fern-api 0.84.7 → 0.84.8
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 +2 -2
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -2160,7 +2160,7 @@ ${Cby.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&z_f(th
|
|
|
2160
2160
|
`+$ua.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?$ua.default.cyan(xby(t,this.opt.mask)):$ua.default.italic($ua.default.dim("[hidden]")):this.opt.mask?xby(t,this.opt.mask):$ua.default.italic($ua.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 Bjs=fa(Gue(),1);var xgy=fa(mhf(),1),Mjs=require("child_process"),oZa=require("fs"),Cjs=fa(require("path"),1),zgy=fa(require("os"),1),Qgy=require("crypto"),iyf=fa(Ngy(),1);var Ejs=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var HGo=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var Sjs=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var Djs=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function Ijs(e="",t,r){let n=new ayf(e,r);n.runAsync((i,a)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,a)}catch(o){setImmediate(t,o,void 0)}})}function Fgy(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function HZD(e){let t=[],r="";for(let n=0;n<e.length;n++){let i=e.charAt(n);n>0&&i===" "&&e[n-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${i}`}return r.length>0&&t.push(r),t}var ayf=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=HZD(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??zgy.default.tmpdir(),r=(0,Qgy.randomUUID)(),n=Fgy(this.fileOptions.prefix),i=Fgy(this.fileOptions.postfix),a=`${n}${r}${i}`,o=Cjs.default.resolve(t,a),c=Cjs.default.resolve(t)+Cjs.default.sep;if(!o.startsWith(c))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=o;let d={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(d.mode=this.fileOptions.mode),(0,oZa.writeFileSync)(this.tempFile,this.text,d)}catch(t){throw new Ejs(t)}}readTemporaryFile(){try{let t=(0,oZa.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,xgy.detect)(t)??"utf8";iyf.default.encodingExists(r)||(r="utf8"),this.text=iyf.default.decode(t,r)}}catch(t){throw new Sjs(t)}}removeTemporaryFile(){try{(0,oZa.unlinkSync)(this.tempFile)}catch(t){throw new Djs(t)}}launchEditor(){try{let t=(0,Mjs.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new HGo(t)}}launchEditorAsync(t){try{(0,Mjs.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new HGo(r)}}};var Lgy=fa(dnt(),1);var GGo=class extends Jue{_run(t){this.done=t,this.editorResult=new Lgy.Subject;let r=Sbe(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,i=this.handleSubmitEvents(this.editorResult);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,n?this.render():this.startExternalEditor(),this}render(t){let r="",n=this.getQuestion();n+=this.status==="answered"?Bjs.default.dim("Received"):Bjs.default.dim("Press <enter> to launch your preferred editor."),t&&(r=Bjs.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),Ijs(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 Ggy=require("stream");var Wgy=fa(require("readline"),1),Hgy=fa(Vgy(),1),kua=class{constructor(t){this.rl||=Wgy.default.createInterface(JZD(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 JZD(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new Hgy.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var JGo=class extends kua{constructor(t={}){super(t),this.log=new Ggy.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return MGo(this.rl,this.bottomBar.split(`
|
|
2161
2161
|
`).length),this}updateBottomBar(t){return MGo(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+`
|
|
2162
2162
|
`}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&&ejs(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var q6=fa(dnt(),1),$gy=fa(XHo(),1);var Tjs=fa(dnt(),1),Jgy=fa(XHo(),1),qjs=function(e,t,r){return typeof e[t]!="function"?(0,Tjs.of)(e):(0,Tjs.from)((0,Jgy.default)(e[t])(r).then(n=>(e[t]=n,e)))};var Kgy={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,a,o)=>{i==="__proto__"||i==="constructor"||(a===o.length-1?n[i]=r:(!(i in n)||typeof n[i]!="object")&&(n[i]={}),n=n[i])})},get:(e,t="",r)=>{let n=a=>String.prototype.split.call(t,a).filter(Boolean).reduce((o,c)=>o!=null?o[c]:o,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},uZa=class extends kua{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let n;return Array.isArray(t)?n=(0,q6.from)(t):(0,q6.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,q6.from)(Object.entries(t).map(([i,a])=>({name:i,...a}))):n=(0,q6.from)([t]),this.process=n.pipe((0,q6.concatMap)(this.processQuestion.bind(this)),(0,q6.publish)()),this.process.connect(),this.process.pipe((0,q6.reduce)((i,a)=>(Kgy.set(i,a.name,a.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,q6.defer)(()=>(0,q6.of)(t).pipe((0,q6.concatMap)(this.setDefaultType.bind(this)),(0,q6.concatMap)(this.filterIfRunnable.bind(this)),(0,q6.concatMap)(()=>qjs(t,"message",this.answers)),(0,q6.concatMap)(()=>qjs(t,"default",this.answers)),(0,q6.concatMap)(()=>qjs(t,"choices",this.answers)),(0,q6.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,q6.defer)(()=>(0,q6.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,q6.defer)(()=>(0,q6.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&Kgy.get(this.answers,t.name)!==void 0)return q6.EMPTY;if(t.when===!1)return q6.EMPTY;if(typeof t.when!="function")return(0,q6.of)(t);let{answers:r}=this;return(0,q6.defer)(()=>(0,q6.from)((0,$gy.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,q6.filter)(n=>n!=null)))}};function Ygy(e){let t=function(r,n){let i;try{i=new uZa(t.prompts,e)}catch(o){return Promise.reject(o)}let a=i.run(r,n);return a.ui=i,a};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",BGo),this.registerPrompt("input",Kua),this.registerPrompt("number",TGo),this.registerPrompt("confirm",qGo),this.registerPrompt("rawlist",RGo),this.registerPrompt("expand",NGo),this.registerPrompt("checkbox",FGo),this.registerPrompt("password",xGo),this.registerPrompt("editor",GGo)},t.restoreDefaultPrompts(),t}var uyf=Ygy();function $ZD(e,t){uyf.registerPrompt(e,t)}function YZD(){uyf.restoreDefaultPrompts()}var XZD={prompt:uyf,ui:{BottomBar:JGo,Prompt:uZa},createPromptModule:Ygy,registerPrompt:$ZD,restoreDefaultPrompts:YZD,Separator:Pxe},Rjs=XZD;var mZa=require("path"),Nmy=require("fs"),Fmy=require("readline"),umy="posthog-node";function xtC(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"]}={}){return a=>{if(!(i==="*"||i.includes(a.level)))return a;a.tags||(a.tags={});let c=a.tags[i1s.POSTHOG_ID_TAG];if(c===void 0)return a;let d=e.options.host??"https://us.i.posthog.com",s=new URL(`/project/${e.apiKey}/person/${c}`,d).toString();a.tags["PostHog Person URL"]=s;let u=a.exception?.values||[],l=u.map(A=>({...A,stacktrace:A.stacktrace?{...A.stacktrace,type:"raw",frames:(A.stacktrace.frames||[]).map(P=>({...P,platform:"node:javascript"}))}:void 0})),m={$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&&(m.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:c,properties:m}),a}}var i1s=class{constructor(t,r,n,i){this.name=umy,this.name=umy,this.setupOnce=function(a,o){let c=o()?.getClient()?.getDsn()?.projectId;a(xtC(t,{organization:r,projectId:c,prefix:n,severityAllowList:i}))}}};i1s.POSTHOG_ID_TAG="posthog_distinct_id";var kjs="0123456789abcdef",a1s=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,n,i){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||t<0||r<0||n<0||i<0||t>0xffffffffffff||r>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|n>>>24,a[9]=n>>>16,a[10]=n>>>8,a[11]=n,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break}if(r){let n=new Uint8Array(16);for(let i=0;i<16;i+=4){let a=parseInt(r.substring(2*i,2*i+8),16);n[i+0]=a>>>24,n[i+1]=a>>>16,n[i+2]=a>>>8,n[i+3]=a}return new e(n)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=kjs.charAt(this.bytes[r]>>>4),t+=kjs.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+=kjs.charAt(this.bytes[r]>>>4),t+=kjs.charAt(this.bytes[r]&15);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let n=this.bytes[r]-t.bytes[r];if(n!==0)return Math.sign(n)}return 0}},$yf=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??ztC()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let n=this.generateOrAbortCore(t,r);return n===void 0&&(this.timestamp=0,n=this.generateOrAbortCore(t,r)),n}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return a1s.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,a1s.ofInner(t)}},ztC=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),smy,Yyf=()=>QtC().toString(),QtC=()=>(smy||(smy=new $yf)).generate();function LtC(e,t){let r=!1;return Object.assign(n=>{let a=global.process.listeners("uncaughtException").filter(o=>o.name!=="domainUncaughtExceptionClear"&&o._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t())},{_posthogErrorHandler:!0})}function UtC(e,t){global.process.on("uncaughtException",LtC(e,t))}function VtC(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var e1s,cmy,t1s;function WtC(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return t1s&&r.length===cmy||(cmy=r.length,t1s=r.reduce((n,i)=>{e1s||(e1s={});let a=e1s[i];if(a)n[a[0]]=a[1];else{let o=e(i);for(let c=o.length-1;c>=0;c--){let s=o[c]?.filename,u=t[i];if(s&&u){n[s]=u,e1s[i]=[s,u];break}}}return n},{})),t1s}function HtC(e){return typeof Event<"u"&&xmy(e,Event)}function GtC(e){return zmy(e,"Object")}function ivf(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return xmy(e,Error)}}function xmy(e,t){try{return e instanceof t}catch{return!1}}function JtC(e){return zmy(e,"ErrorEvent")}function zmy(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function KtC(e,t,r,n){let a=n&&n.mechanism||{handled:!0,type:"generic"},o=Qmy(a,r,n);return{$exception_list:await Promise.all(o.map(async s=>{let u=await trC(e,t,s);return u.value=u.value||"",u.type=u.type||"Error",u.mechanism=a,u}))}}function Qmy(e,t,r){let n=$tC(e,t,r);return n.cause?[n,...Qmy(e,n.cause,r)]:[n]}function $tC(e,t,r){if(ivf(t))return t;if(e.synthetic=!0,GtC(t)){let i=YtC(t);if(i)return i;let a=XtC(t),o=r?.syntheticException||new Error(a);return o.message=a,o}let n=r?.syntheticException||new Error(t);return n.message=`${t}`,n}function YtC(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(ivf(r))return r}}function XtC(e){if("name"in e&&typeof e.name=="string"){let n=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(n+=` with message '${e.message}'`),n}else if("message"in e&&typeof e.message=="string")return e.message;let t=ktC(e);if(JtC(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=ZtC(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function ZtC(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function ktC(e,t=40){let r=Object.keys(erC(e));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=t)return lmy(n,t);for(let i=r.length;i>0;i--){let a=r.slice(0,i).join(", ");if(!(a.length>t))return i===r.length?a:lmy(a,t)}return""}function lmy(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function erC(e){return ivf(e)?{message:e.message,name:e.name,stack:e.stack,...fmy(e)}:HtC(e)?{type:e.type,target:dmy(e.target),currentTarget:dmy(e.currentTarget),...fmy(e)}:e}function fmy(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 dmy(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function trC(e,t,r){let n={type:r.name||r.constructor.name,value:r.message},i=rrC(e,r);for(let a of t)i=await a(i);return i.length&&(n.stacktrace={frames:i,type:"raw"}),n}function rrC(e,t){return nrC(e(t.stack||"",1),e)}function nrC(e,t){let r=WtC(t);return e.forEach(n=>{n.filename&&(n.chunk_id=r[n.filename])}),e}var irC=2e3,vZa=class e{static async captureException(t,r,n,i,a){let o={...a};i||(o.$process_person_profile=!1);let c=await KtC(this.stackParser,this.frameModifiers,r,n);t.capture({event:"$exception",distinctId:i||Yyf(),properties:{...c,...o}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(UtC(this.onException.bind(this),this.onFatalError.bind(this)),VtC(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(irC)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function arC(e=process.argv[1]?(0,mZa.dirname)(process.argv[1]):process.cwd(),t=mZa.sep==="\\"){let r=t?pmy(e):e;return n=>{if(!n)return;let i=t?pmy(n):n,{dir:a,base:o,ext:c}=mZa.posix.parse(i);(c===".js"||c===".mjs"||c===".cjs")&&(o=o.slice(0,c.length*-1));let d=decodeURIComponent(o);a||(a=".");let s=a.lastIndexOf("/node_modules");if(s>-1)return`${a.slice(s+14).replace(/\//g,".")}:${d}`;if(a.startsWith(r)){let u=a.slice(r.length+1).replace(/\//g,".");return u?`${u}:${d}`:d}return d}}function pmy(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var o1s=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)}}},n1s=new o1s(25),Lmy=new o1s(20),avf=7,orC=1e3,urC=1e4;async function srC(e){let t={};for(let i=e.length-1;i>=0;i--){let a=e[i],o=a?.filename;if(!a||typeof o!="string"||typeof a.lineno!="number"||drC(o)||prC(a))continue;t[o]||(t[o]=[]),t[o].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(Lmy.get(i))continue;let a=t[i];if(!a)continue;a.sort((d,s)=>d-s);let o=hrC(a);if(o.every(d=>_rC(i,d)))continue;let c=yrC(n1s,i,{});n.push(crC(i,o,c))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&lrC(e,n1s),n1s.reduce(),e}function crC(e,t,r){return new Promise(n=>{let i=(0,Nmy.createReadStream)(e),a=(0,Fmy.createInterface)({input:i});function o(){i.destroy(),n()}let c=0,d=0,s=t[d];if(s===void 0){o();return}let u=s[0],l=s[1];function m(){Lmy.set(e,1),a.close(),a.removeAllListeners(),o()}i.on("error",m),a.on("error",m),a.on("close",o),a.on("line",A=>{if(c++,!(c<u)&&(r[c]=vrC(A,0),c>=l)){if(d===t.length-1){a.close(),a.removeAllListeners();return}d++;let P=t[d];if(P===void 0){a.close(),a.removeAllListeners();return}u=P[0],l=P[1]}})})}function lrC(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;frC(r.lineno,r,n)}}function frC(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=Umy(e);i<e;i++){let a=r[i];if(a===void 0){_my(t);return}t.pre_context.push(a)}if(r[e]===void 0){_my(t);return}t.context_line=r[e];let n=Vmy(e);t.post_context=[];for(let i=e+1;i<=n;i++){let a=r[i];if(a===void 0)break;t.post_context.push(a)}}function _my(e){delete e.pre_context,delete e.context_line,delete e.post_context}function drC(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function prC(e){return e.lineno!==void 0&&e.lineno>urC||e.colno!==void 0&&e.colno>orC}function _rC(e,t){let r=n1s.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function hrC(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=hmy(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let a=e[t+1];if(typeof a!="number")break;a<=n[1]?n[1]=a+avf:(i.push(n),n=hmy(a)),t++}return i}function hmy(e){return[Umy(e),Vmy(e)]}function Umy(e){return Math.max(1,e-avf)}function Vmy(e){return e+avf}function yrC(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function vrC(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let a=Math.min(i+140,n);return a>n-5&&(a=n),a===n&&(i=Math.max(a-140,0)),r=r.slice(i,a),i>0&&(r=`...${r}`),a<n&&(r+="..."),r}var brC="4.18.0",Dxe;(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"})(Dxe||(Dxe={}));var ymy;(function(e){e.Left="left",e.Right="right",e.Center="center"})(ymy||(ymy={}));var vmy;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(vmy||(vmy={}));var bmy;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(bmy||(bmy={}));var gmy;(function(e){e.Html="html",e.Text="text"})(gmy||(gmy={}));var mmy;(function(e){e.Number="number",e.Emoji="emoji"})(mmy||(mmy={}));var Omy;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(Omy||(Omy={}));var Amy;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(Amy||(Amy={}));var Pmy;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(Pmy||(Pmy={}));var wmy;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(wmy||(wmy={}));var grC=e=>{if("flags"in e){let t=OrC(e.flags),r=ArC(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,a])=>[i,Wmy(a)])),n=Object.fromEntries(Object.entries(t).map(([i,a])=>[i,mrC(i,a,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function mrC(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 OrC=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,ovf(r)]).filter(([,t])=>t!==void 0)),ArC=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let n=t[r];return n.enabled&&n.metadata&&n.metadata.payload!==void 0}).map(r=>{let n=t[r].metadata?.payload;return[r,n?Wmy(n):void 0]}))},ovf=e=>e===void 0?void 0:e.variant??e.enabled,Wmy=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},PrC=1,wrC=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"]),jrC="utf8";function ErC(e,t){if(!e||typeof e!="string"||SrC(e))throw new Error(t)}function SrC(e){return e.trim().length===0}function DrC(e){return e?.replace(/\/+$/,"")}async function CrC(e,t){let r=null;for(let n=0;n<t.retryCount+1;n++){n>0&&await new Promise(i=>setTimeout(i,t.retryDelay));try{return await e()}catch(i){if(r=i,!t.retryCheck(i))throw i}}throw r}function jmy(){return new Date().getTime()}function Jyf(){return new Date().toISOString()}function u1s(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function MrC(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function IrC(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 BrC(e,t=0,r){let n=IrC(e);return r?.has(n)?!1:parseInt(n,16)/4294967295<t}function Emy(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var nJo=String.fromCharCode,Smy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r1s={};function TrC(e,t){if(!r1s[e]){r1s[e]={};for(let r=0;r<e.length;r++)r1s[e][e.charAt(r)]=r}return r1s[e][t]}var hZa={compressToBase64:function(e){if(e==null)return"";let t=hZa._compress(e,6,function(r){return Smy.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:hZa._decompress(e.length,32,function(t){return TrC(Smy,e.charAt(t))})},compress:function(e){return hZa._compress(e,16,function(t){return nJo(t)})},_compress:function(e,t,r){if(e==null)return"";let n={},i={},a=[],o,c,d="",s="",u="",l=2,m=3,A=2,P=0,C=0,I;for(I=0;I<e.length;I+=1)if(d=e.charAt(I),Object.prototype.hasOwnProperty.call(n,d)||(n[d]=m++,i[d]=!0),s=u+d,Object.prototype.hasOwnProperty.call(n,s))u=s;else{if(Object.prototype.hasOwnProperty.call(i,u)){if(u.charCodeAt(0)<256){for(o=0;o<A;o++)P=P<<1,C==t-1?(C=0,a.push(r(P)),P=0):C++;for(c=u.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<A;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=u.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,A),A++),delete i[u]}else for(c=n[u],o=0;o<A;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,A),A++),n[s]=m++,u=String(d)}if(u!==""){if(Object.prototype.hasOwnProperty.call(i,u)){if(u.charCodeAt(0)<256){for(o=0;o<A;o++)P=P<<1,C==t-1?(C=0,a.push(r(P)),P=0):C++;for(c=u.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<A;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=u.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,A),A++),delete i[u]}else for(c=n[u],o=0;o<A;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,A),A++)}for(c=2,o=0;o<A;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;for(;;)if(P=P<<1,C==t-1){a.push(r(P));break}else C++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:hZa._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let n=[],i=[],a={val:r(0),position:t,index:1},o=4,c=4,d=3,s="",u,l,m,A,P,C,I;for(u=0;u<3;u+=1)n[u]=u;for(m=0,P=Math.pow(2,2),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;switch(m){case 0:for(m=0,P=Math.pow(2,8),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;I=nJo(m);break;case 1:for(m=0,P=Math.pow(2,16),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;I=nJo(m);break;case 2:return""}for(n[3]=I,l=I,i.push(I);;){if(a.index>e)return"";for(m=0,P=Math.pow(2,d),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;switch(I=m){case 0:for(m=0,P=Math.pow(2,8),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;n[c++]=nJo(m),I=c-1,o--;break;case 1:for(m=0,P=Math.pow(2,16),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;n[c++]=nJo(m),I=c-1,o--;break;case 2:return i.join("")}if(o==0&&(o=Math.pow(2,d),d++),n[I])s=n[I];else if(I===c)s=l+l.charAt(0);else return null;i.push(s),n[c++]=l+s.charAt(0),o--,l=s,o==0&&(o=Math.pow(2,d),d++)}}},Xyf=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(n=>n!==r)}}emit(t,r){for(let n of this.events[t]||[])n(r);for(let n of this.events["*"]||[])n(t,r)}},bZa=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()}},iJo=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function Dmy(e){if(e instanceof bZa){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 Kyf(e){return typeof e=="object"&&(e instanceof bZa||e instanceof iJo)}function Cmy(e){return typeof e=="object"&&e instanceof bZa&&e.status===413}var Zyf;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(Zyf||(Zyf={}));var kyf=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new Xyf,this._isInitialized=!1,ErC(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=DrC(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:Kyf},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(Dxe.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(Dxe.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(Dxe.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(n,i)=>console.log("PostHog Debug",n,i));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=Yyf();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,n){this.wrap(()=>{let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",i,n)})}async identifyStatelessImmediate(t,r,n){let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",i,n)}captureStateless(t,r,n,i){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:n});this.enqueue("capture",a,i)})}async captureStatelessImmediate(t,r,n,i){let a=this.buildPayload({distinct_id:t,event:r,properties:n});await this.sendImmediate("capture",a,i)}aliasStateless(t,r,n,i){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});this.enqueue("alias",a,i)})}async aliasStatelessImmediate(t,r,n,i){let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",a,i)}groupIdentifyStateless(t,r,n,i,a,o){this.wrap(()=>{let c=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...o||{}}});this.enqueue("capture",c,i)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,n,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(i=>i.json()).catch(i=>{this.logMsgIfDebug(()=>console.error("Remote config could not be loaded",i)),this._events.emit("error",i)})}async getDecide(t,r={},n={},i={},a={}){await this._initPromise;let c=BrC(this.apiKey,PrC,wrC)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,d={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...a})};return this.logMsgIfDebug(()=>console.log("PostHog Debug","Decide URL",c)),this.fetchWithRetry(c,d,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(s=>s.json()).then(s=>grC(s)).catch(s=>{this._events.emit("error",s)})}async getFeatureFlagStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailStateless(t,r,n,i,a,o);if(c===void 0)return{response:void 0,requestId:void 0};let d=ovf(c.response);return d===void 0&&(d=!1),{response:d,requestId:c.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(r,n,i,a,o,[t]);return c===void 0?void 0:{response:c.flags[t],requestId:c.requestId}}async getFeatureFlagPayloadStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagPayloadsStateless(r,n,i,a,o,[t]);if(!c)return;let d=c[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},a,o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},a,o){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(t,r,n,i,a,o);return c?{flags:c.featureFlags,payloads:c.featureFlagPayloads,requestId:c.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c={};(a??this.disableGeoip)&&(c.geoip_disable=!0),o&&(c.flag_keys_to_evaluate=o);let d=await this.getDecide(t,r,n,i,c);if(d!==void 0)return d.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"),d.quotaLimited?.includes(Zyf.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:d?.requestId}):d}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this.logMsgIfDebug(()=>console.log("PostHog Debug","Loading surveys is disabled.")),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},i=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let o=`Surveys API could not be loaded: ${a.status}`,c=new Error(o);this.logMsgIfDebug(()=>console.error(c)),this._events.emit("error",new Error(o));return}return a.json()}).catch(a=>{this.logMsgIfDebug(()=>console.error("Surveys API could not be loaded",a)),this._events.emit("error",a)}))?.surveys;return i&&this.logMsgIfDebug(()=>console.log("PostHog Debug","Surveys fetched from API: ",JSON.stringify(i))),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(Dxe.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(Dxe.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(Dxe.Props,this.props)})}enqueue(t,r,n){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let i=this.prepareMessage(t,r,n),a=this.getPersistedProperty(Dxe.Queue)||[];a.length>=this.maxQueueSize&&(a.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),a.push({message:i}),this.setPersistedProperty(Dxe.Queue,a),this._events.emit(t,i),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=u1s(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,n){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized||await this._initPromise,this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let i={api_key:this.apiKey,batch:[this.prepareMessage(t,r,n)],sent_at:Jyf()};this.historicalMigration&&(i.historical_migration=!0);let a=JSON.stringify(i),o=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${jmy()}&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(hZa.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(o,c)}catch(d){this._events.emit("error",d)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:Jyf(),uuid:n?.uuid?n.uuid:Yyf()};return(n?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await Dmy(t)})}async flush(){let t=Emy([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),Emy([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(Dxe.Queue)||[];if(!t.length)return;let r=[],n=t.length;for(;t.length>0&&r.length<n;){let i=t.slice(0,this.maxBatchSize),a=i.map(m=>m.message),o=()=>{let A=(this.getPersistedProperty(Dxe.Queue)||[]).slice(i.length);this.setPersistedProperty(Dxe.Queue,A),t=A},c={api_key:this.apiKey,batch:a,sent_at:Jyf()};this.historicalMigration&&(c.historical_migration=!0);let d=JSON.stringify(c),s=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${jmy()}&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(hZa.compressToBase64(d))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:d},l={retryCheck:m=>Cmy(m)?!1:Kyf(m)};try{await this.fetchWithRetry(s,u,l)}catch(m){if(Cmy(m)&&a.length>1){this.maxBatchSize=Math.max(1,Math.floor(a.length/2)),this.logMsgIfDebug(()=>console.warn(`Received 413 when sending batch of size ${a.length}, reducing batch size to ${this.maxBatchSize}`));continue}throw m instanceof iJo||o(),this._events.emit("error",m),m}o(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){var a;(a=AbortSignal).timeout??(a.timeout=function(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,jrC)}catch{c=new TextEncoder().encode(o).length}return await CrC(async()=>{let d=null;try{d=await this.fetch(t,{signal:AbortSignal.timeout(i??this.requestTimeout),...r})}catch(u){throw new iJo(u)}if(!(r.mode==="no-cors")&&(d.status<200||d.status>=400))throw new bZa(d,c);return d},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let n=async()=>{try{for(await Promise.all(Object.values(this.pendingPromises));!((this.getPersistedProperty(Dxe.Queue)||[]).length===0||(await this.flush(),r)););}catch(i){if(!Kyf(i))throw i;await Dmy(i)}};return Promise.race([new Promise((i,a)=>{u1s(()=>{this.logMsgIfDebug(()=>console.error("Timed out while shutting down PostHog")),r=!0,a("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),n()])}async shutdown(t=3e4){return this.shutdownPromise?this.logMsgIfDebug(()=>console.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup")):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}},evf=MrC();if(!evf){let e=omy();evf=async(t,r)=>{let n=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:n.status,text:async()=>n.data,json:async()=>n.data}}}var Hmy=evf,s1s=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()}},Gmy=new s1s(async()=>{try{return await import("crypto")}catch{return}});async function qrC(){return await Gmy.getValue()}var RrC=new s1s(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await Gmy.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function NrC(){return await RrC.getValue()}async function FrC(e){let t=await qrC();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await NrC();if(r){let n=await r.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(n)).map(a=>a.toString(16).padStart(2,"0")).join("")}throw new Error("No crypto implementation available. Tried Node Crypto API and Web SubtleCrypto API")}var xrC=60*1e3,zrC=1152921504606847e3,QrC=["is_not"],yZa=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},Kue=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},tvf=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:a,customHeaders:o,...c}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=a,this.poller=void 0,this.fetch=c.fetch||Hmy,this.onError=c.onError,this.customHeaders=o,this.onLoad=c.onLoad,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,n={},i={},a={}){await this.loadFeatureFlags();let o,c;if(!this.loadedSuccessfullyOnce)return o;for(let d of this.featureFlags)if(t===d.key){c=d;break}if(c!==void 0)try{o=await this.computeFlagLocally(c,r,n,i,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${o}`))}catch(d){d instanceof Kue?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${d}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return o}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let n;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),n==null)return null;try{return JSON.parse(n)}catch{return n}}}async getAllFlagsAndPayloads(t,r={},n={},i={}){await this.loadFeatureFlags();let a={},o={},c=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async d=>{try{let s=await this.computeFlagLocally(d,t,r,n,i);a[d.key]=s;let u=await this.computeFeatureFlagPayloadLocally(d.key,s);u&&(o[d.key]=u)}catch(s){s instanceof Kue||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),c=!0}})),{response:a,payloads:o,fallbackToDecide:c}}async computeFlagLocally(t,r,n={},i={},a={}){if(t.ensure_experience_continuity)throw new Kue("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let d=this.groupTypeMapping[String(c)];if(!d)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new Kue("Flag has unknown group type index");if(!(d in n))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[d];return await this.matchFeatureFlagProperties(t,n[d],s)}else return await this.matchFeatureFlagProperties(t,r,i)}async matchFeatureFlagProperties(t,r,n){let i=t.filters||{},a=i.groups||[],o=!1,c,d=[...a].sort((s,u)=>{let l=!!s.variant,m=!!u.variant;return l&&m?0:l?-1:m?1:0});for(let s of d)try{if(await this.isConditionMatch(t,r,s,n)){let u=s.variant,l=i.multivariate?.variants||[];u&&l.some(m=>m.key===u)?c=u:c=await this.getMatchingVariant(t,r)||!0;break}}catch(u){if(u instanceof Kue)o=!0;else throw u}if(c!==void 0)return c;if(o)throw new Kue("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i){let a=n.rollout_percentage,o=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let d=c.type,s=!1;if(d==="cohort"?s=Kmy(c,i,this.cohorts,this.debugMode):s=Jmy(c,i,o),!s)return!1}if(a==null)return!0}return!(a!=null&&await Mmy(t.key,r)>a/100)}async getMatchingVariant(t,r){let n=await Mmy(t.key,r,"variant"),i=this.variantLookupTable(t).find(a=>n>=a.valueMin&&n<a.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(c=>{i=n+c.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:c.key}),n=i}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(xrC,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 yZa(`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 yZa(`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 yZa(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let r=await t.json()??{};if(!("flags"in r)){this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`));return}this.featureFlags=r.flags??[],this.featureFlagsByKey=this.featureFlags.reduce((n,i)=>(n[i.key]=i,n),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||{},this.loadedSuccessfullyOnce=!0,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.onLoad?.(this.featureFlags.length);break}default:return}}catch(t){t instanceof yZa&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET"){return{method:t,headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions(),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=u1s(()=>{i.abort()},this.timeout),r.signal=i.signal}try{return await this.fetch(t,r)}finally{clearTimeout(n)}}stopPoller(){clearTimeout(this.poller)}_requestRemoteConfigPayload(t){let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config/`,n=this.getPersonalApiKeyRequestOptions(),i=null;if(this.timeout&&typeof this.timeout=="number"){let a=new AbortController;i=u1s(()=>{a.abort()},this.timeout),n.signal=a.signal}try{return this.fetch(r,n)}finally{clearTimeout(i)}}};async function Mmy(e,t,r=""){let n=await FrC(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/zrC}function Jmy(e,t,r){let n=e.key,i=e.value,a=e.operator||"exact";if(n in t){if(a==="is_not_set")throw new Kue("Operator is_not_set is not supported")}else throw new Kue(`Property ${n} not found in propertyValues`);let o=t[n];if(o==null&&!QrC.includes(a))return r&&r(`Property ${n} 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 d(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(i,o);case"is_not":return!c(i,o);case"is_set":return n in t;case"icontains":return String(o).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(i).toLowerCase());case"regex":return Imy(String(i))&&String(o).match(String(i))!==null;case"not_regex":return Imy(String(i))&&String(o).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof i=="number"?i:null;if(typeof i=="string")try{s=parseFloat(i)}catch{}return s!=null&&o!=null?typeof o=="string"?d(o,String(i),a):d(o,s,a):d(String(o),String(i),a)}case"is_date_after":case"is_date_before":{let s=LrC(String(i));if(s==null&&(s=Bmy(i)),s==null)throw new Kue(`Invalid date: ${i}`);let u=Bmy(o);return["is_date_before"].includes(a)?u<s:u>s}default:throw new Kue(`Unknown operator: ${a}`)}}function Kmy(e,t,r,n=!1){let i=String(e.value);if(!(i in r))throw new Kue("can't match cohort without a given cohort property value");let a=r[i];return $my(a,t,r,n)}function $my(e,t,r,n=!1){if(!e)return!0;let i=e.type,a=e.values;if(!a||a.length===0)return!0;let o=!1;if("values"in a[0]){for(let c of a)try{let d=$my(c,t,r,n);if(i==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof Kue)n&&console.debug(`Failed to compute property ${c} locally: ${d}`),o=!0;else throw d}if(o)throw new Kue("Can't match cohort without a given cohort property value");return i==="AND"}else{for(let c of a)try{let d;c.type==="cohort"?d=Kmy(c,t,r,n):d=Jmy(c,t);let s=c.negation||!1;if(i==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof Kue)n&&console.debug(`Failed to compute property ${c} locally: ${d}`),o=!0;else throw d}if(o)throw new Kue("can't match cohort without a given cohort property value");return i==="AND"}}function Imy(e){try{return new RegExp(e),!0}catch{return!1}}function Bmy(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 Kue(`${e} is in an invalid date format`)}else throw new Kue(`The date provided ${e} must be a string, number, or date object`)}function LrC(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let a=r.groups.interval;if(a=="h")n.setUTCHours(n.getUTCHours()-i);else if(a=="d")n.setUTCDate(n.getUTCDate()-i);else if(a=="w")n.setUTCDate(n.getUTCDate()-i*7);else if(a=="m")n.setUTCMonth(n.getUTCMonth()-i);else if(a=="y")n.setUTCFullYear(n.getUTCFullYear()-i);else return null;return n}else return null}var rvf=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},UrC=100,Tmy=30*1e3,VrC=50*1e3,nvf=class extends kyf{constructor(t,r={}){if(super(t,r),this._memoryStorage=new rvf,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,UrC):Tmy,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 tvf({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:n=>{this._events.emit("error",n)},onLoad:n=>{this._events.emit("localEvaluationFlagsLoaded",n)},customHeaders:this.getCustomHeaders()})}this.errorTracking=new vZa(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||VrC}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):Hmy(t,r)}getLibraryVersion(){return brC}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:n,properties:i,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:d,uuid:s}=t,u=A=>{super.captureStateless(r,n,A,{timestamp:c,disableGeoip:d,uuid:s})},l=async(A,P,C)=>(await super.getFeatureFlagsStateless(A,P,void 0,void 0,C)).flags,m=Promise.resolve().then(async()=>{if(o)return await l(r,a,d);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let A={};for(let[P,C]of Object.entries(a||{}))A[P]=String(C);return await this.getAllFlags(r,{groups:A,disableGeoip:d,onlyEvaluateLocally:!0})}return{}}).then(A=>{let P={};if(A)for(let[I,T]of Object.entries(A))P[`$feature/${I}`]=T;let C=Object.keys(A||{}).filter(I=>A?.[I]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(A=>{u({...A,...i,$groups:a})});this.addPendingPromise(m)}async captureImmediate(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:n,properties:i,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:d,uuid:s}=t,u=A=>super.captureStatelessImmediate(r,n,A,{timestamp:c,disableGeoip:d,uuid:s}),l=async(A,P,C)=>(await super.getFeatureFlagsStateless(A,P,void 0,void 0,C)).flags;await Promise.resolve().then(async()=>{if(o)return await l(r,a,d);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let A={};for(let[P,C]of Object.entries(a||{}))A[P]=String(C);return await this.getAllFlags(r,{groups:A,disableGeoip:d,onlyEvaluateLocally:!0})}return{}}).then(A=>{let P={};if(A)for(let[I,T]of Object.entries(A))P[`$feature/${I}`]=T;let C=Object.keys(A||{}).filter(I=>A?.[I]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(A=>{u({...A,...i,$groups:a})})}identify({distinctId:t,properties:r,disableGeoip:n}){let i=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;super.identifyStateless(t,{$set:a,$set_once:i},{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r,disableGeoip:n}){let i=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;await super.identifyStatelessImmediate(t,{$set:a,$set_once:i},{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=Tmy){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(n),i(),r(a>0)})})}async getFeatureFlag(t,r,n){let{groups:i,disableGeoip:a}=n||{},{onlyEvaluateLocally:o,sendFeatureFlagEvents:c,personProperties:d,groupProperties:s}=n||{},u=this.addLocalPersonAndGroupProperties(r,i,d,s);d=u.allPersonProperties,s=u.allGroupProperties,o==null&&(o=!1),c==null&&(c=!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,i,d,s),m=l!==void 0,A,P;if(!m&&!o){let I=await super.getFeatureFlagDetailStateless(t,r,i,d,s,a);if(I===void 0)return;P=I.response,l=ovf(P),A=I?.requestId}let C=`${t}_${l}`;return c&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(C))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(C):this.distinctIdHasSentFlagCalls[r]=[C],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:l,$feature_flag_id:P?.metadata?.id,$feature_flag_version:P?.metadata?.version,$feature_flag_reason:P?.reason?.description??P?.reason?.code,locally_evaluated:m,[`$feature/${t}`]:l,$feature_flag_request_id:A},groups:i,disableGeoip:a})),l}async getFeatureFlagPayload(t,r,n,i){let{groups:a,disableGeoip:o}=i||{},{onlyEvaluateLocally:c,sendFeatureFlagEvents:d,personProperties:s,groupProperties:u}=i||{},l=this.addLocalPersonAndGroupProperties(r,a,s,u);s=l.allPersonProperties,u=l.allGroupProperties;let m;return this.featureFlagsPoller!==void 0&&(n||(n=await this.getFeatureFlag(t,r,{...i,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),n&&(m=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,n))),c==null&&(c=!1),d==null&&(d=!0),c==null&&(c=!1),!(m!==void 0)&&!c&&(m=await super.getFeatureFlagPayloadStateless(t,r,a,s,u,o)),m}async getRemoteConfigPayload(t){return(await this.featureFlagsPoller?._requestRemoteConfigPayload(t))?.json()}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:n,disableGeoip:i}=r||{},{onlyEvaluateLocally:a,personProperties:o,groupProperties:c}=r||{},d=this.addLocalPersonAndGroupProperties(t,n,o,c);o=d.allPersonProperties,c=d.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,n,o,c),u={},l={},m=!0;if(s&&(u=s.response,l=s.payloads,m=s.fallbackToDecide),m&&!a){let A=await super.getFeatureFlagsAndPayloadsStateless(t,n,o,c,i);u={...u,...A.flags||{}},l={...l,...A.payloads||{}}}return{featureFlags:u,featureFlagPayloads:l}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:a}){super.groupIdentifyStateless(t,r,n,{disableGeoip:a},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(),super._shutdown(t)}addLocalPersonAndGroupProperties(t,r,n,i){let a={distinct_id:t,...n||{}},o={};if(r)for(let c of Object.keys(r))o[c]={$group_key:r[c],...i?.[c]||{}};return{allPersonProperties:a,allGroupProperties:o}}captureException(t,r,n){let i=new Error("PostHog syntheticException");vZa.captureException(this,t,{syntheticException:i},r,n)}},qmy=/\(error: (.*)\)/,Ymy=50,Xmy="?";function WrC(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return n=>{let i=n.match(r);if(i){let a,o,c,d,s;if(i[1]){c=i[1];let m=c.lastIndexOf(".");if(c[m-1]==="."&&m--,m>0){a=c.slice(0,m),o=c.slice(m+1);let A=a.indexOf(".Module");A>0&&(c=c.slice(A+1),a=a.slice(0,A))}d=void 0}o&&(d=a,s=o),o==="<anonymous>"&&(s=void 0,c=void 0),c===void 0&&(s=s||Xmy,c=d?`${d}.${s}`:s);let u=i[2]?.startsWith("file://")?i[2].slice(7):i[2],l=i[5]==="native";return u?.match(/\/[A-Z]:/)&&(u=u.slice(1)),!u&&i[5]&&!l&&(u=i[5]),{filename:u?decodeURI(u):void 0,module:e?e(u):void 0,function:c,lineno:Rmy(i[3]),colno:Rmy(i[4]),in_app:HrC(u||"",l),platform:"node:javascript"}}if(n.match(t))return{filename:n,platform:"node:javascript"}}}function HrC(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 Rmy(e){return parseInt(e||"",10)||void 0}function GrC(e){return[90,WrC(e)]}function JrC(e){let r=[GrC(e)].sort((n,i)=>n[0]-i[0]).map(n=>n[1]);return(n,i=0)=>{let a=[],o=n.split(`
|
|
2163
|
-
`);for(let c=i;c<o.length;c++){let d=o[c];if(d.length>1024)continue;let s=qmy.test(d)?d.replace(qmy,"$1"):d;if(!s.match(/\S*Error: /)){for(let u of r){let l=u(s);if(l){a.push(l);break}}if(a.length>=Ymy)break}}return KrC(a)}}function KrC(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,Ymy).map(r=>({...r,filename:r.filename||$rC(t).filename,function:r.function||Xmy}))}function $rC(e){return e[e.length-1]||{}}vZa.stackParser=JrC(arC());vZa.frameModifiers=[srC];var gZa=class extends nvf{getLibraryId(){return"posthog-node"}};var c1s=class{posthog;constructor({posthogApiKey:t}){this.posthog=new gZa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.84.7",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var aJo=class{async sendEvent(){}async identify(){}async flush(){}};var OZa=require("fs/promises"),tOy=require("os"),rOy=require("path");var Zmy=fa(require("crypto")),f1s=new Uint8Array(256),l1s=f1s.length;function uvf(){return l1s>f1s.length-16&&(Zmy.default.randomFillSync(f1s),l1s=0),f1s.slice(l1s,l1s+=16)}var Cbe=[];for(let e=0;e<256;++e)Cbe.push((e+256).toString(16).slice(1));function kmy(e,t=0){return Cbe[e[t+0]]+Cbe[e[t+1]]+Cbe[e[t+2]]+Cbe[e[t+3]]+"-"+Cbe[e[t+4]]+Cbe[e[t+5]]+"-"+Cbe[e[t+6]]+Cbe[e[t+7]]+"-"+Cbe[e[t+8]]+Cbe[e[t+9]]+"-"+Cbe[e[t+10]]+Cbe[e[t+11]]+Cbe[e[t+12]]+Cbe[e[t+13]]+Cbe[e[t+14]]+Cbe[e[t+15]]}var eOy=fa(require("crypto")),svf={randomUUID:eOy.default.randomUUID};function YrC(e,t,r){if(svf.randomUUID&&!t&&!e)return svf.randomUUID();e=e||{};let n=e.random||(e.rng||uvf)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return kmy(n)}var sht=YrC;var XrC="id",ZrC=".fern",oJo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new gZa(r),this.userId=t==null?void 0:Acf(t)}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"0.84.7",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Jl(L_.of((0,tOy.homedir)()),ys.of(ZrC),ys.of(XrC));await Mv(t)||(await(0,OZa.mkdir)((0,rOy.dirname)(t),{recursive:!0}),await(0,OZa.writeFile)(t,sht())),this.persistedDistinctId=(await(0,OZa.readFile)(t)).toString()}return this.persistedDistinctId}};var cvf;async function AZa(){return cvf==null&&(cvf=await krC()),cvf}async function krC(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new aJo;let r=await m0s();return r!=null?new oJo({token:r,posthogApiKey:e}):await AYa()!=null?new c1s({posthogApiKey:e}):new oJo({token:void 0,posthogApiKey:e})}catch{return new aJo}}function uJo(e,t){return function(){return e.apply(t,arguments)}}var{toString:enC}=Object.prototype,{getPrototypeOf:fvf}=Object,{iterator:p1s,toStringTag:iOy}=Symbol,_1s=(e=>t=>{let r=enC.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),QTr=e=>(e=e.toLowerCase(),t=>_1s(t)===e),h1s=e=>t=>typeof t===e,{isArray:wZa}=Array,PZa=h1s("undefined");function sJo(e){return e!==null&&!PZa(e)&&e.constructor!==null&&!PZa(e.constructor)&&Cxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var aOy=QTr("ArrayBuffer");function tnC(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&aOy(e.buffer),t}var rnC=h1s("string"),Cxe=h1s("function"),oOy=h1s("number"),cJo=e=>e!==null&&typeof e=="object",nnC=e=>e===!0||e===!1,d1s=e=>{if(_1s(e)!=="object")return!1;let t=fvf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(iOy in e)&&!(p1s in e)},inC=e=>{if(!cJo(e)||sJo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},anC=QTr("Date"),onC=QTr("File"),unC=QTr("Blob"),snC=QTr("FileList"),cnC=e=>cJo(e)&&Cxe(e.pipe),lnC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Cxe(e.append)&&((t=_1s(e))==="formdata"||t==="object"&&Cxe(e.toString)&&e.toString()==="[object FormData]"))},fnC=QTr("URLSearchParams"),[dnC,pnC,_nC,hnC]=["ReadableStream","Request","Response","Headers"].map(QTr),ynC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function lJo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),wZa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(sJo(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(n=0;n<o;n++)c=a[n],t.call(null,e[c],c,e)}}function uOy(e,t){if(sJo(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var asa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,sOy=e=>!PZa(e)&&e!==asa;function lvf(){let{caseless:e,skipUndefined:t}=sOy(this)&&this||{},r={},n=(i,a)=>{let o=e&&uOy(r,a)||a;d1s(r[o])&&d1s(i)?r[o]=lvf(r[o],i):d1s(i)?r[o]=lvf({},i):wZa(i)?r[o]=i.slice():(!t||!PZa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&lJo(arguments[i],n);return r}var vnC=(e,t,r,{allOwnKeys:n}={})=>(lJo(t,(i,a)=>{r&&Cxe(i)?e[a]=uJo(i,r):e[a]=i},{allOwnKeys:n}),e),bnC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),gnC=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},mnC=(e,t,r,n)=>{let i,a,o,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&fvf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},OnC=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},AnC=e=>{if(!e)return null;if(wZa(e))return e;let t=e.length;if(!oOy(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},PnC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&fvf(Uint8Array)),wnC=(e,t)=>{let n=(e&&e[p1s]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},jnC=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},EnC=QTr("HTMLFormElement"),SnC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),nOy=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),DnC=QTr("RegExp"),cOy=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};lJo(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},CnC=e=>{cOy(e,(t,r)=>{if(Cxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(Cxe(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},MnC=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return wZa(e)?n(e):n(String(e).split(t)),r},InC=()=>{},BnC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function TnC(e){return!!(e&&Cxe(e.append)&&e[iOy]==="FormData"&&e[p1s])}var qnC=e=>{let t=new Array(10),r=(n,i)=>{if(cJo(n)){if(t.indexOf(n)>=0)return;if(sJo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=wZa(n)?[]:{};return lJo(n,(o,c)=>{let d=r(o,i+1);!PZa(d)&&(a[c]=d)}),t[i]=void 0,a}}return n};return r(e,0)},RnC=QTr("AsyncFunction"),NnC=e=>e&&(cJo(e)||Cxe(e))&&Cxe(e.then)&&Cxe(e.catch),lOy=((e,t)=>e?setImmediate:t?((r,n)=>(asa.addEventListener("message",({source:i,data:a})=>{i===asa&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),asa.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Cxe(asa.postMessage)),FnC=typeof queueMicrotask<"u"?queueMicrotask.bind(asa):typeof process<"u"&&process.nextTick||lOy,xnC=e=>e!=null&&Cxe(e[p1s]),Yf={isArray:wZa,isArrayBuffer:aOy,isBuffer:sJo,isFormData:lnC,isArrayBufferView:tnC,isString:rnC,isNumber:oOy,isBoolean:nnC,isObject:cJo,isPlainObject:d1s,isEmptyObject:inC,isReadableStream:dnC,isRequest:pnC,isResponse:_nC,isHeaders:hnC,isUndefined:PZa,isDate:anC,isFile:onC,isBlob:unC,isRegExp:DnC,isFunction:Cxe,isStream:cnC,isURLSearchParams:fnC,isTypedArray:PnC,isFileList:snC,forEach:lJo,merge:lvf,extend:vnC,trim:ynC,stripBOM:bnC,inherits:gnC,toFlatObject:mnC,kindOf:_1s,kindOfTest:QTr,endsWith:OnC,toArray:AnC,forEachEntry:wnC,matchAll:jnC,isHTMLForm:EnC,hasOwnProperty:nOy,hasOwnProp:nOy,reduceDescriptors:cOy,freezeMethods:CnC,toObjectSet:MnC,toCamelCase:SnC,noop:InC,toFiniteNumber:BnC,findKey:uOy,global:asa,isContextDefined:sOy,isSpecCompliantForm:TnC,toJSONObject:qnC,isAsyncFn:RnC,isThenable:NnC,setImmediate:lOy,asap:FnC,isIterable:xnC};function jZa(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Yf.inherits(jZa,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:Yf.toJSONObject(this.config),code:this.code,status:this.status}}});var fOy=jZa.prototype,dOy={};["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=>{dOy[e]={value:e}});Object.defineProperties(jZa,dOy);Object.defineProperty(fOy,"isAxiosError",{value:!0});jZa.from=(e,t,r,n,i,a)=>{let o=Object.create(fOy);Yf.toFlatObject(e,o,function(u){return u!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return jZa.call(o,c,d,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var Pm=jZa;var pOy=fa(xjs(),1),y1s=pOy.default;function dvf(e){return Yf.isPlainObject(e)||Yf.isArray(e)}function hOy(e){return Yf.endsWith(e,"[]")?e.slice(0,-2):e}function _Oy(e,t,r){return e?e.concat(t).map(function(i,a){return i=hOy(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function znC(e){return Yf.isArray(e)&&!e.some(dvf)}var QnC=Yf.toFlatObject(Yf,{},null,function(t){return/^is[A-Z]/.test(t)});function LnC(e,t,r){if(!Yf.isObject(e))throw new TypeError("target must be an object");t=t||new(y1s||FormData),r=Yf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,I){return!Yf.isUndefined(I[C])});let n=r.metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&Yf.isSpecCompliantForm(t);if(!Yf.isFunction(i))throw new TypeError("visitor must be a function");function s(P){if(P===null)return"";if(Yf.isDate(P))return P.toISOString();if(Yf.isBoolean(P))return P.toString();if(!d&&Yf.isBlob(P))throw new Pm("Blob is not supported. Use a Buffer instead.");return Yf.isArrayBuffer(P)||Yf.isTypedArray(P)?d&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function u(P,C,I){let T=P;if(P&&!I&&typeof P=="object"){if(Yf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Yf.isArray(P)&&znC(P)||(Yf.isFileList(P)||Yf.endsWith(C,"[]"))&&(T=Yf.toArray(P)))return C=hOy(C),T.forEach(function(U,R){!(Yf.isUndefined(U)||U===null)&&t.append(o===!0?_Oy([C],R,a):o===null?C:C+"[]",s(U))}),!1}return dvf(P)?!0:(t.append(_Oy(I,C,a),s(P)),!1)}let l=[],m=Object.assign(QnC,{defaultVisitor:u,convertValue:s,isVisitable:dvf});function A(P,C){if(!Yf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Yf.forEach(P,function(T,z){(!(Yf.isUndefined(T)||T===null)&&i.call(t,T,Yf.isString(z)?z.trim():z,C,m))===!0&&A(T,C?C.concat(z):[z])}),l.pop()}}if(!Yf.isObject(e))throw new TypeError("data must be an object");return A(e),t}var X6i=LnC;function yOy(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function vOy(e,t){this._pairs=[],e&&X6i(e,this,t)}var bOy=vOy.prototype;bOy.append=function(t,r){this._pairs.push([t,r])};bOy.toString=function(t){let r=t?function(n){return t.call(this,n,yOy)}:yOy;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var gOy=vOy;function UnC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function osa(e,t,r){if(!t)return e;let n=r&&r.encode||UnC;Yf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Yf.isURLSearchParams(t)?t.toString():new gOy(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var pvf=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Yf.forEach(this.handlers,function(n){n!==null&&t(n)})}},_vf=pvf;var EZa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var POy=fa(require("crypto"),1);var mOy=fa(require("url"),1),OOy=mOy.default.URLSearchParams;var hvf="abcdefghijklmnopqrstuvwxyz",AOy="0123456789",wOy={DIGIT:AOy,ALPHA:hvf,ALPHA_DIGIT:hvf+hvf.toUpperCase()+AOy},VnC=(e=16,t=wOy.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);POy.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},jOy={isNode:!0,classes:{URLSearchParams:OOy,FormData:y1s,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:wOy,generateString:VnC,protocols:["http","https","file","data"]};var bvf={};ff(bvf,{hasBrowserEnv:()=>vvf,hasStandardBrowserEnv:()=>WnC,hasStandardBrowserWebWorkerEnv:()=>HnC,navigator:()=>yvf,origin:()=>GnC});var vvf=typeof window<"u"&&typeof document<"u",yvf=typeof navigator=="object"&&navigator||void 0,WnC=vvf&&(!yvf||["ReactNative","NativeScript","NS"].indexOf(yvf.product)<0),HnC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",GnC=vvf&&window.location.href||"http://localhost";var q2={...bvf,...jOy};function gvf(e,t){return X6i(e,new q2.classes.URLSearchParams,{visitor:function(r,n,i,a){return q2.isNode&&Yf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function JnC(e){return Yf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function KnC(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function $nC(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),d=a>=r.length;return o=!o&&Yf.isArray(i)?i.length:o,d?(Yf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Yf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Yf.isArray(i[o])&&(i[o]=KnC(i[o])),!c)}if(Yf.isFormData(e)&&Yf.isFunction(e.entries)){let r={};return Yf.forEachEntry(e,(n,i)=>{t(JnC(n),i,r,0)}),r}return null}var v1s=$nC;function YnC(e,t,r){if(Yf.isString(e))try{return(t||JSON.parse)(e),Yf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var mvf={transitional:EZa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Yf.isObject(t);if(a&&Yf.isHTMLForm(t)&&(t=new FormData(t)),Yf.isFormData(t))return i?JSON.stringify(v1s(t)):t;if(Yf.isArrayBuffer(t)||Yf.isBuffer(t)||Yf.isStream(t)||Yf.isFile(t)||Yf.isBlob(t)||Yf.isReadableStream(t))return t;if(Yf.isArrayBufferView(t))return t.buffer;if(Yf.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return gvf(t,this.formSerializer).toString();if((c=Yf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return X6i(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),YnC(t)):t}],transformResponse:[function(t){let r=this.transitional||mvf.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Yf.isResponse(t)||Yf.isReadableStream(t))return t;if(t&&Yf.isString(t)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?Pm.from(c,Pm.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:q2.classes.FormData,Blob:q2.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Yf.forEach(["delete","get","head","post","put","patch"],e=>{mvf.headers[e]={}});var SZa=mvf;var XnC=Yf.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"]),EOy=e=>{let t={},r,n,i;return e&&e.split(`
|
|
2163
|
+
`);for(let c=i;c<o.length;c++){let d=o[c];if(d.length>1024)continue;let s=qmy.test(d)?d.replace(qmy,"$1"):d;if(!s.match(/\S*Error: /)){for(let u of r){let l=u(s);if(l){a.push(l);break}}if(a.length>=Ymy)break}}return KrC(a)}}function KrC(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,Ymy).map(r=>({...r,filename:r.filename||$rC(t).filename,function:r.function||Xmy}))}function $rC(e){return e[e.length-1]||{}}vZa.stackParser=JrC(arC());vZa.frameModifiers=[srC];var gZa=class extends nvf{getLibraryId(){return"posthog-node"}};var c1s=class{posthog;constructor({posthogApiKey:t}){this.posthog=new gZa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.84.8",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var aJo=class{async sendEvent(){}async identify(){}async flush(){}};var OZa=require("fs/promises"),tOy=require("os"),rOy=require("path");var Zmy=fa(require("crypto")),f1s=new Uint8Array(256),l1s=f1s.length;function uvf(){return l1s>f1s.length-16&&(Zmy.default.randomFillSync(f1s),l1s=0),f1s.slice(l1s,l1s+=16)}var Cbe=[];for(let e=0;e<256;++e)Cbe.push((e+256).toString(16).slice(1));function kmy(e,t=0){return Cbe[e[t+0]]+Cbe[e[t+1]]+Cbe[e[t+2]]+Cbe[e[t+3]]+"-"+Cbe[e[t+4]]+Cbe[e[t+5]]+"-"+Cbe[e[t+6]]+Cbe[e[t+7]]+"-"+Cbe[e[t+8]]+Cbe[e[t+9]]+"-"+Cbe[e[t+10]]+Cbe[e[t+11]]+Cbe[e[t+12]]+Cbe[e[t+13]]+Cbe[e[t+14]]+Cbe[e[t+15]]}var eOy=fa(require("crypto")),svf={randomUUID:eOy.default.randomUUID};function YrC(e,t,r){if(svf.randomUUID&&!t&&!e)return svf.randomUUID();e=e||{};let n=e.random||(e.rng||uvf)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return kmy(n)}var sht=YrC;var XrC="id",ZrC=".fern",oJo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new gZa(r),this.userId=t==null?void 0:Acf(t)}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"0.84.8",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Jl(L_.of((0,tOy.homedir)()),ys.of(ZrC),ys.of(XrC));await Mv(t)||(await(0,OZa.mkdir)((0,rOy.dirname)(t),{recursive:!0}),await(0,OZa.writeFile)(t,sht())),this.persistedDistinctId=(await(0,OZa.readFile)(t)).toString()}return this.persistedDistinctId}};var cvf;async function AZa(){return cvf==null&&(cvf=await krC()),cvf}async function krC(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new aJo;let r=await m0s();return r!=null?new oJo({token:r,posthogApiKey:e}):await AYa()!=null?new c1s({posthogApiKey:e}):new oJo({token:void 0,posthogApiKey:e})}catch{return new aJo}}function uJo(e,t){return function(){return e.apply(t,arguments)}}var{toString:enC}=Object.prototype,{getPrototypeOf:fvf}=Object,{iterator:p1s,toStringTag:iOy}=Symbol,_1s=(e=>t=>{let r=enC.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),QTr=e=>(e=e.toLowerCase(),t=>_1s(t)===e),h1s=e=>t=>typeof t===e,{isArray:wZa}=Array,PZa=h1s("undefined");function sJo(e){return e!==null&&!PZa(e)&&e.constructor!==null&&!PZa(e.constructor)&&Cxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var aOy=QTr("ArrayBuffer");function tnC(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&aOy(e.buffer),t}var rnC=h1s("string"),Cxe=h1s("function"),oOy=h1s("number"),cJo=e=>e!==null&&typeof e=="object",nnC=e=>e===!0||e===!1,d1s=e=>{if(_1s(e)!=="object")return!1;let t=fvf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(iOy in e)&&!(p1s in e)},inC=e=>{if(!cJo(e)||sJo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},anC=QTr("Date"),onC=QTr("File"),unC=QTr("Blob"),snC=QTr("FileList"),cnC=e=>cJo(e)&&Cxe(e.pipe),lnC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Cxe(e.append)&&((t=_1s(e))==="formdata"||t==="object"&&Cxe(e.toString)&&e.toString()==="[object FormData]"))},fnC=QTr("URLSearchParams"),[dnC,pnC,_nC,hnC]=["ReadableStream","Request","Response","Headers"].map(QTr),ynC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function lJo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),wZa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(sJo(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(n=0;n<o;n++)c=a[n],t.call(null,e[c],c,e)}}function uOy(e,t){if(sJo(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var asa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,sOy=e=>!PZa(e)&&e!==asa;function lvf(){let{caseless:e,skipUndefined:t}=sOy(this)&&this||{},r={},n=(i,a)=>{let o=e&&uOy(r,a)||a;d1s(r[o])&&d1s(i)?r[o]=lvf(r[o],i):d1s(i)?r[o]=lvf({},i):wZa(i)?r[o]=i.slice():(!t||!PZa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&lJo(arguments[i],n);return r}var vnC=(e,t,r,{allOwnKeys:n}={})=>(lJo(t,(i,a)=>{r&&Cxe(i)?e[a]=uJo(i,r):e[a]=i},{allOwnKeys:n}),e),bnC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),gnC=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},mnC=(e,t,r,n)=>{let i,a,o,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&fvf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},OnC=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},AnC=e=>{if(!e)return null;if(wZa(e))return e;let t=e.length;if(!oOy(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},PnC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&fvf(Uint8Array)),wnC=(e,t)=>{let n=(e&&e[p1s]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},jnC=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},EnC=QTr("HTMLFormElement"),SnC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),nOy=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),DnC=QTr("RegExp"),cOy=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};lJo(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},CnC=e=>{cOy(e,(t,r)=>{if(Cxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(Cxe(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},MnC=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return wZa(e)?n(e):n(String(e).split(t)),r},InC=()=>{},BnC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function TnC(e){return!!(e&&Cxe(e.append)&&e[iOy]==="FormData"&&e[p1s])}var qnC=e=>{let t=new Array(10),r=(n,i)=>{if(cJo(n)){if(t.indexOf(n)>=0)return;if(sJo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=wZa(n)?[]:{};return lJo(n,(o,c)=>{let d=r(o,i+1);!PZa(d)&&(a[c]=d)}),t[i]=void 0,a}}return n};return r(e,0)},RnC=QTr("AsyncFunction"),NnC=e=>e&&(cJo(e)||Cxe(e))&&Cxe(e.then)&&Cxe(e.catch),lOy=((e,t)=>e?setImmediate:t?((r,n)=>(asa.addEventListener("message",({source:i,data:a})=>{i===asa&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),asa.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Cxe(asa.postMessage)),FnC=typeof queueMicrotask<"u"?queueMicrotask.bind(asa):typeof process<"u"&&process.nextTick||lOy,xnC=e=>e!=null&&Cxe(e[p1s]),Yf={isArray:wZa,isArrayBuffer:aOy,isBuffer:sJo,isFormData:lnC,isArrayBufferView:tnC,isString:rnC,isNumber:oOy,isBoolean:nnC,isObject:cJo,isPlainObject:d1s,isEmptyObject:inC,isReadableStream:dnC,isRequest:pnC,isResponse:_nC,isHeaders:hnC,isUndefined:PZa,isDate:anC,isFile:onC,isBlob:unC,isRegExp:DnC,isFunction:Cxe,isStream:cnC,isURLSearchParams:fnC,isTypedArray:PnC,isFileList:snC,forEach:lJo,merge:lvf,extend:vnC,trim:ynC,stripBOM:bnC,inherits:gnC,toFlatObject:mnC,kindOf:_1s,kindOfTest:QTr,endsWith:OnC,toArray:AnC,forEachEntry:wnC,matchAll:jnC,isHTMLForm:EnC,hasOwnProperty:nOy,hasOwnProp:nOy,reduceDescriptors:cOy,freezeMethods:CnC,toObjectSet:MnC,toCamelCase:SnC,noop:InC,toFiniteNumber:BnC,findKey:uOy,global:asa,isContextDefined:sOy,isSpecCompliantForm:TnC,toJSONObject:qnC,isAsyncFn:RnC,isThenable:NnC,setImmediate:lOy,asap:FnC,isIterable:xnC};function jZa(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Yf.inherits(jZa,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:Yf.toJSONObject(this.config),code:this.code,status:this.status}}});var fOy=jZa.prototype,dOy={};["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=>{dOy[e]={value:e}});Object.defineProperties(jZa,dOy);Object.defineProperty(fOy,"isAxiosError",{value:!0});jZa.from=(e,t,r,n,i,a)=>{let o=Object.create(fOy);Yf.toFlatObject(e,o,function(u){return u!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return jZa.call(o,c,d,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var Pm=jZa;var pOy=fa(xjs(),1),y1s=pOy.default;function dvf(e){return Yf.isPlainObject(e)||Yf.isArray(e)}function hOy(e){return Yf.endsWith(e,"[]")?e.slice(0,-2):e}function _Oy(e,t,r){return e?e.concat(t).map(function(i,a){return i=hOy(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function znC(e){return Yf.isArray(e)&&!e.some(dvf)}var QnC=Yf.toFlatObject(Yf,{},null,function(t){return/^is[A-Z]/.test(t)});function LnC(e,t,r){if(!Yf.isObject(e))throw new TypeError("target must be an object");t=t||new(y1s||FormData),r=Yf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,I){return!Yf.isUndefined(I[C])});let n=r.metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&Yf.isSpecCompliantForm(t);if(!Yf.isFunction(i))throw new TypeError("visitor must be a function");function s(P){if(P===null)return"";if(Yf.isDate(P))return P.toISOString();if(Yf.isBoolean(P))return P.toString();if(!d&&Yf.isBlob(P))throw new Pm("Blob is not supported. Use a Buffer instead.");return Yf.isArrayBuffer(P)||Yf.isTypedArray(P)?d&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function u(P,C,I){let T=P;if(P&&!I&&typeof P=="object"){if(Yf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Yf.isArray(P)&&znC(P)||(Yf.isFileList(P)||Yf.endsWith(C,"[]"))&&(T=Yf.toArray(P)))return C=hOy(C),T.forEach(function(U,R){!(Yf.isUndefined(U)||U===null)&&t.append(o===!0?_Oy([C],R,a):o===null?C:C+"[]",s(U))}),!1}return dvf(P)?!0:(t.append(_Oy(I,C,a),s(P)),!1)}let l=[],m=Object.assign(QnC,{defaultVisitor:u,convertValue:s,isVisitable:dvf});function A(P,C){if(!Yf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Yf.forEach(P,function(T,z){(!(Yf.isUndefined(T)||T===null)&&i.call(t,T,Yf.isString(z)?z.trim():z,C,m))===!0&&A(T,C?C.concat(z):[z])}),l.pop()}}if(!Yf.isObject(e))throw new TypeError("data must be an object");return A(e),t}var X6i=LnC;function yOy(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function vOy(e,t){this._pairs=[],e&&X6i(e,this,t)}var bOy=vOy.prototype;bOy.append=function(t,r){this._pairs.push([t,r])};bOy.toString=function(t){let r=t?function(n){return t.call(this,n,yOy)}:yOy;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var gOy=vOy;function UnC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function osa(e,t,r){if(!t)return e;let n=r&&r.encode||UnC;Yf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Yf.isURLSearchParams(t)?t.toString():new gOy(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var pvf=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Yf.forEach(this.handlers,function(n){n!==null&&t(n)})}},_vf=pvf;var EZa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var POy=fa(require("crypto"),1);var mOy=fa(require("url"),1),OOy=mOy.default.URLSearchParams;var hvf="abcdefghijklmnopqrstuvwxyz",AOy="0123456789",wOy={DIGIT:AOy,ALPHA:hvf,ALPHA_DIGIT:hvf+hvf.toUpperCase()+AOy},VnC=(e=16,t=wOy.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);POy.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},jOy={isNode:!0,classes:{URLSearchParams:OOy,FormData:y1s,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:wOy,generateString:VnC,protocols:["http","https","file","data"]};var bvf={};ff(bvf,{hasBrowserEnv:()=>vvf,hasStandardBrowserEnv:()=>WnC,hasStandardBrowserWebWorkerEnv:()=>HnC,navigator:()=>yvf,origin:()=>GnC});var vvf=typeof window<"u"&&typeof document<"u",yvf=typeof navigator=="object"&&navigator||void 0,WnC=vvf&&(!yvf||["ReactNative","NativeScript","NS"].indexOf(yvf.product)<0),HnC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",GnC=vvf&&window.location.href||"http://localhost";var q2={...bvf,...jOy};function gvf(e,t){return X6i(e,new q2.classes.URLSearchParams,{visitor:function(r,n,i,a){return q2.isNode&&Yf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function JnC(e){return Yf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function KnC(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function $nC(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),d=a>=r.length;return o=!o&&Yf.isArray(i)?i.length:o,d?(Yf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Yf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Yf.isArray(i[o])&&(i[o]=KnC(i[o])),!c)}if(Yf.isFormData(e)&&Yf.isFunction(e.entries)){let r={};return Yf.forEachEntry(e,(n,i)=>{t(JnC(n),i,r,0)}),r}return null}var v1s=$nC;function YnC(e,t,r){if(Yf.isString(e))try{return(t||JSON.parse)(e),Yf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var mvf={transitional:EZa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Yf.isObject(t);if(a&&Yf.isHTMLForm(t)&&(t=new FormData(t)),Yf.isFormData(t))return i?JSON.stringify(v1s(t)):t;if(Yf.isArrayBuffer(t)||Yf.isBuffer(t)||Yf.isStream(t)||Yf.isFile(t)||Yf.isBlob(t)||Yf.isReadableStream(t))return t;if(Yf.isArrayBufferView(t))return t.buffer;if(Yf.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return gvf(t,this.formSerializer).toString();if((c=Yf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return X6i(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),YnC(t)):t}],transformResponse:[function(t){let r=this.transitional||mvf.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Yf.isResponse(t)||Yf.isReadableStream(t))return t;if(t&&Yf.isString(t)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?Pm.from(c,Pm.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:q2.classes.FormData,Blob:q2.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Yf.forEach(["delete","get","head","post","put","patch"],e=>{mvf.headers[e]={}});var SZa=mvf;var XnC=Yf.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"]),EOy=e=>{let t={},r,n,i;return e&&e.split(`
|
|
2164
2164
|
`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&XnC[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var SOy=Symbol("internals");function fJo(e){return e&&String(e).trim().toLowerCase()}function b1s(e){return e===!1||e==null?e:Yf.isArray(e)?e.map(b1s):String(e)}function ZnC(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var knC=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ovf(e,t,r,n,i){if(Yf.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!Yf.isString(t)){if(Yf.isString(n))return t.indexOf(n)!==-1;if(Yf.isRegExp(n))return n.test(t)}}function eiC(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function tiC(e,t){let r=Yf.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,a,o){return this[n].call(this,t,i,a,o)},configurable:!0})})}var DZa=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function a(c,d,s){let u=fJo(d);if(!u)throw new Error("header name must be a non-empty string");let l=Yf.findKey(i,u);(!l||i[l]===void 0||s===!0||s===void 0&&i[l]!==!1)&&(i[l||d]=b1s(c))}let o=(c,d)=>Yf.forEach(c,(s,u)=>a(s,u,d));if(Yf.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(Yf.isString(t)&&(t=t.trim())&&!knC(t))o(EOy(t),r);else if(Yf.isObject(t)&&Yf.isIterable(t)){let c={},d,s;for(let u of t){if(!Yf.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[s=u[0]]=(d=c[s])?Yf.isArray(d)?[...d,u[1]]:[d,u[1]]:u[1]}o(c,r)}else t!=null&&a(r,t,n);return this}get(t,r){if(t=fJo(t),t){let n=Yf.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return ZnC(i);if(Yf.isFunction(r))return r.call(this,i,n);if(Yf.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=fJo(t),t){let n=Yf.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Ovf(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function a(o){if(o=fJo(o),o){let c=Yf.findKey(n,o);c&&(!r||Ovf(n,n[c],c,r))&&(delete n[c],i=!0)}}return Yf.isArray(t)?t.forEach(a):a(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let a=r[n];(!t||Ovf(this,this[a],a,t,!0))&&(delete this[a],i=!0)}return i}normalize(t){let r=this,n={};return Yf.forEach(this,(i,a)=>{let o=Yf.findKey(n,a);if(o){r[o]=b1s(i),delete r[a];return}let c=t?eiC(a):String(a).trim();c!==a&&delete r[a],r[c]=b1s(i),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return Yf.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&Yf.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
2165
2165
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[SOy]=this[SOy]={accessors:{}}).accessors,i=this.prototype;function a(o){let c=fJo(o);n[c]||(tiC(i,o),n[c]=!0)}return Yf.isArray(t)?t.forEach(a):a(t),this}};DZa.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Yf.reduceDescriptors(DZa.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Yf.freezeMethods(DZa);var p$=DZa;function dJo(e,t){let r=this||SZa,n=t||r,i=p$.from(n.headers),a=n.data;return Yf.forEach(e,function(c){a=c.call(r,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function pJo(e){return!!(e&&e.__CANCEL__)}function DOy(e,t,r){Pm.call(this,e??"canceled",Pm.ERR_CANCELED,t,r),this.name="CanceledError"}Yf.inherits(DOy,Pm,{__CANCEL__:!0});var _nt=DOy;function o9r(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Pm("Request failed with status code "+r.status,[Pm.ERR_BAD_REQUEST,Pm.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Avf(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Pvf(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function usa(e,t,r){let n=!Avf(t);return e&&(n||r==!1)?Pvf(e,t):t}var WOy=fa(zjs(),1),HOy=fa(require("http"),1),GOy=fa(require("https"),1),JOy=fa(require("util"),1),KOy=fa(wyf(),1),GOi=fa(require("zlib"),1);var ssa="1.12.2";function _Jo(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var riC=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function wvf(e,t,r){let n=r&&r.Blob||q2.classes.Blob,i=_Jo(e);if(t===void 0&&n&&(t=!0),i==="data"){e=i.length?e.slice(i.length+1):e;let a=riC.exec(e);if(!a)throw new Pm("Invalid URL",Pm.ERR_INVALID_URL);let o=a[1],c=a[2],d=a[3],s=Buffer.from(decodeURIComponent(d),c?"base64":"utf8");if(t){if(!n)throw new Pm("Blob is not supported",Pm.ERR_NOT_SUPPORT);return new n([s],{type:o})}return s}throw new Pm("Unsupported protocol "+i,Pm.ERR_NOT_SUPPORT)}var lsa=fa(require("stream"),1);var COy=fa(require("stream"),1);var jvf=Symbol("internals"),Evf=class extends COy.default.Transform{constructor(t){t=Yf.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,i)=>!Yf.isUndefined(i[n])),super({readableHighWaterMark:t.chunkSize});let r=this[jvf]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",n=>{n==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[jvf];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let i=this[jvf],a=i.maxRate,o=this.readableHighWaterMark,c=i.timeWindow,d=1e3/c,s=a/d,u=i.minChunkSize!==!1?Math.max(i.minChunkSize,s*.01):0,l=(A,P)=>{let C=Buffer.byteLength(A);i.bytesSeen+=C,i.bytes+=C,i.isCaptured&&this.emit("progress",i.bytesSeen),this.push(A)?process.nextTick(P):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(P)}},m=(A,P)=>{let C=Buffer.byteLength(A),I=null,T=o,z,U=0;if(a){let R=Date.now();(!i.ts||(U=R-i.ts)>=c)&&(i.ts=R,z=s-i.bytes,i.bytes=z<0?-z:0,U=0),z=s-i.bytes}if(a){if(z<=0)return setTimeout(()=>{P(null,A)},c-U);z<T&&(T=z)}T&&C>T&&C-T>u&&(I=A.subarray(T),A=A.subarray(0,T)),l(A,I?()=>{process.nextTick(P,null,I)}:P)};m(t,function A(P,C){if(P)return n(P);C?m(C,A):n(null)})}},Svf=Evf;var $Oy=require("events");var IOy=fa(require("util"),1),BOy=require("stream");var{asyncIterator:MOy}=Symbol,niC=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[MOy]?yield*e[MOy]():yield e},g1s=niC;var iiC=q2.ALPHABET.ALPHA_DIGIT+"-_",hJo=typeof TextEncoder=="function"?new TextEncoder:new IOy.default.TextEncoder,csa=`\r
|
|
2166
2166
|
`,aiC=hJo.encode(csa),oiC=2,Dvf=class{constructor(t,r){let{escapeName:n}=this.constructor,i=Yf.isString(r),a=`Content-Disposition: form-data; name="${n(t)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${csa}`;i?r=hJo.encode(String(r).replace(/\r?\n|\r\n?/g,csa)):a+=`Content-Type: ${r.type||"application/octet-stream"}${csa}`,this.headers=hJo.encode(a+csa),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+oiC,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;Yf.isTypedArray(t)?yield t:yield*g1s(t),yield aiC}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},uiC=(e,t,r)=>{let{tag:n="form-data-boundary",size:i=25,boundary:a=n+"-"+q2.generateString(i,iiC)}=r||{};if(!Yf.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=hJo.encode("--"+a+csa),c=hJo.encode("--"+a+"--"+csa),d=c.byteLength,s=Array.from(e.entries()).map(([l,m])=>{let A=new Dvf(l,m);return d+=A.size,A});d+=o.byteLength*s.length,d=Yf.toFiniteNumber(d);let u={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(u["Content-Length"]=d),t&&t(u),BOy.Readable.from((async function*(){for(let l of s)yield o,yield*l.encode();yield c})())},TOy=uiC;var qOy=fa(require("stream"),1),Cvf=class extends qOy.default.Transform{__transform(t,r,n){this.push(t),n()}_transform(t,r,n){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let i=Buffer.alloc(2);i[0]=120,i[1]=156,this.push(i,r)}this.__transform(t,r,n)}},ROy=Cvf;var siC=(e,t)=>Yf.isAsyncFn(e)?function(...r){let n=r.pop();e.apply(this,r).then(i=>{try{t?n(null,...t(i)):n(null,i)}catch(a){n(a)}},n)}:e,NOy=siC;function ciC(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,a=0,o;return t=t!==void 0?t:1e3,function(d){let s=Date.now(),u=n[a];o||(o=s),r[i]=d,n[i]=s;let l=a,m=0;for(;l!==i;)m+=r[l++],l=l%e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),s-o<t)return;let A=u&&s-u;return A?Math.round(m*1e3/A):void 0}}var FOy=ciC;function liC(e,t){let r=0,n=1e3/t,i,a,o=(s,u=Date.now())=>{r=u,i=null,a&&(clearTimeout(a),a=null),e(...s)};return[(...s)=>{let u=Date.now(),l=u-r;l>=n?o(s,u):(i=s,a||(a=setTimeout(()=>{a=null,o(i)},n-l)))},()=>i&&o(i)]}var xOy=liC;var HOi=(e,t,r=3)=>{let n=0,i=FOy(50,250);return xOy(a=>{let o=a.loaded,c=a.lengthComputable?a.total:void 0,d=o-n,s=i(d),u=o<=c;n=o;let l={loaded:o,total:c,progress:c?o/c:void 0,bytes:d,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)},CZa=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},MZa=e=>(...t)=>Yf.asap(()=>e(...t));function Mvf(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;let t=e.indexOf(",");if(t<0)return 0;let r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let a=n.length,o=n.length;for(let m=0;m<o;m++)if(n.charCodeAt(m)===37&&m+2<o){let A=n.charCodeAt(m+1),P=n.charCodeAt(m+2);(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102)&&(P>=48&&P<=57||P>=65&&P<=70||P>=97&&P<=102)&&(a-=2,m+=2)}let c=0,d=o-1,s=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);d>=0&&(n.charCodeAt(d)===61?(c++,d--):s(d)&&(c++,d-=3)),c===1&&d>=0&&(n.charCodeAt(d)===61||s(d))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(n,"utf8")}var zOy={flush:GOi.default.constants.Z_SYNC_FLUSH,finishFlush:GOi.default.constants.Z_SYNC_FLUSH},fiC={flush:GOi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:GOi.default.constants.BROTLI_OPERATION_FLUSH},QOy=Yf.isFunction(GOi.default.createBrotliDecompress),{http:diC,https:piC}=KOy.default,_iC=/https:?/,LOy=q2.protocols.map(e=>e+":"),UOy=(e,[t,r])=>(e.on("end",r).on("error",r),t);function hiC(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function YOy(e,t,r){let n=t;if(!n&&n!==!1){let i=WOy.default.getProxyForUrl(r);i&&(n=new URL(i))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let a=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let i=n.hostname||n.host;e.hostname=i,e.host=i,e.port=n.port,e.path=r,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(a){YOy(a,t,a.href)}}var yiC=typeof process<"u"&&Yf.kindOf(process)==="process",viC=e=>new Promise((t,r)=>{let n,i,a=(d,s)=>{i||(i=!0,n&&n(d,s))},o=d=>{a(d),t(d)},c=d=>{a(d,!0),r(d)};e(o,c,d=>n=d).catch(c)}),biC=({address:e,family:t})=>{if(!Yf.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},VOy=(e,t)=>biC(Yf.isObject(e)?e:{address:e,family:t}),XOy=yiC&&function(t){return viC(async function(n,i,a){let{data:o,lookup:c,family:d}=t,{responseType:s,responseEncoding:u}=t,l=t.method.toUpperCase(),m,A=!1,P;if(c){let Se=NOy(c,St=>Yf.isArray(St)?St:[St]);c=(St,yt,Re)=>{Se(St,yt,(De,Lt,Xe)=>{if(De)return Re(De);let Yt=Yf.isArray(Lt)?Lt.map(It=>VOy(It)):[VOy(Lt,Xe)];yt.all?Re(De,Yt):Re(De,Yt[0].address,Yt[0].family)})}}let C=new $Oy.EventEmitter,I=()=>{t.cancelToken&&t.cancelToken.unsubscribe(T),t.signal&&t.signal.removeEventListener("abort",T),C.removeAllListeners()};a((Se,St)=>{m=!0,St&&(A=!0,I())});function T(Se){C.emit("abort",!Se||Se.type?new _nt(null,t,P):Se)}C.once("abort",i),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(T),t.signal&&(t.signal.aborted?T():t.signal.addEventListener("abort",T)));let z=usa(t.baseURL,t.url,t.allowAbsoluteUrls),U=new URL(z,q2.hasBrowserEnv?q2.origin:void 0),R=U.protocol||LOy[0];if(R==="data:"){if(t.maxContentLength>-1){let St=String(t.url||z||"");if(Mvf(St)>t.maxContentLength)return i(new Pm("maxContentLength size of "+t.maxContentLength+" exceeded",Pm.ERR_BAD_RESPONSE,t))}let Se;if(l!=="GET")return o9r(n,i,{status:405,statusText:"method not allowed",headers:{},config:t});try{Se=wvf(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(St){throw Pm.from(St,Pm.ERR_BAD_REQUEST,t)}return s==="text"?(Se=Se.toString(u),(!u||u==="utf8")&&(Se=Yf.stripBOM(Se))):s==="stream"&&(Se=lsa.default.Readable.from(Se)),o9r(n,i,{data:Se,status:200,statusText:"OK",headers:new p$,config:t})}if(LOy.indexOf(R)===-1)return i(new Pm("Unsupported protocol "+R,Pm.ERR_BAD_REQUEST,t));let V=p$.from(t.headers).normalize();V.set("User-Agent","axios/"+ssa,!1);let{onUploadProgress:$,onDownloadProgress:re}=t,Y=t.maxRate,te,ne;if(Yf.isSpecCompliantForm(o)){let Se=V.getContentType(/boundary=([-_\w\d]{10,70})/i);o=TOy(o,St=>{V.set(St)},{tag:`axios-${ssa}-boundary`,boundary:Se&&Se[1]||void 0})}else if(Yf.isFormData(o)&&Yf.isFunction(o.getHeaders)){if(V.set(o.getHeaders()),!V.hasContentLength())try{let Se=await JOy.default.promisify(o.getLength).call(o);Number.isFinite(Se)&&Se>=0&&V.setContentLength(Se)}catch{}}else if(Yf.isBlob(o)||Yf.isFile(o))o.size&&V.setContentType(o.type||"application/octet-stream"),V.setContentLength(o.size||0),o=lsa.default.Readable.from(g1s(o));else if(o&&!Yf.isStream(o)){if(!Buffer.isBuffer(o))if(Yf.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(Yf.isString(o))o=Buffer.from(o,"utf-8");else return i(new Pm("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Pm.ERR_BAD_REQUEST,t));if(V.setContentLength(o.length,!1),t.maxBodyLength>-1&&o.length>t.maxBodyLength)return i(new Pm("Request body larger than maxBodyLength limit",Pm.ERR_BAD_REQUEST,t))}let Oe=Yf.toFiniteNumber(V.getContentLength());Yf.isArray(Y)?(te=Y[0],ne=Y[1]):te=ne=Y,o&&($||te)&&(Yf.isStream(o)||(o=lsa.default.Readable.from(o,{objectMode:!1})),o=lsa.default.pipeline([o,new Svf({maxRate:Yf.toFiniteNumber(te)})],Yf.noop),$&&o.on("progress",UOy(o,CZa(Oe,HOi(MZa($),!1,3)))));let ge;if(t.auth){let Se=t.auth.username||"",St=t.auth.password||"";ge=Se+":"+St}if(!ge&&U.username){let Se=U.username,St=U.password;ge=Se+":"+St}ge&&V.delete("authorization");let ve;try{ve=osa(U.pathname+U.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Se){let St=new Error(Se.message);return St.config=t,St.url=t.url,St.exists=!0,i(St)}V.set("Accept-Encoding","gzip, compress, deflate"+(QOy?", br":""),!1);let be={path:ve,method:l,headers:V.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:ge,protocol:R,family:d,beforeRedirect:hiC,beforeRedirects:{}};!Yf.isUndefined(c)&&(be.lookup=c),t.socketPath?be.socketPath=t.socketPath:(be.hostname=U.hostname.startsWith("[")?U.hostname.slice(1,-1):U.hostname,be.port=U.port,YOy(be,t.proxy,R+"//"+U.hostname+(U.port?":"+U.port:"")+be.path));let Ie,Be=_iC.test(be.protocol);if(be.agent=Be?t.httpsAgent:t.httpAgent,t.transport?Ie=t.transport:t.maxRedirects===0?Ie=Be?GOy.default:HOy.default:(t.maxRedirects&&(be.maxRedirects=t.maxRedirects),t.beforeRedirect&&(be.beforeRedirects.config=t.beforeRedirect),Ie=Be?piC:diC),t.maxBodyLength>-1?be.maxBodyLength=t.maxBodyLength:be.maxBodyLength=1/0,t.insecureHTTPParser&&(be.insecureHTTPParser=t.insecureHTTPParser),P=Ie.request(be,function(St){if(P.destroyed)return;let yt=[St],Re=+St.headers["content-length"];if(re||ne){let It=new Svf({maxRate:Yf.toFiniteNumber(ne)});re&&It.on("progress",UOy(It,CZa(Re,HOi(MZa(re),!0,3)))),yt.push(It)}let De=St,Lt=St.req||P;if(t.decompress!==!1&&St.headers["content-encoding"])switch((l==="HEAD"||St.statusCode===204)&&delete St.headers["content-encoding"],(St.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":yt.push(GOi.default.createUnzip(zOy)),delete St.headers["content-encoding"];break;case"deflate":yt.push(new ROy),yt.push(GOi.default.createUnzip(zOy)),delete St.headers["content-encoding"];break;case"br":QOy&&(yt.push(GOi.default.createBrotliDecompress(fiC)),delete St.headers["content-encoding"])}De=yt.length>1?lsa.default.pipeline(yt,Yf.noop):yt[0];let Xe=lsa.default.finished(De,()=>{Xe(),I()}),Yt={status:St.statusCode,statusText:St.statusMessage,headers:new p$(St.headers),config:t,request:Lt};if(s==="stream")Yt.data=De,o9r(n,i,Yt);else{let It=[],Ke=0;De.on("data",function(sr){It.push(sr),Ke+=sr.length,t.maxContentLength>-1&&Ke>t.maxContentLength&&(A=!0,De.destroy(),i(new Pm("maxContentLength size of "+t.maxContentLength+" exceeded",Pm.ERR_BAD_RESPONSE,t,Lt)))}),De.on("aborted",function(){if(A)return;let sr=new Pm("stream has been aborted",Pm.ERR_BAD_RESPONSE,t,Lt);De.destroy(sr),i(sr)}),De.on("error",function(sr){P.destroyed||i(Pm.from(sr,null,t,Lt))}),De.on("end",function(){try{let sr=It.length===1?It[0]:Buffer.concat(It);s!=="arraybuffer"&&(sr=sr.toString(u),(!u||u==="utf8")&&(sr=Yf.stripBOM(sr))),Yt.data=sr}catch(sr){return i(Pm.from(sr,null,t,Yt.request,Yt))}o9r(n,i,Yt)})}C.once("abort",It=>{De.destroyed||(De.emit("error",It),De.destroy())})}),C.once("abort",Se=>{i(Se),P.destroy(Se)}),P.on("error",function(St){i(Pm.from(St,null,t,P))}),P.on("socket",function(St){St.setKeepAlive(!0,1e3*60)}),t.timeout){let Se=parseInt(t.timeout,10);if(Number.isNaN(Se)){i(new Pm("error trying to parse `config.timeout` to int",Pm.ERR_BAD_OPTION_VALUE,t,P));return}P.setTimeout(Se,function(){if(m)return;let yt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",Re=t.transitional||EZa;t.timeoutErrorMessage&&(yt=t.timeoutErrorMessage),i(new Pm(yt,Re.clarifyTimeoutError?Pm.ETIMEDOUT:Pm.ECONNABORTED,t,P)),T()})}if(Yf.isStream(o)){let Se=!1,St=!1;o.on("end",()=>{Se=!0}),o.once("error",yt=>{St=!0,P.destroy(yt)}),o.on("close",()=>{!Se&&!St&&T(new _nt("Request stream has been aborted",t,P))}),o.pipe(P)}else P.end(o)})};var ZOy=q2.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,q2.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(q2.origin),q2.navigator&&/(msie|trident)/i.test(q2.navigator.userAgent)):()=>!0;var kOy=q2.hasStandardBrowserEnv?{write(e,t,r,n,i,a){let o=[e+"="+encodeURIComponent(t)];Yf.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Yf.isString(n)&&o.push("path="+n),Yf.isString(i)&&o.push("domain="+i),a===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var eAy=e=>e instanceof p$?{...e}:e;function LTr(e,t){t=t||{};let r={};function n(s,u,l,m){return Yf.isPlainObject(s)&&Yf.isPlainObject(u)?Yf.merge.call({caseless:m},s,u):Yf.isPlainObject(u)?Yf.merge({},u):Yf.isArray(u)?u.slice():u}function i(s,u,l,m){if(Yf.isUndefined(u)){if(!Yf.isUndefined(s))return n(void 0,s,l,m)}else return n(s,u,l,m)}function a(s,u){if(!Yf.isUndefined(u))return n(void 0,u)}function o(s,u){if(Yf.isUndefined(u)){if(!Yf.isUndefined(s))return n(void 0,s)}else return n(void 0,u)}function c(s,u,l){if(l in t)return n(s,u);if(l in e)return n(void 0,s)}let d={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)=>i(eAy(s),eAy(u),l,!0)};return Yf.forEach(Object.keys({...e,...t}),function(u){let l=d[u]||i,m=l(e[u],t[u],u);Yf.isUndefined(m)&&l!==c||(r[u]=m)}),r}var m1s=e=>{let t=LTr({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=p$.from(o),t.url=osa(usa(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),Yf.isFormData(r)){if(q2.hasStandardBrowserEnv||q2.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Yf.isFunction(r.getHeaders)){let d=r.getHeaders(),s=["content-type","content-length"];Object.entries(d).forEach(([u,l])=>{s.includes(u.toLowerCase())&&o.set(u,l)})}}if(q2.hasStandardBrowserEnv&&(n&&Yf.isFunction(n)&&(n=n(t)),n||n!==!1&&ZOy(t.url))){let d=i&&a&&kOy.read(a);d&&o.set(i,d)}return t};var giC=typeof XMLHttpRequest<"u",tAy=giC&&function(e){return new Promise(function(r,n){let i=m1s(e),a=i.data,o=p$.from(i.headers).normalize(),{responseType:c,onUploadProgress:d,onDownloadProgress:s}=i,u,l,m,A,P;function C(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let I=new XMLHttpRequest;I.open(i.method.toUpperCase(),i.url,!0),I.timeout=i.timeout;function T(){if(!I)return;let U=p$.from("getAllResponseHeaders"in I&&I.getAllResponseHeaders()),V={data:!c||c==="text"||c==="json"?I.responseText:I.response,status:I.status,statusText:I.statusText,headers:U,config:e,request:I};o9r(function(re){r(re),C()},function(re){n(re),C()},V),I=null}"onloadend"in I?I.onloadend=T:I.onreadystatechange=function(){!I||I.readyState!==4||I.status===0&&!(I.responseURL&&I.responseURL.indexOf("file:")===0)||setTimeout(T)},I.onabort=function(){I&&(n(new Pm("Request aborted",Pm.ECONNABORTED,e,I)),I=null)},I.onerror=function(R){let V=R&&R.message?R.message:"Network Error",$=new Pm(V,Pm.ERR_NETWORK,e,I);$.event=R||null,n($),I=null},I.ontimeout=function(){let R=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",V=i.transitional||EZa;i.timeoutErrorMessage&&(R=i.timeoutErrorMessage),n(new Pm(R,V.clarifyTimeoutError?Pm.ETIMEDOUT:Pm.ECONNABORTED,e,I)),I=null},a===void 0&&o.setContentType(null),"setRequestHeader"in I&&Yf.forEach(o.toJSON(),function(R,V){I.setRequestHeader(V,R)}),Yf.isUndefined(i.withCredentials)||(I.withCredentials=!!i.withCredentials),c&&c!=="json"&&(I.responseType=i.responseType),s&&([m,P]=HOi(s,!0),I.addEventListener("progress",m)),d&&I.upload&&([l,A]=HOi(d),I.upload.addEventListener("progress",l),I.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(u=U=>{I&&(n(!U||U.type?new _nt(null,e,I):U),I.abort(),I=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));let z=_Jo(i.url);if(z&&q2.protocols.indexOf(z)===-1){n(new Pm("Unsupported protocol "+z+":",Pm.ERR_BAD_REQUEST,e));return}I.send(a||null)})};var miC=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,a=function(s){if(!i){i=!0,c();let u=s instanceof Error?s:this.reason;n.abort(u instanceof Pm?u:new _nt(u instanceof Error?u.message:u))}},o=t&&setTimeout(()=>{o=null,a(new Pm(`timeout ${t} of ms exceeded`,Pm.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:d}=n;return d.unsubscribe=()=>Yf.asap(c),d}},rAy=miC;var OiC=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},AiC=async function*(e,t){for await(let r of PiC(e))yield*OiC(r,t)},PiC=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},Ivf=(e,t,r,n)=>{let i=AiC(e,t),a=0,o,c=d=>{o||(o=!0,n&&n(d))};return new ReadableStream({async pull(d){try{let{done:s,value:u}=await i.next();if(s){c(),d.close();return}let l=u.byteLength;if(r){let m=a+=l;r(m)}d.enqueue(new Uint8Array(u))}catch(s){throw c(s),s}},cancel(d){return c(d),i.return()}},{highWaterMark:2})};var nAy=64*1024,{isFunction:O1s}=Yf,wiC=(({Request:e,Response:t})=>({Request:e,Response:t}))(Yf.global),{ReadableStream:iAy,TextEncoder:aAy}=Yf.global,oAy=(e,...t)=>{try{return!!e(...t)}catch{return!1}},jiC=e=>{e=Yf.merge.call({skipUndefined:!0},wiC,e);let{fetch:t,Request:r,Response:n}=e,i=t?O1s(t):typeof fetch=="function",a=O1s(r),o=O1s(n);if(!i)return!1;let c=i&&O1s(iAy),d=i&&(typeof aAy=="function"?(P=>C=>P.encode(C))(new aAy):async P=>new Uint8Array(await new r(P).arrayBuffer())),s=a&&c&&oAy(()=>{let P=!1,C=new r(q2.origin,{body:new iAy,method:"POST",get duplex(){return P=!0,"half"}}).headers.has("Content-Type");return P&&!C}),u=o&&c&&oAy(()=>Yf.isReadableStream(new n("").body)),l={stream:u&&(P=>P.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(P=>{!l[P]&&(l[P]=(C,I)=>{let T=C&&C[P];if(T)return T.call(C);throw new Pm(`Response type '${P}' is not supported`,Pm.ERR_NOT_SUPPORT,I)})});let m=async P=>{if(P==null)return 0;if(Yf.isBlob(P))return P.size;if(Yf.isSpecCompliantForm(P))return(await new r(q2.origin,{method:"POST",body:P}).arrayBuffer()).byteLength;if(Yf.isArrayBufferView(P)||Yf.isArrayBuffer(P))return P.byteLength;if(Yf.isURLSearchParams(P)&&(P=P+""),Yf.isString(P))return(await d(P)).byteLength},A=async(P,C)=>{let I=Yf.toFiniteNumber(P.getContentLength());return I??m(C)};return async P=>{let{url:C,method:I,data:T,signal:z,cancelToken:U,timeout:R,onDownloadProgress:V,onUploadProgress:$,responseType:re,headers:Y,withCredentials:te="same-origin",fetchOptions:ne}=m1s(P),Oe=t||fetch;re=re?(re+"").toLowerCase():"text";let ge=rAy([z,U&&U.toAbortSignal()],R),ve=null,be=ge&&ge.unsubscribe&&(()=>{ge.unsubscribe()}),Ie;try{if($&&s&&I!=="get"&&I!=="head"&&(Ie=await A(Y,T))!==0){let De=new r(C,{method:"POST",body:T,duplex:"half"}),Lt;if(Yf.isFormData(T)&&(Lt=De.headers.get("content-type"))&&Y.setContentType(Lt),De.body){let[Xe,Yt]=CZa(Ie,HOi(MZa($)));T=Ivf(De.body,nAy,Xe,Yt)}}Yf.isString(te)||(te=te?"include":"omit");let Be=a&&"credentials"in r.prototype,Se={...ne,signal:ge,method:I.toUpperCase(),headers:Y.normalize().toJSON(),body:T,duplex:"half",credentials:Be?te:void 0};ve=a&&new r(C,Se);let St=await(a?Oe(ve,ne):Oe(C,Se)),yt=u&&(re==="stream"||re==="response");if(u&&(V||yt&&be)){let De={};["status","statusText","headers"].forEach(It=>{De[It]=St[It]});let Lt=Yf.toFiniteNumber(St.headers.get("content-length")),[Xe,Yt]=V&&CZa(Lt,HOi(MZa(V),!0))||[];St=new n(Ivf(St.body,nAy,Xe,()=>{Yt&&Yt(),be&&be()}),De)}re=re||"text";let Re=await l[Yf.findKey(l,re)||"text"](St,P);return!yt&&be&&be(),await new Promise((De,Lt)=>{o9r(De,Lt,{data:Re,headers:p$.from(St.headers),status:St.status,statusText:St.statusText,config:P,request:ve})})}catch(Be){throw be&&be(),Be&&Be.name==="TypeError"&&/Load failed|fetch/i.test(Be.message)?Object.assign(new Pm("Network Error",Pm.ERR_NETWORK,P,ve),{cause:Be.cause||Be}):Pm.from(Be,Be&&Be.code,P,ve)}}},EiC=new Map,Bvf=e=>{let t=e?e.env:{},{fetch:r,Request:n,Response:i}=t,a=[n,i,r],o=a.length,c=o,d,s,u=EiC;for(;c--;)d=a[c],s=u.get(d),s===void 0&&u.set(d,s=c?new Map:jiC(t)),u=s;return s},wD9=Bvf();var Tvf={http:XOy,xhr:tAy,fetch:{get:Bvf}};Yf.forEach(Tvf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var uAy=e=>`- ${e}`,DiC=e=>Yf.isFunction(e)||e===null||e===!1,A1s={getAdapter:(e,t)=>{e=Yf.isArray(e)?e:[e];let{length:r}=e,n,i,a={};for(let o=0;o<r;o++){n=e[o];let c;if(i=n,!DiC(n)&&(i=Tvf[(c=String(n)).toLowerCase()],i===void 0))throw new Pm(`Unknown adapter '${c}'`);if(i&&(Yf.isFunction(i)||(i=i.get(t))))break;a[c||"#"+o]=i}if(!i){let o=Object.entries(a).map(([d,s])=>`adapter ${d} `+(s===!1?"is not supported by the environment":"is not available in the build")),c=r?o.length>1?`since :
|
|
@@ -2401,7 +2401,7 @@ ${R}${z}${V}${gro}`});function zqs({message:e,error:t,logger:r,logLevel:n=z1.Err
|
|
|
2401
2401
|
Run ${md.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
|
|
2402
2402
|
Run ${md.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),BZa(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function QMf({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!t9y(e))return;let i=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let o=a.sort((c,d)=>c.generatorName.localeCompare(d.generatorName)||c.currentVersion.localeCompare(d.currentVersion));for(let c of o)i+=`
|
|
2403
2403
|
${await h8C(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+md.dim(c.currentVersion)+md.reset(" \u2192 ")+md.green(c.latestVersion);return i+=`
|
|
2404
|
-
`,n?BZa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function h8C(e){let r=await new e9y.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 y8C({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await n9y({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,u,l)=>{c.versions[s]==null&&(c.versions[s]={});let m=F3i(u.name,l),A=await tLr({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:l});A!=null&&(c.versions[s][u.name]={previousVersion:u.version,latestVersion:A})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await n9y({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,d,s,u)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][d]==null&&(o.versions[c][d]={});let l=F3i(s.name,u),m=await tLr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:u});m!=null&&(o.versions[c][d][s.name]={previousVersion:s.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function n9y({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await bTr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let d of c.groups)if(!(i!=null&&d.groupName!==i))for(let s of d.generators)n!=null&&s.name!==n||await r(a.workspaceName,d.groupName,s,o)}})}))}function i9y(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let d=Gxe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:d,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function Vqs({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await y8C({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[d,s]of Object.entries(c.versions))o.push(...i9y(s,d,t.logger));else o.push(...i9y(c.versions,void 0,t.logger))}return o}var nXo=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${i} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var Pro=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var LMf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),a9y=typeof globalThis.AbortController=="function",o9y=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",u9y=typeof globalThis.ReadableStream=="function",s9y=typeof globalThis.FormData=="function",Wqs=["get","post","put","patch","head","delete"],v8C=()=>{};v8C();var c9y={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Hqs=2147483647,l9y=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Gqs=Symbol("stop"),f9y={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},d9y={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 b8C=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=l9y,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},p9y=(e,t,r)=>{let n,i=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),n){i+=n.byteLength;let c=t===0?0:i/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,i),transferredBytes:i},n)}n=a},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},n))}}))},_9y=(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(p9y(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},h9y=(e,t,r)=>{if(!e.body)return e;let n=b8C(r??e.body);return new Request(e,{duplex:"half",body:p9y(e.body,n,t)})};var wro=e=>e!==null&&typeof e=="object";var iXo=(...e)=>{for(let t of e)if((!wro(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return WMf({},...e)},UMf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,o]of i.entries())n&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function Jqs(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:WMf(e[r]??[],t[r]??[])}var VMf=(e={},t={})=>({beforeRequest:Jqs(e,t,"beforeRequest"),beforeRetry:Jqs(e,t,"beforeRetry"),afterResponse:Jqs(e,t,"afterResponse"),beforeError:Jqs(e,t,"beforeError")}),WMf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(wro(i)){for(let[a,o]of Object.entries(i))wro(o)&&a in t&&(o=WMf(t[a],o)),t={...t,[a]:o};wro(i.hooks)&&(n=VMf(n,i.hooks),t.hooks=n),wro(i.headers)&&(r=UMf(r,i.headers),t.headers=r)}return t};var v9y=e=>Wqs.includes(e)?e.toUpperCase():e,g8C=["get","put","head","delete","options","trace"],m8C=[408,413,429,500,502,503,504],O8C=[413,429,503],y9y={limit:2,methods:g8C,statusCodes:m8C,afterStatusCodes:O8C,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},b9y=(e={})=>{if(typeof e=="number")return{...y9y,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{...y9y,...e}};async function HMf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new Pro(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function GMf(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var g9y=(e,t)=>{let r={};for(let n in t)!(n in d9y)&&!(n in f9y)&&!(n in e)&&(r[n]=t[n]);return r},m9y=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 aXo=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>Hqs)throw new RangeError(`The \`timeout\` option cannot be greater than ${Hqs}`);await Promise.resolve();let c=await n._fetch();for(let d of n._options.hooks.afterResponse){let s=await d(n.request,n._options,n._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let d=new nXo(c,n.request,n._options);for(let s of n._options.hooks.beforeError)d=await s(d);throw d}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!u9y)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return _9y(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{let c=n._originalRequest,d=[];c&&!c.bodyUsed&&d.push(c.body?.cancel()),n.request.bodyUsed||d.push(n.request.body?.cancel()),await Promise.all(d)});for(let[c,d]of Object.entries(c9y))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||d);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:UMf(this._input.headers,r.headers),hooks:VMf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:v9y(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:b9y(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(a9y&&o9y){let n=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=n?AbortSignal.any([n,this.abortController.signal]):this.abortController.signal}if(LMf&&(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),m9y(this._options.searchParams)){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(s9y&&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(!LMf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=h9y(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof Pro)throw t;if(t instanceof nXo){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let n=Math.min(this._calculateRetryDelay(r),Hqs);if(this._retryCount<1)throw r;await GMf(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===Gqs)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=g9y(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):HMf(this._originalRequest,t,this.abortController,this._options)}};var JMf=e=>{let t=(r,n)=>aXo.create(r,iXo(e,n));for(let r of Wqs)t[r]=(n,i)=>aXo.create(n,iXo(e,i,{method:r}));return t.create=r=>JMf(iXo(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),JMf(iXo(e,r))),t.stop=Gqs,t},A8C=JMf(),O9y=A8C;var W9y=fa(V9y(),1);function ZMf(e){let t=(0,W9y.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var xVy=fa(FVy(),1),zVy=fa(e5r(),1),fIf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},dIf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function pIf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??ZMf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,xVy.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,c&&(d.authorization=`${c.type} ${c.token}`);let s;try{s=await O9y(o,{headers:d,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new fIf(e):l}if(t.allVersions)return s;let u=new dIf(e,r);if(s["dist-tags"][r]){let{time:l}=s;s=s.versions[s["dist-tags"][r]],s.time=l}else if(r){let l=!!s.versions[r];if(n&&!l)for(let[A,P]of Object.entries(s.versions))P.deprecated&&delete s.versions[A];if(!l){let A=Object.keys(s.versions);if(r=zVy.default.maxSatisfying(A,r),!r)throw u}let{time:m}=s;if(s=s.versions[r],s.time=m,!s)throw u}return s}async function fXo(e,t){let{version:r}=await pIf(e.toLowerCase(),t);return r}async function O2i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:fXo(e.packageName,{version:t?"prerelease":"latest"})}var QVy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],aRs=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=z1.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new Uqs(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(i==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.84.7"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${md.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Cue}failWithoutThrowing(t,r){this.didSucceed=!1,zqs({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await AZa()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await r9y({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
2404
|
+
`,n?BZa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function h8C(e){let r=await new e9y.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 y8C({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await n9y({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,u,l)=>{c.versions[s]==null&&(c.versions[s]={});let m=F3i(u.name,l),A=await tLr({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:l});A!=null&&(c.versions[s][u.name]={previousVersion:u.version,latestVersion:A})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await n9y({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,d,s,u)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][d]==null&&(o.versions[c][d]={});let l=F3i(s.name,u),m=await tLr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:u});m!=null&&(o.versions[c][d][s.name]={previousVersion:s.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function n9y({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await bTr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let d of c.groups)if(!(i!=null&&d.groupName!==i))for(let s of d.generators)n!=null&&s.name!==n||await r(a.workspaceName,d.groupName,s,o)}})}))}function i9y(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let d=Gxe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:d,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function Vqs({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await y8C({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[d,s]of Object.entries(c.versions))o.push(...i9y(s,d,t.logger));else o.push(...i9y(c.versions,void 0,t.logger))}return o}var nXo=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${i} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var Pro=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var LMf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),a9y=typeof globalThis.AbortController=="function",o9y=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",u9y=typeof globalThis.ReadableStream=="function",s9y=typeof globalThis.FormData=="function",Wqs=["get","post","put","patch","head","delete"],v8C=()=>{};v8C();var c9y={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Hqs=2147483647,l9y=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Gqs=Symbol("stop"),f9y={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},d9y={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 b8C=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=l9y,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},p9y=(e,t,r)=>{let n,i=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),n){i+=n.byteLength;let c=t===0?0:i/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,i),transferredBytes:i},n)}n=a},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},n))}}))},_9y=(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(p9y(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},h9y=(e,t,r)=>{if(!e.body)return e;let n=b8C(r??e.body);return new Request(e,{duplex:"half",body:p9y(e.body,n,t)})};var wro=e=>e!==null&&typeof e=="object";var iXo=(...e)=>{for(let t of e)if((!wro(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return WMf({},...e)},UMf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,o]of i.entries())n&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function Jqs(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:WMf(e[r]??[],t[r]??[])}var VMf=(e={},t={})=>({beforeRequest:Jqs(e,t,"beforeRequest"),beforeRetry:Jqs(e,t,"beforeRetry"),afterResponse:Jqs(e,t,"afterResponse"),beforeError:Jqs(e,t,"beforeError")}),WMf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(wro(i)){for(let[a,o]of Object.entries(i))wro(o)&&a in t&&(o=WMf(t[a],o)),t={...t,[a]:o};wro(i.hooks)&&(n=VMf(n,i.hooks),t.hooks=n),wro(i.headers)&&(r=UMf(r,i.headers),t.headers=r)}return t};var v9y=e=>Wqs.includes(e)?e.toUpperCase():e,g8C=["get","put","head","delete","options","trace"],m8C=[408,413,429,500,502,503,504],O8C=[413,429,503],y9y={limit:2,methods:g8C,statusCodes:m8C,afterStatusCodes:O8C,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},b9y=(e={})=>{if(typeof e=="number")return{...y9y,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{...y9y,...e}};async function HMf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new Pro(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function GMf(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var g9y=(e,t)=>{let r={};for(let n in t)!(n in d9y)&&!(n in f9y)&&!(n in e)&&(r[n]=t[n]);return r},m9y=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 aXo=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>Hqs)throw new RangeError(`The \`timeout\` option cannot be greater than ${Hqs}`);await Promise.resolve();let c=await n._fetch();for(let d of n._options.hooks.afterResponse){let s=await d(n.request,n._options,n._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let d=new nXo(c,n.request,n._options);for(let s of n._options.hooks.beforeError)d=await s(d);throw d}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!u9y)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return _9y(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{let c=n._originalRequest,d=[];c&&!c.bodyUsed&&d.push(c.body?.cancel()),n.request.bodyUsed||d.push(n.request.body?.cancel()),await Promise.all(d)});for(let[c,d]of Object.entries(c9y))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||d);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:UMf(this._input.headers,r.headers),hooks:VMf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:v9y(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:b9y(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(a9y&&o9y){let n=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=n?AbortSignal.any([n,this.abortController.signal]):this.abortController.signal}if(LMf&&(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),m9y(this._options.searchParams)){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(s9y&&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(!LMf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=h9y(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof Pro)throw t;if(t instanceof nXo){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let n=Math.min(this._calculateRetryDelay(r),Hqs);if(this._retryCount<1)throw r;await GMf(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===Gqs)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=g9y(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):HMf(this._originalRequest,t,this.abortController,this._options)}};var JMf=e=>{let t=(r,n)=>aXo.create(r,iXo(e,n));for(let r of Wqs)t[r]=(n,i)=>aXo.create(n,iXo(e,i,{method:r}));return t.create=r=>JMf(iXo(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),JMf(iXo(e,r))),t.stop=Gqs,t},A8C=JMf(),O9y=A8C;var W9y=fa(V9y(),1);function ZMf(e){let t=(0,W9y.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var xVy=fa(FVy(),1),zVy=fa(e5r(),1),fIf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},dIf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function pIf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??ZMf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,xVy.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,c&&(d.authorization=`${c.type} ${c.token}`);let s;try{s=await O9y(o,{headers:d,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new fIf(e):l}if(t.allVersions)return s;let u=new dIf(e,r);if(s["dist-tags"][r]){let{time:l}=s;s=s.versions[s["dist-tags"][r]],s.time=l}else if(r){let l=!!s.versions[r];if(n&&!l)for(let[A,P]of Object.entries(s.versions))P.deprecated&&delete s.versions[A];if(!l){let A=Object.keys(s.versions);if(r=zVy.default.maxSatisfying(A,r),!r)throw u}let{time:m}=s;if(s=s.versions[r],s.time=m,!s)throw u}return s}async function fXo(e,t){let{version:r}=await pIf(e.toLowerCase(),t);return r}async function O2i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:fXo(e.packageName,{version:t?"prerelease":"latest"})}var QVy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],aRs=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=z1.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new Uqs(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(i==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.84.8"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${md.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Cue}failWithoutThrowing(t,r){this.didSucceed=!1,zqs({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await AZa()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await r9y({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
2405
2405
|
`)||(r+=`
|
|
2406
2406
|
`),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=ZJl(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new XYo(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(a){throw a.message.includes("globalThis")?(n.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),n.failWithoutThrowing()):n.failWithoutThrowing(void 0,a),new Cue}finally{n.finish()}return i}async instrumentPostHogEvent(t){this.isLocal||(await AZa()).sendEvent(t)}logger=v5r((t,...r)=>this.log(t,...r));stderr=v5r((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=LVy(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?LVy(this.longestWorkspaceName):r).length,i=r.padEnd(n),a=QVy[this.numTasks++%QVy.length],o=md.hex(a)(i);return{...this.constructTaskInit(),logPrefix:o}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===oV.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let n=t.filter(i=>Yxi.indexOf(i.level)>=Yxi.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===z1.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 O2i({cliEnvironment:this.environment,includePreReleases:t}),n=Gxe(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},a=await Vqs({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await jMf({message:t,default:r})}async getInput(t){return await EMf({message:t.message,default:t.default})}};function LVy(e){return`[${e}]:`}var fqr=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:n,absoluteFilePath:i,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=n,this.absoluteFilePath=i,this.changelog=a}};var Lnt=class extends fqr{definition;sources;type="fern";constructor({definition:t,sources:r,...n}){super(n),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var dqr={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!1,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!0,coerceOptionalSchemasToNullable:!0};function dXo({options:e,overrides:t}){return{enableUniqueErrorsPerEndpoint:t?.enableUniqueErrorsPerEndpoint??e?.enableUniqueErrorsPerEndpoint??dqr.enableUniqueErrorsPerEndpoint,detectGlobalHeaders:t?.detectGlobalHeaders??e?.detectGlobalHeaders??dqr.detectGlobalHeaders,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??dqr.objectQueryParameters,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??dqr.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??dqr.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??dqr.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??dqr.inlinePathParameters,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??dqr.useBytesForBinaryResponse,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??dqr.respectForwardCompatibleEnums,wrapReferencesToNullableInOptional:t?.wrapReferencesToNullableInOptional??e?.wrapReferencesToNullableInOptional??dqr.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:t?.coerceOptionalSchemasToNullable??e?.coerceOptionalSchemasToNullable??dqr.coerceOptionalSchemasToNullable}}var cwe={openapi:e=>({...e,type:"openapi",_visit:function(t){return cwe._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return cwe._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 Iro={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return Iro._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var Rde={basic:e=>({...e,type:"basic",_visit:function(t){return Rde._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return Rde._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return Rde._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return Rde._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return Rde._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 fS={primitive:e=>({value:e,type:"primitive",_visit:function(t){return fS._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return fS._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return fS._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return fS._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return fS._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return fS._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return fS._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return fS._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return fS._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 AO={int:e=>({value:e,type:"int",_visit:function(t){return AO._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return AO._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return AO._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return AO._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return AO._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return AO._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return AO._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return AO._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return AO._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return AO._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return AO._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 A2i={boolean:e=>({value:e,type:"boolean",_visit:function(t){return A2i._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return A2i._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 P2i={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return P2i._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return P2i._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 oRs={};ff(oRs,{Availability:()=>Nde,CustomCodeSample:()=>eVr,EndpointExample:()=>eyt,EndpointResponseExample:()=>tyt,HttpMethod:()=>xde,LiteralSchemaValue:()=>jV,MultipartRequestPropertyEncoding:()=>yIf,MultipartSchema:()=>tVr,OneOfSchema:()=>rVr,Pagination:()=>Unt,PrimitiveSchemaValue:()=>lq,Request:()=>pqr,Response:()=>Rbe,RetriesConfiguration:()=>pXo,Schema:()=>Vj,SupportedSdkLanguage:()=>Fde,WebhookHttpMethod:()=>hIf,WebsocketMessageOrigin:()=>_If});var _If={Client:"client",Server:"server",_visit:(e,t)=>{switch(e){case _If.Client:return t.client();case _If.Server:return t.server();default:return t._other()}}};var hIf={Get:"GET",Post:"POST",_visit:(e,t)=>{switch(e){case hIf.Get:return t.get();case hIf.Post:return t.post();default:return t._other()}}};var Nde={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case Nde.GenerallyAvailable:return t.generallyAvailable();case Nde.Beta:return t.beta();case Nde.Deprecated:return t.deprecated();default:return t._other()}}};var pXo={disabled:e=>({value:e,type:"disabled",_visit:function(t){return pXo._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"disabled":return t.disabled(e.value);default:return t._other(e)}}};var Unt={cursor:e=>({...e,type:"cursor",_visit:function(t){return Unt._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return Unt._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return Unt._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 eVr={language:e=>({...e,type:"language",_visit:function(t){return eVr._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return eVr._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 Fde={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 Fde.Curl:return t.curl();case Fde.Python:return t.python();case Fde.Javascript:return t.javascript();case Fde.Typescript:return t.typescript();case Fde.Go:return t.go();case Fde.Ruby:return t.ruby();case Fde.Csharp:return t.csharp();case Fde.Java:return t.java();case Fde.Js:return t.js();case Fde.Node:return t.node();case Fde.Ts:return t.ts();case Fde.Nodets:return t.nodets();case Fde.Golang:return t.golang();case Fde.Dotnet:return t.dotnet();case Fde.Jvm:return t.jvm();default:return t._other()}}};var eyt={unknown:e=>({value:e,type:"unknown",_visit:function(t){return eyt._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return eyt._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 tyt={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return tyt._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return tyt._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 xde={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case xde.Get:return t.get();case xde.Post:return t.post();case xde.Put:return t.put();case xde.Patch:return t.patch();case xde.Delete:return t.delete();case xde.Head:return t.head();case xde.Options:return t.options();case xde.Trace:return t.trace();default:return t._other()}}};var pqr={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return pqr._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return pqr._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return pqr._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return pqr._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 yIf={Json:"json",Form:"form",_visit:(e,t)=>{switch(e){case yIf.Json:return t.json();case yIf.Form:return t.form();default:return t._other()}}};var tVr={file:e=>({...e,type:"file",_visit:function(t){return tVr._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return tVr._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 Rbe={file:e=>({...e,type:"file",_visit:function(t){return Rbe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Rbe._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Rbe._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return Rbe._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return Rbe._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return Rbe._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return Rbe._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 Vj={primitive:e=>({...e,type:"primitive",_visit:function(t){return Vj._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Vj._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Vj._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Vj._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Vj._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Vj._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Vj._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Vj._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Vj._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Vj._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Vj._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 lq={int:e=>({...e,type:"int",_visit:function(t){return lq._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return lq._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return lq._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return lq._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return lq._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return lq._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return lq._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return lq._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return lq._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return lq._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return lq._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 jV={boolean:e=>({value:e,type:"boolean",_visit:function(t){return jV._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return jV._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 rVr={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return rVr._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return rVr._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 ZCe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return ZCe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return ZCe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return ZCe._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return ZCe._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 QL={file:e=>({...e,type:"file",_visit:function(t){return QL._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return QL._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return QL._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return QL._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return QL._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return QL._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return QL._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 mh={primitive:e=>({...e,type:"primitive",_visit:function(t){return mh._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return mh._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return mh._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return mh._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return mh._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return mh._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return mh._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return mh._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return mh._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return mh._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return mh._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 Vnt={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return Vnt._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return Vnt._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 z0={int:e=>({...e,type:"int",_visit:function(t){return z0._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return z0._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return z0._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return z0._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return z0._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return z0._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return z0._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return z0._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return z0._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return z0._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return z0._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 Oj={};ff(Oj,{AllOfPropertyConflict:()=>nno,ArraySchema:()=>PNs,ArraySchemaWithExample:()=>eFs,Availability:()=>yRs,Base64WithExample:()=>$Ns,BasicSecurityScheme:()=>bRs,BearerSecurityScheme:()=>gRs,BooleanSchema:()=>vNs,BooleanWithExample:()=>YNs,BytesResponse:()=>Jro,CasingOverrides:()=>ARs,CommonProperty:()=>INs,CommonPropertyWithExample:()=>cFs,CursorPagination:()=>eNs,CustomCodeSample:()=>ZRs,CustomCodeSampleLanguage:()=>$Rs,CustomCodeSampleSdk:()=>XRs,CustomPagination:()=>rNs,DateWithExample:()=>KNs,DatetimeWithExample:()=>JNs,DiscriminatedOneOfSchema:()=>CNs,DiscriminatedOneOfSchemaWithExample:()=>uFs,DoubleSchema:()=>hNs,DoubleWithExample:()=>HNs,Encoding:()=>hRs,Endpoint:()=>nNs,EndpointExample:()=>Xro,EndpointResponseExample:()=>KRs,EndpointSdkName:()=>aVr,EndpointSecurity:()=>zro,EndpointWithExample:()=>vWy,EnumSchema:()=>Nro,EnumSchemaWithExample:()=>ZNs,EnumValue:()=>E2i,ErrorExample:()=>VRs,FernExample:()=>HRs,FileResponse:()=>Hro,FileSchema:()=>RRs,FloatWithExample:()=>WNs,FormUrlEncodedRequest:()=>QRs,FullEndpointExample:()=>kRs,FullExample:()=>s5,FullObjectExample:()=>MRs,FullOneOfExample:()=>BRs,GlobalHeader:()=>gNs,Header:()=>D2i,HeaderExample:()=>Yro,HeaderSecurityScheme:()=>mRs,HeaderWithExample:()=>I2i,HttpEndpointServer:()=>Kro,HttpError:()=>WRs,HttpErrorWithExample:()=>zNs,HttpMethod:()=>Qro,IdempotencyHeader:()=>mNs,Int64WithExample:()=>LNs,IntSchema:()=>pNs,IntWithExample:()=>QNs,JsonRequest:()=>zRs,JsonRequestWithExample:()=>RNs,JsonResponse:()=>Gro,JsonResponseWithExample:()=>ono,KeyValuePair:()=>IRs,LiteralExample:()=>DRs,LiteralSchema:()=>rno,LiteralSchemaValue:()=>ONs,LongSchema:()=>_Ns,MapSchema:()=>wNs,MapSchemaWithExample:()=>tFs,MultipartRequest:()=>Wro,MultipartRequestProperty:()=>xRs,MultipartRequestPropertyEncoding:()=>FRs,MultipartSchema:()=>NRs,NamedFullExample:()=>nyt,Namespace:()=>PRs,NamespaceId:()=>SRs,NullExample:()=>CRs,NullableSchema:()=>ENs,NullableSchemaWithExample:()=>nFs,OauthSecurityScheme:()=>jRs,ObjectProperty:()=>DNs,ObjectPropertyConflictInfo:()=>ino,ObjectPropertyWithExample:()=>oFs,ObjectSchema:()=>ANs,ObjectSchemaWithExample:()=>iFs,OctetStreamRequest:()=>Vro,OffsetPagination:()=>tNs,OneOfSchema:()=>SNs,OneOfSchemaWithExample:()=>aFs,OpenApiIntermediateRepresentation:()=>hWy,OpenApiSource:()=>fRs,OptionalSchema:()=>jNs,OptionalSchemaWithExample:()=>rFs,Pagination:()=>Zro,ParseFormUrlEncodedRequest:()=>NNs,ParseMultipartRequest:()=>qNs,ParseOctetStreamRequest:()=>TNs,PathParameter:()=>Lro,PathParameterExample:()=>GRs,PathParameterWithExample:()=>BNs,PrimitiveExample:()=>xro,PrimitiveSchema:()=>M2i,PrimitiveSchemaValue:()=>bNs,PrimitiveSchemaValueWithExample:()=>XNs,PrimitiveSchemaWithExample:()=>uno,PropertyKey:()=>Fro,ProtobufEncoding:()=>_Rs,ProtobufSource:()=>dRs,QueryParameter:()=>Uro,QueryParameterExample:()=>$ro,QueryParameterWithExample:()=>ano,QuerySecurityScheme:()=>ORs,ReferencedSchema:()=>oVr,Request:()=>LRs,RequestWithExample:()=>FNs,Response:()=>URs,ResponseWithExample:()=>xNs,RetriesConfiguration:()=>kro,Schema:()=>hM,SchemaId:()=>kCe,SchemaWithExample:()=>F6,Schemas:()=>dNs,SdkGroup:()=>wRs,SdkGroupInfo:()=>TRs,SdkGroupName:()=>S2i,SecurityScheme:()=>ERs,SecuritySchemeId:()=>Rro,Server:()=>vXo,Source:()=>pRs,StatusCode:()=>nVr,StreamingResponseExample:()=>JRs,StringSchema:()=>yNs,StringSchemaWithExample:()=>GNs,SupportedSdkLanguage:()=>YRs,Tag:()=>vRs,TagId:()=>eMe,Tags:()=>qRs,TextResponse:()=>C2i,Uint64WithExample:()=>VNs,UintWithExample:()=>UNs,UnDiscriminatedOneOfSchema:()=>MNs,UnDiscriminatedOneOfSchemaWithExample:()=>sFs,UnknownSchemaWithExample:()=>kNs,Webhook:()=>iNs,WebhookExampleCall:()=>tno,WebhookHttpMethod:()=>eno,WebhookWithExample:()=>bWy,WebsocketChannel:()=>fNs,WebsocketHandshake:()=>aNs,WebsocketHandshakeWithExample:()=>yWy,WebsocketMessageExample:()=>cNs,WebsocketMessageOrigin:()=>oNs,WebsocketMessageSchema:()=>uNs,WebsocketServer:()=>sNs,WebsocketSessionExample:()=>lNs,WithAvailability:()=>IP,WithDescription:()=>ky,WithEncoding:()=>Kxe,WithInline:()=>N6,WithName:()=>eD,WithNamespace:()=>dS,WithSdkGroupName:()=>pI,WithSdkMethodName:()=>iVr,WithSource:()=>XA,WithStatusCode:()=>ryt,WithTitle:()=>dI,commons:()=>OIf,example:()=>AIf,finalIr:()=>PIf,parseIr:()=>wIf});var OIf={};ff(OIf,{BasicSecurityScheme:()=>bRs,BearerSecurityScheme:()=>gRs,Encoding:()=>hRs,HeaderSecurityScheme:()=>mRs,Namespace:()=>PRs,NamespaceId:()=>SRs,OauthSecurityScheme:()=>jRs,OpenApiSource:()=>fRs,ProtobufEncoding:()=>_Rs,ProtobufSource:()=>dRs,QuerySecurityScheme:()=>ORs,SchemaId:()=>kCe,SdkGroup:()=>wRs,SdkGroupName:()=>S2i,SecurityScheme:()=>ERs,SecuritySchemeId:()=>Rro,Server:()=>vXo,Source:()=>pRs,StatusCode:()=>nVr,Tag:()=>vRs,TagId:()=>eMe,WithAvailability:()=>IP,WithDescription:()=>ky,WithEncoding:()=>Kxe,WithInline:()=>N6,WithName:()=>eD,WithNamespace:()=>dS,WithSdkGroupName:()=>pI,WithSdkMethodName:()=>iVr,WithSource:()=>XA,WithStatusCode:()=>ryt,WithTitle:()=>dI});var Gr={};ff(Gr,{JsonError:()=>Bro,ParseError:()=>Tro,any:()=>rWy,bigint:()=>VVy,boolean:()=>nWy,booleanLiteral:()=>tWy,date:()=>WVy,discriminant:()=>dWy,enum_:()=>sRs,getObjectLikeUtils:()=>_qr,getObjectUtils:()=>Pla,getSchemaUtils:()=>u5,isProperty:()=>j2i,lazy:()=>HVy,lazyObject:()=>ZVy,list:()=>lRs,number:()=>iWy,object:()=>cRs,objectWithoutOptionalProperties:()=>XVy,optional:()=>vIf,property:()=>JVy,record:()=>sWy,set:()=>cWy,string:()=>aWy,stringLiteral:()=>eWy,transform:()=>bIf,undiscriminatedUnion:()=>fWy,union:()=>_Wy,unknown:()=>oWy,withParsedProperties:()=>mIf});var fq={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 z2(e,t){return`Expected ${t}. Received ${D5C(e)}.`}function D5C(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 zde(e){return{...e,json:UVy(e.json),parse:UVy(e.parse)}}function UVy(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
2407
2407
|
`)),{ok:!0,value:t}):n}}function uRs(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Bro=class e extends Error{errors;constructor(t){super(t.map(uRs).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var Tro=class e extends Error{errors;constructor(t){super(t.map(uRs).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function u5(e){return{optional:()=>vIf(e),transform:t=>bIf(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new Tro(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new Bro(n.errors)}}}function vIf(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>fq.OPTIONAL};return{...t,...u5(t)}}function bIf(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(n,i)=>{let a=t.untransform(n);return e.json(a,i)},getType:()=>e.getType()};return{...r,...u5(r)}}function VVy(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:z2(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:z2(t,"bigint")}]},getType:()=>fq.BIGINT};return{...zde(e),...u5(e)}}var C5C=/^([+-]?\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 WVy(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:z2(t,"string")}]}:C5C.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:z2(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:z2(t,"Date object")}]},getType:()=>fq.DATE};return{...zde(e),...u5(e)}}function lwe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...zde(r),...u5(r)}}}function sRs(e){let t=new Set(e);return lwe(fq.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:z2(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:z2(n,"enum")}]}:{ok:!0,value:n})()}function HVy(e){let t=gIf(e);return{...t,...u5(t)}}function gIf(e){return{parse:(t,r)=>qro(e).parse(t,r),json:(t,r)=>qro(e).json(t,r),getType:()=>qro(e).getType()}}function qro(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function _Xo(e){return Object.entries(e)}function hXo(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function w2i(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 yXo(e){return Object.keys(e)}function GVy(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function _qr(e){return{withParsedProperties:t=>mIf(e,t)}}function mIf(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[d,s])=>({...c,[d]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...o}}},json:(n,i)=>{if(!w2i(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:z2(n,"object")}]};let a=new Set(Object.keys(t)),o=hXo(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(o,i)},getType:()=>e.getType()};return{...r,...u5(r),..._qr(r)}}function JVy(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function j2i(e){return e.isProperty}function cRs(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>j2i(n)?n.rawKey:r),_getParsedProperties:()=>yXo(e),parse:(r,n)=>{let i={},a=[];for(let[o,c]of _Xo(e)){let d=j2i(c)?c.rawKey:o,s=j2i(c)?c.valueSchema:c,u={rawKey:d,parsedKey:o,valueSchema:s};i[d]=u,YVy(s)&&a.push(d)}return KVy({value:r,requiredKeys:a,getProperty:o=>{let c=i[o];if(c!=null)return{transformedKey:c.parsedKey,transform:d=>c.valueSchema.parse(d,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,o]of _Xo(e)){let c=j2i(o)?o.valueSchema:o;YVy(c)&&i.push(a)}return KVy({value:r,requiredKeys:i,getProperty:a=>{let o=e[a];if(o!=null)return j2i(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>fq.OBJECT};return{...zde(t),...u5(t),..._qr(t),...Pla(t)}}function KVy({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!w2i(e))return{ok:!1,errors:[{path:a,message:z2(e,"object")}]};let o=new Set(t),c=[],d={};for(let[s,u]of Object.entries(e)){let l=r(s);if(l!=null){o.delete(s);let m=l.transform(u);m.ok?d[l.transformedKey]=m.value:(d[s]=u,c.push(...m.errors))}else switch(n){case"fail":c.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":d[s]=u;break}}return c.push(...t.filter(s=>o.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),c.length===0||i?{ok:!0,value:d}:{ok:!1,errors:c}}function Pla(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>$Vy({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>$Vy({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>fq.OBJECT};return{...r,...u5(r),..._qr(r),...Pla(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,n)=>{let i=e.parse(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},json:(r,n)=>{let i=e.json(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},getType:()=>fq.OBJECT};return{...t,...u5(t),..._qr(t),...Pla(t)}}}}function $Vy({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,o]=GVy(yXo(t),s=>i.has(s)),c=r(hXo(t,o)),d=n(hXo(t,a));return c.ok&&d.ok?{ok:!0,value:{...c.value,...d.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...d.ok?[]:d.errors]}}function YVy(e){return!M5C(e)}function M5C(e){switch(e.getType()){case fq.ANY:case fq.UNKNOWN:case fq.OPTIONAL:return!0;default:return!1}}function XVy(e){return cRs(e)}function ZVy(e){let t={...gIf(e),_getRawProperties:()=>qro(e)._getRawProperties(),_getParsedProperties:()=>qro(e)._getParsedProperties()};return{...t,...u5(t),..._qr(t),...Pla(t)}}function lRs(e){let t={parse:(r,n)=>kVy(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>kVy(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>fq.LIST};return{...zde(t),...u5(t)}}function kVy(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let a=[];return n.ok||a.push(...n.errors),i.ok||a.push(...i.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:z2(e,"list"),path:[]}]}}function eWy(e){return lwe(fq.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:z2(r,`"${e}"`)}]})()}function tWy(e){return lwe(fq.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:z2(r,`${e.toString()}`)}]})()}var rWy=lwe(fq.ANY,e=>({ok:!0,value:e}));var nWy=lwe(fq.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:z2(e,"boolean")}]});var iWy=lwe(fq.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:z2(e,"number")}]});var aWy=lwe(fq.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:z2(e,"string")}]});var oWy=lwe(fq.UNKNOWN,e=>({ok:!0,value:e}));function sWy(e,t){let r={parse:(n,i)=>uWy({value:n,isKeyNumeric:e.getType()===fq.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>uWy({value:n,isKeyNumeric:e.getType()===fq.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>fq.RECORD};return{...zde(r),...u5(r)}}function uWy({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return w2i(e)?_Xo(e).reduce((a,[o,c])=>{if(c==null)return a;let d=a,s=o;if(t){let A=o.length>0?Number(o):NaN;isNaN(A)||(s=A)}let u=r(s),l=n(c,s);if(d.ok&&u.ok&&l.ok)return{ok:!0,value:{...d.value,[u.value]:l.value}};let m=[];return d.ok||m.push(...d.errors),u.ok||m.push(...u.errors),l.ok||m.push(...l.errors),{ok:!1,errors:m}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:z2(e,"object")}]}}function cWy(e){let t=lRs(e),r={parse:(n,i)=>{let a=t.parse(n,i);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:z2(n,"Set")}]},getType:()=>fq.SET};return{...zde(r),...u5(r)}}function fWy(e){let t={parse:(r,n)=>lWy((i,a)=>i.parse(r,a),e,n),json:(r,n)=>lWy((i,a)=>i.json(r,a),e,n),getType:()=>fq.UNDISCRIMINATED_UNION};return{...zde(t),...u5(t)}}function lWy(e,t,r){let n=[];for(let[i,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)n.push({path:c.path,message:`[Variant ${i}] ${c.message}`})}return{ok:!1,errors:n}}function dWy(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function _Wy(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=sRs(yXo(t)),a={parse:(o,c)=>pWy({value:o,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:d=>i.parse(d,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.parse(d,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>pWy({value:o,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:d=>i.json(d,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.json(d,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>fq.UNION};return{...zde(a),...u5(a),..._qr(a)}}function pWy({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!w2i(e))return{ok:!1,errors:[{path:c,message:z2(e,"object")}]};let{[t]:d,...s}=e;if(d==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let u=n(d);if(!u.ok)return{ok:!1,errors:u.errors};let l=i(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 m=o(s,l);return m.ok?{ok:!0,value:{[r]:d,...m.value}}:m}var dI=Gr.objectWithoutOptionalProperties({title:Gr.string().optional()});var fRs=Gr.objectWithoutOptionalProperties({file:Gr.string()});var dRs=Gr.objectWithoutOptionalProperties({file:Gr.string()});var pRs=Gr.union("type",{openapi:fRs,protobuf:dRs}).transform({transform:e=>{switch(e.type){case"openapi":return cwe.openapi(e);case"protobuf":return cwe.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var XA=Gr.objectWithoutOptionalProperties({source:pRs.optional()});var _Rs=Gr.objectWithoutOptionalProperties({typeName:Gr.string()});var hRs=Gr.union("type",{protobuf:_Rs}).transform({transform:e=>{switch(e.type){case"protobuf":return Iro.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Kxe=Gr.objectWithoutOptionalProperties({encoding:hRs.optional()});var ky=Gr.objectWithoutOptionalProperties({description:Gr.string().optional()});var yRs=Gr.enum_(["GenerallyAvailable","Beta","Deprecated"]);var IP=Gr.objectWithoutOptionalProperties({availability:yRs.optional()});var nVr=Gr.number();var ryt=Gr.objectWithoutOptionalProperties({statusCode:nVr.optional()});var eD=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string()});var N6=Gr.objectWithoutOptionalProperties({inline:Gr.boolean().optional()});var kCe=Gr.string();var eMe=Gr.string();var vRs=Gr.objectWithoutOptionalProperties({id:eMe}).extend(ky);var Rro=Gr.string();var bRs=Gr.objectWithoutOptionalProperties({usernameVariableName:Gr.string().optional(),usernameEnvVar:Gr.string().optional(),passwordVariableName:Gr.string().optional(),passwordEnvVar:Gr.string().optional()});var gRs=Gr.objectWithoutOptionalProperties({tokenVariableName:Gr.string().optional(),tokenEnvVar:Gr.string().optional()});var mRs=Gr.objectWithoutOptionalProperties({headerName:Gr.string(),prefix:Gr.string().optional(),headerVariableName:Gr.string().optional(),headerEnvVar:Gr.string().optional()});var ORs=Gr.objectWithoutOptionalProperties({queryParameterName:Gr.string()});var ARs=Gr.objectWithoutOptionalProperties({snake:Gr.string().optional(),camel:Gr.string().optional(),screamingSnake:Gr.string().optional(),pascal:Gr.string().optional()});var E2i=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string(),value:Gr.string(),casing:ARs.optional()}).extend(ky).extend(IP);var PRs=Gr.objectWithoutOptionalProperties({type:Gr.stringLiteral("namespace"),name:Gr.string()});var wRs=Gr.undiscriminatedUnion([Gr.string(),PRs]);var S2i=Gr.list(wRs);var pI=Gr.objectWithoutOptionalProperties({groupName:S2i.optional()});var dS=Gr.objectWithoutOptionalProperties({namespace:Gr.string().optional()});var Nro=Gr.objectWithoutOptionalProperties({default:E2i.optional(),values:Gr.list(E2i)}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(XA).extend(dI).extend(N6);var jRs=Gr.objectWithoutOptionalProperties({scopesEnum:Nro.optional()});var ERs=Gr.union("type",{basic:bRs,bearer:gRs,header:mRs,query:ORs,oauth:jRs}).transform({transform:e=>{switch(e.type){case"basic":return Rde.basic(e);case"bearer":return Rde.bearer(e);case"header":return Rde.header(e);case"query":return Rde.query(e);case"oauth":return Rde.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var vXo=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string(),audiences:Gr.list(Gr.string()).optional()}).extend(ky);var SRs=Gr.string();var iVr=Gr.objectWithoutOptionalProperties({sdkMethodName:Gr.string().optional()});var AIf={};ff(AIf,{FullExample:()=>s5,FullObjectExample:()=>MRs,FullOneOfExample:()=>BRs,KeyValuePair:()=>IRs,LiteralExample:()=>DRs,NullExample:()=>CRs,PrimitiveExample:()=>xro,PropertyKey:()=>Fro});var Fro=Gr.string();var xro=Gr.union("type",{int:Gr.object({value:Gr.number()}),int64:Gr.object({value:Gr.number()}),uint:Gr.object({value:Gr.number()}),uint64:Gr.object({value:Gr.number()}),float:Gr.object({value:Gr.number()}),double:Gr.object({value:Gr.number()}),string:Gr.object({value:Gr.string()}),datetime:Gr.object({value:Gr.string()}),date:Gr.object({value:Gr.string()}),base64:Gr.object({value:Gr.string()}),boolean:Gr.object({value:Gr.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return AO.int(e.value);case"int64":return AO.int64(e.value);case"uint":return AO.uint(e.value);case"uint64":return AO.uint64(e.value);case"float":return AO.float(e.value);case"double":return AO.double(e.value);case"string":return AO.string(e.value);case"datetime":return AO.datetime(e.value);case"date":return AO.date(e.value);case"base64":return AO.base64(e.value);case"boolean":return AO.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var DRs=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return A2i.boolean(e.value);case"string":return A2i.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var CRs=Gr.objectWithoutOptionalProperties({});var s5=Gr.union("type",{primitive:Gr.object({value:xro}),object:Gr.lazyObject(()=>MRs),array:Gr.object({value:Gr.list(Gr.lazy(()=>s5))}),map:Gr.object({value:Gr.list(Gr.lazyObject(()=>IRs))}),enum:Gr.object({value:Gr.string()}),literal:Gr.object({value:DRs}),oneOf:Gr.object({value:Gr.lazy(()=>BRs)}),null:CRs,unknown:Gr.object({value:Gr.lazy(()=>s5)})}).transform({transform:e=>{switch(e.type){case"primitive":return fS.primitive(e.value);case"object":return fS.object(e);case"array":return fS.array(e.value);case"map":return fS.map(e.value);case"enum":return fS.enum(e.value);case"literal":return fS.literal(e.value);case"oneOf":return fS.oneOf(e.value);case"null":return fS.null(e);case"unknown":return fS.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var MRs=Gr.objectWithoutOptionalProperties({properties:Gr.record(Fro,Gr.lazy(()=>s5))});var IRs=Gr.objectWithoutOptionalProperties({key:xro,value:Gr.lazy(()=>s5)});var BRs=Gr.union("type",{discriminated:Gr.object({value:Gr.record(Fro,Gr.lazy(()=>s5))}),undiscriminated:Gr.object({value:Gr.lazy(()=>s5)})}).transform({transform:e=>{switch(e.type){case"discriminated":return P2i.discriminated(e.value);case"undiscriminated":return P2i.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var PIf={};ff(PIf,{AllOfPropertyConflict:()=>nno,ArraySchema:()=>PNs,Availability:()=>yRs,BooleanSchema:()=>vNs,BytesResponse:()=>Jro,CasingOverrides:()=>ARs,CommonProperty:()=>INs,CursorPagination:()=>eNs,CustomCodeSample:()=>ZRs,CustomCodeSampleLanguage:()=>$Rs,CustomCodeSampleSdk:()=>XRs,CustomPagination:()=>rNs,DiscriminatedOneOfSchema:()=>CNs,DoubleSchema:()=>hNs,Endpoint:()=>nNs,EndpointExample:()=>Xro,EndpointResponseExample:()=>KRs,EndpointSdkName:()=>aVr,EndpointSecurity:()=>zro,EnumSchema:()=>Nro,EnumValue:()=>E2i,ErrorExample:()=>VRs,FernExample:()=>HRs,FileResponse:()=>Hro,FileSchema:()=>RRs,FormUrlEncodedRequest:()=>QRs,FullEndpointExample:()=>kRs,GlobalHeader:()=>gNs,Header:()=>D2i,HeaderExample:()=>Yro,HttpEndpointServer:()=>Kro,HttpError:()=>WRs,HttpMethod:()=>Qro,IdempotencyHeader:()=>mNs,IntSchema:()=>pNs,JsonRequest:()=>zRs,JsonResponse:()=>Gro,LiteralSchema:()=>rno,LiteralSchemaValue:()=>ONs,LongSchema:()=>_Ns,MapSchema:()=>wNs,MultipartRequest:()=>Wro,MultipartRequestProperty:()=>xRs,MultipartRequestPropertyEncoding:()=>FRs,MultipartSchema:()=>NRs,NullableSchema:()=>ENs,ObjectProperty:()=>DNs,ObjectPropertyConflictInfo:()=>ino,ObjectSchema:()=>ANs,OctetStreamRequest:()=>Vro,OffsetPagination:()=>tNs,OneOfSchema:()=>SNs,OpenApiIntermediateRepresentation:()=>hWy,OptionalSchema:()=>jNs,Pagination:()=>Zro,PathParameter:()=>Lro,PathParameterExample:()=>GRs,PrimitiveSchema:()=>M2i,PrimitiveSchemaValue:()=>bNs,QueryParameter:()=>Uro,QueryParameterExample:()=>$ro,ReferencedSchema:()=>oVr,Request:()=>LRs,Response:()=>URs,RetriesConfiguration:()=>kro,Schema:()=>hM,Schemas:()=>dNs,SdkGroupInfo:()=>TRs,StreamingResponseExample:()=>JRs,StringSchema:()=>yNs,SupportedSdkLanguage:()=>YRs,Tags:()=>qRs,TextResponse:()=>C2i,UnDiscriminatedOneOfSchema:()=>MNs,Webhook:()=>iNs,WebhookExampleCall:()=>tno,WebhookHttpMethod:()=>eno,WebsocketChannel:()=>fNs,WebsocketHandshake:()=>aNs,WebsocketMessageExample:()=>cNs,WebsocketMessageOrigin:()=>oNs,WebsocketMessageSchema:()=>uNs,WebsocketServer:()=>sNs,WebsocketSessionExample:()=>lNs});var TRs=Gr.objectWithoutOptionalProperties({summary:Gr.string().optional(),description:Gr.string().optional()});var qRs=Gr.objectWithoutOptionalProperties({tagsById:Gr.record(eMe,vRs),orderedTagIds:Gr.list(eMe).optional()});var zro=Gr.list(Gr.record(Rro,Gr.list(Gr.string())));var Qro=Gr.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var Lro=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>hM),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(ky).extend(IP).extend(XA);var Uro=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>hM),parameterNameOverride:Gr.string().optional()}).extend(ky).extend(IP).extend(XA);var D2i=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>hM),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(ky).extend(IP).extend(XA);var aVr=Gr.objectWithoutOptionalProperties({groupName:S2i,methodName:Gr.string()});var Vro=Gr.objectWithoutOptionalProperties({contentType:Gr.string().optional()}).extend(ky).extend(XA);var RRs=Gr.objectWithoutOptionalProperties({isOptional:Gr.boolean(),isArray:Gr.boolean()}).extend(ky);var NRs=Gr.union("type",{file:RRs,json:Gr.object({value:Gr.lazy(()=>hM)})}).transform({transform:e=>{switch(e.type){case"file":return tVr.file(e);case"json":return tVr.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var FRs=Gr.enum_(["json","form"]);var xRs=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:NRs,contentType:Gr.string().optional(),exploded:Gr.boolean().optional(),encoding:FRs.optional()}).extend(ky);var Wro=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),properties:Gr.list(xRs)}).extend(ky).extend(XA);var zRs=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>hM),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(ky).extend(XA);var QRs=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>hM),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(ky).extend(XA);var LRs=Gr.union("type",{octetStream:Vro,multipart:Wro,json:zRs,formUrlEncoded:QRs}).transform({transform:e=>{switch(e.type){case"octetStream":return pqr.octetStream(e);case"multipart":return pqr.multipart(e);case"json":return pqr.json(e);case"formUrlEncoded":return pqr.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var Hro=Gr.objectWithoutOptionalProperties({}).extend(ky).extend(XA).extend(ryt);var Gro=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>hM),responseProperty:Gr.string().optional()}).extend(ky).extend(XA).extend(ryt);var C2i=Gr.objectWithoutOptionalProperties({}).extend(ky).extend(XA).extend(ryt);var Jro=Gr.objectWithoutOptionalProperties({}).extend(ky).extend(XA).extend(ryt);var URs=Gr.union("type",{file:Hro,json:Gro,text:C2i,bytes:Jro,streamingSse:Gro,streamingText:C2i,streamingJson:Gro}).transform({transform:e=>{switch(e.type){case"file":return Rbe.file(e);case"json":return Rbe.json(e);case"text":return Rbe.text(e);case"bytes":return Rbe.bytes(e);case"streamingSse":return Rbe.streamingSse(e);case"streamingText":return Rbe.streamingText(e);case"streamingJson":return Rbe.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var VRs=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),description:Gr.string().optional(),example:Gr.lazy(()=>s5)});var WRs=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>hM).optional(),examples:Gr.list(VRs).optional()}).extend(ky).extend(eD).extend(XA);var Kro=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string().optional(),audiences:Gr.list(Gr.string()).optional()});var HRs=Gr.unknown();var GRs=Gr.objectWithoutOptionalProperties({name:Gr.string(),parameterNameOverride:Gr.string().optional(),value:Gr.lazy(()=>s5)});var $ro=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>s5)});var Yro=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>s5)});var JRs=Gr.objectWithoutOptionalProperties({sse:Gr.boolean(),events:Gr.list(Gr.lazy(()=>s5))});var KRs=Gr.union("type",{withStreaming:JRs,withoutStreaming:Gr.object({value:Gr.lazy(()=>s5)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return tyt.withStreaming(e);case"withoutStreaming":return tyt.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var $Rs=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),language:Gr.string(),code:Gr.string(),install:Gr.string().optional()}).extend(ky);var YRs=Gr.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var XRs=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),sdk:YRs,code:Gr.string()}).extend(ky);var ZRs=Gr.union("type",{language:$Rs,sdk:XRs}).transform({transform:e=>{switch(e.type){case"language":return eVr.language(e);case"sdk":return eVr.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var kRs=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),pathParameters:Gr.list(GRs).optional(),queryParameters:Gr.list($ro).optional(),headers:Gr.list(Yro).optional(),request:Gr.lazy(()=>s5).optional(),response:KRs.optional(),codeSamples:Gr.list(ZRs)}).extend(ky);var Xro=Gr.union("type",{unknown:Gr.object({value:HRs}),full:kRs}).transform({transform:e=>{switch(e.type){case"unknown":return eyt.unknown(e.value);case"full":return eyt.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var eNs=Gr.objectWithoutOptionalProperties({cursor:Gr.string(),nextCursor:Gr.property("next_cursor",Gr.string()),results:Gr.string()});var tNs=Gr.objectWithoutOptionalProperties({offset:Gr.string(),results:Gr.string(),step:Gr.string().optional(),hasNextPage:Gr.string().optional()});var rNs=Gr.objectWithoutOptionalProperties({results:Gr.string()});var Zro=Gr.union("type",{cursor:eNs,offset:tNs,custom:rNs}).transform({transform:e=>{switch(e.type){case"cursor":return Unt.cursor(e);case"offset":return Unt.offset(e);case"custom":return Unt.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var kro=Gr.union("type",{disabled:Gr.object({value:Gr.boolean().optional()})}).transform({transform:e=>{switch(e.type){case"disabled":return pXo.disabled(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var nNs=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:zro,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:Qro,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(eMe),pathParameters:Gr.list(Lro),queryParameters:Gr.list(Uro),headers:Gr.list(D2i),sdkName:aVr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:LRs.optional(),response:URs.optional(),errors:Gr.record(nVr,WRs),servers:Gr.list(Kro),examples:Gr.list(Xro),pagination:Zro.optional(),retries:kro.optional()}).extend(ky).extend(IP).extend(XA).extend(dS);var eno=Gr.enum_(["GET","POST"]);var tno=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),payload:Gr.lazy(()=>s5)}).extend(ky);var iNs=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:aVr.optional(),method:eno,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(eMe),headers:Gr.list(D2i),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>hM),examples:Gr.list(tno)}).extend(ky).extend(XA).extend(dS);var aNs=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(Uro),headers:Gr.list(D2i),pathParameters:Gr.list(Lro)});var oNs=Gr.enum_(["client","server"]);var uNs=Gr.objectWithoutOptionalProperties({name:Gr.string(),origin:oNs,body:Gr.lazy(()=>hM)});var sNs=Gr.objectWithoutOptionalProperties({name:Gr.string(),url:Gr.string()});var cNs=Gr.objectWithoutOptionalProperties({messageType:Gr.string(),payload:Gr.lazy(()=>s5)}).extend(ky);var lNs=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),queryParameters:Gr.list($ro).optional(),headers:Gr.list(Yro).optional(),messages:Gr.list(cNs)}).extend(ky);var fNs=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),path:Gr.string(),groupName:S2i,summary:Gr.string().optional(),handshake:aNs,messages:Gr.list(uNs),servers:Gr.list(sNs),examples:Gr.list(lNs)}).extend(ky).extend(XA);var dNs=Gr.objectWithoutOptionalProperties({rootSchemas:Gr.record(kCe,Gr.lazy(()=>hM)),namespacedSchemas:Gr.record(SRs,Gr.record(kCe,Gr.lazy(()=>hM)))});var pNs=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional()});var _Ns=Gr.objectWithoutOptionalProperties({default:Gr.number().optional()});var hNs=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional()});var yNs=Gr.objectWithoutOptionalProperties({default:Gr.string().optional(),pattern:Gr.string().optional(),format:Gr.string().optional(),minLength:Gr.number().optional(),maxLength:Gr.number().optional()});var vNs=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional()});var bNs=Gr.union("type",{int:pNs,int64:_Ns,uint:Gr.object({}),uint64:Gr.object({}),float:Gr.object({}),double:hNs,string:yNs,datetime:Gr.object({}),date:Gr.object({}),base64:Gr.object({}),boolean:vNs}).transform({transform:e=>{switch(e.type){case"int":return lq.int(e);case"int64":return lq.int64(e);case"uint":return lq.uint();case"uint64":return lq.uint64();case"float":return lq.float();case"double":return lq.double(e);case"string":return lq.string(e);case"datetime":return lq.datetime();case"date":return lq.date();case"base64":return lq.base64();case"boolean":return lq.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var M2i=Gr.objectWithoutOptionalProperties({schema:bNs}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(dI);var gNs=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),optional:Gr.boolean().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>hM).optional()});var mNs=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>hM).optional()});var hWy=Gr.objectWithoutOptionalProperties({apiVersion:Gr.unknown().optional(),title:Gr.string().optional(),description:Gr.string().optional(),basePath:Gr.string().optional(),servers:Gr.list(vXo),websocketServers:Gr.list(vXo),groups:Gr.record(Gr.string(),TRs),tags:qRs,hasEndpointsMarkedInternal:Gr.boolean(),endpoints:Gr.list(nNs),webhooks:Gr.list(iNs),channels:Gr.record(Gr.string(),fNs),groupedSchemas:dNs,variables:Gr.record(Gr.string(),M2i),nonRequestReferencedSchemas:Gr.set(kCe),securitySchemes:Gr.record(Rro,ERs),globalHeaders:Gr.list(gNs).optional(),idempotencyHeaders:Gr.list(mNs).optional()});var oVr=Gr.objectWithoutOptionalProperties({schema:kCe}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(XA).extend(dI);var ONs=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return jV.boolean(e.value);case"string":return jV.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var rno=Gr.objectWithoutOptionalProperties({value:ONs}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(dI);var hM=Gr.union("type",{primitive:M2i,object:Gr.lazyObject(()=>ANs),array:Gr.lazyObject(()=>PNs),map:Gr.lazyObject(()=>wNs),optional:Gr.lazyObject(()=>jNs),enum:Nro,reference:oVr,literal:rno,oneOf:Gr.object({value:Gr.lazy(()=>SNs)}),nullable:Gr.lazyObject(()=>ENs),unknown:eD}).transform({transform:e=>{switch(e.type){case"primitive":return Vj.primitive(e);case"object":return Vj.object(e);case"array":return Vj.array(e);case"map":return Vj.map(e);case"optional":return Vj.optional(e);case"enum":return Vj.enum(e);case"reference":return Vj.reference(e);case"literal":return Vj.literal(e);case"oneOf":return Vj.oneOf(e.value);case"nullable":return Vj.nullable(e);case"unknown":return Vj.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var nno=Gr.objectWithoutOptionalProperties({propertyKey:Gr.string(),allOfSchemaIds:Gr.list(kCe),conflictingTypeSignatures:Gr.boolean()});var ANs=Gr.objectWithoutOptionalProperties({allOf:Gr.list(oVr),properties:Gr.list(Gr.lazyObject(()=>DNs)),allOfPropertyConflicts:Gr.list(nno),additionalProperties:Gr.boolean()}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(XA).extend(dI).extend(N6);var ino=Gr.objectWithoutOptionalProperties({differentSchema:Gr.boolean()});var DNs=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>hM),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),conflict:Gr.record(kCe,ino),generatedName:Gr.string(),nameOverride:Gr.string().optional(),audiences:Gr.list(Gr.string())}).extend(IP);var PNs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>hM)}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(dI).extend(N6);var wNs=Gr.objectWithoutOptionalProperties({key:M2i,value:Gr.lazy(()=>hM)}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(Kxe).extend(dI).extend(N6);var jNs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>hM)}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(dI).extend(N6);var ENs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>hM)}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(dI).extend(N6);var SNs=Gr.union("type",{discriminated:Gr.lazyObject(()=>CNs),undiscriminated:Gr.lazyObject(()=>MNs)}).transform({transform:e=>{switch(e.type){case"discriminated":return rVr.discriminated(e);case"undiscriminated":return rVr.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var CNs=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>INs)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>hM))}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(Kxe).extend(XA).extend(dI).extend(N6);var INs=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>hM)});var MNs=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>hM))}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(Kxe).extend(XA).extend(dI).extend(N6);var wIf={};ff(wIf,{ArraySchemaWithExample:()=>eFs,Base64WithExample:()=>$Ns,BooleanWithExample:()=>YNs,CommonPropertyWithExample:()=>cFs,DateWithExample:()=>KNs,DatetimeWithExample:()=>JNs,DiscriminatedOneOfSchemaWithExample:()=>uFs,DoubleWithExample:()=>HNs,EndpointWithExample:()=>vWy,EnumSchemaWithExample:()=>ZNs,FloatWithExample:()=>WNs,HeaderWithExample:()=>I2i,HttpErrorWithExample:()=>zNs,Int64WithExample:()=>LNs,IntWithExample:()=>QNs,JsonRequestWithExample:()=>RNs,JsonResponseWithExample:()=>ono,MapSchemaWithExample:()=>tFs,NamedFullExample:()=>nyt,NullableSchemaWithExample:()=>nFs,ObjectPropertyWithExample:()=>oFs,ObjectSchemaWithExample:()=>iFs,OneOfSchemaWithExample:()=>aFs,OptionalSchemaWithExample:()=>rFs,ParseFormUrlEncodedRequest:()=>NNs,ParseMultipartRequest:()=>qNs,ParseOctetStreamRequest:()=>TNs,PathParameterWithExample:()=>BNs,PrimitiveSchemaValueWithExample:()=>XNs,PrimitiveSchemaWithExample:()=>uno,QueryParameterWithExample:()=>ano,RequestWithExample:()=>FNs,ResponseWithExample:()=>xNs,SchemaWithExample:()=>F6,StringSchemaWithExample:()=>GNs,Uint64WithExample:()=>VNs,UintWithExample:()=>UNs,UnDiscriminatedOneOfSchemaWithExample:()=>sFs,UnknownSchemaWithExample:()=>kNs,WebhookWithExample:()=>bWy,WebsocketHandshakeWithExample:()=>yWy});var nyt=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),value:Gr.unknown()}).extend(ky);var ano=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>F6),parameterNameOverride:Gr.string().optional()}).extend(ky).extend(IP).extend(XA);var I2i=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>F6),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(ky).extend(IP).extend(XA);var yWy=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(ano),headers:Gr.list(I2i)});var BNs=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>F6),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(ky).extend(IP).extend(XA);var TNs=Gr.objectWithoutOptionalProperties({}).extend(Vro).extend(iVr);var qNs=Gr.objectWithoutOptionalProperties({}).extend(Wro).extend(iVr);var RNs=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>F6),contentType:Gr.string().optional(),fullExamples:Gr.list(nyt).optional(),additionalProperties:Gr.boolean()}).extend(ky).extend(XA).extend(iVr);var NNs=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>F6),contentType:Gr.string().optional(),fullExamples:Gr.list(nyt).optional(),additionalProperties:Gr.boolean()}).extend(ky).extend(XA).extend(iVr);var FNs=Gr.union("type",{octetStream:TNs,multipart:qNs,json:RNs,formUrlEncoded:NNs}).transform({transform:e=>{switch(e.type){case"octetStream":return ZCe.octetStream(e);case"multipart":return ZCe.multipart(e);case"json":return ZCe.json(e);case"formUrlEncoded":return ZCe.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var ono=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>F6),responseProperty:Gr.string().optional(),fullExamples:Gr.list(nyt).optional()}).extend(ky).extend(XA).extend(ryt);var xNs=Gr.union("type",{file:Hro,json:ono,text:C2i,bytes:Jro,streamingSse:ono,streamingText:C2i,streamingJson:ono}).transform({transform:e=>{switch(e.type){case"file":return QL.file(e);case"json":return QL.json(e);case"text":return QL.text(e);case"bytes":return QL.bytes(e);case"streamingSse":return QL.streamingSse(e);case"streamingText":return QL.streamingText(e);case"streamingJson":return QL.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var zNs=Gr.objectWithoutOptionalProperties({statusCode:nVr,schema:Gr.lazy(()=>F6),fullExamples:Gr.list(nyt).optional()}).extend(ky).extend(eD).extend(XA);var vWy=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:zro,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:Qro,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(eMe),pathParameters:Gr.list(BNs),queryParameters:Gr.list(ano),headers:Gr.list(I2i),sdkName:aVr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:FNs.optional(),response:xNs.optional(),errors:Gr.record(nVr,zNs),servers:Gr.list(Kro),examples:Gr.list(Xro),pagination:Zro.optional(),retries:kro.optional()}).extend(ky).extend(IP).extend(XA).extend(dS);var bWy=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:aVr.optional(),method:eno,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(eMe),headers:Gr.list(I2i),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>F6),examples:Gr.list(tno)}).extend(ky).extend(XA).extend(dS);var QNs=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional(),example:Gr.number().optional()});var LNs=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var UNs=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var VNs=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var WNs=Gr.objectWithoutOptionalProperties({example:Gr.number().optional()});var HNs=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional(),example:Gr.number().optional()});var GNs=Gr.objectWithoutOptionalProperties({default:Gr.string().optional(),pattern:Gr.string().optional(),format:Gr.string().optional(),minLength:Gr.number().optional(),maxLength:Gr.number().optional(),example:Gr.string().optional()});var JNs=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var KNs=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var $Ns=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var YNs=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional(),example:Gr.boolean().optional()});var XNs=Gr.union("type",{int:QNs,int64:LNs,uint:UNs,uint64:VNs,float:WNs,double:HNs,string:GNs,datetime:JNs,date:KNs,base64:$Ns,boolean:YNs}).transform({transform:e=>{switch(e.type){case"int":return z0.int(e);case"int64":return z0.int64(e);case"uint":return z0.uint(e);case"uint64":return z0.uint64(e);case"float":return z0.float(e);case"double":return z0.double(e);case"string":return z0.string(e);case"datetime":return z0.datetime(e);case"date":return z0.date(e);case"base64":return z0.base64(e);case"boolean":return z0.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var uno=Gr.objectWithoutOptionalProperties({schema:XNs}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(dI);var ZNs=Gr.objectWithoutOptionalProperties({default:E2i.optional(),values:Gr.list(E2i),example:Gr.string().optional()}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(XA).extend(dI).extend(N6);var kNs=Gr.objectWithoutOptionalProperties({example:Gr.unknown()}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(dI);var F6=Gr.union("type",{primitive:uno,object:Gr.lazyObject(()=>iFs),array:Gr.lazyObject(()=>eFs),map:Gr.lazyObject(()=>tFs),optional:Gr.lazyObject(()=>rFs),enum:ZNs,reference:oVr,literal:rno,oneOf:Gr.object({value:Gr.lazy(()=>aFs)}),nullable:Gr.lazyObject(()=>nFs),unknown:kNs}).transform({transform:e=>{switch(e.type){case"primitive":return mh.primitive(e);case"object":return mh.object(e);case"array":return mh.array(e);case"map":return mh.map(e);case"optional":return mh.optional(e);case"enum":return mh.enum(e);case"reference":return mh.reference(e);case"literal":return mh.literal(e);case"oneOf":return mh.oneOf(e.value);case"nullable":return mh.nullable(e);case"unknown":return mh.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var eFs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>F6),example:Gr.list(Gr.unknown()).optional()}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(dI).extend(N6);var tFs=Gr.objectWithoutOptionalProperties({key:uno,value:Gr.lazy(()=>F6),example:Gr.unknown().optional()}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(Kxe).extend(dI).extend(N6);var rFs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>F6)}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(dI).extend(N6);var nFs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>F6)}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(dI).extend(N6);var iFs=Gr.objectWithoutOptionalProperties({allOf:Gr.list(oVr),properties:Gr.list(Gr.lazyObject(()=>oFs)),allOfPropertyConflicts:Gr.list(nno),fullExamples:Gr.list(nyt).optional(),additionalProperties:Gr.boolean()}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(XA).extend(dI).extend(N6);var oFs=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>F6),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),audiences:Gr.list(Gr.string()),conflict:Gr.record(kCe,ino),nameOverride:Gr.string().optional(),generatedName:Gr.string()}).extend(IP);var aFs=Gr.union("type",{discriminated:Gr.lazyObject(()=>uFs),undiscriminated:Gr.lazyObject(()=>sFs)}).transform({transform:e=>{switch(e.type){case"discriminated":return Vnt.discriminated(e);case"undiscriminated":return Vnt.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var uFs=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>cFs)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>F6))}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(Kxe).extend(XA).extend(dI).extend(N6);var cFs=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>F6)});var sFs=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>F6))}).extend(pI).extend(dS).extend(eD).extend(ky).extend(IP).extend(Kxe).extend(XA).extend(dI).extend(N6);var gWy=/^(\d+)/,sno=/^[a-zA-Z][a-zA-Z0-9_]*$/,mWy={"<":"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 B2i(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],n=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let o=Math.floor(e/10),c=e%10;return c===0?n[o]:`${n[o]}_${t[c]}`}if(e<1e3){let o=Math.floor(e/100),c=e%100;return c===0?`${t[o]}_hundred`:`${t[o]}_hundred_${B2i(c)}`}let i=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[i]}_thousand`:`${t[i]}_thousand_${B2i(a)}`}function bXo(e){let t=e.match(gWy);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let a=B2i(i);return n.length>0?`${a}_${n}`:a}}}function cno(e){let t=bXo(e),r=mWy[e];return t!=null?GU(EA(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":GU(EA(e)))}function $xe(e,t){return e.type==="primitive"&&t.type==="primitive"?OWy(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?I5C(e.values,t.values):e.type==="array"&&t.type==="array"?$xe(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"?$xe(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?B5C(e.value,t.value):e.type==="object"&&t.type==="object"?T5C(e,t):e.type==="map"&&t.type==="map"?OWy(e.key.schema,t.key.schema)&&$xe(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function OWy(e,t){return e.type===t.type}function I5C(e,t){let r=new Set(...e.map(i=>i.value)),n=new Set(...t.map(i=>i.value));return Due(r,n)}function B5C(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,n])=>{let i=t.schemas[r];return i==null?!1:$xe(n,i)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,n)=>{let i=t.schemas[n];return i==null?!1:$xe(r,i)}):!1}function T5C(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(n=>[n.key,n.schema]));return Object.entries(t.properties).every(([n,i])=>{let a=r[n];return a==null?!1:$xe(a,i.schema)})}function PJ(e){switch(e){case Nde.Deprecated:return"deprecated";case Nde.Beta:return"pre-release";case Nde.GenerallyAvailable:return"generally-available";default:return}}function q5C(e){let t=e.find(n=>typeof n=="object"&&n.type==="namespace"),r=e.filter(n=>typeof n=="string"||n.type!=="namespace");return t?[t,...r]:r}function AWy(e){let t=e?q5C(e):void 0;if(t==null||t.length===0)return Yia;let r=[];for(let[n,i]of t.entries())if(typeof i=="string")r.push(EA(i));else if(typeof i=="object")switch(i.type){case"namespace":{n<t.length-1?r.push(EA(i.name)):r.push(i.name,Yia);break}default:nc(i.type)}else nc(i);return r.join("/")}function T2i(e){return rw.of(`${AWy(e)}.yml`)}function jIf({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?Yia:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,AWy(r))}function PWy({sdkName:e,namespaceOverride:t}){return rw.of(`${jIf({sdkName:e,namespaceOverride:t})}.yml`)}function wWy({location:e,namespaceOverride:t}){return t!=null?BX(rw.of(t),e):e}function lFs(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:nc(e.type)}}function lno(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:nc(e)}}function x6(e){return typeof e=="string"?e:e.type}function fno(e){if(typeof e!="string")return e.docs}function gXo(e){if(typeof e!="string")return e.default}function EIf(e){if(typeof e!="string")return e.validation}function EWy(e){let t=x6(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?jWy(e):{...e,type:jWy(e.type)}}function jWy(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function wla(e){return x6(e).startsWith("optional<")?e:typeof e=="string"?SWy(e):{...e,type:SWy(e.type)}}function SWy(e){return e.startsWith("optional<")?e:`optional<${e}>`}var R5C=-2147483648,N5C=2147483647,F5C=-17976931348623157e292,x5C=17976931348623157e292;function UD({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i,declarationDepth:a}){switch(n.shouldMarkSchemaAsReferenced()&&n.markSchemaAsReferenced(e,i),e.type){case"primitive":return fFs(e);case"array":return CIf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"map":return MIf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"reference":return DIf({schema:e,fileContainingReference:t,context:n,namespace:i});case"unknown":return BIf();case"optional":return dFs({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"nullable":return IIf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"enum":return J5C({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:a});case"literal":return e.value,TIf(e);case"object":return K5C({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"oneOf":return $5C({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});default:nc(e)}}function fFs(e){switch(e.schema.type){case"string":return L5C({description:e.description,schema:e.schema});case"int":return U5C({description:e.description,schema:e.schema});case"float":return V5C({description:e.description,schema:e.schema});case"double":return W5C({description:e.description,schema:e.schema});case"boolean":return z5C({description:e.description,schema:e.schema});case"int64":return Q5C({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:PJ(e.availability)}:{}}}function z5C({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function Q5C({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function L5C({description:e,schema:t}){let r="string",n=H5C(t);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function U5C({description:e,schema:t}){let r="integer",n=DWy(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function V5C({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function W5C({description:e,schema:t}){let r="double",n=DWy(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function H5C(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,a=G5C(t);if(!(a==null&&r==null&&n==null&&i==null))return{format:a,pattern:r,minLength:n,maxLength:i}}function G5C(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 DWy(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:a,exclusiveMaximum:o}=e;if(r=SIf(r,t),n=SIf(n,t),i=SIf(i,t),!(r==null&&n==null&&a==null&&o==null&&i==null))return{min:r,max:n,exclusiveMin:a,exclusiveMax:o,multipleOf:i}}function SIf(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[R5C,N5C]:[F5C,x5C];return e<r||e>n?void 0:e}function DIf({schema:e,fileContainingReference:t,context:r,namespace:n}){let i=r.getSchema(e.schema,n);if(i==null)return"unknown";let a=Y5C(i)??e.schema,o=lno(i),c=X5C(i),s=pFs({context:r,fileContainingReference:t,declarationFile:T2i(o),type:a});return i.type==="nullable"&&(s=r.wrapReferencesToNullableInOptional?`optional<${s}>`:`nullable<${s}>`),i.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:PJ(e.availability)}:{}}}function CIf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=UD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=`list<${x6(o)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:PJ(e.availability)}:{},type:c}}function MIf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=fFs(e.key),c=UD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),d=e.encoding!=null?lFs(e.encoding):void 0,s=`map<${x6(o)}, ${x6(c)}>`;if(e.description==null&&d==null&&e.title==null)return s;let u={type:s};return e.description!=null&&(u.docs=e.description),e.encoding!=null&&(u.encoding=d),e.availability!=null&&(u.availability=PJ(e.availability)),u}function IIf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){if(!n.respectNullableSchemas)return dFs({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});let o=UD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=x6(o),d=fno(o),s=gXo(o),u=EIf(o),l=EWy(c);if(n.wrapReferencesToNullableInOptional&&(l=wla(l)),e.availability==null&&e.description==null&&d==null&&s==null&&u==null&&e.title==null)return l;let m=typeof l=="string"?{type:l}:l;return(e.description!=null||d!=null)&&(m.docs=e.description??d),s!=null&&(m.default=s),u!=null&&(m.validation=u),e.availability!=null&&(m.availability=PJ(e.availability)),m}function dFs({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=UD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=x6(o),d=fno(o),s=gXo(o),u=EIf(o),l=wla(c);if(e.availability==null&&e.description==null&&d==null&&s==null&&u==null&&e.title==null)return l;let m=typeof l=="string"?{type:l}:l;return(e.description!=null||d!=null)&&(m.docs=e.description??d),s!=null&&(m.default=s),u!=null&&(m.validation=u),e.availability!=null&&(m.availability=PJ(e.availability)),m}function BIf(){return"unknown"}function TIf(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:nc(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:PJ(e.availability)}:{}}}function J5C({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let a=mXo(e,i),o=e.nameOverride??e.generatedName;n.builder.addType(r,{name:o,schema:a.schema});let c=pFs({type:o,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return c;let d={type:c};return e.description!=null&&(d.docs=e.description),e.default!=null&&(d.default=e.default.value),e.availability!=null&&(d.availability=PJ(e.availability)),d}function K5C({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=qIf({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:o.schema});let d=pFs({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?d:{type:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:PJ(e.availability)}:{}}}function $5C({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=RIf({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:o.schema});let d=pFs({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?d:{...e.title!=null?{"display-name":e.title}:{},type:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:PJ(e.availability)}:{}}}function pFs({type:e,fileContainingReference:t,declarationFile:r,context:n}){if(r===t)return e;let i=n.builder.addImport({file:t,fileToImport:r});return i!=null?`${i}.${e}`:e}function Y5C(e){return Vj._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 X5C(e){return Vj._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 ase;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(ase||(ase={}));function HAi(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:nc(e)}}function MWy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a;switch(e.type){case"primitive":a=eQC(e);break;case"array":a=Z5C({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":a=k5C({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":a=tQC({schema:e,context:t,declarationFile:r,namespace:n});break;case"unknown":a=nQC(e.nameOverride,e.generatedName);break;case"optional":a=IWy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":a=rQC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":a=mXo(e,i);break;case"literal":a=iQC(e,e.nameOverride,e.generatedName);break;case"object":a=qIf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"oneOf":a=RIf({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;default:nc(e)}return a}function qIf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=t.isInState(ase.Request)&&t.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),o=!1,c={},d=new Set;for(let A of e.properties){if(A.readonly&&(o=!0),a&&A.readonly)continue;if(Object.keys(A.conflict).length>0){if(Object.entries(A.conflict).every(([R,V])=>!V.differentSchema))continue;Object.entries(A.conflict).forEach(([R])=>{NIf({property:A.key,schemaId:R,context:t,namespace:n}).forEach($=>{d.add($)})})}let P=UD({schema:A.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}),C=A.audiences,I=A.nameOverride,T=PJ(A.availability),z=sQC(A);c[A.key]=uQC({typeReference:P,audiences:C,name:I,availability:T,propertyAccess:z})}let s=new Set;for(let A of e.allOfPropertyConflicts)A.allOfSchemaIds.forEach(P=>d.add(P)),A.conflictingTypeSignatures&&s.add(A.propertyKey);let u=[];for(let A of e.allOf){let P=BWy({schema:A.schema,context:t,namespace:n});if(P==null||d.has(A.schema)||d.has(P))continue;let C=UD({schema:Vj.reference(A),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});u.push(x6(C))}for(let A of d){let P=FIf(t,A,n);for(let C of P.properties)c[C.key]==null&&(s.has(C.key)&&(c[C.key]="unknown"),c[C.key]=UD({schema:C.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}));for(let C of P.allOf){if(d.has(C.schema))continue;let I=UD({schema:Vj.reference(C),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});u.push(x6(I))}}let l={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([A,P])=>oQC(A)?[A,typeof P=="string"?{type:P,name:`_${A}`}:{...P,name:`_${A}`}]:[A,P]))};u.length>0&&(l.extends=u),e.additionalProperties&&(l["extra-properties"]=!0),e.availability!=null&&(l.availability=PJ(e.availability)),e.source!=null&&(l.source=HAi(e.source)),l.inline=xIf(e,i);let m=e.nameOverride??e.generatedName;return{name:o&&t.respectReadonlySchemas&&!a?`${m}Read`:m,schema:l}}function NIf({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return NIf({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:a,allOf:o}=FIf(r,t,n),c=a.some(s=>s.key===e),d=[...o.flatMap(s=>NIf({property:e,context:r,schemaId:s.schema,namespace:n}))];if(c||d.length>0)return[t,...d]}return[]}function FIf(e,t,r){let n=e.getSchema(t,r);if(n==null)return{properties:[],allOf:[]};if(n.type==="object")return{properties:n.properties,allOf:n.allOf};if(n.type==="reference")return FIf(e,n.schema,r);throw new Error(`Cannot getAllProperties for a non-object schema. schemaId=${t}, type=${n.type}`)}function Z5C({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:CIf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function k5C({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:MIf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function eQC(e){let t=fFs(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...n}=t;return{name:e.nameOverride??e.generatedName,schema:{...n}}}function CWy(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function mXo(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||CWy(a.casing)))return o;let d={value:a.value};if(o!==c&&(d.name=o),a.description!=null&&(d.docs=a.description),a.casing!=null&&!CWy(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&&(d.casing=s)}return d})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=xIf(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?HAi(e.source):void 0};for(let a of r.enum){let o=typeof a=="string"?a:a.name??a.value;n.has(o.toLowerCase())||(i.enum.push(a),n.add(o.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function tQC({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:DIf({schema:e,context:t,fileContainingReference:r,namespace:n})}}function rQC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:IIf({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:IWy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function IWy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:dFs({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function nQC(e,t){return{name:e??t,schema:BIf()}}function iQC(e,t,r){return{name:t??r,schema:TIf(e)}}function RIf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=e.encoding!=null?lFs(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let s of e.commonProperties)c[s.key]=UD({schema:s.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1});let d={};for(let[s,u]of Object.entries(e.schemas))d[s]=UD({schema:u,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":c,docs:e.description??void 0,availability:e.availability!=null?PJ(e.availability):void 0,union:d,encoding:a,source:e.source!=null?HAi(e.source):void 0}}}let o=[];for(let c of e.schemas)o.push(UD({schema:c,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:o,encoding:a,source:e.source!=null?HAi(e.source):void 0,inline:xIf(e,i)}}}var aQC=/^[0-9]/;function oQC(e){return aQC.test(e)}function BWy({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?BWy({context:t,schema:n.schema,namespace:r}):e}function uQC({typeReference:e,audiences:t,name:r,availability:n,propertyAccess:i}){return t.length===0&&r==null&&n==null&&i==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...n!=null?{availability:n}:{},...i!=null?{access:i}:{}}}function xIf(e,t){return e.inline===!0||t>0?!0:void 0}function sQC(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return xX.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return xX.ObjectPropertyAccess.WriteOnly}}function TWy(e){let t=e.replace(/^x-|^X-/,"");return EA(t)}var qWy="BasicAuthScheme",_Fs="BearerAuthScheme";function RWy(e){if(e.authOverrides!=null){for(let[r,n]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:n});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,n]of Object.entries(e.ir.securitySchemes))if(n.type==="basic"){let i={scheme:"basic"};n.usernameVariableName!=null&&(i.username===void 0?i.username={name:n.usernameVariableName}:i.username.name=n.usernameVariableName),n.usernameEnvVar!=null&&(i.username===void 0?i.username={env:n.usernameEnvVar}:i.username.env=n.usernameEnvVar),n.passwordVariableName!=null&&(i.password===void 0?i.password={name:n.passwordVariableName}:i.password.name=n.passwordVariableName),n.passwordEnvVar!=null&&(i.password===void 0?i.password={env:n.passwordEnvVar}:i.password.env=n.passwordEnvVar),e.builder.addAuthScheme({name:qWy,schema:i}),t||(e.builder.setAuth(qWy),t=!0)}else if(n.type==="bearer"){let i={scheme:"bearer"};n.tokenVariableName!=null&&(i.token===void 0?i.token={name:n.tokenVariableName}:i.token.name=n.tokenVariableName),n.tokenEnvVar!=null&&(i.token===void 0?i.token={env:n.tokenEnvVar}:i.token.env=n.tokenEnvVar),e.builder.addAuthScheme({name:_Fs,schema:i}),t||(e.builder.setAuth(_Fs),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??TWy(n.headerName),env:n.headerEnvVar}});else{let i={header:n.headerName,name:n.headerVariableName??"apiKey",type:"string"};n.headerEnvVar!=null&&(i.env=n.headerEnvVar),n.prefix!=null&&(i.prefix=n.prefix),e.builder.addAuthScheme({name:r,schema:i}),e.builder.setAuth(r),t=!0}else if(n.type==="oauth"){let i={scheme:"bearer"};e.builder.addAuthScheme({name:_Fs,schema:i}),t||(e.builder.setAuth(_Fs),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(rw.of("__package__.yml"),{name:"OauthScope",schema:mXo(n.scopesEnum,0).schema})}}function uVr({header:e,context:t,fileContainingReference:r,namespace:n}){let i=UD({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),a=x6(i),o=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:EA(o);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null)return a;let d={type:a};return c!==e.name&&(d.name=c),e.description!=null&&(d.docs=e.description),e.env!=null&&(d.env=e.env),e.availability!=null&&(d.availability=PJ(e.availability)),d}function hFs({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=UD({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return x6(i);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:x6(i)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=PJ(e.availability)),a}function vFs({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=zIf({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let a=x6(i.value),o=gXo(i.value);a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>");let c={type:a};return o!=null&&(c.default=o),i.allowMultiple&&(c["allow-multiple"]=!0),e.description!=null&&(c.docs=e.description),e.parameterNameOverride!=null&&(c.name=e.parameterNameOverride),e.availability!=null&&(c.availability=PJ(e.availability)),cQC(i.value)&&i.value.validation!==void 0&&(c.validation=i.value.validation),c.default==null&&c["allow-multiple"]==null&&c.docs==null&&c.name==null&&c.availability==null&&c.validation==null?a:c}function zIf({schema:e,context:t,fileContainingReference:r,namespace:n}){if(e.type==="reference"){let i=t.getSchema(e.schema,n);if(i==null)return;if(i.type==="array")return{value:UD({schema:Vj.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:rw.of(rF),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,d]of Object.entries(i.value.schemas))d.type==="primitive"&&d.schema.type==="string"&&(o=!0),d.type==="literal"&&d.value.type==="string"&&(sno.test(d.value.value)?a.push(d.value.value):a.push({value:d.value.value,name:cno(d.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[c,d]=i.value.schemas;if(c!=null&&d!=null&&yFs({array:c,primitive:d}))return{value:UD({schema:Vj.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:d,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(c!=null&&d!=null&&yFs({array:c,primitive:d}))return{value:UD({schema:Vj.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}for(let[c,d]of Object.entries(i.value.schemas))return zIf({schema:d,context:t,fileContainingReference:r,namespace:n})}else if(t.objectQueryParameters)return{value:UD({schema:e,context:t,fileContainingReference:r,declarationFile:rw.of(rF),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let i=e.type==="optional"?Vj.optional:Vj.nullable;if(e.value.type==="reference"){let a=t.getSchema(e.value.schema,n);if(a==null)return;if(a.type==="array")return{value:UD({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a.value,description:e.description??a.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:rw.of(rF),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.objectQueryParameters)return{value:UD({schema:e,context:t,fileContainingReference:r,declarationFile:rw.of(rF),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:UD({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,d]of Object.entries(e.value.value.schemas))d.type==="primitive"&&d.schema.type==="string"&&(o=!0),d.type==="literal"&&d.value.type==="string"&&(sno.test(d.value.value)?a.push(d.value.value):a.push({value:d.value.value,name:cno(d.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[c,d]=e.value.value.schemas;if(c!=null&&d!=null&&yFs({array:c,primitive:d}))return{value:UD({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:d,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(c!=null&&d!=null&&yFs({array:d,primitive:c}))return{value:UD({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}if(t.objectQueryParameters)return{value:UD({schema:e,context:t,fileContainingReference:r,declarationFile:rw.of(rF),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[c,d]of Object.entries(e.value.value.schemas))return zIf({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:d,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.objectQueryParameters?{value:UD({schema:e,context:t,fileContainingReference:r,declarationFile:rw.of(rF),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:UD({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:UD({schema:Vj.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}:{value:UD({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function yFs({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function cQC(e){return e.type!=null}function NWy({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"]=lQC(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=fQC({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=q2i(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function lQC(e){let t={};return e.forEach(r=>{let n=q2i(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function fQC({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=q2i(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function q2i(e){switch(e.type){case"primitive":return FWy(e.value);case"object":return xWy(e.properties);case"array":return dQC(e.value);case"map":return pQC(e.value);case"oneOf":return _QC(e.value);case"enum":return e.value;case"literal":return hQC(e.value);case"unknown":return q2i(e.value);case"null":return null;default:nc(e)}}function FWy(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:nc(e)}}function xWy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,q2i(r)]))}function dQC(e){return e.map(t=>q2i(t))}function pQC(e){return Object.fromEntries(e.map(t=>[FWy(t.key),q2i(t.value)]))}function _QC(e){return e.type==="discriminated"?xWy(e.value):q2i(e.value)}function hQC(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:nc(e)}}function GAi(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function bFs(e,t){return t??(e?.groupName!=null?GAi(e.groupName):void 0)}function zWy({channel:e,context:t,declarationFile:r}){let n={path:e.path,url:e.servers[0]?.name,auth:!1};e.audiences!=null&&e.audiences.length>0&&(n.audiences=e.audiences),e.summary!=null&&(n["display-name"]=e.summary),e.description!=null&&(n.docs=e.description);let i=GAi(e.groupName),a={};if(e.handshake.pathParameters.length>0)for(let d of e.handshake.pathParameters)a[d.name]=hFs({pathParameter:d,context:t,fileContainingReference:r,namespace:i});Object.keys(a).length>0&&(n["path-parameters"]=a);let o={};if(e.handshake.queryParameters.length>0)for(let d of e.handshake.queryParameters){let s=vFs({queryParameter:d,context:t,fileContainingReference:r,namespace:i});s!=null&&(o[d.name]=s)}Object.keys(o).length>0&&(n["query-parameters"]=o);let c={};if(e.handshake.headers.length>0)for(let d of e.handshake.headers){let s=uVr({header:d,context:t,fileContainingReference:r,namespace:i});c[d.name]=s}Object.keys(c).length>0&&(n.headers=c),t.builder.addChannel(r,{channel:n});for(let d of e.messages)t.builder.addChannelMessage(r,{messageId:d.name,message:{origin:d.origin,body:UD({schema:d.body,context:t,fileContainingReference:r,namespace:i,declarationDepth:0})}});for(let d of e.examples){let s=NWy({context:t,websocketExample:d});t.builder.addChannelExample(r,{example:s})}}function QWy(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var JAi="Base",yQC="Default";function jla(e){return Object.entries(e).reduce((t,[r,n])=>(ant(n)?Object.entries(n.urls).forEach(([i,a])=>{t[i]=a}):t[r]=typeof n=="string"?n:n.url,t),{})}function LWy(e){if(e.environmentOverrides!=null){for(let[T,z]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:T,schema:z});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let t={},r=[],n=e.ir.servers.some(T=>QWy(T)),i=e.ir.servers;for(let T of i)if(QWy(T)){let z={urls:{}};for(let[U,R]of Object.entries(T.urls))z.urls[U]=R.url;T.name&&(t[T.name]=z)}else if("url"in T&&T.url){let z=T.audiences?{url:T.url,audiences:T.audiences}:T.url;if(T.name==null){r.push(z);continue}t[T.name]=z}let a={},o={},c=[];for(let T of e.ir.endpoints)for(let z of T.servers){if(z.url==null&&z.name!=null){a[z.name]||(a[z.name]=[]);continue}if(z.url==null)continue;let U=z.audiences?{url:z.url,audiences:z.audiences}:z.url;if(z.name==null){c.push(U);continue}a[z.name]||(a[z.name]=[]),a[z.name]?.push({url:z.url,audiences:z.audiences}),o[z.name]=U}let d={},s=[];for(let T of e.ir.websocketServers){let z=T.audiences?{url:T.url,audiences:T.audiences}:T.url;if(T.name==null){s.push(z);continue}d[T.name]=z}let u=Object.keys(t).length,l=u>0,m=Object.keys(o).length>0,A=Object.keys(a).some(T=>a[T]?.length===0),P=Object.keys(d).length>0;if(!l&&!m&&P&&e.ir.servers.length===0){for(let[T,z]of Object.entries(d))e.builder.addEnvironment({name:T,schema:z});e.builder.setDefaultEnvironment(Object.keys(d)[0]),e.builder.setDefaultUrl(JAi);return}if(c.length>0&&e.logger.error(`Skipping endpoint level servers ${c.map(T=>typeof T=="string"?T:T.url).join(", ")} because x-fern-server-name was not provided.`),!l){let T=e.ir.servers[0]?.url,z=e.ir.servers[0]?.audiences;if(T!=null){let U=z?{url:T,audiences:z}:T;t[yQC]=U}}let C=Object.values(t).map(T=>typeof T=="string"?T:ant(T)?Object.values(T.urls)[0]:T.url),I=r.filter(T=>{let z=typeof T=="string"?T:T.url;return!C.includes(z)});if(I.length>0&&e.logger.error(`Skipping top level servers ${I.map(T=>typeof T=="string"?T:T.url).join(", ")} because x-fern-server-name was not provided.`),n){let T=!0;for(let[z,U]of Object.entries(t))if(e.builder.addEnvironment({name:z,schema:U}),T){if(e.builder.setDefaultEnvironment(z),ant(U)){let R=Object.keys(U.urls)[0];R&&e.builder.setDefaultUrl(R)}T=!1}return}if(!m&&!A){let T=!0;for(let[z,U]of Object.entries(t))if(T){if(P){let R=typeof U=="string"?U:ant(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[JAi]:R??"",...jla(d)}}})}else e.builder.addEnvironment({name:z,schema:U});e.builder.setDefaultEnvironment(z),T=!1}else if(P){let R=typeof U=="string"?U:ant(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[JAi]:R??"",...jla(d)}}})}else e.builder.addEnvironment({name:z,schema:U});P&&e.builder.setDefaultUrl(JAi)}else if(u===1){let T=Object.keys(t)[0],z=Object.values(t)[0],U=typeof z=="string"?z:ant(z)?Object.values(z.urls)[0]:z.url;e.builder.addEnvironment({name:T,schema:{urls:{[JAi]:U??"",...jla(o),...jla(d)}}}),e.builder.setDefaultEnvironment(T),e.builder.setDefaultUrl(JAi)}else{let T=new Map;for(let z of e.ir.endpoints)for(let U of z.servers)if(U.url!=null&&U.name!=null){T.has(U.name)||T.set(U.name,new Map);let R=U.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",V=T.get(U.name);V&&V.set(R,U.url)}if(T.size>0){let z=!0;for(let[U,R]of Object.entries(t)){let V=typeof R=="string"?R:ant(R)?Object.values(R.urls)[0]:R.url;if(!V)continue;let $=V.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",re={[JAi]:V};for(let[Y,te]of T.entries()){let ne=te.get($)||te.get("production")||te.values().next().value;ne&&(re[Y]=ne)}P&&Object.assign(re,jla(d)),Object.keys(re).length>1?e.builder.addEnvironment({name:U,schema:{urls:re}}):e.builder.addEnvironment({name:U,schema:V}),z&&(e.builder.setDefaultEnvironment(U),z=!1)}T.size>0&&e.builder.setDefaultUrl(JAi)}else{let z=!0;for(let[U,R]of Object.entries(t)){if(P||Object.keys(o).length>0){let V=typeof R=="string"?R:ant(R)?Object.values(R.urls)[0]:R.url;e.builder.addEnvironment({name:U,schema:{urls:{[JAi]:V??"",...jla(o),...jla(d)}}})}else e.builder.addEnvironment({name:U,schema:R});z&&(e.builder.setDefaultEnvironment(U),z=!1)}}}}var QIf=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},vQC=.75,bQC=new Set("authorization");function UWy(e){if(e.globalHeaderOverrides!=null){for(let[r,n]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:n});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,n]of Object.entries(t)){let i="optional<string>";if(n.name==null&&n.env==null&&typeof n.schema=="string")i=n.schema;else if(n!=null){let a=n.schema?lno(n.schema):void 0,o=a!=null?GAi(a):void 0,c=rw.of("api.yml");i={name:n.name,env:n.env,type:n.schema!=null?x6(UD({schema:n.schema,context:e,fileContainingReference:o?BX(rw.of(EA(o)),c):c,namespace:o,declarationDepth:0}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:i})}if(e.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let a of i.headers){if(bQC.has(a.name.toLowerCase()))continue;let o=r[a.name];if(o==null){let c=t[a.name],d=uVr({header:{...a,schema:c?.schema??a.schema,name:c?.name??a.name},fileContainingReference:rw.of(Kk),context:e,namespace:void 0});o=new QIf(d),r[a.name]=o}o.increment()}let n=e.ir.endpoints.length*vQC;for(let[i,a]of Object.entries(r)){let o=t[i],c=a.count===e.ir.endpoints.length,d=a.count>=n;o==null&&(c?e.builder.addGlobalHeader({name:i,schema:a.schema}):d&&e.builder.addGlobalHeader({name:i,schema:wla(a.schema)}))}}}function VWy(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?lno(t.schema):void 0,n=r!=null?GAi(r):void 0,i=uVr({header:{...t,schema:t.schema??Vj.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:lq.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:rw.of(Kk),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:wla(i)})}}function fwe(e){switch(e.type){case"primitive":return HWy(e.value);case"object":return GWy(e.properties);case"array":return JWy(e.value);case"map":return mQC(e.value);case"oneOf":return OQC(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return AQC(e.value);case"unknown":return fwe(e.value);case"null":return null;default:nc(e)}}function WWy(e){switch(e.type){case"withStreaming":return e.sse?{stream:gQC(e.events)}:{stream:JWy(e.events)};case"withoutStreaming":return{body:fwe(e.value)};default:nc(e)}}function HWy(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:nc(e)}}function GWy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,fwe(r)]))}function gQC(e){return e.map(t=>({event:"",data:fwe(t)}))}function JWy(e){return e.map(t=>fwe(t))}function mQC(e){return Object.fromEntries(e.map(t=>[HWy(t.key),fwe(t.value)]))}function OQC(e){return e.type==="discriminated"?GWy(e.value):fwe(e.value)}function AQC(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:nc(e)}}function KWy({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"]=PQC(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=wQC(e.queryParameters));let n=e.headers!=null&&e.headers.length>0,i=t.builder.getGlobalHeaders(),a=Object.keys(i).length>0,o=new Set(e.headers?.map(c=>c.name)??[]);if(n||a){let c=[];if(e.headers!=null)for(let d of e.headers)d.name!==t.builder.getAuthHeaderName()&&c.push(d);for(let[d,s]of Object.entries(i))if(!o.has(d))if(s!=null&&typeof s=="object"&&s.type!=null){let u=see({type:s.type,_default:void 0,validation:void 0,visitor:{primitive:l=>l.toString(),map:l=>l.toString(),list:l=>l,optional:l=>l,nullable:l=>l,set:l=>l,named:l=>l,literal:l=>{if(l.type==="string")return l.string;if(l.type==="boolean")return l.boolean.toString()},unknown:Hc}});u!=null&&c.push({name:d,value:fS.literal(A2i.string(u))})}else c.push({name:d,value:fS.primitive(AO.string(d))});r.headers=jQC({context:t,namedFullExamples:c})}return e.request!=null&&(r.request=fwe(e.request)),e.response!=null&&(r.response=WWy(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(Hw)),r}function PQC(e){let t={};return e.forEach(r=>{let n=fwe(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function wQC(e){let t={};return e.forEach(r=>{let n=fwe(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function jQC({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=fwe(n.value);i!=null&&(r[n.name]=i)}),r}function $Wy(e){return xde._visit(e,{get:()=>xX.HttpMethodSchema.Get,post:()=>xX.HttpMethodSchema.Post,put:()=>xX.HttpMethodSchema.Put,patch:()=>xX.HttpMethodSchema.Patch,delete:()=>xX.HttpMethodSchema.Delete,head:()=>xX.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 YWy(e){return e==="POST"||e==="PUT"||e==="PATCH"}function XWy({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:n}=r.ir,i=[],a=new Set,o=e.path,c=bFs(e.sdkName,e.namespace),d={};for(let I of e.pathParameters)I.parameterNameOverride&&(o=o.replace(I.name,I.parameterNameOverride)),d[I.parameterNameOverride??I.name]=hFs({pathParameter:I,context:r,fileContainingReference:t,namespace:c}),a.add(I.name);let s={};for(let I of e.queryParameters){let T=vFs({queryParameter:I,context:r,fileContainingReference:t,namespace:c});T!=null&&(s[I.name]=T,a.add(I.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:nc(e.pagination)}let l={path:o,method:$Wy(e.method),auth:Object.keys(e.security).length>0?e.security:void 0,docs:e.description??void 0,pagination:u,source:e.source!=null?HAi(e.source):void 0};!CQC({context:r,request:e.request})&&Object.keys(d).length>0&&(l["path-parameters"]=d),e.summary!=null&&(l["display-name"]=e.summary);let m={},A=r.builder.getGlobalHeaderNames(),P=r.builder.getAuthHeaderName();P!=null&&A.add(P);let C=e.headers.filter(I=>!A.has(I.name));for(let I of C){let T=uVr({header:I,context:r,fileContainingReference:t,namespace:c});m[I.name]=T,a.add(typeof T=="string"?I.name:T.name??I.name)}if(e.request!=null){r.setInState(ase.Request);let I=DQC({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.inlinePathParameters&&Object.keys(d).length>0?d:void 0,queryParameters:Object.keys(s).length>0?s:void 0,nonRequestReferencedSchemas:Array.from(n),headers:Object.keys(m).length>0?m:void 0,usedNames:a,namespace:c});l.request=I.value,i=[...i,...I.schemaIdsToExclude??[]],r.unsetInState(ase.Request)}else{let I=r.inlinePathParameters&&Object.keys(d).length>0,T=Object.keys(s).length>0,z=Object.keys(m).length>0,U={};(I||T||z)&&(U.name=e.requestNameOverride??e.generatedRequestName),I&&(U["path-parameters"]=d),T&&(U["query-parameters"]=s),z&&(U.headers=m),Object.keys(U).length>0&&(l.request=U)}if(e.response!=null&&e.response._visit({json:I=>{let T=UD({schema:I.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l.response={docs:I.description??void 0,type:x6(T)},I.statusCode!=null&&(l.response["status-code"]=I.statusCode),I.responseProperty!=null&&(l.response.property=I.responseProperty)},streamingJson:I=>{let T=UD({schema:I.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:I.description??void 0,type:x6(T),format:"json"}},streamingSse:I=>{let T=UD({schema:I.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:I.description??void 0,type:x6(T),format:"sse"}},file:I=>{l.response={docs:I.description??void 0,type:"file","status-code":I.statusCode}},bytes:I=>{l.response={docs:I.description??void 0,type:"bytes","status-code":I.statusCode}},streamingText:I=>{l["response-stream"]={docs:I.description??void 0,type:"text"}},text:I=>{l.response={docs:I.description??void 0,type:"text","status-code":I.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let I=r.getDefaultServerName(),T=e.servers[0];T==null?I!=null&&(l.url=I):l.url=T.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=PJ(e.availability)),Object.entries(e.errors).forEach(([I,T])=>{let z=T.generatedName,U=rw.of(rF);r.builder.enableUniqueErrorsPerEndpoint&&(z=`${e.generatedRequestName}${T.generatedName}`,T.schema!=null&&(T.schema.type!=="reference"&&T.schema.type!=="oneOf"?T.schema.generatedName=`${e.generatedRequestName}${T.schema.generatedName}`:T.schema.type==="oneOf"&&(T.schema.value.generatedName=`${e.generatedRequestName}${T.schema.value.generatedName}`)));let R={"status-code":parseInt(I)},V=wWy({location:ZWy,namespaceOverride:c});if(T.schema!=null){let Y=UD({schema:T.schema,context:r,fileContainingReference:V,declarationFile:V,namespace:c,declarationDepth:0});R.type=x6(Y),R.docs=T.description}r.builder.addError(V,{name:z,schema:r.isErrorUnknownSchema(parseInt(I))?{...R,type:"unknown"}:R}),l.errors==null&&(l.errors=[]);let $=r.builder.addImport({file:t,fileToImport:V});l.errors.push($!=null?`${$}.${z}`:z),R.type!=null&&T.examples?.forEach(Y=>{let te={value:fwe(Y.example),name:Y.name,docs:Y.description};r.builder.addErrorExample(V,{name:z,example:te})})}),e.examples.length>0&&(l.examples=EQC({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=SQC({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[LIf,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:i}}function EQC({endpointExamples:e,context:t}){return e.map(r=>{try{return KWy({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function SQC({retries:e}){if(e!=null)switch(e.type){case"disabled":return{disabled:e.value??void 0};default:nc(e)}}function DQC({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:a,pathParameters:o,queryParameters:c,nonRequestReferencedSchemas:d,headers:s,usedNames:u,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let m=n.schema.type==="reference"?n.schema.schema:void 0,A=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(A?.type!=="object"||m!=null&&d.includes(m)){let z=UD({schema:n.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),U={schemaIdsToExclude:[],value:{body:z}},R=Object.keys(o??{}).length>0,V=Object.keys(c??{}).length>0,$=Object.keys(s??{}).length>0;return R&&(U.value["path-parameters"]=o),V&&(U.value["query-parameters"]=c),$&&(U.value.headers=s),(R||V||$)&&(U.value.name=i??a),n.contentType!=null&&(U.value["content-type"]=n.contentType),n.description!=null&&(U.value.docs=n.description),U}let P=Object.fromEntries(A.properties.filter(z=>z.readonly==null?!0:!(YWy(e.method)&&z.readonly)).map(z=>{let U=UD({schema:z.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:1}),R=z.nameOverride??z.key,V=PJ(z.availability);if(!u.has(R)&&z.audiences.length<=0)return u.add(R),z.nameOverride!=null?[z.key,{type:x6(U),docs:fno(U),name:z.nameOverride,availability:V}]:[z.key,V?{...typeof U=="string"?{type:U}:U,availability:V}:U];let $={type:x6(U),docs:fno(U)};return u.has(R)&&($.name=z.generatedName),z.audiences.length>0&&($.audiences=z.audiences),V!=null&&($.availability=V),u.add(R),[z.key,$]})),C=A.allOf.map(z=>{let U=UD({schema:Vj.reference(z),fileContainingReference:t,context:r,namespace:l,declarationDepth:0});return x6(U)}).filter(z=>z!=="unknown"),I={properties:P};C.length>0&&(I.extends=C),n.additionalProperties&&(I["extra-properties"]=!0);let T={name:i??A.nameOverride??A.generatedName,"path-parameters":o,"query-parameters":c,headers:s,body:I};return n.contentType!=null&&(T["content-type"]=n.contentType),n.description!=null&&(T.docs=n.description),{schemaIdsToExclude:m!=null?[m]:[],value:T}}else if(n.type==="octetStream"){let m={body:"bytes","content-type":n.contentType??M7.APPLICATION_OCTET_STREAM,"query-parameters":c};return c!=null&&(m.name=i??a),n.description!=null&&(m.docs=n.description),{schemaIdsToExclude:[],value:m}}else if(n.type==="multipart"){let m=Object.fromEntries(n.properties.map(A=>{if(A.schema.type==="file"){let P=A.schema.isArray?"list<file>":"file";if(P=A.schema.isOptional?`optional<${P}>`:P,A.description!=null||A.contentType!=null){let C={type:P};if(A.description!=null&&(C.docs=A.description),A.contentType!=null){let I=A.contentType.split(",")[0];C["content-type"]=I}return[A.key,C]}return[A.key,P]}else{let P=UD({schema:A.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(A.contentType||A.exploded||A.encoding){let C=typeof P=="string"?{type:P}:P;A.contentType!=null&&(C["content-type"]=A.contentType),A.encoding==="form"?C.style="form":A.encoding==="json"?C.style="json":A.exploded&&(C.style="exploded"),P=C}return[A.key,P]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??a,"path-parameters":o,"query-parameters":c,headers:s,body:{properties:m},"content-type":M7.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else nc(n)}function CQC({context:e,request:t}){if(!e.inlinePathParameters)return!1;if(t==null)return!0;switch(t.type){case"octetStream":return!1;case"multipart":return!0;case"json":return!0;case"formUrlEncoded":return!0;default:nc(t)}}function MQC({location:e,namespaceOverride:t}){return t!=null?{...e,file:BX(rw.of(t),e.file)}:e}function IQC(e){let t=e.namespace,r=e.tags.filter(d=>d!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:rw.of(`${EA(r)}.yml`),endpointId:e.summary!=null?EA(e.summary):EA(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:rw.of(rF),endpointId:EA(e.summary)}:{file:rw.of(rF),endpointId:EA(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:rw.of(rF),endpointId:n};let i=OXo(r),a=OXo(n);if(Due(i,a))return{file:rw.of("__package__.yml"),endpointId:r};let o=qQC({operationId:n,tag:r,path:e.path,method:e.method});if(o!=null)return o;let c=[];for(let d=0;d<i.length;++d){let s=i[d];if(s!=null&&s===a[d])c.push(s);else{let u=EA(r);return{file:rw.of(`${u}.yml`),endpointId:n,tag:r}}}if(c.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:rw.of(EA(c.join("_"))+".yml"),endpointId:EA(a.slice(c.length).join("_")),tag:r}}function AXo(e){let t=e.tags[0];if(e.sdkName!=null){let r=jIf({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:rw.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return MQC({namespaceOverride:e.namespace,location:IQC(e)})}function OXo(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=tpt(t),t}var BQC=new RegExp("[^a-zA-Z0-9{}]+"),TQC=new RegExp("[{}]","g");function qQC({operationId:e,tag:t,path:r,method:n}){let a=`${r.split(BQC).join("_").replaceAll(TQC,"_")}_${n.toLowerCase()}`;if(e.endsWith(a))return{file:rw.of(EA(t)+".yml"),endpointId:EA(e.slice(0,-1*a.length)),tag:t}}function kWy(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let a of r){let{endpointId:o,file:c,tag:d}=AXo(a),s=c.split(".")[0];s!=null&&t.add(s);let u;if(a.sdkName!=null){let A=e.ir.groups;for(let P of a.sdkName.groupName){let C=typeof P=="string"?P:P.name,I=A[C];if(I==null)break;if(I.summary!=null||I.description!=null){u=A[C];break}}}let l=d==null?void 0:n.tagsById[d];e.setInState(ase.Endpoint),e.setEndpointMethod(a.method);let m=XWy({context:e,endpoint:a,declarationFile:c});e.unsetEndpointMethod(),e.unsetInState(ase.Endpoint),i=[...i,...m.schemaIdsToExclude],e.builder.addEndpoint(c,{name:o,schema:m.value,source:a.source!=null?HAi(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:i,sdkGroups:t}}function eHy(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?GAi(r.groupName):void 0,i=UD({schema:Vj.primitive(r),context:e,fileContainingReference:rw.of(rF),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:x6(i),docs:r.description??void 0}})}}function tHy(e){for(let t of e.ir.webhooks){let r=FQC({webhook:t,context:e});if(r==null)continue;let n=bFs(t.sdkName,t.namespace),i={};for(let o of t.headers)i[o.name]=uVr({header:o,context:e,fileContainingReference:r.file,namespace:n});let a={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:UD({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),examples:t.examples!=null?t.examples.map(o=>({docs:o.description,name:o.name,payload:fwe(o.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function RQC({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:BX(rw.of(t),e.file)}:e}function NQC({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:rw.of(rF),endpointId:n};let i=OXo(r),a=OXo(n);if(Due(i,a))return{file:rw.of("__package__.yml"),endpointId:r};let o=[];for(let c=0;c<i.length;++c){let d=i[c];if(d!=null&&d===a[c])o.push(d);else{let s=EA(r);return{file:rw.of(`${s}.yml`),endpointId:n,tag:r}}}if(o.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:rw.of(EA(o.join("_"))+".yml"),endpointId:EA(a.slice(o.length).join("_")),tag:r}}function FQC({webhook:e,context:t}){return e.sdkName!=null?{file:PWy({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:RQC({namespaceOverride:e.namespace,location:NQC({webhook:e,context:t})})}var xQC=rw.of(rF);function nHy(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return rHy({namespace:e.namespace,groupName:e.groupName});case"oneOf":return rHy({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return xQC;default:nc(e)}}function rHy({namespace:e,groupName:t}){return e!=null&&t!=null?T2i([{type:"namespace",name:e},...t]):e!=null?T2i([{type:"namespace",name:e}]):T2i(t)}var LIf="external",ZWy=rw.of(rF);function iHy({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,a]of Object.entries(e)){if(t.includes(i))continue;let o=nHy(a),c=MWy({schema:a,context:n,declarationFile:o,namespace:r,declarationDepth:0});if(Szi(c.schema)){let d=x6(c.schema);if(d===(c.name??i)||d===`optional<${c.name??i}>`||d===`nullable<${c.name??i}>`||d===`optional<nullable<${c.name??i}>>`)continue}n.builder.addType(o,{name:c.name??i,schema:c.schema})}}function aHy(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),LWy(e),UWy(e),VWy(e),RWy(e),eHy(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(LIf);let t=kWy(e),r=t.sdkGroups;e.setInState(ase.Webhook),tHy(e),e.unsetInState(ase.Webhook),e.setInState(ase.Channel);for(let i of Object.values(e.ir.channels)){let a=T2i(i.groupName);zWy({channel:i,context:e,declarationFile:a})}e.unsetInState(ase.Channel);let n=zQC({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});iHy({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))iHy({schemas:a,schemaIdsToExclude:n,namespace:i,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(a=>r.has(a))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.build()}function zQC({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return t;let n=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(a=>Object.keys(a))]),i=new Set(t);for(let a of n)r.includes(a)||i.add(a);return Array.from(i)}var PXo=class{context;constructor(t){this.context=t}};var gFs=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[o,c]of Object.entries(n.files)){let d=i!=null?rw.of(`${i}${"/"}${o}`):rw.of(o);t[d]=c}let a=Object.keys(n.directories).sort();for(let o of a){let c=i!=null?`${i}${"/"}${o}`:o,d=n.directories[o];r(d,c)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[rw.of(t[0])]??={};let[r,...n]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(n)}};var Ela=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new gFs,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":n,"display-name":i,docs:a}){let o=this.getOrCreateFile(t);o.service==null&&(o.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(o.service.auth=r),n!=null&&(o.service["base-path"]=n),i!=null&&(o.service["display-name"]=i),a!=null&&(o.docs=a)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return yLr(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let n of Object.values(this.rootApiFile["auth-schemes"]))oHy(n)&&t.push(n.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if(oHy(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let n=this.getVersionHeader();n!=null&&n===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}getGlobalHeaders(){return this.rootApiFile.headers??{}}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r,alias:n}){if(t===r)return;let i=n??EA((_pt(r)+"/"+vaa(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===rw.of(Kk))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=ras(_pt(xGa.of(`/${t}`)),xGa.of(`/${r}`)),i;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[i]=ras(_pt(xGa.of(`/${t}`)),xGa.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===rw.of(Kk))return;let i=this.getOrCreateFile(t);i.types==null&&(i.types={}),i.types[r]=n}addTypeExample(t,r,n){let i=this.getOrCreateFile(t);i.types==null&&(i.types={});let a=i.types[r];a!=null&&(typeof a=="string"?i.types[r]={type:a,examples:[n]}:(a.examples==null&&(a.examples=[]),a.examples.push(n)))}addError(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.errors==null&&(i.errors={}),i.errors[r]==null?i.errors[r]=n:i.errors[r]?.type!==n.type&&(i.errors[r]={"status-code":n["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:n}){let i=this.getOrCreateFile(t);if(i.errors==null)return;let a=i.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(c=>Due(c,n))??!1)||a.examples?.push(n)}addEndpoint(t,{name:r,schema:n,source:i}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),i!=null&&(a.service.source=i),a.service.endpoints[r]=n}addWebhook(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.webhooks==null&&(i.webhooks={}),i.webhooks[r]=n}addChannel(t,{channel:r}){let n=this.getOrCreateFile(t);n.channel=r;let i=this.basePath;i!=null&&(n.channel.path=BX(i,r.path))}addChannelExample(t,{example:r}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.examples==null&&(n.channel.examples=[]),n.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:n}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.messages[r]=n}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([i,a])=>[i,{...a,path:BX(r,a.path)}]))});for(let i of Object.values(t))i.service!=null&&(i.service={...i.service,endpoints:Object.fromEntries(Object.entries(i.service.endpoints).map(([a,o])=>[a,{...o,path:BX(r,o.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===rF?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 oHy(e){return e?.header!=null}var mFs=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;detectGlobalHeaders;objectQueryParameters;respectReadonlySchemas;respectNullableSchemas;onlyIncludeReferencedSchemas;inlinePathParameters;useBytesForBinaryResponse;respectForwardCompatibleEnums;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:a,authOverrides:o}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=o,this.globalHeaderOverrides=a,this.detectGlobalHeaders=n?.detectGlobalHeaders??!0,this.objectQueryParameters=n?.objectQueryParameters??!1,this.respectReadonlySchemas=n?.respectReadonlySchemas??!1,this.respectNullableSchemas=n?.respectNullableSchemas??!1,this.onlyIncludeReferencedSchemas=n?.onlyIncludeReferencedSchemas??!1,this.inlinePathParameters=n?.inlinePathParameters??!1,this.useBytesForBinaryResponse=n?.useBytesForBinaryResponse??!1,this.respectForwardCompatibleEnums=n?.respectForwardCompatibleEnums??!1,this.referencedSchemaIds=n?.onlyIncludeReferencedSchemas?new Set:void 0,this.enableUniqueErrorsPerEndpoint=n?.enableUniqueErrorsPerEndpoint??!1,this.wrapReferencesToNullableInOptional=n?.wrapReferencesToNullableInOptional??!0,this.coerceOptionalSchemasToNullable=n?.coerceOptionalSchemasToNullable??!0,this.builder=new Ela(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let c={};if(!this.enableUniqueErrorsPerEndpoint)for(let d of r.endpoints)for(let[s,u]of Object.entries(d.errors)){let l=parseInt(s),m=c[l];m==null&&u.schema!=null?c[l]=u.schema:m!=null&&u.schema!=null&&$xe(m,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}isErrorUnknownSchema(t){return this.unknownSchema.has(t)}getEndpointMethod(){return this.endpointMethod}setEndpointMethod(t){this.endpointMethod=t}unsetEndpointMethod(){this.endpointMethod=void 0}isInState(t){return this.state.has(t)}setInState(t){this.state.add(t)}unsetInState(t){this.state.delete(t)}shouldMarkSchemaAsReferenced(){return this.onlyIncludeReferencedSchemas&&this.isInAnyState(ase.Channel,ase.Endpoint,ase.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:nc(t)}}markObjectSchemaAsReferenced(t,r){for(let n of t.allOf)this.markSchemaIdAsReferenced(n.schema,r);for(let n of t.properties)this.markSchemaAsReferenced(n.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let n of Object.values(t.schemas))this.markSchemaAsReferenced(n,r);return;case"undiscriminated":for(let n of t.schemas)this.markSchemaAsReferenced(n,r);return;default:nc(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let n=this.getSchema(t,r);n!=null&&this.markSchemaAsReferenced(n,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}};function UIf(e){let t=new mFs(e);return aHy(t)}var OFs=class{args;constructor(t){this.args=t}convert({context:t,ir:r,settings:n,absoluteFilePath:i}){let a=UIf({taskContext:t,ir:r,options:dXo({overrides:{...n,respectReadonlySchemas:n?.respectReadonlySchemas??this.args.respectReadonlySchemas,respectNullableSchemas:n?.respectNullableSchemas??this.args.respectNullableSchemas,wrapReferencesToNullableInOptional:n?.wrapReferencesToNullableInOptional??this.args.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:n?.coerceOptionalSchemasToNullable??this.args.coerceOptionalSchemasToNullable,onlyIncludeReferencedSchemas:n?.onlyIncludeReferencedSchemas??this.args.onlyIncludeReferencedSchemas,inlinePathParameters:n?.inlinePathParameters??this.args.inlinePathParameters,objectQueryParameters:n?.objectQueryParameters??this.args.objectQueryParameters,useBytesForBinaryResponse:n?.useBytesForBinaryResponse??this.args.useBytesForBinaryResponse,respectForwardCompatibleEnums:n?.respectForwardCompatibleEnums??this.args.respectForwardCompatibleEnums}}),authOverrides:n?.auth!=null?{auth:n.auth}:this.args.generatorsConfiguration?.api?.auth!=null?{...this.args.generatorsConfiguration.api}:void 0,environmentOverrides:this.args.generatorsConfiguration?.api?.environments!=null?{...this.args.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.args.generatorsConfiguration?.api?.headers!=null?{...this.args.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:i??this.args.absoluteFilePath,rootApiFile:{defaultUrl:a.rootApiFile["default-url"],contents:a.rootApiFile,rawContents:Qg.dump(a.rootApiFile)},namedDefinitionFiles:{...pg(a.definitionFiles,o=>({absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Qg.dump(o),contents:o})),[rw.of(rF)]:{absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Qg.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var wXo=class extends fqr{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;resolveAliases;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.converter=new OFs(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:n},i){let a=await this.getOpenAPIIr({context:t,relativePathToDependency:n},i);return this.converter.convert({context:t,ir:a,settings:i,absoluteFilePath:r})}async toFernWorkspace({context:t},r){let n=await this.getDefinition({context:t},r);return new Lnt({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion})}};var Nbe={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 dno={of(e){return e}};var uHy={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},VIf={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:uHy,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},Ab={SOURCE:dno.of("source"),SDK_NAMESPACE:dno.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:dno.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:dno.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:dno.of("x-fern-groups"),OPENAPI_OVERIDES_FILEPATH:"x-fern-overrides-filepath",TYPE_DEFINITION:"x-fern-type",STREAMING:"x-fern-streaming",PAGINATION:"x-fern-pagination",WEBHOOK:"x-fern-webhook",ASYNC_CONFIG:"x-fern-async-config",RETRIES:"x-fern-retries",SDK_VARIABLES:"x-fern-sdk-variables",SDK_VARIABLE:"x-fern-sdk-variable",PARAMETER_NAME:"x-fern-parameter-name",BASIC_AUTH_USERNAME_VARIABLE_NAME:"x-fern-username-variable-name",BASIC_AUTH_PASSWORD_VARIABLE_NAME:"x-fern-password-variable-name",BEARER_TOKEN_VARIABLE_NAME:"x-fern-token-variable-name",HEADER_VARIABLE_NAME:"x-fern-header-variable-name",FERN_ENUM:"x-fern-enum",AUDIENCES:"x-fern-audiences",IGNORE:"x-fern-ignore",AVAILABILITY:"x-fern-availability",RESPONSE_PROPERTY:"x-fern-sdk-return-value",RESOLUTIONS:"x-fern-resolutions",EXAMPLES:"x-fern-examples",FERN_BEARER_TOKEN:"x-fern-bearer",FERN_HEADER_AUTH:"x-fern-header",FERN_BASIC_AUTH:"x-fern-basic",FERN_GLOBAL_HEADERS:"x-fern-global-headers",FERN_IDEMPOTENCY_HEADERS:"x-fern-idempotency-headers",IDEMPOTENT:"x-fern-idempotent",FERN_PROPERTY_NAME:"x-fern-property-name",IS_UNDISCRIMINATED:"x-fern-undiscriminated",FERN_VERSION:"x-fern-version",ENCODING:"x-fern-encoding",TRANSPORT:"x-fern-transport",IS_DISCRIMINATED:"x-fern-discriminated"};var EV={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!0,audiences:void 0,optionalAdditionalProperties:!0,coerceEnumsToLiterals:!0,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,preserveSchemaIds:!1,objectQueryParameters:!1,shouldUseUndiscriminatedUnionsWithLiterals:!1,shouldUseIdiomaticRequestNames:!1,filter:void 0,asyncApiNaming:"v1",exampleGeneration:void 0,defaultFormParameterEncoding:"json",useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,additionalPropertiesDefaultsTo:!1,typeDatesAsStrings:!0,preserveSingleSchemaOneOf:!1,inlineAllOfSchemas:!1,resolveAliases:!1,groupMultiApiEnvironments:!1,wrapReferencesToNullableInOptional:!0,coerceOptionalSchemasToNullable:!0};function iyt({options:e,overrides:t}){return{disableExamples:t?.disableExamples??EV.disableExamples,discriminatedUnionV2:t?.discriminatedUnionV2??e?.discriminatedUnionV2??EV.discriminatedUnionV2,useTitlesAsName:t?.useTitlesAsName??e?.useTitlesAsName??EV.useTitlesAsName,audiences:t?.audiences??e?.audiences??EV.audiences,optionalAdditionalProperties:t?.optionalAdditionalProperties??e?.optionalAdditionalProperties??EV.optionalAdditionalProperties,coerceEnumsToLiterals:t?.coerceEnumsToLiterals??e?.coerceEnumsToLiterals??EV.coerceEnumsToLiterals,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??EV.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??EV.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??EV.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??EV.inlinePathParameters,preserveSchemaIds:t?.preserveSchemaIds??EV.preserveSchemaIds,shouldUseUndiscriminatedUnionsWithLiterals:t?.shouldUseUndiscriminatedUnionsWithLiterals??e?.shouldUseUndiscriminatedUnionsWithLiterals??EV.shouldUseUndiscriminatedUnionsWithLiterals,shouldUseIdiomaticRequestNames:t?.shouldUseIdiomaticRequestNames??e?.shouldUseIdiomaticRequestNames??EV.shouldUseIdiomaticRequestNames,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??EV.objectQueryParameters,filter:t?.filter??e?.filter??EV.filter,asyncApiNaming:t?.asyncApiNaming??e?.asyncApiNaming??EV.asyncApiNaming,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??EV.useBytesForBinaryResponse,exampleGeneration:t?.exampleGeneration??e?.exampleGeneration??void 0,defaultFormParameterEncoding:t?.defaultFormParameterEncoding??e?.defaultFormParameterEncoding??void 0,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??EV.respectForwardCompatibleEnums,additionalPropertiesDefaultsTo:t?.additionalPropertiesDefaultsTo??e?.additionalPropertiesDefaultsTo??EV.additionalPropertiesDefaultsTo,typeDatesAsStrings:t?.typeDatesAsStrings??e?.typeDatesAsStrings??EV.typeDatesAsStrings,preserveSingleSchemaOneOf:t?.preserveSingleSchemaOneOf??e?.preserveSingleSchemaOneOf??EV.preserveSingleSchemaOneOf,inlineAllOfSchemas:t?.inlineAllOfSchemas??e?.inlineAllOfSchemas??EV.inlineAllOfSchemas,resolveAliases:t?.resolveAliases??e?.resolveAliases??EV.resolveAliases,groupMultiApiEnvironments:t?.groupMultiApiEnvironments??e?.groupMultiApiEnvironments??EV.groupMultiApiEnvironments,wrapReferencesToNullableInOptional:t?.wrapReferencesToNullableInOptional??e?.wrapReferencesToNullableInOptional??EV.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:t?.coerceOptionalSchemasToNullable??e?.coerceOptionalSchemasToNullable??EV.coerceOptionalSchemasToNullable}}var sHy={naming:"v1"};function Hy(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function jXo(e,t,r,n,i=[]){try{let a=Hy(e,t);if(a!=null)return r.parse(a)}catch{let o=tpt(i).join(" -> ");n.error(`${o.length>0?`${o}: `:""}Failed to parse ${t}`)}}function Sla(e){let t=Hy(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 cHy({schema:e,logger:t}){return Hy(e,Ab.ENCODING)??void 0}function lHy(e){return Hy(e,Ab.FERN_ENUM)}function fHy({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:a}){let o=Hy(n,Ab.SDK_NAMESPACE),c=Hy(n,Ab.SDK_GROUP_NAME),d=Hy(n,Ab.TYPE_DEFINITION);if(d!=null)return EXo({fernType:d,nameOverride:e,generatedName:t,title:r,description:i,availability:a,namespace:o,groupName:typeof c=="string"?[c]:c})}function EXo({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c}){return see({type:e,_default:void 0,validation:void 0,visitor:{primitive:d=>{switch(d.v1){case"BASE_64":return mh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:z0.base64({example:void 0})});case"BOOLEAN":return mh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:z0.boolean({default:void 0,example:void 0})});case"DATE":return mh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:z0.date({example:void 0})});case"DATE_TIME":return mh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:z0.datetime({example:void 0})});case"FLOAT":return mh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:z0.float({example:void 0})});case"DOUBLE":return mh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:z0.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 mh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:z0.uint({default:void 0,example:void 0})});case"INTEGER":return mh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:z0.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 mh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:z0.uint64({default:void 0,example:void 0})});case"LONG":return mh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:z0.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return mh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:z0.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:nc(d.v1)}},unknown:()=>mh.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:a,namespace:o,groupName:c}),map:({keyType:d,valueType:s})=>d?.type==="primitive"&&s!=null?mh.map({nameOverride:t,generatedName:r,title:n,key:d,value:s,description:i,availability:a,namespace:o,groupName:c,encoding:void 0,example:void 0,inline:void 0}):void 0,list:d=>d!=null?mh.array({nameOverride:t,generatedName:r,title:n,value:d,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,optional:d=>d!=null?mh.optional({nameOverride:t,generatedName:r,title:n,value:d,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,nullable:d=>d!=null?mh.nullable({nameOverride:t,generatedName:r,title:n,value:d,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,set:d=>d!=null?mh.array({nameOverride:t,generatedName:r,title:n,value:d,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,literal:d=>mh.literal({nameOverride:t,generatedName:r,title:n,value:d._visit({string:s=>jV.string(s),boolean:s=>jV.boolean(s),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:a,namespace:o,groupName:c}),named:d=>mh.reference({schema:d,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,source:cwe.openapi({file:"<memory>"})})}})}function dHy(e){let t=Hy(e,Ab.SOURCE);if(t!=null)return t.endsWith(".proto")?cwe.protobuf({file:t}):cwe.openapi({file:t})}function Dla(e){if(e!=null&&typeof e=="boolean")return e}function $g(e){return e?.$ref!=null}function pHy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:d,context:s,namespace:u,groupName:l,example:m,encoding:A,source:P}){return i===void 0&&(i=s.options.additionalPropertiesDefaultsTo),WIf({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:d,description:a,availability:o,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:z0.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),namespace:void 0,groupName:void 0},valueSchema:typeof i=="boolean"||SXo(i,s.options)?mh.unknown({...QQC(i),generatedName:`${t}Value`}):_Hy(pS(i,!1,s.options.optionalAdditionalProperties?d:!1,s,[...n,"Value"],P,u,void 0,void 0,void 0)),namespace:u,groupName:l,example:m,encoding:A})}function _Hy(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=_Hy(e.value);break;case"oneOf":e.value.inline=!0;break;default:nc(e)}return e}function WIf({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsOptional:a,wrapAsNullable:o,description:c,availability:d,namespace:s,groupName:u,example:l,encoding:m}){let A=mh.map({nameOverride:e,generatedName:t,title:r,description:c,availability:d,key:n,value:i,namespace:s,groupName:u,encoding:m,example:l,inline:void 0});return o&&(A=mh.nullable({nameOverride:e,generatedName:t,title:r,value:A,description:c,availability:d,namespace:s,groupName:u,inline:void 0})),a&&(A=mh.optional({nameOverride:e,generatedName:t,title:r,value:A,description:c,availability:d,namespace:s,groupName:u,inline:void 0})),A}function SXo(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:!($g(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 QQC(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"||$g(e)||typeof e!="object"||(e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description)),t}function hHy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:d,context:s,namespace:u,groupName:l,example:m,source:A}){let P=i==null?mh.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:u,groupName:l}):pS(i,!1,!1,s,[...n,"Item"],A,u);return LQC({nameOverride:e,generatedName:t,title:r,namespace:u,groupName:l,itemSchema:P,wrapAsOptional:c,wrapAsNullable:d,description:a,availability:o,example:m})}function LQC({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,namespace:d,groupName:s,example:u}){let l=mh.array({nameOverride:e,generatedName:t,title:r,value:n,description:o,availability:c,namespace:d,groupName:s,example:u,inline:void 0});return a&&(l=mh.nullable({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),i&&(l=mh.optional({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),l}function dwe(e){switch(Hy(e,Ab.AVAILABILITY)){case"deprecated":return Nde.Deprecated;case"beta":return Nde.Beta;case"generally-available":return Nde.GenerallyAvailable;default:break}if(!$g(e)&&e.deprecated)return Nde.Deprecated}function HIf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsOptional:d,wrapAsNullable:s,discriminator:u,context:l,namespace:m,groupName:A,encoding:P,source:C}){let I=u.propertyName,T=Object.fromEntries(Object.entries(u.mapping??{}).map(([U,R])=>{let V=KAi({$ref:R},!1,!1,l,[R],P,C,m);return l.markReferencedByDiscriminatedUnion({$ref:R},I,1),[U,V]})),z=Object.entries(i).filter(([U])=>U!==I).map(([U,R])=>{let V=c!=null&&c.includes(U),[$,re]=l.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1],Y=pS(R,$,re,l,[...n,U],C,m);return{key:U,schema:Y}});return yHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:d,wrapAsNullable:s,properties:z,description:a,availability:o,discriminant:I,subtypes:T,namespace:m,groupName:A,source:C})}function GIf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsOptional:d,wrapAsNullable:s,discriminant:u,variants:l,context:m,namespace:A,groupName:P,encoding:C,source:I}){let T=Object.fromEntries(Object.entries(l).map(([U,R])=>{if($g(R)){let V=KAi(R,!1,!1,m,[R.$ref],C,I,A);return m.markReferencedByDiscriminatedUnion(R,u,1),[U,V]}else{let V=pno(R,!1,!1,m,[...n,U],C,I,A,new Set([u]));return[U,V]}})),z=Object.entries(i).filter(([U])=>U!==u).map(([U,R])=>{let V=c!=null&&c.includes(U),[$,re]=m.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1],Y=pS(R,$,re,m,[...n,U],I,A);return{key:U,schema:Y}});return yHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:d,wrapAsNullable:s,properties:z,description:a,availability:o,discriminant:u,subtypes:T,namespace:A,groupName:P,source:I})}function yHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:a,description:o,availability:c,discriminant:d,subtypes:s,namespace:u,groupName:l,source:m}){let A=mh.oneOf(Vnt.discriminated({description:o,availability:c,discriminantProperty:d,nameOverride:e,generatedName:t,title:r,schemas:s,commonProperties:a,namespace:u,groupName:l,encoding:void 0,source:m,inline:void 0}));return i&&(A=mh.nullable({nameOverride:e,generatedName:t,title:r,value:A,namespace:u,groupName:l,description:o,availability:c,inline:void 0})),n&&(A=mh.optional({nameOverride:e,generatedName:t,title:r,value:A,namespace:u,groupName:l,description:o,availability:c,inline:void 0})),A}function vHy(e){if(e.proto!=null)return Iro.protobuf({typeName:e.proto.type})}function R2i({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:a,_default:o,description:c,availability:d,wrapAsOptional:s,wrapAsNullable:u,namespace:l,groupName:m,context:A,source:P,inline:C}){let I=VQC(i??[]),T=new Set(a),z=Array.from(T).map((R,V)=>{let $=n?.[R],re=I[V],Y=sno.test(R),te=$?.name??re,ne=Y?R:cno(R);return te!=null&&!sno.test(te)&&(A?.logger.warn(`Enum name override ${te} is not a valid name. Falling back on ${ne}.`),te=void 0),{nameOverride:te,generatedName:ne,value:R,description:$?.description,availability:d,casing:{snake:$?.casing?.snake??void 0,pascal:$?.casing?.pascal??void 0,screamingSnake:$?.casing?.screamingSnake??void 0,camel:$?.casing?.camel??void 0}}}),U=o!=null?z.find(R=>R.value===o):void 0;return UQC({wrapAsOptional:s,wrapAsNullable:u,nameOverride:e,generatedName:t,title:r,values:z,_default:U,description:c,availability:d,namespace:l,groupName:m,source:P,inline:C})}function UQC({wrapAsOptional:e,wrapAsNullable:t,nameOverride:r,generatedName:n,title:i,values:a,_default:o,description:c,availability:d,namespace:s,groupName:u,source:l,inline:m}){let A=mh.enum({nameOverride:r,generatedName:n,title:i,values:a,description:c,availability:d,default:o,example:void 0,namespace:s,groupName:u,source:l,inline:m});return t&&(A=mh.nullable({nameOverride:r,generatedName:n,title:i,value:A,description:c,availability:d,namespace:s,groupName:u,inline:m})),e&&(A=mh.optional({nameOverride:r,generatedName:n,title:i,value:A,description:c,availability:d,namespace:s,groupName:u,inline:m})),A}function VQC(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(n=>n[r]===t[r]);)r++;return e.map(n=>n.substring(r))}function bHy({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,description:u,availability:l,wrapAsOptional:m,wrapAsNullable:A,example:P,namespace:C,groupName:I}){return n==="int64"?ose({nameOverride:e,generatedName:t,title:r,primitive:z0.int64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I}):n==="uint32"?ose({nameOverride:e,generatedName:t,title:r,primitive:z0.uint({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I}):n==="uint64"?ose({nameOverride:e,generatedName:t,title:r,primitive:z0.uint64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I}):ose({nameOverride:e,generatedName:t,title:r,primitive:z0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I})}function WQC(e){return typeof e=="string"?jV.string(e):typeof e=="boolean"?jV.boolean(e):jV.string(`${e}`)}function gHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,value:a,description:o,availability:c,namespace:d,groupName:s}){let u=mh.literal({nameOverride:e,generatedName:t,title:r,value:WQC(a),description:o,availability:c,namespace:d,groupName:s});return i&&(u=mh.nullable({nameOverride:e,generatedName:t,title:r,value:u,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),n&&(u=mh.optional({nameOverride:e,generatedName:t,title:r,value:u,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),u}function JIf({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,description:u,availability:l,wrapAsOptional:m,wrapAsNullable:A,example:P,namespace:C,groupName:I}){return n==null||n==="double"?ose({nameOverride:e,generatedName:t,title:r,primitive:z0.double({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I}):n==="float"?ose({nameOverride:e,generatedName:t,title:r,primitive:z0.float({example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I}):n==="int32"?ose({nameOverride:e,generatedName:t,title:r,primitive:z0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I}):n==="int64"?ose({nameOverride:e,generatedName:t,title:r,primitive:z0.int64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I}):n==="uint32"?ose({nameOverride:e,generatedName:t,title:r,primitive:z0.uint({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I}):n==="uint64"?ose({nameOverride:e,generatedName:t,title:r,primitive:z0.uint64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I}):n==="time-delta"?ose({nameOverride:e,generatedName:t,title:r,primitive:z0.float({example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I}):ose({nameOverride:e,generatedName:t,title:r,primitive:z0.float({example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:I})}var HQC={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},GQC={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}}},JQC={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}}},KQC={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},$QC={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},YQC={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},XQC={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},ZQC={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function DXo(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],n=[HQC,GQC,JQC,KQC,$QC,YQC,XQC,ZQC],i;do{i=t;for(let a of n)if(a.isApplicable(t)){let{refUnderProcessing:o,newBreadcrumbs:c}=a.applyStrategy(t);t=o,r=[...r,...c]}}while(t.join("")!==i.join(""));return r}function jie(e,t){let n=e.map(i=>/^[^a-zA-Z0-9]+$/.test(i)?i:GU(EA(i))).join("");return/^\d/.test(n)?bXo(n)??n:n}function mHy(e){let t=e.join("_");return EA(t)}function I4(e){switch(e.type){case"object":return Vj.object({allOf:e.allOf,properties:e.properties.map(t=>eLC(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 Vj.array({description:e.description,availability:e.availability,value:I4(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"enum":return Vj.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 Vj.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 Vj.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:I4(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return Vj.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:I4(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return Vj.primitive({description:e.description,availability:e.availability,schema:OHy(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return Vj.map({description:e.description,availability:e.availability,key:Vj.primitive({description:e.key.description,availability:e.key.availability,schema:OHy(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:I4(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 Vj.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 Vj.oneOf(kQC(e.value));case"unknown":return Vj.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:nc(e)}}function kQC(e){switch(e.type){case"discriminated":return rVr.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:I4(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,I4(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return rVr.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>I4(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:nc(e)}}function OHy(e){switch(e.type){case"string":return lq.string(e);case"base64":return lq.base64();case"boolean":return lq.boolean(e);case"date":return lq.date();case"datetime":return lq.datetime();case"double":return lq.double(e);case"float":return lq.float();case"int":return lq.int(e);case"int64":return lq.int64(e);case"uint":return lq.uint();case"uint64":return lq.uint64();default:nc(e)}}function eLC(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:I4(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function AFs(e,t){return $xe(I4(e),I4(t))}function AHy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,required:o,wrapAsOptional:c,wrapAsNullable:d,allOf:s,context:u,propertiesToExclude:l,namespace:m,groupName:A,fullExamples:P,additionalProperties:C,availability:I,source:T}){let z=[...o??[]],U={...i},R=[],V=[];for(let ne of s)if(!u.options.inlineAllOfSchemas&&$g(ne)){let Oe=u.resolveSchemaReference(ne);if(Oe.discriminator!=null&&Oe.discriminator.mapping!=null)continue;if(Oe.oneOf!=null||Oe.anyOf!=null){let ve=Oe.oneOf??Oe.anyOf;if(ve!=null){for(let be of ve){let Ie=$g(be)?u.resolveSchemaReference(be):be,Be=pS(Ie,!1,!1,u.DUMMY,n,T,m);Be.type==="object"&&R.push(...Be.properties.map(Se=>Se.schema.type!=="optional"&&Se.schema.type!=="nullable"?{...Se,schema:mh.optional({nameOverride:void 0,generatedName:"",title:void 0,value:Se.schema,description:void 0,availability:Se.availability,namespace:void 0,groupName:void 0,inline:void 0})}:Se))}continue}}let ge=N2i(ne);if(ge==null)continue;V.push({schemaId:ge,convertedSchema:KIf(ne,[ge],T,u.options.preserveSchemaIds),properties:PHy({schema:ne,context:u,breadcrumbs:n,source:T,namespace:m})}),u.markSchemaAsReferencedByNonRequest(ge)}else if($g(ne)){let Oe=u.resolveSchemaReference(ne),ge=pS(Oe,!1,!1,u,n,T,m);ge.type==="object"&&R.push(...ge.properties)}else{let Oe=ne.required??[];R=R.map(ve=>(ve.schema.type==="optional"||ve.schema.type==="nullable")&&Oe.includes(ve.key)?{...ve,schema:ve.schema.value}:ve);let ge=pS(ne,!1,!1,u,n,T,m);ge.type==="object"&&R.push(...ge.properties)}let $={};for(let ne of V)for(let[Oe,ge]of Object.entries(ne.properties)){let ve=$[Oe];ve!=null?(ve.schemaIds.push(ne.schemaId),ve.schemas.some(Ie=>AFs(Ie,ge))||ve.schemas.push(ge)):$[Oe]={schemaIds:[ne.schemaId],schemas:[ge]}}let re=[];for(let[ne,Oe]of Object.entries($))Oe.schemaIds.length>1&&re.push({propertyKey:ne,allOfSchemaIds:Oe.schemaIds,conflictingTypeSignatures:Oe.schemas.length>1});let Y=Object.fromEntries(Object.entries(U).filter(([ne,Oe])=>!(!$g(Oe)&&Oe.type==="null"))),te=Object.entries(Y).map(([ne,Oe])=>{let ge=Hy(Oe,Ab.AUDIENCES)??[],ve=dwe(Oe),be=$g(Oe)?!1:Oe.readOnly,Ie=$g(Oe)?!1:Oe.writeOnly,Se=!(z.includes(ne)&&!be),St=Hy(Oe,Ab.FERN_PROPERTY_NAME),yt=[...n,ne],Re=mHy(yt),De=pS(Oe,Se,!1,u,yt,T,m),Lt={};for(let Xe of V){let Yt=Xe.properties[ne];Yt!=null&&!AFs(De,Yt)?Lt[Xe.schemaId]={differentSchema:!0}:Yt!=null&&(Lt[Xe.schemaId]={differentSchema:!1})}return{key:ne,schema:De,nameOverride:St,audiences:ge,conflict:Lt,generatedName:Re,availability:ve,readonly:be,writeonly:Ie}});return te.push(...R.map(ne=>{let Oe=ne.conflict;for(let ge of V){let ve=ge.properties[ne.key];ve!=null&&!AFs(ne.schema,ve)?Oe[ge.schemaId]={differentSchema:!0}:ve!=null&&(Oe[ge.schemaId]={differentSchema:!1})}return{...ne,conflict:Oe}})),tLC({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:d,properties:te.filter(ne=>!l.has(ne.key)),description:a,allOf:V.map(ne=>ne.convertedSchema),allOfPropertyConflicts:re,namespace:m,groupName:A,fullExamples:P,additionalProperties:C,availability:I,source:T,context:u})}function tLC({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:a,description:o,allOf:c,allOfPropertyConflicts:d,namespace:s,groupName:u,fullExamples:l,additionalProperties:m,availability:A,source:P,context:C}){let I=mh.object({description:o,properties:a,nameOverride:e,generatedName:t,title:r,allOf:c,allOfPropertyConflicts:d,namespace:s,groupName:u,fullExamples:l,additionalProperties:SXo(m,C.options),availability:A,source:P,inline:void 0});return i&&(I=mh.nullable({nameOverride:e,generatedName:t,title:r,value:I,description:o,availability:A,namespace:s,groupName:u,inline:void 0})),n&&(I=mh.optional({nameOverride:e,generatedName:t,title:r,value:I,description:o,availability:A,namespace:s,groupName:u,inline:void 0})),I}function PHy({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let a={},[o,c]=$g(e)?[t.resolveSchemaReference(e),DXo(e.$ref)]:[e,r];for(let d of o.allOf??[])a={...a,...PHy({schema:d,context:t,breadcrumbs:c,source:n,namespace:i})};for(let[d,s]of Object.entries(o.properties??{})){let u=pS(s,!1,!1,t,[...c,d],n,i);a[d]=u}return a}function F2i({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:a,wrapAsOptional:o,wrapAsNullable:c,context:d,subtypes:s,namespace:u,groupName:l,encoding:m,source:A,subtypePrefixOverrides:P}){let C=iLC({schemas:s}),I=s.flatMap((z,U)=>{if(!$g(z)&&z.enum!=null&&d.options.coerceEnumsToLiterals&&z.type==="string")return z.enum.map(V=>mh.literal({nameOverride:void 0,generatedName:jie([t,V],d.options.preserveSchemaIds),title:void 0,value:jV.string(String(V)),namespace:u,groupName:void 0,description:void 0,availability:V.availability}));let R=C[U];if(P!=null){let V=P[U];V!=null&&"name"in V&&(R=V.name)}return[pS(z,!1,!1,d,[...n,R??`${U}`],A,u)]}),T=rLC(I);return nLC({uniqueSubtypes:T,nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:c,description:i,availability:a,namespace:u,groupName:l,context:d,encoding:m,source:A})}function rLC(e){let t=[];for(let r=0;r<e.length;++r){let n=e[r],i=!1;for(let a=r+1;a<e.length;++a){let o=e[a];if(n!=null&&o!=null&&$xe(n,o)){i=!0;break}}n!=null&&!i&&t.push(n)}return t}function nLC({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,namespace:d,groupName:s,context:u,encoding:l,source:m}){if(Object.entries(e).every(([P,C])=>C.type==="literal")){let P={},C=[];return Object.entries(e).forEach(([I,T])=>{T.type==="literal"&&T.value.type==="string"&&(C.push(T.value.value),T.description!=null&&(P[T.value.value]={description:T.description}))}),R2i({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,fernEnum:P,enumVarNames:void 0,enumValues:C,_default:void 0,namespace:d,groupName:s,context:u,source:m,inline:void 0})}if(e.length===1&&e[0]!=null&&!u.options.preserveSingleSchemaOneOf){let P=e[0];return a&&(P=mh.nullable({nameOverride:t,generatedName:r,title:n,value:P,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),i&&(P=mh.optional({nameOverride:t,generatedName:r,title:n,value:P,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),P}return wHy({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,subtypes:e,namespace:d,groupName:s,encoding:l,source:m})}function $If({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsOptional:a,wrapAsNullable:o,context:c,namespace:d,groupName:s,discriminator:u,encoding:l,source:m}){let A=Object.entries(u.mapping??{}).map(([I,T],z)=>{let U={$ref:T},R=KAi(U,!1,!1,c,[T],l,m,d);return c.markSchemaWithDiscriminantValue(U,u.propertyName,I),R.type==="object"&&(R.properties={[u.propertyName]:mh.literal({nameOverride:void 0,generatedName:jie([t,I],c.options.preserveSchemaIds),title:void 0,value:jV.string(I),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...R.properties.filter(V=>V.key!==u.propertyName)}),R}),P=[];for(let I=0;I<A.length;++I){let T=A[I],z=!1;for(let U=I+1;U<A.length;++U){let R=A[U];if(T!=null&&R!=null&&$xe(T,R)){z=!0;break}}T!=null&&!z&&P.push(T)}if(Object.entries(P).every(([I,T])=>T.type==="literal")){let I={},T=[];return Object.entries(P).forEach(([z,U])=>{U.type==="literal"&&U.value.type==="string"&&(T.push(U.value.value),U.description!=null&&(I[U.value.value]={description:U.description}))}),R2i({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:n,availability:i,fernEnum:I,enumVarNames:void 0,enumValues:T,_default:void 0,namespace:d,groupName:s,context:c,source:m,inline:void 0})}return P.length===1&&P[0]!=null&&!c.options.preserveSingleSchemaOneOf?P[0]:wHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:n,availability:i,subtypes:P,namespace:d,groupName:s,encoding:l,source:m})}function iLC({schemas:e}){let t={},r=0;for(let a of e){if(!$g(a)){if(a.properties!=null&&Object.entries(a.properties).length>0){let o=Object.keys(a.properties),c={},d=o;for(let[s,u]of Object.entries(t)){let l=Zes(u,o);d=Zes(d,u),c[s]=l}c[r]=d,t=c}}r++}let n=[],i=0;for(let a of e){let o=t[i];if(o!=null&&o.length>0){let c=o.sort();if(c[0]!=null){n.push(c[0]),++i;continue}}$g(a)?n.push(B2i(i)??`${i}`):a.type==="array"||a.type==="boolean"||a.type==="integer"||a.type==="number"||a.type==="string"?n.push(""):n.push(B2i(i)??`${i}`),++i}return n}function wHy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,description:a,availability:o,subtypes:c,namespace:d,groupName:s,encoding:u,source:l}){let m=mh.oneOf(Vnt.undiscriminated({description:a,availability:o,nameOverride:e,generatedName:t,title:r,schemas:c,namespace:d,groupName:s,encoding:u,source:l,inline:void 0}));return i&&(m=mh.nullable({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:o,namespace:d,groupName:s,inline:void 0})),n&&(m=mh.optional({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:o,namespace:d,groupName:s,inline:void 0})),m}function _no(e){if(e.default!=null&&typeof e.default=="string")return e.default}function PFs({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let n=Sla(e);for(let i of n??[])if(typeof i=="number")return i;if(r&&typeof r=="number")return r}function jHy({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let n=Sla(e);for(let i of n??[])if(typeof i=="boolean")return i;if(r&&typeof r=="boolean")return r}function sVr({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let n=Sla(e);for(let i of n??[])if(typeof i=="string")return i;if(r&&typeof r=="string")return r}function EHy({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let n=Sla(e);for(let i of n??[])if(Array.isArray(i))return i;if(r&&Array.isArray(r))return r}var Cla="#/components/schemas/";function CHy(e,t){let r=$g(e)?t.resolveSchemaReference(e):e;switch(r.type){case"boolean":case"number":case"string":case"integer":return!0;case"array":return CHy(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 aLC(e,t,r){return r.options.resolveAliases?typeof r.options.resolveAliases=="object"&&r.options.resolveAliases.except?.includes(e)?!1:CHy(t,r):!1}function pS(e,t,r,n,i,a,o,c=!1,d=new Set,s){let u=dHy(e)??a,l=pLC({schema:e,logger:n.logger});if($g(e)){let m=N2i(e);return m!=null?aLC(m,e,n)?pno(n.resolveSchemaReference(e),t,r,n,DXo(e.$ref),l,u,o,d,c,s):(c?n.markSchemaAsReferencedByRequest(m):n.markSchemaAsReferencedByNonRequest(m),KAi(e,t,r,n,i,l,u,o)):pno(n.resolveSchemaReference(e),t,r,n,DXo(e.$ref),l,u,o,d,c,s)}return pno(e,t,r,n,i,l,u,o,d,c,s)}function KAi(e,t,r,n,i,a,o,c){let d=e.$ref.includes("properties")?pno(n.resolveSchemaReference(e),t,r,n,i,a,o,c,new Set):mh.reference(KIf(e,i,o,n.options.preserveSchemaIds));if(r===!1){let s=n.resolveSchemaReference(e);(s.nullable===!0||Array.isArray(s.type)&&s.type.length>=2&&s.type.includes("null"))&&(r=!0)}return r&&(d=mh.nullable({title:void 0,nameOverride:void 0,generatedName:jie(i,n.options.preserveSchemaIds),value:d,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),t&&(d=mh.optional({title:void 0,nameOverride:void 0,generatedName:jie(i,n.options.preserveSchemaIds),value:d,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),d}function oLC(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function pno(e,t,r,n,i,a,o,c,d=new Set,s=!1,u){typeof e=="string"&&(e={type:e});let l=Hy(e,Ab.TYPE_NAME)??(n.options.useTitlesAsName?oLC(e.title):void 0),m=Hy(e,Ab.SDK_GROUP_NAME)??Hy(e,Nbe.TAGS)?.[0],A=(typeof m=="string"?[m]:m)??[];A=n.resolveGroupName(A);let P=jie(i,n.options.preserveSchemaIds),C=e.title,I=e.description,T=dwe(e),z=[];e.example!=null&&z.push({name:void 0,value:e.example,description:void 0});let U=Hy(e,Nbe.EXAMPLES);U!=null&&Object.keys(U).length>0&&z.push(...Object.entries(U).map(([$,re])=>({name:re?.summary??$,value:re.value,description:re.description})));let R=Sla(e);R!=null&&Object.keys(R).length>0&&z.push(...R.map($=>({name:void 0,value:$,description:void 0})));let V=fHy({schema:e,description:I,title:C,nameOverride:l,generatedName:P,availability:T});if(V!=null){let $=V;return r&&($=mh.nullable({availability:T,namespace:c,groupName:A,description:I,generatedName:P,inline:void 0,nameOverride:l,title:C,value:$})),t&&($=mh.optional({availability:T,namespace:c,groupName:A,description:I,generatedName:P,inline:void 0,nameOverride:l,title:C,value:$})),$}try{if(Array.isArray(e.type)){let Y=e.type.indexOf("null"),te=Y!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&te)e.type.splice(Y,1),e.type=e.type[0],e.nullable=!0;else if(te&&(e.type.splice(Y,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let ne=new Set([...e.oneOf,...e.type]);e.oneOf=[...ne]}}if(r=r||e.nullable===!0,"const"in e&&(e.enum=[e.const]),e.enum!=null&&(e.type==="string"||e.type==null||e.type==="enum")){if(e.enum=e.enum.filter(te=>te!==null),!EFs(e.enum))return ose({nameOverride:l,generatedName:P,title:C,primitive:z0.string({default:_no(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:sVr({schema:e,logger:n.logger,fallback:u})}),namespace:c,groupName:A,wrapAsOptional:t,wrapAsNullable:r,description:I,availability:T});let Y=lHy(e);return e.enum.length===1&&e.enum[0]!=null&&Y==null?gHy({nameOverride:l,generatedName:P,title:C,wrapAsOptional:t,wrapAsNullable:r,value:e.enum[0],description:I,availability:T,namespace:c,groupName:A}):R2i({nameOverride:l,generatedName:P,title:C,fernEnum:Y,enumVarNames:Hy(e,[Nbe.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:A,context:n,source:o,inline:void 0})}if(EFs(e.type)&&e.type.length>1){let Y=e.type.includes("null"),te=e.type.filter(ne=>ne!=="null").map(ne=>({type:ne,nullable:Y}));return F2i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:te,namespace:c,groupName:A,encoding:a,source:o})}if(e.type==="boolean"){let Y=Hy(e,Ab.BOOLEAN_LITERAL);return Y!=null?SHy({nameOverride:l,generatedName:P,title:C,literal:jV.boolean(Y),wrapAsOptional:t,wrapAsNullable:r,description:I,availability:T,namespace:c,groupName:A}):ose({nameOverride:l,generatedName:P,title:C,primitive:z0.boolean({default:uLC(e.default),example:jHy({schema:e,logger:n.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:I,availability:T,namespace:c,groupName:A})}if(e.type==="number")return JIf({nameOverride:l,generatedName:P,title:C,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Dla(e.exclusiveMinimum),exclusiveMaximum:Dla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:PFs({schema:e,logger:n.logger,fallback:u}),namespace:c,groupName:A});if(e.type==="integer")return bHy({nameOverride:l,generatedName:P,title:C,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Dla(e.exclusiveMinimum),exclusiveMaximum:Dla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:PFs({schema:e,logger:n.logger,fallback:u}),namespace:c,groupName:A});if(e.type==="float")return JIf({nameOverride:l,generatedName:P,title:C,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Dla(e.exclusiveMinimum),exclusiveMaximum:Dla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:PFs({schema:e,logger:n.logger,fallback:u}),namespace:c,groupName:A});if(e.type==="string"){if(e.format==="date-time")return ose({nameOverride:l,generatedName:P,title:C,primitive:z0.datetime({example:sVr({schema:e,logger:n.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:I,availability:T,namespace:c,groupName:A});if(e.format==="date"&&n.options.typeDatesAsStrings===!1)return ose({nameOverride:l,generatedName:P,title:C,primitive:z0.date({example:sVr({schema:e,logger:n.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:I,availability:T,namespace:c,groupName:A});if(e.format==="json-string"){let te=mh.unknown({nameOverride:l,generatedName:P,title:C,description:I,availability:T,namespace:c,groupName:A,example:void 0});return r&&(te=mh.nullable({availability:T,namespace:c,groupName:A,description:I,generatedName:P,inline:void 0,nameOverride:l,title:C,value:te})),t&&(te=mh.optional({availability:T,namespace:c,groupName:A,description:I,generatedName:P,inline:void 0,nameOverride:l,title:C,value:te})),te}let Y=IHy(e,"const");return Y!=null?SHy({nameOverride:l,generatedName:P,title:C,literal:jV.string(Y),wrapAsOptional:t,wrapAsNullable:r,description:I,availability:T,namespace:c,groupName:A}):ose({nameOverride:l,generatedName:P,title:C,primitive:z0.string({default:_no(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:sVr({schema:e,logger:n.logger,fallback:u})}),namespace:c,groupName:A,wrapAsOptional:t,wrapAsNullable:r,description:I,availability:T})}if(e.type==="array")return hHy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,item:e.items,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,example:EHy({schema:e,logger:n.logger,fallback:u}),source:o});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&wFs(e))return pHy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,additionalProperties:e.additionalProperties,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,encoding:a,example:e.example,source:o});if(e.oneOf!=null&&e.oneOf.length>0&&Hy(e,Ab.IS_DISCRIMINATED)===!1)return F2i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf,namespace:c,groupName:A,encoding:a,source:o});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return n.options.discriminatedUnionV2?$If({nameOverride:l,generatedName:P,title:C,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,discriminator:e.discriminator,encoding:a,source:o}):HIf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:I,availability:T,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,encoding:a,source:o});if(e.oneOf!=null&&e.oneOf.length>0){let Y=Hy(e,Ab.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return n.options.discriminatedUnionV2||Y?$If({nameOverride:l,generatedName:P,title:C,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,discriminator:e.discriminator,encoding:a,source:o}):HIf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:I,availability:T,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,encoding:a,source:o});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(n.options.preserveSingleSchemaOneOf)return F2i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf.filter(ne=>$g(ne)||ne.type!=="null"),encoding:a,namespace:c,groupName:A,source:o});let te=pS(e.oneOf[0],t,r,n,i,o,c,s);return hno(te,I,c,A)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let ge=e.oneOf[0],ve=e.oneOf[1];if(!$g(ge)&&ge.type==="null")return pS(ve,!1,!0,n,i,o,c);if(!$g(ve)&&ve.type==="null")return pS(ge,!1,!0,n,i,o,c)}let te=lLC({schemas:e.oneOf});if(te!=null)return R2i({nameOverride:l,generatedName:P,title:C,fernEnum:void 0,enumVarNames:void 0,enumValues:te,_default:e.default,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:A,context:n,source:o,inline:void 0});let ne=DHy({schemas:e.oneOf,context:n});if(ne!=null&&!n.options.discriminatedUnionV2&&!Y)return GIf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},required:e.required,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,discriminant:ne.discriminant,variants:ne.schemas,context:n,namespace:c,groupName:A,encoding:a,source:o});let Oe=e.oneOf.filter(ge=>!$g(ge)&&ge.type==="null").length>0;return F2i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r||Oe,context:n,subtypes:e.oneOf.filter(ge=>$g(ge)||ge.type!=="null"),encoding:a,namespace:c,groupName:A,source:o})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let ne=pS(e.anyOf[0],t,r,n,i,o,c,s);return hno(ne,I,c,A)}if(e.anyOf.length===2){let[ne,Oe]=e.anyOf;if(ne!=null&&Oe!=null){if(!$g(ne)&&ne.type==="null"){let ge=pS(Oe,!1,!0,n,i,o,c);return hno(ge,I,c,A)}else if(!$g(Oe)&&Oe.type==="null"){let ge=pS(ne,!1,!0,n,i,o,c);return hno(ge,I,c,A)}}}let Y=DHy({schemas:e.anyOf,context:n});if(Y!=null&&!n.options.discriminatedUnionV2)return GIf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},required:e.required,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,discriminant:Y.discriminant,variants:Y.schemas,context:n,namespace:c,groupName:A,encoding:a,source:o});let te=e.anyOf.filter(ne=>!$g(ne)&&ne.type==="null").length>0;return F2i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r||te,context:n,subtypes:e.anyOf.filter(ne=>$g(ne)||ne.type!=="null"),encoding:a,namespace:c,groupName:A,source:o})}if(e.allOf!=null||e.properties!=null){let Y=[];for(let ne of e.allOf??[])($g(ne)||Object.keys(ne).length>0)&&Y.push(ne);if((e.properties==null||wFs(e))&&Y.length===1&&Y[0]!=null){let ne=pS(Y[0],t,r,n,i,o,c,s);return hno(ne,I,c,A)}let te=Y.filter(ne=>{let Oe=jFs(ne);return Oe||n.logger.warn(`Skipping non-object allOf element: ${JSON.stringify(ne)}`),Oe});if((e.properties==null||wFs(e))&&te.length===1&&te[0]!=null){let ne=pS(te[0],t,r,n,i,o,c,s);return hno(ne,I,c,A)}return AHy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},description:I,required:e.required,wrapAsOptional:t,wrapAsNullable:r,allOf:te,context:n,propertiesToExclude:d,namespace:c,groupName:A,fullExamples:z,additionalProperties:e.additionalProperties,availability:T,encoding:a,source:o})}if(e.type==="object"&&sLC(e)&&cLC(e)&&wFs(e))return WIf({nameOverride:l,generatedName:P,title:C,description:I,availability:T,wrapAsOptional:t,wrapAsNullable:r,keySchema:{nameOverride:void 0,generatedName:`${P}Key`,title:void 0,description:void 0,availability:void 0,schema:z0.string({default:_no(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:sVr({schema:e,logger:n.logger,fallback:u})}),namespace:c,groupName:A},valueSchema:mh.unknown({nameOverride:void 0,generatedName:`${P}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:c,groupName:A}),namespace:c,groupName:A,encoding:a,example:e.example});e.type!=null&&n.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${i.join("->")}. Coercing to unknown.`);let $=e.example??e.default,re=mh.unknown({nameOverride:l,generatedName:P,title:C,description:I,availability:T,namespace:c,groupName:A,example:$});return r&&(re=mh.nullable({availability:T,namespace:c,groupName:A,description:I,generatedName:P,inline:void 0,nameOverride:l,title:C,value:re})),t&&(re=mh.optional({availability:T,namespace:c,groupName:A,description:I,generatedName:P,inline:void 0,nameOverride:l,title:C,value:re})),re}catch($){return n.logger.debug(`Error converting schema: ${$.message}
|