fern-api 0.64.32-rc1 → 0.64.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +2 -2
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -1712,7 +1712,7 @@ ${vBp.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&_Ks(th
|
|
|
1712
1712
|
`+HHi.default.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?HHi.default.cyan(DBp(t,this.opt.mask)):HHi.default.italic(HHi.default.dim("[hidden]")):this.opt.mask?DBp(t,this.opt.mask):HHi.default.italic(HHi.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 $3o=ni(L2(),1),XIp=ni(oYs(),1),ZIp=ni(QEe(),1);var IEa=class extends U2{_run(t){this.done=t,this.editorResult=new ZIp.Subject;let r=MW(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"?$3o.default.dim("Received"):$3o.default.dim("Press <enter> to launch your preferred editor."),t&&(r=$3o.default.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),(0,XIp.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 izp=require("stream");var tzp=ni(require("readline"),1),rzp=ni(ezp(),1),ZHi=class{constructor(t){this.rl||=tzp.default.createInterface(YbD(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 YbD(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 rzp.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var zEa=class extends ZHi{constructor(t={}){super(t),this.log=new izp.Writable({write:(r,i,n)=>{this.writeLog(r),n()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return yEa(this.rl,this.bottomBar.split(`
|
|
1713
1713
|
`).length),this}updateBottomBar(t){return yEa(this.rl,1),this.rl.output.unmute(),this.clean(),this.bottomBar=t,this.render(),this.rl.output.mute(),this}writeLog(t){return this.rl.output.unmute(),this.clean(),this.rl.output.write(this.enforceLF(t.toString())),this.render(),this.rl.output.mute(),this}enforceLF(t){return/[\n\r]$/.test(t)?t:t+`
|
|
1714
1714
|
`}write(t){let r=t.split(/\n/);this.height=r.length,this.rl.setPrompt(r.at(-1)),this.rl.output.rows===0&&this.rl.output.columns===0&&g3o(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var VE=ni(QEe(),1),ozp=ni(NDa(),1);var G3o=ni(QEe(),1),nzp=ni(NDa(),1),Q3o=function(e,t,r){return typeof e[t]!="function"?(0,G3o.of)(e):(0,G3o.from)((0,nzp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var azp={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}},mFn=class extends ZHi{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,VE.from)(t):(0,VE.isObservable)(t)?i=t:Object.values(t).every(n=>typeof n=="object"&&!Array.isArray(n)&&n!=null)?i=(0,VE.from)(Object.entries(t).map(([n,a])=>({name:n,...a}))):i=(0,VE.from)([t]),this.process=i.pipe((0,VE.concatMap)(this.processQuestion.bind(this)),(0,VE.publish)()),this.process.connect(),this.process.pipe((0,VE.reduce)((n,a)=>(azp.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,VE.defer)(()=>(0,VE.of)(t).pipe((0,VE.concatMap)(this.setDefaultType.bind(this)),(0,VE.concatMap)(this.filterIfRunnable.bind(this)),(0,VE.concatMap)(()=>Q3o(t,"message",this.answers)),(0,VE.concatMap)(()=>Q3o(t,"default",this.answers)),(0,VE.concatMap)(()=>Q3o(t,"choices",this.answers)),(0,VE.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,VE.defer)(()=>(0,VE.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,VE.defer)(()=>(0,VE.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&azp.get(this.answers,t.name)!==void 0)return VE.EMPTY;if(t.when===!1)return VE.EMPTY;if(typeof t.when!="function")return(0,VE.of)(t);let{answers:r}=this;return(0,VE.defer)(()=>(0,VE.from)((0,ozp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,VE.filter)(i=>i!=null)))}};function uzp(e){let t=function(r,i){let n;try{n=new mFn(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",bEa),this.registerPrompt("input",WHi),this.registerPrompt("number",gEa),this.registerPrompt("confirm",OEa),this.registerPrompt("rawlist",mEa),this.registerPrompt("expand",PEa),this.registerPrompt("checkbox",jEa),this.registerPrompt("password",wEa),this.registerPrompt("editor",IEa)},t.restoreDefaultPrompts(),t}var sYs=uzp();function ZbD(e,t){sYs.registerPrompt(e,t)}function kbD(){sYs.restoreDefaultPrompts()}var e0D={prompt:sYs,ui:{BottomBar:zEa,Prompt:mFn},createPromptModule:uzp,registerPrompt:ZbD,restoreDefaultPrompts:kbD,Separator:pae},J3o=e0D;var BFn=require("path"),Uxp=require("fs"),Vxp=require("readline"),dxp="posthog-node";function zOD(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[y7o.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 y7o=class{constructor(t,r,i,n){this.name=dxp,this.name=dxp,this.setupOnce=function(a,u){let l=u()?.getClient()?.getDsn()?.projectId;a(zOD(t,{organization:r,projectId:l,prefix:i,severityAllowList:n}))}}};y7o.POSTHOG_ID_TAG="posthog_distinct_id";var f7o="0123456789abcdef",v7o=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+=f7o.charAt(this.bytes[r]>>>4),t+=f7o.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+=f7o.charAt(this.bytes[r]>>>4),t+=f7o.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}},XYs=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??xOD()}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 v7o.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,v7o.ofInner(t)}},xOD=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),pxp,ZYs=()=>ROD().toString(),ROD=()=>(pxp||(pxp=new XYs)).generate();function NOD(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 FOD(e,t){global.process.on("uncaughtException",NOD(e,t))}function LOD(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var d7o,_xp,p7o;function UOD(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return p7o&&r.length===_xp||(_xp=r.length,p7o=r.reduce((i,n)=>{d7o||(d7o={});let a=d7o[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,d7o[n]=[s,o];break}}}return i},{})),p7o}function VOD(e){return typeof Event<"u"&&Wxp(e,Event)}function WOD(e){return Hxp(e,"Object")}function oXs(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Wxp(e,Error)}}function Wxp(e,t){try{return e instanceof t}catch{return!1}}function HOD(e){return Hxp(e,"ErrorEvent")}function Hxp(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function $OD(e,t,r,i){let a=i&&i.mechanism||{handled:!0,type:"generic"},u=$xp(a,r,i);return{$exception_list:await Promise.all(u.map(async s=>{let o=await ZOD(e,t,s);return o.value=o.value||"",o.type=o.type||"Error",o.mechanism=a,o}))}}function $xp(e,t,r){let i=GOD(e,t,r);return i.cause?[i,...$xp(e,i.cause,r)]:[i]}function GOD(e,t,r){if(oXs(t))return t;if(e.synthetic=!0,WOD(t)){let n=QOD(t);if(n)return n;let a=JOD(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 QOD(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(oXs(r))return r}}function JOD(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=YOD(e);if(HOD(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=KOD(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function KOD(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function YOD(e,t=40){let r=Object.keys(XOD(e));r.sort();let i=r[0];if(!i)return"[object has no keys]";if(i.length>=t)return hxp(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:hxp(a,t)}return""}function hxp(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function XOD(e){return oXs(e)?{message:e.message,name:e.name,stack:e.stack,...yxp(e)}:VOD(e)?{type:e.type,target:vxp(e.target),currentTarget:vxp(e.currentTarget),...yxp(e)}:e}function yxp(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 vxp(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function ZOD(e,t,r){let i={type:r.name||r.constructor.name,value:r.message},n=kOD(e,r);for(let a of t)n=await a(n);return n.length&&(i.stacktrace={frames:n,type:"raw"}),i}function kOD(e,t){return emD(e(t.stack||"",1),e)}function emD(e,t){let r=UOD(t);return e.forEach(i=>{i.filename&&(i.chunk_id=r[i.filename])}),e}var tmD=2e3,qFn=class e{static async captureException(t,r,i,n,a){let u={...a};n||(u.$process_person_profile=!1);let l=await $OD(this.stackParser,this.frameModifiers,r,i);t.capture({event:"$exception",distinctId:n||ZYs(),properties:{...l,...u}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(FOD(this.onException.bind(this),this.onFatalError.bind(this)),LOD(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(tmD)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function rmD(e=process.argv[1]?(0,BFn.dirname)(process.argv[1]):process.cwd(),t=BFn.sep==="\\"){let r=t?bxp(e):e;return i=>{if(!i)return;let n=t?bxp(i):i,{dir:a,base:u,ext:l}=BFn.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 bxp(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var b7o=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)}}},h7o=new b7o(25),Gxp=new b7o(20),uXs=7,imD=1e3,nmD=1e4;async function amD(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"||cmD(u)||lmD(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(Gxp.get(n))continue;let a=t[n];if(!a)continue;a.sort((d,s)=>d-s);let u=dmD(a);if(u.every(d=>fmD(n,d)))continue;let l=pmD(h7o,n,{});i.push(omD(n,u,l))}return await Promise.all(i).catch(()=>{}),e&&e.length>0&&umD(e,h7o),h7o.reduce(),e}function omD(e,t,r){return new Promise(i=>{let n=(0,Uxp.createReadStream)(e),a=(0,Vxp.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(){Gxp.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]=_mD(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 umD(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;smD(r.lineno,r,i)}}function smD(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let n=Qxp(e);n<e;n++){let a=r[n];if(a===void 0){gxp(t);return}t.pre_context.push(a)}if(r[e]===void 0){gxp(t);return}t.context_line=r[e];let i=Jxp(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 gxp(e){delete e.pre_context,delete e.context_line,delete e.post_context}function cmD(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function lmD(e){return e.lineno!==void 0&&e.lineno>nmD||e.colno!==void 0&&e.colno>imD}function fmD(e,t){let r=h7o.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 dmD(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let i=Oxp(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+uXs:(n.push(i),i=Oxp(a)),t++}return n}function Oxp(e){return[Qxp(e),Jxp(e)]}function Qxp(e){return Math.max(1,e-uXs)}function Jxp(e){return e+uXs}function pmD(e,t,r){let i=e.get(t);return i===void 0?(e.set(t,r),r):i}function _mD(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 hmD="4.18.0",gae;(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"})(gae||(gae={}));var mxp;(function(e){e.Left="left",e.Right="right",e.Center="center"})(mxp||(mxp={}));var Pxp;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(Pxp||(Pxp={}));var jxp;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(jxp||(jxp={}));var wxp;(function(e){e.Html="html",e.Text="text"})(wxp||(wxp={}));var Sxp;(function(e){e.Number="number",e.Emoji="emoji"})(Sxp||(Sxp={}));var Dxp;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(Dxp||(Dxp={}));var Exp;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(Exp||(Exp={}));var Mxp;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(Mxp||(Mxp={}));var Axp;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(Axp||(Axp={}));var ymD=e=>{if("flags"in e){let t=bmD(e.flags),r=gmD(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([n,a])=>[n,Kxp(a)])),i=Object.fromEntries(Object.entries(t).map(([n,a])=>[n,vmD(n,a,r[n])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}};function vmD(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 bmD=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,sXs(r)]).filter(([,t])=>t!==void 0)),gmD=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?Kxp(i):void 0]}))},sXs=e=>e===void 0?void 0:e.variant??e.enabled,Kxp=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},OmD=1,mmD=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"]),PmD="utf8";function jmD(e,t){if(!e||typeof e!="string"||wmD(e))throw new Error(t)}function wmD(e){return e.trim().length===0}function SmD(e){return e?.replace(/\/+$/,"")}async function DmD(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 qxp(){return new Date().getTime()}function KYs(){return new Date().toISOString()}function g7o(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function EmD(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function MmD(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 AmD(e,t=0,r){let i=MmD(e);return r?.has(i)?!1:parseInt(i,16)/4294967295<t}function Txp(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var $Ea=String.fromCharCode,Cxp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_7o={};function qmD(e,t){if(!_7o[e]){_7o[e]={};for(let r=0;r<e.length;r++)_7o[e][e.charAt(r)]=r}return _7o[e][t]}var MFn={compressToBase64:function(e){if(e==null)return"";let t=MFn._compress(e,6,function(r){return Cxp.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:MFn._decompress(e.length,32,function(t){return qmD(Cxp,e.charAt(t))})},compress:function(e){return MFn._compress(e,16,function(t){return $Ea(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:MFn._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=$Ea(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=$Ea(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++]=$Ea(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++]=$Ea(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++)}}},kYs=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)}},TFn=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()}},GEa=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function Bxp(e){if(e instanceof TFn){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 YYs(e){return typeof e=="object"&&(e instanceof TFn||e instanceof GEa)}function Ixp(e){return typeof e=="object"&&e instanceof TFn&&e.status===413}var eXs;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(eXs||(eXs={}));var tXs=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new kYs,this._isInitialized=!1,jmD(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=SmD(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:YYs},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(gae.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(gae.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(gae.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=ZYs();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=AmD(this.apiKey,OmD,mmD)?`${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=>ymD(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=sXs(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(eXs.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(gae.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(gae.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(gae.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(gae.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(gae.Queue,a),this._events.emit(t,n),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=g7o(()=>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:KYs()};this.historicalMigration&&(n.historical_migration=!0);let a=JSON.stringify(n),u=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${qxp()}&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(MFn.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:KYs(),uuid:i?.uuid?i.uuid:ZYs()};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 Bxp(t)})}async flush(){let t=Txp([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),Txp([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(gae.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(gae.Queue)||[]).slice(n.length);this.setPersistedProperty(gae.Queue,g),t=g},l={api_key:this.apiKey,batch:a,sent_at:KYs()};this.historicalMigration&&(l.historical_migration=!0);let d=JSON.stringify(l),s=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${qxp()}&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(MFn.compressToBase64(d))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:d},c={retryCheck:b=>Ixp(b)?!1:YYs(b)};try{await this.fetchWithRetry(s,o,c)}catch(b){if(Ixp(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 GEa||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,PmD)}catch{l=new TextEncoder().encode(u).length}return await DmD(async()=>{let d=null;try{d=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(o){throw new GEa(o)}if(!(r.mode==="no-cors")&&(d.status<200||d.status>=400))throw new TFn(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(gae.Queue)||[]).length===0||(await this.flush(),r)););}catch(n){if(!YYs(n))throw n;await Bxp(n)}};return Promise.race([new Promise((n,a)=>{g7o(()=>{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}},rXs=EmD();if(!rXs){let e=fxp();rXs=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 Yxp=rXs,O7o=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()}},Xxp=new O7o(async()=>{try{return await import("crypto")}catch{return}});async function TmD(){return await Xxp.getValue()}var CmD=new O7o(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await Xxp.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function BmD(){return await CmD.getValue()}async function ImD(e){let t=await TmD();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await BmD();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 zmD=60*1e3,xmD=1152921504606847e3,RmD=["is_not"],AFn=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},V2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},iXs=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||Yxp,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 V2?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 V2||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 V2("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 V2("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 V2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new V2("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=kxp(l,n,this.cohorts,this.debugMode):s=Zxp(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&await zxp(t.key,r)>a/100)}async getMatchingVariant(t,r){let i=await zxp(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(zmD,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 AFn(`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 AFn(`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 AFn(`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 AFn&&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=g7o(()=>{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=g7o(()=>{a.abort()},this.timeout),i.signal=a.signal}try{return this.fetch(r,i)}finally{clearTimeout(n)}}};async function zxp(e,t,r=""){let i=await ImD(`${e}.${t}${r}`);return parseInt(i.slice(0,15),16)/xmD}function Zxp(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 V2("Operator is_not_set is not supported")}else throw new V2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!RmD.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 xxp(String(n))&&String(u).match(String(n))!==null;case"not_regex":return xxp(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=NmD(String(n));if(s==null&&(s=Rxp(n)),s==null)throw new V2(`Invalid date: ${n}`);let o=Rxp(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new V2(`Unknown operator: ${a}`)}}function kxp(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new V2("can't match cohort without a given cohort property value");let a=r[n];return eRp(a,t,r,i)}function eRp(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=eRp(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof V2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new V2("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=kxp(l,t,r,i):d=Zxp(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 V2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new V2("can't match cohort without a given cohort property value");return n==="AND"}}function xxp(e){try{return new RegExp(e),!0}catch{return!1}}function Rxp(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 V2(`${e} is in an invalid date format`)}else throw new V2(`The date provided ${e} must be a string, number, or date object`)}function NmD(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 nXs=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},FmD=100,Nxp=30*1e3,LmD=50*1e3,aXs=class extends tXs{constructor(t,r={}){if(super(t,r),this._memoryStorage=new nXs,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,FmD):Nxp,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 iXs({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 qFn(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||LmD}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):Yxp(t,r)}getLibraryVersion(){return hmD}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=Nxp){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=sXs(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");qFn.captureException(this,t,{syntheticException:n},r,i)}},Fxp=/\(error: (.*)\)/,tRp=50,rRp="?";function UmD(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||rRp,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:Lxp(n[3]),colno:Lxp(n[4]),in_app:VmD(o||"",c),platform:"node:javascript"}}if(i.match(t))return{filename:i,platform:"node:javascript"}}}function VmD(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 Lxp(e){return parseInt(e||"",10)||void 0}function WmD(e){return[90,UmD(e)]}function HmD(e){let r=[WmD(e)].sort((i,n)=>i[0]-n[0]).map(i=>i[1]);return(i,n=0)=>{let a=[],u=i.split(`
|
|
1715
|
-
`);for(let l=n;l<u.length;l++){let d=u[l];if(d.length>1024)continue;let s=Fxp.test(d)?d.replace(Fxp,"$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>=tRp)break}}return $mD(a)}}function $mD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,tRp).map(r=>({...r,filename:r.filename||GmD(t).filename,function:r.function||rRp}))}function GmD(e){return e[e.length-1]||{}}qFn.stackParser=HmD(rmD());qFn.frameModifiers=[amD];var CFn=class extends aXs{getLibraryId(){return"posthog-node"}};var m7o=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.32-rc1",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var QEa=class{async sendEvent(){}async identify(){}async flush(){}};var IFn=require("fs/promises"),oRp=require("os"),uRp=require("path");var iRp=ni(require("crypto")),j7o=new Uint8Array(256),P7o=j7o.length;function cXs(){return P7o>j7o.length-16&&(iRp.default.randomFillSync(j7o),P7o=0),j7o.slice(P7o,P7o+=16)}var TW=[];for(let e=0;e<256;++e)TW.push((e+256).toString(16).slice(1));function nRp(e,t=0){return TW[e[t+0]]+TW[e[t+1]]+TW[e[t+2]]+TW[e[t+3]]+"-"+TW[e[t+4]]+TW[e[t+5]]+"-"+TW[e[t+6]]+TW[e[t+7]]+"-"+TW[e[t+8]]+TW[e[t+9]]+"-"+TW[e[t+10]]+TW[e[t+11]]+TW[e[t+12]]+TW[e[t+13]]+TW[e[t+14]]+TW[e[t+15]]}var aRp=ni(require("crypto")),lXs={randomUUID:aRp.default.randomUUID};function QmD(e,t,r){if(lXs.randomUUID&&!t&&!e)return lXs.randomUUID();e=e||{};let i=e.random||(e.rng||cXs)();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 nRp(i)}var Oae=QmD;var JmD="id",KmD=".fern",JEa=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new CFn(r),this.userId=t==null?void 0:eHs(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.32-rc1",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ru(fl.of((0,oRp.homedir)()),Fa.of(KmD),Fa.of(JmD));await Pf(t)||(await(0,IFn.mkdir)((0,uRp.dirname)(t),{recursive:!0}),await(0,IFn.writeFile)(t,Oae())),this.persistedDistinctId=(await(0,IFn.readFile)(t)).toString()}return this.persistedDistinctId}};var fXs;async function zFn(){return fXs==null&&(fXs=await YmD()),fXs}async function YmD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new QEa;let r=await VIo();return r!=null?new JEa({token:r,posthogApiKey:e}):await IRn()!=null?new m7o({posthogApiKey:e}):new JEa({token:void 0,posthogApiKey:e})}catch{return new QEa}}function KEa(e,t){return function(){return e.apply(t,arguments)}}var{toString:XmD}=Object.prototype,{getPrototypeOf:pXs}=Object,{iterator:S7o,toStringTag:cRp}=Symbol,D7o=(e=>t=>{let r=XmD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),vWt=e=>(e=e.toLowerCase(),t=>D7o(t)===e),E7o=e=>t=>typeof t===e,{isArray:xFn}=Array,YEa=E7o("undefined");function ZmD(e){return e!==null&&!YEa(e)&&e.constructor!==null&&!YEa(e.constructor)&&mae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var lRp=vWt("ArrayBuffer");function kmD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&lRp(e.buffer),t}var ePD=E7o("string"),mae=E7o("function"),fRp=E7o("number"),M7o=e=>e!==null&&typeof e=="object",tPD=e=>e===!0||e===!1,w7o=e=>{if(D7o(e)!=="object")return!1;let t=pXs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(cRp in e)&&!(S7o in e)},rPD=vWt("Date"),iPD=vWt("File"),nPD=vWt("Blob"),aPD=vWt("FileList"),oPD=e=>M7o(e)&&mae(e.pipe),uPD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||mae(e.append)&&((t=D7o(e))==="formdata"||t==="object"&&mae(e.toString)&&e.toString()==="[object FormData]"))},sPD=vWt("URLSearchParams"),[cPD,lPD,fPD,dPD]=["ReadableStream","Request","Response","Headers"].map(vWt),pPD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function XEa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),xFn(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 dRp(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 n$i=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,pRp=e=>!YEa(e)&&e!==n$i;function dXs(){let{caseless:e}=pRp(this)&&this||{},t={},r=(i,n)=>{let a=e&&dRp(t,n)||n;w7o(t[a])&&w7o(i)?t[a]=dXs(t[a],i):w7o(i)?t[a]=dXs({},i):xFn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&XEa(arguments[i],r);return t}var _PD=(e,t,r,{allOwnKeys:i}={})=>(XEa(t,(n,a)=>{r&&mae(n)?e[a]=KEa(n,r):e[a]=n},{allOwnKeys:i}),e),hPD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),yPD=(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)},vPD=(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&&pXs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},bPD=(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},gPD=e=>{if(!e)return null;if(xFn(e))return e;let t=e.length;if(!fRp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},OPD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&pXs(Uint8Array)),mPD=(e,t)=>{let i=(e&&e[S7o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},PPD=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},jPD=vWt("HTMLFormElement"),wPD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),sRp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),SPD=vWt("RegExp"),_Rp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};XEa(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},DPD=e=>{_Rp(e,(t,r)=>{if(mae(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(mae(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+"'")})}})},EPD=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return xFn(e)?i(e):i(String(e).split(t)),r},MPD=()=>{},APD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function qPD(e){return!!(e&&mae(e.append)&&e[cRp]==="FormData"&&e[S7o])}var TPD=e=>{let t=new Array(10),r=(i,n)=>{if(M7o(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=xFn(i)?[]:{};return XEa(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)},CPD=vWt("AsyncFunction"),BPD=e=>e&&(M7o(e)||mae(e))&&mae(e.then)&&mae(e.catch),hRp=((e,t)=>e?setImmediate:t?((r,i)=>(n$i.addEventListener("message",({source:n,data:a})=>{n===n$i&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),n$i.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",mae(n$i.postMessage)),IPD=typeof queueMicrotask<"u"?queueMicrotask.bind(n$i):typeof process<"u"&&process.nextTick||hRp,zPD=e=>e!=null&&mae(e[S7o]),us={isArray:xFn,isArrayBuffer:lRp,isBuffer:ZmD,isFormData:uPD,isArrayBufferView:kmD,isString:ePD,isNumber:fRp,isBoolean:tPD,isObject:M7o,isPlainObject:w7o,isReadableStream:cPD,isRequest:lPD,isResponse:fPD,isHeaders:dPD,isUndefined:YEa,isDate:rPD,isFile:iPD,isBlob:nPD,isRegExp:SPD,isFunction:mae,isStream:oPD,isURLSearchParams:sPD,isTypedArray:OPD,isFileList:aPD,forEach:XEa,merge:dXs,extend:_PD,trim:pPD,stripBOM:hPD,inherits:yPD,toFlatObject:vPD,kindOf:D7o,kindOfTest:vWt,endsWith:bPD,toArray:gPD,forEachEntry:mPD,matchAll:PPD,isHTMLForm:jPD,hasOwnProperty:sRp,hasOwnProp:sRp,reduceDescriptors:_Rp,freezeMethods:DPD,toObjectSet:EPD,toCamelCase:wPD,noop:MPD,toFiniteNumber:APD,findKey:dRp,global:n$i,isContextDefined:pRp,isSpecCompliantForm:qPD,toJSONObject:TPD,isAsyncFn:CPD,isThenable:BPD,setImmediate:hRp,asap:IPD,isIterable:zPD};function RFn(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(RFn,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 yRp=RFn.prototype,vRp={};["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=>{vRp[e]={value:e}});Object.defineProperties(RFn,vRp);Object.defineProperty(yRp,"isAxiosError",{value:!0});RFn.from=(e,t,r,i,n,a)=>{let u=Object.create(yRp);return us.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),RFn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var Lp=RFn;var bRp=ni(K3o(),1),A7o=bRp.default;function _Xs(e){return us.isPlainObject(e)||us.isArray(e)}function ORp(e){return us.endsWith(e,"[]")?e.slice(0,-2):e}function gRp(e,t,r){return e?e.concat(t).map(function(n,a){return n=ORp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function xPD(e){return us.isArray(e)&&!e.some(_Xs)}var RPD=us.toFlatObject(us,{},null,function(t){return/^is[A-Z]/.test(t)});function NPD(e,t,r){if(!us.isObject(e))throw new TypeError("target must be an object");t=t||new(A7o||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 Lp("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)&&xPD(O)||(us.isFileList(O)||us.endsWith(m,"[]"))&&(E=us.toArray(O)))return m=ORp(m),E.forEach(function(A,D){!(us.isUndefined(A)||A===null)&&t.append(u===!0?gRp([m],D,a):u===null?m:m+"[]",s(A))}),!1}return _Xs(O)?!0:(t.append(gRp(w,m,a),s(O)),!1)}let c=[],b=Object.assign(RPD,{defaultVisitor:o,convertValue:s,isVisitable:_Xs});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 nDi=NPD;function mRp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function PRp(e,t){this._pairs=[],e&&nDi(e,this,t)}var jRp=PRp.prototype;jRp.append=function(t,r){this._pairs.push([t,r])};jRp.toString=function(t){let r=t?function(i){return t.call(this,i,mRp)}:mRp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var wRp=PRp;function FPD(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function a$i(e,t,r){if(!t)return e;let i=r&&r.encode||FPD;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 wRp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var hXs=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)})}},yXs=hXs;var NFn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var MRp=ni(require("crypto"),1);var SRp=ni(require("url"),1),DRp=SRp.default.URLSearchParams;var vXs="abcdefghijklmnopqrstuvwxyz",ERp="0123456789",ARp={DIGIT:ERp,ALPHA:vXs,ALPHA_DIGIT:vXs+vXs.toUpperCase()+ERp},LPD=(e=16,t=ARp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);MRp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},qRp={isNode:!0,classes:{URLSearchParams:DRp,FormData:A7o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:ARp,generateString:LPD,protocols:["http","https","file","data"]};var OXs={};Dn(OXs,{hasBrowserEnv:()=>gXs,hasStandardBrowserEnv:()=>UPD,hasStandardBrowserWebWorkerEnv:()=>VPD,navigator:()=>bXs,origin:()=>WPD});var gXs=typeof window<"u"&&typeof document<"u",bXs=typeof navigator=="object"&&navigator||void 0,UPD=gXs&&(!bXs||["ReactNative","NativeScript","NS"].indexOf(bXs.product)<0),VPD=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",WPD=gXs&&window.location.href||"http://localhost";var uA={...OXs,...qRp};function mXs(e,t){return nDi(e,new uA.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return uA.isNode&&us.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function HPD(e){return us.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function $PD(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 GPD(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]=$PD(n[u])),!l)}if(us.isFormData(e)&&us.isFunction(e.entries)){let r={};return us.forEachEntry(e,(i,n)=>{t(HPD(i),n,r,0)}),r}return null}var q7o=GPD;function QPD(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 PXs={transitional:NFn,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(q7o(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 mXs(t,this.formSerializer).toString();if((l=us.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return nDi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),QPD(t)):t}],transformResponse:[function(t){let r=this.transitional||PXs.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"?Lp.from(l,Lp.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:uA.classes.FormData,Blob:uA.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=>{PXs.headers[e]={}});var FFn=PXs;var JPD=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"]),TRp=e=>{let t={},r,i,n;return e&&e.split(`
|
|
1715
|
+
`);for(let l=n;l<u.length;l++){let d=u[l];if(d.length>1024)continue;let s=Fxp.test(d)?d.replace(Fxp,"$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>=tRp)break}}return $mD(a)}}function $mD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,tRp).map(r=>({...r,filename:r.filename||GmD(t).filename,function:r.function||rRp}))}function GmD(e){return e[e.length-1]||{}}qFn.stackParser=HmD(rmD());qFn.frameModifiers=[amD];var CFn=class extends aXs{getLibraryId(){return"posthog-node"}};var m7o=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.33",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var QEa=class{async sendEvent(){}async identify(){}async flush(){}};var IFn=require("fs/promises"),oRp=require("os"),uRp=require("path");var iRp=ni(require("crypto")),j7o=new Uint8Array(256),P7o=j7o.length;function cXs(){return P7o>j7o.length-16&&(iRp.default.randomFillSync(j7o),P7o=0),j7o.slice(P7o,P7o+=16)}var TW=[];for(let e=0;e<256;++e)TW.push((e+256).toString(16).slice(1));function nRp(e,t=0){return TW[e[t+0]]+TW[e[t+1]]+TW[e[t+2]]+TW[e[t+3]]+"-"+TW[e[t+4]]+TW[e[t+5]]+"-"+TW[e[t+6]]+TW[e[t+7]]+"-"+TW[e[t+8]]+TW[e[t+9]]+"-"+TW[e[t+10]]+TW[e[t+11]]+TW[e[t+12]]+TW[e[t+13]]+TW[e[t+14]]+TW[e[t+15]]}var aRp=ni(require("crypto")),lXs={randomUUID:aRp.default.randomUUID};function QmD(e,t,r){if(lXs.randomUUID&&!t&&!e)return lXs.randomUUID();e=e||{};let i=e.random||(e.rng||cXs)();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 nRp(i)}var Oae=QmD;var JmD="id",KmD=".fern",JEa=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new CFn(r),this.userId=t==null?void 0:eHs(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.33",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ru(fl.of((0,oRp.homedir)()),Fa.of(KmD),Fa.of(JmD));await Pf(t)||(await(0,IFn.mkdir)((0,uRp.dirname)(t),{recursive:!0}),await(0,IFn.writeFile)(t,Oae())),this.persistedDistinctId=(await(0,IFn.readFile)(t)).toString()}return this.persistedDistinctId}};var fXs;async function zFn(){return fXs==null&&(fXs=await YmD()),fXs}async function YmD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new QEa;let r=await VIo();return r!=null?new JEa({token:r,posthogApiKey:e}):await IRn()!=null?new m7o({posthogApiKey:e}):new JEa({token:void 0,posthogApiKey:e})}catch{return new QEa}}function KEa(e,t){return function(){return e.apply(t,arguments)}}var{toString:XmD}=Object.prototype,{getPrototypeOf:pXs}=Object,{iterator:S7o,toStringTag:cRp}=Symbol,D7o=(e=>t=>{let r=XmD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),vWt=e=>(e=e.toLowerCase(),t=>D7o(t)===e),E7o=e=>t=>typeof t===e,{isArray:xFn}=Array,YEa=E7o("undefined");function ZmD(e){return e!==null&&!YEa(e)&&e.constructor!==null&&!YEa(e.constructor)&&mae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var lRp=vWt("ArrayBuffer");function kmD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&lRp(e.buffer),t}var ePD=E7o("string"),mae=E7o("function"),fRp=E7o("number"),M7o=e=>e!==null&&typeof e=="object",tPD=e=>e===!0||e===!1,w7o=e=>{if(D7o(e)!=="object")return!1;let t=pXs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(cRp in e)&&!(S7o in e)},rPD=vWt("Date"),iPD=vWt("File"),nPD=vWt("Blob"),aPD=vWt("FileList"),oPD=e=>M7o(e)&&mae(e.pipe),uPD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||mae(e.append)&&((t=D7o(e))==="formdata"||t==="object"&&mae(e.toString)&&e.toString()==="[object FormData]"))},sPD=vWt("URLSearchParams"),[cPD,lPD,fPD,dPD]=["ReadableStream","Request","Response","Headers"].map(vWt),pPD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function XEa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),xFn(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 dRp(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 n$i=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,pRp=e=>!YEa(e)&&e!==n$i;function dXs(){let{caseless:e}=pRp(this)&&this||{},t={},r=(i,n)=>{let a=e&&dRp(t,n)||n;w7o(t[a])&&w7o(i)?t[a]=dXs(t[a],i):w7o(i)?t[a]=dXs({},i):xFn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&XEa(arguments[i],r);return t}var _PD=(e,t,r,{allOwnKeys:i}={})=>(XEa(t,(n,a)=>{r&&mae(n)?e[a]=KEa(n,r):e[a]=n},{allOwnKeys:i}),e),hPD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),yPD=(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)},vPD=(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&&pXs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},bPD=(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},gPD=e=>{if(!e)return null;if(xFn(e))return e;let t=e.length;if(!fRp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},OPD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&pXs(Uint8Array)),mPD=(e,t)=>{let i=(e&&e[S7o]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},PPD=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},jPD=vWt("HTMLFormElement"),wPD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),sRp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),SPD=vWt("RegExp"),_Rp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};XEa(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},DPD=e=>{_Rp(e,(t,r)=>{if(mae(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(mae(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+"'")})}})},EPD=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return xFn(e)?i(e):i(String(e).split(t)),r},MPD=()=>{},APD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function qPD(e){return!!(e&&mae(e.append)&&e[cRp]==="FormData"&&e[S7o])}var TPD=e=>{let t=new Array(10),r=(i,n)=>{if(M7o(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=xFn(i)?[]:{};return XEa(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)},CPD=vWt("AsyncFunction"),BPD=e=>e&&(M7o(e)||mae(e))&&mae(e.then)&&mae(e.catch),hRp=((e,t)=>e?setImmediate:t?((r,i)=>(n$i.addEventListener("message",({source:n,data:a})=>{n===n$i&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),n$i.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",mae(n$i.postMessage)),IPD=typeof queueMicrotask<"u"?queueMicrotask.bind(n$i):typeof process<"u"&&process.nextTick||hRp,zPD=e=>e!=null&&mae(e[S7o]),us={isArray:xFn,isArrayBuffer:lRp,isBuffer:ZmD,isFormData:uPD,isArrayBufferView:kmD,isString:ePD,isNumber:fRp,isBoolean:tPD,isObject:M7o,isPlainObject:w7o,isReadableStream:cPD,isRequest:lPD,isResponse:fPD,isHeaders:dPD,isUndefined:YEa,isDate:rPD,isFile:iPD,isBlob:nPD,isRegExp:SPD,isFunction:mae,isStream:oPD,isURLSearchParams:sPD,isTypedArray:OPD,isFileList:aPD,forEach:XEa,merge:dXs,extend:_PD,trim:pPD,stripBOM:hPD,inherits:yPD,toFlatObject:vPD,kindOf:D7o,kindOfTest:vWt,endsWith:bPD,toArray:gPD,forEachEntry:mPD,matchAll:PPD,isHTMLForm:jPD,hasOwnProperty:sRp,hasOwnProp:sRp,reduceDescriptors:_Rp,freezeMethods:DPD,toObjectSet:EPD,toCamelCase:wPD,noop:MPD,toFiniteNumber:APD,findKey:dRp,global:n$i,isContextDefined:pRp,isSpecCompliantForm:qPD,toJSONObject:TPD,isAsyncFn:CPD,isThenable:BPD,setImmediate:hRp,asap:IPD,isIterable:zPD};function RFn(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(RFn,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 yRp=RFn.prototype,vRp={};["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=>{vRp[e]={value:e}});Object.defineProperties(RFn,vRp);Object.defineProperty(yRp,"isAxiosError",{value:!0});RFn.from=(e,t,r,i,n,a)=>{let u=Object.create(yRp);return us.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),RFn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var Lp=RFn;var bRp=ni(K3o(),1),A7o=bRp.default;function _Xs(e){return us.isPlainObject(e)||us.isArray(e)}function ORp(e){return us.endsWith(e,"[]")?e.slice(0,-2):e}function gRp(e,t,r){return e?e.concat(t).map(function(n,a){return n=ORp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function xPD(e){return us.isArray(e)&&!e.some(_Xs)}var RPD=us.toFlatObject(us,{},null,function(t){return/^is[A-Z]/.test(t)});function NPD(e,t,r){if(!us.isObject(e))throw new TypeError("target must be an object");t=t||new(A7o||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 Lp("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)&&xPD(O)||(us.isFileList(O)||us.endsWith(m,"[]"))&&(E=us.toArray(O)))return m=ORp(m),E.forEach(function(A,D){!(us.isUndefined(A)||A===null)&&t.append(u===!0?gRp([m],D,a):u===null?m:m+"[]",s(A))}),!1}return _Xs(O)?!0:(t.append(gRp(w,m,a),s(O)),!1)}let c=[],b=Object.assign(RPD,{defaultVisitor:o,convertValue:s,isVisitable:_Xs});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 nDi=NPD;function mRp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function PRp(e,t){this._pairs=[],e&&nDi(e,this,t)}var jRp=PRp.prototype;jRp.append=function(t,r){this._pairs.push([t,r])};jRp.toString=function(t){let r=t?function(i){return t.call(this,i,mRp)}:mRp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var wRp=PRp;function FPD(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function a$i(e,t,r){if(!t)return e;let i=r&&r.encode||FPD;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 wRp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var hXs=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)})}},yXs=hXs;var NFn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var MRp=ni(require("crypto"),1);var SRp=ni(require("url"),1),DRp=SRp.default.URLSearchParams;var vXs="abcdefghijklmnopqrstuvwxyz",ERp="0123456789",ARp={DIGIT:ERp,ALPHA:vXs,ALPHA_DIGIT:vXs+vXs.toUpperCase()+ERp},LPD=(e=16,t=ARp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);MRp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},qRp={isNode:!0,classes:{URLSearchParams:DRp,FormData:A7o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:ARp,generateString:LPD,protocols:["http","https","file","data"]};var OXs={};Dn(OXs,{hasBrowserEnv:()=>gXs,hasStandardBrowserEnv:()=>UPD,hasStandardBrowserWebWorkerEnv:()=>VPD,navigator:()=>bXs,origin:()=>WPD});var gXs=typeof window<"u"&&typeof document<"u",bXs=typeof navigator=="object"&&navigator||void 0,UPD=gXs&&(!bXs||["ReactNative","NativeScript","NS"].indexOf(bXs.product)<0),VPD=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",WPD=gXs&&window.location.href||"http://localhost";var uA={...OXs,...qRp};function mXs(e,t){return nDi(e,new uA.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return uA.isNode&&us.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function HPD(e){return us.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function $PD(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 GPD(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]=$PD(n[u])),!l)}if(us.isFormData(e)&&us.isFunction(e.entries)){let r={};return us.forEachEntry(e,(i,n)=>{t(HPD(i),n,r,0)}),r}return null}var q7o=GPD;function QPD(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 PXs={transitional:NFn,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(q7o(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 mXs(t,this.formSerializer).toString();if((l=us.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return nDi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),QPD(t)):t}],transformResponse:[function(t){let r=this.transitional||PXs.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"?Lp.from(l,Lp.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:uA.classes.FormData,Blob:uA.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=>{PXs.headers[e]={}});var FFn=PXs;var JPD=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"]),TRp=e=>{let t={},r,i,n;return e&&e.split(`
|
|
1716
1716
|
`).forEach(function(u){n=u.indexOf(":"),r=u.substring(0,n).trim().toLowerCase(),i=u.substring(n+1).trim(),!(!r||t[r]&&JPD[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var CRp=Symbol("internals");function ZEa(e){return e&&String(e).trim().toLowerCase()}function T7o(e){return e===!1||e==null?e:us.isArray(e)?e.map(T7o):String(e)}function KPD(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 YPD=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function jXs(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 XPD(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function ZPD(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 LFn=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(l,d,s){let o=ZEa(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]=T7o(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())&&!YPD(t))u(TRp(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=ZEa(t),t){let i=us.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return KPD(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=ZEa(t),t){let i=us.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||jXs(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(u){if(u=ZEa(u),u){let l=us.findKey(i,u);l&&(!r||jXs(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||jXs(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]=T7o(n),delete r[a];return}let l=t?XPD(a):String(a).trim();l!==a&&delete r[a],r[l]=T7o(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(`
|
|
1717
1717
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let i=new this(t);return r.forEach(n=>i.set(n)),i}static accessor(t){let i=(this[CRp]=this[CRp]={accessors:{}}).accessors,n=this.prototype;function a(u){let l=ZEa(u);i[l]||(ZPD(n,u),i[l]=!0)}return us.isArray(t)?t.forEach(a):a(t),this}};LFn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);us.reduceDescriptors(LFn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});us.freezeMethods(LFn);var oR=LFn;function kEa(e,t){let r=this||FFn,i=t||r,n=oR.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 eMa(e){return!!(e&&e.__CANCEL__)}function BRp(e,t,r){Lp.call(this,e??"canceled",Lp.ERR_CANCELED,t,r),this.name="CanceledError"}us.inherits(BRp,Lp,{__CANCEL__:!0});var KEe=BRp;function rrr(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new Lp("Request failed with status code "+r.status,[Lp.ERR_BAD_REQUEST,Lp.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function wXs(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function SXs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function o$i(e,t,r){let i=!wXs(t);return e&&(i||r==!1)?SXs(e,t):t}var KRp=ni(xEa(),1),YRp=ni(require("http"),1),XRp=ni(require("https"),1),ZRp=ni(require("util"),1),kRp=ni(SYs(),1),mfi=ni(require("zlib"),1);var u$i="1.10.0";function tMa(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var kPD=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function DXs(e,t,r){let i=r&&r.Blob||uA.classes.Blob,n=tMa(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=kPD.exec(e);if(!a)throw new Lp("Invalid URL",Lp.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 Lp("Blob is not supported",Lp.ERR_NOT_SUPPORT);return new i([s],{type:u})}return s}throw new Lp("Unsupported protocol "+n,Lp.ERR_NOT_SUPPORT)}var c$i=ni(require("stream"),1);var IRp=ni(require("stream"),1);var EXs=Symbol("internals"),MXs=class extends IRp.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[EXs]={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[EXs];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[EXs],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)})}},AXs=MXs;var eNp=require("events");var xRp=ni(require("util"),1),RRp=require("stream");var{asyncIterator:zRp}=Symbol,ejD=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[zRp]?yield*e[zRp]():yield e},C7o=ejD;var tjD=uA.ALPHABET.ALPHA_DIGIT+"-_",rMa=typeof TextEncoder=="function"?new TextEncoder:new xRp.default.TextEncoder,s$i=`\r
|
|
1718
1718
|
`,rjD=rMa.encode(s$i),ijD=2,qXs=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)}"`:""}${s$i}`;n?r=rMa.encode(String(r).replace(/\r?\n|\r\n?/g,s$i)):a+=`Content-Type: ${r.type||"application/octet-stream"}${s$i}`,this.headers=rMa.encode(a+s$i),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+ijD,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;us.isTypedArray(t)?yield t:yield*C7o(t),yield rjD}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},njD=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+uA.generateString(n,tjD)}=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=rMa.encode("--"+a+s$i),l=rMa.encode("--"+a+"--"+s$i),d=l.byteLength,s=Array.from(e.entries()).map(([c,b])=>{let g=new qXs(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),RRp.Readable.from(async function*(){for(let c of s)yield u,yield*c.encode();yield l}())},NRp=njD;var FRp=ni(require("stream"),1),TXs=class extends FRp.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)}},LRp=TXs;var ajD=(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,URp=ajD;function ojD(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 VRp=ojD;function ujD(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 WRp=ujD;var Ofi=(e,t,r=3)=>{let i=0,n=VRp(50,250);return WRp(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)},UFn=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},VFn=e=>(...t)=>us.asap(()=>e(...t));var HRp={flush:mfi.default.constants.Z_SYNC_FLUSH,finishFlush:mfi.default.constants.Z_SYNC_FLUSH},sjD={flush:mfi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:mfi.default.constants.BROTLI_OPERATION_FLUSH},$Rp=us.isFunction(mfi.default.createBrotliDecompress),{http:cjD,https:ljD}=kRp.default,fjD=/https:?/,GRp=uA.protocols.map(e=>e+":"),QRp=(e,[t,r])=>(e.on("end",r).on("error",r),t);function djD(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function tNp(e,t,r){let i=t;if(!i&&i!==!1){let n=KRp.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){tNp(a,t,a.href)}}var pjD=typeof process<"u"&&us.kindOf(process)==="process",_jD=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)}),hjD=({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)}},JRp=(e,t)=>hjD(us.isObject(e)?e:{address:e,family:t}),rNp=pjD&&function(t){return _jD(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=URp(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=>JRp(at)):[JRp(xt,Pe)];wt.all?De(Te,ot):De(Te,ot[0].address,ot[0].family)})}}let m=new eNp.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 KEe(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=o$i(t.baseURL,t.url,t.allowAbsoluteUrls),A=new URL(q,uA.hasBrowserEnv?uA.origin:void 0),D=A.protocol||GRp[0];if(D==="data:"){let Oe;if(c!=="GET")return rrr(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{Oe=DXs(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(Ue){throw Lp.from(Ue,Lp.ERR_BAD_REQUEST,t)}return s==="text"?(Oe=Oe.toString(o),(!o||o==="utf8")&&(Oe=us.stripBOM(Oe))):s==="stream"&&(Oe=c$i.default.Readable.from(Oe)),rrr(i,n,{data:Oe,status:200,statusText:"OK",headers:new oR,config:t})}if(GRp.indexOf(D)===-1)return n(new Lp("Unsupported protocol "+D,Lp.ERR_BAD_REQUEST,t));let C=oR.from(t.headers).normalize();C.set("User-Agent","axios/"+u$i,!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=NRp(u,Ue=>{C.set(Ue)},{tag:`axios-${u$i}-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 ZRp.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=c$i.default.Readable.from(C7o(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 Lp("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Lp.ERR_BAD_REQUEST,t));if(C.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return n(new Lp("Request body larger than maxBodyLength limit",Lp.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=c$i.default.Readable.from(u,{objectMode:!1})),u=c$i.default.pipeline([u,new AXs({maxRate:us.toFiniteNumber(L)})],us.noop),x&&u.on("progress",QRp(u,UFn(K,Ofi(VFn(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=a$i(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"+($Rp?", 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:djD,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,tNp(oe,t.proxy,D+"//"+A.hostname+(A.port?":"+A.port:"")+oe.path));let _e,de=fjD.test(oe.protocol);if(oe.agent=de?t.httpsAgent:t.httpAgent,t.transport?_e=t.transport:t.maxRedirects===0?_e=de?XRp.default:YRp.default:(t.maxRedirects&&(oe.maxRedirects=t.maxRedirects),t.beforeRedirect&&(oe.beforeRedirects.config=t.beforeRedirect),_e=de?ljD:cjD),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 AXs({maxRate:us.toFiniteNumber(V)});$&&at.on("progress",QRp(at,UFn(De,Ofi(VFn($),!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(mfi.default.createUnzip(HRp)),delete Ue.headers["content-encoding"];break;case"deflate":wt.push(new LRp),wt.push(mfi.default.createUnzip(HRp)),delete Ue.headers["content-encoding"];break;case"br":$Rp&&(wt.push(mfi.default.createBrotliDecompress(sjD)),delete Ue.headers["content-encoding"])}Te=wt.length>1?c$i.default.pipeline(wt,us.noop):wt[0];let Pe=c$i.default.finished(Te,()=>{Pe(),w()}),ot={status:Ue.statusCode,statusText:Ue.statusMessage,headers:new oR(Ue.headers),config:t,request:xt};if(s==="stream")ot.data=Te,rrr(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 Lp("maxContentLength size of "+t.maxContentLength+" exceeded",Lp.ERR_BAD_RESPONSE,t,xt)))}),Te.on("aborted",function(){if(g)return;let jt=new Lp("stream has been aborted",Lp.ERR_BAD_RESPONSE,t,xt);Te.destroy(jt),n(jt)}),Te.on("error",function(jt){O.destroyed||n(Lp.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(Lp.from(jt,null,t,ot.request,ot))}rrr(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(Lp.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 Lp("error trying to parse `config.timeout` to int",Lp.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||NFn;t.timeoutErrorMessage&&(wt=t.timeoutErrorMessage),n(new Lp(wt,De.clarifyTimeoutError?Lp.ETIMEDOUT:Lp.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 KEe("Request stream has been aborted",t,O))}),u.pipe(O)}else O.end(u)})};var iNp=uA.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,uA.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(uA.origin),uA.navigator&&/(msie|trident)/i.test(uA.navigator.userAgent)):()=>!0;var nNp=uA.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 aNp=e=>e instanceof oR?{...e}:e;function bWt(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(aNp(s),aNp(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 B7o=e=>{let t=bWt({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:u,auth:l}=t;t.headers=u=oR.from(u),t.url=a$i(o$i(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(uA.hasStandardBrowserEnv||uA.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(uA.hasStandardBrowserEnv&&(i&&us.isFunction(i)&&(i=i(t)),i||i!==!1&&iNp(t.url))){let s=n&&a&&nNp.read(a);s&&u.set(n,s)}return t};var yjD=typeof XMLHttpRequest<"u",oNp=yjD&&function(e){return new Promise(function(r,i){let n=B7o(e),a=n.data,u=oR.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=oR.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};rrr(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 Lp("Request aborted",Lp.ECONNABORTED,e,w)),w=null)},w.onerror=function(){i(new Lp("Network Error",Lp.ERR_NETWORK,e,w)),w=null},w.ontimeout=function(){let D=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",C=n.transitional||NFn;n.timeoutErrorMessage&&(D=n.timeoutErrorMessage),i(new Lp(D,C.clarifyTimeoutError?Lp.ETIMEDOUT:Lp.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]=Ofi(s,!0),w.addEventListener("progress",b)),d&&w.upload&&([c,g]=Ofi(d),w.upload.addEventListener("progress",c),w.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(o=A=>{w&&(i(!A||A.type?new KEe(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=tMa(n.url);if(q&&uA.protocols.indexOf(q)===-1){i(new Lp("Unsupported protocol "+q+":",Lp.ERR_BAD_REQUEST,e));return}w.send(a||null)})};var vjD=(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 Lp?o:new KEe(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new Lp(`timeout ${t} of ms exceeded`,Lp.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}},uNp=vjD;var bjD=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},gjD=async function*(e,t){for await(let r of OjD(e))yield*bjD(r,t)},OjD=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()}},CXs=(e,t,r,i)=>{let n=gjD(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 z7o=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",cNp=z7o&&typeof ReadableStream=="function",mjD=z7o&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),lNp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},PjD=cNp&&lNp(()=>{let e=!1,t=new Request(uA.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),sNp=64*1024,BXs=cNp&&lNp(()=>us.isReadableStream(new Response("").body)),I7o={stream:BXs&&(e=>e.body)};z7o&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!I7o[t]&&(I7o[t]=us.isFunction(e[t])?r=>r[t]():(r,i)=>{throw new Lp(`Response type '${t}' is not supported`,Lp.ERR_NOT_SUPPORT,i)})})})(new Response);var jjD=async e=>{if(e==null)return 0;if(us.isBlob(e))return e.size;if(us.isSpecCompliantForm(e))return(await new Request(uA.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 mjD(e)).byteLength},wjD=async(e,t)=>{let r=us.toFiniteNumber(e.getContentLength());return r??jjD(t)},fNp=z7o&&(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}=B7o(e);s=s?(s+"").toLowerCase():"text";let g=uNp([n,a&&a.toAbortSignal()],u),O,m=g&&g.unsubscribe&&(()=>{g.unsubscribe()}),w;try{if(d&&PjD&&r!=="get"&&r!=="head"&&(w=await wjD(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]=UFn(w,Ofi(VFn(d)));i=CXs(C.body,sNp,$,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=BXs&&(s==="stream"||s==="response");if(BXs&&(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&&UFn(x,Ofi(VFn(l),!0))||[];q=new Response(CXs(q.body,sNp,$,()=>{I&&I(),m&&m()}),C)}s=s||"text";let D=await I7o[us.findKey(I7o,s)||"text"](q,e);return!A&&m&&m(),await new Promise((C,x)=>{rrr(C,x,{data:D,headers:oR.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 Lp("Network Error",Lp.ERR_NETWORK,e,O),{cause:E.cause||E}):Lp.from(E,E&&E.code,e,O)}});var IXs={http:rNp,xhr:oNp,fetch:fNp};us.forEach(IXs,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var dNp=e=>`- ${e}`,SjD=e=>us.isFunction(e)||e===null||e===!1,x7o={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,!SjD(r)&&(i=IXs[(u=String(r)).toLowerCase()],i===void 0))throw new Lp(`Unknown adapter '${u}'`);if(i)break;n[u||"#"+a]=i}if(!i){let a=Object.entries(n).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build")),u=t?a.length>1?`since :
|
|
@@ -1954,7 +1954,7 @@ ${A}${q}${D}${ikp.default.cursorHide}`});var UCa=ni(Vwi(),1);function Rsc(e,t){i
|
|
|
1954
1954
|
Run ${Ds.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
|
|
1955
1955
|
Run ${Ds.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),HFn(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function Jsc({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!Ekp(e))return;let n=t??"",a=e.filter(l=>l.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((l,d)=>l.generatorName.localeCompare(d.generatorName)||l.currentVersion.localeCompare(d.currentVersion));for(let l of u)n+=`
|
|
1956
1956
|
${await LGD(l.generatorName)} (${l.apiName!=null?"API: "+l.apiName+", ":""}Group: ${l.generatorGroup}) `+Ds.dim(l.currentVersion)+Ds.reset(" \u2192 ")+Ds.green(l.latestVersion);return n+=`
|
|
1957
|
-
`,i?HFn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function LGD(e){let r=await new Dkp.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 UGD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await Akp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=Uwi(o.name,c),g=await fkt({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 Akp({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=Uwi(s.name,o),b=await fkt({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 Akp({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 WVt({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 qkp(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=zae(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 hVo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await UGD({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(...qkp(s,d,t.logger));else u.push(...qkp(l.versions,void 0,t.logger))}return u}var KCa=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 C4n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Ksc=(()=>{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})(),Tkp=typeof globalThis.AbortController=="function",Ckp=typeof globalThis.ReadableStream=="function",Bkp=typeof globalThis.FormData=="function",yVo=["get","post","put","patch","head","delete"],VGD=()=>{};VGD();var Ikp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},vVo=2147483647,zkp=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,bVo=Symbol("stop"),xkp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},Rkp={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 WGD=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=zkp,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},Nkp=(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})},Fkp=(e,t)=>{let r=WGD(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 B4n=e=>e!==null&&typeof e=="object";var YCa=(...e)=>{for(let t of e)if((!B4n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Zsc({},...e)},Ysc=(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 gVo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Zsc(e[r]??[],t[r]??[])}var Xsc=(e={},t={})=>({beforeRequest:gVo(e,t,"beforeRequest"),beforeRetry:gVo(e,t,"beforeRetry"),afterResponse:gVo(e,t,"afterResponse"),beforeError:gVo(e,t,"beforeError")}),Zsc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(B4n(n)){for(let[a,u]of Object.entries(n))B4n(u)&&a in t&&(u=Zsc(t[a],u)),t={...t,[a]:u};B4n(n.hooks)&&(i=Xsc(i,n.hooks),t.hooks=i),B4n(n.headers)&&(r=Ysc(r,n.headers),t.headers=r)}return t};var Ukp=e=>yVo.includes(e)?e.toUpperCase():e,HGD=["get","put","head","delete","options","trace"],$GD=[408,413,429,500,502,503,504],GGD=[413,429,503],Lkp={limit:2,methods:HGD,statusCodes:$GD,afterStatusCodes:GGD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Vkp=(e={})=>{if(typeof e=="number")return{...Lkp,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{...Lkp,...e}};async function ksc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new C4n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function ecc(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 Wkp=(e,t)=>{let r={};for(let i in t)!(i in Rkp)&&!(i in xkp)&&!(i in e)&&(r[i]=t[i]);return r};var XCa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>vVo)throw new RangeError(`The \`timeout\` option cannot be greater than ${vVo}`);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 KCa(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(!Ckp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return Nkp(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(Ikp))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:Ysc(this._input.headers,r.headers),hooks:Xsc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Ukp(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:Vkp(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(Tkp){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(Ksc&&(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);(Bkp&&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(!Ksc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=Fkp(this.request,this._options.onUploadProgress))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof C4n)throw t;if(t instanceof KCa){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),vVo);if(this._retryCount<1)throw r;await ecc(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})===bVo)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=Wkp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):ksc(r,t,this.abortController,this._options)}};var tcc=e=>{let t=(r,i)=>XCa.create(r,YCa(e,i));for(let r of yVo)t[r]=(i,n)=>XCa.create(i,YCa(e,n,{method:r}));return t.create=r=>tcc(YCa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),tcc(YCa(e,r))),t.stop=bVo,t},QGD=tcc(),Hkp=QGD;var pe_=ni(de_(),1);function occ(e){let t=(0,pe_.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var ut_=ni(ot_(),1),st_=ni(Vwi(),1),gcc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Occ=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function mcc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??occ(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,ut_.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 Hkp(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new gcc(e):c}if(t.allVersions)return s;let o=new Occ(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=st_.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 iBa(e,t){let{version:r}=await mcc(e.toLowerCase(),t);return r}async function IEi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:iBa(e.packageName,{version:t?"prerelease":"latest"})}var ct_=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],TVo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=kv.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new _Vo(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.32-rc1"}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 _9}failWithoutThrowing(t,r){this.didSucceed=!1,lVo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await zFn()).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 Mkp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1957
|
+
`,i?HFn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function LGD(e){let r=await new Dkp.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 UGD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await Akp({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=Uwi(o.name,c),g=await fkt({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 Akp({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=Uwi(s.name,o),b=await fkt({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 Akp({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 WVt({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 qkp(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=zae(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 hVo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await UGD({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(...qkp(s,d,t.logger));else u.push(...qkp(l.versions,void 0,t.logger))}return u}var KCa=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 C4n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Ksc=(()=>{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})(),Tkp=typeof globalThis.AbortController=="function",Ckp=typeof globalThis.ReadableStream=="function",Bkp=typeof globalThis.FormData=="function",yVo=["get","post","put","patch","head","delete"],VGD=()=>{};VGD();var Ikp={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},vVo=2147483647,zkp=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,bVo=Symbol("stop"),xkp={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},Rkp={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 WGD=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=zkp,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},Nkp=(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})},Fkp=(e,t)=>{let r=WGD(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 B4n=e=>e!==null&&typeof e=="object";var YCa=(...e)=>{for(let t of e)if((!B4n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Zsc({},...e)},Ysc=(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 gVo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Zsc(e[r]??[],t[r]??[])}var Xsc=(e={},t={})=>({beforeRequest:gVo(e,t,"beforeRequest"),beforeRetry:gVo(e,t,"beforeRetry"),afterResponse:gVo(e,t,"afterResponse"),beforeError:gVo(e,t,"beforeError")}),Zsc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(B4n(n)){for(let[a,u]of Object.entries(n))B4n(u)&&a in t&&(u=Zsc(t[a],u)),t={...t,[a]:u};B4n(n.hooks)&&(i=Xsc(i,n.hooks),t.hooks=i),B4n(n.headers)&&(r=Ysc(r,n.headers),t.headers=r)}return t};var Ukp=e=>yVo.includes(e)?e.toUpperCase():e,HGD=["get","put","head","delete","options","trace"],$GD=[408,413,429,500,502,503,504],GGD=[413,429,503],Lkp={limit:2,methods:HGD,statusCodes:$GD,afterStatusCodes:GGD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Vkp=(e={})=>{if(typeof e=="number")return{...Lkp,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{...Lkp,...e}};async function ksc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new C4n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function ecc(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 Wkp=(e,t)=>{let r={};for(let i in t)!(i in Rkp)&&!(i in xkp)&&!(i in e)&&(r[i]=t[i]);return r};var XCa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>vVo)throw new RangeError(`The \`timeout\` option cannot be greater than ${vVo}`);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 KCa(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(!Ckp)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return Nkp(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(Ikp))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:Ysc(this._input.headers,r.headers),hooks:Xsc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:Ukp(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:Vkp(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(Tkp){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(Ksc&&(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);(Bkp&&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(!Ksc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=Fkp(this.request,this._options.onUploadProgress))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof C4n)throw t;if(t instanceof KCa){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),vVo);if(this._retryCount<1)throw r;await ecc(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})===bVo)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=Wkp(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):ksc(r,t,this.abortController,this._options)}};var tcc=e=>{let t=(r,i)=>XCa.create(r,YCa(e,i));for(let r of yVo)t[r]=(i,n)=>XCa.create(i,YCa(e,n,{method:r}));return t.create=r=>tcc(YCa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),tcc(YCa(e,r))),t.stop=bVo,t},QGD=tcc(),Hkp=QGD;var pe_=ni(de_(),1);function occ(e){let t=(0,pe_.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var ut_=ni(ot_(),1),st_=ni(Vwi(),1),gcc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Occ=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function mcc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??occ(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,ut_.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 Hkp(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new gcc(e):c}if(t.allVersions)return s;let o=new Occ(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=st_.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 iBa(e,t){let{version:r}=await mcc(e.toLowerCase(),t);return r}async function IEi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:iBa(e.packageName,{version:t?"prerelease":"latest"})}var ct_=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],TVo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=kv.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new _Vo(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.33"}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 _9}failWithoutThrowing(t,r){this.didSucceed=!1,lVo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await zFn()).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 Mkp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1958
1958
|
`)||(r+=`
|
|
1959
1959
|
`),this.stderr.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram({code:t}={}){process.exit(t??(this.didSucceed?0:1))}longestWorkspaceName;registerWorkspaces(t){let r=Bzs(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 VCa(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 _9}finally{i.finish()}return n}async instrumentPostHogEvent(t){this.isLocal||(await zFn()).sendEvent(t)}logger=wXt((t,...r)=>this.log(t,...r));stderr=wXt((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=lt_(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?lt_(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=ct_[this.numTasks++%ct_.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===CB.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=>Zji.indexOf(n.level)>=Zji.indexOf(this.logLevel));this.ttyAwareLogger.log(i,{includeDebugInfo:this.logLevel===kv.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 IEi({cliEnvironment:this.environment,includePreReleases:t}),i=zae(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await hVo({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await Csc({message:t,default:r})}async getInput(t){return await Bsc({message:t.message,default:t.default})}};function lt_(e){return`[${e}]:`}var xP_=require("fs/promises");function uFe({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(`
|
|
1960
1960
|
`)}var Fv_=require("fs/promises");var XWt=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 yMe=class extends XWt{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 nBa=class{context;constructor(t){this.context=t}};var CVo=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[u,l]of Object.entries(i.files)){let d=n!=null?Py.of(`${n}${uVt}${u}`):Py.of(u);t[d]=l}let a=Object.keys(i.directories).sort();for(let u of a){let l=n!=null?`${n}${uVt}${u}`:u,d=i.directories[u];r(d,l)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(uVt))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Py.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 gQi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new CVo,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 Ekt(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"]))ft_(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(ft_(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??d_((Oxe(r)+"/"+nVi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Py.of(GF))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=zOo(Oxe($Bn.of(`/${t}`)),$Bn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=zOo(Oxe($Bn.of(`/${t}`)),$Bn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){if(t===Py.of(GF))return;let n=this.getOrCreateFile(t);n.types==null&&(n.types={}),n.types[r]=i}addTypeExample(t,r,i){let n=this.getOrCreateFile(t);n.types==null&&(n.types={});let a=n.types[r];a!=null&&(typeof a=="string"?n.types[r]={type:a,examples:[i]}:(a.examples==null&&(a.examples=[]),a.examples.push(i)))}addError(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.errors==null&&(n.errors={}),n.errors[r]==null?n.errors[r]=i:n.errors[r]?.type!==i.type&&(n.errors[r]={"status-code":i["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:i}){let n=this.getOrCreateFile(t);if(n.errors==null)return;let a=n.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(l=>P2(l,i))??!1)||a.examples?.push(i)}addEndpoint(t,{name:r,schema:i,source:n}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),n!=null&&(a.service.source=n),a.service.endpoints[r]=i}addWebhook(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.webhooks==null&&(n.webhooks={}),n.webhooks[r]=i}addChannel(t,{channel:r}){let i=this.getOrCreateFile(t);i.channel=r;let n=this.basePath;n!=null&&(i.channel.path=TN(n,r.path))}addChannelExample(t,{example:r}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.examples==null&&(i.channel.examples=[]),i.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:i}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.messages[r]=i}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([n,a])=>[n,{...a,path:TN(r,a.path)}]))});for(let n of Object.values(t))n.service!=null&&(n.service={...n.service,endpoints:Object.fromEntries(Object.entries(n.service.endpoints).map(([a,u])=>[a,{...u,path:TN(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===BS?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 ft_(e){return e?.header!=null}var xae={openapi:e=>({...e,type:"openapi",_visit:function(t){return xae._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return xae._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 L4n={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return L4n._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var Z9={basic:e=>({...e,type:"basic",_visit:function(t){return Z9._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return Z9._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return Z9._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return Z9._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return Z9._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 PO={primitive:e=>({value:e,type:"primitive",_visit:function(t){return PO._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return PO._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return PO._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return PO._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return PO._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return PO._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return PO._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return PO._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 A_={int:e=>({value:e,type:"int",_visit:function(t){return A_._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return A_._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return A_._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return A_._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return A_._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return A_._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return A_._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return A_._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return A_._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return A_._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return A_._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 U4n={boolean:e=>({value:e,type:"boolean",_visit:function(t){return U4n._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return U4n._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 zEi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return zEi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return zEi._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 WW={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case WW.GenerallyAvailable:return t.generallyAvailable();case WW.Beta:return t.beta();case WW.Deprecated:return t.deprecated();default:return t._other()}}};var sFe={cursor:e=>({...e,type:"cursor",_visit:function(t){return sFe._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return sFe._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return sFe._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 fdi={language:e=>({...e,type:"language",_visit:function(t){return fdi._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return fdi._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 HW={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 HW.Curl:return t.curl();case HW.Python:return t.python();case HW.Javascript:return t.javascript();case HW.Typescript:return t.typescript();case HW.Go:return t.go();case HW.Ruby:return t.ruby();case HW.Csharp:return t.csharp();case HW.Java:return t.java();case HW.Js:return t.js();case HW.Node:return t.node();case HW.Ts:return t.ts();case HW.Nodets:return t.nodets();case HW.Golang:return t.golang();case HW.Dotnet:return t.dotnet();case HW.Jvm:return t.jvm();default:return t._other()}}};var ZWt={unknown:e=>({value:e,type:"unknown",_visit:function(t){return ZWt._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return ZWt._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 kWt={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return kWt._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return kWt._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 $W={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case $W.Get:return t.get();case $W.Post:return t.post();case $W.Put:return t.put();case $W.Patch:return t.patch();case $W.Delete:return t.delete();case $W.Head:return t.head();case $W.Options:return t.options();case $W.Trace:return t.trace();default:return t._other()}}};var xEi={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return xEi._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return xEi._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return xEi._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 ddi={file:e=>({...e,type:"file",_visit:function(t){return ddi._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return ddi._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 ZQ={file:e=>({...e,type:"file",_visit:function(t){return ZQ._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return ZQ._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return ZQ._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return ZQ._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return ZQ._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return ZQ._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return ZQ._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 Jy={primitive:e=>({...e,type:"primitive",_visit:function(t){return Jy._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Jy._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Jy._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Jy._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Jy._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Jy._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Jy._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Jy._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Jy._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Jy._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Jy._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 Zj={int:e=>({...e,type:"int",_visit:function(t){return Zj._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Zj._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Zj._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Zj._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Zj._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Zj._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Zj._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Zj._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Zj._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Zj._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Zj._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 _z={boolean:e=>({value:e,type:"boolean",_visit:function(t){return _z._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return _z._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 pdi={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return pdi._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return pdi._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 vMe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return vMe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return vMe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return vMe._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 OC={file:e=>({...e,type:"file",_visit:function(t){return OC._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return OC._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return OC._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return OC._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return OC._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return OC._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return OC._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 Cl={primitive:e=>({...e,type:"primitive",_visit:function(t){return Cl._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Cl._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Cl._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Cl._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Cl._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Cl._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Cl._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Cl._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Cl._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Cl._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Cl._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 WZ={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return WZ._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return WZ._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 rp={int:e=>({...e,type:"int",_visit:function(t){return rp._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return rp._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return rp._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return rp._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return rp._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return rp._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return rp._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return rp._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return rp._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return rp._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return rp._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 zv={};Dn(zv,{AllOfPropertyConflict:()=>l2n,ArraySchema:()=>JWo,ArraySchemaWithExample:()=>PHo,Availability:()=>VVo,Base64WithExample:()=>vHo,BasicSecurityScheme:()=>$Vo,BearerSecurityScheme:()=>GVo,BooleanSchema:()=>VWo,BooleanWithExample:()=>bHo,BytesResponse:()=>t2n,CasingOverrides:()=>KVo,CommonProperty:()=>rHo,CommonPropertyWithExample:()=>THo,CursorPagination:()=>SWo,CustomCodeSample:()=>jWo,CustomCodeSampleLanguage:()=>OWo,CustomCodeSampleSdk:()=>PWo,CustomPagination:()=>EWo,DateWithExample:()=>yHo,DatetimeWithExample:()=>hHo,DiscriminatedOneOfSchema:()=>eHo,DiscriminatedOneOfSchemaWithExample:()=>AHo,DoubleSchema:()=>LWo,DoubleWithExample:()=>pHo,Encoding:()=>UVo,Endpoint:()=>MWo,EndpointExample:()=>a2n,EndpointResponseExample:()=>gWo,EndpointSdkName:()=>Grr,EndpointWithExample:()=>Ut_,EnumSchema:()=>$4n,EnumSchemaWithExample:()=>OHo,EnumValue:()=>FEi,ErrorExample:()=>_Wo,FernExample:()=>yWo,FileResponse:()=>k4n,FileSchema:()=>uWo,FloatWithExample:()=>dHo,FullEndpointExample:()=>wWo,FullExample:()=>Hq,FullObjectExample:()=>rWo,FullOneOfExample:()=>nWo,GlobalHeader:()=>HWo,Header:()=>UEi,HeaderExample:()=>n2n,HeaderSecurityScheme:()=>QVo,HeaderWithExample:()=>HEi,HttpEndpointServer:()=>r2n,HttpError:()=>hWo,HttpErrorWithExample:()=>uHo,HttpMethod:()=>J4n,IdempotencyHeader:()=>$Wo,Int64WithExample:()=>cHo,IntSchema:()=>NWo,IntWithExample:()=>sHo,JsonRequest:()=>fWo,JsonRequestWithExample:()=>nHo,JsonResponse:()=>e2n,JsonResponseWithExample:()=>p2n,KeyValuePair:()=>iWo,LiteralExample:()=>tWo,LiteralSchema:()=>c2n,LiteralSchemaValue:()=>GWo,LongSchema:()=>FWo,MapSchema:()=>KWo,MapSchemaWithExample:()=>jHo,MultipartRequest:()=>Z4n,MultipartRequestProperty:()=>lWo,MultipartRequestPropertyEncoding:()=>cWo,MultipartSchema:()=>sWo,NamedFullExample:()=>Jrr,Namespace:()=>YVo,NamespaceId:()=>eWo,NullableSchema:()=>XWo,NullableSchemaWithExample:()=>SHo,OauthSecurityScheme:()=>ZVo,ObjectProperty:()=>kWo,ObjectPropertyConflictInfo:()=>f2n,ObjectPropertyWithExample:()=>MHo,ObjectSchema:()=>QWo,ObjectSchemaWithExample:()=>DHo,OctetStreamRequest:()=>X4n,OffsetPagination:()=>DWo,OneOfSchema:()=>ZWo,OneOfSchemaWithExample:()=>EHo,OpenApiIntermediateRepresentation:()=>Ft_,OpenApiSource:()=>RVo,OptionalSchema:()=>YWo,OptionalSchemaWithExample:()=>wHo,Pagination:()=>o2n,PathParameter:()=>K4n,PathParameterExample:()=>vWo,PathParameterWithExample:()=>iHo,PrimitiveExample:()=>Q4n,PrimitiveSchema:()=>WEi,PrimitiveSchemaValue:()=>WWo,PrimitiveSchemaValueWithExample:()=>gHo,PrimitiveSchemaWithExample:()=>_2n,PropertyKey:()=>G4n,ProtobufEncoding:()=>LVo,ProtobufSource:()=>NVo,QueryParameter:()=>Y4n,QueryParameterExample:()=>i2n,QueryParameterWithExample:()=>d2n,QuerySecurityScheme:()=>JVo,ReferencedSchema:()=>Qrr,Request:()=>dWo,RequestWithExample:()=>aHo,Response:()=>pWo,ResponseWithExample:()=>oHo,Schema:()=>Dm,SchemaId:()=>HZ,SchemaWithExample:()=>dA,Schemas:()=>RWo,SdkGroup:()=>XVo,SdkGroupInfo:()=>aWo,SdkGroupName:()=>LEi,SecurityScheme:()=>kVo,SecuritySchemeId:()=>HVo,Server:()=>sBa,Source:()=>FVo,StatusCode:()=>$rr,StreamingResponseExample:()=>bWo,StringSchema:()=>UWo,StringSchemaWithExample:()=>_Ho,SupportedSdkLanguage:()=>mWo,Tag:()=>WVo,TagId:()=>$Z,Tags:()=>oWo,TextResponse:()=>VEi,Uint64WithExample:()=>fHo,UintWithExample:()=>lHo,UnDiscriminatedOneOfSchema:()=>tHo,UnDiscriminatedOneOfSchemaWithExample:()=>qHo,UnknownSchemaWithExample:()=>mHo,Webhook:()=>AWo,WebhookExampleCall:()=>s2n,WebhookHttpMethod:()=>u2n,WebhookWithExample:()=>Vt_,WebsocketChannel:()=>xWo,WebsocketHandshake:()=>qWo,WebsocketHandshakeWithExample:()=>Lt_,WebsocketMessageExample:()=>IWo,WebsocketMessageOrigin:()=>TWo,WebsocketMessageSchema:()=>CWo,WebsocketServer:()=>BWo,WebsocketSessionExample:()=>zWo,WithAvailability:()=>Bh,WithDescription:()=>Of,WithEncoding:()=>Rae,WithInline:()=>HE,WithName:()=>R0,WithNamespace:()=>o0,WithSdkGroupName:()=>cm,WithSource:()=>ey,WithStatusCode:()=>cFe,WithTitle:()=>sm,commons:()=>Dcc,example:()=>Ecc,finalIr:()=>Mcc,parseIr:()=>Acc});var Dcc={};Dn(Dcc,{BasicSecurityScheme:()=>$Vo,BearerSecurityScheme:()=>GVo,Encoding:()=>UVo,HeaderSecurityScheme:()=>QVo,Namespace:()=>YVo,NamespaceId:()=>eWo,OauthSecurityScheme:()=>ZVo,OpenApiSource:()=>RVo,ProtobufEncoding:()=>LVo,ProtobufSource:()=>NVo,QuerySecurityScheme:()=>JVo,SchemaId:()=>HZ,SdkGroup:()=>XVo,SdkGroupName:()=>LEi,SecurityScheme:()=>kVo,SecuritySchemeId:()=>HVo,Server:()=>sBa,Source:()=>FVo,StatusCode:()=>$rr,Tag:()=>WVo,TagId:()=>$Z,WithAvailability:()=>Bh,WithDescription:()=>Of,WithEncoding:()=>Rae,WithInline:()=>HE,WithName:()=>R0,WithNamespace:()=>o0,WithSdkGroupName:()=>cm,WithSource:()=>ey,WithStatusCode:()=>cFe,WithTitle:()=>sm});var Mt={};Dn(Mt,{JsonError:()=>V4n,ParseError:()=>W4n,any:()=>Dt_,bigint:()=>pt_,boolean:()=>Et_,booleanLiteral:()=>St_,date:()=>_t_,discriminant:()=>xt_,enum_:()=>IVo,getObjectLikeUtils:()=>eHt,getObjectUtils:()=>OQi,getSchemaUtils:()=>Wq,isProperty:()=>NEi,lazy:()=>ht_,lazyObject:()=>Pt_,list:()=>xVo,number:()=>Mt_,object:()=>zVo,objectWithoutOptionalProperties:()=>mt_,optional:()=>Pcc,property:()=>vt_,record:()=>Ct_,set:()=>Bt_,string:()=>At_,stringLiteral:()=>wt_,transform:()=>jcc,undiscriminatedUnion:()=>zt_,union:()=>Nt_,unknown:()=>qt_,withParsedProperties:()=>Scc});var Aj={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 fA(e,t){return`Expected ${t}. Received ${kQD(e)}.`}function kQD(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 k9(e){return{...e,json:dt_(e.json),parse:dt_(e.parse)}}function dt_(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(`
|