fern-api 0.44.5 → 0.44.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bundle.cjs +3 -3
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -1783,7 +1783,7 @@ ${l.indent}`:""}${fNc(o)}:${f.indent?" ":""}`;return u=!1,c=!0,f.objectItem=void
1783
1783
  `}),r.replaceAll(/\n$/g,"")}function vHP(e){return e?al.green(INr.radioOn):INr.radioOff}var cda=yu(zje(),1);function ZJl(e,t){return e=String(e),t=typeof t=="string"?t:"*",e.length===0?"":Array.from({length:e.length+1}).join(t)}var _di=class extends PR{_run(t){this.done=t;let r=vW(this.rl),n=r.line.pipe((0,cda.map)(this.filterInput.bind(this))),i=this.handleSubmitEvents(n);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),r.keypress.pipe((0,cda.takeUntil)(i.success)).forEach(this.onKeypress.bind(this)),this.render(),this}render(t){let r=this.getQuestion(),n="";r+=this.status==="answered"?this.getMaskedValue(this.answer):this.getMaskedValue(this.rl.line||""),t&&(n=`
1784
1784
  `+al.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?al.cyan(ZJl(t,this.opt.mask)):al.italic.dim("[hidden]"):this.opt.mask?ZJl(t,this.opt.mask):al.italic.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(){var t;(t=this.opt).default&&(t.default=void 0),this.render()}};var wKl=yu(jKl(),1),DKl=yu(zje(),1);var wdi=class extends PR{_run(t){this.done=t,this.editorResult=new DKl.Subject;let r=vW(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"?al.dim("Received"):al.dim("Press <enter> to launch your preferred editor."),t&&(r=al.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),(0,wKl.editAsync)(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 AKl=yu(MKl(),1);var qKl=yu(require("readline"),1),CKl=yu(TKl(),1),qkr=class{constructor(t){this.rl||(this.rl=qKl.default.createInterface(u$P(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 u$P(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 CKl.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var Ddi=class extends qkr{constructor(t={}){super(t),this.log=(0,AKl.default)(this.writeLog.bind(this)),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return odi(this.rl,this.bottomBar.split(`
1785
1785
  `).length),this}updateBottomBar(t){return odi(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+`
