fern-api 0.63.27 → 0.63.28

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 +3 -3
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1670,7 +1670,7 @@ ${c.indent}`:""}${FBd(o)}:${l.indent?" ":""}`;return u=!1,s=!0,l.objectItem=void
1670
1670
  `:`
1671
1671
  `)+r,n=i+1,i=e.indexOf(`
1672
1672
  `,n)}while(i!==-1);return a+=e.slice(n),a}var{stdout:awp,stderr:owp}=rwp,g$s=Symbol("GENERATOR"),TNn=Symbol("STYLER"),nEa=Symbol("IS_EMPTY"),uwp=["ansi","ansi","ansi256","ansi16m"],CNn=Object.create(null),SQS=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=awp?awp.level:0;e.level=t.level===void 0?r:t.level};var DQS=e=>{let t=(...r)=>r.join(" ");return SQS(t,e),Object.setPrototypeOf(t,aEa.prototype),t};function aEa(e){return DQS(e)}Object.setPrototypeOf(aEa.prototype,Function.prototype);for(let[e,t]of Object.entries(tWt))CNn[e]={get(){let r=Exo(this,m$s(t.open,t.close,this[TNn]),this[nEa]);return Object.defineProperty(this,e,{value:r}),r}};CNn.visible={get(){let e=Exo(this,this[TNn],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var O$s=(e,t,r,...i)=>e==="rgb"?t==="ansi16m"?tWt[r].ansi16m(...i):t==="ansi256"?tWt[r].ansi256(tWt.rgbToAnsi256(...i)):tWt[r].ansi(tWt.rgbToAnsi(...i)):e==="hex"?O$s("rgb",t,r,...tWt.hexToRgb(...i)):tWt[r][e](...i),EQS=["rgb","hex","ansi256"];for(let e of EQS){CNn[e]={get(){let{level:r}=this;return function(...i){let n=m$s(O$s(e,uwp[r],"color",...i),tWt.color.close,this[TNn]);return Exo(this,n,this[nEa])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);CNn[t]={get(){let{level:r}=this;return function(...i){let n=m$s(O$s(e,uwp[r],"bgColor",...i),tWt.bgColor.close,this[TNn]);return Exo(this,n,this[nEa])}}}}var MQS=Object.defineProperties(()=>{},{...CNn,level:{enumerable:!0,get(){return this[g$s].level},set(e){this[g$s].level=e}}}),m$s=(e,t,r)=>{let i,n;return r===void 0?(i=e,n=t):(i=r.openAll+e,n=t+r.closeAll),{open:e,close:t,openAll:i,closeAll:n,parent:r}},Exo=(e,t,r)=>{let i=(...n)=>AQS(i,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(i,MQS),i[g$s]=e,i[TNn]=t,i[nEa]=r,i},AQS=(e,t)=>{if(e.level<=0||!t)return e[nEa]?"":t;let r=e[TNn];if(r===void 0)return t;let{openAll:i,closeAll:n}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=iwp(t,r.close,r.open),r=r.parent;let a=t.indexOf(`
