fern-api 0.120.0 → 0.120.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +6 -6
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -2437,7 +2437,7 @@ ${Egy.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&vgf(th
2437
2437
  `+lua.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?lua.default.cyan(Rgy(t,this.opt.mask)):lua.default.italic(lua.default.dim("[hidden]")):this.opt.mask?Rgy(t,this.opt.mask):lua.default.italic(lua.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 KEu=Hi(Ase(),1);var R0y=Hi(Zgf(),1),HEu=require("child_process"),cZa=require("fs"),GEu=Hi(require("path"),1),N0y=Hi(require("os"),1),F0y=require("crypto"),N0f=Hi(T0y(),1);var UEu=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var EKo=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var VEu=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var WEu=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function JEu(e="",t,r){let n=new F0f(e,r);n.runAsync((i,a)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,a)}catch(o){setImmediate(t,o,void 0)}})}function q0y(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function I0C(e){let t=[],r="";for(let n=0;n<e.length;n++){let i=e.charAt(n);n>0&&i===" "&&e[n-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${i}`}return r.length>0&&t.push(r),t}var F0f=class{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(t="",r){this.text=t,r&&(this.fileOptions=r),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(t){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(t,void 0,this.text)}catch(r){setImmediate(t,r,void 0)}})}catch(r){setImmediate(t,r,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim",r=I0C(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??N0y.default.tmpdir(),r=(0,F0y.randomUUID)(),n=q0y(this.fileOptions.prefix),i=q0y(this.fileOptions.postfix),a=`${n}${r}${i}`,o=GEu.default.resolve(t,a),c=GEu.default.resolve(t)+GEu.default.sep;if(!o.startsWith(c))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=o;let f={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(f.mode=this.fileOptions.mode),(0,cZa.writeFileSync)(this.tempFile,this.text,f)}catch(t){throw new UEu(t)}}readTemporaryFile(){try{let t=(0,cZa.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,R0y.detect)(t)??"utf8";N0f.default.encodingExists(r)||(r="utf8"),this.text=N0f.default.decode(t,r)}}catch(t){throw new VEu(t)}}removeTemporaryFile(){try{(0,cZa.unlinkSync)(this.tempFile)}catch(t){throw new WEu(t)}}launchEditor(){try{let t=(0,HEu.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new EKo(t)}}launchEditorAsync(t){try{(0,HEu.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new EKo(r)}}};var x0y=Hi(Rrt(),1);var SKo=class extends Pse{_run(t){this.done=t,this.editorResult=new x0y.Subject;let r=Hve(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,i=this.handleSubmitEvents(this.editorResult);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,n?this.render():this.startExternalEditor(),this}render(t){let r="",n=this.getQuestion();n+=this.status==="answered"?KEu.default.dim("Received"):KEu.default.dim("Press <enter> to launch your preferred editor."),t&&(r=KEu.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),JEu(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 V0y=require("stream");var L0y=Hi(require("readline"),1),U0y=Hi(Q0y(),1),_ua=class{constructor(t){this.rl||=L0y.default.createInterface(B0C(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 B0C(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new U0y.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var DKo=class extends _ua{constructor(t={}){super(t),this.log=new V0y.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return fKo(this.rl,this.bottomBar.split(`
2438
2438
  `).length),this}updateBottomBar(t){return fKo(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+`
2439
2439
  `}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&&yEu(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var J4=Hi(Rrt(),1),H0y=Hi(BJo(),1);var $Eu=Hi(Rrt(),1),W0y=Hi(BJo(),1),YEu=function(e,t,r){return typeof e[t]!="function"?(0,$Eu.of)(e):(0,$Eu.from)((0,W0y.default)(e[t])(r).then(n=>(e[t]=n,e)))};var G0y={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,a,o)=>{i==="__proto__"||i==="constructor"||(a===o.length-1?n[i]=r:(!(i in n)||typeof n[i]!="object")&&(n[i]={}),n=n[i])})},get:(e,t="",r)=>{let n=a=>String.prototype.split.call(t,a).filter(Boolean).reduce((o,c)=>o!=null?o[c]:o,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},lZa=class extends _ua{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let n;return Array.isArray(t)?n=(0,J4.from)(t):(0,J4.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,J4.from)(Object.entries(t).map(([i,a])=>({name:i,...a}))):n=(0,J4.from)([t]),this.process=n.pipe((0,J4.concatMap)(this.processQuestion.bind(this)),(0,J4.publish)()),this.process.connect(),this.process.pipe((0,J4.reduce)((i,a)=>(G0y.set(i,a.name,a.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,J4.defer)(()=>(0,J4.of)(t).pipe((0,J4.concatMap)(this.setDefaultType.bind(this)),(0,J4.concatMap)(this.filterIfRunnable.bind(this)),(0,J4.concatMap)(()=>YEu(t,"message",this.answers)),(0,J4.concatMap)(()=>YEu(t,"default",this.answers)),(0,J4.concatMap)(()=>YEu(t,"choices",this.answers)),(0,J4.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,J4.defer)(()=>(0,J4.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,J4.defer)(()=>(0,J4.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&G0y.get(this.answers,t.name)!==void 0)return J4.EMPTY;if(t.when===!1)return J4.EMPTY;if(typeof t.when!="function")return(0,J4.of)(t);let{answers:r}=this;return(0,J4.defer)(()=>(0,J4.from)((0,H0y.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,J4.filter)(n=>n!=null)))}};function J0y(e){let t=function(r,n){let i;try{i=new lZa(t.prompts,e)}catch(o){return Promise.reject(o)}let a=i.run(r,n);return a.ui=i,a};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",pKo),this.registerPrompt("input",cua),this.registerPrompt("number",_Ko),this.registerPrompt("confirm",hKo),this.registerPrompt("rawlist",yKo),this.registerPrompt("expand",vKo),this.registerPrompt("checkbox",bKo),this.registerPrompt("password",gKo),this.registerPrompt("editor",SKo)},t.restoreDefaultPrompts(),t}var z0f=J0y();function q0C(e,t){z0f.registerPrompt(e,t)}function R0C(){z0f.restoreDefaultPrompts()}var N0C={prompt:z0f,ui:{BottomBar:DKo,Prompt:lZa},createPromptModule:J0y,registerPrompt:q0C,restoreDefaultPrompts:R0C,Separator:axe},XEu=N0C;var PZa=require("path"),EOy=require("fs"),SOy=require("readline"),Xmy="posthog-node";function cAC(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"]}={}){return a=>{if(!(i==="*"||i.includes(a.level)))return a;a.tags||(a.tags={});let c=a.tags[vSu.POSTHOG_ID_TAG];if(c===void 0)return a;let f=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${c}`,f).toString();a.tags["PostHog Person URL"]=u;let s=a.exception?.values||[],l=s.map(O=>({...O,stacktrace:O.stacktrace?{...O.stacktrace,type:"raw",frames:(O.stacktrace.frames||[]).map(P=>({...P,platform:"node:javascript"}))}:void 0})),m={$exception_message:s[0]?.value||a.message,$exception_type:s[0]?.type,$exception_personURL:u,$exception_level:a.level,$exception_list:l,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:s[0]?.value||a.message,$sentry_exception_type:s[0]?.type,$sentry_tags:a.tags};return t&&r&&(m.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:c,properties:m}),a}}var vSu=class{constructor(t,r,n,i){this.name=Xmy,this.name=Xmy,this.setupOnce=function(a,o){let c=o()?.getClient()?.getDsn()?.projectId;a(cAC(t,{organization:r,projectId:c,prefix:n,severityAllowList:i}))}}};vSu.POSTHOG_ID_TAG="posthog_distinct_id";var dSu="0123456789abcdef",bSu=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,n,i){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||t<0||r<0||n<0||i<0||t>0xffffffffffff||r>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|n>>>24,a[9]=n>>>16,a[10]=n>>>8,a[11]=n,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break}if(r){let n=new Uint8Array(16);for(let i=0;i<16;i+=4){let a=parseInt(r.substring(2*i,2*i+8),16);n[i+0]=a>>>24,n[i+1]=a>>>16,n[i+2]=a>>>8,n[i+3]=a}return new e(n)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=dSu.charAt(this.bytes[r]>>>4),t+=dSu.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+=dSu.charAt(this.bytes[r]>>>4),t+=dSu.charAt(this.bytes[r]&15);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let n=this.bytes[r]-t.bytes[r];if(n!==0)return Math.sign(n)}return 0}},Pmf=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??lAC()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let n=this.generateOrAbortCore(t,r);return n===void 0&&(this.timestamp=0,n=this.generateOrAbortCore(t,r)),n}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return bSu.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,bSu.ofInner(t)}},lAC=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),Zmy,wmf=()=>fAC().toString(),fAC=()=>(Zmy||(Zmy=new Pmf)).generate();function dAC(e,t){let r=!1;return Object.assign(n=>{let a=global.process.listeners("uncaughtException").filter(o=>o.name!=="domainUncaughtExceptionClear"&&o._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t())},{_posthogErrorHandler:!0})}function pAC(e,t){global.process.on("uncaughtException",dAC(e,t))}function _AC(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var pSu,kmy,_Su;function hAC(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return _Su&&r.length===kmy||(kmy=r.length,_Su=r.reduce((n,i)=>{pSu||(pSu={});let a=pSu[i];if(a)n[a[0]]=a[1];else{let o=e(i);for(let c=o.length-1;c>=0;c--){let u=o[c]?.filename,s=t[i];if(u&&s){n[u]=s,pSu[i]=[u,s];break}}}return n},{})),_Su}function yAC(e){return typeof Event<"u"&&DOy(e,Event)}function vAC(e){return COy(e,"Object")}function Bmf(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return DOy(e,Error)}}function DOy(e,t){try{return e instanceof t}catch{return!1}}function bAC(e){return COy(e,"ErrorEvent")}function COy(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function gAC(e,t,r,n){let a=n&&n.mechanism||{handled:!0,type:"generic"},o=IOy(a,r,n);return{$exception_list:await Promise.all(o.map(async u=>{let s=await EAC(e,t,u);return s.value=s.value||"",s.type=s.type||"Error",s.mechanism=a,s}))}}function IOy(e,t,r){let n=mAC(e,t,r);return n.cause?[n,...IOy(e,n.cause,r)]:[n]}function mAC(e,t,r){if(Bmf(t))return t;if(e.synthetic=!0,vAC(t)){let i=OAC(t);if(i)return i;let a=AAC(t),o=r?.syntheticException||new Error(a);return o.message=a,o}let n=r?.syntheticException||new Error(t);return n.message=`${t}`,n}function OAC(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(Bmf(r))return r}}function AAC(e){if("name"in e&&typeof e.name=="string"){let n=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(n+=` with message '${e.message}'`),n}else if("message"in e&&typeof e.message=="string")return e.message;let t=wAC(e);if(bAC(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=PAC(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function PAC(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function wAC(e,t=40){let r=Object.keys(jAC(e));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=t)return eOy(n,t);for(let i=r.length;i>0;i--){let a=r.slice(0,i).join(", ");if(!(a.length>t))return i===r.length?a:eOy(a,t)}return""}function eOy(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function jAC(e){return Bmf(e)?{message:e.message,name:e.name,stack:e.stack,...tOy(e)}:yAC(e)?{type:e.type,target:rOy(e.target),currentTarget:rOy(e.currentTarget),...tOy(e)}:e}function tOy(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 rOy(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function EAC(e,t,r){let n={type:r.name||r.constructor.name,value:r.message},i=SAC(e,r);for(let a of t)i=await a(i);return i.length&&(n.stacktrace={frames:i,type:"raw"}),n}function SAC(e,t){return DAC(e(t.stack||"",1),e)}function DAC(e,t){let r=hAC(t);return e.forEach(n=>{n.filename&&(n.chunk_id=r[n.filename])}),e}var CAC=2e3,mZa=class e{static async captureException(t,r,n,i,a){let o={...a};i||(o.$process_person_profile=!1);let c=await gAC(this.stackParser,this.frameModifiers,r,n);t.capture({event:"$exception",distinctId:i||wmf(),properties:{...c,...o}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(pAC(this.onException.bind(this),this.onFatalError.bind(this)),_AC(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(CAC)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function IAC(e=process.argv[1]?(0,PZa.dirname)(process.argv[1]):process.cwd(),t=PZa.sep==="\\"){let r=t?nOy(e):e;return n=>{if(!n)return;let i=t?nOy(n):n,{dir:a,base:o,ext:c}=PZa.posix.parse(i);(c===".js"||c===".mjs"||c===".cjs")&&(o=o.slice(0,c.length*-1));let f=decodeURIComponent(o);a||(a=".");let u=a.lastIndexOf("/node_modules");if(u>-1)return`${a.slice(u+14).replace(/\//g,".")}:${f}`;if(a.startsWith(r)){let s=a.slice(r.length+1).replace(/\//g,".");return s?`${s}:${f}`:f}return f}}function nOy(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var gSu=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)}}},ySu=new gSu(25),MOy=new gSu(20),Tmf=7,MAC=1e3,BAC=1e4;async function TAC(e){let t={};for(let i=e.length-1;i>=0;i--){let a=e[i],o=a?.filename;if(!a||typeof o!="string"||typeof a.lineno!="number"||FAC(o)||xAC(a))continue;t[o]||(t[o]=[]),t[o].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(MOy.get(i))continue;let a=t[i];if(!a)continue;a.sort((f,u)=>f-u);let o=QAC(a);if(o.every(f=>zAC(i,f)))continue;let c=LAC(ySu,i,{});n.push(qAC(i,o,c))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&RAC(e,ySu),ySu.reduce(),e}function qAC(e,t,r){return new Promise(n=>{let i=(0,EOy.createReadStream)(e),a=(0,SOy.createInterface)({input:i});function o(){i.destroy(),n()}let c=0,f=0,u=t[f];if(u===void 0){o();return}let s=u[0],l=u[1];function m(){MOy.set(e,1),a.close(),a.removeAllListeners(),o()}i.on("error",m),a.on("error",m),a.on("close",o),a.on("line",O=>{if(c++,!(c<s)&&(r[c]=UAC(O,0),c>=l)){if(f===t.length-1){a.close(),a.removeAllListeners();return}f++;let P=t[f];if(P===void 0){a.close(),a.removeAllListeners();return}s=P[0],l=P[1]}})})}function RAC(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;NAC(r.lineno,r,n)}}function NAC(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=BOy(e);i<e;i++){let a=r[i];if(a===void 0){iOy(t);return}t.pre_context.push(a)}if(r[e]===void 0){iOy(t);return}t.context_line=r[e];let n=TOy(e);t.post_context=[];for(let i=e+1;i<=n;i++){let a=r[i];if(a===void 0)break;t.post_context.push(a)}}function iOy(e){delete e.pre_context,delete e.context_line,delete e.post_context}function FAC(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function xAC(e){return e.lineno!==void 0&&e.lineno>BAC||e.colno!==void 0&&e.colno>MAC}function zAC(e,t){let r=ySu.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function QAC(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=aOy(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let a=e[t+1];if(typeof a!="number")break;a<=n[1]?n[1]=a+Tmf:(i.push(n),n=aOy(a)),t++}return i}function aOy(e){return[BOy(e),TOy(e)]}function BOy(e){return Math.max(1,e-Tmf)}function TOy(e){return e+Tmf}function LAC(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function UAC(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let a=Math.min(i+140,n);return a>n-5&&(a=n),a===n&&(i=Math.max(a-140,0)),r=r.slice(i,a),i>0&&(r=`...${r}`),a<n&&(r+="..."),r}var VAC="4.18.0",lxe;(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"})(lxe||(lxe={}));var oOy;(function(e){e.Left="left",e.Right="right",e.Center="center"})(oOy||(oOy={}));var sOy;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(sOy||(sOy={}));var uOy;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(uOy||(uOy={}));var cOy;(function(e){e.Html="html",e.Text="text"})(cOy||(cOy={}));var lOy;(function(e){e.Number="number",e.Emoji="emoji"})(lOy||(lOy={}));var fOy;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(fOy||(fOy={}));var dOy;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(dOy||(dOy={}));var pOy;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(pOy||(pOy={}));var _Oy;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(_Oy||(_Oy={}));var WAC=e=>{if("flags"in e){let t=HAC(e.flags),r=JAC(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,a])=>[i,qOy(a)])),n=Object.fromEntries(Object.entries(t).map(([i,a])=>[i,GAC(i,a,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function GAC(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 HAC=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,qmf(r)]).filter(([,t])=>t!==void 0)),JAC=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let n=t[r];return n.enabled&&n.metadata&&n.metadata.payload!==void 0}).map(r=>{let n=t[r].metadata?.payload;return[r,n?qOy(n):void 0]}))},qmf=e=>e===void 0?void 0:e.variant??e.enabled,qOy=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},KAC=1,$AC=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"]),YAC="utf8";function XAC(e,t){if(!e||typeof e!="string"||ZAC(e))throw new Error(t)}function ZAC(e){return e.trim().length===0}function kAC(e){return e?.replace(/\/+$/,"")}async function ePC(e,t){let r=null;for(let n=0;n<t.retryCount+1;n++){n>0&&await new Promise(i=>setTimeout(i,t.retryDelay));try{return await e()}catch(i){if(r=i,!t.retryCheck(i))throw i}}throw r}function hOy(){return new Date().getTime()}function Omf(){return new Date().toISOString()}function mSu(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function tPC(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function rPC(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 nPC(e,t=0,r){let n=rPC(e);return r?.has(n)?!1:parseInt(n,16)/4294967295<t}function yOy(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var xKo=String.fromCharCode,vOy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",hSu={};function iPC(e,t){if(!hSu[e]){hSu[e]={};for(let r=0;r<e.length;r++)hSu[e][e.charAt(r)]=r}return hSu[e][t]}var bZa={compressToBase64:function(e){if(e==null)return"";let t=bZa._compress(e,6,function(r){return vOy.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:bZa._decompress(e.length,32,function(t){return iPC(vOy,e.charAt(t))})},compress:function(e){return bZa._compress(e,16,function(t){return xKo(t)})},_compress:function(e,t,r){if(e==null)return"";let n={},i={},a=[],o,c,f="",u="",s="",l=2,m=3,O=2,P=0,C=0,M;for(M=0;M<e.length;M+=1)if(f=e.charAt(M),Object.prototype.hasOwnProperty.call(n,f)||(n[f]=m++,i[f]=!0),u=s+f,Object.prototype.hasOwnProperty.call(n,u))s=u;else{if(Object.prototype.hasOwnProperty.call(i,s)){if(s.charCodeAt(0)<256){for(o=0;o<O;o++)P=P<<1,C==t-1?(C=0,a.push(r(P)),P=0):C++;for(c=s.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<O;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=s.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,O),O++),delete i[s]}else for(c=n[s],o=0;o<O;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,O),O++),n[u]=m++,s=String(f)}if(s!==""){if(Object.prototype.hasOwnProperty.call(i,s)){if(s.charCodeAt(0)<256){for(o=0;o<O;o++)P=P<<1,C==t-1?(C=0,a.push(r(P)),P=0):C++;for(c=s.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<O;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=s.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,O),O++),delete i[s]}else for(c=n[s],o=0;o<O;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,O),O++)}for(c=2,o=0;o<O;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;for(;;)if(P=P<<1,C==t-1){a.push(r(P));break}else C++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:bZa._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let n=[],i=[],a={val:r(0),position:t,index:1},o=4,c=4,f=3,u="",s,l,m,O,P,C,M;for(s=0;s<3;s+=1)n[s]=s;for(m=0,P=Math.pow(2,2),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;switch(m){case 0:for(m=0,P=Math.pow(2,8),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;M=xKo(m);break;case 1:for(m=0,P=Math.pow(2,16),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;M=xKo(m);break;case 2:return""}for(n[3]=M,l=M,i.push(M);;){if(a.index>e)return"";for(m=0,P=Math.pow(2,f),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;switch(M=m){case 0:for(m=0,P=Math.pow(2,8),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;n[c++]=xKo(m),M=c-1,o--;break;case 1:for(m=0,P=Math.pow(2,16),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;n[c++]=xKo(m),M=c-1,o--;break;case 2:return i.join("")}if(o==0&&(o=Math.pow(2,f),f++),n[M])u=n[M];else if(M===c)u=l+l.charAt(0);else return null;i.push(u),n[c++]=l+u.charAt(0),o--,l=u,o==0&&(o=Math.pow(2,f),f++)}}},jmf=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(n=>n!==r)}}emit(t,r){for(let n of this.events[t]||[])n(r);for(let n of this.events["*"]||[])n(t,r)}},OZa=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()}},zKo=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function bOy(e){if(e instanceof OZa){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 Amf(e){return typeof e=="object"&&(e instanceof OZa||e instanceof zKo)}function gOy(e){return typeof e=="object"&&e instanceof OZa&&e.status===413}var Emf;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(Emf||(Emf={}));var Smf=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new jmf,this._isInitialized=!1,XAC(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=kAC(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:Amf},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(lxe.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(lxe.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(lxe.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(n,i)=>console.log("PostHog Debug",n,i));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=wmf();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,n){this.wrap(()=>{let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",i,n)})}async identifyStatelessImmediate(t,r,n){let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",i,n)}captureStateless(t,r,n,i){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:n});this.enqueue("capture",a,i)})}async captureStatelessImmediate(t,r,n,i){let a=this.buildPayload({distinct_id:t,event:r,properties:n});await this.sendImmediate("capture",a,i)}aliasStateless(t,r,n,i){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});this.enqueue("alias",a,i)})}async aliasStatelessImmediate(t,r,n,i){let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",a,i)}groupIdentifyStateless(t,r,n,i,a,o){this.wrap(()=>{let c=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...o||{}}});this.enqueue("capture",c,i)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,n,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(i=>i.json()).catch(i=>{this.logMsgIfDebug(()=>console.error("Remote config could not be loaded",i)),this._events.emit("error",i)})}async getDecide(t,r={},n={},i={},a={}){await this._initPromise;let c=nPC(this.apiKey,KAC,$AC)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,f={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...a})};return this.logMsgIfDebug(()=>console.log("PostHog Debug","Decide URL",c)),this.fetchWithRetry(c,f,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(u=>u.json()).then(u=>WAC(u)).catch(u=>{this._events.emit("error",u)})}async getFeatureFlagStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailStateless(t,r,n,i,a,o);if(c===void 0)return{response:void 0,requestId:void 0};let f=qmf(c.response);return f===void 0&&(f=!1),{response:f,requestId:c.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(r,n,i,a,o,[t]);return c===void 0?void 0:{response:c.flags[t],requestId:c.requestId}}async getFeatureFlagPayloadStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagPayloadsStateless(r,n,i,a,o,[t]);if(!c)return;let f=c[t];return f===void 0?null:f}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},a,o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},a,o){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(t,r,n,i,a,o);return c?{flags:c.featureFlags,payloads:c.featureFlagPayloads,requestId:c.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c={};(a??this.disableGeoip)&&(c.geoip_disable=!0),o&&(c.flag_keys_to_evaluate=o);let f=await this.getDecide(t,r,n,i,c);if(f!==void 0)return f.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),f.quotaLimited?.includes(Emf.FeatureFlags)?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:f?.requestId}):f}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this.logMsgIfDebug(()=>console.log("PostHog Debug","Loading surveys is disabled.")),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},i=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let o=`Surveys API could not be loaded: ${a.status}`,c=new Error(o);this.logMsgIfDebug(()=>console.error(c)),this._events.emit("error",new Error(o));return}return a.json()}).catch(a=>{this.logMsgIfDebug(()=>console.error("Surveys API could not be loaded",a)),this._events.emit("error",a)}))?.surveys;return i&&this.logMsgIfDebug(()=>console.log("PostHog Debug","Surveys fetched from API: ",JSON.stringify(i))),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(lxe.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(lxe.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(lxe.Props,this.props)})}enqueue(t,r,n){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let i=this.prepareMessage(t,r,n),a=this.getPersistedProperty(lxe.Queue)||[];a.length>=this.maxQueueSize&&(a.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),a.push({message:i}),this.setPersistedProperty(lxe.Queue,a),this._events.emit(t,i),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=mSu(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,n){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized||await this._initPromise,this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let i={api_key:this.apiKey,batch:[this.prepareMessage(t,r,n)],sent_at:Omf()};this.historicalMigration&&(i.historical_migration=!0);let a=JSON.stringify(i),o=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${hOy()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,c=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(bZa.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(o,c)}catch(f){this._events.emit("error",f)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:Omf(),uuid:n?.uuid?n.uuid:wmf()};return(n?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await bOy(t)})}async flush(){let t=yOy([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),yOy([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(lxe.Queue)||[];if(!t.length)return;let r=[],n=t.length;for(;t.length>0&&r.length<n;){let i=t.slice(0,this.maxBatchSize),a=i.map(m=>m.message),o=()=>{let O=(this.getPersistedProperty(lxe.Queue)||[]).slice(i.length);this.setPersistedProperty(lxe.Queue,O),t=O},c={api_key:this.apiKey,batch:a,sent_at:Omf()};this.historicalMigration&&(c.historical_migration=!0);let f=JSON.stringify(c),u=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${hOy()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,s=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(bZa.compressToBase64(f))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:f},l={retryCheck:m=>gOy(m)?!1:Amf(m)};try{await this.fetchWithRetry(u,s,l)}catch(m){if(gOy(m)&&a.length>1){this.maxBatchSize=Math.max(1,Math.floor(a.length/2)),this.logMsgIfDebug(()=>console.warn(`Received 413 when sending batch of size ${a.length}, reducing batch size to ${this.maxBatchSize}`));continue}throw m instanceof zKo||o(),this._events.emit("error",m),m}o(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){var a;(a=AbortSignal).timeout??(a.timeout=function(u){let s=new AbortController;return setTimeout(()=>s.abort(),u),s.signal});let o=r.body?r.body:"",c=-1;try{c=Buffer.byteLength(o,YAC)}catch{c=new TextEncoder().encode(o).length}return await ePC(async()=>{let f=null;try{f=await this.fetch(t,{signal:AbortSignal.timeout(i??this.requestTimeout),...r})}catch(s){throw new zKo(s)}if(!(r.mode==="no-cors")&&(f.status<200||f.status>=400))throw new OZa(f,c);return f},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let n=async()=>{try{for(await Promise.all(Object.values(this.pendingPromises));!((this.getPersistedProperty(lxe.Queue)||[]).length===0||(await this.flush(),r)););}catch(i){if(!Amf(i))throw i;await bOy(i)}};return Promise.race([new Promise((i,a)=>{mSu(()=>{this.logMsgIfDebug(()=>console.error("Timed out while shutting down PostHog")),r=!0,a("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),n()])}async shutdown(t=3e4){return this.shutdownPromise?this.logMsgIfDebug(()=>console.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup")):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}},Dmf=tPC();if(!Dmf){let e=Ymy();Dmf=async(t,r)=>{let n=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:n.status,text:async()=>n.data,json:async()=>n.data}}}var ROy=Dmf,OSu=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()}},NOy=new OSu(async()=>{try{return await import("crypto")}catch{return}});async function aPC(){return await NOy.getValue()}var oPC=new OSu(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await NOy.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function sPC(){return await oPC.getValue()}async function uPC(e){let t=await aPC();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await sPC();if(r){let n=await r.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(n)).map(a=>a.toString(16).padStart(2,"0")).join("")}throw new Error("No crypto implementation available. Tried Node Crypto API and Web SubtleCrypto API")}var cPC=60*1e3,lPC=1152921504606847e3,fPC=["is_not"],gZa=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},wse=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Cmf=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:a,customHeaders:o,...c}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=a,this.poller=void 0,this.fetch=c.fetch||ROy,this.onError=c.onError,this.customHeaders=o,this.onLoad=c.onLoad,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,n={},i={},a={}){await this.loadFeatureFlags();let o,c;if(!this.loadedSuccessfullyOnce)return o;for(let f of this.featureFlags)if(t===f.key){c=f;break}if(c!==void 0)try{o=await this.computeFlagLocally(c,r,n,i,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${o}`))}catch(f){f instanceof wse?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${f}`)):f instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${f}`))}return o}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let n;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),n==null)return null;try{return JSON.parse(n)}catch{return n}}}async getAllFlagsAndPayloads(t,r={},n={},i={}){await this.loadFeatureFlags();let a={},o={},c=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async f=>{try{let u=await this.computeFlagLocally(f,t,r,n,i);a[f.key]=u;let s=await this.computeFeatureFlagPayloadLocally(f.key,u);s&&(o[f.key]=s)}catch(u){u instanceof wse||u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${f.key}: ${u}`)),c=!0}})),{response:a,payloads:o,fallbackToDecide:c}}async computeFlagLocally(t,r,n={},i={},a={}){if(t.ensure_experience_continuity)throw new wse("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let f=this.groupTypeMapping[String(c)];if(!f)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new wse("Flag has unknown group type index");if(!(f in n))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let u=a[f];return await this.matchFeatureFlagProperties(t,n[f],u)}else return await this.matchFeatureFlagProperties(t,r,i)}async matchFeatureFlagProperties(t,r,n){let i=t.filters||{},a=i.groups||[],o=!1,c,f=[...a].sort((u,s)=>{let l=!!u.variant,m=!!s.variant;return l&&m?0:l?-1:m?1:0});for(let u of f)try{if(await this.isConditionMatch(t,r,u,n)){let s=u.variant,l=i.multivariate?.variants||[];s&&l.some(m=>m.key===s)?c=s:c=await this.getMatchingVariant(t,r)||!0;break}}catch(s){if(s instanceof wse)o=!0;else throw s}if(c!==void 0)return c;if(o)throw new wse("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i){let a=n.rollout_percentage,o=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let f=c.type,u=!1;if(f==="cohort"?u=xOy(c,i,this.cohorts,this.debugMode):u=FOy(c,i,o),!u)return!1}if(a==null)return!0}return!(a!=null&&await mOy(t.key,r)>a/100)}async getMatchingVariant(t,r){let n=await mOy(t.key,r,"variant"),i=this.variantLookupTable(t).find(a=>n>=a.valueMin&&n<a.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(c=>{i=n+c.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:c.key}),n=i}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(cPC,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 gZa(`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 gZa(`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 gZa(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let r=await t.json()??{};if(!("flags"in r)){this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`));return}this.featureFlags=r.flags??[],this.featureFlagsByKey=this.featureFlags.reduce((n,i)=>(n[i.key]=i,n),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||{},this.loadedSuccessfullyOnce=!0,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.onLoad?.(this.featureFlags.length);break}default:return}}catch(t){t instanceof gZa&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET"){return{method:t,headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions(),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=mSu(()=>{i.abort()},this.timeout),r.signal=i.signal}try{return await this.fetch(t,r)}finally{clearTimeout(n)}}stopPoller(){clearTimeout(this.poller)}_requestRemoteConfigPayload(t){let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config/`,n=this.getPersonalApiKeyRequestOptions(),i=null;if(this.timeout&&typeof this.timeout=="number"){let a=new AbortController;i=mSu(()=>{a.abort()},this.timeout),n.signal=a.signal}try{return this.fetch(r,n)}finally{clearTimeout(i)}}};async function mOy(e,t,r=""){let n=await uPC(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/lPC}function FOy(e,t,r){let n=e.key,i=e.value,a=e.operator||"exact";if(n in t){if(a==="is_not_set")throw new wse("Operator is_not_set is not supported")}else throw new wse(`Property ${n} not found in propertyValues`);let o=t[n];if(o==null&&!fPC.includes(a))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${a} operator`),!1;function c(u,s){return Array.isArray(u)?u.map(l=>String(l).toLowerCase()).includes(String(s).toLowerCase()):String(u).toLowerCase()===String(s).toLowerCase()}function f(u,s,l){if(l==="gt")return u>s;if(l==="gte")return u>=s;if(l==="lt")return u<s;if(l==="lte")return u<=s;throw new Error(`Invalid operator: ${l}`)}switch(a){case"exact":return c(i,o);case"is_not":return!c(i,o);case"is_set":return n in t;case"icontains":return String(o).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(i).toLowerCase());case"regex":return OOy(String(i))&&String(o).match(String(i))!==null;case"not_regex":return OOy(String(i))&&String(o).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let u=typeof i=="number"?i:null;if(typeof i=="string")try{u=parseFloat(i)}catch{}return u!=null&&o!=null?typeof o=="string"?f(o,String(i),a):f(o,u,a):f(String(o),String(i),a)}case"is_date_after":case"is_date_before":{let u=dPC(String(i));if(u==null&&(u=AOy(i)),u==null)throw new wse(`Invalid date: ${i}`);let s=AOy(o);return["is_date_before"].includes(a)?s<u:s>u}default:throw new wse(`Unknown operator: ${a}`)}}function xOy(e,t,r,n=!1){let i=String(e.value);if(!(i in r))throw new wse("can't match cohort without a given cohort property value");let a=r[i];return zOy(a,t,r,n)}function zOy(e,t,r,n=!1){if(!e)return!0;let i=e.type,a=e.values;if(!a||a.length===0)return!0;let o=!1;if("values"in a[0]){for(let c of a)try{let f=zOy(c,t,r,n);if(i==="AND"){if(!f)return!1}else if(f)return!0}catch(f){if(f instanceof wse)n&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new wse("Can't match cohort without a given cohort property value");return i==="AND"}else{for(let c of a)try{let f;c.type==="cohort"?f=xOy(c,t,r,n):f=FOy(c,t);let u=c.negation||!1;if(i==="AND"){if(!f&&!u||f&&u)return!1}else if(f&&!u||!f&&u)return!0}catch(f){if(f instanceof wse)n&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new wse("can't match cohort without a given cohort property value");return i==="AND"}}function OOy(e){try{return new RegExp(e),!0}catch{return!1}}function AOy(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 wse(`${e} is in an invalid date format`)}else throw new wse(`The date provided ${e} must be a string, number, or date object`)}function dPC(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let a=r.groups.interval;if(a=="h")n.setUTCHours(n.getUTCHours()-i);else if(a=="d")n.setUTCDate(n.getUTCDate()-i);else if(a=="w")n.setUTCDate(n.getUTCDate()-i*7);else if(a=="m")n.setUTCMonth(n.getUTCMonth()-i);else if(a=="y")n.setUTCFullYear(n.getUTCFullYear()-i);else return null;return n}else return null}var Imf=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},pPC=100,POy=30*1e3,_PC=50*1e3,Mmf=class extends Smf{constructor(t,r={}){if(super(t,r),this._memoryStorage=new Imf,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,pPC):POy,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 Cmf({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:n=>{this._events.emit("error",n)},onLoad:n=>{this._events.emit("localEvaluationFlagsLoaded",n)},customHeaders:this.getCustomHeaders()})}this.errorTracking=new mZa(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||_PC}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):ROy(t,r)}getLibraryVersion(){return VAC}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:n,properties:i,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:f,uuid:u}=t,s=O=>{super.captureStateless(r,n,O,{timestamp:c,disableGeoip:f,uuid:u})},l=async(O,P,C)=>(await super.getFeatureFlagsStateless(O,P,void 0,void 0,C)).flags,m=Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let O={};for(let[P,C]of Object.entries(a||{}))O[P]=String(C);return await this.getAllFlags(r,{groups:O,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(O=>{let P={};if(O)for(let[M,T]of Object.entries(O))P[`$feature/${M}`]=T;let C=Object.keys(O||{}).filter(M=>O?.[M]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(O=>{s({...O,...i,$groups:a})});this.addPendingPromise(m)}async captureImmediate(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:n,properties:i,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:f,uuid:u}=t,s=O=>super.captureStatelessImmediate(r,n,O,{timestamp:c,disableGeoip:f,uuid:u}),l=async(O,P,C)=>(await super.getFeatureFlagsStateless(O,P,void 0,void 0,C)).flags;await Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let O={};for(let[P,C]of Object.entries(a||{}))O[P]=String(C);return await this.getAllFlags(r,{groups:O,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(O=>{let P={};if(O)for(let[M,T]of Object.entries(O))P[`$feature/${M}`]=T;let C=Object.keys(O||{}).filter(M=>O?.[M]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(O=>{s({...O,...i,$groups:a})})}identify({distinctId:t,properties:r,disableGeoip:n}){let i=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;super.identifyStateless(t,{$set:a,$set_once:i},{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r,disableGeoip:n}){let i=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;await super.identifyStatelessImmediate(t,{$set:a,$set_once:i},{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=POy){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(n),i(),r(a>0)})})}async getFeatureFlag(t,r,n){let{groups:i,disableGeoip:a}=n||{},{onlyEvaluateLocally:o,sendFeatureFlagEvents:c,personProperties:f,groupProperties:u}=n||{},s=this.addLocalPersonAndGroupProperties(r,i,f,u);f=s.allPersonProperties,u=s.allGroupProperties,o==null&&(o=!1),c==null&&(c=!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,i,f,u),m=l!==void 0,O,P;if(!m&&!o){let M=await super.getFeatureFlagDetailStateless(t,r,i,f,u,a);if(M===void 0)return;P=M.response,l=qmf(P),O=M?.requestId}let C=`${t}_${l}`;return c&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(C))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(C):this.distinctIdHasSentFlagCalls[r]=[C],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:l,$feature_flag_id:P?.metadata?.id,$feature_flag_version:P?.metadata?.version,$feature_flag_reason:P?.reason?.description??P?.reason?.code,locally_evaluated:m,[`$feature/${t}`]:l,$feature_flag_request_id:O},groups:i,disableGeoip:a})),l}async getFeatureFlagPayload(t,r,n,i){let{groups:a,disableGeoip:o}=i||{},{onlyEvaluateLocally:c,sendFeatureFlagEvents:f,personProperties:u,groupProperties:s}=i||{},l=this.addLocalPersonAndGroupProperties(r,a,u,s);u=l.allPersonProperties,s=l.allGroupProperties;let m;return this.featureFlagsPoller!==void 0&&(n||(n=await this.getFeatureFlag(t,r,{...i,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),n&&(m=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,n))),c==null&&(c=!1),f==null&&(f=!0),c==null&&(c=!1),!(m!==void 0)&&!c&&(m=await super.getFeatureFlagPayloadStateless(t,r,a,u,s,o)),m}async getRemoteConfigPayload(t){return(await this.featureFlagsPoller?._requestRemoteConfigPayload(t))?.json()}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:n,disableGeoip:i}=r||{},{onlyEvaluateLocally:a,personProperties:o,groupProperties:c}=r||{},f=this.addLocalPersonAndGroupProperties(t,n,o,c);o=f.allPersonProperties,c=f.allGroupProperties,a==null&&(a=!1);let u=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,n,o,c),s={},l={},m=!0;if(u&&(s=u.response,l=u.payloads,m=u.fallbackToDecide),m&&!a){let O=await super.getFeatureFlagsAndPayloadsStateless(t,n,o,c,i);s={...s,...O.flags||{}},l={...l,...O.payloads||{}}}return{featureFlags:s,featureFlagPayloads:l}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:a}){super.groupIdentifyStateless(t,r,n,{disableGeoip:a},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(),super._shutdown(t)}addLocalPersonAndGroupProperties(t,r,n,i){let a={distinct_id:t,...n||{}},o={};if(r)for(let c of Object.keys(r))o[c]={$group_key:r[c],...i?.[c]||{}};return{allPersonProperties:a,allGroupProperties:o}}captureException(t,r,n){let i=new Error("PostHog syntheticException");mZa.captureException(this,t,{syntheticException:i},r,n)}},wOy=/\(error: (.*)\)/,QOy=50,LOy="?";function hPC(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return n=>{let i=n.match(r);if(i){let a,o,c,f,u;if(i[1]){c=i[1];let m=c.lastIndexOf(".");if(c[m-1]==="."&&m--,m>0){a=c.slice(0,m),o=c.slice(m+1);let O=a.indexOf(".Module");O>0&&(c=c.slice(O+1),a=a.slice(0,O))}f=void 0}o&&(f=a,u=o),o==="<anonymous>"&&(u=void 0,c=void 0),c===void 0&&(u=u||LOy,c=f?`${f}.${u}`:u);let s=i[2]?.startsWith("file://")?i[2].slice(7):i[2],l=i[5]==="native";return s?.match(/\/[A-Z]:/)&&(s=s.slice(1)),!s&&i[5]&&!l&&(s=i[5]),{filename:s?decodeURI(s):void 0,module:e?e(s):void 0,function:c,lineno:jOy(i[3]),colno:jOy(i[4]),in_app:yPC(s||"",l),platform:"node:javascript"}}if(n.match(t))return{filename:n,platform:"node:javascript"}}}function yPC(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 jOy(e){return parseInt(e||"",10)||void 0}function vPC(e){return[90,hPC(e)]}function bPC(e){let r=[vPC(e)].sort((n,i)=>n[0]-i[0]).map(n=>n[1]);return(n,i=0)=>{let a=[],o=n.split(`
2440
- `);for(let c=i;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let u=wOy.test(f)?f.replace(wOy,"$1"):f;if(!u.match(/\S*Error: /)){for(let s of r){let l=s(u);if(l){a.push(l);break}}if(a.length>=QOy)break}}return gPC(a)}}function gPC(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,QOy).map(r=>({...r,filename:r.filename||mPC(t).filename,function:r.function||LOy}))}function mPC(e){return e[e.length-1]||{}}mZa.stackParser=bPC(IAC());mZa.frameModifiers=[TAC];var AZa=class extends Mmf{getLibraryId(){return"posthog-node"}};var ASu=class{posthog;constructor({posthogApiKey:t}){this.posthog=new AZa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.120.0",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var QKo=class{async sendEvent(){}async identify(){}async flush(){}};var wZa=require("fs/promises"),GOy=require("os"),HOy=require("path");var UOy=Hi(require("crypto")),wSu=new Uint8Array(256),PSu=wSu.length;function Rmf(){return PSu>wSu.length-16&&(UOy.default.randomFillSync(wSu),PSu=0),wSu.slice(PSu,PSu+=16)}var Kve=[];for(let e=0;e<256;++e)Kve.push((e+256).toString(16).slice(1));function VOy(e,t=0){return Kve[e[t+0]]+Kve[e[t+1]]+Kve[e[t+2]]+Kve[e[t+3]]+"-"+Kve[e[t+4]]+Kve[e[t+5]]+"-"+Kve[e[t+6]]+Kve[e[t+7]]+"-"+Kve[e[t+8]]+Kve[e[t+9]]+"-"+Kve[e[t+10]]+Kve[e[t+11]]+Kve[e[t+12]]+Kve[e[t+13]]+Kve[e[t+14]]+Kve[e[t+15]]}var WOy=Hi(require("crypto")),Nmf={randomUUID:WOy.default.randomUUID};function OPC(e,t,r){if(Nmf.randomUUID&&!t&&!e)return Nmf.randomUUID();e=e||{};let n=e.random||(e.rng||Rmf)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return VOy(n)}var Frt=OPC;var APC="id",PPC=".fern",LKo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new AZa(r),this.userId=t==null?void 0:n_f(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.120.0",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ql(F_.of((0,GOy.homedir)()),eu.of(PPC),eu.of(APC));await Vv(t)||(await(0,wZa.mkdir)((0,HOy.dirname)(t),{recursive:!0}),await(0,wZa.writeFile)(t,Frt())),this.persistedDistinctId=(await(0,wZa.readFile)(t)).toString()}return this.persistedDistinctId}};var Fmf;async function jZa(){return Fmf==null&&(Fmf=await wPC()),Fmf}async function wPC(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new QKo;let r=await LOu();return r!=null?new LKo({token:r,posthogApiKey:e}):await DYa()!=null?new ASu({posthogApiKey:e}):new LKo({token:void 0,posthogApiKey:e})}catch{return new QKo}}function UKo(e,t){return function(){return e.apply(t,arguments)}}var{toString:jPC}=Object.prototype,{getPrototypeOf:zmf}=Object,{iterator:ESu,toStringTag:KOy}=Symbol,SSu=(e=>t=>{let r=jPC.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),YTr=e=>(e=e.toLowerCase(),t=>SSu(t)===e),DSu=e=>t=>typeof t===e,{isArray:SZa}=Array,EZa=DSu("undefined");function VKo(e){return e!==null&&!EZa(e)&&e.constructor!==null&&!EZa(e.constructor)&&fxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var $Oy=YTr("ArrayBuffer");function EPC(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&$Oy(e.buffer),t}var SPC=DSu("string"),fxe=DSu("function"),YOy=DSu("number"),WKo=e=>e!==null&&typeof e=="object",DPC=e=>e===!0||e===!1,jSu=e=>{if(SSu(e)!=="object")return!1;let t=zmf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(KOy in e)&&!(ESu in e)},CPC=e=>{if(!WKo(e)||VKo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},IPC=YTr("Date"),MPC=YTr("File"),BPC=YTr("Blob"),TPC=YTr("FileList"),qPC=e=>WKo(e)&&fxe(e.pipe),RPC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||fxe(e.append)&&((t=SSu(e))==="formdata"||t==="object"&&fxe(e.toString)&&e.toString()==="[object FormData]"))},NPC=YTr("URLSearchParams"),[FPC,xPC,zPC,QPC]=["ReadableStream","Request","Response","Headers"].map(YTr),LPC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function GKo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),SZa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(VKo(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(n=0;n<o;n++)c=a[n],t.call(null,e[c],c,e)}}function XOy(e,t){if(VKo(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var mua=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ZOy=e=>!EZa(e)&&e!==mua;function xmf(){let{caseless:e,skipUndefined:t}=ZOy(this)&&this||{},r={},n=(i,a)=>{let o=e&&XOy(r,a)||a;jSu(r[o])&&jSu(i)?r[o]=xmf(r[o],i):jSu(i)?r[o]=xmf({},i):SZa(i)?r[o]=i.slice():(!t||!EZa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&GKo(arguments[i],n);return r}var UPC=(e,t,r,{allOwnKeys:n}={})=>(GKo(t,(i,a)=>{r&&fxe(i)?e[a]=UKo(i,r):e[a]=i},{allOwnKeys:n}),e),VPC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),WPC=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},GPC=(e,t,r,n)=>{let i,a,o,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&zmf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},HPC=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},JPC=e=>{if(!e)return null;if(SZa(e))return e;let t=e.length;if(!YOy(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},KPC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&zmf(Uint8Array)),$PC=(e,t)=>{let n=(e&&e[ESu]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},YPC=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},XPC=YTr("HTMLFormElement"),ZPC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),JOy=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),kPC=YTr("RegExp"),kOy=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};GKo(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},ewC=e=>{kOy(e,(t,r)=>{if(fxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(fxe(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},twC=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return SZa(e)?n(e):n(String(e).split(t)),r},rwC=()=>{},nwC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function iwC(e){return!!(e&&fxe(e.append)&&e[KOy]==="FormData"&&e[ESu])}var awC=e=>{let t=new Array(10),r=(n,i)=>{if(WKo(n)){if(t.indexOf(n)>=0)return;if(VKo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=SZa(n)?[]:{};return GKo(n,(o,c)=>{let f=r(o,i+1);!EZa(f)&&(a[c]=f)}),t[i]=void 0,a}}return n};return r(e,0)},owC=YTr("AsyncFunction"),swC=e=>e&&(WKo(e)||fxe(e))&&fxe(e.then)&&fxe(e.catch),eAy=((e,t)=>e?setImmediate:t?((r,n)=>(mua.addEventListener("message",({source:i,data:a})=>{i===mua&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),mua.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",fxe(mua.postMessage)),uwC=typeof queueMicrotask<"u"?queueMicrotask.bind(mua):typeof process<"u"&&process.nextTick||eAy,cwC=e=>e!=null&&fxe(e[ESu]),Zf={isArray:SZa,isArrayBuffer:$Oy,isBuffer:VKo,isFormData:RPC,isArrayBufferView:EPC,isString:SPC,isNumber:YOy,isBoolean:DPC,isObject:WKo,isPlainObject:jSu,isEmptyObject:CPC,isReadableStream:FPC,isRequest:xPC,isResponse:zPC,isHeaders:QPC,isUndefined:EZa,isDate:IPC,isFile:MPC,isBlob:BPC,isRegExp:kPC,isFunction:fxe,isStream:qPC,isURLSearchParams:NPC,isTypedArray:KPC,isFileList:TPC,forEach:GKo,merge:xmf,extend:UPC,trim:LPC,stripBOM:VPC,inherits:WPC,toFlatObject:GPC,kindOf:SSu,kindOfTest:YTr,endsWith:HPC,toArray:JPC,forEachEntry:$PC,matchAll:YPC,isHTMLForm:XPC,hasOwnProperty:JOy,hasOwnProp:JOy,reduceDescriptors:kOy,freezeMethods:ewC,toObjectSet:twC,toCamelCase:ZPC,noop:rwC,toFiniteNumber:nwC,findKey:XOy,global:mua,isContextDefined:ZOy,isSpecCompliantForm:iwC,toJSONObject:awC,isAsyncFn:owC,isThenable:swC,setImmediate:eAy,asap:uwC,isIterable:cwC};function DZa(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Zf.inherits(DZa,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:Zf.toJSONObject(this.config),code:this.code,status:this.status}}});var tAy=DZa.prototype,rAy={};["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=>{rAy[e]={value:e}});Object.defineProperties(DZa,rAy);Object.defineProperty(tAy,"isAxiosError",{value:!0});DZa.from=(e,t,r,n,i,a)=>{let o=Object.create(tAy);Zf.toFlatObject(e,o,function(s){return s!==Error.prototype},u=>u!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return DZa.call(o,c,f,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var zm=DZa;var nAy=Hi(isa(),1),CSu=nAy.default;function Qmf(e){return Zf.isPlainObject(e)||Zf.isArray(e)}function aAy(e){return Zf.endsWith(e,"[]")?e.slice(0,-2):e}function iAy(e,t,r){return e?e.concat(t).map(function(i,a){return i=aAy(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function lwC(e){return Zf.isArray(e)&&!e.some(Qmf)}var fwC=Zf.toFlatObject(Zf,{},null,function(t){return/^is[A-Z]/.test(t)});function dwC(e,t,r){if(!Zf.isObject(e))throw new TypeError("target must be an object");t=t||new(CSu||FormData),r=Zf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!Zf.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||s,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&Zf.isSpecCompliantForm(t);if(!Zf.isFunction(i))throw new TypeError("visitor must be a function");function u(P){if(P===null)return"";if(Zf.isDate(P))return P.toISOString();if(Zf.isBoolean(P))return P.toString();if(!f&&Zf.isBlob(P))throw new zm("Blob is not supported. Use a Buffer instead.");return Zf.isArrayBuffer(P)||Zf.isTypedArray(P)?f&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function s(P,C,M){let T=P;if(P&&!M&&typeof P=="object"){if(Zf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Zf.isArray(P)&&lwC(P)||(Zf.isFileList(P)||Zf.endsWith(C,"[]"))&&(T=Zf.toArray(P)))return C=aAy(C),T.forEach(function(U,q){!(Zf.isUndefined(U)||U===null)&&t.append(o===!0?iAy([C],q,a):o===null?C:C+"[]",u(U))}),!1}return Qmf(P)?!0:(t.append(iAy(M,C,a),u(P)),!1)}let l=[],m=Object.assign(fwC,{defaultVisitor:s,convertValue:u,isVisitable:Qmf});function O(P,C){if(!Zf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Zf.forEach(P,function(T,z){(!(Zf.isUndefined(T)||T===null)&&i.call(t,T,Zf.isString(z)?z.trim():z,C,m))===!0&&O(T,C?C.concat(z):[z])}),l.pop()}}if(!Zf.isObject(e))throw new TypeError("data must be an object");return O(e),t}var y4i=dwC;function oAy(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function sAy(e,t){this._pairs=[],e&&y4i(e,this,t)}var uAy=sAy.prototype;uAy.append=function(t,r){this._pairs.push([t,r])};uAy.toString=function(t){let r=t?function(n){return t.call(this,n,oAy)}:oAy;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var cAy=sAy;function pwC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Oua(e,t,r){if(!t)return e;let n=r&&r.encode||pwC;Zf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Zf.isURLSearchParams(t)?t.toString():new cAy(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Lmf=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Zf.forEach(this.handlers,function(n){n!==null&&t(n)})}},Umf=Lmf;var CZa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var pAy=Hi(require("crypto"),1);var lAy=Hi(require("url"),1),fAy=lAy.default.URLSearchParams;var Vmf="abcdefghijklmnopqrstuvwxyz",dAy="0123456789",_Ay={DIGIT:dAy,ALPHA:Vmf,ALPHA_DIGIT:Vmf+Vmf.toUpperCase()+dAy},_wC=(e=16,t=_Ay.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);pAy.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},hAy={isNode:!0,classes:{URLSearchParams:fAy,FormData:CSu,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:_Ay,generateString:_wC,protocols:["http","https","file","data"]};var Hmf={};yf(Hmf,{hasBrowserEnv:()=>Gmf,hasStandardBrowserEnv:()=>hwC,hasStandardBrowserWebWorkerEnv:()=>ywC,navigator:()=>Wmf,origin:()=>vwC});var Gmf=typeof window<"u"&&typeof document<"u",Wmf=typeof navigator=="object"&&navigator||void 0,hwC=Gmf&&(!Wmf||["ReactNative","NativeScript","NS"].indexOf(Wmf.product)<0),ywC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vwC=Gmf&&window.location.href||"http://localhost";var J8={...Hmf,...hAy};function Jmf(e,t){return y4i(e,new J8.classes.URLSearchParams,{visitor:function(r,n,i,a){return J8.isNode&&Zf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function bwC(e){return Zf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function gwC(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function mwC(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&Zf.isArray(i)?i.length:o,f?(Zf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Zf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Zf.isArray(i[o])&&(i[o]=gwC(i[o])),!c)}if(Zf.isFormData(e)&&Zf.isFunction(e.entries)){let r={};return Zf.forEachEntry(e,(n,i)=>{t(bwC(n),i,r,0)}),r}return null}var ISu=mwC;function OwC(e,t,r){if(Zf.isString(e))try{return(t||JSON.parse)(e),Zf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Kmf={transitional:CZa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Zf.isObject(t);if(a&&Zf.isHTMLForm(t)&&(t=new FormData(t)),Zf.isFormData(t))return i?JSON.stringify(ISu(t)):t;if(Zf.isArrayBuffer(t)||Zf.isBuffer(t)||Zf.isStream(t)||Zf.isFile(t)||Zf.isBlob(t)||Zf.isReadableStream(t))return t;if(Zf.isArrayBufferView(t))return t.buffer;if(Zf.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Jmf(t,this.formSerializer).toString();if((c=Zf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return y4i(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),OwC(t)):t}],transformResponse:[function(t){let r=this.transitional||Kmf.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Zf.isResponse(t)||Zf.isReadableStream(t))return t;if(t&&Zf.isString(t)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?zm.from(c,zm.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:J8.classes.FormData,Blob:J8.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Zf.forEach(["delete","get","head","post","put","patch"],e=>{Kmf.headers[e]={}});var IZa=Kmf;var AwC=Zf.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"]),yAy=e=>{let t={},r,n,i;return e&&e.split(`
2440
+ `);for(let c=i;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let u=wOy.test(f)?f.replace(wOy,"$1"):f;if(!u.match(/\S*Error: /)){for(let s of r){let l=s(u);if(l){a.push(l);break}}if(a.length>=QOy)break}}return gPC(a)}}function gPC(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,QOy).map(r=>({...r,filename:r.filename||mPC(t).filename,function:r.function||LOy}))}function mPC(e){return e[e.length-1]||{}}mZa.stackParser=bPC(IAC());mZa.frameModifiers=[TAC];var AZa=class extends Mmf{getLibraryId(){return"posthog-node"}};var ASu=class{posthog;constructor({posthogApiKey:t}){this.posthog=new AZa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.120.1",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var QKo=class{async sendEvent(){}async identify(){}async flush(){}};var wZa=require("fs/promises"),GOy=require("os"),HOy=require("path");var UOy=Hi(require("crypto")),wSu=new Uint8Array(256),PSu=wSu.length;function Rmf(){return PSu>wSu.length-16&&(UOy.default.randomFillSync(wSu),PSu=0),wSu.slice(PSu,PSu+=16)}var Kve=[];for(let e=0;e<256;++e)Kve.push((e+256).toString(16).slice(1));function VOy(e,t=0){return Kve[e[t+0]]+Kve[e[t+1]]+Kve[e[t+2]]+Kve[e[t+3]]+"-"+Kve[e[t+4]]+Kve[e[t+5]]+"-"+Kve[e[t+6]]+Kve[e[t+7]]+"-"+Kve[e[t+8]]+Kve[e[t+9]]+"-"+Kve[e[t+10]]+Kve[e[t+11]]+Kve[e[t+12]]+Kve[e[t+13]]+Kve[e[t+14]]+Kve[e[t+15]]}var WOy=Hi(require("crypto")),Nmf={randomUUID:WOy.default.randomUUID};function OPC(e,t,r){if(Nmf.randomUUID&&!t&&!e)return Nmf.randomUUID();e=e||{};let n=e.random||(e.rng||Rmf)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return VOy(n)}var Frt=OPC;var APC="id",PPC=".fern",LKo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new AZa(r),this.userId=t==null?void 0:n_f(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.120.1",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ql(F_.of((0,GOy.homedir)()),eu.of(PPC),eu.of(APC));await Vv(t)||(await(0,wZa.mkdir)((0,HOy.dirname)(t),{recursive:!0}),await(0,wZa.writeFile)(t,Frt())),this.persistedDistinctId=(await(0,wZa.readFile)(t)).toString()}return this.persistedDistinctId}};var Fmf;async function jZa(){return Fmf==null&&(Fmf=await wPC()),Fmf}async function wPC(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new QKo;let r=await LOu();return r!=null?new LKo({token:r,posthogApiKey:e}):await DYa()!=null?new ASu({posthogApiKey:e}):new LKo({token:void 0,posthogApiKey:e})}catch{return new QKo}}function UKo(e,t){return function(){return e.apply(t,arguments)}}var{toString:jPC}=Object.prototype,{getPrototypeOf:zmf}=Object,{iterator:ESu,toStringTag:KOy}=Symbol,SSu=(e=>t=>{let r=jPC.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),YTr=e=>(e=e.toLowerCase(),t=>SSu(t)===e),DSu=e=>t=>typeof t===e,{isArray:SZa}=Array,EZa=DSu("undefined");function VKo(e){return e!==null&&!EZa(e)&&e.constructor!==null&&!EZa(e.constructor)&&fxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var $Oy=YTr("ArrayBuffer");function EPC(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&$Oy(e.buffer),t}var SPC=DSu("string"),fxe=DSu("function"),YOy=DSu("number"),WKo=e=>e!==null&&typeof e=="object",DPC=e=>e===!0||e===!1,jSu=e=>{if(SSu(e)!=="object")return!1;let t=zmf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(KOy in e)&&!(ESu in e)},CPC=e=>{if(!WKo(e)||VKo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},IPC=YTr("Date"),MPC=YTr("File"),BPC=YTr("Blob"),TPC=YTr("FileList"),qPC=e=>WKo(e)&&fxe(e.pipe),RPC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||fxe(e.append)&&((t=SSu(e))==="formdata"||t==="object"&&fxe(e.toString)&&e.toString()==="[object FormData]"))},NPC=YTr("URLSearchParams"),[FPC,xPC,zPC,QPC]=["ReadableStream","Request","Response","Headers"].map(YTr),LPC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function GKo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),SZa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(VKo(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(n=0;n<o;n++)c=a[n],t.call(null,e[c],c,e)}}function XOy(e,t){if(VKo(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var mua=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ZOy=e=>!EZa(e)&&e!==mua;function xmf(){let{caseless:e,skipUndefined:t}=ZOy(this)&&this||{},r={},n=(i,a)=>{let o=e&&XOy(r,a)||a;jSu(r[o])&&jSu(i)?r[o]=xmf(r[o],i):jSu(i)?r[o]=xmf({},i):SZa(i)?r[o]=i.slice():(!t||!EZa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&GKo(arguments[i],n);return r}var UPC=(e,t,r,{allOwnKeys:n}={})=>(GKo(t,(i,a)=>{r&&fxe(i)?e[a]=UKo(i,r):e[a]=i},{allOwnKeys:n}),e),VPC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),WPC=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},GPC=(e,t,r,n)=>{let i,a,o,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&zmf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},HPC=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},JPC=e=>{if(!e)return null;if(SZa(e))return e;let t=e.length;if(!YOy(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},KPC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&zmf(Uint8Array)),$PC=(e,t)=>{let n=(e&&e[ESu]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},YPC=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},XPC=YTr("HTMLFormElement"),ZPC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),JOy=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),kPC=YTr("RegExp"),kOy=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};GKo(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},ewC=e=>{kOy(e,(t,r)=>{if(fxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(fxe(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},twC=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return SZa(e)?n(e):n(String(e).split(t)),r},rwC=()=>{},nwC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function iwC(e){return!!(e&&fxe(e.append)&&e[KOy]==="FormData"&&e[ESu])}var awC=e=>{let t=new Array(10),r=(n,i)=>{if(WKo(n)){if(t.indexOf(n)>=0)return;if(VKo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=SZa(n)?[]:{};return GKo(n,(o,c)=>{let f=r(o,i+1);!EZa(f)&&(a[c]=f)}),t[i]=void 0,a}}return n};return r(e,0)},owC=YTr("AsyncFunction"),swC=e=>e&&(WKo(e)||fxe(e))&&fxe(e.then)&&fxe(e.catch),eAy=((e,t)=>e?setImmediate:t?((r,n)=>(mua.addEventListener("message",({source:i,data:a})=>{i===mua&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),mua.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",fxe(mua.postMessage)),uwC=typeof queueMicrotask<"u"?queueMicrotask.bind(mua):typeof process<"u"&&process.nextTick||eAy,cwC=e=>e!=null&&fxe(e[ESu]),Zf={isArray:SZa,isArrayBuffer:$Oy,isBuffer:VKo,isFormData:RPC,isArrayBufferView:EPC,isString:SPC,isNumber:YOy,isBoolean:DPC,isObject:WKo,isPlainObject:jSu,isEmptyObject:CPC,isReadableStream:FPC,isRequest:xPC,isResponse:zPC,isHeaders:QPC,isUndefined:EZa,isDate:IPC,isFile:MPC,isBlob:BPC,isRegExp:kPC,isFunction:fxe,isStream:qPC,isURLSearchParams:NPC,isTypedArray:KPC,isFileList:TPC,forEach:GKo,merge:xmf,extend:UPC,trim:LPC,stripBOM:VPC,inherits:WPC,toFlatObject:GPC,kindOf:SSu,kindOfTest:YTr,endsWith:HPC,toArray:JPC,forEachEntry:$PC,matchAll:YPC,isHTMLForm:XPC,hasOwnProperty:JOy,hasOwnProp:JOy,reduceDescriptors:kOy,freezeMethods:ewC,toObjectSet:twC,toCamelCase:ZPC,noop:rwC,toFiniteNumber:nwC,findKey:XOy,global:mua,isContextDefined:ZOy,isSpecCompliantForm:iwC,toJSONObject:awC,isAsyncFn:owC,isThenable:swC,setImmediate:eAy,asap:uwC,isIterable:cwC};function DZa(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Zf.inherits(DZa,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:Zf.toJSONObject(this.config),code:this.code,status:this.status}}});var tAy=DZa.prototype,rAy={};["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=>{rAy[e]={value:e}});Object.defineProperties(DZa,rAy);Object.defineProperty(tAy,"isAxiosError",{value:!0});DZa.from=(e,t,r,n,i,a)=>{let o=Object.create(tAy);Zf.toFlatObject(e,o,function(s){return s!==Error.prototype},u=>u!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return DZa.call(o,c,f,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var zm=DZa;var nAy=Hi(isa(),1),CSu=nAy.default;function Qmf(e){return Zf.isPlainObject(e)||Zf.isArray(e)}function aAy(e){return Zf.endsWith(e,"[]")?e.slice(0,-2):e}function iAy(e,t,r){return e?e.concat(t).map(function(i,a){return i=aAy(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function lwC(e){return Zf.isArray(e)&&!e.some(Qmf)}var fwC=Zf.toFlatObject(Zf,{},null,function(t){return/^is[A-Z]/.test(t)});function dwC(e,t,r){if(!Zf.isObject(e))throw new TypeError("target must be an object");t=t||new(CSu||FormData),r=Zf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!Zf.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||s,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&Zf.isSpecCompliantForm(t);if(!Zf.isFunction(i))throw new TypeError("visitor must be a function");function u(P){if(P===null)return"";if(Zf.isDate(P))return P.toISOString();if(Zf.isBoolean(P))return P.toString();if(!f&&Zf.isBlob(P))throw new zm("Blob is not supported. Use a Buffer instead.");return Zf.isArrayBuffer(P)||Zf.isTypedArray(P)?f&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function s(P,C,M){let T=P;if(P&&!M&&typeof P=="object"){if(Zf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Zf.isArray(P)&&lwC(P)||(Zf.isFileList(P)||Zf.endsWith(C,"[]"))&&(T=Zf.toArray(P)))return C=aAy(C),T.forEach(function(U,q){!(Zf.isUndefined(U)||U===null)&&t.append(o===!0?iAy([C],q,a):o===null?C:C+"[]",u(U))}),!1}return Qmf(P)?!0:(t.append(iAy(M,C,a),u(P)),!1)}let l=[],m=Object.assign(fwC,{defaultVisitor:s,convertValue:u,isVisitable:Qmf});function O(P,C){if(!Zf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Zf.forEach(P,function(T,z){(!(Zf.isUndefined(T)||T===null)&&i.call(t,T,Zf.isString(z)?z.trim():z,C,m))===!0&&O(T,C?C.concat(z):[z])}),l.pop()}}if(!Zf.isObject(e))throw new TypeError("data must be an object");return O(e),t}var y4i=dwC;function oAy(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function sAy(e,t){this._pairs=[],e&&y4i(e,this,t)}var uAy=sAy.prototype;uAy.append=function(t,r){this._pairs.push([t,r])};uAy.toString=function(t){let r=t?function(n){return t.call(this,n,oAy)}:oAy;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var cAy=sAy;function pwC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Oua(e,t,r){if(!t)return e;let n=r&&r.encode||pwC;Zf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Zf.isURLSearchParams(t)?t.toString():new cAy(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Lmf=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Zf.forEach(this.handlers,function(n){n!==null&&t(n)})}},Umf=Lmf;var CZa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var pAy=Hi(require("crypto"),1);var lAy=Hi(require("url"),1),fAy=lAy.default.URLSearchParams;var Vmf="abcdefghijklmnopqrstuvwxyz",dAy="0123456789",_Ay={DIGIT:dAy,ALPHA:Vmf,ALPHA_DIGIT:Vmf+Vmf.toUpperCase()+dAy},_wC=(e=16,t=_Ay.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);pAy.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},hAy={isNode:!0,classes:{URLSearchParams:fAy,FormData:CSu,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:_Ay,generateString:_wC,protocols:["http","https","file","data"]};var Hmf={};yf(Hmf,{hasBrowserEnv:()=>Gmf,hasStandardBrowserEnv:()=>hwC,hasStandardBrowserWebWorkerEnv:()=>ywC,navigator:()=>Wmf,origin:()=>vwC});var Gmf=typeof window<"u"&&typeof document<"u",Wmf=typeof navigator=="object"&&navigator||void 0,hwC=Gmf&&(!Wmf||["ReactNative","NativeScript","NS"].indexOf(Wmf.product)<0),ywC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vwC=Gmf&&window.location.href||"http://localhost";var J8={...Hmf,...hAy};function Jmf(e,t){return y4i(e,new J8.classes.URLSearchParams,{visitor:function(r,n,i,a){return J8.isNode&&Zf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function bwC(e){return Zf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function gwC(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function mwC(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&Zf.isArray(i)?i.length:o,f?(Zf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Zf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Zf.isArray(i[o])&&(i[o]=gwC(i[o])),!c)}if(Zf.isFormData(e)&&Zf.isFunction(e.entries)){let r={};return Zf.forEachEntry(e,(n,i)=>{t(bwC(n),i,r,0)}),r}return null}var ISu=mwC;function OwC(e,t,r){if(Zf.isString(e))try{return(t||JSON.parse)(e),Zf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Kmf={transitional:CZa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Zf.isObject(t);if(a&&Zf.isHTMLForm(t)&&(t=new FormData(t)),Zf.isFormData(t))return i?JSON.stringify(ISu(t)):t;if(Zf.isArrayBuffer(t)||Zf.isBuffer(t)||Zf.isStream(t)||Zf.isFile(t)||Zf.isBlob(t)||Zf.isReadableStream(t))return t;if(Zf.isArrayBufferView(t))return t.buffer;if(Zf.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Jmf(t,this.formSerializer).toString();if((c=Zf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return y4i(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),OwC(t)):t}],transformResponse:[function(t){let r=this.transitional||Kmf.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Zf.isResponse(t)||Zf.isReadableStream(t))return t;if(t&&Zf.isString(t)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?zm.from(c,zm.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:J8.classes.FormData,Blob:J8.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Zf.forEach(["delete","get","head","post","put","patch"],e=>{Kmf.headers[e]={}});var IZa=Kmf;var AwC=Zf.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"]),yAy=e=>{let t={},r,n,i;return e&&e.split(`
2441
2441
  `).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&AwC[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var vAy=Symbol("internals");function HKo(e){return e&&String(e).trim().toLowerCase()}function MSu(e){return e===!1||e==null?e:Zf.isArray(e)?e.map(MSu):String(e)}function PwC(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var wwC=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function $mf(e,t,r,n,i){if(Zf.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!Zf.isString(t)){if(Zf.isString(n))return t.indexOf(n)!==-1;if(Zf.isRegExp(n))return n.test(t)}}function jwC(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function EwC(e,t){let r=Zf.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,a,o){return this[n].call(this,t,i,a,o)},configurable:!0})})}var MZa=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function a(c,f,u){let s=HKo(f);if(!s)throw new Error("header name must be a non-empty string");let l=Zf.findKey(i,s);(!l||i[l]===void 0||u===!0||u===void 0&&i[l]!==!1)&&(i[l||f]=MSu(c))}let o=(c,f)=>Zf.forEach(c,(u,s)=>a(u,s,f));if(Zf.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(Zf.isString(t)&&(t=t.trim())&&!wwC(t))o(yAy(t),r);else if(Zf.isObject(t)&&Zf.isIterable(t)){let c={},f,u;for(let s of t){if(!Zf.isArray(s))throw TypeError("Object iterator must return a key-value pair");c[u=s[0]]=(f=c[u])?Zf.isArray(f)?[...f,s[1]]:[f,s[1]]:s[1]}o(c,r)}else t!=null&&a(r,t,n);return this}get(t,r){if(t=HKo(t),t){let n=Zf.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return PwC(i);if(Zf.isFunction(r))return r.call(this,i,n);if(Zf.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=HKo(t),t){let n=Zf.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||$mf(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function a(o){if(o=HKo(o),o){let c=Zf.findKey(n,o);c&&(!r||$mf(n,n[c],c,r))&&(delete n[c],i=!0)}}return Zf.isArray(t)?t.forEach(a):a(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let a=r[n];(!t||$mf(this,this[a],a,t,!0))&&(delete this[a],i=!0)}return i}normalize(t){let r=this,n={};return Zf.forEach(this,(i,a)=>{let o=Zf.findKey(n,a);if(o){r[o]=MSu(i),delete r[a];return}let c=t?jwC(a):String(a).trim();c!==a&&delete r[a],r[c]=MSu(i),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return Zf.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&Zf.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
2442
2442
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[vAy]=this[vAy]={accessors:{}}).accessors,i=this.prototype;function a(o){let c=HKo(o);n[c]||(EwC(i,o),n[c]=!0)}return Zf.isArray(t)?t.forEach(a):a(t),this}};MZa.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Zf.reduceDescriptors(MZa.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Zf.freezeMethods(MZa);var g$=MZa;function JKo(e,t){let r=this||IZa,n=t||r,i=g$.from(n.headers),a=n.data;return Zf.forEach(e,function(c){a=c.call(r,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function KKo(e){return!!(e&&e.__CANCEL__)}function bAy(e,t,r){zm.call(this,e??"canceled",zm.ERR_CANCELED,t,r),this.name="CanceledError"}Zf.inherits(bAy,zm,{__CANCEL__:!0});var xrt=bAy;function wUr(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new zm("Request failed with status code "+r.status,[zm.ERR_BAD_REQUEST,zm.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Ymf(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Xmf(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Aua(e,t,r){let n=!Ymf(t);return e&&(n||r==!1)?Xmf(e,t):t}var qAy=Hi(ZEu(),1),RAy=Hi(require("http"),1),NAy=Hi(require("https"),1),FAy=Hi(require("util"),1),xAy=Hi(Z0f(),1),CAi=Hi(require("zlib"),1);var Pua="1.12.2";function $Ko(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var SwC=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Zmf(e,t,r){let n=r&&r.Blob||J8.classes.Blob,i=$Ko(e);if(t===void 0&&n&&(t=!0),i==="data"){e=i.length?e.slice(i.length+1):e;let a=SwC.exec(e);if(!a)throw new zm("Invalid URL",zm.ERR_INVALID_URL);let o=a[1],c=a[2],f=a[3],u=Buffer.from(decodeURIComponent(f),c?"base64":"utf8");if(t){if(!n)throw new zm("Blob is not supported",zm.ERR_NOT_SUPPORT);return new n([u],{type:o})}return u}throw new zm("Unsupported protocol "+i,zm.ERR_NOT_SUPPORT)}var jua=Hi(require("stream"),1);var gAy=Hi(require("stream"),1);var kmf=Symbol("internals"),eOf=class extends gAy.default.Transform{constructor(t){t=Zf.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,i)=>!Zf.isUndefined(i[n])),super({readableHighWaterMark:t.chunkSize});let r=this[kmf]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",n=>{n==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[kmf];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let i=this[kmf],a=i.maxRate,o=this.readableHighWaterMark,c=i.timeWindow,f=1e3/c,u=a/f,s=i.minChunkSize!==!1?Math.max(i.minChunkSize,u*.01):0,l=(O,P)=>{let C=Buffer.byteLength(O);i.bytesSeen+=C,i.bytes+=C,i.isCaptured&&this.emit("progress",i.bytesSeen),this.push(O)?process.nextTick(P):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(P)}},m=(O,P)=>{let C=Buffer.byteLength(O),M=null,T=o,z,U=0;if(a){let q=Date.now();(!i.ts||(U=q-i.ts)>=c)&&(i.ts=q,z=u-i.bytes,i.bytes=z<0?-z:0,U=0),z=u-i.bytes}if(a){if(z<=0)return setTimeout(()=>{P(null,O)},c-U);z<T&&(T=z)}T&&C>T&&C-T>s&&(M=O.subarray(T),O=O.subarray(0,T)),l(O,M?()=>{process.nextTick(P,null,M)}:P)};m(t,function O(P,C){if(P)return n(P);C?m(C,O):n(null)})}},tOf=eOf;var zAy=require("events");var OAy=Hi(require("util"),1),AAy=require("stream");var{asyncIterator:mAy}=Symbol,DwC=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[mAy]?yield*e[mAy]():yield e},BSu=DwC;var CwC=J8.ALPHABET.ALPHA_DIGIT+"-_",YKo=typeof TextEncoder=="function"?new TextEncoder:new OAy.default.TextEncoder,wua=`\r
2443
2443
  `,IwC=YKo.encode(wua),MwC=2,rOf=class{constructor(t,r){let{escapeName:n}=this.constructor,i=Zf.isString(r),a=`Content-Disposition: form-data; name="${n(t)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${wua}`;i?r=YKo.encode(String(r).replace(/\r?\n|\r\n?/g,wua)):a+=`Content-Type: ${r.type||"application/octet-stream"}${wua}`,this.headers=YKo.encode(a+wua),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+MwC,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;Zf.isTypedArray(t)?yield t:yield*BSu(t),yield IwC}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},BwC=(e,t,r)=>{let{tag:n="form-data-boundary",size:i=25,boundary:a=n+"-"+J8.generateString(i,CwC)}=r||{};if(!Zf.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let o=YKo.encode("--"+a+wua),c=YKo.encode("--"+a+"--"+wua),f=c.byteLength,u=Array.from(e.entries()).map(([l,m])=>{let O=new rOf(l,m);return f+=O.size,O});f+=o.byteLength*u.length,f=Zf.toFiniteNumber(f);let s={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(f)&&(s["Content-Length"]=f),t&&t(s),AAy.Readable.from((async function*(){for(let l of u)yield o,yield*l.encode();yield c})())},PAy=BwC;var wAy=Hi(require("stream"),1),nOf=class extends wAy.default.Transform{__transform(t,r,n){this.push(t),n()}_transform(t,r,n){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let i=Buffer.alloc(2);i[0]=120,i[1]=156,this.push(i,r)}this.__transform(t,r,n)}},jAy=nOf;var TwC=(e,t)=>Zf.isAsyncFn(e)?function(...r){let n=r.pop();e.apply(this,r).then(i=>{try{t?n(null,...t(i)):n(null,i)}catch(a){n(a)}},n)}:e,EAy=TwC;function qwC(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,a=0,o;return t=t!==void 0?t:1e3,function(f){let u=Date.now(),s=n[a];o||(o=u),r[i]=f,n[i]=u;let l=a,m=0;for(;l!==i;)m+=r[l++],l=l%e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),u-o<t)return;let O=s&&u-s;return O?Math.round(m*1e3/O):void 0}}var SAy=qwC;function RwC(e,t){let r=0,n=1e3/t,i,a,o=(u,s=Date.now())=>{r=s,i=null,a&&(clearTimeout(a),a=null),e(...u)};return[(...u)=>{let s=Date.now(),l=s-r;l>=n?o(u,s):(i=u,a||(a=setTimeout(()=>{a=null,o(i)},n-l)))},()=>i&&o(i)]}var DAy=RwC;var DAi=(e,t,r=3)=>{let n=0,i=SAy(50,250);return DAy(a=>{let o=a.loaded,c=a.lengthComputable?a.total:void 0,f=o-n,u=i(f),s=o<=c;n=o;let l={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:u||void 0,estimated:u&&c&&s?(c-o)/u:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},r)},BZa=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},TZa=e=>(...t)=>Zf.asap(()=>e(...t));function iOf(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;let t=e.indexOf(",");if(t<0)return 0;let r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let a=n.length,o=n.length;for(let m=0;m<o;m++)if(n.charCodeAt(m)===37&&m+2<o){let O=n.charCodeAt(m+1),P=n.charCodeAt(m+2);(O>=48&&O<=57||O>=65&&O<=70||O>=97&&O<=102)&&(P>=48&&P<=57||P>=65&&P<=70||P>=97&&P<=102)&&(a-=2,m+=2)}let c=0,f=o-1,u=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);f>=0&&(n.charCodeAt(f)===61?(c++,f--):u(f)&&(c++,f-=3)),c===1&&f>=0&&(n.charCodeAt(f)===61||u(f))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(n,"utf8")}var CAy={flush:CAi.default.constants.Z_SYNC_FLUSH,finishFlush:CAi.default.constants.Z_SYNC_FLUSH},NwC={flush:CAi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:CAi.default.constants.BROTLI_OPERATION_FLUSH},IAy=Zf.isFunction(CAi.default.createBrotliDecompress),{http:FwC,https:xwC}=xAy.default,zwC=/https:?/,MAy=J8.protocols.map(e=>e+":"),BAy=(e,[t,r])=>(e.on("end",r).on("error",r),t);function QwC(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function QAy(e,t,r){let n=t;if(!n&&n!==!1){let i=qAy.default.getProxyForUrl(r);i&&(n=new URL(i))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let a=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let i=n.hostname||n.host;e.hostname=i,e.host=i,e.port=n.port,e.path=r,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(a){QAy(a,t,a.href)}}var LwC=typeof process<"u"&&Zf.kindOf(process)==="process",UwC=e=>new Promise((t,r)=>{let n,i,a=(f,u)=>{i||(i=!0,n&&n(f,u))},o=f=>{a(f),t(f)},c=f=>{a(f,!0),r(f)};e(o,c,f=>n=f).catch(c)}),VwC=({address:e,family:t})=>{if(!Zf.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},TAy=(e,t)=>VwC(Zf.isObject(e)?e:{address:e,family:t}),LAy=LwC&&function(t){return UwC(async function(n,i,a){let{data:o,lookup:c,family:f}=t,{responseType:u,responseEncoding:s}=t,l=t.method.toUpperCase(),m,O=!1,P;if(c){let Se=EAy(c,Ot=>Zf.isArray(Ot)?Ot:[Ot]);c=(Ot,mt,Qe)=>{Se(Ot,mt,(Be,er,pt)=>{if(Be)return Qe(Be);let Ar=Zf.isArray(er)?er.map(Xt=>TAy(Xt)):[TAy(er,pt)];mt.all?Qe(Be,Ar):Qe(Be,Ar[0].address,Ar[0].family)})}}let C=new zAy.EventEmitter,M=()=>{t.cancelToken&&t.cancelToken.unsubscribe(T),t.signal&&t.signal.removeEventListener("abort",T),C.removeAllListeners()};a((Se,Ot)=>{m=!0,Ot&&(O=!0,M())});function T(Se){C.emit("abort",!Se||Se.type?new xrt(null,t,P):Se)}C.once("abort",i),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(T),t.signal&&(t.signal.aborted?T():t.signal.addEventListener("abort",T)));let z=Aua(t.baseURL,t.url,t.allowAbsoluteUrls),U=new URL(z,J8.hasBrowserEnv?J8.origin:void 0),q=U.protocol||MAy[0];if(q==="data:"){if(t.maxContentLength>-1){let Ot=String(t.url||z||"");if(iOf(Ot)>t.maxContentLength)return i(new zm("maxContentLength size of "+t.maxContentLength+" exceeded",zm.ERR_BAD_RESPONSE,t))}let Se;if(l!=="GET")return wUr(n,i,{status:405,statusText:"method not allowed",headers:{},config:t});try{Se=Zmf(t.url,u==="blob",{Blob:t.env&&t.env.Blob})}catch(Ot){throw zm.from(Ot,zm.ERR_BAD_REQUEST,t)}return u==="text"?(Se=Se.toString(s),(!s||s==="utf8")&&(Se=Zf.stripBOM(Se))):u==="stream"&&(Se=jua.default.Readable.from(Se)),wUr(n,i,{data:Se,status:200,statusText:"OK",headers:new g$,config:t})}if(MAy.indexOf(q)===-1)return i(new zm("Unsupported protocol "+q,zm.ERR_BAD_REQUEST,t));let V=g$.from(t.headers).normalize();V.set("User-Agent","axios/"+Pua,!1);let{onUploadProgress:$,onDownloadProgress:re}=t,Y=t.maxRate,k,ne;if(Zf.isSpecCompliantForm(o)){let Se=V.getContentType(/boundary=([-_\w\d]{10,70})/i);o=PAy(o,Ot=>{V.set(Ot)},{tag:`axios-${Pua}-boundary`,boundary:Se&&Se[1]||void 0})}else if(Zf.isFormData(o)&&Zf.isFunction(o.getHeaders)){if(V.set(o.getHeaders()),!V.hasContentLength())try{let Se=await FAy.default.promisify(o.getLength).call(o);Number.isFinite(Se)&&Se>=0&&V.setContentLength(Se)}catch{}}else if(Zf.isBlob(o)||Zf.isFile(o))o.size&&V.setContentType(o.type||"application/octet-stream"),V.setContentLength(o.size||0),o=jua.default.Readable.from(BSu(o));else if(o&&!Zf.isStream(o)){if(!Buffer.isBuffer(o))if(Zf.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(Zf.isString(o))o=Buffer.from(o,"utf-8");else return i(new zm("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",zm.ERR_BAD_REQUEST,t));if(V.setContentLength(o.length,!1),t.maxBodyLength>-1&&o.length>t.maxBodyLength)return i(new zm("Request body larger than maxBodyLength limit",zm.ERR_BAD_REQUEST,t))}let Oe=Zf.toFiniteNumber(V.getContentLength());Zf.isArray(Y)?(k=Y[0],ne=Y[1]):k=ne=Y,o&&($||k)&&(Zf.isStream(o)||(o=jua.default.Readable.from(o,{objectMode:!1})),o=jua.default.pipeline([o,new tOf({maxRate:Zf.toFiniteNumber(k)})],Zf.noop),$&&o.on("progress",BAy(o,BZa(Oe,DAi(TZa($),!1,3)))));let ye;if(t.auth){let Se=t.auth.username||"",Ot=t.auth.password||"";ye=Se+":"+Ot}if(!ye&&U.username){let Se=U.username,Ot=U.password;ye=Se+":"+Ot}ye&&V.delete("authorization");let ge;try{ge=Oua(U.pathname+U.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Se){let Ot=new Error(Se.message);return Ot.config=t,Ot.url=t.url,Ot.exists=!0,i(Ot)}V.set("Accept-Encoding","gzip, compress, deflate"+(IAy?", br":""),!1);let pe={path:ge,method:l,headers:V.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:ye,protocol:q,family:f,beforeRedirect:QwC,beforeRedirects:{}};!Zf.isUndefined(c)&&(pe.lookup=c),t.socketPath?pe.socketPath=t.socketPath:(pe.hostname=U.hostname.startsWith("[")?U.hostname.slice(1,-1):U.hostname,pe.port=U.port,QAy(pe,t.proxy,q+"//"+U.hostname+(U.port?":"+U.port:"")+pe.path));let Ce,je=zwC.test(pe.protocol);if(pe.agent=je?t.httpsAgent:t.httpAgent,t.transport?Ce=t.transport:t.maxRedirects===0?Ce=je?NAy.default:RAy.default:(t.maxRedirects&&(pe.maxRedirects=t.maxRedirects),t.beforeRedirect&&(pe.beforeRedirects.config=t.beforeRedirect),Ce=je?xwC:FwC),t.maxBodyLength>-1?pe.maxBodyLength=t.maxBodyLength:pe.maxBodyLength=1/0,t.insecureHTTPParser&&(pe.insecureHTTPParser=t.insecureHTTPParser),P=Ce.request(pe,function(Ot){if(P.destroyed)return;let mt=[Ot],Qe=+Ot.headers["content-length"];if(re||ne){let Xt=new tOf({maxRate:Zf.toFiniteNumber(ne)});re&&Xt.on("progress",BAy(Xt,BZa(Qe,DAi(TZa(re),!0,3)))),mt.push(Xt)}let Be=Ot,er=Ot.req||P;if(t.decompress!==!1&&Ot.headers["content-encoding"])switch((l==="HEAD"||Ot.statusCode===204)&&delete Ot.headers["content-encoding"],(Ot.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":mt.push(CAi.default.createUnzip(CAy)),delete Ot.headers["content-encoding"];break;case"deflate":mt.push(new jAy),mt.push(CAi.default.createUnzip(CAy)),delete Ot.headers["content-encoding"];break;case"br":IAy&&(mt.push(CAi.default.createBrotliDecompress(NwC)),delete Ot.headers["content-encoding"])}Be=mt.length>1?jua.default.pipeline(mt,Zf.noop):mt[0];let pt=jua.default.finished(Be,()=>{pt(),M()}),Ar={status:Ot.statusCode,statusText:Ot.statusMessage,headers:new g$(Ot.headers),config:t,request:er};if(u==="stream")Ar.data=Be,wUr(n,i,Ar);else{let Xt=[],Ye=0;Be.on("data",function(tr){Xt.push(tr),Ye+=tr.length,t.maxContentLength>-1&&Ye>t.maxContentLength&&(O=!0,Be.destroy(),i(new zm("maxContentLength size of "+t.maxContentLength+" exceeded",zm.ERR_BAD_RESPONSE,t,er)))}),Be.on("aborted",function(){if(O)return;let tr=new zm("stream has been aborted",zm.ERR_BAD_RESPONSE,t,er);Be.destroy(tr),i(tr)}),Be.on("error",function(tr){P.destroyed||i(zm.from(tr,null,t,er))}),Be.on("end",function(){try{let tr=Xt.length===1?Xt[0]:Buffer.concat(Xt);u!=="arraybuffer"&&(tr=tr.toString(s),(!s||s==="utf8")&&(tr=Zf.stripBOM(tr))),Ar.data=tr}catch(tr){return i(zm.from(tr,null,t,Ar.request,Ar))}wUr(n,i,Ar)})}C.once("abort",Xt=>{Be.destroyed||(Be.emit("error",Xt),Be.destroy())})}),C.once("abort",Se=>{i(Se),P.destroy(Se)}),P.on("error",function(Ot){i(zm.from(Ot,null,t,P))}),P.on("socket",function(Ot){Ot.setKeepAlive(!0,1e3*60)}),t.timeout){let Se=parseInt(t.timeout,10);if(Number.isNaN(Se)){i(new zm("error trying to parse `config.timeout` to int",zm.ERR_BAD_OPTION_VALUE,t,P));return}P.setTimeout(Se,function(){if(m)return;let mt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",Qe=t.transitional||CZa;t.timeoutErrorMessage&&(mt=t.timeoutErrorMessage),i(new zm(mt,Qe.clarifyTimeoutError?zm.ETIMEDOUT:zm.ECONNABORTED,t,P)),T()})}if(Zf.isStream(o)){let Se=!1,Ot=!1;o.on("end",()=>{Se=!0}),o.once("error",mt=>{Ot=!0,P.destroy(mt)}),o.on("close",()=>{!Se&&!Ot&&T(new xrt("Request stream has been aborted",t,P))}),o.pipe(P)}else P.end(o)})};var UAy=J8.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,J8.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(J8.origin),J8.navigator&&/(msie|trident)/i.test(J8.navigator.userAgent)):()=>!0;var VAy=J8.hasStandardBrowserEnv?{write(e,t,r,n,i,a){let o=[e+"="+encodeURIComponent(t)];Zf.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Zf.isString(n)&&o.push("path="+n),Zf.isString(i)&&o.push("domain="+i),a===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var WAy=e=>e instanceof g$?{...e}:e;function XTr(e,t){t=t||{};let r={};function n(u,s,l,m){return Zf.isPlainObject(u)&&Zf.isPlainObject(s)?Zf.merge.call({caseless:m},u,s):Zf.isPlainObject(s)?Zf.merge({},s):Zf.isArray(s)?s.slice():s}function i(u,s,l,m){if(Zf.isUndefined(s)){if(!Zf.isUndefined(u))return n(void 0,u,l,m)}else return n(u,s,l,m)}function a(u,s){if(!Zf.isUndefined(s))return n(void 0,s)}function o(u,s){if(Zf.isUndefined(s)){if(!Zf.isUndefined(u))return n(void 0,u)}else return n(void 0,s)}function c(u,s,l){if(l in t)return n(u,s);if(l in e)return n(void 0,u)}let f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,s,l)=>i(WAy(u),WAy(s),l,!0)};return Zf.forEach(Object.keys({...e,...t}),function(s){let l=f[s]||i,m=l(e[s],t[s],s);Zf.isUndefined(m)&&l!==c||(r[s]=m)}),r}var TSu=e=>{let t=XTr({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=g$.from(o),t.url=Oua(Aua(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),Zf.isFormData(r)){if(J8.hasStandardBrowserEnv||J8.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Zf.isFunction(r.getHeaders)){let f=r.getHeaders(),u=["content-type","content-length"];Object.entries(f).forEach(([s,l])=>{u.includes(s.toLowerCase())&&o.set(s,l)})}}if(J8.hasStandardBrowserEnv&&(n&&Zf.isFunction(n)&&(n=n(t)),n||n!==!1&&UAy(t.url))){let f=i&&a&&VAy.read(a);f&&o.set(i,f)}return t};var WwC=typeof XMLHttpRequest<"u",GAy=WwC&&function(e){return new Promise(function(r,n){let i=TSu(e),a=i.data,o=g$.from(i.headers).normalize(),{responseType:c,onUploadProgress:f,onDownloadProgress:u}=i,s,l,m,O,P;function C(){O&&O(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let M=new XMLHttpRequest;M.open(i.method.toUpperCase(),i.url,!0),M.timeout=i.timeout;function T(){if(!M)return;let U=g$.from("getAllResponseHeaders"in M&&M.getAllResponseHeaders()),V={data:!c||c==="text"||c==="json"?M.responseText:M.response,status:M.status,statusText:M.statusText,headers:U,config:e,request:M};wUr(function(re){r(re),C()},function(re){n(re),C()},V),M=null}"onloadend"in M?M.onloadend=T:M.onreadystatechange=function(){!M||M.readyState!==4||M.status===0&&!(M.responseURL&&M.responseURL.indexOf("file:")===0)||setTimeout(T)},M.onabort=function(){M&&(n(new zm("Request aborted",zm.ECONNABORTED,e,M)),M=null)},M.onerror=function(q){let V=q&&q.message?q.message:"Network Error",$=new zm(V,zm.ERR_NETWORK,e,M);$.event=q||null,n($),M=null},M.ontimeout=function(){let q=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",V=i.transitional||CZa;i.timeoutErrorMessage&&(q=i.timeoutErrorMessage),n(new zm(q,V.clarifyTimeoutError?zm.ETIMEDOUT:zm.ECONNABORTED,e,M)),M=null},a===void 0&&o.setContentType(null),"setRequestHeader"in M&&Zf.forEach(o.toJSON(),function(q,V){M.setRequestHeader(V,q)}),Zf.isUndefined(i.withCredentials)||(M.withCredentials=!!i.withCredentials),c&&c!=="json"&&(M.responseType=i.responseType),u&&([m,P]=DAi(u,!0),M.addEventListener("progress",m)),f&&M.upload&&([l,O]=DAi(f),M.upload.addEventListener("progress",l),M.upload.addEventListener("loadend",O)),(i.cancelToken||i.signal)&&(s=U=>{M&&(n(!U||U.type?new xrt(null,e,M):U),M.abort(),M=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));let z=$Ko(i.url);if(z&&J8.protocols.indexOf(z)===-1){n(new zm("Unsupported protocol "+z+":",zm.ERR_BAD_REQUEST,e));return}M.send(a||null)})};var GwC=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,a=function(u){if(!i){i=!0,c();let s=u instanceof Error?u:this.reason;n.abort(s instanceof zm?s:new xrt(s instanceof Error?s.message:s))}},o=t&&setTimeout(()=>{o=null,a(new zm(`timeout ${t} of ms exceeded`,zm.ETIMEDOUT))},t),c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(a):u.removeEventListener("abort",a)}),e=null)};e.forEach(u=>u.addEventListener("abort",a));let{signal:f}=n;return f.unsubscribe=()=>Zf.asap(c),f}},HAy=GwC;var HwC=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},JwC=async function*(e,t){for await(let r of KwC(e))yield*HwC(r,t)},KwC=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},aOf=(e,t,r,n)=>{let i=JwC(e,t),a=0,o,c=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{let{done:u,value:s}=await i.next();if(u){c(),f.close();return}let l=s.byteLength;if(r){let m=a+=l;r(m)}f.enqueue(new Uint8Array(s))}catch(u){throw c(u),u}},cancel(f){return c(f),i.return()}},{highWaterMark:2})};var JAy=64*1024,{isFunction:qSu}=Zf,$wC=(({Request:e,Response:t})=>({Request:e,Response:t}))(Zf.global),{ReadableStream:KAy,TextEncoder:$Ay}=Zf.global,YAy=(e,...t)=>{try{return!!e(...t)}catch{return!1}},YwC=e=>{e=Zf.merge.call({skipUndefined:!0},$wC,e);let{fetch:t,Request:r,Response:n}=e,i=t?qSu(t):typeof fetch=="function",a=qSu(r),o=qSu(n);if(!i)return!1;let c=i&&qSu(KAy),f=i&&(typeof $Ay=="function"?(P=>C=>P.encode(C))(new $Ay):async P=>new Uint8Array(await new r(P).arrayBuffer())),u=a&&c&&YAy(()=>{let P=!1,C=new r(J8.origin,{body:new KAy,method:"POST",get duplex(){return P=!0,"half"}}).headers.has("Content-Type");return P&&!C}),s=o&&c&&YAy(()=>Zf.isReadableStream(new n("").body)),l={stream:s&&(P=>P.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(P=>{!l[P]&&(l[P]=(C,M)=>{let T=C&&C[P];if(T)return T.call(C);throw new zm(`Response type '${P}' is not supported`,zm.ERR_NOT_SUPPORT,M)})});let m=async P=>{if(P==null)return 0;if(Zf.isBlob(P))return P.size;if(Zf.isSpecCompliantForm(P))return(await new r(J8.origin,{method:"POST",body:P}).arrayBuffer()).byteLength;if(Zf.isArrayBufferView(P)||Zf.isArrayBuffer(P))return P.byteLength;if(Zf.isURLSearchParams(P)&&(P=P+""),Zf.isString(P))return(await f(P)).byteLength},O=async(P,C)=>{let M=Zf.toFiniteNumber(P.getContentLength());return M??m(C)};return async P=>{let{url:C,method:M,data:T,signal:z,cancelToken:U,timeout:q,onDownloadProgress:V,onUploadProgress:$,responseType:re,headers:Y,withCredentials:k="same-origin",fetchOptions:ne}=TSu(P),Oe=t||fetch;re=re?(re+"").toLowerCase():"text";let ye=HAy([z,U&&U.toAbortSignal()],q),ge=null,pe=ye&&ye.unsubscribe&&(()=>{ye.unsubscribe()}),Ce;try{if($&&u&&M!=="get"&&M!=="head"&&(Ce=await O(Y,T))!==0){let Be=new r(C,{method:"POST",body:T,duplex:"half"}),er;if(Zf.isFormData(T)&&(er=Be.headers.get("content-type"))&&Y.setContentType(er),Be.body){let[pt,Ar]=BZa(Ce,DAi(TZa($)));T=aOf(Be.body,JAy,pt,Ar)}}Zf.isString(k)||(k=k?"include":"omit");let je=a&&"credentials"in r.prototype,Se={...ne,signal:ye,method:M.toUpperCase(),headers:Y.normalize().toJSON(),body:T,duplex:"half",credentials:je?k:void 0};ge=a&&new r(C,Se);let Ot=await(a?Oe(ge,ne):Oe(C,Se)),mt=s&&(re==="stream"||re==="response");if(s&&(V||mt&&pe)){let Be={};["status","statusText","headers"].forEach(Xt=>{Be[Xt]=Ot[Xt]});let er=Zf.toFiniteNumber(Ot.headers.get("content-length")),[pt,Ar]=V&&BZa(er,DAi(TZa(V),!0))||[];Ot=new n(aOf(Ot.body,JAy,pt,()=>{Ar&&Ar(),pe&&pe()}),Be)}re=re||"text";let Qe=await l[Zf.findKey(l,re)||"text"](Ot,P);return!mt&&pe&&pe(),await new Promise((Be,er)=>{wUr(Be,er,{data:Qe,headers:g$.from(Ot.headers),status:Ot.status,statusText:Ot.statusText,config:P,request:ge})})}catch(je){throw pe&&pe(),je&&je.name==="TypeError"&&/Load failed|fetch/i.test(je.message)?Object.assign(new zm("Network Error",zm.ERR_NETWORK,P,ge),{cause:je.cause||je}):zm.from(je,je&&je.code,P,ge)}}},XwC=new Map,oOf=e=>{let t=e?e.env:{},{fetch:r,Request:n,Response:i}=t,a=[n,i,r],o=a.length,c=o,f,u,s=XwC;for(;c--;)f=a[c],u=s.get(f),u===void 0&&s.set(f,u=c?new Map:YwC(t)),s=u;return u},gnU=oOf();var sOf={http:LAy,xhr:GAy,fetch:{get:oOf}};Zf.forEach(sOf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var XAy=e=>`- ${e}`,kwC=e=>Zf.isFunction(e)||e===null||e===!1,RSu={getAdapter:(e,t)=>{e=Zf.isArray(e)?e:[e];let{length:r}=e,n,i,a={};for(let o=0;o<r;o++){n=e[o];let c;if(i=n,!kwC(n)&&(i=sOf[(c=String(n)).toLowerCase()],i===void 0))throw new zm(`Unknown adapter '${c}'`);if(i&&(Zf.isFunction(i)||(i=i.get(t))))break;a[c||"#"+o]=i}if(!i){let o=Object.entries(a).map(([f,u])=>`adapter ${f} `+(u===!1?"is not supported by the environment":"is not available in the build")),c=r?o.length>1?`since :
@@ -2678,7 +2678,7 @@ ${q}${z}${V}${dro}`});function kNu({message:e,error:t,logger:r,logLevel:n=sE.Err
2678
2678
  Run ${Mf.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
2679
2679
  Run ${Mf.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),RZa(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function pRf({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!lUy(e))return;let i=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let o=a.sort((c,f)=>c.generatorName.localeCompare(f.generatorName)||c.currentVersion.localeCompare(f.currentVersion));for(let c of o)i+=`
2680
2680
  ${await viI(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+Mf.dim(c.currentVersion)+Mf.reset(" \u2192 ")+Mf.green(c.latestVersion);return i+=`
2681
- `,n?RZa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function viI(e){let r=await new cUy.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 biI({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,u,s,l)=>{c.versions[u]==null&&(c.versions[u]={});let m=t3i(s.name,l),O=await bTr({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:l});O!=null&&(c.versions[u][s.name]={previousVersion:s.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,u,s)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=t3i(u.name,s),m=await bTr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:s});m!=null&&(o.versions[c][f][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await CTr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(i!=null&&f.groupName!==i))for(let u of f.generators)n!=null&&u.name!==n||await r(a.workspaceName,f.groupName,u,o)}})}))}function pUy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let f=Sxe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function nFu({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await biI({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[f,u]of Object.entries(c.versions))o.push(...pUy(u,f,t.logger));else o.push(...pUy(c.versions,void 0,t.logger))}return o}var RZo=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${i} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var yro=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var _Rf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),_Uy=typeof globalThis.AbortController=="function",hUy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",yUy=typeof globalThis.ReadableStream=="function",vUy=typeof globalThis.FormData=="function",iFu=["get","post","put","patch","head","delete"],giI=()=>{};giI();var bUy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},aFu=2147483647,gUy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,oFu=Symbol("stop"),mUy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},OUy={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 miI=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=gUy,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},AUy=(e,t,r)=>{let n,i=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),n){i+=n.byteLength;let c=t===0?0:i/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,i),transferredBytes:i},n)}n=a},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},n))}}))},PUy=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(AUy(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},wUy=(e,t,r)=>{if(!e.body)return e;let n=miI(r??e.body);return new Request(e,{duplex:"half",body:AUy(e.body,n,t)})};var vro=e=>e!==null&&typeof e=="object";var NZo=(...e)=>{for(let t of e)if((!vro(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return vRf({},...e)},hRf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,o]of i.entries())n&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function sFu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:vRf(e[r]??[],t[r]??[])}var yRf=(e={},t={})=>({beforeRequest:sFu(e,t,"beforeRequest"),beforeRetry:sFu(e,t,"beforeRetry"),afterResponse:sFu(e,t,"afterResponse"),beforeError:sFu(e,t,"beforeError")}),vRf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(vro(i)){for(let[a,o]of Object.entries(i))vro(o)&&a in t&&(o=vRf(t[a],o)),t={...t,[a]:o};vro(i.hooks)&&(n=yRf(n,i.hooks),t.hooks=n),vro(i.headers)&&(r=hRf(r,i.headers),t.headers=r)}return t};var EUy=e=>iFu.includes(e)?e.toUpperCase():e,OiI=["get","put","head","delete","options","trace"],AiI=[408,413,429,500,502,503,504],PiI=[413,429,503],jUy={limit:2,methods:OiI,statusCodes:AiI,afterStatusCodes:PiI,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},SUy=(e={})=>{if(typeof e=="number")return{...jUy,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{...jUy,...e}};async function bRf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new yro(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function gRf(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var DUy=(e,t)=>{let r={};for(let n in t)!(n in OUy)&&!(n in mUy)&&!(n in e)&&(r[n]=t[n]);return r},CUy=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;var FZo=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>aFu)throw new RangeError(`The \`timeout\` option cannot be greater than ${aFu}`);await Promise.resolve();let c=await n._fetch();for(let f of n._options.hooks.afterResponse){let u=await f(n.request,n._options,n._decorateResponse(c.clone()));u instanceof globalThis.Response&&(c=u)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let f=new RZo(c,n.request,n._options);for(let u of n._options.hooks.beforeError)f=await u(f);throw f}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!yUy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return PUy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{let c=n._originalRequest,f=[];c&&!c.bodyUsed&&f.push(c.body?.cancel()),n.request.bodyUsed||f.push(n.request.body?.cancel()),await Promise.all(f)});for(let[c,f]of Object.entries(bUy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||f);let u=await o;if(c==="json"){if(u.status===204)return"";let s=await u.text();return s===""?"":r.parseJson?r.parseJson(s):JSON.parse(s)}return u[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:hRf(this._input.headers,r.headers),hooks:yRf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:EUy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:SUy(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(_Uy&&hUy){let n=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=n?AbortSignal.any([n,this.abortController.signal]):this.abortController.signal}if(_Rf&&(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),CUy(this._options.searchParams)){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(vUy&&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(!_Rf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=wUy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof yro)throw t;if(t instanceof RZo){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let n=Math.min(this._calculateRetryDelay(r),aFu);if(this._retryCount<1)throw r;await gRf(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===oFu)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=DUy(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):bRf(this._originalRequest,t,this.abortController,this._options)}};var mRf=e=>{let t=(r,n)=>FZo.create(r,NZo(e,n));for(let r of iFu)t[r]=(n,i)=>FZo.create(n,NZo(e,i,{method:r}));return t.create=r=>mRf(NZo(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),mRf(NZo(e,r))),t.stop=oFu,t},wiI=mRf(),IUy=wiI;var kUy=Hi(ZUy(),1);function jRf(e){let t=(0,kUy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var JVy=Hi(HVy(),1),KVy=Hi(pTu(),1),xRf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},zRf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function QRf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??jRf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,JVy.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let u;try{u=await IUy(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new xRf(e):l}if(t.allVersions)return u;let s=new zRf(e,r);if(u["dist-tags"][r]){let{time:l}=u;u=u.versions[u["dist-tags"][r]],u.time=l}else if(r){let l=!!u.versions[r];if(n&&!l)for(let[O,P]of Object.entries(u.versions))P.deprecated&&delete u.versions[O];if(!l){let O=Object.keys(u.versions);if(r=KVy.default.maxSatisfying(O,r),!r)throw s}let{time:m}=u;if(u=u.versions[r],u.time=m,!u)throw s}return u}async function Tla(e,t){let{version:r}=await QRf(e.toLowerCase(),t);return r}async function z7i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Tla(e.packageName,{version:t?"prerelease":"latest"})}var $Vy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],gFu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=sE.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new rFu(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(i==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.120.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Mf.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new jne}failWithoutThrowing(t,r){this.didSucceed=!1,kNu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await jZa()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await fUy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
2681
+ `,n?RZa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function viI(e){let r=await new cUy.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 biI({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,u,s,l)=>{c.versions[u]==null&&(c.versions[u]={});let m=t3i(s.name,l),O=await bTr({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:l});O!=null&&(c.versions[u][s.name]={previousVersion:s.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,u,s)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=t3i(u.name,s),m=await bTr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:s});m!=null&&(o.versions[c][f][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function dUy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await CTr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(i!=null&&f.groupName!==i))for(let u of f.generators)n!=null&&u.name!==n||await r(a.workspaceName,f.groupName,u,o)}})}))}function pUy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let f=Sxe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function nFu({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await biI({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[f,u]of Object.entries(c.versions))o.push(...pUy(u,f,t.logger));else o.push(...pUy(c.versions,void 0,t.logger))}return o}var RZo=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${i} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var yro=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var _Rf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),_Uy=typeof globalThis.AbortController=="function",hUy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",yUy=typeof globalThis.ReadableStream=="function",vUy=typeof globalThis.FormData=="function",iFu=["get","post","put","patch","head","delete"],giI=()=>{};giI();var bUy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},aFu=2147483647,gUy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,oFu=Symbol("stop"),mUy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},OUy={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 miI=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=gUy,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},AUy=(e,t,r)=>{let n,i=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),n){i+=n.byteLength;let c=t===0?0:i/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,i),transferredBytes:i},n)}n=a},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},n))}}))},PUy=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(AUy(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},wUy=(e,t,r)=>{if(!e.body)return e;let n=miI(r??e.body);return new Request(e,{duplex:"half",body:AUy(e.body,n,t)})};var vro=e=>e!==null&&typeof e=="object";var NZo=(...e)=>{for(let t of e)if((!vro(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return vRf({},...e)},hRf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,o]of i.entries())n&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function sFu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:vRf(e[r]??[],t[r]??[])}var yRf=(e={},t={})=>({beforeRequest:sFu(e,t,"beforeRequest"),beforeRetry:sFu(e,t,"beforeRetry"),afterResponse:sFu(e,t,"afterResponse"),beforeError:sFu(e,t,"beforeError")}),vRf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(vro(i)){for(let[a,o]of Object.entries(i))vro(o)&&a in t&&(o=vRf(t[a],o)),t={...t,[a]:o};vro(i.hooks)&&(n=yRf(n,i.hooks),t.hooks=n),vro(i.headers)&&(r=hRf(r,i.headers),t.headers=r)}return t};var EUy=e=>iFu.includes(e)?e.toUpperCase():e,OiI=["get","put","head","delete","options","trace"],AiI=[408,413,429,500,502,503,504],PiI=[413,429,503],jUy={limit:2,methods:OiI,statusCodes:AiI,afterStatusCodes:PiI,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},SUy=(e={})=>{if(typeof e=="number")return{...jUy,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{...jUy,...e}};async function bRf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new yro(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function gRf(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var DUy=(e,t)=>{let r={};for(let n in t)!(n in OUy)&&!(n in mUy)&&!(n in e)&&(r[n]=t[n]);return r},CUy=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;var FZo=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>aFu)throw new RangeError(`The \`timeout\` option cannot be greater than ${aFu}`);await Promise.resolve();let c=await n._fetch();for(let f of n._options.hooks.afterResponse){let u=await f(n.request,n._options,n._decorateResponse(c.clone()));u instanceof globalThis.Response&&(c=u)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let f=new RZo(c,n.request,n._options);for(let u of n._options.hooks.beforeError)f=await u(f);throw f}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!yUy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return PUy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{let c=n._originalRequest,f=[];c&&!c.bodyUsed&&f.push(c.body?.cancel()),n.request.bodyUsed||f.push(n.request.body?.cancel()),await Promise.all(f)});for(let[c,f]of Object.entries(bUy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||f);let u=await o;if(c==="json"){if(u.status===204)return"";let s=await u.text();return s===""?"":r.parseJson?r.parseJson(s):JSON.parse(s)}return u[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:hRf(this._input.headers,r.headers),hooks:yRf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:EUy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:SUy(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(_Uy&&hUy){let n=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=n?AbortSignal.any([n,this.abortController.signal]):this.abortController.signal}if(_Rf&&(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),CUy(this._options.searchParams)){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(vUy&&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(!_Rf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=wUy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof yro)throw t;if(t instanceof RZo){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let n=Math.min(this._calculateRetryDelay(r),aFu);if(this._retryCount<1)throw r;await gRf(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===oFu)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=DUy(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):bRf(this._originalRequest,t,this.abortController,this._options)}};var mRf=e=>{let t=(r,n)=>FZo.create(r,NZo(e,n));for(let r of iFu)t[r]=(n,i)=>FZo.create(n,NZo(e,i,{method:r}));return t.create=r=>mRf(NZo(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),mRf(NZo(e,r))),t.stop=oFu,t},wiI=mRf(),IUy=wiI;var kUy=Hi(ZUy(),1);function jRf(e){let t=(0,kUy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var JVy=Hi(HVy(),1),KVy=Hi(pTu(),1),xRf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},zRf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function QRf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??jRf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,JVy.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let u;try{u=await IUy(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new xRf(e):l}if(t.allVersions)return u;let s=new zRf(e,r);if(u["dist-tags"][r]){let{time:l}=u;u=u.versions[u["dist-tags"][r]],u.time=l}else if(r){let l=!!u.versions[r];if(n&&!l)for(let[O,P]of Object.entries(u.versions))P.deprecated&&delete u.versions[O];if(!l){let O=Object.keys(u.versions);if(r=KVy.default.maxSatisfying(O,r),!r)throw s}let{time:m}=u;if(u=u.versions[r],u.time=m,!u)throw s}return u}async function Tla(e,t){let{version:r}=await QRf(e.toLowerCase(),t);return r}async function z7i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Tla(e.packageName,{version:t?"prerelease":"latest"})}var $Vy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],gFu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=sE.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new rFu(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(i==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.120.1"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Mf.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new jne}failWithoutThrowing(t,r){this.didSucceed=!1,kNu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await jZa()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await fUy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
2682
2682
  `)||(r+=`
2683
2683
  `),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=pJl(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new CZo(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(a){throw a.message.includes("globalThis")?(n.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),n.failWithoutThrowing()):n.failWithoutThrowing(void 0,a),new jne}finally{n.finish()}return i}async instrumentPostHogEvent(t){this.isLocal||(await jZa()).sendEvent(t)}logger=G6r((t,...r)=>this.log(t,...r));stderr=G6r((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=YVy(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?YVy(this.longestWorkspaceName):r).length,i=r.padEnd(n),a=$Vy[this.numTasks++%$Vy.length],o=Mf.hex(a)(i);return{...this.constructTaskInit(),logPrefix:o}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===gV.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let n=t.filter(i=>Axi.indexOf(i.level)>=Axi.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===sE.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 z7i({cliEnvironment:this.environment,includePreReleases:t}),n=Sxe(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},a=await nFu({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){try{return await rRf({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r,theme:{prefix:Mf.yellow("?"),style:{answer:i=>Mf.cyan(i),message:i=>Mf.bold(i),highlight:i=>Mf.cyan(i)}}})}catch(n){throw n?.name==="ExitPromptError"?(this.logger.info(`
2684
2684
  Cancelled by user.`),new jne):n}}async getInput(t){return await Zqf({message:t.message,default:t.default})}};function YVy(e){return`[${e}]:`}var mqr=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:n,absoluteFilePath:i,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=n,this.absoluteFilePath=i,this.changelog=a}};function mFu(e,t,r,n){if(typeof r!="function")throw new Error("method for before hook must be a function");return n||(n={}),Array.isArray(t)?t.reverse().reduce((i,a)=>mFu.bind(null,e,a,i,n),r)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((i,a)=>a.hook.bind(null,i,n),r)():r(n))}function XVy(e,t,r,n){let i=n;e.registry[r]||(e.registry[r]=[]),t==="before"&&(n=(a,o)=>Promise.resolve().then(i.bind(null,o)).then(a.bind(null,o))),t==="after"&&(n=(a,o)=>{let c;return Promise.resolve().then(a.bind(null,o)).then(f=>(c=f,i(c,o))).then(()=>c)}),t==="error"&&(n=(a,o)=>Promise.resolve().then(a.bind(null,o)).catch(c=>i(c,o))),e.registry[r].push({hook:n,orig:i})}function ZVy(e,t,r){if(!e.registry[t])return;let n=e.registry[t].map(i=>i.orig).indexOf(r);n!==-1&&e.registry[t].splice(n,1)}var kVy=Function.bind,eWy=kVy.bind(kVy);function tWy(e,t,r){let n=eWy(ZVy,null).apply(null,r?[t,r]:[t]);e.api={remove:n},e.remove=n,["before","error","after","wrap"].forEach(i=>{let a=r?[t,i,r]:[t,i];e[i]=e.api[i]=eWy(XVy,null).apply(null,a)})}function IaI(){let e=Symbol("Singular"),t={registry:{}},r=mFu.bind(null,t,e);return tWy(r,t,e),r}function MaI(){let e={registry:{}},t=mFu.bind(null,e);return tWy(t,e),t}var rWy={Singular:IaI,Collection:MaI};var BaI="0.0.0-development",TaI=`octokit-endpoint.js/${BaI} ${Nfe()}`,qaI={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":TaI},mediaType:{format:""}};function RaI(e){return e?Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{}):{}}function NaI(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}function aWy(e,t){let r=Object.assign({},e);return Object.keys(t).forEach(n=>{NaI(t[n])?n in e?r[n]=aWy(e[n],t[n]):Object.assign(r,{[n]:t[n]}):Object.assign(r,{[n]:t[n]})}),r}function nWy(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function URf(e,t,r){if(typeof t=="string"){let[i,a]=t.split(" ");r=Object.assign(a?{method:i,url:a}:{url:i},r)}else r=Object.assign({},t);r.headers=RaI(r.headers),nWy(r),nWy(r.headers);let n=aWy(e||{},r);return r.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(n.mediaType.previews=e.mediaType.previews.filter(i=>!n.mediaType.previews.includes(i)).concat(n.mediaType.previews)),n.mediaType.previews=(n.mediaType.previews||[]).map(i=>i.replace(/-preview/,""))),n}function FaI(e,t){let r=/\?/.test(e)?"&":"?",n=Object.keys(t);return n.length===0?e:e+r+n.map(i=>i==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${i}=${encodeURIComponent(t[i])}`).join("&")}var xaI=/\{[^{}}]+\}/g;function zaI(e){return e.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g,"").split(/,/)}function QaI(e){let t=e.match(xaI);return t?t.map(zaI).reduce((r,n)=>r.concat(n),[]):[]}function iWy(e,t){let r={__proto__:null};for(let n of Object.keys(e))t.indexOf(n)===-1&&(r[n]=e[n]);return r}function oWy(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function jro(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function VZo(e,t,r){return t=e==="+"||e==="#"?oWy(t):jro(t),r?jro(r)+"="+t:t}function wro(e){return e!=null}function LRf(e){return e===";"||e==="&"||e==="?"}function LaI(e,t,r,n){var i=e[r],a=[];if(wro(i)&&i!=="")if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")i=i.toString(),n&&n!=="*"&&(i=i.substring(0,parseInt(n,10))),a.push(VZo(t,i,LRf(t)?r:""));else if(n==="*")Array.isArray(i)?i.filter(wro).forEach(function(o){a.push(VZo(t,o,LRf(t)?r:""))}):Object.keys(i).forEach(function(o){wro(i[o])&&a.push(VZo(t,i[o],o))});else{let o=[];Array.isArray(i)?i.filter(wro).forEach(function(c){o.push(VZo(t,c))}):Object.keys(i).forEach(function(c){wro(i[c])&&(o.push(jro(c)),o.push(VZo(t,i[c].toString())))}),LRf(t)?a.push(jro(r)+"="+o.join(",")):o.length!==0&&a.push(o.join(","))}else t===";"?wro(i)&&a.push(jro(r)):i===""&&(t==="&"||t==="?")?a.push(jro(r)+"="):i===""&&a.push("");return a}function UaI(e){return{expand:VaI.bind(null,e)}}function VaI(e,t){var r=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(n,i,a){if(i){let c="",f=[];if(r.indexOf(i.charAt(0))!==-1&&(c=i.charAt(0),i=i.substr(1)),i.split(/,/g).forEach(function(u){var s=/([^:\*]*)(?::(\d+)|(\*))?/.exec(u);f.push(LaI(t,c,s[1],s[2]||s[3]))}),c&&c!=="+"){var o=",";return c==="?"?o="&":c!=="#"&&(o=c),(f.length!==0?c:"")+f.join(o)}else return f.join(",")}else return oWy(a)}),e==="/"?e:e.replace(/\/$/,"")}function sWy(e){let t=e.method.toUpperCase(),r=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),n=Object.assign({},e.headers),i,a=iWy(e,["method","baseUrl","url","headers","request","mediaType"]),o=QaI(r);r=UaI(r).expand(a),/^http/.test(r)||(r=e.baseUrl+r);let c=Object.keys(e).filter(s=>o.includes(s)).concat("baseUrl"),f=iWy(a,c);if(!/application\/octet-stream/i.test(n.accept)&&(e.mediaType.format&&(n.accept=n.accept.split(/,/).map(s=>s.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),r.endsWith("/graphql")&&e.mediaType.previews?.length)){let s=n.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g)||[];n.accept=s.concat(e.mediaType.previews).map(l=>{let m=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${l}-preview${m}`}).join(",")}return["GET","HEAD"].includes(t)?r=FaI(r,f):"data"in f?i=f.data:Object.keys(f).length&&(i=f),!n["content-type"]&&typeof i<"u"&&(n["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof i>"u"&&(i=""),Object.assign({method:t,url:r,headers:n},typeof i<"u"?{body:i}:null,e.request?{request:e.request}:null)}function WaI(e,t,r){return sWy(URf(e,t,r))}function uWy(e,t){let r=URf(e,t),n=WaI.bind(null,r);return Object.assign(n,{DEFAULTS:r,defaults:uWy.bind(null,r),merge:URf.bind(null,r),parse:sWy})}var cWy=uWy(null,qaI);var hWy=Hi(pWy(),1);var Oqr=class extends Error{name;status;request;response;constructor(t,r,n){super(t),this.name="HttpError",this.status=Number.parseInt(r),Number.isNaN(this.status)&&(this.status=0),"response"in n&&(this.response=n.response);let i=Object.assign({},n.request);n.request.headers.authorization&&(i.headers=Object.assign({},n.request.headers,{authorization:n.request.headers.authorization.replace(/(?<! ) .*$/," [REDACTED]")})),i.url=i.url.replace(/\bclient_secret=\w+/g,"client_secret=[REDACTED]").replace(/\baccess_token=\w+/g,"access_token=[REDACTED]"),this.request=i}};var GaI="10.0.6",HaI={headers:{"user-agent":`octokit-request.js/${GaI} ${Nfe()}`}};function JaI(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}async function _Wy(e){let t=e.request?.fetch||globalThis.fetch;if(!t)throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");let r=e.request?.log||console,n=e.request?.parseSuccessResponseBody!==!1,i=JaI(e.body)||Array.isArray(e.body)?JSON.stringify(e.body):e.body,a=Object.fromEntries(Object.entries(e.headers).map(([l,m])=>[l,String(m)])),o;try{o=await t(e.url,{method:e.method,body:i,redirect:e.request?.redirect,headers:a,signal:e.request?.signal,...e.body&&{duplex:"half"}})}catch(l){let m="Unknown Error";if(l instanceof Error){if(l.name==="AbortError")throw l.status=500,l;m=l.message,l.name==="TypeError"&&"cause"in l&&(l.cause instanceof Error?m=l.cause.message:typeof l.cause=="string"&&(m=l.cause))}let O=new Oqr(m,500,{request:e});throw O.cause=l,O}let c=o.status,f=o.url,u={};for(let[l,m]of o.headers)u[l]=m;let s={url:f,status:c,headers:u,data:""};if("deprecation"in u){let l=u.link&&u.link.match(/<([^<>]+)>; rel="deprecation"/),m=l&&l.pop();r.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${u.sunset}${m?`. See ${m}`:""}`)}if(c===204||c===205)return s;if(e.method==="HEAD"){if(c<400)return s;throw new Oqr(o.statusText,c,{response:s,request:e})}if(c===304)throw s.data=await VRf(o),new Oqr("Not modified",c,{response:s,request:e});if(c>=400)throw s.data=await VRf(o),new Oqr($aI(s.data),c,{response:s,request:e});return s.data=n?await VRf(o):o.body,s}async function VRf(e){let t=e.headers.get("content-type");if(!t)return e.text().catch(()=>"");let r=(0,hWy.safeParse)(t);if(KaI(r)){let n="";try{return n=await e.text(),JSON.parse(n)}catch{return n}}else return r.type.startsWith("text/")||r.parameters.charset?.toLowerCase()==="utf-8"?e.text().catch(()=>""):e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function KaI(e){return e.type==="application/json"||e.type==="application/scim+json"}function $aI(e){if(typeof e=="string")return e;if(e instanceof ArrayBuffer)return"Unknown error";if("message"in e){let t="documentation_url"in e?` - ${e.documentation_url}`:"";return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(r=>JSON.stringify(r)).join(", ")}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function WRf(e,t){let r=e.defaults(t);return Object.assign(function(i,a){let o=r.merge(i,a);if(!o.request||!o.request.hook)return _Wy(r.parse(o));let c=(f,u)=>_Wy(r.parse(r.merge(f,u)));return Object.assign(c,{endpoint:r,defaults:WRf.bind(null,r)}),o.request.hook(c,o)},{endpoint:r,defaults:WRf.bind(null,r)})}var H7=WRf(cWy,HaI);var YaI="0.0.0-development";function XaI(e){return`Request failed due to following response errors:
@@ -3015,10 +3015,10 @@ l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
3015
3015
  ?)[ \r ]*`,O5f="[\u0300-\u036F]",YQI=new RegExp(O5f+"+$"),XQI="("+eyv+"+)|"+($QI+"|")+"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]"+(O5f+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(O5f+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+KQI)+("|"+JQI+")"),dLu=class{constructor(t,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=r,this.tokenRegex=new RegExp(XQI,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,r){this.catcodes[t]=r}lex(){var t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new Kht("EOF",new Snt(this,r,r));var n=this.tokenRegex.exec(t);if(n===null||n.index!==r)throw new wg("Unexpected character: '"+t[r]+"'",new Kht(t[r],new Snt(this,r,r+1)));var i=n[6]||n[3]||(n[2]?"\\ ":" ");if(this.catcodes[i]===14){var a=t.indexOf(`
3016
3016
  `,this.tokenRegex.lastIndex);return a===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new Kht(i,new Snt(this,r,this.tokenRegex.lastIndex))}},A5f=class{constructor(t,r){t===void 0&&(t={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new wg("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var r in t)t.hasOwnProperty(r)&&(t[r]==null?delete this.current[r]:this.current[r]=t[r])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,r,n){if(n===void 0&&(n=!1),n){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(t)&&(a[t]=this.current[t])}r==null?delete this.current[t]:this.current[t]=r}},ZQI=Vhv;Ks("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});Ks("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});Ks("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});Ks("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});Ks("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});Ks("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Ks("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var shv={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Ks("\\char",function(e){var t=e.popToken(),r,n="";if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")n=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new wg("\\char` missing argument");n=t.text.charCodeAt(0)}else r=10;if(r){if(n=shv[t.text],n==null||n>=r)throw new wg("Invalid base-"+r+" digit "+t.text);for(var i;(i=shv[e.future().text])!=null&&i<r;)n*=r,n+=i,e.popToken()}return"\\@char{"+n+"}"});var x5f=(e,t,r,n)=>{var i=e.consumeArg().tokens;if(i.length!==1)throw new wg("\\newcommand's first argument must be a macro name");var a=i[0].text,o=e.isDefined(a);if(o&&!t)throw new wg("\\newcommand{"+a+"} attempting to redefine "+(a+"; use \\renewcommand"));if(!o&&!r)throw new wg("\\renewcommand{"+a+"} when command "+a+" does not yet exist; use \\newcommand");var c=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var f="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)f+=u.text,u=e.expandNextToken();if(!f.match(/^\s*[0-9]+\s*$/))throw new wg("Invalid number of arguments: "+f);c=parseInt(f),i=e.consumeArg().tokens}return o&&n||e.macros.set(a,{tokens:i,numArgs:c}),""};Ks("\\newcommand",e=>x5f(e,!1,!0,!1));Ks("\\renewcommand",e=>x5f(e,!0,!1,!1));Ks("\\providecommand",e=>x5f(e,!0,!0,!0));Ks("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(r=>r.text).join("")),""});Ks("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(r=>r.text).join("")),""});Ks("\\show",e=>{var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),m2i[r],QV.math[r],QV.text[r]),""});Ks("\\bgroup","{");Ks("\\egroup","}");Ks("~","\\nobreakspace");Ks("\\lq","`");Ks("\\rq","'");Ks("\\aa","\\r a");Ks("\\AA","\\r A");Ks("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`\xA9}");Ks("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Ks("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}");Ks("\u212C","\\mathscr{B}");Ks("\u2130","\\mathscr{E}");Ks("\u2131","\\mathscr{F}");Ks("\u210B","\\mathscr{H}");Ks("\u2110","\\mathscr{I}");Ks("\u2112","\\mathscr{L}");Ks("\u2133","\\mathscr{M}");Ks("\u211B","\\mathscr{R}");Ks("\u212D","\\mathfrak{C}");Ks("\u210C","\\mathfrak{H}");Ks("\u2128","\\mathfrak{Z}");Ks("\\Bbbk","\\Bbb{k}");Ks("\xB7","\\cdotp");Ks("\\llap","\\mathllap{\\textrm{#1}}");Ks("\\rlap","\\mathrlap{\\textrm{#1}}");Ks("\\clap","\\mathclap{\\textrm{#1}}");Ks("\\mathstrut","\\vphantom{(}");Ks("\\underbar","\\underline{\\text{#1}}");Ks("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');Ks("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}");Ks("\\ne","\\neq");Ks("\u2260","\\neq");Ks("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}");Ks("\u2209","\\notin");Ks("\u2258","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}");Ks("\u2259","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");Ks("\u225A","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");Ks("\u225B","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}");Ks("\u225D","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}");Ks("\u225E","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}");Ks("\u225F","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");Ks("\u27C2","\\perp");Ks("\u203C","\\mathclose{!\\mkern-0.8mu!}");Ks("\u220C","\\notni");Ks("\u231C","\\ulcorner");Ks("\u231D","\\urcorner");Ks("\u231E","\\llcorner");Ks("\u231F","\\lrcorner");Ks("\xA9","\\copyright");Ks("\xAE","\\textregistered");Ks("\uFE0F","\\textregistered");Ks("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Ks("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Ks("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Ks("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Ks("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Ks("\u22EE","\\vdots");Ks("\\varGamma","\\mathit{\\Gamma}");Ks("\\varDelta","\\mathit{\\Delta}");Ks("\\varTheta","\\mathit{\\Theta}");Ks("\\varLambda","\\mathit{\\Lambda}");Ks("\\varXi","\\mathit{\\Xi}");Ks("\\varPi","\\mathit{\\Pi}");Ks("\\varSigma","\\mathit{\\Sigma}");Ks("\\varUpsilon","\\mathit{\\Upsilon}");Ks("\\varPhi","\\mathit{\\Phi}");Ks("\\varPsi","\\mathit{\\Psi}");Ks("\\varOmega","\\mathit{\\Omega}");Ks("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Ks("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Ks("\\boxed","\\fbox{$\\displaystyle{#1}$}");Ks("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Ks("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Ks("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Ks("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Ks("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var uhv={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};Ks("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in uhv?t=uhv[r]:(r.slice(0,4)==="\\not"||r in QV.math&&VE.contains(["bin","rel"],QV.math[r].group))&&(t="\\dotsb"),t});var z5f={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Ks("\\dotso",function(e){var t=e.future().text;return t in z5f?"\\ldots\\,":"\\ldots"});Ks("\\dotsc",function(e){var t=e.future().text;return t in z5f&&t!==","?"\\ldots\\,":"\\ldots"});Ks("\\cdots",function(e){var t=e.future().text;return t in z5f?"\\@cdots\\,":"\\@cdots"});Ks("\\dotsb","\\cdots");Ks("\\dotsm","\\cdots");Ks("\\dotsi","\\!\\cdots");Ks("\\dotsx","\\ldots\\,");Ks("\\DOTSI","\\relax");Ks("\\DOTSB","\\relax");Ks("\\DOTSX","\\relax");Ks("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Ks("\\,","\\tmspace+{3mu}{.1667em}");Ks("\\thinspace","\\,");Ks("\\>","\\mskip{4mu}");Ks("\\:","\\tmspace+{4mu}{.2222em}");Ks("\\medspace","\\:");Ks("\\;","\\tmspace+{5mu}{.2777em}");Ks("\\thickspace","\\;");Ks("\\!","\\tmspace-{3mu}{.1667em}");Ks("\\negthinspace","\\!");Ks("\\negmedspace","\\tmspace-{4mu}{.2222em}");Ks("\\negthickspace","\\tmspace-{5mu}{.277em}");Ks("\\enspace","\\kern.5em ");Ks("\\enskip","\\hskip.5em\\relax");Ks("\\quad","\\hskip1em\\relax");Ks("\\qquad","\\hskip2em\\relax");Ks("\\tag","\\@ifstar\\tag@literal\\tag@paren");Ks("\\tag@paren","\\tag@literal{({#1})}");Ks("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new wg("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Ks("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Ks("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Ks("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Ks("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Ks("\\newline","\\\\\\relax");Ks("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var tyv=S0(tWr["Main-Regular"][84][1]-.7*tWr["Main-Regular"][65][1]);Ks("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+tyv+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Ks("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+tyv+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Ks("\\hspace","\\@ifstar\\@hspacer\\@hspace");Ks("\\@hspace","\\hskip #1\\relax");Ks("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Ks("\\ordinarycolon",":");Ks("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Ks("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Ks("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Ks("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Ks("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Ks("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Ks("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Ks("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Ks("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Ks("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Ks("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Ks("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Ks("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Ks("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Ks("\u2237","\\dblcolon");Ks("\u2239","\\eqcolon");Ks("\u2254","\\coloneqq");Ks("\u2255","\\eqqcolon");Ks("\u2A74","\\Coloneqq");Ks("\\ratio","\\vcentcolon");Ks("\\coloncolon","\\dblcolon");Ks("\\colonequals","\\coloneqq");Ks("\\coloncolonequals","\\Coloneqq");Ks("\\equalscolon","\\eqqcolon");Ks("\\equalscoloncolon","\\Eqqcolon");Ks("\\colonminus","\\coloneq");Ks("\\coloncolonminus","\\Coloneq");Ks("\\minuscolon","\\eqcolon");Ks("\\minuscoloncolon","\\Eqcolon");Ks("\\coloncolonapprox","\\Colonapprox");Ks("\\coloncolonsim","\\Colonsim");Ks("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ks("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ks("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ks("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ks("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");Ks("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Ks("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Ks("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Ks("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Ks("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Ks("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Ks("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Ks("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Ks("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}");Ks("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}");Ks("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}");Ks("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}");Ks("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}");Ks("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}");Ks("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}");Ks("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}");Ks("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}");Ks("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}");Ks("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228A}");Ks("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2ACB}");Ks("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228B}");Ks("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2ACC}");Ks("\\imath","\\html@mathml{\\@imath}{\u0131}");Ks("\\jmath","\\html@mathml{\\@jmath}{\u0237}");Ks("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}");Ks("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}");Ks("\u27E6","\\llbracket");Ks("\u27E7","\\rrbracket");Ks("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}");Ks("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}");Ks("\u2983","\\lBrace");Ks("\u2984","\\rBrace");Ks("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}");Ks("\u29B5","\\minuso");Ks("\\darr","\\downarrow");Ks("\\dArr","\\Downarrow");Ks("\\Darr","\\Downarrow");Ks("\\lang","\\langle");Ks("\\rang","\\rangle");Ks("\\uarr","\\uparrow");Ks("\\uArr","\\Uparrow");Ks("\\Uarr","\\Uparrow");Ks("\\N","\\mathbb{N}");Ks("\\R","\\mathbb{R}");Ks("\\Z","\\mathbb{Z}");Ks("\\alef","\\aleph");Ks("\\alefsym","\\aleph");Ks("\\Alpha","\\mathrm{A}");Ks("\\Beta","\\mathrm{B}");Ks("\\bull","\\bullet");Ks("\\Chi","\\mathrm{X}");Ks("\\clubs","\\clubsuit");Ks("\\cnums","\\mathbb{C}");Ks("\\Complex","\\mathbb{C}");Ks("\\Dagger","\\ddagger");Ks("\\diamonds","\\diamondsuit");Ks("\\empty","\\emptyset");Ks("\\Epsilon","\\mathrm{E}");Ks("\\Eta","\\mathrm{H}");Ks("\\exist","\\exists");Ks("\\harr","\\leftrightarrow");Ks("\\hArr","\\Leftrightarrow");Ks("\\Harr","\\Leftrightarrow");Ks("\\hearts","\\heartsuit");Ks("\\image","\\Im");Ks("\\infin","\\infty");Ks("\\Iota","\\mathrm{I}");Ks("\\isin","\\in");Ks("\\Kappa","\\mathrm{K}");Ks("\\larr","\\leftarrow");Ks("\\lArr","\\Leftarrow");Ks("\\Larr","\\Leftarrow");Ks("\\lrarr","\\leftrightarrow");Ks("\\lrArr","\\Leftrightarrow");Ks("\\Lrarr","\\Leftrightarrow");Ks("\\Mu","\\mathrm{M}");Ks("\\natnums","\\mathbb{N}");Ks("\\Nu","\\mathrm{N}");Ks("\\Omicron","\\mathrm{O}");Ks("\\plusmn","\\pm");Ks("\\rarr","\\rightarrow");Ks("\\rArr","\\Rightarrow");Ks("\\Rarr","\\Rightarrow");Ks("\\real","\\Re");Ks("\\reals","\\mathbb{R}");Ks("\\Reals","\\mathbb{R}");Ks("\\Rho","\\mathrm{P}");Ks("\\sdot","\\cdot");Ks("\\sect","\\S");Ks("\\spades","\\spadesuit");Ks("\\sub","\\subset");Ks("\\sube","\\subseteq");Ks("\\supe","\\supseteq");Ks("\\Tau","\\mathrm{T}");Ks("\\thetasym","\\vartheta");Ks("\\weierp","\\wp");Ks("\\Zeta","\\mathrm{Z}");Ks("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Ks("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Ks("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Ks("\\bra","\\mathinner{\\langle{#1}|}");Ks("\\ket","\\mathinner{|{#1}\\rangle}");Ks("\\braket","\\mathinner{\\langle{#1}\\rangle}");Ks("\\Bra","\\left\\langle#1\\right|");Ks("\\Ket","\\left|#1\\right\\rangle");var ryv=e=>t=>{var r=t.consumeArg().tokens,n=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,o=t.macros.get("|"),c=t.macros.get("\\|");t.macros.beginGroup();var f=l=>m=>{e&&(m.macros.set("|",o),i.length&&m.macros.set("\\|",c));var O=l;if(!l&&i.length){var P=m.future();P.text==="|"&&(m.popToken(),O=!0)}return{tokens:O?i:n,numArgs:0}};t.macros.set("|",f(!1)),i.length&&t.macros.set("\\|",f(!0));var u=t.consumeArg().tokens,s=t.expandTokens([...a,...u,...r]);return t.macros.endGroup(),{tokens:s.reverse(),numArgs:0}};Ks("\\bra@ket",ryv(!1));Ks("\\bra@set",ryv(!0));Ks("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Ks("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Ks("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Ks("\\angln","{\\angl n}");Ks("\\blue","\\textcolor{##6495ed}{#1}");Ks("\\orange","\\textcolor{##ffa500}{#1}");Ks("\\pink","\\textcolor{##ff00af}{#1}");Ks("\\red","\\textcolor{##df0030}{#1}");Ks("\\green","\\textcolor{##28ae7b}{#1}");Ks("\\gray","\\textcolor{gray}{#1}");Ks("\\purple","\\textcolor{##9d38bd}{#1}");Ks("\\blueA","\\textcolor{##ccfaff}{#1}");Ks("\\blueB","\\textcolor{##80f6ff}{#1}");Ks("\\blueC","\\textcolor{##63d9ea}{#1}");Ks("\\blueD","\\textcolor{##11accd}{#1}");Ks("\\blueE","\\textcolor{##0c7f99}{#1}");Ks("\\tealA","\\textcolor{##94fff5}{#1}");Ks("\\tealB","\\textcolor{##26edd5}{#1}");Ks("\\tealC","\\textcolor{##01d1c1}{#1}");Ks("\\tealD","\\textcolor{##01a995}{#1}");Ks("\\tealE","\\textcolor{##208170}{#1}");Ks("\\greenA","\\textcolor{##b6ffb0}{#1}");Ks("\\greenB","\\textcolor{##8af281}{#1}");Ks("\\greenC","\\textcolor{##74cf70}{#1}");Ks("\\greenD","\\textcolor{##1fab54}{#1}");Ks("\\greenE","\\textcolor{##0d923f}{#1}");Ks("\\goldA","\\textcolor{##ffd0a9}{#1}");Ks("\\goldB","\\textcolor{##ffbb71}{#1}");Ks("\\goldC","\\textcolor{##ff9c39}{#1}");Ks("\\goldD","\\textcolor{##e07d10}{#1}");Ks("\\goldE","\\textcolor{##a75a05}{#1}");Ks("\\redA","\\textcolor{##fca9a9}{#1}");Ks("\\redB","\\textcolor{##ff8482}{#1}");Ks("\\redC","\\textcolor{##f9685d}{#1}");Ks("\\redD","\\textcolor{##e84d39}{#1}");Ks("\\redE","\\textcolor{##bc2612}{#1}");Ks("\\maroonA","\\textcolor{##ffbde0}{#1}");Ks("\\maroonB","\\textcolor{##ff92c6}{#1}");Ks("\\maroonC","\\textcolor{##ed5fa6}{#1}");Ks("\\maroonD","\\textcolor{##ca337c}{#1}");Ks("\\maroonE","\\textcolor{##9e034e}{#1}");Ks("\\purpleA","\\textcolor{##ddd7ff}{#1}");Ks("\\purpleB","\\textcolor{##c6b9fc}{#1}");Ks("\\purpleC","\\textcolor{##aa87ff}{#1}");Ks("\\purpleD","\\textcolor{##7854ab}{#1}");Ks("\\purpleE","\\textcolor{##543b78}{#1}");Ks("\\mintA","\\textcolor{##f5f9e8}{#1}");Ks("\\mintB","\\textcolor{##edf2df}{#1}");Ks("\\mintC","\\textcolor{##e0e5cc}{#1}");Ks("\\grayA","\\textcolor{##f6f7f7}{#1}");Ks("\\grayB","\\textcolor{##f0f1f2}{#1}");Ks("\\grayC","\\textcolor{##e3e5e6}{#1}");Ks("\\grayD","\\textcolor{##d6d8da}{#1}");Ks("\\grayE","\\textcolor{##babec2}{#1}");Ks("\\grayF","\\textcolor{##888d93}{#1}");Ks("\\grayG","\\textcolor{##626569}{#1}");Ks("\\grayH","\\textcolor{##3b3e40}{#1}");Ks("\\grayI","\\textcolor{##21242c}{#1}");Ks("\\kaBlue","\\textcolor{##314453}{#1}");Ks("\\kaGreen","\\textcolor{##71B307}{#1}");var nyv={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},P5f=class{constructor(t,r,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new A5f(ZQI,r.macros),this.mode=n,this.stack=[]}feed(t){this.lexer=new dLu(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var r,n,i;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:i,end:n}=this.consumeArg(["]"])}else({tokens:i,start:r,end:n}=this.consumeArg());return this.pushToken(new Kht("EOF",n.loc)),this.pushTokens(i),r.range(n,"")}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var r=[],n=t&&t.length>0;n||this.consumeSpaces();var i=this.future(),a,o=0,c=0;do{if(a=this.popToken(),r.push(a),a.text==="{")++o;else if(a.text==="}"){if(--o,o===-1)throw new wg("Extra }",a)}else if(a.text==="EOF")throw new wg("Unexpected end of input in a macro argument, expected '"+(t&&n?t[c]:"}")+"'",a);if(t&&n)if((o===0||o===1&&t[c]==="{")&&a.text===t[c]){if(++c,c===t.length){r.splice(-c,c);break}}else c=0}while(o!==0||n);return i.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:i,end:a}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new wg("The length of delimiters doesn't match the number of args!");for(var n=r[0],i=0;i<n.length;i++){var a=this.popToken();if(n[i]!==a.text)throw new wg("Use of the macro doesn't match its definition",a)}}for(var o=[],c=0;c<t;c++)o.push(this.consumeArg(r&&r[c+1]).tokens);return o}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new wg("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var r=this.popToken(),n=r.text,i=r.noexpand?null:this._getExpansion(n);if(i==null||t&&i.unexpandable){if(t&&i==null&&n[0]==="\\"&&!this.isDefined(n))throw new wg("Undefined control sequence: "+n);return this.pushToken(r),!1}this.countExpansion(1);var a=i.tokens,o=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){a=a.slice();for(var c=a.length-1;c>=0;--c){var f=a[c];if(f.text==="#"){if(c===0)throw new wg("Incomplete placeholder at end of macro body",f);if(f=a[--c],f.text==="#")a.splice(c+1,1);else if(/^[1-9]$/.test(f.text))a.splice(c,2,...o[+f.text-1]);else throw new wg("Not a valid argument number",f)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new Kht(t)]):void 0}expandTokens(t){var r=[],n=this.stack.length;for(this.pushTokens(t);this.stack.length>n;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),r.push(i)}return this.countExpansion(r.length),r}expandMacroAsText(t){var r=this.expandMacro(t);return r&&r.map(n=>n.text).join("")}_getExpansion(t){var r=this.macros.get(t);if(r==null)return r;if(t.length===1){var n=this.lexer.catcodes[t];if(n!=null&&n!==13)return}var i=typeof r=="function"?r(this):r;if(typeof i=="string"){var a=0;if(i.indexOf("#")!==-1)for(var o=i.replace(/##/g,"");o.indexOf("#"+(a+1))!==-1;)++a;for(var c=new dLu(i,this.settings),f=[],u=c.lex();u.text!=="EOF";)f.push(u),u=c.lex();f.reverse();var s={tokens:f,numArgs:a};return s}return i}isDefined(t){return this.macros.has(t)||m2i.hasOwnProperty(t)||QV.math.hasOwnProperty(t)||QV.text.hasOwnProperty(t)||nyv.hasOwnProperty(t)}isExpandable(t){var r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:m2i.hasOwnProperty(t)&&!m2i[t].primitive}},chv=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,nLu=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),f5f={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},lhv={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u1E09:"c\u0327\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u00E7:"c\u0327",\u010F:"d\u030C",\u1E0B:"d\u0307",\u1E11:"d\u0327",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u1E1D:"e\u0327\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u0229:"e\u0327",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u0123:"g\u0327",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u1E29:"h\u0327",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u0137:"k\u0327",\u013A:"l\u0301",\u013E:"l\u030C",\u013C:"l\u0327",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u0146:"n\u0327",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u0157:"r\u0327",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u015F:"s\u0327",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u0163:"t\u0327",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u1E08:"C\u0327\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u00C7:"C\u0327",\u010E:"D\u030C",\u1E0A:"D\u0307",\u1E10:"D\u0327",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u1E1C:"E\u0327\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u0228:"E\u0327",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u0122:"G\u0327",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u1E28:"H\u0327",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0136:"K\u0327",\u0139:"L\u0301",\u013D:"L\u030C",\u013B:"L\u0327",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u0145:"N\u0327",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u0156:"R\u0327",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u015E:"S\u0327",\u0164:"T\u030C",\u1E6A:"T\u0307",\u0162:"T\u0327",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"},pLu=class e{constructor(t,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new P5f(t,r,this.mode),this.settings=r,this.leftrightDepth=0}expect(t,r){if(r===void 0&&(r=!0),this.fetch().text!==t)throw new wg("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var r=this.nextToken;this.consume(),this.gullet.pushToken(new Kht("}")),this.gullet.pushTokens(t);var n=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,n}parseExpression(t,r){for(var n=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(e.endOfExpression.indexOf(i.text)!==-1||r&&i.text===r||t&&m2i[i.text]&&m2i[i.text].infix)break;var a=this.parseAtom(r);if(a){if(a.type==="internal")continue}else break;n.push(a)}return this.mode==="text"&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){for(var r=-1,n,i=0;i<t.length;i++)if(t[i].type==="infix"){if(r!==-1)throw new wg("only one infix operator per group",t[i].token);r=i,n=t[i].replaceWith}if(r!==-1&&n){var a,o,c=t.slice(0,r),f=t.slice(r+1);c.length===1&&c[0].type==="ordgroup"?a=c[0]:a={type:"ordgroup",mode:this.mode,body:c},f.length===1&&f[0].type==="ordgroup"?o=f[0]:o={type:"ordgroup",mode:this.mode,body:f};var u;return n==="\\\\abovefrac"?u=this.callFunction(n,[a,t[r],o],[]):u=this.callFunction(n,[a,o],[]),[u]}else return t}handleSupSubscript(t){var r=this.fetch(),n=r.text;this.consume(),this.consumeSpaces();var i=this.parseGroup(t);if(!i)throw new wg("Expected group after '"+n+"'",r);return i}formatUnsupportedCmd(t){for(var r=[],n=0;n<t.length;n++)r.push({type:"textord",mode:"text",text:t[n]});var i={type:"text",mode:this.mode,body:r},a={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return a}parseAtom(t){var r=this.parseGroup("atom",t);if(this.mode==="text")return r;for(var n,i;;){this.consumeSpaces();var a=this.fetch();if(a.text==="\\limits"||a.text==="\\nolimits"){if(r&&r.type==="op"){var o=a.text==="\\limits";r.limits=o,r.alwaysHandleSupSub=!0}else if(r&&r.type==="operatorname")r.alwaysHandleSupSub&&(r.limits=a.text==="\\limits");else throw new wg("Limit controls must follow a math operator",a);this.consume()}else if(a.text==="^"){if(n)throw new wg("Double superscript",a);n=this.handleSupSubscript("superscript")}else if(a.text==="_"){if(i)throw new wg("Double subscript",a);i=this.handleSupSubscript("subscript")}else if(a.text==="'"){if(n)throw new wg("Double superscript",a);var c={type:"textord",mode:this.mode,text:"\\prime"},f=[c];for(this.consume();this.fetch().text==="'";)f.push(c),this.consume();this.fetch().text==="^"&&f.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:f}}else if(nLu[a.text]){var u=chv.test(a.text),s=[];for(s.push(new Kht(nLu[a.text])),this.consume();;){var l=this.fetch().text;if(!nLu[l]||chv.test(l)!==u)break;s.unshift(new Kht(nLu[l])),this.consume()}var m=this.subparse(s);u?i={type:"ordgroup",mode:"math",body:m}:n={type:"ordgroup",mode:"math",body:m}}else break}return n||i?{type:"supsub",mode:this.mode,base:r,sup:n,sub:i}:r}parseFunction(t,r){var n=this.fetch(),i=n.text,a=m2i[i];if(!a)return null;if(this.consume(),r&&r!=="atom"&&!a.allowedInArgument)throw new wg("Got function '"+i+"' with no arguments"+(r?" as "+r:""),n);if(this.mode==="text"&&!a.allowedInText)throw new wg("Can't use function '"+i+"' in text mode",n);if(this.mode==="math"&&a.allowedInMath===!1)throw new wg("Can't use function '"+i+"' in math mode",n);var{args:o,optArgs:c}=this.parseArguments(i,a);return this.callFunction(i,o,c,n,t)}callFunction(t,r,n,i,a){var o={funcName:t,parser:this,token:i,breakOnTokenText:a},c=m2i[t];if(c&&c.handler)return c.handler(o,r,n);throw new wg("No function handler for "+t)}parseArguments(t,r){var n=r.numArgs+r.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};for(var i=[],a=[],o=0;o<n;o++){var c=r.argTypes&&r.argTypes[o],f=o<r.numOptionalArgs;(r.primitive&&c==null||r.type==="sqrt"&&o===1&&a[0]==null)&&(c="primitive");var u=this.parseGroupOfType("argument to '"+t+"'",c,f);if(f)a.push(u);else if(u!=null)i.push(u);else throw new wg("Null argument, please report this as a bug")}return{args:i,optArgs:a}}parseGroupOfType(t,r,n){switch(r){case"color":return this.parseColorGroup(n);case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,r);case"hbox":{var i=this.parseArgumentGroup(n,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text"}:null}case"raw":{var a=this.parseStringGroup("raw",n);return a!=null?{type:"raw",mode:"text",string:a.text}:null}case"primitive":{if(n)throw new wg("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new wg("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new wg("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,r){var n=this.gullet.scanArgument(r);if(n==null)return null;for(var i="",a;(a=this.fetch()).text!=="EOF";)i+=a.text,this.consume();return this.consume(),n.text=i,n}parseRegexGroup(t,r){for(var n=this.fetch(),i=n,a="",o;(o=this.fetch()).text!=="EOF"&&t.test(a+o.text);)i=o,a+=i.text,this.consume();if(a==="")throw new wg("Invalid "+r+": '"+n.text+"'",n);return n.range(i,a)}parseColorGroup(t){var r=this.parseStringGroup("color",t);if(r==null)return null;var n=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(r.text);if(!n)throw new wg("Invalid color: '"+r.text+"'",r);var i=n[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(t){var r,n=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?r=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):r=this.parseStringGroup("size",t),!r)return null;!t&&r.text.length===0&&(r.text="0pt",n=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(r.text);if(!i)throw new wg("Invalid size: '"+r.text+"'",r);var a={number:+(i[1]+i[2]),unit:i[3]};if(!phv(a))throw new wg("Invalid unit: '"+a.unit+"'",r);return{type:"size",mode:this.mode,value:a,isBlank:n}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var r=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),r==null)return null;var n=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:n}}parseArgumentGroup(t,r){var n=this.gullet.scanArgument(t);if(n==null)return null;var i=this.mode;r&&this.switchMode(r),this.gullet.beginGroup();var a=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:n.loc,body:a};return r&&this.switchMode(i),o}parseGroup(t,r){var n=this.fetch(),i=n.text,a;if(i==="{"||i==="\\begingroup"){this.consume();var o=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var c=this.parseExpression(!1,o),f=this.fetch();this.expect(o),this.gullet.endGroup(),a={type:"ordgroup",mode:this.mode,loc:Snt.range(n,f),body:c,semisimple:i==="\\begingroup"||void 0}}else if(a=this.parseFunction(r,t)||this.parseSymbol(),a==null&&i[0]==="\\"&&!nyv.hasOwnProperty(i)){if(this.settings.throwOnError)throw new wg("Undefined control sequence: "+i,n);a=this.formatUnsupportedCmd(i),this.consume()}return a}formLigatures(t){for(var r=t.length-1,n=0;n<r;++n){var i=t[n],a=i.text;a==="-"&&t[n+1].text==="-"&&(n+1<r&&t[n+2].text==="-"?(t.splice(n,3,{type:"textord",mode:"text",loc:Snt.range(i,t[n+2]),text:"---"}),r-=2):(t.splice(n,2,{type:"textord",mode:"text",loc:Snt.range(i,t[n+1]),text:"--"}),r-=1)),(a==="'"||a==="`")&&t[n+1].text===a&&(t.splice(n,2,{type:"textord",mode:"text",loc:Snt.range(i,t[n+1]),text:a+a}),r-=1)}}parseSymbol(){var t=this.fetch(),r=t.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();var n=r.slice(5),i=n.charAt(0)==="*";if(i&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new wg(`\\verb assertion failed --
3017
3017
  please report what input caused this bug`);return n=n.slice(1,-1),{type:"verb",mode:"text",body:n,star:i}}lhv.hasOwnProperty(r[0])&&!QV[this.mode][r[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+r[0]+'" used in math mode',t),r=lhv[r[0]]+r.slice(1));var a=YQI.exec(r);a&&(r=r.substring(0,a.index),r==="i"?r="\u0131":r==="j"&&(r="\u0237"));var o;if(QV[this.mode][r]){this.settings.strict&&this.mode==="math"&&h5f.indexOf(r)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+r[0]+'" used in math mode',t);var c=QV[this.mode][r].group,f=Snt.range(t),u;if(V6I.hasOwnProperty(c)){var s=c;u={type:"atom",mode:this.mode,family:s,loc:f,text:r}}else u={type:c,mode:this.mode,loc:f,text:r};o=u}else if(r.charCodeAt(0)>=128)this.settings.strict&&(dhv(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),t)),o={type:"textord",mode:"text",loc:Snt.range(t),text:r};else return null;if(this.consume(),a)for(var l=0;l<a[0].length;l++){var m=a[0][l];if(!f5f[m])throw new wg("Unknown accent ' "+m+"'",t);var O=f5f[m][this.mode]||f5f[m].text;if(!O)throw new wg("Accent "+m+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:Snt.range(t),label:O,isStretchy:!1,isShifty:!0,base:o}}return o}};pLu.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var Q5f=function(t,r){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var n=new pLu(t,r);delete n.gullet.macros.current["\\df@tag"];var i=n.parse();if(delete n.gullet.macros.current["\\current@color"],delete n.gullet.macros.current["\\color"],n.gullet.macros.get("\\df@tag")){if(!r.displayMode)throw new wg("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:n.subparse([new Kht("\\df@tag")])}]}return i},iyv=function(t,r,n){r.textContent="";var i=L5f(t,n).toNode();r.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),iyv=function(){throw new wg("KaTeX doesn't work in quirks mode.")});var kQI=function(t,r){var n=L5f(t,r).toMarkup();return n},e5I=function(t,r){var n=new drs(r);return Q5f(t,n)},ayv=function(t,r,n){if(n.throwOnError||!(t instanceof wg))throw t;var i=a_.makeSpan(["katex-error"],[new Vxe(r)]);return i.setAttribute("title",t.toString()),i.setAttribute("style","color:"+n.errorColor),i},L5f=function(t,r){var n=new drs(r);try{var i=Q5f(t,n);return fQI(i,t,n)}catch(a){return ayv(a,t,n)}},t5I=function(t,r){var n=new drs(r);try{var i=Q5f(t,n);return dQI(i,t,n)}catch(a){return ayv(a,t,n)}},r5I="0.16.21",n5I={Span:Yfa,Anchor:_rs,SymbolNode:Vxe,SvgNode:Lqr,PathNode:rWr,LineNode:hrs},U5f={version:r5I,render:iyv,renderToString:kQI,ParseError:wg,SETTINGS_SCHEMA:iLu,__parse:e5I,__renderToDomTree:L5f,__renderToHTMLTree:t5I,__setFontMetrics:N6I,__defineSymbol:Fn,__defineFunction:QO,__defineMacro:Ks,__domTree:n5I};function w2i(e){let{content:t}=(0,oyv.default)(e);return Gfa(t,{extensions:[dka(),ika(),Jfa()],mdastExtensions:[Vua(),xua(),Hfa()]})}function wao(e,t){lie(e,{enter(r){r.type==="JSXElement"&&r.openingElement.attributes.forEach(n=>{n.type==="JSXAttribute"&&n.name.type==="JSXIdentifier"&&t[n.name.name]&&t[n.name.name]?.(n,r)})}})}function Zfa(e,t){let{content:r,data:n}=(0,brs.default)(e,{}),i=r,a=new Set;function o(u){let s=jao(u,t);if(u&&s!=null)return a.add(s),s}fyv(n,["image","og:image","og:logo","twitter:image"],o),dyv(n,o);let c=w2i(r),f=0;return Uv(c,u=>{if(u.position==null)return;let{start:s,length:l}=lyv(r,u.position),m=i.slice(s+f,s+f+l),O=m;if(u.type==="image"){let C=Cnt(u.url),M=jao(C,t);C!=null&&M!=null&&(a.add(M),O=O.replaceAll(C,M))}function P(C){wao(C,{src:M=>{let T=Cnt(pwi(M.value)),z=jao(T,t);T&&z&&(a.add(z),O=O.replaceAll(T,z))}})}if(W5u(u)){let C=u.attributes.filter(_wi).find(T=>T.name==="src"),M=Cnt(v2i(C?.value));if(C&&M){let T=jao(M,t);T!=null&&(a.add(T),O=O.replaceAll(M,T))}u.attributes.forEach(T=>{_wi(T)&&typeof T.value!="string"&&T.value!=null&&T.value.data?.estree?P(T.value.data.estree):H5u(T)&&T.data?.estree&&P(T.data.estree)})}if(G5u(u)&&u.data?.estree&&P(u.data.estree),!(O===m&&a.size===0))return i=i.slice(0,s+f)+O+i.slice(s+f+l),f+=O.length-l,pm}),{filepaths:[...a],markdown:brs.default.stringify(i,n)}}function jao(e,{absolutePathToFernFolder:t,absolutePathToMarkdownFile:r}){return e==null||uyv(e)||cyv(e)?void 0:d1(e.startsWith("/")?t:Mg(r),eu.of(e.replace(/^\//,"")))}function uyv(e){return/^(https?:)?\/\//.test(e)}function cyv(e){return e.startsWith("data:")}function mLu({href:e,metadata:t,markdownFilesToPathName:r}){if(e!=null&&(e.endsWith(".md")||e.endsWith(".mdx"))){let n=jao(e,t);if(n!=null){let i=r[n];return i!=null?{type:"replace",slug:i.startsWith("/")?i:"/"+i,href:e}:{type:"missing-reference",path:n,href:e}}}}function W5f(e,t,r,n,i){let{content:a,data:o}=(0,brs.default)(e,{}),c=a,f=w2i(a),u=0;function s(l){if(l==null||uyv(l)||cyv(l))return;if((0,syv.isAbsolute)(l)){let O=F_.of(l),P=t.get(O);return P?`file:${P}`:void 0}let m=jao(l,n);if(m){let O=t.get(m);return O?`file:${O}`:void 0}}return fyv(o,["image","og:image","og:logo","twitter:image"],s),dyv(o,s),Uv(f,l=>{if(l.position==null)return;let{start:m,length:O}=lyv(a,l.position),P=c.slice(m+u,m+u+O),C=P;function M(U){let q=s(U);U&&q&&(C=C.replace(U,q))}function T(U){let q=mLu({href:U,markdownFilesToPathName:r,metadata:n});U!=null&&q!=null&&q.type==="replace"&&(C=C.replace(U,q.slug))}function z(U){wao(U,{src:q=>M(Cnt(pwi(q.value))),href:q=>T(Cnt(pwi(q.value)))})}if(l.type==="image"){let U=Cnt(l.url);M(Cnt(U))}if(l.type==="link"&&T(Cnt(l.url)),W5u(l)){let U=l.attributes.filter(_wi).find(V=>V.name==="src");M(Cnt(v2i(U?.value)));let q=l.attributes.find(V=>V.type==="mdxJsxAttribute"&&V.name==="href");T(Cnt(v2i(q?.value))),l.attributes.forEach(V=>{_wi(V)&&typeof V.value!="string"&&V.value!=null&&V.value.data?.estree?z(V.value.data.estree):H5u(V)&&V.data?.estree&&z(V.data.estree)})}if(G5u(l)&&l.data?.estree&&z(l.data.estree),C!==P)return c=c.slice(0,m+u)+C+c.slice(m+u+O),u+=C.length-O,pm}),brs.default.stringify(c,o)}function lyv(e,t){let r=e.split(`
3018
- `),n=t.start.column-1;for(let a=0;a<t.start.line-1;a++){let o=r[a];if(o==null)break;n+=o.length+1}let i=0-t.start.column+t.end.column;for(let a=t.start.line-1;a<t.end.line-1;a++){let o=r[a];if(o==null)break;i+=o.length+1}return{start:n,length:i}}function Cnt(e){if(typeof e=="string")return e.replace(/#.*$/,"")}function fyv(e,t,r){for(let n of t){let i=e[n];if(i!=null){if(typeof i=="object")i.type==="fileId"&&(e[n]={type:"fileId",value:Xh.FileId(r(i.value)??i.value)});else if(typeof i=="string"){let a=r(i);e[n]=a?{type:"fileId",value:Xh.FileId(a)}:{type:"url",value:Xh.Url(i)}}}}}var i5I=nl.union([nl.string(),nl.object({light:nl.string().optional(),dark:nl.string().optional()})]);function V5f(e,t){let r=t(e);return r?{type:"fileId",value:Xh.FileId(r)}:{type:"url",value:Xh.Url(e)}}function dyv(e,t){let r=i5I.safeParse(e.logo);if(!r.success)return;let n=r.data;typeof n=="string"?e.logo=V5f(n,t):(n.light!=null&&(e.logo.light=V5f(n.light,t)),n.dark!=null&&(e.logo.dark=V5f(n.dark,t)))}var pyv=require("fs/promises");async function a5I(e){return(await(0,pyv.readFile)(e)).toString()}function o5I(e){return e.startsWith("http://")||e.startsWith("https://")}async function G5f({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,fileLoader:i=a5I}){if(!e.includes("<Code "))return e;let a=/([ \t]*)<Code(?:\s+[^>]*?)?\s+src={?['"]([^'"]+)['"](?! \+)}?((?:\s+[^>]*)?)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);try{let l,m="",O,P;if(o5I(s))try{let T=await fetch(s);if(!T.ok){n.logger.warn(`Failed to fetch code from URL "${s}" (status ${T.status}) referenced in ${r}`);break}l=await T.text();let U=new URL(s).pathname;O=U.split(".").pop(),P=U.split("/").pop()}catch(T){n.logger.warn(`Failed to fetch code from URL "${s}" referenced in ${r}: ${T}`);break}else{let T=d1(s.startsWith("/")?t:Mg(r),eu.of(s.replace(/^\//,"")));l=await i(T),O=T.split(".").pop(),P=T.split("/").pop()}O!=null&&(m+=O),P!=null&&(m+=` title={"${P}"}`);let C=c[3]?.trim()||"";if(C){let T=/(\w+)=(?:{([^}]+)}|"([^"]+)")/g,z;for(;(z=T.exec(C))!==null;){let U=z[1],q=z[2]||z[3];U&&q&&U!=="src"&&(m+=` ${U}=${q.includes("{")?q:`{${q}}`}`)}}let M=f?.split("src=")[0]?.trim()??"";if(M){let T=/(\w+)=(?:{([^}]+)}|"([^"]+)")/g,z;for(;(z=T.exec(M))!==null;){let U=z[1],q=z[2]||z[3];U&&q&&U!=="src"&&(m+=` ${U}=${q.includes("{")?q:`{${q}}`}`)}}l=`\`\`\`${m}
3018
+ `),n=t.start.column-1;for(let a=0;a<t.start.line-1;a++){let o=r[a];if(o==null)break;n+=o.length+1}let i=0-t.start.column+t.end.column;for(let a=t.start.line-1;a<t.end.line-1;a++){let o=r[a];if(o==null)break;i+=o.length+1}return{start:n,length:i}}function Cnt(e){if(typeof e=="string")return e.replace(/#.*$/,"")}function fyv(e,t,r){for(let n of t){let i=e[n];if(i!=null){if(typeof i=="object")i.type==="fileId"&&(e[n]={type:"fileId",value:Xh.FileId(r(i.value)??i.value)});else if(typeof i=="string"){let a=r(i);e[n]=a?{type:"fileId",value:Xh.FileId(a)}:{type:"url",value:Xh.Url(i)}}}}}var i5I=nl.union([nl.string(),nl.object({light:nl.string().optional(),dark:nl.string().optional()})]);function V5f(e,t){let r=t(e);return r?{type:"fileId",value:Xh.FileId(r)}:{type:"url",value:Xh.Url(e)}}function dyv(e,t){let r=i5I.safeParse(e.logo);if(!r.success)return;let n=r.data;typeof n=="string"?e.logo=V5f(n,t):(n.light!=null&&(e.logo.light=V5f(n.light,t)),n.dark!=null&&(e.logo.dark=V5f(n.dark,t)))}var pyv=require("fs/promises");async function a5I(e){return(await(0,pyv.readFile)(e)).toString()}function o5I(e){return e.startsWith("http://")||e.startsWith("https://")}async function G5f({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,fileLoader:i=a5I}){if(!e.includes("<Code "))return e;let a=/([ \t]*)<Code(?:\s+[^>]*?)?\s+src={?['"]([^'"]+)['"](?! \+)}?((?:\s+[^>]*)?)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);try{let l,m,O;if(o5I(s))try{let q=await fetch(s);if(!q.ok){n.logger.warn(`Failed to fetch code from URL "${s}" (status ${q.status}) referenced in ${r}`);break}l=await q.text();let $=new URL(s).pathname;m=$.split(".").pop(),O=$.split("/").pop()}catch(q){n.logger.warn(`Failed to fetch code from URL "${s}" referenced in ${r}: ${q}`);break}else{let q=d1(s.startsWith("/")?t:Mg(r),eu.of(s.replace(/^\//,"")));l=await i(q),m=q.split(".").pop(),O=q.split("/").pop()}let P=new Map,C=/(\w+)=(?:{([^}]+)}|"([^"]+)")/g,M=f?.split("src=")[0]?.trim()??"",T;for(;(T=C.exec(M))!==null;){let q=T[1],V=T[2]||T[3];q&&V&&P.set(q,V)}let z=c[3]?.trim()||"";for(C.lastIndex=0;(T=C.exec(z))!==null;){let q=T[1],V=T[2]||T[3];q&&V&&P.set(q,V)}P.delete("src"),P.has("language")&&(m=P.get("language"),P.delete("language")),P.has("title")&&(O=P.get("title"),P.delete("title"));let U="";m!=null&&(U+=m),O!=null&&(U+=` title={"${O}"}`);for(let[q,V]of P)U+=` ${q}={${V}}`;l=`\`\`\`${U}
3019
3019
  ${l}
3020
3020
  \`\`\``,l=l.split(`
3021
- `).map(T=>u+T).join(`
3021
+ `).map(q=>u+q).join(`
3022
3022
  `),l=l+`
3023
3023
  `,o=o.replace(f,l)}catch{n.logger.warn(`Failed to read markdown file "${s}" referenced in ${r}`);break}}return o}var _yv=require("fs/promises"),hyv=Hi(Ort(),1);async function s5I(e){let{content:t}=(0,hyv.default)(await(0,_yv.readFile)(e));return t}function u5I(e){let t={},r=/(\w+)=(?:{?['"]([^'"]+)['"]?}?|{([^}]+)})/g,n;for(;(n=r.exec(e))!=null;){let i=n[1],a=n[2]??n[3];i!=null&&a!=null&&(t[i]=a)}return t}function c5I(e){let t=new Set,r=/{{([A-Za-z_][A-Za-z0-9_]*)}}/g,n;for(;(n=r.exec(e))!=null;)n[1]!=null&&t.add(n[1]);return t}function l5I(e,t){return e.slice(0,t).split(`
3024
3024
  `).length}function f5I(e,t){let r=e;for(let[n,i]of Object.entries(t)){let a=new RegExp(`\\{{${n}\\}}`,"g");r=r.replace(a,i)}return r}async function H5f({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,markdownLoader:i=s5I}){if(!e.includes("<Markdown"))return e;let a=/([ \t]*)<Markdown\s+([^>]+)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);let l=u5I(s),m=l.src;if(m==null||!m.match(/\.mdx?$/))continue;let O=d1(m.startsWith("/")?t:Mg(r),eu.of(m.replace(/^\//,"")));try{let P=await i(O),{src:C,...M}=l,T=c5I(P),z=new Set(Object.keys(M)),U=[...T].filter(q=>!z.has(q));if(U.length>0){let q=c.index??e.indexOf(f),V=l5I(e,q),$=String(r).split("/").pop()??String(r);for(let re of U)n.logger.warn(`[${r}:${V}] Markdown snippet missing property: \`${re}\``)}P=f5I(P,M),P=P.split(`
@@ -3066,10 +3066,10 @@ https://buildwithfern.com/learn/docs/getting-started/project-structure#api-defin
3066
3066
  `,zkI=`@fern-fern:registry=https://npm.buildwithfern.com
3067
3067
  `;async function Rns({bucketUrl:e,logger:t,preferCached:r,app:n=!1,tryTar:i=!1}){t.debug("Setting up docs preview bundle...");let a=await fetch(e);if(!a.ok)return{type:"failure"};let o=await a.text(),f=await new YCv.default.Parser().parseStringPromise(o),u=f?.ListBucketResult?.Contents?.[0]?.ETag?.[0],s=f?.ListBucketResult?.Contents?.[0]?.Key?.[0],l=FkI({app:n});if(r){let C=await Vv(l),M;if(C&&(t.debug("Reading existing ETag"),M=(await(0,Zxe.readFile)(l)).toString()),M!=null&&M===u)return t.debug("ETag matches. Using already downloaded bundle"),{type:"success"};t.debug("ETag is different. Downloading latest preview bundle"),n&&t.info(`Setting up docs preview bundle...
3068
3068
  Please wait while the installation completes. This may take a few minutes depending on your connection speed.`)}t.debug("Creating tmp directory to download docs preview bundle");let m=await $Cv.default.dir({prefix:"fern"}),O=F_.of(m.path),P=new URL(s,e).href;t.debug(`Downloading docs preview bundle from ${P}`);try{let C=await fetch(P);if(!C.ok)throw new Error(`Failed to download docs preview bundle. Status code: ${C.status}`);let M=Ql(O,eu.of(i?"output.tar.gz":"output.zip"));if(C.body==null)throw Pda("Docs bundle has empty response body");let T=Buffer.from(await C.arrayBuffer());await(0,Zxe.writeFile)(M,new Uint8Array(T)),t.debug(`Wrote ${i?"output.tar.gz":"output.zip"} to ${M}`);let z=rWu({app:n});await Vv(z)&&(t.debug(`Removing previously cached bundle at: ${z}`),await(0,Zxe.rm)(z,{recursive:!0})),await(0,Zxe.mkdir)(z,{recursive:!0});let U=r6i({app:n});if(await(0,Zxe.mkdir)(U,{recursive:!0}),t.debug(`Decompressing bundle from ${M} to ${U}`),await(0,JCv.default)(M,U,{filter:q=>!(tWu&&q.type==="symlink")}),await(0,Zxe.writeFile)(l,u),t.debug(`Downloaded bundle to ${U}`),n){t.debug("Checking if pnpm is installed");try{await FG(t,tWu?"where":"which",["pnpm"],{cwd:U,doNotPipeOutput:!0})}catch{t.debug("pnpm not found, installing pnpm"),await FG(t,"npm",["install","-g","pnpm"],{doNotPipeOutput:!0})}try{await FG(t,tWu?"where":"which",["pnpm"],{cwd:U,doNotPipeOutput:!0})}catch{throw new Error("Requires [pnpm] to run local development. Please run: npm install -g pnpm, and then: fern docs dev")}try{t.debug("Installing esbuild"),await FG(t,"pnpm",["i","esbuild"],{cwd:U,doNotPipeOutput:!0})}catch(q){if(q instanceof Error)if(typeof q?.message=="string"&&q.message.includes(MkI)){t.debug("Detected corepack missing keyid error. Attempting to upgrade corepack");try{await FG(t,"npm",["install","-g","corepack@latest"],{doNotPipeOutput:!0})}catch(V){throw Pda(`Failed to update corepack due to error: ${V}`)}try{t.debug("Installing esbuild after upgrading corepack"),await FG(t,"pnpm",["i","esbuild"],{cwd:U,doNotPipeOutput:!0})}catch(V){throw Pda(`Failed to install required package after updating corepack due to error: ${V}`)}}else throw Pda(`Failed to install required package due to error: ${q}.`);else throw Pda(`Failed to install required package due to error: ${q}.`)}try{t.debug("Resolve esbuild imports"),await FG(t,"node",["install-esbuild.js"],{cwd:U,doNotPipeOutput:!0})}catch(q){throw Pda(`Failed to resolve imports due to error: ${q}`)}if(tWu){let q=qns({app:n}),V=TkI({app:n}),$=qkI({app:n}),re=RkI({app:n}),Y=NkI({app:n}),[k,ne,Oe,ye]=await Promise.all([Vv($),Vv(re),Vv(Y),Vv(V)]);k||t.warn(`Expected pnpm-workspace.yaml at ${$} but it does not exist. If you are experiencing issues, please contact support@buildwithfern.com.`),ne||(t.debug(`Writing pnpmfile.cjs at ${re}`),await(0,Zxe.writeFile)(re,xkI)),Oe||(t.debug(`Writing .npmrc at ${Y}`),await(0,Zxe.writeFile)(Y,zkI)),ye&&(t.debug(`Removing instrumentation.js at ${V}`),await(0,Zxe.rm)(V));try{t.debug("Running pnpm install within standalone"),await FG(t,"pnpm",["install"],{cwd:q,doNotPipeOutput:!0})}catch(ge){throw Pda(`Failed to install required package due to error: ${ge}`)}}}return{type:"success"}}catch(C){t.error(`Error: ${C}`);let M=rWu({app:n});return await Vv(M)&&await(0,Zxe.rm)(M,{recursive:!0}),t.debug(`Removing incomplete bundle: rm -rf ${M}`),{type:"failure"}}}var cIv=require("fs/promises"),lIv=Hi(Ort(),1);function Nns(e){if(e==null)return;let t=[],r=!1;if(lie(e,{enter(n){(n.type==="FunctionDeclaration"||n.type==="ArrowFunctionExpression"||n.type==="JSXOpeningElement"||n.type==="JSXOpeningFragment"||n.type==="Identifier")&&(r=!0,this.skip()),n.type==="Literal"&&t.push(n.value)}}),!r)return t.length===1?t[0]:void 0}function nWu(e){if(typeof e=="string")return e;if(e?.type==="mdxJsxAttributeValueExpression")return Nns(e.data?.estree)}function nWf(e){return e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement"}function iWf(e){return e.type==="mdxFlowExpression"||e.type==="mdxTextExpression"}function Fns(e){return e.type==="mdxJsxAttribute"}function aWf(e){return e.type==="mdxJsxExpressionAttribute"}var xns=Hi(Ort(),1),ZCv=require("path");var XCv=Hi(Ort(),1);function oWf(e){let{content:t}=(0,XCv.default)(e);return Gfa(t,{extensions:[dka(),ika(),Jfa()],mdastExtensions:[Vua(),xua(),Hfa()]})}function sWf(e,t){lie(e,{enter(r){r.type==="JSXElement"&&r.openingElement.attributes.forEach(n=>{n.type==="JSXAttribute"&&n.name.type==="JSXIdentifier"&&t[n.name.name]&&t[n.name.name]?.(n,r)})}})}function cWf(e,t){let{content:r,data:n}=(0,xns.default)(e,{}),i=r,a=new Set;function o(u){let s=joo(u,t);if(u&&s!=null)return a.add(s),s}nIv(n,["image","og:image","og:logo","twitter:image"],o),iIv(n,o);let c=oWf(r),f=0;return Uv(c,u=>{if(u.position==null)return;let{start:s,length:l}=rIv(r,u.position),m=i.slice(s+f,s+f+l),O=m;if(u.type==="image"){let C=kqr(u.url),M=joo(C,t);C!=null&&M!=null&&(a.add(M),O=O.replaceAll(C,M))}function P(C){sWf(C,{src:M=>{let T=kqr(Nns(M.value)),z=joo(T,t);T&&z&&(a.add(z),O=O.replaceAll(T,z))}})}if(nWf(u)){let C=u.attributes.filter(Fns).find(T=>T.name==="src"),M=kqr(nWu(C?.value));if(C&&M){let T=joo(M,t);T!=null&&(a.add(T),O=O.replaceAll(M,T))}u.attributes.forEach(T=>{Fns(T)&&typeof T.value!="string"&&T.value!=null&&T.value.data?.estree?P(T.value.data.estree):aWf(T)&&T.data?.estree&&P(T.data.estree)})}if(iWf(u)&&u.data?.estree&&P(u.data.estree),!(O===m&&a.size===0))return i=i.slice(0,s+f)+O+i.slice(s+f+l),f+=O.length-l,pm}),{filepaths:[...a],markdown:xns.default.stringify(i,n)}}function joo(e,{absolutePathToFernFolder:t,absolutePathToMarkdownFile:r}){return e==null||kCv(e)||eIv(e)?void 0:d1(e.startsWith("/")?t:Mg(r),eu.of(e.replace(/^\//,"")))}function kCv(e){return/^(https?:)?\/\//.test(e)}function eIv(e){return e.startsWith("data:")}function tIv({href:e,metadata:t,markdownFilesToPathName:r}){if(e!=null&&(e.endsWith(".md")||e.endsWith(".mdx"))){let n=joo(e,t);if(n!=null){let i=r[n];return i!=null?{type:"replace",slug:i.startsWith("/")?i:"/"+i,href:e}:{type:"missing-reference",path:n,href:e}}}}function lWf(e,t,r,n,i){let{content:a,data:o}=(0,xns.default)(e,{}),c=a,f=oWf(a),u=0;function s(l){if(l==null||kCv(l)||eIv(l))return;if((0,ZCv.isAbsolute)(l)){let O=F_.of(l),P=t.get(O);return P?`file:${P}`:void 0}let m=joo(l,n);if(m){let O=t.get(m);return O?`file:${O}`:void 0}}return nIv(o,["image","og:image","og:logo","twitter:image"],s),iIv(o,s),Uv(f,l=>{if(l.position==null)return;let{start:m,length:O}=rIv(a,l.position),P=c.slice(m+u,m+u+O),C=P;function M(U){let q=s(U);U&&q&&(C=C.replace(U,q))}function T(U){let q=tIv({href:U,markdownFilesToPathName:r,metadata:n});U!=null&&q!=null&&q.type==="replace"&&(C=C.replace(U,q.slug))}function z(U){sWf(U,{src:q=>M(kqr(Nns(q.value))),href:q=>T(kqr(Nns(q.value)))})}if(l.type==="image"){let U=kqr(l.url);M(kqr(U))}if(l.type==="link"&&T(kqr(l.url)),nWf(l)){let U=l.attributes.filter(Fns).find(V=>V.name==="src");M(kqr(nWu(U?.value)));let q=l.attributes.find(V=>V.type==="mdxJsxAttribute"&&V.name==="href");T(kqr(nWu(q?.value))),l.attributes.forEach(V=>{Fns(V)&&typeof V.value!="string"&&V.value!=null&&V.value.data?.estree?z(V.value.data.estree):aWf(V)&&V.data?.estree&&z(V.data.estree)})}if(iWf(l)&&l.data?.estree&&z(l.data.estree),C!==P)return c=c.slice(0,m+u)+C+c.slice(m+u+O),u+=C.length-O,pm}),xns.default.stringify(c,o)}function rIv(e,t){let r=e.split(`
3069
- `),n=t.start.column-1;for(let a=0;a<t.start.line-1;a++){let o=r[a];if(o==null)break;n+=o.length+1}let i=0-t.start.column+t.end.column;for(let a=t.start.line-1;a<t.end.line-1;a++){let o=r[a];if(o==null)break;i+=o.length+1}return{start:n,length:i}}function kqr(e){if(typeof e=="string")return e.replace(/#.*$/,"")}function nIv(e,t,r){for(let n of t){let i=e[n];if(i!=null){if(typeof i=="object")i.type==="fileId"&&(e[n]={type:"fileId",value:Xh.FileId(r(i.value)??i.value)});else if(typeof i=="string"){let a=r(i);e[n]=a?{type:"fileId",value:Xh.FileId(a)}:{type:"url",value:Xh.Url(i)}}}}}var QkI=nl.union([nl.string(),nl.object({light:nl.string().optional(),dark:nl.string().optional()})]);function uWf(e,t){let r=t(e);return r?{type:"fileId",value:Xh.FileId(r)}:{type:"url",value:Xh.Url(e)}}function iIv(e,t){let r=QkI.safeParse(e.logo);if(!r.success)return;let n=r.data;typeof n=="string"?e.logo=uWf(n,t):(n.light!=null&&(e.logo.light=uWf(n.light,t)),n.dark!=null&&(e.logo.dark=uWf(n.dark,t)))}var aIv=require("fs/promises");async function LkI(e){return(await(0,aIv.readFile)(e)).toString()}function UkI(e){return e.startsWith("http://")||e.startsWith("https://")}async function fWf({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,fileLoader:i=LkI}){if(!e.includes("<Code "))return e;let a=/([ \t]*)<Code(?:\s+[^>]*?)?\s+src={?['"]([^'"]+)['"](?! \+)}?((?:\s+[^>]*)?)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);try{let l,m="",O,P;if(UkI(s))try{let T=await fetch(s);if(!T.ok){n.logger.warn(`Failed to fetch code from URL "${s}" (status ${T.status}) referenced in ${r}`);break}l=await T.text();let U=new URL(s).pathname;O=U.split(".").pop(),P=U.split("/").pop()}catch(T){n.logger.warn(`Failed to fetch code from URL "${s}" referenced in ${r}: ${T}`);break}else{let T=d1(s.startsWith("/")?t:Mg(r),eu.of(s.replace(/^\//,"")));l=await i(T),O=T.split(".").pop(),P=T.split("/").pop()}O!=null&&(m+=O),P!=null&&(m+=` title={"${P}"}`);let C=c[3]?.trim()||"";if(C){let T=/(\w+)=(?:{([^}]+)}|"([^"]+)")/g,z;for(;(z=T.exec(C))!==null;){let U=z[1],q=z[2]||z[3];U&&q&&U!=="src"&&(m+=` ${U}=${q.includes("{")?q:`{${q}}`}`)}}let M=f?.split("src=")[0]?.trim()??"";if(M){let T=/(\w+)=(?:{([^}]+)}|"([^"]+)")/g,z;for(;(z=T.exec(M))!==null;){let U=z[1],q=z[2]||z[3];U&&q&&U!=="src"&&(m+=` ${U}=${q.includes("{")?q:`{${q}}`}`)}}l=`\`\`\`${m}
3069
+ `),n=t.start.column-1;for(let a=0;a<t.start.line-1;a++){let o=r[a];if(o==null)break;n+=o.length+1}let i=0-t.start.column+t.end.column;for(let a=t.start.line-1;a<t.end.line-1;a++){let o=r[a];if(o==null)break;i+=o.length+1}return{start:n,length:i}}function kqr(e){if(typeof e=="string")return e.replace(/#.*$/,"")}function nIv(e,t,r){for(let n of t){let i=e[n];if(i!=null){if(typeof i=="object")i.type==="fileId"&&(e[n]={type:"fileId",value:Xh.FileId(r(i.value)??i.value)});else if(typeof i=="string"){let a=r(i);e[n]=a?{type:"fileId",value:Xh.FileId(a)}:{type:"url",value:Xh.Url(i)}}}}}var QkI=nl.union([nl.string(),nl.object({light:nl.string().optional(),dark:nl.string().optional()})]);function uWf(e,t){let r=t(e);return r?{type:"fileId",value:Xh.FileId(r)}:{type:"url",value:Xh.Url(e)}}function iIv(e,t){let r=QkI.safeParse(e.logo);if(!r.success)return;let n=r.data;typeof n=="string"?e.logo=uWf(n,t):(n.light!=null&&(e.logo.light=uWf(n.light,t)),n.dark!=null&&(e.logo.dark=uWf(n.dark,t)))}var aIv=require("fs/promises");async function LkI(e){return(await(0,aIv.readFile)(e)).toString()}function UkI(e){return e.startsWith("http://")||e.startsWith("https://")}async function fWf({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,fileLoader:i=LkI}){if(!e.includes("<Code "))return e;let a=/([ \t]*)<Code(?:\s+[^>]*?)?\s+src={?['"]([^'"]+)['"](?! \+)}?((?:\s+[^>]*)?)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);try{let l,m,O;if(UkI(s))try{let q=await fetch(s);if(!q.ok){n.logger.warn(`Failed to fetch code from URL "${s}" (status ${q.status}) referenced in ${r}`);break}l=await q.text();let $=new URL(s).pathname;m=$.split(".").pop(),O=$.split("/").pop()}catch(q){n.logger.warn(`Failed to fetch code from URL "${s}" referenced in ${r}: ${q}`);break}else{let q=d1(s.startsWith("/")?t:Mg(r),eu.of(s.replace(/^\//,"")));l=await i(q),m=q.split(".").pop(),O=q.split("/").pop()}let P=new Map,C=/(\w+)=(?:{([^}]+)}|"([^"]+)")/g,M=f?.split("src=")[0]?.trim()??"",T;for(;(T=C.exec(M))!==null;){let q=T[1],V=T[2]||T[3];q&&V&&P.set(q,V)}let z=c[3]?.trim()||"";for(C.lastIndex=0;(T=C.exec(z))!==null;){let q=T[1],V=T[2]||T[3];q&&V&&P.set(q,V)}P.delete("src"),P.has("language")&&(m=P.get("language"),P.delete("language")),P.has("title")&&(O=P.get("title"),P.delete("title"));let U="";m!=null&&(U+=m),O!=null&&(U+=` title={"${O}"}`);for(let[q,V]of P)U+=` ${q}={${V}}`;l=`\`\`\`${U}
3070
3070
  ${l}
3071
3071
  \`\`\``,l=l.split(`
3072
- `).map(T=>u+T).join(`
3072
+ `).map(q=>u+q).join(`
3073
3073
  `),l=l+`
3074
3074
  `,o=o.replace(f,l)}catch{n.logger.warn(`Failed to read markdown file "${s}" referenced in ${r}`);break}}return o}var oIv=require("fs/promises"),sIv=Hi(Ort(),1);async function VkI(e){let{content:t}=(0,sIv.default)(await(0,oIv.readFile)(e));return t}function WkI(e){let t={},r=/(\w+)=(?:{?['"]([^'"]+)['"]?}?|{([^}]+)})/g,n;for(;(n=r.exec(e))!=null;){let i=n[1],a=n[2]??n[3];i!=null&&a!=null&&(t[i]=a)}return t}function GkI(e){let t=new Set,r=/{{([A-Za-z_][A-Za-z0-9_]*)}}/g,n;for(;(n=r.exec(e))!=null;)n[1]!=null&&t.add(n[1]);return t}function HkI(e,t){return e.slice(0,t).split(`
3075
3075
  `).length}function JkI(e,t){let r=e;for(let[n,i]of Object.entries(t)){let a=new RegExp(`\\{{${n}\\}}`,"g");r=r.replace(a,i)}return r}async function dWf({markdown:e,absolutePathToFernFolder:t,absolutePathToMarkdownFile:r,context:n,markdownLoader:i=VkI}){if(!e.includes("<Markdown"))return e;let a=/([ \t]*)<Markdown\s+([^>]+)\/>/g,o=e,c;for(;(c=a.exec(e))!=null;){let f=c[0],u=c[1],s=c[2];if(f==null||s==null)throw new Error(`Failed to parse regex "${c}" in ${r}`);let l=WkI(s),m=l.src;if(m==null||!m.match(/\.mdx?$/))continue;let O=d1(m.startsWith("/")?t:Mg(r),eu.of(m.replace(/^\//,"")));try{let P=await i(O),{src:C,...M}=l,T=GkI(P),z=new Set(Object.keys(M)),U=[...T].filter(q=>!z.has(q));if(U.length>0){let q=c.index??e.indexOf(f),V=HkI(e,q),$=String(r).split("/").pop()??String(r);for(let re of U)n.logger.warn(`[${r}:${V}] Markdown snippet missing property: \`${re}\``)}P=JkI(P,M),P=P.split(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.120.0",
3
+ "version": "0.120.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",