fern-api 0.65.19 → 0.65.20

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/cli.cjs +2 -2
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1712,7 +1712,7 @@ ${NAp.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&iJs(th
1712
1712
  `+RHi.default.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?RHi.default.cyan(QAp(t,this.opt.mask)):RHi.default.italic(RHi.default.dim("[hidden]")):this.opt.mask?QAp(t,this.opt.mask):RHi.default.italic(RHi.default.dim("[input is hidden] "))}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var YFo=ui(F2(),1),bTp=ui(KJs(),1),gTp=ui(UEe(),1);var eEa=class extends L2{_run(t){this.done=t,this.editorResult=new gTp.Subject;let r=DW(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let i=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,n=this.handleSubmitEvents(this.editorResult);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,i?this.render():this.startExternalEditor(),this}render(t){let r="",i=this.getQuestion();i+=this.status==="answered"?YFo.default.dim("Received"):YFo.default.dim("Press <enter> to launch your preferred editor."),t&&(r=YFo.default.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),(0,bTp.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 wTp=require("stream");var PTp=ui(require("readline"),1),jTp=ui(mTp(),1),$Hi=class{constructor(t){this.rl||=PTp.default.createInterface(y_D(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 y_D(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let n=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw n.isTtyError=!0,n}let r=new jTp.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var tEa=class extends $Hi{constructor(t={}){super(t),this.log=new wTp.Writable({write:(r,i,n)=>{this.writeLog(r),n()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return xDa(this.rl,this.bottomBar.split(`
1713
1713
  `).length),this}updateBottomBar(t){return xDa(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+`
1714
1714
  `}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&&wFo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var UE=ui(UEe(),1),ETp=ui(nDa(),1);var XFo=ui(UEe(),1),STp=ui(nDa(),1),ZFo=function(e,t,r){return typeof e[t]!="function"?(0,XFo.of)(e):(0,XFo.from)((0,STp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var DTp={set:(e,t="",r)=>{let i=e;t.split(".").forEach((n,a,u)=>{n==="__proto__"||n==="constructor"||(a===u.length-1?i[n]=r:(!(n in i)||typeof i[n]!="object")&&(i[n]={}),i=i[n])})},get:(e,t="",r)=>{let i=a=>String.prototype.split.call(t,a).filter(Boolean).reduce((u,l)=>u!=null?u[l]:u,e),n=i(/[,[\]]+?/)||i(/[,.[\]]+?/);return n===void 0||n===e?r:n}},pFn=class extends $Hi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let i;return Array.isArray(t)?i=(0,UE.from)(t):(0,UE.isObservable)(t)?i=t:Object.values(t).every(n=>typeof n=="object"&&!Array.isArray(n)&&n!=null)?i=(0,UE.from)(Object.entries(t).map(([n,a])=>({name:n,...a}))):i=(0,UE.from)([t]),this.process=i.pipe((0,UE.concatMap)(this.processQuestion.bind(this)),(0,UE.publish)()),this.process.connect(),this.process.pipe((0,UE.reduce)((n,a)=>(DTp.set(n,a.name,a.answer),n),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,UE.defer)(()=>(0,UE.of)(t).pipe((0,UE.concatMap)(this.setDefaultType.bind(this)),(0,UE.concatMap)(this.filterIfRunnable.bind(this)),(0,UE.concatMap)(()=>ZFo(t,"message",this.answers)),(0,UE.concatMap)(()=>ZFo(t,"default",this.answers)),(0,UE.concatMap)(()=>ZFo(t,"choices",this.answers)),(0,UE.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,UE.defer)(()=>(0,UE.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,UE.defer)(()=>(0,UE.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&DTp.get(this.answers,t.name)!==void 0)return UE.EMPTY;if(t.when===!1)return UE.EMPTY;if(typeof t.when!="function")return(0,UE.of)(t);let{answers:r}=this;return(0,UE.defer)(()=>(0,UE.from)((0,ETp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,UE.filter)(i=>i!=null)))}};function MTp(e){let t=function(r,i){let n;try{n=new pFn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",NDa),this.registerPrompt("input",xHi),this.registerPrompt("number",FDa),this.registerPrompt("confirm",LDa),this.registerPrompt("rawlist",UDa),this.registerPrompt("expand",VDa),this.registerPrompt("checkbox",WDa),this.registerPrompt("password",HDa),this.registerPrompt("editor",eEa)},t.restoreDefaultPrompts(),t}var XJs=MTp();function b_D(e,t){XJs.registerPrompt(e,t)}function g_D(){XJs.restoreDefaultPrompts()}var O_D={prompt:XJs,ui:{BottomBar:tEa,Prompt:pFn},createPromptModule:MTp,registerPrompt:b_D,restoreDefaultPrompts:g_D,Separator:cae},kFo=O_D;var SFn=require("path"),sBp=require("fs"),cBp=require("readline"),BCp="posthog-node";function tvD(e,{organization:t,projectId:r,prefix:i,severityAllowList:n=["error"]}={}){return a=>{if(!(n==="*"||n.includes(a.level)))return a;a.tags||(a.tags={});let l=a.tags[m3o.POSTHOG_ID_TAG];if(l===void 0)return a;let d=e.options.host??"https://us.i.posthog.com",s=new URL(`/project/${e.apiKey}/person/${l}`,d).toString();a.tags["PostHog Person URL"]=s;let o=a.exception?.values||[],c=o.map(g=>({...g,stacktrace:g.stacktrace?{...g.stacktrace,type:"raw",frames:(g.stacktrace.frames||[]).map(O=>({...O,platform:"node:javascript"}))}:void 0})),b={$exception_message:o[0]?.value||a.message,$exception_type:o[0]?.type,$exception_personURL:s,$exception_level:a.level,$exception_list:c,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:o[0]?.value||a.message,$sentry_exception_type:o[0]?.type,$sentry_tags:a.tags};return t&&r&&(b.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:l,properties:b}),a}}var m3o=class{constructor(t,r,i,n){this.name=BCp,this.name=BCp,this.setupOnce=function(a,u){let l=u()?.getClient()?.getDsn()?.projectId;a(tvD(t,{organization:r,projectId:l,prefix:i,severityAllowList:n}))}}};m3o.POSTHOG_ID_TAG="posthog_distinct_id";var y3o="0123456789abcdef",P3o=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=y3o.charAt(this.bytes[r]>>>4),t+=y3o.charAt(this.bytes[r]&15),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=y3o.charAt(this.bytes[r]>>>4),t+=y3o.charAt(this.bytes[r]&15);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},LKs=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??rvD()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return P3o.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}generateV4(){let t=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return t[6]=64|t[6]>>>4,t[8]=128|t[8]>>>2,P3o.ofInner(t)}},rvD=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),ICp,UKs=()=>ivD().toString(),ivD=()=>(ICp||(ICp=new LKs)).generate();function nvD(e,t){let r=!1;return Object.assign(i=>{let a=global.process.listeners("uncaughtException").filter(u=>u.name!=="domainUncaughtExceptionClear"&&u._posthogErrorHandler!==!0).length===0;e(i,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t())},{_posthogErrorHandler:!0})}function avD(e,t){global.process.on("uncaughtException",nvD(e,t))}function ovD(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var v3o,zCp,b3o;function uvD(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return b3o&&r.length===zCp||(zCp=r.length,b3o=r.reduce((i,n)=>{v3o||(v3o={});let a=v3o[n];if(a)i[a[0]]=a[1];else{let u=e(n);for(let l=u.length-1;l>=0;l--){let s=u[l]?.filename,o=t[n];if(s&&o){i[s]=o,v3o[n]=[s,o];break}}}return i},{})),b3o}function svD(e){return typeof Event<"u"&&lBp(e,Event)}function cvD(e){return fBp(e,"Object")}function KKs(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return lBp(e,Error)}}function lBp(e,t){try{return e instanceof t}catch{return!1}}function lvD(e){return fBp(e,"ErrorEvent")}function fBp(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function fvD(e,t,r,i){let a=i&&i.mechanism||{handled:!0,type:"generic"},u=dBp(a,r,i);return{$exception_list:await Promise.all(u.map(async s=>{let o=await bvD(e,t,s);return o.value=o.value||"",o.type=o.type||"Error",o.mechanism=a,o}))}}function dBp(e,t,r){let i=dvD(e,t,r);return i.cause?[i,...dBp(e,i.cause,r)]:[i]}function dvD(e,t,r){if(KKs(t))return t;if(e.synthetic=!0,cvD(t)){let n=pvD(t);if(n)return n;let a=_vD(t),u=r?.syntheticException||new Error(a);return u.message=a,u}let i=r?.syntheticException||new Error(t);return i.message=`${t}`,i}function pvD(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(KKs(r))return r}}function _vD(e){if("name"in e&&typeof e.name=="string"){let i=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(i+=` with message '${e.message}'`),i}else if("message"in e&&typeof e.message=="string")return e.message;let t=yvD(e);if(lvD(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=hvD(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function hvD(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function yvD(e,t=40){let r=Object.keys(vvD(e));r.sort();let i=r[0];if(!i)return"[object has no keys]";if(i.length>=t)return xCp(i,t);for(let n=r.length;n>0;n--){let a=r.slice(0,n).join(", ");if(!(a.length>t))return n===r.length?a:xCp(a,t)}return""}function xCp(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function vvD(e){return KKs(e)?{message:e.message,name:e.name,stack:e.stack,...RCp(e)}:svD(e)?{type:e.type,target:NCp(e.target),currentTarget:NCp(e.currentTarget),...RCp(e)}:e}function RCp(e){if(typeof e=="object"&&e!==null){let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}else return{}}function NCp(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function bvD(e,t,r){let i={type:r.name||r.constructor.name,value:r.message},n=gvD(e,r);for(let a of t)n=await a(n);return n.length&&(i.stacktrace={frames:n,type:"raw"}),i}function gvD(e,t){return OvD(e(t.stack||"",1),e)}function OvD(e,t){let r=uvD(t);return e.forEach(i=>{i.filename&&(i.chunk_id=r[i.filename])}),e}var mvD=2e3,PFn=class e{static async captureException(t,r,i,n,a){let u={...a};n||(u.$process_person_profile=!1);let l=await fvD(this.stackParser,this.frameModifiers,r,i);t.capture({event:"$exception",distinctId:n||UKs(),properties:{...l,...u}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(avD(this.onException.bind(this),this.onFatalError.bind(this)),ovD(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(mvD)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function PvD(e=process.argv[1]?(0,SFn.dirname)(process.argv[1]):process.cwd(),t=SFn.sep==="\\"){let r=t?FCp(e):e;return i=>{if(!i)return;let n=t?FCp(i):i,{dir:a,base:u,ext:l}=SFn.posix.parse(n);(l===".js"||l===".mjs"||l===".cjs")&&(u=u.slice(0,l.length*-1));let d=decodeURIComponent(u);a||(a=".");let s=a.lastIndexOf("/node_modules");if(s>-1)return`${a.slice(s+14).replace(/\//g,".")}:${d}`;if(a.startsWith(r)){let o=a.slice(r.length+1).replace(/\//g,".");return o?`${o}:${d}`:d}return d}}function FCp(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var j3o=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}},O3o=new j3o(25),pBp=new j3o(20),YKs=7,jvD=1e3,wvD=1e4;async function SvD(e){let t={};for(let n=e.length-1;n>=0;n--){let a=e[n],u=a?.filename;if(!a||typeof u!="string"||typeof a.lineno!="number"||AvD(u)||qvD(a))continue;t[u]||(t[u]=[]),t[u].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let i=[];for(let n of r){if(pBp.get(n))continue;let a=t[n];if(!a)continue;a.sort((d,s)=>d-s);let u=CvD(a);if(u.every(d=>TvD(n,d)))continue;let l=BvD(O3o,n,{});i.push(DvD(n,u,l))}return await Promise.all(i).catch(()=>{}),e&&e.length>0&&EvD(e,O3o),O3o.reduce(),e}function DvD(e,t,r){return new Promise(i=>{let n=(0,sBp.createReadStream)(e),a=(0,cBp.createInterface)({input:n});function u(){n.destroy(),i()}let l=0,d=0,s=t[d];if(s===void 0){u();return}let o=s[0],c=s[1];function b(){pBp.set(e,1),a.close(),a.removeAllListeners(),u()}n.on("error",b),a.on("error",b),a.on("close",u),a.on("line",g=>{if(l++,!(l<o)&&(r[l]=IvD(g,0),l>=c)){if(d===t.length-1){a.close(),a.removeAllListeners();return}d++;let O=t[d];if(O===void 0){a.close(),a.removeAllListeners();return}o=O[0],c=O[1]}})})}function EvD(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let i=t.get(r.filename);if(i===void 0)continue;MvD(r.lineno,r,i)}}function MvD(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let n=_Bp(e);n<e;n++){let a=r[n];if(a===void 0){LCp(t);return}t.pre_context.push(a)}if(r[e]===void 0){LCp(t);return}t.context_line=r[e];let i=hBp(e);t.post_context=[];for(let n=e+1;n<=i;n++){let a=r[n];if(a===void 0)break;t.post_context.push(a)}}function LCp(e){delete e.pre_context,delete e.context_line,delete e.post_context}function AvD(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function qvD(e){return e.lineno!==void 0&&e.lineno>wvD||e.colno!==void 0&&e.colno>jvD}function TvD(e,t){let r=O3o.get(e);if(r===void 0)return!1;for(let i=t[0];i<=t[1];i++)if(r[i]===void 0)return!1;return!0}function CvD(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let i=UCp(r),n=[];for(;;){if(t===e.length-1){n.push(i);break}let a=e[t+1];if(typeof a!="number")break;a<=i[1]?i[1]=a+YKs:(n.push(i),i=UCp(a)),t++}return n}function UCp(e){return[_Bp(e),hBp(e)]}function _Bp(e){return Math.max(1,e-YKs)}function hBp(e){return e+YKs}function BvD(e,t,r){let i=e.get(t);return i===void 0?(e.set(t,r),r):i}function IvD(e,t){let r=e,i=r.length;if(i<=150)return r;t>i&&(t=i);let n=Math.max(t-60,0);n<5&&(n=0);let a=Math.min(n+140,i);return a>i-5&&(a=i),a===i&&(n=Math.max(a-140,0)),r=r.slice(n,a),n>0&&(r=`...${r}`),a<i&&(r+="..."),r}var zvD="4.18.0",hae;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.DecideEndpointWasHit="decide_endpoint_was_hit",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config"})(hae||(hae={}));var VCp;(function(e){e.Left="left",e.Right="right",e.Center="center"})(VCp||(VCp={}));var WCp;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(WCp||(WCp={}));var HCp;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(HCp||(HCp={}));var $Cp;(function(e){e.Html="html",e.Text="text"})($Cp||($Cp={}));var GCp;(function(e){e.Number="number",e.Emoji="emoji"})(GCp||(GCp={}));var QCp;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(QCp||(QCp={}));var JCp;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(JCp||(JCp={}));var KCp;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(KCp||(KCp={}));var YCp;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(YCp||(YCp={}));var xvD=e=>{if("flags"in e){let t=NvD(e.flags),r=FvD(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([n,a])=>[n,yBp(a)])),i=Object.fromEntries(Object.entries(t).map(([n,a])=>[n,RvD(n,a,r[n])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}};function RvD(e,t,r){return{key:e,enabled:typeof t=="string"?!0:t,variant:typeof t=="string"?t:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:r?JSON.stringify(r):void 0,description:void 0}}}var NvD=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,XKs(r)]).filter(([,t])=>t!==void 0)),FvD=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let i=t[r];return i.enabled&&i.metadata&&i.metadata.payload!==void 0}).map(r=>{let i=t[r].metadata?.payload;return[r,i?yBp(i):void 0]}))},XKs=e=>e===void 0?void 0:e.variant??e.enabled,yBp=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},LvD=1,UvD=new Set(["61be3dd8","96f6df5f","8cfdba9b","bf027177","e59430a8","7fa5500b","569798e9","04809ff7","0ebc61a5","32de7f98","3beeb69a","12d34ad9","733853ec","0645bb64","5dcbee21","b1f95fa3","2189e408","82b460c2","3a8cc979","29ef8843","2cdbf767","38084b54","50f9f8de","41d0df91","5c236689","c11aedd3","ada46672","f4331ee1","42fed62a","c957462c","d62f705a","e0162666","01b3e5cf","441cef7f","bb9cafee","8f348eb0","b2553f3a","97469d7d","39f21a76","03706dcc","27d50569","307584a7","6433e92e","150c7fbb","49f57f22","3772f65b","01eb8256","3c9e9234","f853c7f7","c0ac4b67","cd609d40","10ca9b1a","8a87f11b","8e8e5216","1f6b63b3","db7943dd","79b7164c","07f78e33","2d21b6fd","952db5ee","a7d3b43f","1924dd9c","84e1b8f6","dff631b6","c5aa8a79","fa133a95","498a4508","24748755","98f3d658","21bbda67","7dbfed69","be3ec24c","fc80b8e2","75cc0998"]),VvD="utf8";function WvD(e,t){if(!e||typeof e!="string"||HvD(e))throw new Error(t)}function HvD(e){return e.trim().length===0}function $vD(e){return e?.replace(/\/+$/,"")}async function GvD(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(n=>setTimeout(n,t.retryDelay));try{return await e()}catch(n){if(r=n,!t.retryCheck(n))throw n}}throw r}function XCp(){return new Date().getTime()}function NKs(){return new Date().toISOString()}function w3o(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function QvD(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function JvD(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return(t>>>0).toString(16).padStart(8,"0")}function KvD(e,t=0,r){let i=JvD(e);return r?.has(i)?!1:parseInt(i,16)/4294967295<t}function ZCp(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var fEa=String.fromCharCode,kCp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g3o={};function YvD(e,t){if(!g3o[e]){g3o[e]={};for(let r=0;r<e.length;r++)g3o[e][e.charAt(r)]=r}return g3o[e][t]}var OFn={compressToBase64:function(e){if(e==null)return"";let t=OFn._compress(e,6,function(r){return kCp.charAt(r)});switch(t.length%4){default:case 0:return t;case 1:return t+"===";case 2:return t+"==";case 3:return t+"="}},decompressFromBase64:function(e){return e==null?"":e==""?null:OFn._decompress(e.length,32,function(t){return YvD(kCp,e.charAt(t))})},compress:function(e){return OFn._compress(e,16,function(t){return fEa(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,d="",s="",o="",c=2,b=3,g=2,O=0,m=0,w;for(w=0;w<e.length;w+=1)if(d=e.charAt(w),Object.prototype.hasOwnProperty.call(i,d)||(i[d]=b++,n[d]=!0),s=o+d,Object.prototype.hasOwnProperty.call(i,s))o=s;else{if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++),i[s]=b++,o=String(d)}if(o!==""){if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++)}for(l=2,u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;for(;;)if(O=O<<1,m==t-1){a.push(r(O));break}else m++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:OFn._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},u=4,l=4,d=3,s="",o,c,b,g,O,m,w;for(o=0;o<3;o+=1)i[o]=o;for(b=0,O=Math.pow(2,2),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=fEa(b);break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;w=fEa(b);break;case 2:return""}for(i[3]=w,c=w,n.push(w);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,d),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(w=b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=fEa(b),w=l-1,u--;break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=fEa(b),w=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,d),d++),i[w])s=i[w];else if(w===l)s=c+c.charAt(0);else return null;n.push(s),i[l++]=c+s.charAt(0),u--,c=s,u==0&&(u=Math.pow(2,d),d++)}}},VKs=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}},jFn=class extends Error{constructor(t,r){super("HTTP error while fetching PostHog: status="+t.status+", reqByteLength="+r),this.response=t,this.reqByteLength=r,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}},dEa=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function eBp(e){if(e instanceof jFn){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function FKs(e){return typeof e=="object"&&(e instanceof jFn||e instanceof dEa)}function tBp(e){return typeof e=="object"&&e instanceof jFn&&e.status===413}var WKs;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(WKs||(WKs={}));var HKs=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new VKs,this._isInitialized=!1,WvD(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=$vD(r?.host||"https://us.i.posthog.com"),this.flushAt=r?.flushAt?Math.max(r?.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,r?.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,r?.maxQueueSize??1e3),this.flushInterval=r?.flushInterval??1e4,this.captureMode=r?.captureMode||"json",this.preloadFeatureFlags=r?.preloadFeatureFlags??!0,this.defaultOptIn=r?.defaultOptIn??!0,this.disableSurveys=r?.disableSurveys??!1,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:FKs},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=r?.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=r?.disableGeoip??!0,this.disabled=r?.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(hae.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(hae.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(hae.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=UKs();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}async identifyStatelessImmediate(t,r,i){let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",n,i)}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}async captureStatelessImmediate(t,r,i,n){let a=this.buildPayload({distinct_id:t,event:r,properties:i});await this.sendImmediate("capture",a,n)}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}async aliasStatelessImmediate(t,r,i,n){let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",a,n)}groupIdentifyStateless(t,r,i,n,a,u){this.wrap(()=>{let l=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...u||{}}});this.enqueue("capture",l,n)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,i={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,i,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(n=>n.json()).catch(n=>{this.logMsgIfDebug(()=>console.error("Remote config could not be loaded",n)),this._events.emit("error",n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let l=KvD(this.apiKey,LvD,UvD)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,d={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.logMsgIfDebug(()=>console.log("PostHog Debug","Decide URL",l)),this.fetchWithRetry(l,d,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(s=>s.json()).then(s=>xvD(s)).catch(s=>{this._events.emit("error",s)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagDetailStateless(t,r,i,n,a,u);if(l===void 0)return{response:void 0,requestId:void 0};let d=XKs(l.response);return d===void 0&&(d=!1),{response:d,requestId:l.requestId}}async getFeatureFlagDetailStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagDetailsStateless(r,i,n,a,u,[t]);return l===void 0?void 0:{response:l.flags[t],requestId:l.requestId}}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u,[t]);if(!l)return;let d=l[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a,u){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,u)).payloads}async getFeatureFlagsStateless(t,r={},i={},n={},a,u){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,u)}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a,u){await this._initPromise;let l=await this.getFeatureFlagDetailsStateless(t,r,i,n,a,u);return l?{flags:l.featureFlags,payloads:l.featureFlagPayloads,requestId:l.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},i={},n={},a,u){await this._initPromise;let l={};(a??this.disableGeoip)&&(l.geoip_disable=!0),u&&(l.flag_keys_to_evaluate=u);let d=await this.getDecide(t,r,i,n,l);if(d!==void 0)return d.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),d.quotaLimited?.includes(WKs.FeatureFlags)?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:d?.requestId}):d}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this.logMsgIfDebug(()=>console.log("PostHog Debug","Loading surveys is disabled.")),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},n=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let u=`Surveys API could not be loaded: ${a.status}`,l=new Error(u);this.logMsgIfDebug(()=>console.error(l)),this._events.emit("error",new Error(u));return}return a.json()}).catch(a=>{this.logMsgIfDebug(()=>console.error("Surveys API could not be loaded",a)),this._events.emit("error",a)}))?.surveys;return n&&this.logMsgIfDebug(()=>console.log("PostHog Debug","Surveys fetched from API: ",JSON.stringify(n))),n??[]}get props(){return this._props||(this._props=this.getPersistedProperty(hae.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(hae.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(hae.Props,this.props)})}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n=this.prepareMessage(t,r,i),a=this.getPersistedProperty(hae.Queue)||[];a.length>=this.maxQueueSize&&(a.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),a.push({message:n}),this.setPersistedProperty(hae.Queue,a),this._events.emit(t,n),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=w3o(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,i){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized||await this._initPromise,this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n={api_key:this.apiKey,batch:[this.prepareMessage(t,r,i)],sent_at:NKs()};this.historicalMigration&&(n.historical_migration=!0);let a=JSON.stringify(n),u=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${XCp()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,l=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(OFn.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(u,l)}catch(d){this._events.emit("error",d)}}prepareMessage(t,r,i){let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:NKs(),uuid:i?.uuid?i.uuid:UKs()};return(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId),n}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await eBp(t)})}async flush(){let t=ZCp([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),ZCp([t]).then(()=>{this.flushPromise===t&&(this.flushPromise=null)}),t}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(hae.Queue)||[];if(!t.length)return;let r=[],i=t.length;for(;t.length>0&&r.length<i;){let n=t.slice(0,this.maxBatchSize),a=n.map(b=>b.message),u=()=>{let g=(this.getPersistedProperty(hae.Queue)||[]).slice(n.length);this.setPersistedProperty(hae.Queue,g),t=g},l={api_key:this.apiKey,batch:a,sent_at:NKs()};this.historicalMigration&&(l.historical_migration=!0);let d=JSON.stringify(l),s=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${XCp()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,o=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(OFn.compressToBase64(d))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:d},c={retryCheck:b=>tBp(b)?!1:FKs(b)};try{await this.fetchWithRetry(s,o,c)}catch(b){if(tBp(b)&&a.length>1){this.maxBatchSize=Math.max(1,Math.floor(a.length/2)),this.logMsgIfDebug(()=>console.warn(`Received 413 when sending batch of size ${a.length}, reducing batch size to ${this.maxBatchSize}`));continue}throw b instanceof dEa||u(),this._events.emit("error",b),b}u(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,i,n){var a;(a=AbortSignal).timeout??(a.timeout=function(s){let o=new AbortController;return setTimeout(()=>o.abort(),s),o.signal});let u=r.body?r.body:"",l=-1;try{l=Buffer.byteLength(u,VvD)}catch{l=new TextEncoder().encode(u).length}return await GvD(async()=>{let d=null;try{d=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(o){throw new dEa(o)}if(!(r.mode==="no-cors")&&(d.status<200||d.status>=400))throw new jFn(d,l);return d},{...this._retryOptions,...i})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let i=async()=>{try{for(await Promise.all(Object.values(this.pendingPromises));!((this.getPersistedProperty(hae.Queue)||[]).length===0||(await this.flush(),r)););}catch(n){if(!FKs(n))throw n;await eBp(n)}};return Promise.race([new Promise((n,a)=>{w3o(()=>{this.logMsgIfDebug(()=>console.error("Timed out while shutting down PostHog")),r=!0,a("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),i()])}async shutdown(t=3e4){return this.shutdownPromise?this.logMsgIfDebug(()=>console.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup")):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}},$Ks=QvD();if(!$Ks){let e=CCp();$Ks=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var vBp=$Ks,S3o=class{constructor(t){this.factory=t}async getValue(){return this.value!==void 0?this.value:(this.initializationPromise===void 0&&(this.initializationPromise=(async()=>{try{let t=await this.factory();return this.value=t,t}finally{this.initializationPromise=void 0}})()),this.initializationPromise)}isInitialized(){return this.value!==void 0}async waitForInitialization(){this.isInitialized()||await this.getValue()}},bBp=new S3o(async()=>{try{return await import("crypto")}catch{return}});async function XvD(){return await bBp.getValue()}var ZvD=new S3o(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await bBp.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function kvD(){return await ZvD.getValue()}async function ebD(e){let t=await XvD();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await kvD();if(r){let i=await r.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(i)).map(a=>a.toString(16).padStart(2,"0")).join("")}throw new Error("No crypto implementation available. Tried Node Crypto API and Web SubtleCrypto API")}var tbD=60*1e3,rbD=1152921504606847e3,ibD=["is_not"],mFn=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},U2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},GKs=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=l.fetch||vBp,this.onError=l.onError,this.customHeaders=u,this.onLoad=l.onLoad,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let u,l;if(!this.loadedSuccessfullyOnce)return u;for(let d of this.featureFlags)if(t===d.key){l=d;break}if(l!==void 0)try{u=await this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(d){d instanceof U2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${d}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return u}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},u={},l=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async d=>{try{let s=await this.computeFlagLocally(d,t,r,i,n);a[d.key]=s;let o=await this.computeFeatureFlagPayloadLocally(d.key,s);o&&(u[d.key]=o)}catch(s){s instanceof U2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),l=!0}})),{response:a,payloads:u,fallbackToDecide:l}}async computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new U2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let d=this.groupTypeMapping[String(l)];if(!d)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new U2("Flag has unknown group type index");if(!(d in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[d];return await this.matchFeatureFlagProperties(t,i[d],s)}else return await this.matchFeatureFlagProperties(t,r,n)}async matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,d=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of d)try{if(await this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=await this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof U2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new U2("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,i,n){let a=i.rollout_percentage,u=l=>{this.logMsgIfDebug(()=>console.warn(l))};if((i.properties||[]).length>0){for(let l of i.properties){let d=l.type,s=!1;if(d==="cohort"?s=OBp(l,n,this.cohorts,this.debugMode):s=gBp(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&await rBp(t.key,r)>a/100)}async getMatchingVariant(t,r){let i=await rBp(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(l=>{n=i+l.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:l.key}),i=n}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(tbD,this.pollingInterval*2**this.backOffCount):this.pollingInterval}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.getPollingInterval());try{let t=await this._requestFeatureFlagDefinitions();if(!t)return;switch(t.status){case 401:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new mFn(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new mFn(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new mFn(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let r=await t.json()??{};if(!("flags"in r)){this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`));return}this.featureFlags=r.flags??[],this.featureFlagsByKey=this.featureFlags.reduce((i,n)=>(i[n.key]=n,i),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||{},this.loadedSuccessfullyOnce=!0,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.onLoad?.(this.featureFlags.length);break}default:return}}catch(t){t instanceof mFn&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET"){return{method:t,headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions(),i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=w3o(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}_requestRemoteConfigPayload(t){let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config/`,i=this.getPersonalApiKeyRequestOptions(),n=null;if(this.timeout&&typeof this.timeout=="number"){let a=new AbortController;n=w3o(()=>{a.abort()},this.timeout),i.signal=a.signal}try{return this.fetch(r,i)}finally{clearTimeout(n)}}};async function rBp(e,t,r=""){let i=await ebD(`${e}.${t}${r}`);return parseInt(i.slice(0,15),16)/rbD}function gBp(e,t,r){let i=e.key,n=e.value,a=e.operator||"exact";if(i in t){if(a==="is_not_set")throw new U2("Operator is_not_set is not supported")}else throw new U2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!ibD.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function l(s,o){return Array.isArray(s)?s.map(c=>String(c).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function d(s,o,c){if(c==="gt")return s>o;if(c==="gte")return s>=o;if(c==="lt")return s<o;if(c==="lte")return s<=o;throw new Error(`Invalid operator: ${c}`)}switch(a){case"exact":return l(n,u);case"is_not":return!l(n,u);case"is_set":return i in t;case"icontains":return String(u).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(n).toLowerCase());case"regex":return iBp(String(n))&&String(u).match(String(n))!==null;case"not_regex":return iBp(String(n))&&String(u).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&u!=null?typeof u=="string"?d(u,String(n),a):d(u,s,a):d(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=nbD(String(n));if(s==null&&(s=nBp(n)),s==null)throw new U2(`Invalid date: ${n}`);let o=nBp(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new U2(`Unknown operator: ${a}`)}}function OBp(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new U2("can't match cohort without a given cohort property value");let a=r[n];return mBp(a,t,r,i)}function mBp(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let l of a)try{let d=mBp(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof U2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new U2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let d;l.type==="cohort"?d=OBp(l,t,r,i):d=gBp(l,t);let s=l.negation||!1;if(n==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof U2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new U2("can't match cohort without a given cohort property value");return n==="AND"}}function iBp(e){try{return new RegExp(e),!0}catch{return!1}}function nBp(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new U2(`${e} is in an invalid date format`)}else throw new U2(`The date provided ${e} must be a string, number, or date object`)}function nbD(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var QKs=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},abD=100,aBp=30*1e3,obD=50*1e3,JKs=class extends HKs{constructor(t,r={}){if(super(t,r),this._memoryStorage=new QKs,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,abD):aBp,r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');this.featureFlagsPoller=new GKs({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders()})}this.errorTracking=new PFn(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||obD}getPersistedProperty(t){return this._memoryStorage.getProperty(t)}setPersistedProperty(t,r){return this._memoryStorage.setProperty(t,r)}fetch(t,r){return this.options.fetch?this.options.fetch(t,r):vBp(t,r)}getLibraryVersion(){return zvD}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:i,properties:n,groups:a,sendFeatureFlags:u,timestamp:l,disableGeoip:d,uuid:s}=t,o=g=>{super.captureStateless(r,i,g,{timestamp:l,disableGeoip:d,uuid:s})},c=async(g,O,m)=>(await super.getFeatureFlagsStateless(g,O,void 0,void 0,m)).flags,b=Promise.resolve().then(async()=>{if(u)return await c(r,a,d);if(i==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let g={};for(let[O,m]of Object.entries(a||{}))g[O]=String(m);return await this.getAllFlags(r,{groups:g,disableGeoip:d,onlyEvaluateLocally:!0})}return{}}).then(g=>{let O={};if(g)for(let[w,E]of Object.entries(g))O[`$feature/${w}`]=E;let m=Object.keys(g||{}).filter(w=>g?.[w]!==!1).sort();return m.length>0&&(O.$active_feature_flags=m),O}).catch(()=>({})).then(g=>{o({...g,...n,$groups:a})});this.addPendingPromise(b)}async captureImmediate(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:i,properties:n,groups:a,sendFeatureFlags:u,timestamp:l,disableGeoip:d,uuid:s}=t,o=g=>super.captureStatelessImmediate(r,i,g,{timestamp:l,disableGeoip:d,uuid:s}),c=async(g,O,m)=>(await super.getFeatureFlagsStateless(g,O,void 0,void 0,m)).flags;await Promise.resolve().then(async()=>{if(u)return await c(r,a,d);if(i==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let g={};for(let[O,m]of Object.entries(a||{}))g[O]=String(m);return await this.getAllFlags(r,{groups:g,disableGeoip:d,onlyEvaluateLocally:!0})}return{}}).then(g=>{let O={};if(g)for(let[w,E]of Object.entries(g))O[`$feature/${w}`]=E;let m=Object.keys(g||{}).filter(w=>g?.[w]!==!1).sort();return m.length>0&&(O.$active_feature_flags=m),O}).catch(()=>({})).then(g=>{o({...g,...n,$groups:a})})}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;super.identifyStateless(t,{$set:a,$set_once:n},{disableGeoip:i})}async identifyImmediate({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;await super.identifyStatelessImmediate(t,{$set:a,$set_once:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=aBp){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let i=setTimeout(()=>{n(),r(!1)},t),n=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(i),n(),r(a>0)})})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:u,sendFeatureFlagEvents:l,personProperties:d,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,d,s);d=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,d,s),b=c!==void 0,g,O;if(!b&&!u){let w=await super.getFeatureFlagDetailStateless(t,r,n,d,s,a);if(w===void 0)return;O=w.response,c=XKs(O),g=w?.requestId}let m=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(m))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(m):this.distinctIdHasSentFlagCalls[r]=[m],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,$feature_flag_id:O?.metadata?.id,$feature_flag_version:O?.metadata?.version,$feature_flag_reason:O?.reason?.description??O?.reason?.code,locally_evaluated:b,[`$feature/${t}`]:c,$feature_flag_request_id:g},groups:n,disableGeoip:a})),c}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:u}=n||{},{onlyEvaluateLocally:l,sendFeatureFlagEvents:d,personProperties:s,groupProperties:o}=n||{},c=this.addLocalPersonAndGroupProperties(r,a,s,o);s=c.allPersonProperties,o=c.allGroupProperties;let b;return this.featureFlagsPoller!==void 0&&(i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),i&&(b=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i))),l==null&&(l=!1),d==null&&(d=!0),l==null&&(l=!1),!(b!==void 0)&&!l&&(b=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),b}async getRemoteConfigPayload(t){return(await this.featureFlagsPoller?._requestRemoteConfigPayload(t))?.json()}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:u,groupProperties:l}=r||{},d=this.addLocalPersonAndGroupProperties(t,i,u,l);u=d.allPersonProperties,l=d.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,u,l),o={},c={},b=!0;if(s&&(o=s.response,c=s.payloads,b=s.fallbackToDecide),b&&!a){let g=await super.getFeatureFlagsAndPayloadsStateless(t,i,u,l,n);o={...o,...g.flags||{}},c={...c,...g.payloads||{}}}return{featureFlags:o,featureFlagPayloads:c}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(),super._shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},u={};if(r)for(let l of Object.keys(r))u[l]={$group_key:r[l],...n?.[l]||{}};return{allPersonProperties:a,allGroupProperties:u}}captureException(t,r,i){let n=new Error("PostHog syntheticException");PFn.captureException(this,t,{syntheticException:n},r,i)}},oBp=/\(error: (.*)\)/,PBp=50,jBp="?";function ubD(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return i=>{let n=i.match(r);if(n){let a,u,l,d,s;if(n[1]){l=n[1];let b=l.lastIndexOf(".");if(l[b-1]==="."&&b--,b>0){a=l.slice(0,b),u=l.slice(b+1);let g=a.indexOf(".Module");g>0&&(l=l.slice(g+1),a=a.slice(0,g))}d=void 0}u&&(d=a,s=u),u==="<anonymous>"&&(s=void 0,l=void 0),l===void 0&&(s=s||jBp,l=d?`${d}.${s}`:s);let o=n[2]?.startsWith("file://")?n[2].slice(7):n[2],c=n[5]==="native";return o?.match(/\/[A-Z]:/)&&(o=o.slice(1)),!o&&n[5]&&!c&&(o=n[5]),{filename:o?decodeURI(o):void 0,module:e?e(o):void 0,function:l,lineno:uBp(n[3]),colno:uBp(n[4]),in_app:sbD(o||"",c),platform:"node:javascript"}}if(i.match(t))return{filename:i,platform:"node:javascript"}}}function sbD(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function uBp(e){return parseInt(e||"",10)||void 0}function cbD(e){return[90,ubD(e)]}function lbD(e){let r=[cbD(e)].sort((i,n)=>i[0]-n[0]).map(i=>i[1]);return(i,n=0)=>{let a=[],u=i.split(`
1715
- `);for(let l=n;l<u.length;l++){let d=u[l];if(d.length>1024)continue;let s=oBp.test(d)?d.replace(oBp,"$1"):d;if(!s.match(/\S*Error: /)){for(let o of r){let c=o(s);if(c){a.push(c);break}}if(a.length>=PBp)break}}return fbD(a)}}function fbD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,PBp).map(r=>({...r,filename:r.filename||dbD(t).filename,function:r.function||jBp}))}function dbD(e){return e[e.length-1]||{}}PFn.stackParser=lbD(PvD());PFn.frameModifiers=[SvD];var wFn=class extends JKs{getLibraryId(){return"posthog-node"}};var D3o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new wFn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.65.19",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var pEa=class{async sendEvent(){}async identify(){}async flush(){}};var DFn=require("fs/promises"),EBp=require("os"),MBp=require("path");var wBp=ui(require("crypto")),M3o=new Uint8Array(256),E3o=M3o.length;function ZKs(){return E3o>M3o.length-16&&(wBp.default.randomFillSync(M3o),E3o=0),M3o.slice(E3o,E3o+=16)}var AW=[];for(let e=0;e<256;++e)AW.push((e+256).toString(16).slice(1));function SBp(e,t=0){return AW[e[t+0]]+AW[e[t+1]]+AW[e[t+2]]+AW[e[t+3]]+"-"+AW[e[t+4]]+AW[e[t+5]]+"-"+AW[e[t+6]]+AW[e[t+7]]+"-"+AW[e[t+8]]+AW[e[t+9]]+"-"+AW[e[t+10]]+AW[e[t+11]]+AW[e[t+12]]+AW[e[t+13]]+AW[e[t+14]]+AW[e[t+15]]}var DBp=ui(require("crypto")),kKs={randomUUID:DBp.default.randomUUID};function pbD(e,t,r){if(kKs.randomUUID&&!t&&!e)return kKs.randomUUID();e=e||{};let i=e.random||(e.rng||ZKs)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return SBp(i)}var yae=pbD;var _bD="id",hbD=".fern",_Ea=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new wFn(r),this.userId=t==null?void 0:WVs(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.65.19",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Tu(pl.of((0,EBp.homedir)()),Ra.of(hbD),Ra.of(_bD));await yf(t)||(await(0,DFn.mkdir)((0,MBp.dirname)(t),{recursive:!0}),await(0,DFn.writeFile)(t,yae())),this.persistedDistinctId=(await(0,DFn.readFile)(t)).toString()}return this.persistedDistinctId}};var eYs;async function EFn(){return eYs==null&&(eYs=await ybD()),eYs}async function ybD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new pEa;let r=await QBo();return r!=null?new _Ea({token:r,posthogApiKey:e}):await DRn()!=null?new D3o({posthogApiKey:e}):new _Ea({token:void 0,posthogApiKey:e})}catch{return new pEa}}function hEa(e,t){return function(){return e.apply(t,arguments)}}var{toString:vbD}=Object.prototype,{getPrototypeOf:rYs}=Object,{iterator:q3o,toStringTag:qBp}=Symbol,T3o=(e=>t=>{let r=vbD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),cWt=e=>(e=e.toLowerCase(),t=>T3o(t)===e),C3o=e=>t=>typeof t===e,{isArray:MFn}=Array,yEa=C3o("undefined");function bbD(e){return e!==null&&!yEa(e)&&e.constructor!==null&&!yEa(e.constructor)&&vae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var TBp=cWt("ArrayBuffer");function gbD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&TBp(e.buffer),t}var ObD=C3o("string"),vae=C3o("function"),CBp=C3o("number"),B3o=e=>e!==null&&typeof e=="object",mbD=e=>e===!0||e===!1,A3o=e=>{if(T3o(e)!=="object")return!1;let t=rYs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(qBp in e)&&!(q3o in e)},PbD=cWt("Date"),jbD=cWt("File"),wbD=cWt("Blob"),SbD=cWt("FileList"),DbD=e=>B3o(e)&&vae(e.pipe),EbD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||vae(e.append)&&((t=T3o(e))==="formdata"||t==="object"&&vae(e.toString)&&e.toString()==="[object FormData]"))},MbD=cWt("URLSearchParams"),[AbD,qbD,TbD,CbD]=["ReadableStream","Request","Response","Headers"].map(cWt),BbD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function vEa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),MFn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function BBp(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var XHi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,IBp=e=>!yEa(e)&&e!==XHi;function tYs(){let{caseless:e}=IBp(this)&&this||{},t={},r=(i,n)=>{let a=e&&BBp(t,n)||n;A3o(t[a])&&A3o(i)?t[a]=tYs(t[a],i):A3o(i)?t[a]=tYs({},i):MFn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&vEa(arguments[i],r);return t}var IbD=(e,t,r,{allOwnKeys:i}={})=>(vEa(t,(n,a)=>{r&&vae(n)?e[a]=hEa(n,r):e[a]=n},{allOwnKeys:i}),e),zbD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),xbD=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},RbD=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&rYs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},NbD=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},FbD=e=>{if(!e)return null;if(MFn(e))return e;let t=e.length;if(!CBp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},LbD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&rYs(Uint8Array)),UbD=(e,t)=>{let i=(e&&e[q3o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},VbD=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},WbD=cWt("HTMLFormElement"),HbD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),ABp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),$bD=cWt("RegExp"),zBp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};vEa(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},GbD=e=>{zBp(e,(t,r)=>{if(vae(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(vae(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},QbD=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return MFn(e)?i(e):i(String(e).split(t)),r},JbD=()=>{},KbD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function YbD(e){return!!(e&&vae(e.append)&&e[qBp]==="FormData"&&e[q3o])}var XbD=e=>{let t=new Array(10),r=(i,n)=>{if(B3o(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=MFn(i)?[]:{};return vEa(i,(u,l)=>{let d=r(u,n+1);!yEa(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},ZbD=cWt("AsyncFunction"),kbD=e=>e&&(B3o(e)||vae(e))&&vae(e.then)&&vae(e.catch),xBp=((e,t)=>e?setImmediate:t?((r,i)=>(XHi.addEventListener("message",({source:n,data:a})=>{n===XHi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),XHi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",vae(XHi.postMessage)),e0D=typeof queueMicrotask<"u"?queueMicrotask.bind(XHi):typeof process<"u"&&process.nextTick||xBp,t0D=e=>e!=null&&vae(e[q3o]),os={isArray:MFn,isArrayBuffer:TBp,isBuffer:bbD,isFormData:EbD,isArrayBufferView:gbD,isString:ObD,isNumber:CBp,isBoolean:mbD,isObject:B3o,isPlainObject:A3o,isReadableStream:AbD,isRequest:qbD,isResponse:TbD,isHeaders:CbD,isUndefined:yEa,isDate:PbD,isFile:jbD,isBlob:wbD,isRegExp:$bD,isFunction:vae,isStream:DbD,isURLSearchParams:MbD,isTypedArray:LbD,isFileList:SbD,forEach:vEa,merge:tYs,extend:IbD,trim:BbD,stripBOM:zbD,inherits:xbD,toFlatObject:RbD,kindOf:T3o,kindOfTest:cWt,endsWith:NbD,toArray:FbD,forEachEntry:UbD,matchAll:VbD,isHTMLForm:WbD,hasOwnProperty:ABp,hasOwnProp:ABp,reduceDescriptors:zBp,freezeMethods:GbD,toObjectSet:QbD,toCamelCase:HbD,noop:JbD,toFiniteNumber:KbD,findKey:BBp,global:XHi,isContextDefined:IBp,isSpecCompliantForm:YbD,toJSONObject:XbD,isAsyncFn:ZbD,isThenable:kbD,setImmediate:xBp,asap:e0D,isIterable:t0D};function AFn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}os.inherits(AFn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:os.toJSONObject(this.config),code:this.code,status:this.status}}});var RBp=AFn.prototype,NBp={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{NBp[e]={value:e}});Object.defineProperties(AFn,NBp);Object.defineProperty(RBp,"isAxiosError",{value:!0});AFn.from=(e,t,r,i,n,a)=>{let u=Object.create(RBp);return os.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),AFn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var Fp=AFn;var FBp=ui(e3o(),1),I3o=FBp.default;function iYs(e){return os.isPlainObject(e)||os.isArray(e)}function UBp(e){return os.endsWith(e,"[]")?e.slice(0,-2):e}function LBp(e,t,r){return e?e.concat(t).map(function(n,a){return n=UBp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function r0D(e){return os.isArray(e)&&!e.some(iYs)}var i0D=os.toFlatObject(os,{},null,function(t){return/^is[A-Z]/.test(t)});function n0D(e,t,r){if(!os.isObject(e))throw new TypeError("target must be an object");t=t||new(I3o||FormData),r=os.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!os.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&os.isSpecCompliantForm(t);if(!os.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(os.isDate(O))return O.toISOString();if(os.isBoolean(O))return O.toString();if(!d&&os.isBlob(O))throw new Fp("Blob is not supported. Use a Buffer instead.");return os.isArrayBuffer(O)||os.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,w){let E=O;if(O&&!w&&typeof O=="object"){if(os.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(os.isArray(O)&&r0D(O)||(os.isFileList(O)||os.endsWith(m,"[]"))&&(E=os.toArray(O)))return m=UBp(m),E.forEach(function(A,D){!(os.isUndefined(A)||A===null)&&t.append(u===!0?LBp([m],D,a):u===null?m:m+"[]",s(A))}),!1}return iYs(O)?!0:(t.append(LBp(w,m,a),s(O)),!1)}let c=[],b=Object.assign(i0D,{defaultVisitor:o,convertValue:s,isVisitable:iYs});function g(O,m){if(!os.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),os.forEach(O,function(E,q){(!(os.isUndefined(E)||E===null)&&n.call(t,E,os.isString(q)?q.trim():q,m,b))===!0&&g(E,m?m.concat(q):[q])}),c.pop()}}if(!os.isObject(e))throw new TypeError("data must be an object");return g(e),t}var ZSi=n0D;function VBp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function WBp(e,t){this._pairs=[],e&&ZSi(e,this,t)}var HBp=WBp.prototype;HBp.append=function(t,r){this._pairs.push([t,r])};HBp.toString=function(t){let r=t?function(i){return t.call(this,i,VBp)}:VBp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var $Bp=WBp;function a0D(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ZHi(e,t,r){if(!t)return e;let i=r&&r.encode||a0D;os.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=os.isURLSearchParams(t)?t.toString():new $Bp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var nYs=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){os.forEach(this.handlers,function(i){i!==null&&t(i)})}},aYs=nYs;var qFn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var KBp=ui(require("crypto"),1);var GBp=ui(require("url"),1),QBp=GBp.default.URLSearchParams;var oYs="abcdefghijklmnopqrstuvwxyz",JBp="0123456789",YBp={DIGIT:JBp,ALPHA:oYs,ALPHA_DIGIT:oYs+oYs.toUpperCase()+JBp},o0D=(e=16,t=YBp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);KBp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},XBp={isNode:!0,classes:{URLSearchParams:QBp,FormData:I3o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:YBp,generateString:o0D,protocols:["http","https","file","data"]};var cYs={};Po(cYs,{hasBrowserEnv:()=>sYs,hasStandardBrowserEnv:()=>u0D,hasStandardBrowserWebWorkerEnv:()=>s0D,navigator:()=>uYs,origin:()=>c0D});var sYs=typeof window<"u"&&typeof document<"u",uYs=typeof navigator=="object"&&navigator||void 0,u0D=sYs&&(!uYs||["ReactNative","NativeScript","NS"].indexOf(uYs.product)<0),s0D=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",c0D=sYs&&window.location.href||"http://localhost";var oA={...cYs,...XBp};function lYs(e,t){return ZSi(e,new oA.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return oA.isNode&&os.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function l0D(e){return os.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function f0D(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function d0D(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),d=a>=r.length;return u=!u&&os.isArray(n)?n.length:u,d?(os.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!os.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&os.isArray(n[u])&&(n[u]=f0D(n[u])),!l)}if(os.isFormData(e)&&os.isFunction(e.entries)){let r={};return os.forEachEntry(e,(i,n)=>{t(l0D(i),n,r,0)}),r}return null}var z3o=d0D;function p0D(e,t,r){if(os.isString(e))try{return(t||JSON.parse)(e),os.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var fYs={transitional:qFn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=os.isObject(t);if(a&&os.isHTMLForm(t)&&(t=new FormData(t)),os.isFormData(t))return n?JSON.stringify(z3o(t)):t;if(os.isArrayBuffer(t)||os.isBuffer(t)||os.isStream(t)||os.isFile(t)||os.isBlob(t)||os.isReadableStream(t))return t;if(os.isArrayBufferView(t))return t.buffer;if(os.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return lYs(t,this.formSerializer).toString();if((l=os.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return ZSi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),p0D(t)):t}],transformResponse:[function(t){let r=this.transitional||fYs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(os.isResponse(t)||os.isReadableStream(t))return t;if(t&&os.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?Fp.from(l,Fp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:oA.classes.FormData,Blob:oA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};os.forEach(["delete","get","head","post","put","patch"],e=>{fYs.headers[e]={}});var TFn=fYs;var _0D=os.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ZBp=e=>{let t={},r,i,n;return e&&e.split(`
1715
+ `);for(let l=n;l<u.length;l++){let d=u[l];if(d.length>1024)continue;let s=oBp.test(d)?d.replace(oBp,"$1"):d;if(!s.match(/\S*Error: /)){for(let o of r){let c=o(s);if(c){a.push(c);break}}if(a.length>=PBp)break}}return fbD(a)}}function fbD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,PBp).map(r=>({...r,filename:r.filename||dbD(t).filename,function:r.function||jBp}))}function dbD(e){return e[e.length-1]||{}}PFn.stackParser=lbD(PvD());PFn.frameModifiers=[SvD];var wFn=class extends JKs{getLibraryId(){return"posthog-node"}};var D3o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new wFn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.65.20",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var pEa=class{async sendEvent(){}async identify(){}async flush(){}};var DFn=require("fs/promises"),EBp=require("os"),MBp=require("path");var wBp=ui(require("crypto")),M3o=new Uint8Array(256),E3o=M3o.length;function ZKs(){return E3o>M3o.length-16&&(wBp.default.randomFillSync(M3o),E3o=0),M3o.slice(E3o,E3o+=16)}var AW=[];for(let e=0;e<256;++e)AW.push((e+256).toString(16).slice(1));function SBp(e,t=0){return AW[e[t+0]]+AW[e[t+1]]+AW[e[t+2]]+AW[e[t+3]]+"-"+AW[e[t+4]]+AW[e[t+5]]+"-"+AW[e[t+6]]+AW[e[t+7]]+"-"+AW[e[t+8]]+AW[e[t+9]]+"-"+AW[e[t+10]]+AW[e[t+11]]+AW[e[t+12]]+AW[e[t+13]]+AW[e[t+14]]+AW[e[t+15]]}var DBp=ui(require("crypto")),kKs={randomUUID:DBp.default.randomUUID};function pbD(e,t,r){if(kKs.randomUUID&&!t&&!e)return kKs.randomUUID();e=e||{};let i=e.random||(e.rng||ZKs)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return SBp(i)}var yae=pbD;var _bD="id",hbD=".fern",_Ea=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new wFn(r),this.userId=t==null?void 0:WVs(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.65.20",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Tu(pl.of((0,EBp.homedir)()),Ra.of(hbD),Ra.of(_bD));await yf(t)||(await(0,DFn.mkdir)((0,MBp.dirname)(t),{recursive:!0}),await(0,DFn.writeFile)(t,yae())),this.persistedDistinctId=(await(0,DFn.readFile)(t)).toString()}return this.persistedDistinctId}};var eYs;async function EFn(){return eYs==null&&(eYs=await ybD()),eYs}async function ybD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new pEa;let r=await QBo();return r!=null?new _Ea({token:r,posthogApiKey:e}):await DRn()!=null?new D3o({posthogApiKey:e}):new _Ea({token:void 0,posthogApiKey:e})}catch{return new pEa}}function hEa(e,t){return function(){return e.apply(t,arguments)}}var{toString:vbD}=Object.prototype,{getPrototypeOf:rYs}=Object,{iterator:q3o,toStringTag:qBp}=Symbol,T3o=(e=>t=>{let r=vbD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),cWt=e=>(e=e.toLowerCase(),t=>T3o(t)===e),C3o=e=>t=>typeof t===e,{isArray:MFn}=Array,yEa=C3o("undefined");function bbD(e){return e!==null&&!yEa(e)&&e.constructor!==null&&!yEa(e.constructor)&&vae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var TBp=cWt("ArrayBuffer");function gbD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&TBp(e.buffer),t}var ObD=C3o("string"),vae=C3o("function"),CBp=C3o("number"),B3o=e=>e!==null&&typeof e=="object",mbD=e=>e===!0||e===!1,A3o=e=>{if(T3o(e)!=="object")return!1;let t=rYs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(qBp in e)&&!(q3o in e)},PbD=cWt("Date"),jbD=cWt("File"),wbD=cWt("Blob"),SbD=cWt("FileList"),DbD=e=>B3o(e)&&vae(e.pipe),EbD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||vae(e.append)&&((t=T3o(e))==="formdata"||t==="object"&&vae(e.toString)&&e.toString()==="[object FormData]"))},MbD=cWt("URLSearchParams"),[AbD,qbD,TbD,CbD]=["ReadableStream","Request","Response","Headers"].map(cWt),BbD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function vEa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),MFn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function BBp(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var XHi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,IBp=e=>!yEa(e)&&e!==XHi;function tYs(){let{caseless:e}=IBp(this)&&this||{},t={},r=(i,n)=>{let a=e&&BBp(t,n)||n;A3o(t[a])&&A3o(i)?t[a]=tYs(t[a],i):A3o(i)?t[a]=tYs({},i):MFn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&vEa(arguments[i],r);return t}var IbD=(e,t,r,{allOwnKeys:i}={})=>(vEa(t,(n,a)=>{r&&vae(n)?e[a]=hEa(n,r):e[a]=n},{allOwnKeys:i}),e),zbD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),xbD=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},RbD=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&rYs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},NbD=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},FbD=e=>{if(!e)return null;if(MFn(e))return e;let t=e.length;if(!CBp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},LbD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&rYs(Uint8Array)),UbD=(e,t)=>{let i=(e&&e[q3o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},VbD=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},WbD=cWt("HTMLFormElement"),HbD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),ABp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),$bD=cWt("RegExp"),zBp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};vEa(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},GbD=e=>{zBp(e,(t,r)=>{if(vae(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(vae(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},QbD=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return MFn(e)?i(e):i(String(e).split(t)),r},JbD=()=>{},KbD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function YbD(e){return!!(e&&vae(e.append)&&e[qBp]==="FormData"&&e[q3o])}var XbD=e=>{let t=new Array(10),r=(i,n)=>{if(B3o(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=MFn(i)?[]:{};return vEa(i,(u,l)=>{let d=r(u,n+1);!yEa(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},ZbD=cWt("AsyncFunction"),kbD=e=>e&&(B3o(e)||vae(e))&&vae(e.then)&&vae(e.catch),xBp=((e,t)=>e?setImmediate:t?((r,i)=>(XHi.addEventListener("message",({source:n,data:a})=>{n===XHi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),XHi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",vae(XHi.postMessage)),e0D=typeof queueMicrotask<"u"?queueMicrotask.bind(XHi):typeof process<"u"&&process.nextTick||xBp,t0D=e=>e!=null&&vae(e[q3o]),os={isArray:MFn,isArrayBuffer:TBp,isBuffer:bbD,isFormData:EbD,isArrayBufferView:gbD,isString:ObD,isNumber:CBp,isBoolean:mbD,isObject:B3o,isPlainObject:A3o,isReadableStream:AbD,isRequest:qbD,isResponse:TbD,isHeaders:CbD,isUndefined:yEa,isDate:PbD,isFile:jbD,isBlob:wbD,isRegExp:$bD,isFunction:vae,isStream:DbD,isURLSearchParams:MbD,isTypedArray:LbD,isFileList:SbD,forEach:vEa,merge:tYs,extend:IbD,trim:BbD,stripBOM:zbD,inherits:xbD,toFlatObject:RbD,kindOf:T3o,kindOfTest:cWt,endsWith:NbD,toArray:FbD,forEachEntry:UbD,matchAll:VbD,isHTMLForm:WbD,hasOwnProperty:ABp,hasOwnProp:ABp,reduceDescriptors:zBp,freezeMethods:GbD,toObjectSet:QbD,toCamelCase:HbD,noop:JbD,toFiniteNumber:KbD,findKey:BBp,global:XHi,isContextDefined:IBp,isSpecCompliantForm:YbD,toJSONObject:XbD,isAsyncFn:ZbD,isThenable:kbD,setImmediate:xBp,asap:e0D,isIterable:t0D};function AFn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}os.inherits(AFn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:os.toJSONObject(this.config),code:this.code,status:this.status}}});var RBp=AFn.prototype,NBp={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{NBp[e]={value:e}});Object.defineProperties(AFn,NBp);Object.defineProperty(RBp,"isAxiosError",{value:!0});AFn.from=(e,t,r,i,n,a)=>{let u=Object.create(RBp);return os.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),AFn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var Fp=AFn;var FBp=ui(e3o(),1),I3o=FBp.default;function iYs(e){return os.isPlainObject(e)||os.isArray(e)}function UBp(e){return os.endsWith(e,"[]")?e.slice(0,-2):e}function LBp(e,t,r){return e?e.concat(t).map(function(n,a){return n=UBp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function r0D(e){return os.isArray(e)&&!e.some(iYs)}var i0D=os.toFlatObject(os,{},null,function(t){return/^is[A-Z]/.test(t)});function n0D(e,t,r){if(!os.isObject(e))throw new TypeError("target must be an object");t=t||new(I3o||FormData),r=os.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!os.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&os.isSpecCompliantForm(t);if(!os.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(os.isDate(O))return O.toISOString();if(os.isBoolean(O))return O.toString();if(!d&&os.isBlob(O))throw new Fp("Blob is not supported. Use a Buffer instead.");return os.isArrayBuffer(O)||os.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,w){let E=O;if(O&&!w&&typeof O=="object"){if(os.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(os.isArray(O)&&r0D(O)||(os.isFileList(O)||os.endsWith(m,"[]"))&&(E=os.toArray(O)))return m=UBp(m),E.forEach(function(A,D){!(os.isUndefined(A)||A===null)&&t.append(u===!0?LBp([m],D,a):u===null?m:m+"[]",s(A))}),!1}return iYs(O)?!0:(t.append(LBp(w,m,a),s(O)),!1)}let c=[],b=Object.assign(i0D,{defaultVisitor:o,convertValue:s,isVisitable:iYs});function g(O,m){if(!os.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),os.forEach(O,function(E,q){(!(os.isUndefined(E)||E===null)&&n.call(t,E,os.isString(q)?q.trim():q,m,b))===!0&&g(E,m?m.concat(q):[q])}),c.pop()}}if(!os.isObject(e))throw new TypeError("data must be an object");return g(e),t}var ZSi=n0D;function VBp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function WBp(e,t){this._pairs=[],e&&ZSi(e,this,t)}var HBp=WBp.prototype;HBp.append=function(t,r){this._pairs.push([t,r])};HBp.toString=function(t){let r=t?function(i){return t.call(this,i,VBp)}:VBp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var $Bp=WBp;function a0D(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ZHi(e,t,r){if(!t)return e;let i=r&&r.encode||a0D;os.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=os.isURLSearchParams(t)?t.toString():new $Bp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var nYs=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){os.forEach(this.handlers,function(i){i!==null&&t(i)})}},aYs=nYs;var qFn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var KBp=ui(require("crypto"),1);var GBp=ui(require("url"),1),QBp=GBp.default.URLSearchParams;var oYs="abcdefghijklmnopqrstuvwxyz",JBp="0123456789",YBp={DIGIT:JBp,ALPHA:oYs,ALPHA_DIGIT:oYs+oYs.toUpperCase()+JBp},o0D=(e=16,t=YBp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);KBp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},XBp={isNode:!0,classes:{URLSearchParams:QBp,FormData:I3o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:YBp,generateString:o0D,protocols:["http","https","file","data"]};var cYs={};Po(cYs,{hasBrowserEnv:()=>sYs,hasStandardBrowserEnv:()=>u0D,hasStandardBrowserWebWorkerEnv:()=>s0D,navigator:()=>uYs,origin:()=>c0D});var sYs=typeof window<"u"&&typeof document<"u",uYs=typeof navigator=="object"&&navigator||void 0,u0D=sYs&&(!uYs||["ReactNative","NativeScript","NS"].indexOf(uYs.product)<0),s0D=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",c0D=sYs&&window.location.href||"http://localhost";var oA={...cYs,...XBp};function lYs(e,t){return ZSi(e,new oA.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return oA.isNode&&os.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function l0D(e){return os.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function f0D(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function d0D(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),d=a>=r.length;return u=!u&&os.isArray(n)?n.length:u,d?(os.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!os.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&os.isArray(n[u])&&(n[u]=f0D(n[u])),!l)}if(os.isFormData(e)&&os.isFunction(e.entries)){let r={};return os.forEachEntry(e,(i,n)=>{t(l0D(i),n,r,0)}),r}return null}var z3o=d0D;function p0D(e,t,r){if(os.isString(e))try{return(t||JSON.parse)(e),os.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var fYs={transitional:qFn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=os.isObject(t);if(a&&os.isHTMLForm(t)&&(t=new FormData(t)),os.isFormData(t))return n?JSON.stringify(z3o(t)):t;if(os.isArrayBuffer(t)||os.isBuffer(t)||os.isStream(t)||os.isFile(t)||os.isBlob(t)||os.isReadableStream(t))return t;if(os.isArrayBufferView(t))return t.buffer;if(os.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return lYs(t,this.formSerializer).toString();if((l=os.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return ZSi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),p0D(t)):t}],transformResponse:[function(t){let r=this.transitional||fYs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(os.isResponse(t)||os.isReadableStream(t))return t;if(t&&os.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?Fp.from(l,Fp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:oA.classes.FormData,Blob:oA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};os.forEach(["delete","get","head","post","put","patch"],e=>{fYs.headers[e]={}});var TFn=fYs;var _0D=os.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ZBp=e=>{let t={},r,i,n;return e&&e.split(`
1716
1716
  `).forEach(function(u){n=u.indexOf(":"),r=u.substring(0,n).trim().toLowerCase(),i=u.substring(n+1).trim(),!(!r||t[r]&&_0D[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var kBp=Symbol("internals");function bEa(e){return e&&String(e).trim().toLowerCase()}function x3o(e){return e===!1||e==null?e:os.isArray(e)?e.map(x3o):String(e)}function h0D(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}var y0D=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function dYs(e,t,r,i,n){if(os.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!os.isString(t)){if(os.isString(i))return t.indexOf(i)!==-1;if(os.isRegExp(i))return i.test(t)}}function v0D(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function b0D(e,t){let r=os.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(n,a,u){return this[i].call(this,t,n,a,u)},configurable:!0})})}var CFn=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(l,d,s){let o=bEa(d);if(!o)throw new Error("header name must be a non-empty string");let c=os.findKey(n,o);(!c||n[c]===void 0||s===!0||s===void 0&&n[c]!==!1)&&(n[c||d]=x3o(l))}let u=(l,d)=>os.forEach(l,(s,o)=>a(s,o,d));if(os.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(os.isString(t)&&(t=t.trim())&&!y0D(t))u(ZBp(t),r);else if(os.isObject(t)&&os.isIterable(t)){let l={},d,s;for(let o of t){if(!os.isArray(o))throw TypeError("Object iterator must return a key-value pair");l[s=o[0]]=(d=l[s])?os.isArray(d)?[...d,o[1]]:[d,o[1]]:o[1]}u(l,r)}else t!=null&&a(r,t,i);return this}get(t,r){if(t=bEa(t),t){let i=os.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return h0D(n);if(os.isFunction(r))return r.call(this,n,i);if(os.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=bEa(t),t){let i=os.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||dYs(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(u){if(u=bEa(u),u){let l=os.findKey(i,u);l&&(!r||dYs(i,i[l],l,r))&&(delete i[l],n=!0)}}return os.isArray(t)?t.forEach(a):a(t),n}clear(t){let r=Object.keys(this),i=r.length,n=!1;for(;i--;){let a=r[i];(!t||dYs(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return os.forEach(this,(n,a)=>{let u=os.findKey(i,a);if(u){r[u]=x3o(n),delete r[a];return}let l=t?v0D(a):String(a).trim();l!==a&&delete r[a],r[l]=x3o(n),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return os.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&os.isArray(i)?i.join(", "):i)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
1717
1717
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let i=new this(t);return r.forEach(n=>i.set(n)),i}static accessor(t){let i=(this[kBp]=this[kBp]={accessors:{}}).accessors,n=this.prototype;function a(u){let l=bEa(u);i[l]||(b0D(n,u),i[l]=!0)}return os.isArray(t)?t.forEach(a):a(t),this}};CFn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);os.reduceDescriptors(CFn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});os.freezeMethods(CFn);var aR=CFn;function gEa(e,t){let r=this||TFn,i=t||r,n=aR.from(i.headers),a=i.data;return os.forEach(e,function(l){a=l.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function OEa(e){return!!(e&&e.__CANCEL__)}function eIp(e,t,r){Fp.call(this,e??"canceled",Fp.ERR_CANCELED,t,r),this.name="CanceledError"}os.inherits(eIp,Fp,{__CANCEL__:!0});var WEe=eIp;function Ktr(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new Fp("Request failed with status code "+r.status,[Fp.ERR_BAD_REQUEST,Fp.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function pYs(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function _Ys(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function kHi(e,t,r){let i=!pYs(t);return e&&(i||r==!1)?_Ys(e,t):t}var yIp=ui(rEa(),1),vIp=ui(require("http"),1),bIp=ui(require("https"),1),gIp=ui(require("util"),1),OIp=ui(_Ks(),1),_fi=ui(require("zlib"),1);var e$i="1.10.0";function mEa(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var g0D=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function hYs(e,t,r){let i=r&&r.Blob||oA.classes.Blob,n=mEa(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=g0D.exec(e);if(!a)throw new Fp("Invalid URL",Fp.ERR_INVALID_URL);let u=a[1],l=a[2],d=a[3],s=Buffer.from(decodeURIComponent(d),l?"base64":"utf8");if(t){if(!i)throw new Fp("Blob is not supported",Fp.ERR_NOT_SUPPORT);return new i([s],{type:u})}return s}throw new Fp("Unsupported protocol "+n,Fp.ERR_NOT_SUPPORT)}var r$i=ui(require("stream"),1);var tIp=ui(require("stream"),1);var yYs=Symbol("internals"),vYs=class extends tIp.default.Transform{constructor(t){t=os.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!os.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[yYs]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",i=>{i==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[yYs];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[yYs],a=n.maxRate,u=this.readableHighWaterMark,l=n.timeWindow,d=1e3/l,s=a/d,o=n.minChunkSize!==!1?Math.max(n.minChunkSize,s*.01):0,c=(g,O)=>{let m=Buffer.byteLength(g);n.bytesSeen+=m,n.bytes+=m,n.isCaptured&&this.emit("progress",n.bytesSeen),this.push(g)?process.nextTick(O):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(O)}},b=(g,O)=>{let m=Buffer.byteLength(g),w=null,E=u,q,A=0;if(a){let D=Date.now();(!n.ts||(A=D-n.ts)>=l)&&(n.ts=D,q=s-n.bytes,n.bytes=q<0?-q:0,A=0),q=s-n.bytes}if(a){if(q<=0)return setTimeout(()=>{O(null,g)},l-A);q<E&&(E=q)}E&&m>E&&m-E>o&&(w=g.subarray(E),g=g.subarray(0,E)),c(g,w?()=>{process.nextTick(O,null,w)}:O)};b(t,function g(O,m){if(O)return i(O);m?b(m,g):i(null)})}},bYs=vYs;var mIp=require("events");var iIp=ui(require("util"),1),nIp=require("stream");var{asyncIterator:rIp}=Symbol,O0D=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[rIp]?yield*e[rIp]():yield e},R3o=O0D;var m0D=oA.ALPHABET.ALPHA_DIGIT+"-_",PEa=typeof TextEncoder=="function"?new TextEncoder:new iIp.default.TextEncoder,t$i=`\r
1718
1718
  `,P0D=PEa.encode(t$i),j0D=2,gYs=class{constructor(t,r){let{escapeName:i}=this.constructor,n=os.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${t$i}`;n?r=PEa.encode(String(r).replace(/\r?\n|\r\n?/g,t$i)):a+=`Content-Type: ${r.type||"application/octet-stream"}${t$i}`,this.headers=PEa.encode(a+t$i),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+j0D,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;os.isTypedArray(t)?yield t:yield*R3o(t),yield P0D}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},w0D=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+oA.generateString(n,m0D)}=r||{};if(!os.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let u=PEa.encode("--"+a+t$i),l=PEa.encode("--"+a+"--"+t$i),d=l.byteLength,s=Array.from(e.entries()).map(([c,b])=>{let g=new gYs(c,b);return d+=g.size,g});d+=u.byteLength*s.length,d=os.toFiniteNumber(d);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(o["Content-Length"]=d),t&&t(o),nIp.Readable.from(async function*(){for(let c of s)yield u,yield*c.encode();yield l}())},aIp=w0D;var oIp=ui(require("stream"),1),OYs=class extends oIp.default.Transform{__transform(t,r,i){this.push(t),i()}_transform(t,r,i){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let n=Buffer.alloc(2);n[0]=120,n[1]=156,this.push(n,r)}this.__transform(t,r,i)}},uIp=OYs;var S0D=(e,t)=>os.isAsyncFn(e)?function(...r){let i=r.pop();e.apply(this,r).then(n=>{try{t?i(null,...t(n)):i(null,n)}catch(a){i(a)}},i)}:e,sIp=S0D;function D0D(e,t){e=e||10;let r=new Array(e),i=new Array(e),n=0,a=0,u;return t=t!==void 0?t:1e3,function(d){let s=Date.now(),o=i[a];u||(u=s),r[n]=d,i[n]=s;let c=a,b=0;for(;c!==n;)b+=r[c++],c=c%e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),s-u<t)return;let g=o&&s-o;return g?Math.round(b*1e3/g):void 0}}var cIp=D0D;function E0D(e,t){let r=0,i=1e3/t,n,a,u=(s,o=Date.now())=>{r=o,n=null,a&&(clearTimeout(a),a=null),e.apply(null,s)};return[(...s)=>{let o=Date.now(),c=o-r;c>=i?u(s,o):(n=s,a||(a=setTimeout(()=>{a=null,u(n)},i-c)))},()=>n&&u(n)]}var lIp=E0D;var pfi=(e,t,r=3)=>{let i=0,n=cIp(50,250);return lIp(a=>{let u=a.loaded,l=a.lengthComputable?a.total:void 0,d=u-i,s=n(d),o=u<=l;i=u;let c={loaded:u,total:l,progress:l?u/l:void 0,bytes:d,rate:s||void 0,estimated:s&&l&&o?(l-u)/s:void 0,event:a,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(c)},r)},BFn=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},IFn=e=>(...t)=>os.asap(()=>e(...t));var fIp={flush:_fi.default.constants.Z_SYNC_FLUSH,finishFlush:_fi.default.constants.Z_SYNC_FLUSH},M0D={flush:_fi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:_fi.default.constants.BROTLI_OPERATION_FLUSH},dIp=os.isFunction(_fi.default.createBrotliDecompress),{http:A0D,https:q0D}=OIp.default,T0D=/https:?/,pIp=oA.protocols.map(e=>e+":"),_Ip=(e,[t,r])=>(e.on("end",r).on("error",r),t);function C0D(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function PIp(e,t,r){let i=t;if(!i&&i!==!1){let n=yIp.default.getProxyForUrl(r);n&&(i=new URL(n))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));let a=Buffer.from(i.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let n=i.hostname||i.host;e.hostname=n,e.host=n,e.port=i.port,e.path=r,i.protocol&&(e.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}e.beforeRedirects.proxy=function(a){PIp(a,t,a.href)}}var B0D=typeof process<"u"&&os.kindOf(process)==="process",I0D=e=>new Promise((t,r)=>{let i,n,a=(d,s)=>{n||(n=!0,i&&i(d,s))},u=d=>{a(d),t(d)},l=d=>{a(d,!0),r(d)};e(u,l,d=>i=d).catch(l)}),z0D=({address:e,family:t})=>{if(!os.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},hIp=(e,t)=>z0D(os.isObject(e)?e:{address:e,family:t}),jIp=B0D&&function(t){return I0D(async function(i,n,a){let{data:u,lookup:l,family:d}=t,{responseType:s,responseEncoding:o}=t,c=t.method.toUpperCase(),b,g=!1,O;if(l){let Oe=sIp(l,Ue=>os.isArray(Ue)?Ue:[Ue]);l=(Ue,wt,De)=>{Oe(Ue,wt,(Te,xt,Pe)=>{if(Te)return De(Te);let ot=os.isArray(xt)?xt.map(at=>hIp(at)):[hIp(xt,Pe)];wt.all?De(Te,ot):De(Te,ot[0].address,ot[0].family)})}}let m=new mIp.EventEmitter,w=()=>{t.cancelToken&&t.cancelToken.unsubscribe(E),t.signal&&t.signal.removeEventListener("abort",E),m.removeAllListeners()};a((Oe,Ue)=>{b=!0,Ue&&(g=!0,w())});function E(Oe){m.emit("abort",!Oe||Oe.type?new WEe(null,t,O):Oe)}m.once("abort",n),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(E),t.signal&&(t.signal.aborted?E():t.signal.addEventListener("abort",E)));let q=kHi(t.baseURL,t.url,t.allowAbsoluteUrls),A=new URL(q,oA.hasBrowserEnv?oA.origin:void 0),D=A.protocol||pIp[0];if(D==="data:"){let Oe;if(c!=="GET")return Ktr(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{Oe=hYs(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(Ue){throw Fp.from(Ue,Fp.ERR_BAD_REQUEST,t)}return s==="text"?(Oe=Oe.toString(o),(!o||o==="utf8")&&(Oe=os.stripBOM(Oe))):s==="stream"&&(Oe=r$i.default.Readable.from(Oe)),Ktr(i,n,{data:Oe,status:200,statusText:"OK",headers:new aR,config:t})}if(pIp.indexOf(D)===-1)return n(new Fp("Unsupported protocol "+D,Fp.ERR_BAD_REQUEST,t));let C=aR.from(t.headers).normalize();C.set("User-Agent","axios/"+e$i,!1);let{onUploadProgress:x,onDownloadProgress:G}=t,I=t.maxRate,F,V;if(os.isSpecCompliantForm(u)){let Oe=C.getContentType(/boundary=([-_\w\d]{10,70})/i);u=aIp(u,Ue=>{C.set(Ue)},{tag:`axios-${e$i}-boundary`,boundary:Oe&&Oe[1]||void 0})}else if(os.isFormData(u)&&os.isFunction(u.getHeaders)){if(C.set(u.getHeaders()),!C.hasContentLength())try{let Oe=await gIp.default.promisify(u.getLength).call(u);Number.isFinite(Oe)&&Oe>=0&&C.setContentLength(Oe)}catch{}}else if(os.isBlob(u)||os.isFile(u))u.size&&C.setContentType(u.type||"application/octet-stream"),C.setContentLength(u.size||0),u=r$i.default.Readable.from(R3o(u));else if(u&&!os.isStream(u)){if(!Buffer.isBuffer(u))if(os.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(os.isString(u))u=Buffer.from(u,"utf-8");else return n(new Fp("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Fp.ERR_BAD_REQUEST,t));if(C.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return n(new Fp("Request body larger than maxBodyLength limit",Fp.ERR_BAD_REQUEST,t))}let K=os.toFiniteNumber(C.getContentLength());os.isArray(I)?(F=I[0],V=I[1]):F=V=I,u&&(x||F)&&(os.isStream(u)||(u=r$i.default.Readable.from(u,{objectMode:!1})),u=r$i.default.pipeline([u,new bYs({maxRate:os.toFiniteNumber(F)})],os.noop),x&&u.on("progress",_Ip(u,BFn(K,pfi(IFn(x),!1,3)))));let Y;if(t.auth){let Oe=t.auth.username||"",Ue=t.auth.password||"";Y=Oe+":"+Ue}if(!Y&&A.username){let Oe=A.username,Ue=A.password;Y=Oe+":"+Ue}Y&&C.delete("authorization");let Z;try{Z=ZHi(A.pathname+A.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Oe){let Ue=new Error(Oe.message);return Ue.config=t,Ue.url=t.url,Ue.exists=!0,n(Ue)}C.set("Accept-Encoding","gzip, compress, deflate"+(dIp?", br":""),!1);let oe={path:Z,method:c,headers:C.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:Y,protocol:D,family:d,beforeRedirect:C0D,beforeRedirects:{}};!os.isUndefined(l)&&(oe.lookup=l),t.socketPath?oe.socketPath=t.socketPath:(oe.hostname=A.hostname.startsWith("[")?A.hostname.slice(1,-1):A.hostname,oe.port=A.port,PIp(oe,t.proxy,D+"//"+A.hostname+(A.port?":"+A.port:"")+oe.path));let pe,de=T0D.test(oe.protocol);if(oe.agent=de?t.httpsAgent:t.httpAgent,t.transport?pe=t.transport:t.maxRedirects===0?pe=de?bIp.default:vIp.default:(t.maxRedirects&&(oe.maxRedirects=t.maxRedirects),t.beforeRedirect&&(oe.beforeRedirects.config=t.beforeRedirect),pe=de?q0D:A0D),t.maxBodyLength>-1?oe.maxBodyLength=t.maxBodyLength:oe.maxBodyLength=1/0,t.insecureHTTPParser&&(oe.insecureHTTPParser=t.insecureHTTPParser),O=pe.request(oe,function(Ue){if(O.destroyed)return;let wt=[Ue],De=+Ue.headers["content-length"];if(G||V){let at=new bYs({maxRate:os.toFiniteNumber(V)});G&&at.on("progress",_Ip(at,BFn(De,pfi(IFn(G),!0,3)))),wt.push(at)}let Te=Ue,xt=Ue.req||O;if(t.decompress!==!1&&Ue.headers["content-encoding"])switch((c==="HEAD"||Ue.statusCode===204)&&delete Ue.headers["content-encoding"],(Ue.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":wt.push(_fi.default.createUnzip(fIp)),delete Ue.headers["content-encoding"];break;case"deflate":wt.push(new uIp),wt.push(_fi.default.createUnzip(fIp)),delete Ue.headers["content-encoding"];break;case"br":dIp&&(wt.push(_fi.default.createBrotliDecompress(M0D)),delete Ue.headers["content-encoding"])}Te=wt.length>1?r$i.default.pipeline(wt,os.noop):wt[0];let Pe=r$i.default.finished(Te,()=>{Pe(),w()}),ot={status:Ue.statusCode,statusText:Ue.statusMessage,headers:new aR(Ue.headers),config:t,request:xt};if(s==="stream")ot.data=Te,Ktr(i,n,ot);else{let at=[],me=0;Te.on("data",function(jt){at.push(jt),me+=jt.length,t.maxContentLength>-1&&me>t.maxContentLength&&(g=!0,Te.destroy(),n(new Fp("maxContentLength size of "+t.maxContentLength+" exceeded",Fp.ERR_BAD_RESPONSE,t,xt)))}),Te.on("aborted",function(){if(g)return;let jt=new Fp("stream has been aborted",Fp.ERR_BAD_RESPONSE,t,xt);Te.destroy(jt),n(jt)}),Te.on("error",function(jt){O.destroyed||n(Fp.from(jt,null,t,xt))}),Te.on("end",function(){try{let jt=at.length===1?at[0]:Buffer.concat(at);s!=="arraybuffer"&&(jt=jt.toString(o),(!o||o==="utf8")&&(jt=os.stripBOM(jt))),ot.data=jt}catch(jt){return n(Fp.from(jt,null,t,ot.request,ot))}Ktr(i,n,ot)})}m.once("abort",at=>{Te.destroyed||(Te.emit("error",at),Te.destroy())})}),m.once("abort",Oe=>{n(Oe),O.destroy(Oe)}),O.on("error",function(Ue){n(Fp.from(Ue,null,t,O))}),O.on("socket",function(Ue){Ue.setKeepAlive(!0,1e3*60)}),t.timeout){let Oe=parseInt(t.timeout,10);if(Number.isNaN(Oe)){n(new Fp("error trying to parse `config.timeout` to int",Fp.ERR_BAD_OPTION_VALUE,t,O));return}O.setTimeout(Oe,function(){if(b)return;let wt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",De=t.transitional||qFn;t.timeoutErrorMessage&&(wt=t.timeoutErrorMessage),n(new Fp(wt,De.clarifyTimeoutError?Fp.ETIMEDOUT:Fp.ECONNABORTED,t,O)),E()})}if(os.isStream(u)){let Oe=!1,Ue=!1;u.on("end",()=>{Oe=!0}),u.once("error",wt=>{Ue=!0,O.destroy(wt)}),u.on("close",()=>{!Oe&&!Ue&&E(new WEe("Request stream has been aborted",t,O))}),u.pipe(O)}else O.end(u)})};var wIp=oA.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,oA.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(oA.origin),oA.navigator&&/(msie|trident)/i.test(oA.navigator.userAgent)):()=>!0;var SIp=oA.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let u=[e+"="+encodeURIComponent(t)];os.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),os.isString(i)&&u.push("path="+i),os.isString(n)&&u.push("domain="+n),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var DIp=e=>e instanceof aR?{...e}:e;function lWt(e,t){t=t||{};let r={};function i(s,o,c,b){return os.isPlainObject(s)&&os.isPlainObject(o)?os.merge.call({caseless:b},s,o):os.isPlainObject(o)?os.merge({},o):os.isArray(o)?o.slice():o}function n(s,o,c,b){if(os.isUndefined(o)){if(!os.isUndefined(s))return i(void 0,s,c,b)}else return i(s,o,c,b)}function a(s,o){if(!os.isUndefined(o))return i(void 0,o)}function u(s,o){if(os.isUndefined(o)){if(!os.isUndefined(s))return i(void 0,s)}else return i(void 0,o)}function l(s,o,c){if(c in t)return i(s,o);if(c in e)return i(void 0,s)}let d={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:l,headers:(s,o,c)=>n(DIp(s),DIp(o),c,!0)};return os.forEach(Object.keys(Object.assign({},e,t)),function(o){let c=d[o]||n,b=c(e[o],t[o],o);os.isUndefined(b)&&c!==l||(r[o]=b)}),r}var N3o=e=>{let t=lWt({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:u,auth:l}=t;t.headers=u=aR.from(u),t.url=ZHi(kHi(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&u.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let d;if(os.isFormData(r)){if(oA.hasStandardBrowserEnv||oA.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((d=u.getContentType())!==!1){let[s,...o]=d?d.split(";").map(c=>c.trim()).filter(Boolean):[];u.setContentType([s||"multipart/form-data",...o].join("; "))}}if(oA.hasStandardBrowserEnv&&(i&&os.isFunction(i)&&(i=i(t)),i||i!==!1&&wIp(t.url))){let s=n&&a&&SIp.read(a);s&&u.set(n,s)}return t};var x0D=typeof XMLHttpRequest<"u",EIp=x0D&&function(e){return new Promise(function(r,i){let n=N3o(e),a=n.data,u=aR.from(n.headers).normalize(),{responseType:l,onUploadProgress:d,onDownloadProgress:s}=n,o,c,b,g,O;function m(){g&&g(),O&&O(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let w=new XMLHttpRequest;w.open(n.method.toUpperCase(),n.url,!0),w.timeout=n.timeout;function E(){if(!w)return;let A=aR.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),C={data:!l||l==="text"||l==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:A,config:e,request:w};Ktr(function(G){r(G),m()},function(G){i(G),m()},C),w=null}"onloadend"in w?w.onloadend=E:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(E)},w.onabort=function(){w&&(i(new Fp("Request aborted",Fp.ECONNABORTED,e,w)),w=null)},w.onerror=function(){i(new Fp("Network Error",Fp.ERR_NETWORK,e,w)),w=null},w.ontimeout=function(){let D=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",C=n.transitional||qFn;n.timeoutErrorMessage&&(D=n.timeoutErrorMessage),i(new Fp(D,C.clarifyTimeoutError?Fp.ETIMEDOUT:Fp.ECONNABORTED,e,w)),w=null},a===void 0&&u.setContentType(null),"setRequestHeader"in w&&os.forEach(u.toJSON(),function(D,C){w.setRequestHeader(C,D)}),os.isUndefined(n.withCredentials)||(w.withCredentials=!!n.withCredentials),l&&l!=="json"&&(w.responseType=n.responseType),s&&([b,O]=pfi(s,!0),w.addEventListener("progress",b)),d&&w.upload&&([c,g]=pfi(d),w.upload.addEventListener("progress",c),w.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(o=A=>{w&&(i(!A||A.type?new WEe(null,e,w):A),w.abort(),w=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));let q=mEa(n.url);if(q&&oA.protocols.indexOf(q)===-1){i(new Fp("Unsupported protocol "+q+":",Fp.ERR_BAD_REQUEST,e));return}w.send(a||null)})};var R0D=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let i=new AbortController,n,a=function(s){if(!n){n=!0,l();let o=s instanceof Error?s:this.reason;i.abort(o instanceof Fp?o:new WEe(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new Fp(`timeout ${t} of ms exceeded`,Fp.ETIMEDOUT))},t),l=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:d}=i;return d.unsubscribe=()=>os.asap(l),d}},MIp=R0D;var N0D=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let i=0,n;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},F0D=async function*(e,t){for await(let r of L0D(e))yield*N0D(r,t)},L0D=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:i}=await t.read();if(r)break;yield i}}finally{await t.cancel()}},mYs=(e,t,r,i)=>{let n=F0D(e,t),a=0,u,l=d=>{u||(u=!0,i&&i(d))};return new ReadableStream({async pull(d){try{let{done:s,value:o}=await n.next();if(s){l(),d.close();return}let c=o.byteLength;if(r){let b=a+=c;r(b)}d.enqueue(new Uint8Array(o))}catch(s){throw l(s),s}},cancel(d){return l(d),n.return()}},{highWaterMark:2})};var L3o=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",qIp=L3o&&typeof ReadableStream=="function",U0D=L3o&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),TIp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},V0D=qIp&&TIp(()=>{let e=!1,t=new Request(oA.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),AIp=64*1024,PYs=qIp&&TIp(()=>os.isReadableStream(new Response("").body)),F3o={stream:PYs&&(e=>e.body)};L3o&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!F3o[t]&&(F3o[t]=os.isFunction(e[t])?r=>r[t]():(r,i)=>{throw new Fp(`Response type '${t}' is not supported`,Fp.ERR_NOT_SUPPORT,i)})})})(new Response);var W0D=async e=>{if(e==null)return 0;if(os.isBlob(e))return e.size;if(os.isSpecCompliantForm(e))return(await new Request(oA.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(os.isArrayBufferView(e)||os.isArrayBuffer(e))return e.byteLength;if(os.isURLSearchParams(e)&&(e=e+""),os.isString(e))return(await U0D(e)).byteLength},H0D=async(e,t)=>{let r=os.toFiniteNumber(e.getContentLength());return r??W0D(t)},CIp=L3o&&(async e=>{let{url:t,method:r,data:i,signal:n,cancelToken:a,timeout:u,onDownloadProgress:l,onUploadProgress:d,responseType:s,headers:o,withCredentials:c="same-origin",fetchOptions:b}=N3o(e);s=s?(s+"").toLowerCase():"text";let g=MIp([n,a&&a.toAbortSignal()],u),O,m=g&&g.unsubscribe&&(()=>{g.unsubscribe()}),w;try{if(d&&V0D&&r!=="get"&&r!=="head"&&(w=await H0D(o,i))!==0){let C=new Request(t,{method:"POST",body:i,duplex:"half"}),x;if(os.isFormData(i)&&(x=C.headers.get("content-type"))&&o.setContentType(x),C.body){let[G,I]=BFn(w,pfi(IFn(d)));i=mYs(C.body,AIp,G,I)}}os.isString(c)||(c=c?"include":"omit");let E="credentials"in Request.prototype;O=new Request(t,{...b,signal:g,method:r.toUpperCase(),headers:o.normalize().toJSON(),body:i,duplex:"half",credentials:E?c:void 0});let q=await fetch(O,b),A=PYs&&(s==="stream"||s==="response");if(PYs&&(l||A&&m)){let C={};["status","statusText","headers"].forEach(F=>{C[F]=q[F]});let x=os.toFiniteNumber(q.headers.get("content-length")),[G,I]=l&&BFn(x,pfi(IFn(l),!0))||[];q=new Response(mYs(q.body,AIp,G,()=>{I&&I(),m&&m()}),C)}s=s||"text";let D=await F3o[os.findKey(F3o,s)||"text"](q,e);return!A&&m&&m(),await new Promise((C,x)=>{Ktr(C,x,{data:D,headers:aR.from(q.headers),status:q.status,statusText:q.statusText,config:e,request:O})})}catch(E){throw m&&m(),E&&E.name==="TypeError"&&/Load failed|fetch/i.test(E.message)?Object.assign(new Fp("Network Error",Fp.ERR_NETWORK,e,O),{cause:E.cause||E}):Fp.from(E,E&&E.code,e,O)}});var jYs={http:jIp,xhr:EIp,fetch:CIp};os.forEach(jYs,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var BIp=e=>`- ${e}`,$0D=e=>os.isFunction(e)||e===null||e===!1,U3o={getAdapter:e=>{e=os.isArray(e)?e:[e];let{length:t}=e,r,i,n={};for(let a=0;a<t;a++){r=e[a];let u;if(i=r,!$0D(r)&&(i=jYs[(u=String(r)).toLowerCase()],i===void 0))throw new Fp(`Unknown adapter '${u}'`);if(i)break;n[u||"#"+a]=i}if(!i){let a=Object.entries(n).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build")),u=t?a.length>1?`since :
@@ -1954,7 +1954,7 @@ ${A}${q}${D}${SKp.default.cursorHide}`});var sCa=ui(Rwi(),1);function Duc(e,t){i
1954
1954
  Run ${Ss.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
1955
1955
  Run ${Ss.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),xFn(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function Ruc({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!KKp(e))return;let n=t??"",a=e.filter(l=>l.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((l,d)=>l.generatorName.localeCompare(d.generatorName)||l.currentVersion.localeCompare(d.currentVersion));for(let l of u)n+=`
1956
1956
  ${await oVD(l.generatorName)} (${l.apiName!=null?"API: "+l.apiName+", ":""}Group: ${l.generatorGroup}) `+Ss.dim(l.currentVersion)+Ss.reset(" \u2192 ")+Ss.green(l.latestVersion);return n+=`
1957
- `,i?xFn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function oVD(e){let r=await new JKp.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 uVD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await XKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=xwi(o.name,c),g=await rkt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await XKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,d,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][d]==null&&(u.versions[l][d]={});let c=xwi(s.name,o),b=await rkt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][d][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function XKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await xVt({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let d of l.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function ZKp(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=qae(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function OUo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await uVD({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[d,s]of Object.entries(l.versions))u.push(...ZKp(s,d,t.logger));else u.push(...ZKp(l.versions,void 0,t.logger))}return u}var yCa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var D4n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Nuc=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),kKp=typeof globalThis.AbortController=="function",eYp=typeof globalThis.ReadableStream=="function",tYp=typeof globalThis.FormData=="function",mUo=["get","post","put","patch","head","delete"],sVD=()=>{};sVD();var rYp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},PUo=2147483647,iYp=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,jUo=Symbol("stop"),nYp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},aYp={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var cVD=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=iYp,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof i=="string"?new TextEncoder().encode(i).length:i.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},oYp=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,i=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:i},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(n){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function u(){let{done:l,value:d}=await a.read();if(l){n.close();return}if(t){i+=d.byteLength;let s=r===0?0:i/r;t({percent:s,transferredBytes:i,totalBytes:r},d)}n.enqueue(d),await u()}await u()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},uYp=(e,t)=>{let r=cVD(e.body),i=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(n){let a=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function u(){let{done:l,value:d}=await a.read();if(l){t&&t({percent:1,transferredBytes:i,totalBytes:Math.max(r,i)},new Uint8Array),n.close();return}i+=d.byteLength;let s=r===0?0:i/r;(r<i||s===1)&&(s=.99),t&&t({percent:Number(s.toFixed(2)),transferredBytes:i,totalBytes:r},d),n.enqueue(d),await u()}await u()}})})};var E4n=e=>e!==null&&typeof e=="object";var vCa=(...e)=>{for(let t of e)if((!E4n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Uuc({},...e)},Fuc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function wUo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Uuc(e[r]??[],t[r]??[])}var Luc=(e={},t={})=>({beforeRequest:wUo(e,t,"beforeRequest"),beforeRetry:wUo(e,t,"beforeRetry"),afterResponse:wUo(e,t,"afterResponse"),beforeError:wUo(e,t,"beforeError")}),Uuc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(E4n(n)){for(let[a,u]of Object.entries(n))E4n(u)&&a in t&&(u=Uuc(t[a],u)),t={...t,[a]:u};E4n(n.hooks)&&(i=Luc(i,n.hooks),t.hooks=i),E4n(n.headers)&&(r=Fuc(r,n.headers),t.headers=r)}return t};var cYp=e=>mUo.includes(e)?e.toUpperCase():e,lVD=["get","put","head","delete","options","trace"],fVD=[408,413,429,500,502,503,504],dVD=[413,429,503],sYp={limit:2,methods:lVD,statusCodes:fVD,afterStatusCodes:dVD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},lYp=(e={})=>{if(typeof e=="number")return{...sYp,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{...sYp,...e}};async function Vuc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new D4n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function Wuc(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var fYp=(e,t)=>{let r={};for(let i in t)!(i in aYp)&&!(i in nYp)&&!(i in e)&&(r[i]=t[i]);return r};var bCa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>PUo)throw new RangeError(`The \`timeout\` option cannot be greater than ${PUo}`);await Promise.resolve();let l=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let d=new yCa(l,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!eYp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return oYp(l.clone(),i._options.onDownloadProgress)}return l},u=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{i.request.bodyUsed||await i.request.body?.cancel()});for(let[l,d]of Object.entries(rYp))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let s=await u;if(l==="json"){if(s.status===204||(await s.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await s.text())}return s[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:Fuc(this._input.headers,r.headers),hooks:Luc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:cYp(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:lYp(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(kKp){let i=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=i?AbortSignal.any([i,this.abortController.signal]):this.abortController.signal}if(Nuc&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(tYp&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Nuc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=uYp(this.request,this._options.onUploadProgress))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof D4n)throw t;if(t instanceof yCa){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),PUo);if(this._retryCount<1)throw r;await Wuc(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===jUo)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=fYp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Vuc(r,t,this.abortController,this._options)}};var Huc=e=>{let t=(r,i)=>bCa.create(r,vCa(e,i));for(let r of mUo)t[r]=(i,n)=>bCa.create(i,vCa(e,n,{method:r}));return t.create=r=>Huc(vCa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),Huc(vCa(e,r))),t.stop=jUo,t},pVD=Huc(),dYp=pVD;var zYp=ui(IYp(),1);function Kuc(e){let t=(0,zYp.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var AXp=ui(MXp(),1),qXp=ui(Rwi(),1),ssc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},csc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function lsc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??Kuc(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,AXp.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,l&&(d.authorization=`${l.type} ${l.token}`);let s;try{s=await dYp(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new ssc(e):c}if(t.allVersions)return s;let o=new csc(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=qXp.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function wCa(e,t){let{version:r}=await lsc(e.toLowerCase(),t);return r}async function EEi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:wCa(e.packageName,{version:t?"prerelease":"latest"})}var TXp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],xUo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Yv.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new gUo(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),u=this.getCliName();(n==null||a==null||u==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:u}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.65.19"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Ss.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new d9}failWithoutThrowing(t,r){this.didSucceed=!1,hUo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await EFn()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await YKp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1957
+ `,i?xFn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function oVD(e){let r=await new JKp.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 uVD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await XKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=xwi(o.name,c),g=await rkt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await XKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,d,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][d]==null&&(u.versions[l][d]={});let c=xwi(s.name,o),b=await rkt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][d][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function XKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await xVt({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let d of l.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function ZKp(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=qae(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function OUo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await uVD({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[d,s]of Object.entries(l.versions))u.push(...ZKp(s,d,t.logger));else u.push(...ZKp(l.versions,void 0,t.logger))}return u}var yCa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var D4n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Nuc=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),kKp=typeof globalThis.AbortController=="function",eYp=typeof globalThis.ReadableStream=="function",tYp=typeof globalThis.FormData=="function",mUo=["get","post","put","patch","head","delete"],sVD=()=>{};sVD();var rYp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},PUo=2147483647,iYp=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,jUo=Symbol("stop"),nYp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},aYp={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var cVD=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=iYp,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof i=="string"?new TextEncoder().encode(i).length:i.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},oYp=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,i=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:i},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(n){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function u(){let{done:l,value:d}=await a.read();if(l){n.close();return}if(t){i+=d.byteLength;let s=r===0?0:i/r;t({percent:s,transferredBytes:i,totalBytes:r},d)}n.enqueue(d),await u()}await u()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},uYp=(e,t)=>{let r=cVD(e.body),i=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(n){let a=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function u(){let{done:l,value:d}=await a.read();if(l){t&&t({percent:1,transferredBytes:i,totalBytes:Math.max(r,i)},new Uint8Array),n.close();return}i+=d.byteLength;let s=r===0?0:i/r;(r<i||s===1)&&(s=.99),t&&t({percent:Number(s.toFixed(2)),transferredBytes:i,totalBytes:r},d),n.enqueue(d),await u()}await u()}})})};var E4n=e=>e!==null&&typeof e=="object";var vCa=(...e)=>{for(let t of e)if((!E4n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Uuc({},...e)},Fuc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function wUo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Uuc(e[r]??[],t[r]??[])}var Luc=(e={},t={})=>({beforeRequest:wUo(e,t,"beforeRequest"),beforeRetry:wUo(e,t,"beforeRetry"),afterResponse:wUo(e,t,"afterResponse"),beforeError:wUo(e,t,"beforeError")}),Uuc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(E4n(n)){for(let[a,u]of Object.entries(n))E4n(u)&&a in t&&(u=Uuc(t[a],u)),t={...t,[a]:u};E4n(n.hooks)&&(i=Luc(i,n.hooks),t.hooks=i),E4n(n.headers)&&(r=Fuc(r,n.headers),t.headers=r)}return t};var cYp=e=>mUo.includes(e)?e.toUpperCase():e,lVD=["get","put","head","delete","options","trace"],fVD=[408,413,429,500,502,503,504],dVD=[413,429,503],sYp={limit:2,methods:lVD,statusCodes:fVD,afterStatusCodes:dVD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},lYp=(e={})=>{if(typeof e=="number")return{...sYp,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{...sYp,...e}};async function Vuc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new D4n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function Wuc(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var fYp=(e,t)=>{let r={};for(let i in t)!(i in aYp)&&!(i in nYp)&&!(i in e)&&(r[i]=t[i]);return r};var bCa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>PUo)throw new RangeError(`The \`timeout\` option cannot be greater than ${PUo}`);await Promise.resolve();let l=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let d=new yCa(l,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!eYp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return oYp(l.clone(),i._options.onDownloadProgress)}return l},u=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{i.request.bodyUsed||await i.request.body?.cancel()});for(let[l,d]of Object.entries(rYp))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let s=await u;if(l==="json"){if(s.status===204||(await s.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await s.text())}return s[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:Fuc(this._input.headers,r.headers),hooks:Luc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:cYp(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:lYp(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(kKp){let i=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=i?AbortSignal.any([i,this.abortController.signal]):this.abortController.signal}if(Nuc&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(tYp&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Nuc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=uYp(this.request,this._options.onUploadProgress))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof D4n)throw t;if(t instanceof yCa){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),PUo);if(this._retryCount<1)throw r;await Wuc(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===jUo)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=fYp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Vuc(r,t,this.abortController,this._options)}};var Huc=e=>{let t=(r,i)=>bCa.create(r,vCa(e,i));for(let r of mUo)t[r]=(i,n)=>bCa.create(i,vCa(e,n,{method:r}));return t.create=r=>Huc(vCa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),Huc(vCa(e,r))),t.stop=jUo,t},pVD=Huc(),dYp=pVD;var zYp=ui(IYp(),1);function Kuc(e){let t=(0,zYp.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var AXp=ui(MXp(),1),qXp=ui(Rwi(),1),ssc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},csc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function lsc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??Kuc(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,AXp.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,l&&(d.authorization=`${l.type} ${l.token}`);let s;try{s=await dYp(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new ssc(e):c}if(t.allVersions)return s;let o=new csc(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=qXp.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function wCa(e,t){let{version:r}=await lsc(e.toLowerCase(),t);return r}async function EEi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:wCa(e.packageName,{version:t?"prerelease":"latest"})}var TXp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],xUo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Yv.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new gUo(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),u=this.getCliName();(n==null||a==null||u==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:u}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.65.20"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Ss.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new d9}failWithoutThrowing(t,r){this.didSucceed=!1,hUo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await EFn()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await YKp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1958
1958
  `)||(r+=`
1959
1959
  `),this.stderr.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram({code:t}={}){process.exit(t??(this.didSucceed?0:1))}longestWorkspaceName;registerWorkspaces(t){let r=mIs(t.map(i=>i.type==="docs"?"docs":i.workspaceName??"api"),i=>i.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new cCa(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let i=this.addTaskWithInit(t).start(),n;try{n=await r(i)}catch(a){throw a.message.includes("globalThis")?(i.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),i.failWithoutThrowing()):i.failWithoutThrowing(void 0,a),new d9}finally{i.finish()}return n}async instrumentPostHogEvent(t){this.isLocal||(await EFn()).sendEvent(t)}logger=yXt((t,...r)=>this.log(t,...r));stderr=yXt((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=CXp(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?CXp(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=TXp[this.numTasks++%TXp.length],u=Ss.hex(a)(n);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===AB.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let i=t.filter(n=>Qji.indexOf(n.level)>=Qji.indexOf(this.logLevel));this.ttyAwareLogger.log(i,{includeDebugInfo:this.logLevel===Yv.Debug,stderr:r})}_suppressUpgradeMessage=!1;suppressUpgradeMessage(){this._suppressUpgradeMessage=!0}_isUpgradeAvailable;async isUpgradeAvailable({includePreReleases:t=!1}={}){if(this._isUpgradeAvailable==null){this.logger.debug(`Checking if ${this.environment.packageName} upgrade is available...`);let r=await EEi({cliEnvironment:this.environment,includePreReleases:t}),i=qae(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await OUo({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await muc({message:t,default:r})}async getInput(t){return await Puc({message:t.message,default:t.default})}};function CXp(e){return`[${e}]:`}var og_=require("fs/promises");function kNe({breadcrumbs:e=[],title:t,subtitle:r}){let i=[];return e.length>0&&i.push(Ss.blue(e.join(" -> "))),i.push(t),r!=null&&i.push(Ss.dim(r)),i.join(`
1960
1960
  `)}var u__=require("fs/promises");var HWt=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:i,absoluteFilePath:n,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=i,this.absoluteFilePath=n,this.changelog=a}};var lMe=class extends HWt{definition;sources;type="fern";constructor({definition:t,sources:r,...i}){super(i),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var SCa=class{context;constructor(t){this.context=t}};var RUo=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[u,l]of Object.entries(i.files)){let d=n!=null?my.of(`${n}${ZUt}${u}`):my.of(u);t[d]=l}let a=Object.keys(i.directories).sort();for(let u of a){let l=n!=null?`${n}${ZUt}${u}`:u,d=i.directories[u];r(d,l)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(ZUt))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[my.of(t[0])]??={};let[r,...i]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(i)}};var dQi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new RUo,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":i,"display-name":n,docs:a}){let u=this.getOrCreateFile(t);u.service==null&&(u.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(u.service.auth=r),i!=null&&(u.service["base-path"]=i),n!=null&&(u.service["display-name"]=n),a!=null&&(u.docs=a)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return gkt(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let i of Object.values(this.rootApiFile["auth-schemes"]))BXp(i)&&t.push(i.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if(BXp(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let i=this.getVersionHeader();i!=null&&i===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}getGlobalHeaders(){return this.rootApiFile.headers??{}}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r,alias:i}){if(t===r)return;let n=i??p_((fxe(r)+"/"+YUi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===my.of($F))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=xgo(fxe(BBn.of(`/${t}`)),BBn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=xgo(fxe(BBn.of(`/${t}`)),BBn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){if(t===my.of($F))return;let n=this.getOrCreateFile(t);n.types==null&&(n.types={}),n.types[r]=i}addTypeExample(t,r,i){let n=this.getOrCreateFile(t);n.types==null&&(n.types={});let a=n.types[r];a!=null&&(typeof a=="string"?n.types[r]={type:a,examples:[i]}:(a.examples==null&&(a.examples=[]),a.examples.push(i)))}addError(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.errors==null&&(n.errors={}),n.errors[r]==null?n.errors[r]=i:n.errors[r]?.type!==i.type&&(n.errors[r]={"status-code":i["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:i}){let n=this.getOrCreateFile(t);if(n.errors==null)return;let a=n.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(l=>P2(l,i))??!1)||a.examples?.push(i)}addEndpoint(t,{name:r,schema:i,source:n}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),n!=null&&(a.service.source=n),a.service.endpoints[r]=i}addWebhook(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.webhooks==null&&(n.webhooks={}),n.webhooks[r]=i}addChannel(t,{channel:r}){let i=this.getOrCreateFile(t);i.channel=r;let n=this.basePath;n!=null&&(i.channel.path=TN(n,r.path))}addChannelExample(t,{example:r}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.examples==null&&(i.channel.examples=[]),i.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:i}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.messages[r]=i}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([n,a])=>[n,{...a,path:TN(r,a.path)}]))});for(let n of Object.values(t))n.service!=null&&(n.service={...n.service,endpoints:Object.fromEntries(Object.entries(n.service.endpoints).map(([a,u])=>[a,{...u,path:TN(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===CS?this.packageMarkerFile:this.root.getOrCreateFile(t)}getVersionHeader(){if(this.rootApiFile.version!=null)return typeof this.rootApiFile.version.header=="string"?this.rootApiFile.version.header:this.rootApiFile.version.header.value}};function BXp(e){return e?.header!=null}var KQ={openapi:e=>({...e,type:"openapi",_visit:function(t){return KQ._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return KQ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"openapi":return t.openapi(e);case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var I4n={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return I4n._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var K9={basic:e=>({...e,type:"basic",_visit:function(t){return K9._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return K9._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return K9._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return K9._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return K9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"query":return t.query(e);case"oauth":return t.oauth(e);default:return t._other(e)}}};var qg={primitive:e=>({value:e,type:"primitive",_visit:function(t){return qg._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return qg._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return qg._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return qg._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return qg._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return qg._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return qg._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return qg._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var i_={int:e=>({value:e,type:"int",_visit:function(t){return i_._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return i_._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return i_._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return i_._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return i_._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return i_._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return i_._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return i_._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return i_._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return i_._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return i_._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e.value);case"int64":return t.int64(e.value);case"uint":return t.uint(e.value);case"uint64":return t.uint64(e.value);case"float":return t.float(e.value);case"double":return t.double(e.value);case"string":return t.string(e.value);case"datetime":return t.datetime(e.value);case"date":return t.date(e.value);case"base64":return t.base64(e.value);case"boolean":return t.boolean(e.value);default:return t._other(e)}}};var z4n={boolean:e=>({value:e,type:"boolean",_visit:function(t){return z4n._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return z4n._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var MEi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return MEi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return MEi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e.value);case"undiscriminated":return t.undiscriminated(e.value);default:return t._other(e)}}};var UW={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case UW.GenerallyAvailable:return t.generallyAvailable();case UW.Beta:return t.beta();case UW.Deprecated:return t.deprecated();default:return t._other()}}};var eFe={cursor:e=>({...e,type:"cursor",_visit:function(t){return eFe._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return eFe._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return eFe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);default:return t._other(e)}}};var ndi={language:e=>({...e,type:"language",_visit:function(t){return ndi._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return ndi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"language":return t.language(e);case"sdk":return t.sdk(e);default:return t._other(e)}}};var VW={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Js:"js",Node:"node",Ts:"ts",Nodets:"nodets",Golang:"golang",Dotnet:"dotnet",Jvm:"jvm",_visit:(e,t)=>{switch(e){case VW.Curl:return t.curl();case VW.Python:return t.python();case VW.Javascript:return t.javascript();case VW.Typescript:return t.typescript();case VW.Go:return t.go();case VW.Ruby:return t.ruby();case VW.Csharp:return t.csharp();case VW.Java:return t.java();case VW.Js:return t.js();case VW.Node:return t.node();case VW.Ts:return t.ts();case VW.Nodets:return t.nodets();case VW.Golang:return t.golang();case VW.Dotnet:return t.dotnet();case VW.Jvm:return t.jvm();default:return t._other()}}};var $Wt={unknown:e=>({value:e,type:"unknown",_visit:function(t){return $Wt._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return $Wt._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"unknown":return t.unknown(e.value);case"full":return t.full(e);default:return t._other(e)}}};var GWt={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return GWt._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return GWt._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"withStreaming":return t.withStreaming(e);case"withoutStreaming":return t.withoutStreaming(e.value);default:return t._other(e)}}};var WW={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case WW.Get:return t.get();case WW.Post:return t.post();case WW.Put:return t.put();case WW.Patch:return t.patch();case WW.Delete:return t.delete();case WW.Head:return t.head();case WW.Options:return t.options();case WW.Trace:return t.trace();default:return t._other()}}};var AEi={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return AEi._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return AEi._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return AEi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);default:return t._other(e)}}};var adi={file:e=>({...e,type:"file",_visit:function(t){return adi._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return adi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e.value);default:return t._other(e)}}};var YQ={file:e=>({...e,type:"file",_visit:function(t){return YQ._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return YQ._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return YQ._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return YQ._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return YQ._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return YQ._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return YQ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var Qy={primitive:e=>({...e,type:"primitive",_visit:function(t){return Qy._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Qy._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Qy._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Qy._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Qy._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Qy._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Qy._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Qy._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Qy._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Qy._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Qy._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var Xj={int:e=>({...e,type:"int",_visit:function(t){return Xj._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Xj._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Xj._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Xj._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Xj._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Xj._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Xj._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Xj._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Xj._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Xj._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Xj._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint();case"uint64":return t.uint64();case"float":return t.float();case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime();case"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var lz={boolean:e=>({value:e,type:"boolean",_visit:function(t){return lz._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return lz._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var odi={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return odi._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return odi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var fMe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return fMe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return fMe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return fMe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);default:return t._other(e)}}};var gC={file:e=>({...e,type:"file",_visit:function(t){return gC._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return gC._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return gC._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return gC._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return gC._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return gC._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return gC._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var El={primitive:e=>({...e,type:"primitive",_visit:function(t){return El._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return El._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return El._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return El._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return El._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return El._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return El._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return El._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return El._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return El._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return El._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var NZ={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return NZ._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return NZ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var tp={int:e=>({...e,type:"int",_visit:function(t){return tp._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return tp._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return tp._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return tp._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return tp._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return tp._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return tp._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return tp._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return tp._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return tp._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return tp._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint(e);case"uint64":return t.uint64(e);case"float":return t.float(e);case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime(e);case"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var Cv={};Po(Cv,{AllOfPropertyConflict:()=>n2n,ArraySchema:()=>kVo,ArraySchemaWithExample:()=>EWo,Availability:()=>QUo,Base64WithExample:()=>PWo,BasicSecurityScheme:()=>YUo,BearerSecurityScheme:()=>XUo,BooleanSchema:()=>QVo,BooleanWithExample:()=>jWo,BytesResponse:()=>K4n,CasingOverrides:()=>eVo,CommonProperty:()=>uWo,CommonPropertyWithExample:()=>xWo,CursorPagination:()=>qVo,CustomCodeSample:()=>MVo,CustomCodeSampleLanguage:()=>SVo,CustomCodeSampleSdk:()=>EVo,CustomPagination:()=>CVo,DateWithExample:()=>mWo,DatetimeWithExample:()=>OWo,DiscriminatedOneOfSchema:()=>aWo,DiscriminatedOneOfSchemaWithExample:()=>IWo,DoubleSchema:()=>$Vo,DoubleWithExample:()=>bWo,Encoding:()=>GUo,Endpoint:()=>BVo,EndpointExample:()=>k4n,EndpointResponseExample:()=>wVo,EndpointSdkName:()=>Frr,EndpointWithExample:()=>cZp,EnumSchema:()=>F4n,EnumSchemaWithExample:()=>SWo,EnumValue:()=>CEi,ErrorExample:()=>gVo,FernExample:()=>mVo,FileResponse:()=>Q4n,FileSchema:()=>dVo,FloatWithExample:()=>vWo,FullEndpointExample:()=>AVo,FullExample:()=>Uq,FullObjectExample:()=>uVo,FullOneOfExample:()=>cVo,GlobalHeader:()=>KVo,Header:()=>IEi,HeaderExample:()=>Z4n,HeaderSecurityScheme:()=>ZUo,HeaderWithExample:()=>REi,HttpEndpointServer:()=>Y4n,HttpError:()=>OVo,HttpErrorWithExample:()=>dWo,HttpMethod:()=>V4n,IdempotencyHeader:()=>YVo,Int64WithExample:()=>_Wo,IntSchema:()=>WVo,IntWithExample:()=>pWo,JsonRequest:()=>yVo,JsonRequestWithExample:()=>cWo,JsonResponse:()=>J4n,JsonResponseWithExample:()=>u2n,KeyValuePair:()=>sVo,LiteralExample:()=>oVo,LiteralSchema:()=>i2n,LiteralSchemaValue:()=>XVo,LongSchema:()=>HVo,MapSchema:()=>eWo,MapSchemaWithExample:()=>MWo,MultipartRequest:()=>G4n,MultipartRequestProperty:()=>hVo,MultipartRequestPropertyEncoding:()=>_Vo,MultipartSchema:()=>pVo,NamedFullExample:()=>Urr,Namespace:()=>tVo,NamespaceId:()=>aVo,NullableSchema:()=>rWo,NullableSchemaWithExample:()=>qWo,OauthSecurityScheme:()=>iVo,ObjectProperty:()=>nWo,ObjectPropertyConflictInfo:()=>a2n,ObjectPropertyWithExample:()=>BWo,ObjectSchema:()=>ZVo,ObjectSchemaWithExample:()=>TWo,OctetStreamRequest:()=>$4n,OffsetPagination:()=>TVo,OneOfSchema:()=>iWo,OneOfSchemaWithExample:()=>CWo,OpenApiIntermediateRepresentation:()=>uZp,OpenApiSource:()=>VUo,OptionalSchema:()=>tWo,OptionalSchemaWithExample:()=>AWo,Pagination:()=>e2n,PathParameter:()=>W4n,PathParameterExample:()=>PVo,PathParameterWithExample:()=>sWo,PrimitiveExample:()=>U4n,PrimitiveSchema:()=>xEi,PrimitiveSchemaValue:()=>JVo,PrimitiveSchemaValueWithExample:()=>wWo,PrimitiveSchemaWithExample:()=>s2n,PropertyKey:()=>L4n,ProtobufEncoding:()=>$Uo,ProtobufSource:()=>WUo,QueryParameter:()=>H4n,QueryParameterExample:()=>X4n,QueryParameterWithExample:()=>o2n,QuerySecurityScheme:()=>kUo,ReferencedSchema:()=>Lrr,Request:()=>vVo,RequestWithExample:()=>lWo,Response:()=>bVo,ResponseWithExample:()=>fWo,Schema:()=>Sm,SchemaId:()=>FZ,SchemaWithExample:()=>fA,Schemas:()=>VVo,SdkGroup:()=>rVo,SdkGroupInfo:()=>lVo,SdkGroupName:()=>BEi,SecurityScheme:()=>nVo,SecuritySchemeId:()=>KUo,Server:()=>ACa,Source:()=>HUo,StatusCode:()=>Nrr,StreamingResponseExample:()=>jVo,StringSchema:()=>GVo,StringSchemaWithExample:()=>gWo,SupportedSdkLanguage:()=>DVo,Tag:()=>JUo,TagId:()=>LZ,Tags:()=>fVo,TextResponse:()=>zEi,Uint64WithExample:()=>yWo,UintWithExample:()=>hWo,UnDiscriminatedOneOfSchema:()=>oWo,UnDiscriminatedOneOfSchemaWithExample:()=>zWo,UnknownSchemaWithExample:()=>DWo,Webhook:()=>IVo,WebhookExampleCall:()=>r2n,WebhookHttpMethod:()=>t2n,WebhookWithExample:()=>lZp,WebsocketChannel:()=>UVo,WebsocketHandshake:()=>zVo,WebsocketHandshakeWithExample:()=>sZp,WebsocketMessageExample:()=>FVo,WebsocketMessageOrigin:()=>xVo,WebsocketMessageSchema:()=>RVo,WebsocketServer:()=>NVo,WebsocketSessionExample:()=>LVo,WithAvailability:()=>Bh,WithDescription:()=>Of,WithEncoding:()=>Tae,WithInline:()=>WE,WithName:()=>z0,WithNamespace:()=>a0,WithSdkGroupName:()=>sm,WithSource:()=>ey,WithStatusCode:()=>tFe,WithTitle:()=>um,commons:()=>hsc,example:()=>ysc,finalIr:()=>vsc,parseIr:()=>bsc});var hsc={};Po(hsc,{BasicSecurityScheme:()=>YUo,BearerSecurityScheme:()=>XUo,Encoding:()=>GUo,HeaderSecurityScheme:()=>ZUo,Namespace:()=>tVo,NamespaceId:()=>aVo,OauthSecurityScheme:()=>iVo,OpenApiSource:()=>VUo,ProtobufEncoding:()=>$Uo,ProtobufSource:()=>WUo,QuerySecurityScheme:()=>kUo,SchemaId:()=>FZ,SdkGroup:()=>rVo,SdkGroupName:()=>BEi,SecurityScheme:()=>nVo,SecuritySchemeId:()=>KUo,Server:()=>ACa,Source:()=>HUo,StatusCode:()=>Nrr,Tag:()=>JUo,TagId:()=>LZ,WithAvailability:()=>Bh,WithDescription:()=>Of,WithEncoding:()=>Tae,WithInline:()=>WE,WithName:()=>z0,WithNamespace:()=>a0,WithSdkGroupName:()=>sm,WithSource:()=>ey,WithStatusCode:()=>tFe,WithTitle:()=>um});var Mt={};Po(Mt,{JsonError:()=>x4n,ParseError:()=>R4n,any:()=>JXp,bigint:()=>zXp,boolean:()=>KXp,booleanLiteral:()=>QXp,date:()=>xXp,discriminant:()=>nZp,enum_:()=>FUo,getObjectLikeUtils:()=>QWt,getObjectUtils:()=>pQi,getSchemaUtils:()=>Lq,isProperty:()=>TEi,lazy:()=>RXp,lazyObject:()=>HXp,list:()=>UUo,number:()=>YXp,object:()=>LUo,objectWithoutOptionalProperties:()=>WXp,optional:()=>fsc,property:()=>FXp,record:()=>eZp,set:()=>tZp,string:()=>XXp,stringLiteral:()=>GXp,transform:()=>dsc,undiscriminatedUnion:()=>iZp,union:()=>oZp,unknown:()=>ZXp,withParsedProperties:()=>_sc});var Mj={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function lA(e,t){return`Expected ${t}. Received ${gWD(e)}.`}function gWD(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function Y9(e){return{...e,json:IXp(e.json),parse:IXp(e.parse)}}function IXp(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.65.19",
3
+ "version": "0.65.20",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",