1786
- `}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&&ada(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var WKl=yu(BKl(),1),HKl=yu(wtu(),1),$Kl=yu(UKl(),1),bq=yu(zje(),1),JKl=yu(_fi(),1);var qda=yu(zje(),1),VKl=yu(_fi(),1),Cda=function(e,t,r){return typeof e[t]!="function"?(0,qda.of)(e):(0,qda.from)((0,VKl.default)(e[t])(r).then(n=>(e[t]=n,e)))};var Sdi={isPlainObject:WKl.default,set:$Kl.default,get:HKl.default},SAn=class extends qkr{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=Sdi.isPlainObject(r)?{...r}:{},Sdi.isPlainObject(t)&&(t=Object.values(t).every(i=>Sdi.isPlainObject(i)&&i.name===void 0)?Object.entries(t).map(([i,a])=>({name:i,...a})):[t]);let n=Array.isArray(t)?(0,bq.from)(t):t;return this.process=n.pipe((0,bq.concatMap)(this.processQuestion.bind(this)),(0,bq.publish)()),this.process.connect(),this.process.pipe((0,bq.reduce)((i,a)=>(Sdi.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,bq.defer)(()=>(0,bq.of)(t).pipe((0,bq.concatMap)(this.setDefaultType.bind(this)),(0,bq.concatMap)(this.filterIfRunnable.bind(this)),(0,bq.concatMap)(()=>Cda(t,"message",this.answers)),(0,bq.concatMap)(()=>Cda(t,"default",this.answers)),(0,bq.concatMap)(()=>Cda(t,"choices",this.answers)),(0,bq.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,bq.defer)(()=>(0,bq.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,bq.defer)(()=>(0,bq.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&Sdi.get(this.answers,t.name)!==void 0)return(0,bq.empty)();if(t.when===!1)return(0,bq.empty)();if(typeof t.when!="function")return(0,bq.of)(t);let{answers:r}=this;return(0,bq.defer)(()=>(0,bq.from)((0,JKl.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,bq.filter)(n=>n!=null)))}};function GKl(e){let t=function(r,n){let i;try{i=new SAn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=i.run(r,n);return a.ui=i,a};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",sdi),this.registerPrompt("input",wkr),this.registerPrompt("number",cdi),this.registerPrompt("confirm",ldi),this.registerPrompt("rawlist",fdi),this.registerPrompt("expand",ddi),this.registerPrompt("checkbox",pdi),this.registerPrompt("password",_di),this.registerPrompt("editor",wdi)},t.restoreDefaultPrompts(),t}var Onu=GKl();function D$P(e,t){Onu.registerPrompt(e,t)}function S$P(){Onu.restoreDefaultPrompts()}var E$P={prompt:Onu,ui:{BottomBar:Ddi,Prompt:SAn},createPromptModule:GKl,registerPrompt:D$P,restoreDefaultPrompts:S$P,Separator:Dne},Ada=E$P;var cYl=yu(Enu(),1),zda=class{posthog;constructor({posthogApiKey:t}){this.posthog=new cYl.PostHog(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.44.5",usingAccessToken:!0}})}flush(){this.posthog.flush()}};var Tdi=class{async sendEvent(){}async identify(){}async flush(){}};var MAn=require("fs/promises"),xYl=require("os"),TYl=require("path"),qYl=yu(Enu(),1);var nRt=yu(MYl(),1),XN7=nRt.default.v1,QN7=nRt.default.v3,Akr=nRt.default.v4,ZN7=nRt.default.v5,kN7=nRt.default.NIL,e87=nRt.default.version,t87=nRt.default.validate,r87=nRt.default.stringify,n87=nRt.default.parse;var rGP="id",nGP=".fern",Ndi=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new qYl.PostHog(r),this.userId=t==null?void 0:zXo(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.44.5",...t,...t.properties}})}flush(){this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=ff(P_.of((0,xYl.homedir)()),As.of(nGP),As.of(rGP));await Vh(t)||(await(0,MAn.mkdir)((0,TYl.dirname)(t),{recursive:!0}),await(0,MAn.writeFile)(t,Akr())),this.persistedDistinctId=(await(0,MAn.readFile)(t)).toString()}return this.persistedDistinctId}};var znu;async function xAn(){return znu==null&&(znu=await iGP()),znu}async function iGP(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Tdi;let r=await coa();return r!=null?new Ndi({token:r,posthogApiKey:e}):await soa()!=null?new zda({posthogApiKey:e}):new Ndi({token:void 0,posthogApiKey:e})}catch{return new Tdi}}var Tiu=yu(aRt(),1);var Idi=yu(require("process"),1);var DQl=yu(oiu(),1),SQl=yu(wQl(),1);function J9(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=Xqt(e),e.length===0))return 0;e=e.replace((0,SQl.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let a=i.codePointAt(0);if(a<=31||a>=127&&a<=159||a>=768&&a<=879)continue;switch(DQl.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function spa(e){let t=0;for(let r of e.split(`
1786
+ `}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&&ada(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var WKl=yu(BKl(),1),HKl=yu(wtu(),1),$Kl=yu(UKl(),1),bq=yu(zje(),1),JKl=yu(_fi(),1);var qda=yu(zje(),1),VKl=yu(_fi(),1),Cda=function(e,t,r){return typeof e[t]!="function"?(0,qda.of)(e):(0,qda.from)((0,VKl.default)(e[t])(r).then(n=>(e[t]=n,e)))};var Sdi={isPlainObject:WKl.default,set:$Kl.default,get:HKl.default},SAn=class extends qkr{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=Sdi.isPlainObject(r)?{...r}:{},Sdi.isPlainObject(t)&&(t=Object.values(t).every(i=>Sdi.isPlainObject(i)&&i.name===void 0)?Object.entries(t).map(([i,a])=>({name:i,...a})):[t]);let n=Array.isArray(t)?(0,bq.from)(t):t;return this.process=n.pipe((0,bq.concatMap)(this.processQuestion.bind(this)),(0,bq.publish)()),this.process.connect(),this.process.pipe((0,bq.reduce)((i,a)=>(Sdi.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,bq.defer)(()=>(0,bq.of)(t).pipe((0,bq.concatMap)(this.setDefaultType.bind(this)),(0,bq.concatMap)(this.filterIfRunnable.bind(this)),(0,bq.concatMap)(()=>Cda(t,"message",this.answers)),(0,bq.concatMap)(()=>Cda(t,"default",this.answers)),(0,bq.concatMap)(()=>Cda(t,"choices",this.answers)),(0,bq.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,bq.defer)(()=>(0,bq.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,bq.defer)(()=>(0,bq.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&Sdi.get(this.answers,t.name)!==void 0)return(0,bq.empty)();if(t.when===!1)return(0,bq.empty)();if(typeof t.when!="function")return(0,bq.of)(t);let{answers:r}=this;return(0,bq.defer)(()=>(0,bq.from)((0,JKl.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,bq.filter)(n=>n!=null)))}};function GKl(e){let t=function(r,n){let i;try{i=new SAn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=i.run(r,n);return a.ui=i,a};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",sdi),this.registerPrompt("input",wkr),this.registerPrompt("number",cdi),this.registerPrompt("confirm",ldi),this.registerPrompt("rawlist",fdi),this.registerPrompt("expand",ddi),this.registerPrompt("checkbox",pdi),this.registerPrompt("password",_di),this.registerPrompt("editor",wdi)},t.restoreDefaultPrompts(),t}var Onu=GKl();function D$P(e,t){Onu.registerPrompt(e,t)}function S$P(){Onu.restoreDefaultPrompts()}var E$P={prompt:Onu,ui:{BottomBar:Ddi,Prompt:SAn},createPromptModule:GKl,registerPrompt:D$P,restoreDefaultPrompts:S$P,Separator:Dne},Ada=E$P;var cYl=yu(Enu(),1),zda=class{posthog;constructor({posthogApiKey:t}){this.posthog=new cYl.PostHog(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.44.6",usingAccessToken:!0}})}flush(){this.posthog.flush()}};var Tdi=class{async sendEvent(){}async identify(){}async flush(){}};var MAn=require("fs/promises"),xYl=require("os"),TYl=require("path"),qYl=yu(Enu(),1);var nRt=yu(MYl(),1),XN7=nRt.default.v1,QN7=nRt.default.v3,Akr=nRt.default.v4,ZN7=nRt.default.v5,kN7=nRt.default.NIL,e87=nRt.default.version,t87=nRt.default.validate,r87=nRt.default.stringify,n87=nRt.default.parse;var rGP="id",nGP=".fern",Ndi=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new qYl.PostHog(r),this.userId=t==null?void 0:zXo(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.44.6",...t,...t.properties}})}flush(){this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=ff(P_.of((0,xYl.homedir)()),As.of(nGP),As.of(rGP));await Vh(t)||(await(0,MAn.mkdir)((0,TYl.dirname)(t),{recursive:!0}),await(0,MAn.writeFile)(t,Akr())),this.persistedDistinctId=(await(0,MAn.readFile)(t)).toString()}return this.persistedDistinctId}};var znu;async function xAn(){return znu==null&&(znu=await iGP()),znu}async function iGP(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Tdi;let r=await coa();return r!=null?new Ndi({token:r,posthogApiKey:e}):await soa()!=null?new zda({posthogApiKey:e}):new Ndi({token:void 0,posthogApiKey:e})}catch{return new Tdi}}var Tiu=yu(aRt(),1);var Idi=yu(require("process"),1);var DQl=yu(oiu(),1),SQl=yu(wQl(),1);function J9(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=Xqt(e),e.length===0))return 0;e=e.replace((0,SQl.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let a=i.codePointAt(0);if(a<=31||a>=127&&a<=159||a>=768&&a<=879)continue;switch(DQl.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function spa(e){let t=0;for(let r of e.split(`
1787
1787
  `))t=Math.max(t,J9(r));return t}var JQl=yu(siu(),1);var eYP=/[\p{Lu}]/u,tYP=/[\p{Ll}]/u,xQl=/^[\p{Lu}](?![\p{Lu}])/gu,CQl=/([\p{Alpha}\p{N}_]|$)/u,ciu=/[_.\- ]+/,rYP=new RegExp("^"+ciu.source),TQl=new RegExp(ciu.source+CQl.source,"gu"),qQl=new RegExp("\\d+"+CQl.source,"gu"),nYP=(e,t,r,n)=>{let i=!1,a=!1,u=!1,f=!1;for(let d=0;d<e.length;d++){let c=e[d];f=d>2?e[d-3]==="-":!0,i&&eYP.test(c)?(e=e.slice(0,d)+"-"+e.slice(d),i=!1,u=a,a=!0,d++):a&&u&&tYP.test(c)&&(!f||n)?(e=e.slice(0,d-1)+"-"+e.slice(d-1),u=a,a=!1,i=!0):(i=t(c)===c&&r(c)!==c,u=a,a=r(c)===c&&t(c)!==c)}return e},iYP=(e,t)=>(xQl.lastIndex=0,e.replace(xQl,r=>t(r))),aYP=(e,t)=>(TQl.lastIndex=0,qQl.lastIndex=0,e.replace(TQl,(r,n)=>t(n)).replace(qQl,r=>t(r)));function liu(e,t){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(e)?e=e.map(a=>a.trim()).filter(a=>a.length).join("-"):e=e.trim(),e.length===0)return"";let r=t.locale===!1?a=>a.toLowerCase():a=>a.toLocaleLowerCase(t.locale),n=t.locale===!1?a=>a.toUpperCase():a=>a.toLocaleUpperCase(t.locale);return e.length===1?ciu.test(e)?"":t.pascalCase?n(e):r(e):(e!==r(e)&&(e=nYP(e,r,n,t.preserveConsecutiveUppercase)),e=e.replace(rYP,""),e=t.preserveConsecutiveUppercase?iYP(e,r):r(e),t.pascalCase&&(e=n(e.charAt(0))+e.slice(1)),aYP(e,n))}var _iu=yu(NQl(),1);var zQl=(e=0)=>t=>`\x1B[${t+e}m`,BQl=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,IQl=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`;function cYP(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[r,n]of Object.entries(t)){for(let[i,a]of Object.entries(n))t[i]={open:`\x1B[${a[0]}m`,close:`\x1B[${a[1]}m`},n[i]=t[i],e.set(a[0],a[1]);Object.defineProperty(t,r,{value:n,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",t.color.ansi=zQl(),t.color.ansi256=BQl(),t.color.ansi16m=IQl(),t.bgColor.ansi=zQl(10),t.bgColor.ansi256=BQl(10),t.bgColor.ansi16m=IQl(10),Object.defineProperties(t,{rgbToAnsi256:{value:(r,n,i)=>r===n&&n===i?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5),enumerable:!1},hexToRgb:{value:r=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(r.toString(16));if(!n)return[0,0,0];let{colorString:i}=n.groups;i.length===3&&(i=i.split("").map(u=>u+u).join(""));let a=Number.parseInt(i,16);return[a>>16&255,a>>8&255,a&255]},enumerable:!1},hexToAnsi256:{value:r=>t.rgbToAnsi256(...t.hexToRgb(r)),enumerable:!1},ansi256ToAnsi:{value:r=>{if(r<8)return 30+r;if(r<16)return 90+(r-8);let n,i,a;if(r>=232)n=((r-232)*10+8)/255,i=n,a=n;else{r-=16;let d=r%36;n=Math.floor(r/36)/5,i=Math.floor(d/6)/5,a=d%6/5}let u=Math.max(n,i,a)*2;if(u===0)return 30;let f=30+(Math.round(a)<<2|Math.round(i)<<1|Math.round(n));return u===2&&(f+=60),f},enumerable:!1},rgbToAnsi:{value:(r,n,i)=>t.ansi256ToAnsi(t.rgbToAnsi256(r,n,i)),enumerable:!1},hexToAnsi:{value:r=>t.ansi256ToAnsi(t.hexToAnsi256(r)),enumerable:!1}}),t}var lYP=cYP(),RQl=lYP;var cpa=new Set(["\x1B","\x9B"]),fYP=39,diu="\x07",UQl="[",dYP="]",VQl="m",piu=`${dYP}8;;`,FQl=e=>`${cpa.values().next().value}${UQl}${e}${VQl}`,LQl=e=>`${cpa.values().next().value}${piu}${e}${diu}`,pYP=e=>e.split(" ").map(t=>J9(t)),fiu=(e,t,r)=>{let n=[...t],i=!1,a=!1,u=J9(Xqt(e[e.length-1]));for(let[f,d]of n.entries()){let c=J9(d);if(u+c<=r?e[e.length-1]+=d:(e.push(d),u=0),cpa.has(d)&&(i=!0,a=n.slice(f+1).join("").startsWith(piu)),i){a?d===diu&&(i=!1,a=!1):d===VQl&&(i=!1);continue}u+=c,u===r&&f<n.length-1&&(e.push(""),u=0)}!u&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},_YP=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(J9(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},hYP=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",i,a,u=pYP(e),f=[""];for(let[c,o]of e.split(" ").entries()){r.trim!==!1&&(f[f.length-1]=f[f.length-1].trimStart());let l=J9(f[f.length-1]);if(c!==0&&(l>=t&&(r.wordWrap===!1||r.trim===!1)&&(f.push(""),l=0),(l>0||r.trim===!1)&&(f[f.length-1]+=" ",l++)),r.hard&&u[c]>t){let g=t-l,O=1+Math.floor((u[c]-g-1)/t);Math.floor((u[c]-1)/t)<O&&f.push(""),fiu(f,o,t);continue}if(l+u[c]>t&&l>0&&u[c]>0){if(r.wordWrap===!1&&l<t){fiu(f,o,t);continue}f.push("")}if(l+u[c]>t&&r.wordWrap===!1){fiu(f,o,t);continue}f[f.length-1]+=o}r.trim!==!1&&(f=f.map(c=>_YP(c)));let d=[...f.join(`
1788
1788
  `)];for(let[c,o]of d.entries()){if(n+=o,cpa.has(o)){let{groups:g}=new RegExp(`(?:\\${UQl}(?<code>\\d+)m|\\${piu}(?<uri>.*)${diu})`).exec(d.slice(c).join(""))||{groups:{}};if(g.code!==void 0){let O=Number.parseFloat(g.code);i=O===fYP?void 0:O}else g.uri!==void 0&&(a=g.uri.length===0?void 0:g.uri)}let l=RQl.codes.get(Number(i));d[c+1]===`
1789
1789
  `?(a&&(n+=LQl("")),i&&l&&(n+=FQl(l))):o===`
@@ -1900,7 +1900,7 @@ errors:
1900
1900
  Run ${al.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
1901
1901
  Run ${al.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),FAn(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function kou({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!onf(e))return;let i=t??"",a=e.filter(f=>f.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((f,d)=>f.generatorName.localeCompare(d.generatorName)||f.currentVersion.localeCompare(d.currentVersion));for(let f of u)i+=`
1902
1902
  ${await _a1(f.generatorName)} (${f.apiName!=null?"API: "+f.apiName+", ":""}Group: ${f.generatorGroup}) `+al.dim(f.currentVersion)+al.reset(" \u2192 ")+al.green(f.latestVersion);return i+=`
1903
- `,n?FAn(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function _a1(e){let r=await new anf.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 ha1({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let f={type:"singleApi",versions:{}};return await snf({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,c,o,l)=>{f.versions[c]==null&&(f.versions[c]={});let g=gg.getGeneratorNameOrThrow(o.name,l),O=await gg.getLatestGeneratorVersion({generatorName:g,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:i,includeMajor:a,context:l});O!=null&&(f.versions[c][o.name]={previousVersion:o.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),f}let u={type:"multiApi",versions:{}};return await snf({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,d,c,o)=>{if(f==null)return;u.versions[f]==null&&(u.versions[f]={}),u.versions[f][d]==null&&(u.versions[f][d]={});let l=gg.getGeneratorNameOrThrow(c.name,o),g=await gg.getLatestGeneratorVersion({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:c.version,channel:i,includeMajor:a,context:o});g!=null&&(u.versions[f][d][c.name]={previousVersion:c.version,latestVersion:g})},generatorFilter:r,groupFilter:n}),u}async function snf({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let f=await gg.loadGeneratorsConfiguration({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(f==null||f.groups==null)){for(let d of f.groups)if(!(i!=null&&d.groupName!==i))for(let c of d.generators)n!=null&&c.name!==n||await r(a.workspaceName,d.groupName,c,u)}})}))}function cnf(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[u,f]of Object.entries(a)){r.debug(`Checking if ${u} in group ${i} has an upgrade available...`);let d=Mne(f.latestVersion,f.previousVersion);r.debug(`Latest version: ${f.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),n.push({generatorName:u,generatorGroup:i,apiName:t,isUpgradeAvailable:d,currentVersion:f.previousVersion,latestVersion:f.latestVersion})}return n}async function h_a({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let u=[];if(e!=null){let f=await ha1({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(f.type==="multiApi")for(let[d,c]of Object.entries(f.versions))u.push(...cnf(c,d,t.logger));else u.push(...cnf(f.versions,void 0,t.logger))}return u}var wpi=class extends Error{constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${i} ${a}`.trim(),f=u?`status code ${u}`:"an unknown error";super(`Request failed with ${f}`),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var v6n=class extends Error{constructor(t){super("Request timed out"),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TimeoutError",this.request=t}};var Dpi=e=>e!==null&&typeof e=="object";var Spi=(...e)=>{for(let t of e)if((!Dpi(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return y_a({},...e)},euu=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,u]of i.entries())n&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r},y_a=(...e)=>{let t={},r={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(Dpi(n)){for(let[i,a]of Object.entries(n))Dpi(a)&&i in t&&(a=y_a(t[i],a)),t={...t,[i]:a};Dpi(n.headers)&&(r=euu(r,n.headers),t.headers=r)}return t};var lnf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";return r&&n&&(t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")),e&&!t})(),fnf=typeof globalThis.AbortController=="function",dnf=typeof globalThis.ReadableStream=="function",pnf=typeof globalThis.FormData=="function",v_a=["get","post","put","patch","head","delete"],ya1=()=>{};ya1();var _nf={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},b_a=2147483647,g_a=Symbol("stop"),hnf={json:!0,parseJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},ynf={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};var bnf=e=>v_a.includes(e)?e.toUpperCase():e,va1=["get","put","head","delete","options","trace"],ba1=[408,413,429,500,502,503,504],gnf=[413,429,503],vnf={limit:2,methods:va1,statusCodes:ba1,afterStatusCodes:gnf,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},mnf=(e={})=>{if(typeof e=="number")return{...vnf,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{...vnf,...e,afterStatusCodes:gnf}};async function tuu(e,t,r,n){return new Promise((i,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new v6n(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(u)})})}async function ruu(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==null||t.removeEventListener("abort",i),r()},e)})}var Onf=(e,t)=>{let r={};for(let n in t)!(n in ynf)&&!(n in hnf)&&!(n in e)&&(r[n]=t[n]);return r};var een=class{static create(t,r){let n=new een(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>b_a)throw new RangeError(`The \`timeout\` option cannot be greater than ${b_a}`);await Promise.resolve();let f=await n._fetch();for(let d of n._options.hooks.afterResponse){let c=await d(n.request,n._options,n._decorateResponse(f.clone()));c instanceof globalThis.Response&&(f=c)}if(n._decorateResponse(f),!f.ok&&n._options.throwHttpErrors){let d=new wpi(f,n.request,n._options);for(let c of n._options.hooks.beforeError)d=await c(d);throw d}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!dnf)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return n._stream(f.clone(),n._options.onDownloadProgress)}return f},u=n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i();for(let[f,d]of Object.entries(_nf))u[f]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||d);let o=(await u).clone();if(f==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[f]()};return u}constructor(t,r={}){Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"abortController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._input=t;let n="credentials"in Request.prototype;if(this._options={credentials:n?this._input.credentials:void 0,...r,headers:euu(this._input.headers,r.headers),hooks:y_a({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:bnf(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:mnf(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(fnf){if(this.abortController=new globalThis.AbortController,this._options.signal){let i=this._options.signal;this._options.signal.addEventListener("abort",()=>{this.abortController.abort(i.reason)})}this._options.signal=this.abortController.signal}if(lnf&&(this._options.duplex="half"),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let i=typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString(),a="?"+i,u=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,a);(pnf&&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(u,{...this.request}),this._options)}this._options.json!==void 0&&(this._options.body=JSON.stringify(this._options.json),this.request.headers.set("content-type",this._options.headers.get("content-type")??"application/json"),this.request=new globalThis.Request(this.request,{body:this._options.body}))}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount<=this._options.retry.limit&&!(t instanceof v6n)){if(t instanceof wpi){if(!this._options.retry.statusCodes.includes(t.response.status))return 0;let n=t.response.headers.get("Retry-After");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n);return Number.isNaN(i)?i=Date.parse(n)-Date.now():i*=1e3,this._options.retry.maxRetryAfter!==void 0&&i>this._options.retry.maxRetryAfter?0:i}if(t.response.status===413)return 0}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}return 0}_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),b_a);if(n!==0&&this._retryCount>0){await ruu(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})===g_a)return;return this._retry(t)}throw r}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=Onf(this.request,this._options);return this._options.timeout===!1?this._options.fetch(this.request.clone(),t):tuu(this.request.clone(),t,this.abortController,this._options)}_stream(t,r){let n=Number(t.headers.get("content-length"))||0,i=0;return t.status===204?(r&&r({percent:1,totalBytes:n,transferredBytes:i},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array);async function f(){let{done:d,value:c}=await u.read();if(d){a.close();return}if(r){i+=c.byteLength;let o=n===0?0:i/n;r({percent:o,transferredBytes:i,totalBytes:n},c)}a.enqueue(c),await f()}await f()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var nuu=e=>{let t=(r,n)=>een.create(r,Spi(e,n));for(let r of v_a)t[r]=(n,i)=>een.create(n,Spi(e,i,{method:r}));return t.create=r=>nuu(Spi(r)),t.extend=r=>nuu(Spi(e,r)),t.stop=g_a,t},ga1=nuu(),Pnf=ga1;var $nf=yu(Hnf(),1);function suu(e){let t=(0,$nf.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Uif=yu(Lif(),1),Vif=yu(JQr(),1),muu=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Ouu=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Puu(e,t={}){var l;let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??suu(i),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),f=(0,Uif.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,f&&(d.authorization=`${f.type} ${f.token}`);let c;try{c=await Pnf(u,{headers:d,keepalive:!0}).json()}catch(g){throw((l=g==null?void 0:g.response)==null?void 0:l.status)===404?new muu(e):g}if(t.allVersions)return c;let o=new Ouu(e,r);if(c["dist-tags"][r]){let{time:g}=c;c=c.versions[c["dist-tags"][r]],c.time=g}else if(r){let g=Boolean(c.versions[r]);if(n&&!g)for(let[j,S]of Object.entries(c.versions))S.deprecated&&delete c.versions[j];if(!g){let j=Object.keys(c.versions);if(r=Vif.default.maxSatisfying(j,r),!r)throw o}let{time:O}=c;if(c=c.versions[r],c.time=O,!c)throw o}return c}async function qpi(e,t){let{version:r}=await Puu(e.toLowerCase(),t);return r}async function w6n({cliEnvironment:e,includePreReleases:t=!1}){return e.packageVersion==="0.0.0"?e.packageVersion:qpi(e.packageName,{version:t?"prerelease":"latest"})}var Wif=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],C_a=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=SM.Info;constructor(t){this.ttyAwareLogger=new __a(t);let r=this.getPackageName(),n=this.getPackageVersion(),i=this.getCliName();(r==null||n==null||i==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:n,cliName:i}}getPackageName(){return"fern-api"==null&&this.logger.error("CLI_PACKAGE_NAME is not defined"),"fern-api"}getPackageVersion(){return"0.44.5"==null&&this.logger.error("CLI_VERSION is not defined"),"0.44.5"}getCliName(){return"fern"==null&&this.logger.error("CLI_NAME is not defined"),"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${al.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new ire}failWithoutThrowing(t,r){this.didSucceed=!1,l_a({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvaialable(),this.ttyAwareLogger.finish(),(await xAn()).flush(),this.exitProgram()}async nudgeUpgradeIfAvaialable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await unf({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1903
+ `,n?FAn(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function _a1(e){let r=await new anf.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 ha1({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let f={type:"singleApi",versions:{}};return await snf({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,c,o,l)=>{f.versions[c]==null&&(f.versions[c]={});let g=gg.getGeneratorNameOrThrow(o.name,l),O=await gg.getLatestGeneratorVersion({generatorName:g,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:i,includeMajor:a,context:l});O!=null&&(f.versions[c][o.name]={previousVersion:o.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),f}let u={type:"multiApi",versions:{}};return await snf({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,d,c,o)=>{if(f==null)return;u.versions[f]==null&&(u.versions[f]={}),u.versions[f][d]==null&&(u.versions[f][d]={});let l=gg.getGeneratorNameOrThrow(c.name,o),g=await gg.getLatestGeneratorVersion({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:c.version,channel:i,includeMajor:a,context:o});g!=null&&(u.versions[f][d][c.name]={previousVersion:c.version,latestVersion:g})},generatorFilter:r,groupFilter:n}),u}async function snf({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let f=await gg.loadGeneratorsConfiguration({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(f==null||f.groups==null)){for(let d of f.groups)if(!(i!=null&&d.groupName!==i))for(let c of d.generators)n!=null&&c.name!==n||await r(a.workspaceName,d.groupName,c,u)}})}))}function cnf(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[u,f]of Object.entries(a)){r.debug(`Checking if ${u} in group ${i} has an upgrade available...`);let d=Mne(f.latestVersion,f.previousVersion);r.debug(`Latest version: ${f.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),n.push({generatorName:u,generatorGroup:i,apiName:t,isUpgradeAvailable:d,currentVersion:f.previousVersion,latestVersion:f.latestVersion})}return n}async function h_a({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let u=[];if(e!=null){let f=await ha1({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(f.type==="multiApi")for(let[d,c]of Object.entries(f.versions))u.push(...cnf(c,d,t.logger));else u.push(...cnf(f.versions,void 0,t.logger))}return u}var wpi=class extends Error{constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${i} ${a}`.trim(),f=u?`status code ${u}`:"an unknown error";super(`Request failed with ${f}`),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var v6n=class extends Error{constructor(t){super("Request timed out"),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TimeoutError",this.request=t}};var Dpi=e=>e!==null&&typeof e=="object";var Spi=(...e)=>{for(let t of e)if((!Dpi(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return y_a({},...e)},euu=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,u]of i.entries())n&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r},y_a=(...e)=>{let t={},r={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(Dpi(n)){for(let[i,a]of Object.entries(n))Dpi(a)&&i in t&&(a=y_a(t[i],a)),t={...t,[i]:a};Dpi(n.headers)&&(r=euu(r,n.headers),t.headers=r)}return t};var lnf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";return r&&n&&(t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")),e&&!t})(),fnf=typeof globalThis.AbortController=="function",dnf=typeof globalThis.ReadableStream=="function",pnf=typeof globalThis.FormData=="function",v_a=["get","post","put","patch","head","delete"],ya1=()=>{};ya1();var _nf={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},b_a=2147483647,g_a=Symbol("stop"),hnf={json:!0,parseJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},ynf={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};var bnf=e=>v_a.includes(e)?e.toUpperCase():e,va1=["get","put","head","delete","options","trace"],ba1=[408,413,429,500,502,503,504],gnf=[413,429,503],vnf={limit:2,methods:va1,statusCodes:ba1,afterStatusCodes:gnf,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},mnf=(e={})=>{if(typeof e=="number")return{...vnf,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{...vnf,...e,afterStatusCodes:gnf}};async function tuu(e,t,r,n){return new Promise((i,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new v6n(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(u)})})}async function ruu(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==null||t.removeEventListener("abort",i),r()},e)})}var Onf=(e,t)=>{let r={};for(let n in t)!(n in ynf)&&!(n in hnf)&&!(n in e)&&(r[n]=t[n]);return r};var een=class{static create(t,r){let n=new een(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>b_a)throw new RangeError(`The \`timeout\` option cannot be greater than ${b_a}`);await Promise.resolve();let f=await n._fetch();for(let d of n._options.hooks.afterResponse){let c=await d(n.request,n._options,n._decorateResponse(f.clone()));c instanceof globalThis.Response&&(f=c)}if(n._decorateResponse(f),!f.ok&&n._options.throwHttpErrors){let d=new wpi(f,n.request,n._options);for(let c of n._options.hooks.beforeError)d=await c(d);throw d}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!dnf)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return n._stream(f.clone(),n._options.onDownloadProgress)}return f},u=n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i();for(let[f,d]of Object.entries(_nf))u[f]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||d);let o=(await u).clone();if(f==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[f]()};return u}constructor(t,r={}){Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"abortController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._input=t;let n="credentials"in Request.prototype;if(this._options={credentials:n?this._input.credentials:void 0,...r,headers:euu(this._input.headers,r.headers),hooks:y_a({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:bnf(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:mnf(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(fnf){if(this.abortController=new globalThis.AbortController,this._options.signal){let i=this._options.signal;this._options.signal.addEventListener("abort",()=>{this.abortController.abort(i.reason)})}this._options.signal=this.abortController.signal}if(lnf&&(this._options.duplex="half"),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let i=typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString(),a="?"+i,u=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,a);(pnf&&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(u,{...this.request}),this._options)}this._options.json!==void 0&&(this._options.body=JSON.stringify(this._options.json),this.request.headers.set("content-type",this._options.headers.get("content-type")??"application/json"),this.request=new globalThis.Request(this.request,{body:this._options.body}))}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount<=this._options.retry.limit&&!(t instanceof v6n)){if(t instanceof wpi){if(!this._options.retry.statusCodes.includes(t.response.status))return 0;let n=t.response.headers.get("Retry-After");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n);return Number.isNaN(i)?i=Date.parse(n)-Date.now():i*=1e3,this._options.retry.maxRetryAfter!==void 0&&i>this._options.retry.maxRetryAfter?0:i}if(t.response.status===413)return 0}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}return 0}_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),b_a);if(n!==0&&this._retryCount>0){await ruu(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})===g_a)return;return this._retry(t)}throw r}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=Onf(this.request,this._options);return this._options.timeout===!1?this._options.fetch(this.request.clone(),t):tuu(this.request.clone(),t,this.abortController,this._options)}_stream(t,r){let n=Number(t.headers.get("content-length"))||0,i=0;return t.status===204?(r&&r({percent:1,totalBytes:n,transferredBytes:i},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array);async function f(){let{done:d,value:c}=await u.read();if(d){a.close();return}if(r){i+=c.byteLength;let o=n===0?0:i/n;r({percent:o,transferredBytes:i,totalBytes:n},c)}a.enqueue(c),await f()}await f()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var nuu=e=>{let t=(r,n)=>een.create(r,Spi(e,n));for(let r of v_a)t[r]=(n,i)=>een.create(n,Spi(e,i,{method:r}));return t.create=r=>nuu(Spi(r)),t.extend=r=>nuu(Spi(e,r)),t.stop=g_a,t},ga1=nuu(),Pnf=ga1;var $nf=yu(Hnf(),1);function suu(e){let t=(0,$nf.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Uif=yu(Lif(),1),Vif=yu(JQr(),1),muu=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Ouu=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Puu(e,t={}){var l;let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??suu(i),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),f=(0,Uif.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,f&&(d.authorization=`${f.type} ${f.token}`);let c;try{c=await Pnf(u,{headers:d,keepalive:!0}).json()}catch(g){throw((l=g==null?void 0:g.response)==null?void 0:l.status)===404?new muu(e):g}if(t.allVersions)return c;let o=new Ouu(e,r);if(c["dist-tags"][r]){let{time:g}=c;c=c.versions[c["dist-tags"][r]],c.time=g}else if(r){let g=Boolean(c.versions[r]);if(n&&!g)for(let[j,S]of Object.entries(c.versions))S.deprecated&&delete c.versions[j];if(!g){let j=Object.keys(c.versions);if(r=Vif.default.maxSatisfying(j,r),!r)throw o}let{time:O}=c;if(c=c.versions[r],c.time=O,!c)throw o}return c}async function qpi(e,t){let{version:r}=await Puu(e.toLowerCase(),t);return r}async function w6n({cliEnvironment:e,includePreReleases:t=!1}){return e.packageVersion==="0.0.0"?e.packageVersion:qpi(e.packageName,{version:t?"prerelease":"latest"})}var Wif=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],C_a=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=SM.Info;constructor(t){this.ttyAwareLogger=new __a(t);let r=this.getPackageName(),n=this.getPackageVersion(),i=this.getCliName();(r==null||n==null||i==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:n,cliName:i}}getPackageName(){return"fern-api"==null&&this.logger.error("CLI_PACKAGE_NAME is not defined"),"fern-api"}getPackageVersion(){return"0.44.6"==null&&this.logger.error("CLI_VERSION is not defined"),"0.44.6"}getCliName(){return"fern"==null&&this.logger.error("CLI_NAME is not defined"),"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${al.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new ire}failWithoutThrowing(t,r){this.didSucceed=!1,l_a({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvaialable(),this.ttyAwareLogger.finish(),(await xAn()).flush(),this.exitProgram()}async nudgeUpgradeIfAvaialable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await unf({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1904
1904
  `)||(r+=`
1905
1905
  `),this.logger.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram(){process.exit(this.didSucceed?0:1)}longestWorkspaceName;registerWorkspaces(t){let r=cFo(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 ppi(t);return this.ttyAwareLogger.registerTask(r),r}async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(a){throw n.failWithoutThrowing(void 0,a),new ire}finally{n.finish()}return i}async instrumentPostHogEvent(t){(await xAn()).sendEvent(t)}logger=Yui(this.log.bind(this));constructTaskInitForWorkspace(t){let r=Hif(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?Hif(this.longestWorkspaceName):r).length,i=r.padEnd(n),a=Wif[this.numTasks++%Wif.length],u=al.hex(a)(i);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===U4.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}])}logImmediately(t){let r=t.filter(n=>i4r.indexOf(n.level)>=i4r.indexOf(this.logLevel));this.ttyAwareLogger.log(r,{includeDebugInfo:this.logLevel===SM.Debug})}_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 w6n({cliEnvironment:this.environment,includePreReleases:t}),n=Mne(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},a=await h_a({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}};function Hif(e){return`[${e}]:`}var bof=yu(vof(),1);async function Hje(e,t,r=[],{doNotPipeOutput:n=!1,secrets:i=[],substitutions:a={},...u}={}){var o,l;let f=i.reduce((g,O)=>({...g,[O]:"<redacted>"}),a),d=[t,...r].join(" ");for(let[g,O]of Object.entries(f))d=d.replaceAll(g,O);e==null||e.debug(`+ ${d}`);let c=(0,bof.default)(t,r,u);return n||((o=c.stdout)==null||o.pipe(process.stdout),(l=c.stderr)==null||l.pipe(process.stderr)),c}function L_a(e,{logger:t,...r}={}){return(n,i)=>Hje(t,e,n,{...r,...i})}var V_a=require("fs/promises"),gof=yu(nre(),1),_s1="buf.gen.yaml",mof="output",hs1=`${mof}/openapi.yaml`,ys1=`
1906
1906
  version: v1
@@ -1951,7 +1951,7 @@ ${g}
1951
1951
  `+d.map(c=>` - ${Kdj(c)}`).join(`
1952
1952
  `)});return u}}})};function Gdj({endpoint:e,service:t,relativeFilepath:r,definitionFile:n,workspace:i}){let a={},u=(f,d)=>{(a[f]??(a[f]=[])).push(d)};if(e.request!=null&&typeof e.request!="string"&&e.request.body!=null&&!EA(e.request.body)&&nja({request:e.request,file:jO({relativeFilepath:r,definitionFile:n,casingsGenerator:xx,rootApiFile:i.definition.rootApiFile.contents}),typeResolver:new CM(i)})&&u(fvi,{type:"referenced-body",propertyName:fvi}),t.headers!=null)for(let[f,d]of Object.entries(t.headers))u(pFt({headerKey:f,header:d}).name,{type:"service-header",headerKey:f,header:d});if(e.request!=null&&typeof e.request!="string"){if(e.request.headers!=null)for(let[f,d]of Object.entries(e.request.headers))u(pFt({headerKey:f,header:d}).name,{type:"endpoint-header",headerKey:f,header:d});if(e.request["query-parameters"]!=null)for(let[f,d]of Object.entries(e.request["query-parameters"]))u(oEr({queryParameterKey:f,queryParameter:d}).name,{type:"endpoint-query-parameter",queryParameterKey:f,queryParameter:d});if(e.request.body!=null&&EA(e.request.body)){let f=KAt({typeName:void 0,objectDeclaration:{extends:e.request.body.extends,properties:e.request.body.properties??{}},filepathOfDeclaration:r,definitionFile:n,workspace:i,typeResolver:new CM(i),smartCasing:!1});for(let d of f)u(d.name,{type:"inlined-body",property:d})}}return a}function Kdj(e){switch(e.type){case"service-header":return`Service header "${e.headerKey}"`;case"endpoint-header":return`Endpoint header "${e.headerKey}"`;case"endpoint-query-parameter":return`Query Parameter "${e.queryParameterKey}"`;case"inlined-body":return`Body property: ${sNn({property:e.property,prefixBreadcrumbs:["<Request Body>"]})}`;case"referenced-body":return`Body property "${e.propertyName}"`;default:dl(e)}}var Yju=yu(require("path"),1),Xju={name:"no-duplicate-declarations",create:async({workspace:e,logger:t})=>{let r=await Ydj(e),n={},i=({declaredName:a,relativeFilepath:u})=>{var g;let f=Yju.default.dirname(u),d=(g=r[f])==null?void 0:g[a];if(d==null)return t.error(`Could not find declarations for name: ${a}. This is an error in the Fern validator.`),[];let c=n[f]??(n[f]=new Set);if(!c.has(a))return c.add(a),[];let o=d.indexOf(u);return d.filter((O,j)=>j!==o).map(O=>({severity:"error",message:`${a} is already declared in ${O===u?"this file":O}`}))};return{definitionFile:{typeName:(a,{relativeFilepath:u})=>i({declaredName:a,relativeFilepath:u}),errorDeclaration:({errorName:a},{relativeFilepath:u})=>i({declaredName:a,relativeFilepath:u}),httpEndpoint:({endpoint:a},{relativeFilepath:u})=>{var f;return typeof a.request!="string"&&((f=a.request)==null?void 0:f.name)!=null?i({declaredName:a.request.name,relativeFilepath:u}):[]}}}}};async function Ydj(e){let t={};return await R5(e,async(r,n)=>{let i=Yju.default.dirname(r),a=t[i]??(t[i]={}),u=f=>{(a[f]??(a[f]=[])).push(r)};await JW(n,{typeName:f=>{u(f)},errorDeclaration:({errorName:f})=>{u(f)},httpEndpoint:({endpoint:f})=>{var d;typeof f.request!="string"&&((d=f.request)==null?void 0:d.name)!=null&&u(f.request.name)}})}),t}function Bbi(e){let t=new Set,r=new Set,n=[];for(let i of e)t.has(i)&&!r.has(i)&&(r.add(i),n.push(i)),t.add(i);return n}var Qju={name:"no-duplicate-enum-values",create:()=>({definitionFile:{typeDeclaration:({declaration:e})=>CCt(e)?Bbi(e.enum.map(r=>typeof r=="string"?r:r.value)).map(r=>({severity:"error",message:`Duplicated enum value: ${al.bold(r)}.`})):[]}})};var Zju={name:"no-duplicate-example-names",create:async()=>({definitionFile:{typeDeclaration:({declaration:e})=>{if(typeof e=="string"||e.examples==null)return[];let t=e.examples.map(r=>r.name).filter(KS);return Bbi(t).map(r=>({severity:"error",message:`Duplicate example name: ${r}`}))},httpEndpoint:({endpoint:e})=>{if(e.examples==null)return[];let t=e.examples.map(r=>r.name).filter(KS);return Bbi(t).map(r=>({severity:"error",message:`Duplicate example name: ${r}`}))}}})};function GUf(e){if(!e.isInlined)return e.name;switch(e.location){case"inlinedRequest":return"<Inlined Request>";default:dl(e.location)}}var kju={name:"no-duplicate-field-names",create:({workspace:e})=>{let t=new CM(e);return{definitionFile:{typeDeclaration:({typeName:r,declaration:n},{relativeFilepath:i,contents:a})=>{let u=[];return E5(n,{alias:Qqt,enum:f=>{let d=KUf(f.enum,c=>dNn(c).name);for(let c of d)u.push({severity:"error",message:`Name "${c}" is used by multiple values.`})},object:f=>{let d=GUf(r),c=KAt({typeName:d,objectDeclaration:f,filepathOfDeclaration:i,definitionFile:a,workspace:e,typeResolver:t,smartCasing:!1}),o=aFo(c,l=>l.name);for(let[l,g]of Object.entries(o))if(g.length>1){let O=[`Object has multiple properties named "${l}":`,...g.map(j=>` - ${sNn({property:j,prefixBreadcrumbs:[d]})}`)].join(`
1953
1953
  `);u.push({severity:"error",message:O})}},undiscriminatedUnion:()=>[],discriminatedUnion:f=>{let d=KUf(Object.entries(f.union),([c,o])=>lNn({unionKey:c,rawSingleUnionType:o}).name);for(let c of d)u.push({severity:"error",message:`Name ${c} is used by multiple subtypes of this union.`});for(let[c,o]of Object.entries(f.union)){let l=typeof o=="string"?o:typeof o.type=="string"?o.type:void 0;if(l!=null){let g=t.resolveType({type:l,file:jO({relativeFilepath:i,definitionFile:a,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents})});if(g==null)continue;if(g._type==="named"&&QE(g.declaration)){let O=Hzr(f).name,j=Cne(e,g.filepath);if(j==null)continue;let x=KAt({typeName:g.rawName,objectDeclaration:g.declaration,filepathOfDeclaration:g.filepath,definitionFile:j,workspace:e,typeResolver:t,smartCasing:!1}).filter(A=>A.name===O);if(x.length>0){let A=[`Discriminant "${O}" conflicts with extended ${x.length===1?"property":"properties"}:`,...x.map(N=>` - ${sNn({property:N,prefixBreadcrumbs:[c,l]})}`)].join(`
1954
- `);u.push({severity:"error",message:A})}}}}}}),u}}}}};function KUf(e,t){var n;let r={};for(let i of e)r[n=t(i)]??(r[n]=0),r[t(i)]++;return Object.entries(r).reduce((i,[a,u])=>(u>1&&i.push(a),i),[])}var ewu={name:"no-error-status-code-conflict",create:async({workspace:e})=>{var r;if(((r=e.definition.rootApiFile.contents["error-discrimination"])==null?void 0:r.strategy)!=="status-code")return{};let t=await Xdj(e);return{definitionFile:{httpEndpoint:async({endpoint:n})=>{var u;if(n.errors==null)return[];let i={};for(let f of n.errors){let d=typeof f=="string"?f:f.error,c=t[d];if(c==null)continue;let o=c["status-code"];o in i?(u=i[o])==null||u.push(d):i[o]=[d]}let a=[];for(let[f,d]of Object.entries(i))d.length>1&&a.push({severity:"error",message:`Multiple errors have status-code ${f}: ${d.join(", ")}`});return a}}}}};async function Xdj(e){let t={};return await R5(e,async(r,n)=>{await JW(n,{typeName:Qqt,errorDeclaration:({errorName:i,declaration:a})=>{t[i]=a},httpService:Qqt})}),t}var twu={name:"no-extensions-with-file-upload",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.request==null)return[];let t=gZr(e.request);return(t==null?void 0:t.extends)==null?[]:[{severity:"error",message:"Request body extensions are not supported for file-upload requests."}]}}})};var rwu={name:"no-get-request-body",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>e.method==="GET"&&yGo(e)!=null?[{severity:"error",message:"Endpoint is a GET, so it cannot have a request body."}]:[]}})};var nwu={name:"no-missing-auth",create:e=>{let t=e.workspace.definition.rootApiFile.contents.auth!=null;return{definitionFile:{httpService:r=>r.auth&&!t?[{severity:"error",message:"Service requires auth, but no auth is defined."}]:[],httpEndpoint:({endpoint:r})=>r.auth!=null&&r.auth&&!t?[{severity:"error",message:"Endpoint requires auth, but no auth is defined."}]:[]}}}};var iwu={name:"no-missing-error-discriminant",create:async({workspace:e})=>Qdj(e)?{rootApiFile:{errorDiscrimination:t=>t!=null?[]:[{severity:"error",message:"error-discrimination is required because this API has declared errors."}]}}:{}};function Qdj(e){for(let t of Object.values(Q8r(e.definition)))if(t.contents.errors!=null&&!oFo(t.contents.errors))return!0;return!1}var awu={name:"no-missing-request-name",create:()=>({definitionFile:{httpEndpoint:({endpoint:e,service:t})=>{var r;if(typeof e.request!="string"&&((r=e.request)==null?void 0:r.name)!=null)return[];if(e.request!=null&&typeof e.request!="string"){if(e.request.body!=null&&EA(e.request.body))return[{severity:"error",message:"Request name is required because request body is defined inline"}];if(e.request["query-parameters"]!=null&&I8t(e.request["query-parameters"])>0)return[{severity:"error",message:"Request name is required because request has query parameters"}];if(I8t(e.request.headers)>0)return[{severity:"error",message:"Request name is required because request has headers"}]}return I8t(t.headers)>0?[{severity:"error",message:"Request name is required because service has headers"}]:[]}}})};var owu={name:"no-object-single-property-key",create:({workspace:e})=>{let t=new CM(e);return{definitionFile:{typeDeclaration:({declaration:r},{relativeFilepath:n,contents:i})=>{let a=[];if(!eNr(r))return a;let u=({discriminantValue:f,singleUnionType:d})=>{let c=typeof d!="string"&&d.key!=null,o=typeof d=="string"?d:d.type;return typeof o!="string"||c?typeof o!="string"&&c?[{severity:"error",message:`Union variant ${f} has no type, so "key" cannot be defined`}]:[]:t.resolveType({type:o,file:jO({relativeFilepath:n,definitionFile:i,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents})})==null?[]:[]};for(let[f,d]of Object.entries(r.union))a.push(...u({discriminantValue:f,singleUnionType:d}));return a}}}}};var uwu={name:"no-response-property",create:({workspace:e})=>{let t=new CM(e);return{definitionFile:{httpEndpoint:({endpoint:r},{relativeFilepath:n,contents:i})=>{let{response:a}=r;if(a==null)return[];let u=typeof a=="string"?a:a.type;if(NTe(u)!=null)return[];if(ili(u)!=null)return[];let f=typeof a!="string"?a.property:void 0;if(f==null)return[];let d=jO({relativeFilepath:n,definitionFile:i,rootApiFile:e.definition.rootApiFile.contents,casingsGenerator:xx}),c=t.resolveTypeOrThrow({type:typeof a!="string"?a.type:a,file:d}),o=YUf(c,f,d,t);return Zdj(o,f)}}}}},qFt;(function(e){e[e.ContainsProperty=0]="ContainsProperty",e[e.DoesNotContainProperty=1]="DoesNotContainProperty",e[e.IsNotObject=2]="IsNotObject"})(qFt||(qFt={}));function Zdj(e,t){switch(e){case qFt.ContainsProperty:return[];case qFt.DoesNotContainProperty:return[{severity:"error",message:`Response does not have a property named ${t}.`}];case qFt.IsNotObject:return[{severity:"error",message:"Response must be an object in order to return a property as a response."}]}}function YUf(e,t,r,n){switch(e._type){case"container":return e.container._type!=="optional"?qFt.IsNotObject:YUf(e.container.itemType,t,r,n);case"named":return QUf(e.declaration)?kdj(e.declaration,t,r,n)?qFt.ContainsProperty:qFt.DoesNotContainProperty:qFt.IsNotObject;case"primitive":case"unknown":return qFt.IsNotObject;default:dl(e)}}function kdj(e,t,r,n){return XUf(e,r,n).has(t)}function XUf(e,t,r){let n=[];typeof e.extends=="string"?n=[e.extends]:Array.isArray(e.extends)&&(n=e.extends);let i=new Set;for(let a of n)for(let u of epj(a,t,r))i.add(u);for(let a of Object.keys(e.properties??{}))i.add(a);return i}function epj(e,t,r){let n=r.resolveNamedTypeOrThrow({referenceToNamedType:e,file:t});return n._type==="named"&&QUf(n.declaration)?XUf(n.declaration,t,r):new Set}function QUf(e){return e.extends!=null||e.properties!=null}var swu={name:"no-undefined-error-reference",create:async({workspace:e})=>{let t=await tpj(e);function r(i,a){let u=t[a];return u==null?!1:u.has(i)}let n=(i,a,u)=>{let f=dwe({reference:i,referencedIn:a,imports:cy(u.imports??{},As.of)});return f!=null&&r(f.typeName,f.relativeFilepath)?[]:[{severity:"error",message:"Error is not defined."}]};return{rootApiFile:{errorReference:(i,{relativeFilepath:a,contents:u})=>n(i,a,u)},definitionFile:{errorReference:(i,{relativeFilepath:a,contents:u})=>n(i,a,u)}}}};async function tpj(e){let t={};return await R5(e,async(r,n)=>{let i=new Set;t[r]=i,await JW(n,{errorDeclaration:({errorName:a})=>{i.add(a)}})}),t}var cwu={name:"no-undefined-example-reference",create:async({workspace:e})=>{let t=new _we(new CM(e));return{definitionFile:{exampleTypeReference:(r,{relativeFilepath:n,contents:i})=>t.parseExampleReference(r)==null?[{severity:"error",message:`Example ${al.bold(r)} is malformed. Examples should be formatted like ${al.bold("$YourType.ExampleName")}`}]:t.resolveExample({example:r,file:jO({relativeFilepath:n,definitionFile:i,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents})})!=null?[]:[{severity:"error",message:`Example ${al.bold(r)} is not defined.`}]}}}};var fwu={name:"no-undefined-path-parameters",create:()=>({rootApiFile:{file:e=>e["base-path"]==null?[]:lwu({path:e["base-path"],pathParameters:e["path-parameters"]??{},pathType:"file"})},definitionFile:{httpService:e=>lwu({path:e["base-path"],pathParameters:e["path-parameters"]??{},pathType:"service"}),httpEndpoint:({endpoint:e})=>lwu({path:e["base-path"]!=null?Jw(e["base-path"],e.path):e.path,pathParameters:e["path-parameters"]!=null?e["path-parameters"]:{},pathType:"endpoint"})}})};function lwu({path:e,pathParameters:t,pathType:r}){let n=[],i=new Set;k2e(e).parts.forEach(c=>{i.has(c.pathParameter)&&n.push({severity:"error",message:`${jui(r)} has duplicate path parameter: ${al.bold(c.pathParameter)}.`}),i.add(c.pathParameter)});let u=new Set(Object.keys(t));return ZUf(i,u).forEach(c=>{n.push({severity:"error",message:`${jui(r)} has missing path-parameter: ${al.bold(c)}.`})}),ZUf(u,i).forEach(c=>{n.push({severity:"error",message:`Path parameter is unreferenced in ${r}: ${al.bold(c)}.`})}),n}function ZUf(e,t){return new Set([...e].filter(r=>!t.has(r)))}var dwu={name:"no-undefined-type-reference",create:async({workspace:e})=>{let t=await rpj(e);function r(i){if(i.parsed==null)return!1;let a=t[i.parsed.relativeFilepath];if(a==null)return!1;let u=R3(i.parsed.typeName);return u!=null?u.name?a.has(u.name):!1:a.has(i.parsed.typeName)}function n(i,a){var u,f,d;if(a!=null){let c=[...a];for(;c.length>0;){let o=c.pop(),l=o?typeof o=="string"?R3(o):R3(o.key):void 0;if(l!=null)return((u=i.parsed)==null?void 0:u.typeName)&&((d=l.arguments)==null?void 0:d.includes((f=i.parsed)==null?void 0:f.typeName))}}return!1}return{definitionFile:{typeReference:({typeReference:i,location:a,nodePath:u},{relativeFilepath:f,contents:d})=>{let c=NTe(i);if(c!=null){if(a===$W.InlinedRequestProperty)return[];if(a===$W.Response)return c.isOptional?[{severity:"error",message:"File response cannot be optional"}]:[]}return k3r(i)!=null?a===$W.RequestReference?[]:[{severity:"error",message:"The bytes type can only be used as a request"}]:d2n(i)?a===$W.StreamingResponse?[]:a===$W.Response?[]:[{severity:"error",message:"The text type can only be used as a response or response-stream."}]:npj({type:i,relativeFilepath:f,imports:cy(d.imports??{},As.of)}).reduce((g,O)=>{var j,S,x;return((j=O.parsed)==null?void 0:j.typeName)!=null&&NTe(O.parsed.typeName)!=null?g.push({severity:"error",message:"The file type can only be used as properties in inlined requests."}):((S=O.parsed)==null?void 0:S.typeName)!=null&&d2n(O.parsed.typeName)?g.push({severity:"error",message:"The text type can only be used as a response-stream or response."}):!r(O)&&!n(O,u)&&g.push({severity:"error",message:`Type ${al.bold(((x=O.parsed)==null?void 0:x.typeName)??O.fullyQualifiedName)} is not defined.`}),g},[])}}}}};async function rpj(e){let t={};return await R5(e,async(r,n)=>{let i=new Set;t[r]=i,await JW(n,{typeDeclaration:({typeName:a})=>{if(!a.isInlined){let u=R3(a.name);u!=null&&u.name&&i.add(u.name),i.add(a.name)}}})}),t}function npj({type:e,relativeFilepath:t,imports:r}){return $J({type:e,_default:void 0,validation:void 0,visitor:{primitive:()=>[],unknown:()=>[],map:({keyType:n,valueType:i})=>[...n,...i],list:n=>n,set:n=>n,optional:n=>n,literal:()=>[],named:n=>{let i=dwe({reference:n,referencedIn:t,imports:r});return[{fullyQualifiedName:n,parsed:i!=null?{typeName:i.typeName,relativeFilepath:i.relativeFilepath}:void 0}]}}})}var pwu={name:"no-undefined-variable-reference",create:async({workspace:e})=>{let t=new rqe,r=(n,i)=>n.startsWith(rqe.VARIABLE_PREFIX)?t.getDeclaration(n,i)?[]:[{severity:"error",message:`Variable ${n} is not defined.`}]:[{severity:"error",message:`Variable reference must start with ${rqe.VARIABLE_PREFIX}`}];return{rootApiFile:{variableReference:n=>r(n,aEr({casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}))},definitionFile:{variableReference:(n,{relativeFilepath:i,contents:a})=>r(n,jO({casingsGenerator:xx,relativeFilepath:i,definitionFile:a,rootApiFile:e.definition.rootApiFile.contents}))}}}};var _wu={name:"no-unused-generic",create:async({workspace:e})=>{let t=new Set;return await R5(e,async(r,n)=>{await JW(n,{typeDeclaration:i=>{E5(i.declaration,{alias:a=>{let u=R3(typeof a=="string"?a:a.type);if(u!=null&&u.name){let[f,d,...c]=u.name.split("."),o=d??f;o&&t.add(o)}},enum:()=>{},object:()=>{},discriminatedUnion:()=>{},undiscriminatedUnion:()=>{}})}})}),{definitionFile:{typeName:r=>{let n=R3(r);return n==null?[]:n.name&&t.has(n.name)?[]:[{severity:"error",message:`Generic "${r}" is declared but never used.`}]}}}}};var hwu={name:"only-object-extensions",create:({workspace:e})=>{let t=new CM(e);return{definitionFile:{extension:(r,{relativeFilepath:n,contents:i})=>{let a=t.resolveNamedType({referenceToNamedType:r,file:jO({relativeFilepath:n,definitionFile:i,rootApiFile:e.definition.rootApiFile.contents,casingsGenerator:xx})});return a==null?[]:a._type==="named"&&QE(a.declaration)?[]:[{severity:"error",message:`Objects can only extend other objects, and ${r} is not an object.`}]}}}}};var ywu={name:"valid-base-path",create:()=>({rootApiFile:{file:e=>e["base-path"]!=null?kUf(e["base-path"]):[]},definitionFile:{httpService:e=>kUf(e["base-path"])}})};function kUf(e){if(e==="/"||e.length===0)return[];let t=[];return e.startsWith("/")||t.push({severity:"error",message:"base-path must be empty or start with a slash."}),t}var vwu={name:"valid-default-environment",create:({workspace:e})=>{let t=e.definition.rootApiFile.contents.environments;return{rootApiFile:{defaultEnvironment:r=>r!=null&&(t==null||!Object.keys(t).includes(r))?[{severity:"error",message:`The default-environment ${r} is not listed as an environment`}]:t!=null&&r===void 0?[{severity:"error",message:"Please specify a default-environment. If no default, use null"}]:[]}}}};var bwu={name:"valid-endpoint-path",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.path==="")return[];let t=[];return e.path.startsWith("/")||t.push({severity:"error",message:"Path must start with a slash."}),t}}})};function SDa({allDeclarations:e={},examples:t,parameterDisplayName:r,typeResolver:n,exampleResolver:i,workspace:a,getRawType:u,breadcrumbs:f}){let d=[],c=Object.entries(e).reduce((o,[l,g])=>{let O=u(g);if(O!=null){let j=n.resolveType({type:O.rawType,file:O.file});j!=null&&j._type==="container"&&j.container._type==="optional"||(j==null?void 0:j._type)==="unknown"||o.push(l)}return o},[]);for(let o of c)(t==null?void 0:t[o])==null&&d.push({severity:"error",message:`Example is missing required ${r} "${o}"`});if(t!=null)for(let[o,l]of Object.entries(t)){let g=e[o];if(g==null)d.push({severity:"error",message:`Unexpected ${r} "${o}"`});else{let O=u(g);O!=null&&d.push(...TG.validateTypeReferenceExample({rawTypeReference:O.rawType,example:l,file:O.file,workspace:a,typeResolver:n,exampleResolver:i,breadcrumbs:f}).map(j=>({severity:"error",message:j.message})))}}return d}function eVf({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a}){var d;let u=[],f=typeof t.request!="string"?(d=t.request)==null?void 0:d.body:t.request;return f==null?e!=null&&u.push({severity:"error",message:"Unexpected request in example."}):EA(f)?u.push(...TG.validateObjectExample({typeName:void 0,typeNameForBreadcrumb:"<Inlined Request>",rawObject:{extends:f.extends,properties:f.properties??{}},file:i,typeResolver:r,exampleResolver:n,workspace:a,example:e,breadcrumbs:["request"]}).map(c=>({severity:"error",message:c.message}))):u.push(...TG.validateTypeReferenceExample({rawTypeReference:typeof f=="string"?f:f.type,example:e,file:i,workspace:a,typeResolver:r,exampleResolver:n,breadcrumbs:["response","body"]}).map(c=>({severity:"error",message:c.message}))),u}function rVf({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a,errorResolver:u}){return e==null?tVf({example:{},endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a,errorResolver:u}):mZr(t,e,{body:f=>tVf({example:f,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a,errorResolver:u}),stream:f=>ipj({example:f,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a}),events:f=>apj({example:f,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a})})}function tVf({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a,errorResolver:u}){let f=[];if(e.error==null)t.response!=null?f.push(...TG.validateTypeReferenceExample({rawTypeReference:typeof t.response!="string"?t.response.type:t.response,example:e.body,typeResolver:r,exampleResolver:n,file:i,workspace:a,breadcrumbs:["response","body"]}).map(d=>({severity:"error",message:d.message}))):e.body!=null&&f.push({severity:"error",message:`Unexpected response in example. If you're adding an example of an error response, set the "error" property to the error's name`});else{let d=u.getDeclaration(e.error,i);d!=null&&(t.errors!=null&&t.errors.some(o=>(typeof o!="string"?o.error:o)===e.error)||f.push({severity:"error",message:`${al.bold(e.error)} is not specified as an allowed error for this endpoint. Add ${al.bold(e.error)} to the endpoint's "errors" list.`}),d.declaration.type!=null?f.push(...TG.validateTypeReferenceExample({rawTypeReference:d.declaration.type,example:e.body,typeResolver:r,exampleResolver:n,file:d.file,workspace:a,breadcrumbs:["response","body"]}).map(o=>({severity:"error",message:o.message}))):e.body!=null&&f.push({severity:"error",message:`Unexpected response in example. ${al.bold(e.error)} does not have a body.`}))}return f}function ipj({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a}){let u=[];if(t["response-stream"]==null)u.push({severity:"error",message:"Unexpected streaming response in example. Endpoint's schema is missing `response-stream` key."});else if(typeof t["response-stream"]=="string"||t["response-stream"].format==null||t["response-stream"].format==="json")for(let f of e.stream)u.push(...TG.validateTypeReferenceExample({rawTypeReference:typeof t["response-stream"]!="string"?t["response-stream"].type:t["response-stream"],example:f,typeResolver:r,exampleResolver:n,file:i,workspace:a,breadcrumbs:["response","body"]}).map(d=>({severity:"error",message:d.message})));else u.push({severity:"error",message:"Endpoint response expects server-sent events (`response-stream.format: sse`), but the provided example is a regular stream. Use the `events` key to provide an list of server-sent event examples."});return u}function apj({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a}){let u=[];if(t["response-stream"]==null)u.push({severity:"error",message:"Unexpected streaming response in example. Endpoint's schema is missing `response-stream` key."});else if(typeof t["response-stream"]!="string"&&t["response-stream"].format==="sse")for(let f of e.stream)u.push(...TG.validateTypeReferenceExample({rawTypeReference:typeof t["response-stream"]!="string"?t["response-stream"].type:t["response-stream"],example:f.data,typeResolver:r,exampleResolver:n,file:i,workspace:a,breadcrumbs:["response","body"]}).map(d=>({severity:"error",message:d.message})));else u.push({severity:"error",message:"Endpoint response expects a regular stream, but the provided example is a server-sent event. Use the `stream` key to provide a list of stream examples."});return u}var gwu={name:"valid-example-endpoint-call",create:({workspace:e})=>{let t=new CM(e),r=new vrn(e),n=new _we(t),i=new rqe;return{definitionFile:{exampleHeaders:({service:a,endpoint:u,examples:f},{relativeFilepath:d,contents:c})=>{var o;return SDa({allDeclarations:{...a.headers,...typeof u.request!="string"?(o=u.request)==null?void 0:o.headers:void 0},examples:f,parameterDisplayName:"header",typeResolver:t,exampleResolver:n,workspace:e,getRawType:l=>({file:jO({relativeFilepath:d,definitionFile:c,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),rawType:typeof l=="string"?l:l.type}),breadcrumbs:["headers"]})},examplePathParameters:({service:a,endpoint:u,examples:f},{relativeFilepath:d,contents:c})=>SDa({allDeclarations:{...e.definition.rootApiFile.contents["path-parameters"],...a["path-parameters"],...u["path-parameters"]},examples:f,parameterDisplayName:"path parameter",typeResolver:t,exampleResolver:n,workspace:e,getRawType:o=>cja({parameter:o,variableResolver:i,file:jO({relativeFilepath:d,definitionFile:c,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents})}),breadcrumbs:["path-parameters"]}),exampleQueryParameters:({endpoint:a,examples:u},{relativeFilepath:f,contents:d})=>{var c;return SDa({allDeclarations:typeof a.request!="string"?(c=a.request)==null?void 0:c["query-parameters"]:void 0,examples:u,parameterDisplayName:"query parameter",typeResolver:t,exampleResolver:n,workspace:e,getRawType:o=>({file:jO({relativeFilepath:f,definitionFile:d,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),rawType:typeof o=="string"?o:o.type}),breadcrumbs:["query-parameters"]})},exampleRequest:({endpoint:a,example:u},{relativeFilepath:f,contents:d})=>eVf({example:u,endpoint:a,typeResolver:t,exampleResolver:n,file:jO({relativeFilepath:f,definitionFile:d,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),workspace:e}),exampleResponse:({endpoint:a,example:u},{relativeFilepath:f,contents:d})=>rVf({example:u,endpoint:a,typeResolver:t,exampleResolver:n,file:jO({relativeFilepath:f,definitionFile:d,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),workspace:e,errorResolver:r})}}}};var mwu={name:"valid-example-error",create:({workspace:e})=>{let t=new CM(e),r=new _we(t);return{definitionFile:{exampleError:({errorName:n,declaration:i,example:a},{relativeFilepath:u,contents:f})=>i.type==null?[]:TG.validateTypeReferenceExample({rawTypeReference:i.type,example:a.value,file:jO({relativeFilepath:u,definitionFile:f,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),workspace:e,typeResolver:t,exampleResolver:r,breadcrumbs:["response","body"]}).map(c=>({severity:"error",message:c.message}))}}}};var Owu={name:"valid-example-type",create:({workspace:e})=>{let t=new CM(e),r=new _we(t);return{definitionFile:{exampleType:({typeName:n,typeDeclaration:i,example:a},{relativeFilepath:u,contents:f})=>TG.validateTypeExample({typeName:n,typeDeclaration:i,example:a.value,file:jO({relativeFilepath:u,definitionFile:f,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),typeResolver:t,exampleResolver:r,workspace:e,breadcrumbs:[]}).map(c=>({severity:"error",message:c.message}))}}}};function nVf(e){let t=[];return e.enum.forEach(r=>{let n=dNn(r);PDa.test(n.name)||(n.wasExplicitlySet?t.push({severity:"error",message:`Enum name ${al.bold(n.name)} is not suitable for code generation. It must start with a letter and only contain letters, numbers, and underscores.`}):t.push({severity:"error",message:`Enum value ${al.bold(n.name)} is not suitable for code generation. Add a "name" property that starts with a letter and contains only letters, numbers, and underscores.`}))}),t}function iVf(e){let t=[],r=Hzr(e);return PDa.test(r.name)||(r.wasExplicitlySet?t.push({severity:"error",message:`Discriminant name ${al.bold(r.name)} is not suitable for code generation. It must start with a letter and only contain letters, numbers, and underscores.`}):t.push({severity:"error",message:`Discriminant value ${al.bold(r.name)} is not suitable for code generation. Add a "name" property that starts with a letter and contains only letters, numbers, and underscores.`})),t}var Pwu={name:"valid-field-names",create:()=>({definitionFile:{typeDeclaration:({declaration:e})=>E5(e,{alias:()=>[],enum:nVf,object:()=>[],undiscriminatedUnion:()=>[],discriminatedUnion:iVf})}})};var jwu={name:"valid-generic",create:async({workspace:e})=>{let t=await opj(e),r={object:[],discriminatedUnion:[]};return{definitionFile:{typeDeclaration:({typeName:n,declaration:i,nodePath:a})=>{let u=[];return n.isInlined||R3(n.name)!=null&&(E5(i,{alias:()=>!1,enum:()=>!1,object:()=>!0,discriminatedUnion:()=>!1,undiscriminatedUnion:()=>!1})||u.push({severity:"error",message:"Generics are only supported for object declarations"})),E5(i,{alias:f=>{let d=typeof f=="string"?f:f.type,c=R3(d);if(c!=null){let[o,l,...g]=c.name.split("."),O=l??o;O&&O in t&&t[O]!==c.arguments.length&&u.push({severity:"error",message:`Generic ${O} expects ${t[O]} arguments, but received ${c.arguments.length} <${c.arguments.join(",")}>`})}else d in t&&u.push({severity:"error",message:`Generic ${d} expects ${t[d]} arguments, but received none`})},enum:f=>{typeof f!="string"&&f.enum.forEach(d=>{let c=typeof d=="string"?d:d.value;jTe(c)&&u.push({severity:"error",message:`Cannot reference generic ${c} from enum`})})},object:f=>{Object.entries((f==null?void 0:f.properties)??{}).forEach(([d,c])=>{jTe(typeof c=="string"?c:c.type)&&(a?(r.object??(r.object=[])).push({key:d,nodePath:a}):u.push({severity:"error",message:`Cannot reference generic ${c} from object property ${d}`}))})},discriminatedUnion:f=>{Object.entries(f.union).forEach(([d,c])=>{let o=typeof c=="string"?c:typeof c.type=="string"?c.type:void 0;o&&jTe(o)&&(a?(r.discriminatedUnion??(r.discriminatedUnion=[])).push({key:d,nodePath:a}):u.push({severity:"error",message:`Cannot reference generic ${c} from union property ${d}`}))})},undiscriminatedUnion:f=>{f.union.forEach(d=>{let c=typeof d=="string"?d:d.type;jTe(c)&&u.push({severity:"error",message:`Cannot reference generic ${c} from union`})})}}),u},typeReference:({typeReference:n,nodePath:i})=>{let a=[];if(i)for(let u of Object.keys(r))for(let{key:f,nodePath:d}of r[u])d.length>0&&i.join(",").startsWith(d.join(","))&&i.includes(f)&&a.push({severity:"error",message:`Cannot reference generic ${n} from ${u.toLowerCase().includes("union")?"union":u}`});return a}}}}};async function opj(e){let t={};return await R5(e,async(r,n)=>{await JW(n,{typeDeclaration:({typeName:i,declaration:a})=>{if(!i.isInlined){let u=R3(i.name);u!=null&&E5(a,{alias:()=>{},enum:()=>{},object:()=>{u.name&&u.arguments&&(t[u.name]=u.arguments.length)},discriminatedUnion:()=>{},undiscriminatedUnion:()=>{}})}}})}),t}var aVf=yu(require("path"),1),wwu={name:"valid-navigation",create:({workspace:e})=>{let t=q8t(mSr(e.definition)),n=q8t(Q8r(e.definition)).reduce((i,a)=>{var f;return(i[f=bg(a)]??(i[f]=new Set)).add(aVf.default.basename(a)),i},{});return{packageMarker:{navigation:(i,{relativeFilepath:a})=>{if(i==null)return[];if(typeof i=="string"){let c=LC(e.definition.absoluteFilePath,ff(e.definition.absoluteFilePath,bg(a),As.of(i)));return t.some(o=>o.startsWith(c))?[]:[{severity:"error",message:`${i} does not exist.`}]}let u=n[bg(a)];if(u==null)throw new Error(`Could not find expected contents of ${a}`);let f=[],d=new Set;for(let c of i)c===Xx?f.push({severity:"error",message:`${Xx} cannot be specified in navigation.`}):u.has(c)?d.has(c)&&f.push({severity:"error",message:`${c} is specified more than once.`}):f.push({severity:"error",message:`Unexpected item: ${c}`}),d.add(c);for(let c of u)d.has(c)||f.push({severity:"error",message:`Missing ${c}`});return f}}}}};var Ibi="$request.",Dwu="$response.";function o8n({typeResolver:e,file:t,endpoint:r,propertyComponents:n,validate:i}){if(r.request==null)return!1;if(typeof r.request=="string"){let a=e.resolveType({type:r.request,file:t});return n6t({typeResolver:e,file:hL(a)??t,resolvedType:a,propertyComponents:n,validate:i})}return upj({typeResolver:e,file:t,requestType:r.request,propertyComponents:n,validate:i})}function upj({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}){if(spj({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}))return!0;if(r.body==null)return!1;if(typeof r.body=="string"){let u=e.resolveType({type:r.body,file:t});return n6t({typeResolver:e,file:hL(u)??t,resolvedType:u,propertyComponents:n,validate:i})}if(EA(r.body))return oVf({typeResolver:e,file:t,objectSchema:r.body,propertyComponents:n,validate:i});let a=e.resolveType({type:r.body.type,file:t});return n6t({typeResolver:e,file:hL(a)??t,resolvedType:e.resolveType({type:r.body.type,file:t}),propertyComponents:n,validate:i})}function spj({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}){if(n.length!==1||typeof r=="string"||r["query-parameters"]==null)return!1;let a=r["query-parameters"][n[0]??""];if(a==null)return!1;let u=e.resolveType({type:typeof a!="string"?a.type:a,file:t});return i({resolvedType:u})}function n6t({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:i}){if(n.length===0)return i({resolvedType:r});let a=sVf(r);return a==null?!1:oVf({typeResolver:e,file:t,objectSchema:a,propertyComponents:n,validate:i})}function dBr({endpoint:e,typeResolver:t,file:r}){var i;let n=typeof e.response!="string"?(i=e.response)==null?void 0:i.type:e.response;if(n!=null)return t.resolveType({type:n,file:r})}function i6t(e){if((e==null?void 0:e._type)==="primitive")return e.primitive.v1;if((e==null?void 0:e._type)==="container"&&e.container._type==="optional")return i6t(e.container.itemType)}function hL(e){if(e!=null){if(e._type==="named")return e.file;if(e._type==="container"&&e.container._type==="optional")return hL(e.container.itemType)}}function u8n(e){let t=cVf(e,Ibi);return t==null?void 0:t.split(".")}function EDa(e){let t=cVf(e,Dwu);return t==null?void 0:t.split(".")}function oVf({typeResolver:e,file:t,objectSchema:r,propertyComponents:n,validate:i}){let a=cpj({typeResolver:e,file:t,objectSchema:r,property:n[0]??""});if(a==null)return!1;let u=e.resolveType({type:a,file:t});return n6t({typeResolver:e,file:hL(u)??t,resolvedType:u,propertyComponents:n.slice(1),validate:i})}function cpj({typeResolver:e,file:t,objectSchema:r,property:n}){return uVf({typeResolver:e,file:t,objectSchema:r})[n]}function uVf({typeResolver:e,file:t,objectSchema:r}){let n=[];typeof r.extends=="string"?n=[r.extends]:Array.isArray(r.extends)&&(n=r.extends);let i={};for(let a of n){let u=lpj({typeResolver:e,file:t,extendedType:a});Object.entries(u).map(([f,d])=>{i[f]=d})}return r.properties!=null&&Object.entries(r.properties).map(([a,u])=>{i[a]=typeof u=="string"?u:u.type}),i}function lpj({typeResolver:e,file:t,extendedType:r}){let n=e.resolveNamedTypeOrThrow({referenceToNamedType:r,file:t});return n._type==="named"&&QE(n.declaration)?uVf({typeResolver:e,file:hL(n)??t,objectSchema:n.declaration}):{}}function sVf(e){if(e!=null){if(e._type==="named"&&QE(e.declaration))return e.declaration;if(e._type==="container"&&e.container._type==="optional")return sVf(e.container.itemType)}}function cVf(e,t){return e.startsWith(t)?e.substring(t.length):null}var Swu=`${Ibi}client_id`,Ewu=`${Ibi}client_secret`,s8n=`${Dwu}access_token`,Mwu=`${Ibi}refresh_token`;function xwu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:i}){return TDa({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"client-id",validate:Rbi}})}function Twu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:i}){return TDa({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"client-secret",validate:Rbi}})}function lVf({endpointId:e,endpoint:t,typeResolver:r,file:n,scopesProperty:i}){return TDa({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"scopes",validate:Rbi}})}function qwu({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:i}){return TDa({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"refresh-token",validate:Rbi}})}function c8n({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,accessTokenProperty:i}){return Cwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"access-token",validate:fVf}})}function MDa({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,refreshTokenProperty:i}){return Cwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"refresh-token",validate:fVf}})}function xDa({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,expiresInProperty:i}){return Cwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"expires-in",validate:fpj}})}function fpj({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return n6t({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:dpj})}function fVf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return n6t({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:Rbi})}function TDa({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:a}){let u=[],f=u8n(i);return f==null?(u.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} must define a dot-delimited '${a.propertyID}' property starting with $request (e.g. $request.${a.propertyID}).`}),u):f.length>1?(u.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} cannot reference nested $request properties like '${i}'; expected '$request.${a.propertyID}' instead.`}),u):(o8n({typeResolver:r,file:n,endpoint:t,propertyComponents:f,validate:a.validate})||u.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} specifies '${a.propertyID}' ${i}, which is not a valid '${a.propertyID}' type.`}),u)}function Cwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:a}){let u=[],f=EDa(i);return f==null&&u.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} must define a dot-delimited '${a.propertyID}' property starting with $response (e.g. $response.${a.propertyID}).`}),f!=null&&!a.validate({typeResolver:t,file:r,resolvedType:n,propertyComponents:f})&&u.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} specifies '${a.propertyID}' ${i}, which is not a valid '${a.propertyID}' type.`}),u}function dpj({resolvedType:e}){return i6t(e)==="INTEGER"}function Rbi({resolvedType:e}){return i6t(e)==="STRING"}function dVf({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshEndpoint:i}){var l,g,O,j;let a=[],u=(l=i["request-properties"])==null?void 0:l["refresh-token"];u!=null?a.push(...qwu({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:u})):qwu({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:Mwu}).length>0&&a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} is missing a valid refresh-token, such as '${Mwu}'.`});let f=dBr({endpoint:t,typeResolver:r,file:n});if(f==null)return a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} must define a response type.`}),a;let d=(g=i["response-properties"])==null?void 0:g["access-token"];d!=null?a.push(...c8n({endpointId:e,typeResolver:r,file:n,resolvedResponseType:f,accessTokenProperty:d})):c8n({endpointId:e,typeResolver:r,file:n,resolvedResponseType:f,accessTokenProperty:s8n}).length>0&&a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} is missing a valid access-token, such as '${s8n}'.`});let c=(O=i==null?void 0:i["response-properties"])==null?void 0:O["expires-in"];c!=null&&a.push(...xDa({endpointId:e,typeResolver:r,file:hL(f)??n,resolvedResponseType:f,expiresInProperty:c}));let o=(j=i==null?void 0:i["response-properties"])==null?void 0:j["refresh-token"];return o!=null&&a.push(...MDa({endpointId:e,typeResolver:r,file:hL(f)??n,resolvedResponseType:f,refreshTokenProperty:o})),a}function pVf({endpointId:e,endpoint:t,typeResolver:r,file:n,tokenEndpoint:i}){var O,j,S,x,A,N;let a=[],u=(O=i["request-properties"])==null?void 0:O["client-id"];u!=null?a.push(...xwu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:u})):xwu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:Swu}).length>0&&a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} is missing a valid client-id, such as '${Swu}'.`});let f=(j=i["request-properties"])==null?void 0:j["client-secret"];f!=null?a.push(...Twu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:f})):Twu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:Ewu}).length>0&&a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} is missing a valid client-secret, such as '${Ewu}'.`});let d=(S=i==null?void 0:i["request-properties"])==null?void 0:S.scopes;d!=null&&a.push(...lVf({endpointId:e,endpoint:t,typeResolver:r,file:n,scopesProperty:d}));let c=dBr({endpoint:t,typeResolver:r,file:n});if(c==null)return a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} must define a response type.`}),a;let o=(x=i["response-properties"])==null?void 0:x["access-token"];o!=null?a.push(...c8n({endpointId:e,typeResolver:r,file:n,resolvedResponseType:c,accessTokenProperty:o})):c8n({endpointId:e,typeResolver:r,file:n,resolvedResponseType:c,accessTokenProperty:s8n}).length>0&&a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} is missing a valid access-token, such as '${s8n}'.`});let l=(A=i==null?void 0:i["response-properties"])==null?void 0:A["expires-in"];l!=null&&a.push(...xDa({endpointId:e,typeResolver:r,file:hL(c)??n,resolvedResponseType:c,expiresInProperty:l}));let g=(N=i==null?void 0:i["response-properties"])==null?void 0:N["refresh-token"];return g!=null&&a.push(...MDa({endpointId:e,typeResolver:r,file:hL(c)??n,resolvedResponseType:c,refreshTokenProperty:g})),a}var Awu={name:"valid-oauth",create:({workspace:e})=>{let t=new CM(e),r=new yrn(e),n=aEr({casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents});return{rootApiFile:{oauth:async({name:i,oauth:a},{relativeFilepath:u})=>{var l;let f=[],d=a["get-token"].endpoint,c=await r.resolveEndpoint({endpoint:d,file:n});c==null?f.push({severity:"error",message:`Failed to resolve endpoint ${d}`}):f.push(...pVf({endpointId:c.endpointId,endpoint:c.endpoint,typeResolver:t,file:c.file,tokenEndpoint:a["get-token"]}));let o=(l=a["refresh-token"])==null?void 0:l.endpoint;if(a["refresh-token"]!=null&&o!=null){let g=await r.resolveEndpoint({endpoint:o,file:n});g==null?f.push({severity:"error",message:`Failed to resolve endpoint ${d}`}):f.push(...dVf({endpointId:g.endpointId,endpoint:g.endpoint,typeResolver:t,file:g.file,refreshEndpoint:a["refresh-token"]}))}return f}}}}};function qDa({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,resultsProperty:i}){return Nwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"results",validate:ppj}})}function Fbi({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:a}){let u=[],f=u8n(i);return f==null?(u.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} must define a dot-delimited '${a.propertyID}' property starting with $request (e.g. $request.${a.propertyID}).`}),u):(o8n({typeResolver:r,file:n,endpoint:t,propertyComponents:f,validate:a.validate})||u.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} specifies '${a.propertyID}' ${i}, which is not a valid '${a.propertyID}' type.`}),u)}function Nwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:a}){let u=[],f=EDa(i);return f==null&&u.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} must define a dot-delimited '${a.propertyID}' property starting with $response (e.g. $response.${a.propertyID}).`}),f!=null&&!a.validate({typeResolver:t,file:r,resolvedType:n,propertyComponents:f})&&u.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} specifies '${a.propertyID}' ${i}, which is not a valid '${a.propertyID}' type.`}),u}function ppj({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return n6t({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:_pj})}function _pj({resolvedType:e}){return!0}function _Vf({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}){let a=[];a.push(...hpj({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}));let u=dBr({endpoint:t,typeResolver:r,file:n});return u==null?(a.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} must define a response type.`}),a):(a.push(...ypj({endpointId:e,typeResolver:r,file:hL(u)??n,resolvedResponseType:u,nextProperty:i.next_cursor})),a.push(...qDa({endpointId:e,typeResolver:r,file:hL(u)??n,resolvedResponseType:u,resultsProperty:i.results})),a)}function hpj({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}){return Fbi({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.cursor,propertyValidator:{propertyID:"cursor",validate:hVf}})}function ypj({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,nextProperty:i}){return Nwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"next_cursor",validate:vpj}})}function vpj({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return n6t({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:hVf})}function hVf({resolvedType:e}){let t=i6t(e);return t==null?!1:t!=="BOOLEAN"}function yVf(e){return e.split(".").slice(1)}function vVf({path:e,typeResolver:t,file:r,resolvedType:n,validate:i}){let a=n;for(let u of e){if(a==null)return i({resolvedType:void 0});let f=mVf(a);if(f==null)return i({resolvedType:void 0});let c=bVf({typeResolver:t,file:r,objectSchema:f})[u];if(c==null)return i({resolvedType:void 0});a=t.resolveType({type:c,file:r})}return i({resolvedType:a})}function bVf({typeResolver:e,file:t,objectSchema:r}){let n=[];typeof r.extends=="string"?n=[r.extends]:Array.isArray(r.extends)&&(n=r.extends);let i={};for(let a of n){let u=bpj({typeResolver:e,file:t,extendedType:a});Object.entries(u).map(([f,d])=>{i[f]=d})}return r.properties!=null&&Object.entries(r.properties).map(([a,u])=>{i[a]=typeof u=="string"?u:u.type}),i}function bpj({typeResolver:e,file:t,extendedType:r}){let n=e.resolveNamedTypeOrThrow({referenceToNamedType:r,file:t});return n._type==="named"&&QE(n.declaration)?bVf({typeResolver:e,file:gVf(n)??t,objectSchema:n.declaration}):{}}function gVf(e){if(e!=null){if(e._type==="named")return e.file;if(e._type==="container"&&e.container._type==="optional")return gVf(e.container.itemType)}}function mVf(e){if(e!=null){if(e._type==="named"&&QE(e.declaration))return e.declaration;if(e._type==="container"&&e.container._type==="optional")return mVf(e.container.itemType)}}function OVf({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){let a=[];a.push(...gpj({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i})),a.push(...mpj({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}));let u=dBr({endpoint:t,typeResolver:r,file:n});return u==null?(a.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} must define a response type.`}),a):(a.push(...qDa({endpointId:e,typeResolver:r,file:hL(u)??n,resolvedResponseType:u,resultsProperty:i.results})),a.push(...Opj({endpointId:e,resolvedResponseType:u,typeResolver:r,file:hL(u)??n,offsetPagination:i})),a)}function gpj({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){return Fbi({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.offset,propertyValidator:{propertyID:"offset",validate:PVf}})}function mpj({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){return i.step==null?[]:Fbi({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.step,propertyValidator:{propertyID:"step",validate:PVf}})}function PVf({resolvedType:e}){let t=i6t(e);return t==null?!1:t==="INTEGER"||t==="LONG"||t==="DOUBLE"}function Opj({resolvedResponseType:e,typeResolver:t,file:r,offsetPagination:n}){return n["has-next-page"]==null?[]:vVf({typeResolver:t,file:r,path:yVf(n["has-next-page"]),resolvedType:e,validate:({resolvedType:i})=>i6t(i)!=="BOOLEAN"?[{message:`"has-next-page" selector, ${n["has-next-page"]}, does not point to a boolean property`,severity:"error"}]:[]})}var zwu={name:"valid-pagination",create:({workspace:e})=>{let t=new CM(e),r=e.definition.rootApiFile.contents.pagination;return{definitionFile:{httpEndpoint:({endpointId:n,endpoint:i},{relativeFilepath:a,contents:u})=>{let f=typeof i.pagination=="boolean"?r:i.pagination;if(!f)return[];let d=jO({relativeFilepath:a,definitionFile:u,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents});return Ppj(f)?_Vf({endpointId:n,endpoint:i,typeResolver:t,file:d,cursorPagination:f}):OVf({endpointId:n,endpoint:i,typeResolver:t,file:d,offsetPagination:f})}}}}};function Ppj(e){return e.cursor!=null&&e.next_cursor!=null&&e.results!=null}var Bwu={name:"valid-service-urls",create:({workspace:e})=>{let t=jDa(e),r=n=>{var i;return t.includes(n)?[]:t.length===0&&((i=e.definition.rootApiFile.contents)==null?void 0:i["default-url"])!=null?[]:t.length===0?[{severity:"error",message:`"url" cannot be configured unless you specify multiple URLs for each environment in ${fB}`}]:[{severity:"error",message:[`URL ${al.bold(n)} is not recognized. Please add it to your environments in ${fB} or specify one of the configured environment URLs:`,...t.map(a=>` - ${a}`)].join(`
1954
+ `);u.push({severity:"error",message:A})}}}}}}),u}}}}};function KUf(e,t){var n;let r={};for(let i of e)r[n=t(i)]??(r[n]=0),r[t(i)]++;return Object.entries(r).reduce((i,[a,u])=>(u>1&&i.push(a),i),[])}var ewu={name:"no-error-status-code-conflict",create:async({workspace:e})=>{var r;if(((r=e.definition.rootApiFile.contents["error-discrimination"])==null?void 0:r.strategy)!=="status-code")return{};let t=await Xdj(e);return{definitionFile:{httpEndpoint:async({endpoint:n})=>{var u;if(n.errors==null)return[];let i={};for(let f of n.errors){let d=typeof f=="string"?f:f.error,c=t[d];if(c==null)continue;let o=c["status-code"];o in i?(u=i[o])==null||u.push(d):i[o]=[d]}let a=[];for(let[f,d]of Object.entries(i))d.length>1&&a.push({severity:"error",message:`Multiple errors have status-code ${f}: ${d.join(", ")}`});return a}}}}};async function Xdj(e){let t={};return await R5(e,async(r,n)=>{await JW(n,{typeName:Qqt,errorDeclaration:({errorName:i,declaration:a})=>{t[i]=a},httpService:Qqt})}),t}var twu={name:"no-extensions-with-file-upload",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.request==null)return[];let t=gZr(e.request);return(t==null?void 0:t.extends)==null?[]:[{severity:"error",message:"Request body extensions are not supported for file-upload requests."}]}}})};var rwu={name:"no-get-request-body",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>e.method==="GET"&&yGo(e)!=null?[{severity:"error",message:"Endpoint is a GET, so it cannot have a request body."}]:[]}})};var nwu={name:"no-missing-auth",create:e=>{let t=e.workspace.definition.rootApiFile.contents.auth!=null;return{definitionFile:{httpService:r=>r.auth&&!t?[{severity:"error",message:"Service requires auth, but no auth is defined."}]:[],httpEndpoint:({endpoint:r})=>r.auth!=null&&r.auth&&!t?[{severity:"error",message:"Endpoint requires auth, but no auth is defined."}]:[]}}}};var iwu={name:"no-missing-error-discriminant",create:async({workspace:e})=>Qdj(e)?{rootApiFile:{errorDiscrimination:t=>t!=null?[]:[{severity:"error",message:"error-discrimination is required because this API has declared errors."}]}}:{}};function Qdj(e){for(let t of Object.values(Q8r(e.definition)))if(t.contents.errors!=null&&!oFo(t.contents.errors))return!0;return!1}var awu={name:"no-missing-request-name",create:()=>({definitionFile:{httpEndpoint:({endpoint:e,service:t})=>{var r;if(typeof e.request!="string"&&((r=e.request)==null?void 0:r.name)!=null)return[];if(e.request!=null&&typeof e.request!="string"){if(e.request.body!=null&&EA(e.request.body))return[{severity:"error",message:"Request name is required because request body is defined inline"}];if(e.request["query-parameters"]!=null&&I8t(e.request["query-parameters"])>0)return[{severity:"error",message:"Request name is required because request has query parameters"}];if(I8t(e.request.headers)>0)return[{severity:"error",message:"Request name is required because request has headers"}]}return I8t(t.headers)>0?[{severity:"error",message:"Request name is required because service has headers"}]:[]}}})};var owu={name:"no-object-single-property-key",create:({workspace:e})=>{let t=new CM(e);return{definitionFile:{typeDeclaration:({declaration:r},{relativeFilepath:n,contents:i})=>{let a=[];if(!eNr(r))return a;let u=({discriminantValue:f,singleUnionType:d})=>{let c=typeof d!="string"&&d.key!=null,o=typeof d=="string"?d:d.type;return typeof o!="string"||c?typeof o!="string"&&c?[{severity:"error",message:`Union variant ${f} has no type, so "key" cannot be defined`}]:[]:t.resolveType({type:o,file:jO({relativeFilepath:n,definitionFile:i,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents})})==null?[]:[]};for(let[f,d]of Object.entries(r.union))a.push(...u({discriminantValue:f,singleUnionType:d}));return a}}}}};var uwu={name:"no-response-property",create:({workspace:e})=>{let t=new CM(e);return{definitionFile:{httpEndpoint:({endpoint:r},{relativeFilepath:n,contents:i})=>{let{response:a}=r;if(a==null)return[];let u=typeof a=="string"?a:a.type;if(NTe(u)!=null)return[];if(ili(u)!=null)return[];let f=typeof a!="string"?a.property:void 0;if(f==null)return[];let d=jO({relativeFilepath:n,definitionFile:i,rootApiFile:e.definition.rootApiFile.contents,casingsGenerator:xx}),c=t.resolveTypeOrThrow({type:typeof a!="string"?a.type:a,file:d}),o=YUf(c,f,d,t);return Zdj(o,f)}}}}},qFt;(function(e){e[e.ContainsProperty=0]="ContainsProperty",e[e.DoesNotContainProperty=1]="DoesNotContainProperty",e[e.IsNotObject=2]="IsNotObject"})(qFt||(qFt={}));function Zdj(e,t){switch(e){case qFt.ContainsProperty:return[];case qFt.DoesNotContainProperty:return[{severity:"error",message:`Response does not have a property named ${t}.`}];case qFt.IsNotObject:return[{severity:"error",message:"Response must be an object in order to return a property as a response."}]}}function YUf(e,t,r,n){switch(e._type){case"container":return e.container._type!=="optional"?qFt.IsNotObject:YUf(e.container.itemType,t,r,n);case"named":return QUf(e.declaration)?kdj(e.declaration,t,r,n)?qFt.ContainsProperty:qFt.DoesNotContainProperty:qFt.IsNotObject;case"primitive":case"unknown":return qFt.IsNotObject;default:dl(e)}}function kdj(e,t,r,n){return XUf(e,r,n).has(t)}function XUf(e,t,r){let n=[];typeof e.extends=="string"?n=[e.extends]:Array.isArray(e.extends)&&(n=e.extends);let i=new Set;for(let a of n)for(let u of epj(a,t,r))i.add(u);for(let a of Object.keys(e.properties??{}))i.add(a);return i}function epj(e,t,r){let n=r.resolveNamedTypeOrThrow({referenceToNamedType:e,file:t});return n._type==="named"&&QUf(n.declaration)?XUf(n.declaration,t,r):new Set}function QUf(e){return e.extends!=null||e.properties!=null}var swu={name:"no-undefined-error-reference",create:async({workspace:e})=>{let t=await tpj(e);function r(i,a){let u=t[a];return u==null?!1:u.has(i)}let n=(i,a,u)=>{let f=dwe({reference:i,referencedIn:a,imports:cy(u.imports??{},As.of)});return f!=null&&r(f.typeName,f.relativeFilepath)?[]:[{severity:"error",message:"Error is not defined."}]};return{rootApiFile:{errorReference:(i,{relativeFilepath:a,contents:u})=>n(i,a,u)},definitionFile:{errorReference:(i,{relativeFilepath:a,contents:u})=>n(i,a,u)}}}};async function tpj(e){let t={};return await R5(e,async(r,n)=>{let i=new Set;t[r]=i,await JW(n,{errorDeclaration:({errorName:a})=>{i.add(a)}})}),t}var cwu={name:"no-undefined-example-reference",create:async({workspace:e})=>{let t=new _we(new CM(e));return{definitionFile:{exampleTypeReference:(r,{relativeFilepath:n,contents:i})=>t.parseExampleReference(r)==null?[{severity:"error",message:`Example ${al.bold(r)} is malformed. Examples should be formatted like ${al.bold("$YourType.ExampleName")}`}]:t.resolveExample({example:r,file:jO({relativeFilepath:n,definitionFile:i,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents})})!=null?[]:[{severity:"error",message:`Example ${al.bold(r)} is not defined.`}]}}}};var fwu={name:"no-undefined-path-parameters",create:()=>({rootApiFile:{file:e=>e["base-path"]==null?[]:lwu({path:e["base-path"],pathParameters:e["path-parameters"]??{},pathType:"file"})},definitionFile:{httpService:e=>lwu({path:e["base-path"],pathParameters:e["path-parameters"]??{},pathType:"service"}),httpEndpoint:({endpoint:e})=>lwu({path:e["base-path"]!=null?Jw(e["base-path"],e.path):e.path,pathParameters:e["path-parameters"]!=null?e["path-parameters"]:{},pathType:"endpoint"})}})};function lwu({path:e,pathParameters:t,pathType:r}){let n=[],i=new Set;k2e(e).parts.forEach(c=>{i.has(c.pathParameter)&&n.push({severity:"error",message:`${jui(r)} has duplicate path parameter: ${al.bold(c.pathParameter)}.`}),i.add(c.pathParameter)});let u=new Set(Object.keys(t));return ZUf(i,u).forEach(c=>{n.push({severity:"error",message:`${jui(r)} has missing path-parameter: ${al.bold(c)}.`})}),ZUf(u,i).forEach(c=>{n.push({severity:"error",message:`Path parameter is unreferenced in ${r}: ${al.bold(c)}.`})}),n}function ZUf(e,t){return new Set([...e].filter(r=>!t.has(r)))}var dwu={name:"no-undefined-type-reference",create:async({workspace:e})=>{let t=await rpj(e);function r(i){if(i.parsed==null)return!1;let a=t[i.parsed.relativeFilepath];if(a==null)return!1;let u=R3(i.parsed.typeName);return u!=null?u.name?a.has(u.name):!1:a.has(i.parsed.typeName)}function n(i,a){var u,f,d;if(a!=null){let c=[...a];for(;c.length>0;){let o=c.pop(),l=o?typeof o=="string"?R3(o):R3(o.key):void 0;if(l!=null)return((u=i.parsed)==null?void 0:u.typeName)&&((d=l.arguments)==null?void 0:d.includes((f=i.parsed)==null?void 0:f.typeName))}}return!1}return{definitionFile:{typeReference:({typeReference:i,location:a,nodePath:u},{relativeFilepath:f,contents:d})=>{let c=NTe(i);if(c!=null){if(a===$W.InlinedRequestProperty)return[];if(a===$W.Response)return c.isOptional?[{severity:"error",message:"File response cannot be optional"}]:[]}return k3r(i)!=null?a===$W.RequestReference?[]:[{severity:"error",message:"The bytes type can only be used as a request"}]:d2n(i)?a===$W.StreamingResponse?[]:a===$W.Response?[]:[{severity:"error",message:"The text type can only be used as a response or response-stream."}]:npj({type:i,relativeFilepath:f,imports:cy(d.imports??{},As.of)}).reduce((g,O)=>{var j,S,x;return((j=O.parsed)==null?void 0:j.typeName)!=null&&NTe(O.parsed.typeName)!=null?g.push({severity:"error",message:"The file type can only be used as properties in inlined requests."}):((S=O.parsed)==null?void 0:S.typeName)!=null&&d2n(O.parsed.typeName)?g.push({severity:"error",message:"The text type can only be used as a response-stream or response."}):!r(O)&&!n(O,u)&&g.push({severity:"error",message:`Type ${al.bold(((x=O.parsed)==null?void 0:x.typeName)??O.fullyQualifiedName)} is not defined.`}),g},[])}}}}};async function rpj(e){let t={};return await R5(e,async(r,n)=>{let i=new Set;t[r]=i,await JW(n,{typeDeclaration:({typeName:a})=>{if(!a.isInlined){let u=R3(a.name);u!=null&&u.name&&i.add(u.name),i.add(a.name)}}})}),t}function npj({type:e,relativeFilepath:t,imports:r}){return $J({type:e,_default:void 0,validation:void 0,visitor:{primitive:()=>[],unknown:()=>[],map:({keyType:n,valueType:i})=>[...n,...i],list:n=>n,set:n=>n,optional:n=>n,literal:()=>[],named:n=>{let i=dwe({reference:n,referencedIn:t,imports:r});return[{fullyQualifiedName:n,parsed:i!=null?{typeName:i.typeName,relativeFilepath:i.relativeFilepath}:void 0}]}}})}var pwu={name:"no-undefined-variable-reference",create:async({workspace:e})=>{let t=new rqe,r=(n,i)=>n.startsWith(rqe.VARIABLE_PREFIX)?t.getDeclaration(n,i)?[]:[{severity:"error",message:`Variable ${n} is not defined.`}]:[{severity:"error",message:`Variable reference must start with ${rqe.VARIABLE_PREFIX}`}];return{rootApiFile:{variableReference:n=>r(n,aEr({casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}))},definitionFile:{variableReference:(n,{relativeFilepath:i,contents:a})=>r(n,jO({casingsGenerator:xx,relativeFilepath:i,definitionFile:a,rootApiFile:e.definition.rootApiFile.contents}))}}}};var _wu={name:"no-unused-generic",create:async({workspace:e})=>{let t=new Set;return await R5(e,async(r,n)=>{await JW(n,{typeDeclaration:i=>{E5(i.declaration,{alias:a=>{let u=R3(typeof a=="string"?a:a.type);if(u!=null&&u.name){let[f,d,...c]=u.name.split("."),o=d??f;o&&t.add(o)}},enum:()=>{},object:()=>{},discriminatedUnion:()=>{},undiscriminatedUnion:()=>{}})}})}),{definitionFile:{typeName:r=>{let n=R3(r);return n==null?[]:n.name&&t.has(n.name)?[]:[{severity:"error",message:`Generic "${r}" is declared but never used.`}]}}}}};var hwu={name:"only-object-extensions",create:({workspace:e})=>{let t=new CM(e);return{definitionFile:{extension:(r,{relativeFilepath:n,contents:i})=>{let a=t.resolveNamedType({referenceToNamedType:r,file:jO({relativeFilepath:n,definitionFile:i,rootApiFile:e.definition.rootApiFile.contents,casingsGenerator:xx})});return a==null?[]:a._type==="named"&&QE(a.declaration)?[]:[{severity:"error",message:`Objects can only extend other objects, and ${r} is not an object.`}]}}}}};var ywu={name:"valid-base-path",create:()=>({rootApiFile:{file:e=>e["base-path"]!=null?kUf(e["base-path"]):[]},definitionFile:{httpService:e=>kUf(e["base-path"])}})};function kUf(e){if(e==="/"||e.length===0)return[];let t=[];return e.startsWith("/")||t.push({severity:"error",message:"base-path must be empty or start with a slash."}),t}var vwu={name:"valid-default-environment",create:({workspace:e})=>{let t=e.definition.rootApiFile.contents.environments;return{rootApiFile:{defaultEnvironment:r=>r!=null&&(t==null||!Object.keys(t).includes(r))?[{severity:"error",message:`The default-environment ${r} is not listed as an environment`}]:t!=null&&r===void 0?[{severity:"error",message:"Please specify a default-environment. If no default, use null"}]:[]}}}};var bwu={name:"valid-endpoint-path",create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.path==="")return[];let t=[];return e.path.startsWith("/")||t.push({severity:"error",message:"Path must start with a slash."}),t}}})};function SDa({allDeclarations:e={},examples:t,parameterDisplayName:r,typeResolver:n,exampleResolver:i,workspace:a,getRawType:u,breadcrumbs:f}){let d=[],c=Object.entries(e).reduce((o,[l,g])=>{let O=u(g);if(O!=null){let j=n.resolveType({type:O.rawType,file:O.file});j!=null&&j._type==="container"&&j.container._type==="optional"||(j==null?void 0:j._type)==="unknown"||o.push(l)}return o},[]);for(let o of c)(t==null?void 0:t[o])==null&&d.push({severity:"error",message:`Example is missing required ${r} "${o}"`});if(t!=null)for(let[o,l]of Object.entries(t)){let g=e[o];if(g==null)d.push({severity:"error",message:`Unexpected ${r} "${o}"`});else{let O=u(g);O!=null&&d.push(...TG.validateTypeReferenceExample({rawTypeReference:O.rawType,example:l,file:O.file,workspace:a,typeResolver:n,exampleResolver:i,breadcrumbs:f}).map(j=>({severity:"error",message:j.message})))}}return d}function eVf({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a}){var d;let u=[],f=typeof t.request!="string"?(d=t.request)==null?void 0:d.body:t.request;return f==null?e!=null&&u.push({severity:"error",message:"Unexpected request in example."}):EA(f)?u.push(...TG.validateObjectExample({typeName:void 0,typeNameForBreadcrumb:"<Inlined Request>",rawObject:{extends:f.extends,properties:f.properties??{}},file:i,typeResolver:r,exampleResolver:n,workspace:a,example:e,breadcrumbs:["request"]}).map(c=>({severity:"error",message:c.message}))):u.push(...TG.validateTypeReferenceExample({rawTypeReference:typeof f=="string"?f:f.type,example:e,file:i,workspace:a,typeResolver:r,exampleResolver:n,breadcrumbs:["response","body"]}).map(c=>({severity:"error",message:c.message}))),u}function rVf({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a,errorResolver:u}){return e==null?tVf({example:{},endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a,errorResolver:u}):mZr(t,e,{body:f=>tVf({example:f,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a,errorResolver:u}),stream:f=>ipj({example:f,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a}),events:f=>apj({example:f,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a})})}function tVf({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a,errorResolver:u}){let f=[];if(e.error==null)t.response!=null?f.push(...TG.validateTypeReferenceExample({rawTypeReference:typeof t.response!="string"?t.response.type:t.response,example:e.body,typeResolver:r,exampleResolver:n,file:i,workspace:a,breadcrumbs:["response","body"]}).map(d=>({severity:"error",message:d.message}))):e.body!=null&&f.push({severity:"error",message:`Unexpected response in example. If you're adding an example of an error response, set the "error" property to the error's name`});else{let d=u.getDeclaration(e.error,i);d!=null&&(t.errors!=null&&t.errors.some(o=>(typeof o!="string"?o.error:o)===e.error)||f.push({severity:"error",message:`${al.bold(e.error)} is not specified as an allowed error for this endpoint. Add ${al.bold(e.error)} to the endpoint's "errors" list.`}),d.declaration.type!=null?f.push(...TG.validateTypeReferenceExample({rawTypeReference:d.declaration.type,example:e.body,typeResolver:r,exampleResolver:n,file:d.file,workspace:a,breadcrumbs:["response","body"]}).map(o=>({severity:"error",message:o.message}))):e.body!=null&&f.push({severity:"error",message:`Unexpected response in example. ${al.bold(e.error)} does not have a body.`}))}return f}function ipj({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a}){let u=[];if(t["response-stream"]==null)u.push({severity:"error",message:"Unexpected streaming response in example. Endpoint's schema is missing `response-stream` key."});else if(typeof t["response-stream"]=="string"||t["response-stream"].format==null||t["response-stream"].format==="json")for(let f of e.stream)u.push(...TG.validateTypeReferenceExample({rawTypeReference:typeof t["response-stream"]!="string"?t["response-stream"].type:t["response-stream"],example:f,typeResolver:r,exampleResolver:n,file:i,workspace:a,breadcrumbs:["response","body"]}).map(d=>({severity:"error",message:d.message})));else u.push({severity:"error",message:"Endpoint response expects server-sent events (`response-stream.format: sse`), but the provided example is a regular stream. Use the `events` key to provide an list of server-sent event examples."});return u}function apj({example:e,endpoint:t,typeResolver:r,exampleResolver:n,file:i,workspace:a}){let u=[];if(t["response-stream"]==null)u.push({severity:"error",message:"Unexpected streaming response in example. Endpoint's schema is missing `response-stream` key."});else if(typeof t["response-stream"]!="string"&&t["response-stream"].format==="sse")for(let f of e.stream)u.push(...TG.validateTypeReferenceExample({rawTypeReference:typeof t["response-stream"]!="string"?t["response-stream"].type:t["response-stream"],example:f.data,typeResolver:r,exampleResolver:n,file:i,workspace:a,breadcrumbs:["response","body"]}).map(d=>({severity:"error",message:d.message})));else u.push({severity:"error",message:"Endpoint response expects a regular stream, but the provided example is a server-sent event. Use the `stream` key to provide a list of stream examples."});return u}var gwu={name:"valid-example-endpoint-call",create:({workspace:e})=>{let t=new CM(e),r=new vrn(e),n=new _we(t),i=new rqe;return{definitionFile:{exampleHeaders:({service:a,endpoint:u,examples:f},{relativeFilepath:d,contents:c})=>{var o;return SDa({allDeclarations:{...a.headers,...typeof u.request!="string"?(o=u.request)==null?void 0:o.headers:void 0},examples:f,parameterDisplayName:"header",typeResolver:t,exampleResolver:n,workspace:e,getRawType:l=>({file:jO({relativeFilepath:d,definitionFile:c,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),rawType:typeof l=="string"?l:l.type}),breadcrumbs:["headers"]})},examplePathParameters:({service:a,endpoint:u,examples:f},{relativeFilepath:d,contents:c})=>SDa({allDeclarations:u["base-path"]!=null?{...u["path-parameters"]}:{...e.definition.rootApiFile.contents["path-parameters"],...a["path-parameters"],...u["path-parameters"]},examples:f,parameterDisplayName:"path parameter",typeResolver:t,exampleResolver:n,workspace:e,getRawType:o=>cja({parameter:o,variableResolver:i,file:jO({relativeFilepath:d,definitionFile:c,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents})}),breadcrumbs:["path-parameters"]}),exampleQueryParameters:({endpoint:a,examples:u},{relativeFilepath:f,contents:d})=>{var c;return SDa({allDeclarations:typeof a.request!="string"?(c=a.request)==null?void 0:c["query-parameters"]:void 0,examples:u,parameterDisplayName:"query parameter",typeResolver:t,exampleResolver:n,workspace:e,getRawType:o=>({file:jO({relativeFilepath:f,definitionFile:d,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),rawType:typeof o=="string"?o:o.type}),breadcrumbs:["query-parameters"]})},exampleRequest:({endpoint:a,example:u},{relativeFilepath:f,contents:d})=>eVf({example:u,endpoint:a,typeResolver:t,exampleResolver:n,file:jO({relativeFilepath:f,definitionFile:d,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),workspace:e}),exampleResponse:({endpoint:a,example:u},{relativeFilepath:f,contents:d})=>rVf({example:u,endpoint:a,typeResolver:t,exampleResolver:n,file:jO({relativeFilepath:f,definitionFile:d,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),workspace:e,errorResolver:r})}}}};var mwu={name:"valid-example-error",create:({workspace:e})=>{let t=new CM(e),r=new _we(t);return{definitionFile:{exampleError:({errorName:n,declaration:i,example:a},{relativeFilepath:u,contents:f})=>i.type==null?[]:TG.validateTypeReferenceExample({rawTypeReference:i.type,example:a.value,file:jO({relativeFilepath:u,definitionFile:f,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),workspace:e,typeResolver:t,exampleResolver:r,breadcrumbs:["response","body"]}).map(c=>({severity:"error",message:c.message}))}}}};var Owu={name:"valid-example-type",create:({workspace:e})=>{let t=new CM(e),r=new _we(t);return{definitionFile:{exampleType:({typeName:n,typeDeclaration:i,example:a},{relativeFilepath:u,contents:f})=>TG.validateTypeExample({typeName:n,typeDeclaration:i,example:a.value,file:jO({relativeFilepath:u,definitionFile:f,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),typeResolver:t,exampleResolver:r,workspace:e,breadcrumbs:[]}).map(c=>({severity:"error",message:c.message}))}}}};function nVf(e){let t=[];return e.enum.forEach(r=>{let n=dNn(r);PDa.test(n.name)||(n.wasExplicitlySet?t.push({severity:"error",message:`Enum name ${al.bold(n.name)} is not suitable for code generation. It must start with a letter and only contain letters, numbers, and underscores.`}):t.push({severity:"error",message:`Enum value ${al.bold(n.name)} is not suitable for code generation. Add a "name" property that starts with a letter and contains only letters, numbers, and underscores.`}))}),t}function iVf(e){let t=[],r=Hzr(e);return PDa.test(r.name)||(r.wasExplicitlySet?t.push({severity:"error",message:`Discriminant name ${al.bold(r.name)} is not suitable for code generation. It must start with a letter and only contain letters, numbers, and underscores.`}):t.push({severity:"error",message:`Discriminant value ${al.bold(r.name)} is not suitable for code generation. Add a "name" property that starts with a letter and contains only letters, numbers, and underscores.`})),t}var Pwu={name:"valid-field-names",create:()=>({definitionFile:{typeDeclaration:({declaration:e})=>E5(e,{alias:()=>[],enum:nVf,object:()=>[],undiscriminatedUnion:()=>[],discriminatedUnion:iVf})}})};var jwu={name:"valid-generic",create:async({workspace:e})=>{let t=await opj(e),r={object:[],discriminatedUnion:[]};return{definitionFile:{typeDeclaration:({typeName:n,declaration:i,nodePath:a})=>{let u=[];return n.isInlined||R3(n.name)!=null&&(E5(i,{alias:()=>!1,enum:()=>!1,object:()=>!0,discriminatedUnion:()=>!1,undiscriminatedUnion:()=>!1})||u.push({severity:"error",message:"Generics are only supported for object declarations"})),E5(i,{alias:f=>{let d=typeof f=="string"?f:f.type,c=R3(d);if(c!=null){let[o,l,...g]=c.name.split("."),O=l??o;O&&O in t&&t[O]!==c.arguments.length&&u.push({severity:"error",message:`Generic ${O} expects ${t[O]} arguments, but received ${c.arguments.length} <${c.arguments.join(",")}>`})}else d in t&&u.push({severity:"error",message:`Generic ${d} expects ${t[d]} arguments, but received none`})},enum:f=>{typeof f!="string"&&f.enum.forEach(d=>{let c=typeof d=="string"?d:d.value;jTe(c)&&u.push({severity:"error",message:`Cannot reference generic ${c} from enum`})})},object:f=>{Object.entries((f==null?void 0:f.properties)??{}).forEach(([d,c])=>{jTe(typeof c=="string"?c:c.type)&&(a?(r.object??(r.object=[])).push({key:d,nodePath:a}):u.push({severity:"error",message:`Cannot reference generic ${c} from object property ${d}`}))})},discriminatedUnion:f=>{Object.entries(f.union).forEach(([d,c])=>{let o=typeof c=="string"?c:typeof c.type=="string"?c.type:void 0;o&&jTe(o)&&(a?(r.discriminatedUnion??(r.discriminatedUnion=[])).push({key:d,nodePath:a}):u.push({severity:"error",message:`Cannot reference generic ${c} from union property ${d}`}))})},undiscriminatedUnion:f=>{f.union.forEach(d=>{let c=typeof d=="string"?d:d.type;jTe(c)&&u.push({severity:"error",message:`Cannot reference generic ${c} from union`})})}}),u},typeReference:({typeReference:n,nodePath:i})=>{let a=[];if(i)for(let u of Object.keys(r))for(let{key:f,nodePath:d}of r[u])d.length>0&&i.join(",").startsWith(d.join(","))&&i.includes(f)&&a.push({severity:"error",message:`Cannot reference generic ${n} from ${u.toLowerCase().includes("union")?"union":u}`});return a}}}}};async function opj(e){let t={};return await R5(e,async(r,n)=>{await JW(n,{typeDeclaration:({typeName:i,declaration:a})=>{if(!i.isInlined){let u=R3(i.name);u!=null&&E5(a,{alias:()=>{},enum:()=>{},object:()=>{u.name&&u.arguments&&(t[u.name]=u.arguments.length)},discriminatedUnion:()=>{},undiscriminatedUnion:()=>{}})}}})}),t}var aVf=yu(require("path"),1),wwu={name:"valid-navigation",create:({workspace:e})=>{let t=q8t(mSr(e.definition)),n=q8t(Q8r(e.definition)).reduce((i,a)=>{var f;return(i[f=bg(a)]??(i[f]=new Set)).add(aVf.default.basename(a)),i},{});return{packageMarker:{navigation:(i,{relativeFilepath:a})=>{if(i==null)return[];if(typeof i=="string"){let c=LC(e.definition.absoluteFilePath,ff(e.definition.absoluteFilePath,bg(a),As.of(i)));return t.some(o=>o.startsWith(c))?[]:[{severity:"error",message:`${i} does not exist.`}]}let u=n[bg(a)];if(u==null)throw new Error(`Could not find expected contents of ${a}`);let f=[],d=new Set;for(let c of i)c===Xx?f.push({severity:"error",message:`${Xx} cannot be specified in navigation.`}):u.has(c)?d.has(c)&&f.push({severity:"error",message:`${c} is specified more than once.`}):f.push({severity:"error",message:`Unexpected item: ${c}`}),d.add(c);for(let c of u)d.has(c)||f.push({severity:"error",message:`Missing ${c}`});return f}}}}};var Ibi="$request.",Dwu="$response.";function o8n({typeResolver:e,file:t,endpoint:r,propertyComponents:n,validate:i}){if(r.request==null)return!1;if(typeof r.request=="string"){let a=e.resolveType({type:r.request,file:t});return n6t({typeResolver:e,file:hL(a)??t,resolvedType:a,propertyComponents:n,validate:i})}return upj({typeResolver:e,file:t,requestType:r.request,propertyComponents:n,validate:i})}function upj({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}){if(spj({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}))return!0;if(r.body==null)return!1;if(typeof r.body=="string"){let u=e.resolveType({type:r.body,file:t});return n6t({typeResolver:e,file:hL(u)??t,resolvedType:u,propertyComponents:n,validate:i})}if(EA(r.body))return oVf({typeResolver:e,file:t,objectSchema:r.body,propertyComponents:n,validate:i});let a=e.resolveType({type:r.body.type,file:t});return n6t({typeResolver:e,file:hL(a)??t,resolvedType:e.resolveType({type:r.body.type,file:t}),propertyComponents:n,validate:i})}function spj({typeResolver:e,file:t,requestType:r,propertyComponents:n,validate:i}){if(n.length!==1||typeof r=="string"||r["query-parameters"]==null)return!1;let a=r["query-parameters"][n[0]??""];if(a==null)return!1;let u=e.resolveType({type:typeof a!="string"?a.type:a,file:t});return i({resolvedType:u})}function n6t({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:i}){if(n.length===0)return i({resolvedType:r});let a=sVf(r);return a==null?!1:oVf({typeResolver:e,file:t,objectSchema:a,propertyComponents:n,validate:i})}function dBr({endpoint:e,typeResolver:t,file:r}){var i;let n=typeof e.response!="string"?(i=e.response)==null?void 0:i.type:e.response;if(n!=null)return t.resolveType({type:n,file:r})}function i6t(e){if((e==null?void 0:e._type)==="primitive")return e.primitive.v1;if((e==null?void 0:e._type)==="container"&&e.container._type==="optional")return i6t(e.container.itemType)}function hL(e){if(e!=null){if(e._type==="named")return e.file;if(e._type==="container"&&e.container._type==="optional")return hL(e.container.itemType)}}function u8n(e){let t=cVf(e,Ibi);return t==null?void 0:t.split(".")}function EDa(e){let t=cVf(e,Dwu);return t==null?void 0:t.split(".")}function oVf({typeResolver:e,file:t,objectSchema:r,propertyComponents:n,validate:i}){let a=cpj({typeResolver:e,file:t,objectSchema:r,property:n[0]??""});if(a==null)return!1;let u=e.resolveType({type:a,file:t});return n6t({typeResolver:e,file:hL(u)??t,resolvedType:u,propertyComponents:n.slice(1),validate:i})}function cpj({typeResolver:e,file:t,objectSchema:r,property:n}){return uVf({typeResolver:e,file:t,objectSchema:r})[n]}function uVf({typeResolver:e,file:t,objectSchema:r}){let n=[];typeof r.extends=="string"?n=[r.extends]:Array.isArray(r.extends)&&(n=r.extends);let i={};for(let a of n){let u=lpj({typeResolver:e,file:t,extendedType:a});Object.entries(u).map(([f,d])=>{i[f]=d})}return r.properties!=null&&Object.entries(r.properties).map(([a,u])=>{i[a]=typeof u=="string"?u:u.type}),i}function lpj({typeResolver:e,file:t,extendedType:r}){let n=e.resolveNamedTypeOrThrow({referenceToNamedType:r,file:t});return n._type==="named"&&QE(n.declaration)?uVf({typeResolver:e,file:hL(n)??t,objectSchema:n.declaration}):{}}function sVf(e){if(e!=null){if(e._type==="named"&&QE(e.declaration))return e.declaration;if(e._type==="container"&&e.container._type==="optional")return sVf(e.container.itemType)}}function cVf(e,t){return e.startsWith(t)?e.substring(t.length):null}var Swu=`${Ibi}client_id`,Ewu=`${Ibi}client_secret`,s8n=`${Dwu}access_token`,Mwu=`${Ibi}refresh_token`;function xwu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:i}){return TDa({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"client-id",validate:Rbi}})}function Twu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:i}){return TDa({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"client-secret",validate:Rbi}})}function lVf({endpointId:e,endpoint:t,typeResolver:r,file:n,scopesProperty:i}){return TDa({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"scopes",validate:Rbi}})}function qwu({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:i}){return TDa({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:{propertyID:"refresh-token",validate:Rbi}})}function c8n({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,accessTokenProperty:i}){return Cwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"access-token",validate:fVf}})}function MDa({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,refreshTokenProperty:i}){return Cwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"refresh-token",validate:fVf}})}function xDa({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,expiresInProperty:i}){return Cwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"expires-in",validate:fpj}})}function fpj({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return n6t({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:dpj})}function fVf({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return n6t({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:Rbi})}function TDa({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:a}){let u=[],f=u8n(i);return f==null?(u.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} must define a dot-delimited '${a.propertyID}' property starting with $request (e.g. $request.${a.propertyID}).`}),u):f.length>1?(u.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} cannot reference nested $request properties like '${i}'; expected '$request.${a.propertyID}' instead.`}),u):(o8n({typeResolver:r,file:n,endpoint:t,propertyComponents:f,validate:a.validate})||u.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} specifies '${a.propertyID}' ${i}, which is not a valid '${a.propertyID}' type.`}),u)}function Cwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:a}){let u=[],f=EDa(i);return f==null&&u.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} must define a dot-delimited '${a.propertyID}' property starting with $response (e.g. $response.${a.propertyID}).`}),f!=null&&!a.validate({typeResolver:t,file:r,resolvedType:n,propertyComponents:f})&&u.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} specifies '${a.propertyID}' ${i}, which is not a valid '${a.propertyID}' type.`}),u}function dpj({resolvedType:e}){return i6t(e)==="INTEGER"}function Rbi({resolvedType:e}){return i6t(e)==="STRING"}function dVf({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshEndpoint:i}){var l,g,O,j;let a=[],u=(l=i["request-properties"])==null?void 0:l["refresh-token"];u!=null?a.push(...qwu({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:u})):qwu({endpointId:e,endpoint:t,typeResolver:r,file:n,refreshTokenProperty:Mwu}).length>0&&a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} is missing a valid refresh-token, such as '${Mwu}'.`});let f=dBr({endpoint:t,typeResolver:r,file:n});if(f==null)return a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} must define a response type.`}),a;let d=(g=i["response-properties"])==null?void 0:g["access-token"];d!=null?a.push(...c8n({endpointId:e,typeResolver:r,file:n,resolvedResponseType:f,accessTokenProperty:d})):c8n({endpointId:e,typeResolver:r,file:n,resolvedResponseType:f,accessTokenProperty:s8n}).length>0&&a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} is missing a valid access-token, such as '${s8n}'.`});let c=(O=i==null?void 0:i["response-properties"])==null?void 0:O["expires-in"];c!=null&&a.push(...xDa({endpointId:e,typeResolver:r,file:hL(f)??n,resolvedResponseType:f,expiresInProperty:c}));let o=(j=i==null?void 0:i["response-properties"])==null?void 0:j["refresh-token"];return o!=null&&a.push(...MDa({endpointId:e,typeResolver:r,file:hL(f)??n,resolvedResponseType:f,refreshTokenProperty:o})),a}function pVf({endpointId:e,endpoint:t,typeResolver:r,file:n,tokenEndpoint:i}){var O,j,S,x,A,N;let a=[],u=(O=i["request-properties"])==null?void 0:O["client-id"];u!=null?a.push(...xwu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:u})):xwu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientIdProperty:Swu}).length>0&&a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} is missing a valid client-id, such as '${Swu}'.`});let f=(j=i["request-properties"])==null?void 0:j["client-secret"];f!=null?a.push(...Twu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:f})):Twu({endpointId:e,endpoint:t,typeResolver:r,file:n,clientSecretProperty:Ewu}).length>0&&a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} is missing a valid client-secret, such as '${Ewu}'.`});let d=(S=i==null?void 0:i["request-properties"])==null?void 0:S.scopes;d!=null&&a.push(...lVf({endpointId:e,endpoint:t,typeResolver:r,file:n,scopesProperty:d}));let c=dBr({endpoint:t,typeResolver:r,file:n});if(c==null)return a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} must define a response type.`}),a;let o=(x=i["response-properties"])==null?void 0:x["access-token"];o!=null?a.push(...c8n({endpointId:e,typeResolver:r,file:n,resolvedResponseType:c,accessTokenProperty:o})):c8n({endpointId:e,typeResolver:r,file:n,resolvedResponseType:c,accessTokenProperty:s8n}).length>0&&a.push({severity:"error",message:`OAuth configuration for endpoint ${al.bold(e)} is missing a valid access-token, such as '${s8n}'.`});let l=(A=i==null?void 0:i["response-properties"])==null?void 0:A["expires-in"];l!=null&&a.push(...xDa({endpointId:e,typeResolver:r,file:hL(c)??n,resolvedResponseType:c,expiresInProperty:l}));let g=(N=i==null?void 0:i["response-properties"])==null?void 0:N["refresh-token"];return g!=null&&a.push(...MDa({endpointId:e,typeResolver:r,file:hL(c)??n,resolvedResponseType:c,refreshTokenProperty:g})),a}var Awu={name:"valid-oauth",create:({workspace:e})=>{let t=new CM(e),r=new yrn(e),n=aEr({casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents});return{rootApiFile:{oauth:async({name:i,oauth:a},{relativeFilepath:u})=>{var l;let f=[],d=a["get-token"].endpoint,c=await r.resolveEndpoint({endpoint:d,file:n});c==null?f.push({severity:"error",message:`Failed to resolve endpoint ${d}`}):f.push(...pVf({endpointId:c.endpointId,endpoint:c.endpoint,typeResolver:t,file:c.file,tokenEndpoint:a["get-token"]}));let o=(l=a["refresh-token"])==null?void 0:l.endpoint;if(a["refresh-token"]!=null&&o!=null){let g=await r.resolveEndpoint({endpoint:o,file:n});g==null?f.push({severity:"error",message:`Failed to resolve endpoint ${d}`}):f.push(...dVf({endpointId:g.endpointId,endpoint:g.endpoint,typeResolver:t,file:g.file,refreshEndpoint:a["refresh-token"]}))}return f}}}}};function qDa({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,resultsProperty:i}){return Nwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"results",validate:ppj}})}function Fbi({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i,propertyValidator:a}){let u=[],f=u8n(i);return f==null?(u.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} must define a dot-delimited '${a.propertyID}' property starting with $request (e.g. $request.${a.propertyID}).`}),u):(o8n({typeResolver:r,file:n,endpoint:t,propertyComponents:f,validate:a.validate})||u.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} specifies '${a.propertyID}' ${i}, which is not a valid '${a.propertyID}' type.`}),u)}function Nwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:a}){let u=[],f=EDa(i);return f==null&&u.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} must define a dot-delimited '${a.propertyID}' property starting with $response (e.g. $response.${a.propertyID}).`}),f!=null&&!a.validate({typeResolver:t,file:r,resolvedType:n,propertyComponents:f})&&u.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} specifies '${a.propertyID}' ${i}, which is not a valid '${a.propertyID}' type.`}),u}function ppj({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return n6t({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:_pj})}function _pj({resolvedType:e}){return!0}function _Vf({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}){let a=[];a.push(...hpj({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}));let u=dBr({endpoint:t,typeResolver:r,file:n});return u==null?(a.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} must define a response type.`}),a):(a.push(...ypj({endpointId:e,typeResolver:r,file:hL(u)??n,resolvedResponseType:u,nextProperty:i.next_cursor})),a.push(...qDa({endpointId:e,typeResolver:r,file:hL(u)??n,resolvedResponseType:u,resultsProperty:i.results})),a)}function hpj({endpointId:e,endpoint:t,typeResolver:r,file:n,cursorPagination:i}){return Fbi({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.cursor,propertyValidator:{propertyID:"cursor",validate:hVf}})}function ypj({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,nextProperty:i}){return Nwu({endpointId:e,typeResolver:t,file:r,resolvedResponseType:n,responseProperty:i,propertyValidator:{propertyID:"next_cursor",validate:vpj}})}function vpj({typeResolver:e,file:t,resolvedType:r,propertyComponents:n}){return n6t({typeResolver:e,file:t,resolvedType:r,propertyComponents:n,validate:hVf})}function hVf({resolvedType:e}){let t=i6t(e);return t==null?!1:t!=="BOOLEAN"}function yVf(e){return e.split(".").slice(1)}function vVf({path:e,typeResolver:t,file:r,resolvedType:n,validate:i}){let a=n;for(let u of e){if(a==null)return i({resolvedType:void 0});let f=mVf(a);if(f==null)return i({resolvedType:void 0});let c=bVf({typeResolver:t,file:r,objectSchema:f})[u];if(c==null)return i({resolvedType:void 0});a=t.resolveType({type:c,file:r})}return i({resolvedType:a})}function bVf({typeResolver:e,file:t,objectSchema:r}){let n=[];typeof r.extends=="string"?n=[r.extends]:Array.isArray(r.extends)&&(n=r.extends);let i={};for(let a of n){let u=bpj({typeResolver:e,file:t,extendedType:a});Object.entries(u).map(([f,d])=>{i[f]=d})}return r.properties!=null&&Object.entries(r.properties).map(([a,u])=>{i[a]=typeof u=="string"?u:u.type}),i}function bpj({typeResolver:e,file:t,extendedType:r}){let n=e.resolveNamedTypeOrThrow({referenceToNamedType:r,file:t});return n._type==="named"&&QE(n.declaration)?bVf({typeResolver:e,file:gVf(n)??t,objectSchema:n.declaration}):{}}function gVf(e){if(e!=null){if(e._type==="named")return e.file;if(e._type==="container"&&e.container._type==="optional")return gVf(e.container.itemType)}}function mVf(e){if(e!=null){if(e._type==="named"&&QE(e.declaration))return e.declaration;if(e._type==="container"&&e.container._type==="optional")return mVf(e.container.itemType)}}function OVf({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){let a=[];a.push(...gpj({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i})),a.push(...mpj({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}));let u=dBr({endpoint:t,typeResolver:r,file:n});return u==null?(a.push({severity:"error",message:`Pagination configuration for endpoint ${al.bold(e)} must define a response type.`}),a):(a.push(...qDa({endpointId:e,typeResolver:r,file:hL(u)??n,resolvedResponseType:u,resultsProperty:i.results})),a.push(...Opj({endpointId:e,resolvedResponseType:u,typeResolver:r,file:hL(u)??n,offsetPagination:i})),a)}function gpj({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){return Fbi({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.offset,propertyValidator:{propertyID:"offset",validate:PVf}})}function mpj({endpointId:e,endpoint:t,typeResolver:r,file:n,offsetPagination:i}){return i.step==null?[]:Fbi({endpointId:e,endpoint:t,typeResolver:r,file:n,requestProperty:i.step,propertyValidator:{propertyID:"step",validate:PVf}})}function PVf({resolvedType:e}){let t=i6t(e);return t==null?!1:t==="INTEGER"||t==="LONG"||t==="DOUBLE"}function Opj({resolvedResponseType:e,typeResolver:t,file:r,offsetPagination:n}){return n["has-next-page"]==null?[]:vVf({typeResolver:t,file:r,path:yVf(n["has-next-page"]),resolvedType:e,validate:({resolvedType:i})=>i6t(i)!=="BOOLEAN"?[{message:`"has-next-page" selector, ${n["has-next-page"]}, does not point to a boolean property`,severity:"error"}]:[]})}var zwu={name:"valid-pagination",create:({workspace:e})=>{let t=new CM(e),r=e.definition.rootApiFile.contents.pagination;return{definitionFile:{httpEndpoint:({endpointId:n,endpoint:i},{relativeFilepath:a,contents:u})=>{let f=typeof i.pagination=="boolean"?r:i.pagination;if(!f)return[];let d=jO({relativeFilepath:a,definitionFile:u,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents});return Ppj(f)?_Vf({endpointId:n,endpoint:i,typeResolver:t,file:d,cursorPagination:f}):OVf({endpointId:n,endpoint:i,typeResolver:t,file:d,offsetPagination:f})}}}}};function Ppj(e){return e.cursor!=null&&e.next_cursor!=null&&e.results!=null}var Bwu={name:"valid-service-urls",create:({workspace:e})=>{let t=jDa(e),r=n=>{var i;return t.includes(n)?[]:t.length===0&&((i=e.definition.rootApiFile.contents)==null?void 0:i["default-url"])!=null?[]:t.length===0?[{severity:"error",message:`"url" cannot be configured unless you specify multiple URLs for each environment in ${fB}`}]:[{severity:"error",message:[`URL ${al.bold(n)} is not recognized. Please add it to your environments in ${fB} or specify one of the configured environment URLs:`,...t.map(a=>` - ${a}`)].join(`
1955
1955
  `)}]};return{definitionFile:{serviceBaseUrl:n=>n==null?[]:r(n),endpointBaseUrl:({baseUrl:n,service:i})=>{var a;return(a=e.definition.rootApiFile.contents)!=null&&a["default-url"]?[]:n==null?t.length===0||i.url!=null?[]:[{severity:"error",message:['"url" is missing. Please specify one of the configured environment URLs:',...t.map(u=>` - ${u}`)].join(`
1956
1956
  `)}]:r(n)}}}}};var Iwu={name:"valid-stream-condition",create:async({workspace:e})=>({definitionFile:{streamCondition:({endpoint:t,streamCondition:r},{relativeFilepath:n,contents:i})=>{let a=new CM(e),u=jO({relativeFilepath:n,definitionFile:i,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents});return t.response==null||t["response-stream"]==null?r==null?[]:[{severity:"error",message:"stream-condition can only be used if both response and response-stream are specified."}]:r==null?[{severity:"error",message:"stream-condition must be specified when both response and response-stream are specified."}]:wpj({endpoint:t,typeResolver:a,file:u,requestProperty:r,propertyValidator:{propertyID:"stream-condition",validate:jpj}})}}})};function jpj({resolvedType:e}){let t=i6t(e);return t==null?!1:t==="BOOLEAN"}function wpj({endpoint:e,typeResolver:t,file:r,requestProperty:n,propertyValidator:i}){let a=[],u=u8n(n);return u==null?[{severity:"error",message:"Please specify path to a valid property (e.g. $request.stream)"}]:o8n({typeResolver:t,file:r,endpoint:e,propertyComponents:u,validate:i.validate})?a:[{severity:"error",message:`Property "${n}" does not exist on the request.`}]}var Dpj=/^[a-z]/i,Rwu={name:"valid-type-name",create:async()=>({definitionFile:{typeDeclaration:({typeName:e})=>!e.isInlined&&!Dpj.test(e.name)?[{severity:"error",message:"Type name must begin with a letter"}]:[]}})};var Lwu={name:"valid-type-reference-with-default-and-validation",create:async({workspace:e})=>{let t=new CM(e);return{definitionFile:{typeDeclaration:({declaration:r})=>{if(!CCt(r))return[];let n=new Set(r.enum.map(i=>typeof i=="string"?i:i.value));return r.default!=null&&!n.has(r.default)?[{message:`Default value '${r.default}' is not a valid enum value`,severity:"error"}]:[]},typeReference:({typeReference:r,_default:n,validation:i,location:a},{relativeFilepath:u,contents:f})=>{let d=jO({relativeFilepath:u,definitionFile:f,casingsGenerator:xx,rootApiFile:e.definition.rootApiFile.contents}),c=t.resolveType({type:r,file:d});return c==null?[]:jVf({resolvedType:c,_default:n,validation:i})}}}}};function jVf({resolvedType:e,_default:t,validation:r}){let n=[];if(t==null&&r==null)return[];if(e._type==="container"&&e.container._type==="optional")return jVf({resolvedType:e.container.itemType,_default:t,validation:r});let i=e._type;if(e._type==="primitive")switch(e.primitive.v1){case"STRING":return Epj({_default:t,validation:r});case"DOUBLE":return Mpj({_default:t,validation:r});case"INTEGER":return xpj({_default:t,validation:r});case"BOOLEAN":return Tpj({_default:t,validation:r});case"LONG":return qpj({_default:t,validation:r});case"BIG_INTEGER":return Cpj({_default:t,validation:r});case"DATE_TIME":i="datetime";break;case"UUID":i="uuid";break;case"BASE_64":i="base64";break;case"UINT":i="uint";break;case"UINT_64":i="uint64";break}return e._type==="named"&&CCt(e.declaration)?Spj({declaration:e.declaration,_default:t}):(t!=null&&n.push({message:`Default values are not supported for the ${i} type`,severity:"error"}),r!=null&&n.push({message:`Validation rules are not supported for the ${i} type`,severity:"error"}),n)}function Spj({declaration:e,_default:t}){if(t==null)return[];let r=new Set(e.enum.map(i=>typeof i=="string"?i:i.value)),n=[];return r.has(t)||n.push({message:`Default value '${t}' is not a valid enum value`,severity:"error"}),n}function Epj({_default:e,validation:t}){let r=[];return e!=null&&typeof e!="string"&&r.push({message:`Default value '${e}' is not a valid string`,severity:"error"}),t!=null&&!Apj(t)&&r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the string type`,severity:"error"}),r}function Mpj({_default:e,validation:t}){let r=[];return e!=null&&typeof e!="number"&&r.push({message:`Default value '${e}' is not a valid double`,severity:"error"}),t!=null&&!wVf(t)&&r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the double type`,severity:"error"}),r}function xpj({_default:e,validation:t}){let r=[];return e!=null&&!Number.isInteger(e)&&r.push({message:`Default value '${e}' is not a valid integer`,severity:"error"}),t!=null&&(wVf(t)?r.push(...Fwu({name:"min",value:t.min}),...Fwu({name:"max",value:t.max}),...Fwu({name:"multipleOf",value:t.multipleOf})):r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the integer type`,severity:"error"})),r}function Tpj({_default:e,validation:t}){let r=[];return e!=null&&typeof e!="boolean"&&r.push({message:`Default value '${e}' is not a valid boolean`,severity:"error"}),t!=null&&r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the boolean type`,severity:"error"}),r}function qpj({_default:e,validation:t}){let r=[];return e!=null&&typeof e!="number"&&r.push({message:`Default value '${e}' is not a valid long`,severity:"error"}),t!=null&&r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the long type`,severity:"error"}),r}function Cpj({_default:e,validation:t}){let r=[];if(e!=null)if(typeof e!="string")r.push({message:`Default value '${e}' is not a valid bigint`,severity:"error"});else try{BigInt(e)}catch{r.push({message:`Default value '${e}' is not a valid bigint`,severity:"error"})}return t!=null&&r.push({message:`Validation rules '${JSON.stringify(t)}' are not compatible with the bigint type`,severity:"error"}),r}function Fwu({name:e,value:t}){return t!=null&&!Number.isInteger(t)?[{message:`Validation for '${e}' must be an integer, but found '${t}'`,severity:"error"}]:[]}function wVf(e){let t=e;return t.min!=null||t.max!=null||t.exclusiveMin!=null||t.exclusiveMax!=null||t.multipleOf!=null}function Apj(e){let t=e;return t.minLength!=null||t.maxLength!=null||t.pattern!=null||t.format!=null}var Uwu={name:"valid-version",create:({workspace:e})=>{let t=new CM(e);return{rootApiFile:{file:r=>Npj({root:r,typeResolver:t})}}}};function Npj({root:e,typeResolver:t}){let r=[];return e.version==null||e.version.default==null?[]:(new Set(e.version.values.map(i=>typeof i=="string"?i:i.value)).has(e.version.default)||r.push({severity:"error",message:`Default version "${e.version.default}" not found in version values`}),r)}var Vwu={name:"content-type-only-for-multipart",DISABLE_RULE:!1,create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.request==null)return[];if(gZr(e.request)!=null)return[];if(typeof e.request!="string"&&e.request.body!=null&&EA(e.request.body)){let r=[];for(let[n,i]of Object.entries(e.request.body.properties??{}))typeof i!="string"&&i["content-type"]!=null&&r.push({severity:"error",message:`${n} has content-type, but the request is not multipart`});return r}return[]}}})};function zpj(){return[dwu,Qju,fwu,Vju,Xju,swu,Hju,Pwu,kju,owu,rwu,$ju,vwu,iwu,Owu,ewu,nwu,awu,Jju,Kju,gwu,Zju,cwu,Wju,Bwu,ywu,bwu,Gju,Rwu,twu,wwu,pwu,hwu,uwu,Awu,zwu,mwu,Lwu,Iwu,Uwu,_wu,jwu,Uju,Vwu]}function DVf(){return zpj().filter(({DISABLE_RULE:e=!1})=>!e)}function SVf({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let u=async(f,d)=>{var c;for(let o of r){let l=(c=o.generatorsYml)==null?void 0:c[a];if(l!=null){let g=await l(f,{relativeFilepath:e,contents:t});n(g.map(O=>({severity:O.severity,relativeFilepath:e,nodePath:d,message:O.message})))}}};return{[a]:u}}return{...i("file"),...i("generatorInvocation")}}async function EVf({groups:e,visitor:t,nodePath:r,cliVersion:n}){if(e!=null)for(let[i,a]of Object.entries(e))await Bpj({group:a,visitor:t,nodePath:[...r,i],cliVersion:n})}async function Bpj({group:e,visitor:t,nodePath:r,cliVersion:n}){await Promise.all(e.generators.map(async(i,a)=>{var u;return await((u=t.generatorInvocation)==null?void 0:u.call(t,{invocation:i,cliVersion:n},[...r,"generators",a.toString(),i.name]))}))}async function MVf(e,t,r){var n;await((n=r.file)==null?void 0:n.call(r,e,[])),await xP(e,{"auth-schemes":sl,api:sl,whitelabel:sl,metadata:sl,readme:sl,"default-group":sl,reviewers:sl,openapi:sl,"openapi-overrides":sl,"spec-origin":sl,"async-api":sl,"api-settings":sl,groups:async i=>{await EVf({groups:i,visitor:r,nodePath:["groups"],cliVersion:t})}})}async function Wwu(e,t){return Ipj({workspace:e,rules:DVf(),logger:t})}async function Ipj({workspace:e,rules:t,logger:r}){var u;let n=[],i=await Promise.all(t.map(f=>f.create({workspace:e,logger:r})));if((u=e.generatorsConfiguration)!=null&&u.rawConfiguration){let f=await Rpj({contents:e.generatorsConfiguration.rawConfiguration,allRuleVisitors:i,cliVersion:e.cliVersion});n.push(...f)}let a=await Lpj({contents:e.definition.rootApiFile.contents,allRuleVisitors:i});return n.push(...a),await R5(e,async(f,d)=>{let c=await Fpj({relativeFilepath:f,contents:d,allRuleVisitors:i});n.push(...c)}),await Pen(e,async(f,d)=>{let c=await Upj({relativeFilepath:f,contents:d,allRuleVisitors:i});n.push(...c)}),n}async function Rpj({contents:e,allRuleVisitors:t,cliVersion:r}){let n=[],i=SVf({relativeFilepath:As.of(y5),contents:e,allRuleVisitors:t,addViolations:a=>{n.push(...a)}});return await MVf(e,r,i),n}async function Fpj({relativeFilepath:e,contents:t,allRuleVisitors:r}){let n=[],i=WUf({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:a=>{n.push(...a)}});return await JW(t,i),n}async function Lpj({contents:e,allRuleVisitors:t}){let r=[],n=$Uf({relativeFilepath:As.of(fB),contents:e,allRuleVisitors:t,addViolations:i=>{r.push(...i)}});return await Lju(e,n),r}async function Upj({relativeFilepath:e,contents:t,allRuleVisitors:r}){let n=[],i=HUf({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:a=>{n.push(...a)}});return await Fju(t,i),n}var CVf=yu(TVf(),1);function CDa({context:e,violations:t,logWarnings:r,logSummary:n=!0}){let i=Kpj(t);return n&&Gpj({context:e,stats:i,logWarnings:r}),t.forEach(a=>{a.severity==="error"&&qVf({violation:a,context:e})}),r&&t.forEach(a=>{a.severity==="warning"&&qVf({violation:a,context:e})}),{hasErrors:i.numErrors>0}}function qVf({violation:e,context:t}){t.logger.log(Jpj(e.severity),Ewr({breadcrumbs:[e.relativeFilepath,...e.nodePath.map(r=>{let n=typeof r=="string"?r:r.key;return typeof r!="string"&&r.arrayIndex!=null&&(n+=`[${r.arrayIndex}]`),n})],title:e.message}))}function Jpj(e){switch(e){case"error":return SM.Error;case"warning":return SM.Warn}}function Gpj({stats:e,context:t,logWarnings:r}){let{numErrors:n,numWarnings:i}=e,a=`Found ${n} errors and ${i} warnings.`;r||(a+=" Run fern check --warnings to print out the warnings."),n>0?t.logger.error(a):i>0?t.logger.warn(a):t.logger.info(al.green("\u2713 All checks passed"))}function Kpj(e){let t=0,r=0;for(let n of e)switch(n.severity){case"error":t+=1;continue;case"warning":r+=1;continue;default:dl(n.severity)}return{numErrors:t,numWarnings:r}}async function Hwu({workspace:e,context:t,logWarnings:r,logSummary:n=!0}){let i=await Wwu(e,t.logger),{hasErrors:a}=CDa({violations:i,context:t,logWarnings:r,logSummary:n});return{hasErrors:a}}async function CFt({workspace:e,context:t,logWarnings:r}){(0,CVf.default)(e.definition.rootApiFile.contents.name).validForNewPackages||t.failAndThrow("API name is not valid.");let{hasErrors:n}=await Hwu({workspace:e,context:t,logWarnings:r});n&&t.failAndThrow()}async function ADa({value:e}){let t=await Sxe.RawSchemas.Serializer.VersionFileConfig.parse(e);if(t.ok)return{type:"success",contents:t.value};let r=t.errors.map(n=>{let i=n.path.length>0?`${n.message} at "${n.path.join(" -> ")}"`:n.message;return ZX({content:i,prefix:" - "})});return{type:"failure",message:r.join(`
1957
1957
  `)}}var Ypj=/\[([^\]]+)\]\(((?!http:\/\/|https:\/\/).*?)\)/gi,$wu={name:"valid-markdown-links",create:()=>({markdownPage:async({content:e,absoluteFilepath:t})=>{let r=[],n=Xpj({content:e,absoluteFilepath:t});for(let i of n)await Vh(i.absolutePath)||r.push({severity:"error",message:`Link to non-existent file: ${i.path}`});return r}})};function Xpj({content:e,absoluteFilepath:t}){let r=e.matchAll(Ypj),n=[];for(let i of r){if(i[2]==null)continue;if(!i[2].endsWith("md")&&!i[2].endsWith("mdx"))continue;let a=i[2],u=a.startsWith("/")?P_.of(a):ff(bg(t),As.of(a));n.push({path:a,absolutePath:u})}return n}var oqe=yu(require("path"),1);var Jwu=yu(require("process"),1);var Gwu=require("url");function NDa(e){return Boolean(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}var Kwu=["history","path","basename","stem","extname","dirname"],uqe=class{constructor(t){let r;t?NDa(t)?r={path:t}:typeof t=="string"||Qpj(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":Jwu.default.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Kwu.length;){let a=Kwu[n];a in r&&r[a]!==void 0&&r[a]!==null&&(this[a]=a==="history"?[...r[a]]:r[a])}let i;for(i in r)Kwu.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?oqe.default.basename(this.path):void 0}set basename(t){Xwu(t,"basename"),Ywu(t,"basename"),this.path=oqe.default.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?oqe.default.dirname(this.path):void 0}set dirname(t){AVf(this.basename,"dirname"),this.path=oqe.default.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?oqe.default.extname(this.path):void 0}set extname(t){if(Ywu(t,"extname"),AVf(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=oqe.default.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){NDa(t)&&(t=(0,Gwu.fileURLToPath)(t)),Xwu(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?oqe.default.basename(this.path,this.extname):void 0}set stem(t){Xwu(t,"stem"),Ywu(t,"stem"),this.path=oqe.default.join(this.dirname||"",t+(this.extname||""))}fail(t,r,n){let i=this.message(t,r,n);throw i.fatal=!0,i}info(t,r,n){let i=this.message(t,r,n);return i.fatal=void 0,i}message(t,r,n){let i=new pw(t,r,n);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}};function Ywu(e,t){if(e&&e.includes(oqe.default.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+oqe.default.sep+"`")}function Xwu(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function AVf(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Qpj(e){return Boolean(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var Zpj=["md","markdown","mdown","mkdn","mkd","mdwn","mkdown","ron"],NVf=Zpj;var zVf=NVf.map(function(e){return"."+e});function BVf(e,t){let r=kpj(e)?e:new uqe(e),{format:n,...i}=t||{};return{file:r,options:{format:n==="md"||n==="mdx"?n:r.extname&&(i.mdExtensions||zVf).includes(r.extname)?"md":"mdx",...i}}}function kpj(e){return Boolean(e&&typeof e=="object"&&"message"in e&&"messages"in e)}var e_j=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],VVf=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],t_j="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",WVf="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",Qwu={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},Zwu="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",r_j={5:Zwu,"5module":Zwu+" export import",6:Zwu+" const class extends export import super"},n_j=/^in(stanceof)?$/,i_j=new RegExp("["+WVf+"]"),a_j=new RegExp("["+WVf+t_j+"]");function eDu(e,t){for(var r=65536,n=0;n<t.length;n+=2){if(r+=t[n],r>e)return!1;if(r+=t[n+1],r>=e)return!0}return!1}function SEr(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&i_j.test(String.fromCharCode(e)):t===!1?!1:eDu(e,VVf)}function l8n(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&a_j.test(String.fromCharCode(e)):t===!1?!1:eDu(e,VVf)||eDu(e,e_j)}var NT=function(t,r){r===void 0&&(r={}),this.label=t,this.keyword=r.keyword,this.beforeExpr=!!r.beforeExpr,this.startsExpr=!!r.startsExpr,this.isLoop=!!r.isLoop,this.isAssign=!!r.isAssign,this.prefix=!!r.prefix,this.postfix=!!r.postfix,this.binop=r.binop||null,this.updateContext=null};function sqe(e,t){return new NT(e,{beforeExpr:!0,binop:t})}var cqe={beforeExpr:!0},rie={startsExpr:!0},nDu={};function Tx(e,t){return t===void 0&&(t={}),t.keyword=e,nDu[e]=new NT(e,t)}var Tu={num:new NT("num",rie),regexp:new NT("regexp",rie),string:new NT("string",rie),name:new NT("name",rie),privateId:new NT("privateId",rie),eof:new NT("eof"),bracketL:new NT("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new NT("]"),braceL:new NT("{",{beforeExpr:!0,startsExpr:!0}),braceR:new NT("}"),parenL:new NT("(",{beforeExpr:!0,startsExpr:!0}),parenR:new NT(")"),comma:new NT(",",cqe),semi:new NT(";",cqe),colon:new NT(":",cqe),dot:new NT("."),question:new NT("?",cqe),questionDot:new NT("?."),arrow:new NT("=>",cqe),template:new NT("template"),invalidTemplate:new NT("invalidTemplate"),ellipsis:new NT("...",cqe),backQuote:new NT("`",rie),dollarBraceL:new NT("${",{beforeExpr:!0,startsExpr:!0}),eq:new NT("=",{beforeExpr:!0,isAssign:!0}),assign:new NT("_=",{beforeExpr:!0,isAssign:!0}),incDec:new NT("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new NT("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:sqe("||",1),logicalAND:sqe("&&",2),bitwiseOR:sqe("|",3),bitwiseXOR:sqe("^",4),bitwiseAND:sqe("&",5),equality:sqe("==/!=/===/!==",6),relational:sqe("</>/<=/>=",7),bitShift:sqe("<</>>/>>>",8),plusMin:new NT("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:sqe("%",10),star:sqe("*",10),slash:sqe("/",10),starstar:new NT("**",{beforeExpr:!0}),coalesce:sqe("??",1),_break:Tx("break"),_case:Tx("case",cqe),_catch:Tx("catch"),_continue:Tx("continue"),_debugger:Tx("debugger"),_default:Tx("default",cqe),_do:Tx("do",{isLoop:!0,beforeExpr:!0}),_else:Tx("else",cqe),_finally:Tx("finally"),_for:Tx("for",{isLoop:!0}),_function:Tx("function",rie),_if:Tx("if"),_return:Tx("return",cqe),_switch:Tx("switch"),_throw:Tx("throw",cqe),_try:Tx("try"),_var:Tx("var"),_const:Tx("const"),_while:Tx("while",{isLoop:!0}),_with:Tx("with"),_new:Tx("new",{beforeExpr:!0,startsExpr:!0}),_this:Tx("this",rie),_super:Tx("super",rie),_class:Tx("class",rie),_extends:Tx("extends",cqe),_export:Tx("export"),_import:Tx("import",rie),_null:Tx("null",rie),_true:Tx("true",rie),_false:Tx("false",rie),_in:Tx("in",{beforeExpr:!0,binop:7}),_instanceof:Tx("instanceof",{beforeExpr:!0,binop:7}),_typeof:Tx("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:Tx("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:Tx("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},dqe=/\r\n?|\n|\u2028|\u2029/,o_j=new RegExp(dqe.source,"g");function f8n(e){return e===10||e===13||e===8232||e===8233}function HVf(e,t,r){r===void 0&&(r=e.length);for(var n=t;n<r;n++){var i=e.charCodeAt(n);if(f8n(i))return n<r-1&&i===13&&e.charCodeAt(n+1)===10?n+2:n+1}return-1}var $Vf=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,lqe=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,JVf=Object.prototype,u_j=JVf.hasOwnProperty,s_j=JVf.toString,Hbi=Object.hasOwn||function(e,t){return u_j.call(e,t)},IVf=Array.isArray||function(e){return s_j.call(e)==="[object Array]"},RVf=Object.create(null);function pBr(e){return RVf[e]||(RVf[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function _Br(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var c_j=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Vbi=function(t,r){this.line=t,this.column=r};Vbi.prototype.offset=function(t){return new Vbi(this.line,this.column+t)};var FDa=function(t,r,n){this.start=r,this.end=n,t.sourceFile!==null&&(this.source=t.sourceFile)};function GVf(e,t){for(var r=1,n=0;;){var i=HVf(e,n,t);if(i<0)return new Vbi(r,t-n);++r,n=i}}var tDu={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},FVf=!1;function l_j(e){var t={};for(var r in tDu)t[r]=e&&Hbi(e,r)?e[r]:tDu[r];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!FVf&&typeof console=="object"&&console.warn&&(FVf=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.44.5",
3
+ "version": "0.44.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",