fern-api 0.82.2 → 0.82.3
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
|
@@ -2159,7 +2159,7 @@ ${VGh.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&NXl(th
|
|
|
2159
2159
|
`+DYi.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?DYi.default.cyan(ZGh(t,this.opt.mask)):DYi.default.italic(DYi.default.dim("[hidden]")):this.opt.mask?ZGh(t,this.opt.mask):DYi.default.italic(DYi.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 Ufu=aa(nse(),1);var ZJh=aa(vZl(),1),Qfu=require("child_process"),_Qa=require("fs"),zfu=aa(require("path"),1),kJh=aa(require("os"),1),eKh=require("crypto"),tkl=aa(YJh(),1);var Nfu=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var uzo=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var xfu=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var Ffu=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function Lfu(e="",t,r){let n=new rkl(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 XJh(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function NhD(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 rkl=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=NhD(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??kJh.default.tmpdir(),r=(0,eKh.randomUUID)(),n=XJh(this.fileOptions.prefix),i=XJh(this.fileOptions.postfix),a=`${n}${r}${i}`,o=zfu.default.resolve(t,a),c=zfu.default.resolve(t)+zfu.default.sep;if(!o.startsWith(c))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=o;let f={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(f.mode=this.fileOptions.mode),(0,_Qa.writeFileSync)(this.tempFile,this.text,f)}catch(t){throw new Nfu(t)}}readTemporaryFile(){try{let t=(0,_Qa.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,ZJh.detect)(t)??"utf8";tkl.default.encodingExists(r)||(r="utf8"),this.text=tkl.default.decode(t,r)}}catch(t){throw new xfu(t)}}removeTemporaryFile(){try{(0,_Qa.unlinkSync)(this.tempFile)}catch(t){throw new Ffu(t)}}launchEditor(){try{let t=(0,Qfu.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new uzo(t)}}launchEditorAsync(t){try{(0,Qfu.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new uzo(r)}}};var tKh=aa(Utt(),1);var czo=class extends ise{_run(t){this.done=t,this.editorResult=new tKh.Subject;let r=Ive(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"?Ufu.default.dim("Received"):Ufu.default.dim("Press <enter> to launch your preferred editor."),t&&(r=Ufu.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),Lfu(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 oKh=require("stream");var iKh=aa(require("readline"),1),aKh=aa(nKh(),1),BYi=class{constructor(t){this.rl||=iKh.default.createInterface(FhD(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 FhD(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 aKh.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var lzo=class extends BYi{constructor(t={}){super(t),this.log=new oKh.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return J2o(this.rl,this.bottomBar.split(`
|
|
2160
2160
|
`).length),this}updateBottomBar(t){return J2o(this.rl,1),this.rl.output.unmute(),this.clean(),this.bottomBar=t,this.render(),this.rl.output.mute(),this}writeLog(t){return this.rl.output.unmute(),this.clean(),this.rl.output.write(this.enforceLF(t.toString())),this.render(),this.rl.output.mute(),this}enforceLF(t){return/[\n\r]$/.test(t)?t:t+`
|
|
2161
2161
|
`}write(t){let r=t.split(/\n/);this.height=r.length,this.rl.setPrompt(r.at(-1)),this.rl.output.rows===0&&this.rl.output.columns===0&&lfu(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var dz=aa(Utt(),1),cKh=aa(_2o(),1);var Vfu=aa(Utt(),1),sKh=aa(_2o(),1),Wfu=function(e,t,r){return typeof e[t]!="function"?(0,Vfu.of)(e):(0,Vfu.from)((0,sKh.default)(e[t])(r).then(n=>(e[t]=n,e)))};var uKh={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}},hQa=class extends BYi{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,dz.from)(t):(0,dz.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,dz.from)(Object.entries(t).map(([i,a])=>({name:i,...a}))):n=(0,dz.from)([t]),this.process=n.pipe((0,dz.concatMap)(this.processQuestion.bind(this)),(0,dz.publish)()),this.process.connect(),this.process.pipe((0,dz.reduce)((i,a)=>(uKh.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,dz.defer)(()=>(0,dz.of)(t).pipe((0,dz.concatMap)(this.setDefaultType.bind(this)),(0,dz.concatMap)(this.filterIfRunnable.bind(this)),(0,dz.concatMap)(()=>Wfu(t,"message",this.answers)),(0,dz.concatMap)(()=>Wfu(t,"default",this.answers)),(0,dz.concatMap)(()=>Wfu(t,"choices",this.answers)),(0,dz.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,dz.defer)(()=>(0,dz.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,dz.defer)(()=>(0,dz.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&uKh.get(this.answers,t.name)!==void 0)return dz.EMPTY;if(t.when===!1)return dz.EMPTY;if(typeof t.when!="function")return(0,dz.of)(t);let{answers:r}=this;return(0,dz.defer)(()=>(0,dz.from)((0,cKh.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,dz.filter)(n=>n!=null)))}};function lKh(e){let t=function(r,n){let i;try{i=new hQa(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",$2o),this.registerPrompt("input",SYi),this.registerPrompt("number",Y2o),this.registerPrompt("confirm",X2o),this.registerPrompt("rawlist",Z2o),this.registerPrompt("expand",k2o),this.registerPrompt("checkbox",ezo),this.registerPrompt("password",tzo),this.registerPrompt("editor",czo)},t.restoreDefaultPrompts(),t}var ikl=lKh();function QhD(e,t){ikl.registerPrompt(e,t)}function LhD(){ikl.restoreDefaultPrompts()}var UhD={prompt:ikl,ui:{BottomBar:lzo,Prompt:hQa},createPromptModule:lKh,registerPrompt:QhD,restoreDefaultPrompts:LhD,Separator:oxe},Hfu=UhD;var DQa=require("path"),Y$h=require("fs"),X$h=require("readline"),O$h="posthog-node";function CbD(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[_du.POSTHOG_ID_TAG];if(c===void 0)return a;let f=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${c}`,f).toString();a.tags["PostHog Person URL"]=u;let s=a.exception?.values||[],l=s.map(A=>({...A,stacktrace:A.stacktrace?{...A.stacktrace,type:"raw",frames:(A.stacktrace.frames||[]).map(P=>({...P,platform:"node:javascript"}))}:void 0})),m={$exception_message:s[0]?.value||a.message,$exception_type:s[0]?.type,$exception_personURL:u,$exception_level:a.level,$exception_list:l,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:s[0]?.value||a.message,$sentry_exception_type:s[0]?.type,$sentry_tags:a.tags};return t&&r&&(m.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:c,properties:m}),a}}var _du=class{constructor(t,r,n,i){this.name=O$h,this.name=O$h,this.setupOnce=function(a,o){let c=o()?.getClient()?.getDsn()?.projectId;a(CbD(t,{organization:r,projectId:c,prefix:n,severityAllowList:i}))}}};_du.POSTHOG_ID_TAG="posthog_distinct_id";var cdu="0123456789abcdef",hdu=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+=cdu.charAt(this.bytes[r]>>>4),t+=cdu.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+=cdu.charAt(this.bytes[r]>>>4),t+=cdu.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}},Gkl=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??IbD()}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 hdu.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,hdu.ofInner(t)}},IbD=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),A$h,Jkl=()=>MbD().toString(),MbD=()=>(A$h||(A$h=new Gkl)).generate();function BbD(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 TbD(e,t){global.process.on("uncaughtException",BbD(e,t))}function qbD(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var ldu,P$h,fdu;function RbD(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return fdu&&r.length===P$h||(P$h=r.length,fdu=r.reduce((n,i)=>{ldu||(ldu={});let a=ldu[i];if(a)n[a[0]]=a[1];else{let o=e(i);for(let c=o.length-1;c>=0;c--){let u=o[c]?.filename,s=t[i];if(u&&s){n[u]=s,ldu[i]=[u,s];break}}}return n},{})),fdu}function NbD(e){return typeof Event<"u"&&Z$h(e,Event)}function xbD(e){return k$h(e,"Object")}function tef(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Z$h(e,Error)}}function Z$h(e,t){try{return e instanceof t}catch{return!1}}function FbD(e){return k$h(e,"ErrorEvent")}function k$h(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function zbD(e,t,r,n){let a=n&&n.mechanism||{handled:!0,type:"generic"},o=eYh(a,r,n);return{$exception_list:await Promise.all(o.map(async u=>{let s=await GbD(e,t,u);return s.value=s.value||"",s.type=s.type||"Error",s.mechanism=a,s}))}}function eYh(e,t,r){let n=QbD(e,t,r);return n.cause?[n,...eYh(e,n.cause,r)]:[n]}function QbD(e,t,r){if(tef(t))return t;if(e.synthetic=!0,xbD(t)){let i=LbD(t);if(i)return i;let a=UbD(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 LbD(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(tef(r))return r}}function UbD(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=WbD(e);if(FbD(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=VbD(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function VbD(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function WbD(e,t=40){let r=Object.keys(HbD(e));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=t)return w$h(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:w$h(a,t)}return""}function w$h(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function HbD(e){return tef(e)?{message:e.message,name:e.name,stack:e.stack,...j$h(e)}:NbD(e)?{type:e.type,target:E$h(e.target),currentTarget:E$h(e.currentTarget),...j$h(e)}:e}function j$h(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 E$h(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function GbD(e,t,r){let n={type:r.name||r.constructor.name,value:r.message},i=JbD(e,r);for(let a of t)i=await a(i);return i.length&&(n.stacktrace={frames:i,type:"raw"}),n}function JbD(e,t){return KbD(e(t.stack||"",1),e)}function KbD(e,t){let r=RbD(t);return e.forEach(n=>{n.filename&&(n.chunk_id=r[n.filename])}),e}var $bD=2e3,jQa=class e{static async captureException(t,r,n,i,a){let o={...a};i||(o.$process_person_profile=!1);let c=await zbD(this.stackParser,this.frameModifiers,r,n);t.capture({event:"$exception",distinctId:i||Jkl(),properties:{...c,...o}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(TbD(this.onException.bind(this),this.onFatalError.bind(this)),qbD(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown($bD)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function YbD(e=process.argv[1]?(0,DQa.dirname)(process.argv[1]):process.cwd(),t=DQa.sep==="\\"){let r=t?S$h(e):e;return n=>{if(!n)return;let i=t?S$h(n):n,{dir:a,base:o,ext:c}=DQa.posix.parse(i);(c===".js"||c===".mjs"||c===".cjs")&&(o=o.slice(0,c.length*-1));let f=decodeURIComponent(o);a||(a=".");let u=a.lastIndexOf("/node_modules");if(u>-1)return`${a.slice(u+14).replace(/\//g,".")}:${f}`;if(a.startsWith(r)){let s=a.slice(r.length+1).replace(/\//g,".");return s?`${s}:${f}`:f}return f}}function S$h(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var ydu=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)}}},pdu=new ydu(25),tYh=new ydu(20),ref=7,XbD=1e3,ZbD=1e4;async function kbD(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"||ngD(o)||igD(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(tYh.get(i))continue;let a=t[i];if(!a)continue;a.sort((f,u)=>f-u);let o=ogD(a);if(o.every(f=>agD(i,f)))continue;let c=sgD(pdu,i,{});n.push(egD(i,o,c))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&tgD(e,pdu),pdu.reduce(),e}function egD(e,t,r){return new Promise(n=>{let i=(0,Y$h.createReadStream)(e),a=(0,X$h.createInterface)({input:i});function o(){i.destroy(),n()}let c=0,f=0,u=t[f];if(u===void 0){o();return}let s=u[0],l=u[1];function m(){tYh.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<s)&&(r[c]=ugD(A,0),c>=l)){if(f===t.length-1){a.close(),a.removeAllListeners();return}f++;let P=t[f];if(P===void 0){a.close(),a.removeAllListeners();return}s=P[0],l=P[1]}})})}function tgD(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;rgD(r.lineno,r,n)}}function rgD(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=rYh(e);i<e;i++){let a=r[i];if(a===void 0){D$h(t);return}t.pre_context.push(a)}if(r[e]===void 0){D$h(t);return}t.context_line=r[e];let n=nYh(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 D$h(e){delete e.pre_context,delete e.context_line,delete e.post_context}function ngD(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function igD(e){return e.lineno!==void 0&&e.lineno>ZbD||e.colno!==void 0&&e.colno>XbD}function agD(e,t){let r=pdu.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 ogD(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=C$h(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+ref:(i.push(n),n=C$h(a)),t++}return i}function C$h(e){return[rYh(e),nYh(e)]}function rYh(e){return Math.max(1,e-ref)}function nYh(e){return e+ref}function sgD(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function ugD(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 cgD="4.18.0",fxe;(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"})(fxe||(fxe={}));var I$h;(function(e){e.Left="left",e.Right="right",e.Center="center"})(I$h||(I$h={}));var M$h;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(M$h||(M$h={}));var B$h;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(B$h||(B$h={}));var T$h;(function(e){e.Html="html",e.Text="text"})(T$h||(T$h={}));var q$h;(function(e){e.Number="number",e.Emoji="emoji"})(q$h||(q$h={}));var R$h;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(R$h||(R$h={}));var N$h;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(N$h||(N$h={}));var x$h;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(x$h||(x$h={}));var F$h;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(F$h||(F$h={}));var lgD=e=>{if("flags"in e){let t=dgD(e.flags),r=pgD(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,a])=>[i,iYh(a)])),n=Object.fromEntries(Object.entries(t).map(([i,a])=>[i,fgD(i,a,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function fgD(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 dgD=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,nef(r)]).filter(([,t])=>t!==void 0)),pgD=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?iYh(n):void 0]}))},nef=e=>e===void 0?void 0:e.variant??e.enabled,iYh=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},_gD=1,hgD=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"]),ygD="utf8";function vgD(e,t){if(!e||typeof e!="string"||bgD(e))throw new Error(t)}function bgD(e){return e.trim().length===0}function ggD(e){return e?.replace(/\/+$/,"")}async function mgD(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 z$h(){return new Date().getTime()}function Wkl(){return new Date().toISOString()}function vdu(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function OgD(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function AgD(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 PgD(e,t=0,r){let n=AgD(e);return r?.has(n)?!1:parseInt(n,16)/4294967295<t}function Q$h(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var mzo=String.fromCharCode,L$h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ddu={};function wgD(e,t){if(!ddu[e]){ddu[e]={};for(let r=0;r<e.length;r++)ddu[e][e.charAt(r)]=r}return ddu[e][t]}var PQa={compressToBase64:function(e){if(e==null)return"";let t=PQa._compress(e,6,function(r){return L$h.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:PQa._decompress(e.length,32,function(t){return wgD(L$h,e.charAt(t))})},compress:function(e){return PQa._compress(e,16,function(t){return mzo(t)})},_compress:function(e,t,r){if(e==null)return"";let n={},i={},a=[],o,c,f="",u="",s="",l=2,m=3,A=2,P=0,C=0,M;for(M=0;M<e.length;M+=1)if(f=e.charAt(M),Object.prototype.hasOwnProperty.call(n,f)||(n[f]=m++,i[f]=!0),u=s+f,Object.prototype.hasOwnProperty.call(n,u))s=u;else{if(Object.prototype.hasOwnProperty.call(i,s)){if(s.charCodeAt(0)<256){for(o=0;o<A;o++)P=P<<1,C==t-1?(C=0,a.push(r(P)),P=0):C++;for(c=s.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<A;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=s.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,A),A++),delete i[s]}else for(c=n[s],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[u]=m++,s=String(f)}if(s!==""){if(Object.prototype.hasOwnProperty.call(i,s)){if(s.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=s.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<A;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=s.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,A),A++),delete i[s]}else for(c=n[s],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:PQa._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let n=[],i=[],a={val:r(0),position:t,index:1},o=4,c=4,f=3,u="",s,l,m,A,P,C,M;for(s=0;s<3;s+=1)n[s]=s;for(m=0,P=Math.pow(2,2),C=1;C!=P;)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;M=mzo(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;M=mzo(m);break;case 2:return""}for(n[3]=M,l=M,i.push(M);;){if(a.index>e)return"";for(m=0,P=Math.pow(2,f),C=1;C!=P;)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=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++]=mzo(m),M=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++]=mzo(m),M=c-1,o--;break;case 2:return i.join("")}if(o==0&&(o=Math.pow(2,f),f++),n[M])u=n[M];else if(M===c)u=l+l.charAt(0);else return null;i.push(u),n[c++]=l+u.charAt(0),o--,l=u,o==0&&(o=Math.pow(2,f),f++)}}},Kkl=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)}},EQa=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()}},Ozo=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function U$h(e){if(e instanceof EQa){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 Hkl(e){return typeof e=="object"&&(e instanceof EQa||e instanceof Ozo)}function V$h(e){return typeof e=="object"&&e instanceof EQa&&e.status===413}var $kl;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})($kl||($kl={}));var Ykl=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new Kkl,this._isInitialized=!1,vgD(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=ggD(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:Hkl},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(fxe.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(fxe.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(fxe.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=Jkl();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=PgD(this.apiKey,_gD,hgD)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,f={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...a})};return this.logMsgIfDebug(()=>console.log("PostHog Debug","Decide URL",c)),this.fetchWithRetry(c,f,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(u=>u.json()).then(u=>lgD(u)).catch(u=>{this._events.emit("error",u)})}async getFeatureFlagStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailStateless(t,r,n,i,a,o);if(c===void 0)return{response:void 0,requestId:void 0};let f=nef(c.response);return f===void 0&&(f=!1),{response:f,requestId:c.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(r,n,i,a,o,[t]);return c===void 0?void 0:{response:c.flags[t],requestId:c.requestId}}async getFeatureFlagPayloadStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagPayloadsStateless(r,n,i,a,o,[t]);if(!c)return;let f=c[t];return f===void 0?null:f}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},a,o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},a,o){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(t,r,n,i,a,o);return c?{flags:c.featureFlags,payloads:c.featureFlagPayloads,requestId:c.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c={};(a??this.disableGeoip)&&(c.geoip_disable=!0),o&&(c.flag_keys_to_evaluate=o);let f=await this.getDecide(t,r,n,i,c);if(f!==void 0)return f.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),f.quotaLimited?.includes($kl.FeatureFlags)?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:f?.requestId}):f}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this.logMsgIfDebug(()=>console.log("PostHog Debug","Loading surveys is disabled.")),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},i=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let o=`Surveys API could not be loaded: ${a.status}`,c=new Error(o);this.logMsgIfDebug(()=>console.error(c)),this._events.emit("error",new Error(o));return}return a.json()}).catch(a=>{this.logMsgIfDebug(()=>console.error("Surveys API could not be loaded",a)),this._events.emit("error",a)}))?.surveys;return i&&this.logMsgIfDebug(()=>console.log("PostHog Debug","Surveys fetched from API: ",JSON.stringify(i))),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(fxe.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(fxe.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(fxe.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(fxe.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(fxe.Queue,a),this._events.emit(t,i),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=vdu(()=>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:Wkl()};this.historicalMigration&&(i.historical_migration=!0);let a=JSON.stringify(i),o=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${z$h()}&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(PQa.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(o,c)}catch(f){this._events.emit("error",f)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:Wkl(),uuid:n?.uuid?n.uuid:Jkl()};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 U$h(t)})}async flush(){let t=Q$h([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),Q$h([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(fxe.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(fxe.Queue)||[]).slice(i.length);this.setPersistedProperty(fxe.Queue,A),t=A},c={api_key:this.apiKey,batch:a,sent_at:Wkl()};this.historicalMigration&&(c.historical_migration=!0);let f=JSON.stringify(c),u=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${z$h()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,s=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(PQa.compressToBase64(f))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:f},l={retryCheck:m=>V$h(m)?!1:Hkl(m)};try{await this.fetchWithRetry(u,s,l)}catch(m){if(V$h(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 Ozo||o(),this._events.emit("error",m),m}o(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){var a;(a=AbortSignal).timeout??(a.timeout=function(u){let s=new AbortController;return setTimeout(()=>s.abort(),u),s.signal});let o=r.body?r.body:"",c=-1;try{c=Buffer.byteLength(o,ygD)}catch{c=new TextEncoder().encode(o).length}return await mgD(async()=>{let f=null;try{f=await this.fetch(t,{signal:AbortSignal.timeout(i??this.requestTimeout),...r})}catch(s){throw new Ozo(s)}if(!(r.mode==="no-cors")&&(f.status<200||f.status>=400))throw new EQa(f,c);return f},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let n=async()=>{try{for(await Promise.all(Object.values(this.pendingPromises));!((this.getPersistedProperty(fxe.Queue)||[]).length===0||(await this.flush(),r)););}catch(i){if(!Hkl(i))throw i;await U$h(i)}};return Promise.race([new Promise((i,a)=>{vdu(()=>{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}},Xkl=OgD();if(!Xkl){let e=m$h();Xkl=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 aYh=Xkl,bdu=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()}},oYh=new bdu(async()=>{try{return await import("crypto")}catch{return}});async function jgD(){return await oYh.getValue()}var EgD=new bdu(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await oYh.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function SgD(){return await EgD.getValue()}async function DgD(e){let t=await jgD();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await SgD();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 CgD=60*1e3,IgD=1152921504606847e3,MgD=["is_not"],wQa=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},ase=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Zkl=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||aYh,this.onError=c.onError,this.customHeaders=o,this.onLoad=c.onLoad,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,n={},i={},a={}){await this.loadFeatureFlags();let o,c;if(!this.loadedSuccessfullyOnce)return o;for(let f of this.featureFlags)if(t===f.key){c=f;break}if(c!==void 0)try{o=await this.computeFlagLocally(c,r,n,i,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${o}`))}catch(f){f instanceof ase?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${f}`)):f instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${f}`))}return o}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let n;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),n==null)return null;try{return JSON.parse(n)}catch{return n}}}async getAllFlagsAndPayloads(t,r={},n={},i={}){await this.loadFeatureFlags();let a={},o={},c=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async f=>{try{let u=await this.computeFlagLocally(f,t,r,n,i);a[f.key]=u;let s=await this.computeFeatureFlagPayloadLocally(f.key,u);s&&(o[f.key]=s)}catch(u){u instanceof ase||u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${f.key}: ${u}`)),c=!0}})),{response:a,payloads:o,fallbackToDecide:c}}async computeFlagLocally(t,r,n={},i={},a={}){if(t.ensure_experience_continuity)throw new ase("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let f=this.groupTypeMapping[String(c)];if(!f)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new ase("Flag has unknown group type index");if(!(f in n))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let u=a[f];return await this.matchFeatureFlagProperties(t,n[f],u)}else return await this.matchFeatureFlagProperties(t,r,i)}async matchFeatureFlagProperties(t,r,n){let i=t.filters||{},a=i.groups||[],o=!1,c,f=[...a].sort((u,s)=>{let l=!!u.variant,m=!!s.variant;return l&&m?0:l?-1:m?1:0});for(let u of f)try{if(await this.isConditionMatch(t,r,u,n)){let s=u.variant,l=i.multivariate?.variants||[];s&&l.some(m=>m.key===s)?c=s:c=await this.getMatchingVariant(t,r)||!0;break}}catch(s){if(s instanceof ase)o=!0;else throw s}if(c!==void 0)return c;if(o)throw new ase("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i){let a=n.rollout_percentage,o=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let f=c.type,u=!1;if(f==="cohort"?u=uYh(c,i,this.cohorts,this.debugMode):u=sYh(c,i,o),!u)return!1}if(a==null)return!0}return!(a!=null&&await W$h(t.key,r)>a/100)}async getMatchingVariant(t,r){let n=await W$h(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(CgD,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 wQa(`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 wQa(`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 wQa(`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 wQa&&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=vdu(()=>{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=vdu(()=>{a.abort()},this.timeout),n.signal=a.signal}try{return this.fetch(r,n)}finally{clearTimeout(i)}}};async function W$h(e,t,r=""){let n=await DgD(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/IgD}function sYh(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 ase("Operator is_not_set is not supported")}else throw new ase(`Property ${n} not found in propertyValues`);let o=t[n];if(o==null&&!MgD.includes(a))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${a} operator`),!1;function c(u,s){return Array.isArray(u)?u.map(l=>String(l).toLowerCase()).includes(String(s).toLowerCase()):String(u).toLowerCase()===String(s).toLowerCase()}function f(u,s,l){if(l==="gt")return u>s;if(l==="gte")return u>=s;if(l==="lt")return u<s;if(l==="lte")return u<=s;throw new Error(`Invalid operator: ${l}`)}switch(a){case"exact":return c(i,o);case"is_not":return!c(i,o);case"is_set":return n in t;case"icontains":return String(o).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(i).toLowerCase());case"regex":return H$h(String(i))&&String(o).match(String(i))!==null;case"not_regex":return H$h(String(i))&&String(o).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let u=typeof i=="number"?i:null;if(typeof i=="string")try{u=parseFloat(i)}catch{}return u!=null&&o!=null?typeof o=="string"?f(o,String(i),a):f(o,u,a):f(String(o),String(i),a)}case"is_date_after":case"is_date_before":{let u=BgD(String(i));if(u==null&&(u=G$h(i)),u==null)throw new ase(`Invalid date: ${i}`);let s=G$h(o);return["is_date_before"].includes(a)?s<u:s>u}default:throw new ase(`Unknown operator: ${a}`)}}function uYh(e,t,r,n=!1){let i=String(e.value);if(!(i in r))throw new ase("can't match cohort without a given cohort property value");let a=r[i];return cYh(a,t,r,n)}function cYh(e,t,r,n=!1){if(!e)return!0;let i=e.type,a=e.values;if(!a||a.length===0)return!0;let o=!1;if("values"in a[0]){for(let c of a)try{let f=cYh(c,t,r,n);if(i==="AND"){if(!f)return!1}else if(f)return!0}catch(f){if(f instanceof ase)n&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new ase("Can't match cohort without a given cohort property value");return i==="AND"}else{for(let c of a)try{let f;c.type==="cohort"?f=uYh(c,t,r,n):f=sYh(c,t);let u=c.negation||!1;if(i==="AND"){if(!f&&!u||f&&u)return!1}else if(f&&!u||!f&&u)return!0}catch(f){if(f instanceof ase)n&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new ase("can't match cohort without a given cohort property value");return i==="AND"}}function H$h(e){try{return new RegExp(e),!0}catch{return!1}}function G$h(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 ase(`${e} is in an invalid date format`)}else throw new ase(`The date provided ${e} must be a string, number, or date object`)}function BgD(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 kkl=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},TgD=100,J$h=30*1e3,qgD=50*1e3,eef=class extends Ykl{constructor(t,r={}){if(super(t,r),this._memoryStorage=new kkl,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,TgD):J$h,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 Zkl({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 jQa(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||qgD}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):aYh(t,r)}getLibraryVersion(){return cgD}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:n,properties:i,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:f,uuid:u}=t,s=A=>{super.captureStateless(r,n,A,{timestamp:c,disableGeoip:f,uuid:u})},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,f);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:f,onlyEvaluateLocally:!0})}return{}}).then(A=>{let P={};if(A)for(let[M,T]of Object.entries(A))P[`$feature/${M}`]=T;let C=Object.keys(A||{}).filter(M=>A?.[M]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(A=>{s({...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:f,uuid:u}=t,s=A=>super.captureStatelessImmediate(r,n,A,{timestamp:c,disableGeoip:f,uuid:u}),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,f);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:f,onlyEvaluateLocally:!0})}return{}}).then(A=>{let P={};if(A)for(let[M,T]of Object.entries(A))P[`$feature/${M}`]=T;let C=Object.keys(A||{}).filter(M=>A?.[M]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(A=>{s({...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=J$h){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(n),i(),r(a>0)})})}async getFeatureFlag(t,r,n){let{groups:i,disableGeoip:a}=n||{},{onlyEvaluateLocally:o,sendFeatureFlagEvents:c,personProperties:f,groupProperties:u}=n||{},s=this.addLocalPersonAndGroupProperties(r,i,f,u);f=s.allPersonProperties,u=s.allGroupProperties,o==null&&(o=!1),c==null&&(c=!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,i,f,u),m=l!==void 0,A,P;if(!m&&!o){let M=await super.getFeatureFlagDetailStateless(t,r,i,f,u,a);if(M===void 0)return;P=M.response,l=nef(P),A=M?.requestId}let C=`${t}_${l}`;return c&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(C))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(C):this.distinctIdHasSentFlagCalls[r]=[C],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:l,$feature_flag_id: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:f,personProperties:u,groupProperties:s}=i||{},l=this.addLocalPersonAndGroupProperties(r,a,u,s);u=l.allPersonProperties,s=l.allGroupProperties;let m;return this.featureFlagsPoller!==void 0&&(n||(n=await this.getFeatureFlag(t,r,{...i,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),n&&(m=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,n))),c==null&&(c=!1),f==null&&(f=!0),c==null&&(c=!1),!(m!==void 0)&&!c&&(m=await super.getFeatureFlagPayloadStateless(t,r,a,u,s,o)),m}async getRemoteConfigPayload(t){return(await this.featureFlagsPoller?._requestRemoteConfigPayload(t))?.json()}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:n,disableGeoip:i}=r||{},{onlyEvaluateLocally:a,personProperties:o,groupProperties:c}=r||{},f=this.addLocalPersonAndGroupProperties(t,n,o,c);o=f.allPersonProperties,c=f.allGroupProperties,a==null&&(a=!1);let u=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,n,o,c),s={},l={},m=!0;if(u&&(s=u.response,l=u.payloads,m=u.fallbackToDecide),m&&!a){let A=await super.getFeatureFlagsAndPayloadsStateless(t,n,o,c,i);s={...s,...A.flags||{}},l={...l,...A.payloads||{}}}return{featureFlags:s,featureFlagPayloads:l}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:a}){super.groupIdentifyStateless(t,r,n,{disableGeoip:a},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(),super._shutdown(t)}addLocalPersonAndGroupProperties(t,r,n,i){let a={distinct_id:t,...n||{}},o={};if(r)for(let c of Object.keys(r))o[c]={$group_key:r[c],...i?.[c]||{}};return{allPersonProperties:a,allGroupProperties:o}}captureException(t,r,n){let i=new Error("PostHog syntheticException");jQa.captureException(this,t,{syntheticException:i},r,n)}},K$h=/\(error: (.*)\)/,lYh=50,fYh="?";function RgD(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return n=>{let i=n.match(r);if(i){let a,o,c,f,u;if(i[1]){c=i[1];let m=c.lastIndexOf(".");if(c[m-1]==="."&&m--,m>0){a=c.slice(0,m),o=c.slice(m+1);let A=a.indexOf(".Module");A>0&&(c=c.slice(A+1),a=a.slice(0,A))}f=void 0}o&&(f=a,u=o),o==="<anonymous>"&&(u=void 0,c=void 0),c===void 0&&(u=u||fYh,c=f?`${f}.${u}`:u);let s=i[2]?.startsWith("file://")?i[2].slice(7):i[2],l=i[5]==="native";return s?.match(/\/[A-Z]:/)&&(s=s.slice(1)),!s&&i[5]&&!l&&(s=i[5]),{filename:s?decodeURI(s):void 0,module:e?e(s):void 0,function:c,lineno:$$h(i[3]),colno:$$h(i[4]),in_app:NgD(s||"",l),platform:"node:javascript"}}if(n.match(t))return{filename:n,platform:"node:javascript"}}}function NgD(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 $$h(e){return parseInt(e||"",10)||void 0}function xgD(e){return[90,RgD(e)]}function FgD(e){let r=[xgD(e)].sort((n,i)=>n[0]-i[0]).map(n=>n[1]);return(n,i=0)=>{let a=[],o=n.split(`
|
|
2162
|
-
`);for(let c=i;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let u=K$h.test(f)?f.replace(K$h,"$1"):f;if(!u.match(/\S*Error: /)){for(let s of r){let l=s(u);if(l){a.push(l);break}}if(a.length>=lYh)break}}return zgD(a)}}function zgD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,lYh).map(r=>({...r,filename:r.filename||QgD(t).filename,function:r.function||fYh}))}function QgD(e){return e[e.length-1]||{}}jQa.stackParser=FgD(YbD());jQa.frameModifiers=[kbD];var SQa=class extends eef{getLibraryId(){return"posthog-node"}};var gdu=class{posthog;constructor({posthogApiKey:t}){this.posthog=new SQa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.82.2",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var Azo=class{async sendEvent(){}async identify(){}async flush(){}};var CQa=require("fs/promises"),hYh=require("os"),yYh=require("path");var dYh=aa(require("crypto")),Odu=new Uint8Array(256),mdu=Odu.length;function ief(){return mdu>Odu.length-16&&(dYh.default.randomFillSync(Odu),mdu=0),Odu.slice(mdu,mdu+=16)}var Bve=[];for(let e=0;e<256;++e)Bve.push((e+256).toString(16).slice(1));function pYh(e,t=0){return Bve[e[t+0]]+Bve[e[t+1]]+Bve[e[t+2]]+Bve[e[t+3]]+"-"+Bve[e[t+4]]+Bve[e[t+5]]+"-"+Bve[e[t+6]]+Bve[e[t+7]]+"-"+Bve[e[t+8]]+Bve[e[t+9]]+"-"+Bve[e[t+10]]+Bve[e[t+11]]+Bve[e[t+12]]+Bve[e[t+13]]+Bve[e[t+14]]+Bve[e[t+15]]}var _Yh=aa(require("crypto")),aef={randomUUID:_Yh.default.randomUUID};function LgD(e,t,r){if(aef.randomUUID&&!t&&!e)return aef.randomUUID();e=e||{};let n=e.random||(e.rng||ief)();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 pYh(n)}var Ept=LgD;var UgD="id",VgD=".fern",Pzo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new SQa(r),this.userId=t==null?void 0:gGl(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.82.2",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=$l(Q_.of((0,hYh.homedir)()),vu.of(VgD),vu.of(UgD));await qv(t)||(await(0,CQa.mkdir)((0,yYh.dirname)(t),{recursive:!0}),await(0,CQa.writeFile)(t,Ept())),this.persistedDistinctId=(await(0,CQa.readFile)(t)).toString()}return this.persistedDistinctId}};var oef;async function IQa(){return oef==null&&(oef=await WgD()),oef}async function WgD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Azo;let r=await Iau();return r!=null?new Pzo({token:r,posthogApiKey:e}):await I8a()!=null?new gdu({posthogApiKey:e}):new Pzo({token:void 0,posthogApiKey:e})}catch{return new Azo}}function wzo(e,t){return function(){return e.apply(t,arguments)}}var{toString:HgD}=Object.prototype,{getPrototypeOf:uef}=Object,{iterator:Pdu,toStringTag:bYh}=Symbol,wdu=(e=>t=>{let r=HgD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),TIr=e=>(e=e.toLowerCase(),t=>wdu(t)===e),jdu=e=>t=>typeof t===e,{isArray:BQa}=Array,MQa=jdu("undefined");function jzo(e){return e!==null&&!MQa(e)&&e.constructor!==null&&!MQa(e.constructor)&&dxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var gYh=TIr("ArrayBuffer");function GgD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&gYh(e.buffer),t}var JgD=jdu("string"),dxe=jdu("function"),mYh=jdu("number"),Ezo=e=>e!==null&&typeof e=="object",KgD=e=>e===!0||e===!1,Adu=e=>{if(wdu(e)!=="object")return!1;let t=uef(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(bYh in e)&&!(Pdu in e)},$gD=e=>{if(!Ezo(e)||jzo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},YgD=TIr("Date"),XgD=TIr("File"),ZgD=TIr("Blob"),kgD=TIr("FileList"),e0D=e=>Ezo(e)&&dxe(e.pipe),t0D=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||dxe(e.append)&&((t=wdu(e))==="formdata"||t==="object"&&dxe(e.toString)&&e.toString()==="[object FormData]"))},r0D=TIr("URLSearchParams"),[n0D,i0D,a0D,o0D]=["ReadableStream","Request","Response","Headers"].map(TIr),s0D=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Szo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),BQa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(jzo(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 OYh(e,t){if(jzo(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 FYi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,AYh=e=>!MQa(e)&&e!==FYi;function sef(){let{caseless:e,skipUndefined:t}=AYh(this)&&this||{},r={},n=(i,a)=>{let o=e&&OYh(r,a)||a;Adu(r[o])&&Adu(i)?r[o]=sef(r[o],i):Adu(i)?r[o]=sef({},i):BQa(i)?r[o]=i.slice():(!t||!MQa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&Szo(arguments[i],n);return r}var u0D=(e,t,r,{allOwnKeys:n}={})=>(Szo(t,(i,a)=>{r&&dxe(i)?e[a]=wzo(i,r):e[a]=i},{allOwnKeys:n}),e),c0D=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),l0D=(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)},f0D=(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&&uef(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},d0D=(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},p0D=e=>{if(!e)return null;if(BQa(e))return e;let t=e.length;if(!mYh(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},_0D=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&uef(Uint8Array)),h0D=(e,t)=>{let n=(e&&e[Pdu]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},y0D=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},v0D=TIr("HTMLFormElement"),b0D=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),vYh=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),g0D=TIr("RegExp"),PYh=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};Szo(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},m0D=e=>{PYh(e,(t,r)=>{if(dxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(dxe(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+"'")})}})},O0D=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return BQa(e)?n(e):n(String(e).split(t)),r},A0D=()=>{},P0D=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function w0D(e){return!!(e&&dxe(e.append)&&e[bYh]==="FormData"&&e[Pdu])}var j0D=e=>{let t=new Array(10),r=(n,i)=>{if(Ezo(n)){if(t.indexOf(n)>=0)return;if(jzo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=BQa(n)?[]:{};return Szo(n,(o,c)=>{let f=r(o,i+1);!MQa(f)&&(a[c]=f)}),t[i]=void 0,a}}return n};return r(e,0)},E0D=TIr("AsyncFunction"),S0D=e=>e&&(Ezo(e)||dxe(e))&&dxe(e.then)&&dxe(e.catch),wYh=((e,t)=>e?setImmediate:t?((r,n)=>(FYi.addEventListener("message",({source:i,data:a})=>{i===FYi&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),FYi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",dxe(FYi.postMessage)),D0D=typeof queueMicrotask<"u"?queueMicrotask.bind(FYi):typeof process<"u"&&process.nextTick||wYh,C0D=e=>e!=null&&dxe(e[Pdu]),$f={isArray:BQa,isArrayBuffer:gYh,isBuffer:jzo,isFormData:t0D,isArrayBufferView:GgD,isString:JgD,isNumber:mYh,isBoolean:KgD,isObject:Ezo,isPlainObject:Adu,isEmptyObject:$gD,isReadableStream:n0D,isRequest:i0D,isResponse:a0D,isHeaders:o0D,isUndefined:MQa,isDate:YgD,isFile:XgD,isBlob:ZgD,isRegExp:g0D,isFunction:dxe,isStream:e0D,isURLSearchParams:r0D,isTypedArray:_0D,isFileList:kgD,forEach:Szo,merge:sef,extend:u0D,trim:s0D,stripBOM:c0D,inherits:l0D,toFlatObject:f0D,kindOf:wdu,kindOfTest:TIr,endsWith:d0D,toArray:p0D,forEachEntry:h0D,matchAll:y0D,isHTMLForm:v0D,hasOwnProperty:vYh,hasOwnProp:vYh,reduceDescriptors:PYh,freezeMethods:m0D,toObjectSet:O0D,toCamelCase:b0D,noop:A0D,toFiniteNumber:P0D,findKey:OYh,global:FYi,isContextDefined:AYh,isSpecCompliantForm:w0D,toJSONObject:j0D,isAsyncFn:E0D,isThenable:S0D,setImmediate:wYh,asap:D0D,isIterable:C0D};function TQa(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)}$f.inherits(TQa,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:$f.toJSONObject(this.config),code:this.code,status:this.status}}});var jYh=TQa.prototype,EYh={};["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=>{EYh[e]={value:e}});Object.defineProperties(TQa,EYh);Object.defineProperty(jYh,"isAxiosError",{value:!0});TQa.from=(e,t,r,n,i,a)=>{let o=Object.create(jYh);$f.toFlatObject(e,o,function(s){return s!==Error.prototype},u=>u!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return TQa.call(o,c,f,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var _m=TQa;var SYh=aa(Kfu(),1),Edu=SYh.default;function cef(e){return $f.isPlainObject(e)||$f.isArray(e)}function CYh(e){return $f.endsWith(e,"[]")?e.slice(0,-2):e}function DYh(e,t,r){return e?e.concat(t).map(function(i,a){return i=CYh(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function I0D(e){return $f.isArray(e)&&!e.some(cef)}var M0D=$f.toFlatObject($f,{},null,function(t){return/^is[A-Z]/.test(t)});function B0D(e,t,r){if(!$f.isObject(e))throw new TypeError("target must be an object");t=t||new(Edu||FormData),r=$f.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!$f.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||s,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&$f.isSpecCompliantForm(t);if(!$f.isFunction(i))throw new TypeError("visitor must be a function");function u(P){if(P===null)return"";if($f.isDate(P))return P.toISOString();if($f.isBoolean(P))return P.toString();if(!f&&$f.isBlob(P))throw new _m("Blob is not supported. Use a Buffer instead.");return $f.isArrayBuffer(P)||$f.isTypedArray(P)?f&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function s(P,C,M){let T=P;if(P&&!M&&typeof P=="object"){if($f.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if($f.isArray(P)&&I0D(P)||($f.isFileList(P)||$f.endsWith(C,"[]"))&&(T=$f.toArray(P)))return C=CYh(C),T.forEach(function(U,R){!($f.isUndefined(U)||U===null)&&t.append(o===!0?DYh([C],R,a):o===null?C:C+"[]",u(U))}),!1}return cef(P)?!0:(t.append(DYh(M,C,a),u(P)),!1)}let l=[],m=Object.assign(M0D,{defaultVisitor:s,convertValue:u,isVisitable:cef});function A(P,C){if(!$f.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),$f.forEach(P,function(T,z){(!($f.isUndefined(T)||T===null)&&i.call(t,T,$f.isString(z)?z.trim():z,C,m))===!0&&A(T,C?C.concat(z):[z])}),l.pop()}}if(!$f.isObject(e))throw new TypeError("data must be an object");return A(e),t}var WIi=B0D;function IYh(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function MYh(e,t){this._pairs=[],e&&WIi(e,this,t)}var BYh=MYh.prototype;BYh.append=function(t,r){this._pairs.push([t,r])};BYh.toString=function(t){let r=t?function(n){return t.call(this,n,IYh)}:IYh;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var TYh=MYh;function T0D(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function zYi(e,t,r){if(!t)return e;let n=r&&r.encode||T0D;$f.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=$f.isURLSearchParams(t)?t.toString():new TYh(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var lef=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){$f.forEach(this.handlers,function(n){n!==null&&t(n)})}},fef=lef;var qQa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var xYh=aa(require("crypto"),1);var qYh=aa(require("url"),1),RYh=qYh.default.URLSearchParams;var def="abcdefghijklmnopqrstuvwxyz",NYh="0123456789",FYh={DIGIT:NYh,ALPHA:def,ALPHA_DIGIT:def+def.toUpperCase()+NYh},q0D=(e=16,t=FYh.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);xYh.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},zYh={isNode:!0,classes:{URLSearchParams:RYh,FormData:Edu,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:FYh,generateString:q0D,protocols:["http","https","file","data"]};var hef={};lf(hef,{hasBrowserEnv:()=>_ef,hasStandardBrowserEnv:()=>R0D,hasStandardBrowserWebWorkerEnv:()=>N0D,navigator:()=>pef,origin:()=>x0D});var _ef=typeof window<"u"&&typeof document<"u",pef=typeof navigator=="object"&&navigator||void 0,R0D=_ef&&(!pef||["ReactNative","NativeScript","NS"].indexOf(pef.product)<0),N0D=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",x0D=_ef&&window.location.href||"http://localhost";var d4={...hef,...zYh};function yef(e,t){return WIi(e,new d4.classes.URLSearchParams,{visitor:function(r,n,i,a){return d4.isNode&&$f.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function F0D(e){return $f.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function z0D(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 Q0D(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&$f.isArray(i)?i.length:o,f?($f.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!$f.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&$f.isArray(i[o])&&(i[o]=z0D(i[o])),!c)}if($f.isFormData(e)&&$f.isFunction(e.entries)){let r={};return $f.forEachEntry(e,(n,i)=>{t(F0D(n),i,r,0)}),r}return null}var Sdu=Q0D;function L0D(e,t,r){if($f.isString(e))try{return(t||JSON.parse)(e),$f.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var vef={transitional:qQa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=$f.isObject(t);if(a&&$f.isHTMLForm(t)&&(t=new FormData(t)),$f.isFormData(t))return i?JSON.stringify(Sdu(t)):t;if($f.isArrayBuffer(t)||$f.isBuffer(t)||$f.isStream(t)||$f.isFile(t)||$f.isBlob(t)||$f.isReadableStream(t))return t;if($f.isArrayBufferView(t))return t.buffer;if($f.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 yef(t,this.formSerializer).toString();if((c=$f.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return WIi(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),L0D(t)):t}],transformResponse:[function(t){let r=this.transitional||vef.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if($f.isResponse(t)||$f.isReadableStream(t))return t;if(t&&$f.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"?_m.from(c,_m.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:d4.classes.FormData,Blob:d4.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$f.forEach(["delete","get","head","post","put","patch"],e=>{vef.headers[e]={}});var RQa=vef;var U0D=$f.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"]),QYh=e=>{let t={},r,n,i;return e&&e.split(`
|
|
2162
|
+
`);for(let c=i;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let u=K$h.test(f)?f.replace(K$h,"$1"):f;if(!u.match(/\S*Error: /)){for(let s of r){let l=s(u);if(l){a.push(l);break}}if(a.length>=lYh)break}}return zgD(a)}}function zgD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,lYh).map(r=>({...r,filename:r.filename||QgD(t).filename,function:r.function||fYh}))}function QgD(e){return e[e.length-1]||{}}jQa.stackParser=FgD(YbD());jQa.frameModifiers=[kbD];var SQa=class extends eef{getLibraryId(){return"posthog-node"}};var gdu=class{posthog;constructor({posthogApiKey:t}){this.posthog=new SQa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.82.3",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var Azo=class{async sendEvent(){}async identify(){}async flush(){}};var CQa=require("fs/promises"),hYh=require("os"),yYh=require("path");var dYh=aa(require("crypto")),Odu=new Uint8Array(256),mdu=Odu.length;function ief(){return mdu>Odu.length-16&&(dYh.default.randomFillSync(Odu),mdu=0),Odu.slice(mdu,mdu+=16)}var Bve=[];for(let e=0;e<256;++e)Bve.push((e+256).toString(16).slice(1));function pYh(e,t=0){return Bve[e[t+0]]+Bve[e[t+1]]+Bve[e[t+2]]+Bve[e[t+3]]+"-"+Bve[e[t+4]]+Bve[e[t+5]]+"-"+Bve[e[t+6]]+Bve[e[t+7]]+"-"+Bve[e[t+8]]+Bve[e[t+9]]+"-"+Bve[e[t+10]]+Bve[e[t+11]]+Bve[e[t+12]]+Bve[e[t+13]]+Bve[e[t+14]]+Bve[e[t+15]]}var _Yh=aa(require("crypto")),aef={randomUUID:_Yh.default.randomUUID};function LgD(e,t,r){if(aef.randomUUID&&!t&&!e)return aef.randomUUID();e=e||{};let n=e.random||(e.rng||ief)();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 pYh(n)}var Ept=LgD;var UgD="id",VgD=".fern",Pzo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new SQa(r),this.userId=t==null?void 0:gGl(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.82.3",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=$l(Q_.of((0,hYh.homedir)()),vu.of(VgD),vu.of(UgD));await qv(t)||(await(0,CQa.mkdir)((0,yYh.dirname)(t),{recursive:!0}),await(0,CQa.writeFile)(t,Ept())),this.persistedDistinctId=(await(0,CQa.readFile)(t)).toString()}return this.persistedDistinctId}};var oef;async function IQa(){return oef==null&&(oef=await WgD()),oef}async function WgD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Azo;let r=await Iau();return r!=null?new Pzo({token:r,posthogApiKey:e}):await I8a()!=null?new gdu({posthogApiKey:e}):new Pzo({token:void 0,posthogApiKey:e})}catch{return new Azo}}function wzo(e,t){return function(){return e.apply(t,arguments)}}var{toString:HgD}=Object.prototype,{getPrototypeOf:uef}=Object,{iterator:Pdu,toStringTag:bYh}=Symbol,wdu=(e=>t=>{let r=HgD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),TIr=e=>(e=e.toLowerCase(),t=>wdu(t)===e),jdu=e=>t=>typeof t===e,{isArray:BQa}=Array,MQa=jdu("undefined");function jzo(e){return e!==null&&!MQa(e)&&e.constructor!==null&&!MQa(e.constructor)&&dxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var gYh=TIr("ArrayBuffer");function GgD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&gYh(e.buffer),t}var JgD=jdu("string"),dxe=jdu("function"),mYh=jdu("number"),Ezo=e=>e!==null&&typeof e=="object",KgD=e=>e===!0||e===!1,Adu=e=>{if(wdu(e)!=="object")return!1;let t=uef(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(bYh in e)&&!(Pdu in e)},$gD=e=>{if(!Ezo(e)||jzo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},YgD=TIr("Date"),XgD=TIr("File"),ZgD=TIr("Blob"),kgD=TIr("FileList"),e0D=e=>Ezo(e)&&dxe(e.pipe),t0D=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||dxe(e.append)&&((t=wdu(e))==="formdata"||t==="object"&&dxe(e.toString)&&e.toString()==="[object FormData]"))},r0D=TIr("URLSearchParams"),[n0D,i0D,a0D,o0D]=["ReadableStream","Request","Response","Headers"].map(TIr),s0D=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Szo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),BQa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(jzo(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 OYh(e,t){if(jzo(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 FYi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,AYh=e=>!MQa(e)&&e!==FYi;function sef(){let{caseless:e,skipUndefined:t}=AYh(this)&&this||{},r={},n=(i,a)=>{let o=e&&OYh(r,a)||a;Adu(r[o])&&Adu(i)?r[o]=sef(r[o],i):Adu(i)?r[o]=sef({},i):BQa(i)?r[o]=i.slice():(!t||!MQa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&Szo(arguments[i],n);return r}var u0D=(e,t,r,{allOwnKeys:n}={})=>(Szo(t,(i,a)=>{r&&dxe(i)?e[a]=wzo(i,r):e[a]=i},{allOwnKeys:n}),e),c0D=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),l0D=(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)},f0D=(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&&uef(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},d0D=(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},p0D=e=>{if(!e)return null;if(BQa(e))return e;let t=e.length;if(!mYh(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},_0D=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&uef(Uint8Array)),h0D=(e,t)=>{let n=(e&&e[Pdu]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},y0D=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},v0D=TIr("HTMLFormElement"),b0D=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),vYh=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),g0D=TIr("RegExp"),PYh=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};Szo(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},m0D=e=>{PYh(e,(t,r)=>{if(dxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(dxe(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+"'")})}})},O0D=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return BQa(e)?n(e):n(String(e).split(t)),r},A0D=()=>{},P0D=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function w0D(e){return!!(e&&dxe(e.append)&&e[bYh]==="FormData"&&e[Pdu])}var j0D=e=>{let t=new Array(10),r=(n,i)=>{if(Ezo(n)){if(t.indexOf(n)>=0)return;if(jzo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=BQa(n)?[]:{};return Szo(n,(o,c)=>{let f=r(o,i+1);!MQa(f)&&(a[c]=f)}),t[i]=void 0,a}}return n};return r(e,0)},E0D=TIr("AsyncFunction"),S0D=e=>e&&(Ezo(e)||dxe(e))&&dxe(e.then)&&dxe(e.catch),wYh=((e,t)=>e?setImmediate:t?((r,n)=>(FYi.addEventListener("message",({source:i,data:a})=>{i===FYi&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),FYi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",dxe(FYi.postMessage)),D0D=typeof queueMicrotask<"u"?queueMicrotask.bind(FYi):typeof process<"u"&&process.nextTick||wYh,C0D=e=>e!=null&&dxe(e[Pdu]),$f={isArray:BQa,isArrayBuffer:gYh,isBuffer:jzo,isFormData:t0D,isArrayBufferView:GgD,isString:JgD,isNumber:mYh,isBoolean:KgD,isObject:Ezo,isPlainObject:Adu,isEmptyObject:$gD,isReadableStream:n0D,isRequest:i0D,isResponse:a0D,isHeaders:o0D,isUndefined:MQa,isDate:YgD,isFile:XgD,isBlob:ZgD,isRegExp:g0D,isFunction:dxe,isStream:e0D,isURLSearchParams:r0D,isTypedArray:_0D,isFileList:kgD,forEach:Szo,merge:sef,extend:u0D,trim:s0D,stripBOM:c0D,inherits:l0D,toFlatObject:f0D,kindOf:wdu,kindOfTest:TIr,endsWith:d0D,toArray:p0D,forEachEntry:h0D,matchAll:y0D,isHTMLForm:v0D,hasOwnProperty:vYh,hasOwnProp:vYh,reduceDescriptors:PYh,freezeMethods:m0D,toObjectSet:O0D,toCamelCase:b0D,noop:A0D,toFiniteNumber:P0D,findKey:OYh,global:FYi,isContextDefined:AYh,isSpecCompliantForm:w0D,toJSONObject:j0D,isAsyncFn:E0D,isThenable:S0D,setImmediate:wYh,asap:D0D,isIterable:C0D};function TQa(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)}$f.inherits(TQa,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:$f.toJSONObject(this.config),code:this.code,status:this.status}}});var jYh=TQa.prototype,EYh={};["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=>{EYh[e]={value:e}});Object.defineProperties(TQa,EYh);Object.defineProperty(jYh,"isAxiosError",{value:!0});TQa.from=(e,t,r,n,i,a)=>{let o=Object.create(jYh);$f.toFlatObject(e,o,function(s){return s!==Error.prototype},u=>u!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return TQa.call(o,c,f,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var _m=TQa;var SYh=aa(Kfu(),1),Edu=SYh.default;function cef(e){return $f.isPlainObject(e)||$f.isArray(e)}function CYh(e){return $f.endsWith(e,"[]")?e.slice(0,-2):e}function DYh(e,t,r){return e?e.concat(t).map(function(i,a){return i=CYh(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function I0D(e){return $f.isArray(e)&&!e.some(cef)}var M0D=$f.toFlatObject($f,{},null,function(t){return/^is[A-Z]/.test(t)});function B0D(e,t,r){if(!$f.isObject(e))throw new TypeError("target must be an object");t=t||new(Edu||FormData),r=$f.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!$f.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||s,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&$f.isSpecCompliantForm(t);if(!$f.isFunction(i))throw new TypeError("visitor must be a function");function u(P){if(P===null)return"";if($f.isDate(P))return P.toISOString();if($f.isBoolean(P))return P.toString();if(!f&&$f.isBlob(P))throw new _m("Blob is not supported. Use a Buffer instead.");return $f.isArrayBuffer(P)||$f.isTypedArray(P)?f&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function s(P,C,M){let T=P;if(P&&!M&&typeof P=="object"){if($f.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if($f.isArray(P)&&I0D(P)||($f.isFileList(P)||$f.endsWith(C,"[]"))&&(T=$f.toArray(P)))return C=CYh(C),T.forEach(function(U,R){!($f.isUndefined(U)||U===null)&&t.append(o===!0?DYh([C],R,a):o===null?C:C+"[]",u(U))}),!1}return cef(P)?!0:(t.append(DYh(M,C,a),u(P)),!1)}let l=[],m=Object.assign(M0D,{defaultVisitor:s,convertValue:u,isVisitable:cef});function A(P,C){if(!$f.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),$f.forEach(P,function(T,z){(!($f.isUndefined(T)||T===null)&&i.call(t,T,$f.isString(z)?z.trim():z,C,m))===!0&&A(T,C?C.concat(z):[z])}),l.pop()}}if(!$f.isObject(e))throw new TypeError("data must be an object");return A(e),t}var WIi=B0D;function IYh(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function MYh(e,t){this._pairs=[],e&&WIi(e,this,t)}var BYh=MYh.prototype;BYh.append=function(t,r){this._pairs.push([t,r])};BYh.toString=function(t){let r=t?function(n){return t.call(this,n,IYh)}:IYh;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var TYh=MYh;function T0D(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function zYi(e,t,r){if(!t)return e;let n=r&&r.encode||T0D;$f.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=$f.isURLSearchParams(t)?t.toString():new TYh(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var lef=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){$f.forEach(this.handlers,function(n){n!==null&&t(n)})}},fef=lef;var qQa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var xYh=aa(require("crypto"),1);var qYh=aa(require("url"),1),RYh=qYh.default.URLSearchParams;var def="abcdefghijklmnopqrstuvwxyz",NYh="0123456789",FYh={DIGIT:NYh,ALPHA:def,ALPHA_DIGIT:def+def.toUpperCase()+NYh},q0D=(e=16,t=FYh.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);xYh.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},zYh={isNode:!0,classes:{URLSearchParams:RYh,FormData:Edu,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:FYh,generateString:q0D,protocols:["http","https","file","data"]};var hef={};lf(hef,{hasBrowserEnv:()=>_ef,hasStandardBrowserEnv:()=>R0D,hasStandardBrowserWebWorkerEnv:()=>N0D,navigator:()=>pef,origin:()=>x0D});var _ef=typeof window<"u"&&typeof document<"u",pef=typeof navigator=="object"&&navigator||void 0,R0D=_ef&&(!pef||["ReactNative","NativeScript","NS"].indexOf(pef.product)<0),N0D=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",x0D=_ef&&window.location.href||"http://localhost";var d4={...hef,...zYh};function yef(e,t){return WIi(e,new d4.classes.URLSearchParams,{visitor:function(r,n,i,a){return d4.isNode&&$f.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function F0D(e){return $f.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function z0D(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 Q0D(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&$f.isArray(i)?i.length:o,f?($f.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!$f.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&$f.isArray(i[o])&&(i[o]=z0D(i[o])),!c)}if($f.isFormData(e)&&$f.isFunction(e.entries)){let r={};return $f.forEachEntry(e,(n,i)=>{t(F0D(n),i,r,0)}),r}return null}var Sdu=Q0D;function L0D(e,t,r){if($f.isString(e))try{return(t||JSON.parse)(e),$f.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var vef={transitional:qQa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=$f.isObject(t);if(a&&$f.isHTMLForm(t)&&(t=new FormData(t)),$f.isFormData(t))return i?JSON.stringify(Sdu(t)):t;if($f.isArrayBuffer(t)||$f.isBuffer(t)||$f.isStream(t)||$f.isFile(t)||$f.isBlob(t)||$f.isReadableStream(t))return t;if($f.isArrayBufferView(t))return t.buffer;if($f.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 yef(t,this.formSerializer).toString();if((c=$f.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return WIi(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),L0D(t)):t}],transformResponse:[function(t){let r=this.transitional||vef.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if($f.isResponse(t)||$f.isReadableStream(t))return t;if(t&&$f.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"?_m.from(c,_m.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:d4.classes.FormData,Blob:d4.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$f.forEach(["delete","get","head","post","put","patch"],e=>{vef.headers[e]={}});var RQa=vef;var U0D=$f.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"]),QYh=e=>{let t={},r,n,i;return e&&e.split(`
|
|
2163
2163
|
`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&U0D[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var LYh=Symbol("internals");function Dzo(e){return e&&String(e).trim().toLowerCase()}function Ddu(e){return e===!1||e==null?e:$f.isArray(e)?e.map(Ddu):String(e)}function V0D(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 W0D=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function bef(e,t,r,n,i){if($f.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!$f.isString(t)){if($f.isString(n))return t.indexOf(n)!==-1;if($f.isRegExp(n))return n.test(t)}}function H0D(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function G0D(e,t){let r=$f.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 NQa=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function a(c,f,u){let s=Dzo(f);if(!s)throw new Error("header name must be a non-empty string");let l=$f.findKey(i,s);(!l||i[l]===void 0||u===!0||u===void 0&&i[l]!==!1)&&(i[l||f]=Ddu(c))}let o=(c,f)=>$f.forEach(c,(u,s)=>a(u,s,f));if($f.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if($f.isString(t)&&(t=t.trim())&&!W0D(t))o(QYh(t),r);else if($f.isObject(t)&&$f.isIterable(t)){let c={},f,u;for(let s of t){if(!$f.isArray(s))throw TypeError("Object iterator must return a key-value pair");c[u=s[0]]=(f=c[u])?$f.isArray(f)?[...f,s[1]]:[f,s[1]]:s[1]}o(c,r)}else t!=null&&a(r,t,n);return this}get(t,r){if(t=Dzo(t),t){let n=$f.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return V0D(i);if($f.isFunction(r))return r.call(this,i,n);if($f.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Dzo(t),t){let n=$f.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||bef(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function a(o){if(o=Dzo(o),o){let c=$f.findKey(n,o);c&&(!r||bef(n,n[c],c,r))&&(delete n[c],i=!0)}}return $f.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||bef(this,this[a],a,t,!0))&&(delete this[a],i=!0)}return i}normalize(t){let r=this,n={};return $f.forEach(this,(i,a)=>{let o=$f.findKey(n,a);if(o){r[o]=Ddu(i),delete r[a];return}let c=t?H0D(a):String(a).trim();c!==a&&delete r[a],r[c]=Ddu(i),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return $f.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&$f.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
2164
2164
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[LYh]=this[LYh]={accessors:{}}).accessors,i=this.prototype;function a(o){let c=Dzo(o);n[c]||(G0D(i,o),n[c]=!0)}return $f.isArray(t)?t.forEach(a):a(t),this}};NQa.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);$f.reduceDescriptors(NQa.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});$f.freezeMethods(NQa);var CK=NQa;function Czo(e,t){let r=this||RQa,n=t||r,i=CK.from(n.headers),a=n.data;return $f.forEach(e,function(c){a=c.call(r,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function Izo(e){return!!(e&&e.__CANCEL__)}function UYh(e,t,r){_m.call(this,e??"canceled",_m.ERR_CANCELED,t,r),this.name="CanceledError"}$f.inherits(UYh,_m,{__CANCEL__:!0});var Wtt=UYh;function G5r(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new _m("Request failed with status code "+r.status,[_m.ERR_BAD_REQUEST,_m.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function gef(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function mef(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function QYi(e,t,r){let n=!gef(t);return e&&(n||r==!1)?mef(e,t):t}var iXh=aa($fu(),1),aXh=aa(require("http"),1),oXh=aa(require("https"),1),sXh=aa(require("util"),1),uXh=aa(Okl(),1),Yfi=aa(require("zlib"),1);var LYi="1.12.2";function Mzo(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var J0D=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Oef(e,t,r){let n=r&&r.Blob||d4.classes.Blob,i=Mzo(e);if(t===void 0&&n&&(t=!0),i==="data"){e=i.length?e.slice(i.length+1):e;let a=J0D.exec(e);if(!a)throw new _m("Invalid URL",_m.ERR_INVALID_URL);let o=a[1],c=a[2],f=a[3],u=Buffer.from(decodeURIComponent(f),c?"base64":"utf8");if(t){if(!n)throw new _m("Blob is not supported",_m.ERR_NOT_SUPPORT);return new n([u],{type:o})}return u}throw new _m("Unsupported protocol "+i,_m.ERR_NOT_SUPPORT)}var VYi=aa(require("stream"),1);var VYh=aa(require("stream"),1);var Aef=Symbol("internals"),Pef=class extends VYh.default.Transform{constructor(t){t=$f.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,i)=>!$f.isUndefined(i[n])),super({readableHighWaterMark:t.chunkSize});let r=this[Aef]={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[Aef];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let i=this[Aef],a=i.maxRate,o=this.readableHighWaterMark,c=i.timeWindow,f=1e3/c,u=a/f,s=i.minChunkSize!==!1?Math.max(i.minChunkSize,u*.01):0,l=(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),M=null,T=o,z,U=0;if(a){let R=Date.now();(!i.ts||(U=R-i.ts)>=c)&&(i.ts=R,z=u-i.bytes,i.bytes=z<0?-z:0,U=0),z=u-i.bytes}if(a){if(z<=0)return setTimeout(()=>{P(null,A)},c-U);z<T&&(T=z)}T&&C>T&&C-T>s&&(M=A.subarray(T),A=A.subarray(0,T)),l(A,M?()=>{process.nextTick(P,null,M)}:P)};m(t,function A(P,C){if(P)return n(P);C?m(C,A):n(null)})}},wef=Pef;var cXh=require("events");var HYh=aa(require("util"),1),GYh=require("stream");var{asyncIterator:WYh}=Symbol,K0D=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[WYh]?yield*e[WYh]():yield e},Cdu=K0D;var $0D=d4.ALPHABET.ALPHA_DIGIT+"-_",Bzo=typeof TextEncoder=="function"?new TextEncoder:new HYh.default.TextEncoder,UYi=`\r
|
|
2165
2165
|
`,Y0D=Bzo.encode(UYi),X0D=2,jef=class{constructor(t,r){let{escapeName:n}=this.constructor,i=$f.isString(r),a=`Content-Disposition: form-data; name="${n(t)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${UYi}`;i?r=Bzo.encode(String(r).replace(/\r?\n|\r\n?/g,UYi)):a+=`Content-Type: ${r.type||"application/octet-stream"}${UYi}`,this.headers=Bzo.encode(a+UYi),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+X0D,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;$f.isTypedArray(t)?yield t:yield*Cdu(t),yield Y0D}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},Z0D=(e,t,r)=>{let{tag:n="form-data-boundary",size:i=25,boundary:a=n+"-"+d4.generateString(i,$0D)}=r||{};if(!$f.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=Bzo.encode("--"+a+UYi),c=Bzo.encode("--"+a+"--"+UYi),f=c.byteLength,u=Array.from(e.entries()).map(([l,m])=>{let A=new jef(l,m);return f+=A.size,A});f+=o.byteLength*u.length,f=$f.toFiniteNumber(f);let s={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(f)&&(s["Content-Length"]=f),t&&t(s),GYh.Readable.from((async function*(){for(let l of u)yield o,yield*l.encode();yield c})())},JYh=Z0D;var KYh=aa(require("stream"),1),Eef=class extends KYh.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)}},$Yh=Eef;var k0D=(e,t)=>$f.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,YYh=k0D;function emD(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,a=0,o;return t=t!==void 0?t:1e3,function(f){let u=Date.now(),s=n[a];o||(o=u),r[i]=f,n[i]=u;let l=a,m=0;for(;l!==i;)m+=r[l++],l=l%e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),u-o<t)return;let A=s&&u-s;return A?Math.round(m*1e3/A):void 0}}var XYh=emD;function tmD(e,t){let r=0,n=1e3/t,i,a,o=(u,s=Date.now())=>{r=s,i=null,a&&(clearTimeout(a),a=null),e(...u)};return[(...u)=>{let s=Date.now(),l=s-r;l>=n?o(u,s):(i=u,a||(a=setTimeout(()=>{a=null,o(i)},n-l)))},()=>i&&o(i)]}var ZYh=tmD;var $fi=(e,t,r=3)=>{let n=0,i=XYh(50,250);return ZYh(a=>{let o=a.loaded,c=a.lengthComputable?a.total:void 0,f=o-n,u=i(f),s=o<=c;n=o;let l={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:u||void 0,estimated:u&&c&&s?(c-o)/u:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},r)},xQa=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},FQa=e=>(...t)=>$f.asap(()=>e(...t));function Sef(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,f=o-1,u=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);f>=0&&(n.charCodeAt(f)===61?(c++,f--):u(f)&&(c++,f-=3)),c===1&&f>=0&&(n.charCodeAt(f)===61||u(f))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(n,"utf8")}var kYh={flush:Yfi.default.constants.Z_SYNC_FLUSH,finishFlush:Yfi.default.constants.Z_SYNC_FLUSH},rmD={flush:Yfi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:Yfi.default.constants.BROTLI_OPERATION_FLUSH},eXh=$f.isFunction(Yfi.default.createBrotliDecompress),{http:nmD,https:imD}=uXh.default,amD=/https:?/,tXh=d4.protocols.map(e=>e+":"),rXh=(e,[t,r])=>(e.on("end",r).on("error",r),t);function omD(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function lXh(e,t,r){let n=t;if(!n&&n!==!1){let i=iXh.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){lXh(a,t,a.href)}}var smD=typeof process<"u"&&$f.kindOf(process)==="process",umD=e=>new Promise((t,r)=>{let n,i,a=(f,u)=>{i||(i=!0,n&&n(f,u))},o=f=>{a(f),t(f)},c=f=>{a(f,!0),r(f)};e(o,c,f=>n=f).catch(c)}),cmD=({address:e,family:t})=>{if(!$f.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},nXh=(e,t)=>cmD($f.isObject(e)?e:{address:e,family:t}),fXh=smD&&function(t){return umD(async function(n,i,a){let{data:o,lookup:c,family:f}=t,{responseType:u,responseEncoding:s}=t,l=t.method.toUpperCase(),m,A=!1,P;if(c){let Se=YYh(c,St=>$f.isArray(St)?St:[St]);c=(St,_t,qe)=>{Se(St,_t,(De,Qt,Xe)=>{if(De)return qe(De);let Xt=$f.isArray(Qt)?Qt.map(Mt=>nXh(Mt)):[nXh(Qt,Xe)];_t.all?qe(De,Xt):qe(De,Xt[0].address,Xt[0].family)})}}let C=new cXh.EventEmitter,M=()=>{t.cancelToken&&t.cancelToken.unsubscribe(T),t.signal&&t.signal.removeEventListener("abort",T),C.removeAllListeners()};a((Se,St)=>{m=!0,St&&(A=!0,M())});function T(Se){C.emit("abort",!Se||Se.type?new Wtt(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=QYi(t.baseURL,t.url,t.allowAbsoluteUrls),U=new URL(z,d4.hasBrowserEnv?d4.origin:void 0),R=U.protocol||tXh[0];if(R==="data:"){if(t.maxContentLength>-1){let St=String(t.url||z||"");if(Sef(St)>t.maxContentLength)return i(new _m("maxContentLength size of "+t.maxContentLength+" exceeded",_m.ERR_BAD_RESPONSE,t))}let Se;if(l!=="GET")return G5r(n,i,{status:405,statusText:"method not allowed",headers:{},config:t});try{Se=Oef(t.url,u==="blob",{Blob:t.env&&t.env.Blob})}catch(St){throw _m.from(St,_m.ERR_BAD_REQUEST,t)}return u==="text"?(Se=Se.toString(s),(!s||s==="utf8")&&(Se=$f.stripBOM(Se))):u==="stream"&&(Se=VYi.default.Readable.from(Se)),G5r(n,i,{data:Se,status:200,statusText:"OK",headers:new CK,config:t})}if(tXh.indexOf(R)===-1)return i(new _m("Unsupported protocol "+R,_m.ERR_BAD_REQUEST,t));let V=CK.from(t.headers).normalize();V.set("User-Agent","axios/"+LYi,!1);let{onUploadProgress:$,onDownloadProgress:re}=t,Y=t.maxRate,te,ne;if($f.isSpecCompliantForm(o)){let Se=V.getContentType(/boundary=([-_\w\d]{10,70})/i);o=JYh(o,St=>{V.set(St)},{tag:`axios-${LYi}-boundary`,boundary:Se&&Se[1]||void 0})}else if($f.isFormData(o)&&$f.isFunction(o.getHeaders)){if(V.set(o.getHeaders()),!V.hasContentLength())try{let Se=await sXh.default.promisify(o.getLength).call(o);Number.isFinite(Se)&&Se>=0&&V.setContentLength(Se)}catch{}}else if($f.isBlob(o)||$f.isFile(o))o.size&&V.setContentType(o.type||"application/octet-stream"),V.setContentLength(o.size||0),o=VYi.default.Readable.from(Cdu(o));else if(o&&!$f.isStream(o)){if(!Buffer.isBuffer(o))if($f.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if($f.isString(o))o=Buffer.from(o,"utf-8");else return i(new _m("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",_m.ERR_BAD_REQUEST,t));if(V.setContentLength(o.length,!1),t.maxBodyLength>-1&&o.length>t.maxBodyLength)return i(new _m("Request body larger than maxBodyLength limit",_m.ERR_BAD_REQUEST,t))}let Oe=$f.toFiniteNumber(V.getContentLength());$f.isArray(Y)?(te=Y[0],ne=Y[1]):te=ne=Y,o&&($||te)&&($f.isStream(o)||(o=VYi.default.Readable.from(o,{objectMode:!1})),o=VYi.default.pipeline([o,new wef({maxRate:$f.toFiniteNumber(te)})],$f.noop),$&&o.on("progress",rXh(o,xQa(Oe,$fi(FQa($),!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=zYi(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"+(eXh?", br":""),!1);let be={path:ve,method:l,headers:V.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:ge,protocol:R,family:f,beforeRedirect:omD,beforeRedirects:{}};!$f.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,lXh(be,t.proxy,R+"//"+U.hostname+(U.port?":"+U.port:"")+be.path));let Me,Be=amD.test(be.protocol);if(be.agent=Be?t.httpsAgent:t.httpAgent,t.transport?Me=t.transport:t.maxRedirects===0?Me=Be?oXh.default:aXh.default:(t.maxRedirects&&(be.maxRedirects=t.maxRedirects),t.beforeRedirect&&(be.beforeRedirects.config=t.beforeRedirect),Me=Be?imD:nmD),t.maxBodyLength>-1?be.maxBodyLength=t.maxBodyLength:be.maxBodyLength=1/0,t.insecureHTTPParser&&(be.insecureHTTPParser=t.insecureHTTPParser),P=Me.request(be,function(St){if(P.destroyed)return;let _t=[St],qe=+St.headers["content-length"];if(re||ne){let Mt=new wef({maxRate:$f.toFiniteNumber(ne)});re&&Mt.on("progress",rXh(Mt,xQa(qe,$fi(FQa(re),!0,3)))),_t.push(Mt)}let De=St,Qt=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":_t.push(Yfi.default.createUnzip(kYh)),delete St.headers["content-encoding"];break;case"deflate":_t.push(new $Yh),_t.push(Yfi.default.createUnzip(kYh)),delete St.headers["content-encoding"];break;case"br":eXh&&(_t.push(Yfi.default.createBrotliDecompress(rmD)),delete St.headers["content-encoding"])}De=_t.length>1?VYi.default.pipeline(_t,$f.noop):_t[0];let Xe=VYi.default.finished(De,()=>{Xe(),M()}),Xt={status:St.statusCode,statusText:St.statusMessage,headers:new CK(St.headers),config:t,request:Qt};if(u==="stream")Xt.data=De,G5r(n,i,Xt);else{let Mt=[],Ke=0;De.on("data",function(ur){Mt.push(ur),Ke+=ur.length,t.maxContentLength>-1&&Ke>t.maxContentLength&&(A=!0,De.destroy(),i(new _m("maxContentLength size of "+t.maxContentLength+" exceeded",_m.ERR_BAD_RESPONSE,t,Qt)))}),De.on("aborted",function(){if(A)return;let ur=new _m("stream has been aborted",_m.ERR_BAD_RESPONSE,t,Qt);De.destroy(ur),i(ur)}),De.on("error",function(ur){P.destroyed||i(_m.from(ur,null,t,Qt))}),De.on("end",function(){try{let ur=Mt.length===1?Mt[0]:Buffer.concat(Mt);u!=="arraybuffer"&&(ur=ur.toString(s),(!s||s==="utf8")&&(ur=$f.stripBOM(ur))),Xt.data=ur}catch(ur){return i(_m.from(ur,null,t,Xt.request,Xt))}G5r(n,i,Xt)})}C.once("abort",Mt=>{De.destroyed||(De.emit("error",Mt),De.destroy())})}),C.once("abort",Se=>{i(Se),P.destroy(Se)}),P.on("error",function(St){i(_m.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 _m("error trying to parse `config.timeout` to int",_m.ERR_BAD_OPTION_VALUE,t,P));return}P.setTimeout(Se,function(){if(m)return;let _t=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",qe=t.transitional||qQa;t.timeoutErrorMessage&&(_t=t.timeoutErrorMessage),i(new _m(_t,qe.clarifyTimeoutError?_m.ETIMEDOUT:_m.ECONNABORTED,t,P)),T()})}if($f.isStream(o)){let Se=!1,St=!1;o.on("end",()=>{Se=!0}),o.once("error",_t=>{St=!0,P.destroy(_t)}),o.on("close",()=>{!Se&&!St&&T(new Wtt("Request stream has been aborted",t,P))}),o.pipe(P)}else P.end(o)})};var dXh=d4.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,d4.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(d4.origin),d4.navigator&&/(msie|trident)/i.test(d4.navigator.userAgent)):()=>!0;var pXh=d4.hasStandardBrowserEnv?{write(e,t,r,n,i,a){let o=[e+"="+encodeURIComponent(t)];$f.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),$f.isString(n)&&o.push("path="+n),$f.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 _Xh=e=>e instanceof CK?{...e}:e;function qIr(e,t){t=t||{};let r={};function n(u,s,l,m){return $f.isPlainObject(u)&&$f.isPlainObject(s)?$f.merge.call({caseless:m},u,s):$f.isPlainObject(s)?$f.merge({},s):$f.isArray(s)?s.slice():s}function i(u,s,l,m){if($f.isUndefined(s)){if(!$f.isUndefined(u))return n(void 0,u,l,m)}else return n(u,s,l,m)}function a(u,s){if(!$f.isUndefined(s))return n(void 0,s)}function o(u,s){if($f.isUndefined(s)){if(!$f.isUndefined(u))return n(void 0,u)}else return n(void 0,s)}function c(u,s,l){if(l in t)return n(u,s);if(l in e)return n(void 0,u)}let f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,s,l)=>i(_Xh(u),_Xh(s),l,!0)};return $f.forEach(Object.keys({...e,...t}),function(s){let l=f[s]||i,m=l(e[s],t[s],s);$f.isUndefined(m)&&l!==c||(r[s]=m)}),r}var Idu=e=>{let t=qIr({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=CK.from(o),t.url=zYi(QYi(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),$f.isFormData(r)){if(d4.hasStandardBrowserEnv||d4.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if($f.isFunction(r.getHeaders)){let f=r.getHeaders(),u=["content-type","content-length"];Object.entries(f).forEach(([s,l])=>{u.includes(s.toLowerCase())&&o.set(s,l)})}}if(d4.hasStandardBrowserEnv&&(n&&$f.isFunction(n)&&(n=n(t)),n||n!==!1&&dXh(t.url))){let f=i&&a&&pXh.read(a);f&&o.set(i,f)}return t};var lmD=typeof XMLHttpRequest<"u",hXh=lmD&&function(e){return new Promise(function(r,n){let i=Idu(e),a=i.data,o=CK.from(i.headers).normalize(),{responseType:c,onUploadProgress:f,onDownloadProgress:u}=i,s,l,m,A,P;function C(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let M=new XMLHttpRequest;M.open(i.method.toUpperCase(),i.url,!0),M.timeout=i.timeout;function T(){if(!M)return;let U=CK.from("getAllResponseHeaders"in M&&M.getAllResponseHeaders()),V={data:!c||c==="text"||c==="json"?M.responseText:M.response,status:M.status,statusText:M.statusText,headers:U,config:e,request:M};G5r(function(re){r(re),C()},function(re){n(re),C()},V),M=null}"onloadend"in M?M.onloadend=T:M.onreadystatechange=function(){!M||M.readyState!==4||M.status===0&&!(M.responseURL&&M.responseURL.indexOf("file:")===0)||setTimeout(T)},M.onabort=function(){M&&(n(new _m("Request aborted",_m.ECONNABORTED,e,M)),M=null)},M.onerror=function(R){let V=R&&R.message?R.message:"Network Error",$=new _m(V,_m.ERR_NETWORK,e,M);$.event=R||null,n($),M=null},M.ontimeout=function(){let R=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",V=i.transitional||qQa;i.timeoutErrorMessage&&(R=i.timeoutErrorMessage),n(new _m(R,V.clarifyTimeoutError?_m.ETIMEDOUT:_m.ECONNABORTED,e,M)),M=null},a===void 0&&o.setContentType(null),"setRequestHeader"in M&&$f.forEach(o.toJSON(),function(R,V){M.setRequestHeader(V,R)}),$f.isUndefined(i.withCredentials)||(M.withCredentials=!!i.withCredentials),c&&c!=="json"&&(M.responseType=i.responseType),u&&([m,P]=$fi(u,!0),M.addEventListener("progress",m)),f&&M.upload&&([l,A]=$fi(f),M.upload.addEventListener("progress",l),M.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(s=U=>{M&&(n(!U||U.type?new Wtt(null,e,M):U),M.abort(),M=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));let z=Mzo(i.url);if(z&&d4.protocols.indexOf(z)===-1){n(new _m("Unsupported protocol "+z+":",_m.ERR_BAD_REQUEST,e));return}M.send(a||null)})};var fmD=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,a=function(u){if(!i){i=!0,c();let s=u instanceof Error?u:this.reason;n.abort(s instanceof _m?s:new Wtt(s instanceof Error?s.message:s))}},o=t&&setTimeout(()=>{o=null,a(new _m(`timeout ${t} of ms exceeded`,_m.ETIMEDOUT))},t),c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(a):u.removeEventListener("abort",a)}),e=null)};e.forEach(u=>u.addEventListener("abort",a));let{signal:f}=n;return f.unsubscribe=()=>$f.asap(c),f}},yXh=fmD;var dmD=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},pmD=async function*(e,t){for await(let r of _mD(e))yield*dmD(r,t)},_mD=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()}},Def=(e,t,r,n)=>{let i=pmD(e,t),a=0,o,c=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{let{done:u,value:s}=await i.next();if(u){c(),f.close();return}let l=s.byteLength;if(r){let m=a+=l;r(m)}f.enqueue(new Uint8Array(s))}catch(u){throw c(u),u}},cancel(f){return c(f),i.return()}},{highWaterMark:2})};var vXh=64*1024,{isFunction:Mdu}=$f,hmD=(({Request:e,Response:t})=>({Request:e,Response:t}))($f.global),{ReadableStream:bXh,TextEncoder:gXh}=$f.global,mXh=(e,...t)=>{try{return!!e(...t)}catch{return!1}},ymD=e=>{e=$f.merge.call({skipUndefined:!0},hmD,e);let{fetch:t,Request:r,Response:n}=e,i=t?Mdu(t):typeof fetch=="function",a=Mdu(r),o=Mdu(n);if(!i)return!1;let c=i&&Mdu(bXh),f=i&&(typeof gXh=="function"?(P=>C=>P.encode(C))(new gXh):async P=>new Uint8Array(await new r(P).arrayBuffer())),u=a&&c&&mXh(()=>{let P=!1,C=new r(d4.origin,{body:new bXh,method:"POST",get duplex(){return P=!0,"half"}}).headers.has("Content-Type");return P&&!C}),s=o&&c&&mXh(()=>$f.isReadableStream(new n("").body)),l={stream:s&&(P=>P.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(P=>{!l[P]&&(l[P]=(C,M)=>{let T=C&&C[P];if(T)return T.call(C);throw new _m(`Response type '${P}' is not supported`,_m.ERR_NOT_SUPPORT,M)})});let m=async P=>{if(P==null)return 0;if($f.isBlob(P))return P.size;if($f.isSpecCompliantForm(P))return(await new r(d4.origin,{method:"POST",body:P}).arrayBuffer()).byteLength;if($f.isArrayBufferView(P)||$f.isArrayBuffer(P))return P.byteLength;if($f.isURLSearchParams(P)&&(P=P+""),$f.isString(P))return(await f(P)).byteLength},A=async(P,C)=>{let M=$f.toFiniteNumber(P.getContentLength());return M??m(C)};return async P=>{let{url:C,method:M,data:T,signal:z,cancelToken:U,timeout:R,onDownloadProgress:V,onUploadProgress:$,responseType:re,headers:Y,withCredentials:te="same-origin",fetchOptions:ne}=Idu(P),Oe=t||fetch;re=re?(re+"").toLowerCase():"text";let ge=yXh([z,U&&U.toAbortSignal()],R),ve=null,be=ge&&ge.unsubscribe&&(()=>{ge.unsubscribe()}),Me;try{if($&&u&&M!=="get"&&M!=="head"&&(Me=await A(Y,T))!==0){let De=new r(C,{method:"POST",body:T,duplex:"half"}),Qt;if($f.isFormData(T)&&(Qt=De.headers.get("content-type"))&&Y.setContentType(Qt),De.body){let[Xe,Xt]=xQa(Me,$fi(FQa($)));T=Def(De.body,vXh,Xe,Xt)}}$f.isString(te)||(te=te?"include":"omit");let Be=a&&"credentials"in r.prototype,Se={...ne,signal:ge,method:M.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)),_t=s&&(re==="stream"||re==="response");if(s&&(V||_t&&be)){let De={};["status","statusText","headers"].forEach(Mt=>{De[Mt]=St[Mt]});let Qt=$f.toFiniteNumber(St.headers.get("content-length")),[Xe,Xt]=V&&xQa(Qt,$fi(FQa(V),!0))||[];St=new n(Def(St.body,vXh,Xe,()=>{Xt&&Xt(),be&&be()}),De)}re=re||"text";let qe=await l[$f.findKey(l,re)||"text"](St,P);return!_t&&be&&be(),await new Promise((De,Qt)=>{G5r(De,Qt,{data:qe,headers:CK.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 _m("Network Error",_m.ERR_NETWORK,P,ve),{cause:Be.cause||Be}):_m.from(Be,Be&&Be.code,P,ve)}}},vmD=new Map,Cef=e=>{let t=e?e.env:{},{fetch:r,Request:n,Response:i}=t,a=[n,i,r],o=a.length,c=o,f,u,s=vmD;for(;c--;)f=a[c],u=s.get(f),u===void 0&&s.set(f,u=c?new Map:ymD(t)),s=u;return u},xeU=Cef();var Ief={http:fXh,xhr:hXh,fetch:{get:Cef}};$f.forEach(Ief,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var OXh=e=>`- ${e}`,gmD=e=>$f.isFunction(e)||e===null||e===!1,Bdu={getAdapter:(e,t)=>{e=$f.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,!gmD(n)&&(i=Ief[(c=String(n)).toLowerCase()],i===void 0))throw new _m(`Unknown adapter '${c}'`);if(i&&($f.isFunction(i)||(i=i.get(t))))break;a[c||"#"+o]=i}if(!i){let o=Object.entries(a).map(([f,u])=>`adapter ${f} `+(u===!1?"is not supported by the environment":"is not available in the build")),c=r?o.length>1?`since :
|
|
@@ -2400,7 +2400,7 @@ ${R}${z}${V}${SVa}`});function Zmu({message:e,error:t,logger:r,logLevel:n=j1.Err
|
|
|
2400
2400
|
Run ${gd.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
|
|
2401
2401
|
Run ${gd.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),QQa(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function Uhf({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!Ijy(e))return;let i=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let o=a.sort((c,f)=>c.generatorName.localeCompare(f.generatorName)||c.currentVersion.localeCompare(f.currentVersion));for(let c of o)i+=`
|
|
2402
2402
|
${await NeC(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+gd.dim(c.currentVersion)+gd.reset(" \u2192 ")+gd.green(c.latestVersion);return i+=`
|
|
2403
|
-
`,n?QQa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function NeC(e){let r=await new Cjy.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 xeC({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await Bjy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,u,s,l)=>{c.versions[u]==null&&(c.versions[u]={});let m=IDi(s.name,l),A=await L7r({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:l});A!=null&&(c.versions[u][s.name]={previousVersion:s.version,latestVersion:A})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await Bjy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,u,s)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=IDi(u.name,s),m=await L7r({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:s});m!=null&&(o.versions[c][f][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function Bjy({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 fIr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(i!=null&&f.groupName!==i))for(let u of f.generators)n!=null&&u.name!==n||await r(a.workspaceName,f.groupName,u,o)}})}))}function Tjy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let f=Cxe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function rOu({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await xeC({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[f,u]of Object.entries(c.versions))o.push(...Tjy(u,f,t.logger));else o.push(...Tjy(c.versions,void 0,t.logger))}return o}var A8o=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 MVa=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Vhf=(()=>{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})(),qjy=typeof globalThis.AbortController=="function",Rjy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",Njy=typeof globalThis.ReadableStream=="function",xjy=typeof globalThis.FormData=="function",nOu=["get","post","put","patch","head","delete"],FeC=()=>{};FeC();var Fjy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},iOu=2147483647,zjy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,aOu=Symbol("stop"),Qjy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},Ljy={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 zeC=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=zjy,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},Ujy=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,n=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:n},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(i){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function o(){let{done:c,value:f}=await a.read();if(c){i.close();return}if(t){n+=f.byteLength;let u=r===0?0:n/r;t({percent:u,transferredBytes:n,totalBytes:r},f)}i.enqueue(f),await o()}await o()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},Vjy=(e,t,r)=>{let n=zeC(r??e.body),i=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(a){let o=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function c(){let{done:f,value:u}=await o.read();if(f){t&&t({percent:1,transferredBytes:i,totalBytes:Math.max(n,i)},new Uint8Array),a.close();return}i+=u.byteLength;let s=n===0?0:i/n;(n<i||s===1)&&(s=.99),t&&t({percent:Number(s.toFixed(2)),transferredBytes:i,totalBytes:n},u),a.enqueue(u),await c()}await c()}})})};var BVa=e=>e!==null&&typeof e=="object";var P8o=(...e)=>{for(let t of e)if((!BVa(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Ghf({},...e)},Whf=(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 oOu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Ghf(e[r]??[],t[r]??[])}var Hhf=(e={},t={})=>({beforeRequest:oOu(e,t,"beforeRequest"),beforeRetry:oOu(e,t,"beforeRetry"),afterResponse:oOu(e,t,"afterResponse"),beforeError:oOu(e,t,"beforeError")}),Ghf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(BVa(i)){for(let[a,o]of Object.entries(i))BVa(o)&&a in t&&(o=Ghf(t[a],o)),t={...t,[a]:o};BVa(i.hooks)&&(n=Hhf(n,i.hooks),t.hooks=n),BVa(i.headers)&&(r=Whf(r,i.headers),t.headers=r)}return t};var Hjy=e=>nOu.includes(e)?e.toUpperCase():e,QeC=["get","put","head","delete","options","trace"],LeC=[408,413,429,500,502,503,504],UeC=[413,429,503],Wjy={limit:2,methods:QeC,statusCodes:LeC,afterStatusCodes:UeC,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Gjy=(e={})=>{if(typeof e=="number")return{...Wjy,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{...Wjy,...e}};async function Jhf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new MVa(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function Khf(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 Jjy=(e,t)=>{let r={};for(let n in t)!(n in Ljy)&&!(n in Qjy)&&!(n in e)&&(r[n]=t[n]);return r},Kjy=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 w8o=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>iOu)throw new RangeError(`The \`timeout\` option cannot be greater than ${iOu}`);await Promise.resolve();let c=await n._fetch();for(let f of n._options.hooks.afterResponse){let u=await f(n.request,n._options,n._decorateResponse(c.clone()));u instanceof globalThis.Response&&(c=u)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let f=new A8o(c,n.request,n._options);for(let u of n._options.hooks.beforeError)f=await u(f);throw f}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Njy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return Ujy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{n.request.bodyUsed||await n.request.body?.cancel()});for(let[c,f]of Object.entries(Fjy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||f);let u=await o;if(c==="json"){if(u.status===204)return"";let s=await u.text();return s===""?"":r.parseJson?r.parseJson(s):JSON.parse(s)}return u[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:Whf(this._input.headers,r.headers),hooks:Hhf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Hjy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:Gjy(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(qjy&&Rjy){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(Vhf&&(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),Kjy(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);(xjy&&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(!Vhf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=Vjy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof MVa)throw t;if(t instanceof A8o){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),iOu);if(this._retryCount<1)throw r;await Khf(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})===aOu)return;return this._retry(t)}}async _fetch(){for(let n of this._options.hooks.beforeRequest){let i=await n(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Jjy(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Jhf(r,t,this.abortController,this._options)}};var $hf=e=>{let t=(r,n)=>w8o.create(r,P8o(e,n));for(let r of nOu)t[r]=(n,i)=>w8o.create(n,P8o(e,i,{method:r}));return t.create=r=>$hf(P8o(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),$hf(P8o(e,r))),t.stop=aOu,t},VeC=$hf(),$jy=VeC;var b1y=aa(v1y(),1);function eyf(e){let t=(0,b1y.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var dEy=aa(fEy(),1),pEy=aa(z6r(),1),pyf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},_yf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function hyf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??eyf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,dEy.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let u;try{u=await $jy(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new pyf(e):l}if(t.allVersions)return u;let s=new _yf(e,r);if(u["dist-tags"][r]){let{time:l}=u;u=u.versions[u["dist-tags"][r]],u.time=l}else if(r){let l=!!u.versions[r];if(n&&!l)for(let[A,P]of Object.entries(u.versions))P.deprecated&&delete u.versions[A];if(!l){let A=Object.keys(u.versions);if(r=pEy.default.maxSatisfying(A,r),!r)throw s}let{time:m}=u;if(u=u.versions[r],u.time=m,!u)throw s}return u}async function I8o(e,t){let{version:r}=await hyf(e.toLowerCase(),t);return r}async function hBi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:I8o(e.packageName,{version:t?"prerelease":"latest"})}var _Ey=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],bOu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=j1.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new tOu(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.82.2"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${gd.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Qoe}failWithoutThrowing(t,r){this.didSucceed=!1,Zmu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await IQa()).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 Mjy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
2403
|
+
`,n?QQa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function NeC(e){let r=await new Cjy.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 xeC({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await Bjy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,u,s,l)=>{c.versions[u]==null&&(c.versions[u]={});let m=IDi(s.name,l),A=await L7r({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:l});A!=null&&(c.versions[u][s.name]={previousVersion:s.version,latestVersion:A})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await Bjy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,u,s)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=IDi(u.name,s),m=await L7r({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:s});m!=null&&(o.versions[c][f][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function Bjy({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 fIr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(i!=null&&f.groupName!==i))for(let u of f.generators)n!=null&&u.name!==n||await r(a.workspaceName,f.groupName,u,o)}})}))}function Tjy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let f=Cxe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function rOu({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await xeC({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[f,u]of Object.entries(c.versions))o.push(...Tjy(u,f,t.logger));else o.push(...Tjy(c.versions,void 0,t.logger))}return o}var A8o=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 MVa=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Vhf=(()=>{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})(),qjy=typeof globalThis.AbortController=="function",Rjy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",Njy=typeof globalThis.ReadableStream=="function",xjy=typeof globalThis.FormData=="function",nOu=["get","post","put","patch","head","delete"],FeC=()=>{};FeC();var Fjy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},iOu=2147483647,zjy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,aOu=Symbol("stop"),Qjy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},Ljy={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 zeC=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=zjy,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},Ujy=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,n=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:n},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(i){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function o(){let{done:c,value:f}=await a.read();if(c){i.close();return}if(t){n+=f.byteLength;let u=r===0?0:n/r;t({percent:u,transferredBytes:n,totalBytes:r},f)}i.enqueue(f),await o()}await o()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},Vjy=(e,t,r)=>{let n=zeC(r??e.body),i=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(a){let o=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function c(){let{done:f,value:u}=await o.read();if(f){t&&t({percent:1,transferredBytes:i,totalBytes:Math.max(n,i)},new Uint8Array),a.close();return}i+=u.byteLength;let s=n===0?0:i/n;(n<i||s===1)&&(s=.99),t&&t({percent:Number(s.toFixed(2)),transferredBytes:i,totalBytes:n},u),a.enqueue(u),await c()}await c()}})})};var BVa=e=>e!==null&&typeof e=="object";var P8o=(...e)=>{for(let t of e)if((!BVa(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Ghf({},...e)},Whf=(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 oOu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Ghf(e[r]??[],t[r]??[])}var Hhf=(e={},t={})=>({beforeRequest:oOu(e,t,"beforeRequest"),beforeRetry:oOu(e,t,"beforeRetry"),afterResponse:oOu(e,t,"afterResponse"),beforeError:oOu(e,t,"beforeError")}),Ghf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(BVa(i)){for(let[a,o]of Object.entries(i))BVa(o)&&a in t&&(o=Ghf(t[a],o)),t={...t,[a]:o};BVa(i.hooks)&&(n=Hhf(n,i.hooks),t.hooks=n),BVa(i.headers)&&(r=Whf(r,i.headers),t.headers=r)}return t};var Hjy=e=>nOu.includes(e)?e.toUpperCase():e,QeC=["get","put","head","delete","options","trace"],LeC=[408,413,429,500,502,503,504],UeC=[413,429,503],Wjy={limit:2,methods:QeC,statusCodes:LeC,afterStatusCodes:UeC,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Gjy=(e={})=>{if(typeof e=="number")return{...Wjy,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{...Wjy,...e}};async function Jhf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new MVa(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function Khf(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 Jjy=(e,t)=>{let r={};for(let n in t)!(n in Ljy)&&!(n in Qjy)&&!(n in e)&&(r[n]=t[n]);return r},Kjy=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 w8o=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>iOu)throw new RangeError(`The \`timeout\` option cannot be greater than ${iOu}`);await Promise.resolve();let c=await n._fetch();for(let f of n._options.hooks.afterResponse){let u=await f(n.request,n._options,n._decorateResponse(c.clone()));u instanceof globalThis.Response&&(c=u)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let f=new A8o(c,n.request,n._options);for(let u of n._options.hooks.beforeError)f=await u(f);throw f}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Njy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return Ujy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{n.request.bodyUsed||await n.request.body?.cancel()});for(let[c,f]of Object.entries(Fjy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||f);let u=await o;if(c==="json"){if(u.status===204)return"";let s=await u.text();return s===""?"":r.parseJson?r.parseJson(s):JSON.parse(s)}return u[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:Whf(this._input.headers,r.headers),hooks:Hhf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Hjy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:Gjy(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(qjy&&Rjy){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(Vhf&&(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),Kjy(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);(xjy&&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(!Vhf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=Vjy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof MVa)throw t;if(t instanceof A8o){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),iOu);if(this._retryCount<1)throw r;await Khf(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})===aOu)return;return this._retry(t)}}async _fetch(){for(let n of this._options.hooks.beforeRequest){let i=await n(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=Jjy(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Jhf(r,t,this.abortController,this._options)}};var $hf=e=>{let t=(r,n)=>w8o.create(r,P8o(e,n));for(let r of nOu)t[r]=(n,i)=>w8o.create(n,P8o(e,i,{method:r}));return t.create=r=>$hf(P8o(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),$hf(P8o(e,r))),t.stop=aOu,t},VeC=$hf(),$jy=VeC;var b1y=aa(v1y(),1);function eyf(e){let t=(0,b1y.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var dEy=aa(fEy(),1),pEy=aa(z6r(),1),pyf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},_yf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function hyf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??eyf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,dEy.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let u;try{u=await $jy(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new pyf(e):l}if(t.allVersions)return u;let s=new _yf(e,r);if(u["dist-tags"][r]){let{time:l}=u;u=u.versions[u["dist-tags"][r]],u.time=l}else if(r){let l=!!u.versions[r];if(n&&!l)for(let[A,P]of Object.entries(u.versions))P.deprecated&&delete u.versions[A];if(!l){let A=Object.keys(u.versions);if(r=pEy.default.maxSatisfying(A,r),!r)throw s}let{time:m}=u;if(u=u.versions[r],u.time=m,!u)throw s}return u}async function I8o(e,t){let{version:r}=await hyf(e.toLowerCase(),t);return r}async function hBi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:I8o(e.packageName,{version:t?"prerelease":"latest"})}var _Ey=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],bOu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=j1.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new tOu(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.82.3"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${gd.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Qoe}failWithoutThrowing(t,r){this.didSucceed=!1,Zmu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await IQa()).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 Mjy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
2404
2404
|
`)||(r+=`
|
|
2405
2405
|
`),this.stderr.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram({code:t}={}){process.exit(t??(this.didSucceed?0:1))}longestWorkspaceName;registerWorkspaces(t){let r=HFl(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 y8o(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 Qoe}finally{n.finish()}return i}async instrumentPostHogEvent(t){this.isLocal||(await IQa()).sendEvent(t)}logger=r4r((t,...r)=>this.log(t,...r));stderr=r4r((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=hEy(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?hEy(this.longestWorkspaceName):r).length,i=r.padEnd(n),a=_Ey[this.numTasks++%_Ey.length],o=gd.hex(a)(i);return{...this.constructTaskInit(),logPrefix:o}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===C9.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=>USi.indexOf(i.level)>=USi.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===j1.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 hBi({cliEnvironment:this.environment,includePreReleases:t}),n=Cxe(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},a=await rOu({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await Shf({message:t,default:r})}async getInput(t){return await Dhf({message:t.message,default:t.default})}};function hEy(e){return`[${e}]:`}var aMr=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 vrt=class extends aMr{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 oMr={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!1,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!0,coerceOptionalSchemasToNullable:!0};function M8o({options:e,overrides:t}){return{enableUniqueErrorsPerEndpoint:t?.enableUniqueErrorsPerEndpoint??e?.enableUniqueErrorsPerEndpoint??oMr.enableUniqueErrorsPerEndpoint,detectGlobalHeaders:t?.detectGlobalHeaders??e?.detectGlobalHeaders??oMr.detectGlobalHeaders,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??oMr.objectQueryParameters,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??oMr.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??oMr.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??oMr.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??oMr.inlinePathParameters,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??oMr.useBytesForBinaryResponse,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??oMr.respectForwardCompatibleEnums,wrapReferencesToNullableInOptional:t?.wrapReferencesToNullableInOptional??e?.wrapReferencesToNullableInOptional??oMr.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:t?.coerceOptionalSchemasToNullable??e?.coerceOptionalSchemasToNullable??oMr.coerceOptionalSchemasToNullable}}var fPe={openapi:e=>({...e,type:"openapi",_visit:function(t){return fPe._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return fPe._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 zVa={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return zVa._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var $fe={basic:e=>({...e,type:"basic",_visit:function(t){return $fe._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return $fe._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return $fe._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return $fe._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return $fe._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 ZE={primitive:e=>({value:e,type:"primitive",_visit:function(t){return ZE._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return ZE._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return ZE._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return ZE._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return ZE._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return ZE._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return ZE._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return ZE._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return ZE._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 pO={int:e=>({value:e,type:"int",_visit:function(t){return pO._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return pO._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return pO._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return pO._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return pO._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return pO._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return pO._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return pO._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return pO._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return pO._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return pO._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 yBi={boolean:e=>({value:e,type:"boolean",_visit:function(t){return yBi._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return yBi._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 vBi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return vBi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return vBi._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 gOu={};lf(gOu,{Availability:()=>Yfe,CustomCodeSample:()=>UQr,EndpointExample:()=>y_t,EndpointResponseExample:()=>v_t,HttpMethod:()=>Zfe,LiteralSchemaValue:()=>K9,MultipartRequestPropertyEncoding:()=>byf,MultipartSchema:()=>VQr,OneOfSchema:()=>WQr,Pagination:()=>brt,PrimitiveSchemaValue:()=>KT,Request:()=>sMr,Response:()=>zve,RetriesConfiguration:()=>B8o,Schema:()=>Ij,SupportedSdkLanguage:()=>Xfe,WebhookHttpMethod:()=>vyf,WebsocketMessageOrigin:()=>yyf});var yyf={Client:"client",Server:"server",_visit:(e,t)=>{switch(e){case yyf.Client:return t.client();case yyf.Server:return t.server();default:return t._other()}}};var vyf={Get:"GET",Post:"POST",_visit:(e,t)=>{switch(e){case vyf.Get:return t.get();case vyf.Post:return t.post();default:return t._other()}}};var Yfe={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case Yfe.GenerallyAvailable:return t.generallyAvailable();case Yfe.Beta:return t.beta();case Yfe.Deprecated:return t.deprecated();default:return t._other()}}};var B8o={disabled:e=>({value:e,type:"disabled",_visit:function(t){return B8o._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"disabled":return t.disabled(e.value);default:return t._other(e)}}};var brt={cursor:e=>({...e,type:"cursor",_visit:function(t){return brt._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return brt._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return brt._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 UQr={language:e=>({...e,type:"language",_visit:function(t){return UQr._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return UQr._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 Xfe={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 Xfe.Curl:return t.curl();case Xfe.Python:return t.python();case Xfe.Javascript:return t.javascript();case Xfe.Typescript:return t.typescript();case Xfe.Go:return t.go();case Xfe.Ruby:return t.ruby();case Xfe.Csharp:return t.csharp();case Xfe.Java:return t.java();case Xfe.Js:return t.js();case Xfe.Node:return t.node();case Xfe.Ts:return t.ts();case Xfe.Nodets:return t.nodets();case Xfe.Golang:return t.golang();case Xfe.Dotnet:return t.dotnet();case Xfe.Jvm:return t.jvm();default:return t._other()}}};var y_t={unknown:e=>({value:e,type:"unknown",_visit:function(t){return y_t._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return y_t._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 v_t={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return v_t._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return v_t._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 Zfe={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case Zfe.Get:return t.get();case Zfe.Post:return t.post();case Zfe.Put:return t.put();case Zfe.Patch:return t.patch();case Zfe.Delete:return t.delete();case Zfe.Head:return t.head();case Zfe.Options:return t.options();case Zfe.Trace:return t.trace();default:return t._other()}}};var sMr={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return sMr._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return sMr._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return sMr._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return sMr._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 byf={Json:"json",Form:"form",_visit:(e,t)=>{switch(e){case byf.Json:return t.json();case byf.Form:return t.form();default:return t._other()}}};var VQr={file:e=>({...e,type:"file",_visit:function(t){return VQr._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return VQr._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 zve={file:e=>({...e,type:"file",_visit:function(t){return zve._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return zve._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return zve._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return zve._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return zve._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return zve._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return zve._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 Ij={primitive:e=>({...e,type:"primitive",_visit:function(t){return Ij._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Ij._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Ij._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Ij._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Ij._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Ij._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Ij._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Ij._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Ij._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Ij._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Ij._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 KT={int:e=>({...e,type:"int",_visit:function(t){return KT._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return KT._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return KT._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return KT._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return KT._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return KT._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return KT._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return KT._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return KT._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return KT._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return KT._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 K9={boolean:e=>({value:e,type:"boolean",_visit:function(t){return K9._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return K9._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 WQr={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return WQr._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return WQr._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 WDe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return WDe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return WDe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return WDe._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return WDe._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 dL={file:e=>({...e,type:"file",_visit:function(t){return dL._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return dL._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return dL._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return dL._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return dL._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return dL._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return dL._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 ny={primitive:e=>({...e,type:"primitive",_visit:function(t){return ny._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return ny._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return ny._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return ny._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return ny._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return ny._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return ny._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return ny._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return ny._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return ny._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return ny._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 grt={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return grt._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return grt._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 R0={int:e=>({...e,type:"int",_visit:function(t){return R0._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return R0._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return R0._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return R0._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return R0._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return R0._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return R0._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return R0._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return R0._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return R0._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return R0._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 uj={};lf(uj,{AllOfPropertyConflict:()=>fWa,ArraySchema:()=>NAu,ArraySchemaWithExample:()=>pPu,Availability:()=>COu,Base64WithExample:()=>uPu,BasicSecurityScheme:()=>MOu,BearerSecurityScheme:()=>BOu,BooleanSchema:()=>IAu,BooleanWithExample:()=>cPu,BytesResponse:()=>tWa,CasingOverrides:()=>ROu,CommonProperty:()=>WAu,CommonPropertyWithExample:()=>APu,CursorPagination:()=>pAu,CustomCodeSample:()=>fAu,CustomCodeSampleLanguage:()=>uAu,CustomCodeSampleSdk:()=>lAu,CustomPagination:()=>hAu,DateWithExample:()=>sPu,DatetimeWithExample:()=>oPu,DiscriminatedOneOfSchema:()=>UAu,DiscriminatedOneOfSchemaWithExample:()=>mPu,DoubleSchema:()=>DAu,DoubleWithExample:()=>iPu,Encoding:()=>DOu,Endpoint:()=>yAu,EndpointExample:()=>aWa,EndpointResponseExample:()=>sAu,EndpointSdkName:()=>JQr,EndpointSecurity:()=>JVa,EndpointWithExample:()=>HEy,EnumSchema:()=>WVa,EnumSchemaWithExample:()=>fPu,EnumValue:()=>mBi,ErrorExample:()=>rAu,FernExample:()=>iAu,FileResponse:()=>kVa,FileSchema:()=>KOu,FloatWithExample:()=>nPu,FormUrlEncodedRequest:()=>kOu,FullEndpointExample:()=>dAu,FullExample:()=>N8,FullObjectExample:()=>VOu,FullOneOfExample:()=>HOu,GlobalHeader:()=>BAu,Header:()=>ABi,HeaderExample:()=>iWa,HeaderSecurityScheme:()=>TOu,HeaderWithExample:()=>jBi,HttpEndpointServer:()=>rWa,HttpError:()=>nAu,HttpErrorWithExample:()=>ZAu,HttpMethod:()=>KVa,IdempotencyHeader:()=>TAu,Int64WithExample:()=>ePu,IntSchema:()=>EAu,IntWithExample:()=>kAu,JsonRequest:()=>ZOu,JsonRequestWithExample:()=>KAu,JsonResponse:()=>eWa,JsonResponseWithExample:()=>_Wa,KeyValuePair:()=>WOu,LiteralExample:()=>LOu,LiteralSchema:()=>lWa,LiteralSchemaValue:()=>qAu,LongSchema:()=>SAu,MapSchema:()=>xAu,MapSchemaWithExample:()=>_Pu,MultipartRequest:()=>ZVa,MultipartRequestProperty:()=>XOu,MultipartRequestPropertyEncoding:()=>YOu,MultipartSchema:()=>$Ou,NamedFullExample:()=>g_t,Namespace:()=>NOu,NamespaceId:()=>QOu,NullExample:()=>UOu,NullableSchema:()=>zAu,NullableSchemaWithExample:()=>yPu,OauthSecurityScheme:()=>FOu,ObjectProperty:()=>LAu,ObjectPropertyConflictInfo:()=>dWa,ObjectPropertyWithExample:()=>gPu,ObjectSchema:()=>RAu,ObjectSchemaWithExample:()=>vPu,OctetStreamRequest:()=>XVa,OffsetPagination:()=>_Au,OneOfSchema:()=>QAu,OneOfSchemaWithExample:()=>bPu,OpenApiIntermediateRepresentation:()=>VEy,OpenApiSource:()=>wOu,OptionalSchema:()=>FAu,OptionalSchemaWithExample:()=>hPu,Pagination:()=>oWa,ParseFormUrlEncodedRequest:()=>$Au,ParseMultipartRequest:()=>JAu,ParseOctetStreamRequest:()=>GAu,PathParameter:()=>$Va,PathParameterExample:()=>aAu,PathParameterWithExample:()=>HAu,PrimitiveExample:()=>GVa,PrimitiveSchema:()=>wBi,PrimitiveSchemaValue:()=>MAu,PrimitiveSchemaValueWithExample:()=>lPu,PrimitiveSchemaWithExample:()=>hWa,PropertyKey:()=>HVa,ProtobufEncoding:()=>SOu,ProtobufSource:()=>jOu,QueryParameter:()=>YVa,QueryParameterExample:()=>nWa,QueryParameterWithExample:()=>pWa,QuerySecurityScheme:()=>qOu,ReferencedSchema:()=>KQr,Request:()=>eAu,RequestWithExample:()=>YAu,Response:()=>tAu,ResponseWithExample:()=>XAu,RetriesConfiguration:()=>sWa,Schema:()=>eI,SchemaId:()=>HDe,SchemaWithExample:()=>yz,Schemas:()=>jAu,SdkGroup:()=>xOu,SdkGroupInfo:()=>GOu,SdkGroupName:()=>OBi,SecurityScheme:()=>zOu,SecuritySchemeId:()=>VVa,Server:()=>N8o,Source:()=>EOu,StatusCode:()=>HQr,StreamingResponseExample:()=>oAu,StringSchema:()=>CAu,StringSchemaWithExample:()=>aPu,SupportedSdkLanguage:()=>cAu,Tag:()=>IOu,TagId:()=>GDe,Tags:()=>JOu,TextResponse:()=>PBi,Uint64WithExample:()=>rPu,UintWithExample:()=>tPu,UnDiscriminatedOneOfSchema:()=>VAu,UnDiscriminatedOneOfSchemaWithExample:()=>OPu,UnknownSchemaWithExample:()=>dPu,Webhook:()=>vAu,WebhookExampleCall:()=>cWa,WebhookHttpMethod:()=>uWa,WebhookWithExample:()=>GEy,WebsocketChannel:()=>wAu,WebsocketHandshake:()=>bAu,WebsocketHandshakeWithExample:()=>WEy,WebsocketMessageExample:()=>AAu,WebsocketMessageOrigin:()=>gAu,WebsocketMessageSchema:()=>mAu,WebsocketServer:()=>OAu,WebsocketSessionExample:()=>PAu,WithAvailability:()=>gP,WithDescription:()=>Xy,WithEncoding:()=>Mxe,WithInline:()=>hz,WithName:()=>QS,WithNamespace:()=>kE,WithSdkGroupName:()=>YI,WithSdkMethodName:()=>GQr,WithSource:()=>QA,WithStatusCode:()=>b_t,WithTitle:()=>$I,commons:()=>Pyf,example:()=>wyf,finalIr:()=>jyf,parseIr:()=>Eyf});var Pyf={};lf(Pyf,{BasicSecurityScheme:()=>MOu,BearerSecurityScheme:()=>BOu,Encoding:()=>DOu,HeaderSecurityScheme:()=>TOu,Namespace:()=>NOu,NamespaceId:()=>QOu,OauthSecurityScheme:()=>FOu,OpenApiSource:()=>wOu,ProtobufEncoding:()=>SOu,ProtobufSource:()=>jOu,QuerySecurityScheme:()=>qOu,SchemaId:()=>HDe,SdkGroup:()=>xOu,SdkGroupName:()=>OBi,SecurityScheme:()=>zOu,SecuritySchemeId:()=>VVa,Server:()=>N8o,Source:()=>EOu,StatusCode:()=>HQr,Tag:()=>IOu,TagId:()=>GDe,WithAvailability:()=>gP,WithDescription:()=>Xy,WithEncoding:()=>Mxe,WithInline:()=>hz,WithName:()=>QS,WithNamespace:()=>kE,WithSdkGroupName:()=>YI,WithSdkMethodName:()=>GQr,WithSource:()=>QA,WithStatusCode:()=>b_t,WithTitle:()=>$I});var Gr={};lf(Gr,{JsonError:()=>QVa,ParseError:()=>LVa,any:()=>IEy,bigint:()=>vEy,boolean:()=>MEy,booleanLiteral:()=>CEy,date:()=>bEy,discriminant:()=>QEy,enum_:()=>OOu,getObjectLikeUtils:()=>uMr,getObjectUtils:()=>nki,getSchemaUtils:()=>R8,isProperty:()=>gBi,lazy:()=>gEy,lazyObject:()=>EEy,list:()=>POu,number:()=>BEy,object:()=>AOu,objectWithoutOptionalProperties:()=>jEy,optional:()=>gyf,property:()=>OEy,record:()=>NEy,set:()=>xEy,string:()=>TEy,stringLiteral:()=>DEy,transform:()=>myf,undiscriminatedUnion:()=>zEy,union:()=>UEy,unknown:()=>qEy,withParsedProperties:()=>Ayf});var $T={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 v4(e,t){return`Expected ${t}. Received ${$tC(e)}.`}function $tC(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 kfe(e){return{...e,json:yEy(e.json),parse:yEy(e.parse)}}function yEy(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
2406
2406
|
`)),{ok:!0,value:t}):n}}function mOu(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var QVa=class e extends Error{errors;constructor(t){super(t.map(mOu).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var LVa=class e extends Error{errors;constructor(t){super(t.map(mOu).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function R8(e){return{optional:()=>gyf(e),transform:t=>myf(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new LVa(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new QVa(n.errors)}}}function gyf(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:()=>$T.OPTIONAL};return{...t,...R8(t)}}function myf(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,...R8(r)}}function vEy(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:v4(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:v4(t,"bigint")}]},getType:()=>$T.BIGINT};return{...kfe(e),...R8(e)}}var YtC=/^([+-]?\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 bEy(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:v4(t,"string")}]}:YtC.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:v4(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:v4(t,"Date object")}]},getType:()=>$T.DATE};return{...kfe(e),...R8(e)}}function dPe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...kfe(r),...R8(r)}}}function OOu(e){let t=new Set(e);return dPe($T.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:v4(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:v4(n,"enum")}]}:{ok:!0,value:n})()}function gEy(e){let t=Oyf(e);return{...t,...R8(t)}}function Oyf(e){return{parse:(t,r)=>UVa(e).parse(t,r),json:(t,r)=>UVa(e).json(t,r),getType:()=>UVa(e).getType()}}function UVa(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function T8o(e){return Object.entries(e)}function q8o(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function bBi(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 R8o(e){return Object.keys(e)}function mEy(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function uMr(e){return{withParsedProperties:t=>Ayf(e,t)}}function Ayf(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[f,u])=>({...c,[f]:typeof u=="function"?u(a.value):u}),{});return{ok:!0,value:{...a.value,...o}}},json:(n,i)=>{if(!bBi(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:v4(n,"object")}]};let a=new Set(Object.keys(t)),o=q8o(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(o,i)},getType:()=>e.getType()};return{...r,...R8(r),...uMr(r)}}function OEy(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function gBi(e){return e.isProperty}function AOu(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>gBi(n)?n.rawKey:r),_getParsedProperties:()=>R8o(e),parse:(r,n)=>{let i={},a=[];for(let[o,c]of T8o(e)){let f=gBi(c)?c.rawKey:o,u=gBi(c)?c.valueSchema:c,s={rawKey:f,parsedKey:o,valueSchema:u};i[f]=s,wEy(u)&&a.push(f)}return AEy({value:r,requiredKeys:a,getProperty:o=>{let c=i[o];if(c!=null)return{transformedKey:c.parsedKey,transform:f=>c.valueSchema.parse(f,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,o]of T8o(e)){let c=gBi(o)?o.valueSchema:o;wEy(c)&&i.push(a)}return AEy({value:r,requiredKeys:i,getProperty:a=>{let o=e[a];if(o!=null)return gBi(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:()=>$T.OBJECT};return{...kfe(t),...R8(t),...uMr(t),...nki(t)}}function AEy({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!bBi(e))return{ok:!1,errors:[{path:a,message:v4(e,"object")}]};let o=new Set(t),c=[],f={};for(let[u,s]of Object.entries(e)){let l=r(u);if(l!=null){o.delete(u);let m=l.transform(s);m.ok?f[l.transformedKey]=m.value:(f[u]=s,c.push(...m.errors))}else switch(n){case"fail":c.push({path:[...a,u],message:`Unexpected key "${u}"`});break;case"strip":break;case"passthrough":f[u]=s;break}}return c.push(...t.filter(u=>o.has(u)).map(u=>({path:a,message:`Missing required key "${u}"`}))),c.length===0||i?{ok:!0,value:f}:{ok:!1,errors:c}}function nki(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>PEy({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>PEy({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>$T.OBJECT};return{...r,...R8(r),...uMr(r),...nki(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:()=>$T.OBJECT};return{...t,...R8(t),...uMr(t),...nki(t)}}}}function PEy({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,o]=mEy(R8o(t),u=>i.has(u)),c=r(q8o(t,o)),f=n(q8o(t,a));return c.ok&&f.ok?{ok:!0,value:{...c.value,...f.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...f.ok?[]:f.errors]}}function wEy(e){return!XtC(e)}function XtC(e){switch(e.getType()){case $T.ANY:case $T.UNKNOWN:case $T.OPTIONAL:return!0;default:return!1}}function jEy(e){return AOu(e)}function EEy(e){let t={...Oyf(e),_getRawProperties:()=>UVa(e)._getRawProperties(),_getParsedProperties:()=>UVa(e)._getParsedProperties()};return{...t,...R8(t),...uMr(t),...nki(t)}}function POu(e){let t={parse:(r,n)=>SEy(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>SEy(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>$T.LIST};return{...kfe(t),...R8(t)}}function SEy(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:v4(e,"list"),path:[]}]}}function DEy(e){return dPe($T.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:v4(r,`"${e}"`)}]})()}function CEy(e){return dPe($T.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:v4(r,`${e.toString()}`)}]})()}var IEy=dPe($T.ANY,e=>({ok:!0,value:e}));var MEy=dPe($T.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:v4(e,"boolean")}]});var BEy=dPe($T.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:v4(e,"number")}]});var TEy=dPe($T.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:v4(e,"string")}]});var qEy=dPe($T.UNKNOWN,e=>({ok:!0,value:e}));function NEy(e,t){let r={parse:(n,i)=>REy({value:n,isKeyNumeric:e.getType()===$T.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)=>REy({value:n,isKeyNumeric:e.getType()===$T.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:()=>$T.RECORD};return{...kfe(r),...R8(r)}}function REy({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return bBi(e)?T8o(e).reduce((a,[o,c])=>{if(c==null)return a;let f=a,u=o;if(t){let A=o.length>0?Number(o):NaN;isNaN(A)||(u=A)}let s=r(u),l=n(c,u);if(f.ok&&s.ok&&l.ok)return{ok:!0,value:{...f.value,[s.value]:l.value}};let m=[];return f.ok||m.push(...f.errors),s.ok||m.push(...s.errors),l.ok||m.push(...l.errors),{ok:!1,errors:m}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:v4(e,"object")}]}}function xEy(e){let t=POu(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:v4(n,"Set")}]},getType:()=>$T.SET};return{...kfe(r),...R8(r)}}function zEy(e){let t={parse:(r,n)=>FEy((i,a)=>i.parse(r,a),e,n),json:(r,n)=>FEy((i,a)=>i.json(r,a),e,n),getType:()=>$T.UNDISCRIMINATED_UNION};return{...kfe(t),...R8(t)}}function FEy(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 QEy(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function UEy(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=OOu(R8o(t)),a={parse:(o,c)=>LEy({value:o,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:f=>i.parse(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.parse(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>LEy({value:o,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:f=>i.json(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.json(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>$T.UNION};return{...kfe(a),...R8(a),...uMr(a)}}function LEy({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!bBi(e))return{ok:!1,errors:[{path:c,message:v4(e,"object")}]};let{[t]:f,...u}=e;if(f==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let s=n(f);if(!s.ok)return{ok:!1,errors:s.errors};let l=i(s.value);if(l==null)return a?{ok:!0,value:{[r]:s.value,...u}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let m=o(u,l);return m.ok?{ok:!0,value:{[r]:f,...m.value}}:m}var $I=Gr.objectWithoutOptionalProperties({title:Gr.string().optional()});var wOu=Gr.objectWithoutOptionalProperties({file:Gr.string()});var jOu=Gr.objectWithoutOptionalProperties({file:Gr.string()});var EOu=Gr.union("type",{openapi:wOu,protobuf:jOu}).transform({transform:e=>{switch(e.type){case"openapi":return fPe.openapi(e);case"protobuf":return fPe.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var QA=Gr.objectWithoutOptionalProperties({source:EOu.optional()});var SOu=Gr.objectWithoutOptionalProperties({typeName:Gr.string()});var DOu=Gr.union("type",{protobuf:SOu}).transform({transform:e=>{switch(e.type){case"protobuf":return zVa.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Mxe=Gr.objectWithoutOptionalProperties({encoding:DOu.optional()});var Xy=Gr.objectWithoutOptionalProperties({description:Gr.string().optional()});var COu=Gr.enum_(["GenerallyAvailable","Beta","Deprecated"]);var gP=Gr.objectWithoutOptionalProperties({availability:COu.optional()});var HQr=Gr.number();var b_t=Gr.objectWithoutOptionalProperties({statusCode:HQr.optional()});var QS=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string()});var hz=Gr.objectWithoutOptionalProperties({inline:Gr.boolean().optional()});var HDe=Gr.string();var GDe=Gr.string();var IOu=Gr.objectWithoutOptionalProperties({id:GDe}).extend(Xy);var VVa=Gr.string();var MOu=Gr.objectWithoutOptionalProperties({usernameVariableName:Gr.string().optional(),usernameEnvVar:Gr.string().optional(),passwordVariableName:Gr.string().optional(),passwordEnvVar:Gr.string().optional()});var BOu=Gr.objectWithoutOptionalProperties({tokenVariableName:Gr.string().optional(),tokenEnvVar:Gr.string().optional()});var TOu=Gr.objectWithoutOptionalProperties({headerName:Gr.string(),prefix:Gr.string().optional(),headerVariableName:Gr.string().optional(),headerEnvVar:Gr.string().optional()});var qOu=Gr.objectWithoutOptionalProperties({queryParameterName:Gr.string()});var ROu=Gr.objectWithoutOptionalProperties({snake:Gr.string().optional(),camel:Gr.string().optional(),screamingSnake:Gr.string().optional(),pascal:Gr.string().optional()});var mBi=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string(),value:Gr.string(),casing:ROu.optional()}).extend(Xy).extend(gP);var NOu=Gr.objectWithoutOptionalProperties({type:Gr.stringLiteral("namespace"),name:Gr.string()});var xOu=Gr.undiscriminatedUnion([Gr.string(),NOu]);var OBi=Gr.list(xOu);var YI=Gr.objectWithoutOptionalProperties({groupName:OBi.optional()});var kE=Gr.objectWithoutOptionalProperties({namespace:Gr.string().optional()});var WVa=Gr.objectWithoutOptionalProperties({default:mBi.optional(),values:Gr.list(mBi)}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend(QA).extend($I).extend(hz);var FOu=Gr.objectWithoutOptionalProperties({scopesEnum:WVa.optional()});var zOu=Gr.union("type",{basic:MOu,bearer:BOu,header:TOu,query:qOu,oauth:FOu}).transform({transform:e=>{switch(e.type){case"basic":return $fe.basic(e);case"bearer":return $fe.bearer(e);case"header":return $fe.header(e);case"query":return $fe.query(e);case"oauth":return $fe.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var N8o=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string(),audiences:Gr.list(Gr.string()).optional()}).extend(Xy);var QOu=Gr.string();var GQr=Gr.objectWithoutOptionalProperties({sdkMethodName:Gr.string().optional()});var wyf={};lf(wyf,{FullExample:()=>N8,FullObjectExample:()=>VOu,FullOneOfExample:()=>HOu,KeyValuePair:()=>WOu,LiteralExample:()=>LOu,NullExample:()=>UOu,PrimitiveExample:()=>GVa,PropertyKey:()=>HVa});var HVa=Gr.string();var GVa=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 pO.int(e.value);case"int64":return pO.int64(e.value);case"uint":return pO.uint(e.value);case"uint64":return pO.uint64(e.value);case"float":return pO.float(e.value);case"double":return pO.double(e.value);case"string":return pO.string(e.value);case"datetime":return pO.datetime(e.value);case"date":return pO.date(e.value);case"base64":return pO.base64(e.value);case"boolean":return pO.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var LOu=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return yBi.boolean(e.value);case"string":return yBi.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var UOu=Gr.objectWithoutOptionalProperties({});var N8=Gr.union("type",{primitive:Gr.object({value:GVa}),object:Gr.lazyObject(()=>VOu),array:Gr.object({value:Gr.list(Gr.lazy(()=>N8))}),map:Gr.object({value:Gr.list(Gr.lazyObject(()=>WOu))}),enum:Gr.object({value:Gr.string()}),literal:Gr.object({value:LOu}),oneOf:Gr.object({value:Gr.lazy(()=>HOu)}),null:UOu,unknown:Gr.object({value:Gr.lazy(()=>N8)})}).transform({transform:e=>{switch(e.type){case"primitive":return ZE.primitive(e.value);case"object":return ZE.object(e);case"array":return ZE.array(e.value);case"map":return ZE.map(e.value);case"enum":return ZE.enum(e.value);case"literal":return ZE.literal(e.value);case"oneOf":return ZE.oneOf(e.value);case"null":return ZE.null(e);case"unknown":return ZE.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var VOu=Gr.objectWithoutOptionalProperties({properties:Gr.record(HVa,Gr.lazy(()=>N8))});var WOu=Gr.objectWithoutOptionalProperties({key:GVa,value:Gr.lazy(()=>N8)});var HOu=Gr.union("type",{discriminated:Gr.object({value:Gr.record(HVa,Gr.lazy(()=>N8))}),undiscriminated:Gr.object({value:Gr.lazy(()=>N8)})}).transform({transform:e=>{switch(e.type){case"discriminated":return vBi.discriminated(e.value);case"undiscriminated":return vBi.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var jyf={};lf(jyf,{AllOfPropertyConflict:()=>fWa,ArraySchema:()=>NAu,Availability:()=>COu,BooleanSchema:()=>IAu,BytesResponse:()=>tWa,CasingOverrides:()=>ROu,CommonProperty:()=>WAu,CursorPagination:()=>pAu,CustomCodeSample:()=>fAu,CustomCodeSampleLanguage:()=>uAu,CustomCodeSampleSdk:()=>lAu,CustomPagination:()=>hAu,DiscriminatedOneOfSchema:()=>UAu,DoubleSchema:()=>DAu,Endpoint:()=>yAu,EndpointExample:()=>aWa,EndpointResponseExample:()=>sAu,EndpointSdkName:()=>JQr,EndpointSecurity:()=>JVa,EnumSchema:()=>WVa,EnumValue:()=>mBi,ErrorExample:()=>rAu,FernExample:()=>iAu,FileResponse:()=>kVa,FileSchema:()=>KOu,FormUrlEncodedRequest:()=>kOu,FullEndpointExample:()=>dAu,GlobalHeader:()=>BAu,Header:()=>ABi,HeaderExample:()=>iWa,HttpEndpointServer:()=>rWa,HttpError:()=>nAu,HttpMethod:()=>KVa,IdempotencyHeader:()=>TAu,IntSchema:()=>EAu,JsonRequest:()=>ZOu,JsonResponse:()=>eWa,LiteralSchema:()=>lWa,LiteralSchemaValue:()=>qAu,LongSchema:()=>SAu,MapSchema:()=>xAu,MultipartRequest:()=>ZVa,MultipartRequestProperty:()=>XOu,MultipartRequestPropertyEncoding:()=>YOu,MultipartSchema:()=>$Ou,NullableSchema:()=>zAu,ObjectProperty:()=>LAu,ObjectPropertyConflictInfo:()=>dWa,ObjectSchema:()=>RAu,OctetStreamRequest:()=>XVa,OffsetPagination:()=>_Au,OneOfSchema:()=>QAu,OpenApiIntermediateRepresentation:()=>VEy,OptionalSchema:()=>FAu,Pagination:()=>oWa,PathParameter:()=>$Va,PathParameterExample:()=>aAu,PrimitiveSchema:()=>wBi,PrimitiveSchemaValue:()=>MAu,QueryParameter:()=>YVa,QueryParameterExample:()=>nWa,ReferencedSchema:()=>KQr,Request:()=>eAu,Response:()=>tAu,RetriesConfiguration:()=>sWa,Schema:()=>eI,Schemas:()=>jAu,SdkGroupInfo:()=>GOu,StreamingResponseExample:()=>oAu,StringSchema:()=>CAu,SupportedSdkLanguage:()=>cAu,Tags:()=>JOu,TextResponse:()=>PBi,UnDiscriminatedOneOfSchema:()=>VAu,Webhook:()=>vAu,WebhookExampleCall:()=>cWa,WebhookHttpMethod:()=>uWa,WebsocketChannel:()=>wAu,WebsocketHandshake:()=>bAu,WebsocketMessageExample:()=>AAu,WebsocketMessageOrigin:()=>gAu,WebsocketMessageSchema:()=>mAu,WebsocketServer:()=>OAu,WebsocketSessionExample:()=>PAu});var GOu=Gr.objectWithoutOptionalProperties({summary:Gr.string().optional(),description:Gr.string().optional()});var JOu=Gr.objectWithoutOptionalProperties({tagsById:Gr.record(GDe,IOu),orderedTagIds:Gr.list(GDe).optional()});var JVa=Gr.list(Gr.record(VVa,Gr.list(Gr.string())));var KVa=Gr.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var $Va=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>eI),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(gP).extend(QA);var YVa=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>eI),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(gP).extend(QA);var ABi=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>eI),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(gP).extend(QA);var JQr=Gr.objectWithoutOptionalProperties({groupName:OBi,methodName:Gr.string()});var XVa=Gr.objectWithoutOptionalProperties({contentType:Gr.string().optional()}).extend(Xy).extend(QA);var KOu=Gr.objectWithoutOptionalProperties({isOptional:Gr.boolean(),isArray:Gr.boolean()}).extend(Xy);var $Ou=Gr.union("type",{file:KOu,json:Gr.object({value:Gr.lazy(()=>eI)})}).transform({transform:e=>{switch(e.type){case"file":return VQr.file(e);case"json":return VQr.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var YOu=Gr.enum_(["json","form"]);var XOu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:$Ou,contentType:Gr.string().optional(),exploded:Gr.boolean().optional(),encoding:YOu.optional()}).extend(Xy);var ZVa=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),properties:Gr.list(XOu)}).extend(Xy).extend(QA);var ZOu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>eI),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(Xy).extend(QA);var kOu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>eI),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(Xy).extend(QA);var eAu=Gr.union("type",{octetStream:XVa,multipart:ZVa,json:ZOu,formUrlEncoded:kOu}).transform({transform:e=>{switch(e.type){case"octetStream":return sMr.octetStream(e);case"multipart":return sMr.multipart(e);case"json":return sMr.json(e);case"formUrlEncoded":return sMr.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var kVa=Gr.objectWithoutOptionalProperties({}).extend(Xy).extend(QA).extend(b_t);var eWa=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>eI),responseProperty:Gr.string().optional()}).extend(Xy).extend(QA).extend(b_t);var PBi=Gr.objectWithoutOptionalProperties({}).extend(Xy).extend(QA).extend(b_t);var tWa=Gr.objectWithoutOptionalProperties({}).extend(Xy).extend(QA).extend(b_t);var tAu=Gr.union("type",{file:kVa,json:eWa,text:PBi,bytes:tWa,streamingSse:eWa,streamingText:PBi,streamingJson:eWa}).transform({transform:e=>{switch(e.type){case"file":return zve.file(e);case"json":return zve.json(e);case"text":return zve.text(e);case"bytes":return zve.bytes(e);case"streamingSse":return zve.streamingSse(e);case"streamingText":return zve.streamingText(e);case"streamingJson":return zve.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var rAu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),description:Gr.string().optional(),example:Gr.lazy(()=>N8)});var nAu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>eI).optional(),examples:Gr.list(rAu).optional()}).extend(Xy).extend(QS).extend(QA);var rWa=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string().optional(),audiences:Gr.list(Gr.string()).optional()});var iAu=Gr.unknown();var aAu=Gr.objectWithoutOptionalProperties({name:Gr.string(),parameterNameOverride:Gr.string().optional(),value:Gr.lazy(()=>N8)});var nWa=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>N8)});var iWa=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>N8)});var oAu=Gr.objectWithoutOptionalProperties({sse:Gr.boolean(),events:Gr.list(Gr.lazy(()=>N8))});var sAu=Gr.union("type",{withStreaming:oAu,withoutStreaming:Gr.object({value:Gr.lazy(()=>N8)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return v_t.withStreaming(e);case"withoutStreaming":return v_t.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var uAu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),language:Gr.string(),code:Gr.string(),install:Gr.string().optional()}).extend(Xy);var cAu=Gr.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var lAu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),sdk:cAu,code:Gr.string()}).extend(Xy);var fAu=Gr.union("type",{language:uAu,sdk:lAu}).transform({transform:e=>{switch(e.type){case"language":return UQr.language(e);case"sdk":return UQr.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var dAu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),pathParameters:Gr.list(aAu).optional(),queryParameters:Gr.list(nWa).optional(),headers:Gr.list(iWa).optional(),request:Gr.lazy(()=>N8).optional(),response:sAu.optional(),codeSamples:Gr.list(fAu)}).extend(Xy);var aWa=Gr.union("type",{unknown:Gr.object({value:iAu}),full:dAu}).transform({transform:e=>{switch(e.type){case"unknown":return y_t.unknown(e.value);case"full":return y_t.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var pAu=Gr.objectWithoutOptionalProperties({cursor:Gr.string(),nextCursor:Gr.property("next_cursor",Gr.string()),results:Gr.string()});var _Au=Gr.objectWithoutOptionalProperties({offset:Gr.string(),results:Gr.string(),step:Gr.string().optional(),hasNextPage:Gr.string().optional()});var hAu=Gr.objectWithoutOptionalProperties({results:Gr.string()});var oWa=Gr.union("type",{cursor:pAu,offset:_Au,custom:hAu}).transform({transform:e=>{switch(e.type){case"cursor":return brt.cursor(e);case"offset":return brt.offset(e);case"custom":return brt.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var sWa=Gr.union("type",{disabled:Gr.object({value:Gr.boolean().optional()})}).transform({transform:e=>{switch(e.type){case"disabled":return B8o.disabled(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var yAu=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:JVa,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:KVa,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(GDe),pathParameters:Gr.list($Va),queryParameters:Gr.list(YVa),headers:Gr.list(ABi),sdkName:JQr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:eAu.optional(),response:tAu.optional(),errors:Gr.record(HQr,nAu),servers:Gr.list(rWa),examples:Gr.list(aWa),pagination:oWa.optional(),retries:sWa.optional()}).extend(Xy).extend(gP).extend(QA).extend(kE);var uWa=Gr.enum_(["GET","POST"]);var cWa=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),payload:Gr.lazy(()=>N8)}).extend(Xy);var vAu=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:JQr.optional(),method:uWa,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(GDe),headers:Gr.list(ABi),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>eI),examples:Gr.list(cWa)}).extend(Xy).extend(QA).extend(kE);var bAu=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(YVa),headers:Gr.list(ABi),pathParameters:Gr.list($Va)});var gAu=Gr.enum_(["client","server"]);var mAu=Gr.objectWithoutOptionalProperties({name:Gr.string(),origin:gAu,body:Gr.lazy(()=>eI)});var OAu=Gr.objectWithoutOptionalProperties({name:Gr.string(),url:Gr.string()});var AAu=Gr.objectWithoutOptionalProperties({messageType:Gr.string(),payload:Gr.lazy(()=>N8)}).extend(Xy);var PAu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),queryParameters:Gr.list(nWa).optional(),headers:Gr.list(iWa).optional(),messages:Gr.list(AAu)}).extend(Xy);var wAu=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),path:Gr.string(),groupName:OBi,summary:Gr.string().optional(),handshake:bAu,messages:Gr.list(mAu),servers:Gr.list(OAu),examples:Gr.list(PAu)}).extend(Xy).extend(QA);var jAu=Gr.objectWithoutOptionalProperties({rootSchemas:Gr.record(HDe,Gr.lazy(()=>eI)),namespacedSchemas:Gr.record(QOu,Gr.record(HDe,Gr.lazy(()=>eI)))});var EAu=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 SAu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional()});var DAu=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 CAu=Gr.objectWithoutOptionalProperties({default:Gr.string().optional(),pattern:Gr.string().optional(),format:Gr.string().optional(),minLength:Gr.number().optional(),maxLength:Gr.number().optional()});var IAu=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional()});var MAu=Gr.union("type",{int:EAu,int64:SAu,uint:Gr.object({}),uint64:Gr.object({}),float:Gr.object({}),double:DAu,string:CAu,datetime:Gr.object({}),date:Gr.object({}),base64:Gr.object({}),boolean:IAu}).transform({transform:e=>{switch(e.type){case"int":return KT.int(e);case"int64":return KT.int64(e);case"uint":return KT.uint();case"uint64":return KT.uint64();case"float":return KT.float();case"double":return KT.double(e);case"string":return KT.string(e);case"datetime":return KT.datetime();case"date":return KT.date();case"base64":return KT.base64();case"boolean":return KT.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var wBi=Gr.objectWithoutOptionalProperties({schema:MAu}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend($I);var BAu=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),optional:Gr.boolean().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>eI).optional()});var TAu=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>eI).optional()});var VEy=Gr.objectWithoutOptionalProperties({apiVersion:Gr.unknown().optional(),title:Gr.string().optional(),description:Gr.string().optional(),basePath:Gr.string().optional(),servers:Gr.list(N8o),websocketServers:Gr.list(N8o),groups:Gr.record(Gr.string(),GOu),tags:JOu,hasEndpointsMarkedInternal:Gr.boolean(),endpoints:Gr.list(yAu),webhooks:Gr.list(vAu),channels:Gr.record(Gr.string(),wAu),groupedSchemas:jAu,variables:Gr.record(Gr.string(),wBi),nonRequestReferencedSchemas:Gr.set(HDe),securitySchemes:Gr.record(VVa,zOu),globalHeaders:Gr.list(BAu).optional(),idempotencyHeaders:Gr.list(TAu).optional()});var KQr=Gr.objectWithoutOptionalProperties({schema:HDe}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend(QA).extend($I);var qAu=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return K9.boolean(e.value);case"string":return K9.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var lWa=Gr.objectWithoutOptionalProperties({value:qAu}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend($I);var eI=Gr.union("type",{primitive:wBi,object:Gr.lazyObject(()=>RAu),array:Gr.lazyObject(()=>NAu),map:Gr.lazyObject(()=>xAu),optional:Gr.lazyObject(()=>FAu),enum:WVa,reference:KQr,literal:lWa,oneOf:Gr.object({value:Gr.lazy(()=>QAu)}),nullable:Gr.lazyObject(()=>zAu),unknown:QS}).transform({transform:e=>{switch(e.type){case"primitive":return Ij.primitive(e);case"object":return Ij.object(e);case"array":return Ij.array(e);case"map":return Ij.map(e);case"optional":return Ij.optional(e);case"enum":return Ij.enum(e);case"reference":return Ij.reference(e);case"literal":return Ij.literal(e);case"oneOf":return Ij.oneOf(e.value);case"nullable":return Ij.nullable(e);case"unknown":return Ij.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var fWa=Gr.objectWithoutOptionalProperties({propertyKey:Gr.string(),allOfSchemaIds:Gr.list(HDe),conflictingTypeSignatures:Gr.boolean()});var RAu=Gr.objectWithoutOptionalProperties({allOf:Gr.list(KQr),properties:Gr.list(Gr.lazyObject(()=>LAu)),allOfPropertyConflicts:Gr.list(fWa),additionalProperties:Gr.boolean()}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend(QA).extend($I).extend(hz);var dWa=Gr.objectWithoutOptionalProperties({differentSchema:Gr.boolean()});var LAu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>eI),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),conflict:Gr.record(HDe,dWa),generatedName:Gr.string(),nameOverride:Gr.string().optional(),audiences:Gr.list(Gr.string())}).extend(gP);var NAu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>eI)}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend($I).extend(hz);var xAu=Gr.objectWithoutOptionalProperties({key:wBi,value:Gr.lazy(()=>eI)}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend(Mxe).extend($I).extend(hz);var FAu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>eI)}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend($I).extend(hz);var zAu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>eI)}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend($I).extend(hz);var QAu=Gr.union("type",{discriminated:Gr.lazyObject(()=>UAu),undiscriminated:Gr.lazyObject(()=>VAu)}).transform({transform:e=>{switch(e.type){case"discriminated":return WQr.discriminated(e);case"undiscriminated":return WQr.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var UAu=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>WAu)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>eI))}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend(Mxe).extend(QA).extend($I).extend(hz);var WAu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>eI)});var VAu=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>eI))}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend(Mxe).extend(QA).extend($I).extend(hz);var Eyf={};lf(Eyf,{ArraySchemaWithExample:()=>pPu,Base64WithExample:()=>uPu,BooleanWithExample:()=>cPu,CommonPropertyWithExample:()=>APu,DateWithExample:()=>sPu,DatetimeWithExample:()=>oPu,DiscriminatedOneOfSchemaWithExample:()=>mPu,DoubleWithExample:()=>iPu,EndpointWithExample:()=>HEy,EnumSchemaWithExample:()=>fPu,FloatWithExample:()=>nPu,HeaderWithExample:()=>jBi,HttpErrorWithExample:()=>ZAu,Int64WithExample:()=>ePu,IntWithExample:()=>kAu,JsonRequestWithExample:()=>KAu,JsonResponseWithExample:()=>_Wa,MapSchemaWithExample:()=>_Pu,NamedFullExample:()=>g_t,NullableSchemaWithExample:()=>yPu,ObjectPropertyWithExample:()=>gPu,ObjectSchemaWithExample:()=>vPu,OneOfSchemaWithExample:()=>bPu,OptionalSchemaWithExample:()=>hPu,ParseFormUrlEncodedRequest:()=>$Au,ParseMultipartRequest:()=>JAu,ParseOctetStreamRequest:()=>GAu,PathParameterWithExample:()=>HAu,PrimitiveSchemaValueWithExample:()=>lPu,PrimitiveSchemaWithExample:()=>hWa,QueryParameterWithExample:()=>pWa,RequestWithExample:()=>YAu,ResponseWithExample:()=>XAu,SchemaWithExample:()=>yz,StringSchemaWithExample:()=>aPu,Uint64WithExample:()=>rPu,UintWithExample:()=>tPu,UnDiscriminatedOneOfSchemaWithExample:()=>OPu,UnknownSchemaWithExample:()=>dPu,WebhookWithExample:()=>GEy,WebsocketHandshakeWithExample:()=>WEy});var g_t=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),value:Gr.unknown()}).extend(Xy);var pWa=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>yz),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(gP).extend(QA);var jBi=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>yz),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(gP).extend(QA);var WEy=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(pWa),headers:Gr.list(jBi)});var HAu=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>yz),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(gP).extend(QA);var GAu=Gr.objectWithoutOptionalProperties({}).extend(XVa).extend(GQr);var JAu=Gr.objectWithoutOptionalProperties({}).extend(ZVa).extend(GQr);var KAu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>yz),contentType:Gr.string().optional(),fullExamples:Gr.list(g_t).optional(),additionalProperties:Gr.boolean()}).extend(Xy).extend(QA).extend(GQr);var $Au=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>yz),contentType:Gr.string().optional(),fullExamples:Gr.list(g_t).optional(),additionalProperties:Gr.boolean()}).extend(Xy).extend(QA).extend(GQr);var YAu=Gr.union("type",{octetStream:GAu,multipart:JAu,json:KAu,formUrlEncoded:$Au}).transform({transform:e=>{switch(e.type){case"octetStream":return WDe.octetStream(e);case"multipart":return WDe.multipart(e);case"json":return WDe.json(e);case"formUrlEncoded":return WDe.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var _Wa=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>yz),responseProperty:Gr.string().optional(),fullExamples:Gr.list(g_t).optional()}).extend(Xy).extend(QA).extend(b_t);var XAu=Gr.union("type",{file:kVa,json:_Wa,text:PBi,bytes:tWa,streamingSse:_Wa,streamingText:PBi,streamingJson:_Wa}).transform({transform:e=>{switch(e.type){case"file":return dL.file(e);case"json":return dL.json(e);case"text":return dL.text(e);case"bytes":return dL.bytes(e);case"streamingSse":return dL.streamingSse(e);case"streamingText":return dL.streamingText(e);case"streamingJson":return dL.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var ZAu=Gr.objectWithoutOptionalProperties({statusCode:HQr,schema:Gr.lazy(()=>yz),fullExamples:Gr.list(g_t).optional()}).extend(Xy).extend(QS).extend(QA);var HEy=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:JVa,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:KVa,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(GDe),pathParameters:Gr.list(HAu),queryParameters:Gr.list(pWa),headers:Gr.list(jBi),sdkName:JQr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:YAu.optional(),response:XAu.optional(),errors:Gr.record(HQr,ZAu),servers:Gr.list(rWa),examples:Gr.list(aWa),pagination:oWa.optional(),retries:sWa.optional()}).extend(Xy).extend(gP).extend(QA).extend(kE);var GEy=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:JQr.optional(),method:uWa,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(GDe),headers:Gr.list(jBi),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>yz),examples:Gr.list(cWa)}).extend(Xy).extend(QA).extend(kE);var kAu=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 ePu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var tPu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var rPu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var nPu=Gr.objectWithoutOptionalProperties({example:Gr.number().optional()});var iPu=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 aPu=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 oPu=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var sPu=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var uPu=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var cPu=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional(),example:Gr.boolean().optional()});var lPu=Gr.union("type",{int:kAu,int64:ePu,uint:tPu,uint64:rPu,float:nPu,double:iPu,string:aPu,datetime:oPu,date:sPu,base64:uPu,boolean:cPu}).transform({transform:e=>{switch(e.type){case"int":return R0.int(e);case"int64":return R0.int64(e);case"uint":return R0.uint(e);case"uint64":return R0.uint64(e);case"float":return R0.float(e);case"double":return R0.double(e);case"string":return R0.string(e);case"datetime":return R0.datetime(e);case"date":return R0.date(e);case"base64":return R0.base64(e);case"boolean":return R0.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var hWa=Gr.objectWithoutOptionalProperties({schema:lPu}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend($I);var fPu=Gr.objectWithoutOptionalProperties({default:mBi.optional(),values:Gr.list(mBi),example:Gr.string().optional()}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend(QA).extend($I).extend(hz);var dPu=Gr.objectWithoutOptionalProperties({example:Gr.unknown()}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend($I);var yz=Gr.union("type",{primitive:hWa,object:Gr.lazyObject(()=>vPu),array:Gr.lazyObject(()=>pPu),map:Gr.lazyObject(()=>_Pu),optional:Gr.lazyObject(()=>hPu),enum:fPu,reference:KQr,literal:lWa,oneOf:Gr.object({value:Gr.lazy(()=>bPu)}),nullable:Gr.lazyObject(()=>yPu),unknown:dPu}).transform({transform:e=>{switch(e.type){case"primitive":return ny.primitive(e);case"object":return ny.object(e);case"array":return ny.array(e);case"map":return ny.map(e);case"optional":return ny.optional(e);case"enum":return ny.enum(e);case"reference":return ny.reference(e);case"literal":return ny.literal(e);case"oneOf":return ny.oneOf(e.value);case"nullable":return ny.nullable(e);case"unknown":return ny.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var pPu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>yz),example:Gr.list(Gr.unknown()).optional()}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend($I).extend(hz);var _Pu=Gr.objectWithoutOptionalProperties({key:hWa,value:Gr.lazy(()=>yz),example:Gr.unknown().optional()}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend(Mxe).extend($I).extend(hz);var hPu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>yz)}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend($I).extend(hz);var yPu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>yz)}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend($I).extend(hz);var vPu=Gr.objectWithoutOptionalProperties({allOf:Gr.list(KQr),properties:Gr.list(Gr.lazyObject(()=>gPu)),allOfPropertyConflicts:Gr.list(fWa),fullExamples:Gr.list(g_t).optional(),additionalProperties:Gr.boolean()}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend(QA).extend($I).extend(hz);var gPu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>yz),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),audiences:Gr.list(Gr.string()),conflict:Gr.record(HDe,dWa),nameOverride:Gr.string().optional(),generatedName:Gr.string()}).extend(gP);var bPu=Gr.union("type",{discriminated:Gr.lazyObject(()=>mPu),undiscriminated:Gr.lazyObject(()=>OPu)}).transform({transform:e=>{switch(e.type){case"discriminated":return grt.discriminated(e);case"undiscriminated":return grt.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var mPu=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>APu)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>yz))}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend(Mxe).extend(QA).extend($I).extend(hz);var APu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>yz)});var OPu=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>yz))}).extend(YI).extend(kE).extend(QS).extend(Xy).extend(gP).extend(Mxe).extend(QA).extend($I).extend(hz);var JEy=/^(\d+)/,yWa=/^[a-zA-Z][a-zA-Z0-9_]*$/,KEy={"<":"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 EBi(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_${EBi(c)}`}let i=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[i]}_thousand`:`${t[i]}_thousand_${EBi(a)}`}function x8o(e){let t=e.match(JEy);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let a=EBi(i);return n.length>0?`${a}_${n}`:a}}}function vWa(e){let t=x8o(e),r=KEy[e];return t!=null?bU(hA(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":bU(hA(e)))}function Bxe(e,t){return e.type==="primitive"&&t.type==="primitive"?$Ey(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?ZtC(e.values,t.values):e.type==="array"&&t.type==="array"?Bxe(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"?Bxe(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?ktC(e.value,t.value):e.type==="object"&&t.type==="object"?erC(e,t):e.type==="map"&&t.type==="map"?$Ey(e.key.schema,t.key.schema)&&Bxe(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function $Ey(e,t){return e.type===t.type}function ZtC(e,t){let r=new Set(...e.map(i=>i.value)),n=new Set(...t.map(i=>i.value));return zoe(r,n)}function ktC(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:Bxe(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:Bxe(r,i)}):!1}function erC(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:Bxe(a,i.schema)})}function UG(e){switch(e){case Yfe.Deprecated:return"deprecated";case Yfe.Beta:return"pre-release";case Yfe.GenerallyAvailable:return"generally-available";default:return}}function trC(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 YEy(e){let t=e?trC(e):void 0;if(t==null||t.length===0)return DJi;let r=[];for(let[n,i]of t.entries())if(typeof i=="string")r.push(hA(i));else if(typeof i=="object")switch(i.type){case"namespace":{n<t.length-1?r.push(hA(i.name)):r.push(i.name,DJi);break}default:fc(i.type)}else fc(i);return r.join("/")}function SBi(e){return WP.of(`${YEy(e)}.yml`)}function Syf({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?DJi:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,YEy(r))}function XEy({sdkName:e,namespaceOverride:t}){return WP.of(`${Syf({sdkName:e,namespaceOverride:t})}.yml`)}function ZEy({location:e,namespaceOverride:t}){return t!=null?GY(WP.of(t),e):e}function PPu(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:fc(e.type)}}function bWa(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:fc(e)}}function vz(e){return typeof e=="string"?e:e.type}function gWa(e){if(typeof e!="string")return e.docs}function F8o(e){if(typeof e!="string")return e.default}function Dyf(e){if(typeof e!="string")return e.validation}function eSy(e){let t=vz(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?kEy(e):{...e,type:kEy(e.type)}}function kEy(e){return e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function mWa(e){return vz(e).startsWith("optional<")?e:typeof e=="string"?tSy(e):{...e,type:tSy(e.type)}}function tSy(e){return`optional<${e}>`}var rrC=-2147483648,nrC=2147483647,irC=-17976931348623157e292,arC=17976931348623157e292;function SD({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 wPu(e);case"array":return Myf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"map":return Byf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"reference":return Iyf({schema:e,fileContainingReference:t,context:n,namespace:i});case"unknown":return qyf();case"optional":return jPu({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"nullable":return Tyf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"enum":return _rC({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:a});case"literal":return e.value,Ryf(e);case"object":return hrC({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"oneOf":return yrC({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});default:fc(e)}}function wPu(e){switch(e.schema.type){case"string":return urC({description:e.description,schema:e.schema});case"int":return crC({description:e.description,schema:e.schema});case"float":return lrC({description:e.description,schema:e.schema});case"double":return frC({description:e.description,schema:e.schema});case"boolean":return orC({description:e.description,schema:e.schema});case"int64":return srC({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:UG(e.availability)}:{}}}function orC({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 srC({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 urC({description:e,schema:t}){let r="string",n=drC(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 crC({description:e,schema:t}){let r="integer",n=rSy(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 lrC({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function frC({description:e,schema:t}){let r="double",n=rSy(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 drC(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,a=prC(t);if(!(a==null&&r==null&&n==null&&i==null))return{format:a,pattern:r,minLength:n,maxLength:i}}function prC(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 rSy(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:a,exclusiveMaximum:o}=e;if(r=Cyf(r,t),n=Cyf(n,t),i=Cyf(i,t),!(r==null&&n==null&&a==null&&o==null&&i==null))return{min:r,max:n,exclusiveMin:a,exclusiveMax:o,multipleOf:i}}function Cyf(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[rrC,nrC]:[irC,arC];return e<r||e>n?void 0:e}function Iyf({schema:e,fileContainingReference:t,context:r,namespace:n}){let i=r.getSchema(e.schema,n);if(i==null)return"unknown";let a=vrC(i)??e.schema,o=bWa(i),c=brC(i),u=EPu({context:r,fileContainingReference:t,declarationFile:SBi(o),type:a});return i.type==="nullable"&&(u=r.wrapReferencesToNullableInOptional?`optional<${u}>`:`nullable<${u}>`),i.type==="optional"&&!u.startsWith("optional<")&&(u=`optional<${u}>`),e.description==null&&c==null?u:{type:u,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:UG(e.availability)}:{}}}function Myf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=SD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=`list<${vz(o)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:UG(e.availability)}:{},type:c}}function Byf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=wPu(e.key),c=SD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),f=e.encoding!=null?PPu(e.encoding):void 0,u=`map<${vz(o)}, ${vz(c)}>`;if(e.description==null&&f==null&&e.title==null)return u;let s={type:u};return e.description!=null&&(s.docs=e.description),e.encoding!=null&&(s.encoding=f),e.availability!=null&&(s.availability=UG(e.availability)),s}function Tyf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){if(!n.respectNullableSchemas)return jPu({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});let o=SD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=vz(o),f=gWa(o),u=F8o(o),s=Dyf(o),l=eSy(c);if(e.availability==null&&e.description==null&&f==null&&u==null&&s==null&&e.title==null)return l;let m=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(m.docs=e.description??f),u!=null&&(m.default=u),s!=null&&(m.validation=s),e.availability!=null&&(m.availability=UG(e.availability)),m}function jPu({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=SD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=vz(o),f=gWa(o),u=F8o(o),s=Dyf(o),l=mWa(c);if(e.availability==null&&e.description==null&&f==null&&u==null&&s==null&&e.title==null)return l;let m=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(m.docs=e.description??f),u!=null&&(m.default=u),s!=null&&(m.validation=s),e.availability!=null&&(m.availability=UG(e.availability)),m}function qyf(){return"unknown"}function Ryf(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:fc(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:UG(e.availability)}:{}}}function _rC({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let a=z8o(e,i),o=e.nameOverride??e.generatedName;n.builder.addType(r,{name:o,schema:a.schema});let c=EPu({type:o,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return c;let f={type:c};return e.description!=null&&(f.docs=e.description),e.default!=null&&(f.default=e.default.value),e.availability!=null&&(f.availability=UG(e.availability)),f}function hrC({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=Nyf({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:o.schema});let f=EPu({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:UG(e.availability)}:{}}}function yrC({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=xyf({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:o.schema});let f=EPu({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{...e.title!=null?{"display-name":e.title}:{},type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:UG(e.availability)}:{}}}function EPu({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 vrC(e){return Ij._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 brC(e){return Ij._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 vse;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(vse||(vse={}));function $di(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:fc(e)}}function iSy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a;switch(e.type){case"primitive":a=OrC(e);break;case"array":a=grC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":a=mrC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":a=ArC({schema:e,context:t,declarationFile:r,namespace:n});break;case"unknown":a=wrC(e.nameOverride,e.generatedName);break;case"optional":a=aSy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":a=PrC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":a=z8o(e,i);break;case"literal":a=jrC(e,e.nameOverride,e.generatedName);break;case"object":a=Nyf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"oneOf":a=xyf({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;default:fc(e)}return a}function Nyf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=t.isInState(vse.Request)&&t.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),o=!1,c={},f=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])=>{Fyf({property:A.key,schemaId:R,context:t,namespace:n}).forEach($=>{f.add($)})})}let P=SD({schema:A.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}),C=A.audiences,M=A.nameOverride,T=UG(A.availability),z=CrC(A);c[A.key]=DrC({typeReference:P,audiences:C,name:M,availability:T,propertyAccess:z})}let u=new Set;for(let A of e.allOfPropertyConflicts)A.allOfSchemaIds.forEach(P=>f.add(P)),A.conflictingTypeSignatures&&u.add(A.propertyKey);let s=[];for(let A of e.allOf){let P=oSy({schema:A.schema,context:t,namespace:n});if(P==null||f.has(A.schema)||f.has(P))continue;let C=SD({schema:Ij.reference(A),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});s.push(vz(C))}for(let A of f){let P=zyf(t,A,n);for(let C of P.properties)c[C.key]==null&&(u.has(C.key)&&(c[C.key]="unknown"),c[C.key]=SD({schema:C.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}));for(let C of P.allOf){if(f.has(C.schema))continue;let M=SD({schema:Ij.reference(C),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});s.push(vz(M))}}let l={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([A,P])=>SrC(A)?[A,typeof P=="string"?{type:P,name:`_${A}`}:{...P,name:`_${A}`}]:[A,P]))};s.length>0&&(l.extends=s),e.additionalProperties&&(l["extra-properties"]=!0),e.availability!=null&&(l.availability=UG(e.availability)),e.source!=null&&(l.source=$di(e.source)),l.inline=Qyf(e,i);let m=e.nameOverride??e.generatedName;return{name:o&&t.respectReadonlySchemas&&!a?`${m}Read`:m,schema:l}}function Fyf({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return Fyf({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:a,allOf:o}=zyf(r,t,n),c=a.some(u=>u.key===e),f=[...o.flatMap(u=>Fyf({property:e,context:r,schemaId:u.schema,namespace:n}))];if(c||f.length>0)return[t,...f]}return[]}function zyf(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 zyf(e,n.schema,r);throw new Error(`Cannot getAllProperties for a non-object schema. schemaId=${t}, type=${n.type}`)}function grC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:Myf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function mrC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:Byf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function OrC(e){let t=wPu(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 nSy(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function z8o(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||nSy(a.casing)))return o;let f={value:a.value};if(o!==c&&(f.name=o),a.description!=null&&(f.docs=a.description),a.casing!=null&&!nSy(a.casing)){let u={},s=!1;a.casing.camel!=null&&(u.camel=a.casing.camel,s=!0),a.casing.screamingSnake!=null&&(u["screaming-snake"]=a.casing.screamingSnake,s=!0),a.casing.snake!=null&&(u.snake=a.casing.snake,s=!0),a.casing.pascal!=null&&(u.pascal=a.casing.pascal,s=!0),s&&(f.casing=u)}return f})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=Qyf(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?$di(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 ArC({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:Iyf({schema:e,context:t,fileContainingReference:r,namespace:n})}}function PrC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:Tyf({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:aSy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function aSy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:jPu({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function wrC(e,t){return{name:e??t,schema:qyf()}}function jrC(e,t,r){return{name:t??r,schema:Ryf(e)}}function xyf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=e.encoding!=null?PPu(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let u of e.commonProperties)c[u.key]=SD({schema:u.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1});let f={};for(let[u,s]of Object.entries(e.schemas))f[u]=SD({schema:s,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":c,docs:e.description??void 0,availability:e.availability!=null?UG(e.availability):void 0,union:f,encoding:a,source:e.source!=null?$di(e.source):void 0}}}let o=[];for(let c of e.schemas)o.push(SD({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?$di(e.source):void 0,inline:Qyf(e,i)}}}var ErC=/^[0-9]/;function SrC(e){return ErC.test(e)}function oSy({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?oSy({context:t,schema:n.schema,namespace:r}):e}function DrC({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 Qyf(e,t){return e.inline===!0||t>0?!0:void 0}function CrC(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return ZY.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return ZY.ObjectPropertyAccess.WriteOnly}}function sSy(e){let t=e.replace(/^x-|^X-/,"");return hA(t)}var uSy="BasicAuthScheme",SPu="BearerAuthScheme";function cSy(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:uSy,schema:i}),t||(e.builder.setAuth(uSy),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:SPu,schema:i}),t||(e.builder.setAuth(SPu),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??sSy(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:SPu,schema:i}),t||(e.builder.setAuth(SPu),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(WP.of("__package__.yml"),{name:"OauthScope",schema:z8o(n.scopesEnum,0).schema})}}function $Qr({header:e,context:t,fileContainingReference:r,namespace:n}){let i=SD({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),a=vz(i),o=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:hA(o);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null)return a;let f={type:a};return c!==e.name&&(f.name=c),e.description!=null&&(f.docs=e.description),e.env!=null&&(f.env=e.env),e.availability!=null&&(f.availability=UG(e.availability)),f}function DPu({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=SD({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return vz(i);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:vz(i)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=UG(e.availability)),a}function IPu({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=Lyf({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let a=vz(i.value),o=F8o(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=UG(e.availability)),IrC(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 Lyf({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:SD({schema:Ij.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:WP.of(xN),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,f]of Object.entries(i.value.schemas))f.type==="primitive"&&f.schema.type==="string"&&(o=!0),f.type==="literal"&&f.value.type==="string"&&(yWa.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:vWa(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[c,f]=i.value.schemas;if(c!=null&&f!=null&&CPu({array:c,primitive:f}))return{value:SD({schema:Ij.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(c!=null&&f!=null&&CPu({array:c,primitive:f}))return{value:SD({schema:Ij.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}for(let[c,f]of Object.entries(i.value.schemas))return Lyf({schema:f,context:t,fileContainingReference:r,namespace:n})}else if(t.objectQueryParameters)return{value:SD({schema:e,context:t,fileContainingReference:r,declarationFile:WP.of(xN),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let i=e.type==="optional"?Ij.optional:Ij.nullable;if(e.value.type==="reference"){let a=t.getSchema(e.value.schema,n);if(a==null)return;if(a.type==="array")return{value:SD({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:WP.of(xN),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.objectQueryParameters)return{value:SD({schema:e,context:t,fileContainingReference:r,declarationFile:WP.of(xN),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:SD({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,f]of Object.entries(e.value.value.schemas))f.type==="primitive"&&f.schema.type==="string"&&(o=!0),f.type==="literal"&&f.value.type==="string"&&(yWa.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:vWa(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[c,f]=e.value.value.schemas;if(c!=null&&f!=null&&CPu({array:c,primitive:f}))return{value:SD({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(c!=null&&f!=null&&CPu({array:f,primitive:c}))return{value:SD({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:SD({schema:e,context:t,fileContainingReference:r,declarationFile:WP.of(xN),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[c,f]of Object.entries(e.value.value.schemas))return Lyf({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.objectQueryParameters?{value:SD({schema:e,context:t,fileContainingReference:r,declarationFile:WP.of(xN),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:SD({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:SD({schema:Ij.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:SD({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function CPu({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function IrC(e){return e.type!=null}function lSy({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"]=MrC(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=BrC({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=DBi(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function MrC(e){let t={};return e.forEach(r=>{let n=DBi(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function BrC({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=DBi(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function DBi(e){switch(e.type){case"primitive":return fSy(e.value);case"object":return dSy(e.properties);case"array":return TrC(e.value);case"map":return qrC(e.value);case"oneOf":return RrC(e.value);case"enum":return e.value;case"literal":return NrC(e.value);case"unknown":return DBi(e.value);case"null":return null;default:fc(e)}}function fSy(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:fc(e)}}function dSy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,DBi(r)]))}function TrC(e){return e.map(t=>DBi(t))}function qrC(e){return Object.fromEntries(e.map(t=>[fSy(t.key),DBi(t.value)]))}function RrC(e){return e.type==="discriminated"?dSy(e.value):DBi(e.value)}function NrC(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:fc(e)}}function Ydi(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function MPu(e,t){return t??(e?.groupName!=null?Ydi(e.groupName):void 0)}function pSy({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=Ydi(e.groupName),a={};if(e.handshake.pathParameters.length>0)for(let f of e.handshake.pathParameters)a[f.name]=DPu({pathParameter:f,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 f of e.handshake.queryParameters){let u=IPu({queryParameter:f,context:t,fileContainingReference:r,namespace:i});u!=null&&(o[f.name]=u)}Object.keys(o).length>0&&(n["query-parameters"]=o);let c={};if(e.handshake.headers.length>0)for(let f of e.handshake.headers){let u=$Qr({header:f,context:t,fileContainingReference:r,namespace:i});c[f.name]=u}Object.keys(c).length>0&&(n.headers=c),t.builder.addChannel(r,{channel:n});for(let f of e.messages)t.builder.addChannelMessage(r,{messageId:f.name,message:{origin:f.origin,body:SD({schema:f.body,context:t,fileContainingReference:r,namespace:i,declarationDepth:0})}});for(let f of e.examples){let u=lSy({context:t,websocketExample:f});t.builder.addChannelExample(r,{example:u})}}function _Sy(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var Xdi="Base",xrC="Default";function iki(e){return Object.entries(e).reduce((t,[r,n])=>(qtt(n)?Object.entries(n.urls).forEach(([i,a])=>{t[i]=a}):t[r]=typeof n=="string"?n:n.url,t),{})}function hSy(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=>_Sy(T)),i=e.ir.servers;for(let T of i)if(_Sy(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 f={},u=[];for(let T of e.ir.websocketServers){let z=T.audiences?{url:T.url,audiences:T.audiences}:T.url;if(T.name==null){u.push(z);continue}f[T.name]=z}let s=Object.keys(t).length,l=s>0,m=Object.keys(o).length>0,A=Object.keys(a).some(T=>a[T]?.length===0),P=Object.keys(f).length>0;if(!l&&!m&&P&&e.ir.servers.length===0){for(let[T,z]of Object.entries(f))e.builder.addEnvironment({name:T,schema:z});e.builder.setDefaultEnvironment(Object.keys(f)[0]),e.builder.setDefaultUrl(Xdi);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[xrC]=U}}let C=Object.values(t).map(T=>typeof T=="string"?T:qtt(T)?Object.values(T.urls)[0]:T.url),M=r.filter(T=>{let z=typeof T=="string"?T:T.url;return!C.includes(z)});if(M.length>0&&e.logger.error(`Skipping top level servers ${M.map(T=>typeof T=="string"?T:T.url).join(", ")} because x-fern-server-name was not provided.`),n){let T=!0;for(let[z,U]of Object.entries(t))if(e.builder.addEnvironment({name:z,schema:U}),T){if(e.builder.setDefaultEnvironment(z),qtt(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:qtt(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[Xdi]:R??"",...iki(f)}}})}else e.builder.addEnvironment({name:z,schema:U});e.builder.setDefaultEnvironment(z),T=!1}else if(P){let R=typeof U=="string"?U:qtt(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[Xdi]:R??"",...iki(f)}}})}else e.builder.addEnvironment({name:z,schema:U});P&&e.builder.setDefaultUrl(Xdi)}else if(s===1){let T=Object.keys(t)[0],z=Object.values(t)[0],U=typeof z=="string"?z:qtt(z)?Object.values(z.urls)[0]:z.url;e.builder.addEnvironment({name:T,schema:{urls:{[Xdi]:U??"",...iki(o),...iki(f)}}}),e.builder.setDefaultEnvironment(T),e.builder.setDefaultUrl(Xdi)}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:qtt(R)?Object.values(R.urls)[0]:R.url;if(!V)continue;let $=V.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",re={[Xdi]: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,iki(f)),Object.keys(re).length>1?e.builder.addEnvironment({name:U,schema:{urls:re}}):e.builder.addEnvironment({name:U,schema:V}),z&&(e.builder.setDefaultEnvironment(U),z=!1)}T.size>0&&e.builder.setDefaultUrl(Xdi)}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:qtt(R)?Object.values(R.urls)[0]:R.url;e.builder.addEnvironment({name:U,schema:{urls:{[Xdi]:V??"",...iki(o),...iki(f)}}})}else e.builder.addEnvironment({name:U,schema:R});z&&(e.builder.setDefaultEnvironment(U),z=!1)}}}}var Uyf=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},FrC=.75,zrC=new Set("authorization");function ySy(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?bWa(n.schema):void 0,o=a!=null?Ydi(a):void 0,c=WP.of("api.yml");i={name:n.name,env:n.env,type:n.schema!=null?vz(SD({schema:n.schema,context:e,fileContainingReference:o?GY(WP.of(hA(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(zrC.has(a.name.toLowerCase()))continue;let o=r[a.name];if(o==null){let c=t[a.name],f=$Qr({header:{...a,schema:c?.schema??a.schema,name:c?.name??a.name},fileContainingReference:WP.of(sk),context:e,namespace:void 0});o=new Uyf(f),r[a.name]=o}o.increment()}let n=e.ir.endpoints.length*FrC;for(let[i,a]of Object.entries(r)){let o=t[i],c=a.count===e.ir.endpoints.length,f=a.count>=n;o==null&&(c?e.builder.addGlobalHeader({name:i,schema:a.schema}):f&&e.builder.addGlobalHeader({name:i,schema:mWa(a.schema)}))}}}function vSy(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?bWa(t.schema):void 0,n=r!=null?Ydi(r):void 0,i=$Qr({header:{...t,schema:t.schema??Ij.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:KT.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:WP.of(sk),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:mWa(i)})}}function pPe(e){switch(e.type){case"primitive":return gSy(e.value);case"object":return mSy(e.properties);case"array":return OSy(e.value);case"map":return LrC(e.value);case"oneOf":return UrC(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return VrC(e.value);case"unknown":return pPe(e.value);case"null":return null;default:fc(e)}}function bSy(e){switch(e.type){case"withStreaming":return e.sse?{stream:QrC(e.events)}:{stream:OSy(e.events)};case"withoutStreaming":return{body:pPe(e.value)};default:fc(e)}}function gSy(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:fc(e)}}function mSy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,pPe(r)]))}function QrC(e){return e.map(t=>({event:"",data:pPe(t)}))}function OSy(e){return e.map(t=>pPe(t))}function LrC(e){return Object.fromEntries(e.map(t=>[gSy(t.key),pPe(t.value)]))}function UrC(e){return e.type==="discriminated"?mSy(e.value):pPe(e.value)}function VrC(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:fc(e)}}function ASy({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"]=WrC(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=HrC(e.queryParameters));let n=e.headers!=null&&e.headers.length>0,i=t.builder.getGlobalHeaders(),a=Object.keys(i).length>0,o=new Set(e.headers?.map(c=>c.name)??[]);if(n||a){let c=[];if(e.headers!=null)for(let f of e.headers)f.name!==t.builder.getAuthHeaderName()&&c.push(f);for(let[f,u]of Object.entries(i))if(!o.has(f))if(u!=null&&typeof u=="object"&&u.type!=null){let s=Ok({type:u.type,_default:void 0,validation:void 0,visitor:{primitive:l=>l.toString(),map:l=>l.toString(),list:l=>l,optional:l=>l,nullable:l=>l,set:l=>l,named:l=>l,literal:l=>{if(l.type==="string")return l.string;if(l.type==="boolean")return l.boolean.toString()},unknown:Wc}});s!=null&&c.push({name:f,value:ZE.literal(yBi.string(s))})}else c.push({name:f,value:ZE.primitive(pO.string(f))});r.headers=GrC({context:t,namedFullExamples:c})}return e.request!=null&&(r.request=pPe(e.request)),e.response!=null&&(r.response=bSy(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(Tw)),r}function WrC(e){let t={};return e.forEach(r=>{let n=pPe(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function HrC(e){let t={};return e.forEach(r=>{let n=pPe(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function GrC({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=pPe(n.value);i!=null&&(r[n.name]=i)}),r}function PSy(e){return Zfe._visit(e,{get:()=>ZY.HttpMethodSchema.Get,post:()=>ZY.HttpMethodSchema.Post,put:()=>ZY.HttpMethodSchema.Put,patch:()=>ZY.HttpMethodSchema.Patch,delete:()=>ZY.HttpMethodSchema.Delete,head:()=>ZY.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 wSy(e){return e==="POST"||e==="PUT"||e==="PATCH"}function jSy({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:n}=r.ir,i=[],a=new Set,o=e.path,c=MPu(e.sdkName,e.namespace),f={};for(let M of e.pathParameters)M.parameterNameOverride&&(o=o.replace(M.name,M.parameterNameOverride)),f[M.parameterNameOverride??M.name]=DPu({pathParameter:M,context:r,fileContainingReference:t,namespace:c}),a.add(M.name);let u={};for(let M of e.queryParameters){let T=IPu({queryParameter:M,context:r,fileContainingReference:t,namespace:c});T!=null&&(u[M.name]=T,a.add(M.name))}let s;if(e.pagination!=null)switch(e.pagination.type){case"cursor":s={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":s={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":s={type:"custom",results:e.pagination.results};break;default:fc(e.pagination)}let l={path:o,method:PSy(e.method),auth:Object.keys(e.security).length>0?e.security:void 0,docs:e.description??void 0,pagination:s,source:e.source!=null?$di(e.source):void 0};!YrC({context:r,request:e.request})&&Object.keys(f).length>0&&(l["path-parameters"]=f),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(M=>!A.has(M.name));for(let M of C){let T=$Qr({header:M,context:r,fileContainingReference:t,namespace:c});m[M.name]=T,a.add(typeof T=="string"?M.name:T.name??M.name)}if(e.request!=null){r.setInState(vse.Request);let M=$rC({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.inlinePathParameters&&Object.keys(f).length>0?f:void 0,queryParameters:Object.keys(u).length>0?u:void 0,nonRequestReferencedSchemas:Array.from(n),headers:Object.keys(m).length>0?m:void 0,usedNames:a,namespace:c});l.request=M.value,i=[...i,...M.schemaIdsToExclude??[]],r.unsetInState(vse.Request)}else{let M=r.inlinePathParameters&&Object.keys(f).length>0,T=Object.keys(u).length>0,z=Object.keys(m).length>0,U={};(M||T||z)&&(U.name=e.requestNameOverride??e.generatedRequestName),M&&(U["path-parameters"]=f),T&&(U["query-parameters"]=u),z&&(U.headers=m),Object.keys(U).length>0&&(l.request=U)}if(e.response!=null&&e.response._visit({json:M=>{let T=SD({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l.response={docs:M.description??void 0,type:vz(T)},M.statusCode!=null&&(l.response["status-code"]=M.statusCode),M.responseProperty!=null&&(l.response.property=M.responseProperty)},streamingJson:M=>{let T=SD({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:vz(T),format:"json"}},streamingSse:M=>{let T=SD({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:vz(T),format:"sse"}},file:M=>{l.response={docs:M.description??void 0,type:"file","status-code":M.statusCode}},bytes:M=>{l.response={docs:M.description??void 0,type:"bytes","status-code":M.statusCode}},streamingText:M=>{l["response-stream"]={docs:M.description??void 0,type:"text"}},text:M=>{l.response={docs:M.description??void 0,type:"text","status-code":M.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let M=r.getDefaultServerName(),T=e.servers[0];T==null?M!=null&&(l.url=M):l.url=T.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=UG(e.availability)),Object.entries(e.errors).forEach(([M,T])=>{let z=T.generatedName,U=WP.of(xN);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(M)},V=ZEy({location:ESy,namespaceOverride:c});if(T.schema!=null){let Y=SD({schema:T.schema,context:r,fileContainingReference:V,declarationFile:V,namespace:c,declarationDepth:0});R.type=vz(Y),R.docs=T.description}r.builder.addError(V,{name:z,schema:r.isErrorUnknownSchema(parseInt(M))?{...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:pPe(Y.example),name:Y.name,docs:Y.description};r.builder.addErrorExample(V,{name:z,example:te})})}),e.examples.length>0&&(l.examples=JrC({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=KrC({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[Vyf,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:i}}function JrC({endpointExamples:e,context:t}){return e.map(r=>{try{return ASy({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function KrC({retries:e}){if(e!=null)switch(e.type){case"disabled":return{disabled:e.value??void 0};default:fc(e)}}function $rC({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:a,pathParameters:o,queryParameters:c,nonRequestReferencedSchemas:f,headers:u,usedNames:s,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let m=n.schema.type==="reference"?n.schema.schema:void 0,A=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(A?.type!=="object"||m!=null&&f.includes(m)){let z=SD({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(u??{}).length>0;return R&&(U.value["path-parameters"]=o),V&&(U.value["query-parameters"]=c),$&&(U.value.headers=u),(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:!(wSy(e.method)&&z.readonly)).map(z=>{let U=SD({schema:z.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:1}),R=z.nameOverride??z.key,V=UG(z.availability);if(!s.has(R)&&z.audiences.length<=0)return s.add(R),z.nameOverride!=null?[z.key,{type:vz(U),docs:gWa(U),name:z.nameOverride,availability:V}]:[z.key,V?{...typeof U=="string"?{type:U}:U,availability:V}:U];let $={type:vz(U),docs:gWa(U)};return s.has(R)&&($.name=z.generatedName),z.audiences.length>0&&($.audiences=z.audiences),V!=null&&($.availability=V),s.add(R),[z.key,$]})),C=A.allOf.map(z=>{let U=SD({schema:Ij.reference(z),fileContainingReference:t,context:r,namespace:l,declarationDepth:0});return vz(U)}).filter(z=>z!=="unknown"),M={properties:P};C.length>0&&(M.extends=C),n.additionalProperties&&(M["extra-properties"]=!0);let T={name:i??A.nameOverride??A.generatedName,"path-parameters":o,"query-parameters":c,headers:u,body:M};return n.contentType!=null&&(T["content-type"]=n.contentType),n.description!=null&&(T.docs=n.description),{schemaIdsToExclude:m!=null?[m]:[],value:T}}else if(n.type==="octetStream"){let m={body:"bytes","content-type":n.contentType??u7.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 M=A.contentType.split(",")[0];C["content-type"]=M}return[A.key,C]}return[A.key,P]}else{let P=SD({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:u,body:{properties:m},"content-type":u7.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else fc(n)}function YrC({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:fc(t)}}function XrC({location:e,namespaceOverride:t}){return t!=null?{...e,file:GY(WP.of(t),e.file)}:e}function ZrC(e){let t=e.namespace,r=e.tags.filter(f=>f!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:WP.of(`${hA(r)}.yml`),endpointId:e.summary!=null?hA(e.summary):hA(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:WP.of(xN),endpointId:hA(e.summary)}:{file:WP.of(xN),endpointId:hA(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:WP.of(xN),endpointId:n};let i=Q8o(r),a=Q8o(n);if(zoe(i,a))return{file:WP.of("__package__.yml"),endpointId:r};let o=tnC({operationId:n,tag:r,path:e.path,method:e.method});if(o!=null)return o;let c=[];for(let f=0;f<i.length;++f){let u=i[f];if(u!=null&&u===a[f])c.push(u);else{let s=hA(r);return{file:WP.of(`${s}.yml`),endpointId:n,tag:r}}}if(c.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:WP.of(hA(c.join("_"))+".yml"),endpointId:hA(a.slice(c.length).join("_")),tag:r}}function L8o(e){let t=e.tags[0];if(e.sdkName!=null){let r=Syf({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:WP.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return XrC({namespaceOverride:e.namespace,location:ZrC(e)})}function Q8o(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=bft(t),t}var krC=new RegExp("[^a-zA-Z0-9{}]+"),enC=new RegExp("[{}]","g");function tnC({operationId:e,tag:t,path:r,method:n}){let a=`${r.split(krC).join("_").replaceAll(enC,"_")}_${n.toLowerCase()}`;if(e.endsWith(a))return{file:WP.of(hA(t)+".yml"),endpointId:hA(e.slice(0,-1*a.length)),tag:t}}function SSy(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let a of r){let{endpointId:o,file:c,tag:f}=L8o(a),u=c.split(".")[0];u!=null&&t.add(u);let s;if(a.sdkName!=null){let A=e.ir.groups;for(let P of a.sdkName.groupName){let C=typeof P=="string"?P:P.name,M=A[C];if(M==null)break;if(M.summary!=null||M.description!=null){s=A[C];break}}}let l=f==null?void 0:n.tagsById[f];e.setInState(vse.Endpoint),e.setEndpointMethod(a.method);let m=jSy({context:e,endpoint:a,declarationFile:c});e.unsetEndpointMethod(),e.unsetInState(vse.Endpoint),i=[...i,...m.schemaIdsToExclude],e.builder.addEndpoint(c,{name:o,schema:m.value,source:a.source!=null?$di(a.source):void 0}),(l?.id!=null||l?.description!=null)&&e.builder.setServiceInfo(c,{"display-name":s?.summary??l?.id,docs:s?.description??l?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}function DSy(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?Ydi(r.groupName):void 0,i=SD({schema:Ij.primitive(r),context:e,fileContainingReference:WP.of(xN),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:vz(i),docs:r.description??void 0}})}}function CSy(e){for(let t of e.ir.webhooks){let r=inC({webhook:t,context:e});if(r==null)continue;let n=MPu(t.sdkName,t.namespace),i={};for(let o of t.headers)i[o.name]=$Qr({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:SD({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:pPe(o.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function rnC({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:GY(WP.of(t),e.file)}:e}function nnC({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:WP.of(xN),endpointId:n};let i=Q8o(r),a=Q8o(n);if(zoe(i,a))return{file:WP.of("__package__.yml"),endpointId:r};let o=[];for(let c=0;c<i.length;++c){let f=i[c];if(f!=null&&f===a[c])o.push(f);else{let u=hA(r);return{file:WP.of(`${u}.yml`),endpointId:n,tag:r}}}if(o.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:WP.of(hA(o.join("_"))+".yml"),endpointId:hA(a.slice(o.length).join("_")),tag:r}}function inC({webhook:e,context:t}){return e.sdkName!=null?{file:XEy({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:rnC({namespaceOverride:e.namespace,location:nnC({webhook:e,context:t})})}var anC=WP.of(xN);function MSy(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return ISy({namespace:e.namespace,groupName:e.groupName});case"oneOf":return ISy({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return anC;default:fc(e)}}function ISy({namespace:e,groupName:t}){return e!=null&&t!=null?SBi([{type:"namespace",name:e},...t]):e!=null?SBi([{type:"namespace",name:e}]):SBi(t)}var Vyf="external",ESy=WP.of(xN);function BSy({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,a]of Object.entries(e)){if(t.includes(i))continue;let o=MSy(a),c=iSy({schema:a,context:n,declarationFile:o,namespace:r,declarationDepth:0});if(mCi(c.schema)){let f=vz(c.schema);if(f===(c.name??i)||f===`optional<${c.name??i}>`||f===`nullable<${c.name??i}>`||f===`optional<nullable<${c.name??i}>>`)continue}n.builder.addType(o,{name:c.name??i,schema:c.schema})}}function TSy(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),hSy(e),ySy(e),vSy(e),cSy(e),DSy(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(Vyf);let t=SSy(e),r=t.sdkGroups;e.setInState(vse.Webhook),CSy(e),e.unsetInState(vse.Webhook),e.setInState(vse.Channel);for(let i of Object.values(e.ir.channels)){let a=SBi(i.groupName);pSy({channel:i,context:e,declarationFile:a})}e.unsetInState(vse.Channel);let n=onC({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});BSy({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))BSy({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 onC({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 U8o=class{context;constructor(t){this.context=t}};var BPu=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[o,c]of Object.entries(n.files)){let f=i!=null?WP.of(`${i}${"/"}${o}`):WP.of(o);t[f]=c}let a=Object.keys(n.directories).sort();for(let o of a){let c=i!=null?`${i}${"/"}${o}`:o,f=n.directories[o];r(f,c)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[WP.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 aki=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new BPu,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 r8r(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"]))qSy(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(qSy(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??hA((Bft(r)+"/"+$Ji(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===WP.of(sk))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=cWs(Bft(Hza.of(`/${t}`)),Hza.of(`/${r}`)),i;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[i]=cWs(Bft(Hza.of(`/${t}`)),Hza.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===WP.of(sk))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=>zoe(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=GY(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:GY(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:GY(r,o.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===xN?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 qSy(e){return e?.header!=null}var TPu=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 aki(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let c={};if(!this.enableUniqueErrorsPerEndpoint)for(let f of r.endpoints)for(let[u,s]of Object.entries(f.errors)){let l=parseInt(u),m=c[l];m==null&&s.schema!=null?c[l]=s.schema:m!=null&&s.schema!=null&&Bxe(m,s.schema)||this.unknownSchema.add(l)}}getReferencedSchemaIds(){if(this.referencedSchemaIds!=null)return Array.from(this.referencedSchemaIds)}getSchema(t,r){return r==null?this.ir.groupedSchemas.rootSchemas[t]:this.ir.groupedSchemas.namespacedSchemas[r]?.[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}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(vse.Channel,vse.Endpoint,vse.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:fc(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:fc(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 Wyf(e){let t=new TPu(e);return TSy(t)}var qPu=class{args;constructor(t){this.args=t}convert({context:t,ir:r,settings:n,absoluteFilePath:i}){let a=Wyf({taskContext:t,ir:r,options:M8o({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:Fg.dump(a.rootApiFile)},namedDefinitionFiles:{...fg(a.definitionFiles,o=>({absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Fg.dump(o),contents:o})),[WP.of(xN)]:{absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Fg.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var V8o=class extends aMr{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.wrapReferencesToNullableInOptional=t.wrapReferencesToNullableInOptional,this.coerceOptionalSchemasToNullable=t.coerceOptionalSchemasToNullable,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.converter=new qPu(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 vrt({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion})}};var Qve={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 OWa={of(e){return e}};var RSy={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},Hyf={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:RSy,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},mb={SOURCE:OWa.of("source"),SDK_NAMESPACE:OWa.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:OWa.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:OWa.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:OWa.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 QW={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!0,audiences:void 0,optionalAdditionalProperties:!0,coerceEnumsToLiterals:!0,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,preserveSchemaIds:!1,objectQueryParameters:!1,shouldUseUndiscriminatedUnionsWithLiterals:!1,shouldUseIdiomaticRequestNames:!1,filter:void 0,asyncApiNaming:"v1",exampleGeneration:void 0,defaultFormParameterEncoding:"json",useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,additionalPropertiesDefaultsTo:!1,typeDatesAsStrings:!0,preserveSingleSchemaOneOf:!1,inlineAllOfSchemas:!1,groupMultiApiEnvironments:!1,wrapReferencesToNullableInOptional:!0,coerceOptionalSchemasToNullable:!0};function m_t({options:e,overrides:t}){return{disableExamples:t?.disableExamples??QW.disableExamples,discriminatedUnionV2:t?.discriminatedUnionV2??e?.discriminatedUnionV2??QW.discriminatedUnionV2,useTitlesAsName:t?.useTitlesAsName??e?.useTitlesAsName??QW.useTitlesAsName,audiences:t?.audiences??e?.audiences??QW.audiences,optionalAdditionalProperties:t?.optionalAdditionalProperties??e?.optionalAdditionalProperties??QW.optionalAdditionalProperties,coerceEnumsToLiterals:t?.coerceEnumsToLiterals??e?.coerceEnumsToLiterals??QW.coerceEnumsToLiterals,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??QW.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??QW.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??QW.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??QW.inlinePathParameters,preserveSchemaIds:t?.preserveSchemaIds??QW.preserveSchemaIds,shouldUseUndiscriminatedUnionsWithLiterals:t?.shouldUseUndiscriminatedUnionsWithLiterals??e?.shouldUseUndiscriminatedUnionsWithLiterals??QW.shouldUseUndiscriminatedUnionsWithLiterals,shouldUseIdiomaticRequestNames:t?.shouldUseIdiomaticRequestNames??e?.shouldUseIdiomaticRequestNames??QW.shouldUseIdiomaticRequestNames,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??QW.objectQueryParameters,filter:t?.filter??e?.filter??QW.filter,asyncApiNaming:t?.asyncApiNaming??e?.asyncApiNaming??QW.asyncApiNaming,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??QW.useBytesForBinaryResponse,exampleGeneration:t?.exampleGeneration??e?.exampleGeneration??void 0,defaultFormParameterEncoding:t?.defaultFormParameterEncoding??e?.defaultFormParameterEncoding??void 0,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??QW.respectForwardCompatibleEnums,additionalPropertiesDefaultsTo:t?.additionalPropertiesDefaultsTo??e?.additionalPropertiesDefaultsTo??QW.additionalPropertiesDefaultsTo,typeDatesAsStrings:t?.typeDatesAsStrings??e?.typeDatesAsStrings??QW.typeDatesAsStrings,preserveSingleSchemaOneOf:t?.preserveSingleSchemaOneOf??e?.preserveSingleSchemaOneOf??QW.preserveSingleSchemaOneOf,inlineAllOfSchemas:t?.inlineAllOfSchemas??e?.inlineAllOfSchemas??QW.inlineAllOfSchemas,groupMultiApiEnvironments:t?.groupMultiApiEnvironments??e?.groupMultiApiEnvironments??QW.groupMultiApiEnvironments,wrapReferencesToNullableInOptional:t?.wrapReferencesToNullableInOptional??e?.wrapReferencesToNullableInOptional??QW.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:t?.coerceOptionalSchemasToNullable??e?.coerceOptionalSchemasToNullable??QW.coerceOptionalSchemasToNullable}}var NSy={naming:"v1"};function Vy(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function W8o(e,t,r,n,i=[]){try{let a=Vy(e,t);if(a!=null)return r.parse(a)}catch{let o=bft(i).join(" -> ");n.error(`${o.length>0?`${o}: `:""}Failed to parse ${t}`)}}function oki(e){let t=Vy(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 xSy({schema:e,logger:t}){return Vy(e,mb.ENCODING)??void 0}function FSy(e){return Vy(e,mb.FERN_ENUM)}function zSy({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:a}){let o=Vy(n,mb.SDK_NAMESPACE),c=Vy(n,mb.SDK_GROUP_NAME),f=Vy(n,mb.TYPE_DEFINITION);if(f!=null)return H8o({fernType:f,nameOverride:e,generatedName:t,title:r,description:i,availability:a,namespace:o,groupName:typeof c=="string"?[c]:c})}function H8o({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c}){return Ok({type:e,_default:void 0,validation:void 0,visitor:{primitive:f=>{switch(f.v1){case"BASE_64":return ny.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:R0.base64({example:void 0})});case"BOOLEAN":return ny.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:R0.boolean({default:void 0,example:void 0})});case"DATE":return ny.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:R0.date({example:void 0})});case"DATE_TIME":return ny.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:R0.datetime({example:void 0})});case"FLOAT":return ny.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:R0.float({example:void 0})});case"DOUBLE":return ny.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:R0.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 ny.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:R0.uint({default:void 0,example:void 0})});case"INTEGER":return ny.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:R0.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 ny.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:R0.uint64({default:void 0,example:void 0})});case"LONG":return ny.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:R0.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return ny.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:R0.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:fc(f.v1)}},unknown:()=>ny.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:a,namespace:o,groupName:c}),map:({keyType:f,valueType:u})=>f?.type==="primitive"&&u!=null?ny.map({nameOverride:t,generatedName:r,title:n,key:f,value:u,description:i,availability:a,namespace:o,groupName:c,encoding:void 0,example:void 0,inline:void 0}):void 0,list:f=>f!=null?ny.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,optional:f=>f!=null?ny.optional({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,nullable:f=>f!=null?ny.nullable({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,set:f=>f!=null?ny.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,literal:f=>ny.literal({nameOverride:t,generatedName:r,title:n,value:f._visit({string:u=>K9.string(u),boolean:u=>K9.boolean(u),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:a,namespace:o,groupName:c}),named:f=>ny.reference({schema:f,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,source:fPe.openapi({file:"<memory>"})})}})}function QSy(e){let t=Vy(e,mb.SOURCE);if(t!=null)return t.endsWith(".proto")?fPe.protobuf({file:t}):fPe.openapi({file:t})}function ski(e){if(e!=null&&typeof e=="boolean")return e}function u0(e){return e?.$ref!=null}function LSy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:f,context:u,namespace:s,groupName:l,example:m,encoding:A,source:P}){return i===void 0&&(i=u.options.additionalPropertiesDefaultsTo),Gyf({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:f,description:a,availability:o,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:R0.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"||G8o(i,u.options)?ny.unknown({nameOverride:void 0,generatedName:`${t}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0}):USy(_E(i,!1,u.options.optionalAdditionalProperties?f:!1,u,[...n,"Value"],P,s,void 0,void 0,void 0)),namespace:s,groupName:l,example:m,encoding:A})}function USy(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=USy(e.value);break;case"oneOf":e.value.inline=!0;break;default:fc(e)}return e}function Gyf({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsOptional:a,wrapAsNullable:o,description:c,availability:f,namespace:u,groupName:s,example:l,encoding:m}){let A=ny.map({nameOverride:e,generatedName:t,title:r,description:c,availability:f,key:n,value:i,namespace:u,groupName:s,encoding:m,example:l,inline:void 0});return o&&(A=ny.nullable({nameOverride:e,generatedName:t,title:r,value:A,description:c,availability:f,namespace:u,groupName:s,inline:void 0})),a&&(A=ny.optional({nameOverride:e,generatedName:t,title:r,value:A,description:c,availability:f,namespace:u,groupName:s,inline:void 0})),A}function G8o(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:!u0(e)&&Object.keys(e).length===0}function VSy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:f,context:u,namespace:s,groupName:l,example:m,source:A}){let P=i==null?ny.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:s,groupName:l}):_E(i,!1,!1,u,[...n,"Item"],A,s);return snC({nameOverride:e,generatedName:t,title:r,namespace:s,groupName:l,itemSchema:P,wrapAsOptional:c,wrapAsNullable:f,description:a,availability:o,example:m})}function snC({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,namespace:f,groupName:u,example:s}){let l=ny.array({nameOverride:e,generatedName:t,title:r,value:n,description:o,availability:c,namespace:f,groupName:u,example:s,inline:void 0});return a&&(l=ny.nullable({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),i&&(l=ny.optional({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),l}function _Pe(e){switch(Vy(e,mb.AVAILABILITY)){case"deprecated":return Yfe.Deprecated;case"beta":return Yfe.Beta;case"generally-available":return Yfe.GenerallyAvailable;default:break}if(!u0(e)&&e.deprecated)return Yfe.Deprecated}function Jyf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsOptional:f,wrapAsNullable:u,discriminator:s,context:l,namespace:m,groupName:A,encoding:P,source:C}){let M=s.propertyName,T=Object.fromEntries(Object.entries(s.mapping??{}).map(([U,R])=>{let V=Zdi({$ref:R},!1,!1,l,[R],P,C,m);return l.markReferencedByDiscriminatedUnion({$ref:R},M,1),[U,V]})),z=Object.entries(i).filter(([U])=>U!==M).map(([U,R])=>{let V=c!=null&&c.includes(U),[$,re]=l.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1],Y=_E(R,$,re,l,[...n,U],C,m);return{key:U,schema:Y}});return WSy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:f,wrapAsNullable:u,properties:z,description:a,availability:o,discriminant:M,subtypes:T,namespace:m,groupName:A,source:C})}function Kyf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsOptional:f,wrapAsNullable:u,discriminant:s,variants:l,context:m,namespace:A,groupName:P,encoding:C,source:M}){let T=Object.fromEntries(Object.entries(l).map(([U,R])=>{if(u0(R)){let V=Zdi(R,!1,!1,m,[R.$ref],C,M,A);return m.markReferencedByDiscriminatedUnion(R,s,1),[U,V]}else{let V=J8o(R,!1,!1,m,[...n,U],C,M,A,new Set([s]));return[U,V]}})),z=Object.entries(i).filter(([U])=>U!==s).map(([U,R])=>{let V=c!=null&&c.includes(U),[$,re]=m.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1],Y=_E(R,$,re,m,[...n,U],M,A);return{key:U,schema:Y}});return WSy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:f,wrapAsNullable:u,properties:z,description:a,availability:o,discriminant:s,subtypes:T,namespace:A,groupName:P,source:M})}function WSy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:a,description:o,availability:c,discriminant:f,subtypes:u,namespace:s,groupName:l,source:m}){let A=ny.oneOf(grt.discriminated({description:o,availability:c,discriminantProperty:f,nameOverride:e,generatedName:t,title:r,schemas:u,commonProperties:a,namespace:s,groupName:l,encoding:void 0,source:m,inline:void 0}));return i&&(A=ny.nullable({nameOverride:e,generatedName:t,title:r,value:A,namespace:s,groupName:l,description:o,availability:c,inline:void 0})),n&&(A=ny.optional({nameOverride:e,generatedName:t,title:r,value:A,namespace:s,groupName:l,description:o,availability:c,inline:void 0})),A}function HSy(e){if(e.proto!=null)return zVa.protobuf({typeName:e.proto.type})}function CBi({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:a,_default:o,description:c,availability:f,wrapAsOptional:u,wrapAsNullable:s,namespace:l,groupName:m,context:A,source:P,inline:C}){let M=cnC(i??[]),T=new Set(a),z=Array.from(T).map((R,V)=>{let $=n?.[R],re=M[V],Y=yWa.test(R),te=$?.name??re,ne=Y?R:vWa(R);return te!=null&&!yWa.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:f,casing:{snake:$?.casing?.snake??void 0,pascal:$?.casing?.pascal??void 0,screamingSnake:$?.casing?.screamingSnake??void 0,camel:$?.casing?.camel??void 0}}}),U=o!=null?z.find(R=>R.value===o):void 0;return unC({wrapAsOptional:u,wrapAsNullable:s,nameOverride:e,generatedName:t,title:r,values:z,_default:U,description:c,availability:f,namespace:l,groupName:m,source:P,inline:C})}function unC({wrapAsOptional:e,wrapAsNullable:t,nameOverride:r,generatedName:n,title:i,values:a,_default:o,description:c,availability:f,namespace:u,groupName:s,source:l,inline:m}){let A=ny.enum({nameOverride:r,generatedName:n,title:i,values:a,description:c,availability:f,default:o,example:void 0,namespace:u,groupName:s,source:l,inline:m});return t&&(A=ny.nullable({nameOverride:r,generatedName:n,title:i,value:A,description:c,availability:f,namespace:u,groupName:s,inline:m})),e&&(A=ny.optional({nameOverride:r,generatedName:n,title:i,value:A,description:c,availability:f,namespace:u,groupName:s,inline:m})),A}function cnC(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 GSy({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,description:s,availability:l,wrapAsOptional:m,wrapAsNullable:A,example:P,namespace:C,groupName:M}){return n==="int64"?bse({nameOverride:e,generatedName:t,title:r,primitive:R0.int64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M}):n==="uint32"?bse({nameOverride:e,generatedName:t,title:r,primitive:R0.uint({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M}):n==="uint64"?bse({nameOverride:e,generatedName:t,title:r,primitive:R0.uint64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M}):bse({nameOverride:e,generatedName:t,title:r,primitive:R0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M})}function lnC(e){return typeof e=="string"?K9.string(e):typeof e=="boolean"?K9.boolean(e):K9.string(`${e}`)}function JSy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,value:a,description:o,availability:c,namespace:f,groupName:u}){let s=ny.literal({nameOverride:e,generatedName:t,title:r,value:lnC(a),description:o,availability:c,namespace:f,groupName:u});return i&&(s=ny.nullable({nameOverride:e,generatedName:t,title:r,value:s,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),n&&(s=ny.optional({nameOverride:e,generatedName:t,title:r,value:s,description:o,availability:c,namespace:f,groupName:u,inline:void 0})),s}function $yf({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,description:s,availability:l,wrapAsOptional:m,wrapAsNullable:A,example:P,namespace:C,groupName:M}){return n==null||n==="double"?bse({nameOverride:e,generatedName:t,title:r,primitive:R0.double({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M}):n==="float"?bse({nameOverride:e,generatedName:t,title:r,primitive:R0.float({example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M}):n==="int32"?bse({nameOverride:e,generatedName:t,title:r,primitive:R0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M}):n==="int64"?bse({nameOverride:e,generatedName:t,title:r,primitive:R0.int64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M}):n==="uint32"?bse({nameOverride:e,generatedName:t,title:r,primitive:R0.uint({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M}):n==="uint64"?bse({nameOverride:e,generatedName:t,title:r,primitive:R0.uint64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M}):n==="time-delta"?bse({nameOverride:e,generatedName:t,title:r,primitive:R0.float({example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M}):bse({nameOverride:e,generatedName:t,title:r,primitive:R0.float({example:P}),wrapAsOptional:m,wrapAsNullable:A,description:s,availability:l,namespace:C,groupName:M})}var fnC={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},dnC={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}}},pnC={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}}},_nC={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},hnC={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},ynC={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},vnC={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},bnC={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function RPu(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],n=[fnC,dnC,pnC,_nC,hnC,ynC,vnC,bnC],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 xne(e,t){let n=e.map(i=>/^[^a-zA-Z0-9]+$/.test(i)?i:bU(hA(i))).join("");return/^\d/.test(n)?x8o(n)??n:n}function Yyf(e){let t=e.join("_");return hA(t)}function l6(e){switch(e.type){case"object":return Ij.object({allOf:e.allOf,properties:e.properties.map(t=>mnC(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 Ij.array({description:e.description,availability:e.availability,value:l6(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"enum":return Ij.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 Ij.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 Ij.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:l6(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return Ij.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:l6(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return Ij.primitive({description:e.description,availability:e.availability,schema:KSy(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return Ij.map({description:e.description,availability:e.availability,key:Ij.primitive({description:e.key.description,availability:e.key.availability,schema:KSy(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:l6(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 Ij.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 Ij.oneOf(gnC(e.value));case"unknown":return Ij.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:fc(e)}}function gnC(e){switch(e.type){case"discriminated":return WQr.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:l6(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,l6(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return WQr.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>l6(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:fc(e)}}function KSy(e){switch(e.type){case"string":return KT.string(e);case"base64":return KT.base64();case"boolean":return KT.boolean(e);case"date":return KT.date();case"datetime":return KT.datetime();case"double":return KT.double(e);case"float":return KT.float();case"int":return KT.int(e);case"int64":return KT.int64(e);case"uint":return KT.uint();case"uint64":return KT.uint64();default:fc(e)}}function mnC(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:l6(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function NPu(e,t){return Bxe(l6(e),l6(t))}function $Sy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,required:o,wrapAsOptional:c,wrapAsNullable:f,allOf:u,context:s,propertiesToExclude:l,namespace:m,groupName:A,fullExamples:P,additionalProperties:C,availability:M,source:T}){let z=[...o??[]],U={...i},R=[],V=[];for(let ne of u)if(!s.options.inlineAllOfSchemas&&u0(ne)){let Oe=s.resolveSchemaReference(ne);if(Oe.discriminator!=null&&Oe.discriminator.mapping!=null)continue;if(Oe.oneOf!=null||Oe.anyOf!=null){let ve=Oe.oneOf??Oe.anyOf;if(ve!=null){for(let be of ve){let Me=u0(be)?s.resolveSchemaReference(be):be,Be=_E(Me,!1,!1,s.DUMMY,n,T,m);Be.type==="object"&&R.push(...Be.properties.map(Se=>Se.schema.type!=="optional"&&Se.schema.type!=="nullable"?{...Se,schema:ny.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=IBi(ne);if(ge==null)continue;V.push({schemaId:ge,convertedSchema:Xyf(ne,[ge],T,s.options.preserveSchemaIds),properties:YSy({schema:ne,context:s,breadcrumbs:n,source:T,namespace:m})}),s.markSchemaAsReferencedByNonRequest(ge)}else if(u0(ne)){let Oe=s.resolveSchemaReference(ne),ge=_E(Oe,!1,!1,s,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=_E(ne,!1,!1,s,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(Me=>NPu(Me,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])=>!(!u0(Oe)&&Oe.type==="null"))),te=Object.entries(Y).map(([ne,Oe])=>{let ge=Vy(Oe,mb.AUDIENCES)??[],ve=_Pe(Oe),be=u0(Oe)?!1:Oe.readOnly,Me=u0(Oe)?!1:Oe.writeOnly,Be=z.includes(ne)&&!be,Se=Vy(Oe,mb.FERN_PROPERTY_NAME),St=[...n,ne],_t=Yyf(St),qe=Be?_E(Oe,!1,!1,s,St,T,m):ny.optional({nameOverride:e,generatedName:_t,title:r,description:void 0,availability:ve,value:_E(Oe,!1,!1,s,St,T,m),namespace:m,groupName:A,inline:void 0}),De={};for(let Qt of V){let Xe=Qt.properties[ne];Xe!=null&&!NPu(qe,Xe)?De[Qt.schemaId]={differentSchema:!0}:Xe!=null&&(De[Qt.schemaId]={differentSchema:!1})}return{key:ne,schema:qe,nameOverride:Se,audiences:ge,conflict:De,generatedName:Yyf([...n,ne]),availability:ve,readonly:be,writeonly:Me}});return te.push(...R.map(ne=>{let Oe=ne.conflict;for(let ge of V){let ve=ge.properties[ne.key];ve!=null&&!NPu(ne.schema,ve)?Oe[ge.schemaId]={differentSchema:!0}:ve!=null&&(Oe[ge.schemaId]={differentSchema:!1})}return{...ne,conflict:Oe}})),OnC({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:f,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:M,source:T,context:s})}function OnC({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:a,description:o,allOf:c,allOfPropertyConflicts:f,namespace:u,groupName:s,fullExamples:l,additionalProperties:m,availability:A,source:P,context:C}){let M=ny.object({description:o,properties:a,nameOverride:e,generatedName:t,title:r,allOf:c,allOfPropertyConflicts:f,namespace:u,groupName:s,fullExamples:l,additionalProperties:G8o(m,C.options),availability:A,source:P,inline:void 0});return i&&(M=ny.nullable({nameOverride:e,generatedName:t,title:r,value:M,description:o,availability:A,namespace:u,groupName:s,inline:void 0})),n&&(M=ny.optional({nameOverride:e,generatedName:t,title:r,value:M,description:o,availability:A,namespace:u,groupName:s,inline:void 0})),M}function YSy({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let a={},[o,c]=u0(e)?[t.resolveSchemaReference(e),RPu(e.$ref)]:[e,r];for(let f of o.allOf??[])a={...a,...YSy({schema:f,context:t,breadcrumbs:c,source:n,namespace:i})};for(let[f,u]of Object.entries(o.properties??{})){let s=_E(u,!1,!1,t,[...c,f],n,i);a[f]=s}return a}function MBi({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:a,wrapAsOptional:o,wrapAsNullable:c,context:f,subtypes:u,namespace:s,groupName:l,encoding:m,source:A,subtypePrefixOverrides:P}){let C=wnC({schemas:u}),M=u.flatMap((z,U)=>{if(!u0(z)&&z.enum!=null&&f.options.coerceEnumsToLiterals&&z.type==="string")return z.enum.map(V=>ny.literal({nameOverride:void 0,generatedName:xne([t,V],f.options.preserveSchemaIds),title:void 0,value:K9.string(String(V)),namespace:s,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[_E(z,!1,!1,f,[...n,R??`${U}`],A,s)]}),T=AnC(M);return PnC({uniqueSubtypes:T,nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:c,description:i,availability:a,namespace:s,groupName:l,context:f,encoding:m,source:A})}function AnC(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&&Bxe(n,o)){i=!0;break}}n!=null&&!i&&t.push(n)}return t}function PnC({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,namespace:f,groupName:u,context:s,encoding:l,source:m}){if(Object.entries(e).every(([P,C])=>C.type==="literal")){let P={},C=[];return Object.entries(e).forEach(([M,T])=>{T.type==="literal"&&T.value.type==="string"&&(C.push(T.value.value),T.description!=null&&(P[T.value.value]={description:T.description}))}),CBi({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,fernEnum:P,enumVarNames:void 0,enumValues:C,_default:void 0,namespace:f,groupName:u,context:s,source:m,inline:void 0})}return e.length===1&&e[0]!=null&&!s.options.preserveSingleSchemaOneOf?e[0]:XSy({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,subtypes:e,namespace:f,groupName:u,encoding:l,source:m})}function Zyf({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsOptional:a,wrapAsNullable:o,context:c,namespace:f,groupName:u,discriminator:s,encoding:l,source:m}){let A=Object.entries(s.mapping??{}).map(([M,T],z)=>{let U={$ref:T},R=Zdi(U,!1,!1,c,[T],l,m,f);return c.markSchemaWithDiscriminantValue(U,s.propertyName,M),R.type==="object"&&(R.properties={[s.propertyName]:ny.literal({nameOverride:void 0,generatedName:xne([t,M],c.options.preserveSchemaIds),title:void 0,value:K9.string(M),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...R.properties.filter(V=>V.key!==s.propertyName)}),R}),P=[];for(let M=0;M<A.length;++M){let T=A[M],z=!1;for(let U=M+1;U<A.length;++U){let R=A[U];if(T!=null&&R!=null&&Bxe(T,R)){z=!0;break}}T!=null&&!z&&P.push(T)}if(Object.entries(P).every(([M,T])=>T.type==="literal")){let M={},T=[];return Object.entries(P).forEach(([z,U])=>{U.type==="literal"&&U.value.type==="string"&&(T.push(U.value.value),U.description!=null&&(M[U.value.value]={description:U.description}))}),CBi({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:n,availability:i,fernEnum:M,enumVarNames:void 0,enumValues:T,_default:void 0,namespace:f,groupName:u,context:c,source:m,inline:void 0})}return P.length===1&&P[0]!=null&&!c.options.preserveSingleSchemaOneOf?P[0]:XSy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:n,availability:i,subtypes:P,namespace:f,groupName:u,encoding:l,source:m})}function wnC({schemas:e}){let t={},r=0;for(let a of e){if(!u0(a)){if(a.properties!=null&&Object.entries(a.properties).length>0){let o=Object.keys(a.properties),c={},f=o;for(let[u,s]of Object.entries(t)){let l=lLs(s,o);f=lLs(f,s),c[u]=l}c[r]=f,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}}u0(a)?n.push(EBi(i)??`${i}`):a.type==="array"||a.type==="boolean"||a.type==="integer"||a.type==="number"||a.type==="string"?n.push(""):n.push(EBi(i)??`${i}`),++i}return n}function XSy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,description:a,availability:o,subtypes:c,namespace:f,groupName:u,encoding:s,source:l}){let m=ny.oneOf(grt.undiscriminated({description:a,availability:o,nameOverride:e,generatedName:t,title:r,schemas:c,namespace:f,groupName:u,encoding:s,source:l,inline:void 0}));return i&&(m=ny.nullable({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:o,namespace:f,groupName:u,inline:void 0})),n&&(m=ny.optional({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:o,namespace:f,groupName:u,inline:void 0})),m}function AWa(e){if(e.default!=null&&typeof e.default=="string")return e.default}function xPu({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let n=oki(e);for(let i of n??[])if(typeof i=="number")return i;if(r&&typeof r=="number")return r}function ZSy({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let n=oki(e);for(let i of n??[])if(typeof i=="boolean")return i;if(r&&typeof r=="boolean")return r}function YQr({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let n=oki(e);for(let i of n??[])if(typeof i=="string")return i;if(r&&typeof r=="string")return r}function kSy({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let n=oki(e);for(let i of n??[])if(Array.isArray(i))return i;if(r&&Array.isArray(r))return r}var uki="#/components/schemas/";function _E(e,t,r,n,i,a,o,c=!1,f=new Set,u){let s=QSy(e)??a,l=BnC({schema:e,logger:n.logger});if(u0(e)){let m=IBi(e);return m!=null?(c?n.markSchemaAsReferencedByRequest(m):n.markSchemaAsReferencedByNonRequest(m),Zdi(e,t,r,n,i,l,s,o)):J8o(n.resolveSchemaReference(e),t,r,n,RPu(e.$ref),l,s,o,f,c,u)}return J8o(e,t,r,n,i,l,s,o,f,c,u)}function Zdi(e,t,r,n,i,a,o,c){let f=e.$ref.includes("properties")?J8o(n.resolveSchemaReference(e),t,r,n,i,a,o,c,new Set):ny.reference(Xyf(e,i,o,n.options.preserveSchemaIds));if(r===!1){let u=n.resolveSchemaReference(e);(u.nullable===!0||Array.isArray(u.type)&&u.type.length>=2&&u.type.includes("null"))&&(r=!0)}return r&&(f=ny.nullable({title:void 0,nameOverride:void 0,generatedName:xne(i,n.options.preserveSchemaIds),value:f,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),t&&(f=ny.optional({title:void 0,nameOverride:void 0,generatedName:xne(i,n.options.preserveSchemaIds),value:f,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),f}function jnC(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function J8o(e,t,r,n,i,a,o,c,f=new Set,u=!1,s){typeof e=="string"&&(e={type:e});let l=Vy(e,mb.TYPE_NAME)??(n.options.useTitlesAsName?jnC(e.title):void 0),m=Vy(e,mb.SDK_GROUP_NAME)??Vy(e,Qve.TAGS)?.[0],A=(typeof m=="string"?[m]:m)??[];A=n.resolveGroupName(A);let P=xne(i,n.options.preserveSchemaIds),C=e.title,M=e.description,T=_Pe(e),z=[];e.example!=null&&z.push({name:void 0,value:e.example,description:void 0});let U=Vy(e,Qve.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=oki(e);R!=null&&Object.keys(R).length>0&&z.push(...R.map($=>({name:void 0,value:$,description:void 0})));let V=zSy({schema:e,description:M,title:C,nameOverride:l,generatedName:P,availability:T});if(V!=null)return V;try{if(Array.isArray(e.type)){let re=e.type.indexOf("null"),Y=re!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&Y)e.type.splice(re,1),e.type=e.type[0],e.nullable=!0;else if(Y&&(e.type.splice(re,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let te=new Set([...e.oneOf,...e.type]);e.oneOf=[...te]}}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(Y=>Y!==null),!QPu(e.enum))return bse({nameOverride:l,generatedName:P,title:C,primitive:R0.string({default:AWa(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:YQr({schema:e,logger:n.logger,fallback:s})}),namespace:c,groupName:A,wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T});let re=FSy(e);return e.enum.length===1&&e.enum[0]!=null&&re==null?JSy({nameOverride:l,generatedName:P,title:C,wrapAsOptional:t,wrapAsNullable:r,value:e.enum[0],description:M,availability:T,namespace:c,groupName:A}):CBi({nameOverride:l,generatedName:P,title:C,fernEnum:re,enumVarNames:Vy(e,[Qve.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:A,context:n,source:o,inline:void 0})}if(QPu(e.type)&&e.type.length>1){let re=e.type.includes("null"),Y=e.type.filter(te=>te!=="null").map(te=>({type:te,nullable:re}));return MBi({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:Y,namespace:c,groupName:A,encoding:a,source:o})}if(e.type==="boolean"){let re=Vy(e,mb.BOOLEAN_LITERAL);return re!=null?eDy({nameOverride:l,generatedName:P,title:C,literal:K9.boolean(re),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:A}):bse({nameOverride:l,generatedName:P,title:C,primitive:R0.boolean({default:EnC(e.default),example:ZSy({schema:e,logger:n.logger,fallback:s})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:A})}if(e.type==="number")return $yf({nameOverride:l,generatedName:P,title:C,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:ski(e.exclusiveMinimum),exclusiveMaximum:ski(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:xPu({schema:e,logger:n.logger,fallback:s}),namespace:c,groupName:A});if(e.type==="integer")return GSy({nameOverride:l,generatedName:P,title:C,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:ski(e.exclusiveMinimum),exclusiveMaximum:ski(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:xPu({schema:e,logger:n.logger,fallback:s}),namespace:c,groupName:A});if(e.type==="float")return $yf({nameOverride:l,generatedName:P,title:C,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:ski(e.exclusiveMinimum),exclusiveMaximum:ski(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:xPu({schema:e,logger:n.logger,fallback:s}),namespace:c,groupName:A});if(e.type==="string"){if(e.format==="date-time")return bse({nameOverride:l,generatedName:P,title:C,primitive:R0.datetime({example:YQr({schema:e,logger:n.logger,fallback:s})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:A});if(e.format==="date"&&n.options.typeDatesAsStrings===!1)return bse({nameOverride:l,generatedName:P,title:C,primitive:R0.date({example:YQr({schema:e,logger:n.logger,fallback:s})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:A});if(e.format==="json-string")return ny.unknown({nameOverride:l,generatedName:P,title:C,description:M,availability:T,namespace:c,groupName:A,example:void 0});let re=nDy(e,"const");return re!=null?eDy({nameOverride:l,generatedName:P,title:C,literal:K9.string(re),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:A}):bse({nameOverride:l,generatedName:P,title:C,primitive:R0.string({default:AWa(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:YQr({schema:e,logger:n.logger,fallback:s})}),namespace:c,groupName:A,wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T})}if(e.type==="array")return VSy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,item:e.items,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,example:kSy({schema:e,logger:n.logger,fallback:s}),source:o});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&FPu(e))return LSy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,additionalProperties:e.additionalProperties,description:M,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&&Vy(e,mb.IS_DISCRIMINATED)===!1)return MBi({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,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?Zyf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,discriminator:e.discriminator,encoding:a,source:o}):Jyf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,encoding:a,source:o});if(e.oneOf!=null&&e.oneOf.length>0){let re=Vy(e,mb.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return n.options.discriminatedUnionV2||re?Zyf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,discriminator:e.discriminator,encoding:a,source:o}):Jyf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,encoding:a,source:o});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(n.options.preserveSingleSchemaOneOf)return MBi({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf.filter(te=>u0(te)||te.type!=="null"),encoding:a,namespace:c,groupName:A,source:o});let Y=_E(e.oneOf[0],t,r,n,i,o,c,u);return PWa(Y,M,c,A)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let Oe=e.oneOf[0],ge=e.oneOf[1];if(!u0(Oe)&&Oe.type==="null")return _E(ge,!1,!0,n,i,o,c);if(!u0(ge)&&ge.type==="null")return _E(Oe,!1,!0,n,i,o,c)}let Y=CnC({schemas:e.oneOf});if(Y!=null)return CBi({nameOverride:l,generatedName:P,title:C,fernEnum:void 0,enumVarNames:void 0,enumValues:Y,_default:e.default,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:A,context:n,source:o,inline:void 0});let te=tDy({schemas:e.oneOf,context:n});if(te!=null&&!n.options.discriminatedUnionV2&&!re)return Kyf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},required:e.required,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,discriminant:te.discriminant,variants:te.schemas,context:n,namespace:c,groupName:A,encoding:a,source:o});let ne=e.oneOf.filter(Oe=>!u0(Oe)&&Oe.type==="null").length>0;return MBi({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r||ne,context:n,subtypes:e.oneOf.filter(Oe=>u0(Oe)||Oe.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 te=_E(e.anyOf[0],t,r,n,i,o,c,u);return PWa(te,M,c,A)}if(e.anyOf.length===2){let[te,ne]=e.anyOf;if(te!=null&&ne!=null){if(!u0(te)&&te.type==="null"){let Oe=_E(ne,!1,!0,n,i,o,c);return PWa(Oe,M,c,A)}else if(!u0(ne)&&ne.type==="null"){let Oe=_E(te,!1,!0,n,i,o,c);return PWa(Oe,M,c,A)}}}let re=tDy({schemas:e.anyOf,context:n});if(re!=null&&!n.options.discriminatedUnionV2)return Kyf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},required:e.required,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,discriminant:re.discriminant,variants:re.schemas,context:n,namespace:c,groupName:A,encoding:a,source:o});let Y=e.anyOf.filter(te=>!u0(te)&&te.type==="null").length>0;return MBi({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r||Y,context:n,subtypes:e.anyOf.filter(te=>u0(te)||te.type!=="null"),encoding:a,namespace:c,groupName:A,source:o})}if(e.allOf!=null||e.properties!=null){let re=[];for(let te of e.allOf??[])(u0(te)||Object.keys(te).length>0)&&re.push(te);if((e.properties==null||FPu(e))&&re.length===1&&re[0]!=null){let te=_E(re[0],t,r,n,i,o,c,u);return PWa(te,M,c,A)}let Y=re.filter(te=>{let ne=zPu(te);return ne||n.logger.warn(`Skipping non-object allOf element: ${JSON.stringify(te)}`),ne});if((e.properties==null||FPu(e))&&Y.length===1&&Y[0]!=null){let te=_E(Y[0],t,r,n,i,o,c,u);return PWa(te,M,c,A)}return $Sy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},description:M,required:e.required,wrapAsOptional:t,wrapAsNullable:r,allOf:Y,context:n,propertiesToExclude:f,namespace:c,groupName:A,fullExamples:z,additionalProperties:e.additionalProperties,availability:T,encoding:a,source:o})}if(e.type==="object"&&SnC(e)&&DnC(e)&&FPu(e))return Gyf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,keySchema:{nameOverride:void 0,generatedName:`${P}Key`,title:void 0,description:void 0,availability:void 0,schema:R0.string({default:AWa(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:YQr({schema:e,logger:n.logger,fallback:s})}),namespace:c,groupName:A},valueSchema:ny.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;return ny.unknown({nameOverride:l,generatedName:P,title:C,description:M,availability:T,namespace:c,groupName:A,example:$})}catch($){return n.logger.debug(`Error converting schema: ${$.message}
|