fern-api 0.113.0 → 0.113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +5 -5
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -2079,7 +2079,7 @@ ${a}`;break;case"retry":Z4E(a)&&(r[i]=a);break;case"id":k4E(a)&&(r[i]=a);break;c
2079
2079
  ${r?e:" ".repeat(n)}`)}`}function ku(e){throw new Error("Unexpected value: "+JSON.stringify(e))}function dKl(e){return new Promise(t=>setTimeout(()=>t(),e))}var zP={};yf(zP,{BASE64:()=>ZsS,BIG_INTEGER:()=>cuS,BOOLEAN:()=>ksS,DATE:()=>euS,DATE_TIME:()=>tuS,DOUBLE:()=>ruS,FLOAT:()=>nuS,INT:()=>iuS,INT64:()=>auS,SAMPLE_STRINGS:()=>luS,STRING:()=>XsS,UINT:()=>ouS,UINT64:()=>suS,UUID:()=>uuS});var XsS="string",ZsS="SGVsbG8gd29ybGQh",ksS=!0,euS="2023-01-15",tuS="2024-01-15T09:30:00Z",ruS=1.1,nuS=1.1,iuS=1,auS=1e6,ouS=1,suS=1e6,uuS="d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",cuS="123456789123456789",luS=["x","xy","foo","buzz","alpha","banana","apricot","mandarin","nectarine","strawberry","pomegranate","blackcurrant"];function pKl(e){let t=new Set,r=new Set,n=[];for(let i of e)t.has(i)&&!r.has(i)&&(r.add(i),n.push(i)),t.add(i);return n}function hj(e){return e!=null}var cnh=$i(yKl(),1),T8=class e{type;subtype;essence;parameters;mimeType;input;constructor(t,r,n,i,a,o){this.type=t,this.subtype=r,this.essence=n,this.parameters=i,this.mimeType=a,this.input=o}static APPLICATION_JSON="application/json";static APPLICATION_OCTET_STREAM="application/octet-stream";static MULTIPART_FORM_DATA="multipart/form-data";static TEXT_PLAIN="text/plain";static TEXT_HTML="text/html";static TEXT_XML="text/xml";static APPLICATION_XML="application/xml";static APPLICATION_FORM_URLENCODED="application/x-www-form-urlencoded";static parse(t){if(t==null||t.trim()==="")return null;let r=t.trim(),n=cnh.default.parse(r);return n==null?null:new e(n.type,n.subtype,n.essence,n.parameters,n,r)}toString(){return this.input}getCharset(){return this.parameters.get("charset")??null}getBoundary(){return this.parameters.get("boundary")??null}isText(){return this.type==="text"}isImage(){return this.type==="image"}isAudio(){return this.type==="audio"}isVideo(){return this.type==="video"}isFont(){return this.type==="font"}isMultipart(){return this.type==="multipart"}isApplication(){return this.type==="application"}isMessage(){return this.type==="message"}isModel(){return this.type==="model"}isCSS(){return this.isText()&&this.subtype==="css"}isCSV(){return(this.isText()||this.isApplication())&&this.subtype==="csv"}isMarkdown(){return this.isText()&&(this.subtype==="markdown"||this.subtype==="x-markdown")}isPlainText(){return this.isText()&&this.subtype==="plain"}isRichText(){return this.isText()&&this.subtype==="richtext"}isDNS(){return this.isText()&&this.subtype==="dns"}isApplicationText(){return this.isApplication()&&this.subtype==="text"}isMultiPartFormData(){return this.isMultipart()&&this.subtype==="form-data"}isMultiPartMixed(){return this.isMultipart()&&this.subtype==="mixed"}isMultiPartAlternative(){return this.isMultipart()&&this.subtype==="alternative"}isMultiPartRelated(){return this.isMultipart()&&this.subtype==="related"}isJSON(){return this.isApplication()&&this.subtype.includes("json")}isURLEncoded(){return this.isApplication()&&this.subtype==="x-www-form-urlencoded"}isOctetStream(){return this.isApplication()&&this.subtype==="octet-stream"}isPDF(){return this.isApplication()&&this.subtype==="pdf"}isZip(){return this.isApplication()&&(this.subtype==="zip"||this.subtype==="x-zip-compressed")}isGzip(){return this.isApplication()&&(this.subtype==="gzip"||this.subtype==="x-gzip")}isTar(){return this.isApplication()&&(this.subtype==="tar"||this.subtype==="x-tar")}isBrotli(){return this.isApplication()&&this.subtype==="br"}isDeflate(){return this.isApplication()&&this.subtype==="deflate"}isProtobuf(){return this.isApplication()&&(this.subtype==="protobuf"||this.subtype==="x-protobuf")}isExcel(){return this.isApplication()&&(this.subtype==="vnd.ms-excel"||this.subtype==="vnd.openxmlformats-officedocument.spreadsheetml.sheet")}isWord(){return this.isApplication()&&(this.subtype==="msword"||this.subtype==="vnd.openxmlformats-officedocument.wordprocessingml.document")}isPowerPoint(){return this.isApplication()&&(this.subtype==="vnd.ms-powerpoint"||this.subtype==="vnd.openxmlformats-officedocument.presentationml.presentation")}isAvif(){return this.isImage()&&this.subtype==="avif"}isWebP(){return this.isImage()&&this.subtype==="webp"}isSVG(){return this.isImage()&&this.subtype==="svg+xml"}isPNG(){return this.isImage()&&this.subtype==="png"}isJPEG(){return this.isImage()&&(this.subtype==="jpeg"||this.subtype==="jpg")}isGIF(){return this.isImage()&&this.subtype==="gif"}isBMP(){return this.isImage()&&this.subtype==="bmp"}isTIFF(){return this.isImage()&&(this.subtype==="tiff"||this.subtype==="tif")}isICO(){return this.isImage()&&(this.subtype==="x-icon"||this.subtype==="vnd.microsoft.icon")}isMPEG(){return this.isAudio()&&(this.subtype==="mpeg"||this.subtype==="mp3")}isWAV(){return this.isAudio()&&(this.subtype==="wav"||this.subtype==="wave")}isOGG(){return this.isAudio()&&this.subtype==="ogg"}isAAC(){return this.isAudio()&&this.subtype==="aac"}isFLAC(){return this.isAudio()&&this.subtype==="flac"}isMP4(){return this.isVideo()&&this.subtype==="mp4"}isWebM(){return this.isVideo()&&this.subtype==="webm"}isAVI(){return this.isVideo()&&this.subtype==="x-msvideo"}isMOV(){return this.isVideo()&&this.subtype==="quicktime"}isHTML(){return this.mimeType.isHTML()}isXML(){return this.mimeType.isXML()||this.isApplication()&&this.subtype.endsWith("+xml")}isJavaScript(){return this.mimeType.isJavaScript()}isBinary(){return this.isImage()||this.isAudio()||this.isVideo()||this.isFont()||this.isOctetStream()||this.isPDF()||this.isZip()||this.isGzip()||this.isTar()||this.isBrotli()}isTextBased(){return this.isText()||this.isJSON()||this.isXML()||this.isHTML()||this.isJavaScript()||this.isCSS()||this.isCSV()||this.isMarkdown()||this.isSVG()||this.isDNS()||this.isApplicationText()}isStructuredData(){return this.isJSON()||this.isXML()||this.isCSV()||this.isHTML()}isFormData(){return this.isURLEncoded()||this.isMultiPartFormData()}isCompressed(){return this.isGzip()||this.isBrotli()||this.isDeflate()||this.isZip()||this.isTar()}};var OuS=typeof global=="object"&&global&&global.Object===Object&&global,Qeu=OuS;var AuS=typeof self=="object"&&self&&self.Object===Object&&self,PuS=Qeu||AuS||Function("return this")(),Ane=PuS;var wuS=Ane.Symbol,jDe=wuS;var lnh=Object.prototype,juS=lnh.hasOwnProperty,EuS=lnh.toString,CLo=jDe?jDe.toStringTag:void 0;function SuS(e){var t=juS.call(e,CLo),r=e[CLo];try{e[CLo]=void 0;var n=!0}catch{}var i=EuS.call(e);return n&&(t?e[CLo]=r:delete e[CLo]),i}var fnh=SuS;var DuS=Object.prototype,CuS=DuS.toString;function IuS(e){return CuS.call(e)}var dnh=IuS;var MuS="[object Null]",BuS="[object Undefined]",pnh=jDe?jDe.toStringTag:void 0;function TuS(e){return e==null?e===void 0?BuS:MuS:pnh&&pnh in Object(e)?fnh(e):dnh(e)}var EDe=TuS;function quS(e){return e!=null&&typeof e=="object"}var tve=quS;var RuS="[object Symbol]";function NuS(e){return typeof e=="symbol"||tve(e)&&EDe(e)==RuS}var O2r=NuS;function FuS(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var zWa=FuS;var xuS=Array.isArray,NL=xuS;var zuS=1/0,_nh=jDe?jDe.prototype:void 0,hnh=_nh?_nh.toString:void 0;function ynh(e){if(typeof e=="string")return e;if(NL(e))return zWa(e,ynh)+"";if(O2r(e))return hnh?hnh.call(e):"";var t=e+"";return t=="0"&&1/e==-zuS?"-0":t}var vnh=ynh;var QuS=/\s/;function LuS(e){for(var t=e.length;t--&&QuS.test(e.charAt(t)););return t}var bnh=LuS;var UuS=/^\s+/;function VuS(e){return e&&e.slice(0,bnh(e)+1).replace(UuS,"")}var gnh=VuS;function WuS(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var FX=WuS;var mnh=NaN,GuS=/^[-+]0x[0-9a-f]+$/i,HuS=/^0b[01]+$/i,JuS=/^0o[0-7]+$/i,KuS=parseInt;function $uS(e){if(typeof e=="number")return e;if(O2r(e))return mnh;if(FX(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=FX(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=gnh(e);var r=HuS.test(e);return r||JuS.test(e)?KuS(e.slice(2),r?2:8):GuS.test(e)?mnh:+e}var Onh=$uS;var Anh=1/0,YuS=17976931348623157e292;function XuS(e){if(!e)return e===0?e:0;if(e=Onh(e),e===Anh||e===-Anh){var t=e<0?-1:1;return t*YuS}return e===e?e:0}var Pnh=XuS;function ZuS(e){var t=Pnh(e),r=t%1;return t===t?r?t-r:t:0}var wnh=ZuS;function kuS(e){return e}var QWa=kuS;var ecS="[object AsyncFunction]",tcS="[object Function]",rcS="[object GeneratorFunction]",ncS="[object Proxy]";function icS(e){if(!FX(e))return!1;var t=EDe(e);return t==tcS||t==rcS||t==ecS||t==ncS}var LWa=icS;var acS=Ane["__core-js_shared__"],Leu=acS;var jnh=(function(){var e=/[^.]+$/.exec(Leu&&Leu.keys&&Leu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function ocS(e){return!!jnh&&jnh in e}var Enh=ocS;var scS=Function.prototype,ucS=scS.toString;function ccS(e){if(e!=null){try{return ucS.call(e)}catch{}try{return e+""}catch{}}return""}var k0i=ccS;var lcS=/[\\^$.*+?()[\]{}|]/g,fcS=/^\[object .+?Constructor\]$/,dcS=Function.prototype,pcS=Object.prototype,_cS=dcS.toString,hcS=pcS.hasOwnProperty,ycS=RegExp("^"+_cS.call(hcS).replace(lcS,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vcS(e){if(!FX(e)||Enh(e))return!1;var t=LWa(e)?ycS:fcS;return t.test(k0i(e))}var Snh=vcS;function bcS(e,t){return e?.[t]}var Dnh=bcS;function gcS(e,t){var r=Dnh(e,t);return Snh(r)?r:void 0}var VNe=gcS;var mcS=VNe(Ane,"WeakMap"),Ueu=mcS;var Cnh=Object.create,OcS=(function(){function e(){}return function(t){if(!FX(t))return{};if(Cnh)return Cnh(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})(),Inh=OcS;function AcS(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Mnh=AcS;function PcS(){}var Ddt=PcS;function wcS(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Bnh=wcS;var jcS=800,EcS=16,ScS=Date.now;function DcS(e){var t=0,r=0;return function(){var n=ScS(),i=EcS-(n-r);if(r=n,i>0){if(++t>=jcS)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Tnh=DcS;function CcS(e){return function(){return e}}var qnh=CcS;var IcS=(function(){try{var e=VNe(Object,"defineProperty");return e({},"",{}),e}catch{}})(),UWa=IcS;var McS=UWa?function(e,t){return UWa(e,"toString",{configurable:!0,enumerable:!1,value:qnh(t),writable:!0})}:QWa,Rnh=McS;var BcS=Tnh(Rnh),Nnh=BcS;function TcS(e,t,r,n){for(var i=e.length,a=r+(n?1:-1);n?a--:++a<i;)if(t(e[a],a,e))return a;return-1}var Fnh=TcS;function qcS(e){return e!==e}var xnh=qcS;function RcS(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var znh=RcS;function NcS(e,t,r){return t===t?znh(e,t,r):Fnh(e,xnh,r)}var Qnh=NcS;function FcS(e,t){var r=e==null?0:e.length;return!!r&&Qnh(e,t,0)>-1}var Lnh=FcS;var xcS=9007199254740991,zcS=/^(?:0|[1-9]\d*)$/;function QcS(e,t){var r=typeof e;return t=t??xcS,!!t&&(r=="number"||r!="symbol"&&zcS.test(e))&&e>-1&&e%1==0&&e<t}var HFi=QcS;function LcS(e,t,r){t=="__proto__"&&UWa?UWa(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var WNe=LcS;function UcS(e,t){return e===t||e!==e&&t!==t}var srt=UcS;var VcS=Object.prototype,WcS=VcS.hasOwnProperty;function GcS(e,t,r){var n=e[t];(!(WcS.call(e,t)&&srt(n,r))||r===void 0&&!(t in e))&&WNe(e,t,r)}var Veu=GcS;function HcS(e,t,r,n){var i=!r;r||(r={});for(var a=-1,o=t.length;++a<o;){var c=t[a],f=n?n(r[c],e[c],c,r,e):void 0;f===void 0&&(f=e[c]),i?WNe(r,c,f):Veu(r,c,f)}return r}var Unh=HcS;var Vnh=Math.max;function JcS(e,t,r){return t=Vnh(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=Vnh(n.length-t,0),o=Array(a);++i<a;)o[i]=n[t+i];i=-1;for(var c=Array(t+1);++i<t;)c[i]=n[i];return c[t]=r(o),Mnh(e,this,c)}}var Wnh=JcS;function KcS(e,t){return Nnh(Wnh(e,t,QWa),e+"")}var Weu=KcS;var $cS=9007199254740991;function YcS(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=$cS}var VWa=YcS;function XcS(e){return e!=null&&VWa(e.length)&&!LWa(e)}var GNe=XcS;function ZcS(e,t,r){if(!FX(r))return!1;var n=typeof t;return(n=="number"?GNe(r)&&HFi(t,r.length):n=="string"&&t in r)?srt(r[t],e):!1}var Geu=ZcS;function kcS(e){return Weu(function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,o&&Geu(r[0],r[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++n<i;){var c=r[n];c&&e(t,c,n,a)}return t})}var Heu=kcS;var elS=Object.prototype;function tlS(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||elS;return e===r}var JFi=tlS;function rlS(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Gnh=rlS;var nlS="[object Arguments]";function ilS(e){return tve(e)&&EDe(e)==nlS}var vKl=ilS;var Hnh=Object.prototype,alS=Hnh.hasOwnProperty,olS=Hnh.propertyIsEnumerable,slS=vKl((function(){return arguments})())?vKl:function(e){return tve(e)&&alS.call(e,"callee")&&!olS.call(e,"callee")},sBr=slS;function ulS(){return!1}var Jnh=ulS;var Ynh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Knh=Ynh&&typeof module=="object"&&module&&!module.nodeType&&module,clS=Knh&&Knh.exports===Ynh,$nh=clS?Ane.Buffer:void 0,llS=$nh?$nh.isBuffer:void 0,flS=llS||Jnh,emi=flS;var dlS="[object Arguments]",plS="[object Array]",_lS="[object Boolean]",hlS="[object Date]",ylS="[object Error]",vlS="[object Function]",blS="[object Map]",glS="[object Number]",mlS="[object Object]",OlS="[object RegExp]",AlS="[object Set]",PlS="[object String]",wlS="[object WeakMap]",jlS="[object ArrayBuffer]",ElS="[object DataView]",SlS="[object Float32Array]",DlS="[object Float64Array]",ClS="[object Int8Array]",IlS="[object Int16Array]",MlS="[object Int32Array]",BlS="[object Uint8Array]",TlS="[object Uint8ClampedArray]",qlS="[object Uint16Array]",RlS="[object Uint32Array]",mG={};mG[SlS]=mG[DlS]=mG[ClS]=mG[IlS]=mG[MlS]=mG[BlS]=mG[TlS]=mG[qlS]=mG[RlS]=!0;mG[dlS]=mG[plS]=mG[jlS]=mG[_lS]=mG[ElS]=mG[hlS]=mG[ylS]=mG[vlS]=mG[blS]=mG[glS]=mG[mlS]=mG[OlS]=mG[AlS]=mG[PlS]=mG[wlS]=!1;function NlS(e){return tve(e)&&VWa(e.length)&&!!mG[EDe(e)]}var Xnh=NlS;function FlS(e){return function(t){return e(t)}}var Jeu=FlS;var Znh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ILo=Znh&&typeof module=="object"&&module&&!module.nodeType&&module,xlS=ILo&&ILo.exports===Znh,bKl=xlS&&Qeu.process,zlS=(function(){try{var e=ILo&&ILo.require&&ILo.require("util").types;return e||bKl&&bKl.binding&&bKl.binding("util")}catch{}})(),gKl=zlS;var knh=gKl&&gKl.isTypedArray,QlS=knh?Jeu(knh):Xnh,KFi=QlS;var LlS=Object.prototype,UlS=LlS.hasOwnProperty;function VlS(e,t){var r=NL(e),n=!r&&sBr(e),i=!r&&!n&&emi(e),a=!r&&!n&&!i&&KFi(e),o=r||n||i||a,c=o?Gnh(e.length,String):[],f=c.length;for(var u in e)(t||UlS.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||HFi(u,f)))&&c.push(u);return c}var Keu=VlS;function WlS(e,t){return function(r){return e(t(r))}}var $eu=WlS;var GlS=$eu(Object.keys,Object),eih=GlS;var HlS=Object.prototype,JlS=HlS.hasOwnProperty;function KlS(e){if(!JFi(e))return eih(e);var t=[];for(var r in Object(e))JlS.call(e,r)&&r!="constructor"&&t.push(r);return t}var WWa=KlS;function $lS(e){return GNe(e)?Keu(e):WWa(e)}var GWa=$lS;function YlS(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var tih=YlS;var XlS=Object.prototype,ZlS=XlS.hasOwnProperty;function klS(e){if(!FX(e))return tih(e);var t=JFi(e),r=[];for(var n in e)n=="constructor"&&(t||!ZlS.call(e,n))||r.push(n);return r}var rih=klS;function efS(e){return GNe(e)?Keu(e,!0):rih(e)}var HWa=efS;var tfS=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rfS=/^\w*$/;function nfS(e,t){if(NL(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||O2r(e)?!0:rfS.test(e)||!tfS.test(e)||t!=null&&e in Object(t)}var JWa=nfS;var ifS=VNe(Object,"create"),tmi=ifS;function afS(){this.__data__=tmi?tmi(null):{},this.size=0}var nih=afS;function ofS(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var iih=ofS;var sfS="__lodash_hash_undefined__",ufS=Object.prototype,cfS=ufS.hasOwnProperty;function lfS(e){var t=this.__data__;if(tmi){var r=t[e];return r===sfS?void 0:r}return cfS.call(t,e)?t[e]:void 0}var aih=lfS;var ffS=Object.prototype,dfS=ffS.hasOwnProperty;function pfS(e){var t=this.__data__;return tmi?t[e]!==void 0:dfS.call(t,e)}var oih=pfS;var _fS="__lodash_hash_undefined__";function hfS(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=tmi&&t===void 0?_fS:t,this}var sih=hfS;function KWa(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}KWa.prototype.clear=nih;KWa.prototype.delete=iih;KWa.prototype.get=aih;KWa.prototype.has=oih;KWa.prototype.set=sih;var mKl=KWa;function yfS(){this.__data__=[],this.size=0}var uih=yfS;function vfS(e,t){for(var r=e.length;r--;)if(srt(e[r][0],t))return r;return-1}var $Fi=vfS;var bfS=Array.prototype,gfS=bfS.splice;function mfS(e){var t=this.__data__,r=$Fi(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():gfS.call(t,r,1),--this.size,!0}var cih=mfS;function OfS(e){var t=this.__data__,r=$Fi(t,e);return r<0?void 0:t[r][1]}var lih=OfS;function AfS(e){return $Fi(this.__data__,e)>-1}var fih=AfS;function PfS(e,t){var r=this.__data__,n=$Fi(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var dih=PfS;function $Wa(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}$Wa.prototype.clear=uih;$Wa.prototype.delete=cih;$Wa.prototype.get=lih;$Wa.prototype.has=fih;$Wa.prototype.set=dih;var YFi=$Wa;var wfS=VNe(Ane,"Map"),XFi=wfS;function jfS(){this.size=0,this.__data__={hash:new mKl,map:new(XFi||YFi),string:new mKl}}var pih=jfS;function EfS(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var _ih=EfS;function SfS(e,t){var r=e.__data__;return _ih(t)?r[typeof t=="string"?"string":"hash"]:r.map}var ZFi=SfS;function DfS(e){var t=ZFi(this,e).delete(e);return this.size-=t?1:0,t}var hih=DfS;function CfS(e){return ZFi(this,e).get(e)}var yih=CfS;function IfS(e){return ZFi(this,e).has(e)}var vih=IfS;function MfS(e,t){var r=ZFi(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var bih=MfS;function YWa(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}YWa.prototype.clear=pih;YWa.prototype.delete=hih;YWa.prototype.get=yih;YWa.prototype.has=vih;YWa.prototype.set=bih;var ria=YWa;var BfS="Expected a function";function OKl(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(BfS);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(OKl.Cache||ria),r}OKl.Cache=ria;var gih=OKl;var TfS=500;function qfS(e){var t=gih(e,function(n){return r.size===TfS&&r.clear(),n}),r=t.cache;return t}var mih=qfS;var RfS=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,NfS=/\\(\\)?/g,FfS=mih(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(RfS,function(r,n,i,a){t.push(i?a.replace(NfS,"$1"):n||r)}),t}),Oih=FfS;function xfS(e){return e==null?"":vnh(e)}var A2r=xfS;function zfS(e,t){return NL(e)?e:JWa(e,t)?[e]:Oih(A2r(e))}var kFi=zfS;var QfS=1/0;function LfS(e){if(typeof e=="string"||O2r(e))return e;var t=e+"";return t=="0"&&1/e==-QfS?"-0":t}var P2r=LfS;function UfS(e,t){t=kFi(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[P2r(t[r++])];return r&&r==n?e:void 0}var XWa=UfS;function VfS(e,t,r){var n=e==null?void 0:XWa(e,t);return n===void 0?r:n}var Aih=VfS;function WfS(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var ZWa=WfS;var Pih=jDe?jDe.isConcatSpreadable:void 0;function GfS(e){return NL(e)||sBr(e)||!!(Pih&&e&&e[Pih])}var wih=GfS;function jih(e,t,r,n,i){var a=-1,o=e.length;for(r||(r=wih),i||(i=[]);++a<o;){var c=e[a];t>0&&r(c)?t>1?jih(c,t-1,r,n,i):ZWa(i,c):n||(i[i.length]=c)}return i}var Eih=jih;var HfS=$eu(Object.getPrototypeOf,Object),kWa=HfS;var JfS="[object Object]",KfS=Function.prototype,$fS=Object.prototype,Sih=KfS.toString,YfS=$fS.hasOwnProperty,XfS=Sih.call(Object);function ZfS(e){if(!tve(e)||EDe(e)!=JfS)return!1;var t=kWa(e);if(t===null)return!0;var r=YfS.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Sih.call(r)==XfS}var MLo=ZfS;function kfS(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),r=r>i?i:r,r<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++n<i;)a[n]=e[n+t];return a}var Yeu=kfS;function edS(e,t,r){var n=e.length;return r=r===void 0?n:r,!t&&r>=n?e:Yeu(e,t,r)}var Dih=edS;var tdS="\\ud800-\\udfff",rdS="\\u0300-\\u036f",ndS="\\ufe20-\\ufe2f",idS="\\u20d0-\\u20ff",adS=rdS+ndS+idS,odS="\\ufe0e\\ufe0f",sdS="\\u200d",udS=RegExp("["+sdS+tdS+adS+odS+"]");function cdS(e){return udS.test(e)}var eGa=cdS;function ldS(e){return e.split("")}var Cih=ldS;var Iih="\\ud800-\\udfff",fdS="\\u0300-\\u036f",ddS="\\ufe20-\\ufe2f",pdS="\\u20d0-\\u20ff",_dS=fdS+ddS+pdS,hdS="\\ufe0e\\ufe0f",ydS="["+Iih+"]",AKl="["+_dS+"]",PKl="\\ud83c[\\udffb-\\udfff]",vdS="(?:"+AKl+"|"+PKl+")",Mih="[^"+Iih+"]",Bih="(?:\\ud83c[\\udde6-\\uddff]){2}",Tih="[\\ud800-\\udbff][\\udc00-\\udfff]",bdS="\\u200d",qih=vdS+"?",Rih="["+hdS+"]?",gdS="(?:"+bdS+"(?:"+[Mih,Bih,Tih].join("|")+")"+Rih+qih+")*",mdS=Rih+qih+gdS,OdS="(?:"+[Mih+AKl+"?",AKl,Bih,Tih,ydS].join("|")+")",AdS=RegExp(PKl+"(?="+PKl+")|"+OdS+mdS,"g");function PdS(e){return e.match(AdS)||[]}var Nih=PdS;function wdS(e){return eGa(e)?Nih(e):Cih(e)}var Fih=wdS;function jdS(e){return function(t){t=A2r(t);var r=eGa(t)?Fih(t):void 0,n=r?r[0]:t.charAt(0),i=r?Dih(r,1).join(""):t.slice(1);return n[e]()+i}}var xih=jdS;var EdS=xih("toUpperCase"),tU=EdS;function SdS(e){return tU(A2r(e).toLowerCase())}var BLo=SdS;function DdS(e,t,r,n){var i=-1,a=e==null?0:e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}var zih=DdS;function CdS(e){return function(t){return e?.[t]}}var Qih=CdS;var IdS={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},MdS=Qih(IdS),Lih=MdS;var BdS=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,TdS="\\u0300-\\u036f",qdS="\\ufe20-\\ufe2f",RdS="\\u20d0-\\u20ff",NdS=TdS+qdS+RdS,FdS="["+NdS+"]",xdS=RegExp(FdS,"g");function zdS(e){return e=A2r(e),e&&e.replace(BdS,Lih).replace(xdS,"")}var Uih=zdS;var QdS=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function LdS(e){return e.match(QdS)||[]}var Vih=LdS;var UdS=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function VdS(e){return UdS.test(e)}var Wih=VdS;var $ih="\\ud800-\\udfff",WdS="\\u0300-\\u036f",GdS="\\ufe20-\\ufe2f",HdS="\\u20d0-\\u20ff",JdS=WdS+GdS+HdS,Yih="\\u2700-\\u27bf",Xih="a-z\\xdf-\\xf6\\xf8-\\xff",KdS="\\xac\\xb1\\xd7\\xf7",$dS="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",YdS="\\u2000-\\u206f",XdS=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Zih="A-Z\\xc0-\\xd6\\xd8-\\xde",ZdS="\\ufe0e\\ufe0f",kih=KdS+$dS+YdS+XdS,eah="['\u2019]",Gih="["+kih+"]",kdS="["+JdS+"]",tah="\\d+",epS="["+Yih+"]",rah="["+Xih+"]",nah="[^"+$ih+kih+tah+Yih+Xih+Zih+"]",tpS="\\ud83c[\\udffb-\\udfff]",rpS="(?:"+kdS+"|"+tpS+")",npS="[^"+$ih+"]",iah="(?:\\ud83c[\\udde6-\\uddff]){2}",aah="[\\ud800-\\udbff][\\udc00-\\udfff]",tGa="["+Zih+"]",ipS="\\u200d",Hih="(?:"+rah+"|"+nah+")",apS="(?:"+tGa+"|"+nah+")",Jih="(?:"+eah+"(?:d|ll|m|re|s|t|ve))?",Kih="(?:"+eah+"(?:D|LL|M|RE|S|T|VE))?",oah=rpS+"?",sah="["+ZdS+"]?",opS="(?:"+ipS+"(?:"+[npS,iah,aah].join("|")+")"+sah+oah+")*",spS="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",upS="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",cpS=sah+oah+opS,lpS="(?:"+[epS,iah,aah].join("|")+")"+cpS,fpS=RegExp([tGa+"?"+rah+"+"+Jih+"(?="+[Gih,tGa,"$"].join("|")+")",apS+"+"+Kih+"(?="+[Gih,tGa+Hih,"$"].join("|")+")",tGa+"?"+Hih+"+"+Jih,tGa+"+"+Kih,upS,spS,tah,lpS].join("|"),"g");function dpS(e){return e.match(fpS)||[]}var uah=dpS;function ppS(e,t,r){return e=A2r(e),t=r?void 0:t,t===void 0?Wih(e)?uah(e):Vih(e):e.match(t)||[]}var nia=ppS;var _pS="['\u2019]",hpS=RegExp(_pS,"g");function ypS(e){return function(t){return zih(nia(Uih(t).replace(hpS,"")),e,"")}}var exi=ypS;var vpS=exi(function(e,t,r){return t=t.toLowerCase(),e+(r?BLo(t):t)}),$A=vpS;var bpS=Math.ceil,gpS=Math.max;function mpS(e,t,r){(r?Geu(e,t,r):t===void 0)?t=1:t=gpS(wnh(t),0);var n=e==null?0:e.length;if(!n||t<1)return[];for(var i=0,a=0,o=Array(bpS(n/t));i<n;)o[a++]=Yeu(e,i,i+=t);return o}var TLo=mpS;function OpS(){this.__data__=new YFi,this.size=0}var cah=OpS;function ApS(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var lah=ApS;function PpS(e){return this.__data__.get(e)}var fah=PpS;function wpS(e){return this.__data__.has(e)}var dah=wpS;var jpS=200;function EpS(e,t){var r=this.__data__;if(r instanceof YFi){var n=r.__data__;if(!XFi||n.length<jpS-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new ria(n)}return r.set(e,t),this.size=r.size,this}var pah=EpS;function rGa(e){var t=this.__data__=new YFi(e);this.size=t.size}rGa.prototype.clear=cah;rGa.prototype.delete=lah;rGa.prototype.get=fah;rGa.prototype.has=dah;rGa.prototype.set=pah;var txi=rGa;var vah=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_ah=vah&&typeof module=="object"&&module&&!module.nodeType&&module,SpS=_ah&&_ah.exports===vah,hah=SpS?Ane.Buffer:void 0,yah=hah?hah.allocUnsafe:void 0;function DpS(e,t){if(t)return e.slice();var r=e.length,n=yah?yah(r):new e.constructor(r);return e.copy(n),n}var bah=DpS;function CpS(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}var gah=CpS;function IpS(){return[]}var Xeu=IpS;var MpS=Object.prototype,BpS=MpS.propertyIsEnumerable,mah=Object.getOwnPropertySymbols,TpS=mah?function(e){return e==null?[]:(e=Object(e),gah(mah(e),function(t){return BpS.call(e,t)}))}:Xeu,Zeu=TpS;var qpS=Object.getOwnPropertySymbols,RpS=qpS?function(e){for(var t=[];e;)ZWa(t,Zeu(e)),e=kWa(e);return t}:Xeu,Oah=RpS;function NpS(e,t,r){var n=t(e);return NL(e)?n:ZWa(n,r(e))}var keu=NpS;function FpS(e){return keu(e,GWa,Zeu)}var wKl=FpS;function xpS(e){return keu(e,HWa,Oah)}var Aah=xpS;var zpS=VNe(Ane,"DataView"),etu=zpS;var QpS=VNe(Ane,"Promise"),ttu=QpS;var LpS=VNe(Ane,"Set"),rtu=LpS;var Pah="[object Map]",UpS="[object Object]",wah="[object Promise]",jah="[object Set]",Eah="[object WeakMap]",Sah="[object DataView]",VpS=k0i(etu),WpS=k0i(XFi),GpS=k0i(ttu),HpS=k0i(rtu),JpS=k0i(Ueu),iia=EDe;(etu&&iia(new etu(new ArrayBuffer(1)))!=Sah||XFi&&iia(new XFi)!=Pah||ttu&&iia(ttu.resolve())!=wah||rtu&&iia(new rtu)!=jah||Ueu&&iia(new Ueu)!=Eah)&&(iia=function(e){var t=EDe(e),r=t==UpS?e.constructor:void 0,n=r?k0i(r):"";if(n)switch(n){case VpS:return Sah;case WpS:return Pah;case GpS:return wah;case HpS:return jah;case JpS:return Eah}return t});var aia=iia;var KpS=Ane.Uint8Array,nGa=KpS;function $pS(e){var t=new e.constructor(e.byteLength);return new nGa(t).set(new nGa(e)),t}var Dah=$pS;function YpS(e,t){var r=t?Dah(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var Cah=YpS;function XpS(e){return typeof e.constructor=="function"&&!JFi(e)?Inh(kWa(e)):{}}var Iah=XpS;function ZpS(e){for(var t=-1,r=e==null?0:e.length,n=0,i=[];++t<r;){var a=e[t];a&&(i[n++]=a)}return i}var Cdt=ZpS;var kpS="__lodash_hash_undefined__";function e_S(e){return this.__data__.set(e,kpS),this}var Mah=e_S;function t_S(e){return this.__data__.has(e)}var Bah=t_S;function ntu(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new ria;++t<r;)this.add(e[t])}ntu.prototype.add=ntu.prototype.push=Mah;ntu.prototype.has=Bah;var itu=ntu;function r_S(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Tah=r_S;function n_S(e,t){return e.has(t)}var atu=n_S;var i_S=1,a_S=2;function o_S(e,t,r,n,i,a){var o=r&i_S,c=e.length,f=t.length;if(c!=f&&!(o&&f>c))return!1;var u=a.get(e),s=a.get(t);if(u&&s)return u==t&&s==e;var l=-1,m=!0,O=r&a_S?new itu:void 0;for(a.set(e,t),a.set(t,e);++l<c;){var P=e[l],C=t[l];if(n)var I=o?n(C,P,l,t,e,a):n(P,C,l,e,t,a);if(I!==void 0){if(I)continue;m=!1;break}if(O){if(!Tah(t,function(T,z){if(!atu(O,z)&&(P===T||i(P,T,r,n,a)))return O.push(z)})){m=!1;break}}else if(!(P===C||i(P,C,r,n,a))){m=!1;break}}return a.delete(e),a.delete(t),m}var otu=o_S;function s_S(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var qah=s_S;function u_S(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Rah=u_S;var c_S=1,l_S=2,f_S="[object Boolean]",d_S="[object Date]",p_S="[object Error]",__S="[object Map]",h_S="[object Number]",y_S="[object RegExp]",v_S="[object Set]",b_S="[object String]",g_S="[object Symbol]",m_S="[object ArrayBuffer]",O_S="[object DataView]",Nah=jDe?jDe.prototype:void 0,jKl=Nah?Nah.valueOf:void 0;function A_S(e,t,r,n,i,a,o){switch(r){case O_S:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case m_S:return!(e.byteLength!=t.byteLength||!a(new nGa(e),new nGa(t)));case f_S:case d_S:case h_S:return srt(+e,+t);case p_S:return e.name==t.name&&e.message==t.message;case y_S:case b_S:return e==t+"";case __S:var c=qah;case v_S:var f=n&c_S;if(c||(c=Rah),e.size!=t.size&&!f)return!1;var u=o.get(e);if(u)return u==t;n|=l_S,o.set(e,t);var s=otu(c(e),c(t),n,i,a,o);return o.delete(e),s;case g_S:if(jKl)return jKl.call(e)==jKl.call(t)}return!1}var Fah=A_S;var P_S=1,w_S=Object.prototype,j_S=w_S.hasOwnProperty;function E_S(e,t,r,n,i,a){var o=r&P_S,c=wKl(e),f=c.length,u=wKl(t),s=u.length;if(f!=s&&!o)return!1;for(var l=f;l--;){var m=c[l];if(!(o?m in t:j_S.call(t,m)))return!1}var O=a.get(e),P=a.get(t);if(O&&P)return O==t&&P==e;var C=!0;a.set(e,t),a.set(t,e);for(var I=o;++l<f;){m=c[l];var T=e[m],z=t[m];if(n)var U=o?n(z,T,m,t,e,a):n(T,z,m,e,t,a);if(!(U===void 0?T===z||i(T,z,r,n,a):U)){C=!1;break}I||(I=m=="constructor")}if(C&&!I){var q=e.constructor,V=t.constructor;q!=V&&"constructor"in e&&"constructor"in t&&!(typeof q=="function"&&q instanceof q&&typeof V=="function"&&V instanceof V)&&(C=!1)}return a.delete(e),a.delete(t),C}var xah=E_S;var S_S=1,zah="[object Arguments]",Qah="[object Array]",stu="[object Object]",D_S=Object.prototype,Lah=D_S.hasOwnProperty;function C_S(e,t,r,n,i,a){var o=NL(e),c=NL(t),f=o?Qah:aia(e),u=c?Qah:aia(t);f=f==zah?stu:f,u=u==zah?stu:u;var s=f==stu,l=u==stu,m=f==u;if(m&&emi(e)){if(!emi(t))return!1;o=!0,s=!1}if(m&&!s)return a||(a=new txi),o||KFi(e)?otu(e,t,r,n,i,a):Fah(e,t,f,r,n,i,a);if(!(r&S_S)){var O=s&&Lah.call(e,"__wrapped__"),P=l&&Lah.call(t,"__wrapped__");if(O||P){var C=O?e.value():e,I=P?t.value():t;return a||(a=new txi),i(C,I,r,n,a)}}return m?(a||(a=new txi),xah(e,t,r,n,i,a)):!1}var Uah=C_S;function Vah(e,t,r,n,i){return e===t?!0:e==null||t==null||!tve(e)&&!tve(t)?e!==e&&t!==t:Uah(e,t,r,n,Vah,i)}var rxi=Vah;var I_S=1,M_S=2;function B_S(e,t,r,n){var i=r.length,a=i,o=!n;if(e==null)return!a;for(e=Object(e);i--;){var c=r[i];if(o&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++i<a;){c=r[i];var f=c[0],u=e[f],s=c[1];if(o&&c[2]){if(u===void 0&&!(f in e))return!1}else{var l=new txi;if(n)var m=n(u,s,f,e,t,l);if(!(m===void 0?rxi(s,u,I_S|M_S,n,l):m))return!1}}return!0}var Wah=B_S;function T_S(e){return e===e&&!FX(e)}var utu=T_S;function q_S(e){for(var t=GWa(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,utu(i)]}return t}var Gah=q_S;function R_S(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var ctu=R_S;function N_S(e){var t=Gah(e);return t.length==1&&t[0][2]?ctu(t[0][0],t[0][1]):function(r){return r===e||Wah(r,e,t)}}var Hah=N_S;function F_S(e,t){return e!=null&&t in Object(e)}var Jah=F_S;function x_S(e,t,r){t=kFi(t,e);for(var n=-1,i=t.length,a=!1;++n<i;){var o=P2r(t[n]);if(!(a=e!=null&&r(e,o)))break;e=e[o]}return a||++n!=i?a:(i=e==null?0:e.length,!!i&&VWa(i)&&HFi(o,i)&&(NL(e)||sBr(e)))}var Kah=x_S;function z_S(e,t){return e!=null&&Kah(e,t,Jah)}var $ah=z_S;var Q_S=1,L_S=2;function U_S(e,t){return JWa(e)&&utu(t)?ctu(P2r(e),t):function(r){var n=Aih(r,e);return n===void 0&&n===t?$ah(r,e):rxi(t,n,Q_S|L_S)}}var Yah=U_S;function V_S(e){return function(t){return t?.[e]}}var ltu=V_S;function W_S(e){return function(t){return XWa(t,e)}}var Xah=W_S;function G_S(e){return JWa(e)?ltu(P2r(e)):Xah(e)}var Zah=G_S;function H_S(e){return typeof e=="function"?e:e==null?QWa:typeof e=="object"?NL(e)?Yah(e[0],e[1]):Hah(e):Zah(e)}var Idt=H_S;function J_S(e,t,r,n){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(n,o,r(o),e)}return n}var kah=J_S;function K_S(e){return function(t,r,n){for(var i=-1,a=Object(t),o=n(t),c=o.length;c--;){var f=o[e?c:++i];if(r(a[f],f,a)===!1)break}return t}}var eoh=K_S;var $_S=eoh(),ftu=$_S;function Y_S(e,t){return e&&ftu(e,t,GWa)}var iGa=Y_S;function X_S(e,t){return function(r,n){if(r==null)return r;if(!GNe(r))return e(r,n);for(var i=r.length,a=t?i:-1,o=Object(r);(t?a--:++a<i)&&n(o[a],a,o)!==!1;);return r}}var toh=X_S;var Z_S=toh(iGa),roh=Z_S;function k_S(e,t,r,n){return roh(e,function(i,a,o){t(n,i,r(i),o)}),n}var noh=k_S;function ehS(e,t){return function(r,n){var i=NL(r)?kah:noh,a=t?t():{};return i(r,e,Idt(n,2),a)}}var dtu=ehS;function thS(e,t,r){(r!==void 0&&!srt(e[t],r)||r===void 0&&!(t in e))&&WNe(e,t,r)}var qLo=thS;function rhS(e){return tve(e)&&GNe(e)}var RLo=rhS;function nhS(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var NLo=nhS;function ihS(e){return Unh(e,HWa(e))}var ioh=ihS;function ahS(e,t,r,n,i,a,o){var c=NLo(e,r),f=NLo(t,r),u=o.get(f);if(u){qLo(e,r,u);return}var s=a?a(c,f,r+"",e,t,o):void 0,l=s===void 0;if(l){var m=NL(f),O=!m&&emi(f),P=!m&&!O&&KFi(f);s=f,m||O||P?NL(c)?s=c:RLo(c)?s=Bnh(c):O?(l=!1,s=bah(f,!0)):P?(l=!1,s=Cah(f,!0)):s=[]:MLo(f)||sBr(f)?(s=c,sBr(c)?s=ioh(c):(!FX(c)||LWa(c))&&(s=Iah(f))):l=!1}l&&(o.set(f,s),i(s,f,n,a,o),o.delete(f)),qLo(e,r,s)}var aoh=ahS;function ooh(e,t,r,n,i){e!==t&&ftu(t,function(a,o){if(i||(i=new txi),FX(a))aoh(e,t,o,r,ooh,n,i);else{var c=n?n(NLo(e,o),a,o+"",e,t,i):void 0;c===void 0&&(c=a),qLo(e,o,c)}},HWa)}var ptu=ooh;var ohS=Heu(function(e,t,r,n){ptu(e,t,r,n)}),aGa=ohS;function shS(e,t,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}var soh=shS;var uhS=200;function chS(e,t,r,n){var i=-1,a=Lnh,o=!0,c=e.length,f=[],u=t.length;if(!c)return f;r&&(t=zWa(t,Jeu(r))),n?(a=soh,o=!1):t.length>=uhS&&(a=atu,o=!1,t=new itu(t));e:for(;++i<c;){var s=e[i],l=r==null?s:r(s);if(s=n||s!==0?s:0,o&&l===l){for(var m=u;m--;)if(t[m]===l)continue e;f.push(s)}else a(t,l,n)||f.push(s)}return f}var uoh=chS;var lhS=Weu(function(e,t){return RLo(e)?uoh(e,Eih(t,1,RLo,!0)):[]}),_tu=lhS;function fhS(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var EKl=fhS;var dhS=Object.prototype,phS=dhS.hasOwnProperty,_hS=dtu(function(e,t,r){phS.call(e,r)?e[r].push(t):WNe(e,r,[t])}),SKl=_hS;function hhS(e,t){return e>t}var coh=hhS;var yhS="[object String]";function vhS(e){return typeof e=="string"||!NL(e)&&tve(e)&&EDe(e)==yhS}var loh=vhS;var bhS="[object Map]",ghS="[object Set]",mhS=Object.prototype,OhS=mhS.hasOwnProperty;function AhS(e){if(e==null)return!0;if(GNe(e)&&(NL(e)||typeof e=="string"||typeof e.splice=="function"||emi(e)||KFi(e)||sBr(e)))return!e.length;var t=aia(e);if(t==bhS||t==ghS)return!e.size;if(JFi(e))return!WWa(e).length;for(var r in e)if(OhS.call(e,r))return!1;return!0}var DKl=AhS;function PhS(e,t){return rxi(e,t)}var ose=PhS;function whS(e,t,r){r=typeof r=="function"?r:void 0;var n=r?r(e,t):void 0;return n===void 0?rxi(e,t,void 0,r):!!n}var w2r=whS;function jhS(e){return e===null}var CKl=jhS;var EhS=exi(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),u$=EhS;var ShS=dtu(function(e,t,r){WNe(e,r,t)}),IKl=ShS;function DhS(e,t){var r={};return t=Idt(t,3),iGa(e,function(n,i,a){WNe(r,t(n,i,a),n)}),r}var FLo=DhS;function ChS(e,t){var r={};return t=Idt(t,3),iGa(e,function(n,i,a){WNe(r,i,t(n,i,a))}),r}var Bg=ChS;function IhS(e,t,r){for(var n=-1,i=e.length;++n<i;){var a=e[n],o=t(a);if(o!=null&&(c===void 0?o===o&&!O2r(o):r(o,c)))var c=o,f=a}return f}var foh=IhS;function MhS(e,t){return e&&e.length?foh(e,Idt(t,2),coh):void 0}var MKl=MhS;var BhS=Heu(function(e,t,r){ptu(e,t,r)}),BKl=BhS;var ThS="Expected a function";function qhS(e){if(typeof e!="function")throw new TypeError(ThS);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}var doh=qhS;function RhS(e,t,r,n){if(!FX(e))return e;t=kFi(t,e);for(var i=-1,a=t.length,o=a-1,c=e;c!=null&&++i<a;){var f=P2r(t[i]),u=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return e;if(i!=o){var s=c[f];u=n?n(s,f,c):void 0,u===void 0&&(u=FX(s)?s:HFi(t[i+1])?[]:{})}Veu(c,f,u),c=c[f]}return e}var poh=RhS;function NhS(e,t,r){for(var n=-1,i=t.length,a={};++n<i;){var o=t[n],c=XWa(e,o);r(c,o)&&poh(a,kFi(o,e),c)}return a}var _oh=NhS;function FhS(e,t){if(e==null)return{};var r=zWa(Aah(e),function(n){return[n]});return t=Idt(t),_oh(e,r,function(n,i){return t(n,i[0])})}var oia=FhS;function xhS(e,t){return oia(e,doh(Idt(t)))}var TKl=xhS;var zhS=ltu("length"),hoh=zhS;var voh="\\ud800-\\udfff",QhS="\\u0300-\\u036f",LhS="\\ufe20-\\ufe2f",UhS="\\u20d0-\\u20ff",VhS=QhS+LhS+UhS,WhS="\\ufe0e\\ufe0f",GhS="["+voh+"]",qKl="["+VhS+"]",RKl="\\ud83c[\\udffb-\\udfff]",HhS="(?:"+qKl+"|"+RKl+")",boh="[^"+voh+"]",goh="(?:\\ud83c[\\udde6-\\uddff]){2}",moh="[\\ud800-\\udbff][\\udc00-\\udfff]",JhS="\\u200d",Ooh=HhS+"?",Aoh="["+WhS+"]?",KhS="(?:"+JhS+"(?:"+[boh,goh,moh].join("|")+")"+Aoh+Ooh+")*",$hS=Aoh+Ooh+KhS,YhS="(?:"+[boh+qKl+"?",qKl,goh,moh,GhS].join("|")+")",yoh=RegExp(RKl+"(?="+RKl+")|"+YhS+$hS,"g");function XhS(e){for(var t=yoh.lastIndex=0;yoh.test(e);)++t;return t}var Poh=XhS;function ZhS(e){return eGa(e)?Poh(e):hoh(e)}var woh=ZhS;var khS="[object Map]",eyS="[object Set]";function tyS(e){if(e==null)return 0;if(GNe(e))return loh(e)?woh(e):e.length;var t=aia(e);return t==khS||t==eyS?e.size:WWa(e).length}var q8=tyS;var ryS=exi(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),sia=ryS;var nyS=exi(function(e,t,r){return e+(r?" ":"")+tU(t)}),uia=nyS;function FKl({data:e,overrides:t,allowNullKeys:r}){let n=aGa(e,aGa,t,(a,o)=>Array.isArray(a)&&Array.isArray(o)?o.every(c=>typeof c=="object")&&a.every(c=>typeof c=="object")?void 0:[...o]:void 0);return NKl(n,CKl,{ancestorKeys:r??[],allowOmissionCursor:!1})}var NKl=(e,t,r)=>{function n(i){if(Array.isArray(i))return i.map(a=>NKl(a,t,r));if(MLo(i)){let a={};for(let[o,c]of Object.entries(i))a[o]=NKl(c,t,r!=null&&(r.allowOmissionCursor||r.ancestorKeys.includes(o))?{...r,allowOmissionCursor:!0}:r);return r==null||!r?.allowOmissionCursor?TKl(a,t):a}return i}return n(e)};function Tc(){}function xKl(e){return hj(e)?e:void 0}function zKl(e){return iyS(e,t=>!hj(t),void 0)}function QKl(...e){let t=e.filter(r=>!hj(r)).length;return t===0||t===e.length}function iyS(e,t,r){return Object.entries(e).some(([,a])=>t(a))?r:e}function uBr(e){return Object.keys(e)}function dN(e,t){for(let r of uBr(t))t[r](e[r])}async function j2r(e,t){for(let r of uBr(t))await t[r](e[r])}function Vk(e){return Object.entries(e)}function QD(e){if(!ayS(e)||toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)==null)return!0;let t=e;for(;Object.getPrototypeOf(t)!=null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ayS(e){return typeof e=="object"&&e!=null}function joh(e,t){e=Object(e);let r={};return Object.keys(e).forEach(n=>{r[n]=t(e[n],n,e)}),r}function LKl(e){let[t,r]=e.split(" ");if(!t||!["POST","GET","PUT","PATCH","DELETE"].includes(t))return{type:"failure",message:`${e} contains invalid method ${t}`};if(!r)return{type:"failure",message:`${e} contains no path ${r}`};let n=new Set,i=/{([^}]+)}/g,a;for(;(a=i.exec(r))!=null;){let o=a[1];o!=null&&n.add(o)}return{type:"success",method:t,path:r,pathParameters:n}}function htu({value:e,suffix:t}){return e.endsWith(t)?e.substring(0,e.length-t.length):e}var oyS=/\$\{(\w+)\}/g;function nxi(e,t,r={}){return typeof e=="string"?e.replace(oyS,(a,o)=>{if(r.substituteAsEmpty)return"";let c=process.env[o];return c==null&&t.onError(`Environment variable ${o} is not defined.`),c??""}):QD(e)?joh(e,i=>nxi(i,t,r)):e}var s$l=$i(rmi(),1);function o$l(e){let t=s$l.default.parse(e);if(t===null)throw new Error(`Invalid semver: ${e}`);return t}function u$l(e,t){let r=typeof e=="string"?o$l(e):e,n=typeof t=="string"?o$l(t):t;if(r>n)throw new Error("From semver must be less than or equal to to semver");return s$l.default.diff(r,n)}function dAe(e){return e?.replace(/^\/+/,"")}var guh=$i(GLo(),1);function Ctu(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,guh.default)(e,{special:fgS}).replace(/V\s(\d)/g,"V$1")}var fgS=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];var Klh=$i(Glh(),1);function JYl(e){return typeof e=="object"&&e!==null&&("oneOf"in e||"anyOf"in e)}function Hlh(e){return typeof e=="object"&&e!==null&&"$ref"in e}function FPS(e){return typeof e=="object"&&e!==null}function xPS(e){return typeof e=="object"&&e!==null&&"additionalProperty"in e}function zPS(e){return typeof e=="object"&&e!==null&&"missingProperty"in e}function urt(e,t){if(!e&&!t)return"$";let r=e.split("/").filter(n=>n!=="");return t&&r.push(t),r.length===0?"$":"$"+r.map(n=>{let i=n.replace(/~1/g,"/").replace(/~0/g,"~");return/^\d+$/.test(i)?`[${i}]`:/[.[\]']/.test(i)?`['${i.replace(/'/g,"\\'")}']`:`.${i}`}).join("")}function QPS(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function fru(e,t){try{let r=t.split("/").filter(i=>i!==""),n=e;for(let i of r){let a=i.replace(/~1/g,"/").replace(/~0/g,"~");if(Array.isArray(n)){let o=parseInt(a,10);if(!isNaN(o))n=n[o];else return}else if(typeof n=="object"&&n!=null)n=n[a];else return}return n}catch{return}}function KYl(e){if(typeof e!="object"||e===null)return"";let r=Object.keys(e);return r.length===0?" (empty object)":` (has properties: ${r.join(", ")})`}function YYl(e,t){if(typeof e!="object"||e===null||typeof t!="object"||t===null)return{missing:0,extra:0,total:0};let r=e,n=new Set(Object.keys(r)),i=new Set,a=new Set;t.properties&&typeof t.properties=="object"&&Object.keys(t.properties).forEach(f=>i.add(f)),Array.isArray(t.required)&&t.required.forEach(f=>a.add(f));let o=0;for(let f of a)n.has(f)||o++;let c=0;for(let f of n)i.has(f)||c++;return{missing:o,extra:c,total:o+c}}function $Yl(e,t){if(typeof e!="object"||e===null||!Array.isArray(t)||t.length===0)return null;let r=null;for(let n of t)if(n.type==="object"&&n.properties){let i=YYl(e,n);(r===null||LPS(i,r.differences))&&(r={schema:n,differences:i})}return r}function LPS(e,t){return e.missing===0&&t.missing>0?!0:e.missing>0&&t.missing===0?!1:e.missing!==t.missing?e.missing<t.missing:e.total<t.total}function UPS(e,t){let r=e.instancePath.split("/").length,n=t.instancePath.split("/").length,i=e.keyword==="oneOf"||e.keyword==="anyOf",a=t.keyword==="oneOf"||t.keyword==="anyOf",o=Jlh(e),c=Jlh(t);return!i&&a?!0:i&&!a?!1:o>=9&&c<9?!0:c>=9&&o<9?!1:r>n?!0:r<n?!1:o>c}function Jlh(e){switch(e.keyword){case"additionalProperties":return 10;case"required":return 9;case"type":return 8;case"enum":return 7;case"format":return 6;case"pattern":return 6;case"const":return 4;case"minimum":case"maximum":case"minLength":case"maxLength":return 5;case"oneOf":case"anyOf":return 3;default:return 1}}function crt(e,t){if(!t)return e;let r=e.match(/at path (\$[^\s]+)/),n=r?r[1]:"";if(n){let i=n.replace(/^\$/,"").replace(/\[(\d+)\]/g,"/$1").replace(/\.([^[\]]+)/g,"/$1");return`${e} at ${i} (in ${t})`}return`${e} (in ${t})`}function m9o(e,t){if(typeof e!="object"||e===null||!t.schema.properties)return"";let r=e,n=new Set(Object.keys(r)),i=new Set,a=new Set;t.schema.properties&&Object.keys(t.schema.properties).forEach(u=>i.add(u)),Array.isArray(t.schema.required)&&t.schema.required.forEach(u=>a.add(u));let o=[],c=[];for(let u of a)n.has(u)||o.push(u);for(let u of n)i.has(u)||c.push(u);let f=[];return o.length>0&&f.push(`add ${o.map(u=>`'${u}'`).join(", ")}`),c.length>0&&f.push(`remove ${c.map(u=>`'${u}'`).join(", ")}`),f.length>0?`
2080
2080
  Did you mean to ${f.join(" and ")}?`:""}function pBr(e,t,r){let i=new Klh.default({allErrors:!0,allowUnionTypes:!0}).compile(t);if(i(e))return{success:!0,data:e};if(i.errors?.[0]!=null)try{let o=i.errors[0],c=new Map;for(let l of i.errors??[]){let m=l.instancePath;c.has(m)||c.set(m,[]),c.get(m)?.push(l)}for(let l of i.errors??[])UPS(l,o)&&(o=l);if(o.keyword==="additionalProperties"){if(!xPS(o.params))throw new Error("additionalProperties error missing expected params");let l=o.params.additionalProperty,m=urt(o.instancePath,l),O=fru(e,o.instancePath),P=KYl(O);if((c.get(o.instancePath)||[]).some(U=>U.keyword==="oneOf"||U.keyword==="anyOf")&&typeof O=="object"&&O!==null){let U="",q=(i.errors??[]).filter(re=>re.keyword==="oneOf"||re.keyword==="anyOf"),V=q.find(re=>re.instancePath===o.instancePath);if(q.length>0){let re=V||q[0],Y=null;if(re?.schema&&JYl(re.schema)&&(Y=re.schema.oneOf||re.schema.anyOf||null),!Y&&re?.schemaPath){let k=re.schemaPath.replace("#/","").split("/"),ne=t;for(let me of k)if(ne&&typeof ne=="object"&&me in ne){let _e=ne[me];if(typeof _e=="object"&&_e!==null)ne=_e;else{ne=null;break}}else{ne=null;break}Array.isArray(ne)&&(Y=ne.map(me=>{if(Hlh(me)&&me.$ref){let _e=me.$ref.replace("#/","").split("/"),ve=t;for(let pe of _e)if(ve&&typeof ve=="object"&&pe in ve){let De=ve[pe];if(typeof De=="object"&&De!==null)ve=De;else{ve=null;break}}else{ve=null;break}return ve}return typeof me=="object"&&me!==null?me:null}).filter(me=>me!==null))}if(!Y&&o.instancePath.includes("/navigation/")&&FPS(t)&&t.definitions){let k=t.definitions["docs.NavigationItem"];JYl(k)&&k.anyOf&&(Y=k.anyOf.map(me=>{if(Hlh(me)&&me.$ref){let _e=me.$ref.replace("#/","").split("/"),ve=t;for(let pe of _e)if(ve&&typeof ve=="object"&&pe in ve){let De=ve[pe];if(typeof De=="object"&&De!==null)ve=De;else{ve=null;break}}else{ve=null;break}return ve}return typeof me=="object"&&me!==null?me:null}).filter(me=>me!==null))}if(Array.isArray(Y)){let k=$Yl(O,Y);k&&k.differences.total<=2&&(U=m9o(O,k))}}else if(t.oneOf||t.anyOf){let re=t.oneOf||t.anyOf;if(Array.isArray(re)){let Y=$Yl(O,re);Y&&Y.differences.total<=2&&(U=m9o(O,Y))}}let $=`Invalid object at path ${urt(o.instancePath)}: does not match any allowed schema${P}${U}`;return{success:!1,error:{...o,message:crt($,r?.filePath)},allErrors:i.errors??[]}}let T="";if(typeof O=="object"&&O!==null&&t.type==="object"&&t.properties){let U=YYl(O,t);U.total<=2&&(T=m9o(O,{schema:t,differences:U}))}let z=`Unexpected property '${l}' at path ${m}${P}${T}`;return{success:!1,error:{...o,message:crt(z,r?.filePath)},allErrors:i.errors??[]}}else if(o.keyword==="required"){if(!zPS(o.params))throw new Error("required error missing expected params");let l=o.params.missingProperty,m=urt(o.instancePath,l),O=fru(e,o.instancePath),P=KYl(O),C="";if(typeof O=="object"&&O!==null&&t.type==="object"&&t.properties){let T=YYl(O,t);T.total<=2&&(C=m9o(O,{schema:t,differences:T}))}let I=`Missing required property '${l}' at path ${m}${P}${C}`;return{success:!1,error:{...o,message:crt(I,r?.filePath)},allErrors:i.errors??[]}}else if(o.keyword==="type"){let l=Array.isArray(o.params.type)?o.params.type.join(" or "):o.params.type,m=urt(o.instancePath),O=fru(e,o.instancePath),P=QPS(O),C=`Incorrect type at path ${m}: expected ${l} but received ${P}`;return{success:!1,error:{...o,message:crt(C,r?.filePath)},allErrors:i.errors??[]}}else if(o.keyword==="enum"){let m=`Invalid value at path ${urt(o.instancePath)}: must be one of [${o.params.allowedValues.join(", ")}]`;return{success:!1,error:{...o,message:crt(m,r?.filePath)},allErrors:i.errors??[]}}else if(o.keyword==="format"){let m=`Invalid format at path ${urt(o.instancePath)}: must be a valid ${o.params.format}`;return{success:!1,error:{...o,message:crt(m,r?.filePath)},allErrors:i.errors??[]}}else if(o.keyword==="pattern"){let m=`Invalid format at path ${urt(o.instancePath)}: must match pattern ${o.params.pattern}`;return{success:!1,error:{...o,message:crt(m,r?.filePath)},allErrors:i.errors??[]}}else if(o.keyword==="oneOf"||o.keyword==="anyOf"){let l=urt(o.instancePath),m=fru(e,o.instancePath),O=KYl(m),P="";if(typeof m=="object"&&m!==null){let I=null;if(o.schema&&JYl(o.schema)&&(I=o.schema.oneOf||o.schema.anyOf||null),!I&&(t.oneOf||t.anyOf)&&(I=t.oneOf||t.anyOf||null),!I&&o.instancePath){let T=o.instancePath.split("/").filter(U=>U),z=t;for(let U of T){let q=U.replace(/~1/g,"/").replace(/~0/g,"~");if(z.properties&&z.properties[q]?z=z.properties[q]:(z.items&&/^\d+$/.test(q)||z.items&&typeof z.items=="object")&&(z=z.items),z.anyOf||z.oneOf){I=z.anyOf||z.oneOf;break}}}if(Array.isArray(I)){let T=$Yl(m,I);T&&T.differences.total<=2&&(P=m9o(m,T))}}let C=`Invalid object at path ${l}: does not match any allowed schema${O}${P}`;return{success:!1,error:{...o,message:crt(C,r?.filePath)},allErrors:i.errors??[]}}else if(o.keyword==="maximum"){let m=`Value at path ${urt(o.instancePath)} must be less than or equal to ${o.params.limit}`;return{success:!1,error:{...o,message:crt(m,r?.filePath)},allErrors:i.errors??[]}}else if(o.keyword==="minimum"){let m=`Value at path ${urt(o.instancePath)} must be greater than or equal to ${o.params.limit}`;return{success:!1,error:{...o,message:crt(m,r?.filePath)},allErrors:i.errors??[]}}else if(o.keyword==="maxLength"){let m=`Value at path ${urt(o.instancePath)} must be no longer than ${o.params.limit} characters`;return{success:!1,error:{...o,message:crt(m,r?.filePath)},allErrors:i.errors??[]}}else if(o.keyword==="minLength"){let m=`Value at path ${urt(o.instancePath)} must be at least ${o.params.limit} characters`;return{success:!1,error:{...o,message:crt(m,r?.filePath)},allErrors:i.errors??[]}}let f=urt(o.instancePath),s=`Validation failed${f!=="$"?` at path ${f}`:""}`;return{success:!1,error:{...o,message:crt(s,r?.filePath)},allErrors:i.errors??[]}}catch{return{success:!1,error:{message:"Failed to parse because JSON schema validation failed",...i.errors[0]},allErrors:i.errors??[]}}else return{success:!1,error:void 0,allErrors:[]}}function mia(e,t="type"){return{_visit:r=>{let n=r[e[t]];return n!=null?n(e):(r._other==null&&ku(e),r._other(e))}}}var ive="fern",Pne="definition",O9o="openapi",$lh="changelog",XYl="asyncapi",Gk="api.yml",Oia="__package__",PF=`${Oia}.yml`,dru="dependencies.yml",c$="generators.yml",pru="generators.yaml",Ylh="dependencies.yml",ave="docs.yml",XNe="fern.config.json",ZYl="api",_ru=".fernignore";var Xlh="snippet-templates.json";var hru="default-group";var umi="apis",A9o="local";var nl={};yf(nl,{BRAND:()=>hwS,DIRTY:()=>Aia,EMPTY_PATH:()=>JPS,INVALID:()=>aD,NEVER:()=>kwS,OK:()=>yAe,ParseStatus:()=>ove,Schema:()=>hR,ZodAny:()=>pxi,ZodArray:()=>dmi,ZodBigInt:()=>wia,ZodBoolean:()=>jia,ZodBranded:()=>w9o,ZodCatch:()=>Nia,ZodDate:()=>Eia,ZodDefault:()=>Ria,ZodDiscriminatedUnion:()=>bru,ZodEffects:()=>zdt,ZodEnum:()=>Tia,ZodError:()=>ZNe,ZodFirstPartyTypeKind:()=>LD,ZodFunction:()=>mru,ZodIntersection:()=>Iia,ZodIssueCode:()=>Ry,ZodLazy:()=>Mia,ZodLiteral:()=>Bia,ZodMap:()=>DGa,ZodNaN:()=>IGa,ZodNativeEnum:()=>qia,ZodNever:()=>_Br,ZodNull:()=>Dia,ZodNullable:()=>T2r,ZodNumber:()=>Pia,ZodObject:()=>kNe,ZodOptional:()=>Fdt,ZodParsedType:()=>yA,ZodPipeline:()=>j9o,ZodPromise:()=>_xi,ZodReadonly:()=>Fia,ZodRecord:()=>gru,ZodSchema:()=>hR,ZodSet:()=>CGa,ZodString:()=>dxi,ZodSymbol:()=>EGa,ZodTransformer:()=>zdt,ZodTuple:()=>B2r,ZodType:()=>hR,ZodUndefined:()=>Sia,ZodUnion:()=>Cia,ZodUnknown:()=>fmi,ZodVoid:()=>SGa,addIssueToContext:()=>Hm,any:()=>wwS,array:()=>DwS,bigint:()=>gwS,boolean:()=>ufh,coerce:()=>ZwS,custom:()=>afh,date:()=>mwS,datetimeRegex:()=>nfh,defaultErrorMap:()=>cmi,discriminatedUnion:()=>BwS,effect:()=>WwS,enum:()=>LwS,function:()=>xwS,getErrorMap:()=>PGa,getParsedType:()=>M2r,instanceof:()=>vwS,intersection:()=>TwS,isAborted:()=>yru,isAsync:()=>wGa,isDirty:()=>vru,isValid:()=>fxi,late:()=>ywS,lazy:()=>zwS,literal:()=>QwS,makeIssue:()=>P9o,map:()=>NwS,nan:()=>bwS,nativeEnum:()=>UwS,never:()=>EwS,null:()=>PwS,nullable:()=>HwS,number:()=>sfh,object:()=>CwS,objectUtil:()=>kYl,oboolean:()=>XwS,onumber:()=>YwS,optional:()=>GwS,ostring:()=>$wS,pipeline:()=>KwS,preprocess:()=>JwS,promise:()=>VwS,quotelessJson:()=>WPS,record:()=>RwS,set:()=>FwS,setErrorMap:()=>HPS,strictObject:()=>IwS,string:()=>ofh,symbol:()=>OwS,transformer:()=>WwS,tuple:()=>qwS,undefined:()=>AwS,union:()=>MwS,unknown:()=>jwS,util:()=>Mx,void:()=>SwS});var Mx;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},e.getValidEnumValues=i=>{let a=e.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),o={};for(let c of a)o[c]=i[c];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(a){return i[a]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},e.find=(i,a)=>{for(let o of i)if(a(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Mx||(Mx={}));var kYl;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(kYl||(kYl={}));var yA=Mx.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),M2r=e=>{switch(typeof e){case"undefined":return yA.undefined;case"string":return yA.string;case"number":return Number.isNaN(e)?yA.nan:yA.number;case"boolean":return yA.boolean;case"function":return yA.function;case"bigint":return yA.bigint;case"symbol":return yA.symbol;case"object":return Array.isArray(e)?yA.array:e===null?yA.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?yA.promise:typeof Map<"u"&&e instanceof Map?yA.map:typeof Set<"u"&&e instanceof Set?yA.set:typeof Date<"u"&&e instanceof Date?yA.date:yA.object;default:return yA.unknown}};var Ry=Mx.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),WPS=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZNe=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let c=n,f=0;for(;f<o.path.length;){let u=o.path[f];f===o.path.length-1?(c[u]=c[u]||{_errors:[]},c[u]._errors.push(r(o))):c[u]=c[u]||{_errors:[]},c=c[u],f++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Mx.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ZNe.create=e=>new ZNe(e);var GPS=(e,t)=>{let r;switch(e.code){case Ry.invalid_type:e.received===yA.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ry.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Mx.jsonStringifyReplacer)}`;break;case Ry.unrecognized_keys:r=`Unrecognized key(s) in object: ${Mx.joinValues(e.keys,", ")}`;break;case Ry.invalid_union:r="Invalid input";break;case Ry.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Mx.joinValues(e.options)}`;break;case Ry.invalid_enum_value:r=`Invalid enum value. Expected ${Mx.joinValues(e.options)}, received '${e.received}'`;break;case Ry.invalid_arguments:r="Invalid function arguments";break;case Ry.invalid_return_type:r="Invalid function return type";break;case Ry.invalid_date:r="Invalid date";break;case Ry.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Mx.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Ry.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Ry.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Ry.custom:r="Invalid input";break;case Ry.invalid_intersection_types:r="Intersection results could not be merged";break;case Ry.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ry.not_finite:r="Number must be finite";break;default:r=t.defaultError,Mx.assertNever(e)}return{message:r}},cmi=GPS;var Zlh=cmi;function HPS(e){Zlh=e}function PGa(){return Zlh}var P9o=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let c="",f=n.filter(u=>!!u).slice().reverse();for(let u of f)c=u(o,{data:t,defaultError:c}).message;return{...i,path:a,message:c}},JPS=[];function Hm(e,t){let r=PGa(),n=P9o({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===cmi?void 0:cmi].filter(i=>!!i)});e.common.issues.push(n)}var ove=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return aD;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return aD;a.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:t.value,value:n}}},aD=Object.freeze({status:"aborted"}),Aia=e=>({status:"dirty",value:e}),yAe=e=>({status:"valid",value:e}),yru=e=>e.status==="aborted",vru=e=>e.status==="dirty",fxi=e=>e.status==="valid",wGa=e=>typeof Promise<"u"&&e instanceof Promise;var Dj;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Dj||(Dj={}));var xdt=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},klh=(e,t)=>{if(fxi(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ZNe(e.common.issues);return this._error=r,this._error}}};function MT(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,c)=>{let{message:f}=e;return o.code==="invalid_enum_value"?{message:f??c.defaultError}:typeof c.data>"u"?{message:f??n??c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:f??r??c.defaultError}},description:i}}var hR=class{get description(){return this._def.description}_getType(t){return M2r(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:M2r(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ove,ctx:{common:t.parent.common,data:t.data,parsedType:M2r(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(wGa(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:M2r(t)},i=this._parseSync({data:t,path:n.path,parent:n});return klh(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:M2r(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return fxi(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>fxi(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:M2r(t)},i=this._parse({data:t,path:n.path,parent:n}),a=await(wGa(i)?i:Promise.resolve(i));return klh(n,a)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=t(i),c=()=>a.addIssue({code:Ry.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(f=>f?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new zdt({schema:this,typeName:LD.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Fdt.create(this,this._def)}nullable(){return T2r.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dmi.create(this)}promise(){return _xi.create(this,this._def)}or(t){return Cia.create([this,t],this._def)}and(t){return Iia.create(this,t,this._def)}transform(t){return new zdt({...MT(this._def),schema:this,typeName:LD.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ria({...MT(this._def),innerType:this,defaultValue:r,typeName:LD.ZodDefault})}brand(){return new w9o({typeName:LD.ZodBranded,type:this,...MT(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Nia({...MT(this._def),innerType:this,catchValue:r,typeName:LD.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return j9o.create(this,t)}readonly(){return Fia.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},KPS=/^c[^\s-]{8,}$/i,$PS=/^[0-9a-z]+$/,YPS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,XPS=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ZPS=/^[a-z0-9_-]{21}$/i,kPS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ewS=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,twS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rwS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",eXl,nwS=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,iwS=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,awS=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,owS=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,swS=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,uwS=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,tfh="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",cwS=new RegExp(`^${tfh}$`);function rfh(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function lwS(e){return new RegExp(`^${rfh(e)}$`)}function nfh(e){let t=`${tfh}T${rfh(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function fwS(e,t){return!!((t==="v4"||!t)&&nwS.test(e)||(t==="v6"||!t)&&awS.test(e))}function dwS(e,t){if(!kPS.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function pwS(e,t){return!!((t==="v4"||!t)&&iwS.test(e)||(t==="v6"||!t)&&owS.test(e))}var dxi=class e extends hR{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==yA.string){let a=this._getOrReturnCtx(t);return Hm(a,{code:Ry.invalid_type,expected:yA.string,received:a.parsedType}),aD}let n=new ove,i;for(let a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(i=this._getOrReturnCtx(t,i),Hm(i,{code:Ry.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(i=this._getOrReturnCtx(t,i),Hm(i,{code:Ry.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=t.data.length>a.value,c=t.data.length<a.value;(o||c)&&(i=this._getOrReturnCtx(t,i),o?Hm(i,{code:Ry.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&Hm(i,{code:Ry.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")twS.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"email",code:Ry.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")eXl||(eXl=new RegExp(rwS,"u")),eXl.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"emoji",code:Ry.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")XPS.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"uuid",code:Ry.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")ZPS.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"nanoid",code:Ry.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")KPS.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"cuid",code:Ry.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")$PS.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"cuid2",code:Ry.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")YPS.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"ulid",code:Ry.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Hm(i,{validation:"url",code:Ry.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"regex",code:Ry.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(t,i),Hm(i,{code:Ry.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(i=this._getOrReturnCtx(t,i),Hm(i,{code:Ry.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(i=this._getOrReturnCtx(t,i),Hm(i,{code:Ry.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?nfh(a).test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{code:Ry.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?cwS.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{code:Ry.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?lwS(a).test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{code:Ry.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?ewS.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"duration",code:Ry.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?fwS(t.data,a.version)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"ip",code:Ry.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?dwS(t.data,a.alg)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"jwt",code:Ry.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?pwS(t.data,a.version)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"cidr",code:Ry.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?swS.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"base64",code:Ry.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?uwS.test(t.data)||(i=this._getOrReturnCtx(t,i),Hm(i,{validation:"base64url",code:Ry.invalid_string,message:a.message}),n.dirty()):Mx.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:Ry.invalid_string,...Dj.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Dj.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Dj.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Dj.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Dj.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Dj.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Dj.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Dj.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Dj.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Dj.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Dj.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Dj.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Dj.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Dj.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Dj.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Dj.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Dj.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Dj.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Dj.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Dj.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Dj.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Dj.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Dj.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Dj.errToObj(r)})}nonempty(t){return this.min(1,Dj.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};dxi.create=e=>new dxi({checks:[],typeName:LD.ZodString,coerce:e?.coerce??!1,...MT(e)});function _wS(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return a%o/10**i}var Pia=class e extends hR{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==yA.number){let a=this._getOrReturnCtx(t);return Hm(a,{code:Ry.invalid_type,expected:yA.number,received:a.parsedType}),aD}let n,i=new ove;for(let a of this._def.checks)a.kind==="int"?Mx.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Hm(n,{code:Ry.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),Hm(n,{code:Ry.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),Hm(n,{code:Ry.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?_wS(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),Hm(n,{code:Ry.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Hm(n,{code:Ry.not_finite,message:a.message}),i.dirty()):Mx.assertNever(a);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Dj.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Dj.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Dj.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Dj.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Dj.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Dj.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Dj.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Dj.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Dj.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Dj.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Dj.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Dj.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Dj.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Dj.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Mx.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Pia.create=e=>new Pia({checks:[],typeName:LD.ZodNumber,coerce:e?.coerce||!1,...MT(e)});var wia=class e extends hR{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==yA.bigint)return this._getInvalidInput(t);let n,i=new ove;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),Hm(n,{code:Ry.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),Hm(n,{code:Ry.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Hm(n,{code:Ry.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Mx.assertNever(a);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Hm(r,{code:Ry.invalid_type,expected:yA.bigint,received:r.parsedType}),aD}gte(t,r){return this.setLimit("min",t,!0,Dj.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Dj.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Dj.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Dj.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Dj.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Dj.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Dj.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Dj.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Dj.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Dj.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};wia.create=e=>new wia({checks:[],typeName:LD.ZodBigInt,coerce:e?.coerce??!1,...MT(e)});var jia=class extends hR{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==yA.boolean){let n=this._getOrReturnCtx(t);return Hm(n,{code:Ry.invalid_type,expected:yA.boolean,received:n.parsedType}),aD}return yAe(t.data)}};jia.create=e=>new jia({typeName:LD.ZodBoolean,coerce:e?.coerce||!1,...MT(e)});var Eia=class e extends hR{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==yA.date){let a=this._getOrReturnCtx(t);return Hm(a,{code:Ry.invalid_type,expected:yA.date,received:a.parsedType}),aD}if(Number.isNaN(t.data.getTime())){let a=this._getOrReturnCtx(t);return Hm(a,{code:Ry.invalid_date}),aD}let n=new ove,i;for(let a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(i=this._getOrReturnCtx(t,i),Hm(i,{code:Ry.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(i=this._getOrReturnCtx(t,i),Hm(i,{code:Ry.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Mx.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Dj.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Dj.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Eia.create=e=>new Eia({checks:[],coerce:e?.coerce||!1,typeName:LD.ZodDate,...MT(e)});var EGa=class extends hR{_parse(t){if(this._getType(t)!==yA.symbol){let n=this._getOrReturnCtx(t);return Hm(n,{code:Ry.invalid_type,expected:yA.symbol,received:n.parsedType}),aD}return yAe(t.data)}};EGa.create=e=>new EGa({typeName:LD.ZodSymbol,...MT(e)});var Sia=class extends hR{_parse(t){if(this._getType(t)!==yA.undefined){let n=this._getOrReturnCtx(t);return Hm(n,{code:Ry.invalid_type,expected:yA.undefined,received:n.parsedType}),aD}return yAe(t.data)}};Sia.create=e=>new Sia({typeName:LD.ZodUndefined,...MT(e)});var Dia=class extends hR{_parse(t){if(this._getType(t)!==yA.null){let n=this._getOrReturnCtx(t);return Hm(n,{code:Ry.invalid_type,expected:yA.null,received:n.parsedType}),aD}return yAe(t.data)}};Dia.create=e=>new Dia({typeName:LD.ZodNull,...MT(e)});var pxi=class extends hR{constructor(){super(...arguments),this._any=!0}_parse(t){return yAe(t.data)}};pxi.create=e=>new pxi({typeName:LD.ZodAny,...MT(e)});var fmi=class extends hR{constructor(){super(...arguments),this._unknown=!0}_parse(t){return yAe(t.data)}};fmi.create=e=>new fmi({typeName:LD.ZodUnknown,...MT(e)});var _Br=class extends hR{_parse(t){let r=this._getOrReturnCtx(t);return Hm(r,{code:Ry.invalid_type,expected:yA.never,received:r.parsedType}),aD}};_Br.create=e=>new _Br({typeName:LD.ZodNever,...MT(e)});var SGa=class extends hR{_parse(t){if(this._getType(t)!==yA.undefined){let n=this._getOrReturnCtx(t);return Hm(n,{code:Ry.invalid_type,expected:yA.void,received:n.parsedType}),aD}return yAe(t.data)}};SGa.create=e=>new SGa({typeName:LD.ZodVoid,...MT(e)});var dmi=class e extends hR{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==yA.array)return Hm(r,{code:Ry.invalid_type,expected:yA.array,received:r.parsedType}),aD;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,c=r.data.length<i.exactLength.value;(o||c)&&(Hm(r,{code:o?Ry.too_big:Ry.too_small,minimum:c?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Hm(r,{code:Ry.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Hm(r,{code:Ry.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,c)=>i.type._parseAsync(new xdt(r,o,r.path,c)))).then(o=>ove.mergeArray(n,o));let a=[...r.data].map((o,c)=>i.type._parseSync(new xdt(r,o,r.path,c)));return ove.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Dj.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Dj.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Dj.toString(r)}})}nonempty(t){return this.min(1,t)}};dmi.create=(e,t)=>new dmi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:LD.ZodArray,...MT(t)});function jGa(e){if(e instanceof kNe){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Fdt.create(jGa(n))}return new kNe({...e._def,shape:()=>t})}else return e instanceof dmi?new dmi({...e._def,type:jGa(e.element)}):e instanceof Fdt?Fdt.create(jGa(e.unwrap())):e instanceof T2r?T2r.create(jGa(e.unwrap())):e instanceof B2r?B2r.create(e.items.map(t=>jGa(t))):e}var kNe=class e extends hR{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Mx.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==yA.object){let u=this._getOrReturnCtx(t);return Hm(u,{code:Ry.invalid_type,expected:yA.object,received:u.parsedType}),aD}let{status:n,ctx:i}=this._processInputParams(t),{shape:a,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof _Br&&this._def.unknownKeys==="strip"))for(let u in i.data)o.includes(u)||c.push(u);let f=[];for(let u of o){let s=a[u],l=i.data[u];f.push({key:{status:"valid",value:u},value:s._parse(new xdt(i,l,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof _Br){let u=this._def.unknownKeys;if(u==="passthrough")for(let s of c)f.push({key:{status:"valid",value:s},value:{status:"valid",value:i.data[s]}});else if(u==="strict")c.length>0&&(Hm(i,{code:Ry.unrecognized_keys,keys:c}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let s of c){let l=i.data[s];f.push({key:{status:"valid",value:s},value:u._parse(new xdt(i,l,i.path,s)),alwaysSet:s in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let s of f){let l=await s.key,m=await s.value;u.push({key:l,value:m,alwaysSet:s.alwaysSet})}return u}).then(u=>ove.mergeObjectSync(n,u)):ove.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return Dj.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Dj.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:LD.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Mx.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Mx.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return jGa(this)}partial(t){let r={};for(let n of Mx.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Mx.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Fdt;)a=a._def.innerType;r[n]=a}return new e({...this._def,shape:()=>r})}keyof(){return ifh(Mx.objectKeys(this.shape))}};kNe.create=(e,t)=>new kNe({shape:()=>e,unknownKeys:"strip",catchall:_Br.create(),typeName:LD.ZodObject,...MT(t)});kNe.strictCreate=(e,t)=>new kNe({shape:()=>e,unknownKeys:"strict",catchall:_Br.create(),typeName:LD.ZodObject,...MT(t)});kNe.lazycreate=(e,t)=>new kNe({shape:e,unknownKeys:"strip",catchall:_Br.create(),typeName:LD.ZodObject,...MT(t)});var Cia=class extends hR{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(a){for(let c of a)if(c.result.status==="valid")return c.result;for(let c of a)if(c.result.status==="dirty")return r.common.issues.push(...c.ctx.common.issues),c.result;let o=a.map(c=>new ZNe(c.ctx.common.issues));return Hm(r,{code:Ry.invalid_union,unionErrors:o}),aD}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let f of n){let u={...r,common:{...r.common,issues:[]},parent:null},s=f._parseSync({data:r.data,path:r.path,parent:u});if(s.status==="valid")return s;s.status==="dirty"&&!a&&(a={result:s,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let c=o.map(f=>new ZNe(f));return Hm(r,{code:Ry.invalid_union,unionErrors:c}),aD}}get options(){return this._def.options}};Cia.create=(e,t)=>new Cia({options:e,typeName:LD.ZodUnion,...MT(t)});var lmi=e=>e instanceof Mia?lmi(e.schema):e instanceof zdt?lmi(e.innerType()):e instanceof Bia?[e.value]:e instanceof Tia?e.options:e instanceof qia?Mx.objectValues(e.enum):e instanceof Ria?lmi(e._def.innerType):e instanceof Sia?[void 0]:e instanceof Dia?[null]:e instanceof Fdt?[void 0,...lmi(e.unwrap())]:e instanceof T2r?[null,...lmi(e.unwrap())]:e instanceof w9o||e instanceof Fia?lmi(e.unwrap()):e instanceof Nia?lmi(e._def.innerType):[],bru=class e extends hR{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==yA.object)return Hm(r,{code:Ry.invalid_type,expected:yA.object,received:r.parsedType}),aD;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(Hm(r,{code:Ry.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),aD)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let a of r){let o=lmi(a.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let c of o){if(i.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);i.set(c,a)}}return new e({typeName:LD.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...MT(n)})}};function tXl(e,t){let r=M2r(e),n=M2r(t);if(e===t)return{valid:!0,data:e};if(r===yA.object&&n===yA.object){let i=Mx.objectKeys(t),a=Mx.objectKeys(e).filter(c=>i.indexOf(c)!==-1),o={...e,...t};for(let c of a){let f=tXl(e[c],t[c]);if(!f.valid)return{valid:!1};o[c]=f.data}return{valid:!0,data:o}}else if(r===yA.array&&n===yA.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let a=0;a<e.length;a++){let o=e[a],c=t[a],f=tXl(o,c);if(!f.valid)return{valid:!1};i.push(f.data)}return{valid:!0,data:i}}else return r===yA.date&&n===yA.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Iia=class extends hR{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(a,o)=>{if(yru(a)||yru(o))return aD;let c=tXl(a.value,o.value);return c.valid?((vru(a)||vru(o))&&r.dirty(),{status:r.value,value:c.data}):(Hm(n,{code:Ry.invalid_intersection_types}),aD)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Iia.create=(e,t,r)=>new Iia({left:e,right:t,typeName:LD.ZodIntersection,...MT(r)});var B2r=class e extends hR{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==yA.array)return Hm(n,{code:Ry.invalid_type,expected:yA.array,received:n.parsedType}),aD;if(n.data.length<this._def.items.length)return Hm(n,{code:Ry.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),aD;!this._def.rest&&n.data.length>this._def.items.length&&(Hm(n,{code:Ry.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,c)=>{let f=this._def.items[c]||this._def.rest;return f?f._parse(new xdt(n,o,n.path,c)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>ove.mergeArray(r,o)):ove.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};B2r.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new B2r({items:e,typeName:LD.ZodTuple,rest:null,...MT(t)})};var gru=class e extends hR{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==yA.object)return Hm(n,{code:Ry.invalid_type,expected:yA.object,received:n.parsedType}),aD;let i=[],a=this._def.keyType,o=this._def.valueType;for(let c in n.data)i.push({key:a._parse(new xdt(n,c,n.path,c)),value:o._parse(new xdt(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?ove.mergeObjectAsync(r,i):ove.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof hR?new e({keyType:t,valueType:r,typeName:LD.ZodRecord,...MT(n)}):new e({keyType:dxi.create(),valueType:t,typeName:LD.ZodRecord,...MT(r)})}},DGa=class extends hR{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==yA.map)return Hm(n,{code:Ry.invalid_type,expected:yA.map,received:n.parsedType}),aD;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([c,f],u)=>({key:i._parse(new xdt(n,c,n.path,[u,"key"])),value:a._parse(new xdt(n,f,n.path,[u,"value"]))}));if(n.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let f of o){let u=await f.key,s=await f.value;if(u.status==="aborted"||s.status==="aborted")return aD;(u.status==="dirty"||s.status==="dirty")&&r.dirty(),c.set(u.value,s.value)}return{status:r.value,value:c}})}else{let c=new Map;for(let f of o){let u=f.key,s=f.value;if(u.status==="aborted"||s.status==="aborted")return aD;(u.status==="dirty"||s.status==="dirty")&&r.dirty(),c.set(u.value,s.value)}return{status:r.value,value:c}}}};DGa.create=(e,t,r)=>new DGa({valueType:t,keyType:e,typeName:LD.ZodMap,...MT(r)});var CGa=class e extends hR{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==yA.set)return Hm(n,{code:Ry.invalid_type,expected:yA.set,received:n.parsedType}),aD;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Hm(n,{code:Ry.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Hm(n,{code:Ry.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(f){let u=new Set;for(let s of f){if(s.status==="aborted")return aD;s.status==="dirty"&&r.dirty(),u.add(s.value)}return{status:r.value,value:u}}let c=[...n.data.values()].map((f,u)=>a._parse(new xdt(n,f,n.path,u)));return n.common.async?Promise.all(c).then(f=>o(f)):o(c)}min(t,r){return new e({...this._def,minSize:{value:t,message:Dj.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Dj.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};CGa.create=(e,t)=>new CGa({valueType:e,minSize:null,maxSize:null,typeName:LD.ZodSet,...MT(t)});var mru=class e extends hR{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==yA.function)return Hm(r,{code:Ry.invalid_type,expected:yA.function,received:r.parsedType}),aD;function n(c,f){return P9o({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,PGa(),cmi].filter(u=>!!u),issueData:{code:Ry.invalid_arguments,argumentsError:f}})}function i(c,f){return P9o({data:c,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,PGa(),cmi].filter(u=>!!u),issueData:{code:Ry.invalid_return_type,returnTypeError:f}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof _xi){let c=this;return yAe(async function(...f){let u=new ZNe([]),s=await c._def.args.parseAsync(f,a).catch(O=>{throw u.addIssue(n(f,O)),u}),l=await Reflect.apply(o,this,s);return await c._def.returns._def.type.parseAsync(l,a).catch(O=>{throw u.addIssue(i(l,O)),u})})}else{let c=this;return yAe(function(...f){let u=c._def.args.safeParse(f,a);if(!u.success)throw new ZNe([n(f,u.error)]);let s=Reflect.apply(o,this,u.data),l=c._def.returns.safeParse(s,a);if(!l.success)throw new ZNe([i(s,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:B2r.create(t).rest(fmi.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||B2r.create([]).rest(fmi.create()),returns:r||fmi.create(),typeName:LD.ZodFunction,...MT(n)})}},Mia=class extends hR{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Mia.create=(e,t)=>new Mia({getter:e,typeName:LD.ZodLazy,...MT(t)});var Bia=class extends hR{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Hm(r,{received:r.data,code:Ry.invalid_literal,expected:this._def.value}),aD}return{status:"valid",value:t.data}}get value(){return this._def.value}};Bia.create=(e,t)=>new Bia({value:e,typeName:LD.ZodLiteral,...MT(t)});function ifh(e,t){return new Tia({values:e,typeName:LD.ZodEnum,...MT(t)})}var Tia=class e extends hR{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Hm(r,{expected:Mx.joinValues(n),received:r.parsedType,code:Ry.invalid_type}),aD}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return Hm(r,{received:r.data,code:Ry.invalid_enum_value,options:n}),aD}return yAe(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Tia.create=ifh;var qia=class extends hR{_parse(t){let r=Mx.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==yA.string&&n.parsedType!==yA.number){let i=Mx.objectValues(r);return Hm(n,{expected:Mx.joinValues(i),received:n.parsedType,code:Ry.invalid_type}),aD}if(this._cache||(this._cache=new Set(Mx.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Mx.objectValues(r);return Hm(n,{received:n.data,code:Ry.invalid_enum_value,options:i}),aD}return yAe(t.data)}get enum(){return this._def.values}};qia.create=(e,t)=>new qia({values:e,typeName:LD.ZodNativeEnum,...MT(t)});var _xi=class extends hR{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==yA.promise&&r.common.async===!1)return Hm(r,{code:Ry.invalid_type,expected:yA.promise,received:r.parsedType}),aD;let n=r.parsedType===yA.promise?r.data:Promise.resolve(r.data);return yAe(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};_xi.create=(e,t)=>new _xi({type:e,typeName:LD.ZodPromise,...MT(t)});var zdt=class extends hR{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===LD.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,a={addIssue:o=>{Hm(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async c=>{if(r.value==="aborted")return aD;let f=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return f.status==="aborted"?aD:f.status==="dirty"?Aia(f.value):r.value==="dirty"?Aia(f.value):f});{if(r.value==="aborted")return aD;let c=this._def.schema._parseSync({data:o,path:n.path,parent:n});return c.status==="aborted"?aD:c.status==="dirty"?Aia(c.value):r.value==="dirty"?Aia(c.value):c}}if(i.type==="refinement"){let o=c=>{let f=i.refinement(c,a);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?aD:(c.status==="dirty"&&r.dirty(),o(c.value),{status:r.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?aD:(c.status==="dirty"&&r.dirty(),o(c.value).then(()=>({status:r.value,value:c.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!fxi(o))return aD;let c=i.transform(o.value,a);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>fxi(o)?Promise.resolve(i.transform(o.value,a)).then(c=>({status:r.value,value:c})):aD);Mx.assertNever(i)}};zdt.create=(e,t,r)=>new zdt({schema:e,typeName:LD.ZodEffects,effect:t,...MT(r)});zdt.createWithPreprocess=(e,t,r)=>new zdt({schema:t,effect:{type:"preprocess",transform:e},typeName:LD.ZodEffects,...MT(r)});var Fdt=class extends hR{_parse(t){return this._getType(t)===yA.undefined?yAe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Fdt.create=(e,t)=>new Fdt({innerType:e,typeName:LD.ZodOptional,...MT(t)});var T2r=class extends hR{_parse(t){return this._getType(t)===yA.null?yAe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};T2r.create=(e,t)=>new T2r({innerType:e,typeName:LD.ZodNullable,...MT(t)});var Ria=class extends hR{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===yA.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ria.create=(e,t)=>new Ria({innerType:e,typeName:LD.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...MT(t)});var Nia=class extends hR{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return wGa(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ZNe(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ZNe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Nia.create=(e,t)=>new Nia({innerType:e,typeName:LD.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...MT(t)});var IGa=class extends hR{_parse(t){if(this._getType(t)!==yA.nan){let n=this._getOrReturnCtx(t);return Hm(n,{code:Ry.invalid_type,expected:yA.nan,received:n.parsedType}),aD}return{status:"valid",value:t.data}}};IGa.create=e=>new IGa({typeName:LD.ZodNaN,...MT(e)});var hwS=Symbol("zod_brand"),w9o=class extends hR{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},j9o=class e extends hR{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?aD:a.status==="dirty"?(r.dirty(),Aia(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?aD:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:LD.ZodPipeline})}},Fia=class extends hR{_parse(t){let r=this._def.innerType._parse(t),n=i=>(fxi(i)&&(i.value=Object.freeze(i.value)),i);return wGa(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Fia.create=(e,t)=>new Fia({innerType:e,typeName:LD.ZodReadonly,...MT(t)});function efh(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function afh(e,t={},r){return e?pxi.create().superRefine((n,i)=>{let a=e(n);if(a instanceof Promise)return a.then(o=>{if(!o){let c=efh(t,n),f=c.fatal??r??!0;i.addIssue({code:"custom",...c,fatal:f})}});if(!a){let o=efh(t,n),c=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:c})}}):pxi.create()}var ywS={object:kNe.lazycreate},LD;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(LD||(LD={}));var vwS=(e,t={message:`Input not instance of ${e.name}`})=>afh(r=>r instanceof e,t),ofh=dxi.create,sfh=Pia.create,bwS=IGa.create,gwS=wia.create,ufh=jia.create,mwS=Eia.create,OwS=EGa.create,AwS=Sia.create,PwS=Dia.create,wwS=pxi.create,jwS=fmi.create,EwS=_Br.create,SwS=SGa.create,DwS=dmi.create,CwS=kNe.create,IwS=kNe.strictCreate,MwS=Cia.create,BwS=bru.create,TwS=Iia.create,qwS=B2r.create,RwS=gru.create,NwS=DGa.create,FwS=CGa.create,xwS=mru.create,zwS=Mia.create,QwS=Bia.create,LwS=Tia.create,UwS=qia.create,VwS=_xi.create,WwS=zdt.create,GwS=Fdt.create,HwS=T2r.create,JwS=zdt.createWithPreprocess,KwS=j9o.create,$wS=()=>ofh().optional(),YwS=()=>sfh().optional(),XwS=()=>ufh().optional(),ZwS={string:(e=>dxi.create({...e,coerce:!0})),number:(e=>Pia.create({...e,coerce:!0})),boolean:(e=>jia.create({...e,coerce:!0})),bigint:(e=>wia.create({...e,coerce:!0})),date:(e=>Eia.create({...e,coerce:!0}))};var kwS=aD;var rFe={};yf(rFe,{RawSchemas:()=>sZl});var sZl={};yf(sZl,{AiChatLocation:()=>aXl,AiChatModel:()=>oXl,Availability:()=>sXl,BodyThemeConfig:()=>lXl,ContentAlignment:()=>yXl,FernDocsConfig:()=>AXl,FernDocsConfigError:()=>E9o,FernDocsConfigTimeoutError:()=>S9o,FontDisplay:()=>gXl,FontStyle:()=>bXl,HeaderPosition:()=>vXl,HttpSnippetLanguage:()=>pXl,JsScriptStrategy:()=>mXl,Language:()=>nXl,PageActionOption:()=>iXl,PageActionsThemeConfig:()=>dXl,ProgrammingLanguage:()=>rXl,SearchbarPlacement:()=>_Xl,Serializer:()=>tFe,SidebarThemeConfig:()=>fXl,TabsPlacement:()=>hXl,TabsThemeConfig:()=>cXl,TwitterCardSetting:()=>OXl,VersionAvailability:()=>uXl,docs:()=>Oru,serialization:()=>tFe});var AXl={};yf(AXl,{AiChatLocation:()=>aXl,AiChatModel:()=>oXl,Availability:()=>sXl,BodyThemeConfig:()=>lXl,ContentAlignment:()=>yXl,FontDisplay:()=>gXl,FontStyle:()=>bXl,HeaderPosition:()=>vXl,HttpSnippetLanguage:()=>pXl,JsScriptStrategy:()=>mXl,Language:()=>nXl,PageActionOption:()=>iXl,PageActionsThemeConfig:()=>dXl,ProgrammingLanguage:()=>rXl,SearchbarPlacement:()=>_Xl,SidebarThemeConfig:()=>fXl,TabsPlacement:()=>hXl,TabsThemeConfig:()=>cXl,TwitterCardSetting:()=>OXl,VersionAvailability:()=>uXl,docs:()=>Oru});var Oru={};yf(Oru,{AiChatLocation:()=>aXl,AiChatModel:()=>oXl,Availability:()=>sXl,BodyThemeConfig:()=>lXl,ContentAlignment:()=>yXl,FontDisplay:()=>gXl,FontStyle:()=>bXl,HeaderPosition:()=>vXl,HttpSnippetLanguage:()=>pXl,JsScriptStrategy:()=>mXl,Language:()=>nXl,PageActionOption:()=>iXl,PageActionsThemeConfig:()=>dXl,ProgrammingLanguage:()=>rXl,SearchbarPlacement:()=>_Xl,SidebarThemeConfig:()=>fXl,TabsPlacement:()=>hXl,TabsThemeConfig:()=>cXl,TwitterCardSetting:()=>OXl,VersionAvailability:()=>uXl});var rXl={Typescript:"typescript",Javascript:"javascript",Python:"python",Java:"java",Go:"go",Ruby:"ruby",Csharp:"csharp",Php:"php",Swift:"swift",Rust:"rust",Nodets:"nodets",Nodejs:"nodejs",Dotnet:"dotnet",Curl:"curl",Jvm:"jvm",Ts:"ts",Js:"js"};var nXl={En:"en",Es:"es",Fr:"fr",De:"de",It:"it",Pt:"pt",Ja:"ja",Zh:"zh",Ko:"ko",El:"el",No:"no",Pl:"pl",Ru:"ru",Sv:"sv",Tr:"tr"};var iXl={CopyPage:"copy-page",ViewAsMarkdown:"view-as-markdown",AskAi:"ask-ai",Chatgpt:"chatgpt",Claude:"claude",Cursor:"cursor",Vscode:"vscode"};var aXl={Docs:"docs",Slack:"slack",Discord:"discord"};var oXl={Claude37:"claude-3.7",Claude4:"claude-4",CommandA:"command-a"};var sXl={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",Beta:"beta"};var uXl={Deprecated:"deprecated",Ga:"ga",Stable:"stable",Beta:"beta"};var cXl={Default:"default",Bubble:"bubble"};var lXl={Default:"default",Canvas:"canvas"};var fXl={Default:"default",Minimal:"minimal"};var dXl={Default:"default",Toolbar:"toolbar"};var pXl={Curl:"curl",Csharp:"csharp",Go:"go",Java:"java",Javascript:"javascript",Php:"php",Python:"python",Ruby:"ruby",Swift:"swift",Typescript:"typescript"};var _Xl={Header:"header",HeaderTabs:"header-tabs",Sidebar:"sidebar"};var hXl={Header:"header",Sidebar:"sidebar"};var yXl={Center:"center",Left:"left"};var vXl={Fixed:"fixed",Static:"static"};var bXl={Normal:"normal",Italic:"italic"};var gXl={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var mXl={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var OXl={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var cfh=(e,t,r)=>JSON.stringify(e,t,r);var E9o=class e extends Error{statusCode;body;rawResponse;constructor({message:t,statusCode:r,body:n,rawResponse:i}){super(ejS({message:t,statusCode:r,body:n})),Object.setPrototypeOf(this,e.prototype),this.statusCode=r,this.body=n,this.rawResponse=i}};function ejS({message:e,statusCode:t,body:r}){let n=[];return e!=null&&n.push(e),t!=null&&n.push(`Status code: ${t.toString()}`),r!=null&&n.push(`Body: ${cfh(r,void 0,2)}`),n.join(`
2081
2081
  `)}var S9o=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};var tFe={};yf(tFe,{AbsoluteProductPath:()=>_iu,AiChatConfig:()=>W9o,AiChatDatasource:()=>wnu,AiChatLocation:()=>Anu,AiChatModel:()=>Onu,AiChatWebsiteDatasource:()=>Pnu,AnalyticsConfig:()=>$ru,AnnouncementConfig:()=>enu,ApiReferenceConfiguration:()=>aiu,ApiReferenceEndpointConfiguration:()=>ciu,ApiReferenceLayoutItem:()=>U2r,ApiReferencePackageConfiguration:()=>fiu,ApiReferencePackageConfigurationWithOptions:()=>diu,ApiReferenceSectionConfiguration:()=>liu,Audience:()=>F2r,AudienceId:()=>U9o,Availability:()=>bAe,BackgroundImageConfiguration:()=>Inu,BackgroundImageThemedConfig:()=>Cnu,BodyThemeConfig:()=>Hnu,ChangelogConfiguration:()=>oiu,ChangelogFolderRelativePath:()=>VGa,ColorConfig:()=>Q2r,ColorThemedConfig:()=>Mnu,ColorsConfiguration:()=>Bnu,ContentAlignment:()=>znu,CssConfig:()=>Xnu,CustomDomain:()=>Yru,DocsConfiguration:()=>Nph,DocsInstance:()=>kru,DocsSettingsConfig:()=>Wnu,DocsTypographyConfig:()=>Nnu,EditThisPageConfig:()=>Zru,ExperimentalConfig:()=>mnu,ExternalProduct:()=>inu,FeatureFlag:()=>V9o,FeatureFlagConfiguration:()=>tnu,FolderConfiguration:()=>siu,FontConfig:()=>$Ga,FontConfigPath:()=>qnu,FontConfigVariant:()=>Tnu,FontDisplay:()=>Rnu,FontStyle:()=>KGa,FontWeight:()=>JGa,FooterLinksConfig:()=>ynu,FullStoryAnalyticsConfig:()=>Wru,GithubEditThisPageConfig:()=>Xru,GoogleAnalytics4Config:()=>Kru,GtmConfig:()=>Jru,HeaderPosition:()=>Qnu,HttpSnippetLanguage:()=>Unu,HttpSnippetsConfig:()=>Vnu,IntegrationsConfig:()=>Ynu,IntercomConfig:()=>Gru,InternalProduct:()=>nnu,JsConfig:()=>tiu,JsConfigOptions:()=>G9o,JsFileConfig:()=>eiu,JsFileConfigSettings:()=>knu,JsRemoteConfig:()=>Znu,JsScriptStrategy:()=>YGa,Language:()=>UGa,LayoutConfig:()=>Lnu,LinkConfiguration:()=>XGa,LogoConfiguration:()=>Dnu,MetadataConfig:()=>Enu,NavbarDropdownConfig:()=>_nu,NavbarGithubConfig:()=>pnu,NavbarGithubConfigWithOptions:()=>dnu,NavbarLink:()=>hnu,NavbarLinkConfig:()=>z2r,NavigationConfig:()=>mxi,NavigationItem:()=>x2r,PageActionOption:()=>vnu,PageActionOptions:()=>bnu,PageActionsConfig:()=>gnu,PageActionsThemeConfig:()=>Knu,PageConfiguration:()=>Ldt,PlaygroundButtonSettings:()=>iiu,PlaygroundSettings:()=>L2r,PostHogConfig:()=>Hru,ProductConfig:()=>anu,ProductConfigBase:()=>HGa,ProductFileConfig:()=>zph,ProductPath:()=>xph,ProgrammingLanguage:()=>Uru,RedirectConfig:()=>Snu,RelativeProductPath:()=>piu,Role:()=>WGa,RoleId:()=>Via,SearchbarPlacement:()=>Fnu,SectionConfiguration:()=>uiu,SegmentConfig:()=>Vru,SidebarThemeConfig:()=>Gnu,SnippetLanguageConfiguration:()=>Udt,SnippetsConfiguration:()=>niu,TabConfig:()=>gxi,TabId:()=>Qdt,TabVariant:()=>unu,TabbedNavigationConfig:()=>fnu,TabbedNavigationItem:()=>lnu,TabbedNavigationItemWithLayout:()=>snu,TabbedNavigationItemWithVariants:()=>cnu,TabsPlacement:()=>xnu,TabsThemeConfig:()=>Jnu,ThemeConfig:()=>$nu,TwitterCardSetting:()=>jnu,UntabbedNavigationConfig:()=>onu,VersionAvailability:()=>rnu,VersionConfig:()=>GGa,VersionFileConfig:()=>Fph,VersionedSnippetLanguageConfiguration:()=>riu,WithFeatureFlags:()=>zL,WithPermissions:()=>xL,WithViewers:()=>Oxi,docs:()=>oZl});var oZl={};yf(oZl,{AbsoluteProductPath:()=>_iu,AiChatConfig:()=>W9o,AiChatDatasource:()=>wnu,AiChatLocation:()=>Anu,AiChatModel:()=>Onu,AiChatWebsiteDatasource:()=>Pnu,AnalyticsConfig:()=>$ru,AnnouncementConfig:()=>enu,ApiReferenceConfiguration:()=>aiu,ApiReferenceEndpointConfiguration:()=>ciu,ApiReferenceLayoutItem:()=>U2r,ApiReferencePackageConfiguration:()=>fiu,ApiReferencePackageConfigurationWithOptions:()=>diu,ApiReferenceSectionConfiguration:()=>liu,Audience:()=>F2r,AudienceId:()=>U9o,Availability:()=>bAe,BackgroundImageConfiguration:()=>Inu,BackgroundImageThemedConfig:()=>Cnu,BodyThemeConfig:()=>Hnu,ChangelogConfiguration:()=>oiu,ChangelogFolderRelativePath:()=>VGa,ColorConfig:()=>Q2r,ColorThemedConfig:()=>Mnu,ColorsConfiguration:()=>Bnu,ContentAlignment:()=>znu,CssConfig:()=>Xnu,CustomDomain:()=>Yru,DocsConfiguration:()=>Nph,DocsInstance:()=>kru,DocsSettingsConfig:()=>Wnu,DocsTypographyConfig:()=>Nnu,EditThisPageConfig:()=>Zru,ExperimentalConfig:()=>mnu,ExternalProduct:()=>inu,FeatureFlag:()=>V9o,FeatureFlagConfiguration:()=>tnu,FolderConfiguration:()=>siu,FontConfig:()=>$Ga,FontConfigPath:()=>qnu,FontConfigVariant:()=>Tnu,FontDisplay:()=>Rnu,FontStyle:()=>KGa,FontWeight:()=>JGa,FooterLinksConfig:()=>ynu,FullStoryAnalyticsConfig:()=>Wru,GithubEditThisPageConfig:()=>Xru,GoogleAnalytics4Config:()=>Kru,GtmConfig:()=>Jru,HeaderPosition:()=>Qnu,HttpSnippetLanguage:()=>Unu,HttpSnippetsConfig:()=>Vnu,IntegrationsConfig:()=>Ynu,IntercomConfig:()=>Gru,InternalProduct:()=>nnu,JsConfig:()=>tiu,JsConfigOptions:()=>G9o,JsFileConfig:()=>eiu,JsFileConfigSettings:()=>knu,JsRemoteConfig:()=>Znu,JsScriptStrategy:()=>YGa,Language:()=>UGa,LayoutConfig:()=>Lnu,LinkConfiguration:()=>XGa,LogoConfiguration:()=>Dnu,MetadataConfig:()=>Enu,NavbarDropdownConfig:()=>_nu,NavbarGithubConfig:()=>pnu,NavbarGithubConfigWithOptions:()=>dnu,NavbarLink:()=>hnu,NavbarLinkConfig:()=>z2r,NavigationConfig:()=>mxi,NavigationItem:()=>x2r,PageActionOption:()=>vnu,PageActionOptions:()=>bnu,PageActionsConfig:()=>gnu,PageActionsThemeConfig:()=>Knu,PageConfiguration:()=>Ldt,PlaygroundButtonSettings:()=>iiu,PlaygroundSettings:()=>L2r,PostHogConfig:()=>Hru,ProductConfig:()=>anu,ProductConfigBase:()=>HGa,ProductFileConfig:()=>zph,ProductPath:()=>xph,ProgrammingLanguage:()=>Uru,RedirectConfig:()=>Snu,RelativeProductPath:()=>piu,Role:()=>WGa,RoleId:()=>Via,SearchbarPlacement:()=>Fnu,SectionConfiguration:()=>uiu,SegmentConfig:()=>Vru,SidebarThemeConfig:()=>Gnu,SnippetLanguageConfiguration:()=>Udt,SnippetsConfiguration:()=>niu,TabConfig:()=>gxi,TabId:()=>Qdt,TabVariant:()=>unu,TabbedNavigationConfig:()=>fnu,TabbedNavigationItem:()=>lnu,TabbedNavigationItemWithLayout:()=>snu,TabbedNavigationItemWithVariants:()=>cnu,TabsPlacement:()=>xnu,TabsThemeConfig:()=>Jnu,ThemeConfig:()=>$nu,TwitterCardSetting:()=>jnu,UntabbedNavigationConfig:()=>onu,VersionAvailability:()=>rnu,VersionConfig:()=>GGa,VersionFileConfig:()=>Fph,VersionedSnippetLanguageConfiguration:()=>riu,WithFeatureFlags:()=>zL,WithPermissions:()=>xL,WithViewers:()=>Oxi});var hi={};yf(hi,{JsonError:()=>zGa,ParseError:()=>QGa,any:()=>Pph,bigint:()=>lph,boolean:()=>wph,booleanLiteral:()=>Aph,date:()=>fph,discriminant:()=>Tph,enum_:()=>zru,getObjectLikeUtils:()=>hBr,getObjectUtils:()=>Uia,getSchemaUtils:()=>I7,isProperty:()=>bxi,lazy:()=>dph,lazyObject:()=>gph,list:()=>Lru,number:()=>jph,object:()=>Qru,objectWithoutOptionalProperties:()=>bph,optional:()=>rZl,property:()=>_ph,record:()=>Cph,set:()=>Iph,string:()=>Eph,stringLiteral:()=>Oph,transform:()=>nZl,undiscriminatedUnion:()=>Bph,union:()=>Rph,unknown:()=>Sph,withParsedProperties:()=>aZl});var TM={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",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function C7(e,t){return`Expected ${t}. Received ${SES(e)}.`}function SES(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 afe(e){return{...e,json:cph(e.json),parse:cph(e.parse)}}function cph(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
2082
- `)),{ok:!0,value:t}):n}}function xru(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var zGa=class e extends Error{errors;constructor(t){super(t.map(xru).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var QGa=class e extends Error{errors;constructor(t){super(t.map(xru).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function I7(e){return{nullable:()=>DES(e),optional:()=>rZl(e),optionalNullable:()=>CES(e),transform:t=>nZl(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new QGa(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new zGa(n.errors)}}}function DES(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>TM.NULLABLE};return{...t,...I7(t)}}function rZl(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>TM.OPTIONAL};return{...t,...I7(t)}}function CES(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>TM.OPTIONAL_NULLABLE};return{...t,...I7(t)}}function nZl(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(n,i)=>{let a=t.untransform(n);return e.json(a,i)},getType:()=>e.getType()};return{...r,...I7(r)}}function lph(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:C7(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:C7(t,"bigint")}]}:{ok:!0,value:t},getType:()=>TM.BIGINT};return{...afe(e),...I7(e)}}var IES=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function fph(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:C7(t,"string")}]}:IES.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:C7(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:C7(t,"Date object")}]},getType:()=>TM.DATE};return{...afe(e),...I7(e)}}function vAe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...afe(r),...I7(r)}}}function zru(e){let t=new Set(e);return vAe(TM.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:C7(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:C7(n,"enum")}]}:{ok:!0,value:n})()}function dph(e){let t=iZl(e);return{...t,...I7(t)}}function iZl(e){return{parse:(t,r)=>LGa(e).parse(t,r),json:(t,r)=>LGa(e).json(t,r),getType:()=>LGa(e).getType()}}function LGa(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function z9o(e){return Object.entries(e)}function Q9o(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function vxi(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function L9o(e){return Object.keys(e)}function pph(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function hBr(e){return{withParsedProperties:t=>aZl(e,t)}}function aZl(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[f,u])=>({...c,[f]:typeof u=="function"?u(a.value):u}),{});return{ok:!0,value:{...a.value,...o}}},json:(n,i)=>{if(!vxi(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:C7(n,"object")}]};let a=new Set(Object.keys(t)),o=Q9o(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(o,i)},getType:()=>e.getType()};return{...r,...I7(r),...hBr(r)}}function _ph(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function bxi(e){return e.isProperty}function Qru(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>bxi(n)?n.rawKey:r),_getParsedProperties:()=>L9o(e),parse:(r,n)=>{let i={},a=[];for(let[o,c]of z9o(e)){let f=bxi(c)?c.rawKey:o,u=bxi(c)?c.valueSchema:c,s={rawKey:f,parsedKey:o,valueSchema:u};i[f]=s,vph(u)&&a.push(f)}return hph({value:r,requiredKeys:a,getProperty:o=>{let c=i[o];if(c!=null)return{transformedKey:c.parsedKey,transform:f=>c.valueSchema.parse(f,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,o]of z9o(e)){let c=bxi(o)?o.valueSchema:o;vph(c)&&i.push(a)}return hph({value:r,requiredKeys:i,getProperty:a=>{let o=e[a];if(o!=null)return bxi(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>TM.OBJECT};return{...afe(t),...I7(t),...hBr(t),...Uia(t)}}function hph({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!vxi(e))return{ok:!1,errors:[{path:a,message:C7(e,"object")}]};let o=new Set(t),c=[],f={};for(let[u,s]of Object.entries(e)){let l=r(u);if(l!=null){o.delete(u);let m=l.transform(s);m.ok?f[l.transformedKey]=m.value:(f[u]=s,c.push(...m.errors))}else switch(n){case"fail":c.push({path:[...a,u],message:`Unexpected key "${u}"`});break;case"strip":break;case"passthrough":f[u]=s;break}}return c.push(...t.filter(u=>o.has(u)).map(u=>({path:a,message:`Missing required key "${u}"`}))),c.length===0||i?{ok:!0,value:f}:{ok:!1,errors:c}}function Uia(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>yph({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>yph({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>TM.OBJECT};return{...r,...I7(r),...hBr(r),...Uia(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,n)=>{let i=e.parse(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},json:(r,n)=>{let i=e.json(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},getType:()=>TM.OBJECT};return{...t,...I7(t),...hBr(t),...Uia(t)}}}}function yph({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,o]=pph(L9o(t),u=>i.has(u)),c=r(Q9o(t,o)),f=n(Q9o(t,a));return c.ok&&f.ok?{ok:!0,value:{...c.value,...f.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...f.ok?[]:f.errors]}}function vph(e){return!MES(e)}function MES(e){switch(e.getType()){case TM.ANY:case TM.UNKNOWN:case TM.OPTIONAL:case TM.OPTIONAL_NULLABLE:return!0;default:return!1}}function bph(e){return Qru(e)}function gph(e){let t={...iZl(e),_getRawProperties:()=>LGa(e)._getRawProperties(),_getParsedProperties:()=>LGa(e)._getParsedProperties()};return{...t,...I7(t),...hBr(t),...Uia(t)}}function Lru(e){let t={parse:(r,n)=>mph(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>mph(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>TM.LIST};return{...afe(t),...I7(t)}}function mph(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let a=[];return n.ok||a.push(...n.errors),i.ok||a.push(...i.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:C7(e,"list"),path:[]}]}}function Oph(e){return vAe(TM.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:C7(r,`"${e}"`)}]})()}function Aph(e){return vAe(TM.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:C7(r,`${e.toString()}`)}]})()}var Pph=vAe(TM.ANY,e=>({ok:!0,value:e}));var wph=vAe(TM.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:C7(e,"boolean")}]});var jph=vAe(TM.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:C7(e,"number")}]});var Eph=vAe(TM.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:C7(e,"string")}]});var Sph=vAe(TM.UNKNOWN,e=>({ok:!0,value:e}));function Cph(e,t){let r={parse:(n,i)=>Dph({value:n,isKeyNumeric:e.getType()===TM.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>Dph({value:n,isKeyNumeric:e.getType()===TM.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>TM.RECORD};return{...afe(r),...I7(r)}}function Dph({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return vxi(e)?z9o(e).reduce((a,[o,c])=>{if(c===void 0)return a;let f=a,u=o;if(t){let O=o.length>0?Number(o):NaN;isNaN(O)||(u=O)}let s=r(u),l=n(c,u);if(f.ok&&s.ok&&l.ok)return{ok:!0,value:{...f.value,[s.value]:l.value}};let m=[];return f.ok||m.push(...f.errors),s.ok||m.push(...s.errors),l.ok||m.push(...l.errors),{ok:!1,errors:m}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:C7(e,"object")}]}}function Iph(e){let t=Lru(e),r={parse:(n,i)=>{let a=t.parse(n,i);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:C7(n,"Set")}]},getType:()=>TM.SET};return{...afe(r),...I7(r)}}function Bph(e){let t={parse:(r,n)=>Mph((i,a)=>i.parse(r,a),e,n),json:(r,n)=>Mph((i,a)=>i.json(r,a),e,n),getType:()=>TM.UNDISCRIMINATED_UNION};return{...afe(t),...I7(t)}}function Mph(e,t,r){let n=[];for(let[i,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)n.push({path:c.path,message:`[Variant ${i}] ${c.message}`})}return{ok:!1,errors:n}}function Tph(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function Rph(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=zru(L9o(t)),a={parse:(o,c)=>qph({value:o,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:f=>i.parse(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.parse(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>qph({value:o,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:f=>i.json(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.json(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>TM.UNION};return{...afe(a),...I7(a),...hBr(a)}}function qph({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!vxi(e))return{ok:!1,errors:[{path:c,message:C7(e,"object")}]};let{[t]:f,...u}=e;if(f==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let s=n(f);if(!s.ok)return{ok:!1,errors:s.errors};let l=i(s.value);if(l==null)return a?{ok:!0,value:{[r]:s.value,...u}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let m=o(u,l);return m.ok?{ok:!0,value:{[r]:f,...m.value}}:m}var Uru=hi.enum_(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]);var UGa=hi.enum_(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]);var Vru=hi.object({writeKey:hi.property("write-key",hi.string())});var Wru=hi.object({orgId:hi.property("org-id",hi.string())});var Gru=hi.object({appId:hi.property("app-id",hi.string()),apiBase:hi.property("api-base",hi.string().optional())});var Hru=hi.object({apiKey:hi.property("api-key",hi.string()),endpoint:hi.string().optional()});var Jru=hi.object({containerId:hi.property("container-id",hi.string())});var Kru=hi.object({measurementId:hi.property("measurement-id",hi.string())});var $ru=hi.object({segment:Vru.optional(),fullstory:Wru.optional(),intercom:Gru.optional(),posthog:Hru.optional(),gtm:Jru.optional(),ga4:Kru.optional()});var Yru=hi.undiscriminatedUnion([hi.string(),hi.list(hi.string())]);var Xru=hi.object({host:hi.string().optional(),owner:hi.string(),repo:hi.string(),branch:hi.string().optional()});var Zru=hi.object({github:Xru.optional()});var U9o=hi.string();var F2r=hi.undiscriminatedUnion([U9o,hi.list(U9o)]);var kru=hi.object({url:hi.string(),customDomain:hi.property("custom-domain",Yru.optional()),private:hi.boolean().optional(),editThisPage:hi.property("edit-this-page",Zru.optional()),audiences:F2r.optional()});var enu=hi.object({message:hi.string()});var Via=hi.string();var Qdt=hi.string();var VGa=hi.string();var WGa=hi.undiscriminatedUnion([Via,hi.list(Via)]);var xL=hi.object({viewers:WGa.optional(),orphaned:hi.boolean().optional()});var V9o=hi.object({flag:hi.string(),fallbackValue:hi.property("fallback-value",hi.unknown().optional()),match:hi.unknown().optional()});var tnu=hi.undiscriminatedUnion([hi.string(),V9o,hi.list(V9o)]);var zL=hi.object({featureFlag:hi.property("feature-flag",tnu.optional())});var gxi=hi.object({displayName:hi.property("display-name",hi.string()),icon:hi.string().optional(),slug:hi.string().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),hidden:hi.boolean().optional(),href:hi.string().optional(),changelog:VGa.optional()}).extend(xL).extend(zL);var rnu=hi.enum_(["deprecated","ga","stable","beta"]);var GGa=hi.object({displayName:hi.property("display-name",hi.string()),path:hi.string(),slug:hi.string().optional(),availability:rnu.optional(),audiences:F2r.optional()}).extend(xL).extend(zL);var HGa=hi.object({displayName:hi.property("display-name",hi.string()),subtitle:hi.string().optional(),icon:hi.string().optional(),image:hi.string().optional(),versions:hi.list(GGa).optional(),audiences:F2r.optional()}).extend(xL).extend(zL);var nnu=hi.object({path:hi.string(),slug:hi.string().optional()}).extend(HGa);var inu=hi.object({href:hi.string()}).extend(HGa);var anu=hi.undiscriminatedUnion([nnu,inu]);var bAe=hi.enum_(["stable","generally-available","in-development","pre-release","deprecated","beta"]);var Ldt=hi.object({page:hi.string(),path:hi.string(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),noindex:hi.boolean().optional(),availability:bAe.optional()}).extend(xL).extend(zL);var onu=hi.list(hi.lazy(()=>x2r));var snu=hi.object({tab:Qdt,layout:hi.list(hi.lazy(()=>x2r)).optional()});var unu=hi.object({title:hi.string(),subtitle:hi.string().optional(),icon:hi.string().optional(),layout:hi.list(hi.lazy(()=>x2r)),slug:hi.string().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),hidden:hi.boolean().optional(),default:hi.boolean().optional()}).extend(xL).extend(zL);var cnu=hi.object({tab:Qdt,variants:hi.list(unu)});var lnu=hi.undiscriminatedUnion([snu,cnu]);var fnu=hi.list(lnu);var mxi=hi.undiscriminatedUnion([onu,fnu]);var Oxi=hi.object({viewers:WGa.optional()});var z2r=hi.object({href:hi.string().optional(),url:hi.string().optional(),text:hi.string().optional(),icon:hi.string().optional(),rightIcon:hi.string().optional(),rounded:hi.boolean().optional()}).extend(Oxi);var dnu=hi.object({url:hi.string()}).extend(Oxi);var pnu=hi.undiscriminatedUnion([hi.string(),dnu]);var _nu=hi.object({links:hi.list(z2r),text:hi.string().optional(),icon:hi.string().optional(),rightIcon:hi.string().optional(),rounded:hi.boolean().optional()}).extend(Oxi);var hnu=hi.union("type",{filled:z2r,outlined:z2r,minimal:z2r,github:hi.object({value:pnu}),dropdown:_nu,primary:z2r,secondary:z2r}).transform({transform:e=>e,untransform:e=>e});var ynu=hi.object({github:hi.string().optional(),twitter:hi.string().optional(),x:hi.string().optional(),linkedin:hi.string().optional(),youtube:hi.string().optional(),instagram:hi.string().optional(),facebook:hi.string().optional(),discord:hi.string().optional(),slack:hi.string().optional(),hackernews:hi.string().optional(),medium:hi.string().optional(),website:hi.string().optional()});var vnu=hi.enum_(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]);var bnu=hi.object({copyPage:hi.property("copy-page",hi.boolean().optional()),viewAsMarkdown:hi.property("view-as-markdown",hi.boolean().optional()),askAi:hi.property("ask-ai",hi.boolean().optional()),chatgpt:hi.boolean().optional(),claude:hi.boolean().optional(),cursor:hi.boolean().optional(),vscode:hi.boolean().optional()});var gnu=hi.object({default:vnu.optional(),options:bnu.optional()});var mnu=hi.object({mdxComponents:hi.property("mdx-components",hi.list(hi.string()).optional()),disableStreamToggle:hi.property("disable-stream-toggle",hi.boolean().optional()),openapiParserV2:hi.property("openapi-parser-v2",hi.boolean().optional()),openapiParserV3:hi.property("openapi-parser-v3",hi.boolean().optional()),dynamicSnippets:hi.property("dynamic-snippets",hi.boolean().optional())});var Onu=hi.enum_(["claude-3.7","claude-4","command-a"]);var Anu=hi.enum_(["docs","slack","discord"]);var Pnu=hi.object({url:hi.string(),title:hi.string().optional()});var wnu=hi.undiscriminatedUnion([Pnu]);var W9o=hi.object({model:Onu.optional(),systemPrompt:hi.property("system-prompt",hi.string().optional()),location:hi.list(Anu).optional(),datasources:hi.list(wnu).optional()});var jnu=hi.enum_(["summary","summary_large_image","app","player"]);var Enu=hi.object({ogSiteName:hi.property("og:site_name",hi.string().optional()),ogTitle:hi.property("og:title",hi.string().optional()),ogDescription:hi.property("og:description",hi.string().optional()),ogUrl:hi.property("og:url",hi.string().optional()),ogImage:hi.property("og:image",hi.string().optional()),ogImageWidth:hi.property("og:image:width",hi.number().optional()),ogImageHeight:hi.property("og:image:height",hi.number().optional()),ogLocale:hi.property("og:locale",hi.string().optional()),ogLogo:hi.property("og:logo",hi.string().optional()),twitterTitle:hi.property("twitter:title",hi.string().optional()),twitterDescription:hi.property("twitter:description",hi.string().optional()),twitterHandle:hi.property("twitter:handle",hi.string().optional()),twitterImage:hi.property("twitter:image",hi.string().optional()),twitterSite:hi.property("twitter:site",hi.string().optional()),twitterUrl:hi.property("twitter:url",hi.string().optional()),twitterCard:hi.property("twitter:card",jnu.optional()),canonicalHost:hi.property("canonical-host",hi.string().optional())});var Snu=hi.object({source:hi.string(),destination:hi.string(),permanent:hi.boolean().optional()});var Dnu=hi.object({dark:hi.string().optional(),light:hi.string().optional(),height:hi.number().optional(),href:hi.string().optional()});var Cnu=hi.object({dark:hi.string().optional(),light:hi.string().optional()});var Inu=hi.undiscriminatedUnion([hi.string(),Cnu]);var Mnu=hi.object({dark:hi.string().optional(),light:hi.string().optional()});var Q2r=hi.undiscriminatedUnion([hi.string(),Mnu]);var Bnu=hi.object({accentPrimary:hi.property("accent-primary",Q2r.optional()),accentPrimaryDeprecated:hi.property("accentPrimary",Q2r.optional()),background:Q2r.optional(),border:Q2r.optional(),sidebarBackground:hi.property("sidebar-background",Q2r.optional()),headerBackground:hi.property("header-background",Q2r.optional()),cardBackground:hi.property("card-background",Q2r.optional())});var JGa=hi.undiscriminatedUnion([hi.string(),hi.number()]);var KGa=hi.enum_(["normal","italic"]);var Tnu=hi.object({path:hi.string(),weight:JGa.optional(),style:KGa.optional()});var qnu=hi.undiscriminatedUnion([hi.string(),Tnu]);var Rnu=hi.enum_(["auto","block","swap","fallback","optional"]);var $Ga=hi.object({name:hi.string().optional(),path:hi.string().optional(),weight:JGa.optional(),style:KGa.optional(),paths:hi.list(qnu).optional(),display:Rnu.optional(),fallback:hi.list(hi.string()).optional(),fontVariationSettings:hi.property("font-variation-settings",hi.string().optional())});var Nnu=hi.object({headingsFont:$Ga.optional(),bodyFont:$Ga.optional(),codeFont:$Ga.optional()});var Fnu=hi.enum_(["header","header-tabs","sidebar"]);var xnu=hi.enum_(["header","sidebar"]);var znu=hi.enum_(["center","left"]);var Qnu=hi.enum_(["fixed","static"]);var Lnu=hi.object({pageWidth:hi.property("page-width",hi.string().optional()),contentWidth:hi.property("content-width",hi.string().optional()),sidebarWidth:hi.property("sidebar-width",hi.string().optional()),headerHeight:hi.property("header-height",hi.string().optional()),searchbarPlacement:hi.property("searchbar-placement",Fnu.optional()),tabsPlacement:hi.property("tabs-placement",xnu.optional()),contentAlignment:hi.property("content-alignment",znu.optional()),headerPosition:hi.property("header-position",Qnu.optional()),disableHeader:hi.property("disable-header",hi.boolean().optional()),hideNavLinks:hi.property("hide-nav-links",hi.boolean().optional()),hideFeedback:hi.property("hide-feedback",hi.boolean().optional())});var Unu=hi.enum_(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]);var Vnu=hi.undiscriminatedUnion([hi.boolean(),hi.list(Unu)]);var Wnu=hi.object({searchText:hi.property("search-text",hi.string().optional()),disableSearch:hi.property("disable-search",hi.boolean().optional()),darkModeCode:hi.property("dark-mode-code",hi.boolean().optional()),defaultSearchFilters:hi.property("default-search-filters",hi.boolean().optional()),httpSnippets:hi.property("http-snippets",Vnu.optional()),hide404Page:hi.property("hide-404-page",hi.boolean().optional()),useJavascriptAsTypescript:hi.property("use-javascript-as-typescript",hi.boolean().optional()),disableExplorerProxy:hi.property("disable-explorer-proxy",hi.boolean().optional()),disableAnalytics:hi.property("disable-analytics",hi.boolean().optional()),language:UGa.optional()});var Gnu=hi.enum_(["default","minimal"]);var Hnu=hi.enum_(["default","canvas"]);var Jnu=hi.enum_(["default","bubble"]);var Knu=hi.enum_(["default","toolbar"]);var $nu=hi.object({sidebar:Gnu,body:Hnu,tabs:Jnu,pageActions:hi.property("page-actions",Knu)});var Ynu=hi.object({intercom:hi.string().optional()});var Xnu=hi.undiscriminatedUnion([hi.string(),hi.list(hi.string())]);var YGa=hi.enum_(["beforeInteractive","afterInteractive","lazyOnload"]);var Znu=hi.object({url:hi.string(),strategy:YGa.optional()});var knu=hi.object({path:hi.string(),strategy:YGa.optional()});var eiu=hi.undiscriminatedUnion([hi.string(),knu]);var G9o=hi.undiscriminatedUnion([Znu,eiu]);var tiu=hi.undiscriminatedUnion([G9o,hi.list(G9o)]);var Nph=hi.object({instances:hi.list(kru),title:hi.string().optional(),analytics:$ru.optional(),announcement:enu.optional(),roles:hi.list(Via).optional(),tabs:hi.record(Qdt,gxi).optional(),versions:hi.list(GGa).optional(),products:hi.list(anu).optional(),landingPage:hi.property("landing-page",Ldt.optional()),navigation:mxi.optional(),navbarLinks:hi.property("navbar-links",hi.list(hnu).optional()),footerLinks:hi.property("footer-links",ynu.optional()),pageActions:hi.property("page-actions",gnu.optional()),experimental:mnu.optional(),defaultLanguage:hi.property("default-language",Uru.optional()),languages:hi.list(UGa).optional(),aiChat:hi.property("ai-chat",W9o.optional()),aiSearch:hi.property("ai-search",W9o.optional()),metadata:Enu.optional(),redirects:hi.list(Snu).optional(),logo:Dnu.optional(),favicon:hi.string().optional(),backgroundImage:hi.property("background-image",Inu.optional()),colors:Bnu.optional(),typography:Nnu.optional(),layout:Lnu.optional(),settings:Wnu.optional(),theme:$nu.optional(),integrations:Ynu.optional(),css:Xnu.optional(),js:tiu.optional()});var Fph=hi.object({tabs:hi.record(Qdt,gxi).optional(),landingPage:hi.property("landing-page",Ldt.optional()),navigation:mxi});var riu=hi.object({version:hi.string(),package:hi.string()});var Udt=hi.undiscriminatedUnion([hi.string(),riu]);var niu=hi.object({python:Udt.optional(),typescript:Udt.optional(),go:Udt.optional(),java:Udt.optional(),ruby:Udt.optional(),csharp:Udt.optional(),php:Udt.optional(),swift:Udt.optional(),rust:Udt.optional()});var iiu=hi.object({href:hi.string().optional()});var L2r=hi.object({environments:hi.list(hi.string()).optional(),button:iiu.optional(),oauth:hi.boolean().optional(),limitWebsocketMessagesPerConnection:hi.property("limit-websocket-messages-per-connection",hi.number().optional())});var aiu=hi.object({api:hi.string(),apiName:hi.property("api-name",hi.string().optional()),openrpc:hi.string().optional(),audiences:F2r.optional(),displayErrors:hi.property("display-errors",hi.boolean().optional()),snippets:niu.optional(),postman:hi.string().optional(),summary:hi.string().optional(),layout:hi.list(hi.lazy(()=>U2r)).optional(),collapsed:hi.boolean().optional(),icon:hi.string().optional(),slug:hi.string().optional(),hidden:hi.boolean().optional(),availability:bAe.optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),alphabetized:hi.boolean().optional(),flattened:hi.boolean().optional(),paginated:hi.boolean().optional(),playground:L2r.optional()}).extend(xL).extend(zL);var XGa=hi.object({link:hi.string(),href:hi.string(),icon:hi.string().optional()});var oiu=hi.object({changelog:VGa,title:hi.string().optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional()}).extend(xL).extend(zL);var siu=hi.object({folder:hi.string(),title:hi.string().optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),collapsed:hi.boolean().optional(),availability:bAe.optional()}).extend(xL).extend(zL);var x2r=hi.undiscriminatedUnion([Ldt,hi.lazyObject(()=>uiu),aiu,XGa,oiu,siu]);var uiu=hi.object({section:hi.string(),path:hi.string().optional(),contents:hi.list(hi.lazy(()=>x2r)),collapsed:hi.boolean().optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),availability:bAe.optional()}).extend(xL).extend(zL);var ciu=hi.object({endpoint:hi.string(),title:hi.string().optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),availability:bAe.optional(),playground:L2r.optional()}).extend(xL).extend(zL);var U2r=hi.undiscriminatedUnion([hi.string(),hi.record(hi.string(),hi.lazy(()=>fiu)),hi.lazyObject(()=>liu),ciu,Ldt,XGa]);var liu=hi.object({section:hi.string(),referencedPackages:hi.property("referenced-packages",hi.list(hi.string()).optional()),summary:hi.string().optional(),contents:hi.list(hi.lazy(()=>U2r)).optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),availability:bAe.optional(),playground:L2r.optional()}).extend(xL).extend(zL);var fiu=hi.undiscriminatedUnion([hi.list(hi.lazy(()=>U2r)),hi.lazyObject(()=>diu)]);var diu=hi.object({title:hi.string().optional(),summary:hi.string().optional(),contents:hi.list(hi.lazy(()=>U2r)).optional(),availability:bAe.optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),playground:L2r.optional()}).extend(xL).extend(zL);var piu=hi.object({displayName:hi.property("display-name",hi.string()),path:hi.string(),slug:hi.string().optional()}).extend(xL).extend(zL);var _iu=hi.object({href:hi.string()});var xph=hi.undiscriminatedUnion([piu,_iu]);var zph=hi.object({tabs:hi.record(Qdt,gxi).optional(),landingPage:hi.property("landing-page",Ldt.optional()),navigation:mxi});var Dw={};yf(Dw,{API_ORIGIN_LOCATION_KEY:()=>q_h,API_SETTINGS_KEY:()=>zES,ASYNC_API_LOCATION_KEY:()=>R_h,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>N_h,DEFAULT_GROUP_NAME:()=>A9o,ExampleStyle:()=>Vph,FormParameterEncoding:()=>Hph,GenerationLanguage:()=>Qph,GithubCommitAndReleaseMode:()=>Kph,GithubLicenseType:()=>$ph,Language:()=>Jph,MessageNamingSettingsSchema:()=>Gph,OPENAPI_LOCATION_KEY:()=>F_h,OPENAPI_OVERRIDES_LOCATION_KEY:()=>xES,UnionSettingsSchema:()=>Wph,fernDefinition:()=>dZl,generators:()=>uZl,getPackageName:()=>Lph,group:()=>cZl,isApiConfigurationV2Schema:()=>x_h,isAsyncApiSpecSchema:()=>z_h,isConjureSchema:()=>Q_h,isNamespacedApiConfiguration:()=>L_h,isOpenApiSpecSchema:()=>U_h,isOpenRpcSpecSchema:()=>V_h,isProtoSpecSchema:()=>W_h,isRawProtobufAPIDefinitionSchema:()=>Uph,license:()=>lZl,reviewers:()=>Yph,serialization:()=>MZl});var Qph={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function Lph({generatorInvocation:e}){return e.language==="go"?BES(e):e.outputMode._visit({downloadFiles:()=>{},github:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),githubV2:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),publish:()=>{},publishV2:()=>{},_other:()=>{}})}function BES(e){return e.outputMode._visit({downloadFiles:()=>{},github:t=>`github.com/${t.owner}/${t.repo}`,githubV2:t=>`github.com/${t.owner}/${t.repo}`,publish:()=>{},publishV2:()=>{},_other:()=>{}})}function Uph(e){return typeof e!="string"&&"proto"in e}var uZl={};yf(uZl,{ExampleStyle:()=>Vph,FormParameterEncoding:()=>Hph,Language:()=>Jph,MessageNamingSettingsSchema:()=>Gph,UnionSettingsSchema:()=>Wph});var Vph={Minimal:"minimal",Comprehensive:"comprehensive"};var Wph={V1:"v1"};var Gph={V1:"v1",V2:"v2"};var Hph={Form:"form",Json:"json"};var Jph={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};var cZl={};yf(cZl,{GithubCommitAndReleaseMode:()=>Kph});var Kph={Commit:"commit",Release:"release"};var lZl={};yf(lZl,{GithubLicenseType:()=>$ph});var $ph={Mit:"MIT",Apache:"Apache-2.0"};var Yph={};var dZl={};yf(dZl,{AvailabilityStatusSchema:()=>Zph,auth:()=>Xph,availability:()=>fZl,commons:()=>kph,encoding:()=>e_h,environments:()=>t_h,file:()=>r_h,service:()=>n_h,types:()=>i_h,validation:()=>a_h});var Xph={};var fZl={};yf(fZl,{AvailabilityStatusSchema:()=>Zph});var Zph={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var kph={};var e_h={};var t_h={};var r_h={};var n_h={};var i_h={};var a_h={};var MZl={};yf(MZl,{ApiConfigurationSchema:()=>mau,ApiConfigurationSchemaInternal:()=>oHa,ApiConfigurationV2Schema:()=>gau,ApiConfigurationV2SpecsSchema:()=>eau,ApiDefinitionList:()=>xiu,ApiDefinitionPathSchema:()=>jxi,ApiDefinitionSchema:()=>Fiu,ApiDefinitionSettingsSchema:()=>Exi,ApiDefinitionWithOverridesSchema:()=>nHa,AsyncApiSettingsSchema:()=>Kiu,AsyncApiSpecSchema:()=>$iu,BaseApiSettingsSchema:()=>cHa,ConjureSchema:()=>kiu,CratesOutputLocationSchema:()=>xau,ExampleStyle:()=>Sau,FormParameterEncoding:()=>Uiu,GeneratorApiSettingsSchema:()=>$au,GeneratorGroupSchema:()=>Xau,GeneratorInvocationSchema:()=>Yau,GeneratorOutputSchema:()=>zau,GeneratorPublishMetadataSchema:()=>Z9o,GeneratorSnippetsSchema:()=>Kau,GeneratorsConfigurationSchema:()=>T_h,GeneratorsOpenApiObjectSchema:()=>Zau,GeneratorsOpenApiSchema:()=>kau,GithubCommitAndReleaseMode:()=>Vau,GithubCommitAndReleaseSchema:()=>Wau,GithubConfigurationSchema:()=>Jau,GithubLicenseCustomSchema:()=>Lau,GithubLicenseSchema:()=>Vdt,GithubLicenseType:()=>Qau,GithubPullRequestSchema:()=>Gau,GithubPushSchema:()=>Hau,GithubSelfhostedSchema:()=>Uau,Language:()=>jau,LocalFileSystemOutputLocationSchema:()=>Rau,MavenOutputLocationSchema:()=>Mau,MavenOutputSignatureSchema:()=>Iau,MessageNamingSettingsSchema:()=>rHa,NamespacedApiConfigurationSchema:()=>ziu,NpmOutputLocationSchema:()=>Cau,NugetOutputLocationSchema:()=>Nau,OpenApiExampleGenerationSchema:()=>Wiu,OpenApiFilterSchema:()=>Viu,OpenApiSettingsSchema:()=>lHa,OpenApiSpecSchema:()=>Jiu,OpenRpcSpecSchema:()=>Xiu,OutputMetadataAuthor:()=>Pau,OutputMetadataSchema:()=>Dxi,PostmanOutputLocationSchema:()=>qau,ProtobufApiDefinitionSchema:()=>aHa,ProtobufDefinitionSchema:()=>iHa,ProtobufSpecSchema:()=>Yiu,PypiOutputLocationSchema:()=>Tau,PypiOutputMetadataSchema:()=>Bau,ReadmeCustomSectionSchema:()=>Eau,ReadmeEndpointObjectSchema:()=>wau,ReadmeEndpointSchema:()=>Y9o,ReadmeSchema:()=>Dau,RequestOrResponseExampleGenerationSchema:()=>$9o,ResolveAliases:()=>Hiu,ResolveAliasesSchema:()=>Giu,ReviewerSchema:()=>X9o,ReviewersSchema:()=>Cxi,RubyGemsOutputLocationSchema:()=>Fau,SpecSchema:()=>Ziu,UnionSettingsSchema:()=>Niu,WhitelabelConfigurationSchema:()=>Aau,WhitelabelGithubConfigurationSchema:()=>Oau,fernDefinition:()=>IZl,generators:()=>vZl,group:()=>bZl,license:()=>gZl,reviewers:()=>mZl});var vZl={};yf(vZl,{ApiConfigurationSchema:()=>mau,ApiConfigurationSchemaInternal:()=>oHa,ApiConfigurationV2Schema:()=>gau,ApiConfigurationV2SpecsSchema:()=>eau,ApiDefinitionList:()=>xiu,ApiDefinitionPathSchema:()=>jxi,ApiDefinitionSchema:()=>Fiu,ApiDefinitionSettingsSchema:()=>Exi,ApiDefinitionWithOverridesSchema:()=>nHa,AsyncApiSettingsSchema:()=>Kiu,AsyncApiSpecSchema:()=>$iu,BaseApiSettingsSchema:()=>cHa,ConjureSchema:()=>kiu,ExampleStyle:()=>Sau,FormParameterEncoding:()=>Uiu,GeneratorsConfigurationSchema:()=>T_h,GeneratorsOpenApiObjectSchema:()=>Zau,GeneratorsOpenApiSchema:()=>kau,Language:()=>jau,MessageNamingSettingsSchema:()=>rHa,NamespacedApiConfigurationSchema:()=>ziu,OpenApiExampleGenerationSchema:()=>Wiu,OpenApiFilterSchema:()=>Viu,OpenApiSettingsSchema:()=>lHa,OpenApiSpecSchema:()=>Jiu,OpenRpcSpecSchema:()=>Xiu,OutputMetadataAuthor:()=>Pau,OutputMetadataSchema:()=>Dxi,ProtobufApiDefinitionSchema:()=>aHa,ProtobufDefinitionSchema:()=>iHa,ProtobufSpecSchema:()=>Yiu,ReadmeCustomSectionSchema:()=>Eau,ReadmeEndpointObjectSchema:()=>wau,ReadmeEndpointSchema:()=>Y9o,ReadmeSchema:()=>Dau,RequestOrResponseExampleGenerationSchema:()=>$9o,ResolveAliases:()=>Hiu,ResolveAliasesSchema:()=>Giu,SpecSchema:()=>Ziu,UnionSettingsSchema:()=>Niu,WhitelabelConfigurationSchema:()=>Aau,WhitelabelGithubConfigurationSchema:()=>Oau});var Qa={};yf(Qa,{JsonError:()=>ZGa,ParseError:()=>kGa,any:()=>m_h,bigint:()=>s_h,boolean:()=>O_h,booleanLiteral:()=>g_h,date:()=>u_h,discriminant:()=>I_h,enum_:()=>yiu,getObjectLikeUtils:()=>yBr,getObjectUtils:()=>Wia,getSchemaUtils:()=>B7,isProperty:()=>Pxi,lazy:()=>c_h,lazyObject:()=>y_h,list:()=>biu,number:()=>A_h,object:()=>viu,objectWithoutOptionalProperties:()=>h_h,optional:()=>pZl,property:()=>f_h,record:()=>E_h,set:()=>S_h,string:()=>P_h,stringLiteral:()=>b_h,transform:()=>_Zl,undiscriminatedUnion:()=>C_h,union:()=>B_h,unknown:()=>w_h,withParsedProperties:()=>yZl});var qM={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",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function M7(e,t){return`Expected ${t}. Received ${TES(e)}.`}function TES(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 ofe(e){return{...e,json:o_h(e.json),parse:o_h(e.parse)}}function o_h(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
2082
+ `)),{ok:!0,value:t}):n}}function xru(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var zGa=class e extends Error{errors;constructor(t){super(t.map(xru).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var QGa=class e extends Error{errors;constructor(t){super(t.map(xru).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function I7(e){return{nullable:()=>DES(e),optional:()=>rZl(e),optionalNullable:()=>CES(e),transform:t=>nZl(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new QGa(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new zGa(n.errors)}}}function DES(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>TM.NULLABLE};return{...t,...I7(t)}}function rZl(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>TM.OPTIONAL};return{...t,...I7(t)}}function CES(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>TM.OPTIONAL_NULLABLE};return{...t,...I7(t)}}function nZl(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(n,i)=>{let a=t.untransform(n);return e.json(a,i)},getType:()=>e.getType()};return{...r,...I7(r)}}function lph(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:C7(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:C7(t,"bigint")}]}:{ok:!0,value:t},getType:()=>TM.BIGINT};return{...afe(e),...I7(e)}}var IES=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function fph(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:C7(t,"string")}]}:IES.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:C7(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:C7(t,"Date object")}]},getType:()=>TM.DATE};return{...afe(e),...I7(e)}}function vAe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...afe(r),...I7(r)}}}function zru(e){let t=new Set(e);return vAe(TM.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:C7(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:C7(n,"enum")}]}:{ok:!0,value:n})()}function dph(e){let t=iZl(e);return{...t,...I7(t)}}function iZl(e){return{parse:(t,r)=>LGa(e).parse(t,r),json:(t,r)=>LGa(e).json(t,r),getType:()=>LGa(e).getType()}}function LGa(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function z9o(e){return Object.entries(e)}function Q9o(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function vxi(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function L9o(e){return Object.keys(e)}function pph(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function hBr(e){return{withParsedProperties:t=>aZl(e,t)}}function aZl(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[f,u])=>({...c,[f]:typeof u=="function"?u(a.value):u}),{});return{ok:!0,value:{...a.value,...o}}},json:(n,i)=>{if(!vxi(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:C7(n,"object")}]};let a=new Set(Object.keys(t)),o=Q9o(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(o,i)},getType:()=>e.getType()};return{...r,...I7(r),...hBr(r)}}function _ph(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function bxi(e){return e.isProperty}function Qru(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>bxi(n)?n.rawKey:r),_getParsedProperties:()=>L9o(e),parse:(r,n)=>{let i={},a=[];for(let[o,c]of z9o(e)){let f=bxi(c)?c.rawKey:o,u=bxi(c)?c.valueSchema:c,s={rawKey:f,parsedKey:o,valueSchema:u};i[f]=s,vph(u)&&a.push(f)}return hph({value:r,requiredKeys:a,getProperty:o=>{let c=i[o];if(c!=null)return{transformedKey:c.parsedKey,transform:f=>c.valueSchema.parse(f,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,o]of z9o(e)){let c=bxi(o)?o.valueSchema:o;vph(c)&&i.push(a)}return hph({value:r,requiredKeys:i,getProperty:a=>{let o=e[a];if(o!=null)return bxi(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>TM.OBJECT};return{...afe(t),...I7(t),...hBr(t),...Uia(t)}}function hph({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!vxi(e))return{ok:!1,errors:[{path:a,message:C7(e,"object")}]};let o=new Set(t),c=[],f={};for(let[u,s]of Object.entries(e)){let l=r(u);if(l!=null){o.delete(u);let m=l.transform(s);m.ok?f[l.transformedKey]=m.value:(f[u]=s,c.push(...m.errors))}else switch(n){case"fail":c.push({path:[...a,u],message:`Unexpected key "${u}"`});break;case"strip":break;case"passthrough":f[u]=s;break}}return c.push(...t.filter(u=>o.has(u)).map(u=>({path:a,message:`Missing required key "${u}"`}))),c.length===0||i?{ok:!0,value:f}:{ok:!1,errors:c}}function Uia(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>yph({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>yph({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>TM.OBJECT};return{...r,...I7(r),...hBr(r),...Uia(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,n)=>{let i=e.parse(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},json:(r,n)=>{let i=e.json(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},getType:()=>TM.OBJECT};return{...t,...I7(t),...hBr(t),...Uia(t)}}}}function yph({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,o]=pph(L9o(t),u=>i.has(u)),c=r(Q9o(t,o)),f=n(Q9o(t,a));return c.ok&&f.ok?{ok:!0,value:{...c.value,...f.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...f.ok?[]:f.errors]}}function vph(e){return!MES(e)}function MES(e){switch(e.getType()){case TM.ANY:case TM.UNKNOWN:case TM.OPTIONAL:case TM.OPTIONAL_NULLABLE:return!0;default:return!1}}function bph(e){return Qru(e)}function gph(e){let t={...iZl(e),_getRawProperties:()=>LGa(e)._getRawProperties(),_getParsedProperties:()=>LGa(e)._getParsedProperties()};return{...t,...I7(t),...hBr(t),...Uia(t)}}function Lru(e){let t={parse:(r,n)=>mph(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>mph(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>TM.LIST};return{...afe(t),...I7(t)}}function mph(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let a=[];return n.ok||a.push(...n.errors),i.ok||a.push(...i.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:C7(e,"list"),path:[]}]}}function Oph(e){return vAe(TM.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:C7(r,`"${e}"`)}]})()}function Aph(e){return vAe(TM.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:C7(r,`${e.toString()}`)}]})()}var Pph=vAe(TM.ANY,e=>({ok:!0,value:e}));var wph=vAe(TM.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:C7(e,"boolean")}]});var jph=vAe(TM.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:C7(e,"number")}]});var Eph=vAe(TM.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:C7(e,"string")}]});var Sph=vAe(TM.UNKNOWN,e=>({ok:!0,value:e}));function Cph(e,t){let r={parse:(n,i)=>Dph({value:n,isKeyNumeric:e.getType()===TM.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>Dph({value:n,isKeyNumeric:e.getType()===TM.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>TM.RECORD};return{...afe(r),...I7(r)}}function Dph({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return vxi(e)?z9o(e).reduce((a,[o,c])=>{if(c===void 0)return a;let f=a,u=o;if(t){let O=o.length>0?Number(o):NaN;isNaN(O)||(u=O)}let s=r(u),l=n(c,u);if(f.ok&&s.ok&&l.ok)return{ok:!0,value:{...f.value,[s.value]:l.value}};let m=[];return f.ok||m.push(...f.errors),s.ok||m.push(...s.errors),l.ok||m.push(...l.errors),{ok:!1,errors:m}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:C7(e,"object")}]}}function Iph(e){let t=Lru(e),r={parse:(n,i)=>{let a=t.parse(n,i);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:C7(n,"Set")}]},getType:()=>TM.SET};return{...afe(r),...I7(r)}}function Bph(e){let t={parse:(r,n)=>Mph((i,a)=>i.parse(r,a),e,n),json:(r,n)=>Mph((i,a)=>i.json(r,a),e,n),getType:()=>TM.UNDISCRIMINATED_UNION};return{...afe(t),...I7(t)}}function Mph(e,t,r){let n=[];for(let[i,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)n.push({path:c.path,message:`[Variant ${i}] ${c.message}`})}return{ok:!1,errors:n}}function Tph(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function Rph(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=zru(L9o(t)),a={parse:(o,c)=>qph({value:o,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:f=>i.parse(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.parse(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>qph({value:o,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:f=>i.json(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.json(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>TM.UNION};return{...afe(a),...I7(a),...hBr(a)}}function qph({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!vxi(e))return{ok:!1,errors:[{path:c,message:C7(e,"object")}]};let{[t]:f,...u}=e;if(f==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let s=n(f);if(!s.ok)return{ok:!1,errors:s.errors};let l=i(s.value);if(l==null)return a?{ok:!0,value:{[r]:s.value,...u}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let m=o(u,l);return m.ok?{ok:!0,value:{[r]:f,...m.value}}:m}var Uru=hi.enum_(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]);var UGa=hi.enum_(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]);var Vru=hi.object({writeKey:hi.property("write-key",hi.string())});var Wru=hi.object({orgId:hi.property("org-id",hi.string())});var Gru=hi.object({appId:hi.property("app-id",hi.string()),apiBase:hi.property("api-base",hi.string().optional())});var Hru=hi.object({apiKey:hi.property("api-key",hi.string()),endpoint:hi.string().optional()});var Jru=hi.object({containerId:hi.property("container-id",hi.string())});var Kru=hi.object({measurementId:hi.property("measurement-id",hi.string())});var $ru=hi.object({segment:Vru.optional(),fullstory:Wru.optional(),intercom:Gru.optional(),posthog:Hru.optional(),gtm:Jru.optional(),ga4:Kru.optional()});var Yru=hi.undiscriminatedUnion([hi.string(),hi.list(hi.string())]);var Xru=hi.object({host:hi.string().optional(),owner:hi.string(),repo:hi.string(),branch:hi.string().optional()});var Zru=hi.object({github:Xru.optional()});var U9o=hi.string();var F2r=hi.undiscriminatedUnion([U9o,hi.list(U9o)]);var kru=hi.object({url:hi.string(),customDomain:hi.property("custom-domain",Yru.optional()),private:hi.boolean().optional(),editThisPage:hi.property("edit-this-page",Zru.optional()),audiences:F2r.optional()});var enu=hi.object({message:hi.string()});var Via=hi.string();var Qdt=hi.string();var VGa=hi.string();var WGa=hi.undiscriminatedUnion([Via,hi.list(Via)]);var xL=hi.object({viewers:WGa.optional(),orphaned:hi.boolean().optional()});var V9o=hi.object({flag:hi.string(),fallbackValue:hi.property("fallback-value",hi.unknown().optional()),match:hi.unknown().optional()});var tnu=hi.undiscriminatedUnion([hi.string(),V9o,hi.list(V9o)]);var zL=hi.object({featureFlag:hi.property("feature-flag",tnu.optional())});var gxi=hi.object({displayName:hi.property("display-name",hi.string()),icon:hi.string().optional(),slug:hi.string().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),hidden:hi.boolean().optional(),href:hi.string().optional(),changelog:VGa.optional()}).extend(xL).extend(zL);var rnu=hi.enum_(["deprecated","ga","stable","beta"]);var GGa=hi.object({displayName:hi.property("display-name",hi.string()),path:hi.string(),slug:hi.string().optional(),availability:rnu.optional(),audiences:F2r.optional()}).extend(xL).extend(zL);var HGa=hi.object({displayName:hi.property("display-name",hi.string()),subtitle:hi.string().optional(),icon:hi.string().optional(),image:hi.string().optional(),versions:hi.list(GGa).optional(),audiences:F2r.optional()}).extend(xL).extend(zL);var nnu=hi.object({path:hi.string(),slug:hi.string().optional()}).extend(HGa);var inu=hi.object({href:hi.string()}).extend(HGa);var anu=hi.undiscriminatedUnion([nnu,inu]);var bAe=hi.enum_(["stable","generally-available","in-development","pre-release","deprecated","beta"]);var Ldt=hi.object({page:hi.string(),path:hi.string(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),noindex:hi.boolean().optional(),availability:bAe.optional()}).extend(xL).extend(zL);var onu=hi.list(hi.lazy(()=>x2r));var snu=hi.object({tab:Qdt,layout:hi.list(hi.lazy(()=>x2r)).optional()});var unu=hi.object({title:hi.string(),subtitle:hi.string().optional(),icon:hi.string().optional(),layout:hi.list(hi.lazy(()=>x2r)),slug:hi.string().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),hidden:hi.boolean().optional(),default:hi.boolean().optional()}).extend(xL).extend(zL);var cnu=hi.object({tab:Qdt,variants:hi.list(unu)});var lnu=hi.undiscriminatedUnion([snu,cnu]);var fnu=hi.list(lnu);var mxi=hi.undiscriminatedUnion([onu,fnu]);var Oxi=hi.object({viewers:WGa.optional()});var z2r=hi.object({href:hi.string().optional(),url:hi.string().optional(),text:hi.string().optional(),icon:hi.string().optional(),rightIcon:hi.string().optional(),rounded:hi.boolean().optional()}).extend(Oxi);var dnu=hi.object({url:hi.string()}).extend(Oxi);var pnu=hi.undiscriminatedUnion([hi.string(),dnu]);var _nu=hi.object({links:hi.list(z2r),text:hi.string().optional(),icon:hi.string().optional(),rightIcon:hi.string().optional(),rounded:hi.boolean().optional()}).extend(Oxi);var hnu=hi.union("type",{filled:z2r,outlined:z2r,minimal:z2r,github:hi.object({value:pnu}),dropdown:_nu,primary:z2r,secondary:z2r}).transform({transform:e=>e,untransform:e=>e});var ynu=hi.object({github:hi.string().optional(),twitter:hi.string().optional(),x:hi.string().optional(),linkedin:hi.string().optional(),youtube:hi.string().optional(),instagram:hi.string().optional(),facebook:hi.string().optional(),discord:hi.string().optional(),slack:hi.string().optional(),hackernews:hi.string().optional(),medium:hi.string().optional(),website:hi.string().optional()});var vnu=hi.enum_(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]);var bnu=hi.object({copyPage:hi.property("copy-page",hi.boolean().optional()),viewAsMarkdown:hi.property("view-as-markdown",hi.boolean().optional()),askAi:hi.property("ask-ai",hi.boolean().optional()),chatgpt:hi.boolean().optional(),claude:hi.boolean().optional(),cursor:hi.boolean().optional(),vscode:hi.boolean().optional()});var gnu=hi.object({default:vnu.optional(),options:bnu.optional()});var mnu=hi.object({mdxComponents:hi.property("mdx-components",hi.list(hi.string()).optional()),disableStreamToggle:hi.property("disable-stream-toggle",hi.boolean().optional()),openapiParserV2:hi.property("openapi-parser-v2",hi.boolean().optional()),openapiParserV3:hi.property("openapi-parser-v3",hi.boolean().optional()),dynamicSnippets:hi.property("dynamic-snippets",hi.boolean().optional())});var Onu=hi.enum_(["claude-3.7","claude-4","command-a"]);var Anu=hi.enum_(["docs","slack","discord"]);var Pnu=hi.object({url:hi.string(),title:hi.string().optional()});var wnu=hi.undiscriminatedUnion([Pnu]);var W9o=hi.object({model:Onu.optional(),systemPrompt:hi.property("system-prompt",hi.string().optional()),location:hi.list(Anu).optional(),datasources:hi.list(wnu).optional()});var jnu=hi.enum_(["summary","summary_large_image","app","player"]);var Enu=hi.object({ogSiteName:hi.property("og:site_name",hi.string().optional()),ogTitle:hi.property("og:title",hi.string().optional()),ogDescription:hi.property("og:description",hi.string().optional()),ogUrl:hi.property("og:url",hi.string().optional()),ogImage:hi.property("og:image",hi.string().optional()),ogImageWidth:hi.property("og:image:width",hi.number().optional()),ogImageHeight:hi.property("og:image:height",hi.number().optional()),ogLocale:hi.property("og:locale",hi.string().optional()),ogLogo:hi.property("og:logo",hi.string().optional()),twitterTitle:hi.property("twitter:title",hi.string().optional()),twitterDescription:hi.property("twitter:description",hi.string().optional()),twitterHandle:hi.property("twitter:handle",hi.string().optional()),twitterImage:hi.property("twitter:image",hi.string().optional()),twitterSite:hi.property("twitter:site",hi.string().optional()),twitterUrl:hi.property("twitter:url",hi.string().optional()),twitterCard:hi.property("twitter:card",jnu.optional()),canonicalHost:hi.property("canonical-host",hi.string().optional())});var Snu=hi.object({source:hi.string(),destination:hi.string(),permanent:hi.boolean().optional()});var Dnu=hi.object({dark:hi.string().optional(),light:hi.string().optional(),height:hi.number().optional(),href:hi.string().optional()});var Cnu=hi.object({dark:hi.string().optional(),light:hi.string().optional()});var Inu=hi.undiscriminatedUnion([hi.string(),Cnu]);var Mnu=hi.object({dark:hi.string().optional(),light:hi.string().optional()});var Q2r=hi.undiscriminatedUnion([hi.string(),Mnu]);var Bnu=hi.object({accentPrimary:hi.property("accent-primary",Q2r.optional()),accentPrimaryDeprecated:hi.property("accentPrimary",Q2r.optional()),background:Q2r.optional(),border:Q2r.optional(),sidebarBackground:hi.property("sidebar-background",Q2r.optional()),headerBackground:hi.property("header-background",Q2r.optional()),cardBackground:hi.property("card-background",Q2r.optional())});var JGa=hi.undiscriminatedUnion([hi.string(),hi.number()]);var KGa=hi.enum_(["normal","italic"]);var Tnu=hi.object({path:hi.string(),weight:JGa.optional(),style:KGa.optional()});var qnu=hi.undiscriminatedUnion([hi.string(),Tnu]);var Rnu=hi.enum_(["auto","block","swap","fallback","optional"]);var $Ga=hi.object({name:hi.string().optional(),path:hi.string().optional(),weight:JGa.optional(),style:KGa.optional(),paths:hi.list(qnu).optional(),display:Rnu.optional(),fallback:hi.list(hi.string()).optional(),fontVariationSettings:hi.property("font-variation-settings",hi.string().optional())});var Nnu=hi.object({headingsFont:$Ga.optional(),bodyFont:$Ga.optional(),codeFont:$Ga.optional()});var Fnu=hi.enum_(["header","header-tabs","sidebar"]);var xnu=hi.enum_(["header","sidebar"]);var znu=hi.enum_(["center","left"]);var Qnu=hi.enum_(["fixed","static"]);var Lnu=hi.object({pageWidth:hi.property("page-width",hi.string().optional()),contentWidth:hi.property("content-width",hi.string().optional()),sidebarWidth:hi.property("sidebar-width",hi.string().optional()),headerHeight:hi.property("header-height",hi.string().optional()),searchbarPlacement:hi.property("searchbar-placement",Fnu.optional()),tabsPlacement:hi.property("tabs-placement",xnu.optional()),contentAlignment:hi.property("content-alignment",znu.optional()),headerPosition:hi.property("header-position",Qnu.optional()),disableHeader:hi.property("disable-header",hi.boolean().optional()),hideNavLinks:hi.property("hide-nav-links",hi.boolean().optional()),hideFeedback:hi.property("hide-feedback",hi.boolean().optional())});var Unu=hi.enum_(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]);var Vnu=hi.undiscriminatedUnion([hi.boolean(),hi.list(Unu)]);var Wnu=hi.object({searchText:hi.property("search-text",hi.string().optional()),disableSearch:hi.property("disable-search",hi.boolean().optional()),darkModeCode:hi.property("dark-mode-code",hi.boolean().optional()),defaultSearchFilters:hi.property("default-search-filters",hi.boolean().optional()),httpSnippets:hi.property("http-snippets",Vnu.optional()),hide404Page:hi.property("hide-404-page",hi.boolean().optional()),useJavascriptAsTypescript:hi.property("use-javascript-as-typescript",hi.boolean().optional()),disableExplorerProxy:hi.property("disable-explorer-proxy",hi.boolean().optional()),disableAnalytics:hi.property("disable-analytics",hi.boolean().optional()),language:UGa.optional()});var Gnu=hi.enum_(["default","minimal"]);var Hnu=hi.enum_(["default","canvas"]);var Jnu=hi.enum_(["default","bubble"]);var Knu=hi.enum_(["default","toolbar"]);var $nu=hi.object({sidebar:Gnu.optional(),body:Hnu.optional(),tabs:Jnu.optional(),pageActions:hi.property("page-actions",Knu.optional())});var Ynu=hi.object({intercom:hi.string().optional()});var Xnu=hi.undiscriminatedUnion([hi.string(),hi.list(hi.string())]);var YGa=hi.enum_(["beforeInteractive","afterInteractive","lazyOnload"]);var Znu=hi.object({url:hi.string(),strategy:YGa.optional()});var knu=hi.object({path:hi.string(),strategy:YGa.optional()});var eiu=hi.undiscriminatedUnion([hi.string(),knu]);var G9o=hi.undiscriminatedUnion([Znu,eiu]);var tiu=hi.undiscriminatedUnion([G9o,hi.list(G9o)]);var Nph=hi.object({instances:hi.list(kru),title:hi.string().optional(),analytics:$ru.optional(),announcement:enu.optional(),roles:hi.list(Via).optional(),tabs:hi.record(Qdt,gxi).optional(),versions:hi.list(GGa).optional(),products:hi.list(anu).optional(),landingPage:hi.property("landing-page",Ldt.optional()),navigation:mxi.optional(),navbarLinks:hi.property("navbar-links",hi.list(hnu).optional()),footerLinks:hi.property("footer-links",ynu.optional()),pageActions:hi.property("page-actions",gnu.optional()),experimental:mnu.optional(),defaultLanguage:hi.property("default-language",Uru.optional()),languages:hi.list(UGa).optional(),aiChat:hi.property("ai-chat",W9o.optional()),aiSearch:hi.property("ai-search",W9o.optional()),metadata:Enu.optional(),redirects:hi.list(Snu).optional(),logo:Dnu.optional(),favicon:hi.string().optional(),backgroundImage:hi.property("background-image",Inu.optional()),colors:Bnu.optional(),typography:Nnu.optional(),layout:Lnu.optional(),settings:Wnu.optional(),theme:$nu.optional(),integrations:Ynu.optional(),css:Xnu.optional(),js:tiu.optional()});var Fph=hi.object({tabs:hi.record(Qdt,gxi).optional(),landingPage:hi.property("landing-page",Ldt.optional()),navigation:mxi});var riu=hi.object({version:hi.string(),package:hi.string()});var Udt=hi.undiscriminatedUnion([hi.string(),riu]);var niu=hi.object({python:Udt.optional(),typescript:Udt.optional(),go:Udt.optional(),java:Udt.optional(),ruby:Udt.optional(),csharp:Udt.optional(),php:Udt.optional(),swift:Udt.optional(),rust:Udt.optional()});var iiu=hi.object({href:hi.string().optional()});var L2r=hi.object({environments:hi.list(hi.string()).optional(),button:iiu.optional(),oauth:hi.boolean().optional(),limitWebsocketMessagesPerConnection:hi.property("limit-websocket-messages-per-connection",hi.number().optional())});var aiu=hi.object({api:hi.string(),apiName:hi.property("api-name",hi.string().optional()),openrpc:hi.string().optional(),audiences:F2r.optional(),displayErrors:hi.property("display-errors",hi.boolean().optional()),snippets:niu.optional(),postman:hi.string().optional(),summary:hi.string().optional(),layout:hi.list(hi.lazy(()=>U2r)).optional(),collapsed:hi.boolean().optional(),icon:hi.string().optional(),slug:hi.string().optional(),hidden:hi.boolean().optional(),availability:bAe.optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),alphabetized:hi.boolean().optional(),flattened:hi.boolean().optional(),paginated:hi.boolean().optional(),playground:L2r.optional()}).extend(xL).extend(zL);var XGa=hi.object({link:hi.string(),href:hi.string(),icon:hi.string().optional()});var oiu=hi.object({changelog:VGa,title:hi.string().optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional()}).extend(xL).extend(zL);var siu=hi.object({folder:hi.string(),title:hi.string().optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),collapsed:hi.boolean().optional(),availability:bAe.optional()}).extend(xL).extend(zL);var x2r=hi.undiscriminatedUnion([Ldt,hi.lazyObject(()=>uiu),aiu,XGa,oiu,siu]);var uiu=hi.object({section:hi.string(),path:hi.string().optional(),contents:hi.list(hi.lazy(()=>x2r)),collapsed:hi.boolean().optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),availability:bAe.optional()}).extend(xL).extend(zL);var ciu=hi.object({endpoint:hi.string(),title:hi.string().optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),availability:bAe.optional(),playground:L2r.optional()}).extend(xL).extend(zL);var U2r=hi.undiscriminatedUnion([hi.string(),hi.record(hi.string(),hi.lazy(()=>fiu)),hi.lazyObject(()=>liu),ciu,Ldt,XGa]);var liu=hi.object({section:hi.string(),referencedPackages:hi.property("referenced-packages",hi.list(hi.string()).optional()),summary:hi.string().optional(),contents:hi.list(hi.lazy(()=>U2r)).optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),availability:bAe.optional(),playground:L2r.optional()}).extend(xL).extend(zL);var fiu=hi.undiscriminatedUnion([hi.list(hi.lazy(()=>U2r)),hi.lazyObject(()=>diu)]);var diu=hi.object({title:hi.string().optional(),summary:hi.string().optional(),contents:hi.list(hi.lazy(()=>U2r)).optional(),availability:bAe.optional(),slug:hi.string().optional(),icon:hi.string().optional(),hidden:hi.boolean().optional(),skipSlug:hi.property("skip-slug",hi.boolean().optional()),playground:L2r.optional()}).extend(xL).extend(zL);var piu=hi.object({displayName:hi.property("display-name",hi.string()),path:hi.string(),slug:hi.string().optional()}).extend(xL).extend(zL);var _iu=hi.object({href:hi.string()});var xph=hi.undiscriminatedUnion([piu,_iu]);var zph=hi.object({tabs:hi.record(Qdt,gxi).optional(),landingPage:hi.property("landing-page",Ldt.optional()),navigation:mxi});var Dw={};yf(Dw,{API_ORIGIN_LOCATION_KEY:()=>q_h,API_SETTINGS_KEY:()=>zES,ASYNC_API_LOCATION_KEY:()=>R_h,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>N_h,DEFAULT_GROUP_NAME:()=>A9o,ExampleStyle:()=>Vph,FormParameterEncoding:()=>Hph,GenerationLanguage:()=>Qph,GithubCommitAndReleaseMode:()=>Kph,GithubLicenseType:()=>$ph,Language:()=>Jph,MessageNamingSettingsSchema:()=>Gph,OPENAPI_LOCATION_KEY:()=>F_h,OPENAPI_OVERRIDES_LOCATION_KEY:()=>xES,UnionSettingsSchema:()=>Wph,fernDefinition:()=>dZl,generators:()=>uZl,getPackageName:()=>Lph,group:()=>cZl,isApiConfigurationV2Schema:()=>x_h,isAsyncApiSpecSchema:()=>z_h,isConjureSchema:()=>Q_h,isNamespacedApiConfiguration:()=>L_h,isOpenApiSpecSchema:()=>U_h,isOpenRpcSpecSchema:()=>V_h,isProtoSpecSchema:()=>W_h,isRawProtobufAPIDefinitionSchema:()=>Uph,license:()=>lZl,reviewers:()=>Yph,serialization:()=>MZl});var Qph={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function Lph({generatorInvocation:e}){return e.language==="go"?BES(e):e.outputMode._visit({downloadFiles:()=>{},github:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),githubV2:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),publish:()=>{},publishV2:()=>{},_other:()=>{}})}function BES(e){return e.outputMode._visit({downloadFiles:()=>{},github:t=>`github.com/${t.owner}/${t.repo}`,githubV2:t=>`github.com/${t.owner}/${t.repo}`,publish:()=>{},publishV2:()=>{},_other:()=>{}})}function Uph(e){return typeof e!="string"&&"proto"in e}var uZl={};yf(uZl,{ExampleStyle:()=>Vph,FormParameterEncoding:()=>Hph,Language:()=>Jph,MessageNamingSettingsSchema:()=>Gph,UnionSettingsSchema:()=>Wph});var Vph={Minimal:"minimal",Comprehensive:"comprehensive"};var Wph={V1:"v1"};var Gph={V1:"v1",V2:"v2"};var Hph={Form:"form",Json:"json"};var Jph={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};var cZl={};yf(cZl,{GithubCommitAndReleaseMode:()=>Kph});var Kph={Commit:"commit",Release:"release"};var lZl={};yf(lZl,{GithubLicenseType:()=>$ph});var $ph={Mit:"MIT",Apache:"Apache-2.0"};var Yph={};var dZl={};yf(dZl,{AvailabilityStatusSchema:()=>Zph,auth:()=>Xph,availability:()=>fZl,commons:()=>kph,encoding:()=>e_h,environments:()=>t_h,file:()=>r_h,service:()=>n_h,types:()=>i_h,validation:()=>a_h});var Xph={};var fZl={};yf(fZl,{AvailabilityStatusSchema:()=>Zph});var Zph={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var kph={};var e_h={};var t_h={};var r_h={};var n_h={};var i_h={};var a_h={};var MZl={};yf(MZl,{ApiConfigurationSchema:()=>mau,ApiConfigurationSchemaInternal:()=>oHa,ApiConfigurationV2Schema:()=>gau,ApiConfigurationV2SpecsSchema:()=>eau,ApiDefinitionList:()=>xiu,ApiDefinitionPathSchema:()=>jxi,ApiDefinitionSchema:()=>Fiu,ApiDefinitionSettingsSchema:()=>Exi,ApiDefinitionWithOverridesSchema:()=>nHa,AsyncApiSettingsSchema:()=>Kiu,AsyncApiSpecSchema:()=>$iu,BaseApiSettingsSchema:()=>cHa,ConjureSchema:()=>kiu,CratesOutputLocationSchema:()=>xau,ExampleStyle:()=>Sau,FormParameterEncoding:()=>Uiu,GeneratorApiSettingsSchema:()=>$au,GeneratorGroupSchema:()=>Xau,GeneratorInvocationSchema:()=>Yau,GeneratorOutputSchema:()=>zau,GeneratorPublishMetadataSchema:()=>Z9o,GeneratorSnippetsSchema:()=>Kau,GeneratorsConfigurationSchema:()=>T_h,GeneratorsOpenApiObjectSchema:()=>Zau,GeneratorsOpenApiSchema:()=>kau,GithubCommitAndReleaseMode:()=>Vau,GithubCommitAndReleaseSchema:()=>Wau,GithubConfigurationSchema:()=>Jau,GithubLicenseCustomSchema:()=>Lau,GithubLicenseSchema:()=>Vdt,GithubLicenseType:()=>Qau,GithubPullRequestSchema:()=>Gau,GithubPushSchema:()=>Hau,GithubSelfhostedSchema:()=>Uau,Language:()=>jau,LocalFileSystemOutputLocationSchema:()=>Rau,MavenOutputLocationSchema:()=>Mau,MavenOutputSignatureSchema:()=>Iau,MessageNamingSettingsSchema:()=>rHa,NamespacedApiConfigurationSchema:()=>ziu,NpmOutputLocationSchema:()=>Cau,NugetOutputLocationSchema:()=>Nau,OpenApiExampleGenerationSchema:()=>Wiu,OpenApiFilterSchema:()=>Viu,OpenApiSettingsSchema:()=>lHa,OpenApiSpecSchema:()=>Jiu,OpenRpcSpecSchema:()=>Xiu,OutputMetadataAuthor:()=>Pau,OutputMetadataSchema:()=>Dxi,PostmanOutputLocationSchema:()=>qau,ProtobufApiDefinitionSchema:()=>aHa,ProtobufDefinitionSchema:()=>iHa,ProtobufSpecSchema:()=>Yiu,PypiOutputLocationSchema:()=>Tau,PypiOutputMetadataSchema:()=>Bau,ReadmeCustomSectionSchema:()=>Eau,ReadmeEndpointObjectSchema:()=>wau,ReadmeEndpointSchema:()=>Y9o,ReadmeSchema:()=>Dau,RequestOrResponseExampleGenerationSchema:()=>$9o,ResolveAliases:()=>Hiu,ResolveAliasesSchema:()=>Giu,ReviewerSchema:()=>X9o,ReviewersSchema:()=>Cxi,RubyGemsOutputLocationSchema:()=>Fau,SpecSchema:()=>Ziu,UnionSettingsSchema:()=>Niu,WhitelabelConfigurationSchema:()=>Aau,WhitelabelGithubConfigurationSchema:()=>Oau,fernDefinition:()=>IZl,generators:()=>vZl,group:()=>bZl,license:()=>gZl,reviewers:()=>mZl});var vZl={};yf(vZl,{ApiConfigurationSchema:()=>mau,ApiConfigurationSchemaInternal:()=>oHa,ApiConfigurationV2Schema:()=>gau,ApiConfigurationV2SpecsSchema:()=>eau,ApiDefinitionList:()=>xiu,ApiDefinitionPathSchema:()=>jxi,ApiDefinitionSchema:()=>Fiu,ApiDefinitionSettingsSchema:()=>Exi,ApiDefinitionWithOverridesSchema:()=>nHa,AsyncApiSettingsSchema:()=>Kiu,AsyncApiSpecSchema:()=>$iu,BaseApiSettingsSchema:()=>cHa,ConjureSchema:()=>kiu,ExampleStyle:()=>Sau,FormParameterEncoding:()=>Uiu,GeneratorsConfigurationSchema:()=>T_h,GeneratorsOpenApiObjectSchema:()=>Zau,GeneratorsOpenApiSchema:()=>kau,Language:()=>jau,MessageNamingSettingsSchema:()=>rHa,NamespacedApiConfigurationSchema:()=>ziu,OpenApiExampleGenerationSchema:()=>Wiu,OpenApiFilterSchema:()=>Viu,OpenApiSettingsSchema:()=>lHa,OpenApiSpecSchema:()=>Jiu,OpenRpcSpecSchema:()=>Xiu,OutputMetadataAuthor:()=>Pau,OutputMetadataSchema:()=>Dxi,ProtobufApiDefinitionSchema:()=>aHa,ProtobufDefinitionSchema:()=>iHa,ProtobufSpecSchema:()=>Yiu,ReadmeCustomSectionSchema:()=>Eau,ReadmeEndpointObjectSchema:()=>wau,ReadmeEndpointSchema:()=>Y9o,ReadmeSchema:()=>Dau,RequestOrResponseExampleGenerationSchema:()=>$9o,ResolveAliases:()=>Hiu,ResolveAliasesSchema:()=>Giu,SpecSchema:()=>Ziu,UnionSettingsSchema:()=>Niu,WhitelabelConfigurationSchema:()=>Aau,WhitelabelGithubConfigurationSchema:()=>Oau});var Qa={};yf(Qa,{JsonError:()=>ZGa,ParseError:()=>kGa,any:()=>m_h,bigint:()=>s_h,boolean:()=>O_h,booleanLiteral:()=>g_h,date:()=>u_h,discriminant:()=>I_h,enum_:()=>yiu,getObjectLikeUtils:()=>yBr,getObjectUtils:()=>Wia,getSchemaUtils:()=>B7,isProperty:()=>Pxi,lazy:()=>c_h,lazyObject:()=>y_h,list:()=>biu,number:()=>A_h,object:()=>viu,objectWithoutOptionalProperties:()=>h_h,optional:()=>pZl,property:()=>f_h,record:()=>E_h,set:()=>S_h,string:()=>P_h,stringLiteral:()=>b_h,transform:()=>_Zl,undiscriminatedUnion:()=>C_h,union:()=>B_h,unknown:()=>w_h,withParsedProperties:()=>yZl});var qM={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",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function M7(e,t){return`Expected ${t}. Received ${TES(e)}.`}function TES(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 ofe(e){return{...e,json:o_h(e.json),parse:o_h(e.parse)}}function o_h(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
2083
2083
  `)),{ok:!0,value:t}):n}}function hiu(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var ZGa=class e extends Error{errors;constructor(t){super(t.map(hiu).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var kGa=class e extends Error{errors;constructor(t){super(t.map(hiu).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function B7(e){return{nullable:()=>qES(e),optional:()=>pZl(e),optionalNullable:()=>RES(e),transform:t=>_Zl(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new kGa(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new ZGa(n.errors)}}}function qES(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>qM.NULLABLE};return{...t,...B7(t)}}function pZl(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>qM.OPTIONAL};return{...t,...B7(t)}}function RES(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>qM.OPTIONAL_NULLABLE};return{...t,...B7(t)}}function _Zl(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(n,i)=>{let a=t.untransform(n);return e.json(a,i)},getType:()=>e.getType()};return{...r,...B7(r)}}function s_h(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:M7(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:M7(t,"bigint")}]}:{ok:!0,value:t},getType:()=>qM.BIGINT};return{...ofe(e),...B7(e)}}var NES=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function u_h(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:M7(t,"string")}]}:NES.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:M7(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:M7(t,"Date object")}]},getType:()=>qM.DATE};return{...ofe(e),...B7(e)}}function gAe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...ofe(r),...B7(r)}}}function yiu(e){let t=new Set(e);return gAe(qM.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:M7(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:M7(n,"enum")}]}:{ok:!0,value:n})()}function c_h(e){let t=hZl(e);return{...t,...B7(t)}}function hZl(e){return{parse:(t,r)=>eHa(e).parse(t,r),json:(t,r)=>eHa(e).json(t,r),getType:()=>eHa(e).getType()}}function eHa(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function H9o(e){return Object.entries(e)}function J9o(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function Axi(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function K9o(e){return Object.keys(e)}function l_h(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function yBr(e){return{withParsedProperties:t=>yZl(e,t)}}function yZl(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[f,u])=>({...c,[f]:typeof u=="function"?u(a.value):u}),{});return{ok:!0,value:{...a.value,...o}}},json:(n,i)=>{if(!Axi(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:M7(n,"object")}]};let a=new Set(Object.keys(t)),o=J9o(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(o,i)},getType:()=>e.getType()};return{...r,...B7(r),...yBr(r)}}function f_h(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Pxi(e){return e.isProperty}function viu(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>Pxi(n)?n.rawKey:r),_getParsedProperties:()=>K9o(e),parse:(r,n)=>{let i={},a=[];for(let[o,c]of H9o(e)){let f=Pxi(c)?c.rawKey:o,u=Pxi(c)?c.valueSchema:c,s={rawKey:f,parsedKey:o,valueSchema:u};i[f]=s,__h(u)&&a.push(f)}return d_h({value:r,requiredKeys:a,getProperty:o=>{let c=i[o];if(c!=null)return{transformedKey:c.parsedKey,transform:f=>c.valueSchema.parse(f,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,o]of H9o(e)){let c=Pxi(o)?o.valueSchema:o;__h(c)&&i.push(a)}return d_h({value:r,requiredKeys:i,getProperty:a=>{let o=e[a];if(o!=null)return Pxi(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>qM.OBJECT};return{...ofe(t),...B7(t),...yBr(t),...Wia(t)}}function d_h({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!Axi(e))return{ok:!1,errors:[{path:a,message:M7(e,"object")}]};let o=new Set(t),c=[],f={};for(let[u,s]of Object.entries(e)){let l=r(u);if(l!=null){o.delete(u);let m=l.transform(s);m.ok?f[l.transformedKey]=m.value:(f[u]=s,c.push(...m.errors))}else switch(n){case"fail":c.push({path:[...a,u],message:`Unexpected key "${u}"`});break;case"strip":break;case"passthrough":f[u]=s;break}}return c.push(...t.filter(u=>o.has(u)).map(u=>({path:a,message:`Missing required key "${u}"`}))),c.length===0||i?{ok:!0,value:f}:{ok:!1,errors:c}}function Wia(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>p_h({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>p_h({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>qM.OBJECT};return{...r,...B7(r),...yBr(r),...Wia(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,n)=>{let i=e.parse(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},json:(r,n)=>{let i=e.json(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},getType:()=>qM.OBJECT};return{...t,...B7(t),...yBr(t),...Wia(t)}}}}function p_h({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,o]=l_h(K9o(t),u=>i.has(u)),c=r(J9o(t,o)),f=n(J9o(t,a));return c.ok&&f.ok?{ok:!0,value:{...c.value,...f.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...f.ok?[]:f.errors]}}function __h(e){return!FES(e)}function FES(e){switch(e.getType()){case qM.ANY:case qM.UNKNOWN:case qM.OPTIONAL:case qM.OPTIONAL_NULLABLE:return!0;default:return!1}}function h_h(e){return viu(e)}function y_h(e){let t={...hZl(e),_getRawProperties:()=>eHa(e)._getRawProperties(),_getParsedProperties:()=>eHa(e)._getParsedProperties()};return{...t,...B7(t),...yBr(t),...Wia(t)}}function biu(e){let t={parse:(r,n)=>v_h(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>v_h(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>qM.LIST};return{...ofe(t),...B7(t)}}function v_h(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let a=[];return n.ok||a.push(...n.errors),i.ok||a.push(...i.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:M7(e,"list"),path:[]}]}}function b_h(e){return gAe(qM.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:M7(r,`"${e}"`)}]})()}function g_h(e){return gAe(qM.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:M7(r,`${e.toString()}`)}]})()}var m_h=gAe(qM.ANY,e=>({ok:!0,value:e}));var O_h=gAe(qM.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:M7(e,"boolean")}]});var A_h=gAe(qM.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:M7(e,"number")}]});var P_h=gAe(qM.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:M7(e,"string")}]});var w_h=gAe(qM.UNKNOWN,e=>({ok:!0,value:e}));function E_h(e,t){let r={parse:(n,i)=>j_h({value:n,isKeyNumeric:e.getType()===qM.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>j_h({value:n,isKeyNumeric:e.getType()===qM.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>qM.RECORD};return{...ofe(r),...B7(r)}}function j_h({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return Axi(e)?H9o(e).reduce((a,[o,c])=>{if(c===void 0)return a;let f=a,u=o;if(t){let O=o.length>0?Number(o):NaN;isNaN(O)||(u=O)}let s=r(u),l=n(c,u);if(f.ok&&s.ok&&l.ok)return{ok:!0,value:{...f.value,[s.value]:l.value}};let m=[];return f.ok||m.push(...f.errors),s.ok||m.push(...s.errors),l.ok||m.push(...l.errors),{ok:!1,errors:m}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:M7(e,"object")}]}}function S_h(e){let t=biu(e),r={parse:(n,i)=>{let a=t.parse(n,i);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:M7(n,"Set")}]},getType:()=>qM.SET};return{...ofe(r),...B7(r)}}function C_h(e){let t={parse:(r,n)=>D_h((i,a)=>i.parse(r,a),e,n),json:(r,n)=>D_h((i,a)=>i.json(r,a),e,n),getType:()=>qM.UNDISCRIMINATED_UNION};return{...ofe(t),...B7(t)}}function D_h(e,t,r){let n=[];for(let[i,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)n.push({path:c.path,message:`[Variant ${i}] ${c.message}`})}return{ok:!1,errors:n}}function I_h(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function B_h(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=yiu(K9o(t)),a={parse:(o,c)=>M_h({value:o,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:f=>i.parse(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.parse(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>M_h({value:o,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:f=>i.json(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.json(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>qM.UNION};return{...ofe(a),...B7(a),...yBr(a)}}function M_h({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!Axi(e))return{ok:!1,errors:[{path:c,message:M7(e,"object")}]};let{[t]:f,...u}=e;if(f==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let s=n(f);if(!s.ok)return{ok:!1,errors:s.errors};let l=i(s.value);if(l==null)return a?{ok:!0,value:{[r]:s.value,...u}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let m=o(u,l);return m.ok?{ok:!0,value:{[r]:f,...m.value}}:m}var giu=Qa.string();var miu=Qa.object({"client-id":Qa.string().optional(),"client-secret":Qa.string().optional(),scopes:Qa.string().optional()});var Oiu=Qa.object({"access-token":Qa.string().optional(),"expires-in":Qa.string().optional(),"refresh-token":Qa.string().optional()});var Aiu=Qa.object({endpoint:Qa.string(),"request-properties":miu.optional(),"response-properties":Oiu.optional()});var Piu=Qa.object({"refresh-token":Qa.string()});var wiu=Qa.object({"access-token":Qa.string().optional(),"expires-in":Qa.string().optional(),"refresh-token":Qa.string().optional()});var jiu=Qa.object({endpoint:Qa.string(),"request-properties":Piu.optional(),"response-properties":wiu.optional()});var zX=Qa.object({docs:Qa.string().optional()});var Eiu=Qa.object({scheme:Qa.stringLiteral("oauth"),type:Qa.stringLiteral("client-credentials"),scopes:Qa.list(giu).optional(),"client-id-env":Qa.string().optional(),"client-secret-env":Qa.string().optional(),"token-prefix":Qa.string().optional(),"token-header":Qa.string().optional(),"get-token":Aiu,"refresh-token":jiu.optional()}).extend(zX);var tHa=Qa.object({env:Qa.string().optional()});var wxi=Qa.object({name:Qa.string().optional()});var Siu=Qa.object({header:Qa.string(),type:Qa.string().optional(),prefix:Qa.string().optional()}).extend(tHa).extend(wxi).extend(zX);var Gia=Qa.object({}).extend(tHa).extend(wxi);var Diu=Qa.object({scheme:Qa.stringLiteral("basic"),username:Gia.optional(),password:Gia.optional()}).extend(zX);var Ciu=Qa.object({scheme:Qa.stringLiteral("bearer"),token:Gia.optional()}).extend(zX);var Iiu=Qa.object({"response-property":Qa.string(),"header-name":Qa.string(),"value-prefix":Qa.string().optional()});var Miu=Qa.object({endpoint:Qa.string(),"expiry-response-property":Qa.string().optional(),"authenticated-request-headers":Qa.list(Iiu).optional()});var Biu=Qa.undiscriminatedUnion([Qa.string(),Miu]);var Tiu=Qa.object({scheme:Qa.stringLiteral("bearer"),"get-token":Biu}).extend(zX);var qiu=Qa.undiscriminatedUnion([Ciu,Tiu]);var Riu=Qa.undiscriminatedUnion([Eiu,Siu,Diu,qiu]);var jxi=Qa.string();var Niu=Qa.enum_(["v1"]);var rHa=Qa.enum_(["v1","v2"]);var Exi=Qa.object({"use-title":Qa.boolean().optional(),unions:Niu.optional(),"message-naming":rHa.optional(),"respect-nullable-schemas":Qa.boolean().optional(),"only-include-referenced-schemas":Qa.boolean().optional(),"inline-path-parameters":Qa.boolean().optional(),"idiomatic-request-names":Qa.boolean().optional(),"wrap-references-to-nullable-in-optional":Qa.boolean().optional(),"coerce-optional-schemas-to-nullable":Qa.boolean().optional(),"group-environments-by-host":Qa.boolean().optional()});var nHa=Qa.object({path:jxi,origin:Qa.string().optional(),overrides:Qa.string().optional(),audiences:Qa.list(Qa.string()).optional(),settings:Exi.optional()});var iHa=Qa.object({target:Qa.string().optional(),root:Qa.string(),overrides:Qa.string().optional(),"local-generation":Qa.boolean().optional(),"from-openapi":Qa.boolean().optional(),dependencies:Qa.list(Qa.string()).optional()});var aHa=Qa.object({proto:iHa});var Fiu=Qa.undiscriminatedUnion([jxi,nHa,aHa]);var xiu=Qa.list(Fiu);var oHa=Qa.undiscriminatedUnion([jxi,nHa,xiu,aHa]);var ziu=Qa.object({namespaces:Qa.record(Qa.string(),oHa)});var sHa=Qa.object({scheme:Qa.string()}).extend(zX);var Qiu=Qa.undiscriminatedUnion([Qa.string(),sHa]);var Liu=Qa.object({any:Qa.list(Qiu)}).extend(zX);var uHa=Qa.undiscriminatedUnion([Qa.string(),sHa,Liu]);var Uiu=Qa.enum_(["form","json"]);var Viu=Qa.object({endpoints:Qa.list(Qa.string()).optional()});var $9o=Qa.object({"max-depth":Qa.number().optional()});var Wiu=Qa.object({request:$9o.optional(),response:$9o.optional()});var Giu=Qa.object({except:Qa.list(Qa.string()).optional()});var Hiu=Qa.undiscriminatedUnion([Qa.boolean(),Giu]);var cHa=Qa.object({"respect-nullable-schemas":Qa.boolean().optional(),"title-as-schema-name":Qa.boolean().optional(),"optional-additional-properties":Qa.boolean().optional(),"coerce-enums-to-literals":Qa.boolean().optional(),"idiomatic-request-names":Qa.boolean().optional(),"wrap-references-to-nullable-in-optional":Qa.boolean().optional(),"coerce-optional-schemas-to-nullable":Qa.boolean().optional(),"group-environments-by-host":Qa.boolean().optional()});var lHa=Qa.object({"only-include-referenced-schemas":Qa.boolean().optional(),"inline-path-parameters":Qa.boolean().optional(),"prefer-undiscriminated-unions-with-literals":Qa.boolean().optional(),"object-query-parameters":Qa.boolean().optional(),"respect-readonly-schemas":Qa.boolean().optional(),"respect-forward-compatible-enums":Qa.boolean().optional(),"use-bytes-for-binary-response":Qa.boolean().optional(),"default-form-parameter-encoding":Uiu.optional(),filter:Viu.optional(),"example-generation":Wiu.optional(),"additional-properties-defaults-to":Qa.boolean().optional(),"type-dates-as-strings":Qa.boolean().optional(),"preserve-single-schema-oneof":Qa.boolean().optional(),"inline-all-of-schemas":Qa.boolean().optional(),"resolve-aliases":Hiu.optional(),"group-multi-api-environments":Qa.boolean().optional()}).extend(cHa);var Jiu=Qa.object({openapi:Qa.string(),origin:Qa.string().optional(),overrides:Qa.string().optional(),namespace:Qa.string().optional(),settings:lHa.optional()});var Kiu=Qa.object({"message-naming":rHa.optional()}).extend(cHa);var $iu=Qa.object({asyncapi:Qa.string(),origin:Qa.string().optional(),overrides:Qa.string().optional(),namespace:Qa.string().optional(),settings:Kiu.optional()});var Yiu=Qa.object({proto:iHa});var Xiu=Qa.object({openrpc:Qa.string(),overrides:Qa.string().optional(),namespace:Qa.string().optional()});var Ziu=Qa.undiscriminatedUnion([Jiu,$iu,Yiu,Xiu]);var kiu=Qa.object({conjure:Qa.string()});var eau=Qa.undiscriminatedUnion([Qa.list(Ziu),kiu]);var tau=Qa.object({type:Qa.string()});var rau=Qa.object({proto:tau.optional()});var nau=Qa.object({minLength:Qa.number().optional(),maxLength:Qa.number().optional(),pattern:Qa.string().optional(),format:Qa.string().optional()});var iau=Qa.object({min:Qa.number().optional(),max:Qa.number().optional(),exclusiveMin:Qa.boolean().optional(),exclusiveMax:Qa.boolean().optional(),multipleOf:Qa.number().optional()});var aau=Qa.undiscriminatedUnion([nau,iau]);var fHa=Qa.enum_(["in-development","pre-release","deprecated","generally-available"]);var oau=Qa.object({status:fHa,message:Qa.string().optional()});var sau=Qa.undiscriminatedUnion([fHa,oau]);var uau=Qa.object({availability:sau.optional()});var cau=Qa.object({default:Qa.unknown().optional(),encoding:rau.optional(),validation:aau.optional()}).extend(zX).extend(uau);var Sxi=Qa.object({audiences:Qa.list(Qa.string()).optional()});var lau=Qa.object({type:Qa.string()}).extend(cau).extend(wxi).extend(Sxi);var fau=Qa.object({env:Qa.string().optional()}).extend(lau);var dau=Qa.undiscriminatedUnion([Qa.string(),fau]);var pau=dau;var _au=Qa.object({headers:Qa.record(Qa.string(),pau).optional()});var hau=Qa.object({url:Qa.string()}).extend(Sxi).extend(zX);var yau=Qa.object({urls:Qa.record(Qa.string(),Qa.string())}).extend(Sxi).extend(zX);var vau=Qa.undiscriminatedUnion([Qa.string(),hau,yau]);var bau=Qa.object({"default-url":Qa.string().optional(),"default-environment":Qa.string().optional(),environments:Qa.record(Qa.string(),vau).optional()});var gau=Qa.object({auth:uHa.optional(),specs:eau}).extend(_au).extend(bau);var mau=Qa.undiscriminatedUnion([oHa,ziu,gau]);var Oau=Qa.object({username:Qa.string(),email:Qa.string(),token:Qa.string()});var Aau=Qa.object({github:Oau.optional()});var Pau=Qa.object({name:Qa.string(),email:Qa.string()});var Dxi=Qa.object({description:Qa.string().optional(),authors:Qa.list(Pau).optional()});var wau=Qa.object({method:Qa.string(),path:Qa.string(),stream:Qa.boolean().optional()});var Y9o=Qa.undiscriminatedUnion([Qa.string(),wau]);var jau=Qa.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var Eau=Qa.object({title:Qa.string(),language:jau,content:Qa.string()});var Sau=Qa.enum_(["minimal","comprehensive"]);var Dau=Qa.object({bannerLink:Qa.string().optional(),introduction:Qa.string().optional(),apiReferenceLink:Qa.string().optional(),apiName:Qa.string().optional(),disabledSections:Qa.list(Qa.string()).optional(),defaultEndpoint:Y9o.optional(),features:Qa.record(Qa.string(),Qa.list(Y9o)).optional(),customSections:Qa.list(Eau).optional(),exampleStyle:Sau.optional()});var Cau=Qa.object({url:Qa.string().optional(),"package-name":Qa.string(),token:Qa.string().optional()});var Iau=Qa.object({keyId:Qa.string(),password:Qa.string(),secretKey:Qa.string()});var Mau=Qa.object({url:Qa.string().optional(),coordinate:Qa.string(),username:Qa.string().optional(),password:Qa.string().optional(),signature:Iau.optional()});var Bau=Qa.object({keywords:Qa.list(Qa.string()).optional(),"documentation-link":Qa.string().optional(),"homepage-link":Qa.string().optional()}).extend(Dxi);var Tau=Qa.object({url:Qa.string().optional(),"package-name":Qa.string(),token:Qa.string().optional(),username:Qa.string().optional(),password:Qa.string().optional(),metadata:Bau.optional()});var qau=Qa.object({"api-key":Qa.string(),"workspace-id":Qa.string(),"collection-id":Qa.string().optional()});var Rau=Qa.object({path:Qa.string()});var Nau=Qa.object({url:Qa.string().optional(),"package-name":Qa.string(),"api-key":Qa.string().optional()});var Fau=Qa.object({url:Qa.string().optional(),"package-name":Qa.string(),"api-key":Qa.string().optional()});var xau=Qa.object({url:Qa.string().optional(),"package-name":Qa.string(),token:Qa.string().optional()});var zau=Qa.union("location",{npm:Cau,maven:Mau,pypi:Tau,postman:qau,"local-file-system":Rau,nuget:Nau,rubygems:Fau,crates:xau}).transform({transform:e=>e,untransform:e=>e});var Qau=Qa.enum_(["MIT","Apache-2.0"]);var Lau=Qa.object({custom:Qa.string()});var Vdt=Qa.undiscriminatedUnion([Qau,Lau]);var Uau=Qa.object({uri:Qa.string(),token:Qa.string(),mode:Qa.stringLiteral("pull-request").optional(),license:Vdt.optional()});var Vau=Qa.enum_(["commit","release"]);var Wau=Qa.object({repository:Qa.string(),license:Vdt.optional(),mode:Vau.optional()});var X9o=Qa.object({name:Qa.string()});var Cxi=Qa.object({teams:Qa.list(X9o).optional(),users:Qa.list(X9o).optional()});var Gau=Qa.object({repository:Qa.string(),branch:Qa.string().optional(),license:Vdt.optional(),mode:Qa.stringLiteral("pull-request"),reviewers:Cxi.optional()});var Hau=Qa.object({repository:Qa.string(),license:Vdt.optional(),mode:Qa.stringLiteral("push"),branch:Qa.string().optional()});var Jau=Qa.undiscriminatedUnion([Uau,Wau,Gau,Hau]);var Z9o=Qa.object({"package-description":Qa.string().optional(),email:Qa.string().optional(),"reference-url":Qa.string().optional(),author:Qa.string().optional(),license:Vdt.optional()});var Kau=Qa.object({path:Qa.string()});var $au=Qa.object({auth:uHa.optional(),settings:Exi.optional()});var Yau=Qa.object({name:Qa.string(),version:Qa.string(),output:zau.optional(),github:Jau.optional(),config:Qa.unknown().optional(),metadata:Z9o.optional(),keywords:Qa.list(Qa.string()).optional(),snippets:Kau.optional(),"ir-version":Qa.string().optional(),"smart-casing":Qa.boolean().optional(),api:$au.optional(),"disable-examples":Qa.boolean().optional(),"publish-metadata":Z9o.optional()});var Xau=Qa.object({audiences:Qa.list(Qa.string()).optional(),generators:Qa.list(Yau),metadata:Dxi.optional(),reviewers:Cxi.optional()});var Zau=Qa.object({path:Qa.string(),origin:Qa.string().optional(),overrides:Qa.string().optional(),"disable-examples":Qa.boolean().optional(),settings:lHa});var kau=Qa.undiscriminatedUnion([Zau,Qa.string()]);var T_h=Qa.object({"auth-schemes":Qa.record(Qa.string(),Riu).optional(),api:mau.optional(),whitelabel:Aau.optional(),metadata:Dxi.optional(),readme:Dau.optional(),"default-group":Qa.string().optional(),groups:Qa.record(Qa.string(),Xau).optional(),reviewers:Cxi.optional(),openapi:kau.optional(),"openapi-overrides":Qa.string().optional(),"spec-origin":Qa.string().optional(),"async-api":Qa.string().optional(),"api-settings":Exi.optional()});var bZl={};yf(bZl,{CratesOutputLocationSchema:()=>xau,GeneratorApiSettingsSchema:()=>$au,GeneratorGroupSchema:()=>Xau,GeneratorInvocationSchema:()=>Yau,GeneratorOutputSchema:()=>zau,GeneratorPublishMetadataSchema:()=>Z9o,GeneratorSnippetsSchema:()=>Kau,GithubCommitAndReleaseMode:()=>Vau,GithubCommitAndReleaseSchema:()=>Wau,GithubConfigurationSchema:()=>Jau,GithubPullRequestSchema:()=>Gau,GithubPushSchema:()=>Hau,GithubSelfhostedSchema:()=>Uau,LocalFileSystemOutputLocationSchema:()=>Rau,MavenOutputLocationSchema:()=>Mau,MavenOutputSignatureSchema:()=>Iau,NpmOutputLocationSchema:()=>Cau,NugetOutputLocationSchema:()=>Nau,PostmanOutputLocationSchema:()=>qau,PypiOutputLocationSchema:()=>Tau,PypiOutputMetadataSchema:()=>Bau,RubyGemsOutputLocationSchema:()=>Fau});var gZl={};yf(gZl,{GithubLicenseCustomSchema:()=>Lau,GithubLicenseSchema:()=>Vdt,GithubLicenseType:()=>Qau});var mZl={};yf(mZl,{ReviewerSchema:()=>X9o,ReviewersSchema:()=>Cxi});var IZl={};yf(IZl,{AnyAuthItem:()=>Qiu,AnyAuthSchemesSchema:()=>Liu,ApiAuthSchema:()=>uHa,AuthSchemeDeclarationSchema:()=>Riu,AuthSchemeReferenceSchema:()=>sHa,AuthScope:()=>giu,AuthVariable:()=>Gia,AvailabilitySchema:()=>oau,AvailabilityStatusSchema:()=>fHa,AvailabilityUnionSchema:()=>sau,BaseTypeReferenceSchema:()=>cau,BasicAuthSchemeSchema:()=>Diu,BearerAuthSchemeSchema:()=>qiu,EncodingSchema:()=>rau,EnvironmentSchema:()=>vau,HeaderAuthSchemeSchema:()=>Siu,HttpHeaderSchema:()=>pau,InferredAuthenticatedRequestHeader:()=>Iiu,InferredBearerAuthSchema:()=>Tiu,InferredGetTokenEndpointSchema:()=>Biu,InferredGetTokenEndpointSchemaObject:()=>Miu,MultipleBaseUrlsEnvironmentSchema:()=>yau,NumberValidationSchema:()=>iau,OAuthAccessTokenRequestPropertiesSchema:()=>miu,OAuthAccessTokenResponsePropertiesSchema:()=>Oiu,OAuthGetTokenEndpointSchema:()=>Aiu,OAuthRefreshTokenEndpointSchema:()=>jiu,OAuthRefreshTokenRequestPropertiesSchema:()=>Piu,OAuthRefreshTokenResponsePropertiesSchema:()=>wiu,OAuthSchemeSchema:()=>Eiu,ProtobufTypeSchema:()=>tau,SingleBaseUrlEnvironmentSchema:()=>hau,StringValidationSchema:()=>nau,TokenBearerAuthSchema:()=>Ciu,TypeReferenceDeclarationWithEnvOverride:()=>dau,TypeReferenceDeclarationWithEnvOverrideSchema:()=>fau,TypeReferenceDeclarationWithName:()=>lau,ValidationSchema:()=>aau,WithAudiences:()=>Sxi,WithAvailability:()=>uau,WithDocsSchema:()=>zX,WithEnvironmentVariable:()=>tHa,WithEnvironmentsSchema:()=>bau,WithHeadersSchema:()=>_au,WithName:()=>wxi,auth:()=>OZl,availability:()=>AZl,commons:()=>PZl,encoding:()=>wZl,environments:()=>jZl,file:()=>EZl,service:()=>SZl,types:()=>DZl,validation:()=>CZl});var OZl={};yf(OZl,{AnyAuthItem:()=>Qiu,AnyAuthSchemesSchema:()=>Liu,ApiAuthSchema:()=>uHa,AuthSchemeDeclarationSchema:()=>Riu,AuthSchemeReferenceSchema:()=>sHa,AuthScope:()=>giu,AuthVariable:()=>Gia,BasicAuthSchemeSchema:()=>Diu,BearerAuthSchemeSchema:()=>qiu,HeaderAuthSchemeSchema:()=>Siu,InferredAuthenticatedRequestHeader:()=>Iiu,InferredBearerAuthSchema:()=>Tiu,InferredGetTokenEndpointSchema:()=>Biu,InferredGetTokenEndpointSchemaObject:()=>Miu,OAuthAccessTokenRequestPropertiesSchema:()=>miu,OAuthAccessTokenResponsePropertiesSchema:()=>Oiu,OAuthGetTokenEndpointSchema:()=>Aiu,OAuthRefreshTokenEndpointSchema:()=>jiu,OAuthRefreshTokenRequestPropertiesSchema:()=>Piu,OAuthRefreshTokenResponsePropertiesSchema:()=>wiu,OAuthSchemeSchema:()=>Eiu,TokenBearerAuthSchema:()=>Ciu,WithEnvironmentVariable:()=>tHa});var AZl={};yf(AZl,{AvailabilitySchema:()=>oau,AvailabilityStatusSchema:()=>fHa,AvailabilityUnionSchema:()=>sau});var PZl={};yf(PZl,{WithAudiences:()=>Sxi,WithAvailability:()=>uau,WithDocsSchema:()=>zX,WithName:()=>wxi});var wZl={};yf(wZl,{EncodingSchema:()=>rau,ProtobufTypeSchema:()=>tau});var jZl={};yf(jZl,{EnvironmentSchema:()=>vau,MultipleBaseUrlsEnvironmentSchema:()=>yau,SingleBaseUrlEnvironmentSchema:()=>hau,WithEnvironmentsSchema:()=>bau});var EZl={};yf(EZl,{WithHeadersSchema:()=>_au});var SZl={};yf(SZl,{HttpHeaderSchema:()=>pau,TypeReferenceDeclarationWithEnvOverride:()=>dau,TypeReferenceDeclarationWithEnvOverrideSchema:()=>fau});var DZl={};yf(DZl,{BaseTypeReferenceSchema:()=>cau,TypeReferenceDeclarationWithName:()=>lau});var CZl={};yf(CZl,{NumberValidationSchema:()=>iau,StringValidationSchema:()=>nau,ValidationSchema:()=>aau});var q_h="spec-origin",R_h="async-api",N_h="default-group",F_h="openapi",xES="openapi-overrides",zES="api-settings";function x_h(e){return e?.specs!=null}function z_h(e){return e?.asyncapi!=null}function Q_h(e){return e?.conjure!=null}function L_h(e){return e?.namespaces!=null}function U_h(e){return e?.openapi!=null}function V_h(e){return e?.openrpc!=null}function W_h(e){return e?.proto!=null}var G_h=$i(require("path"),1);async function eou({schema:e,value:t,context:r,filepathBeingParsed:n}){let i=await e.safeParseAsync(t);if(i.success)return i.data;let a=i.error.errors.map(c=>{let f=c.path.length>0?`${c.message} at "${QES(c.path)}"`:c.message;return oBr({content:f,prefix:" - "})}),o=[`Failed to parse file: ${G_h.default.relative(process.cwd(),n)}`,...a].join(`
2084
2084
  `);return r.failAndThrow(o)}function QES(e){return e.reduce((t,r)=>typeof r=="number"?t+"["+r+"]":t+(t===""?"":".")+r,"")}var J_h=$i(require("path"),1);function frt(e){return e.replace(/\\/g,"/")}function tou(e){return e.startsWith("/")}var dHa={of:e=>{if(!tou(e))throw new Error("Filepath is not absolute: "+e);return frt(e)}};function Hia(e,t){let r=e.split("/").pop()??e;return t?.stripExtension?r.split(".")[0]??r:r}function Wdt(e){let r=e.replace(/\/+$/,"").lastIndexOf("/");return r===-1?".":r===0?"/":e.slice(0,r)}function QX(...e){let t=[];for(let r of e.flatMap(n=>n.split("/")).filter(Boolean))r==="."||r===""||(r===".."&&t.length>0&&t[t.length-1]!==".."?t.pop():t.push(r));return(e[0]?.startsWith("/")?"/":"")+t.join("/")}var Cw={of:e=>{if(tou(e))throw new Error("Filepath is not relative: "+e);return frt(e)}};function rou(e,t){let r=e.split("/").filter(Boolean),n=t.split("/").filter(Boolean),i=0;for(;i<r.length&&i<n.length&&r[i]===n[i];)i++;let a=r.length-i;return[...Array(a).fill(".."),...n.slice(i)].join("/")||"."}function nou(e){return H_h(e)}function iou(e){return H_h(e)}function H_h(e){let t=e;return/^[a-zA-Z]:\\/.test(e)&&(t=e.substring(2)),t.replace(/\\/g,"/")}var F_={of:e=>{if(!J_h.default.isAbsolute(e))throw new Error("Filepath is not absolute: "+e);return frt(e)}};function hV(){return process.cwd()}var K_h=$i(require("path"),1);function Tg(e){return K_h.default.dirname(e)}var $_h=require("fs"),k9o=require("fs/promises");async function BZl(e){try{let t=await(0,k9o.lstat)(e);return t.isFile()?t.size===0:t.isDirectory()?(await(0,k9o.readdir)(e)).length===0:!1}catch{return!0}}async function Vv(e,t){try{let r=await(0,k9o.lstat)(e);return!(t==="file"&&!r.isFile()||t==="directory"&&!r.isDirectory())}catch{return!1}}function vBr(e,t){try{let r=(0,$_h.lstatSync)(e);return!(t==="file"&&!r.isFile()||t==="directory"&&!r.isDirectory())}catch{return!1}}var aou=require("fs/promises"),TZl=$i(require("path"),1);var Y_h=$i(require("path"),1);function Ql(...e){return Y_h.default.join(...e)}var X_h=$i(require("path"),1);var ru={of:e=>{if(X_h.default.isAbsolute(e))throw new Error("Filepath is not relative: "+e);return frt(e)}};async function Gdt(e,t={}){let r=t.fileExtensions!=null?new Set(t.fileExtensions.map(a=>a.startsWith(".")?a:`.${a}`)):void 0,n=[],i=await(0,aou.readdir)(e,{withFileTypes:!0});return await Promise.all(i.map(async a=>{let o=Ql(e,ru.of(a.name));a.isDirectory()?n.push({type:"directory",name:a.name,absolutePath:o,contents:await Gdt(o,t)}):(r==null||r.has(TZl.default.extname(a.name)))&&n.push({type:"file",name:a.name,absolutePath:o,contents:(await(0,aou.readFile)(TZl.default.join(e,a.name))).toString()})})),n.sort((a,o)=>a.name<o.name?-1:1)}function Z_h(e){return e.split(/[/\\]/).filter(t=>t.length>0)}function eUo(e){if(!e.includes("."))return;let t=Z_h(e),r=t[t.length-1];if(r!=null)return ru.of(r)}function qZl(){return process.env.CI==="true"||process.env.GITHUB_ACTIONS==="true"||process.env.GITLAB_CI==="true"||process.env.CIRCLECI==="true"||process.env.JENKINS_URL==="true"||process.env.TRAVIS==="true"}function Jia(e){try{return new URL(e),!0}catch{return!1}}var RZl=(e,t,r)=>{let n=e instanceof RegExp?k_h(e,r):e,i=t instanceof RegExp?k_h(t,r):t,a=n!==null&&i!=null&&LES(n,i,r);return a&&{start:a[0],end:a[1],pre:r.slice(0,a[0]),body:r.slice(a[0]+n.length,a[1]),post:r.slice(a[1]+i.length)}},k_h=(e,t)=>{let r=t.match(e);return r?r[0]:null},LES=(e,t,r)=>{let n,i,a,o,c,f=r.indexOf(e),u=r.indexOf(t,f+1),s=f;if(f>=0&&u>0){if(e===t)return[f,u];for(n=[],a=r.length;s>=0&&!c;){if(s===f)n.push(s),f=r.indexOf(e,s+1);else if(n.length===1){let l=n.pop();l!==void 0&&(c=[l,u])}else i=n.pop(),i!==void 0&&i<a&&(a=i,o=u),u=r.indexOf(t,s+1);s=f<u&&f>=0?f:u}n.length&&o!==void 0&&(c=[a,o])}return c};var ehh="\0SLASH"+Math.random()+"\0",thh="\0OPEN"+Math.random()+"\0",FZl="\0CLOSE"+Math.random()+"\0",rhh="\0COMMA"+Math.random()+"\0",nhh="\0PERIOD"+Math.random()+"\0",UES=new RegExp(ehh,"g"),VES=new RegExp(thh,"g"),WES=new RegExp(FZl,"g"),GES=new RegExp(rhh,"g"),HES=new RegExp(nhh,"g"),JES=/\\\\/g,KES=/\\{/g,$ES=/\\}/g,YES=/\\,/g,XES=/\\./g;function NZl(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function ZES(e){return e.replace(JES,ehh).replace(KES,thh).replace($ES,FZl).replace(YES,rhh).replace(XES,nhh)}function kES(e){return e.replace(UES,"\\").replace(VES,"{").replace(WES,"}").replace(GES,",").replace(HES,".")}function ihh(e){if(!e)return[""];let t=[],r=RZl("{","}",e);if(!r)return e.split(",");let{pre:n,body:i,post:a}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let c=ihh(a);return a.length&&(o[o.length-1]+=c.shift(),o.push.apply(o,c)),t.push.apply(t,o),t}function ahh(e){return e?(e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),tUo(ZES(e),!0).map(kES)):[]}function eSS(e){return"{"+e+"}"}function tSS(e){return/^-?0\d/.test(e)}function rSS(e,t){return e<=t}function nSS(e,t){return e>=t}function tUo(e,t){let r=[],n=RZl("{","}",e);if(!n)return[e];let i=n.pre,a=n.post.length?tUo(n.post,!1):[""];if(/\$$/.test(n.pre))for(let o=0;o<a.length;o++){let c=i+"{"+n.body+"}"+a[o];r.push(c)}else{let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),f=o||c,u=n.body.indexOf(",")>=0;if(!f&&!u)return n.post.match(/,(?!,).*\}/)?(e=n.pre+"{"+n.body+FZl+n.post,tUo(e)):[e];let s;if(f)s=n.body.split(/\.\./);else if(s=ihh(n.body),s.length===1&&s[0]!==void 0&&(s=tUo(s[0],!1).map(eSS),s.length===1))return a.map(m=>n.pre+s[0]+m);let l;if(f&&s[0]!==void 0&&s[1]!==void 0){let m=NZl(s[0]),O=NZl(s[1]),P=Math.max(s[0].length,s[1].length),C=s.length===3&&s[2]!==void 0?Math.abs(NZl(s[2])):1,I=rSS;O<m&&(C*=-1,I=nSS);let z=s.some(tSS);l=[];for(let U=m;I(U,O);U+=C){let q;if(c)q=String.fromCharCode(U),q==="\\"&&(q="");else if(q=String(U),z){let V=P-q.length;if(V>0){let $=new Array(V+1).join("0");U<0?q="-"+$+q.slice(1):q=$+q}}l.push(q)}}else{l=[];for(let m=0;m<s.length;m++)l.push.apply(l,tUo(s[m],!1))}for(let m=0;m<l.length;m++)for(let O=0;O<a.length;O++){let P=i+l[m]+a[O];(!t||f||P)&&r.push(P)}}return r}var rUo=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var iSS={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},nUo=e=>e.replace(/[[\]\\-]/g,"\\$&"),aSS=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ohh=e=>e.join(""),shh=(e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],a=r+1,o=!1,c=!1,f=!1,u=!1,s=r,l="";e:for(;a<e.length;){let C=e.charAt(a);if((C==="!"||C==="^")&&a===r+1){u=!0,a++;continue}if(C==="]"&&o&&!f){s=a+1;break}if(o=!0,C==="\\"&&!f){f=!0,a++;continue}if(C==="["&&!f){for(let[I,[T,z,U]]of Object.entries(iSS))if(e.startsWith(I,a)){if(l)return["$.",!1,e.length-r,!0];a+=I.length,U?i.push(T):n.push(T),c=c||z;continue e}}if(f=!1,l){C>l?n.push(nUo(l)+"-"+nUo(C)):C===l&&n.push(nUo(C)),l="",a++;continue}if(e.startsWith("-]",a+1)){n.push(nUo(C+"-")),a+=2;continue}if(e.startsWith("-",a+1)){l=C,a+=2;continue}n.push(nUo(C)),a++}if(s<a)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,e.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let C=n[0].length===2?n[0].slice(-1):n[0];return[aSS(C),!1,s-r,!1]}let m="["+(u?"^":"")+ohh(n)+"]",O="["+(u?"":"^")+ohh(i)+"]";return[n.length&&i.length?"("+m+"|"+O+")":n.length?m:O,c,s-r,!0]};var bBr=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var oSS=new Set(["!","?","+","*","@"]),uhh=e=>oSS.has(e),sSS="(?!(?:^|/)\\.\\.?(?:$|/))",oou="(?!\\.)",uSS=new Set(["[","."]),cSS=new Set(["..","."]),lSS=new Set("().*{}+?[]^$\\!"),fSS=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),xZl="[^/]",chh=xZl+"*?",lhh=xZl+"+?",pHa=class e{type;#e;#t;#r=!1;#n=[];#i;#a;#o;#u=!1;#s;#c;#f=!1;constructor(t,r,n={}){this.type=t,t&&(this.#t=!0),this.#i=r,this.#e=this.#i?this.#i.#e:this,this.#s=this.#e===this?n:this.#e.#s,this.#o=this.#e===this?[]:this.#e.#o,t==="!"&&!this.#e.#u&&this.#o.push(this),this.#a=this.#i?this.#i.#n.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let t of this.#n)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#c!==void 0?this.#c:this.type?this.#c=this.type+"("+this.#n.map(t=>String(t)).join("|")+")":this.#c=this.#n.map(t=>String(t)).join("")}#d(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#o.pop();){if(t.type!=="!")continue;let r=t,n=r.#i;for(;n;){for(let i=r.#a+1;!n.type&&i<n.#n.length;i++)for(let a of t.#n){if(typeof a=="string")throw new Error("string part in extglob AST??");a.copyIn(n.#n[i])}r=n,n=r.#i}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof e&&r.#i===this))throw new Error("invalid part: "+r);this.#n.push(r)}}toJSON(){let t=this.type===null?this.#n.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#n.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let t=this.#i;for(let r=0;r<this.#a;r++){let n=t.#n[r];if(!(n instanceof e&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#n.length:0;return this.#a===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new e(this.type,t);for(let n of this.#n)r.copyIn(n);return r}static#p(t,r,n,i){let a=!1,o=!1,c=-1,f=!1;if(r.type===null){let O=n,P="";for(;O<t.length;){let C=t.charAt(O++);if(a||C==="\\"){a=!a,P+=C;continue}if(o){O===c+1?(C==="^"||C==="!")&&(f=!0):C==="]"&&!(O===c+2&&f)&&(o=!1),P+=C;continue}else if(C==="["){o=!0,c=O,f=!1,P+=C;continue}if(!i.noext&&uhh(C)&&t.charAt(O)==="("){r.push(P),P="";let I=new e(C,r);O=e.#p(t,I,O,i),r.push(I);continue}P+=C}return r.push(P),O}let u=n+1,s=new e(null,r),l=[],m="";for(;u<t.length;){let O=t.charAt(u++);if(a||O==="\\"){a=!a,m+=O;continue}if(o){u===c+1?(O==="^"||O==="!")&&(f=!0):O==="]"&&!(u===c+2&&f)&&(o=!1),m+=O;continue}else if(O==="["){o=!0,c=u,f=!1,m+=O;continue}if(uhh(O)&&t.charAt(u)==="("){s.push(m),m="";let P=new e(O,s);s.push(P),u=e.#p(t,P,u,i);continue}if(O==="|"){s.push(m),m="",l.push(s),s=new e(null,r);continue}if(O===")")return m===""&&r.#n.length===0&&(r.#f=!0),s.push(m),m="",r.push(...l,s),u;m+=O}return r.type=null,r.#t=void 0,r.#n=[t.substring(n-1)],u}static fromGlob(t,r={}){let n=new e(null,void 0,r);return e.#p(t,n,0,r),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[r,n,i,a]=this.toRegExpSource();if(!(i||this.#t||this.#s.nocase&&!this.#s.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let c=(this.#s.nocase?"i":"")+(a?"u":"");return Object.assign(new RegExp(`^${r}$`,c),{_src:r,_glob:t})}get options(){return this.#s}toRegExpSource(t){let r=t??!!this.#s.dot;if(this.#e===this&&this.#d(),!this.type){let f=this.isStart()&&this.isEnd(),u=this.#n.map(O=>{let[P,C,I,T]=typeof O=="string"?e.#_(O,this.#t,f):O.toRegExpSource(t);return this.#t=this.#t||I,this.#r=this.#r||T,P}).join(""),s="";if(this.isStart()&&typeof this.#n[0]=="string"&&!(this.#n.length===1&&cSS.has(this.#n[0]))){let P=uSS,C=r&&P.has(u.charAt(0))||u.startsWith("\\.")&&P.has(u.charAt(2))||u.startsWith("\\.\\.")&&P.has(u.charAt(4)),I=!r&&!t&&P.has(u.charAt(0));s=C?sSS:I?oou:""}let l="";return this.isEnd()&&this.#e.#u&&this.#i?.type==="!"&&(l="(?:$|\\/)"),[s+u+l,bBr(u),this.#t=!!this.#t,this.#r]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",a=this.#l(r);if(this.isStart()&&this.isEnd()&&!a&&this.type!=="!"){let f=this.toString();return this.#n=[f],this.type=null,this.#t=void 0,[f,bBr(this.toString()),!1,!1]}let o=!n||t||r||!oou?"":this.#l(!0);o===a&&(o=""),o&&(a=`(?:${a})(?:${o})*?`);let c="";if(this.type==="!"&&this.#f)c=(this.isStart()&&!r?oou:"")+lhh;else{let f=this.type==="!"?"))"+(this.isStart()&&!r&&!t?oou:"")+chh+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;c=i+a+f}return[c,bBr(a),this.#t=!!this.#t,this.#r]}#l(t){return this.#n.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,a,o]=r.toRegExpSource(t);return this.#r=this.#r||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#_(t,r,n=!1){let i=!1,a="",o=!1;for(let c=0;c<t.length;c++){let f=t.charAt(c);if(i){i=!1,a+=(lSS.has(f)?"\\":"")+f;continue}if(f==="\\"){c===t.length-1?a+="\\\\":i=!0;continue}if(f==="["){let[u,s,l,m]=shh(t,c);if(l){a+=u,o=o||s,c+=l-1,r=r||m;continue}}if(f==="*"){n&&t==="*"?a+=lhh:a+=chh,r=!0;continue}if(f==="?"){a+=xZl,r=!0;continue}a+=fSS(f)}return[a,bBr(t),!!r,o]}};var _Ha=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var BDe=(e,t,r={})=>(rUo(t),!r.nocomment&&t.charAt(0)==="#"?!1:new drt(t,r).match(e)),dSS=/^\*+([^+@!?\*\[\(]*)$/,pSS=e=>t=>!t.startsWith(".")&&t.endsWith(e),_SS=e=>t=>t.endsWith(e),hSS=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),ySS=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),vSS=/^\*+\.\*+$/,bSS=e=>!e.startsWith(".")&&e.includes("."),gSS=e=>e!=="."&&e!==".."&&e.includes("."),mSS=/^\.\*+$/,OSS=e=>e!=="."&&e!==".."&&e.startsWith("."),ASS=/^\*+$/,PSS=e=>e.length!==0&&!e.startsWith("."),wSS=e=>e.length!==0&&e!=="."&&e!=="..",jSS=/^\?+([^+@!?\*\[\(]*)?$/,ESS=([e,t=""])=>{let r=phh([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},SSS=([e,t=""])=>{let r=_hh([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},DSS=([e,t=""])=>{let r=_hh([e]);return t?n=>r(n)&&n.endsWith(t):r},CSS=([e,t=""])=>{let r=phh([e]);return t?n=>r(n)&&n.endsWith(t):r},phh=([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},_hh=([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},hhh=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",fhh={win32:{sep:"\\"},posix:{sep:"/"}},ISS=hhh==="win32"?fhh.win32.sep:fhh.posix.sep;BDe.sep=ISS;var sve=Symbol("globstar **");BDe.GLOBSTAR=sve;var MSS="[^/]",BSS=MSS+"*?",TSS="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",qSS="(?:(?!(?:\\/|^)\\.).)*?",RSS=(e,t={})=>r=>BDe(r,e,t);BDe.filter=RSS;var Hdt=(e,t={})=>Object.assign({},e,t),NSS=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return BDe;let t=BDe;return Object.assign((n,i,a={})=>t(n,i,Hdt(e,a)),{Minimatch:class extends t.Minimatch{constructor(i,a={}){super(i,Hdt(e,a))}static defaults(i){return t.defaults(Hdt(e,i)).Minimatch}},AST:class extends t.AST{constructor(i,a,o={}){super(i,a,Hdt(e,o))}static fromGlob(i,a={}){return t.AST.fromGlob(i,Hdt(e,a))}},unescape:(n,i={})=>t.unescape(n,Hdt(e,i)),escape:(n,i={})=>t.escape(n,Hdt(e,i)),filter:(n,i={})=>t.filter(n,Hdt(e,i)),defaults:n=>t.defaults(Hdt(e,n)),makeRe:(n,i={})=>t.makeRe(n,Hdt(e,i)),braceExpand:(n,i={})=>t.braceExpand(n,Hdt(e,i)),match:(n,i,a={})=>t.match(n,i,Hdt(e,a)),sep:t.sep,GLOBSTAR:sve})};BDe.defaults=NSS;var yhh=(e,t={})=>(rUo(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ahh(e));BDe.braceExpand=yhh;var FSS=(e,t={})=>new drt(e,t).makeRe();BDe.makeRe=FSS;var xSS=(e,t,r={})=>{let n=new drt(t,r);return e=e.filter(i=>n.match(i)),n.options.nonull&&!e.length&&e.push(t),e};BDe.match=xSS;var dhh=/[?*]|[+@!]\(.*?\)|\[|\]/,zSS=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),drt=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,r={}){rUo(t),r=r||{},this.options=r,this.pattern=t,this.platform=r.platform||hhh,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...a)=>console.error(...a)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(a=>this.slashSplit(a));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((a,o,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let f=a[0]===""&&a[1]===""&&(a[2]==="?"||!dhh.test(a[2]))&&!dhh.test(a[3]),u=/^[a-z]:/i.test(a[0]);if(f)return[...a.slice(0,4),...a.slice(4).map(s=>this.parse(s))];if(u)return[a[0],...a.slice(1).map(s=>this.parse(s))]}return a.map(f=>this.parse(f))});if(this.debug(this.pattern,i),this.set=i.filter(a=>a.indexOf(!1)===-1),this.isWindows)for(let a=0;a<this.set.length;a++){let o=this.set[a];o[0]===""&&o[1]===""&&this.globParts[a][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n=0;n<t.length;n++)for(let i=0;i<t[n].length;i++)t[n][i]==="**"&&(t[n][i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,i)=>{let a=n[n.length-1];return i==="**"&&a==="**"?n:i===".."&&a&&a!==".."&&a!=="."&&a!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let a=t[i];i===1&&a===""&&t[0]===""||(a==="."||a==="")&&(r=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let i=t[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let c=n[i+1],f=n[i+2],u=n[i+3];if(c!==".."||!f||f==="."||f===".."||!u||u==="."||u==="..")continue;r=!0,n.splice(i,1);let s=n.slice(0);s[i]="**",t.push(s),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let c=n[o];o===1&&c===""&&n[0]===""||(c==="."||c==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let a=0;for(;(a=n.indexOf("..",a+1))!==-1;){let o=n[a-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let f=a===1&&n[a+1]==="**"?["."]:[];n.splice(a-1,2,...f),n.length===0&&n.push(""),a-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let i=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(i){t[r]=[],t[n]=i;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let i=0,a=0,o=[],c="";for(;i<t.length&&a<r.length;)if(t[i]===r[a])o.push(c==="b"?r[a]:t[i]),i++,a++;else if(n&&t[i]==="**"&&r[a]===t[i+1])o.push(t[i]),i++;else if(n&&r[a]==="**"&&t[i]===r[a+1])o.push(r[a]),a++;else if(t[i]==="*"&&r[a]&&(this.options.dot||!r[a].startsWith("."))&&r[a]!=="**"){if(c==="b")return!1;c="a",o.push(t[i]),i++,a++}else if(r[a]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(c==="a")return!1;c="b",o.push(r[a]),i++,a++}else return!1;return t.length===r.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let i=this.options;if(this.isWindows){let C=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),I=!C&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),T=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),z=!T&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),U=I?3:C?0:void 0,q=z?3:T?0:void 0;if(typeof U=="number"&&typeof q=="number"){let[V,$]=[t[U],r[q]];V.toLowerCase()===$.toLowerCase()&&(r[q]=V,q>U?r=r.slice(q):U>q&&(t=t.slice(U)))}}let{optimizationLevel:a=1}=this.options;a>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var o=0,c=0,f=t.length,u=r.length;o<f&&c<u;o++,c++){this.debug("matchOne loop");var s=r[c],l=t[o];if(this.debug(r,s,l),s===!1)return!1;if(s===sve){this.debug("GLOBSTAR",[r,s,l]);var m=o,O=c+1;if(O===u){for(this.debug("** at the end");o<f;o++)if(t[o]==="."||t[o]===".."||!i.dot&&t[o].charAt(0)===".")return!1;return!0}for(;m<f;){var P=t[m];if(this.debug(`
2085
2085
  globstar while`,t,m,r,O,P),this.matchOne(t.slice(m),r.slice(O),n))return this.debug("globstar found match!",m,f,P),!0;if(P==="."||P===".."||!i.dot&&P.charAt(0)==="."){this.debug("dot detected!",t,m,r,O);break}this.debug("globstar swallow a segment, and continue"),m++}return!!(n&&(this.debug(`
@@ -2430,7 +2430,7 @@ ${ZAy.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&mmf(th
2430
2430
  `+zua.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?zua.default.cyan(sPy(t,this.opt.mask)):zua.default.italic(zua.default.dim("[hidden]")):this.opt.mask?sPy(t,this.opt.mask):zua.default.italic(zua.default.dim("[input is hidden] "))}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var rDu=$i(Ose(),1);var swy=$i(tOf(),1),eDu=require("child_process"),zZa=require("fs"),kSu=$i(require("path"),1),uwy=$i(require("os"),1),cwy=require("crypto"),zOf=$i(awy(),1);var YSu=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var v$o=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var XSu=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var ZSu=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function tDu(e="",t,r){let n=new QOf(e,r);n.runAsync((i,a)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,a)}catch(o){setImmediate(t,o,void 0)}})}function owy(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function EIC(e){let t=[],r="";for(let n=0;n<e.length;n++){let i=e.charAt(n);n>0&&i===" "&&e[n-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${i}`}return r.length>0&&t.push(r),t}var QOf=class{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(t="",r){this.text=t,r&&(this.fileOptions=r),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(t){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(t,void 0,this.text)}catch(r){setImmediate(t,r,void 0)}})}catch(r){setImmediate(t,r,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim",r=EIC(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??uwy.default.tmpdir(),r=(0,cwy.randomUUID)(),n=owy(this.fileOptions.prefix),i=owy(this.fileOptions.postfix),a=`${n}${r}${i}`,o=kSu.default.resolve(t,a),c=kSu.default.resolve(t)+kSu.default.sep;if(!o.startsWith(c))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=o;let f={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(f.mode=this.fileOptions.mode),(0,zZa.writeFileSync)(this.tempFile,this.text,f)}catch(t){throw new YSu(t)}}readTemporaryFile(){try{let t=(0,zZa.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,swy.detect)(t)??"utf8";zOf.default.encodingExists(r)||(r="utf8"),this.text=zOf.default.decode(t,r)}}catch(t){throw new XSu(t)}}removeTemporaryFile(){try{(0,zZa.unlinkSync)(this.tempFile)}catch(t){throw new ZSu(t)}}launchEditor(){try{let t=(0,eDu.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new v$o(t)}}launchEditorAsync(t){try{(0,eDu.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new v$o(r)}}};var lwy=$i(Qrt(),1);var b$o=class extends Ase{_run(t){this.done=t,this.editorResult=new lwy.Subject;let r=Jve(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,i=this.handleSubmitEvents(this.editorResult);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,n?this.render():this.startExternalEditor(),this}render(t){let r="",n=this.getQuestion();n+=this.status==="answered"?rDu.default.dim("Received"):rDu.default.dim("Press <enter> to launch your preferred editor."),t&&(r=rDu.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),tDu(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 hwy=require("stream");var pwy=$i(require("readline"),1),_wy=$i(dwy(),1),Vua=class{constructor(t){this.rl||=pwy.default.createInterface(DIC(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 DIC(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new _wy.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var g$o=class extends Vua{constructor(t={}){super(t),this.log=new hwy.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return r$o(this.rl,this.bottomBar.split(`
2431
2431
  `).length),this}updateBottomBar(t){return r$o(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+`
2432
2432
  `}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&&wSu(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var W4=$i(Qrt(),1),bwy=$i(PKo(),1);var nDu=$i(Qrt(),1),ywy=$i(PKo(),1),iDu=function(e,t,r){return typeof e[t]!="function"?(0,nDu.of)(e):(0,nDu.from)((0,ywy.default)(e[t])(r).then(n=>(e[t]=n,e)))};var vwy={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,a,o)=>{i==="__proto__"||i==="constructor"||(a===o.length-1?n[i]=r:(!(i in n)||typeof n[i]!="object")&&(n[i]={}),n=n[i])})},get:(e,t="",r)=>{let n=a=>String.prototype.split.call(t,a).filter(Boolean).reduce((o,c)=>o!=null?o[c]:o,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},QZa=class extends Vua{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let n;return Array.isArray(t)?n=(0,W4.from)(t):(0,W4.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,W4.from)(Object.entries(t).map(([i,a])=>({name:i,...a}))):n=(0,W4.from)([t]),this.process=n.pipe((0,W4.concatMap)(this.processQuestion.bind(this)),(0,W4.publish)()),this.process.connect(),this.process.pipe((0,W4.reduce)((i,a)=>(vwy.set(i,a.name,a.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,W4.defer)(()=>(0,W4.of)(t).pipe((0,W4.concatMap)(this.setDefaultType.bind(this)),(0,W4.concatMap)(this.filterIfRunnable.bind(this)),(0,W4.concatMap)(()=>iDu(t,"message",this.answers)),(0,W4.concatMap)(()=>iDu(t,"default",this.answers)),(0,W4.concatMap)(()=>iDu(t,"choices",this.answers)),(0,W4.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,W4.defer)(()=>(0,W4.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,W4.defer)(()=>(0,W4.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&vwy.get(this.answers,t.name)!==void 0)return W4.EMPTY;if(t.when===!1)return W4.EMPTY;if(typeof t.when!="function")return(0,W4.of)(t);let{answers:r}=this;return(0,W4.defer)(()=>(0,W4.from)((0,bwy.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,W4.filter)(n=>n!=null)))}};function gwy(e){let t=function(r,n){let i;try{i=new QZa(t.prompts,e)}catch(o){return Promise.reject(o)}let a=i.run(r,n);return a.ui=i,a};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",i$o),this.registerPrompt("input",xua),this.registerPrompt("number",a$o),this.registerPrompt("confirm",o$o),this.registerPrompt("rawlist",s$o),this.registerPrompt("expand",u$o),this.registerPrompt("checkbox",c$o),this.registerPrompt("password",l$o),this.registerPrompt("editor",b$o)},t.restoreDefaultPrompts(),t}var UOf=gwy();function IIC(e,t){UOf.registerPrompt(e,t)}function MIC(){UOf.restoreDefaultPrompts()}var BIC={prompt:UOf,ui:{BottomBar:g$o,Prompt:QZa},createPromptModule:gwy,registerPrompt:IIC,restoreDefaultPrompts:MIC,Separator:uxe},aDu=BIC;var kZa=require("path"),Zjy=require("fs"),kjy=require("readline"),Pjy="posthog-node";function aTC(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"]}={}){return a=>{if(!(i==="*"||i.includes(a.level)))return a;a.tags||(a.tags={});let c=a.tags[jDu.POSTHOG_ID_TAG];if(c===void 0)return a;let f=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${c}`,f).toString();a.tags["PostHog Person URL"]=u;let s=a.exception?.values||[],l=s.map(O=>({...O,stacktrace:O.stacktrace?{...O.stacktrace,type:"raw",frames:(O.stacktrace.frames||[]).map(P=>({...P,platform:"node:javascript"}))}:void 0})),m={$exception_message:s[0]?.value||a.message,$exception_type:s[0]?.type,$exception_personURL:u,$exception_level:a.level,$exception_list:l,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:s[0]?.value||a.message,$sentry_exception_type:s[0]?.type,$sentry_tags:a.tags};return t&&r&&(m.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:c,properties:m}),a}}var jDu=class{constructor(t,r,n,i){this.name=Pjy,this.name=Pjy,this.setupOnce=function(a,o){let c=o()?.getClient()?.getDsn()?.projectId;a(aTC(t,{organization:r,projectId:c,prefix:n,severityAllowList:i}))}}};jDu.POSTHOG_ID_TAG="posthog_distinct_id";var mDu="0123456789abcdef",EDu=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,n,i){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||t<0||r<0||n<0||i<0||t>0xffffffffffff||r>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|n>>>24,a[9]=n>>>16,a[10]=n>>>8,a[11]=n,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break}if(r){let n=new Uint8Array(16);for(let i=0;i<16;i+=4){let a=parseInt(r.substring(2*i,2*i+8),16);n[i+0]=a>>>24,n[i+1]=a>>>16,n[i+2]=a>>>8,n[i+3]=a}return new e(n)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=mDu.charAt(this.bytes[r]>>>4),t+=mDu.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+=mDu.charAt(this.bytes[r]>>>4),t+=mDu.charAt(this.bytes[r]&15);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let n=this.bytes[r]-t.bytes[r];if(n!==0)return Math.sign(n)}return 0}},EAf=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??oTC()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let n=this.generateOrAbortCore(t,r);return n===void 0&&(this.timestamp=0,n=this.generateOrAbortCore(t,r)),n}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return EDu.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,EDu.ofInner(t)}},oTC=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),wjy,SAf=()=>sTC().toString(),sTC=()=>(wjy||(wjy=new EAf)).generate();function uTC(e,t){let r=!1;return Object.assign(n=>{let a=global.process.listeners("uncaughtException").filter(o=>o.name!=="domainUncaughtExceptionClear"&&o._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t())},{_posthogErrorHandler:!0})}function cTC(e,t){global.process.on("uncaughtException",uTC(e,t))}function lTC(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var ODu,jjy,ADu;function fTC(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return ADu&&r.length===jjy||(jjy=r.length,ADu=r.reduce((n,i)=>{ODu||(ODu={});let a=ODu[i];if(a)n[a[0]]=a[1];else{let o=e(i);for(let c=o.length-1;c>=0;c--){let u=o[c]?.filename,s=t[i];if(u&&s){n[u]=s,ODu[i]=[u,s];break}}}return n},{})),ADu}function dTC(e){return typeof Event<"u"&&e1y(e,Event)}function pTC(e){return t1y(e,"Object")}function RAf(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return e1y(e,Error)}}function e1y(e,t){try{return e instanceof t}catch{return!1}}function _TC(e){return t1y(e,"ErrorEvent")}function t1y(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function hTC(e,t,r,n){let a=n&&n.mechanism||{handled:!0,type:"generic"},o=r1y(a,r,n);return{$exception_list:await Promise.all(o.map(async u=>{let s=await ATC(e,t,u);return s.value=s.value||"",s.type=s.type||"Error",s.mechanism=a,s}))}}function r1y(e,t,r){let n=yTC(e,t,r);return n.cause?[n,...r1y(e,n.cause,r)]:[n]}function yTC(e,t,r){if(RAf(t))return t;if(e.synthetic=!0,pTC(t)){let i=vTC(t);if(i)return i;let a=bTC(t),o=r?.syntheticException||new Error(a);return o.message=a,o}let n=r?.syntheticException||new Error(t);return n.message=`${t}`,n}function vTC(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(RAf(r))return r}}function bTC(e){if("name"in e&&typeof e.name=="string"){let n=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(n+=` with message '${e.message}'`),n}else if("message"in e&&typeof e.message=="string")return e.message;let t=mTC(e);if(_TC(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=gTC(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function gTC(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function mTC(e,t=40){let r=Object.keys(OTC(e));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=t)return Ejy(n,t);for(let i=r.length;i>0;i--){let a=r.slice(0,i).join(", ");if(!(a.length>t))return i===r.length?a:Ejy(a,t)}return""}function Ejy(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function OTC(e){return RAf(e)?{message:e.message,name:e.name,stack:e.stack,...Sjy(e)}:dTC(e)?{type:e.type,target:Djy(e.target),currentTarget:Djy(e.currentTarget),...Sjy(e)}:e}function Sjy(e){if(typeof e=="object"&&e!==null){let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}else return{}}function Djy(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function ATC(e,t,r){let n={type:r.name||r.constructor.name,value:r.message},i=PTC(e,r);for(let a of t)i=await a(i);return i.length&&(n.stacktrace={frames:i,type:"raw"}),n}function PTC(e,t){return wTC(e(t.stack||"",1),e)}function wTC(e,t){let r=fTC(t);return e.forEach(n=>{n.filename&&(n.chunk_id=r[n.filename])}),e}var jTC=2e3,YZa=class e{static async captureException(t,r,n,i,a){let o={...a};i||(o.$process_person_profile=!1);let c=await hTC(this.stackParser,this.frameModifiers,r,n);t.capture({event:"$exception",distinctId:i||SAf(),properties:{...c,...o}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(cTC(this.onException.bind(this),this.onFatalError.bind(this)),lTC(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(jTC)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function ETC(e=process.argv[1]?(0,kZa.dirname)(process.argv[1]):process.cwd(),t=kZa.sep==="\\"){let r=t?Cjy(e):e;return n=>{if(!n)return;let i=t?Cjy(n):n,{dir:a,base:o,ext:c}=kZa.posix.parse(i);(c===".js"||c===".mjs"||c===".cjs")&&(o=o.slice(0,c.length*-1));let f=decodeURIComponent(o);a||(a=".");let u=a.lastIndexOf("/node_modules");if(u>-1)return`${a.slice(u+14).replace(/\//g,".")}:${f}`;if(a.startsWith(r)){let s=a.slice(r.length+1).replace(/\//g,".");return s?`${s}:${f}`:f}return f}}function Cjy(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var SDu=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}},wDu=new SDu(25),n1y=new SDu(20),NAf=7,STC=1e3,DTC=1e4;async function CTC(e){let t={};for(let i=e.length-1;i>=0;i--){let a=e[i],o=a?.filename;if(!a||typeof o!="string"||typeof a.lineno!="number"||TTC(o)||qTC(a))continue;t[o]||(t[o]=[]),t[o].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(n1y.get(i))continue;let a=t[i];if(!a)continue;a.sort((f,u)=>f-u);let o=NTC(a);if(o.every(f=>RTC(i,f)))continue;let c=FTC(wDu,i,{});n.push(ITC(i,o,c))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&MTC(e,wDu),wDu.reduce(),e}function ITC(e,t,r){return new Promise(n=>{let i=(0,Zjy.createReadStream)(e),a=(0,kjy.createInterface)({input:i});function o(){i.destroy(),n()}let c=0,f=0,u=t[f];if(u===void 0){o();return}let s=u[0],l=u[1];function m(){n1y.set(e,1),a.close(),a.removeAllListeners(),o()}i.on("error",m),a.on("error",m),a.on("close",o),a.on("line",O=>{if(c++,!(c<s)&&(r[c]=xTC(O,0),c>=l)){if(f===t.length-1){a.close(),a.removeAllListeners();return}f++;let P=t[f];if(P===void 0){a.close(),a.removeAllListeners();return}s=P[0],l=P[1]}})})}function MTC(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;BTC(r.lineno,r,n)}}function BTC(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=i1y(e);i<e;i++){let a=r[i];if(a===void 0){Ijy(t);return}t.pre_context.push(a)}if(r[e]===void 0){Ijy(t);return}t.context_line=r[e];let n=a1y(e);t.post_context=[];for(let i=e+1;i<=n;i++){let a=r[i];if(a===void 0)break;t.post_context.push(a)}}function Ijy(e){delete e.pre_context,delete e.context_line,delete e.post_context}function TTC(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function qTC(e){return e.lineno!==void 0&&e.lineno>DTC||e.colno!==void 0&&e.colno>STC}function RTC(e,t){let r=wDu.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function NTC(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=Mjy(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let a=e[t+1];if(typeof a!="number")break;a<=n[1]?n[1]=a+NAf:(i.push(n),n=Mjy(a)),t++}return i}function Mjy(e){return[i1y(e),a1y(e)]}function i1y(e){return Math.max(1,e-NAf)}function a1y(e){return e+NAf}function FTC(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function xTC(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let a=Math.min(i+140,n);return a>n-5&&(a=n),a===n&&(i=Math.max(a-140,0)),r=r.slice(i,a),i>0&&(r=`...${r}`),a<n&&(r+="..."),r}var zTC="4.18.0",pxe;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.DecideEndpointWasHit="decide_endpoint_was_hit",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config"})(pxe||(pxe={}));var Bjy;(function(e){e.Left="left",e.Right="right",e.Center="center"})(Bjy||(Bjy={}));var Tjy;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(Tjy||(Tjy={}));var qjy;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(qjy||(qjy={}));var Rjy;(function(e){e.Html="html",e.Text="text"})(Rjy||(Rjy={}));var Njy;(function(e){e.Number="number",e.Emoji="emoji"})(Njy||(Njy={}));var Fjy;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(Fjy||(Fjy={}));var xjy;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(xjy||(xjy={}));var zjy;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(zjy||(zjy={}));var Qjy;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(Qjy||(Qjy={}));var QTC=e=>{if("flags"in e){let t=UTC(e.flags),r=VTC(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,a])=>[i,o1y(a)])),n=Object.fromEntries(Object.entries(t).map(([i,a])=>[i,LTC(i,a,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function LTC(e,t,r){return{key:e,enabled:typeof t=="string"?!0:t,variant:typeof t=="string"?t:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:r?JSON.stringify(r):void 0,description:void 0}}}var UTC=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,FAf(r)]).filter(([,t])=>t!==void 0)),VTC=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let n=t[r];return n.enabled&&n.metadata&&n.metadata.payload!==void 0}).map(r=>{let n=t[r].metadata?.payload;return[r,n?o1y(n):void 0]}))},FAf=e=>e===void 0?void 0:e.variant??e.enabled,o1y=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},WTC=1,GTC=new Set(["61be3dd8","96f6df5f","8cfdba9b","bf027177","e59430a8","7fa5500b","569798e9","04809ff7","0ebc61a5","32de7f98","3beeb69a","12d34ad9","733853ec","0645bb64","5dcbee21","b1f95fa3","2189e408","82b460c2","3a8cc979","29ef8843","2cdbf767","38084b54","50f9f8de","41d0df91","5c236689","c11aedd3","ada46672","f4331ee1","42fed62a","c957462c","d62f705a","e0162666","01b3e5cf","441cef7f","bb9cafee","8f348eb0","b2553f3a","97469d7d","39f21a76","03706dcc","27d50569","307584a7","6433e92e","150c7fbb","49f57f22","3772f65b","01eb8256","3c9e9234","f853c7f7","c0ac4b67","cd609d40","10ca9b1a","8a87f11b","8e8e5216","1f6b63b3","db7943dd","79b7164c","07f78e33","2d21b6fd","952db5ee","a7d3b43f","1924dd9c","84e1b8f6","dff631b6","c5aa8a79","fa133a95","498a4508","24748755","98f3d658","21bbda67","7dbfed69","be3ec24c","fc80b8e2","75cc0998"]),HTC="utf8";function JTC(e,t){if(!e||typeof e!="string"||KTC(e))throw new Error(t)}function KTC(e){return e.trim().length===0}function $TC(e){return e?.replace(/\/+$/,"")}async function YTC(e,t){let r=null;for(let n=0;n<t.retryCount+1;n++){n>0&&await new Promise(i=>setTimeout(i,t.retryDelay));try{return await e()}catch(i){if(r=i,!t.retryCheck(i))throw i}}throw r}function Ljy(){return new Date().getTime()}function wAf(){return new Date().toISOString()}function DDu(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function XTC(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function ZTC(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return(t>>>0).toString(16).padStart(8,"0")}function kTC(e,t=0,r){let n=ZTC(e);return r?.has(n)?!1:parseInt(n,16)/4294967295<t}function Ujy(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var C$o=String.fromCharCode,Vjy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",PDu={};function eqC(e,t){if(!PDu[e]){PDu[e]={};for(let r=0;r<e.length;r++)PDu[e][e.charAt(r)]=r}return PDu[e][t]}var KZa={compressToBase64:function(e){if(e==null)return"";let t=KZa._compress(e,6,function(r){return Vjy.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:KZa._decompress(e.length,32,function(t){return eqC(Vjy,e.charAt(t))})},compress:function(e){return KZa._compress(e,16,function(t){return C$o(t)})},_compress:function(e,t,r){if(e==null)return"";let n={},i={},a=[],o,c,f="",u="",s="",l=2,m=3,O=2,P=0,C=0,I;for(I=0;I<e.length;I+=1)if(f=e.charAt(I),Object.prototype.hasOwnProperty.call(n,f)||(n[f]=m++,i[f]=!0),u=s+f,Object.prototype.hasOwnProperty.call(n,u))s=u;else{if(Object.prototype.hasOwnProperty.call(i,s)){if(s.charCodeAt(0)<256){for(o=0;o<O;o++)P=P<<1,C==t-1?(C=0,a.push(r(P)),P=0):C++;for(c=s.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<O;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=s.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,O),O++),delete i[s]}else for(c=n[s],o=0;o<O;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,O),O++),n[u]=m++,s=String(f)}if(s!==""){if(Object.prototype.hasOwnProperty.call(i,s)){if(s.charCodeAt(0)<256){for(o=0;o<O;o++)P=P<<1,C==t-1?(C=0,a.push(r(P)),P=0):C++;for(c=s.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<O;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=s.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,O),O++),delete i[s]}else for(c=n[s],o=0;o<O;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,O),O++)}for(c=2,o=0;o<O;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;for(;;)if(P=P<<1,C==t-1){a.push(r(P));break}else C++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:KZa._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let n=[],i=[],a={val:r(0),position:t,index:1},o=4,c=4,f=3,u="",s,l,m,O,P,C,I;for(s=0;s<3;s+=1)n[s]=s;for(m=0,P=Math.pow(2,2),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;switch(m){case 0:for(m=0,P=Math.pow(2,8),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;I=C$o(m);break;case 1:for(m=0,P=Math.pow(2,16),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;I=C$o(m);break;case 2:return""}for(n[3]=I,l=I,i.push(I);;){if(a.index>e)return"";for(m=0,P=Math.pow(2,f),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;switch(I=m){case 0:for(m=0,P=Math.pow(2,8),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;n[c++]=C$o(m),I=c-1,o--;break;case 1:for(m=0,P=Math.pow(2,16),C=1;C!=P;)O=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(O>0?1:0)*C,C<<=1;n[c++]=C$o(m),I=c-1,o--;break;case 2:return i.join("")}if(o==0&&(o=Math.pow(2,f),f++),n[I])u=n[I];else if(I===c)u=l+l.charAt(0);else return null;i.push(u),n[c++]=l+u.charAt(0),o--,l=u,o==0&&(o=Math.pow(2,f),f++)}}},DAf=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(n=>n!==r)}}emit(t,r){for(let n of this.events[t]||[])n(r);for(let n of this.events["*"]||[])n(t,r)}},XZa=class extends Error{constructor(t,r){super("HTTP error while fetching PostHog: status="+t.status+", reqByteLength="+r),this.response=t,this.reqByteLength=r,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}},I$o=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function Wjy(e){if(e instanceof XZa){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function jAf(e){return typeof e=="object"&&(e instanceof XZa||e instanceof I$o)}function Gjy(e){return typeof e=="object"&&e instanceof XZa&&e.status===413}var CAf;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(CAf||(CAf={}));var IAf=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new DAf,this._isInitialized=!1,JTC(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=$TC(r?.host||"https://us.i.posthog.com"),this.flushAt=r?.flushAt?Math.max(r?.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,r?.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,r?.maxQueueSize??1e3),this.flushInterval=r?.flushInterval??1e4,this.captureMode=r?.captureMode||"json",this.preloadFeatureFlags=r?.preloadFeatureFlags??!0,this.defaultOptIn=r?.defaultOptIn??!0,this.disableSurveys=r?.disableSurveys??!1,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:jAf},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=r?.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=r?.disableGeoip??!0,this.disabled=r?.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(pxe.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(pxe.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(pxe.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(n,i)=>console.log("PostHog Debug",n,i));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=SAf();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,n){this.wrap(()=>{let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",i,n)})}async identifyStatelessImmediate(t,r,n){let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",i,n)}captureStateless(t,r,n,i){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:n});this.enqueue("capture",a,i)})}async captureStatelessImmediate(t,r,n,i){let a=this.buildPayload({distinct_id:t,event:r,properties:n});await this.sendImmediate("capture",a,i)}aliasStateless(t,r,n,i){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});this.enqueue("alias",a,i)})}async aliasStatelessImmediate(t,r,n,i){let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",a,i)}groupIdentifyStateless(t,r,n,i,a,o){this.wrap(()=>{let c=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...o||{}}});this.enqueue("capture",c,i)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,n,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(i=>i.json()).catch(i=>{this.logMsgIfDebug(()=>console.error("Remote config could not be loaded",i)),this._events.emit("error",i)})}async getDecide(t,r={},n={},i={},a={}){await this._initPromise;let c=kTC(this.apiKey,WTC,GTC)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,f={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...a})};return this.logMsgIfDebug(()=>console.log("PostHog Debug","Decide URL",c)),this.fetchWithRetry(c,f,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(u=>u.json()).then(u=>QTC(u)).catch(u=>{this._events.emit("error",u)})}async getFeatureFlagStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailStateless(t,r,n,i,a,o);if(c===void 0)return{response:void 0,requestId:void 0};let f=FAf(c.response);return f===void 0&&(f=!1),{response:f,requestId:c.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(r,n,i,a,o,[t]);return c===void 0?void 0:{response:c.flags[t],requestId:c.requestId}}async getFeatureFlagPayloadStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagPayloadsStateless(r,n,i,a,o,[t]);if(!c)return;let f=c[t];return f===void 0?null:f}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},a,o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},a,o){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(t,r,n,i,a,o);return c?{flags:c.featureFlags,payloads:c.featureFlagPayloads,requestId:c.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c={};(a??this.disableGeoip)&&(c.geoip_disable=!0),o&&(c.flag_keys_to_evaluate=o);let f=await this.getDecide(t,r,n,i,c);if(f!==void 0)return f.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),f.quotaLimited?.includes(CAf.FeatureFlags)?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:f?.requestId}):f}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this.logMsgIfDebug(()=>console.log("PostHog Debug","Loading surveys is disabled.")),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},i=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let o=`Surveys API could not be loaded: ${a.status}`,c=new Error(o);this.logMsgIfDebug(()=>console.error(c)),this._events.emit("error",new Error(o));return}return a.json()}).catch(a=>{this.logMsgIfDebug(()=>console.error("Surveys API could not be loaded",a)),this._events.emit("error",a)}))?.surveys;return i&&this.logMsgIfDebug(()=>console.log("PostHog Debug","Surveys fetched from API: ",JSON.stringify(i))),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(pxe.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(pxe.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(pxe.Props,this.props)})}enqueue(t,r,n){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let i=this.prepareMessage(t,r,n),a=this.getPersistedProperty(pxe.Queue)||[];a.length>=this.maxQueueSize&&(a.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),a.push({message:i}),this.setPersistedProperty(pxe.Queue,a),this._events.emit(t,i),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=DDu(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,n){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized||await this._initPromise,this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let i={api_key:this.apiKey,batch:[this.prepareMessage(t,r,n)],sent_at:wAf()};this.historicalMigration&&(i.historical_migration=!0);let a=JSON.stringify(i),o=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${Ljy()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,c=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(KZa.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(o,c)}catch(f){this._events.emit("error",f)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:wAf(),uuid:n?.uuid?n.uuid:SAf()};return(n?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await Wjy(t)})}async flush(){let t=Ujy([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),Ujy([t]).then(()=>{this.flushPromise===t&&(this.flushPromise=null)}),t}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(pxe.Queue)||[];if(!t.length)return;let r=[],n=t.length;for(;t.length>0&&r.length<n;){let i=t.slice(0,this.maxBatchSize),a=i.map(m=>m.message),o=()=>{let O=(this.getPersistedProperty(pxe.Queue)||[]).slice(i.length);this.setPersistedProperty(pxe.Queue,O),t=O},c={api_key:this.apiKey,batch:a,sent_at:wAf()};this.historicalMigration&&(c.historical_migration=!0);let f=JSON.stringify(c),u=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${Ljy()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,s=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(KZa.compressToBase64(f))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:f},l={retryCheck:m=>Gjy(m)?!1:jAf(m)};try{await this.fetchWithRetry(u,s,l)}catch(m){if(Gjy(m)&&a.length>1){this.maxBatchSize=Math.max(1,Math.floor(a.length/2)),this.logMsgIfDebug(()=>console.warn(`Received 413 when sending batch of size ${a.length}, reducing batch size to ${this.maxBatchSize}`));continue}throw m instanceof I$o||o(),this._events.emit("error",m),m}o(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){var a;(a=AbortSignal).timeout??(a.timeout=function(u){let s=new AbortController;return setTimeout(()=>s.abort(),u),s.signal});let o=r.body?r.body:"",c=-1;try{c=Buffer.byteLength(o,HTC)}catch{c=new TextEncoder().encode(o).length}return await YTC(async()=>{let f=null;try{f=await this.fetch(t,{signal:AbortSignal.timeout(i??this.requestTimeout),...r})}catch(s){throw new I$o(s)}if(!(r.mode==="no-cors")&&(f.status<200||f.status>=400))throw new XZa(f,c);return f},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let n=async()=>{try{for(await Promise.all(Object.values(this.pendingPromises));!((this.getPersistedProperty(pxe.Queue)||[]).length===0||(await this.flush(),r)););}catch(i){if(!jAf(i))throw i;await Wjy(i)}};return Promise.race([new Promise((i,a)=>{DDu(()=>{this.logMsgIfDebug(()=>console.error("Timed out while shutting down PostHog")),r=!0,a("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),n()])}async shutdown(t=3e4){return this.shutdownPromise?this.logMsgIfDebug(()=>console.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup")):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}},MAf=XTC();if(!MAf){let e=Ajy();MAf=async(t,r)=>{let n=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:n.status,text:async()=>n.data,json:async()=>n.data}}}var s1y=MAf,CDu=class{constructor(t){this.factory=t}async getValue(){return this.value!==void 0?this.value:(this.initializationPromise===void 0&&(this.initializationPromise=(async()=>{try{let t=await this.factory();return this.value=t,t}finally{this.initializationPromise=void 0}})()),this.initializationPromise)}isInitialized(){return this.value!==void 0}async waitForInitialization(){this.isInitialized()||await this.getValue()}},u1y=new CDu(async()=>{try{return await import("crypto")}catch{return}});async function tqC(){return await u1y.getValue()}var rqC=new CDu(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await u1y.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function nqC(){return await rqC.getValue()}async function iqC(e){let t=await tqC();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await nqC();if(r){let n=await r.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(n)).map(a=>a.toString(16).padStart(2,"0")).join("")}throw new Error("No crypto implementation available. Tried Node Crypto API and Web SubtleCrypto API")}var aqC=60*1e3,oqC=1152921504606847e3,sqC=["is_not"],$Za=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},Pse=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},BAf=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:a,customHeaders:o,...c}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=a,this.poller=void 0,this.fetch=c.fetch||s1y,this.onError=c.onError,this.customHeaders=o,this.onLoad=c.onLoad,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,n={},i={},a={}){await this.loadFeatureFlags();let o,c;if(!this.loadedSuccessfullyOnce)return o;for(let f of this.featureFlags)if(t===f.key){c=f;break}if(c!==void 0)try{o=await this.computeFlagLocally(c,r,n,i,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${o}`))}catch(f){f instanceof Pse?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${f}`)):f instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${f}`))}return o}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let n;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),n==null)return null;try{return JSON.parse(n)}catch{return n}}}async getAllFlagsAndPayloads(t,r={},n={},i={}){await this.loadFeatureFlags();let a={},o={},c=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async f=>{try{let u=await this.computeFlagLocally(f,t,r,n,i);a[f.key]=u;let s=await this.computeFeatureFlagPayloadLocally(f.key,u);s&&(o[f.key]=s)}catch(u){u instanceof Pse||u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${f.key}: ${u}`)),c=!0}})),{response:a,payloads:o,fallbackToDecide:c}}async computeFlagLocally(t,r,n={},i={},a={}){if(t.ensure_experience_continuity)throw new Pse("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let f=this.groupTypeMapping[String(c)];if(!f)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new Pse("Flag has unknown group type index");if(!(f in n))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let u=a[f];return await this.matchFeatureFlagProperties(t,n[f],u)}else return await this.matchFeatureFlagProperties(t,r,i)}async matchFeatureFlagProperties(t,r,n){let i=t.filters||{},a=i.groups||[],o=!1,c,f=[...a].sort((u,s)=>{let l=!!u.variant,m=!!s.variant;return l&&m?0:l?-1:m?1:0});for(let u of f)try{if(await this.isConditionMatch(t,r,u,n)){let s=u.variant,l=i.multivariate?.variants||[];s&&l.some(m=>m.key===s)?c=s:c=await this.getMatchingVariant(t,r)||!0;break}}catch(s){if(s instanceof Pse)o=!0;else throw s}if(c!==void 0)return c;if(o)throw new Pse("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i){let a=n.rollout_percentage,o=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let f=c.type,u=!1;if(f==="cohort"?u=l1y(c,i,this.cohorts,this.debugMode):u=c1y(c,i,o),!u)return!1}if(a==null)return!0}return!(a!=null&&await Hjy(t.key,r)>a/100)}async getMatchingVariant(t,r){let n=await Hjy(t.key,r,"variant"),i=this.variantLookupTable(t).find(a=>n>=a.valueMin&&n<a.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(c=>{i=n+c.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:c.key}),n=i}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(aqC,this.pollingInterval*2**this.backOffCount):this.pollingInterval}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.getPollingInterval());try{let t=await this._requestFeatureFlagDefinitions();if(!t)return;switch(t.status){case 401:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new $Za(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new $Za(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new $Za(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let r=await t.json()??{};if(!("flags"in r)){this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`));return}this.featureFlags=r.flags??[],this.featureFlagsByKey=this.featureFlags.reduce((n,i)=>(n[i.key]=i,n),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||{},this.loadedSuccessfullyOnce=!0,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.onLoad?.(this.featureFlags.length);break}default:return}}catch(t){t instanceof $Za&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET"){return{method:t,headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions(),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=DDu(()=>{i.abort()},this.timeout),r.signal=i.signal}try{return await this.fetch(t,r)}finally{clearTimeout(n)}}stopPoller(){clearTimeout(this.poller)}_requestRemoteConfigPayload(t){let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config/`,n=this.getPersonalApiKeyRequestOptions(),i=null;if(this.timeout&&typeof this.timeout=="number"){let a=new AbortController;i=DDu(()=>{a.abort()},this.timeout),n.signal=a.signal}try{return this.fetch(r,n)}finally{clearTimeout(i)}}};async function Hjy(e,t,r=""){let n=await iqC(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/oqC}function c1y(e,t,r){let n=e.key,i=e.value,a=e.operator||"exact";if(n in t){if(a==="is_not_set")throw new Pse("Operator is_not_set is not supported")}else throw new Pse(`Property ${n} not found in propertyValues`);let o=t[n];if(o==null&&!sqC.includes(a))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${a} operator`),!1;function c(u,s){return Array.isArray(u)?u.map(l=>String(l).toLowerCase()).includes(String(s).toLowerCase()):String(u).toLowerCase()===String(s).toLowerCase()}function f(u,s,l){if(l==="gt")return u>s;if(l==="gte")return u>=s;if(l==="lt")return u<s;if(l==="lte")return u<=s;throw new Error(`Invalid operator: ${l}`)}switch(a){case"exact":return c(i,o);case"is_not":return!c(i,o);case"is_set":return n in t;case"icontains":return String(o).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(i).toLowerCase());case"regex":return Jjy(String(i))&&String(o).match(String(i))!==null;case"not_regex":return Jjy(String(i))&&String(o).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let u=typeof i=="number"?i:null;if(typeof i=="string")try{u=parseFloat(i)}catch{}return u!=null&&o!=null?typeof o=="string"?f(o,String(i),a):f(o,u,a):f(String(o),String(i),a)}case"is_date_after":case"is_date_before":{let u=uqC(String(i));if(u==null&&(u=Kjy(i)),u==null)throw new Pse(`Invalid date: ${i}`);let s=Kjy(o);return["is_date_before"].includes(a)?s<u:s>u}default:throw new Pse(`Unknown operator: ${a}`)}}function l1y(e,t,r,n=!1){let i=String(e.value);if(!(i in r))throw new Pse("can't match cohort without a given cohort property value");let a=r[i];return f1y(a,t,r,n)}function f1y(e,t,r,n=!1){if(!e)return!0;let i=e.type,a=e.values;if(!a||a.length===0)return!0;let o=!1;if("values"in a[0]){for(let c of a)try{let f=f1y(c,t,r,n);if(i==="AND"){if(!f)return!1}else if(f)return!0}catch(f){if(f instanceof Pse)n&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new Pse("Can't match cohort without a given cohort property value");return i==="AND"}else{for(let c of a)try{let f;c.type==="cohort"?f=l1y(c,t,r,n):f=c1y(c,t);let u=c.negation||!1;if(i==="AND"){if(!f&&!u||f&&u)return!1}else if(f&&!u||!f&&u)return!0}catch(f){if(f instanceof Pse)n&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new Pse("can't match cohort without a given cohort property value");return i==="AND"}}function Jjy(e){try{return new RegExp(e),!0}catch{return!1}}function Kjy(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 Pse(`${e} is in an invalid date format`)}else throw new Pse(`The date provided ${e} must be a string, number, or date object`)}function uqC(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let a=r.groups.interval;if(a=="h")n.setUTCHours(n.getUTCHours()-i);else if(a=="d")n.setUTCDate(n.getUTCDate()-i);else if(a=="w")n.setUTCDate(n.getUTCDate()-i*7);else if(a=="m")n.setUTCMonth(n.getUTCMonth()-i);else if(a=="y")n.setUTCFullYear(n.getUTCFullYear()-i);else return null;return n}else return null}var TAf=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},cqC=100,$jy=30*1e3,lqC=50*1e3,qAf=class extends IAf{constructor(t,r={}){if(super(t,r),this._memoryStorage=new TAf,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,cqC):$jy,r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');this.featureFlagsPoller=new BAf({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:n=>{this._events.emit("error",n)},onLoad:n=>{this._events.emit("localEvaluationFlagsLoaded",n)},customHeaders:this.getCustomHeaders()})}this.errorTracking=new YZa(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||lqC}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):s1y(t,r)}getLibraryVersion(){return zTC}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:n,properties:i,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:f,uuid:u}=t,s=O=>{super.captureStateless(r,n,O,{timestamp:c,disableGeoip:f,uuid:u})},l=async(O,P,C)=>(await super.getFeatureFlagsStateless(O,P,void 0,void 0,C)).flags,m=Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let O={};for(let[P,C]of Object.entries(a||{}))O[P]=String(C);return await this.getAllFlags(r,{groups:O,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(O=>{let P={};if(O)for(let[I,T]of Object.entries(O))P[`$feature/${I}`]=T;let C=Object.keys(O||{}).filter(I=>O?.[I]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(O=>{s({...O,...i,$groups:a})});this.addPendingPromise(m)}async captureImmediate(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:n,properties:i,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:f,uuid:u}=t,s=O=>super.captureStatelessImmediate(r,n,O,{timestamp:c,disableGeoip:f,uuid:u}),l=async(O,P,C)=>(await super.getFeatureFlagsStateless(O,P,void 0,void 0,C)).flags;await Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let O={};for(let[P,C]of Object.entries(a||{}))O[P]=String(C);return await this.getAllFlags(r,{groups:O,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(O=>{let P={};if(O)for(let[I,T]of Object.entries(O))P[`$feature/${I}`]=T;let C=Object.keys(O||{}).filter(I=>O?.[I]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(O=>{s({...O,...i,$groups:a})})}identify({distinctId:t,properties:r,disableGeoip:n}){let i=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;super.identifyStateless(t,{$set:a,$set_once:i},{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r,disableGeoip:n}){let i=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;await super.identifyStatelessImmediate(t,{$set:a,$set_once:i},{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=$jy){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(n),i(),r(a>0)})})}async getFeatureFlag(t,r,n){let{groups:i,disableGeoip:a}=n||{},{onlyEvaluateLocally:o,sendFeatureFlagEvents:c,personProperties:f,groupProperties:u}=n||{},s=this.addLocalPersonAndGroupProperties(r,i,f,u);f=s.allPersonProperties,u=s.allGroupProperties,o==null&&(o=!1),c==null&&(c=!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,i,f,u),m=l!==void 0,O,P;if(!m&&!o){let I=await super.getFeatureFlagDetailStateless(t,r,i,f,u,a);if(I===void 0)return;P=I.response,l=FAf(P),O=I?.requestId}let C=`${t}_${l}`;return c&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(C))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(C):this.distinctIdHasSentFlagCalls[r]=[C],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:l,$feature_flag_id:P?.metadata?.id,$feature_flag_version:P?.metadata?.version,$feature_flag_reason:P?.reason?.description??P?.reason?.code,locally_evaluated:m,[`$feature/${t}`]:l,$feature_flag_request_id:O},groups:i,disableGeoip:a})),l}async getFeatureFlagPayload(t,r,n,i){let{groups:a,disableGeoip:o}=i||{},{onlyEvaluateLocally:c,sendFeatureFlagEvents:f,personProperties:u,groupProperties:s}=i||{},l=this.addLocalPersonAndGroupProperties(r,a,u,s);u=l.allPersonProperties,s=l.allGroupProperties;let m;return this.featureFlagsPoller!==void 0&&(n||(n=await this.getFeatureFlag(t,r,{...i,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),n&&(m=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,n))),c==null&&(c=!1),f==null&&(f=!0),c==null&&(c=!1),!(m!==void 0)&&!c&&(m=await super.getFeatureFlagPayloadStateless(t,r,a,u,s,o)),m}async getRemoteConfigPayload(t){return(await this.featureFlagsPoller?._requestRemoteConfigPayload(t))?.json()}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:n,disableGeoip:i}=r||{},{onlyEvaluateLocally:a,personProperties:o,groupProperties:c}=r||{},f=this.addLocalPersonAndGroupProperties(t,n,o,c);o=f.allPersonProperties,c=f.allGroupProperties,a==null&&(a=!1);let u=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,n,o,c),s={},l={},m=!0;if(u&&(s=u.response,l=u.payloads,m=u.fallbackToDecide),m&&!a){let O=await super.getFeatureFlagsAndPayloadsStateless(t,n,o,c,i);s={...s,...O.flags||{}},l={...l,...O.payloads||{}}}return{featureFlags:s,featureFlagPayloads:l}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:a}){super.groupIdentifyStateless(t,r,n,{disableGeoip:a},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(),super._shutdown(t)}addLocalPersonAndGroupProperties(t,r,n,i){let a={distinct_id:t,...n||{}},o={};if(r)for(let c of Object.keys(r))o[c]={$group_key:r[c],...i?.[c]||{}};return{allPersonProperties:a,allGroupProperties:o}}captureException(t,r,n){let i=new Error("PostHog syntheticException");YZa.captureException(this,t,{syntheticException:i},r,n)}},Yjy=/\(error: (.*)\)/,d1y=50,p1y="?";function fqC(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return n=>{let i=n.match(r);if(i){let a,o,c,f,u;if(i[1]){c=i[1];let m=c.lastIndexOf(".");if(c[m-1]==="."&&m--,m>0){a=c.slice(0,m),o=c.slice(m+1);let O=a.indexOf(".Module");O>0&&(c=c.slice(O+1),a=a.slice(0,O))}f=void 0}o&&(f=a,u=o),o==="<anonymous>"&&(u=void 0,c=void 0),c===void 0&&(u=u||p1y,c=f?`${f}.${u}`:u);let s=i[2]?.startsWith("file://")?i[2].slice(7):i[2],l=i[5]==="native";return s?.match(/\/[A-Z]:/)&&(s=s.slice(1)),!s&&i[5]&&!l&&(s=i[5]),{filename:s?decodeURI(s):void 0,module:e?e(s):void 0,function:c,lineno:Xjy(i[3]),colno:Xjy(i[4]),in_app:dqC(s||"",l),platform:"node:javascript"}}if(n.match(t))return{filename:n,platform:"node:javascript"}}}function dqC(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function Xjy(e){return parseInt(e||"",10)||void 0}function pqC(e){return[90,fqC(e)]}function _qC(e){let r=[pqC(e)].sort((n,i)=>n[0]-i[0]).map(n=>n[1]);return(n,i=0)=>{let a=[],o=n.split(`
2433
- `);for(let c=i;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let u=Yjy.test(f)?f.replace(Yjy,"$1"):f;if(!u.match(/\S*Error: /)){for(let s of r){let l=s(u);if(l){a.push(l);break}}if(a.length>=d1y)break}}return hqC(a)}}function hqC(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,d1y).map(r=>({...r,filename:r.filename||yqC(t).filename,function:r.function||p1y}))}function yqC(e){return e[e.length-1]||{}}YZa.stackParser=_qC(ETC());YZa.frameModifiers=[CTC];var ZZa=class extends qAf{getLibraryId(){return"posthog-node"}};var IDu=class{posthog;constructor({posthogApiKey:t}){this.posthog=new ZZa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.113.0",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var M$o=class{async sendEvent(){}async identify(){}async flush(){}};var eka=require("fs/promises"),v1y=require("os"),b1y=require("path");var _1y=$i(require("crypto")),BDu=new Uint8Array(256),MDu=BDu.length;function xAf(){return MDu>BDu.length-16&&(_1y.default.randomFillSync(BDu),MDu=0),BDu.slice(MDu,MDu+=16)}var $ve=[];for(let e=0;e<256;++e)$ve.push((e+256).toString(16).slice(1));function h1y(e,t=0){return $ve[e[t+0]]+$ve[e[t+1]]+$ve[e[t+2]]+$ve[e[t+3]]+"-"+$ve[e[t+4]]+$ve[e[t+5]]+"-"+$ve[e[t+6]]+$ve[e[t+7]]+"-"+$ve[e[t+8]]+$ve[e[t+9]]+"-"+$ve[e[t+10]]+$ve[e[t+11]]+$ve[e[t+12]]+$ve[e[t+13]]+$ve[e[t+14]]+$ve[e[t+15]]}var y1y=$i(require("crypto")),zAf={randomUUID:y1y.default.randomUUID};function vqC(e,t,r){if(zAf.randomUUID&&!t&&!e)return zAf.randomUUID();e=e||{};let n=e.random||(e.rng||xAf)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return h1y(n)}var Urt=vqC;var bqC="id",gqC=".fern",B$o=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new ZZa(r),this.userId=t==null?void 0:oyf(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.113.0",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ql(F_.of((0,v1y.homedir)()),ru.of(gqC),ru.of(bqC));await Vv(t)||(await(0,eka.mkdir)((0,b1y.dirname)(t),{recursive:!0}),await(0,eka.writeFile)(t,Urt())),this.persistedDistinctId=(await(0,eka.readFile)(t)).toString()}return this.persistedDistinctId}};var QAf;async function tka(){return QAf==null&&(QAf=await mqC()),QAf}async function mqC(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new M$o;let r=await $Au();return r!=null?new B$o({token:r,posthogApiKey:e}):await iXa()!=null?new IDu({posthogApiKey:e}):new B$o({token:void 0,posthogApiKey:e})}catch{return new M$o}}function T$o(e,t){return function(){return e.apply(t,arguments)}}var{toString:OqC}=Object.prototype,{getPrototypeOf:UAf}=Object,{iterator:qDu,toStringTag:m1y}=Symbol,RDu=(e=>t=>{let r=OqC.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ZTr=e=>(e=e.toLowerCase(),t=>RDu(t)===e),NDu=e=>t=>typeof t===e,{isArray:nka}=Array,rka=NDu("undefined");function q$o(e){return e!==null&&!rka(e)&&e.constructor!==null&&!rka(e.constructor)&&_xe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var O1y=ZTr("ArrayBuffer");function AqC(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&O1y(e.buffer),t}var PqC=NDu("string"),_xe=NDu("function"),A1y=NDu("number"),R$o=e=>e!==null&&typeof e=="object",wqC=e=>e===!0||e===!1,TDu=e=>{if(RDu(e)!=="object")return!1;let t=UAf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(m1y in e)&&!(qDu in e)},jqC=e=>{if(!R$o(e)||q$o(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},EqC=ZTr("Date"),SqC=ZTr("File"),DqC=ZTr("Blob"),CqC=ZTr("FileList"),IqC=e=>R$o(e)&&_xe(e.pipe),MqC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||_xe(e.append)&&((t=RDu(e))==="formdata"||t==="object"&&_xe(e.toString)&&e.toString()==="[object FormData]"))},BqC=ZTr("URLSearchParams"),[TqC,qqC,RqC,NqC]=["ReadableStream","Request","Response","Headers"].map(ZTr),FqC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function N$o(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),nka(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(q$o(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(n=0;n<o;n++)c=a[n],t.call(null,e[c],c,e)}}function P1y(e,t){if(q$o(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var $ua=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,w1y=e=>!rka(e)&&e!==$ua;function LAf(){let{caseless:e,skipUndefined:t}=w1y(this)&&this||{},r={},n=(i,a)=>{let o=e&&P1y(r,a)||a;TDu(r[o])&&TDu(i)?r[o]=LAf(r[o],i):TDu(i)?r[o]=LAf({},i):nka(i)?r[o]=i.slice():(!t||!rka(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&N$o(arguments[i],n);return r}var xqC=(e,t,r,{allOwnKeys:n}={})=>(N$o(t,(i,a)=>{r&&_xe(i)?e[a]=T$o(i,r):e[a]=i},{allOwnKeys:n}),e),zqC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),QqC=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},LqC=(e,t,r,n)=>{let i,a,o,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&UAf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},UqC=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},VqC=e=>{if(!e)return null;if(nka(e))return e;let t=e.length;if(!A1y(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},WqC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&UAf(Uint8Array)),GqC=(e,t)=>{let n=(e&&e[qDu]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},HqC=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},JqC=ZTr("HTMLFormElement"),KqC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),g1y=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),$qC=ZTr("RegExp"),j1y=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};N$o(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},YqC=e=>{j1y(e,(t,r)=>{if(_xe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(_xe(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},XqC=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return nka(e)?n(e):n(String(e).split(t)),r},ZqC=()=>{},kqC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function eRC(e){return!!(e&&_xe(e.append)&&e[m1y]==="FormData"&&e[qDu])}var tRC=e=>{let t=new Array(10),r=(n,i)=>{if(R$o(n)){if(t.indexOf(n)>=0)return;if(q$o(n))return n;if(!("toJSON"in n)){t[i]=n;let a=nka(n)?[]:{};return N$o(n,(o,c)=>{let f=r(o,i+1);!rka(f)&&(a[c]=f)}),t[i]=void 0,a}}return n};return r(e,0)},rRC=ZTr("AsyncFunction"),nRC=e=>e&&(R$o(e)||_xe(e))&&_xe(e.then)&&_xe(e.catch),E1y=((e,t)=>e?setImmediate:t?((r,n)=>($ua.addEventListener("message",({source:i,data:a})=>{i===$ua&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),$ua.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",_xe($ua.postMessage)),iRC=typeof queueMicrotask<"u"?queueMicrotask.bind($ua):typeof process<"u"&&process.nextTick||E1y,aRC=e=>e!=null&&_xe(e[qDu]),Zf={isArray:nka,isArrayBuffer:O1y,isBuffer:q$o,isFormData:MqC,isArrayBufferView:AqC,isString:PqC,isNumber:A1y,isBoolean:wqC,isObject:R$o,isPlainObject:TDu,isEmptyObject:jqC,isReadableStream:TqC,isRequest:qqC,isResponse:RqC,isHeaders:NqC,isUndefined:rka,isDate:EqC,isFile:SqC,isBlob:DqC,isRegExp:$qC,isFunction:_xe,isStream:IqC,isURLSearchParams:BqC,isTypedArray:WqC,isFileList:CqC,forEach:N$o,merge:LAf,extend:xqC,trim:FqC,stripBOM:zqC,inherits:QqC,toFlatObject:LqC,kindOf:RDu,kindOfTest:ZTr,endsWith:UqC,toArray:VqC,forEachEntry:GqC,matchAll:HqC,isHTMLForm:JqC,hasOwnProperty:g1y,hasOwnProp:g1y,reduceDescriptors:j1y,freezeMethods:YqC,toObjectSet:XqC,toCamelCase:KqC,noop:ZqC,toFiniteNumber:kqC,findKey:P1y,global:$ua,isContextDefined:w1y,isSpecCompliantForm:eRC,toJSONObject:tRC,isAsyncFn:rRC,isThenable:nRC,setImmediate:E1y,asap:iRC,isIterable:aRC};function ika(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Zf.inherits(ika,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Zf.toJSONObject(this.config),code:this.code,status:this.status}}});var S1y=ika.prototype,D1y={};["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=>{D1y[e]={value:e}});Object.defineProperties(ika,D1y);Object.defineProperty(S1y,"isAxiosError",{value:!0});ika.from=(e,t,r,n,i,a)=>{let o=Object.create(S1y);Zf.toFlatObject(e,o,function(s){return s!==Error.prototype},u=>u!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return ika.call(o,c,f,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var Qm=ika;var C1y=$i(Tsa(),1),FDu=C1y.default;function VAf(e){return Zf.isPlainObject(e)||Zf.isArray(e)}function M1y(e){return Zf.endsWith(e,"[]")?e.slice(0,-2):e}function I1y(e,t,r){return e?e.concat(t).map(function(i,a){return i=M1y(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function oRC(e){return Zf.isArray(e)&&!e.some(VAf)}var sRC=Zf.toFlatObject(Zf,{},null,function(t){return/^is[A-Z]/.test(t)});function uRC(e,t,r){if(!Zf.isObject(e))throw new TypeError("target must be an object");t=t||new(FDu||FormData),r=Zf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,I){return!Zf.isUndefined(I[C])});let n=r.metaTokens,i=r.visitor||s,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&Zf.isSpecCompliantForm(t);if(!Zf.isFunction(i))throw new TypeError("visitor must be a function");function u(P){if(P===null)return"";if(Zf.isDate(P))return P.toISOString();if(Zf.isBoolean(P))return P.toString();if(!f&&Zf.isBlob(P))throw new Qm("Blob is not supported. Use a Buffer instead.");return Zf.isArrayBuffer(P)||Zf.isTypedArray(P)?f&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function s(P,C,I){let T=P;if(P&&!I&&typeof P=="object"){if(Zf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Zf.isArray(P)&&oRC(P)||(Zf.isFileList(P)||Zf.endsWith(C,"[]"))&&(T=Zf.toArray(P)))return C=M1y(C),T.forEach(function(U,q){!(Zf.isUndefined(U)||U===null)&&t.append(o===!0?I1y([C],q,a):o===null?C:C+"[]",u(U))}),!1}return VAf(P)?!0:(t.append(I1y(I,C,a),u(P)),!1)}let l=[],m=Object.assign(sRC,{defaultVisitor:s,convertValue:u,isVisitable:VAf});function O(P,C){if(!Zf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Zf.forEach(P,function(T,z){(!(Zf.isUndefined(T)||T===null)&&i.call(t,T,Zf.isString(z)?z.trim():z,C,m))===!0&&O(T,C?C.concat(z):[z])}),l.pop()}}if(!Zf.isObject(e))throw new TypeError("data must be an object");return O(e),t}var B4i=uRC;function B1y(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function T1y(e,t){this._pairs=[],e&&B4i(e,this,t)}var q1y=T1y.prototype;q1y.append=function(t,r){this._pairs.push([t,r])};q1y.toString=function(t){let r=t?function(n){return t.call(this,n,B1y)}:B1y;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var R1y=T1y;function cRC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Yua(e,t,r){if(!t)return e;let n=r&&r.encode||cRC;Zf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Zf.isURLSearchParams(t)?t.toString():new R1y(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var WAf=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Zf.forEach(this.handlers,function(n){n!==null&&t(n)})}},GAf=WAf;var aka={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var z1y=$i(require("crypto"),1);var N1y=$i(require("url"),1),F1y=N1y.default.URLSearchParams;var HAf="abcdefghijklmnopqrstuvwxyz",x1y="0123456789",Q1y={DIGIT:x1y,ALPHA:HAf,ALPHA_DIGIT:HAf+HAf.toUpperCase()+x1y},lRC=(e=16,t=Q1y.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);z1y.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},L1y={isNode:!0,classes:{URLSearchParams:F1y,FormData:FDu,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:Q1y,generateString:lRC,protocols:["http","https","file","data"]};var $Af={};yf($Af,{hasBrowserEnv:()=>KAf,hasStandardBrowserEnv:()=>fRC,hasStandardBrowserWebWorkerEnv:()=>dRC,navigator:()=>JAf,origin:()=>pRC});var KAf=typeof window<"u"&&typeof document<"u",JAf=typeof navigator=="object"&&navigator||void 0,fRC=KAf&&(!JAf||["ReactNative","NativeScript","NS"].indexOf(JAf.product)<0),dRC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",pRC=KAf&&window.location.href||"http://localhost";var G7={...$Af,...L1y};function YAf(e,t){return B4i(e,new G7.classes.URLSearchParams,{visitor:function(r,n,i,a){return G7.isNode&&Zf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function _RC(e){return Zf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function hRC(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function yRC(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&Zf.isArray(i)?i.length:o,f?(Zf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Zf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Zf.isArray(i[o])&&(i[o]=hRC(i[o])),!c)}if(Zf.isFormData(e)&&Zf.isFunction(e.entries)){let r={};return Zf.forEachEntry(e,(n,i)=>{t(_RC(n),i,r,0)}),r}return null}var xDu=yRC;function vRC(e,t,r){if(Zf.isString(e))try{return(t||JSON.parse)(e),Zf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var XAf={transitional:aka,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Zf.isObject(t);if(a&&Zf.isHTMLForm(t)&&(t=new FormData(t)),Zf.isFormData(t))return i?JSON.stringify(xDu(t)):t;if(Zf.isArrayBuffer(t)||Zf.isBuffer(t)||Zf.isStream(t)||Zf.isFile(t)||Zf.isBlob(t)||Zf.isReadableStream(t))return t;if(Zf.isArrayBufferView(t))return t.buffer;if(Zf.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return YAf(t,this.formSerializer).toString();if((c=Zf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return B4i(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),vRC(t)):t}],transformResponse:[function(t){let r=this.transitional||XAf.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Zf.isResponse(t)||Zf.isReadableStream(t))return t;if(t&&Zf.isString(t)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?Qm.from(c,Qm.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:G7.classes.FormData,Blob:G7.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Zf.forEach(["delete","get","head","post","put","patch"],e=>{XAf.headers[e]={}});var oka=XAf;var bRC=Zf.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),U1y=e=>{let t={},r,n,i;return e&&e.split(`
2433
+ `);for(let c=i;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let u=Yjy.test(f)?f.replace(Yjy,"$1"):f;if(!u.match(/\S*Error: /)){for(let s of r){let l=s(u);if(l){a.push(l);break}}if(a.length>=d1y)break}}return hqC(a)}}function hqC(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,d1y).map(r=>({...r,filename:r.filename||yqC(t).filename,function:r.function||p1y}))}function yqC(e){return e[e.length-1]||{}}YZa.stackParser=_qC(ETC());YZa.frameModifiers=[CTC];var ZZa=class extends qAf{getLibraryId(){return"posthog-node"}};var IDu=class{posthog;constructor({posthogApiKey:t}){this.posthog=new ZZa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.113.1",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var M$o=class{async sendEvent(){}async identify(){}async flush(){}};var eka=require("fs/promises"),v1y=require("os"),b1y=require("path");var _1y=$i(require("crypto")),BDu=new Uint8Array(256),MDu=BDu.length;function xAf(){return MDu>BDu.length-16&&(_1y.default.randomFillSync(BDu),MDu=0),BDu.slice(MDu,MDu+=16)}var $ve=[];for(let e=0;e<256;++e)$ve.push((e+256).toString(16).slice(1));function h1y(e,t=0){return $ve[e[t+0]]+$ve[e[t+1]]+$ve[e[t+2]]+$ve[e[t+3]]+"-"+$ve[e[t+4]]+$ve[e[t+5]]+"-"+$ve[e[t+6]]+$ve[e[t+7]]+"-"+$ve[e[t+8]]+$ve[e[t+9]]+"-"+$ve[e[t+10]]+$ve[e[t+11]]+$ve[e[t+12]]+$ve[e[t+13]]+$ve[e[t+14]]+$ve[e[t+15]]}var y1y=$i(require("crypto")),zAf={randomUUID:y1y.default.randomUUID};function vqC(e,t,r){if(zAf.randomUUID&&!t&&!e)return zAf.randomUUID();e=e||{};let n=e.random||(e.rng||xAf)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return h1y(n)}var Urt=vqC;var bqC="id",gqC=".fern",B$o=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new ZZa(r),this.userId=t==null?void 0:oyf(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.113.1",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Ql(F_.of((0,v1y.homedir)()),ru.of(gqC),ru.of(bqC));await Vv(t)||(await(0,eka.mkdir)((0,b1y.dirname)(t),{recursive:!0}),await(0,eka.writeFile)(t,Urt())),this.persistedDistinctId=(await(0,eka.readFile)(t)).toString()}return this.persistedDistinctId}};var QAf;async function tka(){return QAf==null&&(QAf=await mqC()),QAf}async function mqC(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new M$o;let r=await $Au();return r!=null?new B$o({token:r,posthogApiKey:e}):await iXa()!=null?new IDu({posthogApiKey:e}):new B$o({token:void 0,posthogApiKey:e})}catch{return new M$o}}function T$o(e,t){return function(){return e.apply(t,arguments)}}var{toString:OqC}=Object.prototype,{getPrototypeOf:UAf}=Object,{iterator:qDu,toStringTag:m1y}=Symbol,RDu=(e=>t=>{let r=OqC.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ZTr=e=>(e=e.toLowerCase(),t=>RDu(t)===e),NDu=e=>t=>typeof t===e,{isArray:nka}=Array,rka=NDu("undefined");function q$o(e){return e!==null&&!rka(e)&&e.constructor!==null&&!rka(e.constructor)&&_xe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var O1y=ZTr("ArrayBuffer");function AqC(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&O1y(e.buffer),t}var PqC=NDu("string"),_xe=NDu("function"),A1y=NDu("number"),R$o=e=>e!==null&&typeof e=="object",wqC=e=>e===!0||e===!1,TDu=e=>{if(RDu(e)!=="object")return!1;let t=UAf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(m1y in e)&&!(qDu in e)},jqC=e=>{if(!R$o(e)||q$o(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},EqC=ZTr("Date"),SqC=ZTr("File"),DqC=ZTr("Blob"),CqC=ZTr("FileList"),IqC=e=>R$o(e)&&_xe(e.pipe),MqC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||_xe(e.append)&&((t=RDu(e))==="formdata"||t==="object"&&_xe(e.toString)&&e.toString()==="[object FormData]"))},BqC=ZTr("URLSearchParams"),[TqC,qqC,RqC,NqC]=["ReadableStream","Request","Response","Headers"].map(ZTr),FqC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function N$o(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),nka(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(q$o(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(n=0;n<o;n++)c=a[n],t.call(null,e[c],c,e)}}function P1y(e,t){if(q$o(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var $ua=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,w1y=e=>!rka(e)&&e!==$ua;function LAf(){let{caseless:e,skipUndefined:t}=w1y(this)&&this||{},r={},n=(i,a)=>{let o=e&&P1y(r,a)||a;TDu(r[o])&&TDu(i)?r[o]=LAf(r[o],i):TDu(i)?r[o]=LAf({},i):nka(i)?r[o]=i.slice():(!t||!rka(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&N$o(arguments[i],n);return r}var xqC=(e,t,r,{allOwnKeys:n}={})=>(N$o(t,(i,a)=>{r&&_xe(i)?e[a]=T$o(i,r):e[a]=i},{allOwnKeys:n}),e),zqC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),QqC=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},LqC=(e,t,r,n)=>{let i,a,o,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&UAf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},UqC=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},VqC=e=>{if(!e)return null;if(nka(e))return e;let t=e.length;if(!A1y(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},WqC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&UAf(Uint8Array)),GqC=(e,t)=>{let n=(e&&e[qDu]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},HqC=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},JqC=ZTr("HTMLFormElement"),KqC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),g1y=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),$qC=ZTr("RegExp"),j1y=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};N$o(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},YqC=e=>{j1y(e,(t,r)=>{if(_xe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(_xe(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},XqC=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return nka(e)?n(e):n(String(e).split(t)),r},ZqC=()=>{},kqC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function eRC(e){return!!(e&&_xe(e.append)&&e[m1y]==="FormData"&&e[qDu])}var tRC=e=>{let t=new Array(10),r=(n,i)=>{if(R$o(n)){if(t.indexOf(n)>=0)return;if(q$o(n))return n;if(!("toJSON"in n)){t[i]=n;let a=nka(n)?[]:{};return N$o(n,(o,c)=>{let f=r(o,i+1);!rka(f)&&(a[c]=f)}),t[i]=void 0,a}}return n};return r(e,0)},rRC=ZTr("AsyncFunction"),nRC=e=>e&&(R$o(e)||_xe(e))&&_xe(e.then)&&_xe(e.catch),E1y=((e,t)=>e?setImmediate:t?((r,n)=>($ua.addEventListener("message",({source:i,data:a})=>{i===$ua&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),$ua.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",_xe($ua.postMessage)),iRC=typeof queueMicrotask<"u"?queueMicrotask.bind($ua):typeof process<"u"&&process.nextTick||E1y,aRC=e=>e!=null&&_xe(e[qDu]),Zf={isArray:nka,isArrayBuffer:O1y,isBuffer:q$o,isFormData:MqC,isArrayBufferView:AqC,isString:PqC,isNumber:A1y,isBoolean:wqC,isObject:R$o,isPlainObject:TDu,isEmptyObject:jqC,isReadableStream:TqC,isRequest:qqC,isResponse:RqC,isHeaders:NqC,isUndefined:rka,isDate:EqC,isFile:SqC,isBlob:DqC,isRegExp:$qC,isFunction:_xe,isStream:IqC,isURLSearchParams:BqC,isTypedArray:WqC,isFileList:CqC,forEach:N$o,merge:LAf,extend:xqC,trim:FqC,stripBOM:zqC,inherits:QqC,toFlatObject:LqC,kindOf:RDu,kindOfTest:ZTr,endsWith:UqC,toArray:VqC,forEachEntry:GqC,matchAll:HqC,isHTMLForm:JqC,hasOwnProperty:g1y,hasOwnProp:g1y,reduceDescriptors:j1y,freezeMethods:YqC,toObjectSet:XqC,toCamelCase:KqC,noop:ZqC,toFiniteNumber:kqC,findKey:P1y,global:$ua,isContextDefined:w1y,isSpecCompliantForm:eRC,toJSONObject:tRC,isAsyncFn:rRC,isThenable:nRC,setImmediate:E1y,asap:iRC,isIterable:aRC};function ika(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Zf.inherits(ika,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Zf.toJSONObject(this.config),code:this.code,status:this.status}}});var S1y=ika.prototype,D1y={};["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=>{D1y[e]={value:e}});Object.defineProperties(ika,D1y);Object.defineProperty(S1y,"isAxiosError",{value:!0});ika.from=(e,t,r,n,i,a)=>{let o=Object.create(S1y);Zf.toFlatObject(e,o,function(s){return s!==Error.prototype},u=>u!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return ika.call(o,c,f,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var Qm=ika;var C1y=$i(Tsa(),1),FDu=C1y.default;function VAf(e){return Zf.isPlainObject(e)||Zf.isArray(e)}function M1y(e){return Zf.endsWith(e,"[]")?e.slice(0,-2):e}function I1y(e,t,r){return e?e.concat(t).map(function(i,a){return i=M1y(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function oRC(e){return Zf.isArray(e)&&!e.some(VAf)}var sRC=Zf.toFlatObject(Zf,{},null,function(t){return/^is[A-Z]/.test(t)});function uRC(e,t,r){if(!Zf.isObject(e))throw new TypeError("target must be an object");t=t||new(FDu||FormData),r=Zf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,I){return!Zf.isUndefined(I[C])});let n=r.metaTokens,i=r.visitor||s,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&Zf.isSpecCompliantForm(t);if(!Zf.isFunction(i))throw new TypeError("visitor must be a function");function u(P){if(P===null)return"";if(Zf.isDate(P))return P.toISOString();if(Zf.isBoolean(P))return P.toString();if(!f&&Zf.isBlob(P))throw new Qm("Blob is not supported. Use a Buffer instead.");return Zf.isArrayBuffer(P)||Zf.isTypedArray(P)?f&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function s(P,C,I){let T=P;if(P&&!I&&typeof P=="object"){if(Zf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Zf.isArray(P)&&oRC(P)||(Zf.isFileList(P)||Zf.endsWith(C,"[]"))&&(T=Zf.toArray(P)))return C=M1y(C),T.forEach(function(U,q){!(Zf.isUndefined(U)||U===null)&&t.append(o===!0?I1y([C],q,a):o===null?C:C+"[]",u(U))}),!1}return VAf(P)?!0:(t.append(I1y(I,C,a),u(P)),!1)}let l=[],m=Object.assign(sRC,{defaultVisitor:s,convertValue:u,isVisitable:VAf});function O(P,C){if(!Zf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Zf.forEach(P,function(T,z){(!(Zf.isUndefined(T)||T===null)&&i.call(t,T,Zf.isString(z)?z.trim():z,C,m))===!0&&O(T,C?C.concat(z):[z])}),l.pop()}}if(!Zf.isObject(e))throw new TypeError("data must be an object");return O(e),t}var B4i=uRC;function B1y(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function T1y(e,t){this._pairs=[],e&&B4i(e,this,t)}var q1y=T1y.prototype;q1y.append=function(t,r){this._pairs.push([t,r])};q1y.toString=function(t){let r=t?function(n){return t.call(this,n,B1y)}:B1y;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var R1y=T1y;function cRC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Yua(e,t,r){if(!t)return e;let n=r&&r.encode||cRC;Zf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Zf.isURLSearchParams(t)?t.toString():new R1y(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var WAf=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Zf.forEach(this.handlers,function(n){n!==null&&t(n)})}},GAf=WAf;var aka={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var z1y=$i(require("crypto"),1);var N1y=$i(require("url"),1),F1y=N1y.default.URLSearchParams;var HAf="abcdefghijklmnopqrstuvwxyz",x1y="0123456789",Q1y={DIGIT:x1y,ALPHA:HAf,ALPHA_DIGIT:HAf+HAf.toUpperCase()+x1y},lRC=(e=16,t=Q1y.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);z1y.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},L1y={isNode:!0,classes:{URLSearchParams:F1y,FormData:FDu,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:Q1y,generateString:lRC,protocols:["http","https","file","data"]};var $Af={};yf($Af,{hasBrowserEnv:()=>KAf,hasStandardBrowserEnv:()=>fRC,hasStandardBrowserWebWorkerEnv:()=>dRC,navigator:()=>JAf,origin:()=>pRC});var KAf=typeof window<"u"&&typeof document<"u",JAf=typeof navigator=="object"&&navigator||void 0,fRC=KAf&&(!JAf||["ReactNative","NativeScript","NS"].indexOf(JAf.product)<0),dRC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",pRC=KAf&&window.location.href||"http://localhost";var G7={...$Af,...L1y};function YAf(e,t){return B4i(e,new G7.classes.URLSearchParams,{visitor:function(r,n,i,a){return G7.isNode&&Zf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function _RC(e){return Zf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function hRC(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function yRC(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&Zf.isArray(i)?i.length:o,f?(Zf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Zf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Zf.isArray(i[o])&&(i[o]=hRC(i[o])),!c)}if(Zf.isFormData(e)&&Zf.isFunction(e.entries)){let r={};return Zf.forEachEntry(e,(n,i)=>{t(_RC(n),i,r,0)}),r}return null}var xDu=yRC;function vRC(e,t,r){if(Zf.isString(e))try{return(t||JSON.parse)(e),Zf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var XAf={transitional:aka,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Zf.isObject(t);if(a&&Zf.isHTMLForm(t)&&(t=new FormData(t)),Zf.isFormData(t))return i?JSON.stringify(xDu(t)):t;if(Zf.isArrayBuffer(t)||Zf.isBuffer(t)||Zf.isStream(t)||Zf.isFile(t)||Zf.isBlob(t)||Zf.isReadableStream(t))return t;if(Zf.isArrayBufferView(t))return t.buffer;if(Zf.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return YAf(t,this.formSerializer).toString();if((c=Zf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return B4i(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),vRC(t)):t}],transformResponse:[function(t){let r=this.transitional||XAf.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Zf.isResponse(t)||Zf.isReadableStream(t))return t;if(t&&Zf.isString(t)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?Qm.from(c,Qm.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:G7.classes.FormData,Blob:G7.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Zf.forEach(["delete","get","head","post","put","patch"],e=>{XAf.headers[e]={}});var oka=XAf;var bRC=Zf.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),U1y=e=>{let t={},r,n,i;return e&&e.split(`
2434
2434
  `).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&bRC[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var V1y=Symbol("internals");function F$o(e){return e&&String(e).trim().toLowerCase()}function zDu(e){return e===!1||e==null?e:Zf.isArray(e)?e.map(zDu):String(e)}function gRC(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var mRC=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ZAf(e,t,r,n,i){if(Zf.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!Zf.isString(t)){if(Zf.isString(n))return t.indexOf(n)!==-1;if(Zf.isRegExp(n))return n.test(t)}}function ORC(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function ARC(e,t){let r=Zf.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,a,o){return this[n].call(this,t,i,a,o)},configurable:!0})})}var ska=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function a(c,f,u){let s=F$o(f);if(!s)throw new Error("header name must be a non-empty string");let l=Zf.findKey(i,s);(!l||i[l]===void 0||u===!0||u===void 0&&i[l]!==!1)&&(i[l||f]=zDu(c))}let o=(c,f)=>Zf.forEach(c,(u,s)=>a(u,s,f));if(Zf.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(Zf.isString(t)&&(t=t.trim())&&!mRC(t))o(U1y(t),r);else if(Zf.isObject(t)&&Zf.isIterable(t)){let c={},f,u;for(let s of t){if(!Zf.isArray(s))throw TypeError("Object iterator must return a key-value pair");c[u=s[0]]=(f=c[u])?Zf.isArray(f)?[...f,s[1]]:[f,s[1]]:s[1]}o(c,r)}else t!=null&&a(r,t,n);return this}get(t,r){if(t=F$o(t),t){let n=Zf.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return gRC(i);if(Zf.isFunction(r))return r.call(this,i,n);if(Zf.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=F$o(t),t){let n=Zf.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||ZAf(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function a(o){if(o=F$o(o),o){let c=Zf.findKey(n,o);c&&(!r||ZAf(n,n[c],c,r))&&(delete n[c],i=!0)}}return Zf.isArray(t)?t.forEach(a):a(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let a=r[n];(!t||ZAf(this,this[a],a,t,!0))&&(delete this[a],i=!0)}return i}normalize(t){let r=this,n={};return Zf.forEach(this,(i,a)=>{let o=Zf.findKey(n,a);if(o){r[o]=zDu(i),delete r[a];return}let c=t?ORC(a):String(a).trim();c!==a&&delete r[a],r[c]=zDu(i),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return Zf.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&Zf.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
2435
2435
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[V1y]=this[V1y]={accessors:{}}).accessors,i=this.prototype;function a(o){let c=F$o(o);n[c]||(ARC(i,o),n[c]=!0)}return Zf.isArray(t)?t.forEach(a):a(t),this}};ska.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Zf.reduceDescriptors(ska.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Zf.freezeMethods(ska);var g$=ska;function x$o(e,t){let r=this||oka,n=t||r,i=g$.from(n.headers),a=n.data;return Zf.forEach(e,function(c){a=c.call(r,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function z$o(e){return!!(e&&e.__CANCEL__)}function W1y(e,t,r){Qm.call(this,e??"canceled",Qm.ERR_CANCELED,t,r),this.name="CanceledError"}Zf.inherits(W1y,Qm,{__CANCEL__:!0});var Vrt=W1y;function BUr(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new Qm("Request failed with status code "+r.status,[Qm.ERR_BAD_REQUEST,Qm.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function kAf(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ePf(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Xua(e,t,r){let n=!kAf(t);return e&&(n||r==!1)?ePf(e,t):t}var oEy=$i(oDu(),1),sEy=$i(require("http"),1),uEy=$i(require("https"),1),cEy=$i(require("util"),1),lEy=$i(tAf(),1),UAi=$i(require("zlib"),1);var Zua="1.12.2";function Q$o(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var PRC=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function tPf(e,t,r){let n=r&&r.Blob||G7.classes.Blob,i=Q$o(e);if(t===void 0&&n&&(t=!0),i==="data"){e=i.length?e.slice(i.length+1):e;let a=PRC.exec(e);if(!a)throw new Qm("Invalid URL",Qm.ERR_INVALID_URL);let o=a[1],c=a[2],f=a[3],u=Buffer.from(decodeURIComponent(f),c?"base64":"utf8");if(t){if(!n)throw new Qm("Blob is not supported",Qm.ERR_NOT_SUPPORT);return new n([u],{type:o})}return u}throw new Qm("Unsupported protocol "+i,Qm.ERR_NOT_SUPPORT)}var eca=$i(require("stream"),1);var G1y=$i(require("stream"),1);var rPf=Symbol("internals"),nPf=class extends G1y.default.Transform{constructor(t){t=Zf.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,i)=>!Zf.isUndefined(i[n])),super({readableHighWaterMark:t.chunkSize});let r=this[rPf]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",n=>{n==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[rPf];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let i=this[rPf],a=i.maxRate,o=this.readableHighWaterMark,c=i.timeWindow,f=1e3/c,u=a/f,s=i.minChunkSize!==!1?Math.max(i.minChunkSize,u*.01):0,l=(O,P)=>{let C=Buffer.byteLength(O);i.bytesSeen+=C,i.bytes+=C,i.isCaptured&&this.emit("progress",i.bytesSeen),this.push(O)?process.nextTick(P):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(P)}},m=(O,P)=>{let C=Buffer.byteLength(O),I=null,T=o,z,U=0;if(a){let q=Date.now();(!i.ts||(U=q-i.ts)>=c)&&(i.ts=q,z=u-i.bytes,i.bytes=z<0?-z:0,U=0),z=u-i.bytes}if(a){if(z<=0)return setTimeout(()=>{P(null,O)},c-U);z<T&&(T=z)}T&&C>T&&C-T>s&&(I=O.subarray(T),O=O.subarray(0,T)),l(O,I?()=>{process.nextTick(P,null,I)}:P)};m(t,function O(P,C){if(P)return n(P);C?m(C,O):n(null)})}},iPf=nPf;var fEy=require("events");var J1y=$i(require("util"),1),K1y=require("stream");var{asyncIterator:H1y}=Symbol,wRC=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[H1y]?yield*e[H1y]():yield e},QDu=wRC;var jRC=G7.ALPHABET.ALPHA_DIGIT+"-_",L$o=typeof TextEncoder=="function"?new TextEncoder:new J1y.default.TextEncoder,kua=`\r
2436
2436
  `,ERC=L$o.encode(kua),SRC=2,aPf=class{constructor(t,r){let{escapeName:n}=this.constructor,i=Zf.isString(r),a=`Content-Disposition: form-data; name="${n(t)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${kua}`;i?r=L$o.encode(String(r).replace(/\r?\n|\r\n?/g,kua)):a+=`Content-Type: ${r.type||"application/octet-stream"}${kua}`,this.headers=L$o.encode(a+kua),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+SRC,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;Zf.isTypedArray(t)?yield t:yield*QDu(t),yield ERC}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},DRC=(e,t,r)=>{let{tag:n="form-data-boundary",size:i=25,boundary:a=n+"-"+G7.generateString(i,jRC)}=r||{};if(!Zf.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let o=L$o.encode("--"+a+kua),c=L$o.encode("--"+a+"--"+kua),f=c.byteLength,u=Array.from(e.entries()).map(([l,m])=>{let O=new aPf(l,m);return f+=O.size,O});f+=o.byteLength*u.length,f=Zf.toFiniteNumber(f);let s={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(f)&&(s["Content-Length"]=f),t&&t(s),K1y.Readable.from((async function*(){for(let l of u)yield o,yield*l.encode();yield c})())},$1y=DRC;var Y1y=$i(require("stream"),1),oPf=class extends Y1y.default.Transform{__transform(t,r,n){this.push(t),n()}_transform(t,r,n){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let i=Buffer.alloc(2);i[0]=120,i[1]=156,this.push(i,r)}this.__transform(t,r,n)}},X1y=oPf;var CRC=(e,t)=>Zf.isAsyncFn(e)?function(...r){let n=r.pop();e.apply(this,r).then(i=>{try{t?n(null,...t(i)):n(null,i)}catch(a){n(a)}},n)}:e,Z1y=CRC;function IRC(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,a=0,o;return t=t!==void 0?t:1e3,function(f){let u=Date.now(),s=n[a];o||(o=u),r[i]=f,n[i]=u;let l=a,m=0;for(;l!==i;)m+=r[l++],l=l%e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),u-o<t)return;let O=s&&u-s;return O?Math.round(m*1e3/O):void 0}}var k1y=IRC;function MRC(e,t){let r=0,n=1e3/t,i,a,o=(u,s=Date.now())=>{r=s,i=null,a&&(clearTimeout(a),a=null),e(...u)};return[(...u)=>{let s=Date.now(),l=s-r;l>=n?o(u,s):(i=u,a||(a=setTimeout(()=>{a=null,o(i)},n-l)))},()=>i&&o(i)]}var eEy=MRC;var LAi=(e,t,r=3)=>{let n=0,i=k1y(50,250);return eEy(a=>{let o=a.loaded,c=a.lengthComputable?a.total:void 0,f=o-n,u=i(f),s=o<=c;n=o;let l={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:u||void 0,estimated:u&&c&&s?(c-o)/u:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},r)},uka=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},cka=e=>(...t)=>Zf.asap(()=>e(...t));function sPf(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;let t=e.indexOf(",");if(t<0)return 0;let r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let a=n.length,o=n.length;for(let m=0;m<o;m++)if(n.charCodeAt(m)===37&&m+2<o){let O=n.charCodeAt(m+1),P=n.charCodeAt(m+2);(O>=48&&O<=57||O>=65&&O<=70||O>=97&&O<=102)&&(P>=48&&P<=57||P>=65&&P<=70||P>=97&&P<=102)&&(a-=2,m+=2)}let c=0,f=o-1,u=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);f>=0&&(n.charCodeAt(f)===61?(c++,f--):u(f)&&(c++,f-=3)),c===1&&f>=0&&(n.charCodeAt(f)===61||u(f))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(n,"utf8")}var tEy={flush:UAi.default.constants.Z_SYNC_FLUSH,finishFlush:UAi.default.constants.Z_SYNC_FLUSH},BRC={flush:UAi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:UAi.default.constants.BROTLI_OPERATION_FLUSH},rEy=Zf.isFunction(UAi.default.createBrotliDecompress),{http:TRC,https:qRC}=lEy.default,RRC=/https:?/,nEy=G7.protocols.map(e=>e+":"),iEy=(e,[t,r])=>(e.on("end",r).on("error",r),t);function NRC(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function dEy(e,t,r){let n=t;if(!n&&n!==!1){let i=oEy.default.getProxyForUrl(r);i&&(n=new URL(i))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let a=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let i=n.hostname||n.host;e.hostname=i,e.host=i,e.port=n.port,e.path=r,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(a){dEy(a,t,a.href)}}var FRC=typeof process<"u"&&Zf.kindOf(process)==="process",xRC=e=>new Promise((t,r)=>{let n,i,a=(f,u)=>{i||(i=!0,n&&n(f,u))},o=f=>{a(f),t(f)},c=f=>{a(f,!0),r(f)};e(o,c,f=>n=f).catch(c)}),zRC=({address:e,family:t})=>{if(!Zf.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},aEy=(e,t)=>zRC(Zf.isObject(e)?e:{address:e,family:t}),pEy=FRC&&function(t){return xRC(async function(n,i,a){let{data:o,lookup:c,family:f}=t,{responseType:u,responseEncoding:s}=t,l=t.method.toUpperCase(),m,O=!1,P;if(c){let Ee=Z1y(c,Ot=>Zf.isArray(Ot)?Ot:[Ot]);c=(Ot,vt,xe)=>{Ee(Ot,vt,(Be,Jt,pt)=>{if(Be)return xe(Be);let vr=Zf.isArray(Jt)?Jt.map(Gt=>aEy(Gt)):[aEy(Jt,pt)];vt.all?xe(Be,vr):xe(Be,vr[0].address,vr[0].family)})}}let C=new fEy.EventEmitter,I=()=>{t.cancelToken&&t.cancelToken.unsubscribe(T),t.signal&&t.signal.removeEventListener("abort",T),C.removeAllListeners()};a((Ee,Ot)=>{m=!0,Ot&&(O=!0,I())});function T(Ee){C.emit("abort",!Ee||Ee.type?new Vrt(null,t,P):Ee)}C.once("abort",i),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(T),t.signal&&(t.signal.aborted?T():t.signal.addEventListener("abort",T)));let z=Xua(t.baseURL,t.url,t.allowAbsoluteUrls),U=new URL(z,G7.hasBrowserEnv?G7.origin:void 0),q=U.protocol||nEy[0];if(q==="data:"){if(t.maxContentLength>-1){let Ot=String(t.url||z||"");if(sPf(Ot)>t.maxContentLength)return i(new Qm("maxContentLength size of "+t.maxContentLength+" exceeded",Qm.ERR_BAD_RESPONSE,t))}let Ee;if(l!=="GET")return BUr(n,i,{status:405,statusText:"method not allowed",headers:{},config:t});try{Ee=tPf(t.url,u==="blob",{Blob:t.env&&t.env.Blob})}catch(Ot){throw Qm.from(Ot,Qm.ERR_BAD_REQUEST,t)}return u==="text"?(Ee=Ee.toString(s),(!s||s==="utf8")&&(Ee=Zf.stripBOM(Ee))):u==="stream"&&(Ee=eca.default.Readable.from(Ee)),BUr(n,i,{data:Ee,status:200,statusText:"OK",headers:new g$,config:t})}if(nEy.indexOf(q)===-1)return i(new Qm("Unsupported protocol "+q,Qm.ERR_BAD_REQUEST,t));let V=g$.from(t.headers).normalize();V.set("User-Agent","axios/"+Zua,!1);let{onUploadProgress:$,onDownloadProgress:re}=t,Y=t.maxRate,k,ne;if(Zf.isSpecCompliantForm(o)){let Ee=V.getContentType(/boundary=([-_\w\d]{10,70})/i);o=$1y(o,Ot=>{V.set(Ot)},{tag:`axios-${Zua}-boundary`,boundary:Ee&&Ee[1]||void 0})}else if(Zf.isFormData(o)&&Zf.isFunction(o.getHeaders)){if(V.set(o.getHeaders()),!V.hasContentLength())try{let Ee=await cEy.default.promisify(o.getLength).call(o);Number.isFinite(Ee)&&Ee>=0&&V.setContentLength(Ee)}catch{}}else if(Zf.isBlob(o)||Zf.isFile(o))o.size&&V.setContentType(o.type||"application/octet-stream"),V.setContentLength(o.size||0),o=eca.default.Readable.from(QDu(o));else if(o&&!Zf.isStream(o)){if(!Buffer.isBuffer(o))if(Zf.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(Zf.isString(o))o=Buffer.from(o,"utf-8");else return i(new Qm("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Qm.ERR_BAD_REQUEST,t));if(V.setContentLength(o.length,!1),t.maxBodyLength>-1&&o.length>t.maxBodyLength)return i(new Qm("Request body larger than maxBodyLength limit",Qm.ERR_BAD_REQUEST,t))}let me=Zf.toFiniteNumber(V.getContentLength());Zf.isArray(Y)?(k=Y[0],ne=Y[1]):k=ne=Y,o&&($||k)&&(Zf.isStream(o)||(o=eca.default.Readable.from(o,{objectMode:!1})),o=eca.default.pipeline([o,new iPf({maxRate:Zf.toFiniteNumber(k)})],Zf.noop),$&&o.on("progress",iEy(o,uka(me,LAi(cka($),!1,3)))));let _e;if(t.auth){let Ee=t.auth.username||"",Ot=t.auth.password||"";_e=Ee+":"+Ot}if(!_e&&U.username){let Ee=U.username,Ot=U.password;_e=Ee+":"+Ot}_e&&V.delete("authorization");let ve;try{ve=Yua(U.pathname+U.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Ee){let Ot=new Error(Ee.message);return Ot.config=t,Ot.url=t.url,Ot.exists=!0,i(Ot)}V.set("Accept-Encoding","gzip, compress, deflate"+(rEy?", br":""),!1);let pe={path:ve,method:l,headers:V.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:_e,protocol:q,family:f,beforeRedirect:NRC,beforeRedirects:{}};!Zf.isUndefined(c)&&(pe.lookup=c),t.socketPath?pe.socketPath=t.socketPath:(pe.hostname=U.hostname.startsWith("[")?U.hostname.slice(1,-1):U.hostname,pe.port=U.port,dEy(pe,t.proxy,q+"//"+U.hostname+(U.port?":"+U.port:"")+pe.path));let De,Ce=RRC.test(pe.protocol);if(pe.agent=Ce?t.httpsAgent:t.httpAgent,t.transport?De=t.transport:t.maxRedirects===0?De=Ce?uEy.default:sEy.default:(t.maxRedirects&&(pe.maxRedirects=t.maxRedirects),t.beforeRedirect&&(pe.beforeRedirects.config=t.beforeRedirect),De=Ce?qRC:TRC),t.maxBodyLength>-1?pe.maxBodyLength=t.maxBodyLength:pe.maxBodyLength=1/0,t.insecureHTTPParser&&(pe.insecureHTTPParser=t.insecureHTTPParser),P=De.request(pe,function(Ot){if(P.destroyed)return;let vt=[Ot],xe=+Ot.headers["content-length"];if(re||ne){let Gt=new iPf({maxRate:Zf.toFiniteNumber(ne)});re&&Gt.on("progress",iEy(Gt,uka(xe,LAi(cka(re),!0,3)))),vt.push(Gt)}let Be=Ot,Jt=Ot.req||P;if(t.decompress!==!1&&Ot.headers["content-encoding"])switch((l==="HEAD"||Ot.statusCode===204)&&delete Ot.headers["content-encoding"],(Ot.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":vt.push(UAi.default.createUnzip(tEy)),delete Ot.headers["content-encoding"];break;case"deflate":vt.push(new X1y),vt.push(UAi.default.createUnzip(tEy)),delete Ot.headers["content-encoding"];break;case"br":rEy&&(vt.push(UAi.default.createBrotliDecompress(BRC)),delete Ot.headers["content-encoding"])}Be=vt.length>1?eca.default.pipeline(vt,Zf.noop):vt[0];let pt=eca.default.finished(Be,()=>{pt(),I()}),vr={status:Ot.statusCode,statusText:Ot.statusMessage,headers:new g$(Ot.headers),config:t,request:Jt};if(u==="stream")vr.data=Be,BUr(n,i,vr);else{let Gt=[],Xe=0;Be.on("data",function(kt){Gt.push(kt),Xe+=kt.length,t.maxContentLength>-1&&Xe>t.maxContentLength&&(O=!0,Be.destroy(),i(new Qm("maxContentLength size of "+t.maxContentLength+" exceeded",Qm.ERR_BAD_RESPONSE,t,Jt)))}),Be.on("aborted",function(){if(O)return;let kt=new Qm("stream has been aborted",Qm.ERR_BAD_RESPONSE,t,Jt);Be.destroy(kt),i(kt)}),Be.on("error",function(kt){P.destroyed||i(Qm.from(kt,null,t,Jt))}),Be.on("end",function(){try{let kt=Gt.length===1?Gt[0]:Buffer.concat(Gt);u!=="arraybuffer"&&(kt=kt.toString(s),(!s||s==="utf8")&&(kt=Zf.stripBOM(kt))),vr.data=kt}catch(kt){return i(Qm.from(kt,null,t,vr.request,vr))}BUr(n,i,vr)})}C.once("abort",Gt=>{Be.destroyed||(Be.emit("error",Gt),Be.destroy())})}),C.once("abort",Ee=>{i(Ee),P.destroy(Ee)}),P.on("error",function(Ot){i(Qm.from(Ot,null,t,P))}),P.on("socket",function(Ot){Ot.setKeepAlive(!0,1e3*60)}),t.timeout){let Ee=parseInt(t.timeout,10);if(Number.isNaN(Ee)){i(new Qm("error trying to parse `config.timeout` to int",Qm.ERR_BAD_OPTION_VALUE,t,P));return}P.setTimeout(Ee,function(){if(m)return;let vt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",xe=t.transitional||aka;t.timeoutErrorMessage&&(vt=t.timeoutErrorMessage),i(new Qm(vt,xe.clarifyTimeoutError?Qm.ETIMEDOUT:Qm.ECONNABORTED,t,P)),T()})}if(Zf.isStream(o)){let Ee=!1,Ot=!1;o.on("end",()=>{Ee=!0}),o.once("error",vt=>{Ot=!0,P.destroy(vt)}),o.on("close",()=>{!Ee&&!Ot&&T(new Vrt("Request stream has been aborted",t,P))}),o.pipe(P)}else P.end(o)})};var _Ey=G7.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,G7.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(G7.origin),G7.navigator&&/(msie|trident)/i.test(G7.navigator.userAgent)):()=>!0;var hEy=G7.hasStandardBrowserEnv?{write(e,t,r,n,i,a){let o=[e+"="+encodeURIComponent(t)];Zf.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Zf.isString(n)&&o.push("path="+n),Zf.isString(i)&&o.push("domain="+i),a===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var yEy=e=>e instanceof g$?{...e}:e;function kTr(e,t){t=t||{};let r={};function n(u,s,l,m){return Zf.isPlainObject(u)&&Zf.isPlainObject(s)?Zf.merge.call({caseless:m},u,s):Zf.isPlainObject(s)?Zf.merge({},s):Zf.isArray(s)?s.slice():s}function i(u,s,l,m){if(Zf.isUndefined(s)){if(!Zf.isUndefined(u))return n(void 0,u,l,m)}else return n(u,s,l,m)}function a(u,s){if(!Zf.isUndefined(s))return n(void 0,s)}function o(u,s){if(Zf.isUndefined(s)){if(!Zf.isUndefined(u))return n(void 0,u)}else return n(void 0,s)}function c(u,s,l){if(l in t)return n(u,s);if(l in e)return n(void 0,u)}let f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,s,l)=>i(yEy(u),yEy(s),l,!0)};return Zf.forEach(Object.keys({...e,...t}),function(s){let l=f[s]||i,m=l(e[s],t[s],s);Zf.isUndefined(m)&&l!==c||(r[s]=m)}),r}var LDu=e=>{let t=kTr({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=g$.from(o),t.url=Yua(Xua(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),Zf.isFormData(r)){if(G7.hasStandardBrowserEnv||G7.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Zf.isFunction(r.getHeaders)){let f=r.getHeaders(),u=["content-type","content-length"];Object.entries(f).forEach(([s,l])=>{u.includes(s.toLowerCase())&&o.set(s,l)})}}if(G7.hasStandardBrowserEnv&&(n&&Zf.isFunction(n)&&(n=n(t)),n||n!==!1&&_Ey(t.url))){let f=i&&a&&hEy.read(a);f&&o.set(i,f)}return t};var QRC=typeof XMLHttpRequest<"u",vEy=QRC&&function(e){return new Promise(function(r,n){let i=LDu(e),a=i.data,o=g$.from(i.headers).normalize(),{responseType:c,onUploadProgress:f,onDownloadProgress:u}=i,s,l,m,O,P;function C(){O&&O(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let I=new XMLHttpRequest;I.open(i.method.toUpperCase(),i.url,!0),I.timeout=i.timeout;function T(){if(!I)return;let U=g$.from("getAllResponseHeaders"in I&&I.getAllResponseHeaders()),V={data:!c||c==="text"||c==="json"?I.responseText:I.response,status:I.status,statusText:I.statusText,headers:U,config:e,request:I};BUr(function(re){r(re),C()},function(re){n(re),C()},V),I=null}"onloadend"in I?I.onloadend=T:I.onreadystatechange=function(){!I||I.readyState!==4||I.status===0&&!(I.responseURL&&I.responseURL.indexOf("file:")===0)||setTimeout(T)},I.onabort=function(){I&&(n(new Qm("Request aborted",Qm.ECONNABORTED,e,I)),I=null)},I.onerror=function(q){let V=q&&q.message?q.message:"Network Error",$=new Qm(V,Qm.ERR_NETWORK,e,I);$.event=q||null,n($),I=null},I.ontimeout=function(){let q=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",V=i.transitional||aka;i.timeoutErrorMessage&&(q=i.timeoutErrorMessage),n(new Qm(q,V.clarifyTimeoutError?Qm.ETIMEDOUT:Qm.ECONNABORTED,e,I)),I=null},a===void 0&&o.setContentType(null),"setRequestHeader"in I&&Zf.forEach(o.toJSON(),function(q,V){I.setRequestHeader(V,q)}),Zf.isUndefined(i.withCredentials)||(I.withCredentials=!!i.withCredentials),c&&c!=="json"&&(I.responseType=i.responseType),u&&([m,P]=LAi(u,!0),I.addEventListener("progress",m)),f&&I.upload&&([l,O]=LAi(f),I.upload.addEventListener("progress",l),I.upload.addEventListener("loadend",O)),(i.cancelToken||i.signal)&&(s=U=>{I&&(n(!U||U.type?new Vrt(null,e,I):U),I.abort(),I=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));let z=Q$o(i.url);if(z&&G7.protocols.indexOf(z)===-1){n(new Qm("Unsupported protocol "+z+":",Qm.ERR_BAD_REQUEST,e));return}I.send(a||null)})};var LRC=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,a=function(u){if(!i){i=!0,c();let s=u instanceof Error?u:this.reason;n.abort(s instanceof Qm?s:new Vrt(s instanceof Error?s.message:s))}},o=t&&setTimeout(()=>{o=null,a(new Qm(`timeout ${t} of ms exceeded`,Qm.ETIMEDOUT))},t),c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(a):u.removeEventListener("abort",a)}),e=null)};e.forEach(u=>u.addEventListener("abort",a));let{signal:f}=n;return f.unsubscribe=()=>Zf.asap(c),f}},bEy=LRC;var URC=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},VRC=async function*(e,t){for await(let r of WRC(e))yield*URC(r,t)},WRC=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},uPf=(e,t,r,n)=>{let i=VRC(e,t),a=0,o,c=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{let{done:u,value:s}=await i.next();if(u){c(),f.close();return}let l=s.byteLength;if(r){let m=a+=l;r(m)}f.enqueue(new Uint8Array(s))}catch(u){throw c(u),u}},cancel(f){return c(f),i.return()}},{highWaterMark:2})};var gEy=64*1024,{isFunction:UDu}=Zf,GRC=(({Request:e,Response:t})=>({Request:e,Response:t}))(Zf.global),{ReadableStream:mEy,TextEncoder:OEy}=Zf.global,AEy=(e,...t)=>{try{return!!e(...t)}catch{return!1}},HRC=e=>{e=Zf.merge.call({skipUndefined:!0},GRC,e);let{fetch:t,Request:r,Response:n}=e,i=t?UDu(t):typeof fetch=="function",a=UDu(r),o=UDu(n);if(!i)return!1;let c=i&&UDu(mEy),f=i&&(typeof OEy=="function"?(P=>C=>P.encode(C))(new OEy):async P=>new Uint8Array(await new r(P).arrayBuffer())),u=a&&c&&AEy(()=>{let P=!1,C=new r(G7.origin,{body:new mEy,method:"POST",get duplex(){return P=!0,"half"}}).headers.has("Content-Type");return P&&!C}),s=o&&c&&AEy(()=>Zf.isReadableStream(new n("").body)),l={stream:s&&(P=>P.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(P=>{!l[P]&&(l[P]=(C,I)=>{let T=C&&C[P];if(T)return T.call(C);throw new Qm(`Response type '${P}' is not supported`,Qm.ERR_NOT_SUPPORT,I)})});let m=async P=>{if(P==null)return 0;if(Zf.isBlob(P))return P.size;if(Zf.isSpecCompliantForm(P))return(await new r(G7.origin,{method:"POST",body:P}).arrayBuffer()).byteLength;if(Zf.isArrayBufferView(P)||Zf.isArrayBuffer(P))return P.byteLength;if(Zf.isURLSearchParams(P)&&(P=P+""),Zf.isString(P))return(await f(P)).byteLength},O=async(P,C)=>{let I=Zf.toFiniteNumber(P.getContentLength());return I??m(C)};return async P=>{let{url:C,method:I,data:T,signal:z,cancelToken:U,timeout:q,onDownloadProgress:V,onUploadProgress:$,responseType:re,headers:Y,withCredentials:k="same-origin",fetchOptions:ne}=LDu(P),me=t||fetch;re=re?(re+"").toLowerCase():"text";let _e=bEy([z,U&&U.toAbortSignal()],q),ve=null,pe=_e&&_e.unsubscribe&&(()=>{_e.unsubscribe()}),De;try{if($&&u&&I!=="get"&&I!=="head"&&(De=await O(Y,T))!==0){let Be=new r(C,{method:"POST",body:T,duplex:"half"}),Jt;if(Zf.isFormData(T)&&(Jt=Be.headers.get("content-type"))&&Y.setContentType(Jt),Be.body){let[pt,vr]=uka(De,LAi(cka($)));T=uPf(Be.body,gEy,pt,vr)}}Zf.isString(k)||(k=k?"include":"omit");let Ce=a&&"credentials"in r.prototype,Ee={...ne,signal:_e,method:I.toUpperCase(),headers:Y.normalize().toJSON(),body:T,duplex:"half",credentials:Ce?k:void 0};ve=a&&new r(C,Ee);let Ot=await(a?me(ve,ne):me(C,Ee)),vt=s&&(re==="stream"||re==="response");if(s&&(V||vt&&pe)){let Be={};["status","statusText","headers"].forEach(Gt=>{Be[Gt]=Ot[Gt]});let Jt=Zf.toFiniteNumber(Ot.headers.get("content-length")),[pt,vr]=V&&uka(Jt,LAi(cka(V),!0))||[];Ot=new n(uPf(Ot.body,gEy,pt,()=>{vr&&vr(),pe&&pe()}),Be)}re=re||"text";let xe=await l[Zf.findKey(l,re)||"text"](Ot,P);return!vt&&pe&&pe(),await new Promise((Be,Jt)=>{BUr(Be,Jt,{data:xe,headers:g$.from(Ot.headers),status:Ot.status,statusText:Ot.statusText,config:P,request:ve})})}catch(Ce){throw pe&&pe(),Ce&&Ce.name==="TypeError"&&/Load failed|fetch/i.test(Ce.message)?Object.assign(new Qm("Network Error",Qm.ERR_NETWORK,P,ve),{cause:Ce.cause||Ce}):Qm.from(Ce,Ce&&Ce.code,P,ve)}}},JRC=new Map,cPf=e=>{let t=e?e.env:{},{fetch:r,Request:n,Response:i}=t,a=[n,i,r],o=a.length,c=o,f,u,s=JRC;for(;c--;)f=a[c],u=s.get(f),u===void 0&&s.set(f,u=c?new Map:HRC(t)),s=u;return u},PyU=cPf();var lPf={http:pEy,xhr:vEy,fetch:{get:cPf}};Zf.forEach(lPf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var PEy=e=>`- ${e}`,$RC=e=>Zf.isFunction(e)||e===null||e===!1,VDu={getAdapter:(e,t)=>{e=Zf.isArray(e)?e:[e];let{length:r}=e,n,i,a={};for(let o=0;o<r;o++){n=e[o];let c;if(i=n,!$RC(n)&&(i=lPf[(c=String(n)).toLowerCase()],i===void 0))throw new Qm(`Unknown adapter '${c}'`);if(i&&(Zf.isFunction(i)||(i=i.get(t))))break;a[c||"#"+o]=i}if(!i){let o=Object.entries(a).map(([f,u])=>`adapter ${f} `+(u===!1?"is not supported by the environment":"is not available in the build")),c=r?o.length>1?`since :
@@ -2671,7 +2671,7 @@ ${q}${z}${V}${Uro}`});function sxu({message:e,error:t,logger:r,logLevel:n=uE.Err
2671
2671
  Run ${Mf.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
2672
2672
  Run ${Mf.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),fka(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function yFf({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!NHy(e))return;let i=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let o=a.sort((c,f)=>c.generatorName.localeCompare(f.generatorName)||c.currentVersion.localeCompare(f.currentVersion));for(let c of o)i+=`
2673
2673
  ${await pyI(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+Mf.dim(c.currentVersion)+Mf.reset(" \u2192 ")+Mf.green(c.latestVersion);return i+=`
2674
- `,n?fka(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function pyI(e){let r=await new RHy.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 _yI({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await xHy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,u,s,l)=>{c.versions[u]==null&&(c.versions[u]={});let m=v3i(s.name,l),O=await mTr({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:l});O!=null&&(c.versions[u][s.name]={previousVersion:s.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await xHy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,u,s)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=v3i(u.name,s),m=await mTr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:s});m!=null&&(o.versions[c][f][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function xHy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await MTr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(i!=null&&f.groupName!==i))for(let u of f.generators)n!=null&&u.name!==n||await r(a.workspaceName,f.groupName,u,o)}})}))}function zHy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let f=Ixe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function fxu({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await _yI({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[f,u]of Object.entries(c.versions))o.push(...zHy(u,f,t.logger));else o.push(...zHy(c.versions,void 0,t.logger))}return o}var Eko=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${i} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var Hro=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var vFf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),QHy=typeof globalThis.AbortController=="function",LHy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",UHy=typeof globalThis.ReadableStream=="function",VHy=typeof globalThis.FormData=="function",dxu=["get","post","put","patch","head","delete"],hyI=()=>{};hyI();var WHy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},pxu=2147483647,GHy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,_xu=Symbol("stop"),HHy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},JHy={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 yyI=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=GHy,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},KHy=(e,t,r)=>{let n,i=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),n){i+=n.byteLength;let c=t===0?0:i/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,i),transferredBytes:i},n)}n=a},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},n))}}))},$Hy=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(KHy(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},YHy=(e,t,r)=>{if(!e.body)return e;let n=yyI(r??e.body);return new Request(e,{duplex:"half",body:KHy(e.body,n,t)})};var Jro=e=>e!==null&&typeof e=="object";var Sko=(...e)=>{for(let t of e)if((!Jro(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return mFf({},...e)},bFf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,o]of i.entries())n&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function hxu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:mFf(e[r]??[],t[r]??[])}var gFf=(e={},t={})=>({beforeRequest:hxu(e,t,"beforeRequest"),beforeRetry:hxu(e,t,"beforeRetry"),afterResponse:hxu(e,t,"afterResponse"),beforeError:hxu(e,t,"beforeError")}),mFf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(Jro(i)){for(let[a,o]of Object.entries(i))Jro(o)&&a in t&&(o=mFf(t[a],o)),t={...t,[a]:o};Jro(i.hooks)&&(n=gFf(n,i.hooks),t.hooks=n),Jro(i.headers)&&(r=bFf(r,i.headers),t.headers=r)}return t};var ZHy=e=>dxu.includes(e)?e.toUpperCase():e,vyI=["get","put","head","delete","options","trace"],byI=[408,413,429,500,502,503,504],gyI=[413,429,503],XHy={limit:2,methods:vyI,statusCodes:byI,afterStatusCodes:gyI,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},kHy=(e={})=>{if(typeof e=="number")return{...XHy,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{...XHy,...e}};async function OFf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new Hro(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function AFf(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var eJy=(e,t)=>{let r={};for(let n in t)!(n in JHy)&&!(n in HHy)&&!(n in e)&&(r[n]=t[n]);return r},tJy=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;var Dko=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>pxu)throw new RangeError(`The \`timeout\` option cannot be greater than ${pxu}`);await Promise.resolve();let c=await n._fetch();for(let f of n._options.hooks.afterResponse){let u=await f(n.request,n._options,n._decorateResponse(c.clone()));u instanceof globalThis.Response&&(c=u)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let f=new Eko(c,n.request,n._options);for(let u of n._options.hooks.beforeError)f=await u(f);throw f}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!UHy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return $Hy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{let c=n._originalRequest,f=[];c&&!c.bodyUsed&&f.push(c.body?.cancel()),n.request.bodyUsed||f.push(n.request.body?.cancel()),await Promise.all(f)});for(let[c,f]of Object.entries(WHy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||f);let u=await o;if(c==="json"){if(u.status===204)return"";let s=await u.text();return s===""?"":r.parseJson?r.parseJson(s):JSON.parse(s)}return u[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:bFf(this._input.headers,r.headers),hooks:gFf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:ZHy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:kHy(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(QHy&&LHy){let n=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=n?AbortSignal.any([n,this.abortController.signal]):this.abortController.signal}if(vFf&&(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),tJy(this._options.searchParams)){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(VHy&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!vFf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=YHy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof Hro)throw t;if(t instanceof Eko){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let n=Math.min(this._calculateRetryDelay(r),pxu);if(this._retryCount<1)throw r;await AFf(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===_xu)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=eJy(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):OFf(this._originalRequest,t,this.abortController,this._options)}};var PFf=e=>{let t=(r,n)=>Dko.create(r,Sko(e,n));for(let r of dxu)t[r]=(n,i)=>Dko.create(n,Sko(e,i,{method:r}));return t.create=r=>PFf(Sko(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),PFf(Sko(e,r))),t.stop=_xu,t},myI=PFf(),rJy=myI;var jJy=$i(wJy(),1);function DFf(e){let t=(0,jJy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var gKy=$i(bKy(),1),mKy=$i(Oqu(),1),LFf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},UFf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function VFf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??DFf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,gKy.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let u;try{u=await rJy(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new LFf(e):l}if(t.allVersions)return u;let s=new UFf(e,r);if(u["dist-tags"][r]){let{time:l}=u;u=u.versions[u["dist-tags"][r]],u.time=l}else if(r){let l=!!u.versions[r];if(n&&!l)for(let[O,P]of Object.entries(u.versions))P.deprecated&&delete u.versions[O];if(!l){let O=Object.keys(u.versions);if(r=mKy.default.maxSatisfying(O,r),!r)throw s}let{time:m}=u;if(u=u.versions[r],u.time=m,!u)throw s}return u}async function ufa(e,t){let{version:r}=await VFf(e.toLowerCase(),t);return r}async function t7i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:ufa(e.packageName,{version:t?"prerelease":"latest"})}var OKy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Sxu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=uE.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new lxu(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(i==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.113.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Mf.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new wne}failWithoutThrowing(t,r){this.didSucceed=!1,sxu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await tka()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await FHy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
2674
+ `,n?fka(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function pyI(e){let r=await new RHy.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 _yI({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await xHy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,u,s,l)=>{c.versions[u]==null&&(c.versions[u]={});let m=v3i(s.name,l),O=await mTr({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:l});O!=null&&(c.versions[u][s.name]={previousVersion:s.version,latestVersion:O})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await xHy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,u,s)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=v3i(u.name,s),m=await mTr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:s});m!=null&&(o.versions[c][f][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function xHy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await MTr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(i!=null&&f.groupName!==i))for(let u of f.generators)n!=null&&u.name!==n||await r(a.workspaceName,f.groupName,u,o)}})}))}function zHy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let f=Ixe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function fxu({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await _yI({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[f,u]of Object.entries(c.versions))o.push(...zHy(u,f,t.logger));else o.push(...zHy(c.versions,void 0,t.logger))}return o}var Eko=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText??"",o=`${i} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var Hro=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var vFf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),QHy=typeof globalThis.AbortController=="function",LHy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",UHy=typeof globalThis.ReadableStream=="function",VHy=typeof globalThis.FormData=="function",dxu=["get","post","put","patch","head","delete"],hyI=()=>{};hyI();var WHy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},pxu=2147483647,GHy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,_xu=Symbol("stop"),HHy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},JHy={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 yyI=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=GHy,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},KHy=(e,t,r)=>{let n,i=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),n){i+=n.byteLength;let c=t===0?0:i/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,i),transferredBytes:i},n)}n=a},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},n))}}))},$Hy=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(KHy(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},YHy=(e,t,r)=>{if(!e.body)return e;let n=yyI(r??e.body);return new Request(e,{duplex:"half",body:KHy(e.body,n,t)})};var Jro=e=>e!==null&&typeof e=="object";var Sko=(...e)=>{for(let t of e)if((!Jro(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return mFf({},...e)},bFf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,o]of i.entries())n&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function hxu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:mFf(e[r]??[],t[r]??[])}var gFf=(e={},t={})=>({beforeRequest:hxu(e,t,"beforeRequest"),beforeRetry:hxu(e,t,"beforeRetry"),afterResponse:hxu(e,t,"afterResponse"),beforeError:hxu(e,t,"beforeError")}),mFf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(Jro(i)){for(let[a,o]of Object.entries(i))Jro(o)&&a in t&&(o=mFf(t[a],o)),t={...t,[a]:o};Jro(i.hooks)&&(n=gFf(n,i.hooks),t.hooks=n),Jro(i.headers)&&(r=bFf(r,i.headers),t.headers=r)}return t};var ZHy=e=>dxu.includes(e)?e.toUpperCase():e,vyI=["get","put","head","delete","options","trace"],byI=[408,413,429,500,502,503,504],gyI=[413,429,503],XHy={limit:2,methods:vyI,statusCodes:byI,afterStatusCodes:gyI,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},kHy=(e={})=>{if(typeof e=="number")return{...XHy,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{...XHy,...e}};async function OFf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new Hro(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function AFf(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var eJy=(e,t)=>{let r={};for(let n in t)!(n in JHy)&&!(n in HHy)&&!(n in e)&&(r[n]=t[n]);return r},tJy=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;var Dko=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>pxu)throw new RangeError(`The \`timeout\` option cannot be greater than ${pxu}`);await Promise.resolve();let c=await n._fetch();for(let f of n._options.hooks.afterResponse){let u=await f(n.request,n._options,n._decorateResponse(c.clone()));u instanceof globalThis.Response&&(c=u)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let f=new Eko(c,n.request,n._options);for(let u of n._options.hooks.beforeError)f=await u(f);throw f}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!UHy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return $Hy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{let c=n._originalRequest,f=[];c&&!c.bodyUsed&&f.push(c.body?.cancel()),n.request.bodyUsed||f.push(n.request.body?.cancel()),await Promise.all(f)});for(let[c,f]of Object.entries(WHy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||f);let u=await o;if(c==="json"){if(u.status===204)return"";let s=await u.text();return s===""?"":r.parseJson?r.parseJson(s):JSON.parse(s)}return u[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:bFf(this._input.headers,r.headers),hooks:gFf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:ZHy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:kHy(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(QHy&&LHy){let n=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=n?AbortSignal.any([n,this.abortController.signal]):this.abortController.signal}if(vFf&&(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),tJy(this._options.searchParams)){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(VHy&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!vFf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=YHy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof Hro)throw t;if(t instanceof Eko){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let n=Math.min(this._calculateRetryDelay(r),pxu);if(this._retryCount<1)throw r;await AFf(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===_xu)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=eJy(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):OFf(this._originalRequest,t,this.abortController,this._options)}};var PFf=e=>{let t=(r,n)=>Dko.create(r,Sko(e,n));for(let r of dxu)t[r]=(n,i)=>Dko.create(n,Sko(e,i,{method:r}));return t.create=r=>PFf(Sko(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),PFf(Sko(e,r))),t.stop=_xu,t},myI=PFf(),rJy=myI;var jJy=$i(wJy(),1);function DFf(e){let t=(0,jJy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var gKy=$i(bKy(),1),mKy=$i(Oqu(),1),LFf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},UFf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function VFf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??DFf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,gKy.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,c&&(f.authorization=`${c.type} ${c.token}`);let u;try{u=await rJy(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new LFf(e):l}if(t.allVersions)return u;let s=new UFf(e,r);if(u["dist-tags"][r]){let{time:l}=u;u=u.versions[u["dist-tags"][r]],u.time=l}else if(r){let l=!!u.versions[r];if(n&&!l)for(let[O,P]of Object.entries(u.versions))P.deprecated&&delete u.versions[O];if(!l){let O=Object.keys(u.versions);if(r=mKy.default.maxSatisfying(O,r),!r)throw s}let{time:m}=u;if(u=u.versions[r],u.time=m,!u)throw s}return u}async function ufa(e,t){let{version:r}=await VFf(e.toLowerCase(),t);return r}async function t7i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:ufa(e.packageName,{version:t?"prerelease":"latest"})}var OKy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Sxu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=uE.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new lxu(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(i==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.113.1"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Mf.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new wne}failWithoutThrowing(t,r){this.didSucceed=!1,sxu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await tka()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await FHy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
2675
2675
  `)||(r+=`
2676
2676
  `),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=MKl(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new mko(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(a){throw a.message.includes("globalThis")?(n.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),n.failWithoutThrowing()):n.failWithoutThrowing(void 0,a),new wne}finally{n.finish()}return i}async instrumentPostHogEvent(t){this.isLocal||(await tka()).sendEvent(t)}logger=J2r((t,...r)=>this.log(t,...r));stderr=J2r((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=AKy(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?AKy(this.longestWorkspaceName):r).length,i=r.padEnd(n),a=OKy[this.numTasks++%OKy.length],o=Mf.hex(a)(i);return{...this.constructTaskInit(),logPrefix:o}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===yV.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let n=t.filter(i=>Nxi.indexOf(i.level)>=Nxi.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===uE.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 t7i({cliEnvironment:this.environment,includePreReleases:t}),n=Ixe(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},a=await fxu({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){try{return await aFf({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r,theme:{prefix:Mf.yellow("?"),style:{answer:i=>Mf.cyan(i),message:i=>Mf.bold(i),highlight:i=>Mf.cyan(i)}}})}catch(n){throw n?.name==="ExitPromptError"?(this.logger.info(`
2677
2677
  Cancelled by user.`),new wne):n}}async getInput(t){return await tFf({message:t.message,default:t.default})}};function AKy(e){return`[${e}]:`}var Aqr=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:n,absoluteFilePath:i,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=n,this.absoluteFilePath=i,this.changelog=a}};function Dxu(e,t,r,n){if(typeof r!="function")throw new Error("method for before hook must be a function");return n||(n={}),Array.isArray(t)?t.reverse().reduce((i,a)=>Dxu.bind(null,e,a,i,n),r)():Promise.resolve().then(()=>e.registry[t]?e.registry[t].reduce((i,a)=>a.hook.bind(null,i,n),r)():r(n))}function PKy(e,t,r,n){let i=n;e.registry[r]||(e.registry[r]=[]),t==="before"&&(n=(a,o)=>Promise.resolve().then(i.bind(null,o)).then(a.bind(null,o))),t==="after"&&(n=(a,o)=>{let c;return Promise.resolve().then(a.bind(null,o)).then(f=>(c=f,i(c,o))).then(()=>c)}),t==="error"&&(n=(a,o)=>Promise.resolve().then(a.bind(null,o)).catch(c=>i(c,o))),e.registry[r].push({hook:n,orig:i})}function wKy(e,t,r){if(!e.registry[t])return;let n=e.registry[t].map(i=>i.orig).indexOf(r);n!==-1&&e.registry[t].splice(n,1)}var jKy=Function.bind,EKy=jKy.bind(jKy);function SKy(e,t,r){let n=EKy(wKy,null).apply(null,r?[t,r]:[t]);e.api={remove:n},e.remove=n,["before","error","after","wrap"].forEach(i=>{let a=r?[t,i,r]:[t,i];e[i]=e.api[i]=EKy(PKy,null).apply(null,a)})}function EvI(){let e=Symbol("Singular"),t={registry:{}},r=Dxu.bind(null,t,e);return SKy(r,t,e),r}function SvI(){let e={registry:{}},t=Dxu.bind(null,e);return SKy(t,e),t}var DKy={Singular:EvI,Collection:SvI};var DvI="0.0.0-development",CvI=`octokit-endpoint.js/${DvI} ${Ffe()}`,IvI={method:"GET",baseUrl:"https://api.github.com",headers:{accept:"application/vnd.github.v3+json","user-agent":CvI},mediaType:{format:""}};function MvI(e){return e?Object.keys(e).reduce((t,r)=>(t[r.toLowerCase()]=e[r],t),{}):{}}function BvI(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}function MKy(e,t){let r=Object.assign({},e);return Object.keys(t).forEach(n=>{BvI(t[n])?n in e?r[n]=MKy(e[n],t[n]):Object.assign(r,{[n]:t[n]}):Object.assign(r,{[n]:t[n]})}),r}function CKy(e){for(let t in e)e[t]===void 0&&delete e[t];return e}function GFf(e,t,r){if(typeof t=="string"){let[i,a]=t.split(" ");r=Object.assign(a?{method:i,url:a}:{url:i},r)}else r=Object.assign({},t);r.headers=MvI(r.headers),CKy(r),CKy(r.headers);let n=MKy(e||{},r);return r.url==="/graphql"&&(e&&e.mediaType.previews?.length&&(n.mediaType.previews=e.mediaType.previews.filter(i=>!n.mediaType.previews.includes(i)).concat(n.mediaType.previews)),n.mediaType.previews=(n.mediaType.previews||[]).map(i=>i.replace(/-preview/,""))),n}function TvI(e,t){let r=/\?/.test(e)?"&":"?",n=Object.keys(t);return n.length===0?e:e+r+n.map(i=>i==="q"?"q="+t.q.split("+").map(encodeURIComponent).join("+"):`${i}=${encodeURIComponent(t[i])}`).join("&")}var qvI=/\{[^{}}]+\}/g;function RvI(e){return e.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g,"").split(/,/)}function NvI(e){let t=e.match(qvI);return t?t.map(RvI).reduce((r,n)=>r.concat(n),[]):[]}function IKy(e,t){let r={__proto__:null};for(let n of Object.keys(e))t.indexOf(n)===-1&&(r[n]=e[n]);return r}function BKy(e){return e.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]")),t}).join("")}function tno(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function qko(e,t,r){return t=e==="+"||e==="#"?BKy(t):tno(t),r?tno(r)+"="+t:t}function eno(e){return e!=null}function WFf(e){return e===";"||e==="&"||e==="?"}function FvI(e,t,r,n){var i=e[r],a=[];if(eno(i)&&i!=="")if(typeof i=="string"||typeof i=="number"||typeof i=="boolean")i=i.toString(),n&&n!=="*"&&(i=i.substring(0,parseInt(n,10))),a.push(qko(t,i,WFf(t)?r:""));else if(n==="*")Array.isArray(i)?i.filter(eno).forEach(function(o){a.push(qko(t,o,WFf(t)?r:""))}):Object.keys(i).forEach(function(o){eno(i[o])&&a.push(qko(t,i[o],o))});else{let o=[];Array.isArray(i)?i.filter(eno).forEach(function(c){o.push(qko(t,c))}):Object.keys(i).forEach(function(c){eno(i[c])&&(o.push(tno(c)),o.push(qko(t,i[c].toString())))}),WFf(t)?a.push(tno(r)+"="+o.join(",")):o.length!==0&&a.push(o.join(","))}else t===";"?eno(i)&&a.push(tno(r)):i===""&&(t==="&"||t==="?")?a.push(tno(r)+"="):i===""&&a.push("");return a}function xvI(e){return{expand:zvI.bind(null,e)}}function zvI(e,t){var r=["+","#",".","/",";","?","&"];return e=e.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(n,i,a){if(i){let c="",f=[];if(r.indexOf(i.charAt(0))!==-1&&(c=i.charAt(0),i=i.substr(1)),i.split(/,/g).forEach(function(u){var s=/([^:\*]*)(?::(\d+)|(\*))?/.exec(u);f.push(FvI(t,c,s[1],s[2]||s[3]))}),c&&c!=="+"){var o=",";return c==="?"?o="&":c!=="#"&&(o=c),(f.length!==0?c:"")+f.join(o)}else return f.join(",")}else return BKy(a)}),e==="/"?e:e.replace(/\/$/,"")}function TKy(e){let t=e.method.toUpperCase(),r=(e.url||"/").replace(/:([a-z]\w+)/g,"{$1}"),n=Object.assign({},e.headers),i,a=IKy(e,["method","baseUrl","url","headers","request","mediaType"]),o=NvI(r);r=xvI(r).expand(a),/^http/.test(r)||(r=e.baseUrl+r);let c=Object.keys(e).filter(s=>o.includes(s)).concat("baseUrl"),f=IKy(a,c);if(!/application\/octet-stream/i.test(n.accept)&&(e.mediaType.format&&(n.accept=n.accept.split(/,/).map(s=>s.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,`application/vnd$1$2.${e.mediaType.format}`)).join(",")),r.endsWith("/graphql")&&e.mediaType.previews?.length)){let s=n.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g)||[];n.accept=s.concat(e.mediaType.previews).map(l=>{let m=e.mediaType.format?`.${e.mediaType.format}`:"+json";return`application/vnd.github.${l}-preview${m}`}).join(",")}return["GET","HEAD"].includes(t)?r=TvI(r,f):"data"in f?i=f.data:Object.keys(f).length&&(i=f),!n["content-type"]&&typeof i<"u"&&(n["content-type"]="application/json; charset=utf-8"),["PATCH","PUT"].includes(t)&&typeof i>"u"&&(i=""),Object.assign({method:t,url:r,headers:n},typeof i<"u"?{body:i}:null,e.request?{request:e.request}:null)}function QvI(e,t,r){return TKy(GFf(e,t,r))}function qKy(e,t){let r=GFf(e,t),n=QvI.bind(null,r);return Object.assign(n,{DEFAULTS:r,defaults:qKy.bind(null,r),merge:GFf.bind(null,r),parse:TKy})}var RKy=qKy(null,IvI);var LKy=$i(zKy(),1);var Pqr=class extends Error{name;status;request;response;constructor(t,r,n){super(t),this.name="HttpError",this.status=Number.parseInt(r),Number.isNaN(this.status)&&(this.status=0),"response"in n&&(this.response=n.response);let i=Object.assign({},n.request);n.request.headers.authorization&&(i.headers=Object.assign({},n.request.headers,{authorization:n.request.headers.authorization.replace(/(?<! ) .*$/," [REDACTED]")})),i.url=i.url.replace(/\bclient_secret=\w+/g,"client_secret=[REDACTED]").replace(/\baccess_token=\w+/g,"access_token=[REDACTED]"),this.request=i}};var LvI="10.0.6",UvI={headers:{"user-agent":`octokit-request.js/${LvI} ${Ffe()}`}};function VvI(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);if(t===null)return!0;let r=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Function.prototype.call(r)===Function.prototype.call(e)}async function QKy(e){let t=e.request?.fetch||globalThis.fetch;if(!t)throw new Error("fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing");let r=e.request?.log||console,n=e.request?.parseSuccessResponseBody!==!1,i=VvI(e.body)||Array.isArray(e.body)?JSON.stringify(e.body):e.body,a=Object.fromEntries(Object.entries(e.headers).map(([l,m])=>[l,String(m)])),o;try{o=await t(e.url,{method:e.method,body:i,redirect:e.request?.redirect,headers:a,signal:e.request?.signal,...e.body&&{duplex:"half"}})}catch(l){let m="Unknown Error";if(l instanceof Error){if(l.name==="AbortError")throw l.status=500,l;m=l.message,l.name==="TypeError"&&"cause"in l&&(l.cause instanceof Error?m=l.cause.message:typeof l.cause=="string"&&(m=l.cause))}let O=new Pqr(m,500,{request:e});throw O.cause=l,O}let c=o.status,f=o.url,u={};for(let[l,m]of o.headers)u[l]=m;let s={url:f,status:c,headers:u,data:""};if("deprecation"in u){let l=u.link&&u.link.match(/<([^<>]+)>; rel="deprecation"/),m=l&&l.pop();r.warn(`[@octokit/request] "${e.method} ${e.url}" is deprecated. It is scheduled to be removed on ${u.sunset}${m?`. See ${m}`:""}`)}if(c===204||c===205)return s;if(e.method==="HEAD"){if(c<400)return s;throw new Pqr(o.statusText,c,{response:s,request:e})}if(c===304)throw s.data=await HFf(o),new Pqr("Not modified",c,{response:s,request:e});if(c>=400)throw s.data=await HFf(o),new Pqr(GvI(s.data),c,{response:s,request:e});return s.data=n?await HFf(o):o.body,s}async function HFf(e){let t=e.headers.get("content-type");if(!t)return e.text().catch(()=>"");let r=(0,LKy.safeParse)(t);if(WvI(r)){let n="";try{return n=await e.text(),JSON.parse(n)}catch{return n}}else return r.type.startsWith("text/")||r.parameters.charset?.toLowerCase()==="utf-8"?e.text().catch(()=>""):e.arrayBuffer().catch(()=>new ArrayBuffer(0))}function WvI(e){return e.type==="application/json"||e.type==="application/scim+json"}function GvI(e){if(typeof e=="string")return e;if(e instanceof ArrayBuffer)return"Unknown error";if("message"in e){let t="documentation_url"in e?` - ${e.documentation_url}`:"";return Array.isArray(e.errors)?`${e.message}: ${e.errors.map(r=>JSON.stringify(r)).join(", ")}${t}`:`${e.message}${t}`}return`Unknown error: ${JSON.stringify(e)}`}function JFf(e,t){let r=e.defaults(t);return Object.assign(function(i,a){let o=r.merge(i,a);if(!o.request||!o.request.hook)return QKy(r.parse(o));let c=(f,u)=>QKy(r.parse(r.merge(f,u)));return Object.assign(c,{endpoint:r,defaults:JFf.bind(null,r)}),o.request.hook(c,o)},{endpoint:r,defaults:JFf.bind(null,r)})}var V6=JFf(RKy,UvI);var HvI="0.0.0-development";function JvI(e){return`Request failed due to following response errors:
@@ -2726,7 +2726,7 @@ plugins:
2726
2726
  - enum_type=string
2727
2727
  - default_response=false
2728
2728
  - source_root=${e}
2729
- `}async function $ht({context:e,specs:t,relativePathToDependency:r}){let n=new HLu({context:e}),i=t.filter(f=>f.type==="openapi").map(f=>({...f,relativePathToDependency:r})),a=t.filter(f=>f.type==="protobuf"),c=(await Promise.all(a.map(async f=>{if(f.absoluteFilepathToProtobufTarget!=null){let m=await hbv({generator:n,protobufSpec:f,relativePathToDependency:r});return m?[m.openApiSpec]:[]}let u=await uve(f.absoluteFilepathToProtobufRoot,"proto"),s,l=[];for(let m of u){let O=await hbv({generator:n,protobufSpec:{...f,absoluteFilepathToProtobufTarget:m},relativePathToDependency:r,existingBufLockContents:s});O!=null&&(l.push(O.openApiSpec),O.bufLockContents!=null&&(s=O.bufLockContents))}return l}))).flat().filter(f=>hj(f));return[...i,...c]}async function hbv({generator:e,protobufSpec:t,relativePathToDependency:r,existingBufLockContents:n}){if(t.absoluteFilepathToProtobufTarget==null)return;let i=await e.generate({absoluteFilepathToProtobufRoot:t.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:t.absoluteFilepathToProtobufTarget,relativeFilepathToProtobufRoot:t.relativeFilepathToProtobufRoot,local:t.generateLocally,deps:t.dependencies,existingBufLockContents:n});return{bufLockContents:i.bufLockContents,openApiSpec:{type:"openapi",absoluteFilepath:i.absoluteFilepath,absoluteFilepathToOverrides:t.absoluteFilepathToOverrides,settings:t.settings,source:{type:"protobuf",relativePathToDependency:r,root:t.absoluteFilepathToProtobufRoot,file:t.absoluteFilepathToProtobufTarget}}}}var S$=class extends tes{type="oss";allSpecs;specs;sources;loader;constructor({allSpecs:t,specs:r,...n}){super({...n,respectReadonlySchemas:r.every(i=>i.settings?.respectReadonlySchemas),respectNullableSchemas:r.every(i=>i.settings?.respectNullableSchemas),wrapReferencesToNullableInOptional:r.every(i=>i.settings?.wrapReferencesToNullableInOptional),coerceOptionalSchemasToNullable:r.every(i=>i.settings?.coerceOptionalSchemasToNullable),onlyIncludeReferencedSchemas:r.every(i=>i.settings?.onlyIncludeReferencedSchemas),inlinePathParameters:r.every(i=>i.settings?.inlinePathParameters),objectQueryParameters:r.every(i=>i.settings?.objectQueryParameters),useBytesForBinaryResponse:r.filter(i=>i.type==="openapi"&&i.source.type==="openapi").some(i=>i.settings?.useBytesForBinaryResponse),respectForwardCompatibleEnums:r.filter(i=>i.type==="openapi"&&i.source.type==="openapi").some(i=>i.settings?.respectForwardCompatibleEnums),inlineAllOfSchemas:r.every(i=>i.settings?.inlineAllOfSchemas),resolveAliases:r.every(o=>o.settings?.resolveAliases)?{except:r.flatMap(o=>typeof o.settings?.resolveAliases=="object"?o.settings.resolveAliases.except??[]:[])}:!1,exampleGeneration:r[0]?.settings?.exampleGeneration,groupEnvironmentsByHost:r.some(i=>i.settings?.groupEnvironmentsByHost)}),this.specs=r,this.allSpecs=t,this.sources=this.convertSpecsToIdentifiableSources(r),this.loader=new Lqr(this.absoluteFilePath)}async getOpenAPIIr({context:t,relativePathToDependency:r},n){let i=await $ht({context:t,specs:this.specs,relativePathToDependency:r});return Afa({context:t,documents:await this.loader.loadDocuments({context:t,specs:i}),options:{...n,respectReadonlySchemas:n?.respectReadonlySchemas??this.respectReadonlySchemas,respectNullableSchemas:n?.respectNullableSchemas??this.respectNullableSchemas,wrapReferencesToNullableInOptional:n?.wrapReferencesToNullableInOptional??this.wrapReferencesToNullableInOptional,onlyIncludeReferencedSchemas:n?.onlyIncludeReferencedSchemas??this.onlyIncludeReferencedSchemas,inlinePathParameters:n?.inlinePathParameters??this.inlinePathParameters,objectQueryParameters:n?.objectQueryParameters??this.objectQueryParameters,exampleGeneration:n?.exampleGeneration??this.exampleGeneration,useBytesForBinaryResponse:n?.useBytesForBinaryResponse??this.useBytesForBinaryResponse,inlineAllOfSchemas:n?.inlineAllOfSchemas??this.inlineAllOfSchemas,resolveAliases:n?.resolveAliases??this.resolveAliases,groupMultiApiEnvironments:n?.groupMultiApiEnvironments??this.specs.some(a=>a.settings?.groupMultiApiEnvironments),groupEnvironmentsByHost:n?.groupEnvironmentsByHost??this.groupEnvironmentsByHost}})}async getIntermediateRepresentation({context:t,audiences:r,enableUniqueErrorsPerEndpoint:n,generateV1Examples:i}){let a=await $ht({context:t,specs:this.specs}),o=await this.loader.loadDocuments({context:t,specs:a}),c=this.generatorsConfiguration?.api?.auth!=null?{...this.generatorsConfiguration?.api}:void 0;c&&t.logger.trace("Using auth overrides from generators configuration");let f=this.generatorsConfiguration?.api?.environments!=null?{...this.generatorsConfiguration?.api}:void 0;f&&t.logger.trace("Using environment overrides from generators configuration");let u=this.generatorsConfiguration?.api?.headers!=null?{...this.generatorsConfiguration?.api}:void 0;u&&t.logger.trace("Using global header overrides from generators configuration");let s,l=[];for(let m of o){let O=Ql(this.absoluteFilePath,ru.of(m.source?.file??"")),P=nFe(hV(),O),C=new G6i({logger:t.logger,relativeFilepathToSpec:P});l.push(C);let I;switch(m.type){case"openapi":{let z=new Vrs({namespace:m.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:m.value,exampleGenerationArgs:{disabled:!1},errorCollector:C,authOverrides:c,environmentOverrides:f,globalHeaderOverrides:u,enableUniqueErrorsPerEndpoint:n,generateV1Examples:i,settings:hts({options:m.settings}),documentBaseDir:Tg(O)});I=await new Urs({context:z,audiences:r}).convert();break}case"asyncapi":{let z=new Qrs({namespace:m.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:m.value,exampleGenerationArgs:{disabled:!1},errorCollector:C,enableUniqueErrorsPerEndpoint:n,settings:hts({options:m.settings}),generateV1Examples:i});I=await new zrs({context:z,audiences:r}).convert();break}default:C.collect({message:`Unsupported document type: ${m}`,path:[]});break}let T=NLu({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});I!=null&&(s=s===void 0?I:qla(s,I,T))}for(let m of this.allSpecs)if(m.type==="openrpc"){let O=m.absoluteFilepath,P=nFe(hV(),O),C=new G6i({logger:t.logger,relativeFilepathToSpec:P});l.push(C);let I=new Grs({namespace:m.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:await ELf({context:t,absoluteFilePath:m.absoluteFilepath,absoluteFilePathToOverrides:m.absoluteFilepathToOverrides}),exampleGenerationArgs:{disabled:!1},errorCollector:C,enableUniqueErrorsPerEndpoint:n,generateV1Examples:i,settings:hts()}),z=await new Wrs({context:I,audiences:r}).convert(),U=NLu({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});z!=null&&(s=s===void 0?z:qla(s,z,U))}else if(m.type==="protobuf")try{let P=await new GLu({context:t}).generate({absoluteFilepathToProtobufRoot:m.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:m.absoluteFilepathToProtobufTarget,local:!0,deps:m.dependencies}),C=await(0,ybv.readFile)(P,"utf-8"),I=NLu({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});if(C!=null){let T;try{if(T=V0.IntermediateRepresentation.parse(JSON.parse(C),{allowUnrecognizedEnumValues:!0,skipValidation:!0}),T.ok)s=s===void 0?T.value:qla(s,T.value,I);else throw new Error}catch{t.logger.log("error","Failed to parse protobuf IR: ")}}}catch(O){t.logger.log("warn","Failed to parse protobuf IR: "+O)}for(let m of l)if(m.hasErrors()){let O=m.getErrorStats(),P=m.relativeFilepathToSpec?` for ${m.relativeFilepathToSpec}`:"";O.numErrors>0?t.logger.log("error",`API validation${P} completed with ${O.numErrors} errors and ${O.numWarnings} warnings.`):O.numWarnings>0?t.logger.log("warn",`API validation${P} completed with ${O.numWarnings} warnings.`):t.logger.log("info",`All checks passed when parsing OpenAPI${P}.`),t.logger.log("info",""),await m.logErrors({logWarnings:!1})}if(s===void 0)throw new Error("Failed to generate intermediate representation");return s}async toFernWorkspace({context:t},r){let n=await this.getDefinition({context:t},r);return new ynt({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion,sources:this.sources})}getAbsoluteFilePaths(){return[this.absoluteFilePath,...this.allSpecs.flatMap(t=>[t.type==="protobuf"?t.absoluteFilepathToProtobufTarget:t.absoluteFilepath,t.absoluteFilepathToOverrides]).filter(hj)]}getSources(){return this.sources}convertSpecsToIdentifiableSources(t){let r=new Set,n=[];return t.reduce((i,a)=>{let o=a.type==="protobuf"?a.absoluteFilepathToProtobufRoot:a.absoluteFilepath;return r.has(o)||(r.add(o),i.push({type:a.type,id:Urt(),absoluteFilePath:o})),i},n)}};function yKI(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function WLf(e,t){for(let[r,n]of Vk(e.failures))vKI({relativeFilepath:r,failure:n,logger:t})}function vKI({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case xT.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case xT.FILE_READ:r.error("Failed to open file: "+e);break;case xT.FILE_MISSING:r.error("Missing file: "+e);break;case xT.FILE_PARSE:t.error instanceof PUo?r.error(zht({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case xT.STRUCTURE_VALIDATION:for(let n of t.error.issues)for(let{title:i,subtitle:a}of bKI(n))r.error(zht({title:i,subtitle:a,breadcrumbs:[e,...n.path]}));break;case xT.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case xT.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${dru}: `+t.dependencyName);break;case xT.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case xT.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case xT.JSONSCHEMA_VALIDATION:if(t.error.error!=null){let n=t.error.error.instancePath.split("/").filter(i=>i!=="").map(yKI);t.error.error.keyword==="required"&&t.error.error.params?.missingProperty?n.push(t.error.error.params.missingProperty):t.error.error.keyword==="additionalProperties"&&t.error.error.params?.additionalProperty&&n.push(t.error.error.params.additionalProperty),r.error(zht({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...n]}))}break;default:ku(t)}}function bKI(e){switch(e.code){case Ry.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Mf.underline(e.expected)} but received ${Mf.underline(e.received)}`}];case Ry.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Mf.underline(t)}`}));case Ry.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Mf.underline(t)).join(", ")}`}];case Ry.invalid_union:case Ry.invalid_arguments:case Ry.invalid_return_type:case Ry.invalid_date:case Ry.invalid_string:case Ry.too_small:case Ry.too_big:case Ry.invalid_intersection_types:case Ry.not_multiple_of:case Ry.custom:default:return[{title:e.message}]}}var vbv=require("fs/promises");async function bbv(e,t){let r=[];for(let n of await uve(e,t))r.push(await gKI({relativeFilepath:P3(e,n),absoluteFilepath:n}));return r}async function gKI({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,vbv.readFile)(t)).toString()}}async function gbv({absolutePathToWorkspace:e}){let t=Ql(e,ru.of($lh));if(!await Vv(t))return;let n=await bbv(t,"{md,mdx}");return{files:await Promise.all(n.map(i=>({absoluteFilepath:i.absoluteFilepath,contents:i.fileContents})))}}async function GLf({absolutePathToWorkspace:e,namespace:t,definitions:r}){let n=[];for(let i of r){let a=i.overrides!=null?Ql(e,ru.of(i.overrides)):void 0;if(i.schema.type==="protobuf"){let c=ru.of(i.schema.root),f=Ql(e,c);if(!await Vv(f))return{didSucceed:!1,failures:{[ru.of(i.schema.root)]:{type:xT.FILE_MISSING}}};let u=i.schema.target.length===0?void 0:Ql(e,ru.of(i.schema.target));if(u!=null&&!await Vv(u))return{didSucceed:!1,failures:{[ru.of(i.schema.target)]:{type:xT.FILE_MISSING}}};n.push({type:"protobuf",absoluteFilepathToProtobufRoot:f,absoluteFilepathToProtobufTarget:u,absoluteFilepathToOverrides:a,relativeFilepathToProtobufRoot:c,dependencies:i.schema.dependencies,generateLocally:i.schema.localGeneration,fromOpenAPI:i.schema.fromOpenAPI,settings:{audiences:i.audiences??[],useTitlesAsName:i.settings?.shouldUseTitleAsName??!0,shouldUseUndiscriminatedUnionsWithLiterals:i.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,shouldUseIdiomaticRequestNames:i.settings?.shouldUseIdiomaticRequestNames??!1,optionalAdditionalProperties:i.settings?.shouldUseOptionalAdditionalProperties??!0,coerceEnumsToLiterals:i.settings?.coerceEnumsToLiterals??!0,objectQueryParameters:i.settings?.objectQueryParameters??!1,respectReadonlySchemas:i.settings?.respectReadonlySchemas??!1,respectNullableSchemas:i.settings?.respectNullableSchemas??!1,onlyIncludeReferencedSchemas:i.settings?.onlyIncludeReferencedSchemas??!1,inlinePathParameters:i.settings?.inlinePathParameters??!1,disableExamples:!1,discriminatedUnionV2:i.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,preserveSchemaIds:!1,asyncApiNaming:i.settings?.asyncApiMessageNaming??"v1",filter:i.settings?.filter,exampleGeneration:void 0,defaultFormParameterEncoding:i.settings?.defaultFormParameterEncoding,useBytesForBinaryResponse:i.settings?.useBytesForBinaryResponse??!1,respectForwardCompatibleEnums:i.settings?.respectForwardCompatibleEnums??!1,additionalPropertiesDefaultsTo:i.settings?.additionalPropertiesDefaultsTo??!1,typeDatesAsStrings:i.settings?.typeDatesAsStrings??!0,preserveSingleSchemaOneOf:i.settings?.preserveSingleSchemaOneOf??!1,inlineAllOfSchemas:i.settings?.inlineAllOfSchemas??!1,resolveAliases:i.settings?.resolveAliases??!1,groupMultiApiEnvironments:i.settings?.groupMultiApiEnvironments??!1,wrapReferencesToNullableInOptional:i.settings?.wrapReferencesToNullableInOptional??!0,coerceOptionalSchemasToNullable:i.settings?.coerceOptionalSchemasToNullable??!0,groupEnvironmentsByHost:i.settings?.groupEnvironmentsByHost??!1}});continue}if(i.schema.type==="openrpc"){let c=ru.of(i.schema.path),f=Ql(e,c);n.push({type:"openrpc",absoluteFilepath:f,absoluteFilepathToOverrides:a,namespace:t});continue}let o=Ql(e,ru.of(i.schema.path));if(!await Vv(o))return{didSucceed:!1,failures:{[ru.of(i.schema.path)]:{type:xT.FILE_MISSING}}};if(i.overrides!=null&&a!=null&&!await Vv(a))return{didSucceed:!1,failures:{[ru.of(i.overrides)]:{type:xT.FILE_MISSING}}};n.push({type:"openapi",absoluteFilepath:o,absoluteFilepathToOverrides:a,settings:{audiences:i.audiences??[],useTitlesAsName:i.settings?.shouldUseTitleAsName??!0,shouldUseUndiscriminatedUnionsWithLiterals:i.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,shouldUseIdiomaticRequestNames:i.settings?.shouldUseIdiomaticRequestNames??!1,optionalAdditionalProperties:i.settings?.shouldUseOptionalAdditionalProperties??!0,coerceEnumsToLiterals:i.settings?.coerceEnumsToLiterals??!0,objectQueryParameters:i.settings?.objectQueryParameters??!1,respectReadonlySchemas:i.settings?.respectReadonlySchemas??!1,respectNullableSchemas:i.settings?.respectNullableSchemas??!1,onlyIncludeReferencedSchemas:i.settings?.onlyIncludeReferencedSchemas??!1,inlinePathParameters:i.settings?.inlinePathParameters??!1,disableExamples:!1,discriminatedUnionV2:i.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,preserveSchemaIds:!1,asyncApiNaming:i.settings?.asyncApiMessageNaming??"v1",filter:i.settings?.filter,exampleGeneration:i.settings?.exampleGeneration,defaultFormParameterEncoding:i.settings?.defaultFormParameterEncoding,useBytesForBinaryResponse:i.settings?.useBytesForBinaryResponse??!1,respectForwardCompatibleEnums:i.settings?.respectForwardCompatibleEnums??!1,additionalPropertiesDefaultsTo:i.settings?.additionalPropertiesDefaultsTo??!1,typeDatesAsStrings:i.settings?.typeDatesAsStrings??!0,preserveSingleSchemaOneOf:i.settings?.preserveSingleSchemaOneOf??!1,inlineAllOfSchemas:i.settings?.inlineAllOfSchemas??!1,resolveAliases:i.settings?.resolveAliases??!1,groupMultiApiEnvironments:i.settings?.groupMultiApiEnvironments??!1,wrapReferencesToNullableInOptional:i.settings?.wrapReferencesToNullableInOptional??!0,coerceOptionalSchemasToNullable:i.settings?.coerceOptionalSchemasToNullable??!0,groupEnvironmentsByHost:i.settings?.groupEnvironmentsByHost??!1},source:{type:"openapi",file:o},namespace:t})}return n}async function Yrs({absolutePathToWorkspace:e,context:t,cliVersion:r,workspaceName:n}){let i=await MTr({absolutePathToWorkspace:e,context:t}),a;try{a=await gbv({absolutePathToWorkspace:e})}catch{}if(i?.api!=null&&i?.api.type==="conjure")return{didSucceed:!0,workspace:new J2u({workspaceName:n,absoluteFilePath:e,generatorsConfiguration:i,changelog:a,cliVersion:r,context:t,relativePathToConjureDirectory:ru.of(i.api.pathToConjureDefinition)})};if(i?.api!=null&&(i.api.type==="singleNamespace"&&i.api.definitions.length>0||i.api.type==="multiNamespace")){let o=[];if(i.api.type==="singleNamespace"){let c=await GLf({absolutePathToWorkspace:e,namespace:void 0,definitions:i.api.definitions});if(!Array.isArray(c))return c;o.push(...c)}else{for(let[c,f]of Object.entries(i.api.definitions)){let u=await GLf({absolutePathToWorkspace:e,namespace:c,definitions:f});if(!Array.isArray(u))return u;o.push(...u)}if(i.api.rootDefinitions!=null){let c=await GLf({absolutePathToWorkspace:e,namespace:void 0,definitions:i.api.rootDefinitions});if(!Array.isArray(c))return c;o.push(...c)}}return{didSucceed:!0,workspace:new S$({specs:o.filter(c=>!(c.type==="openrpc"||c.type==="protobuf"&&!c.fromOpenAPI)),allSpecs:o.filter(c=>!(c.type==="protobuf"&&c.fromOpenAPI)),workspaceName:n,absoluteFilePath:e,generatorsConfiguration:i,changelog:a,cliVersion:r})}}if(await Vv(Ql(e,ru.of(Pne))))return{didSucceed:!0,workspace:new kVr({absoluteFilePath:e,generatorsConfiguration:i,workspaceName:n,changelog:a,context:t,cliVersion:r,loadAPIWorkspace:Yrs})};if(await BZl(Ql(e,ru.of(Pne)))){let o=e.split("/").pop();t.logger.warn(`Detected empty API definiton: ${o}. Remove to resolve error.`)}return{didSucceed:!1,failures:{[ru.of(O9o)]:{type:xT.MISCONFIGURED_DIRECTORY}}}}var mbv=require("fs/promises");var HLf={};yf(HLf,{additionalProperties:()=>PKI,default:()=>jKI,definitions:()=>wKI,properties:()=>OKI,required:()=>AKI,type:()=>mKI});var mKI="object",OKI={instances:{type:"array",items:{$ref:"#/definitions/docs.DocsInstance"}},title:{oneOf:[{type:"string"},{type:"null"}]},analytics:{oneOf:[{$ref:"#/definitions/docs.AnalyticsConfig"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]},roles:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RoleId"}},{type:"null"}]},tabs:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/docs.TabConfig"}},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},products:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ProductConfig"}},{type:"null"}]},"landing-page":{oneOf:[{$ref:"#/definitions/docs.PageConfiguration"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/docs.NavigationConfig"},{type:"null"}]},"navbar-links":{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavbarLink"}},{type:"null"}]},"footer-links":{oneOf:[{$ref:"#/definitions/docs.FooterLinksConfig"},{type:"null"}]},"page-actions":{oneOf:[{$ref:"#/definitions/docs.PageActionsConfig"},{type:"null"}]},experimental:{oneOf:[{$ref:"#/definitions/docs.ExperimentalConfig"},{type:"null"}]},"default-language":{oneOf:[{$ref:"#/definitions/docs.ProgrammingLanguage"},{type:"null"}]},languages:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.Language"}},{type:"null"}]},"ai-chat":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},"ai-search":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},metadata:{oneOf:[{$ref:"#/definitions/docs.MetadataConfig"},{type:"null"}]},redirects:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RedirectConfig"}},{type:"null"}]},logo:{oneOf:[{$ref:"#/definitions/docs.LogoConfiguration"},{type:"null"}]},favicon:{oneOf:[{type:"string"},{type:"null"}]},"background-image":{oneOf:[{$ref:"#/definitions/docs.BackgroundImageConfiguration"},{type:"null"}]},colors:{oneOf:[{$ref:"#/definitions/docs.ColorsConfiguration"},{type:"null"}]},typography:{oneOf:[{$ref:"#/definitions/docs.DocsTypographyConfig"},{type:"null"}]},layout:{oneOf:[{$ref:"#/definitions/docs.LayoutConfig"},{type:"null"}]},settings:{oneOf:[{$ref:"#/definitions/docs.DocsSettingsConfig"},{type:"null"}]},theme:{oneOf:[{$ref:"#/definitions/docs.ThemeConfig"},{type:"null"}]},integrations:{oneOf:[{$ref:"#/definitions/docs.IntegrationsConfig"},{type:"null"}]},css:{oneOf:[{$ref:"#/definitions/docs.CssConfig"},{type:"null"}]},js:{oneOf:[{$ref:"#/definitions/docs.JsConfig"},{type:"null"}]}},AKI=["instances"],PKI=!1,wKI={"docs.CustomDomain":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.GithubEditThisPageConfig":{type:"object",properties:{host:{oneOf:[{type:"string"},{type:"null"}]},owner:{type:"string"},repo:{type:"string"},branch:{oneOf:[{type:"string"},{type:"null"}]}},required:["owner","repo"],additionalProperties:!1},"docs.EditThisPageConfig":{type:"object",properties:{github:{oneOf:[{$ref:"#/definitions/docs.GithubEditThisPageConfig"},{type:"null"}]}},additionalProperties:!1},"docs.AudienceId":{type:"string"},"docs.Audience":{anyOf:[{$ref:"#/definitions/docs.AudienceId"},{type:"array",items:{$ref:"#/definitions/docs.AudienceId"}}]},"docs.DocsInstance":{type:"object",properties:{url:{type:"string"},"custom-domain":{oneOf:[{$ref:"#/definitions/docs.CustomDomain"},{type:"null"}]},private:{oneOf:[{type:"boolean"},{type:"null"}]},"edit-this-page":{oneOf:[{$ref:"#/definitions/docs.EditThisPageConfig"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.SegmentConfig":{type:"object",properties:{"write-key":{type:"string"}},required:["write-key"],additionalProperties:!1},"docs.FullStoryAnalyticsConfig":{type:"object",properties:{"org-id":{type:"string"}},required:["org-id"],additionalProperties:!1},"docs.IntercomConfig":{type:"object",properties:{"app-id":{type:"string"},"api-base":{oneOf:[{type:"string"},{type:"null"}]}},required:["app-id"],additionalProperties:!1},"docs.PostHogConfig":{type:"object",properties:{"api-key":{type:"string"},endpoint:{oneOf:[{type:"string"},{type:"null"}]}},required:["api-key"],additionalProperties:!1},"docs.GTMConfig":{type:"object",properties:{"container-id":{type:"string"}},required:["container-id"],additionalProperties:!1},"docs.GoogleAnalytics4Config":{type:"object",properties:{"measurement-id":{type:"string"}},required:["measurement-id"],additionalProperties:!1},"docs.AnalyticsConfig":{type:"object",properties:{segment:{oneOf:[{$ref:"#/definitions/docs.SegmentConfig"},{type:"null"}]},fullstory:{oneOf:[{$ref:"#/definitions/docs.FullStoryAnalyticsConfig"},{type:"null"}]},intercom:{oneOf:[{$ref:"#/definitions/docs.IntercomConfig"},{type:"null"}]},posthog:{oneOf:[{$ref:"#/definitions/docs.PostHogConfig"},{type:"null"}]},gtm:{oneOf:[{$ref:"#/definitions/docs.GTMConfig"},{type:"null"}]},ga4:{oneOf:[{$ref:"#/definitions/docs.GoogleAnalytics4Config"},{type:"null"}]}},additionalProperties:!1},"docs.AnnouncementConfig":{type:"object",properties:{message:{type:"string"}},required:["message"],additionalProperties:!1},"docs.RoleId":{type:"string"},"docs.Role":{anyOf:[{$ref:"#/definitions/docs.RoleId"},{type:"array",items:{$ref:"#/definitions/docs.RoleId"}}]},"docs.FeatureFlag":{type:"object",properties:{flag:{type:"string"},"fallback-value":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},match:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]}},required:["flag"],additionalProperties:!1},"docs.FeatureFlagConfiguration":{anyOf:[{type:"string",description:"The name of the feature flag, We assume that it is a boolean feature flag that needs to be evaluated to true."},{$ref:"#/definitions/docs.FeatureFlag",description:"A single feature flag with a configurable name, fallback value, and match value. Especially useful for non boolean feature flags."},{type:"array",items:{$ref:"#/definitions/docs.FeatureFlag"},description:"A list of feature flags. If any of the feature flags are satisfied, we will show all content."}]},"docs.ChangelogFolderRelativePath":{type:"string"},"docs.TabConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},changelog:{oneOf:[{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},{type:"null"}]}},required:["display-name"],additionalProperties:!1},"docs.VersionAvailability":{type:"string",enum:["deprecated","ga","stable","beta"]},"docs.VersionConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.VersionAvailability"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.InternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.ExternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},href:{type:"string"}},required:["display-name","href"],additionalProperties:!1},"docs.ProductConfig":{anyOf:[{$ref:"#/definitions/docs.InternalProduct"},{$ref:"#/definitions/docs.ExternalProduct"}]},"docs.Availability":{type:"string",enum:["stable","generally-available","in-development","pre-release","deprecated","beta"]},"docs.PageConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},page:{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},noindex:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["page","path"],additionalProperties:!1},"docs.SectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},path:{oneOf:[{type:"string"},{type:"null"}]},contents:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["section","contents"],additionalProperties:!1},"docs.VersionedSnippetLanguageConfiguration":{type:"object",properties:{version:{type:"string"},package:{type:"string"}},required:["version","package"],additionalProperties:!1},"docs.SnippetLanguageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.VersionedSnippetLanguageConfiguration"}]},"docs.SnippetsConfiguration":{type:"object",properties:{python:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},typescript:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},go:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},java:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},ruby:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},csharp:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},php:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},swift:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},rust:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundButtonSettings":{type:"object",properties:{href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundSettings":{type:"object",properties:{environments:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},button:{oneOf:[{$ref:"#/definitions/docs.PlaygroundButtonSettings"},{type:"null"}]},oauth:{oneOf:[{type:"boolean"},{type:"null"}]},"limit-websocket-messages-per-connection":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfigurationWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfiguration":{anyOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{$ref:"#/definitions/docs.ApiReferencePackageConfigurationWithOptions"}]},"docs.ApiReferenceSectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},"referenced-packages":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["section"],additionalProperties:!1},"docs.ApiReferenceEndpointConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},endpoint:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"docs.LinkConfiguration":{type:"object",properties:{link:{type:"string"},href:{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]}},required:["link","href"],additionalProperties:!1},"docs.ApiReferenceLayoutItem":{anyOf:[{type:"string",description:"This should be either an endpoint, websocket, webhook, or subpackage ID"},{type:"object",additionalProperties:{$ref:"#/definitions/docs.ApiReferencePackageConfiguration"},description:"Keyed by subpackage name, this object allows you to group endpoints and pages together."},{$ref:"#/definitions/docs.ApiReferenceSectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceEndpointConfiguration"},{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"}]},"docs.ApiReferenceConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},api:{type:"string"},"api-name":{oneOf:[{type:"string"},{type:"null"}]},openrpc:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},"display-errors":{oneOf:[{type:"boolean"},{type:"null"}]},snippets:{oneOf:[{$ref:"#/definitions/docs.SnippetsConfiguration"},{type:"null"}]},postman:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},alphabetized:{oneOf:[{type:"boolean"},{type:"null"}]},flattened:{oneOf:[{type:"boolean"},{type:"null"}]},paginated:{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["api"],additionalProperties:!1},"docs.ChangelogConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},changelog:{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["changelog"],additionalProperties:!1},"docs.FolderConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},folder:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["folder"],additionalProperties:!1},"docs.NavigationItem":{anyOf:[{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.SectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"},{$ref:"#/definitions/docs.ChangelogConfiguration"},{$ref:"#/definitions/docs.FolderConfiguration"}]},"docs.UntabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},"docs.TabId":{type:"string"},"docs.TabbedNavigationItemWithLayout":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},{type:"null"}]}},required:["tab"],additionalProperties:!1},"docs.TabVariant":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},layout:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},default:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["title","layout"],additionalProperties:!1},"docs.TabbedNavigationItemWithVariants":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},variants:{type:"array",items:{$ref:"#/definitions/docs.TabVariant"}}},required:["tab","variants"],additionalProperties:!1},"docs.TabbedNavigationItem":{anyOf:[{$ref:"#/definitions/docs.TabbedNavigationItemWithLayout"},{$ref:"#/definitions/docs.TabbedNavigationItemWithVariants"}]},"docs.TabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.TabbedNavigationItem"}},"docs.NavigationConfig":{anyOf:[{$ref:"#/definitions/docs.UntabbedNavigationConfig"},{$ref:"#/definitions/docs.TabbedNavigationConfig"}]},"docs.NavbarGithubConfigWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},url:{type:"string"}},required:["url"],additionalProperties:!1},"docs.NavbarGithubConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.NavbarGithubConfigWithOptions"}]},"docs.NavbarLinkConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.NavbarLink":{type:"object",properties:{type:{type:"string",enum:["filled","outlined","minimal","github","dropdown","primary","secondary"]}},oneOf:[{properties:{type:{const:"filled"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"outlined"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"minimal"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"github"},value:{$ref:"#/definitions/docs.NavbarGithubConfig"}},required:["type"]},{properties:{type:{const:"dropdown"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},links:{type:"array",items:{$ref:"#/definitions/docs.NavbarLinkConfig"}},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type","links"]},{properties:{type:{const:"primary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"secondary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]}]},"docs.FooterLinksConfig":{type:"object",properties:{github:{oneOf:[{type:"string"},{type:"null"}]},twitter:{oneOf:[{type:"string"},{type:"null"}]},x:{oneOf:[{type:"string"},{type:"null"}]},linkedin:{oneOf:[{type:"string"},{type:"null"}]},youtube:{oneOf:[{type:"string"},{type:"null"}]},instagram:{oneOf:[{type:"string"},{type:"null"}]},facebook:{oneOf:[{type:"string"},{type:"null"}]},discord:{oneOf:[{type:"string"},{type:"null"}]},slack:{oneOf:[{type:"string"},{type:"null"}]},hackernews:{oneOf:[{type:"string"},{type:"null"}]},medium:{oneOf:[{type:"string"},{type:"null"}]},website:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PageActionOption":{type:"string",enum:["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]},"docs.PageActionOptions":{type:"object",properties:{"copy-page":{oneOf:[{type:"boolean"},{type:"null"}]},"view-as-markdown":{oneOf:[{type:"boolean"},{type:"null"}]},"ask-ai":{oneOf:[{type:"boolean"},{type:"null"}]},chatgpt:{oneOf:[{type:"boolean"},{type:"null"}]},claude:{oneOf:[{type:"boolean"},{type:"null"}]},cursor:{oneOf:[{type:"boolean"},{type:"null"}]},vscode:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.PageActionsConfig":{type:"object",properties:{default:{oneOf:[{$ref:"#/definitions/docs.PageActionOption"},{type:"null"}]},options:{oneOf:[{$ref:"#/definitions/docs.PageActionOptions"},{type:"null"}]}},additionalProperties:!1},"docs.ExperimentalConfig":{type:"object",properties:{"mdx-components":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"disable-stream-toggle":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v2":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v3":{oneOf:[{type:"boolean"},{type:"null"}]},"dynamic-snippets":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.ProgrammingLanguage":{type:"string",enum:["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]},"docs.Language":{type:"string",enum:["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]},"docs.AIChatModel":{type:"string",enum:["claude-3.7","claude-4","command-a"]},"docs.AIChatLocation":{type:"string",enum:["docs","slack","discord"]},"docs.AIChatWebsiteDatasource":{type:"object",properties:{url:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.AIChatDatasource":{anyOf:[{$ref:"#/definitions/docs.AIChatWebsiteDatasource"}]},"docs.AIChatConfig":{type:"object",properties:{model:{oneOf:[{$ref:"#/definitions/docs.AIChatModel"},{type:"null"}]},"system-prompt":{oneOf:[{type:"string"},{type:"null"}]},location:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatLocation"}},{type:"null"}]},datasources:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatDatasource"}},{type:"null"}]}},additionalProperties:!1},"docs.TwitterCardSetting":{type:"string",enum:["summary","summary_large_image","app","player"]},"docs.MetadataConfig":{type:"object",properties:{"og:site_name":{oneOf:[{type:"string"},{type:"null"}]},"og:title":{oneOf:[{type:"string"},{type:"null"}]},"og:description":{oneOf:[{type:"string"},{type:"null"}]},"og:url":{oneOf:[{type:"string"},{type:"null"}]},"og:image":{oneOf:[{type:"string"},{type:"null"}]},"og:image:width":{oneOf:[{type:"number"},{type:"null"}]},"og:image:height":{oneOf:[{type:"number"},{type:"null"}]},"og:locale":{oneOf:[{type:"string"},{type:"null"}]},"og:logo":{oneOf:[{type:"string"},{type:"null"}]},"twitter:title":{oneOf:[{type:"string"},{type:"null"}]},"twitter:description":{oneOf:[{type:"string"},{type:"null"}]},"twitter:handle":{oneOf:[{type:"string"},{type:"null"}]},"twitter:image":{oneOf:[{type:"string"},{type:"null"}]},"twitter:site":{oneOf:[{type:"string"},{type:"null"}]},"twitter:url":{oneOf:[{type:"string"},{type:"null"}]},"twitter:card":{oneOf:[{$ref:"#/definitions/docs.TwitterCardSetting"},{type:"null"}]},"canonical-host":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.RedirectConfig":{type:"object",properties:{source:{type:"string"},destination:{type:"string"},permanent:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["source","destination"],additionalProperties:!1},"docs.LogoConfiguration":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]},height:{oneOf:[{type:"number"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.BackgroundImageThemedConfig"}]},"docs.ColorThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.ColorConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.ColorThemedConfig"}]},"docs.ColorsConfiguration":{type:"object",properties:{"accent-primary":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},accentPrimary:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},background:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},border:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"sidebar-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"header-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"card-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]}},additionalProperties:!1},"docs.FontWeight":{anyOf:[{type:"string"},{type:"integer"}]},"docs.FontStyle":{type:"string",enum:["normal","italic"]},"docs.FontConfigVariant":{type:"object",properties:{path:{type:"string"},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.FontConfigPath":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.FontConfigVariant"}]},"docs.FontDisplay":{type:"string",enum:["auto","block","swap","fallback","optional"]},"docs.FontConfig":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},path:{oneOf:[{type:"string"},{type:"null"}]},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]},paths:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.FontConfigPath"}},{type:"null"}]},display:{oneOf:[{$ref:"#/definitions/docs.FontDisplay"},{type:"null"}]},fallback:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"font-variation-settings":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.DocsTypographyConfig":{type:"object",properties:{headingsFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},bodyFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},codeFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]}},additionalProperties:!1},"docs.SearchbarPlacement":{type:"string",enum:["header","header-tabs","sidebar"]},"docs.TabsPlacement":{type:"string",enum:["header","sidebar"]},"docs.ContentAlignment":{type:"string",enum:["center","left"]},"docs.HeaderPosition":{type:"string",enum:["fixed","static"]},"docs.LayoutConfig":{type:"object",properties:{"page-width":{oneOf:[{type:"string"},{type:"null"}]},"content-width":{oneOf:[{type:"string"},{type:"null"}]},"sidebar-width":{oneOf:[{type:"string"},{type:"null"}]},"header-height":{oneOf:[{type:"string"},{type:"null"}]},"searchbar-placement":{oneOf:[{$ref:"#/definitions/docs.SearchbarPlacement"},{type:"null"}]},"tabs-placement":{oneOf:[{$ref:"#/definitions/docs.TabsPlacement"},{type:"null"}]},"content-alignment":{oneOf:[{$ref:"#/definitions/docs.ContentAlignment"},{type:"null"}]},"header-position":{oneOf:[{$ref:"#/definitions/docs.HeaderPosition"},{type:"null"}]},"disable-header":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-nav-links":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-feedback":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.HttpSnippetLanguage":{type:"string",enum:["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]},"docs.HttpSnippetsConfig":{anyOf:[{type:"boolean"},{type:"array",items:{$ref:"#/definitions/docs.HttpSnippetLanguage"}}]},"docs.DocsSettingsConfig":{type:"object",properties:{"search-text":{oneOf:[{type:"string"},{type:"null"}]},"disable-search":{oneOf:[{type:"boolean"},{type:"null"}]},"dark-mode-code":{oneOf:[{type:"boolean"},{type:"null"}]},"default-search-filters":{oneOf:[{type:"boolean"},{type:"null"}]},"http-snippets":{oneOf:[{$ref:"#/definitions/docs.HttpSnippetsConfig"},{type:"null"}]},"hide-404-page":{oneOf:[{type:"boolean"},{type:"null"}]},"use-javascript-as-typescript":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-explorer-proxy":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-analytics":{oneOf:[{type:"boolean"},{type:"null"}]},language:{oneOf:[{$ref:"#/definitions/docs.Language"},{type:"null"}]}},additionalProperties:!1},"docs.SidebarThemeConfig":{type:"string",enum:["default","minimal"]},"docs.BodyThemeConfig":{type:"string",enum:["default","canvas"]},"docs.TabsThemeConfig":{type:"string",enum:["default","bubble"]},"docs.PageActionsThemeConfig":{type:"string",enum:["default","toolbar"]},"docs.ThemeConfig":{type:"object",properties:{sidebar:{$ref:"#/definitions/docs.SidebarThemeConfig"},body:{$ref:"#/definitions/docs.BodyThemeConfig"},tabs:{$ref:"#/definitions/docs.TabsThemeConfig"},"page-actions":{$ref:"#/definitions/docs.PageActionsThemeConfig"}},required:["sidebar","body","tabs","page-actions"],additionalProperties:!1},"docs.IntegrationsConfig":{type:"object",properties:{intercom:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.CssConfig":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.JsScriptStrategy":{type:"string",enum:["beforeInteractive","afterInteractive","lazyOnload"]},"docs.JsRemoteConfig":{type:"object",properties:{url:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.JsFileConfigSettings":{type:"object",properties:{path:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.JsFileConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.JsFileConfigSettings"}]},"docs.JsConfigOptions":{anyOf:[{$ref:"#/definitions/docs.JsRemoteConfig"},{$ref:"#/definitions/docs.JsFileConfig"}]},"docs.JsConfig":{anyOf:[{$ref:"#/definitions/docs.JsConfigOptions"},{type:"array",items:{$ref:"#/definitions/docs.JsConfigOptions"}}]}},jKI={type:mKI,properties:OKI,required:AKI,additionalProperties:PKI,definitions:wKI};async function JLf({fernDirectory:e,context:t}){let r=Ql(e,ru.of(ave));if(!await Vv(r))return;let n=await EKI({absolutePathToDocsDefinition:e,context:t});if(n!=null)return{type:"docs",absoluteFilePath:e,config:n,workspaceName:void 0,absoluteFilepathToDocsConfig:Ql(e,ru.of(ave))}}async function EKI({absolutePathToDocsDefinition:e,context:t}){if(!await Vv(e))return;let r=Ql(e,ru.of(ave));return await SKI({absolutePathOfConfiguration:r,context:t})}async function SKI({absolutePathOfConfiguration:e,context:t}){let r=await(0,mbv.readFile)(e),n=jg.load(r.toString()),i=pBr(n,HLf,{filePath:e});if(i.success)return rFe.RawSchemas.Serializer.DocsConfiguration.parseOrThrow(n);throw new Error(`Failed to parse docs.yml:
2729
+ `}async function $ht({context:e,specs:t,relativePathToDependency:r}){let n=new HLu({context:e}),i=t.filter(f=>f.type==="openapi").map(f=>({...f,relativePathToDependency:r})),a=t.filter(f=>f.type==="protobuf"),c=(await Promise.all(a.map(async f=>{if(f.absoluteFilepathToProtobufTarget!=null){let m=await hbv({generator:n,protobufSpec:f,relativePathToDependency:r});return m?[m.openApiSpec]:[]}let u=await uve(f.absoluteFilepathToProtobufRoot,"proto"),s,l=[];for(let m of u){let O=await hbv({generator:n,protobufSpec:{...f,absoluteFilepathToProtobufTarget:m},relativePathToDependency:r,existingBufLockContents:s});O!=null&&(l.push(O.openApiSpec),O.bufLockContents!=null&&(s=O.bufLockContents))}return l}))).flat().filter(f=>hj(f));return[...i,...c]}async function hbv({generator:e,protobufSpec:t,relativePathToDependency:r,existingBufLockContents:n}){if(t.absoluteFilepathToProtobufTarget==null)return;let i=await e.generate({absoluteFilepathToProtobufRoot:t.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:t.absoluteFilepathToProtobufTarget,relativeFilepathToProtobufRoot:t.relativeFilepathToProtobufRoot,local:t.generateLocally,deps:t.dependencies,existingBufLockContents:n});return{bufLockContents:i.bufLockContents,openApiSpec:{type:"openapi",absoluteFilepath:i.absoluteFilepath,absoluteFilepathToOverrides:t.absoluteFilepathToOverrides,settings:t.settings,source:{type:"protobuf",relativePathToDependency:r,root:t.absoluteFilepathToProtobufRoot,file:t.absoluteFilepathToProtobufTarget}}}}var S$=class extends tes{type="oss";allSpecs;specs;sources;loader;constructor({allSpecs:t,specs:r,...n}){super({...n,respectReadonlySchemas:r.every(i=>i.settings?.respectReadonlySchemas),respectNullableSchemas:r.every(i=>i.settings?.respectNullableSchemas),wrapReferencesToNullableInOptional:r.every(i=>i.settings?.wrapReferencesToNullableInOptional),coerceOptionalSchemasToNullable:r.every(i=>i.settings?.coerceOptionalSchemasToNullable),onlyIncludeReferencedSchemas:r.every(i=>i.settings?.onlyIncludeReferencedSchemas),inlinePathParameters:r.every(i=>i.settings?.inlinePathParameters),objectQueryParameters:r.every(i=>i.settings?.objectQueryParameters),useBytesForBinaryResponse:r.filter(i=>i.type==="openapi"&&i.source.type==="openapi").some(i=>i.settings?.useBytesForBinaryResponse),respectForwardCompatibleEnums:r.filter(i=>i.type==="openapi"&&i.source.type==="openapi").some(i=>i.settings?.respectForwardCompatibleEnums),inlineAllOfSchemas:r.every(i=>i.settings?.inlineAllOfSchemas),resolveAliases:r.every(o=>o.settings?.resolveAliases)?{except:r.flatMap(o=>typeof o.settings?.resolveAliases=="object"?o.settings.resolveAliases.except??[]:[])}:!1,exampleGeneration:r[0]?.settings?.exampleGeneration,groupEnvironmentsByHost:r.some(i=>i.settings?.groupEnvironmentsByHost)}),this.specs=r,this.allSpecs=t,this.sources=this.convertSpecsToIdentifiableSources(r),this.loader=new Lqr(this.absoluteFilePath)}async getOpenAPIIr({context:t,relativePathToDependency:r},n){let i=await $ht({context:t,specs:this.specs,relativePathToDependency:r});return Afa({context:t,documents:await this.loader.loadDocuments({context:t,specs:i}),options:{...n,respectReadonlySchemas:n?.respectReadonlySchemas??this.respectReadonlySchemas,respectNullableSchemas:n?.respectNullableSchemas??this.respectNullableSchemas,wrapReferencesToNullableInOptional:n?.wrapReferencesToNullableInOptional??this.wrapReferencesToNullableInOptional,onlyIncludeReferencedSchemas:n?.onlyIncludeReferencedSchemas??this.onlyIncludeReferencedSchemas,inlinePathParameters:n?.inlinePathParameters??this.inlinePathParameters,objectQueryParameters:n?.objectQueryParameters??this.objectQueryParameters,exampleGeneration:n?.exampleGeneration??this.exampleGeneration,useBytesForBinaryResponse:n?.useBytesForBinaryResponse??this.useBytesForBinaryResponse,inlineAllOfSchemas:n?.inlineAllOfSchemas??this.inlineAllOfSchemas,resolveAliases:n?.resolveAliases??this.resolveAliases,groupMultiApiEnvironments:n?.groupMultiApiEnvironments??this.specs.some(a=>a.settings?.groupMultiApiEnvironments),groupEnvironmentsByHost:n?.groupEnvironmentsByHost??this.groupEnvironmentsByHost}})}async getIntermediateRepresentation({context:t,audiences:r,enableUniqueErrorsPerEndpoint:n,generateV1Examples:i}){let a=await $ht({context:t,specs:this.specs}),o=await this.loader.loadDocuments({context:t,specs:a}),c=this.generatorsConfiguration?.api?.auth!=null?{...this.generatorsConfiguration?.api}:void 0;c&&t.logger.trace("Using auth overrides from generators configuration");let f=this.generatorsConfiguration?.api?.environments!=null?{...this.generatorsConfiguration?.api}:void 0;f&&t.logger.trace("Using environment overrides from generators configuration");let u=this.generatorsConfiguration?.api?.headers!=null?{...this.generatorsConfiguration?.api}:void 0;u&&t.logger.trace("Using global header overrides from generators configuration");let s,l=[];for(let m of o){let O=Ql(this.absoluteFilePath,ru.of(m.source?.file??"")),P=nFe(hV(),O),C=new G6i({logger:t.logger,relativeFilepathToSpec:P});l.push(C);let I;switch(m.type){case"openapi":{let z=new Vrs({namespace:m.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:m.value,exampleGenerationArgs:{disabled:!1},errorCollector:C,authOverrides:c,environmentOverrides:f,globalHeaderOverrides:u,enableUniqueErrorsPerEndpoint:n,generateV1Examples:i,settings:hts({options:m.settings}),documentBaseDir:Tg(O)});I=await new Urs({context:z,audiences:r}).convert();break}case"asyncapi":{let z=new Qrs({namespace:m.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:m.value,exampleGenerationArgs:{disabled:!1},errorCollector:C,enableUniqueErrorsPerEndpoint:n,settings:hts({options:m.settings}),generateV1Examples:i});I=await new zrs({context:z,audiences:r}).convert();break}default:C.collect({message:`Unsupported document type: ${m}`,path:[]});break}let T=NLu({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});I!=null&&(s=s===void 0?I:qla(s,I,T))}for(let m of this.allSpecs)if(m.type==="openrpc"){let O=m.absoluteFilepath,P=nFe(hV(),O),C=new G6i({logger:t.logger,relativeFilepathToSpec:P});l.push(C);let I=new Grs({namespace:m.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:await ELf({context:t,absoluteFilePath:m.absoluteFilepath,absoluteFilePathToOverrides:m.absoluteFilepathToOverrides}),exampleGenerationArgs:{disabled:!1},errorCollector:C,enableUniqueErrorsPerEndpoint:n,generateV1Examples:i,settings:hts()}),z=await new Wrs({context:I,audiences:r}).convert(),U=NLu({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});z!=null&&(s=s===void 0?z:qla(s,z,U))}else if(m.type==="protobuf")try{let P=await new GLu({context:t}).generate({absoluteFilepathToProtobufRoot:m.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:m.absoluteFilepathToProtobufTarget,local:!0,deps:m.dependencies}),C=await(0,ybv.readFile)(P,"utf-8"),I=NLu({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});if(C!=null){let T;try{if(T=V0.IntermediateRepresentation.parse(JSON.parse(C),{allowUnrecognizedEnumValues:!0,skipValidation:!0}),T.ok)s=s===void 0?T.value:qla(s,T.value,I);else throw new Error}catch{t.logger.log("error","Failed to parse protobuf IR: ")}}}catch(O){t.logger.log("warn","Failed to parse protobuf IR: "+O)}for(let m of l)if(m.hasErrors()){let O=m.getErrorStats(),P=m.relativeFilepathToSpec?` for ${m.relativeFilepathToSpec}`:"";O.numErrors>0?t.logger.log("error",`API validation${P} completed with ${O.numErrors} errors and ${O.numWarnings} warnings.`):O.numWarnings>0?t.logger.log("warn",`API validation${P} completed with ${O.numWarnings} warnings.`):t.logger.log("info",`All checks passed when parsing OpenAPI${P}.`),t.logger.log("info",""),await m.logErrors({logWarnings:!1})}if(s===void 0)throw new Error("Failed to generate intermediate representation");return s}async toFernWorkspace({context:t},r){let n=await this.getDefinition({context:t},r);return new ynt({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion,sources:this.sources})}getAbsoluteFilePaths(){return[this.absoluteFilePath,...this.allSpecs.flatMap(t=>[t.type==="protobuf"?t.absoluteFilepathToProtobufTarget:t.absoluteFilepath,t.absoluteFilepathToOverrides]).filter(hj)]}getSources(){return this.sources}convertSpecsToIdentifiableSources(t){let r=new Set,n=[];return t.reduce((i,a)=>{let o=a.type==="protobuf"?a.absoluteFilepathToProtobufRoot:a.absoluteFilepath;return r.has(o)||(r.add(o),i.push({type:a.type,id:Urt(),absoluteFilePath:o})),i},n)}};function yKI(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function WLf(e,t){for(let[r,n]of Vk(e.failures))vKI({relativeFilepath:r,failure:n,logger:t})}function vKI({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case xT.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case xT.FILE_READ:r.error("Failed to open file: "+e);break;case xT.FILE_MISSING:r.error("Missing file: "+e);break;case xT.FILE_PARSE:t.error instanceof PUo?r.error(zht({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case xT.STRUCTURE_VALIDATION:for(let n of t.error.issues)for(let{title:i,subtitle:a}of bKI(n))r.error(zht({title:i,subtitle:a,breadcrumbs:[e,...n.path]}));break;case xT.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case xT.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${dru}: `+t.dependencyName);break;case xT.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case xT.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case xT.JSONSCHEMA_VALIDATION:if(t.error.error!=null){let n=t.error.error.instancePath.split("/").filter(i=>i!=="").map(yKI);t.error.error.keyword==="required"&&t.error.error.params?.missingProperty?n.push(t.error.error.params.missingProperty):t.error.error.keyword==="additionalProperties"&&t.error.error.params?.additionalProperty&&n.push(t.error.error.params.additionalProperty),r.error(zht({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...n]}))}break;default:ku(t)}}function bKI(e){switch(e.code){case Ry.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Mf.underline(e.expected)} but received ${Mf.underline(e.received)}`}];case Ry.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Mf.underline(t)}`}));case Ry.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Mf.underline(t)).join(", ")}`}];case Ry.invalid_union:case Ry.invalid_arguments:case Ry.invalid_return_type:case Ry.invalid_date:case Ry.invalid_string:case Ry.too_small:case Ry.too_big:case Ry.invalid_intersection_types:case Ry.not_multiple_of:case Ry.custom:default:return[{title:e.message}]}}var vbv=require("fs/promises");async function bbv(e,t){let r=[];for(let n of await uve(e,t))r.push(await gKI({relativeFilepath:P3(e,n),absoluteFilepath:n}));return r}async function gKI({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,vbv.readFile)(t)).toString()}}async function gbv({absolutePathToWorkspace:e}){let t=Ql(e,ru.of($lh));if(!await Vv(t))return;let n=await bbv(t,"{md,mdx}");return{files:await Promise.all(n.map(i=>({absoluteFilepath:i.absoluteFilepath,contents:i.fileContents})))}}async function GLf({absolutePathToWorkspace:e,namespace:t,definitions:r}){let n=[];for(let i of r){let a=i.overrides!=null?Ql(e,ru.of(i.overrides)):void 0;if(i.schema.type==="protobuf"){let c=ru.of(i.schema.root),f=Ql(e,c);if(!await Vv(f))return{didSucceed:!1,failures:{[ru.of(i.schema.root)]:{type:xT.FILE_MISSING}}};let u=i.schema.target.length===0?void 0:Ql(e,ru.of(i.schema.target));if(u!=null&&!await Vv(u))return{didSucceed:!1,failures:{[ru.of(i.schema.target)]:{type:xT.FILE_MISSING}}};n.push({type:"protobuf",absoluteFilepathToProtobufRoot:f,absoluteFilepathToProtobufTarget:u,absoluteFilepathToOverrides:a,relativeFilepathToProtobufRoot:c,dependencies:i.schema.dependencies,generateLocally:i.schema.localGeneration,fromOpenAPI:i.schema.fromOpenAPI,settings:{audiences:i.audiences??[],useTitlesAsName:i.settings?.shouldUseTitleAsName??!0,shouldUseUndiscriminatedUnionsWithLiterals:i.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,shouldUseIdiomaticRequestNames:i.settings?.shouldUseIdiomaticRequestNames??!1,optionalAdditionalProperties:i.settings?.shouldUseOptionalAdditionalProperties??!0,coerceEnumsToLiterals:i.settings?.coerceEnumsToLiterals??!0,objectQueryParameters:i.settings?.objectQueryParameters??!1,respectReadonlySchemas:i.settings?.respectReadonlySchemas??!1,respectNullableSchemas:i.settings?.respectNullableSchemas??!1,onlyIncludeReferencedSchemas:i.settings?.onlyIncludeReferencedSchemas??!1,inlinePathParameters:i.settings?.inlinePathParameters??!1,disableExamples:!1,discriminatedUnionV2:i.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,preserveSchemaIds:!1,asyncApiNaming:i.settings?.asyncApiMessageNaming??"v1",filter:i.settings?.filter,exampleGeneration:void 0,defaultFormParameterEncoding:i.settings?.defaultFormParameterEncoding,useBytesForBinaryResponse:i.settings?.useBytesForBinaryResponse??!1,respectForwardCompatibleEnums:i.settings?.respectForwardCompatibleEnums??!1,additionalPropertiesDefaultsTo:i.settings?.additionalPropertiesDefaultsTo??!1,typeDatesAsStrings:i.settings?.typeDatesAsStrings??!0,preserveSingleSchemaOneOf:i.settings?.preserveSingleSchemaOneOf??!1,inlineAllOfSchemas:i.settings?.inlineAllOfSchemas??!1,resolveAliases:i.settings?.resolveAliases??!1,groupMultiApiEnvironments:i.settings?.groupMultiApiEnvironments??!1,wrapReferencesToNullableInOptional:i.settings?.wrapReferencesToNullableInOptional??!0,coerceOptionalSchemasToNullable:i.settings?.coerceOptionalSchemasToNullable??!0,groupEnvironmentsByHost:i.settings?.groupEnvironmentsByHost??!1}});continue}if(i.schema.type==="openrpc"){let c=ru.of(i.schema.path),f=Ql(e,c);n.push({type:"openrpc",absoluteFilepath:f,absoluteFilepathToOverrides:a,namespace:t});continue}let o=Ql(e,ru.of(i.schema.path));if(!await Vv(o))return{didSucceed:!1,failures:{[ru.of(i.schema.path)]:{type:xT.FILE_MISSING}}};if(i.overrides!=null&&a!=null&&!await Vv(a))return{didSucceed:!1,failures:{[ru.of(i.overrides)]:{type:xT.FILE_MISSING}}};n.push({type:"openapi",absoluteFilepath:o,absoluteFilepathToOverrides:a,settings:{audiences:i.audiences??[],useTitlesAsName:i.settings?.shouldUseTitleAsName??!0,shouldUseUndiscriminatedUnionsWithLiterals:i.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,shouldUseIdiomaticRequestNames:i.settings?.shouldUseIdiomaticRequestNames??!1,optionalAdditionalProperties:i.settings?.shouldUseOptionalAdditionalProperties??!0,coerceEnumsToLiterals:i.settings?.coerceEnumsToLiterals??!0,objectQueryParameters:i.settings?.objectQueryParameters??!1,respectReadonlySchemas:i.settings?.respectReadonlySchemas??!1,respectNullableSchemas:i.settings?.respectNullableSchemas??!1,onlyIncludeReferencedSchemas:i.settings?.onlyIncludeReferencedSchemas??!1,inlinePathParameters:i.settings?.inlinePathParameters??!1,disableExamples:!1,discriminatedUnionV2:i.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,preserveSchemaIds:!1,asyncApiNaming:i.settings?.asyncApiMessageNaming??"v1",filter:i.settings?.filter,exampleGeneration:i.settings?.exampleGeneration,defaultFormParameterEncoding:i.settings?.defaultFormParameterEncoding,useBytesForBinaryResponse:i.settings?.useBytesForBinaryResponse??!1,respectForwardCompatibleEnums:i.settings?.respectForwardCompatibleEnums??!1,additionalPropertiesDefaultsTo:i.settings?.additionalPropertiesDefaultsTo??!1,typeDatesAsStrings:i.settings?.typeDatesAsStrings??!0,preserveSingleSchemaOneOf:i.settings?.preserveSingleSchemaOneOf??!1,inlineAllOfSchemas:i.settings?.inlineAllOfSchemas??!1,resolveAliases:i.settings?.resolveAliases??!1,groupMultiApiEnvironments:i.settings?.groupMultiApiEnvironments??!1,wrapReferencesToNullableInOptional:i.settings?.wrapReferencesToNullableInOptional??!0,coerceOptionalSchemasToNullable:i.settings?.coerceOptionalSchemasToNullable??!0,groupEnvironmentsByHost:i.settings?.groupEnvironmentsByHost??!1},source:{type:"openapi",file:o},namespace:t})}return n}async function Yrs({absolutePathToWorkspace:e,context:t,cliVersion:r,workspaceName:n}){let i=await MTr({absolutePathToWorkspace:e,context:t}),a;try{a=await gbv({absolutePathToWorkspace:e})}catch{}if(i?.api!=null&&i?.api.type==="conjure")return{didSucceed:!0,workspace:new J2u({workspaceName:n,absoluteFilePath:e,generatorsConfiguration:i,changelog:a,cliVersion:r,context:t,relativePathToConjureDirectory:ru.of(i.api.pathToConjureDefinition)})};if(i?.api!=null&&(i.api.type==="singleNamespace"&&i.api.definitions.length>0||i.api.type==="multiNamespace")){let o=[];if(i.api.type==="singleNamespace"){let c=await GLf({absolutePathToWorkspace:e,namespace:void 0,definitions:i.api.definitions});if(!Array.isArray(c))return c;o.push(...c)}else{for(let[c,f]of Object.entries(i.api.definitions)){let u=await GLf({absolutePathToWorkspace:e,namespace:c,definitions:f});if(!Array.isArray(u))return u;o.push(...u)}if(i.api.rootDefinitions!=null){let c=await GLf({absolutePathToWorkspace:e,namespace:void 0,definitions:i.api.rootDefinitions});if(!Array.isArray(c))return c;o.push(...c)}}return{didSucceed:!0,workspace:new S$({specs:o.filter(c=>!(c.type==="openrpc"||c.type==="protobuf"&&!c.fromOpenAPI)),allSpecs:o.filter(c=>!(c.type==="protobuf"&&c.fromOpenAPI)),workspaceName:n,absoluteFilePath:e,generatorsConfiguration:i,changelog:a,cliVersion:r})}}if(await Vv(Ql(e,ru.of(Pne))))return{didSucceed:!0,workspace:new kVr({absoluteFilePath:e,generatorsConfiguration:i,workspaceName:n,changelog:a,context:t,cliVersion:r,loadAPIWorkspace:Yrs})};if(await BZl(Ql(e,ru.of(Pne)))){let o=e.split("/").pop();t.logger.warn(`Detected empty API definiton: ${o}. Remove to resolve error.`)}return{didSucceed:!1,failures:{[ru.of(O9o)]:{type:xT.MISCONFIGURED_DIRECTORY}}}}var mbv=require("fs/promises");var HLf={};yf(HLf,{additionalProperties:()=>PKI,default:()=>jKI,definitions:()=>wKI,properties:()=>OKI,required:()=>AKI,type:()=>mKI});var mKI="object",OKI={instances:{type:"array",items:{$ref:"#/definitions/docs.DocsInstance"}},title:{oneOf:[{type:"string"},{type:"null"}]},analytics:{oneOf:[{$ref:"#/definitions/docs.AnalyticsConfig"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]},roles:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RoleId"}},{type:"null"}]},tabs:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/docs.TabConfig"}},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},products:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ProductConfig"}},{type:"null"}]},"landing-page":{oneOf:[{$ref:"#/definitions/docs.PageConfiguration"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/docs.NavigationConfig"},{type:"null"}]},"navbar-links":{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavbarLink"}},{type:"null"}]},"footer-links":{oneOf:[{$ref:"#/definitions/docs.FooterLinksConfig"},{type:"null"}]},"page-actions":{oneOf:[{$ref:"#/definitions/docs.PageActionsConfig"},{type:"null"}]},experimental:{oneOf:[{$ref:"#/definitions/docs.ExperimentalConfig"},{type:"null"}]},"default-language":{oneOf:[{$ref:"#/definitions/docs.ProgrammingLanguage"},{type:"null"}]},languages:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.Language"}},{type:"null"}]},"ai-chat":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},"ai-search":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},metadata:{oneOf:[{$ref:"#/definitions/docs.MetadataConfig"},{type:"null"}]},redirects:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RedirectConfig"}},{type:"null"}]},logo:{oneOf:[{$ref:"#/definitions/docs.LogoConfiguration"},{type:"null"}]},favicon:{oneOf:[{type:"string"},{type:"null"}]},"background-image":{oneOf:[{$ref:"#/definitions/docs.BackgroundImageConfiguration"},{type:"null"}]},colors:{oneOf:[{$ref:"#/definitions/docs.ColorsConfiguration"},{type:"null"}]},typography:{oneOf:[{$ref:"#/definitions/docs.DocsTypographyConfig"},{type:"null"}]},layout:{oneOf:[{$ref:"#/definitions/docs.LayoutConfig"},{type:"null"}]},settings:{oneOf:[{$ref:"#/definitions/docs.DocsSettingsConfig"},{type:"null"}]},theme:{oneOf:[{$ref:"#/definitions/docs.ThemeConfig"},{type:"null"}]},integrations:{oneOf:[{$ref:"#/definitions/docs.IntegrationsConfig"},{type:"null"}]},css:{oneOf:[{$ref:"#/definitions/docs.CssConfig"},{type:"null"}]},js:{oneOf:[{$ref:"#/definitions/docs.JsConfig"},{type:"null"}]}},AKI=["instances"],PKI=!1,wKI={"docs.CustomDomain":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.GithubEditThisPageConfig":{type:"object",properties:{host:{oneOf:[{type:"string"},{type:"null"}]},owner:{type:"string"},repo:{type:"string"},branch:{oneOf:[{type:"string"},{type:"null"}]}},required:["owner","repo"],additionalProperties:!1},"docs.EditThisPageConfig":{type:"object",properties:{github:{oneOf:[{$ref:"#/definitions/docs.GithubEditThisPageConfig"},{type:"null"}]}},additionalProperties:!1},"docs.AudienceId":{type:"string"},"docs.Audience":{anyOf:[{$ref:"#/definitions/docs.AudienceId"},{type:"array",items:{$ref:"#/definitions/docs.AudienceId"}}]},"docs.DocsInstance":{type:"object",properties:{url:{type:"string"},"custom-domain":{oneOf:[{$ref:"#/definitions/docs.CustomDomain"},{type:"null"}]},private:{oneOf:[{type:"boolean"},{type:"null"}]},"edit-this-page":{oneOf:[{$ref:"#/definitions/docs.EditThisPageConfig"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.SegmentConfig":{type:"object",properties:{"write-key":{type:"string"}},required:["write-key"],additionalProperties:!1},"docs.FullStoryAnalyticsConfig":{type:"object",properties:{"org-id":{type:"string"}},required:["org-id"],additionalProperties:!1},"docs.IntercomConfig":{type:"object",properties:{"app-id":{type:"string"},"api-base":{oneOf:[{type:"string"},{type:"null"}]}},required:["app-id"],additionalProperties:!1},"docs.PostHogConfig":{type:"object",properties:{"api-key":{type:"string"},endpoint:{oneOf:[{type:"string"},{type:"null"}]}},required:["api-key"],additionalProperties:!1},"docs.GTMConfig":{type:"object",properties:{"container-id":{type:"string"}},required:["container-id"],additionalProperties:!1},"docs.GoogleAnalytics4Config":{type:"object",properties:{"measurement-id":{type:"string"}},required:["measurement-id"],additionalProperties:!1},"docs.AnalyticsConfig":{type:"object",properties:{segment:{oneOf:[{$ref:"#/definitions/docs.SegmentConfig"},{type:"null"}]},fullstory:{oneOf:[{$ref:"#/definitions/docs.FullStoryAnalyticsConfig"},{type:"null"}]},intercom:{oneOf:[{$ref:"#/definitions/docs.IntercomConfig"},{type:"null"}]},posthog:{oneOf:[{$ref:"#/definitions/docs.PostHogConfig"},{type:"null"}]},gtm:{oneOf:[{$ref:"#/definitions/docs.GTMConfig"},{type:"null"}]},ga4:{oneOf:[{$ref:"#/definitions/docs.GoogleAnalytics4Config"},{type:"null"}]}},additionalProperties:!1},"docs.AnnouncementConfig":{type:"object",properties:{message:{type:"string"}},required:["message"],additionalProperties:!1},"docs.RoleId":{type:"string"},"docs.Role":{anyOf:[{$ref:"#/definitions/docs.RoleId"},{type:"array",items:{$ref:"#/definitions/docs.RoleId"}}]},"docs.FeatureFlag":{type:"object",properties:{flag:{type:"string"},"fallback-value":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},match:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]}},required:["flag"],additionalProperties:!1},"docs.FeatureFlagConfiguration":{anyOf:[{type:"string",description:"The name of the feature flag, We assume that it is a boolean feature flag that needs to be evaluated to true."},{$ref:"#/definitions/docs.FeatureFlag",description:"A single feature flag with a configurable name, fallback value, and match value. Especially useful for non boolean feature flags."},{type:"array",items:{$ref:"#/definitions/docs.FeatureFlag"},description:"A list of feature flags. If any of the feature flags are satisfied, we will show all content."}]},"docs.ChangelogFolderRelativePath":{type:"string"},"docs.TabConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},changelog:{oneOf:[{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},{type:"null"}]}},required:["display-name"],additionalProperties:!1},"docs.VersionAvailability":{type:"string",enum:["deprecated","ga","stable","beta"]},"docs.VersionConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.VersionAvailability"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.InternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.ExternalProduct":{type:"object",properties:{"display-name":{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},image:{oneOf:[{type:"string"},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},href:{type:"string"}},required:["display-name","href"],additionalProperties:!1},"docs.ProductConfig":{anyOf:[{$ref:"#/definitions/docs.InternalProduct"},{$ref:"#/definitions/docs.ExternalProduct"}]},"docs.Availability":{type:"string",enum:["stable","generally-available","in-development","pre-release","deprecated","beta"]},"docs.PageConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},page:{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},noindex:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["page","path"],additionalProperties:!1},"docs.SectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},path:{oneOf:[{type:"string"},{type:"null"}]},contents:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["section","contents"],additionalProperties:!1},"docs.VersionedSnippetLanguageConfiguration":{type:"object",properties:{version:{type:"string"},package:{type:"string"}},required:["version","package"],additionalProperties:!1},"docs.SnippetLanguageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.VersionedSnippetLanguageConfiguration"}]},"docs.SnippetsConfiguration":{type:"object",properties:{python:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},typescript:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},go:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},java:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},ruby:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},csharp:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},php:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},swift:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},rust:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundButtonSettings":{type:"object",properties:{href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundSettings":{type:"object",properties:{environments:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},button:{oneOf:[{$ref:"#/definitions/docs.PlaygroundButtonSettings"},{type:"null"}]},oauth:{oneOf:[{type:"boolean"},{type:"null"}]},"limit-websocket-messages-per-connection":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfigurationWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfiguration":{anyOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{$ref:"#/definitions/docs.ApiReferencePackageConfigurationWithOptions"}]},"docs.ApiReferenceSectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},"referenced-packages":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["section"],additionalProperties:!1},"docs.ApiReferenceEndpointConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},endpoint:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"docs.LinkConfiguration":{type:"object",properties:{link:{type:"string"},href:{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]}},required:["link","href"],additionalProperties:!1},"docs.ApiReferenceLayoutItem":{anyOf:[{type:"string",description:"This should be either an endpoint, websocket, webhook, or subpackage ID"},{type:"object",additionalProperties:{$ref:"#/definitions/docs.ApiReferencePackageConfiguration"},description:"Keyed by subpackage name, this object allows you to group endpoints and pages together."},{$ref:"#/definitions/docs.ApiReferenceSectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceEndpointConfiguration"},{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"}]},"docs.ApiReferenceConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},api:{type:"string"},"api-name":{oneOf:[{type:"string"},{type:"null"}]},openrpc:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{$ref:"#/definitions/docs.Audience"},{type:"null"}]},"display-errors":{oneOf:[{type:"boolean"},{type:"null"}]},snippets:{oneOf:[{$ref:"#/definitions/docs.SnippetsConfiguration"},{type:"null"}]},postman:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},alphabetized:{oneOf:[{type:"boolean"},{type:"null"}]},flattened:{oneOf:[{type:"boolean"},{type:"null"}]},paginated:{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["api"],additionalProperties:!1},"docs.ChangelogConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},changelog:{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["changelog"],additionalProperties:!1},"docs.FolderConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},folder:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.Availability"},{type:"null"}]}},required:["folder"],additionalProperties:!1},"docs.NavigationItem":{anyOf:[{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.SectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"},{$ref:"#/definitions/docs.ChangelogConfiguration"},{$ref:"#/definitions/docs.FolderConfiguration"}]},"docs.UntabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},"docs.TabId":{type:"string"},"docs.TabbedNavigationItemWithLayout":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},{type:"null"}]}},required:["tab"],additionalProperties:!1},"docs.TabVariant":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{type:"string"},subtitle:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},layout:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},default:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["title","layout"],additionalProperties:!1},"docs.TabbedNavigationItemWithVariants":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},variants:{type:"array",items:{$ref:"#/definitions/docs.TabVariant"}}},required:["tab","variants"],additionalProperties:!1},"docs.TabbedNavigationItem":{anyOf:[{$ref:"#/definitions/docs.TabbedNavigationItemWithLayout"},{$ref:"#/definitions/docs.TabbedNavigationItemWithVariants"}]},"docs.TabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.TabbedNavigationItem"}},"docs.NavigationConfig":{anyOf:[{$ref:"#/definitions/docs.UntabbedNavigationConfig"},{$ref:"#/definitions/docs.TabbedNavigationConfig"}]},"docs.NavbarGithubConfigWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},url:{type:"string"}},required:["url"],additionalProperties:!1},"docs.NavbarGithubConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.NavbarGithubConfigWithOptions"}]},"docs.NavbarLinkConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.NavbarLink":{type:"object",properties:{type:{type:"string",enum:["filled","outlined","minimal","github","dropdown","primary","secondary"]}},oneOf:[{properties:{type:{const:"filled"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"outlined"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"minimal"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"github"},value:{$ref:"#/definitions/docs.NavbarGithubConfig"}},required:["type"]},{properties:{type:{const:"dropdown"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},links:{type:"array",items:{$ref:"#/definitions/docs.NavbarLinkConfig"}},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type","links"]},{properties:{type:{const:"primary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"secondary"},viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]}]},"docs.FooterLinksConfig":{type:"object",properties:{github:{oneOf:[{type:"string"},{type:"null"}]},twitter:{oneOf:[{type:"string"},{type:"null"}]},x:{oneOf:[{type:"string"},{type:"null"}]},linkedin:{oneOf:[{type:"string"},{type:"null"}]},youtube:{oneOf:[{type:"string"},{type:"null"}]},instagram:{oneOf:[{type:"string"},{type:"null"}]},facebook:{oneOf:[{type:"string"},{type:"null"}]},discord:{oneOf:[{type:"string"},{type:"null"}]},slack:{oneOf:[{type:"string"},{type:"null"}]},hackernews:{oneOf:[{type:"string"},{type:"null"}]},medium:{oneOf:[{type:"string"},{type:"null"}]},website:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PageActionOption":{type:"string",enum:["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]},"docs.PageActionOptions":{type:"object",properties:{"copy-page":{oneOf:[{type:"boolean"},{type:"null"}]},"view-as-markdown":{oneOf:[{type:"boolean"},{type:"null"}]},"ask-ai":{oneOf:[{type:"boolean"},{type:"null"}]},chatgpt:{oneOf:[{type:"boolean"},{type:"null"}]},claude:{oneOf:[{type:"boolean"},{type:"null"}]},cursor:{oneOf:[{type:"boolean"},{type:"null"}]},vscode:{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.PageActionsConfig":{type:"object",properties:{default:{oneOf:[{$ref:"#/definitions/docs.PageActionOption"},{type:"null"}]},options:{oneOf:[{$ref:"#/definitions/docs.PageActionOptions"},{type:"null"}]}},additionalProperties:!1},"docs.ExperimentalConfig":{type:"object",properties:{"mdx-components":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"disable-stream-toggle":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v2":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v3":{oneOf:[{type:"boolean"},{type:"null"}]},"dynamic-snippets":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.ProgrammingLanguage":{type:"string",enum:["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]},"docs.Language":{type:"string",enum:["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]},"docs.AIChatModel":{type:"string",enum:["claude-3.7","claude-4","command-a"]},"docs.AIChatLocation":{type:"string",enum:["docs","slack","discord"]},"docs.AIChatWebsiteDatasource":{type:"object",properties:{url:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.AIChatDatasource":{anyOf:[{$ref:"#/definitions/docs.AIChatWebsiteDatasource"}]},"docs.AIChatConfig":{type:"object",properties:{model:{oneOf:[{$ref:"#/definitions/docs.AIChatModel"},{type:"null"}]},"system-prompt":{oneOf:[{type:"string"},{type:"null"}]},location:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatLocation"}},{type:"null"}]},datasources:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AIChatDatasource"}},{type:"null"}]}},additionalProperties:!1},"docs.TwitterCardSetting":{type:"string",enum:["summary","summary_large_image","app","player"]},"docs.MetadataConfig":{type:"object",properties:{"og:site_name":{oneOf:[{type:"string"},{type:"null"}]},"og:title":{oneOf:[{type:"string"},{type:"null"}]},"og:description":{oneOf:[{type:"string"},{type:"null"}]},"og:url":{oneOf:[{type:"string"},{type:"null"}]},"og:image":{oneOf:[{type:"string"},{type:"null"}]},"og:image:width":{oneOf:[{type:"number"},{type:"null"}]},"og:image:height":{oneOf:[{type:"number"},{type:"null"}]},"og:locale":{oneOf:[{type:"string"},{type:"null"}]},"og:logo":{oneOf:[{type:"string"},{type:"null"}]},"twitter:title":{oneOf:[{type:"string"},{type:"null"}]},"twitter:description":{oneOf:[{type:"string"},{type:"null"}]},"twitter:handle":{oneOf:[{type:"string"},{type:"null"}]},"twitter:image":{oneOf:[{type:"string"},{type:"null"}]},"twitter:site":{oneOf:[{type:"string"},{type:"null"}]},"twitter:url":{oneOf:[{type:"string"},{type:"null"}]},"twitter:card":{oneOf:[{$ref:"#/definitions/docs.TwitterCardSetting"},{type:"null"}]},"canonical-host":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.RedirectConfig":{type:"object",properties:{source:{type:"string"},destination:{type:"string"},permanent:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["source","destination"],additionalProperties:!1},"docs.LogoConfiguration":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]},height:{oneOf:[{type:"number"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.BackgroundImageThemedConfig"}]},"docs.ColorThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.ColorConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.ColorThemedConfig"}]},"docs.ColorsConfiguration":{type:"object",properties:{"accent-primary":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},accentPrimary:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},background:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},border:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"sidebar-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"header-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"card-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]}},additionalProperties:!1},"docs.FontWeight":{anyOf:[{type:"string"},{type:"integer"}]},"docs.FontStyle":{type:"string",enum:["normal","italic"]},"docs.FontConfigVariant":{type:"object",properties:{path:{type:"string"},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.FontConfigPath":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.FontConfigVariant"}]},"docs.FontDisplay":{type:"string",enum:["auto","block","swap","fallback","optional"]},"docs.FontConfig":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},path:{oneOf:[{type:"string"},{type:"null"}]},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]},paths:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.FontConfigPath"}},{type:"null"}]},display:{oneOf:[{$ref:"#/definitions/docs.FontDisplay"},{type:"null"}]},fallback:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"font-variation-settings":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.DocsTypographyConfig":{type:"object",properties:{headingsFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},bodyFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},codeFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]}},additionalProperties:!1},"docs.SearchbarPlacement":{type:"string",enum:["header","header-tabs","sidebar"]},"docs.TabsPlacement":{type:"string",enum:["header","sidebar"]},"docs.ContentAlignment":{type:"string",enum:["center","left"]},"docs.HeaderPosition":{type:"string",enum:["fixed","static"]},"docs.LayoutConfig":{type:"object",properties:{"page-width":{oneOf:[{type:"string"},{type:"null"}]},"content-width":{oneOf:[{type:"string"},{type:"null"}]},"sidebar-width":{oneOf:[{type:"string"},{type:"null"}]},"header-height":{oneOf:[{type:"string"},{type:"null"}]},"searchbar-placement":{oneOf:[{$ref:"#/definitions/docs.SearchbarPlacement"},{type:"null"}]},"tabs-placement":{oneOf:[{$ref:"#/definitions/docs.TabsPlacement"},{type:"null"}]},"content-alignment":{oneOf:[{$ref:"#/definitions/docs.ContentAlignment"},{type:"null"}]},"header-position":{oneOf:[{$ref:"#/definitions/docs.HeaderPosition"},{type:"null"}]},"disable-header":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-nav-links":{oneOf:[{type:"boolean"},{type:"null"}]},"hide-feedback":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.HttpSnippetLanguage":{type:"string",enum:["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]},"docs.HttpSnippetsConfig":{anyOf:[{type:"boolean"},{type:"array",items:{$ref:"#/definitions/docs.HttpSnippetLanguage"}}]},"docs.DocsSettingsConfig":{type:"object",properties:{"search-text":{oneOf:[{type:"string"},{type:"null"}]},"disable-search":{oneOf:[{type:"boolean"},{type:"null"}]},"dark-mode-code":{oneOf:[{type:"boolean"},{type:"null"}]},"default-search-filters":{oneOf:[{type:"boolean"},{type:"null"}]},"http-snippets":{oneOf:[{$ref:"#/definitions/docs.HttpSnippetsConfig"},{type:"null"}]},"hide-404-page":{oneOf:[{type:"boolean"},{type:"null"}]},"use-javascript-as-typescript":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-explorer-proxy":{oneOf:[{type:"boolean"},{type:"null"}]},"disable-analytics":{oneOf:[{type:"boolean"},{type:"null"}]},language:{oneOf:[{$ref:"#/definitions/docs.Language"},{type:"null"}]}},additionalProperties:!1},"docs.SidebarThemeConfig":{type:"string",enum:["default","minimal"]},"docs.BodyThemeConfig":{type:"string",enum:["default","canvas"]},"docs.TabsThemeConfig":{type:"string",enum:["default","bubble"]},"docs.PageActionsThemeConfig":{type:"string",enum:["default","toolbar"]},"docs.ThemeConfig":{type:"object",properties:{sidebar:{oneOf:[{$ref:"#/definitions/docs.SidebarThemeConfig"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/docs.BodyThemeConfig"},{type:"null"}]},tabs:{oneOf:[{$ref:"#/definitions/docs.TabsThemeConfig"},{type:"null"}]},"page-actions":{oneOf:[{$ref:"#/definitions/docs.PageActionsThemeConfig"},{type:"null"}]}},additionalProperties:!1},"docs.IntegrationsConfig":{type:"object",properties:{intercom:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.CssConfig":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.JsScriptStrategy":{type:"string",enum:["beforeInteractive","afterInteractive","lazyOnload"]},"docs.JsRemoteConfig":{type:"object",properties:{url:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.JsFileConfigSettings":{type:"object",properties:{path:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.JsFileConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.JsFileConfigSettings"}]},"docs.JsConfigOptions":{anyOf:[{$ref:"#/definitions/docs.JsRemoteConfig"},{$ref:"#/definitions/docs.JsFileConfig"}]},"docs.JsConfig":{anyOf:[{$ref:"#/definitions/docs.JsConfigOptions"},{type:"array",items:{$ref:"#/definitions/docs.JsConfigOptions"}}]}},jKI={type:mKI,properties:OKI,required:AKI,additionalProperties:PKI,definitions:wKI};async function JLf({fernDirectory:e,context:t}){let r=Ql(e,ru.of(ave));if(!await Vv(r))return;let n=await EKI({absolutePathToDocsDefinition:e,context:t});if(n!=null)return{type:"docs",absoluteFilePath:e,config:n,workspaceName:void 0,absoluteFilepathToDocsConfig:Ql(e,ru.of(ave))}}async function EKI({absolutePathToDocsDefinition:e,context:t}){if(!await Vv(e))return;let r=Ql(e,ru.of(ave));return await SKI({absolutePathOfConfiguration:r,context:t})}async function SKI({absolutePathOfConfiguration:e,context:t}){let r=await(0,mbv.readFile)(e),n=jg.load(r.toString()),i=pBr(n,HLf,{filePath:e});if(i.success)return rFe.RawSchemas.Serializer.DocsConfiguration.parseOrThrow(n);throw new Error(`Failed to parse docs.yml:
2730
2730
  ${i.error?.message??"Unknown error"}`)}var Obv=require("fs/promises");async function KLf({context:e,nameOverride:t,...r}){let n=await BTr(t);return n==null?e.failAndThrow(`Directory "${t??ive}" not found.`):await Abv({absolutePathToFernDirectory:n,context:e,nameOverride:t,...r})}async function Abv({absolutePathToFernDirectory:e,cliName:t,cliVersion:r,commandLineApiWorkspace:n,defaultToAllApiWorkspaces:i,context:a}){let o=[];(await Vv(Ql(e,ru.of(umi)))||await Vv(Ql(e,ru.of(Pne)))||await Vv(Ql(e,ru.of(c$)))||await Vv(Ql(e,ru.of(pru)))||await Vv(Ql(e,ru.of(O9o)))||await Vv(Ql(e,ru.of(XYl))))&&(o=await Pbv({cliName:t,fernDirectory:e,cliVersion:r,context:a,commandLineApiWorkspace:n,defaultToAllApiWorkspaces:i}));let c=await JLf({fernDirectory:e,context:a});return o.length===0&&c==null?a.failAndThrow(`No SDK specifications or docs specifications found. Please ensure one of the following .yml (not .yaml) files is present:
2731
2731
  \u203A ${c$}
2732
2732
  \u203A ${ave}
@@ -3029,7 +3029,7 @@ ${m}
3029
3029
  `)},e.heapify=function(t,r){var n=new e(r);return n.heapArray=t,n.init(),n},e.heappop=function(t,r){var n=new e(r);return n.heapArray=t,n.pop()},e.heappush=function(t,r,n){var i=new e(n);i.heapArray=t,i.push(r)},e.heappushpop=function(t,r,n){var i=new e(n);return i.heapArray=t,i.pushpop(r)},e.heapreplace=function(t,r,n){var i=new e(n);return i.heapArray=t,i.replace(r)},e.heaptop=function(t,r,n){r===void 0&&(r=1);var i=new e(n);return i.heapArray=t,i.top(r)},e.heapbottom=function(t,r,n){r===void 0&&(r=1);var i=new e(n);return i.heapArray=t,i.bottom(r)},e.nlargest=function(t,r,n){var i=new e(n);return i.heapArray=LCe([],GPe(r),!1),i.init(),i.top(t)},e.nsmallest=function(t,r,n){var i=new e(n);return i.heapArray=LCe([],GPe(r),!1),i.init(),i.bottom(t)},e.prototype.add=function(t){return this._sortNodeUp(this.heapArray.push(t)-1),this._applyLimit(),!0},e.prototype.addAll=function(t){var r,n=this.length;(r=this.heapArray).push.apply(r,LCe([],GPe(t),!1));for(var i=this.length;n<i;++n)this._sortNodeUp(n);return this._applyLimit(),!0},e.prototype.bottom=function(t){return t===void 0&&(t=1),this.heapArray.length===0||t<=0?[]:this.heapArray.length===1?[this.heapArray[0]]:t>=this.heapArray.length?LCe([],GPe(this.heapArray),!1):this._bottomN_push(~~t)},e.prototype.check=function(){var t=this;return this.heapArray.find(function(r,n){return!!t.getChildrenOf(n).find(function(i){return t.compare(r,i)>0})})},e.prototype.clear=function(){this.heapArray=[]},e.prototype.clone=function(){var t=new e(this.comparator());return t.heapArray=this.toArray(),t._limit=this._limit,t},e.prototype.comparator=function(){return this.compare},e.prototype.contains=function(t,r){return r===void 0&&(r=e.defaultIsEqual),this.indexOf(t,r)!==-1},e.prototype.init=function(t){t&&(this.heapArray=LCe([],GPe(t),!1));for(var r=e.getParentIndexOf(this.length-1);r>=0;--r)this._sortNodeDown(r);this._applyLimit()},e.prototype.isEmpty=function(){return this.length===0},e.prototype.indexOf=function(t,r){if(r===void 0&&(r=e.defaultIsEqual),this.heapArray.length===0)return-1;for(var n=[],i=0;i<this.heapArray.length;){var a=this.heapArray[i];if(r(a,t))return i;this.compare(a,t)<=0&&n.push.apply(n,LCe([],GPe(e.getChildrenIndexOf(i)),!1)),i=n.shift()||this.heapArray.length}return-1},e.prototype.indexOfEvery=function(t,r){if(r===void 0&&(r=e.defaultIsEqual),this.heapArray.length===0)return[];for(var n=[],i=[],a=0;a<this.heapArray.length;){var o=this.heapArray[a];r(o,t)?(i.push(a),n.push.apply(n,LCe([],GPe(e.getChildrenIndexOf(a)),!1))):this.compare(o,t)<=0&&n.push.apply(n,LCe([],GPe(e.getChildrenIndexOf(a)),!1)),a=n.shift()||this.heapArray.length}return i},e.prototype.leafs=function(){if(this.heapArray.length===0)return[];var t=e.getParentIndexOf(this.heapArray.length-1);return this.heapArray.slice(t+1)},Object.defineProperty(e.prototype,"length",{get:function(){return this.heapArray.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"limit",{get:function(){return this._limit},set:function(t){t<0||isNaN(t)?this._limit=0:this._limit=~~t,this._applyLimit()},enumerable:!1,configurable:!0}),e.prototype.setLimit=function(t){return this.limit=t,t<0||isNaN(t)?NaN:this._limit},e.prototype.peek=function(){return this.heapArray[0]},e.prototype.pop=function(){var t=this.heapArray.pop();return this.length>0&&t!==void 0?this.replace(t):t},e.prototype.push=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.length<1?!1:t.length===1?this.add(t[0]):this.addAll(t)},e.prototype.pushpop=function(t){var r;return this.compare(this.heapArray[0],t)<0&&(r=GPe([this.heapArray[0],t],2),t=r[0],this.heapArray[0]=r[1],this._sortNodeDown(0)),t},e.prototype.remove=function(t,r){var n=this;if(r===void 0&&(r=e.defaultIsEqual),!this.heapArray.length)return!1;if(t===void 0)return this.pop(),!0;for(var i=[0];i.length;){var a=i.shift();if(r(this.heapArray[a],t))return a===0?this.pop():a===this.heapArray.length-1?this.heapArray.pop():(this.heapArray.splice(a,1,this.heapArray.pop()),this._sortNodeUp(a),this._sortNodeDown(a)),!0;if(this.compare(this.heapArray[a],t)<=0){var o=e.getChildrenIndexOf(a).filter(function(c){return c<n.heapArray.length});i.push.apply(i,LCe([],GPe(o),!1))}}return!1},e.prototype.replace=function(t){var r=this.heapArray[0];return this.heapArray[0]=t,this._sortNodeDown(0),r},e.prototype.size=function(){return this.length},e.prototype.top=function(t){return t===void 0&&(t=1),this.heapArray.length===0||t<=0?[]:this.heapArray.length===1||t===1?[this.heapArray[0]]:t>=this.heapArray.length?LCe([],GPe(this.heapArray),!1):this._topN_push(~~t)},e.prototype.toArray=function(){return LCe([],GPe(this.heapArray),!1)},e.prototype.toString=function(){return this.heapArray.toString()},e.prototype.get=function(t){return this.heapArray[t]},e.prototype.getChildrenOf=function(t){var r=this;return e.getChildrenIndexOf(t).map(function(n){return r.heapArray[n]}).filter(function(n){return n!==void 0})},e.prototype.getParentOf=function(t){var r=e.getParentIndexOf(t);return this.heapArray[r]},e.prototype[Symbol.iterator]=function(){return ttM(this,function(t){switch(t.label){case 0:return this.length?[4,this.pop()]:[3,2];case 1:return t.sent(),[3,0];case 2:return[2]}})},e.prototype.iterator=function(){return this.toArray()},e.prototype._applyLimit=function(){if(this._limit>0&&this._limit<this.heapArray.length)for(var t=this.heapArray.length-this._limit;t;)this.heapArray.pop(),--t},e.prototype._bottomN_push=function(t){var r=new e(this.compare);r.limit=t,r.heapArray=this.heapArray.slice(-t),r.init();for(var n=this.heapArray.length-1-t,i=e.getParentIndexOf(n),a=[],o=n;o>i;--o)a.push(o);for(var c=this.heapArray;a.length;){var o=a.shift();this.compare(c[o],r.peek())>0&&(r.replace(c[o]),o%2&&a.push(e.getParentIndexOf(o)))}return r.toArray()},e.prototype._moveNode=function(t,r){var n=this.heapArray[t];this.heapArray[t]=this.heapArray[r],this.heapArray[r]=n},e.prototype._sortNodeDown=function(t){for(var r=this.heapArray.length,n=t,i=this.heapArray[t],a=2*t+1;a<r;){var o=a+1,c=o>=r||this.compare(this.heapArray[a],this.heapArray[o])<0?a:o;if(this.compare(this.heapArray[c],i)<0)this.heapArray[t]=this.heapArray[c],t=c,a=2*t+1;else break}t!==n&&(this.heapArray[t]=i)},e.prototype._sortNodeUp=function(t){for(var r=this.heapArray[t],n=t;t>0;){var i=e.getParentIndexOf(t);if(this.compare(r,this.heapArray[i])<0)this.heapArray[t]=this.heapArray[i],t=i;else break}t!==n&&(this.heapArray[t]=r)},e.prototype._topN_push=function(t){var r=new e(this._invertedCompare);r.limit=t;for(var n=[0],i=this.heapArray;n.length;){var a=n.shift();a<i.length&&(r.length<t?(r.push(i[a]),n.push.apply(n,LCe([],GPe(e.getChildrenIndexOf(a)),!1))):this.compare(i[a],r.peek())<0&&(r.replace(i[a]),n.push.apply(n,LCe([],GPe(e.getChildrenIndexOf(a)),!1))))}return r.toArray()},e.prototype._topN_fill=function(t){var r=this.heapArray,n=new e(this._invertedCompare);n.limit=t,n.heapArray=r.slice(0,t),n.init();for(var i=e.getParentIndexOf(t-1)+1,a=[],o=i;o<t;++o)a.push.apply(a,LCe([],GPe(e.getChildrenIndexOf(o).filter(function(c){return c<r.length})),!1));for((t-1)%2&&a.push(t);a.length;){var o=a.shift();o<r.length&&this.compare(r[o],n.peek())<0&&(n.replace(r[o]),a.push.apply(a,LCe([],GPe(e.getChildrenIndexOf(o)),!1)))}return n.toArray()},e.prototype._topN_heap=function(t){for(var r=this.clone(),n=[],i=0;i<t;++i)n.push(r.pop());return n},e.prototype._topIdxOf=function(t){if(!t.length)return-1;for(var r=0,n=t[r],i=1;i<t.length;++i){var a=this.compare(t[i],n);a<0&&(r=i,n=t[i])}return r},e.prototype._topOf=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=new e(this.compare);return n.init(t),n.peek()},e})();function FPv(e,t,r,n,i){if(r<=0)return[];let a=n??(c=>c),o=new RPv(rtM);for(let c of t){let f=NPv.default.get(a(e),a(c));i!=null&&f>i||(o.push({neighbor:c,distance:f}),o.size()>r&&o.pop())}return ntM(o).reverse().map(c=>c.neighbor)}function rtM(e,t){return e.distance!==t.distance?t.distance-e.distance:t.neighbor.localeCompare(e.neighbor)}function ntM(e){let t=[];for(;e.size()>0;){let r=e.pop();r&&t.push(r)}return t}var itM=3,atM=5;function cUu(e,t){let r=FPv(e,t,itM,otM,atM),n=Array.from(t),i=`Failed to locate API section ${e}.`;switch(r.length){case 0:return i=`${i} No similar API sections found. Available API sections:`,n.length===0?`${i} []`:`${i} [
3030
3030
  ${n.map(a=>` ${a}`).join(`,
3031
3031
  `)}
3032
- ]`;case 1:return`${i} Did you mean ${r[0]}?`;case 2:return`${i} Did you mean ${r[0]} or ${r[1]}?`;default:return`${i} Did you mean ${r[0]}, ${r[1]}, or ${r[2]}?`}}function lUu(e){return`API section ${e} is specified multiple times, however will be only rendered once.`}function otM(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function fUu({children:e,findEndpointById:t,stringifyEndpointPathParts:r,disableEndpointPairs:n,apiDefinitionId:i}){if(n)return e;let a=[],o=new Map;return e.forEach(c=>{if(c.type!=="endpoint"){a.push(c);return}let f=t(c.endpointId);if(f==null)throw new Error(`Endpoint ${c.endpointId} not found`);let u=`${f.method} ${r(f)}`,s=o.get(u);if(o.set(u,c),s==null||s.isResponseStream===c.isResponseStream){a.push(c);return}let l=a.indexOf(s),m=c.isResponseStream?c:s,O=c.isResponseStream?s:c,P={id:fl.V1.NodeId(`${i}:${O.endpointId}+${m.endpointId}`),type:"endpointPair",stream:m,nonStream:O};a[l]=P}),a}function xPv({left:e,right:t,findEndpointById:r,stringifyEndpointPathParts:n,disableEndpointPairs:i,apiDefinitionId:a}){return fUu({children:[...e,...t],findEndpointById:r,stringifyEndpointPathParts:n,disableEndpointPairs:i,apiDefinitionId:a}).filter(o=>o.type==="apiPackage"?o.children.length>0:!0)}function hoo(e,t){if(t!=null)return P3(e.absoluteFilePath,t)}function zPv({docsWorkspace:e,page:t,parentSlug:r,idgen:n,markdownFilesToFullSlugs:i,markdownFilesToNoIndex:a,hideChildren:o,resolveIconFileId:c}){let f=fl.V1.PageId(hoo(e,t.absolutePath)),u=r.apply({fullSlug:i.get(t.absolutePath)?.split("/"),urlSlug:t.slug??u$(t.title)});return{id:n.get(f),type:"page",pageId:f,title:t.title,slug:u.get(),icon:c?c(t.icon):t.icon,hidden:o||t.hidden,noindex:t.noindex||a.get(t.absolutePath),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags,availability:t.availability}}var dUu=class{apiSection;docsWorkspace;taskContext;markdownFilesToFullSlugs;markdownFilesToNoIndex;markdownFilesToTags;workspace;hideChildren;parentAvailability;apiDefinitionId;#e;#t=new Set;#r=new Set;#n=new Set;#i=new Set;#a=new Set;#o=new Map;#u=[];#s;#c;#f;disableEndpointPairs;collectedFileIds=new Map;constructor(t,r,n,i,a,o,c,f,u,s,l,m,O){this.apiSection=t,this.docsWorkspace=i,this.taskContext=a,this.markdownFilesToFullSlugs=o,this.markdownFilesToNoIndex=c,this.markdownFilesToTags=f,this.workspace=l,this.hideChildren=m,this.parentAvailability=O,this.disableEndpointPairs=i.config.experimental?.disableStreamToggle??!1,this.apiDefinitionId=fl.V1.ApiDefinitionId(r.id),this.#e=J8i.create(r,a),this.collectedFileIds=s,this.#f=u,this.#s=this.apiSection.overviewAbsolutePath!=null?fl.V1.PageId(hoo(this.docsWorkspace,this.apiSection.overviewAbsolutePath)):void 0;let P=this.apiSection.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(this.apiSection.overviewAbsolutePath):void 0;this.#c=n.apply({fullSlug:P?.split("/"),skipUrlSlug:this.apiSection.skipUrlSlug,urlSlug:this.apiSection.slug??u$(this.apiSection.title)});let C=this.apiSection.availability??this.parentAvailability;this.apiSection.navigation!=null&&(this.#u=this.#d(this.apiSection.navigation,this.#e.api.rootPackage,this.#c,C)),this.#u=this.#g(this.#u.map(I=>this.#m(I,C)),this.#O(this.#e.api.rootPackage,this.#c,C))}get(){let t=fl.V1.followRedirects(this.#u),r=new Tda(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,this.workspace?.changelog?.files.map(n=>n.absoluteFilepath),this.docsWorkspace,this.#f).orUndefined();return{id:this.#f.get(this.apiDefinitionId),type:"apiReference",title:this.apiSection.title,apiDefinitionId:this.apiDefinitionId,overviewPageId:this.#s,paginated:this.apiSection.paginated,slug:this.#c.get(),icon:this.resolveIconFileId(this.apiSection.icon),hidden:this.hideChildren||this.apiSection.hidden,hideTitle:this.apiSection.flattened,showErrors:this.apiSection.showErrors,changelog:r?.toChangelogNode({parentSlug:this.#c,viewers:void 0,hidden:this.hideChildren}),children:this.#u,availability:this.apiSection.availability??this.parentAvailability,pointsTo:t,noindex:void 0,playground:this.#v(this.apiSection.playground),authed:void 0,viewers:this.apiSection.viewers,orphaned:this.apiSection.orphaned,featureFlags:this.apiSection.featureFlags}}#d(t,r,n,i){r=this.#e.resolveSubpackage(r);let a=r!=null?J8i.getSubpackageId(r):void 0;return t.map(o=>zUf(o)._visit({link:c=>({id:this.#f.get(c.url),type:"link",title:c.text,icon:this.resolveIconFileId(c.icon),url:fl.Url(c.url)}),page:c=>this.#p(c,n,i),package:c=>this.#l(c,n,i),section:c=>this.#_(c,n,i),item:({value:c})=>this.#y(c,a,n,i),endpoint:c=>this.#h(c,a,n,i)})).filter(hj)}#p(t,r,n){return zPv({page:{...t,availability:t.availability??n},parentSlug:r,docsWorkspace:this.docsWorkspace,markdownFilesToFullSlugs:this.markdownFilesToFullSlugs,markdownFilesToNoIndex:this.markdownFilesToNoIndex,idgen:this.#f,hideChildren:this.hideChildren,resolveIconFileId:this.resolveIconFileId.bind(this)})}#l(t,r,n){let i=t.overviewAbsolutePath!=null?fl.V1.PageId(hoo(this.docsWorkspace,t.overviewAbsolutePath)):void 0,a=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,o=t.availability??n,c=this.#e.getSubpackageByIdOrLocator(t.package);if(c!=null){let f=J8i.getSubpackageId(c),u=this.#f.get(i??`${this.apiDefinitionId}:${f}`);this.#a.has(f)&&this.taskContext.logger.warn(lUu(t.package)),this.#a.add(f),this.#o.set(u,[f]);let s=t.slug??(hWr(c)?c.urlSlug:this.apiSection.slug??u$(this.apiSection.title)),l=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:s}),m=this.#d(t.contents,c,l,o);return{id:u,type:"apiPackage",children:m,title:t.title??(hWr(c)?c.displayName??poo(c.name):this.apiSection.title),slug:l.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:o,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}else{this.taskContext.logger.warn(cUu(t.package,this.#e.subpackageLocators));let f=t.slug??u$(t.package),u=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:f}),s=this.#d(t.contents,void 0,u,o);return{id:this.#f.get(i??`${this.apiDefinitionId}:${u$(t.package)}`),type:"apiPackage",children:s,title:t.title??t.package,slug:u.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:o,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}#_(t,r,n){let i=t.overviewAbsolutePath!=null?fl.V1.PageId(hoo(this.docsWorkspace,t.overviewAbsolutePath)):void 0,a=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,o=t.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(t.overviewAbsolutePath):void 0,c=this.#f.get(i??a??r.get()),f=t.referencedSubpackages.map(O=>{let P=this.#e.getSubpackageByIdOrLocator(O),C=P!=null?J8i.getSubpackageId(P):void 0;if(C===void 0){this.taskContext.logger.error(cUu(O,this.#e.subpackageLocators));return}return{subpackageId:C,locator:O}}).filter(O=>O!=null).filter(hj);this.#o.set(c,f.map(O=>O.subpackageId)),f.forEach(O=>{this.#a.has(O.subpackageId)&&this.taskContext.logger.error(lUu(O.locator)),this.#a.add(O.subpackageId)});let u=t.slug??u$(t.title),s=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:u}),l=t.availability??n,m=this.#d(t.contents,void 0,s,l);return{id:c,type:"apiPackage",children:m,title:t.title,slug:s.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:l,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:o,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}#y(t,r,n,i){t=t.trim();let a=this.#e.getSubpackageByIdOrLocator(t)??this.#e.getSubpackageByIdOrLocator($A(t));if(a!=null){let o=J8i.getSubpackageId(a),c=this.#f.get(`${this.apiDefinitionId}:${o}`);this.#a.has(o)&&this.taskContext.logger.error(lUu(t)),this.#a.add(o),this.#o.set(c,[o]);let f=hWr(a)?a.urlSlug:"",u=n.apply({urlSlug:f});return{id:c,type:"apiPackage",children:[],title:hWr(a)?a.displayName??poo(a.name):this.apiSection.title,slug:u.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:i,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}return this.#h({type:"endpoint",endpoint:t,title:void 0,icon:void 0,slug:void 0,hidden:void 0,availability:void 0,playground:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0},r,n,i)}#h(t,r,n,i){let a=(r!=null?this.#e.subpackages.get(mve.SubpackageId(r))?.endpoints.get(mve.EndpointId(t.endpoint)):void 0)??this.#e.endpointsByLocator.get(t.endpoint);if(a!=null){let f=this.#e.getEndpointId(a);if(f==null)this.taskContext.logger.debug(`Expected Endpoint ID for ${a.id} at path: ${uUu(a.method,a.path.parts)}. Got undefined.`);else{this.#t.has(f)&&this.taskContext.logger.error(`Duplicate endpoint found in the API Reference layout: ${f}`),this.#t.add(f);let u=t.slug!=null?n.append(t.slug):n.apply(a);return{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"endpoint",method:a.method,endpointId:f,apiDefinitionId:this.apiDefinitionId,availability:t.availability??fl.V1.convertAvailability(a.availability)??i,isResponseStream:a.response?.type.type==="stream",title:t.title??a.name??WPe(a.path.parts),slug:u.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}let o=(r!=null?this.#e.subpackages.get(mve.SubpackageId(r))?.webSockets.get(mve.WebSocketId(t.endpoint)):void 0)??this.#e.webSocketsByLocator.get(t.endpoint);if(o!=null){let f=this.#e.getWebSocketId(o);if(f==null)this.taskContext.logger.error(`Expected WebSocket ID for ${o.id}. Got undefined.`);else return this.#r.has(f)&&this.taskContext.logger.error(`Duplicate web socket found in the API Reference layout: ${f}`),this.#r.add(f),{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"webSocket",webSocketId:f,title:t.title??o.name??WPe(o.path.parts),slug:(t.slug!=null?n.append(t.slug):n.apply(o)).get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(o.availability)??i,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}let c=(r!=null?this.#e.subpackages.get(mve.SubpackageId(r))?.webhooks.get(mve.WebhookId(t.endpoint)):void 0)??this.#e.webhooks.get(fl.V1.WebhookId(t.endpoint));if(c!=null){let f=this.#e.getWebhookId(c);if(f==null)this.taskContext.logger.error(`Expected Webhook ID for ${c.id}. Got undefined.`);else return this.#n.has(f)&&this.taskContext.logger.error(`Duplicate webhook found in the API Reference layout: ${f}`),this.#n.add(f),{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"webhook",webhookId:f,method:c.method,title:t.title??c.name??(0,QPv.default)("/",...c.path),slug:(t.slug!=null?n.append(t.slug):n.apply(c)).get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:i,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}this.taskContext.logger.error("Unknown identifier in the API Reference layout: ",t.endpoint)}#g(t,r){return xPv({left:t,right:r,findEndpointById:n=>this.#e.endpoints.get(n),stringifyEndpointPathParts:n=>WPe(n.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}#m(t,r){return UUf({child:t,nodeIdToSubpackageId:this.#o,convertApiDefinitionPackageId:(n,i,a)=>this.#A(n,i,a),mergeAndFilterChildren:this.#g.bind(this)})}#O(t,r,n){let i=[];return t.endpoints.forEach(a=>{if(a.protocol?.type==="grpc"){let o=this.#e.getGrpcId(a);if(o==null){this.taskContext.logger.error(`Expected Grpc ID for ${a.id} at path: ${uUu(a.method,a.path.parts)}. Got undefined.`);return}if(this.#i.has(o))return;let c=r.apply(a);i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"grpc",grpcId:o,title:a.name??WPe(a.path.parts),method:a.protocol?.methodType??"UNARY",apiDefinitionId:this.apiDefinitionId,availability:n,slug:c.get(),icon:void 0,hidden:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}else{let o=this.#e.getEndpointId(a);if(o==null){this.taskContext.logger.debug(`Expected Endpoint ID for ${a.id} at path: ${uUu(a.method,a.path.parts)}. Got undefined.`);return}if(this.#t.has(o))return;let c=r.apply(a);i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"endpoint",method:a.method,endpointId:o,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(a.availability)??n,isResponseStream:a.response?.type.type==="stream",title:a.name??WPe(a.path.parts),slug:c.get(),icon:void 0,hidden:this.hideChildren,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}}),t.websockets.forEach(a=>{let o=this.#e.getWebSocketId(a);if(o==null){this.taskContext.logger.error(`Expected WebSocket ID for ${a.id}. Got undefined.`);return}this.#r.has(o)||i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"webSocket",webSocketId:o,title:a.name??WPe(a.path.parts),slug:r.apply(a).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(a.availability)??n,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.webhooks.forEach(a=>{let o=this.#e.getWebhookId(a);if(o==null){this.taskContext.logger.error(`Expected Webhook ID for ${a.id}. Got undefined.`);return}this.#n.has(o)||i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"webhook",webhookId:o,method:a.method,title:a.name??poo(a.id),slug:r.apply(a).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:n,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.subpackages.forEach(a=>{if(this.#a.has(a))return;let o=this.#e.getSubpackageByIdOrLocator(a);if(o==null){this.taskContext.logger.error(`Subpackage ${a} not found in ${this.apiDefinitionId}`);return}let c=hWr(o)?r.apply(o):r,f=this.#A(a,c,n);f.length>0&&i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${a}`),type:"apiPackage",children:f,title:hWr(o)?o.displayName??poo(o.name):this.apiSection.title,slug:c.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:n,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),i=this.mergeEndpointPairs(i),this.apiSection.alphabetized&&(i=i.sort((a,o)=>{let c=a.type==="endpointPair"?a.nonStream.title:a.title,f=o.type==="endpointPair"?o.nonStream.title:o.title;return c.localeCompare(f)})),i}#A(t,r,n){let i=t!=null?this.#e.resolveSubpackage(this.#e.getSubpackageByIdOrLocator(t)):void 0;return i==null?(this.taskContext.logger.debug(cUu(t||"unknown",[])),[]):this.#O(i,r,n)}#v(t){return CPv(t)}mergeEndpointPairs(t){return fUu({children:t,findEndpointById:r=>this.#e.endpoints.get(r),stringifyEndpointPathParts:r=>WPe(r.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}getFileId(t){let r=this.collectedFileIds.get(t);return r??this.taskContext.failAndThrow("Failed to locate file after uploading: "+t)}resolveIconFileId(t){if(t!=null)return this.collectedFileIds.has(t)?`file:${this.getFileId(t)}`:t}};var LPv=$i(require("crypto"),1);function stM(e){return LPv.default.createHash("sha256").update(e).digest("hex")}var pUu=class e{static init(){return new e}constructor(){}#e=new Map;#t=new Set;#r(t){let r=this.#e.get(t)??0;return this.#e.set(t,r+1),stM(r===0?t:`${t}-${r}`)}#n(t){let r=this.#r(t),n=0;for(;this.#t.has(r);)if(r=this.#r(t),n++,n>100)throw new Error(`Infinite loop detected for id: ${t}`);return r}get(t){return fl.V1.NodeId(this.#n(t))}};function UPv(e){return e==null?{}:{pythonSdk:e.python!=null?{package:typeof e.python=="string"?e.python:e.python.package,version:typeof e.python=="string"?void 0:e.python.version}:void 0,typescriptSdk:e.typescript!=null?{package:typeof e.typescript=="string"?e.typescript:e.typescript.package,version:typeof e.typescript=="string"?void 0:e.typescript.version}:void 0,goSdk:e.go!=null?{githubRepo:typeof e.go=="string"?e.go:e.go.package,version:typeof e.go=="string"?void 0:e.go.version}:void 0,javaSdk:e.java!=null?{coordinate:typeof e.java=="string"?e.java:e.java.package,version:typeof e.java=="string"?void 0:e.java.version}:void 0,rubySdk:e.ruby!=null?{gem:typeof e.ruby=="string"?e.ruby:e.ruby.package,version:typeof e.ruby=="string"?void 0:e.ruby.version}:void 0,csharpSdk:e.csharp!=null?{package:typeof e.csharp=="string"?e.csharp:e.csharp.package,version:typeof e.csharp=="string"?void 0:e.csharp.version}:void 0,phpSdk:e.php!=null?{package:typeof e.php=="string"?e.php:e.php.package,version:typeof e.php=="string"?void 0:e.php.version}:void 0,swiftSdk:e.swift!=null?{package:typeof e.swift=="string"?e.swift:e.swift.package,version:typeof e.swift=="string"?void 0:e.swift.version}:void 0,rustSdk:e.rust!=null?{package:typeof e.rust=="string"?e.rust:e.rust.package,version:typeof e.rust=="string"?void 0:e.rust.version}:void 0}}function VPv({auth:e,playgroundConfig:t,context:r}){if(e.schemes.length>0&&e.schemes[0]!=null){let n=e.schemes[0];return WPv({scheme:n,playgroundConfig:t,context:r})}}function WPv({scheme:e,playgroundConfig:t,context:r}){switch(e.type){case"basic":return{type:"basicAuth",passwordName:e.password.originalName,usernameName:e.username.originalName,description:e.docs};case"bearer":return{type:"bearerAuth",tokenName:e.token.originalName,description:e.docs};case"header":return{type:"header",headerWireValue:e.name.wireValue,nameOverride:e.name.name.originalName,prefix:e.prefix,description:e.docs};case"oauth":{let n=e.configuration.tokenEndpoint.responseProperties.accessToken.propertyPath?.map(i=>i.name.originalName).join(".")||"$.body.access_token";return t?.oauth?{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:ry.EndpointId(e.configuration.tokenEndpoint.endpointReference.endpointId),accessTokenLocator:ry.JqString(n),headerName:e.configuration.tokenHeader,tokenPrefix:e.configuration.tokenPrefix,description:e.docs}}}:{type:"bearerAuth",tokenName:"token",description:e.docs}}case"inferred":{e.tokenEndpoint.authenticatedRequestHeaders.length>1&&r.logger.warn("Inferred auth scheme has multiple authenticated request headers. Only the `Authentication` or first header will be pushed to FDR.");let n=e.tokenEndpoint.authenticatedRequestHeaders.find(a=>a.headerName.toLowerCase()==="authorization");if(n)return n.responseProperty.propertyPath!=null&&n.responseProperty.propertyPath.length>0&&r.logger.warn("Inferred Authentication header has a property path. The property wirevalue will be pushed to FDR without property path."),{type:"bearerAuth",tokenName:n.responseProperty.property.name.wireValue,description:e.docs};let i=e.tokenEndpoint.authenticatedRequestHeaders[0];return i?{type:"header",headerWireValue:i.headerName,prefix:i.valuePrefix,nameOverride:void 0,description:e.docs}:{type:"bearerAuth",tokenName:"token",description:e.docs}}default:ku(e)}}function GPv({auth:e,playgroundConfig:t,context:r}){let n={};for(let i of e.schemes){let a=WPv({scheme:i,playgroundConfig:t,context:r});a!=null&&(n[ry.AuthSchemeId(i.key)]=a)}return n}function JPv(e){return e._visit({alias:t=>({type:"alias",value:o4(t.aliasOf)}),enum:t=>({type:"enum",default:t.default!=null?t.default.name.wireValue:void 0,values:t.values.map(r=>({description:r.docs??void 0,value:r.name.wireValue,availability:fie(r.availability)}))}),object:t=>({type:"object",extends:t.extends.map(r=>ry.TypeId(r.typeId)),properties:t.properties.map(r=>({description:r.docs??void 0,key:ry.PropertyKey(r.name.wireValue),valueType:o4(r.valueType),availability:fie(r.availability),propertyAccess:r.propertyAccess})),extraProperties:ltM(t.extraProperties)}),union:t=>{let r=t.baseProperties.map(n=>({key:ry.PropertyKey(n.name.wireValue),valueType:o4(n.valueType),availability:fie(n.availability),description:n.docs,propertyAccess:n.propertyAccess}));return{type:"discriminatedUnion",discriminant:t.discriminant.wireValue,variants:t.types.map(n=>({description:n.docs??void 0,discriminantValue:n.discriminantValue.wireValue,displayName:n.displayName,availability:n.availability!=null?fie(n.availability):void 0,additionalProperties:np.types.SingleUnionTypeProperties._visit(n.shape,{samePropertiesAsObject:i=>({extends:[ry.TypeId(i.typeId)],properties:r,extraProperties:void 0}),singleProperty:i=>({extends:[],properties:[{key:ry.PropertyKey(i.name.wireValue),valueType:o4(i.type),description:void 0,availability:void 0,propertyAccess:void 0},...r],extraProperties:void 0}),noProperties:()=>({extends:[],properties:r,extraProperties:void 0}),_other:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+n.shape.propertiesType)}})}))}},undiscriminatedUnion:t=>({type:"undiscriminatedUnion",variants:t.members.map(r=>({typeName:r.type.type==="named"?r.type.name.originalName:void 0,description:r.docs??void 0,type:o4(r.type),availability:void 0,displayName:r.type.type==="named"?r.type.displayName:void 0}))}),_other:()=>{throw new Error("Unknown Type shape: "+e.type)}})}function o4(e){return e._visit({container:t=>np.types.ContainerType._visit(t,{list:r=>({type:"list",itemType:o4(r)}),map:({keyType:r,valueType:n})=>({type:"map",keyType:o4(r),valueType:o4(n)}),optional:r=>({type:"optional",itemType:o4(r),defaultValue:void 0}),nullable:r=>({type:"nullable",itemType:o4(r)}),set:r=>({type:"set",itemType:o4(r)}),literal:r=>np.types.Literal._visit(r,{boolean:n=>({type:"literal",value:{type:"booleanLiteral",value:n}}),string:n=>({type:"literal",value:{type:"stringLiteral",value:n}}),_other:()=>{throw new Error("Unknown literal type: "+r.type)}}),_other:()=>{throw new Error("Unknown container reference: "+t.type)}}),named:t=>({type:"id",value:ry.TypeId(t.typeId),default:void 0}),primitive:t=>({type:"primitive",value:np.types.PrimitiveTypeV1._visit(t.v1,{integer:()=>ctM(t.v2),float:()=>HPv(t.v2),double:()=>HPv(t.v2),string:()=>utM(t.v2),long:()=>({type:"long",default:t.v2?.type==="long"?t.v2.default:void 0,minimum:void 0,maximum:void 0}),boolean:()=>({type:"boolean",default:t.v2?.type==="boolean"?t.v2.default:void 0}),dateTime:()=>({type:"datetime",default:void 0}),date:()=>({type:"date",default:void 0}),uuid:()=>({type:"uuid",default:void 0}),base64:()=>({type:"base64",mimeType:void 0,default:void 0}),bigInteger:()=>({type:"bigInteger",default:t.v2?.type==="bigInteger"?t.v2.default:void 0}),uint:()=>({type:"uint"}),uint64:()=>({type:"uint64"}),_other:()=>{throw new Error("Unknown primitive: "+t.v1)}})}),unknown:()=>({type:"unknown"}),_other:()=>{throw new Error("Unknown Type reference: "+e.type)}})}function utM(e){let t=e!=null&&e.type==="string"?e.validation:void 0;return{type:"string",format:t?.format,regex:t?.pattern,minLength:t?.minLength,maxLength:t?.maxLength,default:e!=null&&e.type==="string"?e.default:void 0}}function ctM(e){let t=e!=null&&e.type==="integer"?e.validation:void 0;return{type:"integer",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="integer"?e.default:void 0}}function HPv(e){let t=e!=null&&e.type==="double"?e.validation:void 0;return{type:"double",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="double"?e.default:void 0}}function ltM(e){return typeof e=="boolean"?e?Bh.unknown():void 0:typeof e=="string"?{type:"id",value:ry.TypeId(e),default:void 0}:o4(e)}function GUf(e,t){let r=e.service!=null?t.services[e.service]:void 0,n=e.webhooks!=null?t.webhookGroups[e.webhooks]:void 0,i=e.websocket!=null&&t.websocketChannels!=null?t.websocketChannels[e.websocket]:void 0;return{endpoints:r!=null?dtM(r,t):[],webhooks:n!=null?ftM(n):[],websockets:i!=null?[ptM(i,t)]:[],types:e.types.map(a=>ry.TypeId(a)),subpackages:e.subpackages.map(a=>ry.api.v1.SubpackageId(a)),pointsTo:e.navigationConfig!=null?ry.api.v1.SubpackageId(e.navigationConfig.pointsTo):void 0}}function ftM(e){return e.map(t=>{let r=[];return t.v2Examples!=null?(r.push(...Object.values(t.v2Examples.userSpecifiedExamples)),r.push(...Object.values(t.v2Examples.autogeneratedExamples))):r.push(...t.examples?.map(n=>({payload:n.payload.jsonExample}))??[]),{description:t.docs??void 0,id:ry.WebhookId(t.name.originalName),path:[],method:t.method,name:t.displayName??uia(t.name.originalName),headers:t.headers.map(n=>({description:n.docs??void 0,key:n.name.wireValue,type:o4(n.valueType),availability:fie(n.availability)})),payload:OtM(t.payload),examples:r}})}function dtM(e,t){let r=[];for(let n of e.endpoints){let i=n.autogeneratedExamples[0],a=[];if(n.v2Examples!=null){let c,f=n.v2Examples.userSpecifiedExamples,u=n.v2Examples.autogeneratedExamples,s=Object.values(f).map(m=>m.response?.statusCode).filter((m,O,P)=>P.indexOf(m)!==O).length>0;for(let[m,O]of Object.entries(f))c=YPv({shouldUseExampleName:s,exampleName:O.displayName??m,example:O,irEndpoint:n,irService:e,ir:t}),c!=null&&a.push(c);let l=Object.values(u).map(m=>m.response?.statusCode).filter((m,O,P)=>P.indexOf(m)!==O).length>0;for(let[m,O]of Object.entries(u))c=YPv({shouldUseExampleName:l,exampleName:O.displayName??m,example:O,irEndpoint:n,irService:e,ir:t}),c!=null&&a.push(c)}else if(n.userSpecifiedExamples.length>0)a.push(...n.userSpecifiedExamples.map(c=>WUf({userSpecifiedExample:c,...i!=null&&{autogeneratedExample:i},irEndpoint:n,ir:t})).filter(hj));else if(i!=null){let c=WUf({autogeneratedExample:i,irEndpoint:n,ir:t});c!=null&&a.push(c)}else if(n.response?.body?.type==="fileDownload"){let c=gro({ir:t,service:e,endpoint:{...n,response:void 0},typeDeclarations:t.types,skipOptionalRequestProperties:!0,generationResponse:{type:"success"}});if(c.type==="success"){let f=WUf({autogeneratedExample:c,irEndpoint:n,ir:t});if(f!=null){let u={...f,responseBodyV3:{type:"filename",value:"<bytes>"}};a.push(u)}}}let o={slug:void 0,availability:fie(n.availability??e.availability),auth:n.auth,authV2:_tM(n.security),description:n.docs??void 0,method:btM(n.method),defaultEnvironment:t.environments?.defaultEnvironment!=null?ry.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?htM({environmentsConfig:t.environments,endpoint:n}):void 0,id:ry.EndpointId(n.name.originalName),originalEndpointId:n.id,name:n.displayName??uia(n.name.originalName),path:n.basePath!=null?{pathParameters:n.pathParameters.map(c=>({description:c.docs??void 0,key:ry.PropertyKey(c.name.originalName),type:o4(c.valueType),availability:void 0})),parts:[...yoo(n.basePath),...yoo(n.path)]}:{pathParameters:[...t.pathParameters,...e.pathParameters,...n.pathParameters].map(c=>({description:c.docs??void 0,key:ry.PropertyKey(c.name.originalName),type:o4(c.valueType),availability:void 0})),parts:[...t.basePath!=null?yoo(t.basePath):[],...yoo(e.basePath),...yoo(n.path)]},queryParameters:n.queryParameters.map(c=>({description:c.docs??void 0,key:c.name.wireValue,type:o4(c.valueType),availability:fie(c.availability)})),headers:[...e.headers,...n.headers].map(c=>({description:c.docs??void 0,key:c.name.wireValue,type:o4(c.valueType),availability:fie(c.availability)})),request:n.requestBody!=null?KPv(n.requestBody):void 0,requestsV2:{requests:n.v2RequestBodies?.requestBodies?.map(KPv).filter(hj)},response:n.response!=null?$Pv(n.response):void 0,responsesV2:{responses:n.v2Responses?.responses?.map($Pv).filter(hj)},errors:void 0,errorsV2:gtM(n.errors,t),examples:a,protocol:n.source?._visit({openapi:()=>({type:"rest"}),openrpc:()=>({type:"openrpc",methodName:n.id}),proto:c=>({type:"grpc",methodName:n.id,methodType:c.methodType}),_other:()=>{}}),includeInApiExplorer:void 0};r.push(o)}return r}function ptM(e,t){let r=[];if(e.v2Examples!=null&&(Object.keys(e.v2Examples.userSpecifiedExamples).length>0||Object.keys(e.v2Examples.autogeneratedExamples).length>0)){let n=Object.values(e.v2Examples.userSpecifiedExamples),i=Object.values(e.v2Examples.autogeneratedExamples),a=n.length>0?n[0]:i[0];a!=null&&r.push({name:"",description:"",path:a.baseUrl??"",pathParameters:a.pathParameters??{},queryParameters:a.queryParameters??{},headers:a.headers??{},messages:a.messages?.map(o=>({type:ry.api.v1.WebSocketMessageId(o.type),body:o.body}))??[]})}else r=e.examples.map(n=>({name:n.name?.originalName,description:n.docs,path:n.url,pathParameters:n.pathParameters.reduce((i,a)=>(i[ry.PropertyKey(a.name.originalName)]=a.value.jsonExample,i),{}),queryParameters:n.queryParameters.reduce((i,a)=>(i[a.name.wireValue]=a.value.jsonExample,i),{}),headers:n.headers.reduce((i,a)=>(i[a.name.wireValue]=a.value.jsonExample,i),{}),messages:n.messages.map(i=>({type:ry.api.v1.WebSocketMessageId(i.type),body:i.body.jsonExample}))}));return{auth:e.auth,availability:fie(e.availability),description:e.docs??void 0,defaultEnvironment:t.environments?.defaultEnvironment!=null?ry.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?ytM({environmentsConfig:t.environments,channel:e}):[],id:ry.WebSocketId(e.name.originalName),name:e.displayName??uia(e.name.originalName),path:{pathParameters:e.pathParameters.map(n=>({description:n.docs??void 0,key:ry.PropertyKey(n.name.originalName),type:o4(n.valueType),availability:void 0})),parts:yoo(e.path)},headers:e.headers.map(n=>({key:n.name.wireValue,type:o4(n.valueType),description:n.docs,availability:fie(n.availability)})),queryParameters:e.queryParameters.map(n=>({description:n.docs??void 0,key:n.name.wireValue,type:o4(n.valueType),availability:fie(n.availability)})),messages:e.messages.map(n=>({type:ry.api.v1.WebSocketMessageId(n.type),displayName:n.displayName,origin:n.origin,body:AtM(n.body),description:n.docs,availability:fie(n.availability)})),examples:r}}function _tM(e){if(e==null)return;if(e.length===0)return[];let t=new Set(e.flatMap(r=>Object.keys(r)));return Array.from(t).map(r=>ry.AuthSchemeId(r))}function fie(e){if(e!=null)switch(e.status){case"DEPRECATED":return ry.Availability.Deprecated;case"PRE_RELEASE":return ry.Availability.Beta;case"GENERAL_AVAILABILITY":return ry.Availability.GenerallyAvailable;case"IN_DEVELOPMENT":return ry.Availability.Beta;default:ku(e.status)}}function htM({environmentsConfig:e,endpoint:t}){let r=e.environments,n=t.baseUrl,i=t.v2BaseUrls;switch(r.type){case"singleBaseUrl":return r.environments.map(a=>({id:ry.EnvironmentId(a.id),baseUrl:a.url}));case"multipleBaseUrls":if(i!=null)return i.flatMap(o=>r.environments.map(c=>{let f=c.urls[o];if(f==null)throw new Error(`Encountered undefined server name "${o}" at endpoint ${t.method.toUpperCase()} ${t.path}. Expected environment ${c.id} to contain url for ${o}`);return{id:ry.EnvironmentId(o),baseUrl:f}})).filter((o,c,f)=>c===f.findIndex(u=>u.id===o.id&&u.baseUrl===o.baseUrl));if(n==null)throw new Error(`Expected endpoint ${t.name.originalName} to have base url.`);return r.environments.map(a=>{let o=a.urls[n];if(o==null)throw new Error(`Encountered undefined server name "${n}" at endpoint ${t.method.toUpperCase()} ${t.path.head}. Expected environment ${a.id} to contain url for ${n}`);return{id:ry.EnvironmentId(a.id),baseUrl:o}});default:ku(r)}}function ytM({environmentsConfig:e,channel:t}){let r=e.environments,n=t.baseUrl;switch(r.type){case"singleBaseUrl":return r.environments.map(i=>({id:ry.EnvironmentId(i.id),baseUrl:vtM(i.url,"wss")}));case"multipleBaseUrls":if(n==null)throw new Error(`Expected channel ${t.name.originalName} to have base url.`);return r.environments.map(i=>{let a=i.urls[n];if(a==null)throw new Error(`Encountered undefined server name ${a} at channel ${t.name.originalName} ${t.path.head}. Expected environment ${i.id} to contain url for ${n}`);return{id:ry.EnvironmentId(i.id),baseUrl:a}});default:ku(r)}}function vtM(e,t){return e.replace(/^[^:]+/,t)}function btM(e){return np.http.HttpMethod._visit(e,{get:()=>ry.HttpMethod.Get,post:()=>ry.HttpMethod.Post,put:()=>ry.HttpMethod.Put,patch:()=>ry.HttpMethod.Patch,delete:()=>ry.HttpMethod.Delete,head:()=>ry.HttpMethod.Head,_other:()=>{throw new Error("Unknown http method: "+e)}})}function yoo(e){let t=e.parts.flatMap(r=>[{type:"pathParameter",value:ry.PropertyKey(r.pathParameter)},{type:"literal",value:r.tail}]);return[{type:"literal",value:e.head},...t]}function KPv(e){let t=np.http.HttpRequestBody._visit(e,{inlinedRequestBody:r=>({type:"json",contentType:r.contentType??T8.APPLICATION_JSON,shape:{type:"object",extends:r.extends.map(n=>ry.TypeId(n.typeId)),properties:r.properties.map(n=>({description:n.docs??void 0,key:ry.PropertyKey(n.name.wireValue),valueType:o4(n.valueType),availability:fie(n.availability),propertyAccess:n.propertyAccess})),extraProperties:r.extraProperties?{type:"unknown"}:void 0}}),reference:r=>({type:"json",contentType:r.contentType??T8.APPLICATION_JSON,shape:{type:"reference",value:o4(r.requestBodyType)},description:r.docs??void 0}),fileUpload:r=>({type:"fileUpload",value:{name:r.name.originalName,description:void 0,availability:void 0,properties:r.properties.map(n=>n._visit({file:i=>{let a=i._visit({file:o=>({type:"file",key:ry.PropertyKey(o.key.wireValue),isOptional:o.isOptional,contentType:o.contentType,description:o.docs??void 0,availability:void 0}),fileArray:o=>({type:"fileArray",key:ry.PropertyKey(o.key.wireValue),isOptional:o.isOptional,contentType:o.contentType,description:o.docs??void 0,availability:void 0}),_other:()=>{}});if(a!=null)return{type:"file",value:a}},bodyProperty:i=>({type:"bodyProperty",key:ry.PropertyKey(i.name.wireValue),valueType:o4(i.valueType),contentType:i.contentType,description:i.docs??void 0,availability:fie(i.availability),exploded:i.style==="exploded",propertyAccess:void 0}),_other:()=>{}})).filter(hj)},contentType:r.contentType,description:r.docs??void 0}),bytes:r=>({type:"bytes",description:r.docs??void 0,availability:void 0,isOptional:r.isOptional,contentType:r.contentType}),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}});return t!=null?{type:t,description:e.docs}:void 0}function $Pv(e){if(e.body==null)return;let t,r=np.http.HttpResponseBody._visit(e.body,{fileDownload:n=>(t=n.docs,{type:"fileDownload",contentType:void 0}),json:n=>(t=n.docs,{type:"reference",value:o4(n.responseBodyType)}),text:()=>{},bytes:()=>{},streamParameter:()=>{},streaming:n=>{if(n.type==="text")return t=n.docs,{type:"streamingText"};if(n.type==="json")return t=n.docs,{type:"stream",shape:{type:"reference",value:o4(n.payload)},terminator:n.terminator};if(n.type==="sse")return t=n.docs,{type:"stream",shape:{type:"reference",value:o4(n.payload)},terminator:n.terminator}},_other:()=>{throw new Error("Unknown HttpResponse: "+e.body)}});return r!=null?{type:r,statusCode:e.statusCode,description:t}:e.statusCode!=null?{statusCode:e.statusCode,description:t,type:{type:"object",extends:[],properties:[],extraProperties:void 0}}:void 0}function gtM(e,t){let r=[];if(t.errorDiscriminationStrategy.type==="statusCode")for(let n of e){let i=t.errors[n.error.errorId];i&&r.push({type:i.type==null?void 0:{type:"alias",value:o4(i.type)},statusCode:i.statusCode,description:i.docs??void 0,name:i.displayName??i.name.name.originalName,availability:void 0,examples:PtM(i)})}else for(let n of e){let i=t.errors[n.error.errorId];if(i){let a=[{key:ry.PropertyKey(t.errorDiscriminationStrategy.discriminant.wireValue),valueType:{type:"literal",value:{type:"stringLiteral",value:i.discriminantValue.name.originalName}},description:i.docs,availability:void 0,propertyAccess:void 0}];i.type!=null&&a.push({key:ry.PropertyKey(t.errorDiscriminationStrategy.contentProperty.wireValue),valueType:o4(i.type),description:i.docs,availability:void 0,propertyAccess:void 0}),r.push({type:i.type==null?void 0:{type:"object",extends:[],properties:a,extraProperties:void 0},statusCode:i.statusCode,description:i.docs??void 0,availability:void 0,name:i.displayName??i.name.name.originalName,examples:i.examples.map(o=>({name:o.name?.originalName,responseBody:{type:"json",value:o.jsonExample},description:o.docs}))})}}return r}function YPv({shouldUseExampleName:e,exampleName:t,example:r,irEndpoint:n,irService:i,ir:a}){if(r==null)return;let o=u=>{if(u.valueType.type==="container"&&u.valueType.container.type==="literal")return u.valueType.container.literal._visit({boolean:s=>`${s}`,string:s=>s,_other:()=>{}});if(u.valueType.type==="container"&&u.valueType.container.type==="optional"&&u.valueType.container.optional.type==="container"&&u.valueType.container.optional.container.type==="literal")return u.valueType.container.optional.container.literal._visit({boolean:s=>`${s}`,string:s=>s,_other:()=>{}})},c={};a.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)}),i.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)}),n.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)});let f=r.response?.body!=null?r.response.body.value:void 0;return{name:e?t:void 0,description:"",path:r.request?.endpoint.path??"",pathParameters:r.request?.pathParameters??{},queryParameters:r.request?.queryParameters??{},headers:(()=>{let s={...r.request?.headers??{}};for(let[l,m]of Object.entries(c))(s[l]===null||s[l]===void 0)&&(s[l]=m);return s})(),requestBody:r.request?.requestBody,requestBodyV3:n.requestBody?._visit({inlinedRequestBody:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,reference:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,fileUpload:u=>{if(r.request==null)return;let s={};if(QD(r.request.requestBody)){let l=r.request.requestBody;for(let m of u.properties)m._visit({file:O=>{let P=l[O.key.wireValue];if(O.type==="file")s[O.key.wireValue]={type:"filename",value:typeof P=="string"?P:"<file1>"};else if(O.type==="fileArray"){let C=(Array.isArray(P)?P:[P]).filter(I=>typeof I=="string");s[O.key.wireValue]={type:"filenames",value:C}}},bodyProperty:O=>{if(O.style==="exploded"){let P=l[O.name.wireValue];s[O.name.wireValue]={type:"exploded",value:Array.isArray(P)?P:[P]}}else s[O.name.wireValue]={type:"json",value:l[O.name.wireValue]}},_other:Ddt})}return{type:"form",value:s}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??n.response?.statusCode??200,responseBody:f??void 0,responseBodyV3:f!=null?r.response?.body?._visit({json:u=>({type:"json",value:u}),stream:u=>Array.isArray(u)&&u.length>0&&u.every(mtM)?{type:"sse",value:u}:{type:"stream",value:u},error:()=>{},_other:()=>{throw new Error("Unknown ExampleResponseBody: "+r.response?.body?.type)}}):void 0,codeSamples:r.codeSamples?.map(u=>({name:u.name,description:u.docs??void 0,install:void 0,language:u.language,code:u.code})).filter(hj)}}function mtM(e){return typeof e=="object"&&e!==null&&"event"in e&&typeof e?.event=="string"&&"data"in e}function WUf({userSpecifiedExample:e,autogeneratedExample:t,irEndpoint:r,ir:n}){let i=n.headers.map(c=>{let f;if(c.valueType.type==="container"&&c.valueType.container.type==="literal"?f=c.valueType.container.literal._visit({boolean:u=>`${u}`,string:u=>u,_other:()=>{}}):c.valueType.type==="container"&&c.valueType.container.type==="optional"&&c.valueType.container.optional.type==="container"&&c.valueType.container.optional.container.type==="literal"&&(f=c.valueType.container.optional.container.literal._visit({boolean:u=>`${u}`,string:u=>u,_other:()=>{}})),f!=null)return{name:c.name,value:{jsonExample:f,shape:np.ExampleTypeReferenceShape.primitive(np.ExamplePrimitive.string({original:f}))}}}).filter(hj),a=e?.example??t?.example;if(a==null)return;let{codeSamples:o}=e??{codeSamples:[]};return{name:a.name?.originalName,description:a.docs,path:a.url,pathParameters:[...a.rootPathParameters,...a.servicePathParameters,...a.endpointPathParameters].reduce((c,f)=>(c[ry.PropertyKey(f.name.originalName)]=f.value.jsonExample,c),{}),queryParameters:a.queryParameters.reduce((c,f)=>(c[f.name.wireValue]=f.value.jsonExample,c),{}),headers:[...i,...a.serviceHeaders,...a.endpointHeaders].reduce((c,f)=>(c[f.name.wireValue]=f.value.jsonExample,c),{}),requestBody:a.request?.jsonExample,requestBodyV3:r.requestBody?._visit({inlinedRequestBody:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,reference:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,fileUpload:c=>{if(a.request==null)return;let f={};if(QD(a.request.jsonExample)){let u=a.request.jsonExample;for(let s of c.properties)s._visit({file:l=>{let m=u[l.key.wireValue];if(l.type==="file")f[l.key.wireValue]={type:"filename",value:typeof m=="string"?m:"<file1>"};else if(l.type==="fileArray"){let O=(Array.isArray(m)?m:[m]).filter(P=>typeof P=="string");f[l.key.wireValue]={type:"filenames",value:O}}},bodyProperty:l=>{if(l.style==="exploded"){let m=u[l.name.wireValue];f[l.name.wireValue]={type:"exploded",value:Array.isArray(m)?m:[m]}}else f[l.name.wireValue]={type:"json",value:u[l.name.wireValue]}},_other:Ddt})}return{type:"form",value:f}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??np.http.ExampleResponse._visit(a.response,{ok:c=>c._visit({body:f=>f!=null?200:204,stream:f=>f.length>0?200:204,sse:f=>f.length>0?200:204,_other:()=>{throw new Error("Unknown ExampleResponseBody: "+c.type)}}),error:({error:c})=>{let f=n.errors[c.errorId];if(f==null)throw new Error("Cannot find error "+c.errorId);return f.statusCode},_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),responseBody:a.response._visit({ok:c=>c._visit({body:f=>f?.jsonExample,stream:()=>{},sse:()=>{},_other:()=>{}}),error:c=>c.body?.jsonExample,_other:()=>{}}),responseBodyV3:a.response._visit({ok:c=>c._visit({body:f=>f!=null?{type:"json",value:f.jsonExample}:void 0,stream:f=>({type:"stream",value:f.map(u=>u.jsonExample)}),sse:f=>({type:"sse",value:f.map(({event:u,data:s})=>({event:u,data:s.jsonExample}))}),_other:()=>{throw new Error("Unknown ExampleResponseBody: "+c.type)}}),error:c=>c.body!=null?{type:"json",value:c.body.jsonExample}:void 0,_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),codeSamples:o?.map(c=>Drt._visit(c,{language:f=>({language:f.language,code:f.code,name:f.name?.originalName,description:f.docs??void 0,install:f.install}),sdk:f=>({language:f.sdk,code:f.code,name:f.name?.originalName,description:f.docs??void 0,install:void 0}),_other:()=>{}})).filter(hj)}}function OtM(e){switch(e.type){case"inlinedPayload":return{type:{type:"object",extends:e.extends.map(t=>ry.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:ry.PropertyKey(t.name.wireValue),valueType:o4(t.valueType),availability:fie(t.availability),propertyAccess:void 0})),extraProperties:void 0},description:void 0};case"reference":return{type:{type:"reference",value:o4(e.payloadType)},description:e.docs};default:ku(e)}}function AtM(e){switch(e.type){case"inlinedBody":return{type:"object",extends:e.extends.map(t=>ry.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:ry.PropertyKey(t.name.wireValue),valueType:o4(t.valueType),availability:fie(t.availability),propertyAccess:void 0})),extraProperties:void 0};case"reference":return{type:"reference",value:o4(e.bodyType)};default:ku(e)}}function PtM(e){let t=e.v2Examples?.userSpecifiedExamples,r=e.v2Examples?.autogeneratedExamples,n=e.examples;return t!=null&&Object.keys(t).length>0?Object.entries(t).map(([i,a])=>({name:i,responseBody:{type:"json",value:a},description:void 0})):r!=null&&Object.keys(r).length>0?Object.entries(r).map(([i,a])=>({name:i,responseBody:{type:"json",value:a},description:void 0})):n.length>0?n.map(i=>({name:i.name?.originalName,responseBody:{type:"json",value:i.jsonExample},description:i.docs})):[]}function UCe({ir:e,snippetsConfig:t,playgroundConfig:r,context:n}){let i={types:{},subpackages:{},rootPackage:GUf(e.rootPackage,e),auth:VPv({auth:e.auth,playgroundConfig:r,context:n}),authSchemes:GPv({auth:e.auth,playgroundConfig:r,context:n}),snippetsConfiguration:t,globalHeaders:e.headers.map(a=>({availability:fie(a.availability),description:a.docs??void 0,key:a.name.wireValue,type:o4(a.valueType)})),navigation:void 0};for(let[a,o]of Object.entries(e.types))i.types[ry.TypeId(a)]={description:o.docs??void 0,name:o.name.name.originalName,shape:JPv(o.shape),availability:fie(o.availability),displayName:o.name.displayName};for(let[a,o]of Object.entries(e.subpackages)){let c=o.service!=null?e.services[o.service]:void 0;i.subpackages[ry.api.v1.SubpackageId(a)]={subpackageId:ry.api.v1.SubpackageId(a),displayName:c?.displayName??o.displayName,name:o.name.originalName,description:o.docs??void 0,...GUf(o,e)}}return i}async function HUf({organization:e,workspace:t,context:r,token:n,audiences:i,snippetsConfig:a,playgroundConfig:o}){let c=xG({workspace:t,audiences:i,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1},readme:void 0,version:void 0,packageName:void 0,context:r,sourceResolver:new FG(r,t)}),f=rua({token:n.value}),u=UCe({ir:c,snippetsConfig:a,playgroundConfig:o,context:r}),s=await f.api.v1.register.registerApiDefinition({orgId:ry.OrgId(e),apiId:ry.ApiId(c.apiName.originalName),definition:u});if(s.ok)return r.logger.debug(`Registered API Definition ${s.body.apiDefinitionId}`),{id:s.body.apiDefinitionId,ir:c};switch(s.error.error){case"UnauthorizedError":case"UserNotInOrgError":return r.failAndThrow("You do not have permissions to register the docs. Reach out to support@buildwithfern.com");default:return r.failAndThrow("Failed to register API",s.error)}}var wtM=new dfu({snippetsBySdkId:{},snippetsConfigWithSdkId:{},snippetTemplatesByEndpoint:{},snippetsBySdkIdAndEndpointId:{},snippetTemplatesByEndpointId:{}});function jns({ir:e,apiDefinitionId:t,playgroundConfig:r,context:n}){return pfu(lfu(UCe({ir:e,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0,phpSdk:void 0,swiftSdk:void 0,rustSdk:void 0},playgroundConfig:r,context:n}),mve.ApiDefinitionId(t),wtM))}var XPv=$i(require("path"),1);async function nyt({iconPath:e,filepaths:t}){e!=null&&typeof e=="string"&&XPv.default.isAbsolute(e)&&t.add(e)}async function ZPv({parsedDocsConfig:e}){let t=new Set;return e.logo?.dark!=null&&t.add(e.logo.dark),e.logo?.light!=null&&t.add(e.logo.light),e.favicon!=null&&t.add(e.favicon),e.backgroundImage?.dark!=null&&t.add(e.backgroundImage.dark),e.backgroundImage?.light!=null&&t.add(e.backgroundImage.light),e.metadata?.["og:image"]!=null&&e.metadata["og:image"].type==="filepath"&&t.add(e.metadata["og:image"].value),e.metadata?.["og:logo"]!=null&&e.metadata["og:logo"].type==="filepath"&&t.add(e.metadata["og:logo"].value),e.metadata?.["twitter:image"]!=null&&e.metadata["twitter:image"].type==="filepath"&&t.add(e.metadata["twitter:image"].value),e.typography?.bodyFont!=null&&e.typography.bodyFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.typography?.headingsFont!=null&&e.typography.headingsFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.typography?.codeFont!=null&&e.typography.codeFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.navigation.type==="productgroup"&&e.navigation.products.forEach(n=>{n.image!=null&&t.add(n.image)}),(await JUf({navigation:e.navigation})).forEach(n=>{t.add(n)}),e.navbarLinks&&await Promise.all(e.navbarLinks.map(async n=>{n.type==="dropdown"&&n.links.map(async i=>{i.icon&&await nyt({iconPath:i.icon,filepaths:t}),i.rightIcon&&await nyt({iconPath:i.rightIcon,filepaths:t})}),n.type!=="github"&&(n.icon&&await nyt({iconPath:n.icon,filepaths:t}),n.rightIcon&&await nyt({iconPath:n.rightIcon,filepaths:t}))})),e.js!=null&&e.js.files.forEach(n=>{t.add(n.absolutePath)}),t}async function JUf({navigation:e}){let t=new Set;switch(e.type){case"untabbed":await Promise.all(e.items.map(r=>voo({item:r,filepaths:t})));break;case"tabbed":await Promise.all(e.items.map(async r=>{r.icon!=null&&await nyt({iconPath:r.icon,filepaths:t}),r.child.type==="layout"&&r.child.layout!=null?await Promise.all(r.child.layout.map(n=>voo({item:n,filepaths:t}))):r.child.type==="variants"&&r.child.variants!=null&&await Promise.all(r.child.variants.flatMap(n=>{let i=[];return n.icon!=null&&i.push(nyt({iconPath:n.icon,filepaths:t})),i.push(...n.layout.map(a=>voo({item:a,filepaths:t}))),i}))}));break;case"versioned":await Promise.all(e.versions.map(async r=>{r.landingPage!=null&&await voo({item:r.landingPage,filepaths:t}),(await JUf({navigation:r.navigation})).forEach(i=>t.add(i))}));break;case"productgroup":await Promise.all(e.products.map(async r=>{r.icon!=null&&await nyt({iconPath:r.icon,filepaths:t}),r.type==="internal"&&(r.landingPage!=null&&await voo({item:r.landingPage,filepaths:t}),(await JUf({navigation:r.navigation})).forEach(i=>t.add(i)))}));break}return t}async function voo({item:e,filepaths:t}){switch(e.type){case"page":e.icon!=null&&await nyt({iconPath:e.icon,filepaths:t});break;case"section":e.icon!=null&&await nyt({iconPath:e.icon,filepaths:t}),await Promise.all(e.contents.map(r=>voo({item:r,filepaths:t})));break;case"apiSection":e.icon!=null&&await nyt({iconPath:e.icon,filepaths:t});break;case"link":e.icon!=null&&await nyt({iconPath:e.icon,filepaths:t});break;case"changelog":e.icon!=null&&await nyt({iconPath:e.icon,filepaths:t});break}}async function kPv({navigation:e,apiWorkspaces:t,visitor:r,context:n}){EtM(e)?await Promise.all(e.map(async i=>{StM(i)?await Promise.all(i.layout.map(async a=>{await _Uu({navigationItem:a,visitor:r,apiWorkspaces:t,context:n})})):DtM(i)&&await Promise.all(i.variants.flatMap(a=>a.layout.map(async o=>{await _Uu({navigationItem:o,visitor:r,apiWorkspaces:t,context:n})})))})):await Promise.all(e.map(async i=>{await _Uu({navigationItem:i,visitor:r,apiWorkspaces:t,context:n})}))}async function _Uu({navigationItem:e,visitor:t,apiWorkspaces:r,context:n}){if(await j2r(e,{alphabetized:Tc,api:Tc,apiName:Tc,audiences:Tc,displayErrors:Tc,snippets:Tc,summary:Tc,title:Tc,layout:Tc,collapsed:Tc,icon:Tc,slug:Tc,hidden:Tc,skipSlug:Tc,paginated:Tc,playground:Tc,flattened:Tc,path:Tc,page:Tc,featureFlag:Tc,openrpc:Tc,postman:Tc,contents:async i=>{i!=null&&await Promise.all(i.map(async a=>{await _Uu({navigationItem:a,visitor:t,apiWorkspaces:r,context:n})}))},viewers:Tc,orphaned:Tc,availability:Tc}),jtM(e)){let i=r.find(a=>a.workspaceName===e.apiName);i!=null&&await t.apiSection?.({config:e,workspace:i,context:n})}}function jtM(e){return e.api!=null}function EtM(e){return e[0]?.tab!=null}function StM(e){return"layout"in e&&Array.isArray(e.layout)}function DtM(e){return"variants"in e&&Array.isArray(e.variants)}function Lse(e){return e.startsWith("https://")||e.startsWith("http://")?e:`https://${e}`}twv.default.extend(rwv.default);var CtM=e=>e.map(t=>({...t,fileId:String(t.relativeFilePath)})),ewv=0,ItM=async({ir:e})=>(ewv++,`${e.apiName.snakeCase.unsafeName}-${ewv}`),Kqr=class{domain;docsWorkspace;ossWorkspaces;apiWorkspaces;taskContext;editThisPage;uploadFiles;registerApi;targetAudiences;constructor({domain:t,docsWorkspace:r,ossWorkspaces:n,apiWorkspaces:i,taskContext:a,editThisPage:o,uploadFiles:c=CtM,registerApi:f=ItM,targetAudiences:u}){this.domain=t,this.docsWorkspace=r,this.ossWorkspaces=n,this.apiWorkspaces=i,this.taskContext=a,this.editThisPage=o,this.uploadFiles=c,this.registerApi=f,this.targetAudiences=u}#e=pUu.init();shouldIncludeByAudience(t){return!t||t.length===0||!this.targetAudiences||this.targetAudiences.length===0?!0:t.some(r=>this.targetAudiences?.includes(r))}applyAudienceFiltering(t){let r=this.filterNavigationByAudience(t.navigation);return{...t,navigation:r}}filterNavigationByAudience(t){return t.type==="untabbed"||t.type==="tabbed"?t:t.type==="versioned"?{...t,versions:t.versions.filter(r=>this.shouldIncludeByAudience(this.getRawVersionAudiences(r.version)))}:t.type==="productgroup"?{...t,products:t.products.filter(r=>{let n=this.getRawProductAudiences(r.product);return this.shouldIncludeByAudience(n)})}:t}getRawProductAudiences(t){let n=this.docsWorkspace.config.products?.find(i=>i.displayName===t);return fHo(n?.audiences)}getRawVersionAudiences(t){let n=this.docsWorkspace.config.versions?.find(i=>i.displayName===t);return fHo(n?.audiences)}_parsedDocsConfig;get parsedDocsConfig(){if(this._parsedDocsConfig==null)throw new Error("parsedDocsConfig is not set");return this._parsedDocsConfig}collectedFileIds=new Map;markdownFilesToFullSlugs=new Map;markdownFilesToNoIndex=new Map;markdownFilesToTags=new Map;rawMarkdownFiles={};async resolve(){this._parsedDocsConfig=await Wuf({rawDocsConfiguration:this.docsWorkspace.config,context:this.taskContext,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absoluteFilepathToDocsConfig:this.docsWorkspace.absoluteFilepathToDocsConfig}),this.targetAudiences&&this.targetAudiences.length>0&&(this._parsedDocsConfig=this.applyAudienceFiltering(this._parsedDocsConfig));for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.rawMarkdownFiles[ru.of(l)]=m;let t=this.parsedDocsConfig.experimental?.openapiParserV3,r=t!=null&&!t;this.docsWorkspace.config.navigation!=null&&r&&await kPv({navigation:this.docsWorkspace.config.navigation,visitor:{apiSection:async({workspace:l})=>{(await l.toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,preserveSchemaIds:!0,objectQueryParameters:!0,respectReadonlySchemas:!0})).changelog?.files.forEach(O=>{let P=P3(this.docsWorkspace.absoluteFilePath,O.absoluteFilepath);this.parsedDocsConfig.pages[P]=O.contents,this.rawMarkdownFiles[ru.of(P)]=O.contents})}},apiWorkspaces:this.apiWorkspaces,context:this.taskContext}),this.markdownFilesToFullSlugs=await this.getMarkdownFilesToFullSlugs(this.parsedDocsConfig.pages),this.markdownFilesToNoIndex=await this.getMarkdownFilesToNoIndex(this.parsedDocsConfig.pages),this.markdownFilesToTags=await this.getMarkdownFilesToTags(this.parsedDocsConfig.pages);for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[ru.of(l)]=await $9f({markdown:m,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(l),context:this.taskContext});for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[ru.of(l)]=await K9f({markdown:m,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(l),context:this.taskContext});let n=await ZPv({parsedDocsConfig:this.parsedDocsConfig});for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))try{let{filepaths:O,markdown:P}=Eda(m,{absolutePathToMarkdownFile:this.resolveFilepath(l),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath});this.parsedDocsConfig.pages[ru.of(l)]=P;for(let C of O)n.add(C)}catch(O){throw this.taskContext.logger.error(`Failed to parse ${l}: ${O instanceof Error?O.message:String(O)}`),O}let i=Array.from(n).map(l=>({absoluteFilePath:l,relativeFilePath:this.toRelativeFilepath(l)}));(await this.uploadFiles(i)).forEach(l=>{this.collectedFileIds.set(l.absoluteFilePath,l.fileId)});let o=await this.toRootNode(),c=await this.getMarkdownFilesToFullyQualifiedPathNames(o);for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[ru.of(l)]=J9f(m,this.collectedFileIds,c,{absolutePathToMarkdownFile:this.resolveFilepath(l),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath},this.taskContext);let f={};Object.entries(this.parsedDocsConfig.pages).forEach(([l,m])=>{let O=MtM(this.editThisPage,l),P=this.rawMarkdownFiles[ru.of(l)];f[VDe.PageId(l)]={markdown:m,editThisPageUrl:O?VDe.Url(O):void 0,rawMarkdown:P}});let u=await this.convertDocsConfiguration(o),s={};if(this._parsedDocsConfig.experimental?.mdxComponents!=null){let l=new Set;await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async m=>{let O=p1(this.docsWorkspace.absoluteFilePath,m);(await(0,yUu.stat)(O)).isDirectory()?(await uve(O,"{js,ts,jsx,tsx,md,mdx}")).forEach(I=>{l.add(I)}):O.match(/\.(js|ts|jsx|tsx|md|mdx)$/)!=null&&l.add(O)})),s=Object.fromEntries(await Promise.all([...l].map(async m=>{let O=this.toRelativeFilepath(m),P=(await(0,yUu.readFile)(m)).toString();return[O,P]})))}return{config:u,pages:f,jsFiles:s}}resolveFilepath(t){if(t!=null)return p1(this.docsWorkspace.absoluteFilePath,t)}toRelativeFilepath(t){if(t!=null)return P3(this.docsWorkspace.absoluteFilePath,t)}async getMarkdownFilesToFullSlugs(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,hUu.default)(i).data.slug;typeof o=="string"&&o.trim().length>0&&r.set(this.resolveFilepath(n),o.trim())}return r}async getMarkdownFilesToNoIndex(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,hUu.default)(i).data.noindex;typeof o=="boolean"&&r.set(this.resolveFilepath(n),o)}return r}async getMarkdownFilesToTags(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,hUu.default)(i).data.tags;typeof o=="string"?r.set(this.resolveFilepath(n),o.split(",").map(c=>c.trim()).filter(c=>c.length>0)):Array.isArray(o)&&r.set(this.resolveFilepath(n),o)}return r}async getMarkdownFilesToFullyQualifiedPathNames(t){let r={},n=fl.migrate.FernNavigationV1ToLatest.create().root(t);return fl.NodeCollector.collect(n).slugMap.forEach((a,o)=>{if(a==null||!fl.isPage(a))return;let c=fl.getPageId(a);if(c==null)return;let f=Ql(this.docsWorkspace.absoluteFilePath,ru.of(c));r[f]=o}),r}getDocsBasePath(){return new URL(Lse(this.domain)).pathname}async convertDocsConfiguration(t){return{aiChatConfig:this.parsedDocsConfig.aiChatConfig!=null?{model:this.parsedDocsConfig.aiChatConfig.model,systemPrompt:this.parsedDocsConfig.aiChatConfig.systemPrompt,location:this.parsedDocsConfig.aiChatConfig.location,datasources:this.parsedDocsConfig.aiChatConfig.datasources?.map(n=>({url:n.url,title:n.title}))}:void 0,hideNavLinks:void 0,title:this.parsedDocsConfig.title,logoHeight:this.parsedDocsConfig.logo?.height,logoHref:this.parsedDocsConfig.logo?.href?VDe.Url(this.parsedDocsConfig.logo?.href):void 0,favicon:this.getFileId(this.parsedDocsConfig.favicon),navigation:void 0,root:t,colorsV3:this.convertColorConfigImageReferences(),navbarLinks:this.parsedDocsConfig.navbarLinks?.map(n=>n.type==="dropdown"?{...n,links:n.links?.map(i=>({...i,url:VDe.Url(i.url),icon:this.resolveIconFileId(i.icon),rightIcon:this.resolveIconFileId(i.rightIcon)})),icon:this.resolveIconFileId(n.icon),rightIcon:this.resolveIconFileId(n.rightIcon)}:n.type==="github"?{...n,url:VDe.Url(n.url)}:{...n,url:VDe.Url(n.url),icon:this.resolveIconFileId(n.icon),rightIcon:this.resolveIconFileId(n.rightIcon)}),typographyV2:this.convertDocsTypographyConfiguration(),layout:this.parsedDocsConfig.layout,settings:this.parsedDocsConfig.settings,css:this.parsedDocsConfig.css,js:this.convertJavascriptConfiguration(),metadata:this.convertMetadata(),redirects:this.parsedDocsConfig.redirects,integrations:this.parsedDocsConfig.integrations,footerLinks:this.parsedDocsConfig.footerLinks?.map(n=>({...n,value:VDe.Url(n.value)})),defaultLanguage:this.parsedDocsConfig.defaultLanguage,languages:this.parsedDocsConfig.languages,analyticsConfig:{...this.parsedDocsConfig.analyticsConfig,segment:this.parsedDocsConfig.analyticsConfig?.segment,fullstory:this.parsedDocsConfig.analyticsConfig?.fullstory,intercom:this.parsedDocsConfig.analyticsConfig?.intercom?{appId:this.parsedDocsConfig.analyticsConfig.intercom.appId,apiBase:this.parsedDocsConfig.analyticsConfig.intercom.apiBase}:void 0,posthog:this.parsedDocsConfig.analyticsConfig?.posthog?{apiKey:this.parsedDocsConfig.analyticsConfig.posthog.apiKey,endpoint:this.parsedDocsConfig.analyticsConfig.posthog.endpoint}:void 0,gtm:this.parsedDocsConfig.analyticsConfig?.gtm?{containerId:this.parsedDocsConfig.analyticsConfig.gtm.containerId}:void 0,ga4:this.parsedDocsConfig.analyticsConfig?.ga4?{measurementId:this.parsedDocsConfig.analyticsConfig.ga4.measurementId}:void 0,amplitude:void 0,mixpanel:void 0,hotjar:void 0,koala:void 0,logrocket:void 0,pirsch:void 0,plausible:void 0,fathom:void 0,clearbit:void 0,heap:void 0},announcement:this.parsedDocsConfig.announcement!=null?{text:this.parsedDocsConfig.announcement.message}:void 0,pageActions:this.parsedDocsConfig.pageActions,theme:this.parsedDocsConfig.theme!=null?{...this.parsedDocsConfig.theme,"page-actions":void 0}:void 0,logo:void 0,logoV2:void 0,colors:void 0,colorsV2:void 0,typography:void 0,backgroundImage:void 0}}getFernWorkspaceForApiSection(t){if(t.apiName!=null){let n=this.apiWorkspaces.find(i=>i.workspaceName===t.apiName);if(n!=null)return n}else if(this.apiWorkspaces.length===1&&this.apiWorkspaces[0]!=null)return this.apiWorkspaces[0];let r=t.apiName?`Failed to load API Definition '${t.apiName}' referenced in docs`:"Failed to load API Definition referenced in docs";throw new Error(r)}getOpenApiWorkspaceForApiSection(t){if(t.apiName!=null){let n=this.ossWorkspaces.find(i=>i.workspaceName===t.apiName);if(n!=null)return n}else if(this.ossWorkspaces.length===1&&this.ossWorkspaces[0]!=null)return this.ossWorkspaces[0];let r=t.apiName?`Failed to load API Definition '${t.apiName}' referenced in docs`:"Failed to load API Definition referenced in docs";throw new Error(r)}async toRootNode(){let t=fl.V1.SlugGenerator.init(fl.slugjoin(this.getDocsBasePath())),r=this.#e.get("root"),n=await this.toRootChild(t);return{type:"root",version:"v1",id:r,child:n,slug:t.get(),title:this.parsedDocsConfig.title??"Documentation",hidden:!1,icon:void 0,pointsTo:void 0,authed:void 0,viewers:void 0,orphaned:void 0,roles:this.parsedDocsConfig.roles?.map(i=>fl.RoleId(i)),featureFlags:void 0}}async toRootChild(t){return mia(this.parsedDocsConfig.navigation)._visit({untabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),tabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),versioned:r=>this.toVersionedNode(r,t),productgroup:r=>this.toProductGroupNode({landingPageConfig:this.parsedDocsConfig.landingPage,productGroup:r,parentSlug:t})})}toLandingPageNode(t,r){let n=fl.PageId(this.toRelativeFilepath(t.absolutePath)),i=r.apply({urlSlug:t.slug??u$(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{type:"landingPage",id:this.#e.get(n),title:t.title,slug:i.get(),icon:this.resolveIconFileId(t.icon),hidden:t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:n,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags}}async toUnversionedNode({landingPage:t,navigationConfig:r,parentSlug:n}){let i=this.#e.get("unversioned"),a=t!=null?this.toLandingPageNode(t,n):void 0,o=r.type==="tabbed"?await this.convertTabbedNavigation(i,r.items,n):await this.toSidebarRootNode(i,r.items,n);return{type:"unversioned",id:i,landingPage:a,child:o}}async toVersionedNode(t,r){return{id:this.#e.get("versioned"),type:"versioned",children:await Promise.all(t.versions.map((i,a)=>this.toVersionNode(i,r,a===0)))}}async toProductGroupNode({productGroup:t,landingPageConfig:r,parentSlug:n}){let i=this.#e.get("productgroup"),a=r!=null?this.toLandingPageNode(r,n):void 0;return{id:i,type:"productgroup",landingPage:a,children:await Promise.all(t.products.map(o=>this.toProductNode(o,n)))}}async toProductNode(t,r){if(t.type==="internal"){let n=r.setProductSlug(t.slug??u$(t.product)),i;switch(t.navigation.type){case"tabbed":i={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.convertTabbedNavigation(this.#e.get(t.product),t.navigation.items,n)};break;case"untabbed":i={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.toSidebarRootNode(this.#e.get(t.product),t.navigation.items,n)};break;case"versioned":i=await this.toVersionedNode(t.navigation,n);break;default:ku(t.navigation)}return{type:"product",id:this.#e.get(t.product),productId:fl.V1.ProductId(t.product),title:t.product,subtitle:t.subtitle??"",slug:n.get(),child:i,default:!1,hidden:void 0,authed:void 0,icon:this.resolveIconFileId(t.icon),image:t.image!=null?this.getFileId(t.image):void 0,pointsTo:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}else return{type:"productLink",id:this.#e.get(t.product),productId:fl.V1.ProductId(t.product),title:t.product,subtitle:t.subtitle??"",href:VDe.Url(t.href??""),default:!1,hidden:void 0,authed:void 0,icon:this.resolveIconFileId(t.icon),image:t.image!=null?this.getFileId(t.image):void 0,viewers:t.viewers,orphaned:t.orphaned}}async toVersionNode(t,r,n){let i=this.#e.get(t.version),a=r.setVersionSlug(t.slug??u$(t.version)),o=t.navigation.type==="tabbed"?await this.convertTabbedNavigation(i,t.navigation.items,a):await this.toSidebarRootNode(i,t.navigation.items,a);return{type:"version",id:i,versionId:fl.VersionId(t.version),title:t.version,slug:a.get(),child:o,default:n,availability:t.availability!=null?BtM(t.availability):void 0,landingPage:t.landingPage?this.toLandingPageNode(t.landingPage,a):void 0,hidden:void 0,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,icon:void 0,pointsTo:void 0,featureFlags:t.featureFlags}}async toSidebarRootNode(t,r,n){let i=this.#e.get(`${t}/root`),a=await Promise.all(r.map(c=>this.toNavigationChild({prefix:i,item:c,parentSlug:n}))),o=[];return a.forEach(c=>{if(c.type==="apiReference"){o.push(c);return}if(c.type==="section"&&!c.collapsed){o.push(c);return}let f=o.length>0?o[o.length-1]:void 0,u;f?.type==="sidebarGroup"?u=f:(u={id:this.#e.get(`${i}/group`),type:"sidebarGroup",children:[]},o.push(u)),u.children.push(c)}),{type:"sidebarRoot",id:i,children:o}}async toSidebarRootNodeWithVariants(t,r,n){let i=this.#e.get(`${t}/root`);return{type:"sidebarRoot",id:i,children:[{type:"varianted",id:i,children:await Promise.all(r.map(a=>this.toVariantNode(a,i,n)))}]}}async toVariantNode(t,r,n){let i=this.#e.get(`${r}/variant/${t.slug??u$(t.title)}`),a=n.apply({urlSlug:t.slug??u$(t.title),skipUrlSlug:t.skipUrlSlug}),o=await Promise.all(t.layout.map(c=>this.toVariantChild(c,i,a)));return{type:"variant",id:i,variantId:fl.V1.VariantId(t.title),subtitle:t.subtitle??"",default:t.default??!1,image:void 0,children:o,title:t.title,slug:a.get(),icon:this.resolveIconFileId(t.icon),hidden:t.hidden,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags,pointsTo:void 0}}async toVariantChild(t,r,n){return mia(t)._visit({page:async i=>this.toPageNode({item:i,parentSlug:n}),apiSection:async i=>this.toApiSectionNode({item:i,parentSlug:n}),section:async i=>this.toSectionNode({prefix:r,item:i,parentSlug:n}),link:async i=>this.toLinkNode(i),changelog:async i=>this.toChangelogNode(i,n)})}async toNavigationChild({prefix:t,item:r,parentSlug:n,hideChildren:i,parentAvailability:a}){return mia(r)._visit({page:async o=>this.toPageNode({item:o,parentSlug:n,hideChildren:i,parentAvailability:a}),apiSection:async o=>this.toApiSectionNode({item:o,parentSlug:n,hideChildren:i,parentAvailability:a}),section:async o=>this.toSectionNode({prefix:t,item:o,parentSlug:n,hideChildren:i,parentAvailability:a}),link:async o=>this.toLinkNode(o),changelog:async o=>this.toChangelogNode(o,n,i)})}async toApiSectionNode({item:t,parentSlug:r,hideChildren:n,parentAvailability:i}){let a=UPv(t.snippetsConfiguration),o,c=await this.getFernWorkspaceForApiSection(t).toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,objectQueryParameters:!0,preserveSchemaIds:!0}),f=this.parsedDocsConfig.experimental?.openapiParserV3;if(f==null||f)try{o=await this.getOpenApiWorkspaceForApiSection(t).getIntermediateRepresentation({context:this.taskContext,audiences:t.audiences,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1})}catch{}o==null&&(o=xG({workspace:c,audiences:t.audiences,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},readme:void 0,version:void 0,packageName:void 0,context:this.taskContext,sourceResolver:new FG(this.taskContext,c)}));let s=await this.registerApi({ir:o,snippetsConfig:a,playgroundConfig:{oauth:t.playground?.oauth},apiName:t.apiName,workspace:c}),l=jns({ir:o,apiDefinitionId:s,playgroundConfig:{oauth:t.playground?.oauth},context:this.taskContext});return new dUu(t,l,r,this.docsWorkspace,this.taskContext,this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,this.#e,this.collectedFileIds,c,n,i??t.availability).get()}async toChangelogNode(t,r,n){return new Tda(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,t.changelog,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:r,title:t.title,icon:this.resolveIconFileId(t.icon),viewers:t.viewers,hidden:n||t.hidden,slug:t.slug})}async toLinkNode(t){return{type:"link",id:this.#e.get(t.url),title:t.text,url:fl.V1.Url(t.url),icon:this.resolveIconFileId(t.icon)}}async toPageNode({item:t,parentSlug:r,hideChildren:n,parentAvailability:i}){let a=fl.PageId(this.toRelativeFilepath(t.absolutePath)),o=r.apply({urlSlug:t.slug??u$(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{id:this.#e.get(a),type:"page",slug:o.get(),title:t.title,icon:this.resolveIconFileId(t.icon),hidden:n||t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:a,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags,availability:t.availability??i}}async toSectionNode({prefix:t,item:r,parentSlug:n,hideChildren:i,parentAvailability:a}){let o=this.toRelativeFilepath(r.overviewAbsolutePath),c=o?fl.PageId(o):void 0,f=this.#e.get(c??`${t}/section`),u=n.apply({urlSlug:r.slug??u$(r.title),fullSlug:r.overviewAbsolutePath?this.markdownFilesToFullSlugs.get(r.overviewAbsolutePath)?.split("/"):void 0,skipUrlSlug:r.skipUrlSlug}),s=r.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(r.overviewAbsolutePath):void 0,l=i||r.hidden;return{id:f,type:"section",overviewPageId:c,slug:u.get(),title:r.title,icon:this.resolveIconFileId(r.icon),collapsed:r.collapsed,hidden:l,viewers:r.viewers,orphaned:r.orphaned,children:await Promise.all(r.contents.map(m=>this.toNavigationChild({prefix:f,item:m,parentSlug:u,hideChildren:l,parentAvailability:r.availability??a}))),authed:void 0,pointsTo:void 0,noindex:s,featureFlags:r.featureFlags,availability:r.availability??a}}async convertTabbedNavigation(t,r,n){let i=this.#e.get(`${t}/tabbed`);return{type:"tabbed",id:i,children:await Promise.all(r.map(a=>this.toTabChild(i,a,n)))}}async toTabChild(t,r,n){return mia(r.child)._visit({link:({href:i})=>this.toTabLinkNode(r,i),layout:({layout:i})=>this.toTabNode(t,r,i,n),changelog:({changelog:i})=>this.toTabChangelogNode(r,i,n),variants:({variants:i})=>this.toTabNodeWithVariants(t,r,i,n)})}async toTabChangelogNode(t,r,n){return new Tda(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,r,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:n,title:t.title,icon:this.resolveIconFileId(t.icon),viewers:t.viewers,hidden:t.hidden,slug:t.slug})}async toTabLinkNode(t,r){return{type:"link",id:this.#e.get(r),title:t.title,url:fl.V1.Url(r),icon:this.resolveIconFileId(t.icon)}}async toTabNode(t,r,n,i){let a=this.#e.get(`${t}/tab`),o=i.apply({urlSlug:r.slug??u$(r.title),skipUrlSlug:r.skipUrlSlug});return{type:"tab",id:a,title:r.title,slug:o.get(),icon:this.resolveIconFileId(r.icon),hidden:r.hidden,authed:void 0,viewers:r.viewers,orphaned:r.orphaned,pointsTo:void 0,child:await this.toSidebarRootNode(a,n,o),featureFlags:r.featureFlags}}async toTabNodeWithVariants(t,r,n,i){let a=this.#e.get(`${t}/tab`),o=i.apply({urlSlug:r.slug??u$(r.title),skipUrlSlug:r.skipUrlSlug});return{type:"tab",id:a,title:r.title,slug:o.get(),icon:this.resolveIconFileId(r.icon),hidden:r.hidden,authed:void 0,viewers:r.viewers,orphaned:r.orphaned,pointsTo:void 0,child:await this.toSidebarRootNodeWithVariants(a,n,o),featureFlags:r.featureFlags}}getFileId(t){if(t==null)return;let r=this.collectedFileIds.get(t);return r==null?this.taskContext.failAndThrow("Failed to locate file after uploading: "+t):VDe.FileId(r)}resolveIconFileId(t){if(t!=null)return this.collectedFileIds.has(t)?`file:${this.getFileId(t)}`:t}convertColorConfigImageReferences(){let{colors:t}=this.parsedDocsConfig;if(t!=null)return t.type==="dark"?{...t,...this.convertLogoAndBackgroundImage({theme:"dark"})}:t.type==="light"?{...t,...this.convertLogoAndBackgroundImage({theme:"light"}),type:"light"}:{...t,dark:{...t.dark,...this.convertLogoAndBackgroundImage({theme:"dark"})},light:{...t.light,...this.convertLogoAndBackgroundImage({theme:"light"})}}}convertLogoAndBackgroundImage({theme:t}){let{logo:r,backgroundImage:n}=this.parsedDocsConfig,i=r?.[t],a=n?.[t];return{logo:this.getFileId(i),backgroundImage:this.getFileId(a)}}convertDocsTypographyConfiguration(){if(this.parsedDocsConfig.typography!=null)return{headingsFont:this.convertFont(this.parsedDocsConfig.typography.headingsFont,"headings"),bodyFont:this.convertFont(this.parsedDocsConfig.typography.bodyFont,"body"),codeFont:this.convertFont(this.parsedDocsConfig.typography.codeFont,"code")}}convertFont(t,r){if(t==null||t.variants[0]==null)return;let n=this.getFileId(t.variants[0].absolutePath);return{type:"custom",name:t.name??`font:${r}:${n}`,variants:t.variants.map(i=>({fontFile:this.getFileId(i.absolutePath),weight:i.weight,style:i.style!=null?[i.style]:void 0})),display:t.display,fallback:t.fallback,fontVariationSettings:t.fontVariationSettings}}convertJavascriptConfiguration(){if(this.parsedDocsConfig.js!=null)return{files:this.parsedDocsConfig.js.files.map(({absolutePath:t,strategy:r})=>({fileId:this.getFileId(t),strategy:r})).filter(hj),remote:this.parsedDocsConfig.js.remote?.map(t=>({...t,url:VDe.Url(t.url)})),inline:void 0}}convertMetadata(){if(this.parsedDocsConfig.metadata==null)return;let{"og:image":t,"og:logo":r,"twitter:image":n,...i}=this.parsedDocsConfig.metadata;return{...i,"og:image":this.convertFileIdOrUrl(t),"og:logo":this.convertFileIdOrUrl(r),"twitter:image":this.convertFileIdOrUrl(n)}}convertFileIdOrUrl(t){if(t!=null)return mia(t,"type")._visit({filepath:({value:r})=>({type:"fileId",value:this.getFileId(r)}),url:({value:r})=>({type:"url",value:VDe.Url(r)}),_other:()=>this.taskContext.failAndThrow("Invalid metadata configuration")})}};function MtM(e,t){if(e?.github==null)return;let{owner:r,repo:n,branch:i="main",host:a="https://github.com"}=e.github;return`${Lse(a)}/${r}/${n}/blob/${i}/fern/${t}?plain=1`}function BtM(e){switch(e){case"beta":return fl.V1.NavigationV1Availability.Beta;case"deprecated":return fl.V1.NavigationV1Availability.Deprecated;case"ga":return fl.V1.NavigationV1Availability.GenerallyAvailable;case"stable":return fl.V1.NavigationV1Availability.Stable;default:ku(e)}}async function pbe(e){return(await Promise.all(e.apiWorkspaces.map(async t=>t instanceof S$?t:null))).filter(hj)}async function KUf(e,t,r){if(e instanceof kVr){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof S$))return;let n=await e.getIntermediateRepresentation({context:t,audiences:r,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1});return UCe({ir:n,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0,phpSdk:void 0,swiftSdk:void 0,rustSdk:void 0},playgroundConfig:{oauth:!0},context:t})}var Yj={};yf(Yj,{AlgoliaSearchIndex:()=>nwv,ApiDefinitionId:()=>wwv,ApiId:()=>Dwv,Availability:()=>Vwv,DocsConfigId:()=>Cwv,EndpointId:()=>Mwv,EndpointPathLiteral:()=>Lwv,EnvironmentId:()=>Iwv,FileId:()=>Nwv,HttpMethod:()=>Uwv,IndexSegmentId:()=>iwv,JqString:()=>xwv,OrgId:()=>Ewv,PageId:()=>Rwv,PayloadLocation:()=>yjv,PropertyKey:()=>zwv,PullRequestState:()=>fjv,RoleId:()=>Qwv,TokenId:()=>Swv,TypeId:()=>qwv,Url:()=>Fwv,VersionId:()=>jwv,WebSocketId:()=>Bwv,WebhookId:()=>Twv,algolia:()=>$Uf,api:()=>aVf,commons:()=>oVf,diff:()=>Wwv,docs:()=>hVf,generators:()=>vVf,git:()=>bVf,navigation:()=>OVf,sdks:()=>PVf,snippets:()=>_jv,snippetsFactory:()=>hjv,templates:()=>wVf,tokens:()=>vjv});var $Uf={};yf($Uf,{AlgoliaSearchIndex:()=>nwv,IndexSegmentId:()=>iwv});function nwv(e){return e}function iwv(e){return e}var aVf={};yf(aVf,{latest:()=>ZUf,v1:()=>iVf});var ZUf={};yf(ZUf,{AuthSchemeId:()=>awv,WebhookHttpMethod:()=>cwv,auth:()=>YUf,commons:()=>owv,endpoint:()=>swv,type_:()=>uwv,webhook:()=>XUf,websocket:()=>lwv});var YUf={};yf(YUf,{AuthSchemeId:()=>awv});function awv(e){return e}var owv={};var swv={};var uwv={};var XUf={};yf(XUf,{WebhookHttpMethod:()=>cwv});var cwv={Get:"GET",Post:"POST"};var lwv={};var iVf={};yf(iVf,{SubpackageId:()=>mwv,WebSocketMessageId:()=>Owv,WebSocketMessageOrigin:()=>Awv,WebhookHttpMethod:()=>Pwv,commons:()=>nVf,db:()=>kUf,read:()=>tVf,register:()=>rVf});var kUf={};yf(kUf,{endpoint:()=>fwv});var fwv={};var tVf={};yf(tVf,{SupportedLanguage:()=>dwv,endpoint:()=>eVf,type_:()=>pwv,webhook:()=>_wv,websocket:()=>hwv});var eVf={};yf(eVf,{SupportedLanguage:()=>dwv});var dwv={Curl:"curl",Python:"python",Javascript:"javascript",Js:"js",Node:"node",Typescript:"typescript",Ts:"ts",Go:"go",Ruby:"ruby",Csharp:"csharp"};var pwv={};var _wv={};var hwv={};var rVf={};yf(rVf,{SourceId:()=>TtM,endpoint:()=>ywv,type_:()=>vwv,webhook:()=>bwv,websocket:()=>gwv});var ywv={};var vwv={};var bwv={};var gwv={};function TtM(e){return e}var nVf={};yf(nVf,{SubpackageId:()=>mwv,WebSocketMessageId:()=>Owv,WebSocketMessageOrigin:()=>Awv,WebhookHttpMethod:()=>Pwv});function mwv(e){return e}function Owv(e){return e}var Awv={Client:"client",Server:"server"};var Pwv={Get:"GET",Post:"POST"};var oVf={};yf(oVf,{ApiDefinitionId:()=>wwv,ApiId:()=>Dwv,Availability:()=>Vwv,DocsConfigId:()=>Cwv,EndpointId:()=>Mwv,EndpointPathLiteral:()=>Lwv,EnvironmentId:()=>Iwv,FileId:()=>Nwv,HttpMethod:()=>Uwv,JqString:()=>xwv,OrgId:()=>Ewv,PageId:()=>Rwv,PropertyKey:()=>zwv,RoleId:()=>Qwv,TokenId:()=>Swv,TypeId:()=>qwv,Url:()=>Fwv,VersionId:()=>jwv,WebSocketId:()=>Bwv,WebhookId:()=>Twv});function wwv(e){return e}function jwv(e){return e}function Ewv(e){return e}function Swv(e){return e}function Dwv(e){return e}function Cwv(e){return e}function Iwv(e){return e}function Mwv(e){return e}function Bwv(e){return e}function Twv(e){return e}function qwv(e){return e}function Rwv(e){return e}function Nwv(e){return e}function Fwv(e){return e}function xwv(e){return e}function zwv(e){return e}function Qwv(e){return e}function Lwv(e){return e}var Uwv={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE"};var Vwv={Stable:"Stable",GenerallyAvailable:"GenerallyAvailable",InDevelopment:"InDevelopment",PreRelease:"PreRelease",Deprecated:"Deprecated",Beta:"Beta"};var Wwv={};var hVf={};yf(hVf,{latest:()=>cVf,v1:()=>pVf,v2:()=>_Vf});var cVf={};yf(cVf,{Layout:()=>Hwv,MdxEngine:()=>qtM,TwitterCardSetting:()=>Jwv,commons:()=>Gwv,frontmatter:()=>sVf,seo:()=>uVf});var qtM={NextMdxRemote:"next-mdx-remote",MdxBundler:"mdx-bundler"};var Gwv={};var sVf={};yf(sVf,{Layout:()=>Hwv});var Hwv={Guide:"guide",Overview:"overview",Reference:"reference",Page:"page",Custom:"custom"};var uVf={};yf(uVf,{TwitterCardSetting:()=>Jwv});var Jwv={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var pVf={};yf(pVf,{commons:()=>dVf,db:()=>Kwv,read:()=>$wv,write:()=>lVf});var Kwv={};var $wv={};var lVf={};yf(lVf,{DocsRegistrationId:()=>NtM,FilePath:()=>RtM});function RtM(e){return e}function NtM(e){return e}var dVf={};yf(dVf,{ContentAlignment:()=>kwv,FontDisplay:()=>ijv,FontStyle:()=>njv,HeaderPosition:()=>ejv,JsScriptStrategy:()=>rjv,ProgrammingLanguage:()=>Ywv,SearchbarPlacement:()=>Xwv,TabsPlacement:()=>Zwv,TwitterCardSetting:()=>tjv,commons:()=>fVf});var fVf={};yf(fVf,{ContentAlignment:()=>kwv,FontDisplay:()=>ijv,FontStyle:()=>njv,HeaderPosition:()=>ejv,JsScriptStrategy:()=>rjv,ProgrammingLanguage:()=>Ywv,SearchbarPlacement:()=>Xwv,TabsPlacement:()=>Zwv,TwitterCardSetting:()=>tjv});var Ywv={Typescript:"typescript",Javascript:"javascript",Python:"python",Java:"java",Go:"go",Ruby:"ruby",Csharp:"csharp",Nodets:"nodets",Nodejs:"nodejs",Dotnet:"dotnet",Curl:"curl",Jvm:"jvm",Ts:"ts",Js:"js"};var Xwv={Header:"HEADER",HeaderTabs:"HEADER_TABS",Sidebar:"SIDEBAR"};var Zwv={Header:"HEADER",Sidebar:"SIDEBAR"};var kwv={Center:"CENTER",Left:"LEFT"};var ejv={Fixed:"FIXED",Absolute:"ABSOLUTE"};var tjv={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var rjv={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var njv={Normal:"normal",Italic:"italic"};var ijv={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var _Vf={};yf(_Vf,{read:()=>ajv,write:()=>ojv});var ajv={};var ojv={};var vVf={};yf(vVf,{ChangelogEntryType:()=>ujv,GeneratorId:()=>FtM,GeneratorLanguage:()=>xtM,ReleaseType:()=>cjv,cli:()=>sjv,commons:()=>yVf,versions:()=>ljv});var sjv={};var yVf={};yf(yVf,{ChangelogEntryType:()=>ujv,ReleaseType:()=>cjv});var ujv={Fix:"fix",Feat:"feat",Chore:"chore",Break:"break",Internal:"internal"};var cjv={Ga:"GA",Rc:"RC"};var ljv={};function FtM(e){return e}var xtM={Python:"python",Go:"go",Java:"java",Typescript:"typescript",Ruby:"ruby",Csharp:"csharp",Php:"php",Swift:"swift",Rust:"rust"};var bVf={};yf(bVf,{PullRequestState:()=>fjv});var fjv={Open:"open",Closed:"closed",Merged:"merged"};var OVf={};yf(OVf,{latest:()=>gVf,v1:()=>mVf});var gVf={};yf(gVf,{NodeId:()=>LtM,ProductId:()=>UtM,Slug:()=>ztM,TabId:()=>QtM});function ztM(e){return e}function QtM(e){return e}function LtM(e){return e}function UtM(e){return e}var mVf={};yf(mVf,{NavigationV1Availability:()=>JtM,NodeId:()=>GtM,ProductId:()=>HtM,Slug:()=>VtM,TabId:()=>WtM});function VtM(e){return e}function WtM(e){return e}function GtM(e){return e}function HtM(e){return e}var JtM={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Beta:"beta",Deprecated:"deprecated"};var PVf={};yf(PVf,{Language:()=>djv,VersionBump:()=>pjv,versions:()=>AVf});var AVf={};yf(AVf,{Language:()=>djv,VersionBump:()=>pjv});var djv={Go:"Go",TypeScript:"TypeScript",Java:"Java",Python:"Python",Csharp:"Csharp",Ruby:"Ruby"};var pjv={Major:"MAJOR",Minor:"MINOR",Patch:"PATCH"};var _jv={};var hjv={};var wVf={};yf(wVf,{PayloadLocation:()=>yjv});var yjv={Body:"BODY",Query:"QUERY",Path:"PATH",Headers:"HEADERS",Relative:"RELATIVE",Auth:"AUTH"};var vjv={};var vUu=class{warnings=[];errors=[];error(t){this.errors.push(t)}warning(t){this.warnings.push(t)}};function mA(e){return e!=null}var gjv=$i(GLo(),1);var bjv=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];function yWr(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,gjv.default)(e,{special:bjv}).replace(/V\s(\d)/g,"V$1")}function mjv({endpoints:e,webhookEndpoints:t}){let r={};return Object.values({...e,...t}).forEach(n=>{let i=[];n.namespace?.forEach(a=>{let o=[...i,a],c=Yj.api.v1.SubpackageId(o.join("."));r[c]={id:c,name:a,displayName:yWr(a)},i.push(a)})}),r}var bUu=class{input;context;constructor(t,r){this.input=t,this.context=r}errors(){return this.context.errors.errors}warnings(){return this.context.errors.warnings}};function Ojv(e){return`#/${e.map(t=>t.replaceAll(/~/g,"~0").replaceAll(/\//g,"~1")).join("/")}`}var LO=class extends bUu{context;accessPath;pathId;constructor({input:t,context:r,accessPath:n,pathId:i}){if(super(t,r),this.context=r,this.accessPath=[...n],this.pathId=i,i!=null){let a=Array.isArray(this.pathId)?this.pathId:[this.pathId];a.every((o,c)=>o===this.accessPath[this.accessPath.length-a.length+c])||this.accessPath.push(...a)}r.logger.debug(`Processing ${Ojv(this.accessPath)}`)}safeParse(...t){try{this.parse(...t)}catch{this.context.errors.error({message:"Error converting node. Please contact support if the error persists",path:this.accessPath})}}},Tee=class extends LO{},Xxe=class extends Tee{seenSchemas;constructor(t){super(t),this.seenSchemas=new Set(t.seenSchemas)}};var Ajv="x-fern-base-path",Pjv="x-fern-availability",gUu="x-fern-sdk-group-name",wjv="x-fern-global-headers",jjv="x-fern-sdk-method-name";var Ejv="x-fern-webhook",Sjv="x-fern-access-token-locator",Djv="x-fern-basic",Cjv="x-fern-username-variable-name",Ijv="x-fern-password-variable-name",Mjv="x-fern-bearer",Bjv="x-fern-token-variable-name",Tjv="x-fern-header",qjv="x-fern-header-variable-name",Rjv="x-fern-server-name",Njv="x-fern-examples";var mUu=class extends LO{serverName;constructor(t){super(t),this.safeParse()}parse(){this.serverName=this.input[Rjv]}convert(){if(this.serverName!=null)return this.serverName}};var OUu=class extends LO{url;serverName;constructor(t){super(t),this.safeParse()}parse(){this.url=Object.entries(this.input.variables??{}).reduce((t,[r,n])=>t.replace(`{${r}}`,n.default),this.input.url)??this.input.url,this.serverName=new mUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.serverName?.convert()??this.url;if(!(this.url==null||t==null))return{id:Yj.EnvironmentId(t),baseUrl:this.url}}};function K8i(e,t,r,n){let i=e??[],a=new Set(i.map(c=>c.url)),o=(t??[]).filter(c=>!a.has(c.url)).map((c,f)=>new OUu({input:c,context:r,accessPath:n,pathId:["servers",`${f}`]}));return[...i,...o]}function xx(e){return typeof e=="object"&&mA(e)&&"$ref"in e&&typeof e.$ref=="string"}function _be(e,t,r){let n=e.$ref.substring(2).split("/").map(a=>a.replace(/~1/g,"/")),i=t;for(let a of n){if(typeof i!="object"||i==null)return r;i=i[a]}return i==null?r:(xx(i)&&(i=_be(i,t,r)),i)}function AUu(e,t){let r=t.components?.securitySchemes?.[e];if(r!=null)return xx(r)?_be(r,t,void 0):r}var D1v=$i(PJ());var PUu=class extends LO{username;password;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[Djv];this.username=t?.username,this.password=t?.password}convert(){return{username:this.username,password:this.password}}};var wUu=class extends LO{passwordVariableName;constructor(t){super(t),this.safeParse()}parse(){this.passwordVariableName=this.input[Ijv]}convert(){return this.passwordVariableName}};var jUu=class extends LO{usernameVariableName;constructor(t){super(t),this.safeParse()}parse(){this.usernameVariableName=this.input[Cjv]}convert(){return this.usernameVariableName}};var EUu=class extends LO{bearerTokenVariableName;bearerTokenEnvVar;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[Mjv];this.bearerTokenVariableName=t?.name,this.bearerTokenEnvVar=t?.env}convert(){return{tokenVariableName:this.bearerTokenVariableName,tokenEnvVar:this.bearerTokenEnvVar}}};var SUu=class extends LO{tokenVariableName;constructor(t){super(t),this.safeParse()}parse(){this.tokenVariableName=this.input[Bjv]}convert(){return this.tokenVariableName}};function Fjv(e){return typeof e=="object"&&e!=null&&"in"in e&&e.in==="header"}var xjv="x-bearer-format",zjv="x-code-samples",Qjv="x-codeSamples";var DUu=class extends LO{bearerFormat;constructor(t){super(t),this.safeParse()}parse(){this.bearerFormat=this.input[xjv]}convert(){return this.bearerFormat}};var CUu=class extends LO{headerVariableName;headerEnvVar;headerPrefix;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[Tjv];this.headerVariableName=t?.name,this.headerEnvVar=t?.env,this.headerPrefix=t?.prefix}convert(){return{name:this.headerVariableName,env:this.headerEnvVar,prefix:this.headerPrefix}}};var IUu=class extends LO{headerVariableName;constructor(t){super(t),this.safeParse()}parse(){this.headerVariableName=this.input[qjv]}convert(){return this.headerVariableName}};function Ljv(e){return e.type==="apiKey"}var boo=class extends LO{headerName;headerBearerFormatNode;headerAuthNode;headerVariableNameNode;constructor(t){super(t),this.safeParse()}parse(){Ljv(this.input)&&(this.headerName=this.input.name),this.headerAuthNode=new CUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerVariableNameNode=new IUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerBearerFormatNode=new DUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.headerAuthNode?.convert();if(t!=null)return{type:"header",nameOverride:t?.name,headerWireValue:this.headerName??"Authorization",prefix:t?.prefix??this.headerBearerFormatNode?.convert()}}};function MUu(e){return e}function BUu(e){return e==="__proto__"}function TUu(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function qUu(e){return typeof e=="string"||typeof e=="symbol"?e:Object.is(e?.valueOf?.(),-0)?"-0":String(e)}function RUu(e){let t=[],r=e.length;if(r===0)return t;let n=0,i="",a="",o=!1;for(e.charCodeAt(0)===46&&(t.push(""),n++);n<r;){let c=e[n];a?c==="\\"&&n+1<r?(n++,i+=e[n]):c===a?a="":i+=c:o?c==='"'||c==="'"?a=c:c==="]"?(o=!1,t.push(i),i=""):i+=c:c==="["?(o=!0,i&&(t.push(i),i="")):c==="."?i&&(t.push(i),i=""):i+=c,n++}return i&&t.push(i),t}function Ens(e,t,r){if(e==null)return r;switch(typeof t){case"string":{if(BUu(t))return r;let n=e[t];return n===void 0?TUu(t)?Ens(e,RUu(t),r):r:n}case"number":case"symbol":{typeof t=="number"&&(t=qUu(t));let n=e[t];return n===void 0?r:n}default:{if(Array.isArray(t))return KtM(e,t,r);if(Object.is(t?.valueOf(),-0)?t="-0":t=String(t),BUu(t))return r;let n=e[t];return n===void 0?r:n}}}function KtM(e,t,r){if(t.length===0)return r;let n=e;for(let i=0;i<t.length;i++){if(n==null||BUu(t[i]))return r;n=n[t[i]]}return n===void 0?r:n}function Ujv(e){return function(t){return Ens(t,e)}}function Vjv(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function NUu(e){return e==null||typeof e!="object"&&typeof e!="function"}function jVf(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function Wjv(e,t,r){return typeof r!="function"?goo(e,t):EVf(e,t,function n(i,a,o,c,f,u){let s=r(i,a,o,c,f,u);return s!==void 0?!!s:EVf(i,a,n,u)},new Map)}function EVf(e,t,r,n){if(t===e)return!0;switch(typeof t){case"object":return $tM(e,t,r,n);case"function":return Object.keys(t).length>0?EVf(e,{...t},r,n):jVf(e,t);default:return Vjv(e)?typeof t=="string"?t==="":!0:jVf(e,t)}}function $tM(e,t,r,n){if(t==null)return!0;if(Array.isArray(t))return Gjv(e,t,r,n);if(t instanceof Map)return YtM(e,t,r,n);if(t instanceof Set)return XtM(e,t,r,n);let i=Object.keys(t);if(e==null)return i.length===0;if(i.length===0)return!0;if(n&&n.has(t))return n.get(t)===e;n&&n.set(t,e);try{for(let a=0;a<i.length;a++){let o=i[a];if(!NUu(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!r(e[o],t[o],o,e,t,n))return!1}return!0}finally{n&&n.delete(t)}}function YtM(e,t,r,n){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries()){let o=e.get(i);if(r(o,a,i,e,t,n)===!1)return!1}return!0}function Gjv(e,t,r,n){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],c=!1;for(let f=0;f<e.length;f++){if(i.has(f))continue;let u=e[f],s=!1;if(r(u,o,a,e,t,n)&&(s=!0),s){i.add(f),c=!0;break}}if(!c)return!1}return!0}function XtM(e,t,r,n){return t.size===0?!0:e instanceof Set?Gjv([...e],[...t],r,n):!1}function goo(e,t){return Wjv(e,t,()=>{})}function Hjv(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function FUu(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var Jjv="[object RegExp]",xUu="[object String]",zUu="[object Number]",QUu="[object Boolean]",LUu="[object Arguments]",Kjv="[object Symbol]",$jv="[object Date]",Yjv="[object Map]",Xjv="[object Set]",Zjv="[object Array]";var kjv="[object ArrayBuffer]",e1v="[object Object]";var t1v="[object DataView]",r1v="[object Uint8Array]",n1v="[object Uint8ClampedArray]",i1v="[object Uint16Array]",a1v="[object Uint32Array]";var o1v="[object Int8Array]",s1v="[object Int16Array]",u1v="[object Int32Array]";var c1v="[object Float32Array]",l1v="[object Float64Array]";function f1v(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function d1v(e,t){return Y8i(e,void 0,e,new Map,t)}function Y8i(e,t,r,n=new Map,i=void 0){let a=i?.(e,t,r,n);if(a!==void 0)return a;if(NUu(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){let o=new Array(e.length);n.set(e,o);for(let c=0;c<e.length;c++)o[c]=Y8i(e[c],c,r,n,i);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){let o=new Map;n.set(e,o);for(let[c,f]of e)o.set(c,Y8i(f,c,r,n,i));return o}if(e instanceof Set){let o=new Set;n.set(e,o);for(let c of e)o.add(Y8i(c,void 0,r,n,i));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(e))return e.subarray();if(f1v(e)){let o=new(Object.getPrototypeOf(e)).constructor(e.length);n.set(e,o);for(let c=0;c<e.length;c++)o[c]=Y8i(e[c],c,r,n,i);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return n.set(e,o),$8i(o,e,r,n,i),o}if(typeof File<"u"&&e instanceof File){let o=new File([e],e.name,{type:e.type});return n.set(e,o),$8i(o,e,r,n,i),o}if(e instanceof Blob){let o=new Blob([e],{type:e.type});return n.set(e,o),$8i(o,e,r,n,i),o}if(e instanceof Error){let o=new e.constructor;return n.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,$8i(o,e,r,n,i),o}if(typeof e=="object"&&ZtM(e)){let o=Object.create(Object.getPrototypeOf(e));return n.set(e,o),$8i(o,e,r,n,i),o}return e}function $8i(e,t,r=e,n,i){let a=[...Object.keys(t),...Hjv(t)];for(let o=0;o<a.length;o++){let c=a[o],f=Object.getOwnPropertyDescriptor(e,c);(f==null||f.writable)&&(e[c]=Y8i(t[c],c,r,n,i))}}function ZtM(e){switch(FUu(e)){case LUu:case Zjv:case kjv:case t1v:case QUu:case $jv:case c1v:case l1v:case o1v:case s1v:case u1v:case Yjv:case zUu:case e1v:case Jjv:case Xjv:case xUu:case Kjv:case r1v:case n1v:case i1v:case a1v:return!0;default:return!1}}function p1v(e){return Y8i(e,void 0,e,new Map,void 0)}function _1v(e){return e=p1v(e),t=>goo(t,e)}function h1v(e,t){return d1v(e,(r,n,i,a)=>{let o=t?.(r,n,i,a);if(o!==void 0)return o;if(typeof e=="object")switch(Object.prototype.toString.call(e)){case zUu:case xUu:case QUu:{let c=new e.constructor(e?.valueOf());return $8i(c,e),c}case LUu:{let c={};return $8i(c,e),c.length=e.length,c[Symbol.iterator]=e[Symbol.iterator],c}default:return}})}function y1v(e){return h1v(e)}var ktM=/^(?:0|[1-9]\d*)$/;function v1v(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return ktM.test(e)}}function b1v(e){return e!==null&&typeof e=="object"&&FUu(e)==="[object Arguments]"}function g1v(e,t){let r;if(Array.isArray(t)?r=t:typeof t=="string"&&TUu(t)&&e?.[t]==null?r=RUu(t):r=[t],r.length===0)return!1;let n=e;for(let i=0;i<r.length;i++){let a=r[i];if((n==null||!Object.hasOwn(n,a))&&!((Array.isArray(n)||b1v(n))&&v1v(a)&&a<n.length))return!1;n=n[a]}return!0}function m1v(e,t){switch(typeof e){case"object":{Object.is(e?.valueOf(),-0)&&(e="-0");break}case"number":{e=qUu(e);break}}return t=y1v(t),function(r){let n=Ens(r,e);return n===void 0?g1v(r,e):t===void 0?n===void 0:goo(n,t)}}function O1v(e){if(e==null)return MUu;switch(typeof e){case"function":return e;case"object":return Array.isArray(e)&&e.length===2?m1v(e[0],e[1]):_1v(e);case"string":case"symbol":case"number":return Ujv(e)}}function SVf(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(SVf).join(",");let t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function A1v(e,t){let r={},n=Object.keys(e);for(let i=0;i<n.length;i++){let a=n[i],o=e[a];r[a]=t(o,a,e)}return r}function UUu(e,t=MUu){return e==null?{}:A1v(e,O1v(t))}function P1v(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}var erM=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function w1v(e){return Array.from(e.match(erM)??[])}function j1v(e){let t=w1v(e);if(t.length===0)return"";let[r,...n]=t;return`${r.toLowerCase()}${n.map(i=>P1v(i)).join("")}`}function E1v(e){return typeof e!="string"&&(e=SVf(e)),e.replace(/['\u2019]/g,"")}function $qr(e){return j1v(E1v(e))}function TQ(e){if(e!=null)return Array.isArray(e)?e:[e]}function VUu({namespace:e,path:t,method:r,sdkMethodName:n,operationId:i,displayName:a,isWebhook:o}){if(t==null)return;let c=r!=null&&t!=null?`${r}_${t.split("/").join("_")}`:r??t.split("/").join("_");if(!(n==null&&i==null&&a==null&&c==null))return`${trM(o)}${rrM(e)}.${nrM(n,i,a,c)}`}function trM(e){return e?"webhook_":"endpoint_"}function rrM(e){return e!=null?TQ(e)?.map(t=>$qr(t)).join("/"):""}function nrM(e,t,r,n){return e||t||$qr(r??"")||$qr(n??"")}function S1v(e){return e.length===0?!1:/^\$?(\.[\w*]+|\[['"][\w*]+['"]?\]|\[['"]?[\d*]+['"]?\]|\[[\d:]+\])*$/.test(e)}var WUu=class extends LO{accessTokenLocator;constructor(t){super(t),this.safeParse()}parse(){this.accessTokenLocator=this.input[Sjv],this.accessTokenLocator!=null&&(S1v(this.accessTokenLocator)||(this.context.errors.error({message:"Invalid access token locator, must be a valid jq path",path:this.accessPath}),this.accessTokenLocator=void 0))}convert(){return this.accessTokenLocator}};var GUu=class extends LO{authorizationUrl;headerAuthNode;accessTokenLocatorNode;constructor(t){super(t),this.safeParse()}parse(){if(this.input.flows.clientCredentials!=null){let t=this.input.flows.clientCredentials;this.authorizationUrl=t.tokenUrl,this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.headerAuthNode=new boo({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.accessTokenLocatorNode=new WUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.accessTokenLocatorNode?.accessTokenLocator==null&&this.context.errors.error({message:"Expected 'x-fern-access-token-locator' property to be specified",path:this.accessPath})}}convert(){let t=this.accessTokenLocatorNode?.convert();if(t==null||this.authorizationUrl==null)return{type:"bearerAuth",tokenName:void 0};let r=VUu({namespace:void 0,path:this.authorizationUrl,method:"POST",sdkMethodName:void 0,operationId:void 0,displayName:void 0,isWebhook:void 0});if(r!=null)return{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:Yj.EndpointId(r),accessTokenLocator:Yj.JqString(t),headerName:this.headerAuthNode?.convert()?.headerWireValue,tokenPrefix:this.headerAuthNode?.convert()?.prefix}}}}};var moo=class extends LO{authScheme;headerAuthNode;bearerTokenNode;bearerTokenVariableNameNode;basicAuthNode;basicUsernameVariableNameNode;basicPasswordVariableNameNode;oauth2Node;constructor(t){super(t),this.safeParse()}parse(){switch(this.input.type){case"http":switch(this.input.scheme){case"basic":{this.authScheme="basic",this.basicAuthNode=new PUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicUsernameVariableNameNode=new jUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicPasswordVariableNameNode=new wUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),(this.basicAuthNode==null||this.basicAuthNode.username==null&&this.basicUsernameVariableNameNode?.usernameVariableName==null||this.basicAuthNode.password==null&&this.basicPasswordVariableNameNode?.passwordVariableName==null)&&this.context.errors.warning({message:"Basic auth should specify either a username or a username variable name",path:this.accessPath});break}case"bearer":{this.authScheme="bearer",this.bearerTokenNode=new EUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.bearerTokenVariableNameNode=new SUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}default:{this.context.errors.warning({message:`Unsupported HTTP auth scheme: ${this.input.scheme}`,path:this.accessPath});break}}break;case"apiKey":{Fjv(this.input)?(this.authScheme="header",this.headerAuthNode=new boo({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})):this.context.errors.error({message:`Unsupported API key location: ${this.input.in}`,path:this.accessPath});break}case"oauth2":{this.authScheme="oauth",this.oauth2Node=new GUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}case"openIdConnect":{this.authScheme="bearer";break}}}convert(){switch(this.authScheme){case"basic":{let t=this.basicAuthNode?.convert();return{type:"basicAuth",usernameName:t?.username?.name??this.basicUsernameVariableNameNode?.convert(),passwordName:t?.password?.name??this.basicPasswordVariableNameNode?.convert()}}case"bearer":return{type:"bearerAuth",tokenName:this.bearerTokenNode?.convert()?.tokenVariableName??this.bearerTokenVariableNameNode?.convert()};case"header":return this.headerAuthNode?.convert();case"oauth":return this.oauth2Node?.convert();case void 0:return;default:new D1v.UnreachableCaseError(this.authScheme);return}}};var Ooo=class extends LO{authNodesMap;constructor(t){super(t),this.safeParse()}parse(){this.input.map((t,r)=>Object.keys(t).map(n=>{let i=AUu(n,this.context.document);if(i==null){this.context.errors.warning({message:`No auth scheme found for ${n}. Inline security schemes are not supported.`,path:this.accessPath});return}let a=new moo({input:i,context:this.context,accessPath:this.accessPath,pathId:["security",`${r}`]});a.convert()!=null?(this.authNodesMap??={},this.authNodesMap[n]=a):this.context.errors.warning({message:`No auth scheme found for ${n}`,path:this.accessPath})}))}convert(){return Object.fromEntries(Object.entries(this.authNodesMap??{}).map(([t,r])=>{let n=r.convert();if(n!=null)return[t,n]}).filter(mA))}};var HUu=class extends LO{basePath;constructor(t){super(t),this.safeParse()}parse(){this.basePath=this.input[Ajv],this.basePath!=null?(this.basePath.startsWith("/")&&(this.basePath=this.basePath.slice(1)),this.basePath.endsWith("/")&&(this.basePath=this.basePath.slice(0,-1))):this.basePath=void 0}convert(){return this.basePath}};function C1v(e){return"required"in e&&typeof e.required=="boolean"?e.required:!1}function I1v(e,t){return{type:"alias",value:{type:"optional",shape:e,default:t}}}function Aoo(e,t){return e==null?void 0:Object.entries(e).map(([n,i])=>TQ(i.convert())?.map(o=>((t!=null&&!t.includes(n)||t==null&&!C1v(i))&&(o=I1v(o,o.type==="enum"?o.default:void 0)),{key:Yj.PropertyKey(n),valueShape:o,description:i.description,availability:i.availability?.convert()})).filter(mA)).filter(mA).reduce((n,i)=>n.flatMap(a=>i.length>0?i.map(o=>[...a,o]):[[...a]]),[[]])}function JUu(e,t){return xx(e)?_be(e,t,void 0):e}function X8i(e,t){return e!=null&&e!==""?e:t!=null&&t!==""?t:void 0}function M1v(e,t){let r={...e};for(let[n,i]of Object.entries(t??{}))r[n]=[...r[n]??[],...i];return Object.keys(r).length>0?r:void 0}function B1v(e,t){if(e==null)return t;if(t==null)return e;let r=[];for(let n of e)for(let i of t)r.push({path:n.path??i.path,responseStatusCode:n.responseStatusCode??i.responseStatusCode,name:n.name??i.name,description:n.description??i.description,pathParameters:n.pathParameters??i.pathParameters,queryParameters:n.queryParameters??i.queryParameters,headers:n.headers??i.headers,requestBody:n.requestBody??i.requestBody,responseBody:n.responseBody??i.responseBody,snippets:{...i.snippets,...n.snippets}});return r}var T1v=$i(PJ());var DVf=["decimal","decimal128","double-int","double","float","sf-decimal"],CVf=["int16","int32","int64","int8","sf-integer","uint8"],IVf=["base64url","binary","byte","char","commonmark","date-time","date","decimal","decimal128","duration","email","hostname","html","http-date","idn-email","idn-hostname","int64","ipv4","ipv6","iri-reference","iri","json-pointer","media-range","password","regex","relative-json-pointer","sf-binary","sf-boolean","sf-string","sf-token","time","uri-reference","uri-template","uri","uuid"],MVf=["beta","pre-release","in-development","generally-available","deprecated"];function qee(e,t){return xx(e)?_be(e,t,{type:"unknown","x-fern-type":"unknown",additionalProperties:!1}):e}var iyt=class extends LO{availability;constructor(t){super(t),this.safeParse()}parse(){if(qee(this.input,this.context.document)?.deprecated)this.availability="deprecated";else{let r=this.input[Pjv];r!=null&&(MVf.includes(r)?this.availability=r:(this.context.errors.warning({message:`Expected one of: ${MVf.join(", ")}. Received: ${r}`,path:this.accessPath}),this.availability=void 0))}}convert(){switch(this.availability){case"beta":case"pre-release":return Yj.Availability.Beta;case"in-development":return Yj.Availability.InDevelopment;case"generally-available":return Yj.Availability.GenerallyAvailable;case"deprecated":return Yj.Availability.Deprecated;case void 0:return;default:new T1v.UnreachableCaseError(this.availability);return}}};var $Uu=$i(PJ());function q1v(e){return typeof e=="object"&&e!=null&&"language"in e}function R1v(e){return typeof e=="object"&&e!=null&&"sdk"in e}function N1v(e){return typeof e=="object"&&e!=null&&("error"in e||"body"in e)}function F1v(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)}function KUu(e){return typeof e=="object"&&e!=null&&"event"in e}function BVf(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)&&e.stream.every(KUu)}function Z8i(e){return typeof e=="object"&&e!=null&&"filename"in e&&"data"in e&&typeof e.filename=="string"&&typeof e.data=="string"}function x1v(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}var YUu=class extends LO{path;successResponseStatusCode;requestBodyByContentType;responseBodies;examples;constructor(t,r,n,i,a){super(t),this.path=r,this.successResponseStatusCode=n,this.requestBodyByContentType=i,this.responseBodies=a,this.safeParse()}parse(){this.examples=this.input[Njv]}convertFormDataExampleRequest(t,r){if(t.fields!=null)switch(t.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(t.fields).map(([i,a])=>{let o=typeof r=="object"?r[i]:void 0;switch(a.multipartType){case"file":return Z8i(o)?[i,{type:"filenameWithData",filename:o.filename,data:Yj.FileId(o.data)}]:o!=null?[i,{type:"filename",value:o}]:void 0;case"files":{if(Array.isArray(o)){if(o.every(c=>Z8i(c)))return[i,{type:"filenamesWithData",value:o.map(c=>({filename:c.filename,data:Yj.FileId(c.data)}))}];if(o.every(c=>typeof c=="string"))return[i,{type:"filenames",value:o}]}return}case"property":return[i,{type:"json",value:o}];case void 0:return;default:new $Uu.UnreachableCaseError(a.multipartType);return}}).filter(mA))};case"json":return{type:"json",value:r};case"bytes":return typeof r=="string"?{type:"bytes",value:{type:"base64",value:r}}:void 0;default:return}}convert(){if(this.examples==null)return;this.requestBodyByContentType!=null&&Object.keys(this.requestBodyByContentType).length>1&&this.context.logger.warn(`Multiple request bodies found for #/${[this.accessPath,this.pathId,"x-fern-examples"].join("/")}. Coercing to first request body until supported.`);let t=Object.keys(this.requestBodyByContentType??{})[0];return this.examples.flatMap(r=>(this.responseBodies??[]).map(n=>{let i=t!=null?this.requestBodyByContentType?.[t]:void 0,a;if(i!=null)switch(i.contentType){case"form-data":a=x1v(r.request)?this.convertFormDataExampleRequest(i,r.request):void 0;break;case"json":a=r.request!=null?{type:"json",value:r.request}:void 0;break;case"bytes":a=typeof r.request=="string"&&r.request!=null?{type:"bytes",value:{type:"base64",value:r.request}}:void 0;break;case void 0:break;default:new $Uu.UnreachableCaseError(i.contentType);break}let o;switch(n.contentType){case"application/json":{N1v(r.response)&&(o={type:"json",value:r.response.body});break}case"text/event-stream":{BVf(r.response)&&(o={type:"sse",value:r.response.stream.map(l=>({event:l.event,data:l.data}))});break}case"application/octet-stream":!BVf(r.response)&&F1v(r.response)&&(o={type:"stream",value:r.response.stream});break;case void 0:break;default:new $Uu.UnreachableCaseError(n.contentType);break}let c={};r["code-samples"]?.forEach(l=>{q1v(l)?l.language!=null&&(c[l.language]??=[],c[l.language]?.push({name:l.name,language:l.language,install:l.install,code:l.code,generated:!1,description:l.docs})):R1v(l)&&l.sdk!=null&&(c[l.sdk]??=[],c[l.sdk]?.push({name:l.name,language:l.sdk,install:void 0,code:l.code,generated:!1,description:l.docs}))});let f=Object.fromEntries(Object.entries(r["path-parameters"]??{}).map(([l,m])=>[Yj.PropertyKey(l),m])),u=Object.fromEntries(Object.entries(r["query-parameters"]??{}).map(([l,m])=>[Yj.PropertyKey(l),m])),s=Object.fromEntries(Object.entries(r.headers??{}).map(([l,m])=>[Yj.PropertyKey(l),m]));return{path:this.path,responseStatusCode:this.successResponseStatusCode,name:r.name,description:r.docs,pathParameters:Object.keys(f).length>0?f:void 0,queryParameters:Object.keys(u).length>0?u:void 0,headers:Object.keys(s).length>0?s:void 0,requestBody:a,responseBody:o,snippets:c}}))}};var Sns=class extends LO{groupName;constructor(t){super(t),this.safeParse()}parse(){this.groupName=this.input[gUu]}convert(){if(this.groupName==null)return;let t;return Array.isArray(this.groupName)?t=this.groupName:t=[this.groupName],t.map(r=>Yj.api.v1.SubpackageId($qr(r)))}};var XUu=class extends LO{sdkMethodName;constructor(t){super(t),this.safeParse()}parse(){this.sdkMethodName=this.input[jjv]}convert(){return this.sdkMethodName}};var ZUu=class extends LO{isWebhook;constructor(t){super(t),this.safeParse()}parse(){this.isWebhook=this.input[Ejv]}convert(){return this.isWebhook}};var kUu=class extends LO{codeSamples;constructor(t){super(t),this.safeParse()}parse(){this.codeSamples=[...this.input[zjv]??[],...this.input[Qjv]??[]],this.codeSamples.forEach(t=>{[...Object.values(Yj.api.v1.read.SupportedLanguage),"Kotlin","Swift","PHP"].map(r=>r.toLowerCase()).includes(t.lang.toLowerCase())||this.context.errors.warning({message:`Unsupported language: ${t.lang}. This may not render correctly.`,path:this.accessPath})})}convert(){let t={};if(this.codeSamples?.forEach(r=>{t[r.lang.toLowerCase()]??=[],t[r.lang.toLowerCase()]?.push({name:r.label,language:r.lang,code:r.source,install:void 0,generated:!1,description:void 0})}),Object.keys(t).length!==0)return t}};var qda=$i(PJ());function TVf(e,t){return xx(e)?_be(e,t,void 0):e}function z1v(e,t){return e.replace(/{(\w+)}/g,(r,n)=>t[n]!=null&&typeof t[n]=="string"||typeof t[n]=="number"||typeof t[n]=="boolean"?`${t[n]}`:r)}var Pde="",vWr=class extends LO{path;responseStatusCode;name;shapes;resolvedRequestInput;resolvedResponseInput;summary;constructor(t,r,n,i,a){super(t),this.path=r,this.responseStatusCode=n,this.name=i,this.shapes=a,this.safeParse()}validateFormDataRequestExample(){return typeof this.resolvedRequestInput?.value!="object"?!1:Object.entries(this.shapes.requestBody?.fields??{}).reduce((t,[r,n])=>{let i=this.resolvedRequestInput?.value[r];switch(n.multipartType){case"file":return t&&(Z8i(i)||typeof i=="string");case"files":return t&&Array.isArray(i)&&i.every(a=>Z8i(a)||typeof a=="string");case"property":return t;case void 0:return t&&!1;default:return new qda.UnreachableCaseError(n.multipartType),t}},!0)}parse(){let t=this.shapes.requestBody?.schema?.example({includeOptionals:!1,override:void 0});this.resolvedRequestInput=TVf(this.input?.requestExample,this.context.document)??(t!=null?{value:t}:void 0);let r=this.shapes.responseBody?.schema?.example({includeOptionals:!1,override:void 0});if(this.resolvedResponseInput=TVf(this.input?.responseExample,this.context.document)??(r!=null?{value:r}:void 0),this.summary=this.input?.requestExample?.summary??this.input?.responseExample?.summary,this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody?.contentType){case"json":{if(typeof this.resolvedRequestInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break}case"bytes":{if(typeof this.resolvedRequestInput.value!="string"){this.context.errors.error({message:"Invalid example, expected string for bytes",path:this.accessPath});return}break}case"form-data":{if(!this.validateFormDataRequestExample()){this.context.errors.error({message:"Invalid example, expected valid form-data",path:this.accessPath});return}break}case void 0:break;default:new qda.UnreachableCaseError(this.shapes.requestBody?.contentType),this.context.errors.error({message:"Invalid example, unsupported content type",path:this.accessPath});return}if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody?.contentType){case"application/json":if(this.resolvedResponseInput!=null&&typeof this.resolvedResponseInput!="object"||this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break;case"text/event-stream":if(this.resolvedResponseInput.value!=null&&!Array.isArray(this.resolvedResponseInput.value)&&!this.resolvedResponseInput.value.every(KUu)){this.context.errors.error({message:"Invalid example, expected array of SSE events for event-stream",path:this.accessPath});return}break;case"application/octet-stream":if(this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="string"&&!Array.isArray(this.resolvedResponseInput.value)){this.context.errors.error({message:"Invalid example, expected string or array for octet-stream",path:this.accessPath});return}break;case void 0:break;default:new qda.UnreachableCaseError(this.shapes.responseBody?.contentType);return}}convertFormDataExampleRequest(){if(!(this.resolvedRequestInput==null||this.shapes.requestBody?.fields==null))switch(this.shapes.requestBody?.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(this.shapes.requestBody.fields).map(([r,n])=>{let i=this.resolvedRequestInput?.value?.[r];switch(n.multipartType){case"file":return Z8i(i)?[r,{type:"filenameWithData",filename:i.filename,data:Yj.FileId(i.data)}]:[r,{type:"filename",value:i}];case"files":{if(Array.isArray(i)){if(i.every(a=>Z8i(a)))return[r,{type:"filenamesWithData",value:i.map(a=>({filename:a.filename,data:Yj.FileId(a.data)}))}];if(i.every(a=>typeof a=="string"))return[r,{type:"filenames",value:i}]}return}case"property":return[r,{type:"json",value:i}];case void 0:return;default:new qda.UnreachableCaseError(n.multipartType);return}}).filter(mA))};case"json":return{type:"json",value:this.resolvedRequestInput.value};case"bytes":return typeof this.resolvedRequestInput.value=="string"?{type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}}:void 0;default:return}}convertDescription(){if(this.resolvedRequestInput!=null&&this.resolvedResponseInput!=null)return this.resolvedResponseInput.description;if(this.resolvedRequestInput!=null)return this.resolvedRequestInput.description;if(this.resolvedResponseInput!=null)return this.resolvedResponseInput.description}convert(){let t;if(this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody.contentType){case"form-data":t=this.convertFormDataExampleRequest();break;case"json":t={type:"json",value:this.resolvedRequestInput.value};break;case"bytes":t={type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}};break;case void 0:break;default:new qda.UnreachableCaseError(this.shapes.requestBody?.contentType);break}let r;if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody.contentType){case"application/json":{r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break}case"text/event-stream":r={type:"sse",value:this.resolvedResponseInput?.value};break;case"application/octet-stream":r={type:typeof this.resolvedResponseInput?.value=="string"?"filename":"stream",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;case void 0:r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;default:new qda.UnreachableCaseError(this.shapes.responseBody?.contentType);break}let n=Object.fromEntries(Object.entries(this.shapes.pathParameters??{}).map(([o,c])=>[o,c.example({includeOptionals:!1,override:o})]));n=Object.keys(n).length>0?n:void 0;let i=Object.fromEntries(Object.entries(this.shapes.queryParameters??{}).map(([o,c])=>c.required||c.inputExample!=null?[o,c.example({includeOptionals:!1,override:o})]:void 0).filter(mA));i=Object.keys(i).length>0?i:void 0;let a=Object.fromEntries(Object.entries(this.shapes.requestHeaders??{}).map(([o,c])=>c.required||c.inputExample!=null?[o,c.example({includeOptionals:!1,override:o})]:void 0).filter(mA));if(a=Object.keys(a).length>0?a:void 0,!(this.path==null&&t==null&&r==null&&a==null&&i==null&&n==null))return{path:z1v(this.path,n??{}),responseStatusCode:this.responseStatusCode,name:this.name!=null?yWr(this.name):this.summary!=null?yWr(this.summary):void 0,description:this.convertDescription(),pathParameters:n,queryParameters:i,headers:a,requestBody:t,responseBody:r,snippets:void 0}}};function Q1v(e,t){return xx(e)?_be(e,t,void 0):e}var k1v=$i(PJ());var L1v="#/components/schemas/";function Poo(e){if(e.$ref.startsWith(L1v))return e.$ref.replace(L1v,"")}function Lwi(e){if(e!=null)return{type:"alias",value:{type:"nullable",shape:e}}}function k8i(e){return typeof e.type=="string"&&e.type==="array"}function U1v(e){return e.type==="boolean"}function V1v(e){return e.type==="integer"}function e2i(e){return!Array.isArray(e.type)&&!k8i(e)}function W1v(e){return e!=null&&Array.isArray(e)&&e.every(t=>t.type==="null"||e2i(t)||k8i(t))}function G1v(e){return"nullable"in e&&typeof e.nullable=="boolean"}function H1v(e){return e.type==="null"}function J1v(e){return e.type==="number"}function qVf(e){return e.type==null||typeof e.type=="string"&&e.type==="object"}function K1v(e){return e.type==="string"}var eVu=class extends Xxe{item;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.item=new yU({input:this.input.items,context:this.context,accessPath:this.accessPath,pathId:"items",seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}),this.input.items==null&&this.context.errors.error({message:"Expected 'items' property to be specified",path:this.accessPath})}convert(){return TQ(this.item?.convert())?.map(r=>({type:"alias",value:{type:"list",itemShape:r}}))}example(t){return this.input.example??this.input.examples?.[0]??[this.item?.example(t)]}};var tVu=class extends Tee{constValue;description;availability;constructor(t){super(t),this.safeParse()}parse(){this.input.const!=null&&(typeof this.input.const=="string"||typeof this.input.const=="number"||typeof this.input.const=="boolean")?this.constValue=this.input.const.toString():this.context.errors.warning({message:`Unsupported const type: ${typeof this.input}`,path:this.accessPath}),this.description=this.input.description,this.availability=new iyt({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"})}convert(){if(this.constValue!=null)return{type:"enum",default:this.constValue,values:[{value:this.constValue,description:this.description,availability:this.availability?.convert()}]}}example(){return this.input.example??this.input.examples?.[0]??this.constValue}};var rVu=class extends Xxe{typeNodes;nullable;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.parse()}parse(){this.typeNodes=this.input.map(t=>{if(t.type==="null")this.nullable=!0;else return new yU({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName})}).filter(mA)}convert(){if(this.typeNodes==null)return;let n=this.typeNodes.map(i=>TQ(i.convert())?.map(o=>({displayName:i.name,shape:o,description:i.description,availability:i.availability?.convert()}))).filter(mA).reduce((i,a)=>i.flatMap(o=>a.length>0?a.map(c=>[...o,c]):[[...o]]),[[]]).map(i=>({type:"undiscriminatedUnion",variants:i}));return this.nullable?n.map(Lwi).filter(mA):n}example(t){return this.nullable?null:this.typeNodes?.[0]?.example(t)}};function nVu(e){return e!=null&&e.length>0?e:[void 0]}var woo=class extends Xxe{description;extends=[];properties;extraProperties;requiredProperties;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.extends=[],this.requiredProperties=this.input.required,this.properties=Object.fromEntries(Object.entries(this.input.properties??{}).map(([t,r])=>[t,new yU({input:r,context:this.context,accessPath:this.accessPath,pathId:["properties",t],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})])),this.extraProperties=this.input.additionalProperties!=null?typeof this.input.additionalProperties=="boolean"?this.input.additionalProperties?this.input.title:void 0:new yU({input:this.input.additionalProperties,context:this.context,accessPath:this.accessPath,pathId:["additionalProperties"],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0,this.input.allOf!=null&&(this.extends=this.extends.concat(this.input.allOf.map((t,r)=>{if(xx(t))return Poo(t);this.properties={...this.properties,...Object.fromEntries(Object.entries(t.properties??{}).map(([n,i])=>[n,new yU({input:i,context:this.context,accessPath:this.accessPath,pathId:["allOf",r.toString(),"properties",n],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))}}).filter(mA))),this.description=this.input.description}convertProperties(){if(this.properties!=null)return Aoo(this.properties,this.requiredProperties)}convertExtraProperties(){return this.extraProperties==null?void 0:typeof this.extraProperties=="string"?[{type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:{type:"alias",value:{type:"unknown",displayName:this.extraProperties}}}]:TQ(this.extraProperties.convert())?.map(r=>({type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:r})).filter(mA)}convert(){let t=this.convertProperties();if(t==null)return;let r=this.convertExtraProperties();return t.flatMap(n=>nVu(r).map(i=>(this.extends==null||this.extends.length===0)&&n.length===0&&i!=null?{type:"alias",value:i}:{type:"object",extends:this.extends.map(a=>Yj.TypeId(a)),properties:n,extraProperties:i}))}example({includeOptionals:t}){let r={...this.properties};return this.input.allOf?.forEach(n=>{let i=qee(n,this.context.document);i!=null&&(r={...r,...Object.fromEntries(Object.entries(i.properties??{}).map(([a,o])=>[a,new yU({input:o,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))})}),this.input.example??this.input.examples?.[0]??(!t&&this.requiredProperties!=null&&this.requiredProperties.length>0?this.requiredProperties?.reduce((n,i)=>{let a=r?.[i];return n[i]=a?.example({includeOptionals:t,override:i}),n},{}):Object.entries(r).reduce((n,[i,a])=>(n[i]=a?.example({includeOptionals:t,override:i}),n),{}))}};var iVu=class extends Xxe{isNullable;discriminated;discriminant;discriminatedMapping;undiscriminatedMapping;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.input.oneOf!=null||this.input.anyOf!=null)if(this.isNullable=(this.input.oneOf??this.input.anyOf)?.some(t=>qee(t,this.context.document)?.type==="null"),this.input.discriminator==null)this.discriminated=!1,this.undiscriminatedMapping=(this.input.oneOf??this.input.anyOf)?.map(t=>qee(t,this.context.document)?.type!=="null"?new yU({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0).filter(mA);else{let t=this.input.discriminator.mapping;if(t!=null){this.discriminated=!0,this.discriminant=this.input.discriminator.propertyName,this.discriminatedMapping={};let r=this.discriminatedMapping;Object.entries(t).map(([n,i])=>{let a=qee({$ref:i},this.context.document);if(a==null){this.context.errors.warning({message:`Expected schema reference. Received undefined reference: ${i}`,path:[...this.accessPath,"discriminator","mapping",n]});return}r[n]=new yU({input:a,context:this.context,accessPath:[...this.accessPath,"discriminator","mapping",n],pathId:n,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})})}}}convert(){if(!this.discriminated&&this.undiscriminatedMapping?.length===1){let i=this.undiscriminatedMapping?.flatMap(a=>a.convert()).filter(mA);return this.isNullable&&i!=null?i.map(Lwi).filter(mA):i}let t=0,r=this.discriminated&&this.discriminant!=null&&this.discriminatedMapping!=null?{type:"discriminatedUnion",discriminant:Yj.PropertyKey(this.discriminant),variants:Object.entries(this.discriminatedMapping).flatMap(([i,a])=>TQ(a.convert())?.map(c=>{if(!(c==null||c.type!=="object"))return{discriminantValue:i,displayName:a.name??yWr(i),availability:a.availability?.convert(),description:a.description,...c}}).filter(mA)).filter(mA)}:this.undiscriminatedMapping!=null?{type:"undiscriminatedUnion",variants:this.undiscriminatedMapping.flatMap(i=>TQ(i.convert())?.map(o=>{if(o==null)return;t+=1;let c=o.type==="object"?yWr(`${this.schemaName??"Variant"} ${t}`):void 0;return{displayName:i.name??(o.type==="alias"&&o.value.type==="id"?yWr(o.value.id):c),shape:o,description:i.description,availability:i.availability?.convert()}}).filter(mA)).filter(mA)}:void 0,n=this.isNullable?Lwi(r):r;return n!=null?[n]:void 0}example(t){return this.input.example??this.input.examples?.[0]??this.undiscriminatedMapping?.[0]?.example(t)??Object.values(this.discriminatedMapping??{})[0]?.example(t)}};var aVu=class extends Tee{default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.input.default!=null&&typeof this.input.default!="boolean"&&this.context.errors.warning({message:`Expected default value to be a boolean. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default}convert(){return{type:"alias",value:{type:"primitive",value:{type:"boolean",default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:!1)}};var t2i=class extends Tee{default;values=[];nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){if(this.input.enum!=null){let t=!0;this.values=this.input.enum.map((r,n)=>{if(t){if(xx(r)){let i=qee(r,this.context.document);r=typeof i=="string"?i:typeof i?.default=="string"?i?.default:typeof i?.example=="string"?i.example:void 0}if(typeof r!="string"){this.context.errors.error({message:`Expected enum values to be strings. Received ${r}`,path:[...this.accessPath,`enum[${n}]`]}),t=!1;return}return r}}).filter(mA),this.values=Array.from(new Set(this.values))}this.default=this.input.default}convert(){return{type:"enum",values:this.values.map(t=>({value:t,description:void 0,availability:void 0})),default:this.default}}example(){return this.input.example??this.input.examples?.[0]??this.default??this.values[0]??(this.nullable?null:void 0)}};var $1v=$i(PJ());function irM(e){return CVf.includes(e)}var oVu=class extends Tee{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be an integer. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(irM(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${CVf.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="integer";if(this.format!=null)switch(this.format){case"int64":t="long";break;case"int8":case"int16":case"int32":case"uint8":case"sf-integer":case void 0:t="integer";break;default:new $1v.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var sVu=class extends Tee{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){this.displayName=this.input.title}convert(){return Lwi({type:"alias",value:{type:"unknown",displayName:this.displayName}})}example(){return null}};var Y1v=$i(PJ());function arM(e){return DVf.includes(e)}var uVu=class extends Tee{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be a number. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(arM(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${DVf.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="double";if(this.format!=null)switch(this.format){case"decimal":case"decimal128":case"double-int":case"double":case"float":case"sf-decimal":case void 0:t="double";break;default:new Y1v.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var X1v=$i(PJ());function orM(e){return IVf.includes(e)}var cVu=class extends Tee{format;regex;default;minLength;maxLength;enum;mimeType;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}mapToFdrType(t){switch(t){case"base64url":case"binary":case"byte":case"sf-binary":return"base64";case"date-time":return"datetime";case"int64":return"bigInteger";case"date":return"date";case"uuid":return"uuid";case"char":case"commonmark":case"decimal":case"decimal128":case"duration":case"email":case"hostname":case"html":case"http-date":case"idn-email":case"idn-hostname":case"ipv4":case"ipv6":case"iri-reference":case"iri":case"json-pointer":case"media-range":case"password":case"regex":case"relative-json-pointer":case"sf-boolean":case"sf-string":case"sf-token":case"time":case"uri-reference":case"uri-template":case"uri":case void 0:return"string";default:return new X1v.UnreachableCaseError(t),"string"}}parse(){this.regex=this.input.pattern,this.minLength=this.input.minLength,this.maxLength=this.input.maxLength,this.mimeType=this.input.contentMediaType,this.input.default!=null&&typeof this.input.default!="string"&&this.context.errors.warning({message:`Expected default value to be a string. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(orM(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${IVf.join(", ")}. Received ${this.input.format}`,path:this.accessPath})),this.input.enum!=null&&(this.enum=new t2i({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"enum",nullable:this.nullable}))}convert(){if(this.enum!=null)return this.enum.convert();let t="string";return this.format!=null&&(t=this.mapToFdrType(this.format)),{type:"alias",value:{type:"primitive",value:t==="base64"?{type:t,mimeType:this.mimeType,default:this.default}:{type:t,format:t==="string"?this.format:void 0,regex:this.regex,minLength:this.minLength,maxLength:this.maxLength,default:this.default}}}}example({override:t}){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:t??"string")}};var Z1v=$i(PJ());var lVu=class extends Tee{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){(0,Z1v.noop)()}convert(){return{type:"alias",value:{type:"unknown",displayName:void 0}}}example(){}};var Rda=class extends Xxe{description;availability;schemaId;maybeEnumConverterNode;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.description=t.description,this.availability=t.availability,this.safeParse()}parse(){this.schemaId=Poo(this.input);let t=qee(this.input,this.context.document);t?.enum!=null&&e2i(t)&&(this.maybeEnumConverterNode=new t2i({input:t,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",nullable:this.nullable})),this.schemaId==null&&this.context.errors.error({message:`Unprocessable reference: ${this.input.$ref}`,path:this.accessPath})}convert(){if(this.schemaId!=null)return{type:"alias",value:{type:"id",id:Yj.TypeId(this.schemaId),default:this.maybeEnumConverterNode?.default!=null?{type:"enum",value:this.maybeEnumConverterNode.default}:void 0}}}example(t){let r=qee(this.input,this.context.document);if(r!=null)return new yU({input:r,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName}).example(t)}};var yU=class e extends Xxe{typeShapeNode;description;name;examples;availability;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.description=this.input.description,this.availability=new iyt({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),e2i(this.input)&&G1v(this.input)&&(this.nullable=this.input.nullable!=null?this.input.nullable:this.nullable),xx(this.input)){let t=Poo(this.input);if(t==null){this.context.errors.error({message:"Reference object does not have a valid schema ID",path:this.accessPath});return}if(this.seenSchemas.has(t)){this.context.errors.warning({message:"Circular or deeply nested schema found, terminating",path:this.accessPath});return}this.seenSchemas.add(t),this.typeShapeNode=new Rda({input:this.input,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName,description:this.description,availability:this.availability})}else if(this.name=this.input.title,this.examples=this.input.example,this.input.const!=null)this.typeShapeNode=new tVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});else if(W1v(this.input))this.typeShapeNode=new rVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(e2i(this.input)&&(this.input.oneOf!=null||this.input.anyOf!=null))this.typeShapeNode=new iVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(qVf(this.input)&&this.input.allOf!=null)this.typeShapeNode=new woo({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(e2i(this.input)&&this.input.enum!=null)this.typeShapeNode=new t2i({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable});else if(typeof this.input.type=="string"||Array.isArray(this.input.type)&&this.input.type.length===1){if(this.input.type=Array.isArray(this.input.type)?this.input.type[0]:this.input.type,!Array.isArray(this.input.type))switch(this.input.type){case"object":qVf(this.input)&&(this.typeShapeNode=new woo({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"array":k8i(this.input)&&(this.typeShapeNode=new eVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"boolean":U1v(this.input)&&(this.typeShapeNode=new aVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"integer":V1v(this.input)&&(this.typeShapeNode=new oVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"number":J1v(this.input)&&(this.typeShapeNode=new uVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"string":K1v(this.input)&&(this.typeShapeNode=new cVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"null":H1v(this.input)&&(this.typeShapeNode=new sVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}));break;case void 0:break;default:new k1v.UnreachableCaseError(this.input.type);break}}else if(Array.isArray(this.input.type)&&this.input.type.includes("null")&&this.input.type.length===2){let t=this.input.type.filter(r=>r!=="null")[0];t!=="array"&&(this.typeShapeNode=new e({input:{...this.input,type:t},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:!0,schemaName:this.schemaName}))}else this.input.properties!=null&&(this.typeShapeNode=new woo({input:{...this.input,type:"object"},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));this.typeShapeNode==null&&(this.typeShapeNode=new lVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),!xx(this.input)&&(!k8i(this.input)&&this.input==null||k8i(this.input)&&this.input.items==null)&&this.context.errors.error({message:"Expected type declaration. Received: null",path:this.accessPath}))}convert(){let t=this.typeShapeNode?.convert();if(t==null)return;let r=TQ(t)?.map(n=>this.nullable?Lwi(n):n).filter(mA);return Array.isArray(t)&&t.length>1?r:r?.[0]}example(t){return this.availability?.availability!=="deprecated"?this.typeShapeNode?.example(t):void 0}};function r2i(e){if(e!=null)return Aoo(e,Object.entries(e??{}).map(([t,r])=>r.required?t:void 0).filter(mA))}var bWr=class extends Tee{availability;required;schema;description;inputExample;constructor(t){super(t),this.safeParse(t.parameterName)}parse(t){this.description=this.input.description;let r;xx(this.input)?r=this.input:this.input.schema!=null?(r=this.input.schema,this.required=this.input.required):(r={type:"string"},this.required=!1),this.availability=new iyt({input:r,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=new yU({input:r,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:t});let n=Q1v(this.input,this.context.document);this.inputExample=n?.example??Object.values(n?.examples??{})[0]}convert(){return this.schema?.convert()}example(t){return this.inputExample??this.schema?.example(t)}};function eEv(e,t){return xx(e)?_be(e,t,void 0):e}var RVf=$i(PJ());function fVu(e){let{uniqueId:t,type:r,contextTypes:n,description:i,availability:a}=e;n[Yj.TypeId(t)]={name:t,shape:r,description:i,availability:a}}var tEv=$i(yKl(),1),joo=class e{type;subtype;essence;parameters;mimeType;input;constructor(t,r,n,i,a,o){this.type=t,this.subtype=r,this.essence=n,this.parameters=i,this.mimeType=a,this.input=o}static APPLICATION_JSON="application/json";static APPLICATION_OCTET_STREAM="application/octet-stream";static MULTIPART_FORM_DATA="multipart/form-data";static parse(t){if(t==null)return null;let r=tEv.default.parse(t);return r==null?null:new e(r.type,r.subtype,r.essence,r.parameters,r,t)}toString(){return this.input}isText(){return this.type==="text"}isImage(){return this.type==="image"}isAudio(){return this.type==="audio"}isVideo(){return this.type==="video"}isFont(){return this.type==="font"}isMultipart(){return this.type==="multipart"}isApplication(){return this.type==="application"}isMessage(){return this.type==="message"}isModel(){return this.type==="model"}isCSS(){return this.isText()&&this.subtype==="css"}isCSV(){return this.isText()&&this.subtype==="csv"}isMarkdown(){return this.isText()&&this.subtype==="markdown"}isPlainText(){return this.isText()&&this.subtype==="plain"}isEventStream(){return this.isText()&&this.subtype==="event-stream"}isMultiPartFormData(){return this.isMultipart()&&this.subtype==="form-data"}isJSON(){return this.isApplication()&&this.subtype==="json"}containsJSON(){return this.isApplication()&&this.subtype.includes("json")}isURLEncoded(){return this.isApplication()&&this.subtype==="x-www-form-urlencoded"}isOctetStream(){return this.isApplication()&&this.subtype==="octet-stream"}isPDF(){return this.isApplication()&&this.subtype==="pdf"}isZip(){return this.isApplication()&&this.subtype==="zip"}isGzip(){return this.isApplication()&&this.subtype==="gzip"}isTar(){return this.isApplication()&&this.subtype==="tar"}isBrotli(){return this.isApplication()&&this.subtype==="br"}isDeflate(){return this.isApplication()&&this.subtype==="deflate"}isProtobuf(){return this.isApplication()&&this.subtype==="protobuf"}isAvif(){return this.isImage()&&this.subtype==="avif"}isWebP(){return this.isImage()&&this.subtype==="webp"}isSVG(){return this.isImage()&&this.subtype==="svg+xml"}isPNG(){return this.isImage()&&this.subtype==="png"}isJPEG(){return this.isImage()&&this.subtype==="jpeg"}isGIF(){return this.isImage()&&this.subtype==="gif"}isMPEG(){return this.isAudio()&&this.subtype==="mpeg"}isWAV(){return this.isAudio()&&this.subtype==="wav"}isHTML(){return this.mimeType.isHTML()}isXML(){return this.mimeType.isXML()}isJavaScript(){return this.mimeType.isJavaScript()}};function srM(e){return typeof e.securitySchemes=="object"&&e.securitySchemes!=null}var dVu=class extends LO{typeSchemas;securitySchemes;constructor(t){super(t),this.safeParse()}parse(){this.input.schemas!=null&&(this.typeSchemas=Object.fromEntries(Object.entries(this.input.schemas).map(([t,r])=>[t,new yU({input:r,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:new Set,nullable:void 0,schemaName:t})]))),srM(this.input)&&this.input.securitySchemes!=null&&(this.securitySchemes=Object.fromEntries(Object.entries(this.input.securitySchemes??{}).map(([t,r],n)=>{let i;if(xx(r)?i=AUu(r.$ref,this.context.document):i=r,i!=null)return[t,new moo({input:i,context:this.context,accessPath:this.accessPath,pathId:["securitySchemes",`${n}`]})]}).filter(mA)))}convert(){return{auths:this.securitySchemes!=null?Object.fromEntries(Object.entries(this.securitySchemes??{}).map(([t,r])=>{let n=r.convert();if(n!=null)return[Yj.api.latest.AuthSchemeId(t),n]}).filter(mA)):void 0,types:this.typeSchemas!=null?Object.fromEntries(Object.entries(this.typeSchemas).map(([t,r])=>{let n=r.name??t,i=TQ(r.convert());return i==null?[t,void 0]:[Yj.TypeId(t),{name:n,shape:i[0],description:r.description,availability:void 0}]}).filter(([t,r])=>mA(r))):void 0}}};var pVu=class extends yU{multipartType;contentType;constructor(t){super(t),this.safeParse()}parse(){super.parse();let t=qee(this.input,this.context.document);if(t==null){this.context.errors.error({message:`Expected multipart form data property definition. ${xx(this.input)?`Received undefined reference: ${this.input.$ref}`:""}`,path:this.accessPath});return}if(t.type==="string"&&t.format==="binary")this.multipartType="file",this.contentType=t.contentMediaType;else if(t.type==="array"){let r=qee(t.items,this.context.document);r?.type==="string"&&r?.format==="binary"?(this.multipartType="files",this.contentType=r?.contentMediaType):(this.context.errors.warning({message:"Expected multipart form data files definition with array type with internal string type and binary format.",path:this.accessPath}),this.multipartType=void 0,this.contentType=void 0)}else this.multipartType="property",this.contentType=t.contentMediaType}};var _Vu=class extends LO{description;method;path;schema;isOptional;contentType;availability;requiredFields;fields;examples;constructor(t){super(t),this.method=t.method,this.path=t.path,this.safeParse(t)}parse({contentType:t}){if(this.input.schema!=null){let n=qee(this.input.schema,this.context.document);this.availability=new iyt({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=xx(this.input.schema)?new Rda({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:!1,schemaName:"Request Body",description:this.input.schema.description,availability:this.availability}):void 0;let i=joo.parse(t);i?.containsJSON()?(this.contentType="json",this.schema=this.schema??new yU({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:"Request Body"})):i?.isOctetStream()?(this.contentType="bytes",this.isOptional=n?.required==null):i?.isMultiPartFormData()?(this.contentType="form-data",this.requiredFields=n?.required,this.fields=Object.fromEntries(Object.entries(n?.properties??{}).map(([a,o])=>{if(o!=null)return[a,new pVu({input:o,context:this.context,accessPath:this.accessPath,pathId:`schema.${a}`,seenSchemas:new Set,nullable:void 0,schemaName:a})]}).filter(mA))):this.context.errors.warning({message:`Expected request body of reference or object with json, streaming or form-data content types. Received: ${t}`,path:this.accessPath})}let r=this.schema?.example({includeOptionals:!0,override:void 0});this.examples={...this.input.example!=null?{[Pde]:{value:this.input.example}}:{},...this.input.examples},r!=null&&Object.keys(this.examples).length===0&&(this.examples={[Pde]:{value:r}})}convertJsonLike(){let t=this.schema?.convert();return t==null?void 0:TQ(t)?.map(n=>{let i=n.type;switch(i){case"object":case"alias":return n;case"enum":case"undiscriminatedUnion":case"discriminatedUnion":{let a=$qr([this.method,this.path,this.contentType,"request"].join("_"));return fVu({uniqueId:a,type:n,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:Yj.TypeId(a),default:n.type==="enum"&&n.default!=null?{type:"enum",value:n.default}:void 0}}}case void 0:return;default:new RVf.UnreachableCaseError(i);return}}).filter(mA)}convert(){if(this.schema instanceof Rda)return this.schema.convert();switch(this.contentType){case"json":return this.convertJsonLike();case"bytes":return{type:"bytes",isOptional:this.isOptional??!1,contentType:this.contentType};case"form-data":return Object.entries(this.fields??{}).map(([n,i])=>{switch(i.multipartType){case"file":return[{type:i.multipartType,key:Yj.PropertyKey(n),isOptional:this.requiredFields?.includes(n)==null,contentType:i.contentType,description:i.description,availability:i.availability?.convert()}];case"files":return[{type:i.multipartType,key:Yj.PropertyKey(n),isOptional:this.requiredFields?.includes(n)==null,contentType:i.contentType,description:i.description,availability:i.availability?.convert()}];case"property":{let a=TQ(i.convert()),o=i.multipartType;return a?.map(c=>({type:o,key:Yj.PropertyKey(n),contentType:i.contentType,exploded:void 0,valueShape:c,description:i.description,availability:i.availability?.convert()}))}case void 0:return[];default:return new RVf.UnreachableCaseError(i.multipartType),[]}}).filter(mA).reduce((n,i)=>n.flatMap(a=>i.length>0?i.map(o=>[...a,o]):[[...a]]),[[]]).map(n=>({type:"formData",fields:n,availability:this.availability?.convert(),description:this.description}));case void 0:return this.convertJsonLike();default:return}}};var hVu=class extends LO{description;requestBodiesByContentType;constructor(t){super(t),this.safeParse(t)}parse({method:t,path:r}){let n=eEv(this.input,this.context.document);if(n==null){this.context.errors.error({message:"Expected request body. Received: null",path:this.accessPath});return}Object.entries(n.content).forEach(([i,a])=>{this.requestBodiesByContentType??={},this.requestBodiesByContentType[i]=new _Vu({input:a,context:this.context,accessPath:this.accessPath,pathId:"content",contentType:i,method:t,path:r})})}convert(){return Object.entries(this.requestBodiesByContentType??{}).flatMap(([t,r])=>TQ(r.convert())?.map(i=>({description:this.description,contentType:t,body:i}))).filter(mA)}convertToWebhookPayload(){return Object.values(this.requestBodiesByContentType??{}).flatMap(t=>TQ(t.convert())?.map(n=>{if(!(n.type!=="alias"&&n.type!=="object"))return{description:this.description,shape:n}})).filter(mA)}webhookExample(){return{payload:this.requestBodiesByContentType?.["application/json"]?.schema?.example({includeOptionals:!0,override:void 0})}}};var rEv={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Switch Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"};function nEv(e,t){if(xx(e)){let r=_be(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var yVu=$i(PJ());var iEv="application/json";var aEv="application/octet-stream";function oEv(e,t){return e===t||t===Pde||e===Pde}var Dns=class extends LO{streamingFormat;path;method;statusCode;requests;shapes;schema;contentType;unsupportedContentType;contentSubtype;examples;empty;constructor(t,r,n,i,a,o,c,f){super(t),this.streamingFormat=n,this.path=i,this.method=a,this.statusCode=o,this.requests=c,this.shapes=f,this.safeParse(r)}matchRequestResponseExamplesByName(t,r,n){for(let i of t)for(let[a,o]of Object.entries(i?.examples??{}))for(let[c,f]of Object.entries(r))for(let u of f)oEv(c,a)&&(n.add(c),this.examples?.push(new vWr({input:{requestExample:o,responseExample:u},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,X8i(a,c),{requestBody:i,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}matchExamplesByIndex(t,r){let n=0;for(let i of t){let a=0;for(let[o,c]of r){if(a===n){let[f,u,s]=i??[void 0,void 0,void 0];this.examples?.push(...c.map(l=>new vWr({input:{requestExample:s,responseExample:l},context:this.context,accessPath:this.accessPath,pathId:u!=null&&u!==""?["examples",u]:"examples"},this.path,this.statusCode,X8i(u,o),{requestBody:f,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}a++}n++}if(t.length>r.length)for(let i of t.slice(r.length)){let[a,o]=r[r.length-1]??[void 0,void 0],[c,f,u]=i??[void 0,void 0,void 0];this.examples?.push(...(o??[void 0]).map(s=>new vWr({input:{requestExample:u,responseExample:s},context:this.context,accessPath:this.accessPath,pathId:f!=null&&f!==""?["examples",f]:"examples"},this.path,this.statusCode,X8i(f,a),{requestBody:c,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}if(r.length>t.length){let[i,a,o]=t[t.length-1]??[void 0,void 0,void 0];for(let[c,f]of r.slice(t.length))this.examples?.push(...f.map(u=>new vWr({input:{requestExample:o,responseExample:u},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,X8i(a,c),{requestBody:i,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}}pushResponseExample(t,r,n,i){let a=t[Pde];if(a!=null)for(let o of a)this.examples?.push(new vWr({input:{requestExample:i,responseExample:o},context:this.context,accessPath:this.accessPath,pathId:n!=null&&n!==""?["examples",n]:"examples"},this.path,this.statusCode,X8i(n,void 0),{requestBody:r,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders}))}addGlobalFallbackExample(t,r){if(t==null||t.length===0)this.pushResponseExample(r,void 0,void 0,void 0);else for(let n of t)if(Object.keys(n.examples??{}).length===0)this.pushResponseExample(r,n,void 0,void 0);else for(let[i,a]of Object.entries(n.examples??{}))this.pushResponseExample(r,n,i,a)}parse(t){if(t==="empty")this.empty=!0;else{let c=joo.parse(t);if(c?.isJSON()||c?.isEventStream())this.contentType=iEv,this.input.schema==null?(this.streamingFormat==null||this.streamingFormat==="json")&&this.context.errors.error({message:"Expected schema for JSON response body. Received null",path:this.accessPath}):this.schema=new yU({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"type",seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"});else if(c?.isOctetStream())this.contentType=aEv,this.contentSubtype=qee(this.input.schema,this.context.document)?.contentMediaType;else if(this.unsupportedContentType=t,this.input.schema==null){this.context.errors.error({message:"Expected schema for plain text response body. Received null",path:this.accessPath});return}else this.schema=new yU({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"})}let r={};this.input.examples!=null&&(r=UUu(this.input.examples,c=>[c])),this.input.example!=null&&Object.keys(r).length===0&&(r[Pde]??=[],r[Pde]=[{value:this.input.example}]);let n=qee(this.input.schema,this.context.document);if(n!=null&&(n.examples!=null&&Object.keys(r).length===0&&(r=UUu(n.examples,c=>[c])),n.example!=null&&Object.keys(r).length===0&&(r[Pde]??=[],r[Pde]?.push({value:n.example}))),Object.keys(r).length===0){let c=this.schema?.example({includeOptionals:!0,override:void 0});r[Pde]??=[],r[Pde]?.push(c!=null?{value:c}:void 0)}this.examples??=[];let i=new Set;this.matchRequestResponseExamplesByName(this.requests,r,i);let a=[];for(let c of this.requests)a.push(...Object.entries(c.examples??{}).filter(([f])=>!i.has(f)&&f!==Pde).map(([f,u])=>[c,f,u]));let o=Object.entries(r).filter(([c,f])=>!i.has(c)&&mA(f)&&c!==Pde);Object.keys(r).every(c=>c===Pde)||this.matchExamplesByIndex(a,o),!i.has(Pde)&&this.examples.length===0&&this.addGlobalFallbackExample(this.requests,r),this.examples.length===0&&(this.examples=void 0)}convertStreamingFormat(){switch(this.streamingFormat){case"json":return TQ(this.schema?.convert())?.map(r=>({type:"stream",terminator:"[DATA]",shape:r}));case"sse":return{type:"streamingText"};case void 0:return;default:new yVu.UnreachableCaseError(this.streamingFormat);return}}convertJsonLike(){return TQ(this.schema?.convert())?.map(r=>{let n=r.type;switch(n){case"alias":return r;case"discriminatedUnion":case"undiscriminatedUnion":case"enum":{let i=$qr([this.method,this.path,this.statusCode,"response"].join("_"));return fVu({uniqueId:i,type:r,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:Yj.TypeId(i),default:r.type==="enum"&&r.default!=null?{type:"enum",value:r.default}:void 0}}}case"object":return r;default:new yVu.UnreachableCaseError(n);return}}).filter(mA)}convert(){if(this.empty)return{type:"empty"};if(this.contentType!=null)switch(this.contentType){case"application/json":return this.streamingFormat==null?this.convertJsonLike():this.convertStreamingFormat();case"application/octet-stream":return{type:"fileDownload",contentType:this.contentSubtype};case"text/event-stream":return this.convertStreamingFormat();case void 0:return;default:new yVu.UnreachableCaseError(this.contentType);return}else return this.unsupportedContentType!=null?this.convertJsonLike():void 0}};var Cns=class extends LO{path;method;statusCode;requests;shapes;headers;responses;description;constructor(t,r,n,i,a,o){super(t),this.path=r,this.method=n,this.statusCode=i,this.requests=a,this.shapes=o,this.safeParse()}parse(t){this.description=this.input.description;let r=nEv(this.input,this.context.document);if(r==null){this.context.errors.error({message:xx(this.input)?`Undefined reference: ${this.input.$ref}`:"Expected response, received null",path:this.accessPath});return}Object.entries(r.headers??{}).forEach(([n,i])=>{this.headers??={},this.headers[n]=new bWr({input:i,context:this.context,accessPath:this.accessPath,pathId:"headers",parameterName:n})}),r.content==null?(this.responses??=[],this.responses.push(new Dns({input:{},context:this.context,accessPath:this.accessPath,pathId:["content"]},"empty",t,this.path,this.method,this.statusCode,this.requests,this.shapes))):Object.entries(r.content??{}).forEach(([n,i])=>{this.responses??=[],this.responses.push(new Dns({input:i,context:this.context,accessPath:this.accessPath,pathId:["content",n]},n,t,this.path,this.method,this.statusCode,this.requests,this.shapes))})}convert(){return this.responses?.flatMap(t=>t.convert()).filter(mA)}};var vVu=class extends LO{path;method;requests;shapes;responsesByStatusCode;errorsByStatusCode;constructor(t,r,n,i,a){super(t),this.path=r,this.method=n,this.requests=i,this.shapes=a,this.safeParse()}parse(){let t=this.input.default;Object.entries(this.input).forEach(([r,n])=>{r!=="default"&&(parseInt(r)>=400?(this.errorsByStatusCode??={},this.errorsByStatusCode[r]=new Cns({input:{...t,...n},context:this.context,accessPath:this.accessPath,pathId:"errors"},this.path,this.method,parseInt(r),[],this.shapes)):(this.responsesByStatusCode??={},this.responsesByStatusCode[r]=new Cns({input:n,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,parseInt(r),this.requests,this.shapes)))})}convertResponseObjectToHttpResponses(){return Object.entries(this.responsesByStatusCode??{}).flatMap(([t,r])=>{let n=r.convert();if(n!=null)return nVu(r2i(r.headers)).flatMap(i=>n?.map(a=>({headers:i,response:{statusCode:parseInt(t),body:a,description:r.description},examples:(r.responses??[]).flatMap(o=>(o.examples??[]).map(c=>c.convert()).filter(mA))})))}).filter(mA)}convertResponseObjectToErrors(){return Object.entries(this.errorsByStatusCode??{}).flatMap(([t,r])=>r.responses?.flatMap(n=>{let i=n.schema,a=TQ(i?.convert());if(i!=null)return a?.map(o=>({statusCode:parseInt(t),shape:o,description:r.description??i.description,availability:i.availability?.convert(),name:i.name??rEv[parseInt(t)]??"UNKNOWN ERROR",examples:n.examples?.map(c=>{let f=c.convert();if(f!=null&&f.responseBody?.type==="json")return{name:f.name,description:f.description,responseBody:f.responseBody}}).filter(mA)})).filter(mA)})).filter(mA)}convert(){return{responses:this.convertResponseObjectToHttpResponses(),errors:this.convertResponseObjectToErrors()}}};var n2i=class extends LO{servers;globalAuth;path;method;basePath;isWebhook;endpointIds;description;displayName;operationId;pathParameters;queryParameters;requestHeaders;requests;responses;availability;auth;namespaces;xFernExamplesNode;redocExamplesNode;emptyResponseExamples;constructor(t){super(t),this.servers=t.servers,this.globalAuth=t.globalAuth,this.path=t.path,this.method=t.method,this.basePath=t.basePath,this.isWebhook=t.isWebhook,this.safeParse()}pushEmptyResponseExample(t,r,n){this.emptyResponseExamples??=[],this.emptyResponseExamples.push(new vWr({input:{requestExample:t,responseExample:void 0},context:this.context,accessPath:this.accessPath,pathId:"examples"},this.path,200,X8i(n,void 0),{requestBody:r,pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}))}parse(){if(this.isWebhook&&this.method!=="POST"&&this.method!=="GET"){this.context.errors.error({message:`Webhook method must be POST or GET. Received: ${this.method}`,path:this.accessPath});return}this.description=this.input.description,this.displayName=this.input.summary,this.operationId=this.input.operationId,this.availability=new iyt({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),this.servers=K8i(this.servers,this.input.servers,this.context,this.accessPath),this.isWebhook=new ZUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}).isWebhook||this.isWebhook,this.input.parameters?.map((n,i)=>{if(xx(n)){let a=JUu(n,this.context.document);if(a!=null)n=a;else{this.context.errors.warning({message:`Expected parameter reference to resolve to an object. Received undefined reference: ${n.$ref}`,path:[...this.accessPath,`parameters[${i}]`]});return}}n.in==="path"?n.schema!=null&&(this.pathParameters??={},this.pathParameters[n.name]=new bWr({input:n,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${i}`],parameterName:n.name})):n.in==="query"?n.schema!=null&&(this.queryParameters??={},this.queryParameters[n.name]=new bWr({input:n,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${i}`],parameterName:n.name})):n.in==="header"&&n.schema!=null&&(this.requestHeaders??={},this.requestHeaders[n.name]=new bWr({input:n,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${i}`],parameterName:n.name}))});for(let n of this.extractPathParameterIds()??[])this.pathParameters?.[n]==null&&this.context.errors.warning({message:`Path parameter not defined: ${n}`,path:[...this.accessPath,"parameters"]});if(this.redocExamplesNode=new kUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-code-samples"}),this.requests=this.input.requestBody!=null?new hVu({input:this.input.requestBody,context:this.context,accessPath:this.accessPath,pathId:"requestBody",method:this.method,path:this.path}):void 0,this.responses=this.input.responses!=null?new vVu({input:this.input.responses,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,Object.values(this.requests?.requestBodiesByContentType??{}),{pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}):void 0,this.responses==null){let n=this.requests?.requestBodiesByContentType;n==null||Object.keys(n).length===0?this.pushEmptyResponseExample(void 0,void 0,void 0):Object.values(n).forEach(i=>{if(Object.keys(i.examples??{}).length===0){let a=i.schema?.example({includeOptionals:!1,override:void 0});a!=null&&this.pushEmptyResponseExample({value:a},i,void 0)}else Object.entries(i.examples??{}).forEach(([a,o])=>{this.pushEmptyResponseExample(o,i,a)})})}let t=200;this.responses?.responsesByStatusCode!=null&&(t=Number(Object.keys(this.responses.responsesByStatusCode)?.filter(n=>Number(n)>=200&&Number(n)<300)[0])),this.globalAuth!=null&&(this.auth=this.globalAuth),this.input.security!=null&&(this.auth=new Ooo({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"})),this.namespaces=[new Sns({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-group-name"})],this.namespaces?.every(n=>n.groupName==null)&&this.input.tags!=null&&(this.namespaces=this.input.tags.slice(0,1).map((n,i)=>new Sns({input:{[gUu]:n},context:this.context,accessPath:this.accessPath,pathId:["tags",`${i}`]})));let r=new XUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-sdk-method-name"});this.endpointIds=this.namespaces.map(n=>VUu({namespace:TQ(n?.groupName),path:this.path,method:this.method,sdkMethodName:r.sdkMethodName,operationId:this.input.operationId,displayName:this.displayName,isWebhook:this.isWebhook})).filter(mA),this.xFernExamplesNode=new YUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-examples"},this.path,t,this.requests?.requestBodiesByContentType,this.responses?.responsesByStatusCode?.[t]?.responses)}extractPathParameterIds(){if(this.path!=null)return this.path.split("/").map(t=>{if(t.startsWith("{")&&t.endsWith("}"))return t.slice(1,-1).trim()}).filter(mA)}convertPathToPathParts(){if(this.path===void 0)return;let t=this.path.startsWith("/")?this.path.slice(1):this.path,r=this.basePath?.convert();return(r?[r,...t.split("/")]:t.split("/")).reduce((i,a)=>(i.push({type:"literal",value:"/"}),a.startsWith("{")&&a.endsWith("}")?i.push({type:"pathParameter",value:Yj.PropertyKey(a.slice(1,-1).trim())}):i.push({type:"literal",value:a}),i),[])}convert(){if(this.path==null||this.endpointIds==null)return;let{responses:t,errors:r}=this.responses?.convert()??{responses:void 0,errors:void 0},n=this.emptyResponseExamples?.map(s=>s.convert()).filter(mA),i=B1v(this.xFernExamplesNode?.convert(),[...n??[],...t?.flatMap(s=>s.examples)??[]])?.map(s=>({...s,snippets:M1v(s.snippets,this.redocExamplesNode?.convert())}));if(this.isWebhook)return this.endpointIds.map((s,l)=>{if(!(this.method!=="POST"&&this.method!=="GET"))return{id:Yj.WebhookId(s),description:this.description,availability:this.availability?.convert(),displayName:this.displayName,operationId:this.operationId,namespace:this.namespaces?.[l]?.convert(),method:this.method,path:this.convertPathToPathParts()?.map(m=>m.value.toString())??[],queryParameters:r2i(this.queryParameters)?.flat(),headers:r2i(this.requestHeaders)?.flat(),payloads:this.requests?.convertToWebhookPayload(),examples:[this.requests?.webhookExample()].filter(mA)}}).filter(mA);let a=this.servers?.map(s=>s.convert()).filter(mA),o=this.convertPathToPathParts();if(o==null)return;let c,f=this.auth?.convert();f!=null&&(c=Object.keys(f));let u=t?.flatMap(s=>s.headers).filter(mA);return this.endpointIds.map((s,l)=>({id:Yj.EndpointId(s),description:this.description,availability:this.availability?.convert(),namespace:this.namespaces?.[l]?.convert()?.map(m=>Yj.api.v1.SubpackageId(m)),displayName:this.displayName,operationId:this.operationId,method:this.method,path:o,auth:c?.map(m=>Yj.api.latest.AuthSchemeId(m)),defaultEnvironment:a?.[0]?.id,environments:a,pathParameters:r2i(this.pathParameters)?.flat(),queryParameters:r2i(this.queryParameters)?.flat(),requestHeaders:r2i(this.requestHeaders)?.flat(),responseHeaders:u!=null&&u.length>0?u:void 0,requests:this.requests?.convert(),responses:t?.map(m=>m.response),errors:r,examples:i,snippetTemplates:void 0,protocol:{type:"rest"}}))}};var Eoo=class extends LO{description;get;post;put;patch;delete;path;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:n,isWebhook:i}){this.description=this.input.description;let a=K8i(t,this.input.servers,this.context,this.accessPath),o=Array.isArray(this.pathId)?this.pathId.join("/"):this.pathId;this.input.get!=null&&(this.get=new n2i({input:this.input.get,context:this.context,accessPath:this.accessPath,pathId:"get",servers:a,globalAuth:r,path:o,method:"GET",basePath:n,isWebhook:i})),this.input.post!=null&&(this.post=new n2i({input:this.input.post,context:this.context,accessPath:this.accessPath,pathId:"post",servers:a,globalAuth:r,path:o,method:"POST",basePath:n,isWebhook:i})),this.input.put!=null&&(this.put=new n2i({input:this.input.put,context:this.context,accessPath:this.accessPath,pathId:"put",servers:a,globalAuth:r,path:o,method:"PUT",basePath:n,isWebhook:!1})),this.input.patch!=null&&(this.patch=new n2i({input:this.input.patch,context:this.context,accessPath:this.accessPath,pathId:"patch",servers:a,globalAuth:r,path:o,method:"PATCH",basePath:n,isWebhook:!1})),this.input.delete!=null&&(this.delete=new n2i({input:this.input.delete,context:this.context,accessPath:this.accessPath,pathId:"delete",servers:a,globalAuth:r,path:o,method:"DELETE",basePath:n,isWebhook:!1}))}convert(){return[...this.get?.convert()??[],...this.post?.convert()??[],...this.put?.convert()??[],...this.patch?.convert()??[],...this.delete?.convert()??[]].filter(mA)}};function bVu(e){return"payloads"in e}var gVu=class extends LO{paths;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:n}){this.paths=Object.entries(this.input).map(([i,a])=>{if(a!=null)return new Eoo({input:a,context:this.context,accessPath:this.accessPath,pathId:i,servers:K8i(t,a.servers,this.context,this.accessPath),globalAuth:r,basePath:n,isWebhook:void 0})}).filter(mA)}convert(){if(this.paths==null)return;let t={},r={};return this.paths.forEach(n=>{let i=n.convert();i?.forEach(a=>{bVu(a)?r[Yj.WebhookId(a.id)]=a:t[Yj.EndpointId(a.id)]=a})}),{endpoints:t,webhookEndpoints:r}}};var mVu=class extends LO{globalHeaders;requiredProperties;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[wjv]?.map(r=>{let{header:n,...i}=r;return(i.optional!=null&&!i.optional||JUu(i,this.context.document)?.required)&&(this.requiredProperties??=[],this.requiredProperties?.push(n)),[n,new bWr({input:i,context:this.context,accessPath:this.accessPath,pathId:this.pathId,parameterName:n})]});t!=null&&(this.globalHeaders=Object.fromEntries(t))}convert(){return Aoo(this.globalHeaders,this.requiredProperties)?.flat()}};function sEv(e,t){if(xx(e)){let r=_be(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var OVu=class extends LO{webhooks;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:n}){this.webhooks=Object.entries(this.input??{}).map(([i,a])=>{let o=sEv(a,this.context.document);if(o!=null)return new Eoo({input:o,context:this.context,accessPath:this.accessPath,pathId:i,servers:t,globalAuth:r,basePath:n,isWebhook:!0})}).filter(mA)}convert(){return this.webhooks?.reduce((t,r)=>(r.convert()?.forEach(n=>{bVu(n)&&(t[Yj.WebhookId(n.id)]=n)}),t),{})}};var AVu=class extends LO{paths;webhooks;components;auth;globalHeaders;constructor(t){super(t),this.safeParse()}parse(){let t=K8i(void 0,this.input.servers,this.context,this.accessPath);this.input.security!=null&&(this.auth=new Ooo({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"}));let r=new HUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});this.input.paths==null&&this.input.webhooks==null&&this.context.errors.warning({message:"Expected 'paths' or 'webhooks' property to be specified",path:this.accessPath}),this.input.paths!=null&&(this.paths=new gVu({input:this.input.paths,context:this.context,accessPath:this.accessPath,pathId:"paths",basePath:r,servers:t,globalAuth:this.auth})),this.input.webhooks!=null&&(this.webhooks=new OVu({input:this.input.webhooks,context:this.context,accessPath:this.accessPath,pathId:"webhooks",basePath:r,servers:t,globalAuth:this.auth})),this.input.components!=null&&(this.components=new dVu({input:this.input.components,context:this.context,accessPath:this.accessPath,pathId:"components"})),this.globalHeaders=new mVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-global-headers"})}convert(){let t=Urt(),{webhookEndpoints:r,endpoints:n}=this.paths?.convert()??{},i={...this.webhooks?.convert()??{},...r??{}},a=mjv({endpoints:n,webhookEndpoints:i}),{types:o,auths:c}=this.components?.convert()??{};return{id:Yj.ApiDefinitionId(t),endpoints:n??{},websockets:{},webhooks:i,types:{...o,...this.context.generatedTypes},subpackages:a,auths:{...c,...this.auth?.convert()??{}},globalHeaders:this.globalHeaders?.convert(),snippetsConfiguration:void 0}}};async function NVf(e,t){if(e instanceof kVr){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof S$))return;let r=new Lqr(e.absoluteFilePath),n=await $ht({context:t,specs:e.specs}),i=await r.loadDocuments({context:t,specs:n}),a;for(let o of i){if(o.type!=="openapi")continue;let c={document:o.value,logger:t.logger,errors:new vUu,generatedTypes:{}},f=new AVu({input:o.value,context:c,accessPath:[],pathId:e.workspaceName??"openapi parser"});a=BKl(a,f.convert())}return a}var wNv=$i(zVf(),1),jNv=$i(cWu(),1),ENv=require("fs/promises"),SNv=$i(require("http"),1),DNv=$i(require("path"),1);var sMv=require("events"),_Wu=$i(require("fs"),1),Gda=$i(require("path"),1);var VIv=$i(require("os"),1),WIv=300,l2i=20,kns=1e7,GIv=VIv.default.platform();var jcM=GIv==="darwin",iGf=GIv==="win32",f2i=jcM||iGf,HIv=3e3,JIv=2e4,aGf=1250;var AWr;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(AWr||(AWr={}));var Wda;(function(e){e.CHANGE="change",e.RENAME="rename"})(Wda||(Wda={}));var eis;(function(e){e.CHANGE="change",e.ERROR="error"})(eis||(eis={}));var QS;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(QS||(QS={}));var GCe;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(GCe||(GCe={}));var EcM=(e,t=1,r)=>{t=Math.max(1,t);let n=r?.leading??!1,i=r?.trailing??!0,a=Math.max(r?.maxWait??1/0,t),o,c,f=0,u=0,s=()=>{let q=Date.now(),V=q-f,$=q-u,re=V>=t||$>=a;return[q,re]},l=q=>{if(u=q,!o)return;let V=o;o=void 0,e.apply(void 0,V)},m=()=>{z(0)},O=()=>{c&&(m(),l(Date.now()))},P=q=>{if(u=q,n)return l(q)},C=q=>{if(i&&o)return l(q);o=void 0},I=()=>{c=void 0;let[q,V]=s();return V?C(q):T(q)},T=q=>{let V=q-f,$=q-u,re=t-V,Y=a-$,k=Math.min(re,Y);return z(k)},z=q=>{c&&clearTimeout(c),!(q<=0)&&(c=setTimeout(I,q))},U=(...q)=>{let[V,$]=s(),re=!!c;if(o=q,f=V,($||!c)&&z(t),$)return re?l(V):P(V)};return U.cancel=m,U.flush=O,U},lWu=EcM;var cGf=$i(require("fs"),1),dWu=$i(require("path"),1);var $4=$i(require("fs"),1),hbe=require("util");var Vwi=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},PWr=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var oGf=$i(require("process"),1),KIv=oGf.default.getuid?!oGf.default.getuid():!1,$Iv=1e4,t3e=()=>{};var tis={isChangeErrorOk:e=>{if(!tis.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!KIv&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!tis.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!tis.isNodeError(e))throw e;if(!tis.isChangeErrorOk(e))throw e}},Ree=tis;var sGf=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=$Iv,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=()=>this.remove(n),n=()=>t(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},YIv=new sGf;var Wwi=(e,t)=>function(n){return function i(...a){return YIv.schedule().then(o=>{let c=u=>(o(),u),f=u=>{if(o(),Date.now()>=n)throw u;if(t(u)){let s=Math.round(100*Math.random());return new Promise(m=>setTimeout(m,s)).then(()=>i.apply(void 0,a))}throw u};return e.apply(void 0,a).then(c,f)})}},Gwi=(e,t)=>function(n){return function i(...a){try{return e.apply(void 0,a)}catch(o){if(Date.now()>n)throw o;if(t(o))return i.apply(void 0,a);throw o}}};var ScM={attempt:{chmod:Vwi((0,hbe.promisify)($4.default.chmod),Ree.onChangeError),chown:Vwi((0,hbe.promisify)($4.default.chown),Ree.onChangeError),close:Vwi((0,hbe.promisify)($4.default.close),t3e),fsync:Vwi((0,hbe.promisify)($4.default.fsync),t3e),mkdir:Vwi((0,hbe.promisify)($4.default.mkdir),t3e),realpath:Vwi((0,hbe.promisify)($4.default.realpath),t3e),stat:Vwi((0,hbe.promisify)($4.default.stat),t3e),unlink:Vwi((0,hbe.promisify)($4.default.unlink),t3e),chmodSync:PWr($4.default.chmodSync,Ree.onChangeError),chownSync:PWr($4.default.chownSync,Ree.onChangeError),closeSync:PWr($4.default.closeSync,t3e),existsSync:PWr($4.default.existsSync,t3e),fsyncSync:PWr($4.default.fsync,t3e),mkdirSync:PWr($4.default.mkdirSync,t3e),realpathSync:PWr($4.default.realpathSync,t3e),statSync:PWr($4.default.statSync,t3e),unlinkSync:PWr($4.default.unlinkSync,t3e)},retry:{close:Wwi((0,hbe.promisify)($4.default.close),Ree.isRetriableError),fsync:Wwi((0,hbe.promisify)($4.default.fsync),Ree.isRetriableError),open:Wwi((0,hbe.promisify)($4.default.open),Ree.isRetriableError),readFile:Wwi((0,hbe.promisify)($4.default.readFile),Ree.isRetriableError),rename:Wwi((0,hbe.promisify)($4.default.rename),Ree.isRetriableError),stat:Wwi((0,hbe.promisify)($4.default.stat),Ree.isRetriableError),write:Wwi((0,hbe.promisify)($4.default.write),Ree.isRetriableError),writeFile:Wwi((0,hbe.promisify)($4.default.writeFile),Ree.isRetriableError),closeSync:Gwi($4.default.closeSync,Ree.isRetriableError),fsyncSync:Gwi($4.default.fsyncSync,Ree.isRetriableError),openSync:Gwi($4.default.openSync,Ree.isRetriableError),readFileSync:Gwi($4.default.readFileSync,Ree.isRetriableError),renameSync:Gwi($4.default.renameSync,Ree.isRetriableError),statSync:Gwi($4.default.statSync,Ree.isRetriableError),writeSync:Gwi($4.default.writeSync,Ree.isRetriableError),writeFileSync:Gwi($4.default.writeFileSync,Ree.isRetriableError)}},XIv=ScM;var fWu=$i(require("fs"),1),ris=$i(require("path"),1);var uGf=()=>{};var DcM=()=>{let e=uGf,t=uGf,r=!1,n=!1;return{promise:new Promise((f,u)=>{e=s=>(r=!0,f(s)),t=s=>(n=!0,u(s))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},ZIv=DcM;var CcM=()=>{let{promise:e,resolve:t,isPending:r}=ZIv(),n=0,i=()=>{n+=1},a=()=>{n-=1,!n&&t()};return(()=>{i(),queueMicrotask(a)})(),{promise:e,isPending:r,increment:i,decrement:a}},kIv=CcM;var eMv={then:e=>{e()}};var tMv=e=>Array.isArray(e)?e:[e],rMv=e=>typeof e=="function";var IcM=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,a=t?.ignore??[],o=tMv(a).map(xe=>rMv(xe)?xe:Be=>xe.test(Be)),c=xe=>o.some(Be=>Be(xe)),f=t?.signal??{aborted:!1},u=t?.onDirents||(()=>{}),s=[],l=new Set,m={},O=[],P=new Set,C={},I=[],T=new Set,z={},U={},q=new Set,V={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},$={directories:s,directoriesNames:l,directoriesNamesToPaths:m,files:O,filesNames:P,filesNamesToPaths:C,symlinks:I,symlinksNames:T,symlinksNamesToPaths:z,map:U},{promise:re,increment:Y,decrement:k}=kIv(),ne=0,me=(xe,Be,Jt,pt)=>{q.has(Be)||ne>=i||(ne+=1,xe.directories.push(Be),xe.directoriesNames.add(Jt),s.push(Be),l.add(Jt),m.propertyIsEnumerable(Jt)||(m[Jt]=[]),m[Jt].push(Be),q.add(Be),!(pt>=n)&&(ne>=i||Ee(Be,pt+1)))},_e=(xe,Be,Jt)=>{q.has(Be)||ne>=i||(ne+=1,xe.files.push(Be),xe.filesNames.add(Jt),O.push(Be),P.add(Jt),C.propertyIsEnumerable(Jt)||(C[Jt]=[]),C[Jt].push(Be),q.add(Be))},ve=(xe,Be,Jt,pt)=>{q.has(Be)||ne>=i||(ne+=1,xe.symlinks.push(Be),xe.symlinksNames.add(Jt),I.push(Be),T.add(Jt),z.propertyIsEnumerable(Jt)||(z[Jt]=[]),z[Jt].push(Be),q.add(Be),r&&(pt>=n||ne>=i||Ot(Be,pt+1)))},pe=(xe,Be,Jt,pt,vr)=>{f.aborted||c(Be)||(pt.isDirectory()?me(xe,Be,Jt,vr):pt.isFile()?_e(xe,Be,Jt):pt.isSymbolicLink()&&ve(xe,Be,Jt,vr))},De=(xe,Be,Jt,pt)=>{if(f.aborted)return;let vr=Be===ris.default.sep?"":ris.default.sep,Gt=Jt.name,Xe=`${Be}${vr}${Gt}`;c(Xe)||(Jt.isDirectory()?me(xe,Xe,Gt,pt):Jt.isFile()?_e(xe,Xe,Gt):Jt.isSymbolicLink()&&ve(xe,Xe,Gt,pt))},Ce=(xe,Be,Jt,pt)=>{for(let vr=0,Gt=Jt.length;vr<Gt;vr++)De(xe,Be,Jt[vr],pt)},Ee=(xe,Be)=>{f.aborted||Be>n||ne>=i||(Y(),fWu.default.readdir(xe,{withFileTypes:!0},(Jt,pt)=>{if(Jt||f.aborted||!pt.length)return k();(u(pt)||eMv).then(()=>{let Gt=U[xe]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};Ce(Gt,xe,pt,Be),k()})}))},Ot=(xe,Be)=>{Y(),fWu.default.realpath(xe,(Jt,pt)=>{if(Jt||f.aborted)return k();fWu.default.stat(pt,(vr,Gt)=>{if(vr||f.aborted)return k();let Xe=ris.default.basename(pt),dt=U[xe]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};pe(dt,pt,Xe,Gt,Be),k()})})};return(async(xe,Be=1)=>(xe=ris.default.normalize(xe),q.add(xe),Ee(xe,Be),await re,f.aborted?V:$))(e)},nMv=IcM;var wWr={lang:{debounce:lWu,attempt:e=>{try{return e()}catch(t){return wWr.lang.castError(t)}},castArray:e=>wWr.lang.isArray(e)?e:[e],castError:e=>wWr.lang.isError(e)?e:wWr.lang.isString(e)?new Error(e):new Error("Unknown error"),defer:e=>setTimeout(e,0),isArray:e=>Array.isArray(e),isError:e=>e instanceof Error,isFunction:e=>typeof e=="function",isNaN:e=>Number.isNaN(e),isNumber:e=>typeof e=="number",isPrimitive:e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},isShallowEqual:(e,t)=>{if(e===t)return!0;if(wWr.lang.isNaN(e))return wWr.lang.isNaN(t);if(wWr.lang.isPrimitive(e)||wWr.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},isSet:e=>e instanceof Set,isString:e=>typeof e=="string",isUndefined:e=>e===void 0,noop:()=>{},uniq:e=>e.length<2?e:Array.from(new Set(e))},fs:{getDepth:e=>Math.max(0,e.split(dWu.default.sep).length-1),getRealPath:(e,t)=>{try{return t?cGf.default.realpathSync.native(e):cGf.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===dWu.default.sep&&t.length-e.length>dWu.default.sep.length,poll:(e,t=JIv)=>XIv.retry.stat(t)(e,{bigint:!0}).catch(wWr.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,a)=>{if(a&&r===1&&e in a){let o=a[e];return[o.directories,o.files]}else{let o=await nMv(e,{depth:r,limit:n,ignore:t,signal:i});return[o.directories,o.files]}}}},gB=wWr;var pWu=$i(require("path"),1);var lGf=class{constructor(t,r,n){this.base=n,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||gB.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=WIv){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,a=async(c,f)=>{let u=this.options.ignoreInitial?[]:c,s=await this.eventsPopulate([...f]),l=this.eventsDeduplicate([...u,...s]);this.onTargetEvents(l)},o=gB.lang.debounce(()=>{this.watcher.isClosed()||(r=a(n,i),n=[],i=new Set)},t);return async(c,f="",u=!1)=>{u?await this.eventsPopulate([f],n,!0):i.add(f),r.then(o)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[a,o]=i,c=r[o];return a===c||a===QS.CHANGE&&c===QS.ADD||(r[o]=a,n.push(i)),n},[])}async eventsPopulate(t,r=[],n=!1){return await Promise.all(t.map(async i=>{let a=await this.watcher._poller.update(i,this.options.pollingTimeout);await Promise.all(a.map(async o=>{r.push([o,i]),o===QS.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):o===QS.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,i,r,n)}))})),r}async eventsPopulateAddDir(t,r,n=[],i=!1){if(i)return n;let a=this.options.recursive?this.options.depth??l2i:Math.min(1,this.options.depth??l2i),o=this.options.limit??kns,[c,f]=await gB.fs.readdir(r,this.options.ignore,a,o,this.watcher._closeSignal),u=[...c,...f];return await Promise.all(u.map(s=>{if(!this.watcher.isIgnored(s,this.options.ignore)&&!t.includes(s))return this.eventsPopulate([s],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let a of this.watcher._poller.stats.keys())gB.fs.isSubPath(r,a)&&(t.includes(a)||await this.eventsPopulate([a],n,!0));return n}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(QS.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!f2i&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(QS.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(QS.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(pWu.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(QS.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(pWu.default.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(QS.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===QS.ADD?this.onTargetAdd(n):r===QS.ADD_DIR?this.onTargetAddDir(n):r===QS.CHANGE?this.onTargetChange(n):r===QS.UNLINK?this.onTargetUnlink(n):r===QS.UNLINK_DIR&&this.onTargetUnlinkDir(n)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,n=!1){return this.handlerBatched(t,r,n)}onWatcherChange(t=Wda.CHANGE,r){if(this.watcher.isClosed())return;let n=pWu.default.resolve(this.folderPath,r||"");this.filePath&&n!==this.folderPath&&n!==this.filePath||this.watcher.isIgnored(n,this.options.ignore)||this.onWatcherEvent(t,n)}onWatcherError(t){iGf&&t.code==="EPERM"?this.onWatcherChange(Wda.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(eis.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(eis.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(Wda.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&f2i&&this.options.native!==!1?this.options.depth??l2i:Math.min(1,this.options.depth??l2i),n=this.options.limit??kns,[i,a]=await gB.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),o=[this.folderPath,...i,...a];await Promise.all(o.map(c=>{if(!this.watcher._poller.stats.has(c)&&!this.watcher.isIgnored(c,this.options.ignore))return this.onWatcherEvent(Wda.CHANGE,c,t)}))}}},iMv=lGf;var HCe={interval:100,intervalId:void 0,fns:new Map,init:()=>{HCe.intervalId||(HCe.intervalId=setInterval(HCe.resolve,HCe.interval))},reset:()=>{HCe.intervalId&&(clearInterval(HCe.intervalId),delete HCe.intervalId)},add:(e,t)=>{HCe.fns.set(e,Date.now()+t),HCe.init()},remove:e=>{HCe.fns.delete(e)},resolve:()=>{if(!HCe.fns.size)return HCe.reset();let e=Date.now();for(let[t,r]of HCe.fns)r>=e||(HCe.remove(t),t())}},nis=HCe;var iis=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=aGf){let{ino:n,targetPath:i,events:a,locks:o}=t,c=()=>{let l=this._watcher._poller.paths.find(n||-1,m=>m!==i);if(l&&l!==i){if(gB.fs.getRealPath(i,!0)===l)return;this._watcher.event(a.rename,l,i)}else this._watcher.event(a.add,i)};if(!n)return c();let f=()=>{o.add.delete(n),nis.remove(u)},u=()=>{f(),c()};nis.add(u,r);let s=()=>{let l=o.unlink.get(n);if(!l)return;f();let m=l();i===m?a.change&&this._watcher._poller.stats.has(i)&&this._watcher.event(a.change,i):this._watcher.event(a.rename,m,i)};o.add.set(n,s),s()}getLockUnlink(t,r=aGf){let{ino:n,targetPath:i,events:a,locks:o}=t,c=()=>{this._watcher.event(a.unlink,i)};if(!n)return c();let f=()=>{o.unlink.delete(n),nis.remove(u)},u=()=>{f(),c()};nis.add(u,r);let s=()=>(f(),i);o.unlink.set(n,s),o.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,QS.ADD,AWr.FILE);return this.getLockAdd({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let n=this._watcher._poller.getIno(t,QS.ADD_DIR,AWr.DIR);return this.getLockAdd({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let n=this._watcher._poller.getIno(t,QS.UNLINK,AWr.FILE);return this.getLockUnlink({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let n=this._watcher._poller.getIno(t,QS.UNLINK_DIR,AWr.DIR);return this.getLockUnlink({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};iis.DIR_EVENTS={add:QS.ADD_DIR,rename:QS.RENAME_DIR,unlink:QS.UNLINK_DIR};iis.FILE_EVENTS={add:QS.ADD,change:QS.CHANGE,rename:QS.RENAME,unlink:QS.UNLINK};var aMv=iis;var fGf=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(gB.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(gB.lang.isSet(n)){let i=n.delete(r);return n.size||this.map.delete(t),i}else if(n===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let n=this.map.get(t);if(gB.lang.isSet(n))return Array.from(n).find(r);if(r(n))return n}}get(t){return this.map.get(t)}has(t,r){if(gB.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return gB.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);gB.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},dGf=fGf;var pGf=class{constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},oMv=pGf;var _Gf=class{constructor(){this.inos={},this.paths=new dGf,this.stats=new Map}getIno(t,r,n){let i=this.inos[r];if(!i)return;let a=i[t];if(a&&!(n&&a[1]!==n))return a[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let n=await gB.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new oMv(n)}reset(){this.inos={},this.paths=new dGf,this.stats=new Map}async update(t,r){let n=this.getStats(t),i=await this.poll(t,r);if(this.updateStats(t,i),!n&&i){if(i.isFile())return this.updateIno(t,QS.ADD,i),[QS.ADD];if(i.isDirectory())return this.updateIno(t,QS.ADD_DIR,i),[QS.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,QS.UNLINK,n),[QS.UNLINK];if(n.isDirectory())return this.updateIno(t,QS.UNLINK_DIR,n),[QS.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,QS.CHANGE,i),[QS.CHANGE]);if(i.isDirectory())return this.updateIno(t,QS.UNLINK,n),this.updateIno(t,QS.ADD_DIR,i),[QS.UNLINK,QS.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,QS.UNLINK_DIR,n),this.updateIno(t,QS.ADD,i),[QS.UNLINK_DIR,QS.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,QS.UNLINK_DIR,n),this.updateIno(t,QS.ADD_DIR,i),[QS.UNLINK_DIR,QS.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),a=n.isFile()?AWr.FILE:AWr.DIR;i[t]=[n.ino,a]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let n=this.stats.get(t)?.ino||-1;this.paths.delete(n,t),this.stats.delete(t)}}},hGf=_Gf;var yGf=class e extends sMv.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(GCe.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on(GCe.CLOSE,i)),this._readyWait=new Promise(i=>this.on(GCe.READY,i)),this._locker=new aMv(this),this._roots=new Set,this._poller=new hGf,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,n)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(gB.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit(GCe.CLOSE))}error(t){if(this.isClosed())return!1;let r=gB.lang.castError(t);return this.emit(GCe.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit(GCe.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(GCe.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&gB.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&gB.lang.isShallowEqual(n.options,r))return!0;return!1}watchersClose(t,r,n=!0){if(t){let i=this._watchers[t];if(i)for(let a of[...i])r&&a.filePath!==r||this.watcherClose(a);if(n)for(let a in this._watchers)gB.fs.isSubPath(t,a)&&this.watchersClose(a,r,!1)}else for(let i in this._watchers)this.watchersClose(i,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,n]of t)this.watchPath(r,n.options,n.handler)}async watcherAdd(t,r){let{folderPath:n}=t;(this._watchers[n]=this._watchers[n]||[]).push(t);let a=new iMv(this,t,r);return await a.init(),a}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let a=r.indexOf(t);r.splice(a,1),r.length||delete this._watchers[t.folderPath]}let n=t.filePath||t.folderPath;this._roots.has(n)&&(this._watchersRestorable[n]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=gB.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(c=>c.handler===n&&(!c.filePath||c.filePath===i)&&c.options.ignore===r.ignore&&!!c.options.native==!!r.native&&(!r.recursive||c.options.recursive)))return!0;let o=Gda.default.dirname(t);for(let c=1;c<1/0;c++){if(this._watchers[o]?.find(s=>(c===1||s.options.recursive&&c<=(s.options.depth??l2i))&&s.handler===n&&(!s.filePath||s.filePath===i)&&s.options.ignore===r.ignore&&!!s.options.native==!!r.native&&(!r.recursive||s.options.recursive&&f2i&&s.options.native!==!1)))return!0;if(!f2i)break;let u=Gda.default.dirname(t);if(o===u)break;o=u}return!1}async watchDirectories(t,r,n,i,a){if(this.isClosed())return;t=gB.lang.uniq(t).sort();let o;for(let c of t)if(!this.isIgnored(c,r.ignore)&&!this.watcherExists(c,r,n,i))try{let f=!r.recursive||f2i&&r.native!==!1?r:{...r,recursive:!1},s={watcher:_Wu.default.watch(c,f),handler:n,options:r,folderPath:c,filePath:i},l=o=await this.watcherAdd(s,a);if(this._roots.has(i||c)){let O={...r,ignoreInitial:!0,recursive:!1},P=Gda.default.dirname(c),C=c;await this.watchDirectories([P],O,n,C,l)}}catch(f){this.error(f)}return o}async watchDirectory(t,r,n,i,a){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||f2i&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,a));{r={...r,recursive:!0};let o=r.depth??l2i,c=r.limit??kns,[f]=await gB.fs.readdir(t,r.ignore,o,c,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let u=await this.watchDirectories([t],r,n,i,a);if(f.length){let s=gB.fs.getDepth(t);for(let l of f){let m=gB.fs.getDepth(l),O=Math.max(0,o-(m-s)),P={...r,depth:O};await this.watchDirectories([l],P,n,i,a||u)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},a=(u,s)=>{s===t&&(f(),n())},o=new e(a),c=()=>{this._subwatchers.add(i),this.on(GCe.CLOSE,f),o.watchFile(t,r,a)},f=()=>{this._subwatchers.delete(i),this.removeListener(GCe.CLOSE,f),o.close()};return c()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=Gda.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,a=new hGf,o=await this.watchPolling(t,r,async()=>{i||!(await a.update(t,r.pollingTimeout)).length||i||(i=!0,o(),n())})}async watchPolling(t,r,n){if(this.isClosed())return gB.lang.noop;if(this.pollerExists(t,r))return gB.lang.noop;let i={...r,interval:r.pollingInterval??HIv},a={targetPath:t,options:r},o=()=>{this._pollers.add(a),this.on(GCe.CLOSE,c),_Wu.default.watchFile(t,i,n)},c=()=>{this._pollers.delete(a),this.removeListener(GCe.CLOSE,c),_Wu.default.unwatchFile(t,n)};return gB.lang.attempt(o),()=>gB.lang.attempt(c)}async watchUnknownChild(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchFileOnce(t,r,i)}async watchUnknownTarget(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchPollingOnce(t,r,i)}async watchPaths(t,r,n){if(this.isClosed())return;if(t=gB.lang.uniq(t).sort(),t.every((a,o)=>t.every((c,f)=>f===o||!gB.fs.isSubPath(a,c))))await Promise.all(t.map(a=>this.watchPath(a,r,n)));else for(let a of t)await this.watchPath(a,r,n)}async watchPath(t,r,n){if(this.isClosed()||(t=Gda.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await gB.fs.poll(t,r.pollingTimeout);if(i){if(i.isFile())return this.watchFile(t,r,n);if(i.isDirectory())return this.watchDirectory(t,r,n);this.error(`"${t}" is not supported`)}else{let a=Gda.default.dirname(t);return(await gB.fs.poll(a,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=gB.lang.noop){if(gB.lang.isFunction(t))return this.watch([],{},t);if(gB.lang.isUndefined(t))return this.watch([],r,n);if(gB.lang.isFunction(r))return this.watch(t,{},r);if(gB.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=gB.lang.castArray(t);i.forEach(a=>this._roots.add(a)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==gB.lang.noop&&this.on(GCe.ALL,n),r.readdirMap=void 0,this.ready())}},hWu=yGf;squ();var oNv=$i(rGu(),1),r3e=require("fs/promises"),sNv=require("os"),uNv=$i(NDe(),1),cNv=$i(aNv(),1),gGu=process.platform==="win32",upM="etag",cpM="preview",lpM="app-preview",fpM="bundle",dpM=".next",ppM="standalone",_pM=".fern",hpM="packages/fern-docs/bundle/.next/server/instrumentation.js",ypM=".npmrc",vpM=".pnpmfile.cjs",bpM="pnpm-workspace.yaml",gpM='Cannot find matching keyid: {"signatures":';function mpM(){return Ql(F_.of((0,sNv.homedir)()),ru.of(_pM))}function mGu({app:e=!1}){return Ql(mpM(),ru.of(e?lpM:cpM))}function m2i({app:e=!1}){return Ql(mGu({app:e}),ru.of(e?dpM:fpM))}function Dis({app:e=!1}){return Ql(m2i({app:e}),ru.of(ppM))}function OpM({app:e=!1}){return Ql(Dis({app:e}),ru.of(hpM))}function ApM({app:e=!1}){return Ql(Dis({app:e}),ru.of(bpM))}function PpM({app:e=!1}){return Ql(Dis({app:e}),ru.of(vpM))}function wpM({app:e=!1}){return Ql(Dis({app:e}),ru.of(ypM))}function Xda(e){return new Error(`${e}. Please reach out to support@buildwithfern.com.`)}function jpM({app:e=!1}){return Ql(mGu({app:e}),ru.of(upM))}var EpM=`module.exports = {
3032
+ ]`;case 1:return`${i} Did you mean ${r[0]}?`;case 2:return`${i} Did you mean ${r[0]} or ${r[1]}?`;default:return`${i} Did you mean ${r[0]}, ${r[1]}, or ${r[2]}?`}}function lUu(e){return`API section ${e} is specified multiple times, however will be only rendered once.`}function otM(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function fUu({children:e,findEndpointById:t,stringifyEndpointPathParts:r,disableEndpointPairs:n,apiDefinitionId:i}){if(n)return e;let a=[],o=new Map;return e.forEach(c=>{if(c.type!=="endpoint"){a.push(c);return}let f=t(c.endpointId);if(f==null)throw new Error(`Endpoint ${c.endpointId} not found`);let u=`${f.method} ${r(f)}`,s=o.get(u);if(o.set(u,c),s==null||s.isResponseStream===c.isResponseStream){a.push(c);return}let l=a.indexOf(s),m=c.isResponseStream?c:s,O=c.isResponseStream?s:c,P={id:fl.V1.NodeId(`${i}:${O.endpointId}+${m.endpointId}`),type:"endpointPair",stream:m,nonStream:O};a[l]=P}),a}function xPv({left:e,right:t,findEndpointById:r,stringifyEndpointPathParts:n,disableEndpointPairs:i,apiDefinitionId:a}){return fUu({children:[...e,...t],findEndpointById:r,stringifyEndpointPathParts:n,disableEndpointPairs:i,apiDefinitionId:a}).filter(o=>o.type==="apiPackage"?o.children.length>0:!0)}function hoo(e,t){if(t!=null)return P3(e.absoluteFilePath,t)}function zPv({docsWorkspace:e,page:t,parentSlug:r,idgen:n,markdownFilesToFullSlugs:i,markdownFilesToNoIndex:a,hideChildren:o,resolveIconFileId:c}){let f=fl.V1.PageId(hoo(e,t.absolutePath)),u=r.apply({fullSlug:i.get(t.absolutePath)?.split("/"),urlSlug:t.slug??u$(t.title)});return{id:n.get(f),type:"page",pageId:f,title:t.title,slug:u.get(),icon:c?c(t.icon):t.icon,hidden:o||t.hidden,noindex:t.noindex||a.get(t.absolutePath),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags,availability:t.availability}}var dUu=class{apiSection;docsWorkspace;taskContext;markdownFilesToFullSlugs;markdownFilesToNoIndex;markdownFilesToTags;workspace;hideChildren;parentAvailability;apiDefinitionId;#e;#t=new Set;#r=new Set;#n=new Set;#i=new Set;#a=new Set;#o=new Map;#u=[];#s;#c;#f;disableEndpointPairs;collectedFileIds=new Map;constructor(t,r,n,i,a,o,c,f,u,s,l,m,O){this.apiSection=t,this.docsWorkspace=i,this.taskContext=a,this.markdownFilesToFullSlugs=o,this.markdownFilesToNoIndex=c,this.markdownFilesToTags=f,this.workspace=l,this.hideChildren=m,this.parentAvailability=O,this.disableEndpointPairs=i.config.experimental?.disableStreamToggle??!1,this.apiDefinitionId=fl.V1.ApiDefinitionId(r.id),this.#e=J8i.create(r,a),this.collectedFileIds=s,this.#f=u,this.#s=this.apiSection.overviewAbsolutePath!=null?fl.V1.PageId(hoo(this.docsWorkspace,this.apiSection.overviewAbsolutePath)):void 0;let P=this.apiSection.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(this.apiSection.overviewAbsolutePath):void 0;this.#c=n.apply({fullSlug:P?.split("/"),skipUrlSlug:this.apiSection.skipUrlSlug,urlSlug:this.apiSection.slug??u$(this.apiSection.title)});let C=this.apiSection.availability??this.parentAvailability;this.apiSection.navigation!=null&&(this.#u=this.#d(this.apiSection.navigation,this.#e.api.rootPackage,this.#c,C)),this.#u=this.#g(this.#u.map(I=>this.#m(I,C)),this.#O(this.#e.api.rootPackage,this.#c,C))}get(){let t=fl.V1.followRedirects(this.#u),r=new Tda(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,this.workspace?.changelog?.files.map(n=>n.absoluteFilepath),this.docsWorkspace,this.#f).orUndefined();return{id:this.#f.get(this.apiDefinitionId),type:"apiReference",title:this.apiSection.title,apiDefinitionId:this.apiDefinitionId,overviewPageId:this.#s,paginated:this.apiSection.paginated,slug:this.#c.get(),icon:this.resolveIconFileId(this.apiSection.icon),hidden:this.hideChildren||this.apiSection.hidden,hideTitle:this.apiSection.flattened,showErrors:this.apiSection.showErrors,changelog:r?.toChangelogNode({parentSlug:this.#c,viewers:void 0,hidden:this.hideChildren}),children:this.#u,availability:this.apiSection.availability??this.parentAvailability,pointsTo:t,noindex:void 0,playground:this.#v(this.apiSection.playground),authed:void 0,viewers:this.apiSection.viewers,orphaned:this.apiSection.orphaned,featureFlags:this.apiSection.featureFlags}}#d(t,r,n,i){r=this.#e.resolveSubpackage(r);let a=r!=null?J8i.getSubpackageId(r):void 0;return t.map(o=>zUf(o)._visit({link:c=>({id:this.#f.get(c.url),type:"link",title:c.text,icon:this.resolveIconFileId(c.icon),url:fl.Url(c.url)}),page:c=>this.#p(c,n,i),package:c=>this.#l(c,n,i),section:c=>this.#_(c,n,i),item:({value:c})=>this.#y(c,a,n,i),endpoint:c=>this.#h(c,a,n,i)})).filter(hj)}#p(t,r,n){return zPv({page:{...t,availability:t.availability??n},parentSlug:r,docsWorkspace:this.docsWorkspace,markdownFilesToFullSlugs:this.markdownFilesToFullSlugs,markdownFilesToNoIndex:this.markdownFilesToNoIndex,idgen:this.#f,hideChildren:this.hideChildren,resolveIconFileId:this.resolveIconFileId.bind(this)})}#l(t,r,n){let i=t.overviewAbsolutePath!=null?fl.V1.PageId(hoo(this.docsWorkspace,t.overviewAbsolutePath)):void 0,a=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,o=t.availability??n,c=this.#e.getSubpackageByIdOrLocator(t.package);if(c!=null){let f=J8i.getSubpackageId(c),u=this.#f.get(i??`${this.apiDefinitionId}:${f}`);this.#a.has(f)&&this.taskContext.logger.warn(lUu(t.package)),this.#a.add(f),this.#o.set(u,[f]);let s=t.slug??(hWr(c)?c.urlSlug:this.apiSection.slug??u$(this.apiSection.title)),l=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:s}),m=this.#d(t.contents,c,l,o);return{id:u,type:"apiPackage",children:m,title:t.title??(hWr(c)?c.displayName??poo(c.name):this.apiSection.title),slug:l.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:o,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}else{this.taskContext.logger.warn(cUu(t.package,this.#e.subpackageLocators));let f=t.slug??u$(t.package),u=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:f}),s=this.#d(t.contents,void 0,u,o);return{id:this.#f.get(i??`${this.apiDefinitionId}:${u$(t.package)}`),type:"apiPackage",children:s,title:t.title??t.package,slug:u.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:o,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}#_(t,r,n){let i=t.overviewAbsolutePath!=null?fl.V1.PageId(hoo(this.docsWorkspace,t.overviewAbsolutePath)):void 0,a=t.overviewAbsolutePath!=null?this.markdownFilesToFullSlugs.get(t.overviewAbsolutePath):void 0,o=t.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(t.overviewAbsolutePath):void 0,c=this.#f.get(i??a??r.get()),f=t.referencedSubpackages.map(O=>{let P=this.#e.getSubpackageByIdOrLocator(O),C=P!=null?J8i.getSubpackageId(P):void 0;if(C===void 0){this.taskContext.logger.error(cUu(O,this.#e.subpackageLocators));return}return{subpackageId:C,locator:O}}).filter(O=>O!=null).filter(hj);this.#o.set(c,f.map(O=>O.subpackageId)),f.forEach(O=>{this.#a.has(O.subpackageId)&&this.taskContext.logger.error(lUu(O.locator)),this.#a.add(O.subpackageId)});let u=t.slug??u$(t.title),s=r.apply({fullSlug:a?.split("/"),skipUrlSlug:t.skipUrlSlug,urlSlug:u}),l=t.availability??n,m=this.#d(t.contents,void 0,s,l);return{id:c,type:"apiPackage",children:m,title:t.title,slug:s.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,overviewPageId:i,availability:l,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:o,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}#y(t,r,n,i){t=t.trim();let a=this.#e.getSubpackageByIdOrLocator(t)??this.#e.getSubpackageByIdOrLocator($A(t));if(a!=null){let o=J8i.getSubpackageId(a),c=this.#f.get(`${this.apiDefinitionId}:${o}`);this.#a.has(o)&&this.taskContext.logger.error(lUu(t)),this.#a.add(o),this.#o.set(c,[o]);let f=hWr(a)?a.urlSlug:"",u=n.apply({urlSlug:f});return{id:c,type:"apiPackage",children:[],title:hWr(a)?a.displayName??poo(a.name):this.apiSection.title,slug:u.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:i,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0}}return this.#h({type:"endpoint",endpoint:t,title:void 0,icon:void 0,slug:void 0,hidden:void 0,availability:void 0,playground:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0},r,n,i)}#h(t,r,n,i){let a=(r!=null?this.#e.subpackages.get(mve.SubpackageId(r))?.endpoints.get(mve.EndpointId(t.endpoint)):void 0)??this.#e.endpointsByLocator.get(t.endpoint);if(a!=null){let f=this.#e.getEndpointId(a);if(f==null)this.taskContext.logger.debug(`Expected Endpoint ID for ${a.id} at path: ${uUu(a.method,a.path.parts)}. Got undefined.`);else{this.#t.has(f)&&this.taskContext.logger.error(`Duplicate endpoint found in the API Reference layout: ${f}`),this.#t.add(f);let u=t.slug!=null?n.append(t.slug):n.apply(a);return{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"endpoint",method:a.method,endpointId:f,apiDefinitionId:this.apiDefinitionId,availability:t.availability??fl.V1.convertAvailability(a.availability)??i,isResponseStream:a.response?.type.type==="stream",title:t.title??a.name??WPe(a.path.parts),slug:u.get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}}let o=(r!=null?this.#e.subpackages.get(mve.SubpackageId(r))?.webSockets.get(mve.WebSocketId(t.endpoint)):void 0)??this.#e.webSocketsByLocator.get(t.endpoint);if(o!=null){let f=this.#e.getWebSocketId(o);if(f==null)this.taskContext.logger.error(`Expected WebSocket ID for ${o.id}. Got undefined.`);else return this.#r.has(f)&&this.taskContext.logger.error(`Duplicate web socket found in the API Reference layout: ${f}`),this.#r.add(f),{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"webSocket",webSocketId:f,title:t.title??o.name??WPe(o.path.parts),slug:(t.slug!=null?n.append(t.slug):n.apply(o)).get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(o.availability)??i,playground:this.#v(t.playground),authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}let c=(r!=null?this.#e.subpackages.get(mve.SubpackageId(r))?.webhooks.get(mve.WebhookId(t.endpoint)):void 0)??this.#e.webhooks.get(fl.V1.WebhookId(t.endpoint));if(c!=null){let f=this.#e.getWebhookId(c);if(f==null)this.taskContext.logger.error(`Expected Webhook ID for ${c.id}. Got undefined.`);else return this.#n.has(f)&&this.taskContext.logger.error(`Duplicate webhook found in the API Reference layout: ${f}`),this.#n.add(f),{id:this.#f.get(`${this.apiDefinitionId}:${f}`),type:"webhook",webhookId:f,method:c.method,title:t.title??c.name??(0,QPv.default)("/",...c.path),slug:(t.slug!=null?n.append(t.slug):n.apply(c)).get(),icon:this.resolveIconFileId(t.icon),hidden:this.hideChildren||t.hidden,apiDefinitionId:this.apiDefinitionId,availability:i,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}this.taskContext.logger.error("Unknown identifier in the API Reference layout: ",t.endpoint)}#g(t,r){return xPv({left:t,right:r,findEndpointById:n=>this.#e.endpoints.get(n),stringifyEndpointPathParts:n=>WPe(n.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}#m(t,r){return UUf({child:t,nodeIdToSubpackageId:this.#o,convertApiDefinitionPackageId:(n,i,a)=>this.#A(n,i,a),mergeAndFilterChildren:this.#g.bind(this)})}#O(t,r,n){let i=[];return t.endpoints.forEach(a=>{if(a.protocol?.type==="grpc"){let o=this.#e.getGrpcId(a);if(o==null){this.taskContext.logger.error(`Expected Grpc ID for ${a.id} at path: ${uUu(a.method,a.path.parts)}. Got undefined.`);return}if(this.#i.has(o))return;let c=r.apply(a);i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"grpc",grpcId:o,title:a.name??WPe(a.path.parts),method:a.protocol?.methodType??"UNARY",apiDefinitionId:this.apiDefinitionId,availability:n,slug:c.get(),icon:void 0,hidden:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}else{let o=this.#e.getEndpointId(a);if(o==null){this.taskContext.logger.debug(`Expected Endpoint ID for ${a.id} at path: ${uUu(a.method,a.path.parts)}. Got undefined.`);return}if(this.#t.has(o))return;let c=r.apply(a);i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"endpoint",method:a.method,endpointId:o,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(a.availability)??n,isResponseStream:a.response?.type.type==="stream",title:a.name??WPe(a.path.parts),slug:c.get(),icon:void 0,hidden:this.hideChildren,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}}),t.websockets.forEach(a=>{let o=this.#e.getWebSocketId(a);if(o==null){this.taskContext.logger.error(`Expected WebSocket ID for ${a.id}. Got undefined.`);return}this.#r.has(o)||i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"webSocket",webSocketId:o,title:a.name??WPe(a.path.parts),slug:r.apply(a).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:fl.V1.convertAvailability(a.availability)??n,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.webhooks.forEach(a=>{let o=this.#e.getWebhookId(a);if(o==null){this.taskContext.logger.error(`Expected Webhook ID for ${a.id}. Got undefined.`);return}this.#n.has(o)||i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${o}`),type:"webhook",webhookId:o,method:a.method,title:a.name??poo(a.id),slug:r.apply(a).get(),icon:void 0,hidden:this.hideChildren,apiDefinitionId:this.apiDefinitionId,availability:n,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),t.subpackages.forEach(a=>{if(this.#a.has(a))return;let o=this.#e.getSubpackageByIdOrLocator(a);if(o==null){this.taskContext.logger.error(`Subpackage ${a} not found in ${this.apiDefinitionId}`);return}let c=hWr(o)?r.apply(o):r,f=this.#A(a,c,n);f.length>0&&i.push({id:fl.V1.NodeId(`${this.apiDefinitionId}:${a}`),type:"apiPackage",children:f,title:hWr(o)?o.displayName??poo(o.name):this.apiSection.title,slug:c.get(),icon:void 0,hidden:this.hideChildren,overviewPageId:void 0,availability:n,apiDefinitionId:this.apiDefinitionId,pointsTo:void 0,noindex:void 0,playground:void 0,authed:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}),i=this.mergeEndpointPairs(i),this.apiSection.alphabetized&&(i=i.sort((a,o)=>{let c=a.type==="endpointPair"?a.nonStream.title:a.title,f=o.type==="endpointPair"?o.nonStream.title:o.title;return c.localeCompare(f)})),i}#A(t,r,n){let i=t!=null?this.#e.resolveSubpackage(this.#e.getSubpackageByIdOrLocator(t)):void 0;return i==null?(this.taskContext.logger.debug(cUu(t||"unknown",[])),[]):this.#O(i,r,n)}#v(t){return CPv(t)}mergeEndpointPairs(t){return fUu({children:t,findEndpointById:r=>this.#e.endpoints.get(r),stringifyEndpointPathParts:r=>WPe(r.path.parts),disableEndpointPairs:this.disableEndpointPairs,apiDefinitionId:this.apiDefinitionId})}getFileId(t){let r=this.collectedFileIds.get(t);return r??this.taskContext.failAndThrow("Failed to locate file after uploading: "+t)}resolveIconFileId(t){if(t!=null)return this.collectedFileIds.has(t)?`file:${this.getFileId(t)}`:t}};var LPv=$i(require("crypto"),1);function stM(e){return LPv.default.createHash("sha256").update(e).digest("hex")}var pUu=class e{static init(){return new e}constructor(){}#e=new Map;#t=new Set;#r(t){let r=this.#e.get(t)??0;return this.#e.set(t,r+1),stM(r===0?t:`${t}-${r}`)}#n(t){let r=this.#r(t),n=0;for(;this.#t.has(r);)if(r=this.#r(t),n++,n>100)throw new Error(`Infinite loop detected for id: ${t}`);return r}get(t){return fl.V1.NodeId(this.#n(t))}};function UPv(e){return e==null?{}:{pythonSdk:e.python!=null?{package:typeof e.python=="string"?e.python:e.python.package,version:typeof e.python=="string"?void 0:e.python.version}:void 0,typescriptSdk:e.typescript!=null?{package:typeof e.typescript=="string"?e.typescript:e.typescript.package,version:typeof e.typescript=="string"?void 0:e.typescript.version}:void 0,goSdk:e.go!=null?{githubRepo:typeof e.go=="string"?e.go:e.go.package,version:typeof e.go=="string"?void 0:e.go.version}:void 0,javaSdk:e.java!=null?{coordinate:typeof e.java=="string"?e.java:e.java.package,version:typeof e.java=="string"?void 0:e.java.version}:void 0,rubySdk:e.ruby!=null?{gem:typeof e.ruby=="string"?e.ruby:e.ruby.package,version:typeof e.ruby=="string"?void 0:e.ruby.version}:void 0,csharpSdk:e.csharp!=null?{package:typeof e.csharp=="string"?e.csharp:e.csharp.package,version:typeof e.csharp=="string"?void 0:e.csharp.version}:void 0,phpSdk:e.php!=null?{package:typeof e.php=="string"?e.php:e.php.package,version:typeof e.php=="string"?void 0:e.php.version}:void 0,swiftSdk:e.swift!=null?{package:typeof e.swift=="string"?e.swift:e.swift.package,version:typeof e.swift=="string"?void 0:e.swift.version}:void 0,rustSdk:e.rust!=null?{package:typeof e.rust=="string"?e.rust:e.rust.package,version:typeof e.rust=="string"?void 0:e.rust.version}:void 0}}function VPv({auth:e,playgroundConfig:t,context:r}){if(e.schemes.length>0&&e.schemes[0]!=null){let n=e.schemes[0];return WPv({scheme:n,playgroundConfig:t,context:r})}}function WPv({scheme:e,playgroundConfig:t,context:r}){switch(e.type){case"basic":return{type:"basicAuth",passwordName:e.password.originalName,usernameName:e.username.originalName,description:e.docs};case"bearer":return{type:"bearerAuth",tokenName:e.token.originalName,description:e.docs};case"header":return{type:"header",headerWireValue:e.name.wireValue,nameOverride:e.name.name.originalName,prefix:e.prefix,description:e.docs};case"oauth":{let n=e.configuration.tokenEndpoint.responseProperties.accessToken.propertyPath?.map(i=>i.name.originalName).join(".")||"$.body.access_token";return t?.oauth?{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:ry.EndpointId(e.configuration.tokenEndpoint.endpointReference.endpointId),accessTokenLocator:ry.JqString(n),headerName:e.configuration.tokenHeader,tokenPrefix:e.configuration.tokenPrefix,description:e.docs}}}:{type:"bearerAuth",tokenName:"token",description:e.docs}}case"inferred":{e.tokenEndpoint.authenticatedRequestHeaders.length>1&&r.logger.warn("Inferred auth scheme has multiple authenticated request headers. Only the `Authentication` or first header will be pushed to FDR.");let n=e.tokenEndpoint.authenticatedRequestHeaders.find(a=>a.headerName.toLowerCase()==="authorization");if(n)return n.responseProperty.propertyPath!=null&&n.responseProperty.propertyPath.length>0&&r.logger.warn("Inferred Authentication header has a property path. The property wirevalue will be pushed to FDR without property path."),{type:"bearerAuth",tokenName:n.responseProperty.property.name.wireValue,description:e.docs};let i=e.tokenEndpoint.authenticatedRequestHeaders[0];return i?{type:"header",headerWireValue:i.headerName,prefix:i.valuePrefix,nameOverride:void 0,description:e.docs}:{type:"bearerAuth",tokenName:"token",description:e.docs}}default:ku(e)}}function GPv({auth:e,playgroundConfig:t,context:r}){let n={};for(let i of e.schemes){let a=WPv({scheme:i,playgroundConfig:t,context:r});a!=null&&(n[ry.AuthSchemeId(i.key)]=a)}return n}function JPv(e){return e._visit({alias:t=>({type:"alias",value:o4(t.aliasOf)}),enum:t=>({type:"enum",default:t.default!=null?t.default.name.wireValue:void 0,values:t.values.map(r=>({description:r.docs??void 0,value:r.name.wireValue,availability:fie(r.availability)}))}),object:t=>({type:"object",extends:t.extends.map(r=>ry.TypeId(r.typeId)),properties:t.properties.map(r=>({description:r.docs??void 0,key:ry.PropertyKey(r.name.wireValue),valueType:o4(r.valueType),availability:fie(r.availability),propertyAccess:r.propertyAccess})),extraProperties:ltM(t.extraProperties)}),union:t=>{let r=t.baseProperties.map(n=>({key:ry.PropertyKey(n.name.wireValue),valueType:o4(n.valueType),availability:fie(n.availability),description:n.docs,propertyAccess:n.propertyAccess}));return{type:"discriminatedUnion",discriminant:t.discriminant.wireValue,variants:t.types.map(n=>({description:n.docs??void 0,discriminantValue:n.discriminantValue.wireValue,displayName:n.displayName,availability:n.availability!=null?fie(n.availability):void 0,additionalProperties:np.types.SingleUnionTypeProperties._visit(n.shape,{samePropertiesAsObject:i=>({extends:[ry.TypeId(i.typeId)],properties:r,extraProperties:void 0}),singleProperty:i=>({extends:[],properties:[{key:ry.PropertyKey(i.name.wireValue),valueType:o4(i.type),description:void 0,availability:void 0,propertyAccess:void 0},...r],extraProperties:void 0}),noProperties:()=>({extends:[],properties:r,extraProperties:void 0}),_other:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+n.shape.propertiesType)}})}))}},undiscriminatedUnion:t=>({type:"undiscriminatedUnion",variants:t.members.map(r=>({typeName:r.type.type==="named"?r.type.name.originalName:void 0,description:r.docs??void 0,type:o4(r.type),availability:void 0,displayName:r.type.type==="named"?r.type.displayName:void 0}))}),_other:()=>{throw new Error("Unknown Type shape: "+e.type)}})}function o4(e){return e._visit({container:t=>np.types.ContainerType._visit(t,{list:r=>({type:"list",itemType:o4(r)}),map:({keyType:r,valueType:n})=>({type:"map",keyType:o4(r),valueType:o4(n)}),optional:r=>({type:"optional",itemType:o4(r),defaultValue:void 0}),nullable:r=>({type:"nullable",itemType:o4(r)}),set:r=>({type:"set",itemType:o4(r)}),literal:r=>np.types.Literal._visit(r,{boolean:n=>({type:"literal",value:{type:"booleanLiteral",value:n}}),string:n=>({type:"literal",value:{type:"stringLiteral",value:n}}),_other:()=>{throw new Error("Unknown literal type: "+r.type)}}),_other:()=>{throw new Error("Unknown container reference: "+t.type)}}),named:t=>({type:"id",value:ry.TypeId(t.typeId),default:void 0}),primitive:t=>({type:"primitive",value:np.types.PrimitiveTypeV1._visit(t.v1,{integer:()=>ctM(t.v2),float:()=>HPv(t.v2),double:()=>HPv(t.v2),string:()=>utM(t.v2),long:()=>({type:"long",default:t.v2?.type==="long"?t.v2.default:void 0,minimum:void 0,maximum:void 0}),boolean:()=>({type:"boolean",default:t.v2?.type==="boolean"?t.v2.default:void 0}),dateTime:()=>({type:"datetime",default:void 0}),date:()=>({type:"date",default:void 0}),uuid:()=>({type:"uuid",default:void 0}),base64:()=>({type:"base64",mimeType:void 0,default:void 0}),bigInteger:()=>({type:"bigInteger",default:t.v2?.type==="bigInteger"?t.v2.default:void 0}),uint:()=>({type:"uint"}),uint64:()=>({type:"uint64"}),_other:()=>{throw new Error("Unknown primitive: "+t.v1)}})}),unknown:()=>({type:"unknown"}),_other:()=>{throw new Error("Unknown Type reference: "+e.type)}})}function utM(e){let t=e!=null&&e.type==="string"?e.validation:void 0;return{type:"string",format:t?.format,regex:t?.pattern,minLength:t?.minLength,maxLength:t?.maxLength,default:e!=null&&e.type==="string"?e.default:void 0}}function ctM(e){let t=e!=null&&e.type==="integer"?e.validation:void 0;return{type:"integer",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="integer"?e.default:void 0}}function HPv(e){let t=e!=null&&e.type==="double"?e.validation:void 0;return{type:"double",minimum:t?.min,maximum:t?.max,default:e!=null&&e.type==="double"?e.default:void 0}}function ltM(e){return typeof e=="boolean"?e?Bh.unknown():void 0:typeof e=="string"?{type:"id",value:ry.TypeId(e),default:void 0}:o4(e)}function GUf(e,t){let r=e.service!=null?t.services[e.service]:void 0,n=e.webhooks!=null?t.webhookGroups[e.webhooks]:void 0,i=e.websocket!=null&&t.websocketChannels!=null?t.websocketChannels[e.websocket]:void 0;return{endpoints:r!=null?dtM(r,t):[],webhooks:n!=null?ftM(n):[],websockets:i!=null?[ptM(i,t)]:[],types:e.types.map(a=>ry.TypeId(a)),subpackages:e.subpackages.map(a=>ry.api.v1.SubpackageId(a)),pointsTo:e.navigationConfig!=null?ry.api.v1.SubpackageId(e.navigationConfig.pointsTo):void 0}}function ftM(e){return e.map(t=>{let r=[];return t.v2Examples!=null?(r.push(...Object.values(t.v2Examples.userSpecifiedExamples)),r.push(...Object.values(t.v2Examples.autogeneratedExamples))):r.push(...t.examples?.map(n=>({payload:n.payload.jsonExample}))??[]),{description:t.docs??void 0,id:ry.WebhookId(t.name.originalName),path:[],method:t.method,name:t.displayName??uia(t.name.originalName),headers:t.headers.map(n=>({description:n.docs??void 0,key:n.name.wireValue,type:o4(n.valueType),availability:fie(n.availability)})),payload:OtM(t.payload),examples:r}})}function dtM(e,t){let r=[];for(let n of e.endpoints){let i=n.autogeneratedExamples[0],a=[];if(n.v2Examples!=null){let c,f=n.v2Examples.userSpecifiedExamples,u=n.v2Examples.autogeneratedExamples,s=Object.values(f).map(m=>m.response?.statusCode).filter((m,O,P)=>P.indexOf(m)!==O).length>0;for(let[m,O]of Object.entries(f))c=YPv({shouldUseExampleName:s,exampleName:O.displayName??m,example:O,irEndpoint:n,irService:e,ir:t}),c!=null&&a.push(c);let l=Object.values(u).map(m=>m.response?.statusCode).filter((m,O,P)=>P.indexOf(m)!==O).length>0;for(let[m,O]of Object.entries(u))c=YPv({shouldUseExampleName:l,exampleName:O.displayName??m,example:O,irEndpoint:n,irService:e,ir:t}),c!=null&&a.push(c)}else if(n.userSpecifiedExamples.length>0)a.push(...n.userSpecifiedExamples.map(c=>WUf({userSpecifiedExample:c,...i!=null&&{autogeneratedExample:i},irEndpoint:n,ir:t})).filter(hj));else if(i!=null){let c=WUf({autogeneratedExample:i,irEndpoint:n,ir:t});c!=null&&a.push(c)}else if(n.response?.body?.type==="fileDownload"){let c=gro({ir:t,service:e,endpoint:{...n,response:void 0},typeDeclarations:t.types,skipOptionalRequestProperties:!0,generationResponse:{type:"success"}});if(c.type==="success"){let f=WUf({autogeneratedExample:c,irEndpoint:n,ir:t});if(f!=null){let u={...f,responseBodyV3:{type:"filename",value:"<bytes>"}};a.push(u)}}}let o={slug:void 0,availability:fie(n.availability??e.availability),auth:n.auth,authV2:_tM(n.security),description:n.docs??void 0,method:btM(n.method),defaultEnvironment:t.environments?.defaultEnvironment!=null?ry.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?htM({environmentsConfig:t.environments,endpoint:n}):void 0,id:ry.EndpointId(n.name.originalName),originalEndpointId:n.id,name:n.displayName??uia(n.name.originalName),path:n.basePath!=null?{pathParameters:n.pathParameters.map(c=>({description:c.docs??void 0,key:ry.PropertyKey(c.name.originalName),type:o4(c.valueType),availability:void 0})),parts:[...yoo(n.basePath),...yoo(n.path)]}:{pathParameters:[...t.pathParameters,...e.pathParameters,...n.pathParameters].map(c=>({description:c.docs??void 0,key:ry.PropertyKey(c.name.originalName),type:o4(c.valueType),availability:void 0})),parts:[...t.basePath!=null?yoo(t.basePath):[],...yoo(e.basePath),...yoo(n.path)]},queryParameters:n.queryParameters.map(c=>({description:c.docs??void 0,key:c.name.wireValue,type:o4(c.valueType),availability:fie(c.availability)})),headers:[...e.headers,...n.headers].map(c=>({description:c.docs??void 0,key:c.name.wireValue,type:o4(c.valueType),availability:fie(c.availability)})),request:n.requestBody!=null?KPv(n.requestBody):void 0,requestsV2:{requests:n.v2RequestBodies?.requestBodies?.map(KPv).filter(hj)},response:n.response!=null?$Pv(n.response):void 0,responsesV2:{responses:n.v2Responses?.responses?.map($Pv).filter(hj)},errors:void 0,errorsV2:gtM(n.errors,t),examples:a,protocol:n.source?._visit({openapi:()=>({type:"rest"}),openrpc:()=>({type:"openrpc",methodName:n.id}),proto:c=>({type:"grpc",methodName:n.id,methodType:c.methodType}),_other:()=>{}}),includeInApiExplorer:void 0};r.push(o)}return r}function ptM(e,t){let r=[];if(e.v2Examples!=null&&(Object.keys(e.v2Examples.userSpecifiedExamples).length>0||Object.keys(e.v2Examples.autogeneratedExamples).length>0)){let n=Object.values(e.v2Examples.userSpecifiedExamples),i=Object.values(e.v2Examples.autogeneratedExamples),a=n.length>0?n[0]:i[0];a!=null&&r.push({name:"",description:"",path:a.baseUrl??"",pathParameters:a.pathParameters??{},queryParameters:a.queryParameters??{},headers:a.headers??{},messages:a.messages?.map(o=>({type:ry.api.v1.WebSocketMessageId(o.type),body:o.body}))??[]})}else r=e.examples.map(n=>({name:n.name?.originalName,description:n.docs,path:n.url,pathParameters:n.pathParameters.reduce((i,a)=>(i[ry.PropertyKey(a.name.originalName)]=a.value.jsonExample,i),{}),queryParameters:n.queryParameters.reduce((i,a)=>(i[a.name.wireValue]=a.value.jsonExample,i),{}),headers:n.headers.reduce((i,a)=>(i[a.name.wireValue]=a.value.jsonExample,i),{}),messages:n.messages.map(i=>({type:ry.api.v1.WebSocketMessageId(i.type),body:i.body.jsonExample}))}));return{auth:e.auth,availability:fie(e.availability),description:e.docs??void 0,defaultEnvironment:t.environments?.defaultEnvironment!=null?ry.EnvironmentId(t.environments.defaultEnvironment):void 0,environments:t.environments!=null?ytM({environmentsConfig:t.environments,channel:e}):[],id:ry.WebSocketId(e.name.originalName),name:e.displayName??uia(e.name.originalName),path:{pathParameters:e.pathParameters.map(n=>({description:n.docs??void 0,key:ry.PropertyKey(n.name.originalName),type:o4(n.valueType),availability:void 0})),parts:yoo(e.path)},headers:e.headers.map(n=>({key:n.name.wireValue,type:o4(n.valueType),description:n.docs,availability:fie(n.availability)})),queryParameters:e.queryParameters.map(n=>({description:n.docs??void 0,key:n.name.wireValue,type:o4(n.valueType),availability:fie(n.availability)})),messages:e.messages.map(n=>({type:ry.api.v1.WebSocketMessageId(n.type),displayName:n.displayName,origin:n.origin,body:AtM(n.body),description:n.docs,availability:fie(n.availability)})),examples:r}}function _tM(e){if(e==null)return;if(e.length===0)return[];let t=new Set(e.flatMap(r=>Object.keys(r)));return Array.from(t).map(r=>ry.AuthSchemeId(r))}function fie(e){if(e!=null)switch(e.status){case"DEPRECATED":return ry.Availability.Deprecated;case"PRE_RELEASE":return ry.Availability.Beta;case"GENERAL_AVAILABILITY":return ry.Availability.GenerallyAvailable;case"IN_DEVELOPMENT":return ry.Availability.Beta;default:ku(e.status)}}function htM({environmentsConfig:e,endpoint:t}){let r=e.environments,n=t.baseUrl,i=t.v2BaseUrls;switch(r.type){case"singleBaseUrl":return r.environments.map(a=>({id:ry.EnvironmentId(a.id),baseUrl:a.url}));case"multipleBaseUrls":if(i!=null)return i.flatMap(o=>r.environments.map(c=>{let f=c.urls[o];if(f==null)throw new Error(`Encountered undefined server name "${o}" at endpoint ${t.method.toUpperCase()} ${t.path}. Expected environment ${c.id} to contain url for ${o}`);return{id:ry.EnvironmentId(o),baseUrl:f}})).filter((o,c,f)=>c===f.findIndex(u=>u.id===o.id&&u.baseUrl===o.baseUrl));if(n==null)throw new Error(`Expected endpoint ${t.name.originalName} to have base url.`);return r.environments.map(a=>{let o=a.urls[n];if(o==null)throw new Error(`Encountered undefined server name "${n}" at endpoint ${t.method.toUpperCase()} ${t.path.head}. Expected environment ${a.id} to contain url for ${n}`);return{id:ry.EnvironmentId(a.id),baseUrl:o}});default:ku(r)}}function ytM({environmentsConfig:e,channel:t}){let r=e.environments,n=t.baseUrl;switch(r.type){case"singleBaseUrl":return r.environments.map(i=>({id:ry.EnvironmentId(i.id),baseUrl:vtM(i.url,"wss")}));case"multipleBaseUrls":if(n==null)throw new Error(`Expected channel ${t.name.originalName} to have base url.`);return r.environments.map(i=>{let a=i.urls[n];if(a==null)throw new Error(`Encountered undefined server name ${a} at channel ${t.name.originalName} ${t.path.head}. Expected environment ${i.id} to contain url for ${n}`);return{id:ry.EnvironmentId(i.id),baseUrl:a}});default:ku(r)}}function vtM(e,t){return e.replace(/^[^:]+/,t)}function btM(e){return np.http.HttpMethod._visit(e,{get:()=>ry.HttpMethod.Get,post:()=>ry.HttpMethod.Post,put:()=>ry.HttpMethod.Put,patch:()=>ry.HttpMethod.Patch,delete:()=>ry.HttpMethod.Delete,head:()=>ry.HttpMethod.Head,_other:()=>{throw new Error("Unknown http method: "+e)}})}function yoo(e){let t=e.parts.flatMap(r=>[{type:"pathParameter",value:ry.PropertyKey(r.pathParameter)},{type:"literal",value:r.tail}]);return[{type:"literal",value:e.head},...t]}function KPv(e){let t=np.http.HttpRequestBody._visit(e,{inlinedRequestBody:r=>({type:"json",contentType:r.contentType??T8.APPLICATION_JSON,shape:{type:"object",extends:r.extends.map(n=>ry.TypeId(n.typeId)),properties:r.properties.map(n=>({description:n.docs??void 0,key:ry.PropertyKey(n.name.wireValue),valueType:o4(n.valueType),availability:fie(n.availability),propertyAccess:n.propertyAccess})),extraProperties:r.extraProperties?{type:"unknown"}:void 0}}),reference:r=>({type:"json",contentType:r.contentType??T8.APPLICATION_JSON,shape:{type:"reference",value:o4(r.requestBodyType)},description:r.docs??void 0}),fileUpload:r=>({type:"fileUpload",value:{name:r.name.originalName,description:void 0,availability:void 0,properties:r.properties.map(n=>n._visit({file:i=>{let a=i._visit({file:o=>({type:"file",key:ry.PropertyKey(o.key.wireValue),isOptional:o.isOptional,contentType:o.contentType,description:o.docs??void 0,availability:void 0}),fileArray:o=>({type:"fileArray",key:ry.PropertyKey(o.key.wireValue),isOptional:o.isOptional,contentType:o.contentType,description:o.docs??void 0,availability:void 0}),_other:()=>{}});if(a!=null)return{type:"file",value:a}},bodyProperty:i=>({type:"bodyProperty",key:ry.PropertyKey(i.name.wireValue),valueType:o4(i.valueType),contentType:i.contentType,description:i.docs??void 0,availability:fie(i.availability),exploded:i.style==="exploded",propertyAccess:void 0}),_other:()=>{}})).filter(hj)},contentType:r.contentType,description:r.docs??void 0}),bytes:r=>({type:"bytes",description:r.docs??void 0,availability:void 0,isOptional:r.isOptional,contentType:r.contentType}),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}});return t!=null?{type:t,description:e.docs}:void 0}function $Pv(e){if(e.body==null)return;let t,r=np.http.HttpResponseBody._visit(e.body,{fileDownload:n=>(t=n.docs,{type:"fileDownload",contentType:void 0}),json:n=>(t=n.docs,{type:"reference",value:o4(n.responseBodyType)}),text:()=>{},bytes:()=>{},streamParameter:()=>{},streaming:n=>{if(n.type==="text")return t=n.docs,{type:"streamingText"};if(n.type==="json")return t=n.docs,{type:"stream",shape:{type:"reference",value:o4(n.payload)},terminator:n.terminator};if(n.type==="sse")return t=n.docs,{type:"stream",shape:{type:"reference",value:o4(n.payload)},terminator:n.terminator}},_other:()=>{throw new Error("Unknown HttpResponse: "+e.body)}});return r!=null?{type:r,statusCode:e.statusCode,description:t}:e.statusCode!=null?{statusCode:e.statusCode,description:t,type:{type:"object",extends:[],properties:[],extraProperties:void 0}}:void 0}function gtM(e,t){let r=[];if(t.errorDiscriminationStrategy.type==="statusCode")for(let n of e){let i=t.errors[n.error.errorId];i&&r.push({type:i.type==null?void 0:{type:"alias",value:o4(i.type)},statusCode:i.statusCode,description:i.docs??void 0,name:i.displayName??i.name.name.originalName,availability:void 0,examples:PtM(i)})}else for(let n of e){let i=t.errors[n.error.errorId];if(i){let a=[{key:ry.PropertyKey(t.errorDiscriminationStrategy.discriminant.wireValue),valueType:{type:"literal",value:{type:"stringLiteral",value:i.discriminantValue.name.originalName}},description:i.docs,availability:void 0,propertyAccess:void 0}];i.type!=null&&a.push({key:ry.PropertyKey(t.errorDiscriminationStrategy.contentProperty.wireValue),valueType:o4(i.type),description:i.docs,availability:void 0,propertyAccess:void 0}),r.push({type:i.type==null?void 0:{type:"object",extends:[],properties:a,extraProperties:void 0},statusCode:i.statusCode,description:i.docs??void 0,availability:void 0,name:i.displayName??i.name.name.originalName,examples:i.examples.map(o=>({name:o.name?.originalName,responseBody:{type:"json",value:o.jsonExample},description:o.docs}))})}}return r}function YPv({shouldUseExampleName:e,exampleName:t,example:r,irEndpoint:n,irService:i,ir:a}){if(r==null)return;let o=u=>{if(u.valueType.type==="container"&&u.valueType.container.type==="literal")return u.valueType.container.literal._visit({boolean:s=>`${s}`,string:s=>s,_other:()=>{}});if(u.valueType.type==="container"&&u.valueType.container.type==="optional"&&u.valueType.container.optional.type==="container"&&u.valueType.container.optional.container.type==="literal")return u.valueType.container.optional.container.literal._visit({boolean:s=>`${s}`,string:s=>s,_other:()=>{}})},c={};a.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)}),i.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)}),n.headers.forEach(u=>{let s=o(u);s!=null&&(c[u.name.wireValue]=s)});let f=r.response?.body!=null?r.response.body.value:void 0;return{name:e?t:void 0,description:"",path:r.request?.endpoint.path??"",pathParameters:r.request?.pathParameters??{},queryParameters:r.request?.queryParameters??{},headers:(()=>{let s={...r.request?.headers??{}};for(let[l,m]of Object.entries(c))(s[l]===null||s[l]===void 0)&&(s[l]=m);return s})(),requestBody:r.request?.requestBody,requestBodyV3:n.requestBody?._visit({inlinedRequestBody:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,reference:()=>r.request!=null?{type:"json",value:r.request.requestBody}:void 0,fileUpload:u=>{if(r.request==null)return;let s={};if(QD(r.request.requestBody)){let l=r.request.requestBody;for(let m of u.properties)m._visit({file:O=>{let P=l[O.key.wireValue];if(O.type==="file")s[O.key.wireValue]={type:"filename",value:typeof P=="string"?P:"<file1>"};else if(O.type==="fileArray"){let C=(Array.isArray(P)?P:[P]).filter(I=>typeof I=="string");s[O.key.wireValue]={type:"filenames",value:C}}},bodyProperty:O=>{if(O.style==="exploded"){let P=l[O.name.wireValue];s[O.name.wireValue]={type:"exploded",value:Array.isArray(P)?P:[P]}}else s[O.name.wireValue]={type:"json",value:l[O.name.wireValue]}},_other:Ddt})}return{type:"form",value:s}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??n.response?.statusCode??200,responseBody:f??void 0,responseBodyV3:f!=null?r.response?.body?._visit({json:u=>({type:"json",value:u}),stream:u=>Array.isArray(u)&&u.length>0&&u.every(mtM)?{type:"sse",value:u}:{type:"stream",value:u},error:()=>{},_other:()=>{throw new Error("Unknown ExampleResponseBody: "+r.response?.body?.type)}}):void 0,codeSamples:r.codeSamples?.map(u=>({name:u.name,description:u.docs??void 0,install:void 0,language:u.language,code:u.code})).filter(hj)}}function mtM(e){return typeof e=="object"&&e!==null&&"event"in e&&typeof e?.event=="string"&&"data"in e}function WUf({userSpecifiedExample:e,autogeneratedExample:t,irEndpoint:r,ir:n}){let i=n.headers.map(c=>{let f;if(c.valueType.type==="container"&&c.valueType.container.type==="literal"?f=c.valueType.container.literal._visit({boolean:u=>`${u}`,string:u=>u,_other:()=>{}}):c.valueType.type==="container"&&c.valueType.container.type==="optional"&&c.valueType.container.optional.type==="container"&&c.valueType.container.optional.container.type==="literal"&&(f=c.valueType.container.optional.container.literal._visit({boolean:u=>`${u}`,string:u=>u,_other:()=>{}})),f!=null)return{name:c.name,value:{jsonExample:f,shape:np.ExampleTypeReferenceShape.primitive(np.ExamplePrimitive.string({original:f}))}}}).filter(hj),a=e?.example??t?.example;if(a==null)return;let{codeSamples:o}=e??{codeSamples:[]};return{name:a.name?.originalName,description:a.docs,path:a.url,pathParameters:[...a.rootPathParameters,...a.servicePathParameters,...a.endpointPathParameters].reduce((c,f)=>(c[ry.PropertyKey(f.name.originalName)]=f.value.jsonExample,c),{}),queryParameters:a.queryParameters.reduce((c,f)=>(c[f.name.wireValue]=f.value.jsonExample,c),{}),headers:[...i,...a.serviceHeaders,...a.endpointHeaders].reduce((c,f)=>(c[f.name.wireValue]=f.value.jsonExample,c),{}),requestBody:a.request?.jsonExample,requestBodyV3:r.requestBody?._visit({inlinedRequestBody:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,reference:()=>a.request!=null?{type:"json",value:a.request.jsonExample}:void 0,fileUpload:c=>{if(a.request==null)return;let f={};if(QD(a.request.jsonExample)){let u=a.request.jsonExample;for(let s of c.properties)s._visit({file:l=>{let m=u[l.key.wireValue];if(l.type==="file")f[l.key.wireValue]={type:"filename",value:typeof m=="string"?m:"<file1>"};else if(l.type==="fileArray"){let O=(Array.isArray(m)?m:[m]).filter(P=>typeof P=="string");f[l.key.wireValue]={type:"filenames",value:O}}},bodyProperty:l=>{if(l.style==="exploded"){let m=u[l.name.wireValue];f[l.name.wireValue]={type:"exploded",value:Array.isArray(m)?m:[m]}}else f[l.name.wireValue]={type:"json",value:u[l.name.wireValue]}},_other:Ddt})}return{type:"form",value:f}},bytes:()=>{},_other:()=>{}}),responseStatusCode:r.response?.statusCode??np.http.ExampleResponse._visit(a.response,{ok:c=>c._visit({body:f=>f!=null?200:204,stream:f=>f.length>0?200:204,sse:f=>f.length>0?200:204,_other:()=>{throw new Error("Unknown ExampleResponseBody: "+c.type)}}),error:({error:c})=>{let f=n.errors[c.errorId];if(f==null)throw new Error("Cannot find error "+c.errorId);return f.statusCode},_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),responseBody:a.response._visit({ok:c=>c._visit({body:f=>f?.jsonExample,stream:()=>{},sse:()=>{},_other:()=>{}}),error:c=>c.body?.jsonExample,_other:()=>{}}),responseBodyV3:a.response._visit({ok:c=>c._visit({body:f=>f!=null?{type:"json",value:f.jsonExample}:void 0,stream:f=>({type:"stream",value:f.map(u=>u.jsonExample)}),sse:f=>({type:"sse",value:f.map(({event:u,data:s})=>({event:u,data:s.jsonExample}))}),_other:()=>{throw new Error("Unknown ExampleResponseBody: "+c.type)}}),error:c=>c.body!=null?{type:"json",value:c.body.jsonExample}:void 0,_other:()=>{throw new Error("Unknown ExampleResponse: "+a.response.type)}}),codeSamples:o?.map(c=>Drt._visit(c,{language:f=>({language:f.language,code:f.code,name:f.name?.originalName,description:f.docs??void 0,install:f.install}),sdk:f=>({language:f.sdk,code:f.code,name:f.name?.originalName,description:f.docs??void 0,install:void 0}),_other:()=>{}})).filter(hj)}}function OtM(e){switch(e.type){case"inlinedPayload":return{type:{type:"object",extends:e.extends.map(t=>ry.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:ry.PropertyKey(t.name.wireValue),valueType:o4(t.valueType),availability:fie(t.availability),propertyAccess:void 0})),extraProperties:void 0},description:void 0};case"reference":return{type:{type:"reference",value:o4(e.payloadType)},description:e.docs};default:ku(e)}}function AtM(e){switch(e.type){case"inlinedBody":return{type:"object",extends:e.extends.map(t=>ry.TypeId(t.typeId)),properties:e.properties.map(t=>({description:t.docs??void 0,key:ry.PropertyKey(t.name.wireValue),valueType:o4(t.valueType),availability:fie(t.availability),propertyAccess:void 0})),extraProperties:void 0};case"reference":return{type:"reference",value:o4(e.bodyType)};default:ku(e)}}function PtM(e){let t=e.v2Examples?.userSpecifiedExamples,r=e.v2Examples?.autogeneratedExamples,n=e.examples;return t!=null&&Object.keys(t).length>0?Object.entries(t).map(([i,a])=>({name:i,responseBody:{type:"json",value:a},description:void 0})):r!=null&&Object.keys(r).length>0?Object.entries(r).map(([i,a])=>({name:i,responseBody:{type:"json",value:a},description:void 0})):n.length>0?n.map(i=>({name:i.name?.originalName,responseBody:{type:"json",value:i.jsonExample},description:i.docs})):[]}function UCe({ir:e,snippetsConfig:t,playgroundConfig:r,context:n}){let i={types:{},subpackages:{},rootPackage:GUf(e.rootPackage,e),auth:VPv({auth:e.auth,playgroundConfig:r,context:n}),authSchemes:GPv({auth:e.auth,playgroundConfig:r,context:n}),snippetsConfiguration:t,globalHeaders:e.headers.map(a=>({availability:fie(a.availability),description:a.docs??void 0,key:a.name.wireValue,type:o4(a.valueType)})),navigation:void 0};for(let[a,o]of Object.entries(e.types))i.types[ry.TypeId(a)]={description:o.docs??void 0,name:o.name.name.originalName,shape:JPv(o.shape),availability:fie(o.availability),displayName:o.name.displayName};for(let[a,o]of Object.entries(e.subpackages)){let c=o.service!=null?e.services[o.service]:void 0;i.subpackages[ry.api.v1.SubpackageId(a)]={subpackageId:ry.api.v1.SubpackageId(a),displayName:c?.displayName??o.displayName,name:o.name.originalName,description:o.docs??void 0,...GUf(o,e)}}return i}async function HUf({organization:e,workspace:t,context:r,token:n,audiences:i,snippetsConfig:a,playgroundConfig:o}){let c=xG({workspace:t,audiences:i,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1},readme:void 0,version:void 0,packageName:void 0,context:r,sourceResolver:new FG(r,t)}),f=rua({token:n.value}),u=UCe({ir:c,snippetsConfig:a,playgroundConfig:o,context:r}),s=await f.api.v1.register.registerApiDefinition({orgId:ry.OrgId(e),apiId:ry.ApiId(c.apiName.originalName),definition:u});if(s.ok)return r.logger.debug(`Registered API Definition ${s.body.apiDefinitionId}`),{id:s.body.apiDefinitionId,ir:c};switch(s.error.error){case"UnauthorizedError":case"UserNotInOrgError":return r.failAndThrow("You do not have permissions to register the docs. Reach out to support@buildwithfern.com");default:return r.failAndThrow("Failed to register API",s.error)}}var wtM=new dfu({snippetsBySdkId:{},snippetsConfigWithSdkId:{},snippetTemplatesByEndpoint:{},snippetsBySdkIdAndEndpointId:{},snippetTemplatesByEndpointId:{}});function jns({ir:e,apiDefinitionId:t,playgroundConfig:r,context:n}){return pfu(lfu(UCe({ir:e,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0,phpSdk:void 0,swiftSdk:void 0,rustSdk:void 0},playgroundConfig:r,context:n}),mve.ApiDefinitionId(t),wtM))}var XPv=$i(require("path"),1);async function nyt({iconPath:e,filepaths:t}){e!=null&&typeof e=="string"&&XPv.default.isAbsolute(e)&&t.add(e)}async function ZPv({parsedDocsConfig:e}){let t=new Set;return e.logo?.dark!=null&&t.add(e.logo.dark),e.logo?.light!=null&&t.add(e.logo.light),e.favicon!=null&&t.add(e.favicon),e.backgroundImage?.dark!=null&&t.add(e.backgroundImage.dark),e.backgroundImage?.light!=null&&t.add(e.backgroundImage.light),e.metadata?.["og:image"]!=null&&e.metadata["og:image"].type==="filepath"&&t.add(e.metadata["og:image"].value),e.metadata?.["og:logo"]!=null&&e.metadata["og:logo"].type==="filepath"&&t.add(e.metadata["og:logo"].value),e.metadata?.["twitter:image"]!=null&&e.metadata["twitter:image"].type==="filepath"&&t.add(e.metadata["twitter:image"].value),e.typography?.bodyFont!=null&&e.typography.bodyFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.typography?.headingsFont!=null&&e.typography.headingsFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.typography?.codeFont!=null&&e.typography.codeFont.variants.forEach(n=>{t.add(n.absolutePath)}),e.navigation.type==="productgroup"&&e.navigation.products.forEach(n=>{n.image!=null&&t.add(n.image)}),(await JUf({navigation:e.navigation})).forEach(n=>{t.add(n)}),e.navbarLinks&&await Promise.all(e.navbarLinks.map(async n=>{n.type==="dropdown"&&n.links.map(async i=>{i.icon&&await nyt({iconPath:i.icon,filepaths:t}),i.rightIcon&&await nyt({iconPath:i.rightIcon,filepaths:t})}),n.type!=="github"&&(n.icon&&await nyt({iconPath:n.icon,filepaths:t}),n.rightIcon&&await nyt({iconPath:n.rightIcon,filepaths:t}))})),e.js!=null&&e.js.files.forEach(n=>{t.add(n.absolutePath)}),t}async function JUf({navigation:e}){let t=new Set;switch(e.type){case"untabbed":await Promise.all(e.items.map(r=>voo({item:r,filepaths:t})));break;case"tabbed":await Promise.all(e.items.map(async r=>{r.icon!=null&&await nyt({iconPath:r.icon,filepaths:t}),r.child.type==="layout"&&r.child.layout!=null?await Promise.all(r.child.layout.map(n=>voo({item:n,filepaths:t}))):r.child.type==="variants"&&r.child.variants!=null&&await Promise.all(r.child.variants.flatMap(n=>{let i=[];return n.icon!=null&&i.push(nyt({iconPath:n.icon,filepaths:t})),i.push(...n.layout.map(a=>voo({item:a,filepaths:t}))),i}))}));break;case"versioned":await Promise.all(e.versions.map(async r=>{r.landingPage!=null&&await voo({item:r.landingPage,filepaths:t}),(await JUf({navigation:r.navigation})).forEach(i=>t.add(i))}));break;case"productgroup":await Promise.all(e.products.map(async r=>{r.icon!=null&&await nyt({iconPath:r.icon,filepaths:t}),r.type==="internal"&&(r.landingPage!=null&&await voo({item:r.landingPage,filepaths:t}),(await JUf({navigation:r.navigation})).forEach(i=>t.add(i)))}));break}return t}async function voo({item:e,filepaths:t}){switch(e.type){case"page":e.icon!=null&&await nyt({iconPath:e.icon,filepaths:t});break;case"section":e.icon!=null&&await nyt({iconPath:e.icon,filepaths:t}),await Promise.all(e.contents.map(r=>voo({item:r,filepaths:t})));break;case"apiSection":e.icon!=null&&await nyt({iconPath:e.icon,filepaths:t});break;case"link":e.icon!=null&&await nyt({iconPath:e.icon,filepaths:t});break;case"changelog":e.icon!=null&&await nyt({iconPath:e.icon,filepaths:t});break}}async function kPv({navigation:e,apiWorkspaces:t,visitor:r,context:n}){EtM(e)?await Promise.all(e.map(async i=>{StM(i)?await Promise.all(i.layout.map(async a=>{await _Uu({navigationItem:a,visitor:r,apiWorkspaces:t,context:n})})):DtM(i)&&await Promise.all(i.variants.flatMap(a=>a.layout.map(async o=>{await _Uu({navigationItem:o,visitor:r,apiWorkspaces:t,context:n})})))})):await Promise.all(e.map(async i=>{await _Uu({navigationItem:i,visitor:r,apiWorkspaces:t,context:n})}))}async function _Uu({navigationItem:e,visitor:t,apiWorkspaces:r,context:n}){if(await j2r(e,{alphabetized:Tc,api:Tc,apiName:Tc,audiences:Tc,displayErrors:Tc,snippets:Tc,summary:Tc,title:Tc,layout:Tc,collapsed:Tc,icon:Tc,slug:Tc,hidden:Tc,skipSlug:Tc,paginated:Tc,playground:Tc,flattened:Tc,path:Tc,page:Tc,featureFlag:Tc,openrpc:Tc,postman:Tc,contents:async i=>{i!=null&&await Promise.all(i.map(async a=>{await _Uu({navigationItem:a,visitor:t,apiWorkspaces:r,context:n})}))},viewers:Tc,orphaned:Tc,availability:Tc}),jtM(e)){let i=r.find(a=>a.workspaceName===e.apiName);i!=null&&await t.apiSection?.({config:e,workspace:i,context:n})}}function jtM(e){return e.api!=null}function EtM(e){return e[0]?.tab!=null}function StM(e){return"layout"in e&&Array.isArray(e.layout)}function DtM(e){return"variants"in e&&Array.isArray(e.variants)}function Lse(e){return e.startsWith("https://")||e.startsWith("http://")?e:`https://${e}`}twv.default.extend(rwv.default);var CtM=e=>e.map(t=>({...t,fileId:String(t.relativeFilePath)})),ewv=0,ItM=async({ir:e})=>(ewv++,`${e.apiName.snakeCase.unsafeName}-${ewv}`),Kqr=class{domain;docsWorkspace;ossWorkspaces;apiWorkspaces;taskContext;editThisPage;uploadFiles;registerApi;targetAudiences;constructor({domain:t,docsWorkspace:r,ossWorkspaces:n,apiWorkspaces:i,taskContext:a,editThisPage:o,uploadFiles:c=CtM,registerApi:f=ItM,targetAudiences:u}){this.domain=t,this.docsWorkspace=r,this.ossWorkspaces=n,this.apiWorkspaces=i,this.taskContext=a,this.editThisPage=o,this.uploadFiles=c,this.registerApi=f,this.targetAudiences=u}#e=pUu.init();shouldIncludeByAudience(t){return!t||t.length===0||!this.targetAudiences||this.targetAudiences.length===0?!0:t.some(r=>this.targetAudiences?.includes(r))}applyAudienceFiltering(t){let r=this.filterNavigationByAudience(t.navigation);return{...t,navigation:r}}filterNavigationByAudience(t){return t.type==="untabbed"||t.type==="tabbed"?t:t.type==="versioned"?{...t,versions:t.versions.filter(r=>this.shouldIncludeByAudience(this.getRawVersionAudiences(r.version)))}:t.type==="productgroup"?{...t,products:t.products.filter(r=>{let n=this.getRawProductAudiences(r.product);return this.shouldIncludeByAudience(n)})}:t}getRawProductAudiences(t){let n=this.docsWorkspace.config.products?.find(i=>i.displayName===t);return fHo(n?.audiences)}getRawVersionAudiences(t){let n=this.docsWorkspace.config.versions?.find(i=>i.displayName===t);return fHo(n?.audiences)}_parsedDocsConfig;get parsedDocsConfig(){if(this._parsedDocsConfig==null)throw new Error("parsedDocsConfig is not set");return this._parsedDocsConfig}collectedFileIds=new Map;markdownFilesToFullSlugs=new Map;markdownFilesToNoIndex=new Map;markdownFilesToTags=new Map;rawMarkdownFiles={};async resolve(){this._parsedDocsConfig=await Wuf({rawDocsConfiguration:this.docsWorkspace.config,context:this.taskContext,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absoluteFilepathToDocsConfig:this.docsWorkspace.absoluteFilepathToDocsConfig}),this.targetAudiences&&this.targetAudiences.length>0&&(this._parsedDocsConfig=this.applyAudienceFiltering(this._parsedDocsConfig));for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.rawMarkdownFiles[ru.of(l)]=m;let t=this.parsedDocsConfig.experimental?.openapiParserV3,r=t!=null&&!t;this.docsWorkspace.config.navigation!=null&&r&&await kPv({navigation:this.docsWorkspace.config.navigation,visitor:{apiSection:async({workspace:l})=>{(await l.toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,preserveSchemaIds:!0,objectQueryParameters:!0,respectReadonlySchemas:!0})).changelog?.files.forEach(O=>{let P=P3(this.docsWorkspace.absoluteFilePath,O.absoluteFilepath);this.parsedDocsConfig.pages[P]=O.contents,this.rawMarkdownFiles[ru.of(P)]=O.contents})}},apiWorkspaces:this.apiWorkspaces,context:this.taskContext}),this.markdownFilesToFullSlugs=await this.getMarkdownFilesToFullSlugs(this.parsedDocsConfig.pages),this.markdownFilesToNoIndex=await this.getMarkdownFilesToNoIndex(this.parsedDocsConfig.pages),this.markdownFilesToTags=await this.getMarkdownFilesToTags(this.parsedDocsConfig.pages);for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[ru.of(l)]=await $9f({markdown:m,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(l),context:this.taskContext});for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[ru.of(l)]=await K9f({markdown:m,absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath,absolutePathToMarkdownFile:this.resolveFilepath(l),context:this.taskContext});let n=await ZPv({parsedDocsConfig:this.parsedDocsConfig});for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))try{let{filepaths:O,markdown:P}=Eda(m,{absolutePathToMarkdownFile:this.resolveFilepath(l),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath});this.parsedDocsConfig.pages[ru.of(l)]=P;for(let C of O)n.add(C)}catch(O){throw this.taskContext.logger.error(`Failed to parse ${l}: ${O instanceof Error?O.message:String(O)}`),O}let i=Array.from(n).map(l=>({absoluteFilePath:l,relativeFilePath:this.toRelativeFilepath(l)}));(await this.uploadFiles(i)).forEach(l=>{this.collectedFileIds.set(l.absoluteFilePath,l.fileId)});let o=await this.toRootNode(),c=await this.getMarkdownFilesToFullyQualifiedPathNames(o);for(let[l,m]of Object.entries(this.parsedDocsConfig.pages))this.parsedDocsConfig.pages[ru.of(l)]=J9f(m,this.collectedFileIds,c,{absolutePathToMarkdownFile:this.resolveFilepath(l),absolutePathToFernFolder:this.docsWorkspace.absoluteFilePath},this.taskContext);let f={};Object.entries(this.parsedDocsConfig.pages).forEach(([l,m])=>{let O=MtM(this.editThisPage,l),P=this.rawMarkdownFiles[ru.of(l)];f[VDe.PageId(l)]={markdown:m,editThisPageUrl:O?VDe.Url(O):void 0,rawMarkdown:P}});let u=await this.convertDocsConfiguration(o),s={};if(this._parsedDocsConfig.experimental?.mdxComponents!=null){let l=new Set;await Promise.all(this._parsedDocsConfig.experimental.mdxComponents.map(async m=>{let O=p1(this.docsWorkspace.absoluteFilePath,m);(await(0,yUu.stat)(O)).isDirectory()?(await uve(O,"{js,ts,jsx,tsx,md,mdx}")).forEach(I=>{l.add(I)}):O.match(/\.(js|ts|jsx|tsx|md|mdx)$/)!=null&&l.add(O)})),s=Object.fromEntries(await Promise.all([...l].map(async m=>{let O=this.toRelativeFilepath(m),P=(await(0,yUu.readFile)(m)).toString();return[O,P]})))}return{config:u,pages:f,jsFiles:s}}resolveFilepath(t){if(t!=null)return p1(this.docsWorkspace.absoluteFilePath,t)}toRelativeFilepath(t){if(t!=null)return P3(this.docsWorkspace.absoluteFilePath,t)}async getMarkdownFilesToFullSlugs(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,hUu.default)(i).data.slug;typeof o=="string"&&o.trim().length>0&&r.set(this.resolveFilepath(n),o.trim())}return r}async getMarkdownFilesToNoIndex(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,hUu.default)(i).data.noindex;typeof o=="boolean"&&r.set(this.resolveFilepath(n),o)}return r}async getMarkdownFilesToTags(t){let r=new Map;for(let[n,i]of Object.entries(t)){let o=(0,hUu.default)(i).data.tags;typeof o=="string"?r.set(this.resolveFilepath(n),o.split(",").map(c=>c.trim()).filter(c=>c.length>0)):Array.isArray(o)&&r.set(this.resolveFilepath(n),o)}return r}async getMarkdownFilesToFullyQualifiedPathNames(t){let r={},n=fl.migrate.FernNavigationV1ToLatest.create().root(t);return fl.NodeCollector.collect(n).slugMap.forEach((a,o)=>{if(a==null||!fl.isPage(a))return;let c=fl.getPageId(a);if(c==null)return;let f=Ql(this.docsWorkspace.absoluteFilePath,ru.of(c));r[f]=o}),r}getDocsBasePath(){return new URL(Lse(this.domain)).pathname}async convertDocsConfiguration(t){return{aiChatConfig:this.parsedDocsConfig.aiChatConfig!=null?{model:this.parsedDocsConfig.aiChatConfig.model,systemPrompt:this.parsedDocsConfig.aiChatConfig.systemPrompt,location:this.parsedDocsConfig.aiChatConfig.location,datasources:this.parsedDocsConfig.aiChatConfig.datasources?.map(n=>({url:n.url,title:n.title}))}:void 0,hideNavLinks:void 0,title:this.parsedDocsConfig.title,logoHeight:this.parsedDocsConfig.logo?.height,logoHref:this.parsedDocsConfig.logo?.href?VDe.Url(this.parsedDocsConfig.logo?.href):void 0,favicon:this.getFileId(this.parsedDocsConfig.favicon),navigation:void 0,root:t,colorsV3:this.convertColorConfigImageReferences(),navbarLinks:this.parsedDocsConfig.navbarLinks?.map(n=>n.type==="dropdown"?{...n,links:n.links?.map(i=>({...i,url:VDe.Url(i.url),icon:this.resolveIconFileId(i.icon),rightIcon:this.resolveIconFileId(i.rightIcon)})),icon:this.resolveIconFileId(n.icon),rightIcon:this.resolveIconFileId(n.rightIcon)}:n.type==="github"?{...n,url:VDe.Url(n.url)}:{...n,url:VDe.Url(n.url),icon:this.resolveIconFileId(n.icon),rightIcon:this.resolveIconFileId(n.rightIcon)}),typographyV2:this.convertDocsTypographyConfiguration(),layout:this.parsedDocsConfig.layout,settings:this.parsedDocsConfig.settings,css:this.parsedDocsConfig.css,js:this.convertJavascriptConfiguration(),metadata:this.convertMetadata(),redirects:this.parsedDocsConfig.redirects,integrations:this.parsedDocsConfig.integrations,footerLinks:this.parsedDocsConfig.footerLinks?.map(n=>({...n,value:VDe.Url(n.value)})),defaultLanguage:this.parsedDocsConfig.defaultLanguage,languages:this.parsedDocsConfig.languages,analyticsConfig:{...this.parsedDocsConfig.analyticsConfig,segment:this.parsedDocsConfig.analyticsConfig?.segment,fullstory:this.parsedDocsConfig.analyticsConfig?.fullstory,intercom:this.parsedDocsConfig.analyticsConfig?.intercom?{appId:this.parsedDocsConfig.analyticsConfig.intercom.appId,apiBase:this.parsedDocsConfig.analyticsConfig.intercom.apiBase}:void 0,posthog:this.parsedDocsConfig.analyticsConfig?.posthog?{apiKey:this.parsedDocsConfig.analyticsConfig.posthog.apiKey,endpoint:this.parsedDocsConfig.analyticsConfig.posthog.endpoint}:void 0,gtm:this.parsedDocsConfig.analyticsConfig?.gtm?{containerId:this.parsedDocsConfig.analyticsConfig.gtm.containerId}:void 0,ga4:this.parsedDocsConfig.analyticsConfig?.ga4?{measurementId:this.parsedDocsConfig.analyticsConfig.ga4.measurementId}:void 0,amplitude:void 0,mixpanel:void 0,hotjar:void 0,koala:void 0,logrocket:void 0,pirsch:void 0,plausible:void 0,fathom:void 0,clearbit:void 0,heap:void 0},announcement:this.parsedDocsConfig.announcement!=null?{text:this.parsedDocsConfig.announcement.message}:void 0,pageActions:this.parsedDocsConfig.pageActions,theme:this.parsedDocsConfig.theme!=null?{sidebar:this.parsedDocsConfig.theme.sidebar,body:this.parsedDocsConfig.theme.body,tabs:this.parsedDocsConfig.theme.tabs,"page-actions":this.parsedDocsConfig.theme.pageActions}:void 0,logo:void 0,logoV2:void 0,colors:void 0,colorsV2:void 0,typography:void 0,backgroundImage:void 0}}getFernWorkspaceForApiSection(t){if(t.apiName!=null){let n=this.apiWorkspaces.find(i=>i.workspaceName===t.apiName);if(n!=null)return n}else if(this.apiWorkspaces.length===1&&this.apiWorkspaces[0]!=null)return this.apiWorkspaces[0];let r=t.apiName?`Failed to load API Definition '${t.apiName}' referenced in docs`:"Failed to load API Definition referenced in docs";throw new Error(r)}getOpenApiWorkspaceForApiSection(t){if(t.apiName!=null){let n=this.ossWorkspaces.find(i=>i.workspaceName===t.apiName);if(n!=null)return n}else if(this.ossWorkspaces.length===1&&this.ossWorkspaces[0]!=null)return this.ossWorkspaces[0];let r=t.apiName?`Failed to load API Definition '${t.apiName}' referenced in docs`:"Failed to load API Definition referenced in docs";throw new Error(r)}async toRootNode(){let t=fl.V1.SlugGenerator.init(fl.slugjoin(this.getDocsBasePath())),r=this.#e.get("root"),n=await this.toRootChild(t);return{type:"root",version:"v1",id:r,child:n,slug:t.get(),title:this.parsedDocsConfig.title??"Documentation",hidden:!1,icon:void 0,pointsTo:void 0,authed:void 0,viewers:void 0,orphaned:void 0,roles:this.parsedDocsConfig.roles?.map(i=>fl.RoleId(i)),featureFlags:void 0}}async toRootChild(t){return mia(this.parsedDocsConfig.navigation)._visit({untabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),tabbed:r=>this.toUnversionedNode({landingPage:this.parsedDocsConfig.landingPage,navigationConfig:r,parentSlug:t}),versioned:r=>this.toVersionedNode(r,t),productgroup:r=>this.toProductGroupNode({landingPageConfig:this.parsedDocsConfig.landingPage,productGroup:r,parentSlug:t})})}toLandingPageNode(t,r){let n=fl.PageId(this.toRelativeFilepath(t.absolutePath)),i=r.apply({urlSlug:t.slug??u$(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{type:"landingPage",id:this.#e.get(n),title:t.title,slug:i.get(),icon:this.resolveIconFileId(t.icon),hidden:t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:n,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags}}async toUnversionedNode({landingPage:t,navigationConfig:r,parentSlug:n}){let i=this.#e.get("unversioned"),a=t!=null?this.toLandingPageNode(t,n):void 0,o=r.type==="tabbed"?await this.convertTabbedNavigation(i,r.items,n):await this.toSidebarRootNode(i,r.items,n);return{type:"unversioned",id:i,landingPage:a,child:o}}async toVersionedNode(t,r){return{id:this.#e.get("versioned"),type:"versioned",children:await Promise.all(t.versions.map((i,a)=>this.toVersionNode(i,r,a===0)))}}async toProductGroupNode({productGroup:t,landingPageConfig:r,parentSlug:n}){let i=this.#e.get("productgroup"),a=r!=null?this.toLandingPageNode(r,n):void 0;return{id:i,type:"productgroup",landingPage:a,children:await Promise.all(t.products.map(o=>this.toProductNode(o,n)))}}async toProductNode(t,r){if(t.type==="internal"){let n=r.setProductSlug(t.slug??u$(t.product)),i;switch(t.navigation.type){case"tabbed":i={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.convertTabbedNavigation(this.#e.get(t.product),t.navigation.items,n)};break;case"untabbed":i={type:"unversioned",id:this.#e.get(t.product),landingPage:void 0,child:await this.toSidebarRootNode(this.#e.get(t.product),t.navigation.items,n)};break;case"versioned":i=await this.toVersionedNode(t.navigation,n);break;default:ku(t.navigation)}return{type:"product",id:this.#e.get(t.product),productId:fl.V1.ProductId(t.product),title:t.product,subtitle:t.subtitle??"",slug:n.get(),child:i,default:!1,hidden:void 0,authed:void 0,icon:this.resolveIconFileId(t.icon),image:t.image!=null?this.getFileId(t.image):void 0,pointsTo:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags}}else return{type:"productLink",id:this.#e.get(t.product),productId:fl.V1.ProductId(t.product),title:t.product,subtitle:t.subtitle??"",href:VDe.Url(t.href??""),default:!1,hidden:void 0,authed:void 0,icon:this.resolveIconFileId(t.icon),image:t.image!=null?this.getFileId(t.image):void 0,viewers:t.viewers,orphaned:t.orphaned}}async toVersionNode(t,r,n){let i=this.#e.get(t.version),a=r.setVersionSlug(t.slug??u$(t.version)),o=t.navigation.type==="tabbed"?await this.convertTabbedNavigation(i,t.navigation.items,a):await this.toSidebarRootNode(i,t.navigation.items,a);return{type:"version",id:i,versionId:fl.VersionId(t.version),title:t.version,slug:a.get(),child:o,default:n,availability:t.availability!=null?BtM(t.availability):void 0,landingPage:t.landingPage?this.toLandingPageNode(t.landingPage,a):void 0,hidden:void 0,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,icon:void 0,pointsTo:void 0,featureFlags:t.featureFlags}}async toSidebarRootNode(t,r,n){let i=this.#e.get(`${t}/root`),a=await Promise.all(r.map(c=>this.toNavigationChild({prefix:i,item:c,parentSlug:n}))),o=[];return a.forEach(c=>{if(c.type==="apiReference"){o.push(c);return}if(c.type==="section"&&!c.collapsed){o.push(c);return}let f=o.length>0?o[o.length-1]:void 0,u;f?.type==="sidebarGroup"?u=f:(u={id:this.#e.get(`${i}/group`),type:"sidebarGroup",children:[]},o.push(u)),u.children.push(c)}),{type:"sidebarRoot",id:i,children:o}}async toSidebarRootNodeWithVariants(t,r,n){let i=this.#e.get(`${t}/root`);return{type:"sidebarRoot",id:i,children:[{type:"varianted",id:i,children:await Promise.all(r.map(a=>this.toVariantNode(a,i,n)))}]}}async toVariantNode(t,r,n){let i=this.#e.get(`${r}/variant/${t.slug??u$(t.title)}`),a=n.apply({urlSlug:t.slug??u$(t.title),skipUrlSlug:t.skipUrlSlug}),o=await Promise.all(t.layout.map(c=>this.toVariantChild(c,i,a)));return{type:"variant",id:i,variantId:fl.V1.VariantId(t.title),subtitle:t.subtitle??"",default:t.default??!1,image:void 0,children:o,title:t.title,slug:a.get(),icon:this.resolveIconFileId(t.icon),hidden:t.hidden,authed:void 0,viewers:t.viewers,orphaned:t.orphaned,featureFlags:t.featureFlags,pointsTo:void 0}}async toVariantChild(t,r,n){return mia(t)._visit({page:async i=>this.toPageNode({item:i,parentSlug:n}),apiSection:async i=>this.toApiSectionNode({item:i,parentSlug:n}),section:async i=>this.toSectionNode({prefix:r,item:i,parentSlug:n}),link:async i=>this.toLinkNode(i),changelog:async i=>this.toChangelogNode(i,n)})}async toNavigationChild({prefix:t,item:r,parentSlug:n,hideChildren:i,parentAvailability:a}){return mia(r)._visit({page:async o=>this.toPageNode({item:o,parentSlug:n,hideChildren:i,parentAvailability:a}),apiSection:async o=>this.toApiSectionNode({item:o,parentSlug:n,hideChildren:i,parentAvailability:a}),section:async o=>this.toSectionNode({prefix:t,item:o,parentSlug:n,hideChildren:i,parentAvailability:a}),link:async o=>this.toLinkNode(o),changelog:async o=>this.toChangelogNode(o,n,i)})}async toApiSectionNode({item:t,parentSlug:r,hideChildren:n,parentAvailability:i}){let a=UPv(t.snippetsConfiguration),o,c=await this.getFernWorkspaceForApiSection(t).toFernWorkspace({context:this.taskContext},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1,objectQueryParameters:!0,preserveSchemaIds:!0}),f=this.parsedDocsConfig.experimental?.openapiParserV3;if(f==null||f)try{o=await this.getOpenApiWorkspaceForApiSection(t).getIntermediateRepresentation({context:this.taskContext,audiences:t.audiences,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1})}catch{}o==null&&(o=xG({workspace:c,audiences:t.audiences,generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},readme:void 0,version:void 0,packageName:void 0,context:this.taskContext,sourceResolver:new FG(this.taskContext,c)}));let s=await this.registerApi({ir:o,snippetsConfig:a,playgroundConfig:{oauth:t.playground?.oauth},apiName:t.apiName,workspace:c}),l=jns({ir:o,apiDefinitionId:s,playgroundConfig:{oauth:t.playground?.oauth},context:this.taskContext});return new dUu(t,l,r,this.docsWorkspace,this.taskContext,this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,this.#e,this.collectedFileIds,c,n,i??t.availability).get()}async toChangelogNode(t,r,n){return new Tda(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,t.changelog,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:r,title:t.title,icon:this.resolveIconFileId(t.icon),viewers:t.viewers,hidden:n||t.hidden,slug:t.slug})}async toLinkNode(t){return{type:"link",id:this.#e.get(t.url),title:t.text,url:fl.V1.Url(t.url),icon:this.resolveIconFileId(t.icon)}}async toPageNode({item:t,parentSlug:r,hideChildren:n,parentAvailability:i}){let a=fl.PageId(this.toRelativeFilepath(t.absolutePath)),o=r.apply({urlSlug:t.slug??u$(t.title),fullSlug:this.markdownFilesToFullSlugs.get(t.absolutePath)?.split("/")});return{id:this.#e.get(a),type:"page",slug:o.get(),title:t.title,icon:this.resolveIconFileId(t.icon),hidden:n||t.hidden,viewers:t.viewers,orphaned:t.orphaned,pageId:a,authed:void 0,noindex:t.noindex||this.markdownFilesToNoIndex.get(t.absolutePath),featureFlags:t.featureFlags,availability:t.availability??i}}async toSectionNode({prefix:t,item:r,parentSlug:n,hideChildren:i,parentAvailability:a}){let o=this.toRelativeFilepath(r.overviewAbsolutePath),c=o?fl.PageId(o):void 0,f=this.#e.get(c??`${t}/section`),u=n.apply({urlSlug:r.slug??u$(r.title),fullSlug:r.overviewAbsolutePath?this.markdownFilesToFullSlugs.get(r.overviewAbsolutePath)?.split("/"):void 0,skipUrlSlug:r.skipUrlSlug}),s=r.overviewAbsolutePath!=null?this.markdownFilesToNoIndex.get(r.overviewAbsolutePath):void 0,l=i||r.hidden;return{id:f,type:"section",overviewPageId:c,slug:u.get(),title:r.title,icon:this.resolveIconFileId(r.icon),collapsed:r.collapsed,hidden:l,viewers:r.viewers,orphaned:r.orphaned,children:await Promise.all(r.contents.map(m=>this.toNavigationChild({prefix:f,item:m,parentSlug:u,hideChildren:l,parentAvailability:r.availability??a}))),authed:void 0,pointsTo:void 0,noindex:s,featureFlags:r.featureFlags,availability:r.availability??a}}async convertTabbedNavigation(t,r,n){let i=this.#e.get(`${t}/tabbed`);return{type:"tabbed",id:i,children:await Promise.all(r.map(a=>this.toTabChild(i,a,n)))}}async toTabChild(t,r,n){return mia(r.child)._visit({link:({href:i})=>this.toTabLinkNode(r,i),layout:({layout:i})=>this.toTabNode(t,r,i,n),changelog:({changelog:i})=>this.toTabChangelogNode(r,i,n),variants:({variants:i})=>this.toTabNodeWithVariants(t,r,i,n)})}async toTabChangelogNode(t,r,n){return new Tda(this.markdownFilesToFullSlugs,this.markdownFilesToNoIndex,this.markdownFilesToTags,r,this.docsWorkspace,this.#e).toChangelogNode({parentSlug:n,title:t.title,icon:this.resolveIconFileId(t.icon),viewers:t.viewers,hidden:t.hidden,slug:t.slug})}async toTabLinkNode(t,r){return{type:"link",id:this.#e.get(r),title:t.title,url:fl.V1.Url(r),icon:this.resolveIconFileId(t.icon)}}async toTabNode(t,r,n,i){let a=this.#e.get(`${t}/tab`),o=i.apply({urlSlug:r.slug??u$(r.title),skipUrlSlug:r.skipUrlSlug});return{type:"tab",id:a,title:r.title,slug:o.get(),icon:this.resolveIconFileId(r.icon),hidden:r.hidden,authed:void 0,viewers:r.viewers,orphaned:r.orphaned,pointsTo:void 0,child:await this.toSidebarRootNode(a,n,o),featureFlags:r.featureFlags}}async toTabNodeWithVariants(t,r,n,i){let a=this.#e.get(`${t}/tab`),o=i.apply({urlSlug:r.slug??u$(r.title),skipUrlSlug:r.skipUrlSlug});return{type:"tab",id:a,title:r.title,slug:o.get(),icon:this.resolveIconFileId(r.icon),hidden:r.hidden,authed:void 0,viewers:r.viewers,orphaned:r.orphaned,pointsTo:void 0,child:await this.toSidebarRootNodeWithVariants(a,n,o),featureFlags:r.featureFlags}}getFileId(t){if(t==null)return;let r=this.collectedFileIds.get(t);return r==null?this.taskContext.failAndThrow("Failed to locate file after uploading: "+t):VDe.FileId(r)}resolveIconFileId(t){if(t!=null)return this.collectedFileIds.has(t)?`file:${this.getFileId(t)}`:t}convertColorConfigImageReferences(){let{colors:t}=this.parsedDocsConfig;if(t!=null)return t.type==="dark"?{...t,...this.convertLogoAndBackgroundImage({theme:"dark"})}:t.type==="light"?{...t,...this.convertLogoAndBackgroundImage({theme:"light"}),type:"light"}:{...t,dark:{...t.dark,...this.convertLogoAndBackgroundImage({theme:"dark"})},light:{...t.light,...this.convertLogoAndBackgroundImage({theme:"light"})}}}convertLogoAndBackgroundImage({theme:t}){let{logo:r,backgroundImage:n}=this.parsedDocsConfig,i=r?.[t],a=n?.[t];return{logo:this.getFileId(i),backgroundImage:this.getFileId(a)}}convertDocsTypographyConfiguration(){if(this.parsedDocsConfig.typography!=null)return{headingsFont:this.convertFont(this.parsedDocsConfig.typography.headingsFont,"headings"),bodyFont:this.convertFont(this.parsedDocsConfig.typography.bodyFont,"body"),codeFont:this.convertFont(this.parsedDocsConfig.typography.codeFont,"code")}}convertFont(t,r){if(t==null||t.variants[0]==null)return;let n=this.getFileId(t.variants[0].absolutePath);return{type:"custom",name:t.name??`font:${r}:${n}`,variants:t.variants.map(i=>({fontFile:this.getFileId(i.absolutePath),weight:i.weight,style:i.style!=null?[i.style]:void 0})),display:t.display,fallback:t.fallback,fontVariationSettings:t.fontVariationSettings}}convertJavascriptConfiguration(){if(this.parsedDocsConfig.js!=null)return{files:this.parsedDocsConfig.js.files.map(({absolutePath:t,strategy:r})=>({fileId:this.getFileId(t),strategy:r})).filter(hj),remote:this.parsedDocsConfig.js.remote?.map(t=>({...t,url:VDe.Url(t.url)})),inline:void 0}}convertMetadata(){if(this.parsedDocsConfig.metadata==null)return;let{"og:image":t,"og:logo":r,"twitter:image":n,...i}=this.parsedDocsConfig.metadata;return{...i,"og:image":this.convertFileIdOrUrl(t),"og:logo":this.convertFileIdOrUrl(r),"twitter:image":this.convertFileIdOrUrl(n)}}convertFileIdOrUrl(t){if(t!=null)return mia(t,"type")._visit({filepath:({value:r})=>({type:"fileId",value:this.getFileId(r)}),url:({value:r})=>({type:"url",value:VDe.Url(r)}),_other:()=>this.taskContext.failAndThrow("Invalid metadata configuration")})}};function MtM(e,t){if(e?.github==null)return;let{owner:r,repo:n,branch:i="main",host:a="https://github.com"}=e.github;return`${Lse(a)}/${r}/${n}/blob/${i}/fern/${t}?plain=1`}function BtM(e){switch(e){case"beta":return fl.V1.NavigationV1Availability.Beta;case"deprecated":return fl.V1.NavigationV1Availability.Deprecated;case"ga":return fl.V1.NavigationV1Availability.GenerallyAvailable;case"stable":return fl.V1.NavigationV1Availability.Stable;default:ku(e)}}async function pbe(e){return(await Promise.all(e.apiWorkspaces.map(async t=>t instanceof S$?t:null))).filter(hj)}async function KUf(e,t,r){if(e instanceof kVr){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof S$))return;let n=await e.getIntermediateRepresentation({context:t,audiences:r,enableUniqueErrorsPerEndpoint:!0,generateV1Examples:!1});return UCe({ir:n,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0,phpSdk:void 0,swiftSdk:void 0,rustSdk:void 0},playgroundConfig:{oauth:!0},context:t})}var Yj={};yf(Yj,{AlgoliaSearchIndex:()=>nwv,ApiDefinitionId:()=>wwv,ApiId:()=>Dwv,Availability:()=>Vwv,DocsConfigId:()=>Cwv,EndpointId:()=>Mwv,EndpointPathLiteral:()=>Lwv,EnvironmentId:()=>Iwv,FileId:()=>Nwv,HttpMethod:()=>Uwv,IndexSegmentId:()=>iwv,JqString:()=>xwv,OrgId:()=>Ewv,PageId:()=>Rwv,PayloadLocation:()=>yjv,PropertyKey:()=>zwv,PullRequestState:()=>fjv,RoleId:()=>Qwv,TokenId:()=>Swv,TypeId:()=>qwv,Url:()=>Fwv,VersionId:()=>jwv,WebSocketId:()=>Bwv,WebhookId:()=>Twv,algolia:()=>$Uf,api:()=>aVf,commons:()=>oVf,diff:()=>Wwv,docs:()=>hVf,generators:()=>vVf,git:()=>bVf,navigation:()=>OVf,sdks:()=>PVf,snippets:()=>_jv,snippetsFactory:()=>hjv,templates:()=>wVf,tokens:()=>vjv});var $Uf={};yf($Uf,{AlgoliaSearchIndex:()=>nwv,IndexSegmentId:()=>iwv});function nwv(e){return e}function iwv(e){return e}var aVf={};yf(aVf,{latest:()=>ZUf,v1:()=>iVf});var ZUf={};yf(ZUf,{AuthSchemeId:()=>awv,WebhookHttpMethod:()=>cwv,auth:()=>YUf,commons:()=>owv,endpoint:()=>swv,type_:()=>uwv,webhook:()=>XUf,websocket:()=>lwv});var YUf={};yf(YUf,{AuthSchemeId:()=>awv});function awv(e){return e}var owv={};var swv={};var uwv={};var XUf={};yf(XUf,{WebhookHttpMethod:()=>cwv});var cwv={Get:"GET",Post:"POST"};var lwv={};var iVf={};yf(iVf,{SubpackageId:()=>mwv,WebSocketMessageId:()=>Owv,WebSocketMessageOrigin:()=>Awv,WebhookHttpMethod:()=>Pwv,commons:()=>nVf,db:()=>kUf,read:()=>tVf,register:()=>rVf});var kUf={};yf(kUf,{endpoint:()=>fwv});var fwv={};var tVf={};yf(tVf,{SupportedLanguage:()=>dwv,endpoint:()=>eVf,type_:()=>pwv,webhook:()=>_wv,websocket:()=>hwv});var eVf={};yf(eVf,{SupportedLanguage:()=>dwv});var dwv={Curl:"curl",Python:"python",Javascript:"javascript",Js:"js",Node:"node",Typescript:"typescript",Ts:"ts",Go:"go",Ruby:"ruby",Csharp:"csharp"};var pwv={};var _wv={};var hwv={};var rVf={};yf(rVf,{SourceId:()=>TtM,endpoint:()=>ywv,type_:()=>vwv,webhook:()=>bwv,websocket:()=>gwv});var ywv={};var vwv={};var bwv={};var gwv={};function TtM(e){return e}var nVf={};yf(nVf,{SubpackageId:()=>mwv,WebSocketMessageId:()=>Owv,WebSocketMessageOrigin:()=>Awv,WebhookHttpMethod:()=>Pwv});function mwv(e){return e}function Owv(e){return e}var Awv={Client:"client",Server:"server"};var Pwv={Get:"GET",Post:"POST"};var oVf={};yf(oVf,{ApiDefinitionId:()=>wwv,ApiId:()=>Dwv,Availability:()=>Vwv,DocsConfigId:()=>Cwv,EndpointId:()=>Mwv,EndpointPathLiteral:()=>Lwv,EnvironmentId:()=>Iwv,FileId:()=>Nwv,HttpMethod:()=>Uwv,JqString:()=>xwv,OrgId:()=>Ewv,PageId:()=>Rwv,PropertyKey:()=>zwv,RoleId:()=>Qwv,TokenId:()=>Swv,TypeId:()=>qwv,Url:()=>Fwv,VersionId:()=>jwv,WebSocketId:()=>Bwv,WebhookId:()=>Twv});function wwv(e){return e}function jwv(e){return e}function Ewv(e){return e}function Swv(e){return e}function Dwv(e){return e}function Cwv(e){return e}function Iwv(e){return e}function Mwv(e){return e}function Bwv(e){return e}function Twv(e){return e}function qwv(e){return e}function Rwv(e){return e}function Nwv(e){return e}function Fwv(e){return e}function xwv(e){return e}function zwv(e){return e}function Qwv(e){return e}function Lwv(e){return e}var Uwv={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE"};var Vwv={Stable:"Stable",GenerallyAvailable:"GenerallyAvailable",InDevelopment:"InDevelopment",PreRelease:"PreRelease",Deprecated:"Deprecated",Beta:"Beta"};var Wwv={};var hVf={};yf(hVf,{latest:()=>cVf,v1:()=>pVf,v2:()=>_Vf});var cVf={};yf(cVf,{Layout:()=>Hwv,MdxEngine:()=>qtM,TwitterCardSetting:()=>Jwv,commons:()=>Gwv,frontmatter:()=>sVf,seo:()=>uVf});var qtM={NextMdxRemote:"next-mdx-remote",MdxBundler:"mdx-bundler"};var Gwv={};var sVf={};yf(sVf,{Layout:()=>Hwv});var Hwv={Guide:"guide",Overview:"overview",Reference:"reference",Page:"page",Custom:"custom"};var uVf={};yf(uVf,{TwitterCardSetting:()=>Jwv});var Jwv={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var pVf={};yf(pVf,{commons:()=>dVf,db:()=>Kwv,read:()=>$wv,write:()=>lVf});var Kwv={};var $wv={};var lVf={};yf(lVf,{DocsRegistrationId:()=>NtM,FilePath:()=>RtM});function RtM(e){return e}function NtM(e){return e}var dVf={};yf(dVf,{ContentAlignment:()=>kwv,FontDisplay:()=>ijv,FontStyle:()=>njv,HeaderPosition:()=>ejv,JsScriptStrategy:()=>rjv,ProgrammingLanguage:()=>Ywv,SearchbarPlacement:()=>Xwv,TabsPlacement:()=>Zwv,TwitterCardSetting:()=>tjv,commons:()=>fVf});var fVf={};yf(fVf,{ContentAlignment:()=>kwv,FontDisplay:()=>ijv,FontStyle:()=>njv,HeaderPosition:()=>ejv,JsScriptStrategy:()=>rjv,ProgrammingLanguage:()=>Ywv,SearchbarPlacement:()=>Xwv,TabsPlacement:()=>Zwv,TwitterCardSetting:()=>tjv});var Ywv={Typescript:"typescript",Javascript:"javascript",Python:"python",Java:"java",Go:"go",Ruby:"ruby",Csharp:"csharp",Nodets:"nodets",Nodejs:"nodejs",Dotnet:"dotnet",Curl:"curl",Jvm:"jvm",Ts:"ts",Js:"js"};var Xwv={Header:"HEADER",HeaderTabs:"HEADER_TABS",Sidebar:"SIDEBAR"};var Zwv={Header:"HEADER",Sidebar:"SIDEBAR"};var kwv={Center:"CENTER",Left:"LEFT"};var ejv={Fixed:"FIXED",Absolute:"ABSOLUTE"};var tjv={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var rjv={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var njv={Normal:"normal",Italic:"italic"};var ijv={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var _Vf={};yf(_Vf,{read:()=>ajv,write:()=>ojv});var ajv={};var ojv={};var vVf={};yf(vVf,{ChangelogEntryType:()=>ujv,GeneratorId:()=>FtM,GeneratorLanguage:()=>xtM,ReleaseType:()=>cjv,cli:()=>sjv,commons:()=>yVf,versions:()=>ljv});var sjv={};var yVf={};yf(yVf,{ChangelogEntryType:()=>ujv,ReleaseType:()=>cjv});var ujv={Fix:"fix",Feat:"feat",Chore:"chore",Break:"break",Internal:"internal"};var cjv={Ga:"GA",Rc:"RC"};var ljv={};function FtM(e){return e}var xtM={Python:"python",Go:"go",Java:"java",Typescript:"typescript",Ruby:"ruby",Csharp:"csharp",Php:"php",Swift:"swift",Rust:"rust"};var bVf={};yf(bVf,{PullRequestState:()=>fjv});var fjv={Open:"open",Closed:"closed",Merged:"merged"};var OVf={};yf(OVf,{latest:()=>gVf,v1:()=>mVf});var gVf={};yf(gVf,{NodeId:()=>LtM,ProductId:()=>UtM,Slug:()=>ztM,TabId:()=>QtM});function ztM(e){return e}function QtM(e){return e}function LtM(e){return e}function UtM(e){return e}var mVf={};yf(mVf,{NavigationV1Availability:()=>JtM,NodeId:()=>GtM,ProductId:()=>HtM,Slug:()=>VtM,TabId:()=>WtM});function VtM(e){return e}function WtM(e){return e}function GtM(e){return e}function HtM(e){return e}var JtM={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Beta:"beta",Deprecated:"deprecated"};var PVf={};yf(PVf,{Language:()=>djv,VersionBump:()=>pjv,versions:()=>AVf});var AVf={};yf(AVf,{Language:()=>djv,VersionBump:()=>pjv});var djv={Go:"Go",TypeScript:"TypeScript",Java:"Java",Python:"Python",Csharp:"Csharp",Ruby:"Ruby"};var pjv={Major:"MAJOR",Minor:"MINOR",Patch:"PATCH"};var _jv={};var hjv={};var wVf={};yf(wVf,{PayloadLocation:()=>yjv});var yjv={Body:"BODY",Query:"QUERY",Path:"PATH",Headers:"HEADERS",Relative:"RELATIVE",Auth:"AUTH"};var vjv={};var vUu=class{warnings=[];errors=[];error(t){this.errors.push(t)}warning(t){this.warnings.push(t)}};function mA(e){return e!=null}var gjv=$i(GLo(),1);var bjv=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];function yWr(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,gjv.default)(e,{special:bjv}).replace(/V\s(\d)/g,"V$1")}function mjv({endpoints:e,webhookEndpoints:t}){let r={};return Object.values({...e,...t}).forEach(n=>{let i=[];n.namespace?.forEach(a=>{let o=[...i,a],c=Yj.api.v1.SubpackageId(o.join("."));r[c]={id:c,name:a,displayName:yWr(a)},i.push(a)})}),r}var bUu=class{input;context;constructor(t,r){this.input=t,this.context=r}errors(){return this.context.errors.errors}warnings(){return this.context.errors.warnings}};function Ojv(e){return`#/${e.map(t=>t.replaceAll(/~/g,"~0").replaceAll(/\//g,"~1")).join("/")}`}var LO=class extends bUu{context;accessPath;pathId;constructor({input:t,context:r,accessPath:n,pathId:i}){if(super(t,r),this.context=r,this.accessPath=[...n],this.pathId=i,i!=null){let a=Array.isArray(this.pathId)?this.pathId:[this.pathId];a.every((o,c)=>o===this.accessPath[this.accessPath.length-a.length+c])||this.accessPath.push(...a)}r.logger.debug(`Processing ${Ojv(this.accessPath)}`)}safeParse(...t){try{this.parse(...t)}catch{this.context.errors.error({message:"Error converting node. Please contact support if the error persists",path:this.accessPath})}}},Tee=class extends LO{},Xxe=class extends Tee{seenSchemas;constructor(t){super(t),this.seenSchemas=new Set(t.seenSchemas)}};var Ajv="x-fern-base-path",Pjv="x-fern-availability",gUu="x-fern-sdk-group-name",wjv="x-fern-global-headers",jjv="x-fern-sdk-method-name";var Ejv="x-fern-webhook",Sjv="x-fern-access-token-locator",Djv="x-fern-basic",Cjv="x-fern-username-variable-name",Ijv="x-fern-password-variable-name",Mjv="x-fern-bearer",Bjv="x-fern-token-variable-name",Tjv="x-fern-header",qjv="x-fern-header-variable-name",Rjv="x-fern-server-name",Njv="x-fern-examples";var mUu=class extends LO{serverName;constructor(t){super(t),this.safeParse()}parse(){this.serverName=this.input[Rjv]}convert(){if(this.serverName!=null)return this.serverName}};var OUu=class extends LO{url;serverName;constructor(t){super(t),this.safeParse()}parse(){this.url=Object.entries(this.input.variables??{}).reduce((t,[r,n])=>t.replace(`{${r}}`,n.default),this.input.url)??this.input.url,this.serverName=new mUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.serverName?.convert()??this.url;if(!(this.url==null||t==null))return{id:Yj.EnvironmentId(t),baseUrl:this.url}}};function K8i(e,t,r,n){let i=e??[],a=new Set(i.map(c=>c.url)),o=(t??[]).filter(c=>!a.has(c.url)).map((c,f)=>new OUu({input:c,context:r,accessPath:n,pathId:["servers",`${f}`]}));return[...i,...o]}function xx(e){return typeof e=="object"&&mA(e)&&"$ref"in e&&typeof e.$ref=="string"}function _be(e,t,r){let n=e.$ref.substring(2).split("/").map(a=>a.replace(/~1/g,"/")),i=t;for(let a of n){if(typeof i!="object"||i==null)return r;i=i[a]}return i==null?r:(xx(i)&&(i=_be(i,t,r)),i)}function AUu(e,t){let r=t.components?.securitySchemes?.[e];if(r!=null)return xx(r)?_be(r,t,void 0):r}var D1v=$i(PJ());var PUu=class extends LO{username;password;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[Djv];this.username=t?.username,this.password=t?.password}convert(){return{username:this.username,password:this.password}}};var wUu=class extends LO{passwordVariableName;constructor(t){super(t),this.safeParse()}parse(){this.passwordVariableName=this.input[Ijv]}convert(){return this.passwordVariableName}};var jUu=class extends LO{usernameVariableName;constructor(t){super(t),this.safeParse()}parse(){this.usernameVariableName=this.input[Cjv]}convert(){return this.usernameVariableName}};var EUu=class extends LO{bearerTokenVariableName;bearerTokenEnvVar;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[Mjv];this.bearerTokenVariableName=t?.name,this.bearerTokenEnvVar=t?.env}convert(){return{tokenVariableName:this.bearerTokenVariableName,tokenEnvVar:this.bearerTokenEnvVar}}};var SUu=class extends LO{tokenVariableName;constructor(t){super(t),this.safeParse()}parse(){this.tokenVariableName=this.input[Bjv]}convert(){return this.tokenVariableName}};function Fjv(e){return typeof e=="object"&&e!=null&&"in"in e&&e.in==="header"}var xjv="x-bearer-format",zjv="x-code-samples",Qjv="x-codeSamples";var DUu=class extends LO{bearerFormat;constructor(t){super(t),this.safeParse()}parse(){this.bearerFormat=this.input[xjv]}convert(){return this.bearerFormat}};var CUu=class extends LO{headerVariableName;headerEnvVar;headerPrefix;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[Tjv];this.headerVariableName=t?.name,this.headerEnvVar=t?.env,this.headerPrefix=t?.prefix}convert(){return{name:this.headerVariableName,env:this.headerEnvVar,prefix:this.headerPrefix}}};var IUu=class extends LO{headerVariableName;constructor(t){super(t),this.safeParse()}parse(){this.headerVariableName=this.input[qjv]}convert(){return this.headerVariableName}};function Ljv(e){return e.type==="apiKey"}var boo=class extends LO{headerName;headerBearerFormatNode;headerAuthNode;headerVariableNameNode;constructor(t){super(t),this.safeParse()}parse(){Ljv(this.input)&&(this.headerName=this.input.name),this.headerAuthNode=new CUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerVariableNameNode=new IUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.headerBearerFormatNode=new DUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})}convert(){let t=this.headerAuthNode?.convert();if(t!=null)return{type:"header",nameOverride:t?.name,headerWireValue:this.headerName??"Authorization",prefix:t?.prefix??this.headerBearerFormatNode?.convert()}}};function MUu(e){return e}function BUu(e){return e==="__proto__"}function TUu(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function qUu(e){return typeof e=="string"||typeof e=="symbol"?e:Object.is(e?.valueOf?.(),-0)?"-0":String(e)}function RUu(e){let t=[],r=e.length;if(r===0)return t;let n=0,i="",a="",o=!1;for(e.charCodeAt(0)===46&&(t.push(""),n++);n<r;){let c=e[n];a?c==="\\"&&n+1<r?(n++,i+=e[n]):c===a?a="":i+=c:o?c==='"'||c==="'"?a=c:c==="]"?(o=!1,t.push(i),i=""):i+=c:c==="["?(o=!0,i&&(t.push(i),i="")):c==="."?i&&(t.push(i),i=""):i+=c,n++}return i&&t.push(i),t}function Ens(e,t,r){if(e==null)return r;switch(typeof t){case"string":{if(BUu(t))return r;let n=e[t];return n===void 0?TUu(t)?Ens(e,RUu(t),r):r:n}case"number":case"symbol":{typeof t=="number"&&(t=qUu(t));let n=e[t];return n===void 0?r:n}default:{if(Array.isArray(t))return KtM(e,t,r);if(Object.is(t?.valueOf(),-0)?t="-0":t=String(t),BUu(t))return r;let n=e[t];return n===void 0?r:n}}}function KtM(e,t,r){if(t.length===0)return r;let n=e;for(let i=0;i<t.length;i++){if(n==null||BUu(t[i]))return r;n=n[t[i]]}return n===void 0?r:n}function Ujv(e){return function(t){return Ens(t,e)}}function Vjv(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function NUu(e){return e==null||typeof e!="object"&&typeof e!="function"}function jVf(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function Wjv(e,t,r){return typeof r!="function"?goo(e,t):EVf(e,t,function n(i,a,o,c,f,u){let s=r(i,a,o,c,f,u);return s!==void 0?!!s:EVf(i,a,n,u)},new Map)}function EVf(e,t,r,n){if(t===e)return!0;switch(typeof t){case"object":return $tM(e,t,r,n);case"function":return Object.keys(t).length>0?EVf(e,{...t},r,n):jVf(e,t);default:return Vjv(e)?typeof t=="string"?t==="":!0:jVf(e,t)}}function $tM(e,t,r,n){if(t==null)return!0;if(Array.isArray(t))return Gjv(e,t,r,n);if(t instanceof Map)return YtM(e,t,r,n);if(t instanceof Set)return XtM(e,t,r,n);let i=Object.keys(t);if(e==null)return i.length===0;if(i.length===0)return!0;if(n&&n.has(t))return n.get(t)===e;n&&n.set(t,e);try{for(let a=0;a<i.length;a++){let o=i[a];if(!NUu(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!r(e[o],t[o],o,e,t,n))return!1}return!0}finally{n&&n.delete(t)}}function YtM(e,t,r,n){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries()){let o=e.get(i);if(r(o,a,i,e,t,n)===!1)return!1}return!0}function Gjv(e,t,r,n){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],c=!1;for(let f=0;f<e.length;f++){if(i.has(f))continue;let u=e[f],s=!1;if(r(u,o,a,e,t,n)&&(s=!0),s){i.add(f),c=!0;break}}if(!c)return!1}return!0}function XtM(e,t,r,n){return t.size===0?!0:e instanceof Set?Gjv([...e],[...t],r,n):!1}function goo(e,t){return Wjv(e,t,()=>{})}function Hjv(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function FUu(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var Jjv="[object RegExp]",xUu="[object String]",zUu="[object Number]",QUu="[object Boolean]",LUu="[object Arguments]",Kjv="[object Symbol]",$jv="[object Date]",Yjv="[object Map]",Xjv="[object Set]",Zjv="[object Array]";var kjv="[object ArrayBuffer]",e1v="[object Object]";var t1v="[object DataView]",r1v="[object Uint8Array]",n1v="[object Uint8ClampedArray]",i1v="[object Uint16Array]",a1v="[object Uint32Array]";var o1v="[object Int8Array]",s1v="[object Int16Array]",u1v="[object Int32Array]";var c1v="[object Float32Array]",l1v="[object Float64Array]";function f1v(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function d1v(e,t){return Y8i(e,void 0,e,new Map,t)}function Y8i(e,t,r,n=new Map,i=void 0){let a=i?.(e,t,r,n);if(a!==void 0)return a;if(NUu(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){let o=new Array(e.length);n.set(e,o);for(let c=0;c<e.length;c++)o[c]=Y8i(e[c],c,r,n,i);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){let o=new Map;n.set(e,o);for(let[c,f]of e)o.set(c,Y8i(f,c,r,n,i));return o}if(e instanceof Set){let o=new Set;n.set(e,o);for(let c of e)o.add(Y8i(c,void 0,r,n,i));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(e))return e.subarray();if(f1v(e)){let o=new(Object.getPrototypeOf(e)).constructor(e.length);n.set(e,o);for(let c=0;c<e.length;c++)o[c]=Y8i(e[c],c,r,n,i);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return n.set(e,o),$8i(o,e,r,n,i),o}if(typeof File<"u"&&e instanceof File){let o=new File([e],e.name,{type:e.type});return n.set(e,o),$8i(o,e,r,n,i),o}if(e instanceof Blob){let o=new Blob([e],{type:e.type});return n.set(e,o),$8i(o,e,r,n,i),o}if(e instanceof Error){let o=new e.constructor;return n.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,$8i(o,e,r,n,i),o}if(typeof e=="object"&&ZtM(e)){let o=Object.create(Object.getPrototypeOf(e));return n.set(e,o),$8i(o,e,r,n,i),o}return e}function $8i(e,t,r=e,n,i){let a=[...Object.keys(t),...Hjv(t)];for(let o=0;o<a.length;o++){let c=a[o],f=Object.getOwnPropertyDescriptor(e,c);(f==null||f.writable)&&(e[c]=Y8i(t[c],c,r,n,i))}}function ZtM(e){switch(FUu(e)){case LUu:case Zjv:case kjv:case t1v:case QUu:case $jv:case c1v:case l1v:case o1v:case s1v:case u1v:case Yjv:case zUu:case e1v:case Jjv:case Xjv:case xUu:case Kjv:case r1v:case n1v:case i1v:case a1v:return!0;default:return!1}}function p1v(e){return Y8i(e,void 0,e,new Map,void 0)}function _1v(e){return e=p1v(e),t=>goo(t,e)}function h1v(e,t){return d1v(e,(r,n,i,a)=>{let o=t?.(r,n,i,a);if(o!==void 0)return o;if(typeof e=="object")switch(Object.prototype.toString.call(e)){case zUu:case xUu:case QUu:{let c=new e.constructor(e?.valueOf());return $8i(c,e),c}case LUu:{let c={};return $8i(c,e),c.length=e.length,c[Symbol.iterator]=e[Symbol.iterator],c}default:return}})}function y1v(e){return h1v(e)}var ktM=/^(?:0|[1-9]\d*)$/;function v1v(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return ktM.test(e)}}function b1v(e){return e!==null&&typeof e=="object"&&FUu(e)==="[object Arguments]"}function g1v(e,t){let r;if(Array.isArray(t)?r=t:typeof t=="string"&&TUu(t)&&e?.[t]==null?r=RUu(t):r=[t],r.length===0)return!1;let n=e;for(let i=0;i<r.length;i++){let a=r[i];if((n==null||!Object.hasOwn(n,a))&&!((Array.isArray(n)||b1v(n))&&v1v(a)&&a<n.length))return!1;n=n[a]}return!0}function m1v(e,t){switch(typeof e){case"object":{Object.is(e?.valueOf(),-0)&&(e="-0");break}case"number":{e=qUu(e);break}}return t=y1v(t),function(r){let n=Ens(r,e);return n===void 0?g1v(r,e):t===void 0?n===void 0:goo(n,t)}}function O1v(e){if(e==null)return MUu;switch(typeof e){case"function":return e;case"object":return Array.isArray(e)&&e.length===2?m1v(e[0],e[1]):_1v(e);case"string":case"symbol":case"number":return Ujv(e)}}function SVf(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(SVf).join(",");let t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function A1v(e,t){let r={},n=Object.keys(e);for(let i=0;i<n.length;i++){let a=n[i],o=e[a];r[a]=t(o,a,e)}return r}function UUu(e,t=MUu){return e==null?{}:A1v(e,O1v(t))}function P1v(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}var erM=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function w1v(e){return Array.from(e.match(erM)??[])}function j1v(e){let t=w1v(e);if(t.length===0)return"";let[r,...n]=t;return`${r.toLowerCase()}${n.map(i=>P1v(i)).join("")}`}function E1v(e){return typeof e!="string"&&(e=SVf(e)),e.replace(/['\u2019]/g,"")}function $qr(e){return j1v(E1v(e))}function TQ(e){if(e!=null)return Array.isArray(e)?e:[e]}function VUu({namespace:e,path:t,method:r,sdkMethodName:n,operationId:i,displayName:a,isWebhook:o}){if(t==null)return;let c=r!=null&&t!=null?`${r}_${t.split("/").join("_")}`:r??t.split("/").join("_");if(!(n==null&&i==null&&a==null&&c==null))return`${trM(o)}${rrM(e)}.${nrM(n,i,a,c)}`}function trM(e){return e?"webhook_":"endpoint_"}function rrM(e){return e!=null?TQ(e)?.map(t=>$qr(t)).join("/"):""}function nrM(e,t,r,n){return e||t||$qr(r??"")||$qr(n??"")}function S1v(e){return e.length===0?!1:/^\$?(\.[\w*]+|\[['"][\w*]+['"]?\]|\[['"]?[\d*]+['"]?\]|\[[\d:]+\])*$/.test(e)}var WUu=class extends LO{accessTokenLocator;constructor(t){super(t),this.safeParse()}parse(){this.accessTokenLocator=this.input[Sjv],this.accessTokenLocator!=null&&(S1v(this.accessTokenLocator)||(this.context.errors.error({message:"Invalid access token locator, must be a valid jq path",path:this.accessPath}),this.accessTokenLocator=void 0))}convert(){return this.accessTokenLocator}};var GUu=class extends LO{authorizationUrl;headerAuthNode;accessTokenLocatorNode;constructor(t){super(t),this.safeParse()}parse(){if(this.input.flows.clientCredentials!=null){let t=this.input.flows.clientCredentials;this.authorizationUrl=t.tokenUrl,this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.headerAuthNode=new boo({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.accessTokenLocatorNode=new WUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.authorizationUrl==null&&this.context.errors.error({message:"Expected 'tokenUrl' property to be specified",path:this.accessPath}),this.accessTokenLocatorNode?.accessTokenLocator==null&&this.context.errors.error({message:"Expected 'x-fern-access-token-locator' property to be specified",path:this.accessPath})}}convert(){let t=this.accessTokenLocatorNode?.convert();if(t==null||this.authorizationUrl==null)return{type:"bearerAuth",tokenName:void 0};let r=VUu({namespace:void 0,path:this.authorizationUrl,method:"POST",sdkMethodName:void 0,operationId:void 0,displayName:void 0,isWebhook:void 0});if(r!=null)return{type:"oAuth",value:{type:"clientCredentials",value:{type:"referencedEndpoint",endpointId:Yj.EndpointId(r),accessTokenLocator:Yj.JqString(t),headerName:this.headerAuthNode?.convert()?.headerWireValue,tokenPrefix:this.headerAuthNode?.convert()?.prefix}}}}};var moo=class extends LO{authScheme;headerAuthNode;bearerTokenNode;bearerTokenVariableNameNode;basicAuthNode;basicUsernameVariableNameNode;basicPasswordVariableNameNode;oauth2Node;constructor(t){super(t),this.safeParse()}parse(){switch(this.input.type){case"http":switch(this.input.scheme){case"basic":{this.authScheme="basic",this.basicAuthNode=new PUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicUsernameVariableNameNode=new jUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.basicPasswordVariableNameNode=new wUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),(this.basicAuthNode==null||this.basicAuthNode.username==null&&this.basicUsernameVariableNameNode?.usernameVariableName==null||this.basicAuthNode.password==null&&this.basicPasswordVariableNameNode?.passwordVariableName==null)&&this.context.errors.warning({message:"Basic auth should specify either a username or a username variable name",path:this.accessPath});break}case"bearer":{this.authScheme="bearer",this.bearerTokenNode=new EUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),this.bearerTokenVariableNameNode=new SUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}default:{this.context.errors.warning({message:`Unsupported HTTP auth scheme: ${this.input.scheme}`,path:this.accessPath});break}}break;case"apiKey":{Fjv(this.input)?(this.authScheme="header",this.headerAuthNode=new boo({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId})):this.context.errors.error({message:`Unsupported API key location: ${this.input.in}`,path:this.accessPath});break}case"oauth2":{this.authScheme="oauth",this.oauth2Node=new GUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});break}case"openIdConnect":{this.authScheme="bearer";break}}}convert(){switch(this.authScheme){case"basic":{let t=this.basicAuthNode?.convert();return{type:"basicAuth",usernameName:t?.username?.name??this.basicUsernameVariableNameNode?.convert(),passwordName:t?.password?.name??this.basicPasswordVariableNameNode?.convert()}}case"bearer":return{type:"bearerAuth",tokenName:this.bearerTokenNode?.convert()?.tokenVariableName??this.bearerTokenVariableNameNode?.convert()};case"header":return this.headerAuthNode?.convert();case"oauth":return this.oauth2Node?.convert();case void 0:return;default:new D1v.UnreachableCaseError(this.authScheme);return}}};var Ooo=class extends LO{authNodesMap;constructor(t){super(t),this.safeParse()}parse(){this.input.map((t,r)=>Object.keys(t).map(n=>{let i=AUu(n,this.context.document);if(i==null){this.context.errors.warning({message:`No auth scheme found for ${n}. Inline security schemes are not supported.`,path:this.accessPath});return}let a=new moo({input:i,context:this.context,accessPath:this.accessPath,pathId:["security",`${r}`]});a.convert()!=null?(this.authNodesMap??={},this.authNodesMap[n]=a):this.context.errors.warning({message:`No auth scheme found for ${n}`,path:this.accessPath})}))}convert(){return Object.fromEntries(Object.entries(this.authNodesMap??{}).map(([t,r])=>{let n=r.convert();if(n!=null)return[t,n]}).filter(mA))}};var HUu=class extends LO{basePath;constructor(t){super(t),this.safeParse()}parse(){this.basePath=this.input[Ajv],this.basePath!=null?(this.basePath.startsWith("/")&&(this.basePath=this.basePath.slice(1)),this.basePath.endsWith("/")&&(this.basePath=this.basePath.slice(0,-1))):this.basePath=void 0}convert(){return this.basePath}};function C1v(e){return"required"in e&&typeof e.required=="boolean"?e.required:!1}function I1v(e,t){return{type:"alias",value:{type:"optional",shape:e,default:t}}}function Aoo(e,t){return e==null?void 0:Object.entries(e).map(([n,i])=>TQ(i.convert())?.map(o=>((t!=null&&!t.includes(n)||t==null&&!C1v(i))&&(o=I1v(o,o.type==="enum"?o.default:void 0)),{key:Yj.PropertyKey(n),valueShape:o,description:i.description,availability:i.availability?.convert()})).filter(mA)).filter(mA).reduce((n,i)=>n.flatMap(a=>i.length>0?i.map(o=>[...a,o]):[[...a]]),[[]])}function JUu(e,t){return xx(e)?_be(e,t,void 0):e}function X8i(e,t){return e!=null&&e!==""?e:t!=null&&t!==""?t:void 0}function M1v(e,t){let r={...e};for(let[n,i]of Object.entries(t??{}))r[n]=[...r[n]??[],...i];return Object.keys(r).length>0?r:void 0}function B1v(e,t){if(e==null)return t;if(t==null)return e;let r=[];for(let n of e)for(let i of t)r.push({path:n.path??i.path,responseStatusCode:n.responseStatusCode??i.responseStatusCode,name:n.name??i.name,description:n.description??i.description,pathParameters:n.pathParameters??i.pathParameters,queryParameters:n.queryParameters??i.queryParameters,headers:n.headers??i.headers,requestBody:n.requestBody??i.requestBody,responseBody:n.responseBody??i.responseBody,snippets:{...i.snippets,...n.snippets}});return r}var T1v=$i(PJ());var DVf=["decimal","decimal128","double-int","double","float","sf-decimal"],CVf=["int16","int32","int64","int8","sf-integer","uint8"],IVf=["base64url","binary","byte","char","commonmark","date-time","date","decimal","decimal128","duration","email","hostname","html","http-date","idn-email","idn-hostname","int64","ipv4","ipv6","iri-reference","iri","json-pointer","media-range","password","regex","relative-json-pointer","sf-binary","sf-boolean","sf-string","sf-token","time","uri-reference","uri-template","uri","uuid"],MVf=["beta","pre-release","in-development","generally-available","deprecated"];function qee(e,t){return xx(e)?_be(e,t,{type:"unknown","x-fern-type":"unknown",additionalProperties:!1}):e}var iyt=class extends LO{availability;constructor(t){super(t),this.safeParse()}parse(){if(qee(this.input,this.context.document)?.deprecated)this.availability="deprecated";else{let r=this.input[Pjv];r!=null&&(MVf.includes(r)?this.availability=r:(this.context.errors.warning({message:`Expected one of: ${MVf.join(", ")}. Received: ${r}`,path:this.accessPath}),this.availability=void 0))}}convert(){switch(this.availability){case"beta":case"pre-release":return Yj.Availability.Beta;case"in-development":return Yj.Availability.InDevelopment;case"generally-available":return Yj.Availability.GenerallyAvailable;case"deprecated":return Yj.Availability.Deprecated;case void 0:return;default:new T1v.UnreachableCaseError(this.availability);return}}};var $Uu=$i(PJ());function q1v(e){return typeof e=="object"&&e!=null&&"language"in e}function R1v(e){return typeof e=="object"&&e!=null&&"sdk"in e}function N1v(e){return typeof e=="object"&&e!=null&&("error"in e||"body"in e)}function F1v(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)}function KUu(e){return typeof e=="object"&&e!=null&&"event"in e}function BVf(e){return typeof e=="object"&&e!=null&&"stream"in e&&Array.isArray(e.stream)&&e.stream.every(KUu)}function Z8i(e){return typeof e=="object"&&e!=null&&"filename"in e&&"data"in e&&typeof e.filename=="string"&&typeof e.data=="string"}function x1v(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}var YUu=class extends LO{path;successResponseStatusCode;requestBodyByContentType;responseBodies;examples;constructor(t,r,n,i,a){super(t),this.path=r,this.successResponseStatusCode=n,this.requestBodyByContentType=i,this.responseBodies=a,this.safeParse()}parse(){this.examples=this.input[Njv]}convertFormDataExampleRequest(t,r){if(t.fields!=null)switch(t.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(t.fields).map(([i,a])=>{let o=typeof r=="object"?r[i]:void 0;switch(a.multipartType){case"file":return Z8i(o)?[i,{type:"filenameWithData",filename:o.filename,data:Yj.FileId(o.data)}]:o!=null?[i,{type:"filename",value:o}]:void 0;case"files":{if(Array.isArray(o)){if(o.every(c=>Z8i(c)))return[i,{type:"filenamesWithData",value:o.map(c=>({filename:c.filename,data:Yj.FileId(c.data)}))}];if(o.every(c=>typeof c=="string"))return[i,{type:"filenames",value:o}]}return}case"property":return[i,{type:"json",value:o}];case void 0:return;default:new $Uu.UnreachableCaseError(a.multipartType);return}}).filter(mA))};case"json":return{type:"json",value:r};case"bytes":return typeof r=="string"?{type:"bytes",value:{type:"base64",value:r}}:void 0;default:return}}convert(){if(this.examples==null)return;this.requestBodyByContentType!=null&&Object.keys(this.requestBodyByContentType).length>1&&this.context.logger.warn(`Multiple request bodies found for #/${[this.accessPath,this.pathId,"x-fern-examples"].join("/")}. Coercing to first request body until supported.`);let t=Object.keys(this.requestBodyByContentType??{})[0];return this.examples.flatMap(r=>(this.responseBodies??[]).map(n=>{let i=t!=null?this.requestBodyByContentType?.[t]:void 0,a;if(i!=null)switch(i.contentType){case"form-data":a=x1v(r.request)?this.convertFormDataExampleRequest(i,r.request):void 0;break;case"json":a=r.request!=null?{type:"json",value:r.request}:void 0;break;case"bytes":a=typeof r.request=="string"&&r.request!=null?{type:"bytes",value:{type:"base64",value:r.request}}:void 0;break;case void 0:break;default:new $Uu.UnreachableCaseError(i.contentType);break}let o;switch(n.contentType){case"application/json":{N1v(r.response)&&(o={type:"json",value:r.response.body});break}case"text/event-stream":{BVf(r.response)&&(o={type:"sse",value:r.response.stream.map(l=>({event:l.event,data:l.data}))});break}case"application/octet-stream":!BVf(r.response)&&F1v(r.response)&&(o={type:"stream",value:r.response.stream});break;case void 0:break;default:new $Uu.UnreachableCaseError(n.contentType);break}let c={};r["code-samples"]?.forEach(l=>{q1v(l)?l.language!=null&&(c[l.language]??=[],c[l.language]?.push({name:l.name,language:l.language,install:l.install,code:l.code,generated:!1,description:l.docs})):R1v(l)&&l.sdk!=null&&(c[l.sdk]??=[],c[l.sdk]?.push({name:l.name,language:l.sdk,install:void 0,code:l.code,generated:!1,description:l.docs}))});let f=Object.fromEntries(Object.entries(r["path-parameters"]??{}).map(([l,m])=>[Yj.PropertyKey(l),m])),u=Object.fromEntries(Object.entries(r["query-parameters"]??{}).map(([l,m])=>[Yj.PropertyKey(l),m])),s=Object.fromEntries(Object.entries(r.headers??{}).map(([l,m])=>[Yj.PropertyKey(l),m]));return{path:this.path,responseStatusCode:this.successResponseStatusCode,name:r.name,description:r.docs,pathParameters:Object.keys(f).length>0?f:void 0,queryParameters:Object.keys(u).length>0?u:void 0,headers:Object.keys(s).length>0?s:void 0,requestBody:a,responseBody:o,snippets:c}}))}};var Sns=class extends LO{groupName;constructor(t){super(t),this.safeParse()}parse(){this.groupName=this.input[gUu]}convert(){if(this.groupName==null)return;let t;return Array.isArray(this.groupName)?t=this.groupName:t=[this.groupName],t.map(r=>Yj.api.v1.SubpackageId($qr(r)))}};var XUu=class extends LO{sdkMethodName;constructor(t){super(t),this.safeParse()}parse(){this.sdkMethodName=this.input[jjv]}convert(){return this.sdkMethodName}};var ZUu=class extends LO{isWebhook;constructor(t){super(t),this.safeParse()}parse(){this.isWebhook=this.input[Ejv]}convert(){return this.isWebhook}};var kUu=class extends LO{codeSamples;constructor(t){super(t),this.safeParse()}parse(){this.codeSamples=[...this.input[zjv]??[],...this.input[Qjv]??[]],this.codeSamples.forEach(t=>{[...Object.values(Yj.api.v1.read.SupportedLanguage),"Kotlin","Swift","PHP"].map(r=>r.toLowerCase()).includes(t.lang.toLowerCase())||this.context.errors.warning({message:`Unsupported language: ${t.lang}. This may not render correctly.`,path:this.accessPath})})}convert(){let t={};if(this.codeSamples?.forEach(r=>{t[r.lang.toLowerCase()]??=[],t[r.lang.toLowerCase()]?.push({name:r.label,language:r.lang,code:r.source,install:void 0,generated:!1,description:void 0})}),Object.keys(t).length!==0)return t}};var qda=$i(PJ());function TVf(e,t){return xx(e)?_be(e,t,void 0):e}function z1v(e,t){return e.replace(/{(\w+)}/g,(r,n)=>t[n]!=null&&typeof t[n]=="string"||typeof t[n]=="number"||typeof t[n]=="boolean"?`${t[n]}`:r)}var Pde="",vWr=class extends LO{path;responseStatusCode;name;shapes;resolvedRequestInput;resolvedResponseInput;summary;constructor(t,r,n,i,a){super(t),this.path=r,this.responseStatusCode=n,this.name=i,this.shapes=a,this.safeParse()}validateFormDataRequestExample(){return typeof this.resolvedRequestInput?.value!="object"?!1:Object.entries(this.shapes.requestBody?.fields??{}).reduce((t,[r,n])=>{let i=this.resolvedRequestInput?.value[r];switch(n.multipartType){case"file":return t&&(Z8i(i)||typeof i=="string");case"files":return t&&Array.isArray(i)&&i.every(a=>Z8i(a)||typeof a=="string");case"property":return t;case void 0:return t&&!1;default:return new qda.UnreachableCaseError(n.multipartType),t}},!0)}parse(){let t=this.shapes.requestBody?.schema?.example({includeOptionals:!1,override:void 0});this.resolvedRequestInput=TVf(this.input?.requestExample,this.context.document)??(t!=null?{value:t}:void 0);let r=this.shapes.responseBody?.schema?.example({includeOptionals:!1,override:void 0});if(this.resolvedResponseInput=TVf(this.input?.responseExample,this.context.document)??(r!=null?{value:r}:void 0),this.summary=this.input?.requestExample?.summary??this.input?.responseExample?.summary,this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody?.contentType){case"json":{if(typeof this.resolvedRequestInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break}case"bytes":{if(typeof this.resolvedRequestInput.value!="string"){this.context.errors.error({message:"Invalid example, expected string for bytes",path:this.accessPath});return}break}case"form-data":{if(!this.validateFormDataRequestExample()){this.context.errors.error({message:"Invalid example, expected valid form-data",path:this.accessPath});return}break}case void 0:break;default:new qda.UnreachableCaseError(this.shapes.requestBody?.contentType),this.context.errors.error({message:"Invalid example, unsupported content type",path:this.accessPath});return}if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody?.contentType){case"application/json":if(this.resolvedResponseInput!=null&&typeof this.resolvedResponseInput!="object"||this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="object"){this.context.errors.error({message:"Invalid example, expected object for json",path:this.accessPath});return}break;case"text/event-stream":if(this.resolvedResponseInput.value!=null&&!Array.isArray(this.resolvedResponseInput.value)&&!this.resolvedResponseInput.value.every(KUu)){this.context.errors.error({message:"Invalid example, expected array of SSE events for event-stream",path:this.accessPath});return}break;case"application/octet-stream":if(this.resolvedResponseInput.value!=null&&typeof this.resolvedResponseInput.value!="string"&&!Array.isArray(this.resolvedResponseInput.value)){this.context.errors.error({message:"Invalid example, expected string or array for octet-stream",path:this.accessPath});return}break;case void 0:break;default:new qda.UnreachableCaseError(this.shapes.responseBody?.contentType);return}}convertFormDataExampleRequest(){if(!(this.resolvedRequestInput==null||this.shapes.requestBody?.fields==null))switch(this.shapes.requestBody?.contentType){case"form-data":return{type:"form",value:Object.fromEntries(Object.entries(this.shapes.requestBody.fields).map(([r,n])=>{let i=this.resolvedRequestInput?.value?.[r];switch(n.multipartType){case"file":return Z8i(i)?[r,{type:"filenameWithData",filename:i.filename,data:Yj.FileId(i.data)}]:[r,{type:"filename",value:i}];case"files":{if(Array.isArray(i)){if(i.every(a=>Z8i(a)))return[r,{type:"filenamesWithData",value:i.map(a=>({filename:a.filename,data:Yj.FileId(a.data)}))}];if(i.every(a=>typeof a=="string"))return[r,{type:"filenames",value:i}]}return}case"property":return[r,{type:"json",value:i}];case void 0:return;default:new qda.UnreachableCaseError(n.multipartType);return}}).filter(mA))};case"json":return{type:"json",value:this.resolvedRequestInput.value};case"bytes":return typeof this.resolvedRequestInput.value=="string"?{type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}}:void 0;default:return}}convertDescription(){if(this.resolvedRequestInput!=null&&this.resolvedResponseInput!=null)return this.resolvedResponseInput.description;if(this.resolvedRequestInput!=null)return this.resolvedRequestInput.description;if(this.resolvedResponseInput!=null)return this.resolvedResponseInput.description}convert(){let t;if(this.shapes.requestBody!=null&&this.resolvedRequestInput!=null)switch(this.shapes.requestBody.contentType){case"form-data":t=this.convertFormDataExampleRequest();break;case"json":t={type:"json",value:this.resolvedRequestInput.value};break;case"bytes":t={type:"bytes",value:{type:"base64",value:this.resolvedRequestInput.value}};break;case void 0:break;default:new qda.UnreachableCaseError(this.shapes.requestBody?.contentType);break}let r;if(this.shapes.responseBody!=null&&this.resolvedResponseInput!=null)switch(this.shapes.responseBody.contentType){case"application/json":{r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break}case"text/event-stream":r={type:"sse",value:this.resolvedResponseInput?.value};break;case"application/octet-stream":r={type:typeof this.resolvedResponseInput?.value=="string"?"filename":"stream",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;case void 0:r={type:"json",value:this.resolvedResponseInput?.value??this.resolvedResponseInput};break;default:new qda.UnreachableCaseError(this.shapes.responseBody?.contentType);break}let n=Object.fromEntries(Object.entries(this.shapes.pathParameters??{}).map(([o,c])=>[o,c.example({includeOptionals:!1,override:o})]));n=Object.keys(n).length>0?n:void 0;let i=Object.fromEntries(Object.entries(this.shapes.queryParameters??{}).map(([o,c])=>c.required||c.inputExample!=null?[o,c.example({includeOptionals:!1,override:o})]:void 0).filter(mA));i=Object.keys(i).length>0?i:void 0;let a=Object.fromEntries(Object.entries(this.shapes.requestHeaders??{}).map(([o,c])=>c.required||c.inputExample!=null?[o,c.example({includeOptionals:!1,override:o})]:void 0).filter(mA));if(a=Object.keys(a).length>0?a:void 0,!(this.path==null&&t==null&&r==null&&a==null&&i==null&&n==null))return{path:z1v(this.path,n??{}),responseStatusCode:this.responseStatusCode,name:this.name!=null?yWr(this.name):this.summary!=null?yWr(this.summary):void 0,description:this.convertDescription(),pathParameters:n,queryParameters:i,headers:a,requestBody:t,responseBody:r,snippets:void 0}}};function Q1v(e,t){return xx(e)?_be(e,t,void 0):e}var k1v=$i(PJ());var L1v="#/components/schemas/";function Poo(e){if(e.$ref.startsWith(L1v))return e.$ref.replace(L1v,"")}function Lwi(e){if(e!=null)return{type:"alias",value:{type:"nullable",shape:e}}}function k8i(e){return typeof e.type=="string"&&e.type==="array"}function U1v(e){return e.type==="boolean"}function V1v(e){return e.type==="integer"}function e2i(e){return!Array.isArray(e.type)&&!k8i(e)}function W1v(e){return e!=null&&Array.isArray(e)&&e.every(t=>t.type==="null"||e2i(t)||k8i(t))}function G1v(e){return"nullable"in e&&typeof e.nullable=="boolean"}function H1v(e){return e.type==="null"}function J1v(e){return e.type==="number"}function qVf(e){return e.type==null||typeof e.type=="string"&&e.type==="object"}function K1v(e){return e.type==="string"}var eVu=class extends Xxe{item;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.item=new yU({input:this.input.items,context:this.context,accessPath:this.accessPath,pathId:"items",seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}),this.input.items==null&&this.context.errors.error({message:"Expected 'items' property to be specified",path:this.accessPath})}convert(){return TQ(this.item?.convert())?.map(r=>({type:"alias",value:{type:"list",itemShape:r}}))}example(t){return this.input.example??this.input.examples?.[0]??[this.item?.example(t)]}};var tVu=class extends Tee{constValue;description;availability;constructor(t){super(t),this.safeParse()}parse(){this.input.const!=null&&(typeof this.input.const=="string"||typeof this.input.const=="number"||typeof this.input.const=="boolean")?this.constValue=this.input.const.toString():this.context.errors.warning({message:`Unsupported const type: ${typeof this.input}`,path:this.accessPath}),this.description=this.input.description,this.availability=new iyt({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"})}convert(){if(this.constValue!=null)return{type:"enum",default:this.constValue,values:[{value:this.constValue,description:this.description,availability:this.availability?.convert()}]}}example(){return this.input.example??this.input.examples?.[0]??this.constValue}};var rVu=class extends Xxe{typeNodes;nullable;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.parse()}parse(){this.typeNodes=this.input.map(t=>{if(t.type==="null")this.nullable=!0;else return new yU({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName})}).filter(mA)}convert(){if(this.typeNodes==null)return;let n=this.typeNodes.map(i=>TQ(i.convert())?.map(o=>({displayName:i.name,shape:o,description:i.description,availability:i.availability?.convert()}))).filter(mA).reduce((i,a)=>i.flatMap(o=>a.length>0?a.map(c=>[...o,c]):[[...o]]),[[]]).map(i=>({type:"undiscriminatedUnion",variants:i}));return this.nullable?n.map(Lwi).filter(mA):n}example(t){return this.nullable?null:this.typeNodes?.[0]?.example(t)}};function nVu(e){return e!=null&&e.length>0?e:[void 0]}var woo=class extends Xxe{description;extends=[];properties;extraProperties;requiredProperties;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){this.extends=[],this.requiredProperties=this.input.required,this.properties=Object.fromEntries(Object.entries(this.input.properties??{}).map(([t,r])=>[t,new yU({input:r,context:this.context,accessPath:this.accessPath,pathId:["properties",t],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})])),this.extraProperties=this.input.additionalProperties!=null?typeof this.input.additionalProperties=="boolean"?this.input.additionalProperties?this.input.title:void 0:new yU({input:this.input.additionalProperties,context:this.context,accessPath:this.accessPath,pathId:["additionalProperties"],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0,this.input.allOf!=null&&(this.extends=this.extends.concat(this.input.allOf.map((t,r)=>{if(xx(t))return Poo(t);this.properties={...this.properties,...Object.fromEntries(Object.entries(t.properties??{}).map(([n,i])=>[n,new yU({input:i,context:this.context,accessPath:this.accessPath,pathId:["allOf",r.toString(),"properties",n],seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))}}).filter(mA))),this.description=this.input.description}convertProperties(){if(this.properties!=null)return Aoo(this.properties,this.requiredProperties)}convertExtraProperties(){return this.extraProperties==null?void 0:typeof this.extraProperties=="string"?[{type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:{type:"alias",value:{type:"unknown",displayName:this.extraProperties}}}]:TQ(this.extraProperties.convert())?.map(r=>({type:"map",keyShape:{type:"alias",value:{type:"primitive",value:{type:"string",format:void 0,regex:void 0,minLength:void 0,maxLength:void 0,default:void 0}}},valueShape:r})).filter(mA)}convert(){let t=this.convertProperties();if(t==null)return;let r=this.convertExtraProperties();return t.flatMap(n=>nVu(r).map(i=>(this.extends==null||this.extends.length===0)&&n.length===0&&i!=null?{type:"alias",value:i}:{type:"object",extends:this.extends.map(a=>Yj.TypeId(a)),properties:n,extraProperties:i}))}example({includeOptionals:t}){let r={...this.properties};return this.input.allOf?.forEach(n=>{let i=qee(n,this.context.document);i!=null&&(r={...r,...Object.fromEntries(Object.entries(i.properties??{}).map(([a,o])=>[a,new yU({input:o,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})]))})}),this.input.example??this.input.examples?.[0]??(!t&&this.requiredProperties!=null&&this.requiredProperties.length>0?this.requiredProperties?.reduce((n,i)=>{let a=r?.[i];return n[i]=a?.example({includeOptionals:t,override:i}),n},{}):Object.entries(r).reduce((n,[i,a])=>(n[i]=a?.example({includeOptionals:t,override:i}),n),{}))}};var iVu=class extends Xxe{isNullable;discriminated;discriminant;discriminatedMapping;undiscriminatedMapping;schemaName;constructor(t){super(t),this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.input.oneOf!=null||this.input.anyOf!=null)if(this.isNullable=(this.input.oneOf??this.input.anyOf)?.some(t=>qee(t,this.context.document)?.type==="null"),this.input.discriminator==null)this.discriminated=!1,this.undiscriminatedMapping=(this.input.oneOf??this.input.anyOf)?.map(t=>qee(t,this.context.document)?.type!=="null"?new yU({input:t,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName}):void 0).filter(mA);else{let t=this.input.discriminator.mapping;if(t!=null){this.discriminated=!0,this.discriminant=this.input.discriminator.propertyName,this.discriminatedMapping={};let r=this.discriminatedMapping;Object.entries(t).map(([n,i])=>{let a=qee({$ref:i},this.context.document);if(a==null){this.context.errors.warning({message:`Expected schema reference. Received undefined reference: ${i}`,path:[...this.accessPath,"discriminator","mapping",n]});return}r[n]=new yU({input:a,context:this.context,accessPath:[...this.accessPath,"discriminator","mapping",n],pathId:n,seenSchemas:this.seenSchemas,nullable:void 0,schemaName:this.schemaName})})}}}convert(){if(!this.discriminated&&this.undiscriminatedMapping?.length===1){let i=this.undiscriminatedMapping?.flatMap(a=>a.convert()).filter(mA);return this.isNullable&&i!=null?i.map(Lwi).filter(mA):i}let t=0,r=this.discriminated&&this.discriminant!=null&&this.discriminatedMapping!=null?{type:"discriminatedUnion",discriminant:Yj.PropertyKey(this.discriminant),variants:Object.entries(this.discriminatedMapping).flatMap(([i,a])=>TQ(a.convert())?.map(c=>{if(!(c==null||c.type!=="object"))return{discriminantValue:i,displayName:a.name??yWr(i),availability:a.availability?.convert(),description:a.description,...c}}).filter(mA)).filter(mA)}:this.undiscriminatedMapping!=null?{type:"undiscriminatedUnion",variants:this.undiscriminatedMapping.flatMap(i=>TQ(i.convert())?.map(o=>{if(o==null)return;t+=1;let c=o.type==="object"?yWr(`${this.schemaName??"Variant"} ${t}`):void 0;return{displayName:i.name??(o.type==="alias"&&o.value.type==="id"?yWr(o.value.id):c),shape:o,description:i.description,availability:i.availability?.convert()}}).filter(mA)).filter(mA)}:void 0,n=this.isNullable?Lwi(r):r;return n!=null?[n]:void 0}example(t){return this.input.example??this.input.examples?.[0]??this.undiscriminatedMapping?.[0]?.example(t)??Object.values(this.discriminatedMapping??{})[0]?.example(t)}};var aVu=class extends Tee{default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.input.default!=null&&typeof this.input.default!="boolean"&&this.context.errors.warning({message:`Expected default value to be a boolean. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default}convert(){return{type:"alias",value:{type:"primitive",value:{type:"boolean",default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:!1)}};var t2i=class extends Tee{default;values=[];nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){if(this.input.enum!=null){let t=!0;this.values=this.input.enum.map((r,n)=>{if(t){if(xx(r)){let i=qee(r,this.context.document);r=typeof i=="string"?i:typeof i?.default=="string"?i?.default:typeof i?.example=="string"?i.example:void 0}if(typeof r!="string"){this.context.errors.error({message:`Expected enum values to be strings. Received ${r}`,path:[...this.accessPath,`enum[${n}]`]}),t=!1;return}return r}}).filter(mA),this.values=Array.from(new Set(this.values))}this.default=this.input.default}convert(){return{type:"enum",values:this.values.map(t=>({value:t,description:void 0,availability:void 0})),default:this.default}}example(){return this.input.example??this.input.examples?.[0]??this.default??this.values[0]??(this.nullable?null:void 0)}};var $1v=$i(PJ());function irM(e){return CVf.includes(e)}var oVu=class extends Tee{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be an integer. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(irM(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${CVf.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="integer";if(this.format!=null)switch(this.format){case"int64":t="long";break;case"int8":case"int16":case"int32":case"uint8":case"sf-integer":case void 0:t="integer";break;default:new $1v.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var sVu=class extends Tee{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){this.displayName=this.input.title}convert(){return Lwi({type:"alias",value:{type:"unknown",displayName:this.displayName}})}example(){return null}};var Y1v=$i(PJ());function arM(e){return DVf.includes(e)}var uVu=class extends Tee{format;minimum;maximum;default;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}parse(){this.minimum=this.input.minimum,this.maximum=this.input.maximum,this.input.default!=null&&typeof this.input.default!="number"&&this.context.errors.warning({message:`Expected default value to be a number. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(arM(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${DVf.join(", ")}. Received ${this.input.format}`,path:this.accessPath}))}convert(){let t="double";if(this.format!=null)switch(this.format){case"decimal":case"decimal128":case"double-int":case"double":case"float":case"sf-decimal":case void 0:t="double";break;default:new Y1v.UnreachableCaseError(this.format);break}return{type:"alias",value:{type:"primitive",value:{type:t,minimum:this.minimum,maximum:this.maximum,default:this.default}}}}example(){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:0)}};var X1v=$i(PJ());function orM(e){return IVf.includes(e)}var cVu=class extends Tee{format;regex;default;minLength;maxLength;enum;mimeType;nullable;constructor(t){super(t),this.nullable=t.nullable,this.safeParse()}mapToFdrType(t){switch(t){case"base64url":case"binary":case"byte":case"sf-binary":return"base64";case"date-time":return"datetime";case"int64":return"bigInteger";case"date":return"date";case"uuid":return"uuid";case"char":case"commonmark":case"decimal":case"decimal128":case"duration":case"email":case"hostname":case"html":case"http-date":case"idn-email":case"idn-hostname":case"ipv4":case"ipv6":case"iri-reference":case"iri":case"json-pointer":case"media-range":case"password":case"regex":case"relative-json-pointer":case"sf-boolean":case"sf-string":case"sf-token":case"time":case"uri-reference":case"uri-template":case"uri":case void 0:return"string";default:return new X1v.UnreachableCaseError(t),"string"}}parse(){this.regex=this.input.pattern,this.minLength=this.input.minLength,this.maxLength=this.input.maxLength,this.mimeType=this.input.contentMediaType,this.input.default!=null&&typeof this.input.default!="string"&&this.context.errors.warning({message:`Expected default value to be a string. Received ${this.input.default}`,path:this.accessPath}),this.default=this.input.default,this.input.format!=null&&(orM(this.input.format)?this.format=this.input.format:this.context.errors.warning({message:`Expected format to be one of ${IVf.join(", ")}. Received ${this.input.format}`,path:this.accessPath})),this.input.enum!=null&&(this.enum=new t2i({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"enum",nullable:this.nullable}))}convert(){if(this.enum!=null)return this.enum.convert();let t="string";return this.format!=null&&(t=this.mapToFdrType(this.format)),{type:"alias",value:{type:"primitive",value:t==="base64"?{type:t,mimeType:this.mimeType,default:this.default}:{type:t,format:t==="string"?this.format:void 0,regex:this.regex,minLength:this.minLength,maxLength:this.maxLength,default:this.default}}}}example({override:t}){return this.input.example??this.input.examples?.[0]??this.default??(this.nullable?null:t??"string")}};var Z1v=$i(PJ());var lVu=class extends Tee{displayName;shape;constructor(t){super(t),this.safeParse()}parse(){(0,Z1v.noop)()}convert(){return{type:"alias",value:{type:"unknown",displayName:void 0}}}example(){}};var Rda=class extends Xxe{description;availability;schemaId;maybeEnumConverterNode;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.description=t.description,this.availability=t.availability,this.safeParse()}parse(){this.schemaId=Poo(this.input);let t=qee(this.input,this.context.document);t?.enum!=null&&e2i(t)&&(this.maybeEnumConverterNode=new t2i({input:t,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",nullable:this.nullable})),this.schemaId==null&&this.context.errors.error({message:`Unprocessable reference: ${this.input.$ref}`,path:this.accessPath})}convert(){if(this.schemaId!=null)return{type:"alias",value:{type:"id",id:Yj.TypeId(this.schemaId),default:this.maybeEnumConverterNode?.default!=null?{type:"enum",value:this.maybeEnumConverterNode.default}:void 0}}}example(t){let r=qee(this.input,this.context.document);if(r!=null)return new yU({input:r,context:this.context,accessPath:this.accessPath,pathId:this.schemaId??"",seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName}).example(t)}};var yU=class e extends Xxe{typeShapeNode;description;name;examples;availability;nullable;schemaName;constructor(t){super(t),this.nullable=t.nullable,this.schemaName=t.schemaName,this.safeParse()}parse(){if(this.description=this.input.description,this.availability=new iyt({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),e2i(this.input)&&G1v(this.input)&&(this.nullable=this.input.nullable!=null?this.input.nullable:this.nullable),xx(this.input)){let t=Poo(this.input);if(t==null){this.context.errors.error({message:"Reference object does not have a valid schema ID",path:this.accessPath});return}if(this.seenSchemas.has(t)){this.context.errors.warning({message:"Circular or deeply nested schema found, terminating",path:this.accessPath});return}this.seenSchemas.add(t),this.typeShapeNode=new Rda({input:this.input,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:this.seenSchemas,nullable:this.nullable,schemaName:this.schemaName,description:this.description,availability:this.availability})}else if(this.name=this.input.title,this.examples=this.input.example,this.input.const!=null)this.typeShapeNode=new tVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});else if(W1v(this.input))this.typeShapeNode=new rVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(e2i(this.input)&&(this.input.oneOf!=null||this.input.anyOf!=null))this.typeShapeNode=new iVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(qVf(this.input)&&this.input.allOf!=null)this.typeShapeNode=new woo({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName});else if(e2i(this.input)&&this.input.enum!=null)this.typeShapeNode=new t2i({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable});else if(typeof this.input.type=="string"||Array.isArray(this.input.type)&&this.input.type.length===1){if(this.input.type=Array.isArray(this.input.type)?this.input.type[0]:this.input.type,!Array.isArray(this.input.type))switch(this.input.type){case"object":qVf(this.input)&&(this.typeShapeNode=new woo({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"array":k8i(this.input)&&(this.typeShapeNode=new eVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));break;case"boolean":U1v(this.input)&&(this.typeShapeNode=new aVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"integer":V1v(this.input)&&(this.typeShapeNode=new oVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"number":J1v(this.input)&&(this.typeShapeNode=new uVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"string":K1v(this.input)&&(this.typeShapeNode=new cVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId,nullable:this.nullable}));break;case"null":H1v(this.input)&&(this.typeShapeNode=new sVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}));break;case void 0:break;default:new k1v.UnreachableCaseError(this.input.type);break}}else if(Array.isArray(this.input.type)&&this.input.type.includes("null")&&this.input.type.length===2){let t=this.input.type.filter(r=>r!=="null")[0];t!=="array"&&(this.typeShapeNode=new e({input:{...this.input,type:t},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,nullable:!0,schemaName:this.schemaName}))}else this.input.properties!=null&&(this.typeShapeNode=new woo({input:{...this.input,type:"object"},context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:this.seenSchemas,schemaName:this.schemaName}));this.typeShapeNode==null&&(this.typeShapeNode=new lVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}),!xx(this.input)&&(!k8i(this.input)&&this.input==null||k8i(this.input)&&this.input.items==null)&&this.context.errors.error({message:"Expected type declaration. Received: null",path:this.accessPath}))}convert(){let t=this.typeShapeNode?.convert();if(t==null)return;let r=TQ(t)?.map(n=>this.nullable?Lwi(n):n).filter(mA);return Array.isArray(t)&&t.length>1?r:r?.[0]}example(t){return this.availability?.availability!=="deprecated"?this.typeShapeNode?.example(t):void 0}};function r2i(e){if(e!=null)return Aoo(e,Object.entries(e??{}).map(([t,r])=>r.required?t:void 0).filter(mA))}var bWr=class extends Tee{availability;required;schema;description;inputExample;constructor(t){super(t),this.safeParse(t.parameterName)}parse(t){this.description=this.input.description;let r;xx(this.input)?r=this.input:this.input.schema!=null?(r=this.input.schema,this.required=this.input.required):(r={type:"string"},this.required=!1),this.availability=new iyt({input:r,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=new yU({input:r,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:t});let n=Q1v(this.input,this.context.document);this.inputExample=n?.example??Object.values(n?.examples??{})[0]}convert(){return this.schema?.convert()}example(t){return this.inputExample??this.schema?.example(t)}};function eEv(e,t){return xx(e)?_be(e,t,void 0):e}var RVf=$i(PJ());function fVu(e){let{uniqueId:t,type:r,contextTypes:n,description:i,availability:a}=e;n[Yj.TypeId(t)]={name:t,shape:r,description:i,availability:a}}var tEv=$i(yKl(),1),joo=class e{type;subtype;essence;parameters;mimeType;input;constructor(t,r,n,i,a,o){this.type=t,this.subtype=r,this.essence=n,this.parameters=i,this.mimeType=a,this.input=o}static APPLICATION_JSON="application/json";static APPLICATION_OCTET_STREAM="application/octet-stream";static MULTIPART_FORM_DATA="multipart/form-data";static parse(t){if(t==null)return null;let r=tEv.default.parse(t);return r==null?null:new e(r.type,r.subtype,r.essence,r.parameters,r,t)}toString(){return this.input}isText(){return this.type==="text"}isImage(){return this.type==="image"}isAudio(){return this.type==="audio"}isVideo(){return this.type==="video"}isFont(){return this.type==="font"}isMultipart(){return this.type==="multipart"}isApplication(){return this.type==="application"}isMessage(){return this.type==="message"}isModel(){return this.type==="model"}isCSS(){return this.isText()&&this.subtype==="css"}isCSV(){return this.isText()&&this.subtype==="csv"}isMarkdown(){return this.isText()&&this.subtype==="markdown"}isPlainText(){return this.isText()&&this.subtype==="plain"}isEventStream(){return this.isText()&&this.subtype==="event-stream"}isMultiPartFormData(){return this.isMultipart()&&this.subtype==="form-data"}isJSON(){return this.isApplication()&&this.subtype==="json"}containsJSON(){return this.isApplication()&&this.subtype.includes("json")}isURLEncoded(){return this.isApplication()&&this.subtype==="x-www-form-urlencoded"}isOctetStream(){return this.isApplication()&&this.subtype==="octet-stream"}isPDF(){return this.isApplication()&&this.subtype==="pdf"}isZip(){return this.isApplication()&&this.subtype==="zip"}isGzip(){return this.isApplication()&&this.subtype==="gzip"}isTar(){return this.isApplication()&&this.subtype==="tar"}isBrotli(){return this.isApplication()&&this.subtype==="br"}isDeflate(){return this.isApplication()&&this.subtype==="deflate"}isProtobuf(){return this.isApplication()&&this.subtype==="protobuf"}isAvif(){return this.isImage()&&this.subtype==="avif"}isWebP(){return this.isImage()&&this.subtype==="webp"}isSVG(){return this.isImage()&&this.subtype==="svg+xml"}isPNG(){return this.isImage()&&this.subtype==="png"}isJPEG(){return this.isImage()&&this.subtype==="jpeg"}isGIF(){return this.isImage()&&this.subtype==="gif"}isMPEG(){return this.isAudio()&&this.subtype==="mpeg"}isWAV(){return this.isAudio()&&this.subtype==="wav"}isHTML(){return this.mimeType.isHTML()}isXML(){return this.mimeType.isXML()}isJavaScript(){return this.mimeType.isJavaScript()}};function srM(e){return typeof e.securitySchemes=="object"&&e.securitySchemes!=null}var dVu=class extends LO{typeSchemas;securitySchemes;constructor(t){super(t),this.safeParse()}parse(){this.input.schemas!=null&&(this.typeSchemas=Object.fromEntries(Object.entries(this.input.schemas).map(([t,r])=>[t,new yU({input:r,context:this.context,accessPath:this.accessPath,pathId:t,seenSchemas:new Set,nullable:void 0,schemaName:t})]))),srM(this.input)&&this.input.securitySchemes!=null&&(this.securitySchemes=Object.fromEntries(Object.entries(this.input.securitySchemes??{}).map(([t,r],n)=>{let i;if(xx(r)?i=AUu(r.$ref,this.context.document):i=r,i!=null)return[t,new moo({input:i,context:this.context,accessPath:this.accessPath,pathId:["securitySchemes",`${n}`]})]}).filter(mA)))}convert(){return{auths:this.securitySchemes!=null?Object.fromEntries(Object.entries(this.securitySchemes??{}).map(([t,r])=>{let n=r.convert();if(n!=null)return[Yj.api.latest.AuthSchemeId(t),n]}).filter(mA)):void 0,types:this.typeSchemas!=null?Object.fromEntries(Object.entries(this.typeSchemas).map(([t,r])=>{let n=r.name??t,i=TQ(r.convert());return i==null?[t,void 0]:[Yj.TypeId(t),{name:n,shape:i[0],description:r.description,availability:void 0}]}).filter(([t,r])=>mA(r))):void 0}}};var pVu=class extends yU{multipartType;contentType;constructor(t){super(t),this.safeParse()}parse(){super.parse();let t=qee(this.input,this.context.document);if(t==null){this.context.errors.error({message:`Expected multipart form data property definition. ${xx(this.input)?`Received undefined reference: ${this.input.$ref}`:""}`,path:this.accessPath});return}if(t.type==="string"&&t.format==="binary")this.multipartType="file",this.contentType=t.contentMediaType;else if(t.type==="array"){let r=qee(t.items,this.context.document);r?.type==="string"&&r?.format==="binary"?(this.multipartType="files",this.contentType=r?.contentMediaType):(this.context.errors.warning({message:"Expected multipart form data files definition with array type with internal string type and binary format.",path:this.accessPath}),this.multipartType=void 0,this.contentType=void 0)}else this.multipartType="property",this.contentType=t.contentMediaType}};var _Vu=class extends LO{description;method;path;schema;isOptional;contentType;availability;requiredFields;fields;examples;constructor(t){super(t),this.method=t.method,this.path=t.path,this.safeParse(t)}parse({contentType:t}){if(this.input.schema!=null){let n=qee(this.input.schema,this.context.document);this.availability=new iyt({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"availability"}),this.schema=xx(this.input.schema)?new Rda({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:!1,schemaName:"Request Body",description:this.input.schema.description,availability:this.availability}):void 0;let i=joo.parse(t);i?.containsJSON()?(this.contentType="json",this.schema=this.schema??new yU({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"schema",seenSchemas:new Set,nullable:void 0,schemaName:"Request Body"})):i?.isOctetStream()?(this.contentType="bytes",this.isOptional=n?.required==null):i?.isMultiPartFormData()?(this.contentType="form-data",this.requiredFields=n?.required,this.fields=Object.fromEntries(Object.entries(n?.properties??{}).map(([a,o])=>{if(o!=null)return[a,new pVu({input:o,context:this.context,accessPath:this.accessPath,pathId:`schema.${a}`,seenSchemas:new Set,nullable:void 0,schemaName:a})]}).filter(mA))):this.context.errors.warning({message:`Expected request body of reference or object with json, streaming or form-data content types. Received: ${t}`,path:this.accessPath})}let r=this.schema?.example({includeOptionals:!0,override:void 0});this.examples={...this.input.example!=null?{[Pde]:{value:this.input.example}}:{},...this.input.examples},r!=null&&Object.keys(this.examples).length===0&&(this.examples={[Pde]:{value:r}})}convertJsonLike(){let t=this.schema?.convert();return t==null?void 0:TQ(t)?.map(n=>{let i=n.type;switch(i){case"object":case"alias":return n;case"enum":case"undiscriminatedUnion":case"discriminatedUnion":{let a=$qr([this.method,this.path,this.contentType,"request"].join("_"));return fVu({uniqueId:a,type:n,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:Yj.TypeId(a),default:n.type==="enum"&&n.default!=null?{type:"enum",value:n.default}:void 0}}}case void 0:return;default:new RVf.UnreachableCaseError(i);return}}).filter(mA)}convert(){if(this.schema instanceof Rda)return this.schema.convert();switch(this.contentType){case"json":return this.convertJsonLike();case"bytes":return{type:"bytes",isOptional:this.isOptional??!1,contentType:this.contentType};case"form-data":return Object.entries(this.fields??{}).map(([n,i])=>{switch(i.multipartType){case"file":return[{type:i.multipartType,key:Yj.PropertyKey(n),isOptional:this.requiredFields?.includes(n)==null,contentType:i.contentType,description:i.description,availability:i.availability?.convert()}];case"files":return[{type:i.multipartType,key:Yj.PropertyKey(n),isOptional:this.requiredFields?.includes(n)==null,contentType:i.contentType,description:i.description,availability:i.availability?.convert()}];case"property":{let a=TQ(i.convert()),o=i.multipartType;return a?.map(c=>({type:o,key:Yj.PropertyKey(n),contentType:i.contentType,exploded:void 0,valueShape:c,description:i.description,availability:i.availability?.convert()}))}case void 0:return[];default:return new RVf.UnreachableCaseError(i.multipartType),[]}}).filter(mA).reduce((n,i)=>n.flatMap(a=>i.length>0?i.map(o=>[...a,o]):[[...a]]),[[]]).map(n=>({type:"formData",fields:n,availability:this.availability?.convert(),description:this.description}));case void 0:return this.convertJsonLike();default:return}}};var hVu=class extends LO{description;requestBodiesByContentType;constructor(t){super(t),this.safeParse(t)}parse({method:t,path:r}){let n=eEv(this.input,this.context.document);if(n==null){this.context.errors.error({message:"Expected request body. Received: null",path:this.accessPath});return}Object.entries(n.content).forEach(([i,a])=>{this.requestBodiesByContentType??={},this.requestBodiesByContentType[i]=new _Vu({input:a,context:this.context,accessPath:this.accessPath,pathId:"content",contentType:i,method:t,path:r})})}convert(){return Object.entries(this.requestBodiesByContentType??{}).flatMap(([t,r])=>TQ(r.convert())?.map(i=>({description:this.description,contentType:t,body:i}))).filter(mA)}convertToWebhookPayload(){return Object.values(this.requestBodiesByContentType??{}).flatMap(t=>TQ(t.convert())?.map(n=>{if(!(n.type!=="alias"&&n.type!=="object"))return{description:this.description,shape:n}})).filter(mA)}webhookExample(){return{payload:this.requestBodiesByContentType?.["application/json"]?.schema?.example({includeOptionals:!0,override:void 0})}}};var rEv={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Switch Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"};function nEv(e,t){if(xx(e)){let r=_be(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var yVu=$i(PJ());var iEv="application/json";var aEv="application/octet-stream";function oEv(e,t){return e===t||t===Pde||e===Pde}var Dns=class extends LO{streamingFormat;path;method;statusCode;requests;shapes;schema;contentType;unsupportedContentType;contentSubtype;examples;empty;constructor(t,r,n,i,a,o,c,f){super(t),this.streamingFormat=n,this.path=i,this.method=a,this.statusCode=o,this.requests=c,this.shapes=f,this.safeParse(r)}matchRequestResponseExamplesByName(t,r,n){for(let i of t)for(let[a,o]of Object.entries(i?.examples??{}))for(let[c,f]of Object.entries(r))for(let u of f)oEv(c,a)&&(n.add(c),this.examples?.push(new vWr({input:{requestExample:o,responseExample:u},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,X8i(a,c),{requestBody:i,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}matchExamplesByIndex(t,r){let n=0;for(let i of t){let a=0;for(let[o,c]of r){if(a===n){let[f,u,s]=i??[void 0,void 0,void 0];this.examples?.push(...c.map(l=>new vWr({input:{requestExample:s,responseExample:l},context:this.context,accessPath:this.accessPath,pathId:u!=null&&u!==""?["examples",u]:"examples"},this.path,this.statusCode,X8i(u,o),{requestBody:f,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}a++}n++}if(t.length>r.length)for(let i of t.slice(r.length)){let[a,o]=r[r.length-1]??[void 0,void 0],[c,f,u]=i??[void 0,void 0,void 0];this.examples?.push(...(o??[void 0]).map(s=>new vWr({input:{requestExample:u,responseExample:s},context:this.context,accessPath:this.accessPath,pathId:f!=null&&f!==""?["examples",f]:"examples"},this.path,this.statusCode,X8i(f,a),{requestBody:c,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}if(r.length>t.length){let[i,a,o]=t[t.length-1]??[void 0,void 0,void 0];for(let[c,f]of r.slice(t.length))this.examples?.push(...f.map(u=>new vWr({input:{requestExample:o,responseExample:u},context:this.context,accessPath:this.accessPath,pathId:a!=null&&a!==""?["examples",a]:"examples"},this.path,this.statusCode,X8i(a,c),{requestBody:i,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders})))}}pushResponseExample(t,r,n,i){let a=t[Pde];if(a!=null)for(let o of a)this.examples?.push(new vWr({input:{requestExample:i,responseExample:o},context:this.context,accessPath:this.accessPath,pathId:n!=null&&n!==""?["examples",n]:"examples"},this.path,this.statusCode,X8i(n,void 0),{requestBody:r,responseBody:this,pathParameters:this.shapes.pathParameters,queryParameters:this.shapes.queryParameters,requestHeaders:this.shapes.requestHeaders}))}addGlobalFallbackExample(t,r){if(t==null||t.length===0)this.pushResponseExample(r,void 0,void 0,void 0);else for(let n of t)if(Object.keys(n.examples??{}).length===0)this.pushResponseExample(r,n,void 0,void 0);else for(let[i,a]of Object.entries(n.examples??{}))this.pushResponseExample(r,n,i,a)}parse(t){if(t==="empty")this.empty=!0;else{let c=joo.parse(t);if(c?.isJSON()||c?.isEventStream())this.contentType=iEv,this.input.schema==null?(this.streamingFormat==null||this.streamingFormat==="json")&&this.context.errors.error({message:"Expected schema for JSON response body. Received null",path:this.accessPath}):this.schema=new yU({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:"type",seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"});else if(c?.isOctetStream())this.contentType=aEv,this.contentSubtype=qee(this.input.schema,this.context.document)?.contentMediaType;else if(this.unsupportedContentType=t,this.input.schema==null){this.context.errors.error({message:"Expected schema for plain text response body. Received null",path:this.accessPath});return}else this.schema=new yU({input:this.input.schema,context:this.context,accessPath:this.accessPath,pathId:this.pathId,seenSchemas:new Set,nullable:void 0,schemaName:"Response Body"})}let r={};this.input.examples!=null&&(r=UUu(this.input.examples,c=>[c])),this.input.example!=null&&Object.keys(r).length===0&&(r[Pde]??=[],r[Pde]=[{value:this.input.example}]);let n=qee(this.input.schema,this.context.document);if(n!=null&&(n.examples!=null&&Object.keys(r).length===0&&(r=UUu(n.examples,c=>[c])),n.example!=null&&Object.keys(r).length===0&&(r[Pde]??=[],r[Pde]?.push({value:n.example}))),Object.keys(r).length===0){let c=this.schema?.example({includeOptionals:!0,override:void 0});r[Pde]??=[],r[Pde]?.push(c!=null?{value:c}:void 0)}this.examples??=[];let i=new Set;this.matchRequestResponseExamplesByName(this.requests,r,i);let a=[];for(let c of this.requests)a.push(...Object.entries(c.examples??{}).filter(([f])=>!i.has(f)&&f!==Pde).map(([f,u])=>[c,f,u]));let o=Object.entries(r).filter(([c,f])=>!i.has(c)&&mA(f)&&c!==Pde);Object.keys(r).every(c=>c===Pde)||this.matchExamplesByIndex(a,o),!i.has(Pde)&&this.examples.length===0&&this.addGlobalFallbackExample(this.requests,r),this.examples.length===0&&(this.examples=void 0)}convertStreamingFormat(){switch(this.streamingFormat){case"json":return TQ(this.schema?.convert())?.map(r=>({type:"stream",terminator:"[DATA]",shape:r}));case"sse":return{type:"streamingText"};case void 0:return;default:new yVu.UnreachableCaseError(this.streamingFormat);return}}convertJsonLike(){return TQ(this.schema?.convert())?.map(r=>{let n=r.type;switch(n){case"alias":return r;case"discriminatedUnion":case"undiscriminatedUnion":case"enum":{let i=$qr([this.method,this.path,this.statusCode,"response"].join("_"));return fVu({uniqueId:i,type:r,contextTypes:this.context.generatedTypes,description:this.schema?.description,availability:this.schema?.availability?.convert()}),{type:"alias",value:{type:"id",id:Yj.TypeId(i),default:r.type==="enum"&&r.default!=null?{type:"enum",value:r.default}:void 0}}}case"object":return r;default:new yVu.UnreachableCaseError(n);return}}).filter(mA)}convert(){if(this.empty)return{type:"empty"};if(this.contentType!=null)switch(this.contentType){case"application/json":return this.streamingFormat==null?this.convertJsonLike():this.convertStreamingFormat();case"application/octet-stream":return{type:"fileDownload",contentType:this.contentSubtype};case"text/event-stream":return this.convertStreamingFormat();case void 0:return;default:new yVu.UnreachableCaseError(this.contentType);return}else return this.unsupportedContentType!=null?this.convertJsonLike():void 0}};var Cns=class extends LO{path;method;statusCode;requests;shapes;headers;responses;description;constructor(t,r,n,i,a,o){super(t),this.path=r,this.method=n,this.statusCode=i,this.requests=a,this.shapes=o,this.safeParse()}parse(t){this.description=this.input.description;let r=nEv(this.input,this.context.document);if(r==null){this.context.errors.error({message:xx(this.input)?`Undefined reference: ${this.input.$ref}`:"Expected response, received null",path:this.accessPath});return}Object.entries(r.headers??{}).forEach(([n,i])=>{this.headers??={},this.headers[n]=new bWr({input:i,context:this.context,accessPath:this.accessPath,pathId:"headers",parameterName:n})}),r.content==null?(this.responses??=[],this.responses.push(new Dns({input:{},context:this.context,accessPath:this.accessPath,pathId:["content"]},"empty",t,this.path,this.method,this.statusCode,this.requests,this.shapes))):Object.entries(r.content??{}).forEach(([n,i])=>{this.responses??=[],this.responses.push(new Dns({input:i,context:this.context,accessPath:this.accessPath,pathId:["content",n]},n,t,this.path,this.method,this.statusCode,this.requests,this.shapes))})}convert(){return this.responses?.flatMap(t=>t.convert()).filter(mA)}};var vVu=class extends LO{path;method;requests;shapes;responsesByStatusCode;errorsByStatusCode;constructor(t,r,n,i,a){super(t),this.path=r,this.method=n,this.requests=i,this.shapes=a,this.safeParse()}parse(){let t=this.input.default;Object.entries(this.input).forEach(([r,n])=>{r!=="default"&&(parseInt(r)>=400?(this.errorsByStatusCode??={},this.errorsByStatusCode[r]=new Cns({input:{...t,...n},context:this.context,accessPath:this.accessPath,pathId:"errors"},this.path,this.method,parseInt(r),[],this.shapes)):(this.responsesByStatusCode??={},this.responsesByStatusCode[r]=new Cns({input:n,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,parseInt(r),this.requests,this.shapes)))})}convertResponseObjectToHttpResponses(){return Object.entries(this.responsesByStatusCode??{}).flatMap(([t,r])=>{let n=r.convert();if(n!=null)return nVu(r2i(r.headers)).flatMap(i=>n?.map(a=>({headers:i,response:{statusCode:parseInt(t),body:a,description:r.description},examples:(r.responses??[]).flatMap(o=>(o.examples??[]).map(c=>c.convert()).filter(mA))})))}).filter(mA)}convertResponseObjectToErrors(){return Object.entries(this.errorsByStatusCode??{}).flatMap(([t,r])=>r.responses?.flatMap(n=>{let i=n.schema,a=TQ(i?.convert());if(i!=null)return a?.map(o=>({statusCode:parseInt(t),shape:o,description:r.description??i.description,availability:i.availability?.convert(),name:i.name??rEv[parseInt(t)]??"UNKNOWN ERROR",examples:n.examples?.map(c=>{let f=c.convert();if(f!=null&&f.responseBody?.type==="json")return{name:f.name,description:f.description,responseBody:f.responseBody}}).filter(mA)})).filter(mA)})).filter(mA)}convert(){return{responses:this.convertResponseObjectToHttpResponses(),errors:this.convertResponseObjectToErrors()}}};var n2i=class extends LO{servers;globalAuth;path;method;basePath;isWebhook;endpointIds;description;displayName;operationId;pathParameters;queryParameters;requestHeaders;requests;responses;availability;auth;namespaces;xFernExamplesNode;redocExamplesNode;emptyResponseExamples;constructor(t){super(t),this.servers=t.servers,this.globalAuth=t.globalAuth,this.path=t.path,this.method=t.method,this.basePath=t.basePath,this.isWebhook=t.isWebhook,this.safeParse()}pushEmptyResponseExample(t,r,n){this.emptyResponseExamples??=[],this.emptyResponseExamples.push(new vWr({input:{requestExample:t,responseExample:void 0},context:this.context,accessPath:this.accessPath,pathId:"examples"},this.path,200,X8i(n,void 0),{requestBody:r,pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}))}parse(){if(this.isWebhook&&this.method!=="POST"&&this.method!=="GET"){this.context.errors.error({message:`Webhook method must be POST or GET. Received: ${this.method}`,path:this.accessPath});return}this.description=this.input.description,this.displayName=this.input.summary,this.operationId=this.input.operationId,this.availability=new iyt({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-availability"}),this.servers=K8i(this.servers,this.input.servers,this.context,this.accessPath),this.isWebhook=new ZUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId}).isWebhook||this.isWebhook,this.input.parameters?.map((n,i)=>{if(xx(n)){let a=JUu(n,this.context.document);if(a!=null)n=a;else{this.context.errors.warning({message:`Expected parameter reference to resolve to an object. Received undefined reference: ${n.$ref}`,path:[...this.accessPath,`parameters[${i}]`]});return}}n.in==="path"?n.schema!=null&&(this.pathParameters??={},this.pathParameters[n.name]=new bWr({input:n,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${i}`],parameterName:n.name})):n.in==="query"?n.schema!=null&&(this.queryParameters??={},this.queryParameters[n.name]=new bWr({input:n,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${i}`],parameterName:n.name})):n.in==="header"&&n.schema!=null&&(this.requestHeaders??={},this.requestHeaders[n.name]=new bWr({input:n,context:this.context,accessPath:this.accessPath,pathId:["parameters",`${i}`],parameterName:n.name}))});for(let n of this.extractPathParameterIds()??[])this.pathParameters?.[n]==null&&this.context.errors.warning({message:`Path parameter not defined: ${n}`,path:[...this.accessPath,"parameters"]});if(this.redocExamplesNode=new kUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-code-samples"}),this.requests=this.input.requestBody!=null?new hVu({input:this.input.requestBody,context:this.context,accessPath:this.accessPath,pathId:"requestBody",method:this.method,path:this.path}):void 0,this.responses=this.input.responses!=null?new vVu({input:this.input.responses,context:this.context,accessPath:this.accessPath,pathId:"responses"},this.path,this.method,Object.values(this.requests?.requestBodiesByContentType??{}),{pathParameters:this.pathParameters,queryParameters:this.queryParameters,requestHeaders:this.requestHeaders}):void 0,this.responses==null){let n=this.requests?.requestBodiesByContentType;n==null||Object.keys(n).length===0?this.pushEmptyResponseExample(void 0,void 0,void 0):Object.values(n).forEach(i=>{if(Object.keys(i.examples??{}).length===0){let a=i.schema?.example({includeOptionals:!1,override:void 0});a!=null&&this.pushEmptyResponseExample({value:a},i,void 0)}else Object.entries(i.examples??{}).forEach(([a,o])=>{this.pushEmptyResponseExample(o,i,a)})})}let t=200;this.responses?.responsesByStatusCode!=null&&(t=Number(Object.keys(this.responses.responsesByStatusCode)?.filter(n=>Number(n)>=200&&Number(n)<300)[0])),this.globalAuth!=null&&(this.auth=this.globalAuth),this.input.security!=null&&(this.auth=new Ooo({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"})),this.namespaces=[new Sns({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-group-name"})],this.namespaces?.every(n=>n.groupName==null)&&this.input.tags!=null&&(this.namespaces=this.input.tags.slice(0,1).map((n,i)=>new Sns({input:{[gUu]:n},context:this.context,accessPath:this.accessPath,pathId:["tags",`${i}`]})));let r=new XUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-sdk-method-name"});this.endpointIds=this.namespaces.map(n=>VUu({namespace:TQ(n?.groupName),path:this.path,method:this.method,sdkMethodName:r.sdkMethodName,operationId:this.input.operationId,displayName:this.displayName,isWebhook:this.isWebhook})).filter(mA),this.xFernExamplesNode=new YUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-examples"},this.path,t,this.requests?.requestBodiesByContentType,this.responses?.responsesByStatusCode?.[t]?.responses)}extractPathParameterIds(){if(this.path!=null)return this.path.split("/").map(t=>{if(t.startsWith("{")&&t.endsWith("}"))return t.slice(1,-1).trim()}).filter(mA)}convertPathToPathParts(){if(this.path===void 0)return;let t=this.path.startsWith("/")?this.path.slice(1):this.path,r=this.basePath?.convert();return(r?[r,...t.split("/")]:t.split("/")).reduce((i,a)=>(i.push({type:"literal",value:"/"}),a.startsWith("{")&&a.endsWith("}")?i.push({type:"pathParameter",value:Yj.PropertyKey(a.slice(1,-1).trim())}):i.push({type:"literal",value:a}),i),[])}convert(){if(this.path==null||this.endpointIds==null)return;let{responses:t,errors:r}=this.responses?.convert()??{responses:void 0,errors:void 0},n=this.emptyResponseExamples?.map(s=>s.convert()).filter(mA),i=B1v(this.xFernExamplesNode?.convert(),[...n??[],...t?.flatMap(s=>s.examples)??[]])?.map(s=>({...s,snippets:M1v(s.snippets,this.redocExamplesNode?.convert())}));if(this.isWebhook)return this.endpointIds.map((s,l)=>{if(!(this.method!=="POST"&&this.method!=="GET"))return{id:Yj.WebhookId(s),description:this.description,availability:this.availability?.convert(),displayName:this.displayName,operationId:this.operationId,namespace:this.namespaces?.[l]?.convert(),method:this.method,path:this.convertPathToPathParts()?.map(m=>m.value.toString())??[],queryParameters:r2i(this.queryParameters)?.flat(),headers:r2i(this.requestHeaders)?.flat(),payloads:this.requests?.convertToWebhookPayload(),examples:[this.requests?.webhookExample()].filter(mA)}}).filter(mA);let a=this.servers?.map(s=>s.convert()).filter(mA),o=this.convertPathToPathParts();if(o==null)return;let c,f=this.auth?.convert();f!=null&&(c=Object.keys(f));let u=t?.flatMap(s=>s.headers).filter(mA);return this.endpointIds.map((s,l)=>({id:Yj.EndpointId(s),description:this.description,availability:this.availability?.convert(),namespace:this.namespaces?.[l]?.convert()?.map(m=>Yj.api.v1.SubpackageId(m)),displayName:this.displayName,operationId:this.operationId,method:this.method,path:o,auth:c?.map(m=>Yj.api.latest.AuthSchemeId(m)),defaultEnvironment:a?.[0]?.id,environments:a,pathParameters:r2i(this.pathParameters)?.flat(),queryParameters:r2i(this.queryParameters)?.flat(),requestHeaders:r2i(this.requestHeaders)?.flat(),responseHeaders:u!=null&&u.length>0?u:void 0,requests:this.requests?.convert(),responses:t?.map(m=>m.response),errors:r,examples:i,snippetTemplates:void 0,protocol:{type:"rest"}}))}};var Eoo=class extends LO{description;get;post;put;patch;delete;path;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:n,isWebhook:i}){this.description=this.input.description;let a=K8i(t,this.input.servers,this.context,this.accessPath),o=Array.isArray(this.pathId)?this.pathId.join("/"):this.pathId;this.input.get!=null&&(this.get=new n2i({input:this.input.get,context:this.context,accessPath:this.accessPath,pathId:"get",servers:a,globalAuth:r,path:o,method:"GET",basePath:n,isWebhook:i})),this.input.post!=null&&(this.post=new n2i({input:this.input.post,context:this.context,accessPath:this.accessPath,pathId:"post",servers:a,globalAuth:r,path:o,method:"POST",basePath:n,isWebhook:i})),this.input.put!=null&&(this.put=new n2i({input:this.input.put,context:this.context,accessPath:this.accessPath,pathId:"put",servers:a,globalAuth:r,path:o,method:"PUT",basePath:n,isWebhook:!1})),this.input.patch!=null&&(this.patch=new n2i({input:this.input.patch,context:this.context,accessPath:this.accessPath,pathId:"patch",servers:a,globalAuth:r,path:o,method:"PATCH",basePath:n,isWebhook:!1})),this.input.delete!=null&&(this.delete=new n2i({input:this.input.delete,context:this.context,accessPath:this.accessPath,pathId:"delete",servers:a,globalAuth:r,path:o,method:"DELETE",basePath:n,isWebhook:!1}))}convert(){return[...this.get?.convert()??[],...this.post?.convert()??[],...this.put?.convert()??[],...this.patch?.convert()??[],...this.delete?.convert()??[]].filter(mA)}};function bVu(e){return"payloads"in e}var gVu=class extends LO{paths;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:n}){this.paths=Object.entries(this.input).map(([i,a])=>{if(a!=null)return new Eoo({input:a,context:this.context,accessPath:this.accessPath,pathId:i,servers:K8i(t,a.servers,this.context,this.accessPath),globalAuth:r,basePath:n,isWebhook:void 0})}).filter(mA)}convert(){if(this.paths==null)return;let t={},r={};return this.paths.forEach(n=>{let i=n.convert();i?.forEach(a=>{bVu(a)?r[Yj.WebhookId(a.id)]=a:t[Yj.EndpointId(a.id)]=a})}),{endpoints:t,webhookEndpoints:r}}};var mVu=class extends LO{globalHeaders;requiredProperties;constructor(t){super(t),this.safeParse()}parse(){let t=this.input[wjv]?.map(r=>{let{header:n,...i}=r;return(i.optional!=null&&!i.optional||JUu(i,this.context.document)?.required)&&(this.requiredProperties??=[],this.requiredProperties?.push(n)),[n,new bWr({input:i,context:this.context,accessPath:this.accessPath,pathId:this.pathId,parameterName:n})]});t!=null&&(this.globalHeaders=Object.fromEntries(t))}convert(){return Aoo(this.globalHeaders,this.requiredProperties)?.flat()}};function sEv(e,t){if(xx(e)){let r=_be(e,t,void 0);return r==null?void 0:{...r,...e}}return e}var OVu=class extends LO{webhooks;constructor(t){super(t),this.safeParse(t)}parse({servers:t,globalAuth:r,basePath:n}){this.webhooks=Object.entries(this.input??{}).map(([i,a])=>{let o=sEv(a,this.context.document);if(o!=null)return new Eoo({input:o,context:this.context,accessPath:this.accessPath,pathId:i,servers:t,globalAuth:r,basePath:n,isWebhook:!0})}).filter(mA)}convert(){return this.webhooks?.reduce((t,r)=>(r.convert()?.forEach(n=>{bVu(n)&&(t[Yj.WebhookId(n.id)]=n)}),t),{})}};var AVu=class extends LO{paths;webhooks;components;auth;globalHeaders;constructor(t){super(t),this.safeParse()}parse(){let t=K8i(void 0,this.input.servers,this.context,this.accessPath);this.input.security!=null&&(this.auth=new Ooo({input:this.input.security,context:this.context,accessPath:this.accessPath,pathId:"security"}));let r=new HUu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:this.pathId});this.input.paths==null&&this.input.webhooks==null&&this.context.errors.warning({message:"Expected 'paths' or 'webhooks' property to be specified",path:this.accessPath}),this.input.paths!=null&&(this.paths=new gVu({input:this.input.paths,context:this.context,accessPath:this.accessPath,pathId:"paths",basePath:r,servers:t,globalAuth:this.auth})),this.input.webhooks!=null&&(this.webhooks=new OVu({input:this.input.webhooks,context:this.context,accessPath:this.accessPath,pathId:"webhooks",basePath:r,servers:t,globalAuth:this.auth})),this.input.components!=null&&(this.components=new dVu({input:this.input.components,context:this.context,accessPath:this.accessPath,pathId:"components"})),this.globalHeaders=new mVu({input:this.input,context:this.context,accessPath:this.accessPath,pathId:"x-fern-global-headers"})}convert(){let t=Urt(),{webhookEndpoints:r,endpoints:n}=this.paths?.convert()??{},i={...this.webhooks?.convert()??{},...r??{}},a=mjv({endpoints:n,webhookEndpoints:i}),{types:o,auths:c}=this.components?.convert()??{};return{id:Yj.ApiDefinitionId(t),endpoints:n??{},websockets:{},webhooks:i,types:{...o,...this.context.generatedTypes},subpackages:a,auths:{...c,...this.auth?.convert()??{}},globalHeaders:this.globalHeaders?.convert(),snippetsConfiguration:void 0}}};async function NVf(e,t){if(e instanceof kVr){t.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(e instanceof S$))return;let r=new Lqr(e.absoluteFilePath),n=await $ht({context:t,specs:e.specs}),i=await r.loadDocuments({context:t,specs:n}),a;for(let o of i){if(o.type!=="openapi")continue;let c={document:o.value,logger:t.logger,errors:new vUu,generatedTypes:{}},f=new AVu({input:o.value,context:c,accessPath:[],pathId:e.workspaceName??"openapi parser"});a=BKl(a,f.convert())}return a}var wNv=$i(zVf(),1),jNv=$i(cWu(),1),ENv=require("fs/promises"),SNv=$i(require("http"),1),DNv=$i(require("path"),1);var sMv=require("events"),_Wu=$i(require("fs"),1),Gda=$i(require("path"),1);var VIv=$i(require("os"),1),WIv=300,l2i=20,kns=1e7,GIv=VIv.default.platform();var jcM=GIv==="darwin",iGf=GIv==="win32",f2i=jcM||iGf,HIv=3e3,JIv=2e4,aGf=1250;var AWr;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(AWr||(AWr={}));var Wda;(function(e){e.CHANGE="change",e.RENAME="rename"})(Wda||(Wda={}));var eis;(function(e){e.CHANGE="change",e.ERROR="error"})(eis||(eis={}));var QS;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(QS||(QS={}));var GCe;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(GCe||(GCe={}));var EcM=(e,t=1,r)=>{t=Math.max(1,t);let n=r?.leading??!1,i=r?.trailing??!0,a=Math.max(r?.maxWait??1/0,t),o,c,f=0,u=0,s=()=>{let q=Date.now(),V=q-f,$=q-u,re=V>=t||$>=a;return[q,re]},l=q=>{if(u=q,!o)return;let V=o;o=void 0,e.apply(void 0,V)},m=()=>{z(0)},O=()=>{c&&(m(),l(Date.now()))},P=q=>{if(u=q,n)return l(q)},C=q=>{if(i&&o)return l(q);o=void 0},I=()=>{c=void 0;let[q,V]=s();return V?C(q):T(q)},T=q=>{let V=q-f,$=q-u,re=t-V,Y=a-$,k=Math.min(re,Y);return z(k)},z=q=>{c&&clearTimeout(c),!(q<=0)&&(c=setTimeout(I,q))},U=(...q)=>{let[V,$]=s(),re=!!c;if(o=q,f=V,($||!c)&&z(t),$)return re?l(V):P(V)};return U.cancel=m,U.flush=O,U},lWu=EcM;var cGf=$i(require("fs"),1),dWu=$i(require("path"),1);var $4=$i(require("fs"),1),hbe=require("util");var Vwi=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},PWr=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var oGf=$i(require("process"),1),KIv=oGf.default.getuid?!oGf.default.getuid():!1,$Iv=1e4,t3e=()=>{};var tis={isChangeErrorOk:e=>{if(!tis.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!KIv&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!tis.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!tis.isNodeError(e))throw e;if(!tis.isChangeErrorOk(e))throw e}},Ree=tis;var sGf=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=$Iv,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=()=>this.remove(n),n=()=>t(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},YIv=new sGf;var Wwi=(e,t)=>function(n){return function i(...a){return YIv.schedule().then(o=>{let c=u=>(o(),u),f=u=>{if(o(),Date.now()>=n)throw u;if(t(u)){let s=Math.round(100*Math.random());return new Promise(m=>setTimeout(m,s)).then(()=>i.apply(void 0,a))}throw u};return e.apply(void 0,a).then(c,f)})}},Gwi=(e,t)=>function(n){return function i(...a){try{return e.apply(void 0,a)}catch(o){if(Date.now()>n)throw o;if(t(o))return i.apply(void 0,a);throw o}}};var ScM={attempt:{chmod:Vwi((0,hbe.promisify)($4.default.chmod),Ree.onChangeError),chown:Vwi((0,hbe.promisify)($4.default.chown),Ree.onChangeError),close:Vwi((0,hbe.promisify)($4.default.close),t3e),fsync:Vwi((0,hbe.promisify)($4.default.fsync),t3e),mkdir:Vwi((0,hbe.promisify)($4.default.mkdir),t3e),realpath:Vwi((0,hbe.promisify)($4.default.realpath),t3e),stat:Vwi((0,hbe.promisify)($4.default.stat),t3e),unlink:Vwi((0,hbe.promisify)($4.default.unlink),t3e),chmodSync:PWr($4.default.chmodSync,Ree.onChangeError),chownSync:PWr($4.default.chownSync,Ree.onChangeError),closeSync:PWr($4.default.closeSync,t3e),existsSync:PWr($4.default.existsSync,t3e),fsyncSync:PWr($4.default.fsync,t3e),mkdirSync:PWr($4.default.mkdirSync,t3e),realpathSync:PWr($4.default.realpathSync,t3e),statSync:PWr($4.default.statSync,t3e),unlinkSync:PWr($4.default.unlinkSync,t3e)},retry:{close:Wwi((0,hbe.promisify)($4.default.close),Ree.isRetriableError),fsync:Wwi((0,hbe.promisify)($4.default.fsync),Ree.isRetriableError),open:Wwi((0,hbe.promisify)($4.default.open),Ree.isRetriableError),readFile:Wwi((0,hbe.promisify)($4.default.readFile),Ree.isRetriableError),rename:Wwi((0,hbe.promisify)($4.default.rename),Ree.isRetriableError),stat:Wwi((0,hbe.promisify)($4.default.stat),Ree.isRetriableError),write:Wwi((0,hbe.promisify)($4.default.write),Ree.isRetriableError),writeFile:Wwi((0,hbe.promisify)($4.default.writeFile),Ree.isRetriableError),closeSync:Gwi($4.default.closeSync,Ree.isRetriableError),fsyncSync:Gwi($4.default.fsyncSync,Ree.isRetriableError),openSync:Gwi($4.default.openSync,Ree.isRetriableError),readFileSync:Gwi($4.default.readFileSync,Ree.isRetriableError),renameSync:Gwi($4.default.renameSync,Ree.isRetriableError),statSync:Gwi($4.default.statSync,Ree.isRetriableError),writeSync:Gwi($4.default.writeSync,Ree.isRetriableError),writeFileSync:Gwi($4.default.writeFileSync,Ree.isRetriableError)}},XIv=ScM;var fWu=$i(require("fs"),1),ris=$i(require("path"),1);var uGf=()=>{};var DcM=()=>{let e=uGf,t=uGf,r=!1,n=!1;return{promise:new Promise((f,u)=>{e=s=>(r=!0,f(s)),t=s=>(n=!0,u(s))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},ZIv=DcM;var CcM=()=>{let{promise:e,resolve:t,isPending:r}=ZIv(),n=0,i=()=>{n+=1},a=()=>{n-=1,!n&&t()};return(()=>{i(),queueMicrotask(a)})(),{promise:e,isPending:r,increment:i,decrement:a}},kIv=CcM;var eMv={then:e=>{e()}};var tMv=e=>Array.isArray(e)?e:[e],rMv=e=>typeof e=="function";var IcM=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,a=t?.ignore??[],o=tMv(a).map(xe=>rMv(xe)?xe:Be=>xe.test(Be)),c=xe=>o.some(Be=>Be(xe)),f=t?.signal??{aborted:!1},u=t?.onDirents||(()=>{}),s=[],l=new Set,m={},O=[],P=new Set,C={},I=[],T=new Set,z={},U={},q=new Set,V={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},$={directories:s,directoriesNames:l,directoriesNamesToPaths:m,files:O,filesNames:P,filesNamesToPaths:C,symlinks:I,symlinksNames:T,symlinksNamesToPaths:z,map:U},{promise:re,increment:Y,decrement:k}=kIv(),ne=0,me=(xe,Be,Jt,pt)=>{q.has(Be)||ne>=i||(ne+=1,xe.directories.push(Be),xe.directoriesNames.add(Jt),s.push(Be),l.add(Jt),m.propertyIsEnumerable(Jt)||(m[Jt]=[]),m[Jt].push(Be),q.add(Be),!(pt>=n)&&(ne>=i||Ee(Be,pt+1)))},_e=(xe,Be,Jt)=>{q.has(Be)||ne>=i||(ne+=1,xe.files.push(Be),xe.filesNames.add(Jt),O.push(Be),P.add(Jt),C.propertyIsEnumerable(Jt)||(C[Jt]=[]),C[Jt].push(Be),q.add(Be))},ve=(xe,Be,Jt,pt)=>{q.has(Be)||ne>=i||(ne+=1,xe.symlinks.push(Be),xe.symlinksNames.add(Jt),I.push(Be),T.add(Jt),z.propertyIsEnumerable(Jt)||(z[Jt]=[]),z[Jt].push(Be),q.add(Be),r&&(pt>=n||ne>=i||Ot(Be,pt+1)))},pe=(xe,Be,Jt,pt,vr)=>{f.aborted||c(Be)||(pt.isDirectory()?me(xe,Be,Jt,vr):pt.isFile()?_e(xe,Be,Jt):pt.isSymbolicLink()&&ve(xe,Be,Jt,vr))},De=(xe,Be,Jt,pt)=>{if(f.aborted)return;let vr=Be===ris.default.sep?"":ris.default.sep,Gt=Jt.name,Xe=`${Be}${vr}${Gt}`;c(Xe)||(Jt.isDirectory()?me(xe,Xe,Gt,pt):Jt.isFile()?_e(xe,Xe,Gt):Jt.isSymbolicLink()&&ve(xe,Xe,Gt,pt))},Ce=(xe,Be,Jt,pt)=>{for(let vr=0,Gt=Jt.length;vr<Gt;vr++)De(xe,Be,Jt[vr],pt)},Ee=(xe,Be)=>{f.aborted||Be>n||ne>=i||(Y(),fWu.default.readdir(xe,{withFileTypes:!0},(Jt,pt)=>{if(Jt||f.aborted||!pt.length)return k();(u(pt)||eMv).then(()=>{let Gt=U[xe]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};Ce(Gt,xe,pt,Be),k()})}))},Ot=(xe,Be)=>{Y(),fWu.default.realpath(xe,(Jt,pt)=>{if(Jt||f.aborted)return k();fWu.default.stat(pt,(vr,Gt)=>{if(vr||f.aborted)return k();let Xe=ris.default.basename(pt),dt=U[xe]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};pe(dt,pt,Xe,Gt,Be),k()})})};return(async(xe,Be=1)=>(xe=ris.default.normalize(xe),q.add(xe),Ee(xe,Be),await re,f.aborted?V:$))(e)},nMv=IcM;var wWr={lang:{debounce:lWu,attempt:e=>{try{return e()}catch(t){return wWr.lang.castError(t)}},castArray:e=>wWr.lang.isArray(e)?e:[e],castError:e=>wWr.lang.isError(e)?e:wWr.lang.isString(e)?new Error(e):new Error("Unknown error"),defer:e=>setTimeout(e,0),isArray:e=>Array.isArray(e),isError:e=>e instanceof Error,isFunction:e=>typeof e=="function",isNaN:e=>Number.isNaN(e),isNumber:e=>typeof e=="number",isPrimitive:e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},isShallowEqual:(e,t)=>{if(e===t)return!0;if(wWr.lang.isNaN(e))return wWr.lang.isNaN(t);if(wWr.lang.isPrimitive(e)||wWr.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},isSet:e=>e instanceof Set,isString:e=>typeof e=="string",isUndefined:e=>e===void 0,noop:()=>{},uniq:e=>e.length<2?e:Array.from(new Set(e))},fs:{getDepth:e=>Math.max(0,e.split(dWu.default.sep).length-1),getRealPath:(e,t)=>{try{return t?cGf.default.realpathSync.native(e):cGf.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===dWu.default.sep&&t.length-e.length>dWu.default.sep.length,poll:(e,t=JIv)=>XIv.retry.stat(t)(e,{bigint:!0}).catch(wWr.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,a)=>{if(a&&r===1&&e in a){let o=a[e];return[o.directories,o.files]}else{let o=await nMv(e,{depth:r,limit:n,ignore:t,signal:i});return[o.directories,o.files]}}}},gB=wWr;var pWu=$i(require("path"),1);var lGf=class{constructor(t,r,n){this.base=n,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||gB.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=WIv){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,a=async(c,f)=>{let u=this.options.ignoreInitial?[]:c,s=await this.eventsPopulate([...f]),l=this.eventsDeduplicate([...u,...s]);this.onTargetEvents(l)},o=gB.lang.debounce(()=>{this.watcher.isClosed()||(r=a(n,i),n=[],i=new Set)},t);return async(c,f="",u=!1)=>{u?await this.eventsPopulate([f],n,!0):i.add(f),r.then(o)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[a,o]=i,c=r[o];return a===c||a===QS.CHANGE&&c===QS.ADD||(r[o]=a,n.push(i)),n},[])}async eventsPopulate(t,r=[],n=!1){return await Promise.all(t.map(async i=>{let a=await this.watcher._poller.update(i,this.options.pollingTimeout);await Promise.all(a.map(async o=>{r.push([o,i]),o===QS.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):o===QS.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,i,r,n)}))})),r}async eventsPopulateAddDir(t,r,n=[],i=!1){if(i)return n;let a=this.options.recursive?this.options.depth??l2i:Math.min(1,this.options.depth??l2i),o=this.options.limit??kns,[c,f]=await gB.fs.readdir(r,this.options.ignore,a,o,this.watcher._closeSignal),u=[...c,...f];return await Promise.all(u.map(s=>{if(!this.watcher.isIgnored(s,this.options.ignore)&&!t.includes(s))return this.eventsPopulate([s],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let a of this.watcher._poller.stats.keys())gB.fs.isSubPath(r,a)&&(t.includes(a)||await this.eventsPopulate([a],n,!0));return n}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(QS.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!f2i&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(QS.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(QS.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(pWu.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(QS.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(pWu.default.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(QS.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===QS.ADD?this.onTargetAdd(n):r===QS.ADD_DIR?this.onTargetAddDir(n):r===QS.CHANGE?this.onTargetChange(n):r===QS.UNLINK?this.onTargetUnlink(n):r===QS.UNLINK_DIR&&this.onTargetUnlinkDir(n)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,n=!1){return this.handlerBatched(t,r,n)}onWatcherChange(t=Wda.CHANGE,r){if(this.watcher.isClosed())return;let n=pWu.default.resolve(this.folderPath,r||"");this.filePath&&n!==this.folderPath&&n!==this.filePath||this.watcher.isIgnored(n,this.options.ignore)||this.onWatcherEvent(t,n)}onWatcherError(t){iGf&&t.code==="EPERM"?this.onWatcherChange(Wda.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(eis.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(eis.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(Wda.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&f2i&&this.options.native!==!1?this.options.depth??l2i:Math.min(1,this.options.depth??l2i),n=this.options.limit??kns,[i,a]=await gB.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),o=[this.folderPath,...i,...a];await Promise.all(o.map(c=>{if(!this.watcher._poller.stats.has(c)&&!this.watcher.isIgnored(c,this.options.ignore))return this.onWatcherEvent(Wda.CHANGE,c,t)}))}}},iMv=lGf;var HCe={interval:100,intervalId:void 0,fns:new Map,init:()=>{HCe.intervalId||(HCe.intervalId=setInterval(HCe.resolve,HCe.interval))},reset:()=>{HCe.intervalId&&(clearInterval(HCe.intervalId),delete HCe.intervalId)},add:(e,t)=>{HCe.fns.set(e,Date.now()+t),HCe.init()},remove:e=>{HCe.fns.delete(e)},resolve:()=>{if(!HCe.fns.size)return HCe.reset();let e=Date.now();for(let[t,r]of HCe.fns)r>=e||(HCe.remove(t),t())}},nis=HCe;var iis=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=aGf){let{ino:n,targetPath:i,events:a,locks:o}=t,c=()=>{let l=this._watcher._poller.paths.find(n||-1,m=>m!==i);if(l&&l!==i){if(gB.fs.getRealPath(i,!0)===l)return;this._watcher.event(a.rename,l,i)}else this._watcher.event(a.add,i)};if(!n)return c();let f=()=>{o.add.delete(n),nis.remove(u)},u=()=>{f(),c()};nis.add(u,r);let s=()=>{let l=o.unlink.get(n);if(!l)return;f();let m=l();i===m?a.change&&this._watcher._poller.stats.has(i)&&this._watcher.event(a.change,i):this._watcher.event(a.rename,m,i)};o.add.set(n,s),s()}getLockUnlink(t,r=aGf){let{ino:n,targetPath:i,events:a,locks:o}=t,c=()=>{this._watcher.event(a.unlink,i)};if(!n)return c();let f=()=>{o.unlink.delete(n),nis.remove(u)},u=()=>{f(),c()};nis.add(u,r);let s=()=>(f(),i);o.unlink.set(n,s),o.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,QS.ADD,AWr.FILE);return this.getLockAdd({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let n=this._watcher._poller.getIno(t,QS.ADD_DIR,AWr.DIR);return this.getLockAdd({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let n=this._watcher._poller.getIno(t,QS.UNLINK,AWr.FILE);return this.getLockUnlink({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let n=this._watcher._poller.getIno(t,QS.UNLINK_DIR,AWr.DIR);return this.getLockUnlink({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};iis.DIR_EVENTS={add:QS.ADD_DIR,rename:QS.RENAME_DIR,unlink:QS.UNLINK_DIR};iis.FILE_EVENTS={add:QS.ADD,change:QS.CHANGE,rename:QS.RENAME,unlink:QS.UNLINK};var aMv=iis;var fGf=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(gB.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(gB.lang.isSet(n)){let i=n.delete(r);return n.size||this.map.delete(t),i}else if(n===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let n=this.map.get(t);if(gB.lang.isSet(n))return Array.from(n).find(r);if(r(n))return n}}get(t){return this.map.get(t)}has(t,r){if(gB.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return gB.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);gB.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},dGf=fGf;var pGf=class{constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},oMv=pGf;var _Gf=class{constructor(){this.inos={},this.paths=new dGf,this.stats=new Map}getIno(t,r,n){let i=this.inos[r];if(!i)return;let a=i[t];if(a&&!(n&&a[1]!==n))return a[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let n=await gB.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new oMv(n)}reset(){this.inos={},this.paths=new dGf,this.stats=new Map}async update(t,r){let n=this.getStats(t),i=await this.poll(t,r);if(this.updateStats(t,i),!n&&i){if(i.isFile())return this.updateIno(t,QS.ADD,i),[QS.ADD];if(i.isDirectory())return this.updateIno(t,QS.ADD_DIR,i),[QS.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,QS.UNLINK,n),[QS.UNLINK];if(n.isDirectory())return this.updateIno(t,QS.UNLINK_DIR,n),[QS.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,QS.CHANGE,i),[QS.CHANGE]);if(i.isDirectory())return this.updateIno(t,QS.UNLINK,n),this.updateIno(t,QS.ADD_DIR,i),[QS.UNLINK,QS.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,QS.UNLINK_DIR,n),this.updateIno(t,QS.ADD,i),[QS.UNLINK_DIR,QS.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,QS.UNLINK_DIR,n),this.updateIno(t,QS.ADD_DIR,i),[QS.UNLINK_DIR,QS.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),a=n.isFile()?AWr.FILE:AWr.DIR;i[t]=[n.ino,a]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let n=this.stats.get(t)?.ino||-1;this.paths.delete(n,t),this.stats.delete(t)}}},hGf=_Gf;var yGf=class e extends sMv.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(GCe.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on(GCe.CLOSE,i)),this._readyWait=new Promise(i=>this.on(GCe.READY,i)),this._locker=new aMv(this),this._roots=new Set,this._poller=new hGf,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,n)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(gB.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit(GCe.CLOSE))}error(t){if(this.isClosed())return!1;let r=gB.lang.castError(t);return this.emit(GCe.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit(GCe.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(GCe.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&gB.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&gB.lang.isShallowEqual(n.options,r))return!0;return!1}watchersClose(t,r,n=!0){if(t){let i=this._watchers[t];if(i)for(let a of[...i])r&&a.filePath!==r||this.watcherClose(a);if(n)for(let a in this._watchers)gB.fs.isSubPath(t,a)&&this.watchersClose(a,r,!1)}else for(let i in this._watchers)this.watchersClose(i,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,n]of t)this.watchPath(r,n.options,n.handler)}async watcherAdd(t,r){let{folderPath:n}=t;(this._watchers[n]=this._watchers[n]||[]).push(t);let a=new iMv(this,t,r);return await a.init(),a}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let a=r.indexOf(t);r.splice(a,1),r.length||delete this._watchers[t.folderPath]}let n=t.filePath||t.folderPath;this._roots.has(n)&&(this._watchersRestorable[n]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=gB.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(c=>c.handler===n&&(!c.filePath||c.filePath===i)&&c.options.ignore===r.ignore&&!!c.options.native==!!r.native&&(!r.recursive||c.options.recursive)))return!0;let o=Gda.default.dirname(t);for(let c=1;c<1/0;c++){if(this._watchers[o]?.find(s=>(c===1||s.options.recursive&&c<=(s.options.depth??l2i))&&s.handler===n&&(!s.filePath||s.filePath===i)&&s.options.ignore===r.ignore&&!!s.options.native==!!r.native&&(!r.recursive||s.options.recursive&&f2i&&s.options.native!==!1)))return!0;if(!f2i)break;let u=Gda.default.dirname(t);if(o===u)break;o=u}return!1}async watchDirectories(t,r,n,i,a){if(this.isClosed())return;t=gB.lang.uniq(t).sort();let o;for(let c of t)if(!this.isIgnored(c,r.ignore)&&!this.watcherExists(c,r,n,i))try{let f=!r.recursive||f2i&&r.native!==!1?r:{...r,recursive:!1},s={watcher:_Wu.default.watch(c,f),handler:n,options:r,folderPath:c,filePath:i},l=o=await this.watcherAdd(s,a);if(this._roots.has(i||c)){let O={...r,ignoreInitial:!0,recursive:!1},P=Gda.default.dirname(c),C=c;await this.watchDirectories([P],O,n,C,l)}}catch(f){this.error(f)}return o}async watchDirectory(t,r,n,i,a){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||f2i&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,a));{r={...r,recursive:!0};let o=r.depth??l2i,c=r.limit??kns,[f]=await gB.fs.readdir(t,r.ignore,o,c,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let u=await this.watchDirectories([t],r,n,i,a);if(f.length){let s=gB.fs.getDepth(t);for(let l of f){let m=gB.fs.getDepth(l),O=Math.max(0,o-(m-s)),P={...r,depth:O};await this.watchDirectories([l],P,n,i,a||u)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},a=(u,s)=>{s===t&&(f(),n())},o=new e(a),c=()=>{this._subwatchers.add(i),this.on(GCe.CLOSE,f),o.watchFile(t,r,a)},f=()=>{this._subwatchers.delete(i),this.removeListener(GCe.CLOSE,f),o.close()};return c()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=Gda.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,a=new hGf,o=await this.watchPolling(t,r,async()=>{i||!(await a.update(t,r.pollingTimeout)).length||i||(i=!0,o(),n())})}async watchPolling(t,r,n){if(this.isClosed())return gB.lang.noop;if(this.pollerExists(t,r))return gB.lang.noop;let i={...r,interval:r.pollingInterval??HIv},a={targetPath:t,options:r},o=()=>{this._pollers.add(a),this.on(GCe.CLOSE,c),_Wu.default.watchFile(t,i,n)},c=()=>{this._pollers.delete(a),this.removeListener(GCe.CLOSE,c),_Wu.default.unwatchFile(t,n)};return gB.lang.attempt(o),()=>gB.lang.attempt(c)}async watchUnknownChild(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchFileOnce(t,r,i)}async watchUnknownTarget(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchPollingOnce(t,r,i)}async watchPaths(t,r,n){if(this.isClosed())return;if(t=gB.lang.uniq(t).sort(),t.every((a,o)=>t.every((c,f)=>f===o||!gB.fs.isSubPath(a,c))))await Promise.all(t.map(a=>this.watchPath(a,r,n)));else for(let a of t)await this.watchPath(a,r,n)}async watchPath(t,r,n){if(this.isClosed()||(t=Gda.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await gB.fs.poll(t,r.pollingTimeout);if(i){if(i.isFile())return this.watchFile(t,r,n);if(i.isDirectory())return this.watchDirectory(t,r,n);this.error(`"${t}" is not supported`)}else{let a=Gda.default.dirname(t);return(await gB.fs.poll(a,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=gB.lang.noop){if(gB.lang.isFunction(t))return this.watch([],{},t);if(gB.lang.isUndefined(t))return this.watch([],r,n);if(gB.lang.isFunction(r))return this.watch(t,{},r);if(gB.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=gB.lang.castArray(t);i.forEach(a=>this._roots.add(a)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==gB.lang.noop&&this.on(GCe.ALL,n),r.readdirMap=void 0,this.ready())}},hWu=yGf;squ();var oNv=$i(rGu(),1),r3e=require("fs/promises"),sNv=require("os"),uNv=$i(NDe(),1),cNv=$i(aNv(),1),gGu=process.platform==="win32",upM="etag",cpM="preview",lpM="app-preview",fpM="bundle",dpM=".next",ppM="standalone",_pM=".fern",hpM="packages/fern-docs/bundle/.next/server/instrumentation.js",ypM=".npmrc",vpM=".pnpmfile.cjs",bpM="pnpm-workspace.yaml",gpM='Cannot find matching keyid: {"signatures":';function mpM(){return Ql(F_.of((0,sNv.homedir)()),ru.of(_pM))}function mGu({app:e=!1}){return Ql(mpM(),ru.of(e?lpM:cpM))}function m2i({app:e=!1}){return Ql(mGu({app:e}),ru.of(e?dpM:fpM))}function Dis({app:e=!1}){return Ql(m2i({app:e}),ru.of(ppM))}function OpM({app:e=!1}){return Ql(Dis({app:e}),ru.of(hpM))}function ApM({app:e=!1}){return Ql(Dis({app:e}),ru.of(bpM))}function PpM({app:e=!1}){return Ql(Dis({app:e}),ru.of(vpM))}function wpM({app:e=!1}){return Ql(Dis({app:e}),ru.of(ypM))}function Xda(e){return new Error(`${e}. Please reach out to support@buildwithfern.com.`)}function jpM({app:e=!1}){return Ql(mGu({app:e}),ru.of(upM))}var EpM=`module.exports = {
3033
3033
  hooks: {
3034
3034
  readPackage(pkg) {
3035
3035
  // Remove all workspace:* dependencies