fern-api 0.64.28 → 0.64.30

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
@@ -1711,7 +1711,7 @@ ${lqp.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&SQs(th
1711
1711
  `+AHi.default.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?AHi.default.cyan(gqp(t,this.opt.mask)):AHi.default.italic(AHi.default.dim("[hidden]")):this.opt.mask?gqp(t,this.opt.mask):AHi.default.italic(AHi.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 $Fo=ni(z2(),1),HTp=ni(vJs(),1),$Tp=ni(VEe(),1);var eEa=class extends x2{_run(t){this.done=t,this.editorResult=new $Tp.Subject;let r=jW(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"?$Fo.default.dim("Received"):$Fo.default.dim("Press <enter> to launch your preferred editor."),t&&(r=$Fo.default.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),(0,HTp.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 YTp=require("stream");var JTp=ni(require("readline"),1),KTp=ni(QTp(),1),RHi=class{constructor(t){this.rl||=JTp.default.createInterface(R_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 R_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 KTp.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var tEa=class extends RHi{constructor(t={}){super(t),this.log=new YTp.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(`
1712
1712
  `).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+`
1713
1713
  `}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&&gFo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var UE=ni(VEe(),1),kTp=ni(nDa(),1);var GFo=ni(VEe(),1),XTp=ni(nDa(),1),QFo=function(e,t,r){return typeof e[t]!="function"?(0,GFo.of)(e):(0,GFo.from)((0,XTp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var ZTp={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}},ZNn=class extends RHi{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)=>(ZTp.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)(()=>QFo(t,"message",this.answers)),(0,UE.concatMap)(()=>QFo(t,"default",this.answers)),(0,UE.concatMap)(()=>QFo(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&&ZTp.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,kTp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,UE.filter)(i=>i!=null)))}};function eCp(e){let t=function(r,i){let n;try{n=new ZNn(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",MHi),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 gJs=eCp();function F_D(e,t){gJs.registerPrompt(e,t)}function L_D(){gJs.restoreDefaultPrompts()}var U_D={prompt:gJs,ui:{BottomBar:tEa,Prompt:ZNn},createPromptModule:eCp,registerPrompt:F_D,restoreDefaultPrompts:L_D,Separator:sae},JFo=U_D;var lFn=require("path"),IBp=require("fs"),zBp=require("readline"),aBp="posthog-node";function PvD(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[y3o.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 y3o=class{constructor(t,r,i,n){this.name=aBp,this.name=aBp,this.setupOnce=function(a,u){let l=u()?.getClient()?.getDsn()?.projectId;a(PvD(t,{organization:r,projectId:l,prefix:i,severityAllowList:n}))}}};y3o.POSTHOG_ID_TAG="posthog_distinct_id";var f3o="0123456789abcdef",v3o=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+=f3o.charAt(this.bytes[r]>>>4),t+=f3o.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+=f3o.charAt(this.bytes[r]>>>4),t+=f3o.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}},sKs=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??jvD()}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 v3o.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,v3o.ofInner(t)}},jvD=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),oBp,cKs=()=>wvD().toString(),wvD=()=>(oBp||(oBp=new sKs)).generate();function SvD(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 DvD(e,t){global.process.on("uncaughtException",SvD(e,t))}function EvD(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var d3o,uBp,p3o;function MvD(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return p3o&&r.length===uBp||(uBp=r.length,p3o=r.reduce((i,n)=>{d3o||(d3o={});let a=d3o[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,d3o[n]=[s,o];break}}}return i},{})),p3o}function AvD(e){return typeof Event<"u"&&xBp(e,Event)}function qvD(e){return RBp(e,"Object")}function vKs(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return xBp(e,Error)}}function xBp(e,t){try{return e instanceof t}catch{return!1}}function TvD(e){return RBp(e,"ErrorEvent")}function RBp(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function CvD(e,t,r,i){let a=i&&i.mechanism||{handled:!0,type:"generic"},u=NBp(a,r,i);return{$exception_list:await Promise.all(u.map(async s=>{let o=await FvD(e,t,s);return o.value=o.value||"",o.type=o.type||"Error",o.mechanism=a,o}))}}function NBp(e,t,r){let i=BvD(e,t,r);return i.cause?[i,...NBp(e,i.cause,r)]:[i]}function BvD(e,t,r){if(vKs(t))return t;if(e.synthetic=!0,qvD(t)){let n=IvD(t);if(n)return n;let a=zvD(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 IvD(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(vKs(r))return r}}function zvD(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=RvD(e);if(TvD(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=xvD(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function xvD(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function RvD(e,t=40){let r=Object.keys(NvD(e));r.sort();let i=r[0];if(!i)return"[object has no keys]";if(i.length>=t)return sBp(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:sBp(a,t)}return""}function sBp(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function NvD(e){return vKs(e)?{message:e.message,name:e.name,stack:e.stack,...cBp(e)}:AvD(e)?{type:e.type,target:lBp(e.target),currentTarget:lBp(e.currentTarget),...cBp(e)}:e}function cBp(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 lBp(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function FvD(e,t,r){let i={type:r.name||r.constructor.name,value:r.message},n=LvD(e,r);for(let a of t)n=await a(n);return n.length&&(i.stacktrace={frames:n,type:"raw"}),i}function LvD(e,t){return UvD(e(t.stack||"",1),e)}function UvD(e,t){let r=MvD(t);return e.forEach(i=>{i.filename&&(i.chunk_id=r[i.filename])}),e}var VvD=2e3,uFn=class e{static async captureException(t,r,i,n,a){let u={...a};n||(u.$process_person_profile=!1);let l=await CvD(this.stackParser,this.frameModifiers,r,i);t.capture({event:"$exception",distinctId:n||cKs(),properties:{...l,...u}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(DvD(this.onException.bind(this),this.onFatalError.bind(this)),EvD(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(VvD)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function WvD(e=process.argv[1]?(0,lFn.dirname)(process.argv[1]):process.cwd(),t=lFn.sep==="\\"){let r=t?fBp(e):e;return i=>{if(!i)return;let n=t?fBp(i):i,{dir:a,base:u,ext:l}=lFn.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 fBp(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var b3o=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)}}},h3o=new b3o(25),FBp=new b3o(20),bKs=7,HvD=1e3,$vD=1e4;async function GvD(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"||YvD(u)||XvD(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(FBp.get(n))continue;let a=t[n];if(!a)continue;a.sort((d,s)=>d-s);let u=kvD(a);if(u.every(d=>ZvD(n,d)))continue;let l=ebD(h3o,n,{});i.push(QvD(n,u,l))}return await Promise.all(i).catch(()=>{}),e&&e.length>0&&JvD(e,h3o),h3o.reduce(),e}function QvD(e,t,r){return new Promise(i=>{let n=(0,IBp.createReadStream)(e),a=(0,zBp.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(){FBp.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]=tbD(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 JvD(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;KvD(r.lineno,r,i)}}function KvD(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let n=LBp(e);n<e;n++){let a=r[n];if(a===void 0){dBp(t);return}t.pre_context.push(a)}if(r[e]===void 0){dBp(t);return}t.context_line=r[e];let i=UBp(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 dBp(e){delete e.pre_context,delete e.context_line,delete e.post_context}function YvD(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function XvD(e){return e.lineno!==void 0&&e.lineno>$vD||e.colno!==void 0&&e.colno>HvD}function ZvD(e,t){let r=h3o.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 kvD(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let i=pBp(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+bKs:(n.push(i),i=pBp(a)),t++}return n}function pBp(e){return[LBp(e),UBp(e)]}function LBp(e){return Math.max(1,e-bKs)}function UBp(e){return e+bKs}function ebD(e,t,r){let i=e.get(t);return i===void 0?(e.set(t,r),r):i}function tbD(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 rbD="4.18.0",_ae;(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"})(_ae||(_ae={}));var _Bp;(function(e){e.Left="left",e.Right="right",e.Center="center"})(_Bp||(_Bp={}));var hBp;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(hBp||(hBp={}));var yBp;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(yBp||(yBp={}));var vBp;(function(e){e.Html="html",e.Text="text"})(vBp||(vBp={}));var bBp;(function(e){e.Number="number",e.Emoji="emoji"})(bBp||(bBp={}));var gBp;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(gBp||(gBp={}));var OBp;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(OBp||(OBp={}));var mBp;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(mBp||(mBp={}));var PBp;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(PBp||(PBp={}));var ibD=e=>{if("flags"in e){let t=abD(e.flags),r=obD(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([n,a])=>[n,VBp(a)])),i=Object.fromEntries(Object.entries(t).map(([n,a])=>[n,nbD(n,a,r[n])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}};function nbD(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 abD=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,gKs(r)]).filter(([,t])=>t!==void 0)),obD=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?VBp(i):void 0]}))},gKs=e=>e===void 0?void 0:e.variant??e.enabled,VBp=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},ubD=1,sbD=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"]),cbD="utf8";function lbD(e,t){if(!e||typeof e!="string"||fbD(e))throw new Error(t)}function fbD(e){return e.trim().length===0}function dbD(e){return e?.replace(/\/+$/,"")}async function pbD(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 jBp(){return new Date().getTime()}function oKs(){return new Date().toISOString()}function g3o(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function _bD(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function hbD(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 ybD(e,t=0,r){let i=hbD(e);return r?.has(i)?!1:parseInt(i,16)/4294967295<t}function wBp(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,SBp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_3o={};function vbD(e,t){if(!_3o[e]){_3o[e]={};for(let r=0;r<e.length;r++)_3o[e][e.charAt(r)]=r}return _3o[e][t]}var aFn={compressToBase64:function(e){if(e==null)return"";let t=aFn._compress(e,6,function(r){return SBp.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:aFn._decompress(e.length,32,function(t){return vbD(SBp,e.charAt(t))})},compress:function(e){return aFn._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:aFn._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++)}}},lKs=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)}},sFn=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 DBp(e){if(e instanceof sFn){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 uKs(e){return typeof e=="object"&&(e instanceof sFn||e instanceof dEa)}function EBp(e){return typeof e=="object"&&e instanceof sFn&&e.status===413}var fKs;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(fKs||(fKs={}));var dKs=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new lKs,this._isInitialized=!1,lbD(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=dbD(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:uKs},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(_ae.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(_ae.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(_ae.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=cKs();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=ybD(this.apiKey,ubD,sbD)?`${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=>ibD(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=gKs(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(fKs.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(_ae.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(_ae.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(_ae.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(_ae.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(_ae.Queue,a),this._events.emit(t,n),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=g3o(()=>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:oKs()};this.historicalMigration&&(n.historical_migration=!0);let a=JSON.stringify(n),u=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${jBp()}&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(aFn.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:oKs(),uuid:i?.uuid?i.uuid:cKs()};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 DBp(t)})}async flush(){let t=wBp([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),wBp([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(_ae.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(_ae.Queue)||[]).slice(n.length);this.setPersistedProperty(_ae.Queue,g),t=g},l={api_key:this.apiKey,batch:a,sent_at:oKs()};this.historicalMigration&&(l.historical_migration=!0);let d=JSON.stringify(l),s=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${jBp()}&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(aFn.compressToBase64(d))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:d},c={retryCheck:b=>EBp(b)?!1:uKs(b)};try{await this.fetchWithRetry(s,o,c)}catch(b){if(EBp(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,cbD)}catch{l=new TextEncoder().encode(u).length}return await pbD(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 sFn(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(_ae.Queue)||[]).length===0||(await this.flush(),r)););}catch(n){if(!uKs(n))throw n;await DBp(n)}};return Promise.race([new Promise((n,a)=>{g3o(()=>{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}},pKs=_bD();if(!pKs){let e=nBp();pKs=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 WBp=pKs,O3o=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()}},HBp=new O3o(async()=>{try{return await import("crypto")}catch{return}});async function bbD(){return await HBp.getValue()}var gbD=new O3o(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await HBp.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function ObD(){return await gbD.getValue()}async function mbD(e){let t=await bbD();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await ObD();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 PbD=60*1e3,jbD=1152921504606847e3,wbD=["is_not"],oFn=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},R2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},_Ks=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||WBp,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 R2?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 R2||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 R2("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 R2("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 R2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new R2("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=GBp(l,n,this.cohorts,this.debugMode):s=$Bp(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&await MBp(t.key,r)>a/100)}async getMatchingVariant(t,r){let i=await MBp(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(PbD,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 oFn(`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 oFn(`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 oFn(`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 oFn&&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=g3o(()=>{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=g3o(()=>{a.abort()},this.timeout),i.signal=a.signal}try{return this.fetch(r,i)}finally{clearTimeout(n)}}};async function MBp(e,t,r=""){let i=await mbD(`${e}.${t}${r}`);return parseInt(i.slice(0,15),16)/jbD}function $Bp(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 R2("Operator is_not_set is not supported")}else throw new R2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!wbD.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 ABp(String(n))&&String(u).match(String(n))!==null;case"not_regex":return ABp(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=SbD(String(n));if(s==null&&(s=qBp(n)),s==null)throw new R2(`Invalid date: ${n}`);let o=qBp(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new R2(`Unknown operator: ${a}`)}}function GBp(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new R2("can't match cohort without a given cohort property value");let a=r[n];return QBp(a,t,r,i)}function QBp(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=QBp(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof R2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new R2("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=GBp(l,t,r,i):d=$Bp(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 R2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new R2("can't match cohort without a given cohort property value");return n==="AND"}}function ABp(e){try{return new RegExp(e),!0}catch{return!1}}function qBp(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 R2(`${e} is in an invalid date format`)}else throw new R2(`The date provided ${e} must be a string, number, or date object`)}function SbD(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 hKs=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},DbD=100,TBp=30*1e3,EbD=50*1e3,yKs=class extends dKs{constructor(t,r={}){if(super(t,r),this._memoryStorage=new hKs,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,DbD):TBp,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 _Ks({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 uFn(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||EbD}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):WBp(t,r)}getLibraryVersion(){return rbD}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=TBp){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=gKs(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");uFn.captureException(this,t,{syntheticException:n},r,i)}},CBp=/\(error: (.*)\)/,JBp=50,KBp="?";function MbD(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||KBp,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:BBp(n[3]),colno:BBp(n[4]),in_app:AbD(o||"",c),platform:"node:javascript"}}if(i.match(t))return{filename:i,platform:"node:javascript"}}}function AbD(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 BBp(e){return parseInt(e||"",10)||void 0}function qbD(e){return[90,MbD(e)]}function TbD(e){let r=[qbD(e)].sort((i,n)=>i[0]-n[0]).map(i=>i[1]);return(i,n=0)=>{let a=[],u=i.split(`
1714
- `);for(let l=n;l<u.length;l++){let d=u[l];if(d.length>1024)continue;let s=CBp.test(d)?d.replace(CBp,"$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>=JBp)break}}return CbD(a)}}function CbD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,JBp).map(r=>({...r,filename:r.filename||BbD(t).filename,function:r.function||KBp}))}function BbD(e){return e[e.length-1]||{}}uFn.stackParser=TbD(WvD());uFn.frameModifiers=[GvD];var cFn=class extends yKs{getLibraryId(){return"posthog-node"}};var m3o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new cFn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.64.28",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var pEa=class{async sendEvent(){}async identify(){}async flush(){}};var fFn=require("fs/promises"),kBp=require("os"),eIp=require("path");var YBp=ni(require("crypto")),j3o=new Uint8Array(256),P3o=j3o.length;function OKs(){return P3o>j3o.length-16&&(YBp.default.randomFillSync(j3o),P3o=0),j3o.slice(P3o,P3o+=16)}var DW=[];for(let e=0;e<256;++e)DW.push((e+256).toString(16).slice(1));function XBp(e,t=0){return DW[e[t+0]]+DW[e[t+1]]+DW[e[t+2]]+DW[e[t+3]]+"-"+DW[e[t+4]]+DW[e[t+5]]+"-"+DW[e[t+6]]+DW[e[t+7]]+"-"+DW[e[t+8]]+DW[e[t+9]]+"-"+DW[e[t+10]]+DW[e[t+11]]+DW[e[t+12]]+DW[e[t+13]]+DW[e[t+14]]+DW[e[t+15]]}var ZBp=ni(require("crypto")),mKs={randomUUID:ZBp.default.randomUUID};function IbD(e,t,r){if(mKs.randomUUID&&!t&&!e)return mKs.randomUUID();e=e||{};let i=e.random||(e.rng||OKs)();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 XBp(i)}var hae=IbD;var zbD="id",xbD=".fern",_Ea=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new cFn(r),this.userId=t==null?void 0:fVs(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.64.28",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ru(cl.of((0,kBp.homedir)()),Fa.of(xbD),Fa.of(zbD));await mf(t)||(await(0,fFn.mkdir)((0,eIp.dirname)(t),{recursive:!0}),await(0,fFn.writeFile)(t,hae())),this.persistedDistinctId=(await(0,fFn.readFile)(t)).toString()}return this.persistedDistinctId}};var PKs;async function dFn(){return PKs==null&&(PKs=await RbD()),PKs}async function RbD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new pEa;let r=await VBo();return r!=null?new _Ea({token:r,posthogApiKey:e}):await fRn()!=null?new m3o({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:NbD}=Object.prototype,{getPrototypeOf:wKs}=Object,{iterator:S3o,toStringTag:rIp}=Symbol,D3o=(e=>t=>{let r=NbD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),fWt=e=>(e=e.toLowerCase(),t=>D3o(t)===e),E3o=e=>t=>typeof t===e,{isArray:pFn}=Array,yEa=E3o("undefined");function FbD(e){return e!==null&&!yEa(e)&&e.constructor!==null&&!yEa(e.constructor)&&yae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var iIp=fWt("ArrayBuffer");function LbD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&iIp(e.buffer),t}var UbD=E3o("string"),yae=E3o("function"),nIp=E3o("number"),M3o=e=>e!==null&&typeof e=="object",VbD=e=>e===!0||e===!1,w3o=e=>{if(D3o(e)!=="object")return!1;let t=wKs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(rIp in e)&&!(S3o in e)},WbD=fWt("Date"),HbD=fWt("File"),$bD=fWt("Blob"),GbD=fWt("FileList"),QbD=e=>M3o(e)&&yae(e.pipe),JbD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||yae(e.append)&&((t=D3o(e))==="formdata"||t==="object"&&yae(e.toString)&&e.toString()==="[object FormData]"))},KbD=fWt("URLSearchParams"),[YbD,XbD,ZbD,kbD]=["ReadableStream","Request","Response","Headers"].map(fWt),e0D=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]),pFn(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 aIp(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 WHi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,oIp=e=>!yEa(e)&&e!==WHi;function jKs(){let{caseless:e}=oIp(this)&&this||{},t={},r=(i,n)=>{let a=e&&aIp(t,n)||n;w3o(t[a])&&w3o(i)?t[a]=jKs(t[a],i):w3o(i)?t[a]=jKs({},i):pFn(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 t0D=(e,t,r,{allOwnKeys:i}={})=>(vEa(t,(n,a)=>{r&&yae(n)?e[a]=hEa(n,r):e[a]=n},{allOwnKeys:i}),e),r0D=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),i0D=(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)},n0D=(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&&wKs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},a0D=(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},o0D=e=>{if(!e)return null;if(pFn(e))return e;let t=e.length;if(!nIp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},u0D=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&wKs(Uint8Array)),s0D=(e,t)=>{let i=(e&&e[S3o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},c0D=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},l0D=fWt("HTMLFormElement"),f0D=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),tIp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),d0D=fWt("RegExp"),uIp=(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)},p0D=e=>{uIp(e,(t,r)=>{if(yae(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(yae(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+"'")})}})},_0D=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return pFn(e)?i(e):i(String(e).split(t)),r},h0D=()=>{},y0D=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function v0D(e){return!!(e&&yae(e.append)&&e[rIp]==="FormData"&&e[S3o])}var b0D=e=>{let t=new Array(10),r=(i,n)=>{if(M3o(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=pFn(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)},g0D=fWt("AsyncFunction"),O0D=e=>e&&(M3o(e)||yae(e))&&yae(e.then)&&yae(e.catch),sIp=((e,t)=>e?setImmediate:t?((r,i)=>(WHi.addEventListener("message",({source:n,data:a})=>{n===WHi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),WHi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",yae(WHi.postMessage)),m0D=typeof queueMicrotask<"u"?queueMicrotask.bind(WHi):typeof process<"u"&&process.nextTick||sIp,P0D=e=>e!=null&&yae(e[S3o]),us={isArray:pFn,isArrayBuffer:iIp,isBuffer:FbD,isFormData:JbD,isArrayBufferView:LbD,isString:UbD,isNumber:nIp,isBoolean:VbD,isObject:M3o,isPlainObject:w3o,isReadableStream:YbD,isRequest:XbD,isResponse:ZbD,isHeaders:kbD,isUndefined:yEa,isDate:WbD,isFile:HbD,isBlob:$bD,isRegExp:d0D,isFunction:yae,isStream:QbD,isURLSearchParams:KbD,isTypedArray:u0D,isFileList:GbD,forEach:vEa,merge:jKs,extend:t0D,trim:e0D,stripBOM:r0D,inherits:i0D,toFlatObject:n0D,kindOf:D3o,kindOfTest:fWt,endsWith:a0D,toArray:o0D,forEachEntry:s0D,matchAll:c0D,isHTMLForm:l0D,hasOwnProperty:tIp,hasOwnProp:tIp,reduceDescriptors:uIp,freezeMethods:p0D,toObjectSet:_0D,toCamelCase:f0D,noop:h0D,toFiniteNumber:y0D,findKey:aIp,global:WHi,isContextDefined:oIp,isSpecCompliantForm:v0D,toJSONObject:b0D,isAsyncFn:g0D,isThenable:O0D,setImmediate:sIp,asap:m0D,isIterable:P0D};function _Fn(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)}us.inherits(_Fn,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:us.toJSONObject(this.config),code:this.code,status:this.status}}});var cIp=_Fn.prototype,lIp={};["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=>{lIp[e]={value:e}});Object.defineProperties(_Fn,lIp);Object.defineProperty(cIp,"isAxiosError",{value:!0});_Fn.from=(e,t,r,i,n,a)=>{let u=Object.create(cIp);return us.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),_Fn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var Fp=_Fn;var fIp=ni(KFo(),1),A3o=fIp.default;function SKs(e){return us.isPlainObject(e)||us.isArray(e)}function pIp(e){return us.endsWith(e,"[]")?e.slice(0,-2):e}function dIp(e,t,r){return e?e.concat(t).map(function(n,a){return n=pIp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function j0D(e){return us.isArray(e)&&!e.some(SKs)}var w0D=us.toFlatObject(us,{},null,function(t){return/^is[A-Z]/.test(t)});function S0D(e,t,r){if(!us.isObject(e))throw new TypeError("target must be an object");t=t||new(A3o||FormData),r=us.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!us.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&us.isSpecCompliantForm(t);if(!us.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(us.isDate(O))return O.toISOString();if(us.isBoolean(O))return O.toString();if(!d&&us.isBlob(O))throw new Fp("Blob is not supported. Use a Buffer instead.");return us.isArrayBuffer(O)||us.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(us.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(us.isArray(O)&&j0D(O)||(us.isFileList(O)||us.endsWith(m,"[]"))&&(E=us.toArray(O)))return m=pIp(m),E.forEach(function(A,D){!(us.isUndefined(A)||A===null)&&t.append(u===!0?dIp([m],D,a):u===null?m:m+"[]",s(A))}),!1}return SKs(O)?!0:(t.append(dIp(w,m,a),s(O)),!1)}let c=[],b=Object.assign(w0D,{defaultVisitor:o,convertValue:s,isVisitable:SKs});function g(O,m){if(!us.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),us.forEach(O,function(E,q){(!(us.isUndefined(E)||E===null)&&n.call(t,E,us.isString(q)?q.trim():q,m,b))===!0&&g(E,m?m.concat(q):[q])}),c.pop()}}if(!us.isObject(e))throw new TypeError("data must be an object");return g(e),t}var JSi=S0D;function _Ip(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function hIp(e,t){this._pairs=[],e&&JSi(e,this,t)}var yIp=hIp.prototype;yIp.append=function(t,r){this._pairs.push([t,r])};yIp.toString=function(t){let r=t?function(i){return t.call(this,i,_Ip)}:_Ip;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var vIp=hIp;function D0D(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function HHi(e,t,r){if(!t)return e;let i=r&&r.encode||D0D;us.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=us.isURLSearchParams(t)?t.toString():new vIp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var DKs=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){us.forEach(this.handlers,function(i){i!==null&&t(i)})}},EKs=DKs;var hFn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var mIp=ni(require("crypto"),1);var bIp=ni(require("url"),1),gIp=bIp.default.URLSearchParams;var MKs="abcdefghijklmnopqrstuvwxyz",OIp="0123456789",PIp={DIGIT:OIp,ALPHA:MKs,ALPHA_DIGIT:MKs+MKs.toUpperCase()+OIp},E0D=(e=16,t=PIp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);mIp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},jIp={isNode:!0,classes:{URLSearchParams:gIp,FormData:A3o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:PIp,generateString:E0D,protocols:["http","https","file","data"]};var TKs={};Dn(TKs,{hasBrowserEnv:()=>qKs,hasStandardBrowserEnv:()=>M0D,hasStandardBrowserWebWorkerEnv:()=>A0D,navigator:()=>AKs,origin:()=>q0D});var qKs=typeof window<"u"&&typeof document<"u",AKs=typeof navigator=="object"&&navigator||void 0,M0D=qKs&&(!AKs||["ReactNative","NativeScript","NS"].indexOf(AKs.product)<0),A0D=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",q0D=qKs&&window.location.href||"http://localhost";var aA={...TKs,...jIp};function CKs(e,t){return JSi(e,new aA.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return aA.isNode&&us.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function T0D(e){return us.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function C0D(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 B0D(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&&us.isArray(n)?n.length:u,d?(us.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!us.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&us.isArray(n[u])&&(n[u]=C0D(n[u])),!l)}if(us.isFormData(e)&&us.isFunction(e.entries)){let r={};return us.forEachEntry(e,(i,n)=>{t(T0D(i),n,r,0)}),r}return null}var q3o=B0D;function I0D(e,t,r){if(us.isString(e))try{return(t||JSON.parse)(e),us.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var BKs={transitional:hFn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=us.isObject(t);if(a&&us.isHTMLForm(t)&&(t=new FormData(t)),us.isFormData(t))return n?JSON.stringify(q3o(t)):t;if(us.isArrayBuffer(t)||us.isBuffer(t)||us.isStream(t)||us.isFile(t)||us.isBlob(t)||us.isReadableStream(t))return t;if(us.isArrayBufferView(t))return t.buffer;if(us.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 CKs(t,this.formSerializer).toString();if((l=us.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return JSi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),I0D(t)):t}],transformResponse:[function(t){let r=this.transitional||BKs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(us.isResponse(t)||us.isReadableStream(t))return t;if(t&&us.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:aA.classes.FormData,Blob:aA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};us.forEach(["delete","get","head","post","put","patch"],e=>{BKs.headers[e]={}});var yFn=BKs;var z0D=us.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"]),wIp=e=>{let t={},r,i,n;return e&&e.split(`
1714
+ `);for(let l=n;l<u.length;l++){let d=u[l];if(d.length>1024)continue;let s=CBp.test(d)?d.replace(CBp,"$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>=JBp)break}}return CbD(a)}}function CbD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,JBp).map(r=>({...r,filename:r.filename||BbD(t).filename,function:r.function||KBp}))}function BbD(e){return e[e.length-1]||{}}uFn.stackParser=TbD(WvD());uFn.frameModifiers=[GvD];var cFn=class extends yKs{getLibraryId(){return"posthog-node"}};var m3o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new cFn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.64.30",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var pEa=class{async sendEvent(){}async identify(){}async flush(){}};var fFn=require("fs/promises"),kBp=require("os"),eIp=require("path");var YBp=ni(require("crypto")),j3o=new Uint8Array(256),P3o=j3o.length;function OKs(){return P3o>j3o.length-16&&(YBp.default.randomFillSync(j3o),P3o=0),j3o.slice(P3o,P3o+=16)}var DW=[];for(let e=0;e<256;++e)DW.push((e+256).toString(16).slice(1));function XBp(e,t=0){return DW[e[t+0]]+DW[e[t+1]]+DW[e[t+2]]+DW[e[t+3]]+"-"+DW[e[t+4]]+DW[e[t+5]]+"-"+DW[e[t+6]]+DW[e[t+7]]+"-"+DW[e[t+8]]+DW[e[t+9]]+"-"+DW[e[t+10]]+DW[e[t+11]]+DW[e[t+12]]+DW[e[t+13]]+DW[e[t+14]]+DW[e[t+15]]}var ZBp=ni(require("crypto")),mKs={randomUUID:ZBp.default.randomUUID};function IbD(e,t,r){if(mKs.randomUUID&&!t&&!e)return mKs.randomUUID();e=e||{};let i=e.random||(e.rng||OKs)();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 XBp(i)}var hae=IbD;var zbD="id",xbD=".fern",_Ea=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new cFn(r),this.userId=t==null?void 0:fVs(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.64.30",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ru(cl.of((0,kBp.homedir)()),Fa.of(xbD),Fa.of(zbD));await mf(t)||(await(0,fFn.mkdir)((0,eIp.dirname)(t),{recursive:!0}),await(0,fFn.writeFile)(t,hae())),this.persistedDistinctId=(await(0,fFn.readFile)(t)).toString()}return this.persistedDistinctId}};var PKs;async function dFn(){return PKs==null&&(PKs=await RbD()),PKs}async function RbD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new pEa;let r=await VBo();return r!=null?new _Ea({token:r,posthogApiKey:e}):await fRn()!=null?new m3o({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:NbD}=Object.prototype,{getPrototypeOf:wKs}=Object,{iterator:S3o,toStringTag:rIp}=Symbol,D3o=(e=>t=>{let r=NbD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),fWt=e=>(e=e.toLowerCase(),t=>D3o(t)===e),E3o=e=>t=>typeof t===e,{isArray:pFn}=Array,yEa=E3o("undefined");function FbD(e){return e!==null&&!yEa(e)&&e.constructor!==null&&!yEa(e.constructor)&&yae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var iIp=fWt("ArrayBuffer");function LbD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&iIp(e.buffer),t}var UbD=E3o("string"),yae=E3o("function"),nIp=E3o("number"),M3o=e=>e!==null&&typeof e=="object",VbD=e=>e===!0||e===!1,w3o=e=>{if(D3o(e)!=="object")return!1;let t=wKs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(rIp in e)&&!(S3o in e)},WbD=fWt("Date"),HbD=fWt("File"),$bD=fWt("Blob"),GbD=fWt("FileList"),QbD=e=>M3o(e)&&yae(e.pipe),JbD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||yae(e.append)&&((t=D3o(e))==="formdata"||t==="object"&&yae(e.toString)&&e.toString()==="[object FormData]"))},KbD=fWt("URLSearchParams"),[YbD,XbD,ZbD,kbD]=["ReadableStream","Request","Response","Headers"].map(fWt),e0D=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]),pFn(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 aIp(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 WHi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,oIp=e=>!yEa(e)&&e!==WHi;function jKs(){let{caseless:e}=oIp(this)&&this||{},t={},r=(i,n)=>{let a=e&&aIp(t,n)||n;w3o(t[a])&&w3o(i)?t[a]=jKs(t[a],i):w3o(i)?t[a]=jKs({},i):pFn(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 t0D=(e,t,r,{allOwnKeys:i}={})=>(vEa(t,(n,a)=>{r&&yae(n)?e[a]=hEa(n,r):e[a]=n},{allOwnKeys:i}),e),r0D=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),i0D=(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)},n0D=(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&&wKs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},a0D=(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},o0D=e=>{if(!e)return null;if(pFn(e))return e;let t=e.length;if(!nIp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},u0D=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&wKs(Uint8Array)),s0D=(e,t)=>{let i=(e&&e[S3o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},c0D=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},l0D=fWt("HTMLFormElement"),f0D=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),tIp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),d0D=fWt("RegExp"),uIp=(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)},p0D=e=>{uIp(e,(t,r)=>{if(yae(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(yae(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+"'")})}})},_0D=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return pFn(e)?i(e):i(String(e).split(t)),r},h0D=()=>{},y0D=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function v0D(e){return!!(e&&yae(e.append)&&e[rIp]==="FormData"&&e[S3o])}var b0D=e=>{let t=new Array(10),r=(i,n)=>{if(M3o(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=pFn(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)},g0D=fWt("AsyncFunction"),O0D=e=>e&&(M3o(e)||yae(e))&&yae(e.then)&&yae(e.catch),sIp=((e,t)=>e?setImmediate:t?((r,i)=>(WHi.addEventListener("message",({source:n,data:a})=>{n===WHi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),WHi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",yae(WHi.postMessage)),m0D=typeof queueMicrotask<"u"?queueMicrotask.bind(WHi):typeof process<"u"&&process.nextTick||sIp,P0D=e=>e!=null&&yae(e[S3o]),us={isArray:pFn,isArrayBuffer:iIp,isBuffer:FbD,isFormData:JbD,isArrayBufferView:LbD,isString:UbD,isNumber:nIp,isBoolean:VbD,isObject:M3o,isPlainObject:w3o,isReadableStream:YbD,isRequest:XbD,isResponse:ZbD,isHeaders:kbD,isUndefined:yEa,isDate:WbD,isFile:HbD,isBlob:$bD,isRegExp:d0D,isFunction:yae,isStream:QbD,isURLSearchParams:KbD,isTypedArray:u0D,isFileList:GbD,forEach:vEa,merge:jKs,extend:t0D,trim:e0D,stripBOM:r0D,inherits:i0D,toFlatObject:n0D,kindOf:D3o,kindOfTest:fWt,endsWith:a0D,toArray:o0D,forEachEntry:s0D,matchAll:c0D,isHTMLForm:l0D,hasOwnProperty:tIp,hasOwnProp:tIp,reduceDescriptors:uIp,freezeMethods:p0D,toObjectSet:_0D,toCamelCase:f0D,noop:h0D,toFiniteNumber:y0D,findKey:aIp,global:WHi,isContextDefined:oIp,isSpecCompliantForm:v0D,toJSONObject:b0D,isAsyncFn:g0D,isThenable:O0D,setImmediate:sIp,asap:m0D,isIterable:P0D};function _Fn(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)}us.inherits(_Fn,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:us.toJSONObject(this.config),code:this.code,status:this.status}}});var cIp=_Fn.prototype,lIp={};["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=>{lIp[e]={value:e}});Object.defineProperties(_Fn,lIp);Object.defineProperty(cIp,"isAxiosError",{value:!0});_Fn.from=(e,t,r,i,n,a)=>{let u=Object.create(cIp);return us.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),_Fn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var Fp=_Fn;var fIp=ni(KFo(),1),A3o=fIp.default;function SKs(e){return us.isPlainObject(e)||us.isArray(e)}function pIp(e){return us.endsWith(e,"[]")?e.slice(0,-2):e}function dIp(e,t,r){return e?e.concat(t).map(function(n,a){return n=pIp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function j0D(e){return us.isArray(e)&&!e.some(SKs)}var w0D=us.toFlatObject(us,{},null,function(t){return/^is[A-Z]/.test(t)});function S0D(e,t,r){if(!us.isObject(e))throw new TypeError("target must be an object");t=t||new(A3o||FormData),r=us.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!us.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&us.isSpecCompliantForm(t);if(!us.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(us.isDate(O))return O.toISOString();if(us.isBoolean(O))return O.toString();if(!d&&us.isBlob(O))throw new Fp("Blob is not supported. Use a Buffer instead.");return us.isArrayBuffer(O)||us.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(us.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(us.isArray(O)&&j0D(O)||(us.isFileList(O)||us.endsWith(m,"[]"))&&(E=us.toArray(O)))return m=pIp(m),E.forEach(function(A,D){!(us.isUndefined(A)||A===null)&&t.append(u===!0?dIp([m],D,a):u===null?m:m+"[]",s(A))}),!1}return SKs(O)?!0:(t.append(dIp(w,m,a),s(O)),!1)}let c=[],b=Object.assign(w0D,{defaultVisitor:o,convertValue:s,isVisitable:SKs});function g(O,m){if(!us.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),us.forEach(O,function(E,q){(!(us.isUndefined(E)||E===null)&&n.call(t,E,us.isString(q)?q.trim():q,m,b))===!0&&g(E,m?m.concat(q):[q])}),c.pop()}}if(!us.isObject(e))throw new TypeError("data must be an object");return g(e),t}var JSi=S0D;function _Ip(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function hIp(e,t){this._pairs=[],e&&JSi(e,this,t)}var yIp=hIp.prototype;yIp.append=function(t,r){this._pairs.push([t,r])};yIp.toString=function(t){let r=t?function(i){return t.call(this,i,_Ip)}:_Ip;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var vIp=hIp;function D0D(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function HHi(e,t,r){if(!t)return e;let i=r&&r.encode||D0D;us.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=us.isURLSearchParams(t)?t.toString():new vIp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var DKs=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){us.forEach(this.handlers,function(i){i!==null&&t(i)})}},EKs=DKs;var hFn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var mIp=ni(require("crypto"),1);var bIp=ni(require("url"),1),gIp=bIp.default.URLSearchParams;var MKs="abcdefghijklmnopqrstuvwxyz",OIp="0123456789",PIp={DIGIT:OIp,ALPHA:MKs,ALPHA_DIGIT:MKs+MKs.toUpperCase()+OIp},E0D=(e=16,t=PIp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);mIp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},jIp={isNode:!0,classes:{URLSearchParams:gIp,FormData:A3o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:PIp,generateString:E0D,protocols:["http","https","file","data"]};var TKs={};Dn(TKs,{hasBrowserEnv:()=>qKs,hasStandardBrowserEnv:()=>M0D,hasStandardBrowserWebWorkerEnv:()=>A0D,navigator:()=>AKs,origin:()=>q0D});var qKs=typeof window<"u"&&typeof document<"u",AKs=typeof navigator=="object"&&navigator||void 0,M0D=qKs&&(!AKs||["ReactNative","NativeScript","NS"].indexOf(AKs.product)<0),A0D=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",q0D=qKs&&window.location.href||"http://localhost";var aA={...TKs,...jIp};function CKs(e,t){return JSi(e,new aA.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return aA.isNode&&us.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function T0D(e){return us.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function C0D(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 B0D(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&&us.isArray(n)?n.length:u,d?(us.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!us.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&us.isArray(n[u])&&(n[u]=C0D(n[u])),!l)}if(us.isFormData(e)&&us.isFunction(e.entries)){let r={};return us.forEachEntry(e,(i,n)=>{t(T0D(i),n,r,0)}),r}return null}var q3o=B0D;function I0D(e,t,r){if(us.isString(e))try{return(t||JSON.parse)(e),us.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var BKs={transitional:hFn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=us.isObject(t);if(a&&us.isHTMLForm(t)&&(t=new FormData(t)),us.isFormData(t))return n?JSON.stringify(q3o(t)):t;if(us.isArrayBuffer(t)||us.isBuffer(t)||us.isStream(t)||us.isFile(t)||us.isBlob(t)||us.isReadableStream(t))return t;if(us.isArrayBufferView(t))return t.buffer;if(us.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 CKs(t,this.formSerializer).toString();if((l=us.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return JSi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),I0D(t)):t}],transformResponse:[function(t){let r=this.transitional||BKs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(us.isResponse(t)||us.isReadableStream(t))return t;if(t&&us.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:aA.classes.FormData,Blob:aA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};us.forEach(["delete","get","head","post","put","patch"],e=>{BKs.headers[e]={}});var yFn=BKs;var z0D=us.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"]),wIp=e=>{let t={},r,i,n;return e&&e.split(`
1715
1715
  `).forEach(function(u){n=u.indexOf(":"),r=u.substring(0,n).trim().toLowerCase(),i=u.substring(n+1).trim(),!(!r||t[r]&&z0D[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var SIp=Symbol("internals");function bEa(e){return e&&String(e).trim().toLowerCase()}function T3o(e){return e===!1||e==null?e:us.isArray(e)?e.map(T3o):String(e)}function x0D(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 R0D=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function IKs(e,t,r,i,n){if(us.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!us.isString(t)){if(us.isString(i))return t.indexOf(i)!==-1;if(us.isRegExp(i))return i.test(t)}}function N0D(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function F0D(e,t){let r=us.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 vFn=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=us.findKey(n,o);(!c||n[c]===void 0||s===!0||s===void 0&&n[c]!==!1)&&(n[c||d]=T3o(l))}let u=(l,d)=>us.forEach(l,(s,o)=>a(s,o,d));if(us.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(us.isString(t)&&(t=t.trim())&&!R0D(t))u(wIp(t),r);else if(us.isObject(t)&&us.isIterable(t)){let l={},d,s;for(let o of t){if(!us.isArray(o))throw TypeError("Object iterator must return a key-value pair");l[s=o[0]]=(d=l[s])?us.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=us.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return x0D(n);if(us.isFunction(r))return r.call(this,n,i);if(us.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=us.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||IKs(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=us.findKey(i,u);l&&(!r||IKs(i,i[l],l,r))&&(delete i[l],n=!0)}}return us.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||IKs(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return us.forEach(this,(n,a)=>{let u=us.findKey(i,a);if(u){r[u]=T3o(n),delete r[a];return}let l=t?N0D(a):String(a).trim();l!==a&&delete r[a],r[l]=T3o(n),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return us.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&us.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(`
1716
1716
  `)}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[SIp]=this[SIp]={accessors:{}}).accessors,n=this.prototype;function a(u){let l=bEa(u);i[l]||(F0D(n,u),i[l]=!0)}return us.isArray(t)?t.forEach(a):a(t),this}};vFn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);us.reduceDescriptors(vFn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});us.freezeMethods(vFn);var rR=vFn;function gEa(e,t){let r=this||yFn,i=t||r,n=rR.from(i.headers),a=i.data;return us.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 DIp(e,t,r){Fp.call(this,e??"canceled",Fp.ERR_CANCELED,t,r),this.name="CanceledError"}us.inherits(DIp,Fp,{__CANCEL__:!0});var HEe=DIp;function Qtr(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 zKs(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function xKs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function $Hi(e,t,r){let i=!zKs(t);return e&&(i||r==!1)?xKs(e,t):t}var VIp=ni(rEa(),1),WIp=ni(require("http"),1),HIp=ni(require("https"),1),$Ip=ni(require("util"),1),GIp=ni(xJs(),1),lfi=ni(require("zlib"),1);var GHi="1.10.0";function mEa(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var L0D=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function RKs(e,t,r){let i=r&&r.Blob||aA.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=L0D.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 JHi=ni(require("stream"),1);var EIp=ni(require("stream"),1);var NKs=Symbol("internals"),FKs=class extends EIp.default.Transform{constructor(t){t=us.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!us.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[NKs]={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[NKs];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[NKs],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)})}},LKs=FKs;var QIp=require("events");var AIp=ni(require("util"),1),qIp=require("stream");var{asyncIterator:MIp}=Symbol,U0D=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[MIp]?yield*e[MIp]():yield e},C3o=U0D;var V0D=aA.ALPHABET.ALPHA_DIGIT+"-_",PEa=typeof TextEncoder=="function"?new TextEncoder:new AIp.default.TextEncoder,QHi=`\r
1717
1717
  `,W0D=PEa.encode(QHi),H0D=2,UKs=class{constructor(t,r){let{escapeName:i}=this.constructor,n=us.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${QHi}`;n?r=PEa.encode(String(r).replace(/\r?\n|\r\n?/g,QHi)):a+=`Content-Type: ${r.type||"application/octet-stream"}${QHi}`,this.headers=PEa.encode(a+QHi),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+H0D,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;us.isTypedArray(t)?yield t:yield*C3o(t),yield W0D}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},$0D=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+aA.generateString(n,V0D)}=r||{};if(!us.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+QHi),l=PEa.encode("--"+a+"--"+QHi),d=l.byteLength,s=Array.from(e.entries()).map(([c,b])=>{let g=new UKs(c,b);return d+=g.size,g});d+=u.byteLength*s.length,d=us.toFiniteNumber(d);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(o["Content-Length"]=d),t&&t(o),qIp.Readable.from(async function*(){for(let c of s)yield u,yield*c.encode();yield l}())},TIp=$0D;var CIp=ni(require("stream"),1),VKs=class extends CIp.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)}},BIp=VKs;var G0D=(e,t)=>us.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,IIp=G0D;function Q0D(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 zIp=Q0D;function J0D(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 xIp=J0D;var cfi=(e,t,r=3)=>{let i=0,n=zIp(50,250);return xIp(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]]},gFn=e=>(...t)=>us.asap(()=>e(...t));var RIp={flush:lfi.default.constants.Z_SYNC_FLUSH,finishFlush:lfi.default.constants.Z_SYNC_FLUSH},K0D={flush:lfi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:lfi.default.constants.BROTLI_OPERATION_FLUSH},NIp=us.isFunction(lfi.default.createBrotliDecompress),{http:Y0D,https:X0D}=GIp.default,Z0D=/https:?/,FIp=aA.protocols.map(e=>e+":"),LIp=(e,[t,r])=>(e.on("end",r).on("error",r),t);function k0D(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function JIp(e,t,r){let i=t;if(!i&&i!==!1){let n=VIp.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){JIp(a,t,a.href)}}var egD=typeof process<"u"&&us.kindOf(process)==="process",tgD=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)}),rgD=({address:e,family:t})=>{if(!us.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},UIp=(e,t)=>rgD(us.isObject(e)?e:{address:e,family:t}),KIp=egD&&function(t){return tgD(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=IIp(l,Ue=>us.isArray(Ue)?Ue:[Ue]);l=(Ue,wt,De)=>{Oe(Ue,wt,(Te,xt,Pe)=>{if(Te)return De(Te);let ot=us.isArray(xt)?xt.map(at=>UIp(at)):[UIp(xt,Pe)];wt.all?De(Te,ot):De(Te,ot[0].address,ot[0].family)})}}let m=new QIp.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 HEe(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=$Hi(t.baseURL,t.url,t.allowAbsoluteUrls),A=new URL(q,aA.hasBrowserEnv?aA.origin:void 0),D=A.protocol||FIp[0];if(D==="data:"){let Oe;if(c!=="GET")return Qtr(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{Oe=RKs(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=us.stripBOM(Oe))):s==="stream"&&(Oe=JHi.default.Readable.from(Oe)),Qtr(i,n,{data:Oe,status:200,statusText:"OK",headers:new rR,config:t})}if(FIp.indexOf(D)===-1)return n(new Fp("Unsupported protocol "+D,Fp.ERR_BAD_REQUEST,t));let C=rR.from(t.headers).normalize();C.set("User-Agent","axios/"+GHi,!1);let{onUploadProgress:x,onDownloadProgress:$}=t,I=t.maxRate,L,V;if(us.isSpecCompliantForm(u)){let Oe=C.getContentType(/boundary=([-_\w\d]{10,70})/i);u=TIp(u,Ue=>{C.set(Ue)},{tag:`axios-${GHi}-boundary`,boundary:Oe&&Oe[1]||void 0})}else if(us.isFormData(u)&&us.isFunction(u.getHeaders)){if(C.set(u.getHeaders()),!C.hasContentLength())try{let Oe=await $Ip.default.promisify(u.getLength).call(u);Number.isFinite(Oe)&&Oe>=0&&C.setContentLength(Oe)}catch{}}else if(us.isBlob(u)||us.isFile(u))u.size&&C.setContentType(u.type||"application/octet-stream"),C.setContentLength(u.size||0),u=JHi.default.Readable.from(C3o(u));else if(u&&!us.isStream(u)){if(!Buffer.isBuffer(u))if(us.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(us.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=us.toFiniteNumber(C.getContentLength());us.isArray(I)?(L=I[0],V=I[1]):L=V=I,u&&(x||L)&&(us.isStream(u)||(u=JHi.default.Readable.from(u,{objectMode:!1})),u=JHi.default.pipeline([u,new LKs({maxRate:us.toFiniteNumber(L)})],us.noop),x&&u.on("progress",LIp(u,bFn(K,cfi(gFn(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=HHi(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"+(NIp?", 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:k0D,beforeRedirects:{}};!us.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,JIp(oe,t.proxy,D+"//"+A.hostname+(A.port?":"+A.port:"")+oe.path));let _e,de=Z0D.test(oe.protocol);if(oe.agent=de?t.httpsAgent:t.httpAgent,t.transport?_e=t.transport:t.maxRedirects===0?_e=de?HIp.default:WIp.default:(t.maxRedirects&&(oe.maxRedirects=t.maxRedirects),t.beforeRedirect&&(oe.beforeRedirects.config=t.beforeRedirect),_e=de?X0D:Y0D),t.maxBodyLength>-1?oe.maxBodyLength=t.maxBodyLength:oe.maxBodyLength=1/0,t.insecureHTTPParser&&(oe.insecureHTTPParser=t.insecureHTTPParser),O=_e.request(oe,function(Ue){if(O.destroyed)return;let wt=[Ue],De=+Ue.headers["content-length"];if($||V){let at=new LKs({maxRate:us.toFiniteNumber(V)});$&&at.on("progress",LIp(at,bFn(De,cfi(gFn($),!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(lfi.default.createUnzip(RIp)),delete Ue.headers["content-encoding"];break;case"deflate":wt.push(new BIp),wt.push(lfi.default.createUnzip(RIp)),delete Ue.headers["content-encoding"];break;case"br":NIp&&(wt.push(lfi.default.createBrotliDecompress(K0D)),delete Ue.headers["content-encoding"])}Te=wt.length>1?JHi.default.pipeline(wt,us.noop):wt[0];let Pe=JHi.default.finished(Te,()=>{Pe(),w()}),ot={status:Ue.statusCode,statusText:Ue.statusMessage,headers:new rR(Ue.headers),config:t,request:xt};if(s==="stream")ot.data=Te,Qtr(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=us.stripBOM(jt))),ot.data=jt}catch(jt){return n(Fp.from(jt,null,t,ot.request,ot))}Qtr(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||hFn;t.timeoutErrorMessage&&(wt=t.timeoutErrorMessage),n(new Fp(wt,De.clarifyTimeoutError?Fp.ETIMEDOUT:Fp.ECONNABORTED,t,O)),E()})}if(us.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 HEe("Request stream has been aborted",t,O))}),u.pipe(O)}else O.end(u)})};var YIp=aA.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,aA.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(aA.origin),aA.navigator&&/(msie|trident)/i.test(aA.navigator.userAgent)):()=>!0;var XIp=aA.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let u=[e+"="+encodeURIComponent(t)];us.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),us.isString(i)&&u.push("path="+i),us.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 ZIp=e=>e instanceof rR?{...e}:e;function dWt(e,t){t=t||{};let r={};function i(s,o,c,b){return us.isPlainObject(s)&&us.isPlainObject(o)?us.merge.call({caseless:b},s,o):us.isPlainObject(o)?us.merge({},o):us.isArray(o)?o.slice():o}function n(s,o,c,b){if(us.isUndefined(o)){if(!us.isUndefined(s))return i(void 0,s,c,b)}else return i(s,o,c,b)}function a(s,o){if(!us.isUndefined(o))return i(void 0,o)}function u(s,o){if(us.isUndefined(o)){if(!us.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(ZIp(s),ZIp(o),c,!0)};return us.forEach(Object.keys(Object.assign({},e,t)),function(o){let c=d[o]||n,b=c(e[o],t[o],o);us.isUndefined(b)&&c!==l||(r[o]=b)}),r}var B3o=e=>{let t=dWt({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:u,auth:l}=t;t.headers=u=rR.from(u),t.url=HHi($Hi(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(us.isFormData(r)){if(aA.hasStandardBrowserEnv||aA.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(aA.hasStandardBrowserEnv&&(i&&us.isFunction(i)&&(i=i(t)),i||i!==!1&&YIp(t.url))){let s=n&&a&&XIp.read(a);s&&u.set(n,s)}return t};var igD=typeof XMLHttpRequest<"u",kIp=igD&&function(e){return new Promise(function(r,i){let n=B3o(e),a=n.data,u=rR.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=rR.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};Qtr(function($){r($),m()},function($){i($),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||hFn;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&&us.forEach(u.toJSON(),function(D,C){w.setRequestHeader(C,D)}),us.isUndefined(n.withCredentials)||(w.withCredentials=!!n.withCredentials),l&&l!=="json"&&(w.responseType=n.responseType),s&&([b,O]=cfi(s,!0),w.addEventListener("progress",b)),d&&w.upload&&([c,g]=cfi(d),w.upload.addEventListener("progress",c),w.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(o=A=>{w&&(i(!A||A.type?new HEe(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&&aA.protocols.indexOf(q)===-1){i(new Fp("Unsupported protocol "+q+":",Fp.ERR_BAD_REQUEST,e));return}w.send(a||null)})};var ngD=(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 HEe(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=()=>us.asap(l),d}},ezp=ngD;var agD=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},ogD=async function*(e,t){for await(let r of ugD(e))yield*agD(r,t)},ugD=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()}},WKs=(e,t,r,i)=>{let n=ogD(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 z3o=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",rzp=z3o&&typeof ReadableStream=="function",sgD=z3o&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),izp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},cgD=rzp&&izp(()=>{let e=!1,t=new Request(aA.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),tzp=64*1024,HKs=rzp&&izp(()=>us.isReadableStream(new Response("").body)),I3o={stream:HKs&&(e=>e.body)};z3o&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!I3o[t]&&(I3o[t]=us.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 lgD=async e=>{if(e==null)return 0;if(us.isBlob(e))return e.size;if(us.isSpecCompliantForm(e))return(await new Request(aA.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(us.isArrayBufferView(e)||us.isArrayBuffer(e))return e.byteLength;if(us.isURLSearchParams(e)&&(e=e+""),us.isString(e))return(await sgD(e)).byteLength},fgD=async(e,t)=>{let r=us.toFiniteNumber(e.getContentLength());return r??lgD(t)},nzp=z3o&&(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}=B3o(e);s=s?(s+"").toLowerCase():"text";let g=ezp([n,a&&a.toAbortSignal()],u),O,m=g&&g.unsubscribe&&(()=>{g.unsubscribe()}),w;try{if(d&&cgD&&r!=="get"&&r!=="head"&&(w=await fgD(o,i))!==0){let C=new Request(t,{method:"POST",body:i,duplex:"half"}),x;if(us.isFormData(i)&&(x=C.headers.get("content-type"))&&o.setContentType(x),C.body){let[$,I]=bFn(w,cfi(gFn(d)));i=WKs(C.body,tzp,$,I)}}us.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=HKs&&(s==="stream"||s==="response");if(HKs&&(l||A&&m)){let C={};["status","statusText","headers"].forEach(L=>{C[L]=q[L]});let x=us.toFiniteNumber(q.headers.get("content-length")),[$,I]=l&&bFn(x,cfi(gFn(l),!0))||[];q=new Response(WKs(q.body,tzp,$,()=>{I&&I(),m&&m()}),C)}s=s||"text";let D=await I3o[us.findKey(I3o,s)||"text"](q,e);return!A&&m&&m(),await new Promise((C,x)=>{Qtr(C,x,{data:D,headers:rR.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 $Ks={http:KIp,xhr:kIp,fetch:nzp};us.forEach($Ks,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var azp=e=>`- ${e}`,dgD=e=>us.isFunction(e)||e===null||e===!1,x3o={getAdapter:e=>{e=us.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,!dgD(r)&&(i=$Ks[(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 :
@@ -1952,7 +1952,7 @@ ${A}${q}${D}${PKp.default.cursorHide}`});var kTa=ni(Cwi(),1);function Coc(e,t){i
1952
1952
  Run ${Ds.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
1953
1953
  Run ${Ds.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),mFn(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function Woc({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!GKp(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+=`
1954
1954
  ${await NUD(l.generatorName)} (${l.apiName!=null?"API: "+l.apiName+", ":""}Group: ${l.generatorGroup}) `+Ds.dim(l.currentVersion)+Ds.reset(" \u2192 ")+Ds.green(l.latestVersion);return n+=`
1955
- `,i?mFn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function NUD(e){let r=await new $Kp.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 FUD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await JKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=Twi(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 JKp({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=Twi(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 JKp({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 RVt({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 KKp(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 LLo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await FUD({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(...KKp(s,d,t.logger));else u.push(...KKp(l.versions,void 0,t.logger))}return u}var uCa=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 e4n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Hoc=(()=>{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})(),YKp=typeof globalThis.AbortController=="function",XKp=typeof globalThis.ReadableStream=="function",ZKp=typeof globalThis.FormData=="function",ULo=["get","post","put","patch","head","delete"],LUD=()=>{};LUD();var kKp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},VLo=2147483647,eYp=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,WLo=Symbol("stop"),tYp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},rYp={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 UUD=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=eYp,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},iYp=(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})},nYp=(e,t)=>{let r=UUD(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 t4n=e=>e!==null&&typeof e=="object";var sCa=(...e)=>{for(let t of e)if((!t4n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Qoc({},...e)},$oc=(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 HLo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Qoc(e[r]??[],t[r]??[])}var Goc=(e={},t={})=>({beforeRequest:HLo(e,t,"beforeRequest"),beforeRetry:HLo(e,t,"beforeRetry"),afterResponse:HLo(e,t,"afterResponse"),beforeError:HLo(e,t,"beforeError")}),Qoc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(t4n(n)){for(let[a,u]of Object.entries(n))t4n(u)&&a in t&&(u=Qoc(t[a],u)),t={...t,[a]:u};t4n(n.hooks)&&(i=Goc(i,n.hooks),t.hooks=i),t4n(n.headers)&&(r=$oc(r,n.headers),t.headers=r)}return t};var oYp=e=>ULo.includes(e)?e.toUpperCase():e,VUD=["get","put","head","delete","options","trace"],WUD=[408,413,429,500,502,503,504],HUD=[413,429,503],aYp={limit:2,methods:VUD,statusCodes:WUD,afterStatusCodes:HUD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},uYp=(e={})=>{if(typeof e=="number")return{...aYp,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{...aYp,...e}};async function Joc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new e4n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function Koc(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 sYp=(e,t)=>{let r={};for(let i in t)!(i in rYp)&&!(i in tYp)&&!(i in e)&&(r[i]=t[i]);return r};var cCa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>VLo)throw new RangeError(`The \`timeout\` option cannot be greater than ${VLo}`);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 uCa(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(!XKp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return iYp(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(kKp))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:$oc(this._input.headers,r.headers),hooks:Goc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:oYp(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:uYp(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(YKp){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(Hoc&&(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);(ZKp&&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(!Hoc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=nYp(this.request,this._options.onUploadProgress))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof e4n)throw t;if(t instanceof uCa){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),VLo);if(this._retryCount<1)throw r;await Koc(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})===WLo)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=sYp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Joc(r,t,this.abortController,this._options)}};var Yoc=e=>{let t=(r,i)=>cCa.create(r,sCa(e,i));for(let r of ULo)t[r]=(i,n)=>cCa.create(i,sCa(e,n,{method:r}));return t.create=r=>Yoc(sCa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),Yoc(sCa(e,r))),t.stop=WLo,t},$UD=Yoc(),cYp=$UD;var CYp=ni(TYp(),1);function tuc(e){let t=(0,CYp.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var DXp=ni(SXp(),1),EXp=ni(Cwi(),1),_uc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},huc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function yuc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??tuc(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,DXp.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 cYp(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new _uc(e):c}if(t.allVersions)return s;let o=new huc(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=EXp.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 hCa(e,t){let{version:r}=await yuc(e.toLowerCase(),t);return r}async function bEi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:hCa(e.packageName,{version:t?"prerelease":"latest"})}var MXp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],rUo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=T0.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new FLo(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.64.28"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Ds.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new l9}failWithoutThrowing(t,r){this.didSucceed=!1,zLo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await dFn()).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 QKp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1955
+ `,i?mFn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function NUD(e){let r=await new $Kp.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 FUD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await JKp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=Twi(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 JKp({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=Twi(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 JKp({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 RVt({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 KKp(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 LLo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await FUD({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(...KKp(s,d,t.logger));else u.push(...KKp(l.versions,void 0,t.logger))}return u}var uCa=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 e4n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Hoc=(()=>{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})(),YKp=typeof globalThis.AbortController=="function",XKp=typeof globalThis.ReadableStream=="function",ZKp=typeof globalThis.FormData=="function",ULo=["get","post","put","patch","head","delete"],LUD=()=>{};LUD();var kKp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},VLo=2147483647,eYp=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,WLo=Symbol("stop"),tYp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},rYp={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 UUD=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=eYp,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},iYp=(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})},nYp=(e,t)=>{let r=UUD(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 t4n=e=>e!==null&&typeof e=="object";var sCa=(...e)=>{for(let t of e)if((!t4n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Qoc({},...e)},$oc=(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 HLo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Qoc(e[r]??[],t[r]??[])}var Goc=(e={},t={})=>({beforeRequest:HLo(e,t,"beforeRequest"),beforeRetry:HLo(e,t,"beforeRetry"),afterResponse:HLo(e,t,"afterResponse"),beforeError:HLo(e,t,"beforeError")}),Qoc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(t4n(n)){for(let[a,u]of Object.entries(n))t4n(u)&&a in t&&(u=Qoc(t[a],u)),t={...t,[a]:u};t4n(n.hooks)&&(i=Goc(i,n.hooks),t.hooks=i),t4n(n.headers)&&(r=$oc(r,n.headers),t.headers=r)}return t};var oYp=e=>ULo.includes(e)?e.toUpperCase():e,VUD=["get","put","head","delete","options","trace"],WUD=[408,413,429,500,502,503,504],HUD=[413,429,503],aYp={limit:2,methods:VUD,statusCodes:WUD,afterStatusCodes:HUD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},uYp=(e={})=>{if(typeof e=="number")return{...aYp,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{...aYp,...e}};async function Joc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new e4n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function Koc(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 sYp=(e,t)=>{let r={};for(let i in t)!(i in rYp)&&!(i in tYp)&&!(i in e)&&(r[i]=t[i]);return r};var cCa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>VLo)throw new RangeError(`The \`timeout\` option cannot be greater than ${VLo}`);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 uCa(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(!XKp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return iYp(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(kKp))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:$oc(this._input.headers,r.headers),hooks:Goc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:oYp(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:uYp(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(YKp){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(Hoc&&(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);(ZKp&&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(!Hoc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=nYp(this.request,this._options.onUploadProgress))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof e4n)throw t;if(t instanceof uCa){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),VLo);if(this._retryCount<1)throw r;await Koc(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})===WLo)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=sYp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Joc(r,t,this.abortController,this._options)}};var Yoc=e=>{let t=(r,i)=>cCa.create(r,sCa(e,i));for(let r of ULo)t[r]=(i,n)=>cCa.create(i,sCa(e,n,{method:r}));return t.create=r=>Yoc(sCa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),Yoc(sCa(e,r))),t.stop=WLo,t},$UD=Yoc(),cYp=$UD;var CYp=ni(TYp(),1);function tuc(e){let t=(0,CYp.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var DXp=ni(SXp(),1),EXp=ni(Cwi(),1),_uc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},huc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function yuc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??tuc(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,DXp.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 cYp(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new _uc(e):c}if(t.allVersions)return s;let o=new huc(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=EXp.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 hCa(e,t){let{version:r}=await yuc(e.toLowerCase(),t);return r}async function bEi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:hCa(e.packageName,{version:t?"prerelease":"latest"})}var MXp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],rUo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=T0.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new FLo(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.64.30"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Ds.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new l9}failWithoutThrowing(t,r){this.didSucceed=!1,zLo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await dFn()).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 QKp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1956
1956
  `)||(r+=`
1957
1957
  `),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=HBs(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 eCa(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 l9}finally{i.finish()}return n}async instrumentPostHogEvent(t){this.isLocal||(await dFn()).sendEvent(t)}logger=hXt((t,...r)=>this.log(t,...r));stderr=hXt((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=AXp(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?AXp(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=MXp[this.numTasks++%MXp.length],u=Ds.hex(a)(n);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===MB.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=>Vji.indexOf(n.level)>=Vji.indexOf(this.logLevel));this.ttyAwareLogger.log(i,{includeDebugInfo:this.logLevel===T0.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 bEi({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 LLo({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await Eoc({message:t,default:r})}async getInput(t){return await Moc({message:t.message,default:t.default})}};function AXp(e){return`[${e}]:`}var Pg_=require("fs/promises");function rFe({breadcrumbs:e=[],title:t,subtitle:r}){let i=[];return e.length>0&&i.push(Ds.blue(e.join(" -> "))),i.push(t),r!=null&&i.push(Ds.dim(r)),i.join(`
1958
1958
  `)}var n__=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 cMe=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 yCa=class{context;constructor(t){this.context=t}};var iUo=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[u,l]of Object.entries(i.files)){let d=n!=null?gy.of(`${n}${tVt}${u}`):gy.of(u);t[d]=l}let a=Object.keys(i.directories).sort();for(let u of a){let l=n!=null?`${n}${tVt}${u}`:u,d=i.directories[u];r(d,l)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(tVt))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[gy.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 kGi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new iUo,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 bkt(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"]))qXp(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(qXp(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)}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??C_((yxe(r)+"/"+WUi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===gy.of(VF))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=zgo(yxe(PBn.of(`/${t}`)),PBn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=zgo(yxe(PBn.of(`/${t}`)),PBn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){if(t===gy.of(VF))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=>v2(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=EN(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:EN(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:EN(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===TS?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 qXp(e){return e?.header!=null}var Tae={openapi:e=>({...e,type:"openapi",_visit:function(t){return Tae._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return Tae._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 s4n={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return s4n._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var Q9={basic:e=>({...e,type:"basic",_visit:function(t){return Q9._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return Q9._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return Q9._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return Q9._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return Q9._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 mO={primitive:e=>({value:e,type:"primitive",_visit:function(t){return mO._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return mO._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return mO._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return mO._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return mO._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return mO._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return mO._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return mO._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 D_={int:e=>({value:e,type:"int",_visit:function(t){return D_._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return D_._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return D_._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return D_._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return D_._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return D_._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return D_._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return D_._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return D_._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return D_._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return D_._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 c4n={boolean:e=>({value:e,type:"boolean",_visit:function(t){return c4n._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return c4n._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 gEi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return gEi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return gEi._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 RW={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case RW.GenerallyAvailable:return t.generallyAvailable();case RW.Beta:return t.beta();case RW.Deprecated:return t.deprecated();default:return t._other()}}};var iFe={cursor:e=>({...e,type:"cursor",_visit:function(t){return iFe._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return iFe._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return iFe._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 kfi={language:e=>({...e,type:"language",_visit:function(t){return kfi._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return kfi._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 NW={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 NW.Curl:return t.curl();case NW.Python:return t.python();case NW.Javascript:return t.javascript();case NW.Typescript:return t.typescript();case NW.Go:return t.go();case NW.Ruby:return t.ruby();case NW.Csharp:return t.csharp();case NW.Java:return t.java();case NW.Js:return t.js();case NW.Node:return t.node();case NW.Ts:return t.ts();case NW.Nodets:return t.nodets();case NW.Golang:return t.golang();case NW.Dotnet:return t.dotnet();case NW.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 FW={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case FW.Get:return t.get();case FW.Post:return t.post();case FW.Put:return t.put();case FW.Patch:return t.patch();case FW.Delete:return t.delete();case FW.Head:return t.head();case FW.Options:return t.options();case FW.Trace:return t.trace();default:return t._other()}}};var OEi={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return OEi._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return OEi._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return OEi._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 edi={file:e=>({...e,type:"file",_visit:function(t){return edi._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return edi._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 GQ={file:e=>({...e,type:"file",_visit:function(t){return GQ._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return GQ._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return GQ._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return GQ._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return GQ._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return GQ._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return GQ._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 Hy={primitive:e=>({...e,type:"primitive",_visit:function(t){return Hy._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Hy._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Hy._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Hy._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Hy._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Hy._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Hy._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Hy._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Hy._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Hy._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Hy._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 fz={boolean:e=>({value:e,type:"boolean",_visit:function(t){return fz._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return fz._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 tdi={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return tdi._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return tdi._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 lMe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return lMe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return lMe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return lMe._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 bC={file:e=>({...e,type:"file",_visit:function(t){return bC._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return bC._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return bC._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return bC._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return bC._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return bC._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return bC._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 ql={primitive:e=>({...e,type:"primitive",_visit:function(t){return ql._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return ql._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return ql._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return ql._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return ql._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return ql._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return ql._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return ql._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return ql._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return ql._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return ql._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 RZ={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return RZ._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return RZ._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 ep={int:e=>({...e,type:"int",_visit:function(t){return ep._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return ep._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return ep._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return ep._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return ep._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return ep._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return ep._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return ep._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return ep._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return ep._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return ep._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={};Dn(Cv,{AllOfPropertyConflict:()=>C4n,ArraySchema:()=>gVo,ArraySchemaWithExample:()=>QVo,Availability:()=>pUo,Base64WithExample:()=>VVo,BasicSecurityScheme:()=>yUo,BearerSecurityScheme:()=>vUo,BooleanSchema:()=>pVo,BooleanWithExample:()=>WVo,BytesResponse:()=>j4n,CasingOverrides:()=>OUo,CommonProperty:()=>EVo,CommonPropertyWithExample:()=>rWo,CursorPagination:()=>YUo,CustomCodeSample:()=>JUo,CustomCodeSampleLanguage:()=>$Uo,CustomCodeSampleSdk:()=>QUo,CustomPagination:()=>ZUo,DateWithExample:()=>UVo,DatetimeWithExample:()=>LVo,DiscriminatedOneOfSchema:()=>SVo,DiscriminatedOneOfSchemaWithExample:()=>eWo,DoubleSchema:()=>fVo,DoubleWithExample:()=>NVo,Encoding:()=>dUo,Endpoint:()=>kUo,EndpointExample:()=>E4n,EndpointResponseExample:()=>HUo,EndpointSdkName:()=>zrr,EndpointWithExample:()=>oZp,EnumSchema:()=>p4n,EnumSchemaWithExample:()=>$Vo,EnumValue:()=>jEi,ErrorExample:()=>FUo,FernExample:()=>UUo,FileResponse:()=>m4n,FileSchema:()=>CUo,FloatWithExample:()=>RVo,FullEndpointExample:()=>KUo,FullExample:()=>Vq,FullObjectExample:()=>EUo,FullOneOfExample:()=>AUo,GlobalHeader:()=>hVo,Header:()=>SEi,HeaderExample:()=>D4n,HeaderSecurityScheme:()=>bUo,HeaderWithExample:()=>MEi,HttpEndpointServer:()=>w4n,HttpError:()=>LUo,HttpErrorWithExample:()=>CVo,HttpMethod:()=>y4n,IdempotencyHeader:()=>yVo,Int64WithExample:()=>IVo,IntSchema:()=>cVo,IntWithExample:()=>BVo,JsonRequest:()=>xUo,JsonRequestWithExample:()=>AVo,JsonResponse:()=>P4n,JsonResponseWithExample:()=>z4n,KeyValuePair:()=>MUo,LiteralExample:()=>DUo,LiteralSchema:()=>T4n,LiteralSchemaValue:()=>vVo,LongSchema:()=>lVo,MapSchema:()=>OVo,MapSchemaWithExample:()=>JVo,MultipartRequest:()=>O4n,MultipartRequestProperty:()=>zUo,MultipartRequestPropertyEncoding:()=>IUo,MultipartSchema:()=>BUo,NamedFullExample:()=>Rrr,Namespace:()=>mUo,NamespaceId:()=>SUo,NullableSchema:()=>PVo,NullableSchemaWithExample:()=>YVo,OauthSecurityScheme:()=>jUo,ObjectProperty:()=>wVo,ObjectPropertyConflictInfo:()=>B4n,ObjectPropertyWithExample:()=>kVo,ObjectSchema:()=>bVo,ObjectSchemaWithExample:()=>XVo,OctetStreamRequest:()=>g4n,OffsetPagination:()=>XUo,OneOfSchema:()=>jVo,OneOfSchemaWithExample:()=>ZVo,OpenApiIntermediateRepresentation:()=>nZp,OpenApiSource:()=>sUo,OptionalSchema:()=>mVo,OptionalSchemaWithExample:()=>KVo,Pagination:()=>M4n,PathParameter:()=>v4n,PathParameterExample:()=>VUo,PathParameterWithExample:()=>MVo,PrimitiveExample:()=>h4n,PrimitiveSchema:()=>EEi,PrimitiveSchemaValue:()=>_Vo,PrimitiveSchemaValueWithExample:()=>HVo,PrimitiveSchemaWithExample:()=>x4n,PropertyKey:()=>_4n,ProtobufEncoding:()=>fUo,ProtobufSource:()=>cUo,QueryParameter:()=>b4n,QueryParameterExample:()=>S4n,QueryParameterWithExample:()=>I4n,QuerySecurityScheme:()=>gUo,ReferencedSchema:()=>xrr,Request:()=>RUo,RequestWithExample:()=>qVo,Response:()=>NUo,ResponseWithExample:()=>TVo,Schema:()=>wm,SchemaId:()=>NZ,SchemaWithExample:()=>lA,Schemas:()=>sVo,SdkGroup:()=>PUo,SdkGroupInfo:()=>qUo,SdkGroupName:()=>wEi,SecurityScheme:()=>wUo,SecuritySchemeId:()=>hUo,Server:()=>OCa,Source:()=>lUo,StatusCode:()=>Irr,StreamingResponseExample:()=>WUo,StringSchema:()=>dVo,StringSchemaWithExample:()=>FVo,SupportedSdkLanguage:()=>GUo,Tag:()=>_Uo,TagId:()=>FZ,Tags:()=>TUo,TextResponse:()=>DEi,Uint64WithExample:()=>xVo,UintWithExample:()=>zVo,UnDiscriminatedOneOfSchema:()=>DVo,UnDiscriminatedOneOfSchemaWithExample:()=>tWo,UnknownSchemaWithExample:()=>GVo,Webhook:()=>eVo,WebhookExampleCall:()=>q4n,WebhookHttpMethod:()=>A4n,WebhookWithExample:()=>uZp,WebsocketChannel:()=>uVo,WebsocketHandshake:()=>tVo,WebsocketHandshakeWithExample:()=>aZp,WebsocketMessageExample:()=>aVo,WebsocketMessageOrigin:()=>rVo,WebsocketMessageSchema:()=>iVo,WebsocketServer:()=>nVo,WebsocketSessionExample:()=>oVo,WithAvailability:()=>Th,WithDescription:()=>gf,WithEncoding:()=>Cae,WithInline:()=>WE,WithName:()=>z0,WithNamespace:()=>i0,WithSdkGroupName:()=>sm,WithSource:()=>Xh,WithStatusCode:()=>nFe,WithTitle:()=>um,commons:()=>muc,example:()=>Puc,finalIr:()=>juc,parseIr:()=>wuc});var muc={};Dn(muc,{BasicSecurityScheme:()=>yUo,BearerSecurityScheme:()=>vUo,Encoding:()=>dUo,HeaderSecurityScheme:()=>bUo,Namespace:()=>mUo,NamespaceId:()=>SUo,OauthSecurityScheme:()=>jUo,OpenApiSource:()=>sUo,ProtobufEncoding:()=>fUo,ProtobufSource:()=>cUo,QuerySecurityScheme:()=>gUo,SchemaId:()=>NZ,SdkGroup:()=>PUo,SdkGroupName:()=>wEi,SecurityScheme:()=>wUo,SecuritySchemeId:()=>hUo,Server:()=>OCa,Source:()=>lUo,StatusCode:()=>Irr,Tag:()=>_Uo,TagId:()=>FZ,WithAvailability:()=>Th,WithDescription:()=>gf,WithEncoding:()=>Cae,WithInline:()=>WE,WithName:()=>z0,WithNamespace:()=>i0,WithSdkGroupName:()=>sm,WithSource:()=>Xh,WithStatusCode:()=>nFe,WithTitle:()=>um});var Mt={};Dn(Mt,{JsonError:()=>l4n,ParseError:()=>f4n,any:()=>$Xp,bigint:()=>CXp,boolean:()=>GXp,booleanLiteral:()=>HXp,date:()=>BXp,discriminant:()=>tZp,enum_:()=>aUo,getObjectLikeUtils:()=>QWt,getObjectUtils:()=>eQi,getSchemaUtils:()=>Uq,isProperty:()=>PEi,lazy:()=>IXp,lazyObject:()=>UXp,list:()=>uUo,number:()=>QXp,object:()=>oUo,objectWithoutOptionalProperties:()=>LXp,optional:()=>vuc,property:()=>xXp,record:()=>XXp,set:()=>ZXp,string:()=>JXp,stringLiteral:()=>WXp,transform:()=>buc,undiscriminatedUnion:()=>eZp,union:()=>iZp,unknown:()=>KXp,withParsedProperties:()=>Ouc});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 cA(e,t){return`Expected ${t}. Received ${XVD(e)}.`}function XVD(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 J9(e){return{...e,json:TXp(e.json),parse:TXp(e.parse)}}function TXp(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.64.28",
3
+ "version": "0.64.30",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",