1673
- `);return a!==-1&&(t=nwp(t,n,i,a)),i+t+n};Object.defineProperties(aEa.prototype,CNn);var qQS=aEa(),HI2=aEa({level:owp?owp.level:0});var Gs=qQS;var tnc=ci(tSp(),1),rnc=require("fs/promises"),sJp=ci(require("path"),1);var H2o=require("fs/promises");var sSp=ci(GEe(),1);var OYS=ci(fzo()),mYS=ci(JSa());var R$s,N$s,F$s,L$s,hYS=typeof window<"u"&&typeof window.document<"u",yYS=typeof self=="object"&&typeof self?.importScripts=="function"&&(((R$s=self.constructor)===null||R$s===void 0?void 0:R$s.name)==="DedicatedWorkerGlobalScope"||((N$s=self.constructor)===null||N$s===void 0?void 0:N$s.name)==="ServiceWorkerGlobalScope"||((F$s=self.constructor)===null||F$s===void 0?void 0:F$s.name)==="SharedWorkerGlobalScope"),oSp=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",uSp=typeof Bun<"u"&&typeof Bun.version<"u",vYS=typeof process<"u"&&!!process.version&&!!(!((L$s=process.versions)===null||L$s===void 0)&&L$s.node)&&!oSp&&!uSp,bYS=typeof navigator<"u"&&navigator?.product==="ReactNative",iWt=gYS();function gYS(){return hYS?{type:"browser",version:window.navigator.userAgent}:yYS?{type:"web-worker"}:oSp?{type:"deno",version:Deno.version.deno}:uSp?{type:"bun",version:Bun.version}:vYS?{type:"node",version:process.versions.node}:bYS?{type:"react-native"}:{type:"unknown"}}var d52=typeof TextDecoder=="function"?new TextDecoder:void 0,p52=typeof TextEncoder=="function"?new TextEncoder:void 0,PYS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",jYS=Array.prototype.slice.call(PYS),_52=(e=>{let t={};return e.forEach((r,i)=>t[r]=i),t})(jYS);var h52=String.fromCharCode.bind(String),y52=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):(e,t=r=>r)=>new Uint8Array(Array.prototype.slice.call(e,0).map(t));var CYS=ci(qP());var wYS=ci(qP());var SYS=ci(qP());var DYS=ci(qP());var EYS=ci(qP());var MYS=ci(qP());var AYS=ci(qP());var qYS=ci(qP());var TYS=ci(qP());function i$i({environment:e="https://registry.buildwithfern.com",token:t}){return new sSp.FernRegistryClient({environment:e,token:t})}var cSp=ci(yDa(),1);function Nxo({environment:e="https://registry.buildwithfern.com",token:t}){return new cSp.FernRegistryClient({environment:e,token:t})}var lSp=ci(kHi(),1),fSp=process.env.FERN_FIDDLE_ORIGIN??"https://fiddle-coordinator.buildwithfern.com"??"https://fiddle-coordinator.buildwithfern.com";function U$s(){return fSp}function Dfi({token:e}={}){return new lSp.FernFiddleClient({environment:fSp,token:e})}var cAp=ci(qEa(),1);function tMe({environment:e="https://venus.buildwithfern.com",token:t}={}){return new cAp.FernVenusApiClient({environment:e,token:t})}var qQs=ci(qEa(),1);function lAp(e){if(e.length===0)return"Organization name cannot be empty"}async function lWt({organization:e,token:t,context:r}){let i=tMe({token:t.value});if((await i.organization.get(qQs.FernVenusApi.OrganizationId(e))).ok)return!1;let a=lAp(e);a!=null&&r.failAndThrow(a);let u=await i.organization.create({organizationId:qQs.FernVenusApi.OrganizationId(e)});return u.ok||r.failAndThrow(`Failed to create organization: ${e}`,u.error),!0}var dAp=require("fs/promises");var fAp=require("os");var hnD="token",ynD=".fern";function wRo(){return Vu(hl.of((0,fAp.homedir)()),Qa.of(ynD),Qa.of(hnD))}var vnD="FERN_TOKEN";async function TEa(){return await QNn()??await SRo()}async function QNn(){let e=process.env[vnD];if(e!=null)return{type:"organization",value:e}}async function SRo(){let e=wRo();if(!await Sf(e))return;let i=(await(0,dAp.readFile)(e)).toString().trim();if(i.length!==0)return{type:"user",value:i}}var DRo=require("fs/promises"),pAp=ci(require("path"),1);async function TQs(e){let t=wRo();await(0,DRo.mkdir)(pAp.default.dirname(t),{recursive:!0}),await(0,DRo.writeFile)(t,e)}async function CQs({token:e,context:t}){let r=await tMe({token:e.value}).user.getMyself();return r.ok?r.body:t.failAndThrow("Failed to fetch user info")}var eTp=ci(tJs(),1);function rJs(e){let t=eTp.default.decode(e.value,{complete:!0});if(t==null)return;let r=t.payload;return typeof r=="string"?void 0:r.sub}async function tTp(e){return(await tMe({token:e.value}).organization.getMyOrganizationFromScopedToken()).ok}var XYs=ci(tJs(),1),kIp=ci(ZIp(),1),TyD=(0,kIp.default)({jwksUri:"https://fern-prod.us.auth0.com/.well-known/jwks.json"});async function ezp(e){let t=XYs.default.decode(e.value,{complete:!0});if(t==null)return!1;try{let r=await TyD.getSigningKey(t.header.kid);return XYs.default.verify(e.value,r.getPublicKey(),{algorithms:["RS256"]}),!0}catch{return!1}}async function ZYs(){let e=await TEa();if(e==null)return!1;switch(e.type){case"organization":return tTp(e);case"user":return ezp(e);default:mo(e)}}var tzp=(e=0)=>t=>`\x1B[${t+e}m`,rzp=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,izp=(e=0)=>(t,r,i)=>`\x1B[${38+e};2;${t};${r};${i}m`,dx={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},J$2=Object.keys(dx.modifier),CyD=Object.keys(dx.color),ByD=Object.keys(dx.bgColor),K$2=[...CyD,...ByD];function IyD(){let e=new Map;for(let[t,r]of Object.entries(dx)){for(let[i,n]of Object.entries(r))dx[i]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[i]=dx[i],e.set(n[0],n[1]);Object.defineProperty(dx,t,{value:r,enumerable:!1})}return Object.defineProperty(dx,"codes",{value:e,enumerable:!1}),dx.color.close="\x1B[39m",dx.bgColor.close="\x1B[49m",dx.color.ansi=tzp(),dx.color.ansi256=rzp(),dx.color.ansi16m=izp(),dx.bgColor.ansi=tzp(10),dx.bgColor.ansi256=rzp(10),dx.bgColor.ansi16m=izp(10),Object.defineProperties(dx,{rgbToAnsi256:{value(t,r,i){return t===r&&r===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(i/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[i]=r;i.length===3&&(i=[...i].map(a=>a+a).join(""));let n=Number.parseInt(i,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:t=>dx.rgbToAnsi256(...dx.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,i,n;if(t>=232)r=((t-232)*10+8)/255,i=r,n=r;else{t-=16;let l=t%36;r=Math.floor(t/36)/5,i=Math.floor(l/6)/5,n=l%6/5}let a=Math.max(r,i,n)*2;if(a===0)return 30;let u=30+(Math.round(n)<<2|Math.round(i)<<1|Math.round(r));return a===2&&(u+=60),u},enumerable:!1},rgbToAnsi:{value:(t,r,i)=>dx.ansi256ToAnsi(dx.rgbToAnsi256(t,r,i)),enumerable:!1},hexToAnsi:{value:t=>dx.ansi256ToAnsi(dx.hexToAnsi256(t)),enumerable:!1}}),dx}var zyD=IyD(),gWt=zyD;var dFo=ci(require("process"),1),azp=ci(require("os"),1),kYs=ci(require("tty"),1);function MNe(e,t=globalThis.Deno?globalThis.Deno.args:dFo.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",i=t.indexOf(r+e),n=t.indexOf("--");return i!==-1&&(n===-1||i<n)}var{env:ZN}=dFo.default,fFo;MNe("no-color")||MNe("no-colors")||MNe("color=false")||MNe("color=never")?fFo=0:(MNe("color")||MNe("colors")||MNe("color=true")||MNe("color=always"))&&(fFo=1);function xyD(){if("FORCE_COLOR"in ZN)return ZN.FORCE_COLOR==="true"?1:ZN.FORCE_COLOR==="false"?0:ZN.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ZN.FORCE_COLOR,10),3)}function RyD(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function NyD(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let i=xyD();i!==void 0&&(fFo=i);let n=r?fFo:i;if(n===0)return 0;if(r){if(MNe("color=16m")||MNe("color=full")||MNe("color=truecolor"))return 3;if(MNe("color=256"))return 2}if("TF_BUILD"in ZN&&"AGENT_NAME"in ZN)return 1;if(e&&!t&&n===void 0)return 0;let a=n||0;if(ZN.TERM==="dumb")return a;if(dFo.default.platform==="win32"){let u=azp.default.release().split(".");return Number(u[0])>=10&&Number(u[2])>=10586?Number(u[2])>=14931?3:2:1}if("CI"in ZN)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(u=>u in ZN)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(u=>u in ZN)||ZN.CI_NAME==="codeship"?1:a;if("TEAMCITY_VERSION"in ZN)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ZN.TEAMCITY_VERSION)?1:0;if(ZN.COLORTERM==="truecolor"||ZN.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in ZN){let u=Number.parseInt((ZN.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ZN.TERM_PROGRAM){case"iTerm.app":return u>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ZN.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ZN.TERM)||"COLORTERM"in ZN?1:a}function nzp(e,t={}){let r=NyD(e,{streamIsTTY:e&&e.isTTY,...t});return RyD(r)}var FyD={stdout:nzp({isTTY:kYs.default.isatty(1)}),stderr:nzp({isTTY:kYs.default.isatty(2)})},ozp=FyD;function uzp(e,t,r){let i=e.indexOf(t);if(i===-1)return e;let n=t.length,a=0,u="";do u+=e.slice(a,i)+t+r,a=i+n,i=e.indexOf(t,a);while(i!==-1);return u+=e.slice(a),u}function szp(e,t,r,i){let n=0,a="";do{let u=e[i-1]==="\r";a+=e.slice(n,u?i-1:i)+t+(u?`\r
1673
+ `);return a!==-1&&(t=nwp(t,n,i,a)),i+t+n};Object.defineProperties(aEa.prototype,CNn);var qQS=aEa(),HI2=aEa({level:owp?owp.level:0});var Gs=qQS;var tnc=ci(tSp(),1),rnc=require("fs/promises"),sJp=ci(require("path"),1);var H2o=require("fs/promises");var sSp=ci(GEe(),1);var OYS=ci(fzo()),mYS=ci(JSa());var R$s,N$s,F$s,L$s,hYS=typeof window<"u"&&typeof window.document<"u",yYS=typeof self=="object"&&typeof self?.importScripts=="function"&&(((R$s=self.constructor)===null||R$s===void 0?void 0:R$s.name)==="DedicatedWorkerGlobalScope"||((N$s=self.constructor)===null||N$s===void 0?void 0:N$s.name)==="ServiceWorkerGlobalScope"||((F$s=self.constructor)===null||F$s===void 0?void 0:F$s.name)==="SharedWorkerGlobalScope"),oSp=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",uSp=typeof Bun<"u"&&typeof Bun.version<"u",vYS=typeof process<"u"&&!!process.version&&!!(!((L$s=process.versions)===null||L$s===void 0)&&L$s.node)&&!oSp&&!uSp,bYS=typeof navigator<"u"&&navigator?.product==="ReactNative",iWt=gYS();function gYS(){return hYS?{type:"browser",version:window.navigator.userAgent}:yYS?{type:"web-worker"}:oSp?{type:"deno",version:Deno.version.deno}:uSp?{type:"bun",version:Bun.version}:vYS?{type:"node",version:process.versions.node}:bYS?{type:"react-native"}:{type:"unknown"}}var d52=typeof TextDecoder=="function"?new TextDecoder:void 0,p52=typeof TextEncoder=="function"?new TextEncoder:void 0,PYS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",jYS=Array.prototype.slice.call(PYS),_52=(e=>{let t={};return e.forEach((r,i)=>t[r]=i),t})(jYS);var h52=String.fromCharCode.bind(String),y52=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):(e,t=r=>r)=>new Uint8Array(Array.prototype.slice.call(e,0).map(t));var CYS=ci(qP());var wYS=ci(qP());var SYS=ci(qP());var DYS=ci(qP());var EYS=ci(qP());var MYS=ci(qP());var AYS=ci(qP());var qYS=ci(qP());var TYS=ci(qP());function i$i({environment:e="https://registry.buildwithfern.com",token:t}){let r=process.env.OVERRIDE_FDR_ORIGIN;return new sSp.FernRegistryClient({environment:r??e,token:t})}var cSp=ci(yDa(),1);function Nxo({environment:e="https://registry.buildwithfern.com",token:t}){return new cSp.FernRegistryClient({environment:e,token:t})}var lSp=ci(kHi(),1),fSp=process.env.FERN_FIDDLE_ORIGIN??"https://fiddle-coordinator.buildwithfern.com"??"https://fiddle-coordinator.buildwithfern.com";function U$s(){return fSp}function Dfi({token:e}={}){return new lSp.FernFiddleClient({environment:fSp,token:e})}var cAp=ci(qEa(),1);function tMe({environment:e="https://venus.buildwithfern.com",token:t}={}){return new cAp.FernVenusApiClient({environment:e,token:t})}var qQs=ci(qEa(),1);function lAp(e){if(e.length===0)return"Organization name cannot be empty"}async function lWt({organization:e,token:t,context:r}){let i=tMe({token:t.value});if((await i.organization.get(qQs.FernVenusApi.OrganizationId(e))).ok)return!1;let a=lAp(e);a!=null&&r.failAndThrow(a);let u=await i.organization.create({organizationId:qQs.FernVenusApi.OrganizationId(e)});return u.ok||r.failAndThrow(`Failed to create organization: ${e}`,u.error),!0}var dAp=require("fs/promises");var fAp=require("os");var hnD="token",ynD=".fern";function wRo(){return Vu(hl.of((0,fAp.homedir)()),Qa.of(ynD),Qa.of(hnD))}var vnD="FERN_TOKEN";async function TEa(){return await QNn()??await SRo()}async function QNn(){let e=process.env[vnD];if(e!=null)return{type:"organization",value:e}}async function SRo(){let e=wRo();if(!await Sf(e))return;let i=(await(0,dAp.readFile)(e)).toString().trim();if(i.length!==0)return{type:"user",value:i}}var DRo=require("fs/promises"),pAp=ci(require("path"),1);async function TQs(e){let t=wRo();await(0,DRo.mkdir)(pAp.default.dirname(t),{recursive:!0}),await(0,DRo.writeFile)(t,e)}async function CQs({token:e,context:t}){let r=await tMe({token:e.value}).user.getMyself();return r.ok?r.body:t.failAndThrow("Failed to fetch user info")}var eTp=ci(tJs(),1);function rJs(e){let t=eTp.default.decode(e.value,{complete:!0});if(t==null)return;let r=t.payload;return typeof r=="string"?void 0:r.sub}async function tTp(e){return(await tMe({token:e.value}).organization.getMyOrganizationFromScopedToken()).ok}var XYs=ci(tJs(),1),kIp=ci(ZIp(),1),TyD=(0,kIp.default)({jwksUri:"https://fern-prod.us.auth0.com/.well-known/jwks.json"});async function ezp(e){let t=XYs.default.decode(e.value,{complete:!0});if(t==null)return!1;try{let r=await TyD.getSigningKey(t.header.kid);return XYs.default.verify(e.value,r.getPublicKey(),{algorithms:["RS256"]}),!0}catch{return!1}}async function ZYs(){let e=await TEa();if(e==null)return!1;switch(e.type){case"organization":return tTp(e);case"user":return ezp(e);default:mo(e)}}var tzp=(e=0)=>t=>`\x1B[${t+e}m`,rzp=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,izp=(e=0)=>(t,r,i)=>`\x1B[${38+e};2;${t};${r};${i}m`,dx={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},J$2=Object.keys(dx.modifier),CyD=Object.keys(dx.color),ByD=Object.keys(dx.bgColor),K$2=[...CyD,...ByD];function IyD(){let e=new Map;for(let[t,r]of Object.entries(dx)){for(let[i,n]of Object.entries(r))dx[i]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[i]=dx[i],e.set(n[0],n[1]);Object.defineProperty(dx,t,{value:r,enumerable:!1})}return Object.defineProperty(dx,"codes",{value:e,enumerable:!1}),dx.color.close="\x1B[39m",dx.bgColor.close="\x1B[49m",dx.color.ansi=tzp(),dx.color.ansi256=rzp(),dx.color.ansi16m=izp(),dx.bgColor.ansi=tzp(10),dx.bgColor.ansi256=rzp(10),dx.bgColor.ansi16m=izp(10),Object.defineProperties(dx,{rgbToAnsi256:{value(t,r,i){return t===r&&r===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(i/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[i]=r;i.length===3&&(i=[...i].map(a=>a+a).join(""));let n=Number.parseInt(i,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:t=>dx.rgbToAnsi256(...dx.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,i,n;if(t>=232)r=((t-232)*10+8)/255,i=r,n=r;else{t-=16;let l=t%36;r=Math.floor(t/36)/5,i=Math.floor(l/6)/5,n=l%6/5}let a=Math.max(r,i,n)*2;if(a===0)return 30;let u=30+(Math.round(n)<<2|Math.round(i)<<1|Math.round(r));return a===2&&(u+=60),u},enumerable:!1},rgbToAnsi:{value:(t,r,i)=>dx.ansi256ToAnsi(dx.rgbToAnsi256(t,r,i)),enumerable:!1},hexToAnsi:{value:t=>dx.ansi256ToAnsi(dx.hexToAnsi256(t)),enumerable:!1}}),dx}var zyD=IyD(),gWt=zyD;var dFo=ci(require("process"),1),azp=ci(require("os"),1),kYs=ci(require("tty"),1);function MNe(e,t=globalThis.Deno?globalThis.Deno.args:dFo.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",i=t.indexOf(r+e),n=t.indexOf("--");return i!==-1&&(n===-1||i<n)}var{env:ZN}=dFo.default,fFo;MNe("no-color")||MNe("no-colors")||MNe("color=false")||MNe("color=never")?fFo=0:(MNe("color")||MNe("colors")||MNe("color=true")||MNe("color=always"))&&(fFo=1);function xyD(){if("FORCE_COLOR"in ZN)return ZN.FORCE_COLOR==="true"?1:ZN.FORCE_COLOR==="false"?0:ZN.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ZN.FORCE_COLOR,10),3)}function RyD(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function NyD(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let i=xyD();i!==void 0&&(fFo=i);let n=r?fFo:i;if(n===0)return 0;if(r){if(MNe("color=16m")||MNe("color=full")||MNe("color=truecolor"))return 3;if(MNe("color=256"))return 2}if("TF_BUILD"in ZN&&"AGENT_NAME"in ZN)return 1;if(e&&!t&&n===void 0)return 0;let a=n||0;if(ZN.TERM==="dumb")return a;if(dFo.default.platform==="win32"){let u=azp.default.release().split(".");return Number(u[0])>=10&&Number(u[2])>=10586?Number(u[2])>=14931?3:2:1}if("CI"in ZN)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(u=>u in ZN)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(u=>u in ZN)||ZN.CI_NAME==="codeship"?1:a;if("TEAMCITY_VERSION"in ZN)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ZN.TEAMCITY_VERSION)?1:0;if(ZN.COLORTERM==="truecolor"||ZN.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in ZN){let u=Number.parseInt((ZN.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ZN.TERM_PROGRAM){case"iTerm.app":return u>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ZN.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ZN.TERM)||"COLORTERM"in ZN?1:a}function nzp(e,t={}){let r=NyD(e,{streamIsTTY:e&&e.isTTY,...t});return RyD(r)}var FyD={stdout:nzp({isTTY:kYs.default.isatty(1)}),stderr:nzp({isTTY:kYs.default.isatty(2)})},ozp=FyD;function uzp(e,t,r){let i=e.indexOf(t);if(i===-1)return e;let n=t.length,a=0,u="";do u+=e.slice(a,i)+t+r,a=i+n,i=e.indexOf(t,a);while(i!==-1);return u+=e.slice(a),u}function szp(e,t,r,i){let n=0,a="";do{let u=e[i-1]==="\r";a+=e.slice(n,u?i-1:i)+t+(u?`\r
1674
1674
  `:`
1675
1675
  `)+r,n=i+1,i=e.indexOf(`
1676
1676
  `,n)}while(i!==-1);return a+=e.slice(n),a}var{stdout:czp,stderr:lzp}=ozp,eXs=Symbol("GENERATOR"),EFn=Symbol("STYLER"),uMa=Symbol("IS_EMPTY"),fzp=["ansi","ansi","ansi256","ansi16m"],MFn=Object.create(null),LyD=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=czp?czp.level:0;e.level=t.level===void 0?r:t.level};var UyD=e=>{let t=(...r)=>r.join(" ");return LyD(t,e),Object.setPrototypeOf(t,sMa.prototype),t};function sMa(e){return UyD(e)}Object.setPrototypeOf(sMa.prototype,Function.prototype);for(let[e,t]of Object.entries(gWt))MFn[e]={get(){let r=pFo(this,rXs(t.open,t.close,this[EFn]),this[uMa]);return Object.defineProperty(this,e,{value:r}),r}};MFn.visible={get(){let e=pFo(this,this[EFn],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var tXs=(e,t,r,...i)=>e==="rgb"?t==="ansi16m"?gWt[r].ansi16m(...i):t==="ansi256"?gWt[r].ansi256(gWt.rgbToAnsi256(...i)):gWt[r].ansi(gWt.rgbToAnsi(...i)):e==="hex"?tXs("rgb",t,r,...gWt.hexToRgb(...i)):gWt[r][e](...i),VyD=["rgb","hex","ansi256"];for(let e of VyD){MFn[e]={get(){let{level:r}=this;return function(...i){let n=rXs(tXs(e,fzp[r],"color",...i),gWt.color.close,this[EFn]);return pFo(this,n,this[uMa])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);MFn[t]={get(){let{level:r}=this;return function(...i){let n=rXs(tXs(e,fzp[r],"bgColor",...i),gWt.bgColor.close,this[EFn]);return pFo(this,n,this[uMa])}}}}var WyD=Object.defineProperties(()=>{},{...MFn,level:{enumerable:!0,get(){return this[eXs].level},set(e){this[eXs].level=e}}}),rXs=(e,t,r)=>{let i,n;return r===void 0?(i=e,n=t):(i=r.openAll+e,n=t+r.closeAll),{open:e,close:t,openAll:i,closeAll:n,parent:r}},pFo=(e,t,r)=>{let i=(...n)=>HyD(i,n.length===1?""+n[0]:n.join(" "));return Object.setPrototypeOf(i,WyD),i[eXs]=e,i[EFn]=t,i[uMa]=r,i},HyD=(e,t)=>{if(e.level<=0||!t)return e[uMa]?"":t;let r=e[EFn];if(r===void 0)return t;let{openAll:i,closeAll:n}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=uzp(t,r.close,r.open),r=r.parent;let a=t.indexOf(`
@@ -1704,7 +1704,7 @@ ${c.indent}`:""}${FBd(o)}:${l.indent?" ":""}`;return u=!1,s=!0,l.objectItem=void
1704
1704
  `}),r.replaceAll(/\n$/g,"")}function t5D(e){return e?Fh.green(R6.radioOn):R6.radioOff}var A4o=ci(aMe(),1);function k9p(e,t){return e=String(e),t=typeof t=="string"?t:"*",e.length===0?"":Array.from({length:e.length+1}).join(t)}var cAa=class extends X2{_run(t){this.done=t;let r=LW(this.rl),i=r.line.pipe((0,A4o.map)(this.filterInput.bind(this))),n=this.handleSubmitEvents(i);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),r.keypress.pipe((0,A4o.takeUntil)(n.success)).forEach(this.onKeypress.bind(this)),this.render(),this}render(t){let r=this.getQuestion(),i="";r+=this.status==="answered"?this.getMaskedValue(this.answer):this.getMaskedValue(this.rl.line||""),t&&(i=`
1705
1705
  `+Fh.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?Fh.cyan(k9p(t,this.opt.mask)):Fh.italic.dim("[hidden]"):this.opt.mask?k9p(t,this.opt.mask):Fh.italic.dim("[input is hidden] ")}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var jUp=ci($ec(),1),wUp=ci(aMe(),1);var gAa=class extends X2{_run(t){this.done=t,this.editorResult=new wUp.Subject;let r=LW(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let i=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,n=this.handleSubmitEvents(this.editorResult);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,i?this.render():this.startExternalEditor(),this}render(t){let r="",i=this.getQuestion();i+=this.status==="answered"?Fh.dim("Received"):Fh.dim("Press <enter> to launch your preferred editor."),t&&(r=Fh.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),(0,jUp.editAsync)(this.currentText,this.endExternalEditor.bind(this),{postfix:this.opt.postfix??".txt"})}endExternalEditor(t,r){this.rl.resume(),t?this.editorResult.error(t):this.editorResult.next(r)}onEnd(t){this.editorResult.unsubscribe(),this.lineSubscription.unsubscribe(),this.answer=t.value,this.status="answered",this.render(),this.screen.done(),this.done(this.answer)}onError(t){this.render(t.isValid)}};var oVp=ci(tVp(),1);var nVp=ci(require("readline"),1),aVp=ci(iVp(),1),nGi=class{constructor(t){this.rl||=nVp.default.createInterface(v9D(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 v9D(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let n=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw n.isTtyError=!0,n}let r=new aVp.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var PAa=class extends nGi{constructor(t={}){super(t),this.log=(0,oVp.default)(this.writeLog.bind(this)),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return tAa(this.rl,this.bottomBar.split(`
1706
1706
  `).length),this}updateBottomBar(t){return tAa(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+`
1707
- `}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&&S4o(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var yVp=ci(cVp(),1),vVp=ci(kZs(),1),bVp=ci(_Vp(),1),Uq=ci(aMe(),1),gVp=ci(lMa(),1);var k4o=ci(aMe(),1),hVp=ci(lMa(),1),e2o=function(e,t,r){return typeof e[t]!="function"?(0,k4o.of)(e):(0,k4o.from)((0,hVp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var jAa={isPlainObject:yVp.default,set:bVp.default,get:vVp.default},X3n=class extends nGi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=jAa.isPlainObject(r)?{...r}:{},jAa.isPlainObject(t)&&(t=Object.values(t).every(n=>jAa.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,Uq.from)(t):t;return this.process=i.pipe((0,Uq.concatMap)(this.processQuestion.bind(this)),(0,Uq.publish)()),this.process.connect(),this.process.pipe((0,Uq.reduce)((n,a)=>(jAa.set(n,a.name,a.answer),n),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,Uq.defer)(()=>(0,Uq.of)(t).pipe((0,Uq.concatMap)(this.setDefaultType.bind(this)),(0,Uq.concatMap)(this.filterIfRunnable.bind(this)),(0,Uq.concatMap)(()=>e2o(t,"message",this.answers)),(0,Uq.concatMap)(()=>e2o(t,"default",this.answers)),(0,Uq.concatMap)(()=>e2o(t,"choices",this.answers)),(0,Uq.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,Uq.defer)(()=>(0,Uq.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,Uq.defer)(()=>(0,Uq.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&jAa.get(this.answers,t.name)!==void 0)return(0,Uq.empty)();if(t.when===!1)return(0,Uq.empty)();if(typeof t.when!="function")return(0,Uq.of)(t);let{answers:r}=this;return(0,Uq.defer)(()=>(0,Uq.from)((0,gVp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,Uq.filter)(i=>i!=null)))}};function OVp(e){let t=function(r,i){let n;try{n=new X3n(t.prompts,e)}catch(u){return Promise.reject(u)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",iAa),this.registerPrompt("input",K$i),this.registerPrompt("number",nAa),this.registerPrompt("confirm",aAa),this.registerPrompt("rawlist",oAa),this.registerPrompt("expand",uAa),this.registerPrompt("checkbox",sAa),this.registerPrompt("password",cAa),this.registerPrompt("editor",gAa)},t.restoreDefaultPrompts(),t}var rtc=OVp();function z9D(e,t){rtc.registerPrompt(e,t)}function x9D(){rtc.restoreDefaultPrompts()}var R9D={prompt:rtc,ui:{BottomBar:PAa,Prompt:X3n},createPromptModule:OVp,registerPrompt:z9D,restoreDefaultPrompts:x9D,Separator:qae},t2o=R9D;var qWp=ci(mVp()),lVD="4.2.1",qWt;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",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"})(qWt||(qWt={}));function fVD(e,t){if(!e)throw new Error(t)}function dVD(e){return e?.replace(/\/+$/,"")}async function pVD(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(n=>setTimeout(n,t.retryDelay));try{return await e()}catch(n){if(r=n,!t.retryCheck(n))throw n}}throw r}function _VD(){return new Date().getTime()}function PWp(){return new Date().toISOString()}function TWp(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var IAa=String.fromCharCode,jWp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",y2o={};function hVD(e,t){if(!y2o[e]){y2o[e]={};for(let r=0;r<e.length;r++)y2o[e][e.charAt(r)]=r}return y2o[e][t]}var zAa={compressToBase64:function(e){if(e==null)return"";let t=zAa._compress(e,6,function(r){return jWp.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:zAa._decompress(e.length,32,function(t){return hVD(jWp,e.charAt(t))})},compress:function(e){return zAa._compress(e,16,function(t){return IAa(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,d="",s="",o="",c=2,b=3,g=2,O=0,m=0,P;for(P=0;P<e.length;P+=1)if(d=e.charAt(P),Object.prototype.hasOwnProperty.call(i,d)||(i[d]=b++,n[d]=!0),s=o+d,Object.prototype.hasOwnProperty.call(i,s))o=s;else{if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++),i[s]=b++,o=String(d)}if(o!==""){if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++)}for(l=2,u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;for(;;)if(O=O<<1,m==t-1){a.push(r(O));break}else m++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:zAa._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},u=4,l=4,d=3,s="",o,c,b,g,O,m,P;for(o=0;o<3;o+=1)i[o]=o;for(b=0,O=Math.pow(2,2),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;P=IAa(b);break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;P=IAa(b);break;case 2:return""}for(i[3]=P,c=P,n.push(P);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,d),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(P=b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=IAa(b),P=l-1,u--;break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=IAa(b),P=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,d),d++),i[P])s=i[P];else if(P===l)s=c+c.charAt(0);else return null;n.push(s),i[l++]=c+s.charAt(0),u--,c=s,u==0&&(u=Math.pow(2,d),d++)}}},Ltc=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}};var v2o="0123456789abcdef",b2o=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=v2o.charAt(this.bytes[r]>>>4),t+=v2o.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+=v2o.charAt(this.bytes[r]>>>4),t+=v2o.charAt(this.bytes[r]&15);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},Utc=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??yVD()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return b2o.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,b2o.ofInner(t)}},yVD=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),wWp,SWp=()=>vVD().toString(),vVD=()=>(wWp||(wWp=new Utc)).generate(),g2o=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},xAa=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function DWp(e){return typeof e=="object"&&(e instanceof g2o||e instanceof xAa)}var Vtc=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new Ltc,this._isInitialized=!1,fVD(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=dVD(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.defaultOptIn=r?.defaultOptIn??!0,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:DWp},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??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(qWt.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(qWt.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(qWt.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=SWp();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}groupIdentifyStateless(t,r,i,n,a,u){this.wrap(()=>{let l=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...u||{}}});this.enqueue("capture",l,n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let u=`${this.host}/decide/?v=3`,l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(d=>d.json()).catch(d=>{this._events.emit("error",d)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0&&(d=!1),d}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).payloads}_parsePayload(t){try{return JSON.parse(t)}catch{return t}}async getFeatureFlagsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).flags}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a){await this._initPromise;let u={};(a??this.disableGeoip)&&(u.geoip_disable=!0);let l=await this.getDecide(t,r,i,n,u),d=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:d,payloads:o}}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:PWp(),uuid:i?.uuid?i.uuid:SWp()};(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId);let u=this.getPersistedProperty(qWt.Queue)||[];u.length>=this.maxQueueSize&&(u.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),u.push({message:n}),this.setPersistedProperty(qWt.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=TWp(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}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(qWt.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty(qWt.Queue)||[];this.setPersistedProperty(qWt.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:PWp()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${_VD()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,d=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(zAa.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,d)}catch(s){throw s instanceof xAa||n(),this._events.emit("error",s),s}return n(),this._events.emit("flush",i),i}async fetchWithRetry(t,r,i,n){var a;return(a=AbortSignal).timeout??(a.timeout=function(l){let d=new AbortController;return setTimeout(()=>d.abort(),l),d.signal}),await pVD(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(d){throw new xAa(d)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new g2o(u);return u},{...this._retryOptions,...i})}async shutdown(t=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let r=Date.now()+t;for(;(this.getPersistedProperty(qWt.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!DWp(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},Wtc=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},Htc=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!Htc){let e=mWp();Htc=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var CWp=Htc,bVD=1152921504606847e3,gVD=["is_not"],O2o=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},Z2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},$tc=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=l.fetch||CWp,this.onError=l.onError,this.customHeaders=u,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let u,l;if(!this.loadedSuccessfullyOnce)return u;for(let d of this.featureFlags)if(t===d.key){l=d;break}if(l!==void 0)try{u=this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(d){d instanceof Z2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${d}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return u}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},u={},l=this.featureFlags.length==0;return this.featureFlags.map(async d=>{try{let s=this.computeFlagLocally(d,t,r,i,n);a[d.key]=s;let o=await this.computeFeatureFlagPayloadLocally(d.key,s);o&&(u[d.key]=o)}catch(s){s instanceof Z2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new Z2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let d=this.groupTypeMapping[String(l)];if(!d)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new Z2("Flag has unknown group type index");if(!(d in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[d];return this.matchFeatureFlagProperties(t,i[d],s)}else return this.matchFeatureFlagProperties(t,r,n)}matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,d=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of d)try{if(this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof Z2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new Z2("Can't determine if feature flag is enabled or not with given properties");return!1}isConditionMatch(t,r,i,n){let a=i.rollout_percentage,u=l=>{this.logMsgIfDebug(()=>console.warn(l))};if((i.properties||[]).length>0){for(let l of i.properties){let d=l.type,s=!1;if(d==="cohort"?s=IWp(l,n,this.cohorts,this.debugMode):s=BWp(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&EWp(t.key,r)>a/100)}getMatchingVariant(t,r){let i=EWp(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(l=>{n=i+l.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:l.key}),i=n}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let t=await this._requestFeatureFlagDefinitions();if(t&&t.status===401)throw new O2o("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(t&&t.status!==200)return;let r=await t.json();"flags"in r||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`)),this.featureFlags=r.flags||[],this.featureFlagsByKey=this.featureFlags.reduce((i,n)=>(i[n.key]=n,i),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||[],this.loadedSuccessfullyOnce=!0}catch(t){t instanceof O2o&&this.onError?.(t)}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=TWp(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function EWp(e,t,r=""){let i=(0,qWp.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/bVD}function BWp(e,t,r){let i=e.key,n=e.value,a=e.operator||"exact";if(i in t){if(a==="is_not_set")throw new Z2("Operator is_not_set is not supported")}else throw new Z2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!gVD.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function l(s,o){return Array.isArray(s)?s.map(c=>String(c).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function d(s,o,c){if(c==="gt")return s>o;if(c==="gte")return s>=o;if(c==="lt")return s<o;if(c==="lte")return s<=o;throw new Error(`Invalid operator: ${c}`)}switch(a){case"exact":return l(n,u);case"is_not":return!l(n,u);case"is_set":return i in t;case"icontains":return String(u).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(n).toLowerCase());case"regex":return MWp(String(n))&&String(u).match(String(n))!==null;case"not_regex":return MWp(String(n))&&String(u).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&u!=null?typeof u=="string"?d(u,String(n),a):d(u,s,a):d(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=OVD(String(n));if(s==null&&(s=AWp(n)),s==null)throw new Z2(`Invalid date: ${n}`);let o=AWp(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new Z2(`Unknown operator: ${a}`)}}function IWp(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new Z2("can't match cohort without a given cohort property value");let a=r[n];return zWp(a,t,r,i)}function zWp(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let l of a)try{let d=zWp(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof Z2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new Z2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let d;l.type==="cohort"?d=IWp(l,t,r,i):d=BWp(l,t);let s=l.negation||!1;if(n==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof Z2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new Z2("can't match cohort without a given cohort property value");return n==="AND"}}function MWp(e){try{return new RegExp(e),!0}catch{return!1}}function AWp(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 Z2(`${e} is in an invalid date format`)}else throw new Z2(`The date provided ${e} must be a string, number, or date object`)}function OVD(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var mVD=30*1e3,PVD=50*1e3,n7n=class extends Vtc{constructor(t,r={}){super(t,r),this._memoryStorage=new Wtc,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new $tc({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:mVD,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||PVD}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):CWp(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return lVD}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({distinctId:t,event:r,properties:i,groups:n,sendFeatureFlags:a,timestamp:u,disableGeoip:l,uuid:d}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:d})},o=(b,g,O)=>super.getFeatureFlagsStateless(b,g,void 0,void 0,O),c=Promise.resolve().then(async()=>{if(a)return await o(t,n,l);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let b={};for(let[g,O]of Object.entries(n||{}))b[g]=String(O);return await this.getAllFlags(t,{groups:b,disableGeoip:l,onlyEvaluateLocally:!0})}return{}}).then(b=>{let g={};if(b)for(let[m,P]of Object.entries(b))g[`$feature/${m}`]=P;let O=Object.keys(b||{}).filter(m=>b?.[m]!==!1);return O.length>0&&(g.$active_feature_flags=O),g}).catch(()=>({})).then(b=>{s({...b,...i,$groups:n})});this.addPendingPromise(c)}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set||r;super.identifyStateless(t,{$set:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:u,sendFeatureFlagEvents:l,personProperties:d,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,d,s);d=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,d,s),b=c!==void 0;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,d,s,a));let g=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(g))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(g):this.distinctIdHasSentFlagCalls[r]=[g],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,locally_evaluated:b,[`$feature/${t}`]:c},groups:n,disableGeoip:a})),c}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:u}=n||{},{onlyEvaluateLocally:l,sendFeatureFlagEvents:d,personProperties:s,groupProperties:o}=n||{},c=this.addLocalPersonAndGroupProperties(r,a,s,o);s=c.allPersonProperties,o=c.allGroupProperties;let b;return i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0})),i&&(b=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i)),l==null&&(l=!1),d==null&&(d=!0),l==null&&(l=!1),!(b!==void 0)&&!l&&(b=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),b}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:u,groupProperties:l}=r||{},d=this.addLocalPersonAndGroupProperties(t,i,u,l);u=d.allPersonProperties,l=d.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,u,l),o={},c={},b=!0;if(s&&(o=s.response,c=s.payloads,b=s.fallbackToDecide),b&&!a){let g=await super.getFeatureFlagsAndPayloadsStateless(t,i,u,l,n);o={...o,...g.flags||{}},c={...c,...g.payloads||{}}}return{featureFlags:o,featureFlagPayloads:c}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async shutdown(t){return this.featureFlagsPoller?.stopPoller(),super.shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},u={};if(r)for(let l of Object.keys(r))u[l]={$group_key:r[l],...n?.[l]||{}};return{allPersonProperties:a,allGroupProperties:u}}},Gtc=class e{constructor(t,r,i,n){this.posthog=t,this.posthogHost=r,this.organization=i,this.prefix=n,this.name="posthog-node",this.posthogHost=t.options.host??"https://us.i.posthog.com"}setupOnce(t,r){t(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let n=r(),a=i.tags[e.POSTHOG_ID_TAG];if(a===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${a}`,this.posthogHost).toString();let u={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},l=n.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&l!==void 0&&i.event_id!==void 0&&(u.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${l}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:a,properties:u}),i})}};Gtc.POSTHOG_ID_TAG="posthog_distinct_id";var m2o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new n7n(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.63.27",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var RAa=class{async sendEvent(){}async identify(){}async flush(){}};var a7n=require("fs/promises"),FWp=require("os"),LWp=require("path");var xWp=ci(require("crypto")),j2o=new Uint8Array(256),P2o=j2o.length;function Qtc(){return P2o>j2o.length-16&&(xWp.default.randomFillSync(j2o),P2o=0),j2o.slice(P2o,P2o+=16)}var WW=[];for(let e=0;e<256;++e)WW.push((e+256).toString(16).slice(1));function RWp(e,t=0){return WW[e[t+0]]+WW[e[t+1]]+WW[e[t+2]]+WW[e[t+3]]+"-"+WW[e[t+4]]+WW[e[t+5]]+"-"+WW[e[t+6]]+WW[e[t+7]]+"-"+WW[e[t+8]]+WW[e[t+9]]+"-"+WW[e[t+10]]+WW[e[t+11]]+WW[e[t+12]]+WW[e[t+13]]+WW[e[t+14]]+WW[e[t+15]]}var NWp=ci(require("crypto")),Jtc={randomUUID:NWp.default.randomUUID};function jVD(e,t,r){if(Jtc.randomUUID&&!t&&!e)return Jtc.randomUUID();e=e||{};let i=e.random||(e.rng||Qtc)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return RWp(i)}var zae=jVD;var wVD="id",SVD=".fern",NAa=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new n7n(r),this.userId=t==null?void 0:rJs(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.63.27",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Vu(hl.of((0,FWp.homedir)()),Qa.of(SVD),Qa.of(wVD));await Sf(t)||(await(0,a7n.mkdir)((0,LWp.dirname)(t),{recursive:!0}),await(0,a7n.writeFile)(t,zae())),this.persistedDistinctId=(await(0,a7n.readFile)(t)).toString()}return this.persistedDistinctId}};var Ktc;async function o7n(){return Ktc==null&&(Ktc=await DVD()),Ktc}async function DVD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new RAa;let r=await SRo();return r!=null?new NAa({token:r,posthogApiKey:e}):await QNn()!=null?new m2o({posthogApiKey:e}):new NAa({token:void 0,posthogApiKey:e})}catch{return new RAa}}function FAa(e,t){return function(){return e.apply(t,arguments)}}var{toString:EVD}=Object.prototype,{getPrototypeOf:Xtc}=Object,S2o=(e=>t=>{let r=EVD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),TWt=e=>(e=e.toLowerCase(),t=>S2o(t)===e),D2o=e=>t=>typeof t===e,{isArray:u7n}=Array,LAa=D2o("undefined");function MVD(e){return e!==null&&!LAa(e)&&e.constructor!==null&&!LAa(e.constructor)&&uMe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var VWp=TWt("ArrayBuffer");function AVD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&VWp(e.buffer),t}var qVD=D2o("string"),uMe=D2o("function"),WWp=D2o("number"),E2o=e=>e!==null&&typeof e=="object",TVD=e=>e===!0||e===!1,w2o=e=>{if(S2o(e)!=="object")return!1;let t=Xtc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},CVD=TWt("Date"),BVD=TWt("File"),IVD=TWt("Blob"),zVD=TWt("FileList"),xVD=e=>E2o(e)&&uMe(e.pipe),RVD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||uMe(e.append)&&((t=S2o(e))==="formdata"||t==="object"&&uMe(e.toString)&&e.toString()==="[object FormData]"))},NVD=TWt("URLSearchParams"),[FVD,LVD,UVD,VVD]=["ReadableStream","Request","Response","Headers"].map(TWt),WVD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function UAa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),u7n(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function HWp(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var cGi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$Wp=e=>!LAa(e)&&e!==cGi;function Ytc(){let{caseless:e}=$Wp(this)&&this||{},t={},r=(i,n)=>{let a=e&&HWp(t,n)||n;w2o(t[a])&&w2o(i)?t[a]=Ytc(t[a],i):w2o(i)?t[a]=Ytc({},i):u7n(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&UAa(arguments[i],r);return t}var HVD=(e,t,r,{allOwnKeys:i}={})=>(UAa(t,(n,a)=>{r&&uMe(n)?e[a]=FAa(n,r):e[a]=n},{allOwnKeys:i}),e),$VD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),GVD=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},QVD=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&Xtc(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},JVD=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},KVD=e=>{if(!e)return null;if(u7n(e))return e;let t=e.length;if(!WWp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},YVD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Xtc(Uint8Array)),XVD=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},ZVD=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},kVD=TWt("HTMLFormElement"),eWD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),UWp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),tWD=TWt("RegExp"),GWp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};UAa(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},rWD=e=>{GWp(e,(t,r)=>{if(uMe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(uMe(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},iWD=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return u7n(e)?i(e):i(String(e).split(t)),r},nWD=()=>{},aWD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function oWD(e){return!!(e&&uMe(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var uWD=e=>{let t=new Array(10),r=(i,n)=>{if(E2o(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=u7n(i)?[]:{};return UAa(i,(u,l)=>{let d=r(u,n+1);!LAa(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},sWD=TWt("AsyncFunction"),cWD=e=>e&&(E2o(e)||uMe(e))&&uMe(e.then)&&uMe(e.catch),QWp=((e,t)=>e?setImmediate:t?((r,i)=>(cGi.addEventListener("message",({source:n,data:a})=>{n===cGi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),cGi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",uMe(cGi.postMessage)),lWD=typeof queueMicrotask<"u"?queueMicrotask.bind(cGi):typeof process<"u"&&process.nextTick||QWp,_s={isArray:u7n,isArrayBuffer:VWp,isBuffer:MVD,isFormData:RVD,isArrayBufferView:AVD,isString:qVD,isNumber:WWp,isBoolean:TVD,isObject:E2o,isPlainObject:w2o,isReadableStream:FVD,isRequest:LVD,isResponse:UVD,isHeaders:VVD,isUndefined:LAa,isDate:CVD,isFile:BVD,isBlob:IVD,isRegExp:tWD,isFunction:uMe,isStream:xVD,isURLSearchParams:NVD,isTypedArray:YVD,isFileList:zVD,forEach:UAa,merge:Ytc,extend:HVD,trim:WVD,stripBOM:$VD,inherits:GVD,toFlatObject:QVD,kindOf:S2o,kindOfTest:TWt,endsWith:JVD,toArray:KVD,forEachEntry:XVD,matchAll:ZVD,isHTMLForm:kVD,hasOwnProperty:UWp,hasOwnProp:UWp,reduceDescriptors:GWp,freezeMethods:rWD,toObjectSet:iWD,toCamelCase:eWD,noop:nWD,toFiniteNumber:aWD,findKey:HWp,global:cGi,isContextDefined:$Wp,isSpecCompliantForm:oWD,toJSONObject:uWD,isAsyncFn:sWD,isThenable:cWD,setImmediate:QWp,asap:lWD};function s7n(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}_s.inherits(s7n,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:_s.toJSONObject(this.config),code:this.code,status:this.status}}});var JWp=s7n.prototype,KWp={};["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=>{KWp[e]={value:e}});Object.defineProperties(s7n,KWp);Object.defineProperty(JWp,"isAxiosError",{value:!0});s7n.from=(e,t,r,i,n,a)=>{let u=Object.create(JWp);return _s.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),s7n.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var xp=s7n;var YWp=ci(uwa(),1),M2o=YWp.default;function Ztc(e){return _s.isPlainObject(e)||_s.isArray(e)}function ZWp(e){return _s.endsWith(e,"[]")?e.slice(0,-2):e}function XWp(e,t,r){return e?e.concat(t).map(function(n,a){return n=ZWp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function fWD(e){return _s.isArray(e)&&!e.some(Ztc)}var dWD=_s.toFlatObject(_s,{},null,function(t){return/^is[A-Z]/.test(t)});function pWD(e,t,r){if(!_s.isObject(e))throw new TypeError("target must be an object");t=t||new(M2o||FormData),r=_s.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,P){return!_s.isUndefined(P[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&_s.isSpecCompliantForm(t);if(!_s.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(_s.isDate(O))return O.toISOString();if(!d&&_s.isBlob(O))throw new xp("Blob is not supported. Use a Buffer instead.");return _s.isArrayBuffer(O)||_s.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,P){let E=O;if(O&&!P&&typeof O=="object"){if(_s.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(_s.isArray(O)&&fWD(O)||(_s.isFileList(O)||_s.endsWith(m,"[]"))&&(E=_s.toArray(O)))return m=ZWp(m),E.forEach(function(M,D){!(_s.isUndefined(M)||M===null)&&t.append(u===!0?XWp([m],D,a):u===null?m:m+"[]",s(M))}),!1}return Ztc(O)?!0:(t.append(XWp(P,m,a),s(O)),!1)}let c=[],b=Object.assign(dWD,{defaultVisitor:o,convertValue:s,isVisitable:Ztc});function g(O,m){if(!_s.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),_s.forEach(O,function(E,q){(!(_s.isUndefined(E)||E===null)&&n.call(t,E,_s.isString(q)?q.trim():q,m,b))===!0&&g(E,m?m.concat(q):[q])}),c.pop()}}if(!_s.isObject(e))throw new TypeError("data must be an object");return g(e),t}var YDi=pWD;function kWp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function eHp(e,t){this._pairs=[],e&&YDi(e,this,t)}var tHp=eHp.prototype;tHp.append=function(t,r){this._pairs.push([t,r])};tHp.toString=function(t){let r=t?function(i){return t.call(this,i,kWp)}:kWp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var rHp=eHp;function _WD(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function lGi(e,t,r){if(!t)return e;let i=r&&r.encode||_WD;_s.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=_s.isURLSearchParams(t)?t.toString():new rHp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var ktc=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){_s.forEach(this.handlers,function(i){i!==null&&t(i)})}},erc=ktc;var c7n={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var oHp=ci(require("crypto"),1);var iHp=ci(require("url"),1),nHp=iHp.default.URLSearchParams;var trc="abcdefghijklmnopqrstuvwxyz",aHp="0123456789",uHp={DIGIT:aHp,ALPHA:trc,ALPHA_DIGIT:trc+trc.toUpperCase()+aHp},hWD=(e=16,t=uHp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);oHp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},sHp={isNode:!0,classes:{URLSearchParams:nHp,FormData:M2o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:uHp,generateString:hWD,protocols:["http","https","file","data"]};var nrc={};jo(nrc,{hasBrowserEnv:()=>irc,hasStandardBrowserEnv:()=>yWD,hasStandardBrowserWebWorkerEnv:()=>vWD,navigator:()=>rrc,origin:()=>bWD});var irc=typeof window<"u"&&typeof document<"u",rrc=typeof navigator=="object"&&navigator||void 0,yWD=irc&&(!rrc||["ReactNative","NativeScript","NS"].indexOf(rrc.product)<0),vWD=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",bWD=irc&&window.location.href||"http://localhost";var sA={...nrc,...sHp};function arc(e,t){return YDi(e,new sA.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return sA.isNode&&_s.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function gWD(e){return _s.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function OWD(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function mWD(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),d=a>=r.length;return u=!u&&_s.isArray(n)?n.length:u,d?(_s.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!_s.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&_s.isArray(n[u])&&(n[u]=OWD(n[u])),!l)}if(_s.isFormData(e)&&_s.isFunction(e.entries)){let r={};return _s.forEachEntry(e,(i,n)=>{t(gWD(i),n,r,0)}),r}return null}var A2o=mWD;function PWD(e,t,r){if(_s.isString(e))try{return(t||JSON.parse)(e),_s.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var orc={transitional:c7n,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=_s.isObject(t);if(a&&_s.isHTMLForm(t)&&(t=new FormData(t)),_s.isFormData(t))return n?JSON.stringify(A2o(t)):t;if(_s.isArrayBuffer(t)||_s.isBuffer(t)||_s.isStream(t)||_s.isFile(t)||_s.isBlob(t)||_s.isReadableStream(t))return t;if(_s.isArrayBufferView(t))return t.buffer;if(_s.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return arc(t,this.formSerializer).toString();if((l=_s.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return YDi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),PWD(t)):t}],transformResponse:[function(t){let r=this.transitional||orc.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(_s.isResponse(t)||_s.isReadableStream(t))return t;if(t&&_s.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?xp.from(l,xp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:sA.classes.FormData,Blob:sA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_s.forEach(["delete","get","head","post","put","patch"],e=>{orc.headers[e]={}});var l7n=orc;var jWD=_s.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"]),cHp=e=>{let t={},r,i,n;return e&&e.split(`
1707
+ `}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&&S4o(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var yVp=ci(cVp(),1),vVp=ci(kZs(),1),bVp=ci(_Vp(),1),Uq=ci(aMe(),1),gVp=ci(lMa(),1);var k4o=ci(aMe(),1),hVp=ci(lMa(),1),e2o=function(e,t,r){return typeof e[t]!="function"?(0,k4o.of)(e):(0,k4o.from)((0,hVp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var jAa={isPlainObject:yVp.default,set:bVp.default,get:vVp.default},X3n=class extends nGi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=jAa.isPlainObject(r)?{...r}:{},jAa.isPlainObject(t)&&(t=Object.values(t).every(n=>jAa.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,Uq.from)(t):t;return this.process=i.pipe((0,Uq.concatMap)(this.processQuestion.bind(this)),(0,Uq.publish)()),this.process.connect(),this.process.pipe((0,Uq.reduce)((n,a)=>(jAa.set(n,a.name,a.answer),n),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,Uq.defer)(()=>(0,Uq.of)(t).pipe((0,Uq.concatMap)(this.setDefaultType.bind(this)),(0,Uq.concatMap)(this.filterIfRunnable.bind(this)),(0,Uq.concatMap)(()=>e2o(t,"message",this.answers)),(0,Uq.concatMap)(()=>e2o(t,"default",this.answers)),(0,Uq.concatMap)(()=>e2o(t,"choices",this.answers)),(0,Uq.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,Uq.defer)(()=>(0,Uq.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,Uq.defer)(()=>(0,Uq.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&jAa.get(this.answers,t.name)!==void 0)return(0,Uq.empty)();if(t.when===!1)return(0,Uq.empty)();if(typeof t.when!="function")return(0,Uq.of)(t);let{answers:r}=this;return(0,Uq.defer)(()=>(0,Uq.from)((0,gVp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,Uq.filter)(i=>i!=null)))}};function OVp(e){let t=function(r,i){let n;try{n=new X3n(t.prompts,e)}catch(u){return Promise.reject(u)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",iAa),this.registerPrompt("input",K$i),this.registerPrompt("number",nAa),this.registerPrompt("confirm",aAa),this.registerPrompt("rawlist",oAa),this.registerPrompt("expand",uAa),this.registerPrompt("checkbox",sAa),this.registerPrompt("password",cAa),this.registerPrompt("editor",gAa)},t.restoreDefaultPrompts(),t}var rtc=OVp();function z9D(e,t){rtc.registerPrompt(e,t)}function x9D(){rtc.restoreDefaultPrompts()}var R9D={prompt:rtc,ui:{BottomBar:PAa,Prompt:X3n},createPromptModule:OVp,registerPrompt:z9D,restoreDefaultPrompts:x9D,Separator:qae},t2o=R9D;var qWp=ci(mVp()),lVD="4.2.1",qWt;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",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"})(qWt||(qWt={}));function fVD(e,t){if(!e)throw new Error(t)}function dVD(e){return e?.replace(/\/+$/,"")}async function pVD(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(n=>setTimeout(n,t.retryDelay));try{return await e()}catch(n){if(r=n,!t.retryCheck(n))throw n}}throw r}function _VD(){return new Date().getTime()}function PWp(){return new Date().toISOString()}function TWp(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var IAa=String.fromCharCode,jWp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",y2o={};function hVD(e,t){if(!y2o[e]){y2o[e]={};for(let r=0;r<e.length;r++)y2o[e][e.charAt(r)]=r}return y2o[e][t]}var zAa={compressToBase64:function(e){if(e==null)return"";let t=zAa._compress(e,6,function(r){return jWp.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:zAa._decompress(e.length,32,function(t){return hVD(jWp,e.charAt(t))})},compress:function(e){return zAa._compress(e,16,function(t){return IAa(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,d="",s="",o="",c=2,b=3,g=2,O=0,m=0,P;for(P=0;P<e.length;P+=1)if(d=e.charAt(P),Object.prototype.hasOwnProperty.call(i,d)||(i[d]=b++,n[d]=!0),s=o+d,Object.prototype.hasOwnProperty.call(i,s))o=s;else{if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++),i[s]=b++,o=String(d)}if(o!==""){if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++)}for(l=2,u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;for(;;)if(O=O<<1,m==t-1){a.push(r(O));break}else m++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:zAa._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},u=4,l=4,d=3,s="",o,c,b,g,O,m,P;for(o=0;o<3;o+=1)i[o]=o;for(b=0,O=Math.pow(2,2),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;P=IAa(b);break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;P=IAa(b);break;case 2:return""}for(i[3]=P,c=P,n.push(P);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,d),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(P=b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=IAa(b),P=l-1,u--;break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=IAa(b),P=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,d),d++),i[P])s=i[P];else if(P===l)s=c+c.charAt(0);else return null;n.push(s),i[l++]=c+s.charAt(0),u--,c=s,u==0&&(u=Math.pow(2,d),d++)}}},Ltc=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}};var v2o="0123456789abcdef",b2o=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=v2o.charAt(this.bytes[r]>>>4),t+=v2o.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+=v2o.charAt(this.bytes[r]>>>4),t+=v2o.charAt(this.bytes[r]&15);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},Utc=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??yVD()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return b2o.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,b2o.ofInner(t)}},yVD=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),wWp,SWp=()=>vVD().toString(),vVD=()=>(wWp||(wWp=new Utc)).generate(),g2o=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},xAa=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function DWp(e){return typeof e=="object"&&(e instanceof g2o||e instanceof xAa)}var Vtc=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new Ltc,this._isInitialized=!1,fVD(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=dVD(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.defaultOptIn=r?.defaultOptIn??!0,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:DWp},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??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(qWt.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(qWt.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(qWt.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=SWp();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}groupIdentifyStateless(t,r,i,n,a,u){this.wrap(()=>{let l=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...u||{}}});this.enqueue("capture",l,n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let u=`${this.host}/decide/?v=3`,l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(d=>d.json()).catch(d=>{this._events.emit("error",d)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0&&(d=!1),d}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).payloads}_parsePayload(t){try{return JSON.parse(t)}catch{return t}}async getFeatureFlagsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).flags}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a){await this._initPromise;let u={};(a??this.disableGeoip)&&(u.geoip_disable=!0);let l=await this.getDecide(t,r,i,n,u),d=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:d,payloads:o}}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:PWp(),uuid:i?.uuid?i.uuid:SWp()};(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId);let u=this.getPersistedProperty(qWt.Queue)||[];u.length>=this.maxQueueSize&&(u.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),u.push({message:n}),this.setPersistedProperty(qWt.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=TWp(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}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(qWt.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty(qWt.Queue)||[];this.setPersistedProperty(qWt.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:PWp()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${_VD()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,d=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(zAa.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,d)}catch(s){throw s instanceof xAa||n(),this._events.emit("error",s),s}return n(),this._events.emit("flush",i),i}async fetchWithRetry(t,r,i,n){var a;return(a=AbortSignal).timeout??(a.timeout=function(l){let d=new AbortController;return setTimeout(()=>d.abort(),l),d.signal}),await pVD(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(d){throw new xAa(d)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new g2o(u);return u},{...this._retryOptions,...i})}async shutdown(t=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let r=Date.now()+t;for(;(this.getPersistedProperty(qWt.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!DWp(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},Wtc=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},Htc=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!Htc){let e=mWp();Htc=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var CWp=Htc,bVD=1152921504606847e3,gVD=["is_not"],O2o=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},Z2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},$tc=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=l.fetch||CWp,this.onError=l.onError,this.customHeaders=u,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let u,l;if(!this.loadedSuccessfullyOnce)return u;for(let d of this.featureFlags)if(t===d.key){l=d;break}if(l!==void 0)try{u=this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(d){d instanceof Z2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${d}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return u}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},u={},l=this.featureFlags.length==0;return this.featureFlags.map(async d=>{try{let s=this.computeFlagLocally(d,t,r,i,n);a[d.key]=s;let o=await this.computeFeatureFlagPayloadLocally(d.key,s);o&&(u[d.key]=o)}catch(s){s instanceof Z2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new Z2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let d=this.groupTypeMapping[String(l)];if(!d)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new Z2("Flag has unknown group type index");if(!(d in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[d];return this.matchFeatureFlagProperties(t,i[d],s)}else return this.matchFeatureFlagProperties(t,r,n)}matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,d=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of d)try{if(this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof Z2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new Z2("Can't determine if feature flag is enabled or not with given properties");return!1}isConditionMatch(t,r,i,n){let a=i.rollout_percentage,u=l=>{this.logMsgIfDebug(()=>console.warn(l))};if((i.properties||[]).length>0){for(let l of i.properties){let d=l.type,s=!1;if(d==="cohort"?s=IWp(l,n,this.cohorts,this.debugMode):s=BWp(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&EWp(t.key,r)>a/100)}getMatchingVariant(t,r){let i=EWp(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(l=>{n=i+l.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:l.key}),i=n}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let t=await this._requestFeatureFlagDefinitions();if(t&&t.status===401)throw new O2o("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(t&&t.status!==200)return;let r=await t.json();"flags"in r||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`)),this.featureFlags=r.flags||[],this.featureFlagsByKey=this.featureFlags.reduce((i,n)=>(i[n.key]=n,i),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||[],this.loadedSuccessfullyOnce=!0}catch(t){t instanceof O2o&&this.onError?.(t)}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=TWp(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function EWp(e,t,r=""){let i=(0,qWp.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/bVD}function BWp(e,t,r){let i=e.key,n=e.value,a=e.operator||"exact";if(i in t){if(a==="is_not_set")throw new Z2("Operator is_not_set is not supported")}else throw new Z2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!gVD.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function l(s,o){return Array.isArray(s)?s.map(c=>String(c).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function d(s,o,c){if(c==="gt")return s>o;if(c==="gte")return s>=o;if(c==="lt")return s<o;if(c==="lte")return s<=o;throw new Error(`Invalid operator: ${c}`)}switch(a){case"exact":return l(n,u);case"is_not":return!l(n,u);case"is_set":return i in t;case"icontains":return String(u).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(n).toLowerCase());case"regex":return MWp(String(n))&&String(u).match(String(n))!==null;case"not_regex":return MWp(String(n))&&String(u).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&u!=null?typeof u=="string"?d(u,String(n),a):d(u,s,a):d(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=OVD(String(n));if(s==null&&(s=AWp(n)),s==null)throw new Z2(`Invalid date: ${n}`);let o=AWp(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new Z2(`Unknown operator: ${a}`)}}function IWp(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new Z2("can't match cohort without a given cohort property value");let a=r[n];return zWp(a,t,r,i)}function zWp(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let l of a)try{let d=zWp(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof Z2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new Z2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let d;l.type==="cohort"?d=IWp(l,t,r,i):d=BWp(l,t);let s=l.negation||!1;if(n==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof Z2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new Z2("can't match cohort without a given cohort property value");return n==="AND"}}function MWp(e){try{return new RegExp(e),!0}catch{return!1}}function AWp(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 Z2(`${e} is in an invalid date format`)}else throw new Z2(`The date provided ${e} must be a string, number, or date object`)}function OVD(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var mVD=30*1e3,PVD=50*1e3,n7n=class extends Vtc{constructor(t,r={}){super(t,r),this._memoryStorage=new Wtc,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new $tc({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:mVD,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||PVD}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):CWp(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return lVD}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({distinctId:t,event:r,properties:i,groups:n,sendFeatureFlags:a,timestamp:u,disableGeoip:l,uuid:d}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:d})},o=(b,g,O)=>super.getFeatureFlagsStateless(b,g,void 0,void 0,O),c=Promise.resolve().then(async()=>{if(a)return await o(t,n,l);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let b={};for(let[g,O]of Object.entries(n||{}))b[g]=String(O);return await this.getAllFlags(t,{groups:b,disableGeoip:l,onlyEvaluateLocally:!0})}return{}}).then(b=>{let g={};if(b)for(let[m,P]of Object.entries(b))g[`$feature/${m}`]=P;let O=Object.keys(b||{}).filter(m=>b?.[m]!==!1);return O.length>0&&(g.$active_feature_flags=O),g}).catch(()=>({})).then(b=>{s({...b,...i,$groups:n})});this.addPendingPromise(c)}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set||r;super.identifyStateless(t,{$set:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:u,sendFeatureFlagEvents:l,personProperties:d,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,d,s);d=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,d,s),b=c!==void 0;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,d,s,a));let g=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(g))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(g):this.distinctIdHasSentFlagCalls[r]=[g],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,locally_evaluated:b,[`$feature/${t}`]:c},groups:n,disableGeoip:a})),c}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:u}=n||{},{onlyEvaluateLocally:l,sendFeatureFlagEvents:d,personProperties:s,groupProperties:o}=n||{},c=this.addLocalPersonAndGroupProperties(r,a,s,o);s=c.allPersonProperties,o=c.allGroupProperties;let b;return i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0})),i&&(b=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i)),l==null&&(l=!1),d==null&&(d=!0),l==null&&(l=!1),!(b!==void 0)&&!l&&(b=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),b}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:u,groupProperties:l}=r||{},d=this.addLocalPersonAndGroupProperties(t,i,u,l);u=d.allPersonProperties,l=d.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,u,l),o={},c={},b=!0;if(s&&(o=s.response,c=s.payloads,b=s.fallbackToDecide),b&&!a){let g=await super.getFeatureFlagsAndPayloadsStateless(t,i,u,l,n);o={...o,...g.flags||{}},c={...c,...g.payloads||{}}}return{featureFlags:o,featureFlagPayloads:c}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async shutdown(t){return this.featureFlagsPoller?.stopPoller(),super.shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},u={};if(r)for(let l of Object.keys(r))u[l]={$group_key:r[l],...n?.[l]||{}};return{allPersonProperties:a,allGroupProperties:u}}},Gtc=class e{constructor(t,r,i,n){this.posthog=t,this.posthogHost=r,this.organization=i,this.prefix=n,this.name="posthog-node",this.posthogHost=t.options.host??"https://us.i.posthog.com"}setupOnce(t,r){t(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let n=r(),a=i.tags[e.POSTHOG_ID_TAG];if(a===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${a}`,this.posthogHost).toString();let u={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},l=n.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&l!==void 0&&i.event_id!==void 0&&(u.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${l}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:a,properties:u}),i})}};Gtc.POSTHOG_ID_TAG="posthog_distinct_id";var m2o=class{posthog;constructor({posthogApiKey:t}){this.posthog=new n7n(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.63.28",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var RAa=class{async sendEvent(){}async identify(){}async flush(){}};var a7n=require("fs/promises"),FWp=require("os"),LWp=require("path");var xWp=ci(require("crypto")),j2o=new Uint8Array(256),P2o=j2o.length;function Qtc(){return P2o>j2o.length-16&&(xWp.default.randomFillSync(j2o),P2o=0),j2o.slice(P2o,P2o+=16)}var WW=[];for(let e=0;e<256;++e)WW.push((e+256).toString(16).slice(1));function RWp(e,t=0){return WW[e[t+0]]+WW[e[t+1]]+WW[e[t+2]]+WW[e[t+3]]+"-"+WW[e[t+4]]+WW[e[t+5]]+"-"+WW[e[t+6]]+WW[e[t+7]]+"-"+WW[e[t+8]]+WW[e[t+9]]+"-"+WW[e[t+10]]+WW[e[t+11]]+WW[e[t+12]]+WW[e[t+13]]+WW[e[t+14]]+WW[e[t+15]]}var NWp=ci(require("crypto")),Jtc={randomUUID:NWp.default.randomUUID};function jVD(e,t,r){if(Jtc.randomUUID&&!t&&!e)return Jtc.randomUUID();e=e||{};let i=e.random||(e.rng||Qtc)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return RWp(i)}var zae=jVD;var wVD="id",SVD=".fern",NAa=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new n7n(r),this.userId=t==null?void 0:rJs(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.63.28",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Vu(hl.of((0,FWp.homedir)()),Qa.of(SVD),Qa.of(wVD));await Sf(t)||(await(0,a7n.mkdir)((0,LWp.dirname)(t),{recursive:!0}),await(0,a7n.writeFile)(t,zae())),this.persistedDistinctId=(await(0,a7n.readFile)(t)).toString()}return this.persistedDistinctId}};var Ktc;async function o7n(){return Ktc==null&&(Ktc=await DVD()),Ktc}async function DVD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new RAa;let r=await SRo();return r!=null?new NAa({token:r,posthogApiKey:e}):await QNn()!=null?new m2o({posthogApiKey:e}):new NAa({token:void 0,posthogApiKey:e})}catch{return new RAa}}function FAa(e,t){return function(){return e.apply(t,arguments)}}var{toString:EVD}=Object.prototype,{getPrototypeOf:Xtc}=Object,S2o=(e=>t=>{let r=EVD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),TWt=e=>(e=e.toLowerCase(),t=>S2o(t)===e),D2o=e=>t=>typeof t===e,{isArray:u7n}=Array,LAa=D2o("undefined");function MVD(e){return e!==null&&!LAa(e)&&e.constructor!==null&&!LAa(e.constructor)&&uMe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var VWp=TWt("ArrayBuffer");function AVD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&VWp(e.buffer),t}var qVD=D2o("string"),uMe=D2o("function"),WWp=D2o("number"),E2o=e=>e!==null&&typeof e=="object",TVD=e=>e===!0||e===!1,w2o=e=>{if(S2o(e)!=="object")return!1;let t=Xtc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},CVD=TWt("Date"),BVD=TWt("File"),IVD=TWt("Blob"),zVD=TWt("FileList"),xVD=e=>E2o(e)&&uMe(e.pipe),RVD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||uMe(e.append)&&((t=S2o(e))==="formdata"||t==="object"&&uMe(e.toString)&&e.toString()==="[object FormData]"))},NVD=TWt("URLSearchParams"),[FVD,LVD,UVD,VVD]=["ReadableStream","Request","Response","Headers"].map(TWt),WVD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function UAa(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),u7n(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function HWp(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var cGi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$Wp=e=>!LAa(e)&&e!==cGi;function Ytc(){let{caseless:e}=$Wp(this)&&this||{},t={},r=(i,n)=>{let a=e&&HWp(t,n)||n;w2o(t[a])&&w2o(i)?t[a]=Ytc(t[a],i):w2o(i)?t[a]=Ytc({},i):u7n(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&UAa(arguments[i],r);return t}var HVD=(e,t,r,{allOwnKeys:i}={})=>(UAa(t,(n,a)=>{r&&uMe(n)?e[a]=FAa(n,r):e[a]=n},{allOwnKeys:i}),e),$VD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),GVD=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},QVD=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&Xtc(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},JVD=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},KVD=e=>{if(!e)return null;if(u7n(e))return e;let t=e.length;if(!WWp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},YVD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Xtc(Uint8Array)),XVD=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},ZVD=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},kVD=TWt("HTMLFormElement"),eWD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),UWp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),tWD=TWt("RegExp"),GWp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};UAa(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},rWD=e=>{GWp(e,(t,r)=>{if(uMe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(uMe(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},iWD=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return u7n(e)?i(e):i(String(e).split(t)),r},nWD=()=>{},aWD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function oWD(e){return!!(e&&uMe(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var uWD=e=>{let t=new Array(10),r=(i,n)=>{if(E2o(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=u7n(i)?[]:{};return UAa(i,(u,l)=>{let d=r(u,n+1);!LAa(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},sWD=TWt("AsyncFunction"),cWD=e=>e&&(E2o(e)||uMe(e))&&uMe(e.then)&&uMe(e.catch),QWp=((e,t)=>e?setImmediate:t?((r,i)=>(cGi.addEventListener("message",({source:n,data:a})=>{n===cGi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),cGi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",uMe(cGi.postMessage)),lWD=typeof queueMicrotask<"u"?queueMicrotask.bind(cGi):typeof process<"u"&&process.nextTick||QWp,_s={isArray:u7n,isArrayBuffer:VWp,isBuffer:MVD,isFormData:RVD,isArrayBufferView:AVD,isString:qVD,isNumber:WWp,isBoolean:TVD,isObject:E2o,isPlainObject:w2o,isReadableStream:FVD,isRequest:LVD,isResponse:UVD,isHeaders:VVD,isUndefined:LAa,isDate:CVD,isFile:BVD,isBlob:IVD,isRegExp:tWD,isFunction:uMe,isStream:xVD,isURLSearchParams:NVD,isTypedArray:YVD,isFileList:zVD,forEach:UAa,merge:Ytc,extend:HVD,trim:WVD,stripBOM:$VD,inherits:GVD,toFlatObject:QVD,kindOf:S2o,kindOfTest:TWt,endsWith:JVD,toArray:KVD,forEachEntry:XVD,matchAll:ZVD,isHTMLForm:kVD,hasOwnProperty:UWp,hasOwnProp:UWp,reduceDescriptors:GWp,freezeMethods:rWD,toObjectSet:iWD,toCamelCase:eWD,noop:nWD,toFiniteNumber:aWD,findKey:HWp,global:cGi,isContextDefined:$Wp,isSpecCompliantForm:oWD,toJSONObject:uWD,isAsyncFn:sWD,isThenable:cWD,setImmediate:QWp,asap:lWD};function s7n(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}_s.inherits(s7n,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:_s.toJSONObject(this.config),code:this.code,status:this.status}}});var JWp=s7n.prototype,KWp={};["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=>{KWp[e]={value:e}});Object.defineProperties(s7n,KWp);Object.defineProperty(JWp,"isAxiosError",{value:!0});s7n.from=(e,t,r,i,n,a)=>{let u=Object.create(JWp);return _s.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),s7n.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var xp=s7n;var YWp=ci(uwa(),1),M2o=YWp.default;function Ztc(e){return _s.isPlainObject(e)||_s.isArray(e)}function ZWp(e){return _s.endsWith(e,"[]")?e.slice(0,-2):e}function XWp(e,t,r){return e?e.concat(t).map(function(n,a){return n=ZWp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function fWD(e){return _s.isArray(e)&&!e.some(Ztc)}var dWD=_s.toFlatObject(_s,{},null,function(t){return/^is[A-Z]/.test(t)});function pWD(e,t,r){if(!_s.isObject(e))throw new TypeError("target must be an object");t=t||new(M2o||FormData),r=_s.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,P){return!_s.isUndefined(P[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&_s.isSpecCompliantForm(t);if(!_s.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(_s.isDate(O))return O.toISOString();if(!d&&_s.isBlob(O))throw new xp("Blob is not supported. Use a Buffer instead.");return _s.isArrayBuffer(O)||_s.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,P){let E=O;if(O&&!P&&typeof O=="object"){if(_s.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(_s.isArray(O)&&fWD(O)||(_s.isFileList(O)||_s.endsWith(m,"[]"))&&(E=_s.toArray(O)))return m=ZWp(m),E.forEach(function(M,D){!(_s.isUndefined(M)||M===null)&&t.append(u===!0?XWp([m],D,a):u===null?m:m+"[]",s(M))}),!1}return Ztc(O)?!0:(t.append(XWp(P,m,a),s(O)),!1)}let c=[],b=Object.assign(dWD,{defaultVisitor:o,convertValue:s,isVisitable:Ztc});function g(O,m){if(!_s.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),_s.forEach(O,function(E,q){(!(_s.isUndefined(E)||E===null)&&n.call(t,E,_s.isString(q)?q.trim():q,m,b))===!0&&g(E,m?m.concat(q):[q])}),c.pop()}}if(!_s.isObject(e))throw new TypeError("data must be an object");return g(e),t}var YDi=pWD;function kWp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function eHp(e,t){this._pairs=[],e&&YDi(e,this,t)}var tHp=eHp.prototype;tHp.append=function(t,r){this._pairs.push([t,r])};tHp.toString=function(t){let r=t?function(i){return t.call(this,i,kWp)}:kWp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var rHp=eHp;function _WD(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function lGi(e,t,r){if(!t)return e;let i=r&&r.encode||_WD;_s.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=_s.isURLSearchParams(t)?t.toString():new rHp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var ktc=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){_s.forEach(this.handlers,function(i){i!==null&&t(i)})}},erc=ktc;var c7n={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var oHp=ci(require("crypto"),1);var iHp=ci(require("url"),1),nHp=iHp.default.URLSearchParams;var trc="abcdefghijklmnopqrstuvwxyz",aHp="0123456789",uHp={DIGIT:aHp,ALPHA:trc,ALPHA_DIGIT:trc+trc.toUpperCase()+aHp},hWD=(e=16,t=uHp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);oHp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},sHp={isNode:!0,classes:{URLSearchParams:nHp,FormData:M2o,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:uHp,generateString:hWD,protocols:["http","https","file","data"]};var nrc={};jo(nrc,{hasBrowserEnv:()=>irc,hasStandardBrowserEnv:()=>yWD,hasStandardBrowserWebWorkerEnv:()=>vWD,navigator:()=>rrc,origin:()=>bWD});var irc=typeof window<"u"&&typeof document<"u",rrc=typeof navigator=="object"&&navigator||void 0,yWD=irc&&(!rrc||["ReactNative","NativeScript","NS"].indexOf(rrc.product)<0),vWD=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",bWD=irc&&window.location.href||"http://localhost";var sA={...nrc,...sHp};function arc(e,t){return YDi(e,new sA.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return sA.isNode&&_s.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function gWD(e){return _s.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function OWD(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function mWD(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),d=a>=r.length;return u=!u&&_s.isArray(n)?n.length:u,d?(_s.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!_s.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&_s.isArray(n[u])&&(n[u]=OWD(n[u])),!l)}if(_s.isFormData(e)&&_s.isFunction(e.entries)){let r={};return _s.forEachEntry(e,(i,n)=>{t(gWD(i),n,r,0)}),r}return null}var A2o=mWD;function PWD(e,t,r){if(_s.isString(e))try{return(t||JSON.parse)(e),_s.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var orc={transitional:c7n,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=_s.isObject(t);if(a&&_s.isHTMLForm(t)&&(t=new FormData(t)),_s.isFormData(t))return n?JSON.stringify(A2o(t)):t;if(_s.isArrayBuffer(t)||_s.isBuffer(t)||_s.isStream(t)||_s.isFile(t)||_s.isBlob(t)||_s.isReadableStream(t))return t;if(_s.isArrayBufferView(t))return t.buffer;if(_s.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return arc(t,this.formSerializer).toString();if((l=_s.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return YDi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),PWD(t)):t}],transformResponse:[function(t){let r=this.transitional||orc.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(_s.isResponse(t)||_s.isReadableStream(t))return t;if(t&&_s.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?xp.from(l,xp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:sA.classes.FormData,Blob:sA.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_s.forEach(["delete","get","head","post","put","patch"],e=>{orc.headers[e]={}});var l7n=orc;var jWD=_s.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"]),cHp=e=>{let t={},r,i,n;return e&&e.split(`
1708
1708
  `).forEach(function(u){n=u.indexOf(":"),r=u.substring(0,n).trim().toLowerCase(),i=u.substring(n+1).trim(),!(!r||t[r]&&jWD[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var lHp=Symbol("internals");function VAa(e){return e&&String(e).trim().toLowerCase()}function q2o(e){return e===!1||e==null?e:_s.isArray(e)?e.map(q2o):String(e)}function wWD(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}var SWD=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function urc(e,t,r,i,n){if(_s.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!_s.isString(t)){if(_s.isString(i))return t.indexOf(i)!==-1;if(_s.isRegExp(i))return i.test(t)}}function DWD(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function EWD(e,t){let r=_s.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(n,a,u){return this[i].call(this,t,n,a,u)},configurable:!0})})}var f7n=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(l,d,s){let o=VAa(d);if(!o)throw new Error("header name must be a non-empty string");let c=_s.findKey(n,o);(!c||n[c]===void 0||s===!0||s===void 0&&n[c]!==!1)&&(n[c||d]=q2o(l))}let u=(l,d)=>_s.forEach(l,(s,o)=>a(s,o,d));if(_s.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(_s.isString(t)&&(t=t.trim())&&!SWD(t))u(cHp(t),r);else if(_s.isHeaders(t))for(let[l,d]of t.entries())a(d,l,i);else t!=null&&a(r,t,i);return this}get(t,r){if(t=VAa(t),t){let i=_s.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return wWD(n);if(_s.isFunction(r))return r.call(this,n,i);if(_s.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=VAa(t),t){let i=_s.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||urc(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(u){if(u=VAa(u),u){let l=_s.findKey(i,u);l&&(!r||urc(i,i[l],l,r))&&(delete i[l],n=!0)}}return _s.isArray(t)?t.forEach(a):a(t),n}clear(t){let r=Object.keys(this),i=r.length,n=!1;for(;i--;){let a=r[i];(!t||urc(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return _s.forEach(this,(n,a)=>{let u=_s.findKey(i,a);if(u){r[u]=q2o(n),delete r[a];return}let l=t?DWD(a):String(a).trim();l!==a&&delete r[a],r[l]=q2o(n),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return _s.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&_s.isArray(i)?i.join(", "):i)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
1709
1709
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let i=new this(t);return r.forEach(n=>i.set(n)),i}static accessor(t){let i=(this[lHp]=this[lHp]={accessors:{}}).accessors,n=this.prototype;function a(u){let l=VAa(u);i[l]||(EWD(n,u),i[l]=!0)}return _s.isArray(t)?t.forEach(a):a(t),this}};f7n.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);_s.reduceDescriptors(f7n.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});_s.freezeMethods(f7n);var hR=f7n;function WAa(e,t){let r=this||l7n,i=t||r,n=hR.from(i.headers),a=i.data;return _s.forEach(e,function(l){a=l.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function HAa(e){return!!(e&&e.__CANCEL__)}function fHp(e,t,r){xp.call(this,e??"canceled",xp.ERR_CANCELED,t,r),this.name="CanceledError"}_s.inherits(fHp,xp,{__CANCEL__:!0});var sMe=fHp;function jrr(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new xp("Request failed with status code "+r.status,[xp.ERR_BAD_REQUEST,xp.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function src(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function crc(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function fGi(e,t,r){let i=!src(t);return e&&i||r==!1?crc(e,t):t}var EHp=ci(SAa(),1),MHp=ci(require("http"),1),AHp=ci(require("https"),1),qHp=ci(require("util"),1),THp=ci(ytc(),1),edi=ci(require("zlib"),1);var dGi="1.8.2";function $Aa(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var MWD=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function lrc(e,t,r){let i=r&&r.Blob||sA.classes.Blob,n=$Aa(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=MWD.exec(e);if(!a)throw new xp("Invalid URL",xp.ERR_INVALID_URL);let u=a[1],l=a[2],d=a[3],s=Buffer.from(decodeURIComponent(d),l?"base64":"utf8");if(t){if(!i)throw new xp("Blob is not supported",xp.ERR_NOT_SUPPORT);return new i([s],{type:u})}return s}throw new xp("Unsupported protocol "+n,xp.ERR_NOT_SUPPORT)}var pGi=ci(require("stream"),1);var dHp=ci(require("stream"),1);var frc=Symbol("internals"),drc=class extends dHp.default.Transform{constructor(t){t=_s.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!_s.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[frc]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",i=>{i==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[frc];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[frc],a=n.maxRate,u=this.readableHighWaterMark,l=n.timeWindow,d=1e3/l,s=a/d,o=n.minChunkSize!==!1?Math.max(n.minChunkSize,s*.01):0,c=(g,O)=>{let m=Buffer.byteLength(g);n.bytesSeen+=m,n.bytes+=m,n.isCaptured&&this.emit("progress",n.bytesSeen),this.push(g)?process.nextTick(O):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(O)}},b=(g,O)=>{let m=Buffer.byteLength(g),P=null,E=u,q,M=0;if(a){let D=Date.now();(!n.ts||(M=D-n.ts)>=l)&&(n.ts=D,q=s-n.bytes,n.bytes=q<0?-q:0,M=0),q=s-n.bytes}if(a){if(q<=0)return setTimeout(()=>{O(null,g)},l-M);q<E&&(E=q)}E&&m>E&&m-E>o&&(P=g.subarray(E),g=g.subarray(0,E)),c(g,P?()=>{process.nextTick(O,null,P)}:O)};b(t,function g(O,m){if(O)return i(O);m?b(m,g):i(null)})}},prc=drc;var CHp=require("events");var _Hp=ci(require("util"),1),hHp=require("stream");var{asyncIterator:pHp}=Symbol,AWD=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[pHp]?yield*e[pHp]():yield e},T2o=AWD;var qWD=sA.ALPHABET.ALPHA_DIGIT+"-_",GAa=typeof TextEncoder=="function"?new TextEncoder:new _Hp.default.TextEncoder,XDi=`\r
1710
1710
  `,TWD=GAa.encode(XDi),CWD=2,_rc=class{constructor(t,r){let{escapeName:i}=this.constructor,n=_s.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${XDi}`;n?r=GAa.encode(String(r).replace(/\r?\n|\r\n?/g,XDi)):a+=`Content-Type: ${r.type||"application/octet-stream"}${XDi}`,this.headers=GAa.encode(a+XDi),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+CWD,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;_s.isTypedArray(t)?yield t:yield*T2o(t),yield TWD}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},BWD=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+sA.generateString(n,qWD)}=r||{};if(!_s.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let u=GAa.encode("--"+a+XDi),l=GAa.encode("--"+a+"--"+XDi+XDi),d=l.byteLength,s=Array.from(e.entries()).map(([c,b])=>{let g=new _rc(c,b);return d+=g.size,g});d+=u.byteLength*s.length,d=_s.toFiniteNumber(d);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(o["Content-Length"]=d),t&&t(o),hHp.Readable.from(async function*(){for(let c of s)yield u,yield*c.encode();yield l}())},yHp=BWD;var vHp=ci(require("stream"),1),hrc=class extends vHp.default.Transform{__transform(t,r,i){this.push(t),i()}_transform(t,r,i){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let n=Buffer.alloc(2);n[0]=120,n[1]=156,this.push(n,r)}this.__transform(t,r,i)}},bHp=hrc;var IWD=(e,t)=>_s.isAsyncFn(e)?function(...r){let i=r.pop();e.apply(this,r).then(n=>{try{t?i(null,...t(n)):i(null,n)}catch(a){i(a)}},i)}:e,gHp=IWD;function zWD(e,t){e=e||10;let r=new Array(e),i=new Array(e),n=0,a=0,u;return t=t!==void 0?t:1e3,function(d){let s=Date.now(),o=i[a];u||(u=s),r[n]=d,i[n]=s;let c=a,b=0;for(;c!==n;)b+=r[c++],c=c%e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),s-u<t)return;let g=o&&s-o;return g?Math.round(b*1e3/g):void 0}}var OHp=zWD;function xWD(e,t){let r=0,i=1e3/t,n,a,u=(s,o=Date.now())=>{r=o,n=null,a&&(clearTimeout(a),a=null),e.apply(null,s)};return[(...s)=>{let o=Date.now(),c=o-r;c>=i?u(s,o):(n=s,a||(a=setTimeout(()=>{a=null,u(n)},i-c)))},()=>n&&u(n)]}var mHp=xWD;var kfi=(e,t,r=3)=>{let i=0,n=OHp(50,250);return mHp(a=>{let u=a.loaded,l=a.lengthComputable?a.total:void 0,d=u-i,s=n(d),o=u<=l;i=u;let c={loaded:u,total:l,progress:l?u/l:void 0,bytes:d,rate:s||void 0,estimated:s&&l&&o?(l-u)/s:void 0,event:a,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(c)},r)},d7n=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},p7n=e=>(...t)=>_s.asap(()=>e(...t));var PHp={flush:edi.default.constants.Z_SYNC_FLUSH,finishFlush:edi.default.constants.Z_SYNC_FLUSH},RWD={flush:edi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:edi.default.constants.BROTLI_OPERATION_FLUSH},jHp=_s.isFunction(edi.default.createBrotliDecompress),{http:NWD,https:FWD}=THp.default,LWD=/https:?/,wHp=sA.protocols.map(e=>e+":"),SHp=(e,[t,r])=>(e.on("end",r).on("error",r),t);function UWD(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function BHp(e,t,r){let i=t;if(!i&&i!==!1){let n=EHp.default.getProxyForUrl(r);n&&(i=new URL(n))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));let a=Buffer.from(i.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let n=i.hostname||i.host;e.hostname=n,e.host=n,e.port=i.port,e.path=r,i.protocol&&(e.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}e.beforeRedirects.proxy=function(a){BHp(a,t,a.href)}}var VWD=typeof process<"u"&&_s.kindOf(process)==="process",WWD=e=>new Promise((t,r)=>{let i,n,a=(d,s)=>{n||(n=!0,i&&i(d,s))},u=d=>{a(d),t(d)},l=d=>{a(d,!0),r(d)};e(u,l,d=>i=d).catch(l)}),HWD=({address:e,family:t})=>{if(!_s.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},DHp=(e,t)=>HWD(_s.isObject(e)?e:{address:e,family:t}),IHp=VWD&&function(t){return WWD(async function(i,n,a){let{data:u,lookup:l,family:d}=t,{responseType:s,responseEncoding:o}=t,c=t.method.toUpperCase(),b,g=!1,O;if(l){let we=gHp(l,Qe=>_s.isArray(Qe)?Qe:[Qe]);l=(Qe,Dt,Ee)=>{we(Qe,Dt,(Te,zt,Pe)=>{if(Te)return Ee(Te);let at=_s.isArray(zt)?zt.map(it=>DHp(it)):[DHp(zt,Pe)];Dt.all?Ee(Te,at):Ee(Te,at[0].address,at[0].family)})}}let m=new CHp.EventEmitter,P=()=>{t.cancelToken&&t.cancelToken.unsubscribe(E),t.signal&&t.signal.removeEventListener("abort",E),m.removeAllListeners()};a((we,Qe)=>{b=!0,Qe&&(g=!0,P())});function E(we){m.emit("abort",!we||we.type?new sMe(null,t,O):we)}m.once("abort",n),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(E),t.signal&&(t.signal.aborted?E():t.signal.addEventListener("abort",E)));let q=fGi(t.baseURL,t.url,t.allowAbsoluteUrls),M=new URL(q,sA.hasBrowserEnv?sA.origin:void 0),D=M.protocol||wHp[0];if(D==="data:"){let we;if(c!=="GET")return jrr(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{we=lrc(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(Qe){throw xp.from(Qe,xp.ERR_BAD_REQUEST,t)}return s==="text"?(we=we.toString(o),(!o||o==="utf8")&&(we=_s.stripBOM(we))):s==="stream"&&(we=pGi.default.Readable.from(we)),jrr(i,n,{data:we,status:200,statusText:"OK",headers:new hR,config:t})}if(wHp.indexOf(D)===-1)return n(new xp("Unsupported protocol "+D,xp.ERR_BAD_REQUEST,t));let T=hR.from(t.headers).normalize();T.set("User-Agent","axios/"+dGi,!1);let{onUploadProgress:x,onDownloadProgress:$}=t,I=t.maxRate,L,V;if(_s.isSpecCompliantForm(u)){let we=T.getContentType(/boundary=([-_\w\d]{10,70})/i);u=yHp(u,Qe=>{T.set(Qe)},{tag:`axios-${dGi}-boundary`,boundary:we&&we[1]||void 0})}else if(_s.isFormData(u)&&_s.isFunction(u.getHeaders)){if(T.set(u.getHeaders()),!T.hasContentLength())try{let we=await qHp.default.promisify(u.getLength).call(u);Number.isFinite(we)&&we>=0&&T.setContentLength(we)}catch{}}else if(_s.isBlob(u)||_s.isFile(u))u.size&&T.setContentType(u.type||"application/octet-stream"),T.setContentLength(u.size||0),u=pGi.default.Readable.from(T2o(u));else if(u&&!_s.isStream(u)){if(!Buffer.isBuffer(u))if(_s.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(_s.isString(u))u=Buffer.from(u,"utf-8");else return n(new xp("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",xp.ERR_BAD_REQUEST,t));if(T.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return n(new xp("Request body larger than maxBodyLength limit",xp.ERR_BAD_REQUEST,t))}let X=_s.toFiniteNumber(T.getContentLength());_s.isArray(I)?(L=I[0],V=I[1]):L=V=I,u&&(x||L)&&(_s.isStream(u)||(u=pGi.default.Readable.from(u,{objectMode:!1})),u=pGi.default.pipeline([u,new prc({maxRate:_s.toFiniteNumber(L)})],_s.noop),x&&u.on("progress",SHp(u,d7n(X,kfi(p7n(x),!1,3)))));let K;if(t.auth){let we=t.auth.username||"",Qe=t.auth.password||"";K=we+":"+Qe}if(!K&&M.username){let we=M.username,Qe=M.password;K=we+":"+Qe}K&&T.delete("authorization");let k;try{k=lGi(M.pathname+M.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(we){let Qe=new Error(we.message);return Qe.config=t,Qe.url=t.url,Qe.exists=!0,n(Qe)}T.set("Accept-Encoding","gzip, compress, deflate"+(jHp?", br":""),!1);let fe={path:k,method:c,headers:T.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:K,protocol:D,family:d,beforeRedirect:UWD,beforeRedirects:{}};!_s.isUndefined(l)&&(fe.lookup=l),t.socketPath?fe.socketPath=t.socketPath:(fe.hostname=M.hostname.startsWith("[")?M.hostname.slice(1,-1):M.hostname,fe.port=M.port,BHp(fe,t.proxy,D+"//"+M.hostname+(M.port?":"+M.port:"")+fe.path));let be,_e=LWD.test(fe.protocol);if(fe.agent=_e?t.httpsAgent:t.httpAgent,t.transport?be=t.transport:t.maxRedirects===0?be=_e?AHp.default:MHp.default:(t.maxRedirects&&(fe.maxRedirects=t.maxRedirects),t.beforeRedirect&&(fe.beforeRedirects.config=t.beforeRedirect),be=_e?FWD:NWD),t.maxBodyLength>-1?fe.maxBodyLength=t.maxBodyLength:fe.maxBodyLength=1/0,t.insecureHTTPParser&&(fe.insecureHTTPParser=t.insecureHTTPParser),O=be.request(fe,function(Qe){if(O.destroyed)return;let Dt=[Qe],Ee=+Qe.headers["content-length"];if($||V){let it=new prc({maxRate:_s.toFiniteNumber(V)});$&&it.on("progress",SHp(it,d7n(Ee,kfi(p7n($),!0,3)))),Dt.push(it)}let Te=Qe,zt=Qe.req||O;if(t.decompress!==!1&&Qe.headers["content-encoding"])switch((c==="HEAD"||Qe.statusCode===204)&&delete Qe.headers["content-encoding"],(Qe.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":Dt.push(edi.default.createUnzip(PHp)),delete Qe.headers["content-encoding"];break;case"deflate":Dt.push(new bHp),Dt.push(edi.default.createUnzip(PHp)),delete Qe.headers["content-encoding"];break;case"br":jHp&&(Dt.push(edi.default.createBrotliDecompress(RWD)),delete Qe.headers["content-encoding"])}Te=Dt.length>1?pGi.default.pipeline(Dt,_s.noop):Dt[0];let Pe=pGi.default.finished(Te,()=>{Pe(),P()}),at={status:Qe.statusCode,statusText:Qe.statusMessage,headers:new hR(Qe.headers),config:t,request:zt};if(s==="stream")at.data=Te,jrr(i,n,at);else{let it=[],ge=0;Te.on("data",function(bt){it.push(bt),ge+=bt.length,t.maxContentLength>-1&&ge>t.maxContentLength&&(g=!0,Te.destroy(),n(new xp("maxContentLength size of "+t.maxContentLength+" exceeded",xp.ERR_BAD_RESPONSE,t,zt)))}),Te.on("aborted",function(){if(g)return;let bt=new xp("stream has been aborted",xp.ERR_BAD_RESPONSE,t,zt);Te.destroy(bt),n(bt)}),Te.on("error",function(bt){O.destroyed||n(xp.from(bt,null,t,zt))}),Te.on("end",function(){try{let bt=it.length===1?it[0]:Buffer.concat(it);s!=="arraybuffer"&&(bt=bt.toString(o),(!o||o==="utf8")&&(bt=_s.stripBOM(bt))),at.data=bt}catch(bt){return n(xp.from(bt,null,t,at.request,at))}jrr(i,n,at)})}m.once("abort",it=>{Te.destroyed||(Te.emit("error",it),Te.destroy())})}),m.once("abort",we=>{n(we),O.destroy(we)}),O.on("error",function(Qe){n(xp.from(Qe,null,t,O))}),O.on("socket",function(Qe){Qe.setKeepAlive(!0,1e3*60)}),t.timeout){let we=parseInt(t.timeout,10);if(Number.isNaN(we)){n(new xp("error trying to parse `config.timeout` to int",xp.ERR_BAD_OPTION_VALUE,t,O));return}O.setTimeout(we,function(){if(b)return;let Dt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",Ee=t.transitional||c7n;t.timeoutErrorMessage&&(Dt=t.timeoutErrorMessage),n(new xp(Dt,Ee.clarifyTimeoutError?xp.ETIMEDOUT:xp.ECONNABORTED,t,O)),E()})}if(_s.isStream(u)){let we=!1,Qe=!1;u.on("end",()=>{we=!0}),u.once("error",Dt=>{Qe=!0,O.destroy(Dt)}),u.on("close",()=>{!we&&!Qe&&E(new sMe("Request stream has been aborted",t,O))}),u.pipe(O)}else O.end(u)})};var zHp=sA.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,sA.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(sA.origin),sA.navigator&&/(msie|trident)/i.test(sA.navigator.userAgent)):()=>!0;var xHp=sA.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let u=[e+"="+encodeURIComponent(t)];_s.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),_s.isString(i)&&u.push("path="+i),_s.isString(n)&&u.push("domain="+n),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var RHp=e=>e instanceof hR?{...e}:e;function CWt(e,t){t=t||{};let r={};function i(s,o,c,b){return _s.isPlainObject(s)&&_s.isPlainObject(o)?_s.merge.call({caseless:b},s,o):_s.isPlainObject(o)?_s.merge({},o):_s.isArray(o)?o.slice():o}function n(s,o,c,b){if(_s.isUndefined(o)){if(!_s.isUndefined(s))return i(void 0,s,c,b)}else return i(s,o,c,b)}function a(s,o){if(!_s.isUndefined(o))return i(void 0,o)}function u(s,o){if(_s.isUndefined(o)){if(!_s.isUndefined(s))return i(void 0,s)}else return i(void 0,o)}function l(s,o,c){if(c in t)return i(s,o);if(c in e)return i(void 0,s)}let d={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:l,headers:(s,o,c)=>n(RHp(s),RHp(o),c,!0)};return _s.forEach(Object.keys(Object.assign({},e,t)),function(o){let c=d[o]||n,b=c(e[o],t[o],o);_s.isUndefined(b)&&c!==l||(r[o]=b)}),r}var C2o=e=>{let t=CWt({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:u,auth:l}=t;t.headers=u=hR.from(u),t.url=lGi(fGi(t.baseURL,t.url),e.params,e.paramsSerializer),l&&u.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let d;if(_s.isFormData(r)){if(sA.hasStandardBrowserEnv||sA.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((d=u.getContentType())!==!1){let[s,...o]=d?d.split(";").map(c=>c.trim()).filter(Boolean):[];u.setContentType([s||"multipart/form-data",...o].join("; "))}}if(sA.hasStandardBrowserEnv&&(i&&_s.isFunction(i)&&(i=i(t)),i||i!==!1&&zHp(t.url))){let s=n&&a&&xHp.read(a);s&&u.set(n,s)}return t};var $WD=typeof XMLHttpRequest<"u",NHp=$WD&&function(e){return new Promise(function(r,i){let n=C2o(e),a=n.data,u=hR.from(n.headers).normalize(),{responseType:l,onUploadProgress:d,onDownloadProgress:s}=n,o,c,b,g,O;function m(){g&&g(),O&&O(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let P=new XMLHttpRequest;P.open(n.method.toUpperCase(),n.url,!0),P.timeout=n.timeout;function E(){if(!P)return;let M=hR.from("getAllResponseHeaders"in P&&P.getAllResponseHeaders()),T={data:!l||l==="text"||l==="json"?P.responseText:P.response,status:P.status,statusText:P.statusText,headers:M,config:e,request:P};jrr(function($){r($),m()},function($){i($),m()},T),P=null}"onloadend"in P?P.onloadend=E:P.onreadystatechange=function(){!P||P.readyState!==4||P.status===0&&!(P.responseURL&&P.responseURL.indexOf("file:")===0)||setTimeout(E)},P.onabort=function(){P&&(i(new xp("Request aborted",xp.ECONNABORTED,e,P)),P=null)},P.onerror=function(){i(new xp("Network Error",xp.ERR_NETWORK,e,P)),P=null},P.ontimeout=function(){let D=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",T=n.transitional||c7n;n.timeoutErrorMessage&&(D=n.timeoutErrorMessage),i(new xp(D,T.clarifyTimeoutError?xp.ETIMEDOUT:xp.ECONNABORTED,e,P)),P=null},a===void 0&&u.setContentType(null),"setRequestHeader"in P&&_s.forEach(u.toJSON(),function(D,T){P.setRequestHeader(T,D)}),_s.isUndefined(n.withCredentials)||(P.withCredentials=!!n.withCredentials),l&&l!=="json"&&(P.responseType=n.responseType),s&&([b,O]=kfi(s,!0),P.addEventListener("progress",b)),d&&P.upload&&([c,g]=kfi(d),P.upload.addEventListener("progress",c),P.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(o=M=>{P&&(i(!M||M.type?new sMe(null,e,P):M),P.abort(),P=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));let q=$Aa(n.url);if(q&&sA.protocols.indexOf(q)===-1){i(new xp("Unsupported protocol "+q+":",xp.ERR_BAD_REQUEST,e));return}P.send(a||null)})};var GWD=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let i=new AbortController,n,a=function(s){if(!n){n=!0,l();let o=s instanceof Error?s:this.reason;i.abort(o instanceof xp?o:new sMe(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new xp(`timeout ${t} of ms exceeded`,xp.ETIMEDOUT))},t),l=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:d}=i;return d.unsubscribe=()=>_s.asap(l),d}},FHp=GWD;var QWD=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let i=0,n;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},JWD=async function*(e,t){for await(let r of KWD(e))yield*QWD(r,t)},KWD=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:i}=await t.read();if(r)break;yield i}}finally{await t.cancel()}},yrc=(e,t,r,i)=>{let n=JWD(e,t),a=0,u,l=d=>{u||(u=!0,i&&i(d))};return new ReadableStream({async pull(d){try{let{done:s,value:o}=await n.next();if(s){l(),d.close();return}let c=o.byteLength;if(r){let b=a+=c;r(b)}d.enqueue(new Uint8Array(o))}catch(s){throw l(s),s}},cancel(d){return l(d),n.return()}},{highWaterMark:2})};var I2o=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",UHp=I2o&&typeof ReadableStream=="function",YWD=I2o&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),VHp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},XWD=UHp&&VHp(()=>{let e=!1,t=new Request(sA.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),LHp=64*1024,vrc=UHp&&VHp(()=>_s.isReadableStream(new Response("").body)),B2o={stream:vrc&&(e=>e.body)};I2o&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!B2o[t]&&(B2o[t]=_s.isFunction(e[t])?r=>r[t]():(r,i)=>{throw new xp(`Response type '${t}' is not supported`,xp.ERR_NOT_SUPPORT,i)})})})(new Response);var ZWD=async e=>{if(e==null)return 0;if(_s.isBlob(e))return e.size;if(_s.isSpecCompliantForm(e))return(await new Request(sA.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(_s.isArrayBufferView(e)||_s.isArrayBuffer(e))return e.byteLength;if(_s.isURLSearchParams(e)&&(e=e+""),_s.isString(e))return(await YWD(e)).byteLength},kWD=async(e,t)=>{let r=_s.toFiniteNumber(e.getContentLength());return r??ZWD(t)},WHp=I2o&&(async e=>{let{url:t,method:r,data:i,signal:n,cancelToken:a,timeout:u,onDownloadProgress:l,onUploadProgress:d,responseType:s,headers:o,withCredentials:c="same-origin",fetchOptions:b}=C2o(e);s=s?(s+"").toLowerCase():"text";let g=FHp([n,a&&a.toAbortSignal()],u),O,m=g&&g.unsubscribe&&(()=>{g.unsubscribe()}),P;try{if(d&&XWD&&r!=="get"&&r!=="head"&&(P=await kWD(o,i))!==0){let T=new Request(t,{method:"POST",body:i,duplex:"half"}),x;if(_s.isFormData(i)&&(x=T.headers.get("content-type"))&&o.setContentType(x),T.body){let[$,I]=d7n(P,kfi(p7n(d)));i=yrc(T.body,LHp,$,I)}}_s.isString(c)||(c=c?"include":"omit");let E="credentials"in Request.prototype;O=new Request(t,{...b,signal:g,method:r.toUpperCase(),headers:o.normalize().toJSON(),body:i,duplex:"half",credentials:E?c:void 0});let q=await fetch(O),M=vrc&&(s==="stream"||s==="response");if(vrc&&(l||M&&m)){let T={};["status","statusText","headers"].forEach(L=>{T[L]=q[L]});let x=_s.toFiniteNumber(q.headers.get("content-length")),[$,I]=l&&d7n(x,kfi(p7n(l),!0))||[];q=new Response(yrc(q.body,LHp,$,()=>{I&&I(),m&&m()}),T)}s=s||"text";let D=await B2o[_s.findKey(B2o,s)||"text"](q,e);return!M&&m&&m(),await new Promise((T,x)=>{jrr(T,x,{data:D,headers:hR.from(q.headers),status:q.status,statusText:q.statusText,config:e,request:O})})}catch(E){throw m&&m(),E&&E.name==="TypeError"&&/fetch/i.test(E.message)?Object.assign(new xp("Network Error",xp.ERR_NETWORK,e,O),{cause:E.cause||E}):xp.from(E,E&&E.code,e,O)}});var brc={http:IHp,xhr:NHp,fetch:WHp};_s.forEach(brc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var HHp=e=>`- ${e}`,eHD=e=>_s.isFunction(e)||e===null||e===!1,z2o={getAdapter:e=>{e=_s.isArray(e)?e:[e];let{length:t}=e,r,i,n={};for(let a=0;a<t;a++){r=e[a];let u;if(i=r,!eHD(r)&&(i=brc[(u=String(r)).toLowerCase()],i===void 0))throw new xp(`Unknown adapter '${u}'`);if(i)break;n[u||"#"+a]=i}if(!i){let a=Object.entries(n).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build")),u=t?a.length>1?`since :
@@ -1943,7 +1943,7 @@ ${M}${q}${D}${Fd_.default.cursorHide}`});var jIa=ci(C1i(),1);function upc(e,t){i
1943
1943
  Run ${Gs.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
1944
1944
  Run ${Gs.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),h7n(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function bpc({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!cp_(e))return;let n=t??"",a=e.filter(l=>l.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((l,d)=>l.generatorName.localeCompare(d.generatorName)||l.currentVersion.localeCompare(d.currentVersion));for(let l of u)n+=`
1945
1945
  ${await WgE(l.generatorName)} (${l.apiName!=null?"API: "+l.apiName+", ":""}Group: ${l.generatorGroup}) `+Gs.dim(l.currentVersion)+Gs.reset(" \u2192 ")+Gs.green(l.latestVersion);return n+=`
1946
- `,i?h7n(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function WgE(e){let r=await new sp_.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 HgE({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await fp_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=T1i(o.name,c),g=await qkt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await fp_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,d,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][d]==null&&(u.versions[l][d]={});let c=T1i(s.name,o),b=await qkt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][d][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function fp_({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await eWt({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let d of l.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function dp_(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=Gae(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function xHo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await HgE({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[d,s]of Object.entries(l.versions))u.push(...dp_(s,d,t.logger));else u.push(...dp_(l.versions,void 0,t.logger))}return u}var TIa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var J2n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var K2n=e=>e!==null&&typeof e=="object";var CIa=(...e)=>{for(let t of e)if((!K2n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return mpc({},...e)},gpc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function RHo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:mpc(e[r]??[],t[r]??[])}var Opc=(e={},t={})=>({beforeRequest:RHo(e,t,"beforeRequest"),beforeRetry:RHo(e,t,"beforeRetry"),afterResponse:RHo(e,t,"afterResponse"),beforeError:RHo(e,t,"beforeError")}),mpc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(K2n(n)){for(let[a,u]of Object.entries(n))K2n(u)&&a in t&&(u=mpc(t[a],u)),t={...t,[a]:u};K2n(n.hooks)&&(i=Opc(i,n.hooks),t.hooks=i),K2n(n.headers)&&(r=gpc(r,n.headers),t.headers=r)}return t};var pp_=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),_p_=typeof globalThis.AbortController=="function",hp_=typeof globalThis.ReadableStream=="function",yp_=typeof globalThis.FormData=="function",NHo=["get","post","put","patch","head","delete"],$gE=()=>{};$gE();var vp_={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},FHo=2147483647,LHo=Symbol("stop"),bp_={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},gp_={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 mp_=e=>NHo.includes(e)?e.toUpperCase():e,GgE=["get","put","head","delete","options","trace"],QgE=[408,413,429,500,502,503,504],JgE=[413,429,503],Op_={limit:2,methods:GgE,statusCodes:QgE,afterStatusCodes:JgE,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Pp_=(e={})=>{if(typeof e=="number")return{...Op_,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{...Op_,...e}};async function Ppc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new J2n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function jpc(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var jp_=(e,t)=>{let r={};for(let i in t)!(i in gp_)&&!(i in bp_)&&!(i in e)&&(r[i]=t[i]);return r};var BIa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>FHo)throw new RangeError(`The \`timeout\` option cannot be greater than ${FHo}`);await Promise.resolve();let l=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let d=new TIa(l,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!hp_)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(l.clone(),i._options.onDownloadProgress)}return l},u=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[l,d]of Object.entries(vp_))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let o=(await u).clone();if(l==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:gpc(this._input.headers,r.headers),hooks:Opc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:mp_(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:Pp_(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(_p_){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if(pp_&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(yp_&&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)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof J2n)throw t;if(t instanceof TIa){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),FHo);if(this._retryCount<1)throw r;await jpc(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===LHo)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=jp_(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Ppc(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function l(){let{done:d,value:s}=await u.read();if(d){a.close();return}if(r){n+=s.byteLength;let o=i===0?0:n/i;r({percent:o,transferredBytes:n,totalBytes:i},s)}a.enqueue(s),await l()}await l()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var wpc=e=>{let t=(r,i)=>BIa.create(r,CIa(e,i));for(let r of NHo)t[r]=(i,n)=>BIa.create(i,CIa(e,n,{method:r}));return t.create=r=>wpc(CIa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),wpc(CIa(e,r))),t.stop=LHo,t},KgE=wpc(),wp_=KgE;var Qp_=ci(Gp_(),1);function Apc(e){let t=(0,Qp_.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var U__=ci(L__(),1),V__=ci(C1i(),1),Wpc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Hpc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function $pc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??Apc(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,U__.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,l&&(d.authorization=`${l.type} ${l.token}`);let s;try{s=await wp_(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new Wpc(e):c}if(t.allVersions)return s;let o=new Hpc(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=V__.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function FIa(e,t){let{version:r}=await $pc(e.toLowerCase(),t);return r}async function mMi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:FIa(e.packageName,{version:t?"prerelease":"latest"})}var W__=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],ZHo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=M0.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new zHo(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),u=this.getCliName();(n==null||a==null||u==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:u}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.63.27"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Gs.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new w9}failWithoutThrowing(t,r){this.didSucceed=!1,THo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await o7n()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await lp_({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1946
+ `,i?h7n(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function WgE(e){let r=await new sp_.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 HgE({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await fp_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=T1i(o.name,c),g=await qkt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await fp_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,d,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][d]==null&&(u.versions[l][d]={});let c=T1i(s.name,o),b=await qkt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][d][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function fp_({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await eWt({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let d of l.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function dp_(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=Gae(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function xHo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await HgE({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[d,s]of Object.entries(l.versions))u.push(...dp_(s,d,t.logger));else u.push(...dp_(l.versions,void 0,t.logger))}return u}var TIa=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var J2n=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var K2n=e=>e!==null&&typeof e=="object";var CIa=(...e)=>{for(let t of e)if((!K2n(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return mpc({},...e)},gpc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function RHo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:mpc(e[r]??[],t[r]??[])}var Opc=(e={},t={})=>({beforeRequest:RHo(e,t,"beforeRequest"),beforeRetry:RHo(e,t,"beforeRetry"),afterResponse:RHo(e,t,"afterResponse"),beforeError:RHo(e,t,"beforeError")}),mpc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(K2n(n)){for(let[a,u]of Object.entries(n))K2n(u)&&a in t&&(u=mpc(t[a],u)),t={...t,[a]:u};K2n(n.hooks)&&(i=Opc(i,n.hooks),t.hooks=i),K2n(n.headers)&&(r=gpc(r,n.headers),t.headers=r)}return t};var pp_=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),_p_=typeof globalThis.AbortController=="function",hp_=typeof globalThis.ReadableStream=="function",yp_=typeof globalThis.FormData=="function",NHo=["get","post","put","patch","head","delete"],$gE=()=>{};$gE();var vp_={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},FHo=2147483647,LHo=Symbol("stop"),bp_={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},gp_={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 mp_=e=>NHo.includes(e)?e.toUpperCase():e,GgE=["get","put","head","delete","options","trace"],QgE=[408,413,429,500,502,503,504],JgE=[413,429,503],Op_={limit:2,methods:GgE,statusCodes:QgE,afterStatusCodes:JgE,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Pp_=(e={})=>{if(typeof e=="number")return{...Op_,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{...Op_,...e}};async function Ppc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new J2n(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function jpc(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var jp_=(e,t)=>{let r={};for(let i in t)!(i in gp_)&&!(i in bp_)&&!(i in e)&&(r[i]=t[i]);return r};var BIa=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>FHo)throw new RangeError(`The \`timeout\` option cannot be greater than ${FHo}`);await Promise.resolve();let l=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let d=new TIa(l,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!hp_)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(l.clone(),i._options.onDownloadProgress)}return l},u=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[l,d]of Object.entries(vp_))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let o=(await u).clone();if(l==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:gpc(this._input.headers,r.headers),hooks:Opc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:mp_(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:Pp_(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(_p_){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if(pp_&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(yp_&&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)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof J2n)throw t;if(t instanceof TIa){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),FHo);if(this._retryCount<1)throw r;await jpc(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===LHo)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=jp_(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Ppc(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function l(){let{done:d,value:s}=await u.read();if(d){a.close();return}if(r){n+=s.byteLength;let o=i===0?0:n/i;r({percent:o,transferredBytes:n,totalBytes:i},s)}a.enqueue(s),await l()}await l()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var wpc=e=>{let t=(r,i)=>BIa.create(r,CIa(e,i));for(let r of NHo)t[r]=(i,n)=>BIa.create(i,CIa(e,n,{method:r}));return t.create=r=>wpc(CIa(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),wpc(CIa(e,r))),t.stop=LHo,t},KgE=wpc(),wp_=KgE;var Qp_=ci(Gp_(),1);function Apc(e){let t=(0,Qp_.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var U__=ci(L__(),1),V__=ci(C1i(),1),Wpc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},Hpc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function $pc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??Apc(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,U__.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,l&&(d.authorization=`${l.type} ${l.token}`);let s;try{s=await wp_(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new Wpc(e):c}if(t.allVersions)return s;let o=new Hpc(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=V__.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function FIa(e,t){let{version:r}=await $pc(e.toLowerCase(),t);return r}async function mMi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:FIa(e.packageName,{version:t?"prerelease":"latest"})}var W__=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],ZHo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=M0.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new zHo(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),u=this.getCliName();(n==null||a==null||u==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:u}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.63.28"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Gs.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new w9}failWithoutThrowing(t,r){this.didSucceed=!1,THo({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await o7n()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await lp_({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1947
1947
  `)||(r+=`
1948
1948
  `),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=g3s(t.map(i=>i.type==="docs"?"docs":i.workspaceName??"api"),i=>i.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new wIa(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let i=this.addTaskWithInit(t).start(),n;try{n=await r(i)}catch(a){throw a.message.includes("globalThis")?(i.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),i.failWithoutThrowing()):i.failWithoutThrowing(void 0,a),new w9}finally{i.finish()}return n}async instrumentPostHogEvent(t){this.isLocal||(await o7n()).sendEvent(t)}logger=QXt((t,...r)=>this.log(t,...r));stderr=QXt((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=H__(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?H__(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=W__[this.numTasks++%W__.length],u=Gs.hex(a)(n);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===AB.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let i=t.filter(n=>Jwi.indexOf(n.level)>=Jwi.indexOf(this.logLevel));this.ttyAwareLogger.log(i,{includeDebugInfo:this.logLevel===M0.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 mMi({cliEnvironment:this.environment,includePreReleases:t}),i=Gae(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await xHo({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await tpc({message:t,default:r})}async getInput(t){return await rpc({message:t.message,default:t.default})}};function H__(e){return`[${e}]:`}var TI_=require("fs/promises");function gFe({breadcrumbs:e=[],title:t,subtitle:r}){let i=[];return e.length>0&&i.push(Gs.blue(e.join(" -> "))),i.push(t),r!=null&&i.push(Gs.dim(r)),i.join(`
1949
1949
  `)}var OM_=require("fs/promises");var cHt=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:i,absoluteFilePath:n,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=i,this.absoluteFilePath=n,this.changelog=a}};var EMe=class extends cHt{definition;sources;type="fern";constructor({definition:t,sources:r,...i}){super(i),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var LIa=class{context;constructor(t){this.context=t}};var kHo=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[u,l]of Object.entries(i.files)){let d=n!=null?yy.of(`${n}${OVt}${u}`):yy.of(u);t[d]=l}let a=Object.keys(i.directories).sort();for(let u of a){let l=n!=null?`${n}${OVt}${u}`:u,d=i.directories[u];r(d,l)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(OVt))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[yy.of(t[0])]??={};let[r,...i]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(i)}};var yJi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new kHo,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":i,"display-name":n,docs:a}){let u=this.getOrCreateFile(t);u.service==null&&(u.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(u.service.auth=r),i!=null&&(u.service["base-path"]=i),n!=null&&(u.service["display-name"]=n),a!=null&&(u.docs=a)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return Gkt(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let i of Object.values(this.rootApiFile["auth-schemes"]))$__(i)&&t.push(i.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if($__(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let i=this.getVersionHeader();i!=null&&i===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r,alias:i}){if(t===r)return;let n=i??T_((Rxe(r)+"/"+uWi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===yy.of(n3))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=xjo(Rxe(yzn.of(`/${t}`)),yzn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=xjo(Rxe(yzn.of(`/${t}`)),yzn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){if(t===yy.of(n3))return;let n=this.getOrCreateFile(t);n.types==null&&(n.types={}),n.types[r]=i}addTypeExample(t,r,i){let n=this.getOrCreateFile(t);n.types==null&&(n.types={});let a=n.types[r];a!=null&&(typeof a=="string"?n.types[r]={type:a,examples:[i]}:(a.examples==null&&(a.examples=[]),a.examples.push(i)))}addError(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.errors==null&&(n.errors={}),n.errors[r]==null?n.errors[r]=i:n.errors[r]?.type!==i.type&&(n.errors[r]={"status-code":i["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:i}){let n=this.getOrCreateFile(t);if(n.errors==null)return;let a=n.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(l=>mEe(l,i))??!1)||a.examples?.push(i)}addEndpoint(t,{name:r,schema:i,source:n}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),n!=null&&(a.service.source=n),a.service.endpoints[r]=i}addWebhook(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.webhooks==null&&(n.webhooks={}),n.webhooks[r]=i}addChannel(t,{channel:r}){let i=this.getOrCreateFile(t);i.channel=r;let n=this.basePath;n!=null&&(i.channel.path=WN(n,r.path))}addChannelExample(t,{example:r}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.examples==null&&(i.channel.examples=[]),i.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:i}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.messages[r]=i}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([n,a])=>[n,{...a,path:WN(r,a.path)}]))});for(let n of Object.values(t))n.service!=null&&(n.service={...n.service,endpoints:Object.fromEntries(Object.entries(n.service.endpoints).map(([a,u])=>[a,{...u,path:WN(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===zS?this.packageMarkerFile:this.root.getOrCreateFile(t)}getVersionHeader(){if(this.rootApiFile.version!=null)return typeof this.rootApiFile.version.header=="string"?this.rootApiFile.version.header:this.rootApiFile.version.header.value}};function $__(e){return e?.header!=null}var Qae={openapi:e=>({...e,type:"openapi",_visit:function(t){return Qae._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return Qae._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"openapi":return t.openapi(e);case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var r8n={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return r8n._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var aL={basic:e=>({...e,type:"basic",_visit:function(t){return aL._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return aL._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return aL._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return aL._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return aL._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"query":return t.query(e);case"oauth":return t.oauth(e);default:return t._other(e)}}};var vO={primitive:e=>({value:e,type:"primitive",_visit:function(t){return vO._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return vO._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return vO._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return vO._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return vO._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return vO._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return vO._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return vO._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var w_={int:e=>({value:e,type:"int",_visit:function(t){return w_._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return w_._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return w_._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return w_._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return w_._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return w_._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return w_._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return w_._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return w_._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return w_._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return w_._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e.value);case"int64":return t.int64(e.value);case"uint":return t.uint(e.value);case"uint64":return t.uint64(e.value);case"float":return t.float(e.value);case"double":return t.double(e.value);case"string":return t.string(e.value);case"datetime":return t.datetime(e.value);case"date":return t.date(e.value);case"base64":return t.base64(e.value);case"boolean":return t.boolean(e.value);default:return t._other(e)}}};var i8n={boolean:e=>({value:e,type:"boolean",_visit:function(t){return i8n._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return i8n._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var PMi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return PMi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return PMi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e.value);case"undiscriminated":return t.undiscriminated(e.value);default:return t._other(e)}}};var eH={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case eH.GenerallyAvailable:return t.generallyAvailable();case eH.Beta:return t.beta();case eH.Deprecated:return t.deprecated();default:return t._other()}}};var OFe={cursor:e=>({...e,type:"cursor",_visit:function(t){return OFe._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return OFe._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return OFe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);default:return t._other(e)}}};var Wdi={language:e=>({...e,type:"language",_visit:function(t){return Wdi._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return Wdi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"language":return t.language(e);case"sdk":return t.sdk(e);default:return t._other(e)}}};var tH={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Js:"js",Node:"node",Ts:"ts",Nodets:"nodets",Golang:"golang",Dotnet:"dotnet",Jvm:"jvm",_visit:(e,t)=>{switch(e){case tH.Curl:return t.curl();case tH.Python:return t.python();case tH.Javascript:return t.javascript();case tH.Typescript:return t.typescript();case tH.Go:return t.go();case tH.Ruby:return t.ruby();case tH.Csharp:return t.csharp();case tH.Java:return t.java();case tH.Js:return t.js();case tH.Node:return t.node();case tH.Ts:return t.ts();case tH.Nodets:return t.nodets();case tH.Golang:return t.golang();case tH.Dotnet:return t.dotnet();case tH.Jvm:return t.jvm();default:return t._other()}}};var lHt={unknown:e=>({value:e,type:"unknown",_visit:function(t){return lHt._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return lHt._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"unknown":return t.unknown(e.value);case"full":return t.full(e);default:return t._other(e)}}};var fHt={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return fHt._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return fHt._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"withStreaming":return t.withStreaming(e);case"withoutStreaming":return t.withoutStreaming(e.value);default:return t._other(e)}}};var rH={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case rH.Get:return t.get();case rH.Post:return t.post();case rH.Put:return t.put();case rH.Patch:return t.patch();case rH.Delete:return t.delete();case rH.Head:return t.head();case rH.Options:return t.options();case rH.Trace:return t.trace();default:return t._other()}}};var jMi={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return jMi._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return jMi._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return jMi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);default:return t._other(e)}}};var Hdi={file:e=>({...e,type:"file",_visit:function(t){return Hdi._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return Hdi._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e.value);default:return t._other(e)}}};var fJ={file:e=>({...e,type:"file",_visit:function(t){return fJ._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return fJ._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return fJ._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return fJ._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return fJ._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return fJ._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return fJ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var Fy={primitive:e=>({...e,type:"primitive",_visit:function(t){return Fy._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Fy._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Fy._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Fy._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Fy._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Fy._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Fy._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Fy._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Fy._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Fy._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Fy._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var Xj={int:e=>({...e,type:"int",_visit:function(t){return Xj._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Xj._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Xj._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Xj._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Xj._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Xj._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Xj._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Xj._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Xj._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Xj._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Xj._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint();case"uint64":return t.uint64();case"float":return t.float();case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime();case"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var vz={boolean:e=>({value:e,type:"boolean",_visit:function(t){return vz._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return vz._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var $di={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return $di._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return $di._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var MMe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return MMe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return MMe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return MMe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);default:return t._other(e)}}};var bC={file:e=>({...e,type:"file",_visit:function(t){return bC._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return bC._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return bC._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return bC._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return bC._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return bC._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return bC._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var xl={primitive:e=>({...e,type:"primitive",_visit:function(t){return xl._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return xl._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return xl._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return xl._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return xl._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return xl._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return xl._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return xl._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return xl._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return xl._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return xl._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var ak={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return ak._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return ak._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var up={int:e=>({...e,type:"int",_visit:function(t){return up._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return up._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return up._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return up._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return up._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return up._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return up._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return up._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return up._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return up._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return up._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint(e);case"uint64":return t.uint64(e);case"float":return t.float(e);case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime(e);case"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var Ev={};jo(Ev,{AllOfPropertyConflict:()=>D8n,ArraySchema:()=>hGo,ArraySchemaWithExample:()=>WGo,Availability:()=>c$o,Base64WithExample:()=>NGo,BasicSecurityScheme:()=>d$o,BearerSecurityScheme:()=>p$o,BooleanSchema:()=>cGo,BooleanWithExample:()=>FGo,BytesResponse:()=>v8n,CasingOverrides:()=>y$o,CommonProperty:()=>jGo,CommonPropertyWithExample:()=>ZGo,CursorPagination:()=>G$o,CustomCodeSample:()=>H$o,CustomCodeSampleLanguage:()=>U$o,CustomCodeSampleSdk:()=>W$o,CustomPagination:()=>J$o,DateWithExample:()=>RGo,DatetimeWithExample:()=>xGo,DiscriminatedOneOfSchema:()=>mGo,DiscriminatedOneOfSchemaWithExample:()=>YGo,DoubleSchema:()=>uGo,DoubleWithExample:()=>IGo,Encoding:()=>s$o,Endpoint:()=>K$o,EndpointExample:()=>m8n,EndpointResponseExample:()=>L$o,EndpointSdkName:()=>lir,EndpointWithExample:()=>mh_,EnumSchema:()=>u8n,EnumSchemaWithExample:()=>UGo,EnumValue:()=>DMi,ErrorExample:()=>z$o,FernExample:()=>R$o,FileResponse:()=>h8n,FileSchema:()=>M$o,FloatWithExample:()=>BGo,FullEndpointExample:()=>$$o,FullExample:()=>Hq,FullObjectExample:()=>j$o,FullOneOfExample:()=>S$o,GlobalHeader:()=>fGo,Header:()=>MMi,HeaderExample:()=>O8n,HeaderSecurityScheme:()=>_$o,HeaderWithExample:()=>TMi,HttpEndpointServer:()=>b8n,HttpError:()=>x$o,HttpErrorWithExample:()=>MGo,HttpMethod:()=>l8n,IdempotencyHeader:()=>dGo,Int64WithExample:()=>qGo,IntSchema:()=>aGo,IntWithExample:()=>AGo,JsonRequest:()=>C$o,JsonRequestWithExample:()=>SGo,JsonResponse:()=>y8n,JsonResponseWithExample:()=>A8n,KeyValuePair:()=>w$o,LiteralExample:()=>P$o,LiteralSchema:()=>S8n,LiteralSchemaValue:()=>pGo,LongSchema:()=>oGo,MapSchema:()=>yGo,MapSchemaWithExample:()=>HGo,MultipartRequest:()=>_8n,MultipartRequestProperty:()=>T$o,MultipartRequestPropertyEncoding:()=>q$o,MultipartSchema:()=>A$o,NamedFullExample:()=>dir,Namespace:()=>v$o,NamespaceId:()=>m$o,NullableSchema:()=>bGo,NullableSchemaWithExample:()=>GGo,OauthSecurityScheme:()=>g$o,ObjectProperty:()=>OGo,ObjectPropertyConflictInfo:()=>E8n,ObjectPropertyWithExample:()=>KGo,ObjectSchema:()=>_Go,ObjectSchemaWithExample:()=>QGo,OctetStreamRequest:()=>p8n,OffsetPagination:()=>Q$o,OneOfSchema:()=>gGo,OneOfSchemaWithExample:()=>JGo,OpenApiIntermediateRepresentation:()=>gh_,OpenApiSource:()=>n$o,OptionalSchema:()=>vGo,OptionalSchemaWithExample:()=>$Go,Pagination:()=>P8n,PathParameter:()=>f8n,PathParameterExample:()=>N$o,PathParameterWithExample:()=>wGo,PrimitiveExample:()=>c8n,PrimitiveSchema:()=>qMi,PrimitiveSchemaValue:()=>lGo,PrimitiveSchemaValueWithExample:()=>LGo,PrimitiveSchemaWithExample:()=>q8n,PropertyKey:()=>s8n,ProtobufEncoding:()=>u$o,ProtobufSource:()=>a$o,QueryParameter:()=>d8n,QueryParameterExample:()=>g8n,QueryParameterWithExample:()=>M8n,QuerySecurityScheme:()=>h$o,ReferencedSchema:()=>fir,Request:()=>B$o,RequestWithExample:()=>DGo,Response:()=>I$o,ResponseWithExample:()=>EGo,Schema:()=>Om,SchemaId:()=>ok,SchemaWithExample:()=>pA,Schemas:()=>nGo,SdkGroup:()=>b$o,SdkGroupInfo:()=>D$o,SdkGroupName:()=>EMi,SecurityScheme:()=>O$o,SecuritySchemeId:()=>f$o,Server:()=>HIa,Source:()=>o$o,StatusCode:()=>cir,StreamingResponseExample:()=>F$o,StringSchema:()=>sGo,StringSchemaWithExample:()=>zGo,SupportedSdkLanguage:()=>V$o,Tag:()=>l$o,TagId:()=>uk,Tags:()=>E$o,TextResponse:()=>AMi,Uint64WithExample:()=>CGo,UintWithExample:()=>TGo,UnDiscriminatedOneOfSchema:()=>PGo,UnDiscriminatedOneOfSchemaWithExample:()=>XGo,UnknownSchemaWithExample:()=>VGo,Webhook:()=>Y$o,WebhookExampleCall:()=>w8n,WebhookHttpMethod:()=>j8n,WebhookWithExample:()=>Ph_,WebsocketChannel:()=>iGo,WebsocketHandshake:()=>X$o,WebsocketHandshakeWithExample:()=>Oh_,WebsocketMessageExample:()=>tGo,WebsocketMessageOrigin:()=>Z$o,WebsocketMessageSchema:()=>k$o,WebsocketServer:()=>eGo,WebsocketSessionExample:()=>rGo,WithAvailability:()=>Ah,WithDescription:()=>bf,WithEncoding:()=>Jae,WithInline:()=>GE,WithName:()=>C0,WithNamespace:()=>e0,WithSdkGroupName:()=>om,WithSource:()=>Jh,WithStatusCode:()=>mFe,WithTitle:()=>am,commons:()=>Ypc,example:()=>Xpc,finalIr:()=>Zpc,parseIr:()=>kpc});var Ypc={};jo(Ypc,{BasicSecurityScheme:()=>d$o,BearerSecurityScheme:()=>p$o,Encoding:()=>s$o,HeaderSecurityScheme:()=>_$o,Namespace:()=>v$o,NamespaceId:()=>m$o,OauthSecurityScheme:()=>g$o,OpenApiSource:()=>n$o,ProtobufEncoding:()=>u$o,ProtobufSource:()=>a$o,QuerySecurityScheme:()=>h$o,SchemaId:()=>ok,SdkGroup:()=>b$o,SdkGroupName:()=>EMi,SecurityScheme:()=>O$o,SecuritySchemeId:()=>f$o,Server:()=>HIa,Source:()=>o$o,StatusCode:()=>cir,Tag:()=>l$o,TagId:()=>uk,WithAvailability:()=>Ah,WithDescription:()=>bf,WithEncoding:()=>Jae,WithInline:()=>GE,WithName:()=>C0,WithNamespace:()=>e0,WithSdkGroupName:()=>om,WithSource:()=>Jh,WithStatusCode:()=>mFe,WithTitle:()=>am});var At={};jo(At,{JsonError:()=>n8n,ParseError:()=>a8n,any:()=>oh_,bigint:()=>Q__,boolean:()=>uh_,booleanLiteral:()=>ah_,date:()=>J__,discriminant:()=>yh_,enum_:()=>t$o,getObjectLikeUtils:()=>dHt,getObjectUtils:()=>vJi,getSchemaUtils:()=>Wq,isProperty:()=>SMi,lazy:()=>K__,lazyObject:()=>rh_,list:()=>i$o,number:()=>sh_,object:()=>r$o,objectWithoutOptionalProperties:()=>th_,optional:()=>Gpc,property:()=>X__,record:()=>dh_,set:()=>ph_,string:()=>ch_,stringLiteral:()=>nh_,transform:()=>Qpc,undiscriminatedUnion:()=>hh_,union:()=>bh_,unknown:()=>lh_,withParsedProperties:()=>Kpc});var Mj={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function dA(e,t){return`Expected ${t}. Received ${emE(e)}.`}function emE(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function oL(e){return{...e,json:G__(e.json),parse:G__(e.parse)}}function G__(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.63.27",
3
+ "version": "0.63.28",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",