fern-api 4.39.0 → 4.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +6 -6
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1457,7 +1457,7 @@ ${o}`;break;case"retry":Urc(o)&&(r[i]=o);break;case"id":zrc(o)&&(r[i]=o);break;c
1457
1457
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let c=e.external.registry.get(s[0])?.id;if(t!==s[0]&&c){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}}function tpe(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s=>{let a=e.seen.get(s);if(a.ref===null)return;let u=a.def??a.schema,c={...u},l=a.ref;if(a.ref=null,l){n(l);let d=e.seen.get(l),f=d.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):Object.assign(u,f),Object.assign(u,c),s._zod.parent===l)for(let h in u)h==="$ref"||h==="allOf"||h in c||delete u[h];if(f.$ref&&d.def)for(let h in u)h==="$ref"||h==="allOf"||h in d.def&&JSON.stringify(u[h])===JSON.stringify(d.def[h])&&delete u[h]}let p=s._zod.parent;if(p&&p!==l){n(p);let d=e.seen.get(p);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(let f in u)f==="$ref"||f==="allOf"||f in d.def&&JSON.stringify(u[f])===JSON.stringify(d.def[f])&&delete u[f]}e.override({zodSchema:s,jsonSchema:u,path:a.path??[]})};for(let s of[...e.seen.entries()].reverse())n(s[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(s)}Object.assign(i,r.def??r.schema);let o=e.external?.defs??{};for(let s of e.seen.entries()){let a=s[1];a.def&&a.defId&&(o[a.defId]=a.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let s=JSON.parse(JSON.stringify(i));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:Y4e(t,"input",e.processors),output:Y4e(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function ZO(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ZO(n.element,r);if(n.type==="set")return ZO(n.valueType,r);if(n.type==="lazy")return ZO(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return ZO(n.innerType,r);if(n.type==="intersection")return ZO(n.left,r)||ZO(n.right,r);if(n.type==="record"||n.type==="map")return ZO(n.keyType,r)||ZO(n.valueType,r);if(n.type==="pipe")return ZO(n.in,r)||ZO(n.out,r);if(n.type==="object"){for(let i in n.shape)if(ZO(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(ZO(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(ZO(i,r))return!0;return!!(n.rest&&ZO(n.rest,r))}return!1}var O7n=(e,t={})=>r=>{let n=Zle({...r,processors:t});return lm(e,n),epe(n,e),tpe(n,e)},Y4e=(e,t,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},s=Zle({...i??{},target:o,io:t,processors:r});return lm(e,s),epe(s,e),tpe(s,e)};var nFc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},P7n=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:s,format:a,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=nFc[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),c&&(i.contentEncoding=c),u&&u.size>0){let l=[...u];l.length===1?i.pattern=l[0].source:l.length>1&&(i.allOf=[...l.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},T7n=(e,t,r,n)=>{let i=r,{minimum:o,maximum:s,format:a,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l),typeof o=="number"&&(i.minimum=o,typeof l=="number"&&t.target!=="draft-04"&&(l>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof c=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c),typeof s=="number"&&(i.maximum=s,typeof c=="number"&&t.target!=="draft-04"&&(c<=s?delete i.maximum:delete i.exclusiveMaximum)),typeof u=="number"&&(i.multipleOf=u)},D7n=(e,t,r,n)=>{r.type="boolean"},R7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},F7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},k7n=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Q7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},N7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},j7n=(e,t,r,n)=>{r.not={}},M7n=(e,t,r,n)=>{},L7n=(e,t,r,n)=>{},U7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},z7n=(e,t,r,n)=>{let i=e._zod.def,o=Vdt(i.entries);o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},V7n=(e,t,r,n)=>{let i=e._zod.def,o=[];for(let s of i.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},q7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},G7n=(e,t,r,n)=>{let i=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},W7n=(e,t,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:u}=e._zod.bag;s!==void 0&&(o.minLength=s),a!==void 0&&(o.maxLength=a),u?u.length===1?(o.contentMediaType=u[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=u.map(c=>({contentMediaType:c}))):Object.assign(i,o)},$7n=(e,t,r,n)=>{r.type="boolean"},H7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},K7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},J7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Y7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},X7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Z7n=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=lm(o.element,t,{...n,path:[...n.path,"items"]})},eWn=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object",i.properties={};let s=o.shape;for(let c in s)i.properties[c]=lm(s[c],t,{...n,path:[...n.path,"properties",c]});let a=new Set(Object.keys(s)),u=new Set([...a].filter(c=>{let l=o.shape[c]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));u.size>0&&(i.required=Array.from(u)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=lm(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},V9t=(e,t,r,n)=>{let i=e._zod.def,o=i.inclusive===!1,s=i.options.map((a,u)=>lm(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",u]}));o?r.oneOf=s:r.anyOf=s},tWn=(e,t,r,n)=>{let i=e._zod.def,o=lm(i.left,t,{...n,path:[...n.path,"allOf",0]}),s=lm(i.right,t,{...n,path:[...n.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,u=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=u},rWn=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=o.items.map((d,f)=>lm(d,t,{...n,path:[...n.path,s,f]})),c=o.rest?lm(o.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=u,c&&(i.items=c)):t.target==="openapi-3.0"?(i.items={anyOf:u},c&&i.items.anyOf.push(c),i.minItems=u.length,c||(i.maxItems=u.length)):(i.items=u,c&&(i.additionalItems=c));let{minimum:l,maximum:p}=e._zod.bag;typeof l=="number"&&(i.minItems=l),typeof p=="number"&&(i.maxItems=p)},nWn=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object";let s=o.keyType,u=s._zod.bag?.patterns;if(o.mode==="loose"&&u&&u.size>0){let l=lm(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let p of u)i.patternProperties[p.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=lm(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=lm(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let c=s._zod.values;if(c){let l=[...c].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(i.required=l)}},iWn=(e,t,r,n)=>{let i=e._zod.def,o=lm(i.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},oWn=(e,t,r,n)=>{let i=e._zod.def;lm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},sWn=(e,t,r,n)=>{let i=e._zod.def;lm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},aWn=(e,t,r,n)=>{let i=e._zod.def;lm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},uWn=(e,t,r,n)=>{let i=e._zod.def;lm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},cWn=(e,t,r,n)=>{let i=e._zod.def,o=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;lm(o,t,n);let s=t.seen.get(e);s.ref=o},lWn=(e,t,r,n)=>{let i=e._zod.def;lm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.readOnly=!0},pWn=(e,t,r,n)=>{let i=e._zod.def;lm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},q9t=(e,t,r,n)=>{let i=e._zod.def;lm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},fWn=(e,t,r,n)=>{let i=e._zod.innerType;lm(i,t,n);let o=t.seen.get(e);o.ref=i},z9t={string:P7n,number:T7n,boolean:D7n,bigint:R7n,symbol:F7n,null:k7n,undefined:Q7n,void:N7n,never:j7n,any:M7n,unknown:L7n,date:U7n,enum:z7n,literal:V7n,nan:q7n,template_literal:G7n,file:W7n,success:$7n,custom:H7n,function:K7n,transform:J7n,map:Y7n,set:X7n,array:Z7n,object:eWn,union:V9t,intersection:tWn,tuple:rWn,record:nWn,nullable:iWn,nonoptional:oWn,default:sWn,prefault:aWn,catch:uWn,pipe:cWn,readonly:lWn,promise:pWn,optional:q9t,lazy:fWn};function G9t(e,t){if("_idmap"in e){let n=e,i=Zle({...t,processors:z9t}),o={};for(let u of n._idmap.entries()){let[c,l]=u;lm(l,i)}let s={},a={registry:n,uri:t?.uri,defs:o};i.external=a;for(let u of n._idmap.entries()){let[c,l]=u;epe(i,l),s[c]=tpe(i,l)}if(Object.keys(o).length>0){let u=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[u]:o}}return{schemas:s}}let r=Zle({...t,processors:z9t});return lm(e,r),epe(r,e),tpe(r,e)}var W9t=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Zle({processors:z9t,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return lm(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),epe(this.ctx,t);let n=tpe(this.ctx,t),{"~standard":i,...o}=n;return o}};var mGo={};var amt={};X(amt,{ZodAny:()=>QWn,ZodArray:()=>LWn,ZodBase64:()=>dGt,ZodBase64URL:()=>mGt,ZodBigInt:()=>iLe,ZodBigIntFormat:()=>AGt,ZodBoolean:()=>nLe,ZodCIDRv4:()=>pGt,ZodCIDRv6:()=>fGt,ZodCUID:()=>iGt,ZodCUID2:()=>oGt,ZodCatch:()=>u$n,ZodCodec:()=>xGt,ZodCustom:()=>ymt,ZodCustomStringFormat:()=>tLe,ZodDate:()=>dmt,ZodDefault:()=>r$n,ZodDiscriminatedUnion:()=>zWn,ZodE164:()=>hGt,ZodEmail:()=>tGt,ZodEmoji:()=>rGt,ZodEnum:()=>Z4e,ZodExactOptional:()=>ZWn,ZodFile:()=>YWn,ZodFunction:()=>A$n,ZodGUID:()=>umt,ZodIPv4:()=>cGt,ZodIPv6:()=>lGt,ZodIntersection:()=>VWn,ZodJWT:()=>gGt,ZodKSUID:()=>uGt,ZodLazy:()=>m$n,ZodLiteral:()=>JWn,ZodMAC:()=>OWn,ZodMap:()=>HWn,ZodNaN:()=>l$n,ZodNanoID:()=>nGt,ZodNever:()=>jWn,ZodNonOptional:()=>wGt,ZodNull:()=>FWn,ZodNullable:()=>t$n,ZodNumber:()=>rLe,ZodNumberFormat:()=>c_e,ZodObject:()=>hmt,ZodOptional:()=>IGt,ZodPipe:()=>CGt,ZodPrefault:()=>i$n,ZodPromise:()=>g$n,ZodReadonly:()=>p$n,ZodRecord:()=>Amt,ZodSet:()=>KWn,ZodString:()=>eLe,ZodStringFormat:()=>wh,ZodSuccess:()=>a$n,ZodSymbol:()=>DWn,ZodTemplateLiteral:()=>d$n,ZodTransform:()=>XWn,ZodTuple:()=>GWn,ZodType:()=>ml,ZodULID:()=>sGt,ZodURL:()=>fmt,ZodUUID:()=>q9,ZodUndefined:()=>RWn,ZodUnion:()=>gmt,ZodUnknown:()=>NWn,ZodVoid:()=>MWn,ZodXID:()=>aGt,ZodXor:()=>UWn,_ZodString:()=>eGt,_default:()=>n$n,_function:()=>v7o,any:()=>ZGo,array:()=>mmt,base64:()=>QGo,base64url:()=>NGo,bigint:()=>HGo,boolean:()=>TWn,catch:()=>c$n,check:()=>I7o,cidrv4:()=>FGo,cidrv6:()=>kGo,codec:()=>y7o,cuid:()=>_Go,cuid2:()=>SGo,custom:()=>w7o,date:()=>t7o,describe:()=>C7o,discriminatedUnion:()=>a7o,e164:()=>jGo,email:()=>gGo,emoji:()=>CGo,enum:()=>EGt,exactOptional:()=>e$n,file:()=>m7o,float32:()=>qGo,float64:()=>GGo,function:()=>v7o,guid:()=>AGo,hash:()=>VGo,hex:()=>zGo,hostname:()=>UGo,httpUrl:()=>wGo,instanceof:()=>_7o,int:()=>Z9t,int32:()=>WGo,int64:()=>KGo,intersection:()=>qWn,ipv4:()=>TGo,ipv6:()=>RGo,json:()=>B7o,jwt:()=>MGo,keyof:()=>r7o,ksuid:()=>PGo,lazy:()=>h$n,literal:()=>d7o,looseObject:()=>o7o,looseRecord:()=>c7o,mac:()=>DGo,map:()=>l7o,meta:()=>x7o,nan:()=>A7o,nanoid:()=>xGo,nativeEnum:()=>f7o,never:()=>yGt,nonoptional:()=>s$n,null:()=>kWn,nullable:()=>lmt,nullish:()=>h7o,number:()=>PWn,object:()=>n7o,optional:()=>cmt,partialRecord:()=>u7o,pipe:()=>pmt,prefault:()=>o$n,preprocess:()=>O7o,promise:()=>E7o,readonly:()=>f$n,record:()=>$Wn,refine:()=>y$n,set:()=>p7o,strictObject:()=>i7o,string:()=>X9t,stringFormat:()=>LGo,stringbool:()=>S7o,success:()=>g7o,superRefine:()=>b$n,symbol:()=>YGo,templateLiteral:()=>b7o,transform:()=>vGt,tuple:()=>WWn,uint32:()=>$Go,uint64:()=>JGo,ulid:()=>BGo,undefined:()=>XGo,union:()=>bGt,unknown:()=>u_e,url:()=>IGo,uuid:()=>yGo,uuidv4:()=>bGo,uuidv6:()=>EGo,uuidv7:()=>vGo,void:()=>e7o,xid:()=>OGo,xor:()=>s7o});var $9t={};X($9t,{endsWith:()=>V4e,gt:()=>z9,gte:()=>XO,includes:()=>U4e,length:()=>a_e,lowercase:()=>M4e,lt:()=>U9,lte:()=>nQ,maxLength:()=>s_e,maxSize:()=>Xle,mime:()=>q4e,minLength:()=>Yre,minSize:()=>V9,multipleOf:()=>Yle,negative:()=>j9t,nonnegative:()=>L9t,nonpositive:()=>M9t,normalize:()=>G4e,overwrite:()=>Z5,positive:()=>N9t,property:()=>U9t,regex:()=>j4e,size:()=>o_e,slugify:()=>K4e,startsWith:()=>z4e,toLowerCase:()=>$4e,toUpperCase:()=>H4e,trim:()=>W4e,uppercase:()=>L4e});var X4e={};X(X4e,{ZodISODate:()=>K9t,ZodISODateTime:()=>H9t,ZodISODuration:()=>Y9t,ZodISOTime:()=>J9t,date:()=>mWn,datetime:()=>dWn,duration:()=>gWn,time:()=>hWn});var H9t=nr("ZodISODateTime",(e,t)=>{q9n.init(e,t),wh.init(e,t)});function dWn(e){return HGn(H9t,e)}var K9t=nr("ZodISODate",(e,t)=>{G9n.init(e,t),wh.init(e,t)});function mWn(e){return KGn(K9t,e)}var J9t=nr("ZodISOTime",(e,t)=>{W9n.init(e,t),wh.init(e,t)});function hWn(e){return JGn(J9t,e)}var Y9t=nr("ZodISODuration",(e,t)=>{$9n.init(e,t),wh.init(e,t)});function gWn(e){return YGn(Y9t,e)}var hGo=(e,t)=>{Hdt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Jdt(e,r)},flatten:{value:r=>Kdt(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,O4e,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,O4e,2)}},isEmpty:{get(){return e.issues.length===0}}})},oFc=nr("ZodError",hGo),$D=nr("ZodError",hGo,{Parent:Error});var AWn=D4e($D),yWn=R4e($D),bWn=F4e($D),EWn=k4e($D),vWn=Gqt($D),IWn=Wqt($D),wWn=$qt($D),CWn=Hqt($D),xWn=Kqt($D),_Wn=Jqt($D),SWn=Yqt($D),BWn=Xqt($D);var ml=nr("ZodType",(e,t)=>(ic.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Y4e(e,"input"),output:Y4e(e,"output")}}),e.toJSONSchema=O7n(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(oi.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>YO(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>AWn(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>bWn(e,r,n),e.parseAsync=async(r,n)=>yWn(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>EWn(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>vWn(e,r,n),e.decode=(r,n)=>IWn(e,r,n),e.encodeAsync=async(r,n)=>wWn(e,r,n),e.decodeAsync=async(r,n)=>CWn(e,r,n),e.safeEncode=(r,n)=>xWn(e,r,n),e.safeDecode=(r,n)=>_Wn(e,r,n),e.safeEncodeAsync=async(r,n)=>SWn(e,r,n),e.safeDecodeAsync=async(r,n)=>BWn(e,r,n),e.refine=(r,n)=>e.check(y$n(r,n)),e.superRefine=r=>e.check(b$n(r)),e.overwrite=r=>e.check(Z5(r)),e.optional=()=>cmt(e),e.exactOptional=()=>e$n(e),e.nullable=()=>lmt(e),e.nullish=()=>cmt(lmt(e)),e.nonoptional=r=>s$n(e,r),e.array=()=>mmt(e),e.or=r=>bGt([e,r]),e.and=r=>qWn(e,r),e.transform=r=>pmt(e,vGt(r)),e.default=r=>n$n(e,r),e.prefault=r=>o$n(e,r),e.catch=r=>c$n(e,r),e.pipe=r=>pmt(e,r),e.readonly=()=>f$n(e),e.describe=r=>{let n=e.clone();return d_.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return d_.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return d_.get(e);let n=e.clone();return d_.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),eGt=nr("_ZodString",(e,t)=>{i_e.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(n,i,o)=>P7n(e,n,i,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(j4e(...n)),e.includes=(...n)=>e.check(U4e(...n)),e.startsWith=(...n)=>e.check(z4e(...n)),e.endsWith=(...n)=>e.check(V4e(...n)),e.min=(...n)=>e.check(Yre(...n)),e.max=(...n)=>e.check(s_e(...n)),e.length=(...n)=>e.check(a_e(...n)),e.nonempty=(...n)=>e.check(Yre(1,...n)),e.lowercase=n=>e.check(M4e(n)),e.uppercase=n=>e.check(L4e(n)),e.trim=()=>e.check(W4e()),e.normalize=(...n)=>e.check(G4e(...n)),e.toLowerCase=()=>e.check($4e()),e.toUpperCase=()=>e.check(H4e()),e.slugify=()=>e.check(K4e())}),eLe=nr("ZodString",(e,t)=>{i_e.init(e,t),eGt.init(e,t),e.email=r=>e.check(A9t(tGt,r)),e.url=r=>e.check(smt(fmt,r)),e.jwt=r=>e.check(Q9t(gGt,r)),e.emoji=r=>e.check(I9t(rGt,r)),e.guid=r=>e.check(omt(umt,r)),e.uuid=r=>e.check(y9t(q9,r)),e.uuidv4=r=>e.check(b9t(q9,r)),e.uuidv6=r=>e.check(E9t(q9,r)),e.uuidv7=r=>e.check(v9t(q9,r)),e.nanoid=r=>e.check(w9t(nGt,r)),e.guid=r=>e.check(omt(umt,r)),e.cuid=r=>e.check(C9t(iGt,r)),e.cuid2=r=>e.check(x9t(oGt,r)),e.ulid=r=>e.check(_9t(sGt,r)),e.base64=r=>e.check(R9t(dGt,r)),e.base64url=r=>e.check(F9t(mGt,r)),e.xid=r=>e.check(S9t(aGt,r)),e.ksuid=r=>e.check(B9t(uGt,r)),e.ipv4=r=>e.check(O9t(cGt,r)),e.ipv6=r=>e.check(P9t(lGt,r)),e.cidrv4=r=>e.check(T9t(pGt,r)),e.cidrv6=r=>e.check(D9t(fGt,r)),e.e164=r=>e.check(k9t(hGt,r)),e.datetime=r=>e.check(dWn(r)),e.date=r=>e.check(mWn(r)),e.time=r=>e.check(hWn(r)),e.duration=r=>e.check(gWn(r))});function X9t(e){return qGn(eLe,e)}var wh=nr("ZodStringFormat",(e,t)=>{Ih.init(e,t),eGt.init(e,t)}),tGt=nr("ZodEmail",(e,t)=>{k9n.init(e,t),wh.init(e,t)});function gGo(e){return A9t(tGt,e)}var umt=nr("ZodGUID",(e,t)=>{R9n.init(e,t),wh.init(e,t)});function AGo(e){return omt(umt,e)}var q9=nr("ZodUUID",(e,t)=>{F9n.init(e,t),wh.init(e,t)});function yGo(e){return y9t(q9,e)}function bGo(e){return b9t(q9,e)}function EGo(e){return E9t(q9,e)}function vGo(e){return v9t(q9,e)}var fmt=nr("ZodURL",(e,t)=>{Q9n.init(e,t),wh.init(e,t)});function IGo(e){return smt(fmt,e)}function wGo(e){return smt(fmt,{protocol:/^https?$/,hostname:rM.domain,...oi.normalizeParams(e)})}var rGt=nr("ZodEmoji",(e,t)=>{N9n.init(e,t),wh.init(e,t)});function CGo(e){return I9t(rGt,e)}var nGt=nr("ZodNanoID",(e,t)=>{j9n.init(e,t),wh.init(e,t)});function xGo(e){return w9t(nGt,e)}var iGt=nr("ZodCUID",(e,t)=>{M9n.init(e,t),wh.init(e,t)});function _Go(e){return C9t(iGt,e)}var oGt=nr("ZodCUID2",(e,t)=>{L9n.init(e,t),wh.init(e,t)});function SGo(e){return x9t(oGt,e)}var sGt=nr("ZodULID",(e,t)=>{U9n.init(e,t),wh.init(e,t)});function BGo(e){return _9t(sGt,e)}var aGt=nr("ZodXID",(e,t)=>{z9n.init(e,t),wh.init(e,t)});function OGo(e){return S9t(aGt,e)}var uGt=nr("ZodKSUID",(e,t)=>{V9n.init(e,t),wh.init(e,t)});function PGo(e){return B9t(uGt,e)}var cGt=nr("ZodIPv4",(e,t)=>{H9n.init(e,t),wh.init(e,t)});function TGo(e){return O9t(cGt,e)}var OWn=nr("ZodMAC",(e,t)=>{J9n.init(e,t),wh.init(e,t)});function DGo(e){return WGn(OWn,e)}var lGt=nr("ZodIPv6",(e,t)=>{K9n.init(e,t),wh.init(e,t)});function RGo(e){return P9t(lGt,e)}var pGt=nr("ZodCIDRv4",(e,t)=>{Y9n.init(e,t),wh.init(e,t)});function FGo(e){return T9t(pGt,e)}var fGt=nr("ZodCIDRv6",(e,t)=>{X9n.init(e,t),wh.init(e,t)});function kGo(e){return D9t(fGt,e)}var dGt=nr("ZodBase64",(e,t)=>{eGn.init(e,t),wh.init(e,t)});function QGo(e){return R9t(dGt,e)}var mGt=nr("ZodBase64URL",(e,t)=>{tGn.init(e,t),wh.init(e,t)});function NGo(e){return F9t(mGt,e)}var hGt=nr("ZodE164",(e,t)=>{rGn.init(e,t),wh.init(e,t)});function jGo(e){return k9t(hGt,e)}var gGt=nr("ZodJWT",(e,t)=>{nGn.init(e,t),wh.init(e,t)});function MGo(e){return Q9t(gGt,e)}var tLe=nr("ZodCustomStringFormat",(e,t)=>{iGn.init(e,t),wh.init(e,t)});function LGo(e,t,r={}){return J4e(tLe,e,t,r)}function UGo(e){return J4e(tLe,"hostname",rM.hostname,e)}function zGo(e){return J4e(tLe,"hex",rM.hex,e)}function VGo(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=rM[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return J4e(tLe,n,i,t)}var rLe=nr("ZodNumber",(e,t)=>{u9t.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(n,i,o)=>T7n(e,n,i,o),e.gt=(n,i)=>e.check(z9(n,i)),e.gte=(n,i)=>e.check(XO(n,i)),e.min=(n,i)=>e.check(XO(n,i)),e.lt=(n,i)=>e.check(U9(n,i)),e.lte=(n,i)=>e.check(nQ(n,i)),e.max=(n,i)=>e.check(nQ(n,i)),e.int=n=>e.check(Z9t(n)),e.safe=n=>e.check(Z9t(n)),e.positive=n=>e.check(z9(0,n)),e.nonnegative=n=>e.check(XO(0,n)),e.negative=n=>e.check(U9(0,n)),e.nonpositive=n=>e.check(nQ(0,n)),e.multipleOf=(n,i)=>e.check(Yle(n,i)),e.step=(n,i)=>e.check(Yle(n,i)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function PWn(e){return XGn(rLe,e)}var c_e=nr("ZodNumberFormat",(e,t)=>{oGn.init(e,t),rLe.init(e,t)});function Z9t(e){return e7n(c_e,e)}function qGo(e){return t7n(c_e,e)}function GGo(e){return r7n(c_e,e)}function WGo(e){return n7n(c_e,e)}function $Go(e){return i7n(c_e,e)}var nLe=nr("ZodBoolean",(e,t)=>{emt.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>D7n(e,r,n,i)});function TWn(e){return o7n(nLe,e)}var iLe=nr("ZodBigInt",(e,t)=>{c9t.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(n,i,o)=>R7n(e,n,i,o),e.gte=(n,i)=>e.check(XO(n,i)),e.min=(n,i)=>e.check(XO(n,i)),e.gt=(n,i)=>e.check(z9(n,i)),e.gte=(n,i)=>e.check(XO(n,i)),e.min=(n,i)=>e.check(XO(n,i)),e.lt=(n,i)=>e.check(U9(n,i)),e.lte=(n,i)=>e.check(nQ(n,i)),e.max=(n,i)=>e.check(nQ(n,i)),e.positive=n=>e.check(z9(BigInt(0),n)),e.negative=n=>e.check(U9(BigInt(0),n)),e.nonpositive=n=>e.check(nQ(BigInt(0),n)),e.nonnegative=n=>e.check(XO(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(Yle(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function HGo(e){return a7n(iLe,e)}var AGt=nr("ZodBigIntFormat",(e,t)=>{sGn.init(e,t),iLe.init(e,t)});function KGo(e){return c7n(AGt,e)}function JGo(e){return l7n(AGt,e)}var DWn=nr("ZodSymbol",(e,t)=>{aGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>F7n(e,r,n,i)});function YGo(e){return p7n(DWn,e)}var RWn=nr("ZodUndefined",(e,t)=>{uGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Q7n(e,r,n,i)});function XGo(e){return f7n(RWn,e)}var FWn=nr("ZodNull",(e,t)=>{cGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>k7n(e,r,n,i)});function kWn(e){return d7n(FWn,e)}var QWn=nr("ZodAny",(e,t)=>{lGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>M7n(e,r,n,i)});function ZGo(){return m7n(QWn)}var NWn=nr("ZodUnknown",(e,t)=>{pGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>L7n(e,r,n,i)});function u_e(){return h7n(NWn)}var jWn=nr("ZodNever",(e,t)=>{fGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>j7n(e,r,n,i)});function yGt(e){return g7n(jWn,e)}var MWn=nr("ZodVoid",(e,t)=>{dGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>N7n(e,r,n,i)});function e7o(e){return A7n(MWn,e)}var dmt=nr("ZodDate",(e,t)=>{mGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(n,i,o)=>U7n(e,n,i,o),e.min=(n,i)=>e.check(XO(n,i)),e.max=(n,i)=>e.check(nQ(n,i));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function t7o(e){return y7n(dmt,e)}var LWn=nr("ZodArray",(e,t)=>{hGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Z7n(e,r,n,i),e.element=t.element,e.min=(r,n)=>e.check(Yre(r,n)),e.nonempty=r=>e.check(Yre(1,r)),e.max=(r,n)=>e.check(s_e(r,n)),e.length=(r,n)=>e.check(a_e(r,n)),e.unwrap=()=>e.element});function mmt(e,t){return v7n(LWn,e,t)}function r7o(e){let t=e._zod.def.shape;return EGt(Object.keys(t))}var hmt=nr("ZodObject",(e,t)=>{gGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>eWn(e,r,n,i),oi.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>EGt(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:u_e()}),e.loose=()=>e.clone({...e._zod.def,catchall:u_e()}),e.strict=()=>e.clone({...e._zod.def,catchall:yGt()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>oi.extend(e,r),e.safeExtend=r=>oi.safeExtend(e,r),e.merge=r=>oi.merge(e,r),e.pick=r=>oi.pick(e,r),e.omit=r=>oi.omit(e,r),e.partial=(...r)=>oi.partial(IGt,e,r[0]),e.required=(...r)=>oi.required(wGt,e,r[0])});function n7o(e,t){let r={type:"object",shape:e??{},...oi.normalizeParams(t)};return new hmt(r)}function i7o(e,t){return new hmt({type:"object",shape:e,catchall:yGt(),...oi.normalizeParams(t)})}function o7o(e,t){return new hmt({type:"object",shape:e,catchall:u_e(),...oi.normalizeParams(t)})}var gmt=nr("ZodUnion",(e,t)=>{tmt.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>V9t(e,r,n,i),e.options=t.options});function bGt(e,t){return new gmt({type:"union",options:e,...oi.normalizeParams(t)})}var UWn=nr("ZodXor",(e,t)=>{gmt.init(e,t),AGn.init(e,t),e._zod.processJSONSchema=(r,n,i)=>V9t(e,r,n,i),e.options=t.options});function s7o(e,t){return new UWn({type:"union",options:e,inclusive:!1,...oi.normalizeParams(t)})}var zWn=nr("ZodDiscriminatedUnion",(e,t)=>{gmt.init(e,t),yGn.init(e,t)});function a7o(e,t,r){return new zWn({type:"union",options:t,discriminator:e,...oi.normalizeParams(r)})}var VWn=nr("ZodIntersection",(e,t)=>{bGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>tWn(e,r,n,i)});function qWn(e,t){return new VWn({type:"intersection",left:e,right:t})}var GWn=nr("ZodTuple",(e,t)=>{l9t.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>rWn(e,r,n,i),e.rest=r=>e.clone({...e._zod.def,rest:r})});function WWn(e,t,r){let n=t instanceof ic,i=n?r:t,o=n?t:null;return new GWn({type:"tuple",items:e,rest:o,...oi.normalizeParams(i)})}var Amt=nr("ZodRecord",(e,t)=>{EGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>nWn(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType});function $Wn(e,t,r){return new Amt({type:"record",keyType:e,valueType:t,...oi.normalizeParams(r)})}function u7o(e,t,r){let n=YO(e);return n._zod.values=void 0,new Amt({type:"record",keyType:n,valueType:t,...oi.normalizeParams(r)})}function c7o(e,t,r){return new Amt({type:"record",keyType:e,valueType:t,mode:"loose",...oi.normalizeParams(r)})}var HWn=nr("ZodMap",(e,t)=>{vGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Y7n(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(V9(...r)),e.nonempty=r=>e.check(V9(1,r)),e.max=(...r)=>e.check(Xle(...r)),e.size=(...r)=>e.check(o_e(...r))});function l7o(e,t,r){return new HWn({type:"map",keyType:e,valueType:t,...oi.normalizeParams(r)})}var KWn=nr("ZodSet",(e,t)=>{IGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>X7n(e,r,n,i),e.min=(...r)=>e.check(V9(...r)),e.nonempty=r=>e.check(V9(1,r)),e.max=(...r)=>e.check(Xle(...r)),e.size=(...r)=>e.check(o_e(...r))});function p7o(e,t){return new KWn({type:"set",valueType:e,...oi.normalizeParams(t)})}var Z4e=nr("ZodEnum",(e,t)=>{wGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(n,i,o)=>z7n(e,n,i,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let o={};for(let s of n)if(r.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Z4e({...t,checks:[],...oi.normalizeParams(i),entries:o})},e.exclude=(n,i)=>{let o={...t.entries};for(let s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new Z4e({...t,checks:[],...oi.normalizeParams(i),entries:o})}});function EGt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Z4e({type:"enum",entries:r,...oi.normalizeParams(t)})}function f7o(e,t){return new Z4e({type:"enum",entries:e,...oi.normalizeParams(t)})}var JWn=nr("ZodLiteral",(e,t)=>{CGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>V7n(e,r,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function d7o(e,t){return new JWn({type:"literal",values:Array.isArray(e)?e:[e],...oi.normalizeParams(t)})}var YWn=nr("ZodFile",(e,t)=>{xGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>W7n(e,r,n,i),e.min=(r,n)=>e.check(V9(r,n)),e.max=(r,n)=>e.check(Xle(r,n)),e.mime=(r,n)=>e.check(q4e(Array.isArray(r)?r:[r],n))});function m7o(e){return I7n(YWn,e)}var XWn=nr("ZodTransform",(e,t)=>{_Gn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>J7n(e,r,n,i),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Wle(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(oi.issue(o,r.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(oi.issue(s))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function vGt(e){return new XWn({type:"transform",transform:e})}var IGt=nr("ZodOptional",(e,t)=>{p9t.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>q9t(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function cmt(e){return new IGt({type:"optional",innerType:e})}var ZWn=nr("ZodExactOptional",(e,t)=>{SGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>q9t(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function e$n(e){return new ZWn({type:"optional",innerType:e})}var t$n=nr("ZodNullable",(e,t)=>{BGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>iWn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function lmt(e){return new t$n({type:"nullable",innerType:e})}function h7o(e){return cmt(lmt(e))}var r$n=nr("ZodDefault",(e,t)=>{OGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>sWn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function n$n(e,t){return new r$n({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():oi.shallowClone(t)}})}var i$n=nr("ZodPrefault",(e,t)=>{PGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>aWn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function o$n(e,t){return new i$n({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():oi.shallowClone(t)}})}var wGt=nr("ZodNonOptional",(e,t)=>{TGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>oWn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function s$n(e,t){return new wGt({type:"nonoptional",innerType:e,...oi.normalizeParams(t)})}var a$n=nr("ZodSuccess",(e,t)=>{DGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>$7n(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function g7o(e){return new a$n({type:"success",innerType:e})}var u$n=nr("ZodCatch",(e,t)=>{RGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>uWn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function c$n(e,t){return new u$n({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var l$n=nr("ZodNaN",(e,t)=>{FGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>q7n(e,r,n,i)});function A7o(e){return E7n(l$n,e)}var CGt=nr("ZodPipe",(e,t)=>{kGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>cWn(e,r,n,i),e.in=t.in,e.out=t.out});function pmt(e,t){return new CGt({type:"pipe",in:e,out:t})}var xGt=nr("ZodCodec",(e,t)=>{CGt.init(e,t),rmt.init(e,t)});function y7o(e,t,r){return new xGt({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var p$n=nr("ZodReadonly",(e,t)=>{QGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>lWn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function f$n(e){return new p$n({type:"readonly",innerType:e})}var d$n=nr("ZodTemplateLiteral",(e,t)=>{NGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>G7n(e,r,n,i)});function b7o(e,t){return new d$n({type:"template_literal",parts:e,...oi.normalizeParams(t)})}var m$n=nr("ZodLazy",(e,t)=>{LGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>fWn(e,r,n,i),e.unwrap=()=>e._zod.def.getter()});function h$n(e){return new m$n({type:"lazy",getter:e})}var g$n=nr("ZodPromise",(e,t)=>{MGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>pWn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function E7o(e){return new g$n({type:"promise",innerType:e})}var A$n=nr("ZodFunction",(e,t)=>{jGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>K7n(e,r,n,i)});function v7o(e){return new A$n({type:"function",input:Array.isArray(e?.input)?WWn(e?.input):e?.input??mmt(u_e()),output:e?.output??u_e()})}var ymt=nr("ZodCustom",(e,t)=>{UGn.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,n,i)=>H7n(e,r,n,i)});function I7o(e){let t=new Jh({check:"custom"});return t._zod.check=e,t}function w7o(e,t){return w7n(ymt,e??(()=>!0),t)}function y$n(e,t={}){return C7n(ymt,e,t)}function b$n(e){return x7n(e)}var C7o=_7n,x7o=S7n;function _7o(e,t={}){let r=new ymt({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...oi.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var S7o=(...e)=>B7n({Codec:xGt,Boolean:nLe,String:eLe},...e);function B7o(e){let t=h$n(()=>bGt([X9t(e),PWn(),TWn(),kWn(),mmt(t),$Wn(X9t(),t)]));return t}function O7o(e,t){return pmt(vGt(e),t)}var aFc={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function uFc(e){Wb({customError:e})}function cFc(){return Wb().customError}var E$n;E$n||(E$n={});var vo={...amt,...$9t,iso:X4e},lFc=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function pFc(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function fFc(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let i=r[1];if(!i||!t.defs[i])throw new Error(`Reference not found: ${e}`);return t.defs[i]}throw new Error(`Reference not found: ${e}`)}function P7o(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return vo.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let i=e.$ref;if(t.refs.has(i))return t.refs.get(i);if(t.processing.has(i))return vo.lazy(()=>{if(!t.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return t.refs.get(i)});t.processing.add(i);let o=fFc(i,t),s=AS(o,t);return t.refs.set(i,s),t.processing.delete(i),s}if(e.enum!==void 0){let i=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&i.length===1&&i[0]===null)return vo.null();if(i.length===0)return vo.never();if(i.length===1)return vo.literal(i[0]);if(i.every(s=>typeof s=="string"))return vo.enum(i);let o=i.map(s=>vo.literal(s));return o.length<2?o[0]:vo.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return vo.literal(e.const);let r=e.type;if(Array.isArray(r)){let i=r.map(o=>{let s={...e,type:o};return P7o(s,t)});return i.length===0?vo.never():i.length===1?i[0]:vo.union(i)}if(!r)return vo.any();let n;switch(r){case"string":{let i=vo.string();if(e.format){let o=e.format;o==="email"?i=i.check(vo.email()):o==="uri"||o==="uri-reference"?i=i.check(vo.url()):o==="uuid"||o==="guid"?i=i.check(vo.uuid()):o==="date-time"?i=i.check(vo.iso.datetime()):o==="date"?i=i.check(vo.iso.date()):o==="time"?i=i.check(vo.iso.time()):o==="duration"?i=i.check(vo.iso.duration()):o==="ipv4"?i=i.check(vo.ipv4()):o==="ipv6"?i=i.check(vo.ipv6()):o==="mac"?i=i.check(vo.mac()):o==="cidr"?i=i.check(vo.cidrv4()):o==="cidr-v6"?i=i.check(vo.cidrv6()):o==="base64"?i=i.check(vo.base64()):o==="base64url"?i=i.check(vo.base64url()):o==="e164"?i=i.check(vo.e164()):o==="jwt"?i=i.check(vo.jwt()):o==="emoji"?i=i.check(vo.emoji()):o==="nanoid"?i=i.check(vo.nanoid()):o==="cuid"?i=i.check(vo.cuid()):o==="cuid2"?i=i.check(vo.cuid2()):o==="ulid"?i=i.check(vo.ulid()):o==="xid"?i=i.check(vo.xid()):o==="ksuid"&&(i=i.check(vo.ksuid()))}typeof e.minLength=="number"&&(i=i.min(e.minLength)),typeof e.maxLength=="number"&&(i=i.max(e.maxLength)),e.pattern&&(i=i.regex(new RegExp(e.pattern))),n=i;break}case"number":case"integer":{let i=r==="integer"?vo.number().int():vo.number();typeof e.minimum=="number"&&(i=i.min(e.minimum)),typeof e.maximum=="number"&&(i=i.max(e.maximum)),typeof e.exclusiveMinimum=="number"?i=i.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(i=i.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?i=i.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(i=i.lt(e.maximum)),typeof e.multipleOf=="number"&&(i=i.multipleOf(e.multipleOf)),n=i;break}case"boolean":{n=vo.boolean();break}case"null":{n=vo.null();break}case"object":{let i={},o=e.properties||{},s=new Set(e.required||[]);for(let[u,c]of Object.entries(o)){let l=AS(c,t);i[u]=s.has(u)?l:l.optional()}if(e.propertyNames){let u=AS(e.propertyNames,t),c=e.additionalProperties&&typeof e.additionalProperties=="object"?AS(e.additionalProperties,t):vo.any();if(Object.keys(i).length===0){n=vo.record(u,c);break}let l=vo.object(i).passthrough(),p=vo.looseRecord(u,c);n=vo.intersection(l,p);break}if(e.patternProperties){let u=e.patternProperties,c=Object.keys(u),l=[];for(let d of c){let f=AS(u[d],t),m=vo.string().regex(new RegExp(d));l.push(vo.looseRecord(m,f))}let p=[];if(Object.keys(i).length>0&&p.push(vo.object(i).passthrough()),p.push(...l),p.length===0)n=vo.object({}).passthrough();else if(p.length===1)n=p[0];else{let d=vo.intersection(p[0],p[1]);for(let f=2;f<p.length;f++)d=vo.intersection(d,p[f]);n=d}break}let a=vo.object(i);e.additionalProperties===!1?n=a.strict():typeof e.additionalProperties=="object"?n=a.catchall(AS(e.additionalProperties,t)):n=a.passthrough();break}case"array":{let i=e.prefixItems,o=e.items;if(i&&Array.isArray(i)){let s=i.map(u=>AS(u,t)),a=o&&typeof o=="object"&&!Array.isArray(o)?AS(o,t):void 0;a?n=vo.tuple(s).rest(a):n=vo.tuple(s),typeof e.minItems=="number"&&(n=n.check(vo.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(vo.maxLength(e.maxItems)))}else if(Array.isArray(o)){let s=o.map(u=>AS(u,t)),a=e.additionalItems&&typeof e.additionalItems=="object"?AS(e.additionalItems,t):void 0;a?n=vo.tuple(s).rest(a):n=vo.tuple(s),typeof e.minItems=="number"&&(n=n.check(vo.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(vo.maxLength(e.maxItems)))}else if(o!==void 0){let s=AS(o,t),a=vo.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),n=a}else n=vo.array(vo.any());break}default:throw new Error(`Unsupported type: ${r}`)}return e.description&&(n=n.describe(e.description)),e.default!==void 0&&(n=n.default(e.default)),n}function AS(e,t){if(typeof e=="boolean")return e?vo.any():vo.never();let r=P7o(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(c=>AS(c,t)),u=vo.union(a);r=n?vo.intersection(r,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(c=>AS(c,t)),u=vo.xor(a);r=n?vo.intersection(r,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:vo.any();else{let a=n?r:AS(e.allOf[0],t),u=n?0:1;for(let c=u;c<e.allOf.length;c++)a=vo.intersection(a,AS(e.allOf[c],t));r=a}e.nullable===!0&&t.version==="openapi-3.0"&&(r=vo.nullable(r)),e.readOnly===!0&&(r=vo.readonly(r));let i={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(i[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(i[a]=e[a]);for(let a of Object.keys(e))lFc.has(a)||(i[a]=e[a]);return Object.keys(i).length>0&&t.registry.add(r,i),r}function T7o(e,t){if(typeof e=="boolean")return e?vo.any():vo.never();let r=pFc(e,t?.defaultTarget),n=e.$defs||e.definitions||{},i={version:r,defs:n,refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??d_};return AS(e,i)}var v$n={};X(v$n,{bigint:()=>gFc,boolean:()=>hFc,date:()=>AFc,number:()=>mFc,string:()=>dFc});function dFc(e){return GGn(eLe,e)}function mFc(e){return ZGn(rLe,e)}function hFc(e){return s7n(nLe,e)}function gFc(e){return u7n(iLe,e)}function AFc(e){return b7n(dmt,e)}Wb(f9t());var Uw={};X(Uw,{DocsYmlSchemas:()=>N$n,RawSchemas:()=>vHn});var N$n={};X(N$n,{AIChatConfig:()=>C$n,AIChatDatasource:()=>gWo,AIChatLocation:()=>F7o,AIChatModel:()=>k7o,AIChatWebsiteDatasource:()=>hWo,AbsoluteProductPath:()=>y$o,AiExamplesConfig:()=>mWo,AnalyticsConfig:()=>dWo,AnnouncementConfig:()=>OGt,ApiReferenceConfiguration:()=>s$o,ApiReferenceEndpointConfiguration:()=>t$o,ApiReferenceLayoutItem:()=>vmt,ApiReferenceOperationConfiguration:()=>r$o,ApiReferencePackageConfiguration:()=>o$o,ApiReferencePackageConfigurationWithOptions:()=>i$o,ApiReferenceSectionConfiguration:()=>n$o,Audience:()=>bmt,AudienceId:()=>I$n,Availability:()=>Zre,BackgroundImageConfiguration:()=>iWo,BackgroundImageThemedConfig:()=>nWo,BodyThemeConfig:()=>K7o,ChangelogConfiguration:()=>XWo,ChangelogFolderRelativePath:()=>_$n,ColorConfig:()=>sv,ColorThemedConfig:()=>eWo,ColorsConfiguration:()=>wWo,ContentAlignment:()=>V7o,CssConfig:()=>oWo,CustomDomain:()=>tWo,CustomPageAction:()=>CWo,DocsConfiguration:()=>vFc,DocsInstance:()=>OWo,DocsSettingsConfig:()=>IWo,DocsTypographyConfig:()=>bWo,EditThisPageConfig:()=>BWo,EditThisPageLaunch:()=>Q7o,ExperimentalConfig:()=>WWo,ExternalProduct:()=>h$o,FeatureFlag:()=>w$n,FeatureFlagConfiguration:()=>sWo,FolderConfiguration:()=>e$o,FontConfig:()=>_Gt,FontConfigPath:()=>yWo,FontConfigVariant:()=>AWo,FontDisplay:()=>M7o,FontStyle:()=>P$n,FontWeight:()=>D$n,FooterLinksConfig:()=>jWo,FooterNavThemeConfig:()=>$7o,FullStoryAnalyticsConfig:()=>uWo,GTMConfig:()=>pWo,GitLibraryInputSchema:()=>$Wo,GithubEditThisPageConfig:()=>SWo,GoogleAnalytics4Config:()=>fWo,HeaderPosition:()=>q7o,HttpSnippetLanguage:()=>X7o,HttpSnippetsConfig:()=>rWo,IntegrationsConfig:()=>GWo,IntercomConfig:()=>cWo,InternalProduct:()=>m$o,JsConfig:()=>zWo,JsConfigOptions:()=>x$n,JsFileConfig:()=>LWo,JsFileConfigSettings:()=>MWo,JsRemoteConfig:()=>UWo,JsScriptStrategy:()=>T$n,Language:()=>B$n,LanguageSwitcherThemeConfig:()=>W7o,LayoutConfig:()=>vWo,LibraryConfiguration:()=>YWo,LibraryInputConfiguration:()=>KWo,LibraryLanguage:()=>j7o,LibraryName:()=>S$n,LibraryOutputConfiguration:()=>JWo,LibraryReferenceConfiguration:()=>ZWo,LinkConfiguration:()=>F$n,LogoConfiguration:()=>PWo,MetadataConfig:()=>VWo,NavbarDropdownConfig:()=>QWo,NavbarGithubConfig:()=>kWo,NavbarGithubConfigWithOptions:()=>FWo,NavbarLink:()=>NWo,NavbarLinkConfig:()=>l_e,NavigationConfig:()=>PGt,NavigationItem:()=>Imt,PageActionOption:()=>R7o,PageActionOptions:()=>xWo,PageActionsConfig:()=>_Wo,PageActionsThemeConfig:()=>Y7o,PageConfiguration:()=>aLe,PathLibraryInputSchema:()=>HWo,PlaygroundButtonSettings:()=>RWo,PlaygroundSettings:()=>Emt,PostHogConfig:()=>lWo,ProductConfig:()=>g$o,ProductConfigBase:()=>Q$n,ProductFileConfig:()=>EFc,ProductPath:()=>bFc,ProductSwitcherThemeConfig:()=>G7o,ProgrammingLanguage:()=>D7o,RedirectConfig:()=>qWo,RelativeProductPath:()=>A$o,Role:()=>R$n,RoleId:()=>SGt,SearchbarPlacement:()=>L7o,SectionConfiguration:()=>a$o,SegmentConfig:()=>aWo,SidebarThemeConfig:()=>J7o,SnippetLanguageConfiguration:()=>G9,SnippetsConfiguration:()=>DWo,SwitcherPlacement:()=>z7o,TabConfig:()=>TGt,TabId:()=>oLe,TabVariant:()=>c$o,TabbedNavigationConfig:()=>d$o,TabbedNavigationItem:()=>f$o,TabbedNavigationItemWithLayout:()=>l$o,TabbedNavigationItemWithVariants:()=>p$o,TabsPlacement:()=>U7o,TabsThemeConfig:()=>H7o,Target:()=>sLe,ThemeConfig:()=>EWo,TitleSource:()=>O$n,TwitterCardSetting:()=>Z7o,UntabbedNavigationConfig:()=>u$o,VersionAvailability:()=>N7o,VersionConfig:()=>k$n,VersionFileConfig:()=>yFc,VersionedSnippetLanguageConfiguration:()=>TWo,WithFeatureFlags:()=>bS,WithPermissions:()=>yS,WithViewers:()=>BGt});var oLe=ne.string(),_$n=ne.string(),I$n=ne.string(),SGt=ne.string(),S$n=ne.string(),D7o=ne.enum(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]),B$n=ne.enum(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]),R7o=ne.enum(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]),F7o=ne.enum(["docs","slack","discord"]),k7o=ne.enum(["claude-3.7","claude-4","command-a"]),Q7o=ne.enum(["github","dashboard"]),Zre=ne.enum(["stable","generally-available","in-development","pre-release","deprecated","beta"]),N7o=ne.enum(["deprecated","ga","stable","beta"]),O$n=ne.enum(["frontmatter","filename"]),j7o=ne.enum(["python","cpp"]),P$n=ne.enum(["normal","italic"]),M7o=ne.enum(["auto","block","swap","fallback","optional"]),L7o=ne.enum(["header","header-tabs","sidebar"]),U7o=ne.enum(["header","sidebar"]),z7o=ne.enum(["header","sidebar"]),V7o=ne.enum(["center","left"]),q7o=ne.enum(["fixed","static"]),G7o=ne.enum(["default","toggle"]),W7o=ne.enum(["default","minimal"]),$7o=ne.enum(["default","minimal"]),H7o=ne.enum(["default","bubble"]),K7o=ne.enum(["default","canvas"]),J7o=ne.enum(["default","minimal"]),Y7o=ne.enum(["default","toolbar"]),X7o=ne.enum(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]),sLe=ne.enum(["_blank","_self","_parent","_top"]),Z7o=ne.enum(["summary","summary_large_image","app","player"]),T$n=ne.enum(["beforeInteractive","afterInteractive","lazyOnload"]),D$n=ne.union([ne.string(),ne.number().int()]),eWo=ne.object({dark:ne.string().optional(),light:ne.string().optional()}),sv=ne.union([ne.string(),eWo]),bmt=ne.union([I$n,ne.array(I$n)]),R$n=ne.union([SGt,ne.array(SGt)]),tWo=ne.union([ne.string(),ne.array(ne.string())]),rWo=ne.union([ne.boolean(),ne.array(X7o)]),nWo=ne.object({dark:ne.string().optional(),light:ne.string().optional()}),iWo=ne.union([ne.string(),nWo]),oWo=ne.union([ne.string(),ne.array(ne.string())]),yS=ne.object({viewers:R$n.optional(),orphaned:ne.boolean().optional()}),w$n=ne.object({flag:ne.string(),"fallback-value":ne.unknown().optional(),match:ne.unknown().optional()}),sWo=ne.union([ne.string(),w$n,ne.array(w$n)]),bS=ne.object({"feature-flag":sWo.optional()}),BGt=ne.object({viewers:R$n.optional()}),aWo=ne.object({"write-key":ne.string()}),uWo=ne.object({"org-id":ne.string()}),cWo=ne.object({"app-id":ne.string(),"api-base":ne.string().optional()}),lWo=ne.object({"api-key":ne.string(),endpoint:ne.string().optional()}),pWo=ne.object({"container-id":ne.string()}),fWo=ne.object({"measurement-id":ne.string()}),dWo=ne.object({segment:aWo.optional(),fullstory:uWo.optional(),intercom:cWo.optional(),posthog:lWo.optional(),gtm:pWo.optional(),ga4:fWo.optional()}),mWo=ne.object({enabled:ne.boolean().optional(),style:ne.string().optional()}),hWo=ne.object({url:ne.string(),title:ne.string().optional()}),gWo=hWo,C$n=ne.object({model:k7o.optional(),"system-prompt":ne.string().optional(),location:ne.array(F7o).optional(),datasources:ne.array(gWo).optional()}),AWo=ne.object({path:ne.string(),weight:D$n.optional(),style:P$n.optional()}),yWo=ne.union([ne.string(),AWo]),_Gt=ne.object({name:ne.string().optional(),path:ne.string().optional(),weight:D$n.optional(),style:P$n.optional(),paths:ne.array(yWo).optional(),display:M7o.optional(),fallback:ne.array(ne.string()).optional(),"font-variation-settings":ne.string().optional()}),bWo=ne.object({headingsFont:_Gt.optional(),bodyFont:_Gt.optional(),codeFont:_Gt.optional()}),EWo=ne.object({sidebar:J7o.optional(),body:K7o.optional(),tabs:H7o.optional(),"page-actions":Y7o.optional(),"footer-nav":$7o.optional(),"language-switcher":W7o.optional(),"product-switcher":G7o.optional()}),vWo=ne.object({"page-width":ne.string().optional(),"content-width":ne.string().optional(),"sidebar-width":ne.string().optional(),"header-height":ne.string().optional(),"searchbar-placement":L7o.optional(),"tabs-placement":U7o.optional(),"switcher-placement":z7o.optional(),"content-alignment":V7o.optional(),"header-position":q7o.optional(),"disable-header":ne.boolean().optional(),"hide-nav-links":ne.boolean().optional(),"hide-feedback":ne.boolean().optional()}),IWo=ne.object({"search-text":ne.string().optional(),"disable-search":ne.boolean().optional(),"dark-mode-code":ne.boolean().optional(),"default-search-filters":ne.boolean().optional(),"http-snippets":rWo.optional(),"hide-404-page":ne.boolean().optional(),"use-javascript-as-typescript":ne.boolean().optional(),"disable-explorer-proxy":ne.boolean().optional(),"disable-analytics":ne.boolean().optional(),language:B$n.optional(),"folder-title-source":O$n.optional(),"substitute-env-vars":ne.boolean().optional()}),wWo=ne.object({"accent-primary":sv.optional(),accentPrimary:sv.optional(),background:sv.optional(),border:sv.optional(),"sidebar-background":sv.optional(),"header-background":sv.optional(),"card-background":sv.optional(),"accent-1":sv.optional(),"accent-2":sv.optional(),"accent-3":sv.optional(),"accent-4":sv.optional(),"accent-5":sv.optional(),"accent-6":sv.optional(),"accent-7":sv.optional(),"accent-8":sv.optional(),"accent-9":sv.optional(),"accent-10":sv.optional(),"accent-11":sv.optional(),"accent-12":sv.optional()}),CWo=ne.object({title:ne.string(),subtitle:ne.string().optional(),url:ne.string(),icon:ne.string().optional(),default:ne.boolean().optional()}),xWo=ne.object({"copy-page":ne.boolean().optional(),"view-as-markdown":ne.boolean().optional(),"ask-ai":ne.boolean().optional(),chatgpt:ne.boolean().optional(),claude:ne.boolean().optional(),cursor:ne.boolean().optional(),vscode:ne.boolean().optional(),custom:ne.array(CWo).optional()}),_Wo=ne.object({default:R7o.optional(),options:xWo.optional()}),SWo=ne.object({host:ne.string().optional(),owner:ne.string(),repo:ne.string(),branch:ne.string().optional()}),BWo=ne.object({github:SWo.optional(),launch:Q7o.optional()}),OWo=ne.object({url:ne.string(),"custom-domain":tWo.optional(),private:ne.boolean().optional(),"edit-this-page":BWo.optional(),audiences:bmt.optional()}),PWo=ne.object({dark:ne.string().optional(),light:ne.string().optional(),height:ne.number().optional(),href:ne.string().optional(),"right-text":ne.string().optional()}),F$n=ne.object({link:ne.string(),href:ne.string(),icon:ne.string().optional(),target:sLe.optional()}),TWo=ne.object({version:ne.string(),package:ne.string()}),G9=ne.union([ne.string(),TWo]),DWo=ne.object({python:G9.optional(),typescript:G9.optional(),go:G9.optional(),java:G9.optional(),ruby:G9.optional(),csharp:G9.optional(),php:G9.optional(),swift:G9.optional(),rust:G9.optional()}),RWo=ne.object({href:ne.string().optional()}),Emt=ne.object({hidden:ne.boolean().optional(),environments:ne.array(ne.string()).optional(),button:RWo.optional(),oauth:ne.boolean().optional(),"limit-websocket-messages-per-connection":ne.number().int().optional()}),OGt=ne.object({message:ne.string()}),l_e=BGt.merge(ne.object({href:ne.string().optional(),target:sLe.optional(),url:ne.string().optional(),text:ne.string().optional(),icon:ne.string().optional(),rightIcon:ne.string().optional(),rounded:ne.boolean().optional()})),FWo=BGt.merge(ne.object({url:ne.string(),target:sLe.optional()})),kWo=ne.union([ne.string(),FWo]),QWo=BGt.merge(ne.object({links:ne.array(l_e),text:ne.string().optional(),icon:ne.string().optional(),rightIcon:ne.string().optional(),rounded:ne.boolean().optional()})),NWo=ne.union([l_e.merge(ne.object({type:ne.literal("filled")})),l_e.merge(ne.object({type:ne.literal("outlined")})),l_e.merge(ne.object({type:ne.literal("minimal")})),ne.object({type:ne.literal("github"),value:kWo}),QWo.merge(ne.object({type:ne.literal("dropdown")})),l_e.merge(ne.object({type:ne.literal("primary")})),l_e.merge(ne.object({type:ne.literal("secondary")}))]),jWo=ne.object({github:ne.string().optional(),twitter:ne.string().optional(),x:ne.string().optional(),linkedin:ne.string().optional(),youtube:ne.string().optional(),instagram:ne.string().optional(),facebook:ne.string().optional(),discord:ne.string().optional(),slack:ne.string().optional(),hackernews:ne.string().optional(),medium:ne.string().optional(),website:ne.string().optional()}),MWo=ne.object({path:ne.string(),strategy:T$n.optional()}),LWo=ne.union([ne.string(),MWo]),UWo=ne.object({url:ne.string(),strategy:T$n.optional()}),x$n=ne.union([UWo,LWo]),zWo=ne.union([x$n,ne.array(x$n)]),VWo=ne.object({"og:site_name":ne.string().optional(),"og:title":ne.string().optional(),"og:description":ne.string().optional(),"og:url":ne.string().optional(),"og:image":ne.string().optional(),"og:image:width":ne.number().optional(),"og:image:height":ne.number().optional(),"og:locale":ne.string().optional(),"og:logo":ne.string().optional(),"twitter:title":ne.string().optional(),"twitter:description":ne.string().optional(),"twitter:handle":ne.string().optional(),"twitter:image":ne.string().optional(),"twitter:site":ne.string().optional(),"twitter:url":ne.string().optional(),"twitter:card":Z7o.optional(),"canonical-host":ne.string().optional()}),qWo=ne.object({source:ne.string(),destination:ne.string(),permanent:ne.boolean().optional()}),GWo=ne.object({intercom:ne.string().optional()}),WWo=ne.object({"mdx-components":ne.array(ne.string()).optional(),"disable-stream-toggle":ne.boolean().optional(),"openapi-parser-v2":ne.boolean().optional(),"openapi-parser-v3":ne.boolean().optional(),"dynamic-snippets":ne.boolean().optional(),"ai-examples":ne.boolean().optional(),"ai-example-style-instructions":ne.string().optional(),"exclude-apis":ne.boolean().optional(),"basepath-aware":ne.boolean().optional()}),$Wo=ne.object({git:ne.string(),subpath:ne.string().optional()}),HWo=ne.object({path:ne.string()}),KWo=ne.union([$Wo,HWo]),JWo=ne.object({path:ne.string()}),YWo=ne.object({input:KWo,output:JWo,lang:j7o}),aLe=yS.merge(bS).merge(ne.object({page:ne.string(),path:ne.string(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),noindex:ne.boolean().optional(),availability:Zre.optional()})),XWo=yS.merge(bS).merge(ne.object({changelog:_$n,title:ne.string().optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional()})),ZWo=yS.merge(bS).merge(ne.object({library:S$n,title:ne.string().optional(),slug:ne.string().optional()})),e$o=yS.merge(bS).merge(ne.object({folder:ne.string(),title:ne.string().optional(),"title-source":O$n.optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),"skip-slug":ne.boolean().optional(),collapsed:ne.union([ne.boolean(),ne.literal("open-by-default")]).optional(),collapsible:ne.boolean().optional(),"collapsed-by-default":ne.boolean().optional(),availability:Zre.optional()})),t$o=yS.merge(bS).merge(ne.object({endpoint:ne.string(),title:ne.string().optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),availability:Zre.optional(),playground:Emt.optional()})),r$o=yS.merge(bS).merge(ne.object({operation:ne.string(),title:ne.string().optional(),slug:ne.string().optional(),hidden:ne.boolean().optional(),availability:Zre.optional()})),vmt=ne.lazy(()=>ne.union([ne.string(),ne.record(ne.string(),o$o),n$o,t$o,r$o,aLe,F$n])),n$o=yS.merge(bS).merge(ne.object({section:ne.string(),"referenced-packages":ne.array(ne.string()).optional(),summary:ne.string().optional(),contents:ne.array(vmt).optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),"skip-slug":ne.boolean().optional(),collapsed:ne.union([ne.boolean(),ne.literal("open-by-default")]).optional(),collapsible:ne.boolean().optional(),"collapsed-by-default":ne.boolean().optional(),availability:Zre.optional(),playground:Emt.optional()})),i$o=yS.merge(bS).merge(ne.object({title:ne.string().optional(),summary:ne.string().optional(),contents:ne.array(vmt).optional(),availability:Zre.optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),"skip-slug":ne.boolean().optional(),playground:Emt.optional()})),o$o=ne.lazy(()=>ne.union([ne.array(vmt),i$o])),s$o=yS.merge(bS).merge(ne.object({api:ne.string(),"api-name":ne.string().optional(),openrpc:ne.string().optional(),audiences:bmt.optional(),"display-errors":ne.boolean().optional(),"tag-description-pages":ne.boolean().optional(),snippets:DWo.optional(),postman:ne.string().optional(),summary:ne.string().optional(),layout:ne.array(vmt).optional(),collapsed:ne.union([ne.boolean(),ne.literal("open-by-default")]).optional(),icon:ne.string().optional(),slug:ne.string().optional(),hidden:ne.boolean().optional(),availability:Zre.optional(),"skip-slug":ne.boolean().optional(),alphabetized:ne.boolean().optional(),flattened:ne.boolean().optional(),paginated:ne.boolean().optional(),playground:Emt.optional()})),Imt=ne.lazy(()=>ne.union([aLe,a$o,s$o,ZWo,F$n,XWo,e$o])),a$o=yS.merge(bS).merge(ne.object({section:ne.string(),path:ne.string().optional(),contents:ne.array(Imt),collapsed:ne.union([ne.boolean(),ne.literal("open-by-default")]).optional(),collapsible:ne.boolean().optional(),"collapsed-by-default":ne.boolean().optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),"skip-slug":ne.boolean().optional(),availability:Zre.optional()})),u$o=ne.array(Imt),c$o=yS.merge(bS).merge(ne.object({title:ne.string(),subtitle:ne.string().optional(),icon:ne.string().optional(),layout:ne.array(Imt),slug:ne.string().optional(),"skip-slug":ne.boolean().optional(),hidden:ne.boolean().optional(),default:ne.boolean().optional()})),l$o=ne.object({tab:oLe,layout:ne.array(Imt).optional()}),p$o=ne.object({tab:oLe,variants:ne.array(c$o)}),f$o=ne.union([l$o,p$o]),d$o=ne.array(f$o),PGt=ne.union([u$o,d$o]),TGt=yS.merge(bS).merge(ne.object({"display-name":ne.string(),icon:ne.string().optional(),slug:ne.string().optional(),"skip-slug":ne.boolean().optional(),hidden:ne.boolean().optional(),href:ne.string().optional(),target:sLe.optional(),changelog:_$n.optional()})),k$n=yS.merge(bS).merge(ne.object({"display-name":ne.string(),path:ne.string(),slug:ne.string().optional(),availability:N7o.optional(),audiences:bmt.optional(),hidden:ne.boolean().optional(),announcement:OGt.optional()})),yFc=ne.object({tabs:ne.record(oLe,TGt).optional(),"landing-page":aLe.optional(),navigation:PGt}),Q$n=yS.merge(bS).merge(ne.object({"display-name":ne.string(),subtitle:ne.string().optional(),icon:ne.string().optional(),image:ne.string().optional(),versions:ne.array(k$n).optional(),audiences:bmt.optional()})),m$o=Q$n.merge(ne.object({path:ne.string(),slug:ne.string().optional(),announcement:OGt.optional()})),h$o=Q$n.merge(ne.object({href:ne.string(),target:sLe.optional()})),g$o=ne.union([m$o,h$o]),A$o=yS.merge(bS).merge(ne.object({"display-name":ne.string(),path:ne.string(),slug:ne.string().optional()})),y$o=ne.object({href:ne.string()}),bFc=ne.union([A$o,y$o]),EFc=ne.object({tabs:ne.record(oLe,TGt).optional(),"landing-page":aLe.optional(),navigation:PGt}),vFc=ne.object({instances:ne.array(OWo),title:ne.string().optional(),libraries:ne.record(S$n,YWo).optional(),analytics:dWo.optional(),announcement:OGt.optional(),roles:ne.array(SGt).optional(),tabs:ne.record(oLe,TGt).optional(),versions:ne.array(k$n).optional(),products:ne.array(g$o).optional(),"landing-page":aLe.optional(),navigation:PGt.optional(),"navbar-links":ne.array(NWo).optional(),"footer-links":jWo.optional(),"page-actions":_Wo.optional(),experimental:WWo.optional(),"default-language":D7o.optional(),languages:ne.array(B$n).optional(),"ai-chat":C$n.optional(),"ai-search":C$n.optional(),"ai-examples":mWo.optional(),metadata:VWo.optional(),redirects:ne.array(qWo).optional(),logo:PWo.optional(),favicon:ne.string().optional(),"background-image":iWo.optional(),colors:wWo.optional(),typography:bWo.optional(),layout:vWo.optional(),settings:IWo.optional(),theme:EWo.optional(),integrations:GWo.optional(),css:oWo.optional(),js:zWo.optional(),header:ne.string().optional(),footer:ne.string().optional()});var vHn={};X(vHn,{AiChatLocation:()=>j$n,AiChatModel:()=>M$n,Availability:()=>L$n,BodyThemeConfig:()=>U$n,ContentAlignment:()=>z$n,EditThisPageLaunch:()=>V$n,FernDocsConfig:()=>fHn,FernDocsConfigError:()=>wmt,FernDocsConfigTimeoutError:()=>Cmt,FontDisplay:()=>q$n,FontStyle:()=>G$n,FooterNavThemeConfig:()=>W$n,HeaderPosition:()=>$$n,HttpSnippetLanguage:()=>H$n,JsScriptStrategy:()=>K$n,Language:()=>J$n,LanguageSwitcherThemeConfig:()=>Y$n,LibraryLanguage:()=>X$n,PageActionOption:()=>Z$n,PageActionsThemeConfig:()=>eHn,ProductSwitcherThemeConfig:()=>tHn,ProgrammingLanguage:()=>rHn,SearchbarPlacement:()=>nHn,Serializer:()=>HD,SidebarThemeConfig:()=>iHn,SwitcherPlacement:()=>oHn,TabsPlacement:()=>sHn,TabsThemeConfig:()=>aHn,Target:()=>uHn,TitleSource:()=>cHn,TwitterCardSetting:()=>lHn,VersionAvailability:()=>pHn,docs:()=>DGt,logging:()=>mHn,serialization:()=>HD});var fHn={};X(fHn,{AiChatLocation:()=>j$n,AiChatModel:()=>M$n,Availability:()=>L$n,BodyThemeConfig:()=>U$n,ContentAlignment:()=>z$n,EditThisPageLaunch:()=>V$n,FontDisplay:()=>q$n,FontStyle:()=>G$n,FooterNavThemeConfig:()=>W$n,HeaderPosition:()=>$$n,HttpSnippetLanguage:()=>H$n,JsScriptStrategy:()=>K$n,Language:()=>J$n,LanguageSwitcherThemeConfig:()=>Y$n,LibraryLanguage:()=>X$n,PageActionOption:()=>Z$n,PageActionsThemeConfig:()=>eHn,ProductSwitcherThemeConfig:()=>tHn,ProgrammingLanguage:()=>rHn,SearchbarPlacement:()=>nHn,SidebarThemeConfig:()=>iHn,SwitcherPlacement:()=>oHn,TabsPlacement:()=>sHn,TabsThemeConfig:()=>aHn,Target:()=>uHn,TitleSource:()=>cHn,TwitterCardSetting:()=>lHn,VersionAvailability:()=>pHn,docs:()=>DGt});var DGt={};X(DGt,{AiChatLocation:()=>j$n,AiChatModel:()=>M$n,Availability:()=>L$n,BodyThemeConfig:()=>U$n,ContentAlignment:()=>z$n,EditThisPageLaunch:()=>V$n,FontDisplay:()=>q$n,FontStyle:()=>G$n,FooterNavThemeConfig:()=>W$n,HeaderPosition:()=>$$n,HttpSnippetLanguage:()=>H$n,JsScriptStrategy:()=>K$n,Language:()=>J$n,LanguageSwitcherThemeConfig:()=>Y$n,LibraryLanguage:()=>X$n,PageActionOption:()=>Z$n,PageActionsThemeConfig:()=>eHn,ProductSwitcherThemeConfig:()=>tHn,ProgrammingLanguage:()=>rHn,SearchbarPlacement:()=>nHn,SidebarThemeConfig:()=>iHn,SwitcherPlacement:()=>oHn,TabsPlacement:()=>sHn,TabsThemeConfig:()=>aHn,Target:()=>uHn,TitleSource:()=>cHn,TwitterCardSetting:()=>lHn,VersionAvailability:()=>pHn});var j$n={Docs:"docs",Slack:"slack",Discord:"discord"};var M$n={Claude37:"claude-3.7",Claude4:"claude-4",CommandA:"command-a"};var L$n={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",Beta:"beta"};var U$n={Default:"default",Canvas:"canvas"};var z$n={Center:"center",Left:"left"};var V$n={Github:"github",Dashboard:"dashboard"};var q$n={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var G$n={Normal:"normal",Italic:"italic"};var W$n={Default:"default",Minimal:"minimal"};var $$n={Fixed:"fixed",Static:"static"};var H$n={Curl:"curl",Csharp:"csharp",Go:"go",Java:"java",Javascript:"javascript",Php:"php",Python:"python",Ruby:"ruby",Swift:"swift",Typescript:"typescript"};var K$n={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var J$n={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 Y$n={Default:"default",Minimal:"minimal"};var X$n={Python:"python",Cpp:"cpp"};var Z$n={CopyPage:"copy-page",ViewAsMarkdown:"view-as-markdown",AskAi:"ask-ai",Chatgpt:"chatgpt",Claude:"claude",Cursor:"cursor",Vscode:"vscode"};var eHn={Default:"default",Toolbar:"toolbar"};var tHn={Default:"default",Toggle:"toggle"};var rHn={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 nHn={Header:"header",HeaderTabs:"header-tabs",Sidebar:"sidebar"};var iHn={Default:"default",Minimal:"minimal"};var oHn={Header:"header",Sidebar:"sidebar"};var sHn={Header:"header",Sidebar:"sidebar"};var aHn={Default:"default",Bubble:"bubble"};var uHn={Blank:"_blank",Self:"_self",Parent:"_parent",Top:"_top"};var cHn={Frontmatter:"frontmatter",Filename:"filename"};var lHn={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var pHn={Deprecated:"deprecated",Ga:"ga",Stable:"stable",Beta:"beta"};var b$o=(e,t,r)=>JSON.stringify(e,t,r);var wmt=class extends Error{statusCode;body;rawResponse;constructor({message:t,statusCode:r,body:n,rawResponse:i}){super(IFc({message:t,statusCode:r,body:n})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=r,this.body=n,this.rawResponse=i}};function IFc({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: ${b$o(r,void 0,2)}`),n.join(`
1458
1458
  `)}var Cmt=class extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var e8={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},E$o={[e8.Debug]:1,[e8.Info]:2,[e8.Warn]:3,[e8.Error]:4},xmt=class{debug(t,...r){console.debug(t,...r)}info(t,...r){console.info(t,...r)}warn(t,...r){console.warn(t,...r)}error(t,...r){console.error(t,...r)}},dHn=class{level;logger;silent;constructor(t){this.level=E$o[t.level],this.logger=t.logger,this.silent=t.silent}shouldLog(t){return!this.silent&&this.level<=E$o[t]}isDebug(){return this.shouldLog(e8.Debug)}debug(t,...r){this.isDebug()&&this.logger.debug(t,...r)}isInfo(){return this.shouldLog(e8.Info)}info(t,...r){this.isInfo()&&this.logger.info(t,...r)}isWarn(){return this.shouldLog(e8.Warn)}warn(t,...r){this.isWarn()&&this.logger.warn(t,...r)}isError(){return this.shouldLog(e8.Error)}error(t,...r){this.isError()&&this.logger.error(t,...r)}};var Yig=new dHn({level:e8.Info,logger:new xmt,silent:!0});var mHn;(function(e){e.LogLevel=e8,e.ConsoleLogger=xmt})(mHn||(mHn={}));var HD={};X(HD,{AbsoluteProductPath:()=>NGt,AiChatConfig:()=>Bmt,AiChatDatasource:()=>MGt,AiChatLocation:()=>LGt,AiChatModel:()=>UGt,AiChatWebsiteDatasource:()=>jGt,AiExamplesConfig:()=>zGt,AnalyticsConfig:()=>KGt,AnnouncementConfig:()=>rpe,ApiReferenceConfiguration:()=>e7t,ApiReferenceEndpointConfiguration:()=>t7t,ApiReferenceLayoutItem:()=>H9,ApiReferenceOperationConfiguration:()=>r7t,ApiReferencePackageConfiguration:()=>n7t,ApiReferencePackageConfigurationWithOptions:()=>o7t,ApiReferenceSectionConfiguration:()=>i7t,Audience:()=>W9,AudienceId:()=>Omt,Availability:()=>Lw,BackgroundImageConfiguration:()=>a7t,BackgroundImageThemedConfig:()=>s7t,BodyThemeConfig:()=>u7t,ChangelogConfiguration:()=>c7t,ChangelogFolderRelativePath:()=>dLe,ColorConfig:()=>$b,ColorThemedConfig:()=>l7t,ColorsConfiguration:()=>p7t,ContentAlignment:()=>f7t,CssConfig:()=>d7t,CustomDomain:()=>m7t,CustomPageAction:()=>h7t,DocsConfiguration:()=>H$o,DocsInstance:()=>b7t,DocsSettingsConfig:()=>I7t,DocsTypographyConfig:()=>_7t,EditThisPageConfig:()=>y7t,EditThisPageLaunch:()=>g7t,ExperimentalConfig:()=>S7t,ExternalProduct:()=>cWt,FeatureFlag:()=>Pmt,FeatureFlagConfiguration:()=>ZGt,FolderConfiguration:()=>vWt,FontConfig:()=>yLe,FontConfigPath:()=>C7t,FontConfigVariant:()=>w7t,FontDisplay:()=>x7t,FontStyle:()=>gLe,FontWeight:()=>ALe,FooterLinksConfig:()=>B7t,FooterNavThemeConfig:()=>mWt,FullStoryAnalyticsConfig:()=>VGt,GitLibraryInputSchema:()=>L7t,GithubEditThisPageConfig:()=>A7t,GoogleAnalytics4Config:()=>qGt,GtmConfig:()=>GGt,HeaderPosition:()=>F7t,HttpSnippetLanguage:()=>E7t,HttpSnippetsConfig:()=>v7t,IntegrationsConfig:()=>O7t,IntercomConfig:()=>WGt,InternalProduct:()=>lWt,JsConfig:()=>R7t,JsConfigOptions:()=>Tmt,JsFileConfig:()=>T7t,JsFileConfigSettings:()=>P7t,JsRemoteConfig:()=>D7t,JsScriptStrategy:()=>bLe,Language:()=>mLe,LanguageSwitcherThemeConfig:()=>hWt,LayoutConfig:()=>j7t,LibraryConfig:()=>M7t,LibraryConfiguration:()=>G7t,LibraryInputConfiguration:()=>z7t,LibraryLanguage:()=>V7t,LibraryName:()=>ELe,LibraryOutputConfiguration:()=>q7t,LibraryReferenceConfiguration:()=>IWt,LinkConfiguration:()=>fLe,LogoConfiguration:()=>W7t,MetadataConfig:()=>H7t,NavbarDropdownConfig:()=>K7t,NavbarGithubConfig:()=>Y7t,NavbarGithubConfigWithOptions:()=>J7t,NavbarLink:()=>X7t,NavbarLinkConfig:()=>K9,NavigationConfig:()=>ipe,NavigationItem:()=>J9,PageActionOption:()=>oWt,PageActionOptions:()=>sWt,PageActionsConfig:()=>aWt,PageActionsThemeConfig:()=>gWt,PageConfiguration:()=>oM,PathLibraryInputSchema:()=>U7t,PlaygroundButtonSettings:()=>JGt,PlaygroundSettings:()=>$9,PostHogConfig:()=>$Gt,ProductConfig:()=>pWt,ProductConfigBase:()=>ILe,ProductFileConfig:()=>K$o,ProductPath:()=>J$o,ProductSwitcherThemeConfig:()=>AWt,ProgrammingLanguage:()=>fWt,RedirectConfig:()=>dWt,RelativeProductPath:()=>CWt,Role:()=>pLe,RoleId:()=>f_e,SearchbarPlacement:()=>k7t,SectionConfiguration:()=>wWt,SegmentConfig:()=>HGt,SidebarThemeConfig:()=>yWt,SnippetLanguageConfiguration:()=>nM,SnippetsConfiguration:()=>XGt,SwitcherPlacement:()=>Q7t,TabConfig:()=>ope,TabId:()=>sM,TabVariant:()=>eWt,TabbedNavigationConfig:()=>nWt,TabbedNavigationItem:()=>rWt,TabbedNavigationItemWithLayout:()=>Z7t,TabbedNavigationItemWithVariants:()=>tWt,TabsPlacement:()=>N7t,TabsThemeConfig:()=>bWt,Target:()=>iM,ThemeConfig:()=>EWt,TitleSource:()=>hLe,TwitterCardSetting:()=>$7t,UntabbedNavigationConfig:()=>iWt,VersionAvailability:()=>uWt,VersionConfig:()=>vLe,VersionFileConfig:()=>Y$o,VersionedSnippetLanguageConfiguration:()=>YGt,WithFeatureFlags:()=>fd,WithPermissions:()=>dd,WithViewers:()=>npe,docs:()=>EHn});var EHn={};X(EHn,{AbsoluteProductPath:()=>NGt,AiChatConfig:()=>Bmt,AiChatDatasource:()=>MGt,AiChatLocation:()=>LGt,AiChatModel:()=>UGt,AiChatWebsiteDatasource:()=>jGt,AiExamplesConfig:()=>zGt,AnalyticsConfig:()=>KGt,AnnouncementConfig:()=>rpe,ApiReferenceConfiguration:()=>e7t,ApiReferenceEndpointConfiguration:()=>t7t,ApiReferenceLayoutItem:()=>H9,ApiReferenceOperationConfiguration:()=>r7t,ApiReferencePackageConfiguration:()=>n7t,ApiReferencePackageConfigurationWithOptions:()=>o7t,ApiReferenceSectionConfiguration:()=>i7t,Audience:()=>W9,AudienceId:()=>Omt,Availability:()=>Lw,BackgroundImageConfiguration:()=>a7t,BackgroundImageThemedConfig:()=>s7t,BodyThemeConfig:()=>u7t,ChangelogConfiguration:()=>c7t,ChangelogFolderRelativePath:()=>dLe,ColorConfig:()=>$b,ColorThemedConfig:()=>l7t,ColorsConfiguration:()=>p7t,ContentAlignment:()=>f7t,CssConfig:()=>d7t,CustomDomain:()=>m7t,CustomPageAction:()=>h7t,DocsConfiguration:()=>H$o,DocsInstance:()=>b7t,DocsSettingsConfig:()=>I7t,DocsTypographyConfig:()=>_7t,EditThisPageConfig:()=>y7t,EditThisPageLaunch:()=>g7t,ExperimentalConfig:()=>S7t,ExternalProduct:()=>cWt,FeatureFlag:()=>Pmt,FeatureFlagConfiguration:()=>ZGt,FolderConfiguration:()=>vWt,FontConfig:()=>yLe,FontConfigPath:()=>C7t,FontConfigVariant:()=>w7t,FontDisplay:()=>x7t,FontStyle:()=>gLe,FontWeight:()=>ALe,FooterLinksConfig:()=>B7t,FooterNavThemeConfig:()=>mWt,FullStoryAnalyticsConfig:()=>VGt,GitLibraryInputSchema:()=>L7t,GithubEditThisPageConfig:()=>A7t,GoogleAnalytics4Config:()=>qGt,GtmConfig:()=>GGt,HeaderPosition:()=>F7t,HttpSnippetLanguage:()=>E7t,HttpSnippetsConfig:()=>v7t,IntegrationsConfig:()=>O7t,IntercomConfig:()=>WGt,InternalProduct:()=>lWt,JsConfig:()=>R7t,JsConfigOptions:()=>Tmt,JsFileConfig:()=>T7t,JsFileConfigSettings:()=>P7t,JsRemoteConfig:()=>D7t,JsScriptStrategy:()=>bLe,Language:()=>mLe,LanguageSwitcherThemeConfig:()=>hWt,LayoutConfig:()=>j7t,LibraryConfig:()=>M7t,LibraryConfiguration:()=>G7t,LibraryInputConfiguration:()=>z7t,LibraryLanguage:()=>V7t,LibraryName:()=>ELe,LibraryOutputConfiguration:()=>q7t,LibraryReferenceConfiguration:()=>IWt,LinkConfiguration:()=>fLe,LogoConfiguration:()=>W7t,MetadataConfig:()=>H7t,NavbarDropdownConfig:()=>K7t,NavbarGithubConfig:()=>Y7t,NavbarGithubConfigWithOptions:()=>J7t,NavbarLink:()=>X7t,NavbarLinkConfig:()=>K9,NavigationConfig:()=>ipe,NavigationItem:()=>J9,PageActionOption:()=>oWt,PageActionOptions:()=>sWt,PageActionsConfig:()=>aWt,PageActionsThemeConfig:()=>gWt,PageConfiguration:()=>oM,PathLibraryInputSchema:()=>U7t,PlaygroundButtonSettings:()=>JGt,PlaygroundSettings:()=>$9,PostHogConfig:()=>$Gt,ProductConfig:()=>pWt,ProductConfigBase:()=>ILe,ProductFileConfig:()=>K$o,ProductPath:()=>J$o,ProductSwitcherThemeConfig:()=>AWt,ProgrammingLanguage:()=>fWt,RedirectConfig:()=>dWt,RelativeProductPath:()=>CWt,Role:()=>pLe,RoleId:()=>f_e,SearchbarPlacement:()=>k7t,SectionConfiguration:()=>wWt,SegmentConfig:()=>HGt,SidebarThemeConfig:()=>yWt,SnippetLanguageConfiguration:()=>nM,SnippetsConfiguration:()=>XGt,SwitcherPlacement:()=>Q7t,TabConfig:()=>ope,TabId:()=>sM,TabVariant:()=>eWt,TabbedNavigationConfig:()=>nWt,TabbedNavigationItem:()=>rWt,TabbedNavigationItemWithLayout:()=>Z7t,TabbedNavigationItemWithVariants:()=>tWt,TabsPlacement:()=>N7t,TabsThemeConfig:()=>bWt,Target:()=>iM,ThemeConfig:()=>EWt,TitleSource:()=>hLe,TwitterCardSetting:()=>$7t,UntabbedNavigationConfig:()=>iWt,VersionAvailability:()=>uWt,VersionConfig:()=>vLe,VersionFileConfig:()=>Y$o,VersionedSnippetLanguageConfiguration:()=>YGt,WithFeatureFlags:()=>fd,WithPermissions:()=>dd,WithViewers:()=>npe});var se={};X(se,{JsonError:()=>uLe,ParseError:()=>cLe,any:()=>F$o,bigint:()=>I$o,boolean:()=>k$o,booleanLiteral:()=>D$o,date:()=>w$o,discriminant:()=>G$o,enum_:()=>FGt,getObjectLikeUtils:()=>t8,getObjectUtils:()=>p_e,getSchemaUtils:()=>pd,isProperty:()=>tne,lazy:()=>C$o,lazyObject:()=>P$o,list:()=>QGt,never:()=>Q$o,number:()=>N$o,object:()=>kGt,objectWithoutOptionalProperties:()=>O$o,optional:()=>hHn,property:()=>_$o,record:()=>U$o,set:()=>z$o,string:()=>j$o,stringLiteral:()=>R$o,transform:()=>gHn,undiscriminatedUnion:()=>q$o,union:()=>$$o,unknown:()=>M$o,withParsedProperties:()=>bHn});var oc={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",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function Qf(e,t){return`Expected ${t}. Received ${CFc(e)}.`}function CFc(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 jw(e){return{...e,json:v$o(e.json),parse:v$o(e.parse)}}function v$o(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(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
1459
1459
  `)),{ok:!0,value:t}):n}}function RGt(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var uLe=class e extends Error{errors;constructor(t){super(t.map(RGt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var cLe=class e extends Error{errors;constructor(t){super(t.map(RGt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function pd(e){return{nullable:()=>xFc(e),optional:()=>hHn(e),optionalNullable:()=>_Fc(e),transform:t=>gHn(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new cLe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new uLe(n.errors)}}}function xFc(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:()=>oc.NULLABLE};return{...t,...pd(t)}}function hHn(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:()=>oc.OPTIONAL};return{...t,...pd(t)}}function _Fc(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:()=>oc.OPTIONAL_NULLABLE};return{...t,...pd(t)}}function gHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...pd(r)}}function I$o(){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:Qf(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:Qf(t,"bigint")}]}:{ok:!0,value:t},getType:()=>oc.BIGINT};return{...jw(e),...pd(e)}}var SFc=/^([+-]?\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 w$o(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Qf(t,"string")}]}:SFc.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Qf(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Qf(t,"Date object")}]},getType:()=>oc.DATE};return{...jw(e),...pd(e)}}function Mw(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...jw(r),...pd(r)}}}function FGt(e){let t=new Set(e);return Mw(oc.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:Qf(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:Qf(n,"enum")}]}:{ok:!0,value:n})()}function C$o(e){let t=AHn(e);return{...t,...pd(t)}}function AHn(e){return{parse:(t,r)=>lLe(e).parse(t,r),json:(t,r)=>lLe(e).json(t,r),getType:()=>lLe(e).getType()}}function lLe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function yHn(e){return Object.entries(e)}function _mt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function ene(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function Smt(e){return Object.keys(e)}function x$o(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var BFc=Object.prototype.hasOwnProperty;function t8(e){return{withParsedProperties:t=>bHn(e,t)}}function bHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(BFc.call(t,a)){let u=t[a];s[a]=typeof u=="function"?u(o.value):u}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!ene(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Qf(n,"object")}]};let o=new Set(Object.keys(t)),s=_mt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...pd(r),...t8(r)}}function _$o(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function tne(e){return e.isProperty}var OFc=Object.prototype.hasOwnProperty;function kGt(e){let t;function r(){if(t==null){t={};for(let[d,f]of yHn(e)){let m=tne(f)?f.rawKey:d,h=tne(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of yHn(e)){let m=tne(f)?f.rawKey:d,h=tne(f)?f.valueSchema:f;PFc(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function u(){return i==null&&a(),i}function c(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>tne(f)?f.rawKey:d),_getParsedProperties:()=>Smt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return S$o({value:d,requiredKeys:a(),requiredKeysSet:c(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let b=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return S$o({value:d,requiredKeys:u(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return tne(g)?{transformedKey:g.rawKey,transform:A=>{let b=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:b})}}:{transformedKey:h,transform:A=>{let b=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>oc.OBJECT};return{...jw(p),...pd(p),...t8(p),...p_e(p)}}function S$o({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!ene(e))return{ok:!1,errors:[{path:s,message:Qf(e,"object")}]};let a=t.length,u=[],c={};for(let l in e){if(!OFc.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?c[d.transformedKey]=f.value:(c[l]=p,u.push(...f.errors))}else switch(i){case"fail":u.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=p;break}}if(a>0)for(let l of t)l in e||u.push({path:s,message:`Missing required key "${l}"`});return u.length===0||o?{ok:!0,value:c}:{ok:!1,errors:u}}function p_e(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>B$o({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>B$o({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>oc.OBJECT};return{...r,...pd(r),...t8(r),...p_e(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))t.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))r.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},getType:()=>oc.OBJECT};return{...n,...pd(n),...t8(n),...p_e(n)}}}}function B$o({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!ene(t))return{ok:!1,errors:[{path:i,message:Qf(t,"object")}]};let o=new Set(e),[s,a]=x$o(Smt(t),l=>o.has(l)),u=r(_mt(t,a)),c=n(_mt(t,s));return u.ok&&c.ok?{ok:!0,value:{...u.value,...c.value}}:{ok:!1,errors:[...u.ok?[]:u.errors,...c.ok?[]:c.errors]}}function PFc(e){return!TFc(e)}function TFc(e){switch(e.getType()){case oc.ANY:case oc.UNKNOWN:case oc.OPTIONAL:case oc.OPTIONAL_NULLABLE:return!0;default:return!1}}function O$o(e){return kGt(e)}function P$o(e){let t={...AHn(e),_getRawProperties:()=>lLe(e)._getRawProperties(),_getParsedProperties:()=>lLe(e)._getParsedProperties()};return{...t,...pd(t),...t8(t),...p_e(t)}}function QGt(e){let t={parse:(r,n)=>T$o(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>T$o(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>oc.LIST};return{...jw(t),...pd(t)}}function T$o(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:Qf(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function D$o(e){return Mw(oc.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Qf(r,`${e.toString()}`)}]})()}function R$o(e){return Mw(oc.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Qf(r,`"${e}"`)}]})()}var F$o=Mw(oc.ANY,e=>({ok:!0,value:e}));var k$o=Mw(oc.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Qf(e,"boolean")}]});var Q$o=Mw(oc.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var N$o=Mw(oc.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Qf(e,"number")}]});var j$o=Mw(oc.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Qf(e,"string")}]});var M$o=Mw(oc.UNKNOWN,e=>({ok:!0,value:e}));var DFc=Object.prototype.hasOwnProperty;function U$o(e,t){let r={parse:(n,i)=>L$o({value:n,isKeyNumeric:e.getType()===oc.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>L$o({value:n,isKeyNumeric:e.getType()===oc.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>oc.RECORD};return{...jw(r),...pd(r)}}function L$o({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!ene(e))return{ok:!1,errors:[{path:i,message:Qf(e,"object")}]};let o={},s=[];for(let a in e){if(!DFc.call(e,a))continue;let u=e[a];if(u===void 0)continue;let c=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(c=d)}let l=r(c),p=n(u,c);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function z$o(e){let t=QGt(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Qf(n,"Set")}]},getType:()=>oc.SET};return{...jw(r),...pd(r)}}function q$o(e){let t={parse:(r,n)=>V$o((i,o)=>i.parse(r,o),e,n),json:(r,n)=>V$o((i,o)=>i.json(r,o),e,n),getType:()=>oc.UNDISCRIMINATED_UNION};return{...jw(t),...pd(t)}}function V$o(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function G$o(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var RFc=Object.prototype.hasOwnProperty;function $$o(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=FGt(Smt(t)),o={parse:(s,a)=>W$o({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>i.parse(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.parse(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>W$o({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>i.json(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.json(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>oc.UNION};return{...jw(o),...pd(o),...t8(o)}}function W$o({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!ene(e))return{ok:!1,errors:[{path:a,message:Qf(e,"object")}]};let u=e[t],c={};for(let f in e)RFc.call(e,f)&&f!==t&&(c[f]=e[f]);if(u==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(u);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...c}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(c,p);return d.ok?{ok:!0,value:{[r]:u,...d.value}}:d}var NGt=se.object({href:se.string()});var jGt=se.object({url:se.string(),title:se.string().optional()});var MGt=se.undiscriminatedUnion([jGt]);var LGt=se.enum_(["docs","slack","discord"]);var UGt=se.enum_(["claude-3.7","claude-4","command-a"]);var Bmt=se.object({model:UGt.optional(),systemPrompt:se.property("system-prompt",se.string().optional()),location:se.list(LGt).optional(),datasources:se.list(MGt).optional()});var zGt=se.object({enabled:se.boolean().optional(),style:se.string().optional()});var VGt=se.object({orgId:se.property("org-id",se.string())});var qGt=se.object({measurementId:se.property("measurement-id",se.string())});var GGt=se.object({containerId:se.property("container-id",se.string())});var WGt=se.object({appId:se.property("app-id",se.string()),apiBase:se.property("api-base",se.string().optional())});var $Gt=se.object({apiKey:se.property("api-key",se.string()),endpoint:se.string().optional()});var HGt=se.object({writeKey:se.property("write-key",se.string())});var KGt=se.object({segment:HGt.optional(),fullstory:VGt.optional(),intercom:WGt.optional(),posthog:$Gt.optional(),gtm:GGt.optional(),ga4:qGt.optional()});var rpe=se.object({message:se.string()});var Omt=se.string();var W9=se.undiscriminatedUnion([Omt,se.list(Omt)]);var Lw=se.enum_(["stable","generally-available","in-development","pre-release","deprecated","beta"]);var JGt=se.object({href:se.string().optional()});var $9=se.object({hidden:se.boolean().optional(),environments:se.list(se.string()).optional(),button:JGt.optional(),oauth:se.boolean().optional(),limitWebsocketMessagesPerConnection:se.property("limit-websocket-messages-per-connection",se.number().optional())});var YGt=se.object({version:se.string(),package:se.string()});var nM=se.undiscriminatedUnion([se.string(),YGt]);var XGt=se.object({python:nM.optional(),typescript:nM.optional(),go:nM.optional(),java:nM.optional(),ruby:nM.optional(),csharp:nM.optional(),php:nM.optional(),swift:nM.optional(),rust:nM.optional()});var Pmt=se.object({flag:se.string(),fallbackValue:se.property("fallback-value",se.unknown().optional()),match:se.unknown().optional()});var ZGt=se.undiscriminatedUnion([se.string(),Pmt,se.list(Pmt)]);var fd=se.object({featureFlag:se.property("feature-flag",ZGt.optional())});var f_e=se.string();var pLe=se.undiscriminatedUnion([f_e,se.list(f_e)]);var dd=se.object({viewers:pLe.optional(),orphaned:se.boolean().optional()});var e7t=se.object({api:se.string(),apiName:se.property("api-name",se.string().optional()),openrpc:se.string().optional(),audiences:W9.optional(),displayErrors:se.property("display-errors",se.boolean().optional()),tagDescriptionPages:se.property("tag-description-pages",se.boolean().optional()),snippets:XGt.optional(),postman:se.string().optional(),summary:se.string().optional(),layout:se.list(se.lazy(()=>H9)).optional(),collapsed:se.undiscriminatedUnion([se.boolean(),se.stringLiteral("open-by-default")]).optional(),icon:se.string().optional(),slug:se.string().optional(),hidden:se.boolean().optional(),availability:Lw.optional(),skipSlug:se.property("skip-slug",se.boolean().optional()),alphabetized:se.boolean().optional(),flattened:se.boolean().optional(),paginated:se.boolean().optional(),playground:$9.optional()}).extend(dd).extend(fd);var t7t=se.object({endpoint:se.string(),title:se.string().optional(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),availability:Lw.optional(),playground:$9.optional()}).extend(dd).extend(fd);var r7t=se.object({operation:se.string(),title:se.string().optional(),slug:se.string().optional(),hidden:se.boolean().optional(),availability:Lw.optional()}).extend(dd).extend(fd);var iM=se.enum_(["_blank","_self","_parent","_top"]);var fLe=se.object({link:se.string(),href:se.string(),icon:se.string().optional(),target:iM.optional()});var oM=se.object({page:se.string(),path:se.string(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),noindex:se.boolean().optional(),availability:Lw.optional()}).extend(dd).extend(fd);var H9=se.undiscriminatedUnion([se.string(),se.record(se.string(),se.lazy(()=>n7t)),se.lazyObject(()=>i7t),t7t,r7t,oM,fLe]);var n7t=se.undiscriminatedUnion([se.list(se.lazy(()=>H9)),se.lazyObject(()=>o7t)]);var o7t=se.object({title:se.string().optional(),summary:se.string().optional(),contents:se.list(se.lazy(()=>H9)).optional(),availability:Lw.optional(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),skipSlug:se.property("skip-slug",se.boolean().optional()),playground:$9.optional()}).extend(dd).extend(fd);var i7t=se.object({section:se.string(),referencedPackages:se.property("referenced-packages",se.list(se.string()).optional()),summary:se.string().optional(),contents:se.list(se.lazy(()=>H9)).optional(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),skipSlug:se.property("skip-slug",se.boolean().optional()),collapsed:se.undiscriminatedUnion([se.boolean(),se.stringLiteral("open-by-default")]).optional(),collapsible:se.boolean().optional(),collapsedByDefault:se.property("collapsed-by-default",se.boolean().optional()),availability:Lw.optional(),playground:$9.optional()}).extend(dd).extend(fd);var s7t=se.object({dark:se.string().optional(),light:se.string().optional()});var a7t=se.undiscriminatedUnion([se.string(),s7t]);var u7t=se.enum_(["default","canvas"]);var dLe=se.string();var c7t=se.object({changelog:dLe,title:se.string().optional(),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional()}).extend(dd).extend(fd);var l7t=se.object({dark:se.string().optional(),light:se.string().optional()});var $b=se.undiscriminatedUnion([se.string(),l7t]);var p7t=se.object({accentPrimary:se.property("accent-primary",$b.optional()),accentPrimaryDeprecated:se.property("accentPrimary",$b.optional()),background:$b.optional(),border:$b.optional(),sidebarBackground:se.property("sidebar-background",$b.optional()),headerBackground:se.property("header-background",$b.optional()),cardBackground:se.property("card-background",$b.optional()),accent1:se.property("accent-1",$b.optional()),accent2:se.property("accent-2",$b.optional()),accent3:se.property("accent-3",$b.optional()),accent4:se.property("accent-4",$b.optional()),accent5:se.property("accent-5",$b.optional()),accent6:se.property("accent-6",$b.optional()),accent7:se.property("accent-7",$b.optional()),accent8:se.property("accent-8",$b.optional()),accent9:se.property("accent-9",$b.optional()),accent10:se.property("accent-10",$b.optional()),accent11:se.property("accent-11",$b.optional()),accent12:se.property("accent-12",$b.optional())});var f7t=se.enum_(["center","left"]);var d7t=se.undiscriminatedUnion([se.string(),se.list(se.string())]);var m7t=se.undiscriminatedUnion([se.string(),se.list(se.string())]);var h7t=se.object({title:se.string(),subtitle:se.string().optional(),url:se.string(),icon:se.string().optional(),default:se.boolean().optional()});var g7t=se.enum_(["github","dashboard"]);var A7t=se.object({host:se.string().optional(),owner:se.string(),repo:se.string(),branch:se.string().optional()});var y7t=se.object({github:A7t.optional(),launch:g7t.optional()});var b7t=se.object({url:se.string(),customDomain:se.property("custom-domain",m7t.optional()),private:se.boolean().optional(),editThisPage:se.property("edit-this-page",y7t.optional()),audiences:W9.optional()});var E7t=se.enum_(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]);var v7t=se.undiscriminatedUnion([se.boolean(),se.list(E7t)]);var mLe=se.enum_(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]);var hLe=se.enum_(["frontmatter","filename"]);var I7t=se.object({searchText:se.property("search-text",se.string().optional()),disableSearch:se.property("disable-search",se.boolean().optional()),darkModeCode:se.property("dark-mode-code",se.boolean().optional()),defaultSearchFilters:se.property("default-search-filters",se.boolean().optional()),httpSnippets:se.property("http-snippets",v7t.optional()),hide404Page:se.property("hide-404-page",se.boolean().optional()),useJavascriptAsTypescript:se.property("use-javascript-as-typescript",se.boolean().optional()),disableExplorerProxy:se.property("disable-explorer-proxy",se.boolean().optional()),disableAnalytics:se.property("disable-analytics",se.boolean().optional()),language:mLe.optional(),folderTitleSource:se.property("folder-title-source",hLe.optional()),substituteEnvVars:se.property("substitute-env-vars",se.boolean().optional())});var gLe=se.enum_(["normal","italic"]);var ALe=se.undiscriminatedUnion([se.string(),se.number()]);var w7t=se.object({path:se.string(),weight:ALe.optional(),style:gLe.optional()});var C7t=se.undiscriminatedUnion([se.string(),w7t]);var x7t=se.enum_(["auto","block","swap","fallback","optional"]);var yLe=se.object({name:se.string().optional(),path:se.string().optional(),weight:ALe.optional(),style:gLe.optional(),paths:se.list(C7t).optional(),display:x7t.optional(),fallback:se.list(se.string()).optional(),fontVariationSettings:se.property("font-variation-settings",se.string().optional())});var _7t=se.object({headingsFont:yLe.optional(),bodyFont:yLe.optional(),codeFont:yLe.optional()});var S7t=se.object({mdxComponents:se.property("mdx-components",se.list(se.string()).optional()),disableStreamToggle:se.property("disable-stream-toggle",se.boolean().optional()),openapiParserV2:se.property("openapi-parser-v2",se.boolean().optional()),openapiParserV3:se.property("openapi-parser-v3",se.boolean().optional()),dynamicSnippets:se.property("dynamic-snippets",se.boolean().optional()),aiExamples:se.property("ai-examples",se.boolean().optional()),aiExampleStyleInstructions:se.property("ai-example-style-instructions",se.string().optional()),excludeApis:se.property("exclude-apis",se.boolean().optional()),basepathAware:se.property("basepath-aware",se.boolean().optional())});var B7t=se.object({github:se.string().optional(),twitter:se.string().optional(),x:se.string().optional(),linkedin:se.string().optional(),youtube:se.string().optional(),instagram:se.string().optional(),facebook:se.string().optional(),discord:se.string().optional(),slack:se.string().optional(),hackernews:se.string().optional(),medium:se.string().optional(),website:se.string().optional()});var O7t=se.object({intercom:se.string().optional()});var bLe=se.enum_(["beforeInteractive","afterInteractive","lazyOnload"]);var P7t=se.object({path:se.string(),strategy:bLe.optional()});var T7t=se.undiscriminatedUnion([se.string(),P7t]);var D7t=se.object({url:se.string(),strategy:bLe.optional()});var Tmt=se.undiscriminatedUnion([D7t,T7t]);var R7t=se.undiscriminatedUnion([Tmt,se.list(Tmt)]);var F7t=se.enum_(["fixed","static"]);var k7t=se.enum_(["header","header-tabs","sidebar"]);var Q7t=se.enum_(["header","sidebar"]);var N7t=se.enum_(["header","sidebar"]);var j7t=se.object({pageWidth:se.property("page-width",se.string().optional()),contentWidth:se.property("content-width",se.string().optional()),sidebarWidth:se.property("sidebar-width",se.string().optional()),headerHeight:se.property("header-height",se.string().optional()),searchbarPlacement:se.property("searchbar-placement",k7t.optional()),tabsPlacement:se.property("tabs-placement",N7t.optional()),switcherPlacement:se.property("switcher-placement",Q7t.optional()),contentAlignment:se.property("content-alignment",f7t.optional()),headerPosition:se.property("header-position",F7t.optional()),disableHeader:se.property("disable-header",se.boolean().optional()),hideNavLinks:se.property("hide-nav-links",se.boolean().optional()),hideFeedback:se.property("hide-feedback",se.boolean().optional())});var M7t=se.object({doxyfile:se.string().optional()});var L7t=se.object({git:se.string(),subpath:se.string().optional()});var U7t=se.object({path:se.string()});var z7t=se.undiscriminatedUnion([L7t,U7t]);var V7t=se.enum_(["python","cpp"]);var q7t=se.object({path:se.string()});var G7t=se.object({input:z7t,output:q7t,lang:V7t,config:M7t.optional()});var ELe=se.string();var W7t=se.object({dark:se.string().optional(),light:se.string().optional(),height:se.number().optional(),href:se.string().optional(),rightText:se.property("right-text",se.string().optional())});var $7t=se.enum_(["summary","summary_large_image","app","player"]);var H7t=se.object({ogSiteName:se.property("og:site_name",se.string().optional()),ogTitle:se.property("og:title",se.string().optional()),ogDescription:se.property("og:description",se.string().optional()),ogUrl:se.property("og:url",se.string().optional()),ogImage:se.property("og:image",se.string().optional()),ogImageWidth:se.property("og:image:width",se.number().optional()),ogImageHeight:se.property("og:image:height",se.number().optional()),ogLocale:se.property("og:locale",se.string().optional()),ogLogo:se.property("og:logo",se.string().optional()),twitterTitle:se.property("twitter:title",se.string().optional()),twitterDescription:se.property("twitter:description",se.string().optional()),twitterHandle:se.property("twitter:handle",se.string().optional()),twitterImage:se.property("twitter:image",se.string().optional()),twitterSite:se.property("twitter:site",se.string().optional()),twitterUrl:se.property("twitter:url",se.string().optional()),twitterCard:se.property("twitter:card",$7t.optional()),ogDynamic:se.property("og:dynamic",se.boolean().optional()),ogBackgroundImage:se.property("og:background-image",se.string().optional()),canonicalHost:se.property("canonical-host",se.string().optional())});var npe=se.object({viewers:pLe.optional()});var K9=se.object({href:se.string().optional(),target:iM.optional(),url:se.string().optional(),text:se.string().optional(),icon:se.string().optional(),rightIcon:se.string().optional(),rounded:se.boolean().optional()}).extend(npe);var K7t=se.object({links:se.list(K9),text:se.string().optional(),icon:se.string().optional(),rightIcon:se.string().optional(),rounded:se.boolean().optional()}).extend(npe);var J7t=se.object({url:se.string(),target:iM.optional()}).extend(npe);var Y7t=se.undiscriminatedUnion([se.string(),J7t]);var X7t=se.union("type",{filled:K9,outlined:K9,minimal:K9,github:se.object({value:Y7t}),dropdown:K7t,primary:K9,secondary:K9}).transform({transform:e=>e,untransform:e=>e});var sM=se.string();var Z7t=se.object({tab:sM,layout:se.list(se.lazy(()=>J9)).optional()});var eWt=se.object({title:se.string(),subtitle:se.string().optional(),icon:se.string().optional(),layout:se.list(se.lazy(()=>J9)),slug:se.string().optional(),skipSlug:se.property("skip-slug",se.boolean().optional()),hidden:se.boolean().optional(),default:se.boolean().optional()}).extend(dd).extend(fd);var tWt=se.object({tab:sM,variants:se.list(eWt)});var rWt=se.undiscriminatedUnion([Z7t,tWt]);var nWt=se.list(rWt);var iWt=se.list(se.lazy(()=>J9));var ipe=se.undiscriminatedUnion([iWt,nWt]);var oWt=se.enum_(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]);var sWt=se.object({copyPage:se.property("copy-page",se.boolean().optional()),viewAsMarkdown:se.property("view-as-markdown",se.boolean().optional()),askAi:se.property("ask-ai",se.boolean().optional()),chatgpt:se.boolean().optional(),claude:se.boolean().optional(),cursor:se.boolean().optional(),vscode:se.boolean().optional(),custom:se.list(h7t).optional()});var aWt=se.object({default:oWt.optional(),options:sWt.optional()});var uWt=se.enum_(["deprecated","ga","stable","beta"]);var vLe=se.object({displayName:se.property("display-name",se.string()),path:se.string(),slug:se.string().optional(),availability:uWt.optional(),audiences:W9.optional(),hidden:se.boolean().optional(),announcement:rpe.optional()}).extend(dd).extend(fd);var ILe=se.object({displayName:se.property("display-name",se.string()),subtitle:se.string().optional(),icon:se.string().optional(),image:se.string().optional(),versions:se.list(vLe).optional(),audiences:W9.optional()}).extend(dd).extend(fd);var cWt=se.object({href:se.string(),target:iM.optional()}).extend(ILe);var lWt=se.object({path:se.string(),slug:se.string().optional(),announcement:rpe.optional()}).extend(ILe);var pWt=se.undiscriminatedUnion([lWt,cWt]);var fWt=se.enum_(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]);var dWt=se.object({source:se.string(),destination:se.string(),permanent:se.boolean().optional()});var ope=se.object({displayName:se.property("display-name",se.string()),icon:se.string().optional(),slug:se.string().optional(),skipSlug:se.property("skip-slug",se.boolean().optional()),hidden:se.boolean().optional(),href:se.string().optional(),target:iM.optional(),changelog:dLe.optional()}).extend(dd).extend(fd);var mWt=se.enum_(["default","minimal"]);var hWt=se.enum_(["default","minimal"]);var gWt=se.enum_(["default","toolbar"]);var AWt=se.enum_(["default","toggle"]);var yWt=se.enum_(["default","minimal"]);var bWt=se.enum_(["default","bubble"]);var EWt=se.object({sidebar:yWt.optional(),body:u7t.optional(),tabs:bWt.optional(),pageActions:se.property("page-actions",gWt.optional()),footerNav:se.property("footer-nav",mWt.optional()),languageSwitcher:se.property("language-switcher",hWt.optional()),productSwitcher:se.property("product-switcher",AWt.optional())});var H$o=se.object({instances:se.list(b7t),title:se.string().optional(),libraries:se.record(ELe,G7t).optional(),analytics:KGt.optional(),announcement:rpe.optional(),roles:se.list(f_e).optional(),tabs:se.record(sM,ope).optional(),versions:se.list(vLe).optional(),products:se.list(pWt).optional(),landingPage:se.property("landing-page",oM.optional()),navigation:ipe.optional(),navbarLinks:se.property("navbar-links",se.list(X7t).optional()),footerLinks:se.property("footer-links",B7t.optional()),pageActions:se.property("page-actions",aWt.optional()),experimental:S7t.optional(),defaultLanguage:se.property("default-language",fWt.optional()),languages:se.list(mLe).optional(),aiChat:se.property("ai-chat",Bmt.optional()),aiSearch:se.property("ai-search",Bmt.optional()),aiExamples:se.property("ai-examples",zGt.optional()),metadata:H7t.optional(),redirects:se.list(dWt).optional(),logo:W7t.optional(),favicon:se.string().optional(),backgroundImage:se.property("background-image",a7t.optional()),colors:p7t.optional(),typography:_7t.optional(),layout:j7t.optional(),settings:I7t.optional(),theme:EWt.optional(),integrations:O7t.optional(),css:d7t.optional(),js:R7t.optional(),header:se.string().optional(),footer:se.string().optional()});var vWt=se.object({folder:se.string(),title:se.string().optional(),titleSource:se.property("title-source",hLe.optional()),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),skipSlug:se.property("skip-slug",se.boolean().optional()),collapsed:se.undiscriminatedUnion([se.boolean(),se.stringLiteral("open-by-default")]).optional(),collapsible:se.boolean().optional(),collapsedByDefault:se.property("collapsed-by-default",se.boolean().optional()),availability:Lw.optional()}).extend(dd).extend(fd);var IWt=se.object({library:ELe,title:se.string().optional(),slug:se.string().optional()}).extend(dd).extend(fd);var J9=se.undiscriminatedUnion([oM,se.lazyObject(()=>wWt),e7t,IWt,fLe,c7t,vWt]);var K$o=se.object({tabs:se.record(sM,ope).optional(),landingPage:se.property("landing-page",oM.optional()),navigation:ipe});var CWt=se.object({displayName:se.property("display-name",se.string()),path:se.string(),slug:se.string().optional()}).extend(dd).extend(fd);var J$o=se.undiscriminatedUnion([CWt,NGt]);var wWt=se.object({section:se.string(),path:se.string().optional(),contents:se.list(se.lazy(()=>J9)),collapsed:se.undiscriminatedUnion([se.boolean(),se.stringLiteral("open-by-default")]).optional(),collapsible:se.boolean().optional(),collapsedByDefault:se.property("collapsed-by-default",se.boolean().optional()),slug:se.string().optional(),icon:se.string().optional(),hidden:se.boolean().optional(),skipSlug:se.property("skip-slug",se.boolean().optional()),availability:Lw.optional()}).extend(dd).extend(fd);var Y$o=se.object({tabs:se.record(sM,ope).optional(),landingPage:se.property("landing-page",oM.optional()),navigation:ipe});var X$o=require("fs/promises");var FFc=/\r?\n/;async function spe({absolutePathToFernignore:e}){let t=(await(0,X$o.readFile)(e)).toString();return Z$o(t)}function Z$o(e){return[gS,...e.trim().split(FFc).map(t=>{let r=t.indexOf("#");return r!==-1?t.slice(0,r).trim():t.trim()}).filter(t=>t.length>0)]}var bn={};X(bn,{API_ORIGIN_LOCATION_KEY:()=>jqo,API_SETTINGS_KEY:()=>zqo,ASYNC_API_LOCATION_KEY:()=>Mqo,CoerceConstsTo:()=>dHo,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>B4e,DEFAULT_GROUP_NAME:()=>Ldt,DefaultIntegerFormat:()=>mHo,ExampleStyle:()=>hHo,FormParameterEncoding:()=>gHo,GenerationLanguage:()=>eHo,GithubCommitAndReleaseMode:()=>IHo,GithubLicenseType:()=>CHo,GithubSelfhostedMode:()=>wHo,Language:()=>AHo,MessageNamingSettingsSchema:()=>yHo,ModelProvider:()=>nHo,OPENAPI_LOCATION_KEY:()=>Lqo,OPENAPI_OVERRIDES_LOCATION_KEY:()=>Uqo,PathParameterOrder:()=>bHo,RemoveDiscriminantsFromSchemas:()=>EHo,UnionSettingsSchema:()=>vHo,ai:()=>IHn,fernDefinition:()=>CHn,generators:()=>xHn,getPackageName:()=>tHo,group:()=>_Hn,isApiConfigurationV2Schema:()=>tKo,isAsyncApiSpecSchema:()=>rKo,isConjureSchema:()=>nKo,isGraphQLSpecSchema:()=>iKo,isNamespacedApiConfiguration:()=>oKo,isOpenApiSpecSchema:()=>sKo,isOpenRpcSpecSchema:()=>aKo,isProtoSpecSchema:()=>uKo,isRawProtobufAPIDefinitionSchema:()=>rHo,license:()=>SHn,replay:()=>xHo,reviewers:()=>_Ho,serialization:()=>KHn});var eHo={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function tHo({generatorInvocation:e}){return e.language==="go"?kFc(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 kFc(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 rHo(e){return typeof e!="string"&&"proto"in e}var IHn={};X(IHn,{ModelProvider:()=>nHo});var nHo={Openai:"openai",Anthropic:"anthropic",Bedrock:"bedrock"};var CHn={};X(CHn,{AvailabilityStatusSchema:()=>oHo,auth:()=>iHo,availability:()=>wHn,commons:()=>sHo,encoding:()=>aHo,environments:()=>uHo,file:()=>cHo,service:()=>lHo,types:()=>pHo,validation:()=>fHo});var iHo={};var wHn={};X(wHn,{AvailabilityStatusSchema:()=>oHo});var oHo={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var sHo={};var aHo={};var uHo={};var cHo={};var lHo={};var pHo={};var fHo={};var xHn={};X(xHn,{CoerceConstsTo:()=>dHo,DefaultIntegerFormat:()=>mHo,ExampleStyle:()=>hHo,FormParameterEncoding:()=>gHo,Language:()=>AHo,MessageNamingSettingsSchema:()=>yHo,PathParameterOrder:()=>bHo,RemoveDiscriminantsFromSchemas:()=>EHo,UnionSettingsSchema:()=>vHo});var dHo={Literals:"literals",Enums:"enums",EnumsCoerceableToLiterals:"enums-coerceable-to-literals"};var mHo={Int32:"int32",Int64:"int64",Uint32:"uint32",Uint64:"uint64"};var hHo={Minimal:"minimal",Comprehensive:"comprehensive"};var gHo={Form:"form",Json:"json"};var AHo={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};var yHo={V1:"v1",V2:"v2"};var bHo={UrlOrder:"url-order",SpecOrder:"spec-order"};var EHo={Always:"always",Never:"never"};var vHo={V1:"v1"};var _Hn={};X(_Hn,{GithubCommitAndReleaseMode:()=>IHo,GithubSelfhostedMode:()=>wHo});var IHo={Commit:"commit",Release:"release"};var wHo={PullRequest:"pull-request",Push:"push"};var SHn={};X(SHn,{GithubLicenseType:()=>CHo});var CHo={Mit:"MIT",Apache:"Apache-2.0"};var xHo={};var _Ho={};var KHn={};X(KHn,{AiServicesSchema:()=>TWt,ApiConfigurationSchema:()=>Q$t,ApiConfigurationSchemaInternal:()=>MLe,ApiConfigurationV2Schema:()=>F$t,ApiConfigurationV2SettingsSchema:()=>zLe,ApiConfigurationV2SpecsSchema:()=>VLe,ApiDefinitionList:()=>b$t,ApiDefinitionPathSchema:()=>lpe,ApiDefinitionSchema:()=>y$t,ApiDefinitionSettingsSchema:()=>kLe,ApiDefinitionWithOverridesSchema:()=>QLe,AsyncApiSettingsSchema:()=>ULe,AsyncApiSpecSchema:()=>B$t,BaseApiSettingsSchema:()=>LLe,CoerceConstsTo:()=>E$t,ConjureSchema:()=>S$t,CratesOutputLocationSchema:()=>L$t,DefaultIntegerFormat:()=>v$t,ExampleStyle:()=>N$t,FormParameterEncoding:()=>I$t,GeneratorApiSettingsSchema:()=>M$t,GeneratorGroupSchema:()=>uHt,GeneratorInvocationSchema:()=>aHt,GeneratorOutputSchema:()=>J$t,GeneratorPublishMetadataSchema:()=>Qmt,GeneratorSnippetsSchema:()=>Z$t,GeneratorsConfigurationSchema:()=>eKo,GeneratorsOpenApiObjectSchema:()=>lHt,GeneratorsOpenApiSchema:()=>pHt,GithubCommitAndReleaseMode:()=>eHt,GithubCommitAndReleaseSchema:()=>tHt,GithubConfigurationSchema:()=>sHt,GithubLicenseCustomSchema:()=>Y$t,GithubLicenseSchema:()=>uM,GithubLicenseType:()=>X$t,GithubPullRequestSchema:()=>rHt,GithubPushSchema:()=>nHt,GithubSelfhostedMode:()=>iHt,GithubSelfhostedSchema:()=>oHt,GraphQlSpecSchema:()=>O$t,Language:()=>fHt,LocalFileSystemOutputLocationSchema:()=>U$t,MavenOutputLocationSchema:()=>V$t,MavenOutputSignatureSchema:()=>z$t,MessageNamingSettingsSchema:()=>DLe,ModelName:()=>OWt,ModelProvider:()=>PWt,NamespacedApiConfigurationSchema:()=>k$t,NpmOutputLocationSchema:()=>q$t,NugetOutputLocationSchema:()=>G$t,OpenApiExampleGenerationSchema:()=>w$t,OpenApiFilterSchema:()=>C$t,OpenApiSettingsSchema:()=>ppe,OpenApiSpecSchema:()=>P$t,OpenRpcSpecSchema:()=>T$t,OutputMetadataAuthor:()=>j$t,OutputMetadataSchema:()=>fpe,OverridesSchema:()=>aM,PathParameterOrder:()=>RLe,PostmanOutputLocationSchema:()=>W$t,ProtobufApiDefinitionSchema:()=>jLe,ProtobufDefinitionSchema:()=>NLe,ProtobufSpecSchema:()=>D$t,PypiOutputLocationSchema:()=>H$t,PypiOutputMetadataSchema:()=>$$t,ReadmeCustomSectionSchema:()=>dHt,ReadmeEndpointObjectSchema:()=>mHt,ReadmeEndpointSchema:()=>Nmt,ReadmeSchema:()=>hHt,RemoveDiscriminantsFromSchemas:()=>FLe,ReplayConfigSchema:()=>cHt,RequestOrResponseExampleGenerationSchema:()=>Fmt,ResolveAliases:()=>_$t,ResolveAliasesSchema:()=>x$t,ReviewerSchema:()=>kmt,ReviewersSchema:()=>dpe,RubyGemsOutputLocationSchema:()=>K$t,SpecSchema:()=>R$t,UnionSettingsSchema:()=>A$t,WhitelabelConfigurationSchema:()=>AHt,WhitelabelGithubConfigurationSchema:()=>gHt,ai:()=>RHn,fernDefinition:()=>VHn,generators:()=>qHn,group:()=>GHn,license:()=>WHn,replay:()=>$Hn,reviewers:()=>HHn});var RHn={};X(RHn,{AiServicesSchema:()=>TWt,ModelName:()=>OWt,ModelProvider:()=>PWt});var ve={};X(ve,{JsonError:()=>wLe,ParseError:()=>CLe,any:()=>LHo,bigint:()=>BHo,boolean:()=>UHo,booleanLiteral:()=>jHo,date:()=>OHo,discriminant:()=>YHo,enum_:()=>_Wt,getObjectLikeUtils:()=>r8,getObjectUtils:()=>d_e,getSchemaUtils:()=>md,isProperty:()=>nne,lazy:()=>PHo,lazyObject:()=>QHo,list:()=>BWt,never:()=>zHo,number:()=>VHo,object:()=>SWt,objectWithoutOptionalProperties:()=>kHo,optional:()=>BHn,property:()=>DHo,record:()=>$Ho,set:()=>HHo,string:()=>qHo,stringLiteral:()=>MHo,transform:()=>OHn,undiscriminatedUnion:()=>JHo,union:()=>ZHo,unknown:()=>GHo,withParsedProperties:()=>DHn});var sc={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",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function Nf(e,t){return`Expected ${t}. Received ${QFc(e)}.`}function QFc(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 zw(e){return{...e,json:SHo(e.json),parse:SHo(e.parse)}}function SHo(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(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
1460
- `)),{ok:!0,value:t}):n}}function xWt(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var wLe=class e extends Error{errors;constructor(t){super(t.map(xWt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var CLe=class e extends Error{errors;constructor(t){super(t.map(xWt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function md(e){return{nullable:()=>NFc(e),optional:()=>BHn(e),optionalNullable:()=>jFc(e),transform:t=>OHn(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new CLe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new wLe(n.errors)}}}function NFc(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:()=>sc.NULLABLE};return{...t,...md(t)}}function BHn(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:()=>sc.OPTIONAL};return{...t,...md(t)}}function jFc(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:()=>sc.OPTIONAL_NULLABLE};return{...t,...md(t)}}function OHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...md(r)}}function BHo(){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:Nf(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:Nf(t,"bigint")}]}:{ok:!0,value:t},getType:()=>sc.BIGINT};return{...zw(e),...md(e)}}var MFc=/^([+-]?\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 OHo(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Nf(t,"string")}]}:MFc.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Nf(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Nf(t,"Date object")}]},getType:()=>sc.DATE};return{...zw(e),...md(e)}}function Vw(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...zw(r),...md(r)}}}function _Wt(e){let t=new Set(e);return Vw(sc.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:Nf(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:Nf(n,"enum")}]}:{ok:!0,value:n})()}function PHo(e){let t=PHn(e);return{...t,...md(t)}}function PHn(e){return{parse:(t,r)=>xLe(e).parse(t,r),json:(t,r)=>xLe(e).json(t,r),getType:()=>xLe(e).getType()}}function xLe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function THn(e){return Object.entries(e)}function Dmt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function rne(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function Rmt(e){return Object.keys(e)}function THo(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var LFc=Object.prototype.hasOwnProperty;function r8(e){return{withParsedProperties:t=>DHn(e,t)}}function DHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(LFc.call(t,a)){let u=t[a];s[a]=typeof u=="function"?u(o.value):u}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!rne(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Nf(n,"object")}]};let o=new Set(Object.keys(t)),s=Dmt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...md(r),...r8(r)}}function DHo(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function nne(e){return e.isProperty}var UFc=Object.prototype.hasOwnProperty;function SWt(e){let t;function r(){if(t==null){t={};for(let[d,f]of THn(e)){let m=nne(f)?f.rawKey:d,h=nne(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of THn(e)){let m=nne(f)?f.rawKey:d,h=nne(f)?f.valueSchema:f;zFc(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function u(){return i==null&&a(),i}function c(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>nne(f)?f.rawKey:d),_getParsedProperties:()=>Rmt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return RHo({value:d,requiredKeys:a(),requiredKeysSet:c(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let b=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return RHo({value:d,requiredKeys:u(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return nne(g)?{transformedKey:g.rawKey,transform:A=>{let b=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:b})}}:{transformedKey:h,transform:A=>{let b=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>sc.OBJECT};return{...zw(p),...md(p),...r8(p),...d_e(p)}}function RHo({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!rne(e))return{ok:!1,errors:[{path:s,message:Nf(e,"object")}]};let a=t.length,u=[],c={};for(let l in e){if(!UFc.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?c[d.transformedKey]=f.value:(c[l]=p,u.push(...f.errors))}else switch(i){case"fail":u.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=p;break}}if(a>0)for(let l of t)l in e||u.push({path:s,message:`Missing required key "${l}"`});return u.length===0||o?{ok:!0,value:c}:{ok:!1,errors:u}}function d_e(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>FHo({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>FHo({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>sc.OBJECT};return{...r,...md(r),...r8(r),...d_e(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))t.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))r.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},getType:()=>sc.OBJECT};return{...n,...md(n),...r8(n),...d_e(n)}}}}function FHo({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!rne(t))return{ok:!1,errors:[{path:i,message:Nf(t,"object")}]};let o=new Set(e),[s,a]=THo(Rmt(t),l=>o.has(l)),u=r(Dmt(t,a)),c=n(Dmt(t,s));return u.ok&&c.ok?{ok:!0,value:{...u.value,...c.value}}:{ok:!1,errors:[...u.ok?[]:u.errors,...c.ok?[]:c.errors]}}function zFc(e){return!VFc(e)}function VFc(e){switch(e.getType()){case sc.ANY:case sc.UNKNOWN:case sc.OPTIONAL:case sc.OPTIONAL_NULLABLE:return!0;default:return!1}}function kHo(e){return SWt(e)}function QHo(e){let t={...PHn(e),_getRawProperties:()=>xLe(e)._getRawProperties(),_getParsedProperties:()=>xLe(e)._getParsedProperties()};return{...t,...md(t),...r8(t),...d_e(t)}}function BWt(e){let t={parse:(r,n)=>NHo(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>NHo(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>sc.LIST};return{...zw(t),...md(t)}}function NHo(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:Nf(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function jHo(e){return Vw(sc.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Nf(r,`${e.toString()}`)}]})()}function MHo(e){return Vw(sc.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Nf(r,`"${e}"`)}]})()}var LHo=Vw(sc.ANY,e=>({ok:!0,value:e}));var UHo=Vw(sc.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nf(e,"boolean")}]});var zHo=Vw(sc.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var VHo=Vw(sc.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nf(e,"number")}]});var qHo=Vw(sc.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nf(e,"string")}]});var GHo=Vw(sc.UNKNOWN,e=>({ok:!0,value:e}));var qFc=Object.prototype.hasOwnProperty;function $Ho(e,t){let r={parse:(n,i)=>WHo({value:n,isKeyNumeric:e.getType()===sc.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>WHo({value:n,isKeyNumeric:e.getType()===sc.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>sc.RECORD};return{...zw(r),...md(r)}}function WHo({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!rne(e))return{ok:!1,errors:[{path:i,message:Nf(e,"object")}]};let o={},s=[];for(let a in e){if(!qFc.call(e,a))continue;let u=e[a];if(u===void 0)continue;let c=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(c=d)}let l=r(c),p=n(u,c);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function HHo(e){let t=BWt(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Nf(n,"Set")}]},getType:()=>sc.SET};return{...zw(r),...md(r)}}function JHo(e){let t={parse:(r,n)=>KHo((i,o)=>i.parse(r,o),e,n),json:(r,n)=>KHo((i,o)=>i.json(r,o),e,n),getType:()=>sc.UNDISCRIMINATED_UNION};return{...zw(t),...md(t)}}function KHo(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function YHo(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var GFc=Object.prototype.hasOwnProperty;function ZHo(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=_Wt(Rmt(t)),o={parse:(s,a)=>XHo({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>i.parse(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.parse(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>XHo({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>i.json(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.json(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>sc.UNION};return{...zw(o),...md(o),...r8(o)}}function XHo({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!rne(e))return{ok:!1,errors:[{path:a,message:Nf(e,"object")}]};let u=e[t],c={};for(let f in e)GFc.call(e,f)&&f!==t&&(c[f]=e[f]);if(u==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(u);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...c}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(c,p);return d.ok?{ok:!0,value:{[r]:u,...d.value}}:d}var OWt=ve.string();var PWt=ve.enum_(["openai","anthropic","bedrock"]);var TWt=ve.object({provider:PWt,model:OWt});var VHn={};X(VHn,{AnyAuthItem:()=>DWt,AnyAuthSchemesSchema:()=>RWt,ApiAuthSchema:()=>SLe,AuthSchemeDeclarationSchema:()=>upe,AuthSchemeReferenceSchema:()=>_Le,AuthScope:()=>qWt,AuthVariable:()=>m_e,AvailabilitySchema:()=>XWt,AvailabilityStatusSchema:()=>OLe,AvailabilityUnionSchema:()=>ZWt,BaseTypeReferenceSchema:()=>f$t,BasicAuthSchemeSchema:()=>QWt,BearerAuthSchemeSchema:()=>zWt,EncodingSchema:()=>r$t,EndpointSecuritySchema:()=>kWt,EndpointSecuritySchemaDetails:()=>FWt,EnvironmentSchema:()=>o$t,HeaderAuthSchemeSchema:()=>VWt,HttpHeaderSchema:()=>TLe,InferredAuthenticatedRequestHeader:()=>NWt,InferredBearerAuthSchema:()=>LWt,InferredGetTokenEndpointSchema:()=>MWt,InferredGetTokenEndpointSchemaObject:()=>jWt,ListValidationSchema:()=>a$t,MapValidationSchema:()=>u$t,MultipleBaseUrlsEnvironmentSchema:()=>n$t,NumberValidationSchema:()=>c$t,OAuthAccessTokenRequestPropertiesSchema:()=>GWt,OAuthAccessTokenResponsePropertiesSchema:()=>WWt,OAuthGetTokenEndpointSchema:()=>$Wt,OAuthRefreshTokenEndpointSchema:()=>JWt,OAuthRefreshTokenRequestPropertiesSchema:()=>HWt,OAuthRefreshTokenResponsePropertiesSchema:()=>KWt,OAuthSchemeSchema:()=>YWt,ProtobufTypeSchema:()=>t$t,ServerVariableSchema:()=>PLe,SingleBaseUrlEnvironmentSchema:()=>i$t,StringValidationSchema:()=>l$t,TokenBearerAuthSchema:()=>UWt,TypeReferenceDeclarationWithEnvOverride:()=>h$t,TypeReferenceDeclarationWithEnvOverrideSchema:()=>m$t,TypeReferenceDeclarationWithName:()=>d$t,ValidationSchema:()=>p$t,WithAudiences:()=>cpe,WithAvailability:()=>e$t,WithDocsSchema:()=>hy,WithEnvironmentVariable:()=>BLe,WithEnvironmentsSchema:()=>s$t,WithHeadersSchema:()=>g$t,WithName:()=>ape,auth:()=>FHn,availability:()=>kHn,commons:()=>QHn,encoding:()=>NHn,environments:()=>jHn,file:()=>MHn,service:()=>LHn,types:()=>UHn,validation:()=>zHn});var FHn={};X(FHn,{AnyAuthItem:()=>DWt,AnyAuthSchemesSchema:()=>RWt,ApiAuthSchema:()=>SLe,AuthSchemeDeclarationSchema:()=>upe,AuthSchemeReferenceSchema:()=>_Le,AuthScope:()=>qWt,AuthVariable:()=>m_e,BasicAuthSchemeSchema:()=>QWt,BearerAuthSchemeSchema:()=>zWt,EndpointSecuritySchema:()=>kWt,EndpointSecuritySchemaDetails:()=>FWt,HeaderAuthSchemeSchema:()=>VWt,InferredAuthenticatedRequestHeader:()=>NWt,InferredBearerAuthSchema:()=>LWt,InferredGetTokenEndpointSchema:()=>MWt,InferredGetTokenEndpointSchemaObject:()=>jWt,OAuthAccessTokenRequestPropertiesSchema:()=>GWt,OAuthAccessTokenResponsePropertiesSchema:()=>WWt,OAuthGetTokenEndpointSchema:()=>$Wt,OAuthRefreshTokenEndpointSchema:()=>JWt,OAuthRefreshTokenRequestPropertiesSchema:()=>HWt,OAuthRefreshTokenResponsePropertiesSchema:()=>KWt,OAuthSchemeSchema:()=>YWt,TokenBearerAuthSchema:()=>UWt,WithEnvironmentVariable:()=>BLe});var hy=ve.object({docs:ve.string().optional()});var _Le=ve.object({scheme:ve.string()}).extend(hy);var DWt=ve.undiscriminatedUnion([ve.string(),_Le]);var RWt=ve.object({any:ve.list(DWt)}).extend(hy);var FWt=ve.object({});var kWt=ve.object({"endpoint-security":FWt}).extend(hy);var SLe=ve.undiscriminatedUnion([ve.string(),_Le,RWt,kWt]);var ape=ve.object({name:ve.string().optional()});var BLe=ve.object({env:ve.string().optional()});var m_e=ve.object({omit:ve.boolean().optional()}).extend(BLe).extend(ape);var QWt=ve.object({scheme:ve.stringLiteral("basic"),username:m_e.optional(),password:m_e.optional()}).extend(hy);var NWt=ve.object({"response-property":ve.string(),"header-name":ve.string(),"value-prefix":ve.string().optional()});var jWt=ve.object({endpoint:ve.string(),"expiry-response-property":ve.string().optional(),"authenticated-request-headers":ve.list(NWt).optional()});var MWt=ve.undiscriminatedUnion([ve.string(),jWt]);var LWt=ve.object({scheme:ve.stringLiteral("bearer"),"get-token":MWt}).extend(hy);var UWt=ve.object({scheme:ve.stringLiteral("bearer"),token:m_e.optional()}).extend(hy);var zWt=ve.undiscriminatedUnion([UWt,LWt]);var VWt=ve.object({header:ve.string(),type:ve.string().optional(),prefix:ve.string().optional()}).extend(BLe).extend(ape).extend(hy);var qWt=ve.string();var GWt=ve.object({"client-id":ve.string().optional(),"client-secret":ve.string().optional(),scopes:ve.string().optional()});var WWt=ve.object({"access-token":ve.string().optional(),"expires-in":ve.string().optional(),"refresh-token":ve.string().optional()});var $Wt=ve.object({endpoint:ve.string(),"request-properties":GWt.optional(),"response-properties":WWt.optional()});var HWt=ve.object({"refresh-token":ve.string()});var KWt=ve.object({"access-token":ve.string().optional(),"expires-in":ve.string().optional(),"refresh-token":ve.string().optional()});var JWt=ve.object({endpoint:ve.string(),"request-properties":HWt.optional(),"response-properties":KWt.optional()});var YWt=ve.object({scheme:ve.stringLiteral("oauth"),type:ve.stringLiteral("client-credentials"),scopes:ve.list(qWt).optional(),"client-id-env":ve.string().optional(),"client-secret-env":ve.string().optional(),"token-prefix":ve.string().optional(),"token-header":ve.string().optional(),"get-token":$Wt,"refresh-token":JWt.optional()}).extend(hy);var upe=ve.undiscriminatedUnion([YWt,VWt,QWt,zWt]);var kHn={};X(kHn,{AvailabilitySchema:()=>XWt,AvailabilityStatusSchema:()=>OLe,AvailabilityUnionSchema:()=>ZWt});var OLe=ve.enum_(["in-development","pre-release","deprecated","generally-available"]);var XWt=ve.object({status:OLe,message:ve.string().optional()});var ZWt=ve.undiscriminatedUnion([OLe,XWt]);var QHn={};X(QHn,{WithAudiences:()=>cpe,WithAvailability:()=>e$t,WithDocsSchema:()=>hy,WithName:()=>ape});var cpe=ve.object({audiences:ve.list(ve.string()).optional()});var e$t=ve.object({availability:ZWt.optional()});var NHn={};X(NHn,{EncodingSchema:()=>r$t,ProtobufTypeSchema:()=>t$t});var t$t=ve.object({type:ve.string()});var r$t=ve.object({proto:t$t.optional()});var jHn={};X(jHn,{EnvironmentSchema:()=>o$t,MultipleBaseUrlsEnvironmentSchema:()=>n$t,ServerVariableSchema:()=>PLe,SingleBaseUrlEnvironmentSchema:()=>i$t,WithEnvironmentsSchema:()=>s$t});var PLe=ve.object({id:ve.string(),default:ve.string().optional(),values:ve.list(ve.string()).optional()});var n$t=ve.object({urls:ve.record(ve.string(),ve.string()),"url-templates":ve.record(ve.string(),ve.string()).optional(),"default-urls":ve.record(ve.string(),ve.string()).optional(),variables:ve.record(ve.string(),ve.list(PLe)).optional()}).extend(cpe).extend(hy);var i$t=ve.object({url:ve.string(),"default-url":ve.string().optional(),"url-template":ve.string().optional(),variables:ve.list(PLe).optional()}).extend(cpe).extend(hy);var o$t=ve.undiscriminatedUnion([ve.string(),i$t,n$t]);var s$t=ve.object({"default-url":ve.string().optional(),"default-environment":ve.string().optional(),environments:ve.record(ve.string(),o$t).optional()});var MHn={};X(MHn,{WithHeadersSchema:()=>g$t});var a$t=ve.object({minItems:ve.number().optional(),maxItems:ve.number().optional()});var u$t=ve.object({minProperties:ve.number().optional(),maxProperties:ve.number().optional()});var c$t=ve.object({min:ve.number().optional(),max:ve.number().optional(),exclusiveMin:ve.boolean().optional(),exclusiveMax:ve.boolean().optional(),multipleOf:ve.number().optional()});var l$t=ve.object({minLength:ve.number().optional(),maxLength:ve.number().optional(),pattern:ve.string().optional(),format:ve.string().optional()});var p$t=ve.undiscriminatedUnion([l$t,c$t,a$t,u$t]);var f$t=ve.object({default:ve.unknown().optional(),encoding:r$t.optional(),validation:p$t.optional()}).extend(hy).extend(e$t);var d$t=ve.object({type:ve.string()}).extend(f$t).extend(ape).extend(cpe);var m$t=ve.object({env:ve.string().optional()}).extend(d$t);var h$t=ve.undiscriminatedUnion([ve.string(),m$t]);var TLe=h$t;var g$t=ve.object({headers:ve.record(ve.string(),TLe).optional()});var LHn={};X(LHn,{HttpHeaderSchema:()=>TLe,TypeReferenceDeclarationWithEnvOverride:()=>h$t,TypeReferenceDeclarationWithEnvOverrideSchema:()=>m$t});var UHn={};X(UHn,{BaseTypeReferenceSchema:()=>f$t,TypeReferenceDeclarationWithName:()=>d$t});var zHn={};X(zHn,{ListValidationSchema:()=>a$t,MapValidationSchema:()=>u$t,NumberValidationSchema:()=>c$t,StringValidationSchema:()=>l$t,ValidationSchema:()=>p$t});var qHn={};X(qHn,{ApiConfigurationSchema:()=>Q$t,ApiConfigurationSchemaInternal:()=>MLe,ApiConfigurationV2Schema:()=>F$t,ApiConfigurationV2SettingsSchema:()=>zLe,ApiConfigurationV2SpecsSchema:()=>VLe,ApiDefinitionList:()=>b$t,ApiDefinitionPathSchema:()=>lpe,ApiDefinitionSchema:()=>y$t,ApiDefinitionSettingsSchema:()=>kLe,ApiDefinitionWithOverridesSchema:()=>QLe,AsyncApiSettingsSchema:()=>ULe,AsyncApiSpecSchema:()=>B$t,BaseApiSettingsSchema:()=>LLe,CoerceConstsTo:()=>E$t,ConjureSchema:()=>S$t,DefaultIntegerFormat:()=>v$t,ExampleStyle:()=>N$t,FormParameterEncoding:()=>I$t,GeneratorsConfigurationSchema:()=>eKo,GeneratorsOpenApiObjectSchema:()=>lHt,GeneratorsOpenApiSchema:()=>pHt,GraphQlSpecSchema:()=>O$t,Language:()=>fHt,MessageNamingSettingsSchema:()=>DLe,NamespacedApiConfigurationSchema:()=>k$t,OpenApiExampleGenerationSchema:()=>w$t,OpenApiFilterSchema:()=>C$t,OpenApiSettingsSchema:()=>ppe,OpenApiSpecSchema:()=>P$t,OpenRpcSpecSchema:()=>T$t,OutputMetadataAuthor:()=>j$t,OutputMetadataSchema:()=>fpe,OverridesSchema:()=>aM,PathParameterOrder:()=>RLe,ProtobufApiDefinitionSchema:()=>jLe,ProtobufDefinitionSchema:()=>NLe,ProtobufSpecSchema:()=>D$t,ReadmeCustomSectionSchema:()=>dHt,ReadmeEndpointObjectSchema:()=>mHt,ReadmeEndpointSchema:()=>Nmt,ReadmeSchema:()=>hHt,RemoveDiscriminantsFromSchemas:()=>FLe,RequestOrResponseExampleGenerationSchema:()=>Fmt,ResolveAliases:()=>_$t,ResolveAliasesSchema:()=>x$t,SpecSchema:()=>R$t,UnionSettingsSchema:()=>A$t,WhitelabelConfigurationSchema:()=>AHt,WhitelabelGithubConfigurationSchema:()=>gHt});var lpe=ve.string();var DLe=ve.enum_(["v1","v2"]);var RLe=ve.enum_(["url-order","spec-order"]);var FLe=ve.enum_(["always","never"]);var A$t=ve.enum_(["v1"]);var kLe=ve.object({"use-title":ve.boolean().optional(),unions:A$t.optional(),"message-naming":DLe.optional(),"respect-nullable-schemas":ve.boolean().optional(),"only-include-referenced-schemas":ve.boolean().optional(),"inline-path-parameters":ve.boolean().optional(),"idiomatic-request-names":ve.boolean().optional(),"wrap-references-to-nullable-in-optional":ve.boolean().optional(),"coerce-optional-schemas-to-nullable":ve.boolean().optional(),"group-environments-by-host":ve.boolean().optional(),"infer-default-environment":ve.boolean().optional(),"remove-discriminants-from-schemas":FLe.optional(),"path-parameter-order":RLe.optional()});var aM=ve.undiscriminatedUnion([ve.string(),ve.list(ve.string())]);var QLe=ve.object({path:lpe,origin:ve.string().optional(),overrides:aM.optional(),audiences:ve.list(ve.string()).optional(),settings:kLe.optional()});var NLe=ve.object({target:ve.string().optional(),root:ve.string(),overrides:aM.optional(),"local-generation":ve.boolean().optional(),"from-openapi":ve.boolean().optional(),dependencies:ve.list(ve.string()).optional()});var jLe=ve.object({proto:NLe});var y$t=ve.undiscriminatedUnion([lpe,QLe,jLe]);var b$t=ve.list(y$t);var MLe=ve.undiscriminatedUnion([lpe,QLe,b$t,jLe]);var E$t=ve.enum_(["literals","enums","enums-coerceable-to-literals"]);var LLe=ve.object({"respect-nullable-schemas":ve.boolean().optional(),"title-as-schema-name":ve.boolean().optional(),"optional-additional-properties":ve.boolean().optional(),"coerce-enums-to-literals":ve.boolean().optional(),"idiomatic-request-names":ve.boolean().optional(),"wrap-references-to-nullable-in-optional":ve.boolean().optional(),"coerce-optional-schemas-to-nullable":ve.boolean().optional(),"group-environments-by-host":ve.boolean().optional(),"infer-default-environment":ve.boolean().optional(),"remove-discriminants-from-schemas":FLe.optional(),"path-parameter-order":RLe.optional(),"resolve-schema-collisions":ve.boolean().optional(),"infer-forward-compatible":ve.boolean().optional(),"coerce-consts-to":E$t.optional()});var ULe=ve.object({"message-naming":DLe.optional()}).extend(LLe);var v$t=ve.enum_(["int32","int64","uint32","uint64"]);var I$t=ve.enum_(["form","json"]);var Fmt=ve.object({"max-depth":ve.number().optional()});var w$t=ve.object({request:Fmt.optional(),response:Fmt.optional()});var C$t=ve.object({endpoints:ve.list(ve.string()).optional()});var x$t=ve.object({except:ve.list(ve.string()).optional()});var _$t=ve.undiscriminatedUnion([ve.boolean(),x$t]);var ppe=ve.object({"only-include-referenced-schemas":ve.boolean().optional(),"inline-path-parameters":ve.boolean().optional(),"prefer-undiscriminated-unions-with-literals":ve.boolean().optional(),"object-query-parameters":ve.boolean().optional(),"respect-readonly-schemas":ve.boolean().optional(),"respect-forward-compatible-enums":ve.boolean().optional(),"use-bytes-for-binary-response":ve.boolean().optional(),"default-form-parameter-encoding":I$t.optional(),filter:C$t.optional(),"example-generation":w$t.optional(),"additional-properties-defaults-to":ve.boolean().optional(),"type-dates-as-strings":ve.boolean().optional(),"preserve-single-schema-oneof":ve.boolean().optional(),"inline-all-of-schemas":ve.boolean().optional(),"resolve-aliases":_$t.optional(),"group-multi-api-environments":ve.boolean().optional(),"default-integer-format":v$t.optional()}).extend(LLe);var zLe=ve.object({}).extend(ppe).extend(ULe);var S$t=ve.object({conjure:ve.string()});var B$t=ve.object({asyncapi:ve.string(),origin:ve.string().optional(),overrides:aM.optional(),namespace:ve.string().optional(),settings:ULe.optional()});var O$t=ve.object({graphql:ve.string(),origin:ve.string().optional(),overrides:ve.string().optional(),name:ve.string().optional()});var P$t=ve.object({openapi:ve.string(),origin:ve.string().optional(),overrides:aM.optional(),overlays:ve.string().optional(),namespace:ve.string().optional(),settings:ppe.optional()});var T$t=ve.object({openrpc:ve.string(),overrides:aM.optional(),namespace:ve.string().optional()});var D$t=ve.object({proto:NLe});var R$t=ve.undiscriminatedUnion([P$t,B$t,D$t,T$t,O$t]);var VLe=ve.undiscriminatedUnion([ve.list(R$t),S$t]);var F$t=ve.object({auth:SLe.optional(),"auth-schemes":ve.record(ve.string(),upe).optional(),specs:VLe,settings:zLe.optional()}).extend(g$t).extend(s$t);var k$t=ve.object({namespaces:ve.record(ve.string(),MLe)});var Q$t=ve.undiscriminatedUnion([MLe,k$t,F$t]);var N$t=ve.enum_(["minimal","comprehensive"]);var j$t=ve.object({name:ve.string(),email:ve.string()});var fpe=ve.object({description:ve.string().optional(),authors:ve.list(j$t).optional()});var kmt=ve.object({name:ve.string()});var dpe=ve.object({teams:ve.list(kmt).optional(),users:ve.list(kmt).optional()});var M$t=ve.object({auth:SLe.optional(),"auth-schemes":ve.record(ve.string(),upe).optional(),headers:ve.record(ve.string(),TLe).optional(),settings:zLe.optional(),specs:VLe.optional()});var L$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional()});var U$t=ve.object({path:ve.string()});var z$t=ve.object({keyId:ve.string(),password:ve.string(),secretKey:ve.string()});var V$t=ve.object({url:ve.string().optional(),coordinate:ve.string(),username:ve.string().optional(),password:ve.string().optional(),signature:z$t.optional()});var q$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional()});var G$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),"api-key":ve.string().optional()});var W$t=ve.object({"api-key":ve.string(),"workspace-id":ve.string(),"collection-id":ve.string().optional()});var $$t=ve.object({keywords:ve.list(ve.string()).optional(),"documentation-link":ve.string().optional(),"homepage-link":ve.string().optional()}).extend(fpe);var H$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional(),username:ve.string().optional(),password:ve.string().optional(),metadata:$$t.optional()});var K$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),"api-key":ve.string().optional()});var J$t=ve.union("location",{npm:q$t,maven:V$t,pypi:H$t,postman:W$t,"local-file-system":U$t,nuget:G$t,rubygems:K$t,crates:L$t}).transform({transform:e=>e,untransform:e=>e});var Y$t=ve.object({custom:ve.string()});var X$t=ve.enum_(["MIT","Apache-2.0"]);var uM=ve.undiscriminatedUnion([X$t,Y$t]);var Qmt=ve.object({"package-description":ve.string().optional(),email:ve.string().optional(),"reference-url":ve.string().optional(),author:ve.string().optional(),license:uM.optional()});var Z$t=ve.object({path:ve.string()});var eHt=ve.enum_(["commit","release"]);var tHt=ve.object({repository:ve.string(),license:uM.optional(),mode:eHt.optional()});var rHt=ve.object({repository:ve.string(),branch:ve.string().optional(),license:uM.optional(),mode:ve.stringLiteral("pull-request"),reviewers:dpe.optional()});var nHt=ve.object({repository:ve.string(),license:uM.optional(),mode:ve.stringLiteral("push"),branch:ve.string().optional()});var iHt=ve.enum_(["pull-request","push"]);var oHt=ve.object({uri:ve.string(),token:ve.string(),mode:iHt.optional(),branch:ve.string().optional(),license:uM.optional()});var sHt=ve.undiscriminatedUnion([oHt,tHt,rHt,nHt]);var aHt=ve.object({name:ve.string(),version:ve.string(),output:J$t.optional(),github:sHt.optional(),config:ve.unknown().optional(),metadata:Qmt.optional(),keywords:ve.list(ve.string()).optional(),snippets:Z$t.optional(),"ir-version":ve.string().optional(),"smart-casing":ve.boolean().optional(),api:M$t.optional(),"disable-examples":ve.boolean().optional(),"publish-metadata":Qmt.optional(),autorelease:ve.boolean().optional()});var uHt=ve.object({audiences:ve.list(ve.string()).optional(),generators:ve.list(aHt),metadata:fpe.optional(),reviewers:dpe.optional()});var cHt=ve.object({enabled:ve.boolean()});var lHt=ve.object({path:ve.string(),origin:ve.string().optional(),overrides:ve.string().optional(),"disable-examples":ve.boolean().optional(),settings:ppe});var pHt=ve.undiscriminatedUnion([lHt,ve.string()]);var fHt=ve.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var dHt=ve.object({title:ve.string(),language:fHt,content:ve.string()});var mHt=ve.object({method:ve.string(),path:ve.string(),stream:ve.boolean().optional()});var Nmt=ve.undiscriminatedUnion([ve.string(),mHt]);var hHt=ve.object({bannerLink:ve.string().optional(),introduction:ve.string().optional(),apiReferenceLink:ve.string().optional(),apiName:ve.string().optional(),disabledSections:ve.list(ve.string()).optional(),defaultEndpoint:Nmt.optional(),features:ve.record(ve.string(),ve.list(Nmt)).optional(),customSections:ve.list(dHt).optional(),exampleStyle:N$t.optional()});var gHt=ve.object({username:ve.string(),email:ve.string(),token:ve.string()});var AHt=ve.object({github:gHt.optional()});var eKo=ve.object({"auth-schemes":ve.record(ve.string(),upe).optional(),api:Q$t.optional(),whitelabel:AHt.optional(),metadata:fpe.optional(),readme:hHt.optional(),"default-group":ve.string().optional(),aliases:ve.record(ve.string(),ve.list(ve.string())).optional(),groups:ve.record(ve.string(),uHt).optional(),reviewers:dpe.optional(),replay:cHt.optional(),ai:TWt.optional(),autorelease:ve.boolean().optional(),openapi:pHt.optional(),"openapi-overrides":ve.string().optional(),"spec-origin":ve.string().optional(),"async-api":ve.string().optional(),"api-settings":kLe.optional()});var GHn={};X(GHn,{CratesOutputLocationSchema:()=>L$t,GeneratorApiSettingsSchema:()=>M$t,GeneratorGroupSchema:()=>uHt,GeneratorInvocationSchema:()=>aHt,GeneratorOutputSchema:()=>J$t,GeneratorPublishMetadataSchema:()=>Qmt,GeneratorSnippetsSchema:()=>Z$t,GithubCommitAndReleaseMode:()=>eHt,GithubCommitAndReleaseSchema:()=>tHt,GithubConfigurationSchema:()=>sHt,GithubPullRequestSchema:()=>rHt,GithubPushSchema:()=>nHt,GithubSelfhostedMode:()=>iHt,GithubSelfhostedSchema:()=>oHt,LocalFileSystemOutputLocationSchema:()=>U$t,MavenOutputLocationSchema:()=>V$t,MavenOutputSignatureSchema:()=>z$t,NpmOutputLocationSchema:()=>q$t,NugetOutputLocationSchema:()=>G$t,PostmanOutputLocationSchema:()=>W$t,PypiOutputLocationSchema:()=>H$t,PypiOutputMetadataSchema:()=>$$t,RubyGemsOutputLocationSchema:()=>K$t});var WHn={};X(WHn,{GithubLicenseCustomSchema:()=>Y$t,GithubLicenseSchema:()=>uM,GithubLicenseType:()=>X$t});var $Hn={};X($Hn,{ReplayConfigSchema:()=>cHt});var HHn={};X(HHn,{ReviewerSchema:()=>kmt,ReviewersSchema:()=>dpe});function tKo(e){return e?.specs!=null}function rKo(e){return e?.asyncapi!=null}function nKo(e){return e?.conjure!=null}function iKo(e){return e?.graphql!=null}function oKo(e){return e?.namespaces!=null}function sKo(e){return e?.openapi!=null}function aKo(e){return e?.openrpc!=null}function uKo(e){return e?.proto!=null}var WFc={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!0,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,groupEnvironmentsByHost:!1,removeDiscriminantsFromSchemas:bn.RemoveDiscriminantsFromSchemas.Always,inferDefaultEnvironment:!0};function $Fc(e){let{defaults:t,options:r,overrides:n,overrideOnly:i=new Set,undefinedIfAbsent:o=new Set}=e,s={};for(let a of Object.keys(t))i.has(a)?s[a]=n?.[a]!==void 0?n[a]:t[a]:o.has(a)?s[a]=n?.[a]!==void 0?n[a]:r?.[a]!==void 0?r[a]:void 0:s[a]=n?.[a]??r?.[a]??t[a];return s}function h_e({options:e,overrides:t}){return $Fc({defaults:WFc,options:e,overrides:t})}yg();yg();St();var qLe={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return qLe._visit(this,t)}}),_visit:(e,t)=>e.type==="protobuf"?t.protobuf(e):t._other(e)};var qw={basic:e=>({...e,type:"basic",_visit:function(t){return qw._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return qw._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return qw._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return qw._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return qw._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"query":return t.query(e);case"oauth":return t.oauth(e);default:return t._other(e)}}};var ES={openapi:e=>({...e,type:"openapi",_visit:function(t){return ES._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return ES._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"openapi":return t.openapi(e);case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var Ka={primitive:e=>({value:e,type:"primitive",_visit:function(t){return Ka._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Ka._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return Ka._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return Ka._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return Ka._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return Ka._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Ka._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return Ka._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return Ka._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"null":return t.null(e);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var mpe={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return mpe._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return mpe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e.value);case"undiscriminated":return t.undiscriminated(e.value);default:return t._other(e)}}};var hpe={boolean:e=>({value:e,type:"boolean",_visit:function(t){return hpe._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return hpe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var us={int:e=>({value:e,type:"int",_visit:function(t){return us._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return us._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return us._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return us._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return us._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return us._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return us._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return us._visit(this,t)}}),datetimeRfc2822:e=>({value:e,type:"datetimeRfc2822",_visit:function(t){return us._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return us._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return us._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return us._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e.value);case"int64":return t.int64(e.value);case"uint":return t.uint(e.value);case"uint64":return t.uint64(e.value);case"float":return t.float(e.value);case"double":return t.double(e.value);case"string":return t.string(e.value);case"datetime":return t.datetime(e.value);case"datetimeRfc2822":return t.datetimeRfc2822(e.value);case"date":return t.date(e.value);case"base64":return t.base64(e.value);case"boolean":return t.boolean(e.value);default:return t._other(e)}}};var Yh={};X(Yh,{AsymmetricAlgorithm:()=>gpe,Availability:()=>Gw,CustomCodeSample:()=>Y9,DiscriminatorContext:()=>JHn,EndpointExample:()=>cM,EndpointResponseExample:()=>lM,HttpMethod:()=>Ww,LiteralSchemaValue:()=>xg,MultipartRequestPropertyEncoding:()=>YHn,MultipartSchema:()=>X9,OneOfSchema:()=>Z9,Pagination:()=>xI,PrimitiveSchemaValue:()=>Uc,Request:()=>n8,Response:()=>m_,RetriesConfiguration:()=>jmt,Schema:()=>la,SupportedSdkLanguage:()=>$w,WebhookHttpMethod:()=>XHn,WebhookPayloadComponent:()=>Mmt,WebhookSignatureAlgorithm:()=>Lmt,WebhookSignatureEncoding:()=>ZHn,WebhookSignatureVerification:()=>g_e,WebhookTimestampFormat:()=>yHt,WebsocketMessageOrigin:()=>eKn});var HFc={RsaSha256:"rsa-sha256",RsaSha384:"rsa-sha384",RsaSha512:"rsa-sha512",EcdsaSha256:"ecdsa-sha256",EcdsaSha384:"ecdsa-sha384",EcdsaSha512:"ecdsa-sha512",Ed25519:"ed25519"},gpe={...HFc,_visit:(e,t)=>{switch(e){case gpe.RsaSha256:return t.rsaSha256();case gpe.RsaSha384:return t.rsaSha384();case gpe.RsaSha512:return t.rsaSha512();case gpe.EcdsaSha256:return t.ecdsaSha256();case gpe.EcdsaSha384:return t.ecdsaSha384();case gpe.EcdsaSha512:return t.ecdsaSha512();case gpe.Ed25519:return t.ed25519();default:return t._other()}}};var KFc={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated"},Gw={...KFc,_visit:(e,t)=>{switch(e){case Gw.GenerallyAvailable:return t.generallyAvailable();case Gw.Beta:return t.beta();case Gw.Deprecated:return t.deprecated();default:return t._other()}}};var Y9={language:e=>({...e,type:"language",_visit:function(t){return Y9._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return Y9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"language":return t.language(e);case"sdk":return t.sdk(e);default:return t._other(e)}}};var JFc={Data:"data",Protocol:"protocol"},JHn={...JFc,_visit:(e,t)=>{switch(e){case JHn.Data:return t.data();case JHn.Protocol:return t.protocol();default:return t._other()}}};var cM={unknown:e=>({value:e,type:"unknown",_visit:function(t){return cM._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return cM._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"unknown":return t.unknown(e.value);case"full":return t.full(e);default:return t._other(e)}}};var lM={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return lM._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return lM._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"withStreaming":return t.withStreaming(e);case"withoutStreaming":return t.withoutStreaming(e.value);default:return t._other(e)}}};var YFc={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE"},Ww={...YFc,_visit:(e,t)=>{switch(e){case Ww.Get:return t.get();case Ww.Post:return t.post();case Ww.Put:return t.put();case Ww.Patch:return t.patch();case Ww.Delete:return t.delete();case Ww.Head:return t.head();case Ww.Options:return t.options();case Ww.Trace:return t.trace();default:return t._other()}}};var xg={boolean:e=>({value:e,type:"boolean",_visit:function(t){return xg._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return xg._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var XFc={Json:"json",Form:"form"},YHn={...XFc,_visit:(e,t)=>{switch(e){case YHn.Json:return t.json();case YHn.Form:return t.form();default:return t._other()}}};var X9={file:e=>({...e,type:"file",_visit:function(t){return X9._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return X9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e.value);default:return t._other(e)}}};var Z9={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return Z9._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return Z9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var xI={cursor:e=>({...e,type:"cursor",_visit:function(t){return xI._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return xI._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return xI._visit(this,t)}}),uri:e=>({...e,type:"uri",_visit:function(t){return xI._visit(this,t)}}),path:e=>({...e,type:"path",_visit:function(t){return xI._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);case"uri":return t.uri(e);case"path":return t.path(e);default:return t._other(e)}}};var Uc={int:e=>({...e,type:"int",_visit:function(t){return Uc._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Uc._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Uc._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Uc._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Uc._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Uc._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Uc._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Uc._visit(this,e)}}),datetimeRfc2822:()=>({type:"datetimeRfc2822",_visit:function(e){return Uc._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Uc._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Uc._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Uc._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint();case"uint64":return t.uint64();case"float":return t.float();case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime();case"datetimeRfc2822":return t.datetimeRfc2822();case"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var n8={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return n8._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return n8._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return n8._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return n8._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var m_={file:e=>({...e,type:"file",_visit:function(t){return m_._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return m_._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return m_._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return m_._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return m_._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return m_._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return m_._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var jmt={disabled:e=>({value:e,type:"disabled",_visit:function(t){return jmt._visit(this,t)}}),_visit:(e,t)=>e.type==="disabled"?t.disabled(e.value):t._other(e)};var la={primitive:e=>({...e,type:"primitive",_visit:function(t){return la._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return la._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return la._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return la._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return la._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return la._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return la._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return la._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return la._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return la._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return la._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var ZFc={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Js:"js",Node:"node",Ts:"ts",Nodets:"nodets",Golang:"golang",Dotnet:"dotnet",Jvm:"jvm"},$w={...ZFc,_visit:(e,t)=>{switch(e){case $w.Curl:return t.curl();case $w.Python:return t.python();case $w.Javascript:return t.javascript();case $w.Typescript:return t.typescript();case $w.Go:return t.go();case $w.Ruby:return t.ruby();case $w.Csharp:return t.csharp();case $w.Java:return t.java();case $w.Js:return t.js();case $w.Node:return t.node();case $w.Ts:return t.ts();case $w.Nodets:return t.nodets();case $w.Golang:return t.golang();case $w.Dotnet:return t.dotnet();case $w.Jvm:return t.jvm();default:return t._other()}}};var ekc={Get:"GET",Post:"POST"},XHn={...ekc,_visit:(e,t)=>{switch(e){case XHn.Get:return t.get();case XHn.Post:return t.post();default:return t._other()}}};var tkc={Body:"body",Timestamp:"timestamp",NotificationUrl:"notification-url",MessageId:"message-id"},Mmt={...tkc,_visit:(e,t)=>{switch(e){case Mmt.Body:return t.body();case Mmt.Timestamp:return t.timestamp();case Mmt.NotificationUrl:return t.notificationUrl();case Mmt.MessageId:return t.messageId();default:return t._other()}}};var rkc={Sha256:"sha256",Sha1:"sha1",Sha384:"sha384",Sha512:"sha512"},Lmt={...rkc,_visit:(e,t)=>{switch(e){case Lmt.Sha256:return t.sha256();case Lmt.Sha1:return t.sha1();case Lmt.Sha384:return t.sha384();case Lmt.Sha512:return t.sha512();default:return t._other()}}};var nkc={Base64:"base64",Hex:"hex"},ZHn={...nkc,_visit:(e,t)=>{switch(e){case ZHn.Base64:return t.base64();case ZHn.Hex:return t.hex();default:return t._other()}}};var g_e={hmac:e=>({...e,type:"hmac",_visit:function(t){return g_e._visit(this,t)}}),asymmetric:e=>({...e,type:"asymmetric",_visit:function(t){return g_e._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"hmac":return t.hmac(e);case"asymmetric":return t.asymmetric(e);default:return t._other(e)}}};var ikc={UnixSeconds:"unix-seconds",UnixMillis:"unix-millis",Iso8601:"iso8601"},yHt={...ikc,_visit:(e,t)=>{switch(e){case yHt.UnixSeconds:return t.unixSeconds();case yHt.UnixMillis:return t.unixMillis();case yHt.Iso8601:return t.iso8601();default:return t._other()}}};var okc={Client:"client",Server:"server"},eKn={...okc,_visit:(e,t)=>{switch(e){case eKn.Client:return t.client();case eKn.Server:return t.server();default:return t._other()}}};var iQ={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return iQ._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return iQ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var Ii={int:e=>({...e,type:"int",_visit:function(t){return Ii._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Ii._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Ii._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Ii._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Ii._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Ii._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Ii._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Ii._visit(this,t)}}),datetimeRfc2822:e=>({...e,type:"datetimeRfc2822",_visit:function(t){return Ii._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Ii._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Ii._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Ii._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint(e);case"uint64":return t.uint64(e);case"float":return t.float(e);case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime(e);case"datetimeRfc2822":return t.datetimeRfc2822(e);case"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var eP={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return eP._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return eP._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return eP._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return eP._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var Ch={file:e=>({...e,type:"file",_visit:function(t){return Ch._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Ch._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Ch._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return Ch._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return Ch._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return Ch._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return Ch._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var kr={primitive:e=>({...e,type:"primitive",_visit:function(t){return kr._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return kr._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return kr._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return kr._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return kr._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return kr._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return kr._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return kr._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return kr._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return kr._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return kr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var pa={};X(pa,{AllOfPropertyConflict:()=>YLe,ArraySchema:()=>WHt,ArraySchemaWithExample:()=>tJt,AsymmetricAlgorithm:()=>$Ht,AsymmetricWebhookSignatureVerification:()=>KHt,Availability:()=>PHt,Base64WithExample:()=>rJt,BasicSecurityScheme:()=>wHt,BearerSecurityScheme:()=>CHt,BooleanSchema:()=>JHt,BooleanWithExample:()=>nJt,BytesResponse:()=>eUe,CasingOverrides:()=>kHt,CommonProperty:()=>YHt,CommonPropertyWithExample:()=>iJt,CursorPagination:()=>XHt,CustomCodeSample:()=>rKt,CustomCodeSampleLanguage:()=>ZHt,CustomCodeSampleSdk:()=>tKt,CustomPagination:()=>nKt,DateWithExample:()=>oJt,DatetimeWithExample:()=>qmt,DiscriminatedOneOfSchema:()=>iKt,DiscriminatedOneOfSchemaWithExample:()=>sJt,DiscriminatorContext:()=>tUe,DoubleSchema:()=>oKt,DoubleWithExample:()=>aJt,Encoding:()=>_Ht,Endpoint:()=>IKt,EndpointExample:()=>iUe,EndpointResponseExample:()=>uKt,EndpointSdkName:()=>rG,EndpointSecurity:()=>oUe,EndpointWithExample:()=>NKo,EnumSchema:()=>HLe,EnumSchemaWithExample:()=>hJt,EnumValue:()=>ype,ErrorExample:()=>pKt,FernExample:()=>sKt,FileResponse:()=>dUe,FileSchema:()=>bKt,FloatWithExample:()=>gJt,FormUrlEncodedRequest:()=>gKt,FullEndpointExample:()=>lKt,FullExample:()=>pm,FullObjectExample:()=>VHt,FullOneOfExample:()=>qHt,GlobalHeader:()=>wKt,GlobalSecurity:()=>CKt,Header:()=>Epe,HeaderExample:()=>rUe,HeaderSecurityScheme:()=>SHt,HeaderWithExample:()=>Cpe,HmacWebhookSignatureVerification:()=>BKt,HttpEndpointServer:()=>sUe,HttpError:()=>fKt,HttpErrorWithExample:()=>uJt,HttpMethod:()=>aUe,IdempotencyHeader:()=>OKt,Int64WithExample:()=>AJt,IntSchema:()=>PKt,IntWithExample:()=>yJt,JsonRequest:()=>AKt,JsonRequestWithExample:()=>lJt,JsonResponse:()=>mUe,JsonResponseWithExample:()=>wUe,KeyValuePair:()=>GHt,LiteralExample:()=>UHt,LiteralSchema:()=>AUe,LiteralSchemaValue:()=>TKt,LongSchema:()=>DKt,MapSchema:()=>kKt,MapSchemaWithExample:()=>wJt,MultipartFormDataWebhookPayload:()=>QKt,MultipartFormDataWebhookPayloadWithExample:()=>CJt,MultipartRequest:()=>pUe,MultipartRequestProperty:()=>vpe,MultipartRequestPropertyEncoding:()=>yKt,MultipartSchema:()=>EKt,NamedFullExample:()=>KD,Namespace:()=>BHt,NamespaceId:()=>OHt,NullExample:()=>zHt,NullableSchema:()=>NKt,NullableSchemaWithExample:()=>xJt,OauthSecurityScheme:()=>QHt,ObjectProperty:()=>jKt,ObjectPropertyConflictInfo:()=>yUe,ObjectPropertyWithExample:()=>_Jt,ObjectSchema:()=>MKt,ObjectSchemaWithExample:()=>SJt,OctetStreamRequest:()=>fUe,OffsetPagination:()=>dKt,OneOfSchema:()=>LKt,OneOfSchemaWithExample:()=>BJt,OpenApiIntermediateRepresentation:()=>QKo,OpenApiSource:()=>DHt,OptionalSchema:()=>ZKt,OptionalSchemaWithExample:()=>PJt,Pagination:()=>uUe,ParseFormUrlEncodedRequest:()=>pJt,ParseMultipartRequest:()=>fJt,ParseOctetStreamRequest:()=>dJt,PathPagination:()=>mKt,PathParameter:()=>cUe,PathParameterExample:()=>cKt,PathParameterWithExample:()=>cJt,PrimitiveExample:()=>KLe,PrimitiveSchema:()=>wpe,PrimitiveSchemaValue:()=>FKt,PrimitiveSchemaValueWithExample:()=>IJt,PrimitiveSchemaWithExample:()=>xUe,PropertyKey:()=>JLe,ProtobufEncoding:()=>xHt,ProtobufSource:()=>RHt,QueryParameter:()=>lUe,QueryParameterExample:()=>nUe,QueryParameterWithExample:()=>IUe,QuerySecurityScheme:()=>NHt,ReferencedSchema:()=>nG,Request:()=>vKt,RequestWithExample:()=>mJt,Response:()=>hUe,ResponseWithExample:()=>CUe,RetriesConfiguration:()=>gUe,Schema:()=>Pc,SchemaId:()=>tP,SchemaWithExample:()=>df,Schemas:()=>zKt,SdkGroup:()=>THt,SdkGroupInfo:()=>VKt,SdkGroupName:()=>Ape,SecurityScheme:()=>jHt,SecuritySchemeId:()=>bpe,Server:()=>Vmt,ServerVariable:()=>MHt,Source:()=>FHt,StatusCode:()=>eG,StreamingResponseExample:()=>aKt,StringSchema:()=>RKt,StringSchemaWithExample:()=>bJt,SupportedSdkLanguage:()=>eKt,Tag:()=>LHt,TagId:()=>rP,Tags:()=>qKt,TextResponse:()=>Ipe,Uint64WithExample:()=>EJt,UintWithExample:()=>vJt,UnDiscriminatedOneOfSchema:()=>UKt,UnDiscriminatedOneOfSchemaWithExample:()=>OJt,UnknownSchema:()=>eJt,UnknownSchemaWithExample:()=>TJt,UriPagination:()=>hKt,Webhook:()=>GKt,WebhookExampleCall:()=>bUe,WebhookHttpMethod:()=>EUe,WebhookPayloadComponent:()=>xKt,WebhookPayloadFormat:()=>_Kt,WebhookSignatureAlgorithm:()=>SKt,WebhookSignatureEncoding:()=>XLe,WebhookSignatureVerification:()=>vUe,WebhookTimestamp:()=>ZLe,WebhookTimestampFormat:()=>HHt,WebhookWithExample:()=>jKo,WebsocketChannel:()=>XKt,WebsocketHandshake:()=>WKt,WebsocketHandshakeWithExample:()=>MKo,WebsocketMessageExample:()=>JKt,WebsocketMessageOrigin:()=>$Kt,WebsocketMessageSchema:()=>HKt,WebsocketServer:()=>KKt,WebsocketSessionExample:()=>YKt,WithAvailability:()=>rs,WithDescription:()=>fn,WithEncoding:()=>Jw,WithInline:()=>ff,WithName:()=>Eu,WithNamespace:()=>Ga,WithSdkGroupName:()=>uc,WithSdkMethodName:()=>tG,WithSource:()=>Uo,WithStatusCode:()=>pM,WithTitle:()=>cc,commons:()=>sKn,example:()=>aKn,finalIr:()=>uKn,parseIr:()=>cKn});var sKn={};X(sKn,{BasicSecurityScheme:()=>wHt,BearerSecurityScheme:()=>CHt,Encoding:()=>_Ht,HeaderSecurityScheme:()=>SHt,Namespace:()=>BHt,NamespaceId:()=>OHt,OauthSecurityScheme:()=>QHt,OpenApiSource:()=>DHt,ProtobufEncoding:()=>xHt,ProtobufSource:()=>RHt,QuerySecurityScheme:()=>NHt,SchemaId:()=>tP,SdkGroup:()=>THt,SdkGroupName:()=>Ape,SecurityScheme:()=>jHt,SecuritySchemeId:()=>bpe,Server:()=>Vmt,ServerVariable:()=>MHt,Source:()=>FHt,StatusCode:()=>eG,Tag:()=>LHt,TagId:()=>rP,WithAvailability:()=>rs,WithDescription:()=>fn,WithEncoding:()=>Jw,WithInline:()=>ff,WithName:()=>Eu,WithNamespace:()=>Ga,WithSdkGroupName:()=>uc,WithSdkMethodName:()=>tG,WithSource:()=>Uo,WithStatusCode:()=>pM,WithTitle:()=>cc});var W={};X(W,{JsonError:()=>GLe,ParseError:()=>WLe,any:()=>IKo,bigint:()=>lKo,boolean:()=>wKo,booleanLiteral:()=>EKo,date:()=>pKo,discriminant:()=>RKo,enum_:()=>EHt,getObjectLikeUtils:()=>i8,getObjectUtils:()=>A_e,getSchemaUtils:()=>hd,isProperty:()=>one,lazy:()=>fKo,lazyObject:()=>yKo,list:()=>IHt,never:()=>CKo,number:()=>xKo,object:()=>vHt,objectWithoutOptionalProperties:()=>AKo,optional:()=>tKn,property:()=>mKo,record:()=>OKo,set:()=>PKo,string:()=>_Ko,stringLiteral:()=>vKo,transform:()=>rKn,undiscriminatedUnion:()=>DKo,union:()=>kKo,unknown:()=>SKo,withParsedProperties:()=>oKn});var ac={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",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function jf(e,t){return`Expected ${t}. Received ${skc(e)}.`}function skc(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 Hw(e){return{...e,json:cKo(e.json),parse:cKo(e.parse)}}function cKo(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(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
1460
+ `)),{ok:!0,value:t}):n}}function xWt(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var wLe=class e extends Error{errors;constructor(t){super(t.map(xWt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var CLe=class e extends Error{errors;constructor(t){super(t.map(xWt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function md(e){return{nullable:()=>NFc(e),optional:()=>BHn(e),optionalNullable:()=>jFc(e),transform:t=>OHn(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new CLe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new wLe(n.errors)}}}function NFc(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:()=>sc.NULLABLE};return{...t,...md(t)}}function BHn(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:()=>sc.OPTIONAL};return{...t,...md(t)}}function jFc(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:()=>sc.OPTIONAL_NULLABLE};return{...t,...md(t)}}function OHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...md(r)}}function BHo(){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:Nf(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:Nf(t,"bigint")}]}:{ok:!0,value:t},getType:()=>sc.BIGINT};return{...zw(e),...md(e)}}var MFc=/^([+-]?\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 OHo(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Nf(t,"string")}]}:MFc.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Nf(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Nf(t,"Date object")}]},getType:()=>sc.DATE};return{...zw(e),...md(e)}}function Vw(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...zw(r),...md(r)}}}function _Wt(e){let t=new Set(e);return Vw(sc.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:Nf(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:Nf(n,"enum")}]}:{ok:!0,value:n})()}function PHo(e){let t=PHn(e);return{...t,...md(t)}}function PHn(e){return{parse:(t,r)=>xLe(e).parse(t,r),json:(t,r)=>xLe(e).json(t,r),getType:()=>xLe(e).getType()}}function xLe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function THn(e){return Object.entries(e)}function Dmt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function rne(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function Rmt(e){return Object.keys(e)}function THo(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var LFc=Object.prototype.hasOwnProperty;function r8(e){return{withParsedProperties:t=>DHn(e,t)}}function DHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(LFc.call(t,a)){let u=t[a];s[a]=typeof u=="function"?u(o.value):u}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!rne(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Nf(n,"object")}]};let o=new Set(Object.keys(t)),s=Dmt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...md(r),...r8(r)}}function DHo(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function nne(e){return e.isProperty}var UFc=Object.prototype.hasOwnProperty;function SWt(e){let t;function r(){if(t==null){t={};for(let[d,f]of THn(e)){let m=nne(f)?f.rawKey:d,h=nne(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of THn(e)){let m=nne(f)?f.rawKey:d,h=nne(f)?f.valueSchema:f;zFc(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function u(){return i==null&&a(),i}function c(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>nne(f)?f.rawKey:d),_getParsedProperties:()=>Rmt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return RHo({value:d,requiredKeys:a(),requiredKeysSet:c(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let b=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return RHo({value:d,requiredKeys:u(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return nne(g)?{transformedKey:g.rawKey,transform:A=>{let b=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:b})}}:{transformedKey:h,transform:A=>{let b=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>sc.OBJECT};return{...zw(p),...md(p),...r8(p),...d_e(p)}}function RHo({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!rne(e))return{ok:!1,errors:[{path:s,message:Nf(e,"object")}]};let a=t.length,u=[],c={};for(let l in e){if(!UFc.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?c[d.transformedKey]=f.value:(c[l]=p,u.push(...f.errors))}else switch(i){case"fail":u.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=p;break}}if(a>0)for(let l of t)l in e||u.push({path:s,message:`Missing required key "${l}"`});return u.length===0||o?{ok:!0,value:c}:{ok:!1,errors:u}}function d_e(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>FHo({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>FHo({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>sc.OBJECT};return{...r,...md(r),...r8(r),...d_e(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))t.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))r.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},getType:()=>sc.OBJECT};return{...n,...md(n),...r8(n),...d_e(n)}}}}function FHo({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!rne(t))return{ok:!1,errors:[{path:i,message:Nf(t,"object")}]};let o=new Set(e),[s,a]=THo(Rmt(t),l=>o.has(l)),u=r(Dmt(t,a)),c=n(Dmt(t,s));return u.ok&&c.ok?{ok:!0,value:{...u.value,...c.value}}:{ok:!1,errors:[...u.ok?[]:u.errors,...c.ok?[]:c.errors]}}function zFc(e){return!VFc(e)}function VFc(e){switch(e.getType()){case sc.ANY:case sc.UNKNOWN:case sc.OPTIONAL:case sc.OPTIONAL_NULLABLE:return!0;default:return!1}}function kHo(e){return SWt(e)}function QHo(e){let t={...PHn(e),_getRawProperties:()=>xLe(e)._getRawProperties(),_getParsedProperties:()=>xLe(e)._getParsedProperties()};return{...t,...md(t),...r8(t),...d_e(t)}}function BWt(e){let t={parse:(r,n)=>NHo(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>NHo(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>sc.LIST};return{...zw(t),...md(t)}}function NHo(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:Nf(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function jHo(e){return Vw(sc.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Nf(r,`${e.toString()}`)}]})()}function MHo(e){return Vw(sc.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Nf(r,`"${e}"`)}]})()}var LHo=Vw(sc.ANY,e=>({ok:!0,value:e}));var UHo=Vw(sc.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nf(e,"boolean")}]});var zHo=Vw(sc.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var VHo=Vw(sc.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nf(e,"number")}]});var qHo=Vw(sc.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nf(e,"string")}]});var GHo=Vw(sc.UNKNOWN,e=>({ok:!0,value:e}));var qFc=Object.prototype.hasOwnProperty;function $Ho(e,t){let r={parse:(n,i)=>WHo({value:n,isKeyNumeric:e.getType()===sc.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>WHo({value:n,isKeyNumeric:e.getType()===sc.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>sc.RECORD};return{...zw(r),...md(r)}}function WHo({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!rne(e))return{ok:!1,errors:[{path:i,message:Nf(e,"object")}]};let o={},s=[];for(let a in e){if(!qFc.call(e,a))continue;let u=e[a];if(u===void 0)continue;let c=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(c=d)}let l=r(c),p=n(u,c);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function HHo(e){let t=BWt(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Nf(n,"Set")}]},getType:()=>sc.SET};return{...zw(r),...md(r)}}function JHo(e){let t={parse:(r,n)=>KHo((i,o)=>i.parse(r,o),e,n),json:(r,n)=>KHo((i,o)=>i.json(r,o),e,n),getType:()=>sc.UNDISCRIMINATED_UNION};return{...zw(t),...md(t)}}function KHo(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function YHo(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var GFc=Object.prototype.hasOwnProperty;function ZHo(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=_Wt(Rmt(t)),o={parse:(s,a)=>XHo({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>i.parse(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.parse(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>XHo({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>i.json(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.json(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>sc.UNION};return{...zw(o),...md(o),...r8(o)}}function XHo({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!rne(e))return{ok:!1,errors:[{path:a,message:Nf(e,"object")}]};let u=e[t],c={};for(let f in e)GFc.call(e,f)&&f!==t&&(c[f]=e[f]);if(u==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(u);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...c}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(c,p);return d.ok?{ok:!0,value:{[r]:u,...d.value}}:d}var OWt=ve.string();var PWt=ve.enum_(["openai","anthropic","bedrock"]);var TWt=ve.object({provider:PWt,model:OWt});var VHn={};X(VHn,{AnyAuthItem:()=>DWt,AnyAuthSchemesSchema:()=>RWt,ApiAuthSchema:()=>SLe,AuthSchemeDeclarationSchema:()=>upe,AuthSchemeReferenceSchema:()=>_Le,AuthScope:()=>qWt,AuthVariable:()=>m_e,AvailabilitySchema:()=>XWt,AvailabilityStatusSchema:()=>OLe,AvailabilityUnionSchema:()=>ZWt,BaseTypeReferenceSchema:()=>f$t,BasicAuthSchemeSchema:()=>QWt,BearerAuthSchemeSchema:()=>zWt,EncodingSchema:()=>r$t,EndpointSecuritySchema:()=>kWt,EndpointSecuritySchemaDetails:()=>FWt,EnvironmentSchema:()=>o$t,HeaderAuthSchemeSchema:()=>VWt,HttpHeaderSchema:()=>TLe,InferredAuthenticatedRequestHeader:()=>NWt,InferredBearerAuthSchema:()=>LWt,InferredGetTokenEndpointSchema:()=>MWt,InferredGetTokenEndpointSchemaObject:()=>jWt,ListValidationSchema:()=>a$t,MapValidationSchema:()=>u$t,MultipleBaseUrlsEnvironmentSchema:()=>n$t,NumberValidationSchema:()=>c$t,OAuthAccessTokenRequestPropertiesSchema:()=>GWt,OAuthAccessTokenResponsePropertiesSchema:()=>WWt,OAuthGetTokenEndpointSchema:()=>$Wt,OAuthRefreshTokenEndpointSchema:()=>JWt,OAuthRefreshTokenRequestPropertiesSchema:()=>HWt,OAuthRefreshTokenResponsePropertiesSchema:()=>KWt,OAuthSchemeSchema:()=>YWt,ProtobufTypeSchema:()=>t$t,ServerVariableSchema:()=>PLe,SingleBaseUrlEnvironmentSchema:()=>i$t,StringValidationSchema:()=>l$t,TokenBearerAuthSchema:()=>UWt,TypeReferenceDeclarationWithEnvOverride:()=>h$t,TypeReferenceDeclarationWithEnvOverrideSchema:()=>m$t,TypeReferenceDeclarationWithName:()=>d$t,ValidationSchema:()=>p$t,WithAudiences:()=>cpe,WithAvailability:()=>e$t,WithDocsSchema:()=>hy,WithEnvironmentVariable:()=>BLe,WithEnvironmentsSchema:()=>s$t,WithHeadersSchema:()=>g$t,WithName:()=>ape,auth:()=>FHn,availability:()=>kHn,commons:()=>QHn,encoding:()=>NHn,environments:()=>jHn,file:()=>MHn,service:()=>LHn,types:()=>UHn,validation:()=>zHn});var FHn={};X(FHn,{AnyAuthItem:()=>DWt,AnyAuthSchemesSchema:()=>RWt,ApiAuthSchema:()=>SLe,AuthSchemeDeclarationSchema:()=>upe,AuthSchemeReferenceSchema:()=>_Le,AuthScope:()=>qWt,AuthVariable:()=>m_e,BasicAuthSchemeSchema:()=>QWt,BearerAuthSchemeSchema:()=>zWt,EndpointSecuritySchema:()=>kWt,EndpointSecuritySchemaDetails:()=>FWt,HeaderAuthSchemeSchema:()=>VWt,InferredAuthenticatedRequestHeader:()=>NWt,InferredBearerAuthSchema:()=>LWt,InferredGetTokenEndpointSchema:()=>MWt,InferredGetTokenEndpointSchemaObject:()=>jWt,OAuthAccessTokenRequestPropertiesSchema:()=>GWt,OAuthAccessTokenResponsePropertiesSchema:()=>WWt,OAuthGetTokenEndpointSchema:()=>$Wt,OAuthRefreshTokenEndpointSchema:()=>JWt,OAuthRefreshTokenRequestPropertiesSchema:()=>HWt,OAuthRefreshTokenResponsePropertiesSchema:()=>KWt,OAuthSchemeSchema:()=>YWt,TokenBearerAuthSchema:()=>UWt,WithEnvironmentVariable:()=>BLe});var hy=ve.object({docs:ve.string().optional()});var _Le=ve.object({scheme:ve.string()}).extend(hy);var DWt=ve.undiscriminatedUnion([ve.string(),_Le]);var RWt=ve.object({any:ve.list(DWt)}).extend(hy);var FWt=ve.object({});var kWt=ve.object({"endpoint-security":FWt}).extend(hy);var SLe=ve.undiscriminatedUnion([ve.string(),_Le,RWt,kWt]);var ape=ve.object({name:ve.string().optional()});var BLe=ve.object({env:ve.string().optional()});var m_e=ve.object({omit:ve.boolean().optional()}).extend(BLe).extend(ape);var QWt=ve.object({scheme:ve.stringLiteral("basic"),username:m_e.optional(),password:m_e.optional()}).extend(hy);var NWt=ve.object({"response-property":ve.string(),"header-name":ve.string(),"value-prefix":ve.string().optional()});var jWt=ve.object({endpoint:ve.string(),"expiry-response-property":ve.string().optional(),"authenticated-request-headers":ve.list(NWt).optional()});var MWt=ve.undiscriminatedUnion([ve.string(),jWt]);var LWt=ve.object({scheme:ve.stringLiteral("bearer"),"get-token":MWt}).extend(hy);var UWt=ve.object({scheme:ve.stringLiteral("bearer"),token:m_e.optional()}).extend(hy);var zWt=ve.undiscriminatedUnion([UWt,LWt]);var VWt=ve.object({header:ve.string(),type:ve.string().optional(),prefix:ve.string().optional()}).extend(BLe).extend(ape).extend(hy);var qWt=ve.string();var GWt=ve.object({"client-id":ve.string().optional(),"client-secret":ve.string().optional(),scopes:ve.string().optional()});var WWt=ve.object({"access-token":ve.string().optional(),"expires-in":ve.string().optional(),"refresh-token":ve.string().optional()});var $Wt=ve.object({endpoint:ve.string(),"request-properties":GWt.optional(),"response-properties":WWt.optional()});var HWt=ve.object({"refresh-token":ve.string()});var KWt=ve.object({"access-token":ve.string().optional(),"expires-in":ve.string().optional(),"refresh-token":ve.string().optional()});var JWt=ve.object({endpoint:ve.string(),"request-properties":HWt.optional(),"response-properties":KWt.optional()});var YWt=ve.object({scheme:ve.stringLiteral("oauth"),type:ve.stringLiteral("client-credentials"),scopes:ve.list(qWt).optional(),"client-id-env":ve.string().optional(),"client-secret-env":ve.string().optional(),"token-prefix":ve.string().optional(),"token-header":ve.string().optional(),"get-token":$Wt,"refresh-token":JWt.optional()}).extend(hy);var upe=ve.undiscriminatedUnion([YWt,VWt,QWt,zWt]);var kHn={};X(kHn,{AvailabilitySchema:()=>XWt,AvailabilityStatusSchema:()=>OLe,AvailabilityUnionSchema:()=>ZWt});var OLe=ve.enum_(["in-development","pre-release","deprecated","generally-available"]);var XWt=ve.object({status:OLe,message:ve.string().optional()});var ZWt=ve.undiscriminatedUnion([OLe,XWt]);var QHn={};X(QHn,{WithAudiences:()=>cpe,WithAvailability:()=>e$t,WithDocsSchema:()=>hy,WithName:()=>ape});var cpe=ve.object({audiences:ve.list(ve.string()).optional()});var e$t=ve.object({availability:ZWt.optional()});var NHn={};X(NHn,{EncodingSchema:()=>r$t,ProtobufTypeSchema:()=>t$t});var t$t=ve.object({type:ve.string()});var r$t=ve.object({proto:t$t.optional()});var jHn={};X(jHn,{EnvironmentSchema:()=>o$t,MultipleBaseUrlsEnvironmentSchema:()=>n$t,ServerVariableSchema:()=>PLe,SingleBaseUrlEnvironmentSchema:()=>i$t,WithEnvironmentsSchema:()=>s$t});var PLe=ve.object({id:ve.string(),default:ve.string().optional(),values:ve.list(ve.string()).optional()});var n$t=ve.object({urls:ve.record(ve.string(),ve.string()),"url-templates":ve.record(ve.string(),ve.string()).optional(),"default-urls":ve.record(ve.string(),ve.string()).optional(),variables:ve.record(ve.string(),ve.list(PLe)).optional()}).extend(cpe).extend(hy);var i$t=ve.object({url:ve.string(),"default-url":ve.string().optional(),"url-template":ve.string().optional(),variables:ve.list(PLe).optional()}).extend(cpe).extend(hy);var o$t=ve.undiscriminatedUnion([ve.string(),i$t,n$t]);var s$t=ve.object({"default-url":ve.string().optional(),"default-environment":ve.string().optional(),environments:ve.record(ve.string(),o$t).optional()});var MHn={};X(MHn,{WithHeadersSchema:()=>g$t});var a$t=ve.object({minItems:ve.number().optional(),maxItems:ve.number().optional()});var u$t=ve.object({minProperties:ve.number().optional(),maxProperties:ve.number().optional()});var c$t=ve.object({min:ve.number().optional(),max:ve.number().optional(),exclusiveMin:ve.boolean().optional(),exclusiveMax:ve.boolean().optional(),multipleOf:ve.number().optional()});var l$t=ve.object({minLength:ve.number().optional(),maxLength:ve.number().optional(),pattern:ve.string().optional(),format:ve.string().optional()});var p$t=ve.undiscriminatedUnion([l$t,c$t,a$t,u$t]);var f$t=ve.object({default:ve.unknown().optional(),encoding:r$t.optional(),validation:p$t.optional()}).extend(hy).extend(e$t);var d$t=ve.object({type:ve.string()}).extend(f$t).extend(ape).extend(cpe);var m$t=ve.object({env:ve.string().optional()}).extend(d$t);var h$t=ve.undiscriminatedUnion([ve.string(),m$t]);var TLe=h$t;var g$t=ve.object({headers:ve.record(ve.string(),TLe).optional()});var LHn={};X(LHn,{HttpHeaderSchema:()=>TLe,TypeReferenceDeclarationWithEnvOverride:()=>h$t,TypeReferenceDeclarationWithEnvOverrideSchema:()=>m$t});var UHn={};X(UHn,{BaseTypeReferenceSchema:()=>f$t,TypeReferenceDeclarationWithName:()=>d$t});var zHn={};X(zHn,{ListValidationSchema:()=>a$t,MapValidationSchema:()=>u$t,NumberValidationSchema:()=>c$t,StringValidationSchema:()=>l$t,ValidationSchema:()=>p$t});var qHn={};X(qHn,{ApiConfigurationSchema:()=>Q$t,ApiConfigurationSchemaInternal:()=>MLe,ApiConfigurationV2Schema:()=>F$t,ApiConfigurationV2SettingsSchema:()=>zLe,ApiConfigurationV2SpecsSchema:()=>VLe,ApiDefinitionList:()=>b$t,ApiDefinitionPathSchema:()=>lpe,ApiDefinitionSchema:()=>y$t,ApiDefinitionSettingsSchema:()=>kLe,ApiDefinitionWithOverridesSchema:()=>QLe,AsyncApiSettingsSchema:()=>ULe,AsyncApiSpecSchema:()=>B$t,BaseApiSettingsSchema:()=>LLe,CoerceConstsTo:()=>E$t,ConjureSchema:()=>S$t,DefaultIntegerFormat:()=>v$t,ExampleStyle:()=>N$t,FormParameterEncoding:()=>I$t,GeneratorsConfigurationSchema:()=>eKo,GeneratorsOpenApiObjectSchema:()=>lHt,GeneratorsOpenApiSchema:()=>pHt,GraphQlSpecSchema:()=>O$t,Language:()=>fHt,MessageNamingSettingsSchema:()=>DLe,NamespacedApiConfigurationSchema:()=>k$t,OpenApiExampleGenerationSchema:()=>w$t,OpenApiFilterSchema:()=>C$t,OpenApiSettingsSchema:()=>ppe,OpenApiSpecSchema:()=>P$t,OpenRpcSpecSchema:()=>T$t,OutputMetadataAuthor:()=>j$t,OutputMetadataSchema:()=>fpe,OverridesSchema:()=>aM,PathParameterOrder:()=>RLe,ProtobufApiDefinitionSchema:()=>jLe,ProtobufDefinitionSchema:()=>NLe,ProtobufSpecSchema:()=>D$t,ReadmeCustomSectionSchema:()=>dHt,ReadmeEndpointObjectSchema:()=>mHt,ReadmeEndpointSchema:()=>Nmt,ReadmeSchema:()=>hHt,RemoveDiscriminantsFromSchemas:()=>FLe,RequestOrResponseExampleGenerationSchema:()=>Fmt,ResolveAliases:()=>_$t,ResolveAliasesSchema:()=>x$t,SpecSchema:()=>R$t,UnionSettingsSchema:()=>A$t,WhitelabelConfigurationSchema:()=>AHt,WhitelabelGithubConfigurationSchema:()=>gHt});var lpe=ve.string();var DLe=ve.enum_(["v1","v2"]);var RLe=ve.enum_(["url-order","spec-order"]);var FLe=ve.enum_(["always","never"]);var A$t=ve.enum_(["v1"]);var kLe=ve.object({"use-title":ve.boolean().optional(),unions:A$t.optional(),"message-naming":DLe.optional(),"respect-nullable-schemas":ve.boolean().optional(),"only-include-referenced-schemas":ve.boolean().optional(),"inline-path-parameters":ve.boolean().optional(),"idiomatic-request-names":ve.boolean().optional(),"wrap-references-to-nullable-in-optional":ve.boolean().optional(),"coerce-optional-schemas-to-nullable":ve.boolean().optional(),"group-environments-by-host":ve.boolean().optional(),"remove-discriminants-from-schemas":FLe.optional(),"path-parameter-order":RLe.optional()});var aM=ve.undiscriminatedUnion([ve.string(),ve.list(ve.string())]);var QLe=ve.object({path:lpe,origin:ve.string().optional(),overrides:aM.optional(),audiences:ve.list(ve.string()).optional(),settings:kLe.optional()});var NLe=ve.object({target:ve.string().optional(),root:ve.string(),overrides:aM.optional(),"local-generation":ve.boolean().optional(),"from-openapi":ve.boolean().optional(),dependencies:ve.list(ve.string()).optional()});var jLe=ve.object({proto:NLe});var y$t=ve.undiscriminatedUnion([lpe,QLe,jLe]);var b$t=ve.list(y$t);var MLe=ve.undiscriminatedUnion([lpe,QLe,b$t,jLe]);var E$t=ve.enum_(["literals","enums","enums-coerceable-to-literals"]);var LLe=ve.object({"respect-nullable-schemas":ve.boolean().optional(),"title-as-schema-name":ve.boolean().optional(),"optional-additional-properties":ve.boolean().optional(),"coerce-enums-to-literals":ve.boolean().optional(),"idiomatic-request-names":ve.boolean().optional(),"wrap-references-to-nullable-in-optional":ve.boolean().optional(),"coerce-optional-schemas-to-nullable":ve.boolean().optional(),"group-environments-by-host":ve.boolean().optional(),"remove-discriminants-from-schemas":FLe.optional(),"path-parameter-order":RLe.optional(),"resolve-schema-collisions":ve.boolean().optional(),"infer-forward-compatible":ve.boolean().optional(),"infer-default-environment":ve.boolean().optional(),"coerce-consts-to":E$t.optional()});var ULe=ve.object({"message-naming":DLe.optional()}).extend(LLe);var v$t=ve.enum_(["int32","int64","uint32","uint64"]);var I$t=ve.enum_(["form","json"]);var Fmt=ve.object({"max-depth":ve.number().optional()});var w$t=ve.object({request:Fmt.optional(),response:Fmt.optional()});var C$t=ve.object({endpoints:ve.list(ve.string()).optional()});var x$t=ve.object({except:ve.list(ve.string()).optional()});var _$t=ve.undiscriminatedUnion([ve.boolean(),x$t]);var ppe=ve.object({"only-include-referenced-schemas":ve.boolean().optional(),"inline-path-parameters":ve.boolean().optional(),"prefer-undiscriminated-unions-with-literals":ve.boolean().optional(),"object-query-parameters":ve.boolean().optional(),"respect-readonly-schemas":ve.boolean().optional(),"respect-forward-compatible-enums":ve.boolean().optional(),"use-bytes-for-binary-response":ve.boolean().optional(),"default-form-parameter-encoding":I$t.optional(),filter:C$t.optional(),"example-generation":w$t.optional(),"additional-properties-defaults-to":ve.boolean().optional(),"type-dates-as-strings":ve.boolean().optional(),"preserve-single-schema-oneof":ve.boolean().optional(),"inline-all-of-schemas":ve.boolean().optional(),"resolve-aliases":_$t.optional(),"group-multi-api-environments":ve.boolean().optional(),"default-integer-format":v$t.optional()}).extend(LLe);var zLe=ve.object({}).extend(ppe).extend(ULe);var S$t=ve.object({conjure:ve.string()});var B$t=ve.object({asyncapi:ve.string(),origin:ve.string().optional(),overrides:aM.optional(),namespace:ve.string().optional(),settings:ULe.optional()});var O$t=ve.object({graphql:ve.string(),origin:ve.string().optional(),overrides:ve.string().optional(),name:ve.string().optional()});var P$t=ve.object({openapi:ve.string(),origin:ve.string().optional(),overrides:aM.optional(),overlays:ve.string().optional(),namespace:ve.string().optional(),settings:ppe.optional()});var T$t=ve.object({openrpc:ve.string(),overrides:aM.optional(),namespace:ve.string().optional()});var D$t=ve.object({proto:NLe});var R$t=ve.undiscriminatedUnion([P$t,B$t,D$t,T$t,O$t]);var VLe=ve.undiscriminatedUnion([ve.list(R$t),S$t]);var F$t=ve.object({auth:SLe.optional(),"auth-schemes":ve.record(ve.string(),upe).optional(),specs:VLe,settings:zLe.optional()}).extend(g$t).extend(s$t);var k$t=ve.object({namespaces:ve.record(ve.string(),MLe)});var Q$t=ve.undiscriminatedUnion([MLe,k$t,F$t]);var N$t=ve.enum_(["minimal","comprehensive"]);var j$t=ve.object({name:ve.string(),email:ve.string()});var fpe=ve.object({description:ve.string().optional(),authors:ve.list(j$t).optional()});var kmt=ve.object({name:ve.string()});var dpe=ve.object({teams:ve.list(kmt).optional(),users:ve.list(kmt).optional()});var M$t=ve.object({auth:SLe.optional(),"auth-schemes":ve.record(ve.string(),upe).optional(),headers:ve.record(ve.string(),TLe).optional(),settings:zLe.optional(),specs:VLe.optional()});var L$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional()});var U$t=ve.object({path:ve.string()});var z$t=ve.object({keyId:ve.string(),password:ve.string(),secretKey:ve.string()});var V$t=ve.object({url:ve.string().optional(),coordinate:ve.string(),username:ve.string().optional(),password:ve.string().optional(),signature:z$t.optional()});var q$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional()});var G$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),"api-key":ve.string().optional()});var W$t=ve.object({"api-key":ve.string(),"workspace-id":ve.string(),"collection-id":ve.string().optional()});var $$t=ve.object({keywords:ve.list(ve.string()).optional(),"documentation-link":ve.string().optional(),"homepage-link":ve.string().optional()}).extend(fpe);var H$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional(),username:ve.string().optional(),password:ve.string().optional(),metadata:$$t.optional()});var K$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),"api-key":ve.string().optional()});var J$t=ve.union("location",{npm:q$t,maven:V$t,pypi:H$t,postman:W$t,"local-file-system":U$t,nuget:G$t,rubygems:K$t,crates:L$t}).transform({transform:e=>e,untransform:e=>e});var Y$t=ve.object({custom:ve.string()});var X$t=ve.enum_(["MIT","Apache-2.0"]);var uM=ve.undiscriminatedUnion([X$t,Y$t]);var Qmt=ve.object({"package-description":ve.string().optional(),email:ve.string().optional(),"reference-url":ve.string().optional(),author:ve.string().optional(),license:uM.optional()});var Z$t=ve.object({path:ve.string()});var eHt=ve.enum_(["commit","release"]);var tHt=ve.object({repository:ve.string(),license:uM.optional(),mode:eHt.optional()});var rHt=ve.object({repository:ve.string(),branch:ve.string().optional(),license:uM.optional(),mode:ve.stringLiteral("pull-request"),reviewers:dpe.optional()});var nHt=ve.object({repository:ve.string(),license:uM.optional(),mode:ve.stringLiteral("push"),branch:ve.string().optional()});var iHt=ve.enum_(["pull-request","push"]);var oHt=ve.object({uri:ve.string(),token:ve.string(),mode:iHt.optional(),branch:ve.string().optional(),license:uM.optional()});var sHt=ve.undiscriminatedUnion([oHt,tHt,rHt,nHt]);var aHt=ve.object({name:ve.string(),version:ve.string(),output:J$t.optional(),github:sHt.optional(),config:ve.unknown().optional(),metadata:Qmt.optional(),keywords:ve.list(ve.string()).optional(),snippets:Z$t.optional(),"ir-version":ve.string().optional(),"smart-casing":ve.boolean().optional(),api:M$t.optional(),"disable-examples":ve.boolean().optional(),"publish-metadata":Qmt.optional(),autorelease:ve.boolean().optional()});var uHt=ve.object({audiences:ve.list(ve.string()).optional(),generators:ve.list(aHt),metadata:fpe.optional(),reviewers:dpe.optional()});var cHt=ve.object({enabled:ve.boolean()});var lHt=ve.object({path:ve.string(),origin:ve.string().optional(),overrides:ve.string().optional(),"disable-examples":ve.boolean().optional(),settings:ppe});var pHt=ve.undiscriminatedUnion([lHt,ve.string()]);var fHt=ve.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var dHt=ve.object({title:ve.string(),language:fHt,content:ve.string()});var mHt=ve.object({method:ve.string(),path:ve.string(),stream:ve.boolean().optional()});var Nmt=ve.undiscriminatedUnion([ve.string(),mHt]);var hHt=ve.object({bannerLink:ve.string().optional(),introduction:ve.string().optional(),apiReferenceLink:ve.string().optional(),apiName:ve.string().optional(),disabledSections:ve.list(ve.string()).optional(),defaultEndpoint:Nmt.optional(),features:ve.record(ve.string(),ve.list(Nmt)).optional(),customSections:ve.list(dHt).optional(),exampleStyle:N$t.optional()});var gHt=ve.object({username:ve.string(),email:ve.string(),token:ve.string()});var AHt=ve.object({github:gHt.optional()});var eKo=ve.object({"auth-schemes":ve.record(ve.string(),upe).optional(),api:Q$t.optional(),whitelabel:AHt.optional(),metadata:fpe.optional(),readme:hHt.optional(),"default-group":ve.string().optional(),aliases:ve.record(ve.string(),ve.list(ve.string())).optional(),groups:ve.record(ve.string(),uHt).optional(),reviewers:dpe.optional(),replay:cHt.optional(),ai:TWt.optional(),autorelease:ve.boolean().optional(),openapi:pHt.optional(),"openapi-overrides":ve.string().optional(),"spec-origin":ve.string().optional(),"async-api":ve.string().optional(),"api-settings":kLe.optional()});var GHn={};X(GHn,{CratesOutputLocationSchema:()=>L$t,GeneratorApiSettingsSchema:()=>M$t,GeneratorGroupSchema:()=>uHt,GeneratorInvocationSchema:()=>aHt,GeneratorOutputSchema:()=>J$t,GeneratorPublishMetadataSchema:()=>Qmt,GeneratorSnippetsSchema:()=>Z$t,GithubCommitAndReleaseMode:()=>eHt,GithubCommitAndReleaseSchema:()=>tHt,GithubConfigurationSchema:()=>sHt,GithubPullRequestSchema:()=>rHt,GithubPushSchema:()=>nHt,GithubSelfhostedMode:()=>iHt,GithubSelfhostedSchema:()=>oHt,LocalFileSystemOutputLocationSchema:()=>U$t,MavenOutputLocationSchema:()=>V$t,MavenOutputSignatureSchema:()=>z$t,NpmOutputLocationSchema:()=>q$t,NugetOutputLocationSchema:()=>G$t,PostmanOutputLocationSchema:()=>W$t,PypiOutputLocationSchema:()=>H$t,PypiOutputMetadataSchema:()=>$$t,RubyGemsOutputLocationSchema:()=>K$t});var WHn={};X(WHn,{GithubLicenseCustomSchema:()=>Y$t,GithubLicenseSchema:()=>uM,GithubLicenseType:()=>X$t});var $Hn={};X($Hn,{ReplayConfigSchema:()=>cHt});var HHn={};X(HHn,{ReviewerSchema:()=>kmt,ReviewersSchema:()=>dpe});function tKo(e){return e?.specs!=null}function rKo(e){return e?.asyncapi!=null}function nKo(e){return e?.conjure!=null}function iKo(e){return e?.graphql!=null}function oKo(e){return e?.namespaces!=null}function sKo(e){return e?.openapi!=null}function aKo(e){return e?.openrpc!=null}function uKo(e){return e?.proto!=null}var WFc={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!0,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,groupEnvironmentsByHost:!1,removeDiscriminantsFromSchemas:bn.RemoveDiscriminantsFromSchemas.Always,inferDefaultEnvironment:!0};function $Fc(e){let{defaults:t,options:r,overrides:n,overrideOnly:i=new Set,undefinedIfAbsent:o=new Set}=e,s={};for(let a of Object.keys(t))i.has(a)?s[a]=n?.[a]!==void 0?n[a]:t[a]:o.has(a)?s[a]=n?.[a]!==void 0?n[a]:r?.[a]!==void 0?r[a]:void 0:s[a]=n?.[a]??r?.[a]??t[a];return s}function h_e({options:e,overrides:t}){return $Fc({defaults:WFc,options:e,overrides:t})}yg();yg();St();var qLe={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return qLe._visit(this,t)}}),_visit:(e,t)=>e.type==="protobuf"?t.protobuf(e):t._other(e)};var qw={basic:e=>({...e,type:"basic",_visit:function(t){return qw._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return qw._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return qw._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return qw._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return qw._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"query":return t.query(e);case"oauth":return t.oauth(e);default:return t._other(e)}}};var ES={openapi:e=>({...e,type:"openapi",_visit:function(t){return ES._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return ES._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"openapi":return t.openapi(e);case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var Ka={primitive:e=>({value:e,type:"primitive",_visit:function(t){return Ka._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Ka._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return Ka._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return Ka._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return Ka._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return Ka._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Ka._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return Ka._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return Ka._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"null":return t.null(e);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var mpe={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return mpe._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return mpe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e.value);case"undiscriminated":return t.undiscriminated(e.value);default:return t._other(e)}}};var hpe={boolean:e=>({value:e,type:"boolean",_visit:function(t){return hpe._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return hpe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var us={int:e=>({value:e,type:"int",_visit:function(t){return us._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return us._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return us._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return us._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return us._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return us._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return us._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return us._visit(this,t)}}),datetimeRfc2822:e=>({value:e,type:"datetimeRfc2822",_visit:function(t){return us._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return us._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return us._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return us._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e.value);case"int64":return t.int64(e.value);case"uint":return t.uint(e.value);case"uint64":return t.uint64(e.value);case"float":return t.float(e.value);case"double":return t.double(e.value);case"string":return t.string(e.value);case"datetime":return t.datetime(e.value);case"datetimeRfc2822":return t.datetimeRfc2822(e.value);case"date":return t.date(e.value);case"base64":return t.base64(e.value);case"boolean":return t.boolean(e.value);default:return t._other(e)}}};var Yh={};X(Yh,{AsymmetricAlgorithm:()=>gpe,Availability:()=>Gw,CustomCodeSample:()=>Y9,DiscriminatorContext:()=>JHn,EndpointExample:()=>cM,EndpointResponseExample:()=>lM,HttpMethod:()=>Ww,LiteralSchemaValue:()=>xg,MultipartRequestPropertyEncoding:()=>YHn,MultipartSchema:()=>X9,OneOfSchema:()=>Z9,Pagination:()=>xI,PrimitiveSchemaValue:()=>Uc,Request:()=>n8,Response:()=>m_,RetriesConfiguration:()=>jmt,Schema:()=>la,SupportedSdkLanguage:()=>$w,WebhookHttpMethod:()=>XHn,WebhookPayloadComponent:()=>Mmt,WebhookSignatureAlgorithm:()=>Lmt,WebhookSignatureEncoding:()=>ZHn,WebhookSignatureVerification:()=>g_e,WebhookTimestampFormat:()=>yHt,WebsocketMessageOrigin:()=>eKn});var HFc={RsaSha256:"rsa-sha256",RsaSha384:"rsa-sha384",RsaSha512:"rsa-sha512",EcdsaSha256:"ecdsa-sha256",EcdsaSha384:"ecdsa-sha384",EcdsaSha512:"ecdsa-sha512",Ed25519:"ed25519"},gpe={...HFc,_visit:(e,t)=>{switch(e){case gpe.RsaSha256:return t.rsaSha256();case gpe.RsaSha384:return t.rsaSha384();case gpe.RsaSha512:return t.rsaSha512();case gpe.EcdsaSha256:return t.ecdsaSha256();case gpe.EcdsaSha384:return t.ecdsaSha384();case gpe.EcdsaSha512:return t.ecdsaSha512();case gpe.Ed25519:return t.ed25519();default:return t._other()}}};var KFc={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated"},Gw={...KFc,_visit:(e,t)=>{switch(e){case Gw.GenerallyAvailable:return t.generallyAvailable();case Gw.Beta:return t.beta();case Gw.Deprecated:return t.deprecated();default:return t._other()}}};var Y9={language:e=>({...e,type:"language",_visit:function(t){return Y9._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return Y9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"language":return t.language(e);case"sdk":return t.sdk(e);default:return t._other(e)}}};var JFc={Data:"data",Protocol:"protocol"},JHn={...JFc,_visit:(e,t)=>{switch(e){case JHn.Data:return t.data();case JHn.Protocol:return t.protocol();default:return t._other()}}};var cM={unknown:e=>({value:e,type:"unknown",_visit:function(t){return cM._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return cM._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"unknown":return t.unknown(e.value);case"full":return t.full(e);default:return t._other(e)}}};var lM={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return lM._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return lM._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"withStreaming":return t.withStreaming(e);case"withoutStreaming":return t.withoutStreaming(e.value);default:return t._other(e)}}};var YFc={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE"},Ww={...YFc,_visit:(e,t)=>{switch(e){case Ww.Get:return t.get();case Ww.Post:return t.post();case Ww.Put:return t.put();case Ww.Patch:return t.patch();case Ww.Delete:return t.delete();case Ww.Head:return t.head();case Ww.Options:return t.options();case Ww.Trace:return t.trace();default:return t._other()}}};var xg={boolean:e=>({value:e,type:"boolean",_visit:function(t){return xg._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return xg._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var XFc={Json:"json",Form:"form"},YHn={...XFc,_visit:(e,t)=>{switch(e){case YHn.Json:return t.json();case YHn.Form:return t.form();default:return t._other()}}};var X9={file:e=>({...e,type:"file",_visit:function(t){return X9._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return X9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e.value);default:return t._other(e)}}};var Z9={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return Z9._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return Z9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var xI={cursor:e=>({...e,type:"cursor",_visit:function(t){return xI._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return xI._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return xI._visit(this,t)}}),uri:e=>({...e,type:"uri",_visit:function(t){return xI._visit(this,t)}}),path:e=>({...e,type:"path",_visit:function(t){return xI._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);case"uri":return t.uri(e);case"path":return t.path(e);default:return t._other(e)}}};var Uc={int:e=>({...e,type:"int",_visit:function(t){return Uc._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Uc._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Uc._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Uc._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Uc._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Uc._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Uc._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Uc._visit(this,e)}}),datetimeRfc2822:()=>({type:"datetimeRfc2822",_visit:function(e){return Uc._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Uc._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Uc._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Uc._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint();case"uint64":return t.uint64();case"float":return t.float();case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime();case"datetimeRfc2822":return t.datetimeRfc2822();case"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var n8={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return n8._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return n8._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return n8._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return n8._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var m_={file:e=>({...e,type:"file",_visit:function(t){return m_._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return m_._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return m_._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return m_._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return m_._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return m_._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return m_._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var jmt={disabled:e=>({value:e,type:"disabled",_visit:function(t){return jmt._visit(this,t)}}),_visit:(e,t)=>e.type==="disabled"?t.disabled(e.value):t._other(e)};var la={primitive:e=>({...e,type:"primitive",_visit:function(t){return la._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return la._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return la._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return la._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return la._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return la._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return la._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return la._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return la._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return la._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return la._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var ZFc={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Js:"js",Node:"node",Ts:"ts",Nodets:"nodets",Golang:"golang",Dotnet:"dotnet",Jvm:"jvm"},$w={...ZFc,_visit:(e,t)=>{switch(e){case $w.Curl:return t.curl();case $w.Python:return t.python();case $w.Javascript:return t.javascript();case $w.Typescript:return t.typescript();case $w.Go:return t.go();case $w.Ruby:return t.ruby();case $w.Csharp:return t.csharp();case $w.Java:return t.java();case $w.Js:return t.js();case $w.Node:return t.node();case $w.Ts:return t.ts();case $w.Nodets:return t.nodets();case $w.Golang:return t.golang();case $w.Dotnet:return t.dotnet();case $w.Jvm:return t.jvm();default:return t._other()}}};var ekc={Get:"GET",Post:"POST"},XHn={...ekc,_visit:(e,t)=>{switch(e){case XHn.Get:return t.get();case XHn.Post:return t.post();default:return t._other()}}};var tkc={Body:"body",Timestamp:"timestamp",NotificationUrl:"notification-url",MessageId:"message-id"},Mmt={...tkc,_visit:(e,t)=>{switch(e){case Mmt.Body:return t.body();case Mmt.Timestamp:return t.timestamp();case Mmt.NotificationUrl:return t.notificationUrl();case Mmt.MessageId:return t.messageId();default:return t._other()}}};var rkc={Sha256:"sha256",Sha1:"sha1",Sha384:"sha384",Sha512:"sha512"},Lmt={...rkc,_visit:(e,t)=>{switch(e){case Lmt.Sha256:return t.sha256();case Lmt.Sha1:return t.sha1();case Lmt.Sha384:return t.sha384();case Lmt.Sha512:return t.sha512();default:return t._other()}}};var nkc={Base64:"base64",Hex:"hex"},ZHn={...nkc,_visit:(e,t)=>{switch(e){case ZHn.Base64:return t.base64();case ZHn.Hex:return t.hex();default:return t._other()}}};var g_e={hmac:e=>({...e,type:"hmac",_visit:function(t){return g_e._visit(this,t)}}),asymmetric:e=>({...e,type:"asymmetric",_visit:function(t){return g_e._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"hmac":return t.hmac(e);case"asymmetric":return t.asymmetric(e);default:return t._other(e)}}};var ikc={UnixSeconds:"unix-seconds",UnixMillis:"unix-millis",Iso8601:"iso8601"},yHt={...ikc,_visit:(e,t)=>{switch(e){case yHt.UnixSeconds:return t.unixSeconds();case yHt.UnixMillis:return t.unixMillis();case yHt.Iso8601:return t.iso8601();default:return t._other()}}};var okc={Client:"client",Server:"server"},eKn={...okc,_visit:(e,t)=>{switch(e){case eKn.Client:return t.client();case eKn.Server:return t.server();default:return t._other()}}};var iQ={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return iQ._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return iQ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var Ii={int:e=>({...e,type:"int",_visit:function(t){return Ii._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Ii._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Ii._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Ii._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Ii._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Ii._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Ii._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Ii._visit(this,t)}}),datetimeRfc2822:e=>({...e,type:"datetimeRfc2822",_visit:function(t){return Ii._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Ii._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Ii._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Ii._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint(e);case"uint64":return t.uint64(e);case"float":return t.float(e);case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime(e);case"datetimeRfc2822":return t.datetimeRfc2822(e);case"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var eP={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return eP._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return eP._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return eP._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return eP._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var Ch={file:e=>({...e,type:"file",_visit:function(t){return Ch._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Ch._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Ch._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return Ch._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return Ch._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return Ch._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return Ch._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var kr={primitive:e=>({...e,type:"primitive",_visit:function(t){return kr._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return kr._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return kr._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return kr._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return kr._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return kr._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return kr._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return kr._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return kr._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return kr._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return kr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var pa={};X(pa,{AllOfPropertyConflict:()=>YLe,ArraySchema:()=>WHt,ArraySchemaWithExample:()=>tJt,AsymmetricAlgorithm:()=>$Ht,AsymmetricWebhookSignatureVerification:()=>KHt,Availability:()=>PHt,Base64WithExample:()=>rJt,BasicSecurityScheme:()=>wHt,BearerSecurityScheme:()=>CHt,BooleanSchema:()=>JHt,BooleanWithExample:()=>nJt,BytesResponse:()=>eUe,CasingOverrides:()=>kHt,CommonProperty:()=>YHt,CommonPropertyWithExample:()=>iJt,CursorPagination:()=>XHt,CustomCodeSample:()=>rKt,CustomCodeSampleLanguage:()=>ZHt,CustomCodeSampleSdk:()=>tKt,CustomPagination:()=>nKt,DateWithExample:()=>oJt,DatetimeWithExample:()=>qmt,DiscriminatedOneOfSchema:()=>iKt,DiscriminatedOneOfSchemaWithExample:()=>sJt,DiscriminatorContext:()=>tUe,DoubleSchema:()=>oKt,DoubleWithExample:()=>aJt,Encoding:()=>_Ht,Endpoint:()=>IKt,EndpointExample:()=>iUe,EndpointResponseExample:()=>uKt,EndpointSdkName:()=>rG,EndpointSecurity:()=>oUe,EndpointWithExample:()=>NKo,EnumSchema:()=>HLe,EnumSchemaWithExample:()=>hJt,EnumValue:()=>ype,ErrorExample:()=>pKt,FernExample:()=>sKt,FileResponse:()=>dUe,FileSchema:()=>bKt,FloatWithExample:()=>gJt,FormUrlEncodedRequest:()=>gKt,FullEndpointExample:()=>lKt,FullExample:()=>pm,FullObjectExample:()=>VHt,FullOneOfExample:()=>qHt,GlobalHeader:()=>wKt,GlobalSecurity:()=>CKt,Header:()=>Epe,HeaderExample:()=>rUe,HeaderSecurityScheme:()=>SHt,HeaderWithExample:()=>Cpe,HmacWebhookSignatureVerification:()=>BKt,HttpEndpointServer:()=>sUe,HttpError:()=>fKt,HttpErrorWithExample:()=>uJt,HttpMethod:()=>aUe,IdempotencyHeader:()=>OKt,Int64WithExample:()=>AJt,IntSchema:()=>PKt,IntWithExample:()=>yJt,JsonRequest:()=>AKt,JsonRequestWithExample:()=>lJt,JsonResponse:()=>mUe,JsonResponseWithExample:()=>wUe,KeyValuePair:()=>GHt,LiteralExample:()=>UHt,LiteralSchema:()=>AUe,LiteralSchemaValue:()=>TKt,LongSchema:()=>DKt,MapSchema:()=>kKt,MapSchemaWithExample:()=>wJt,MultipartFormDataWebhookPayload:()=>QKt,MultipartFormDataWebhookPayloadWithExample:()=>CJt,MultipartRequest:()=>pUe,MultipartRequestProperty:()=>vpe,MultipartRequestPropertyEncoding:()=>yKt,MultipartSchema:()=>EKt,NamedFullExample:()=>KD,Namespace:()=>BHt,NamespaceId:()=>OHt,NullExample:()=>zHt,NullableSchema:()=>NKt,NullableSchemaWithExample:()=>xJt,OauthSecurityScheme:()=>QHt,ObjectProperty:()=>jKt,ObjectPropertyConflictInfo:()=>yUe,ObjectPropertyWithExample:()=>_Jt,ObjectSchema:()=>MKt,ObjectSchemaWithExample:()=>SJt,OctetStreamRequest:()=>fUe,OffsetPagination:()=>dKt,OneOfSchema:()=>LKt,OneOfSchemaWithExample:()=>BJt,OpenApiIntermediateRepresentation:()=>QKo,OpenApiSource:()=>DHt,OptionalSchema:()=>ZKt,OptionalSchemaWithExample:()=>PJt,Pagination:()=>uUe,ParseFormUrlEncodedRequest:()=>pJt,ParseMultipartRequest:()=>fJt,ParseOctetStreamRequest:()=>dJt,PathPagination:()=>mKt,PathParameter:()=>cUe,PathParameterExample:()=>cKt,PathParameterWithExample:()=>cJt,PrimitiveExample:()=>KLe,PrimitiveSchema:()=>wpe,PrimitiveSchemaValue:()=>FKt,PrimitiveSchemaValueWithExample:()=>IJt,PrimitiveSchemaWithExample:()=>xUe,PropertyKey:()=>JLe,ProtobufEncoding:()=>xHt,ProtobufSource:()=>RHt,QueryParameter:()=>lUe,QueryParameterExample:()=>nUe,QueryParameterWithExample:()=>IUe,QuerySecurityScheme:()=>NHt,ReferencedSchema:()=>nG,Request:()=>vKt,RequestWithExample:()=>mJt,Response:()=>hUe,ResponseWithExample:()=>CUe,RetriesConfiguration:()=>gUe,Schema:()=>Pc,SchemaId:()=>tP,SchemaWithExample:()=>df,Schemas:()=>zKt,SdkGroup:()=>THt,SdkGroupInfo:()=>VKt,SdkGroupName:()=>Ape,SecurityScheme:()=>jHt,SecuritySchemeId:()=>bpe,Server:()=>Vmt,ServerVariable:()=>MHt,Source:()=>FHt,StatusCode:()=>eG,StreamingResponseExample:()=>aKt,StringSchema:()=>RKt,StringSchemaWithExample:()=>bJt,SupportedSdkLanguage:()=>eKt,Tag:()=>LHt,TagId:()=>rP,Tags:()=>qKt,TextResponse:()=>Ipe,Uint64WithExample:()=>EJt,UintWithExample:()=>vJt,UnDiscriminatedOneOfSchema:()=>UKt,UnDiscriminatedOneOfSchemaWithExample:()=>OJt,UnknownSchema:()=>eJt,UnknownSchemaWithExample:()=>TJt,UriPagination:()=>hKt,Webhook:()=>GKt,WebhookExampleCall:()=>bUe,WebhookHttpMethod:()=>EUe,WebhookPayloadComponent:()=>xKt,WebhookPayloadFormat:()=>_Kt,WebhookSignatureAlgorithm:()=>SKt,WebhookSignatureEncoding:()=>XLe,WebhookSignatureVerification:()=>vUe,WebhookTimestamp:()=>ZLe,WebhookTimestampFormat:()=>HHt,WebhookWithExample:()=>jKo,WebsocketChannel:()=>XKt,WebsocketHandshake:()=>WKt,WebsocketHandshakeWithExample:()=>MKo,WebsocketMessageExample:()=>JKt,WebsocketMessageOrigin:()=>$Kt,WebsocketMessageSchema:()=>HKt,WebsocketServer:()=>KKt,WebsocketSessionExample:()=>YKt,WithAvailability:()=>rs,WithDescription:()=>fn,WithEncoding:()=>Jw,WithInline:()=>ff,WithName:()=>Eu,WithNamespace:()=>Ga,WithSdkGroupName:()=>uc,WithSdkMethodName:()=>tG,WithSource:()=>Uo,WithStatusCode:()=>pM,WithTitle:()=>cc,commons:()=>sKn,example:()=>aKn,finalIr:()=>uKn,parseIr:()=>cKn});var sKn={};X(sKn,{BasicSecurityScheme:()=>wHt,BearerSecurityScheme:()=>CHt,Encoding:()=>_Ht,HeaderSecurityScheme:()=>SHt,Namespace:()=>BHt,NamespaceId:()=>OHt,OauthSecurityScheme:()=>QHt,OpenApiSource:()=>DHt,ProtobufEncoding:()=>xHt,ProtobufSource:()=>RHt,QuerySecurityScheme:()=>NHt,SchemaId:()=>tP,SdkGroup:()=>THt,SdkGroupName:()=>Ape,SecurityScheme:()=>jHt,SecuritySchemeId:()=>bpe,Server:()=>Vmt,ServerVariable:()=>MHt,Source:()=>FHt,StatusCode:()=>eG,Tag:()=>LHt,TagId:()=>rP,WithAvailability:()=>rs,WithDescription:()=>fn,WithEncoding:()=>Jw,WithInline:()=>ff,WithName:()=>Eu,WithNamespace:()=>Ga,WithSdkGroupName:()=>uc,WithSdkMethodName:()=>tG,WithSource:()=>Uo,WithStatusCode:()=>pM,WithTitle:()=>cc});var W={};X(W,{JsonError:()=>GLe,ParseError:()=>WLe,any:()=>IKo,bigint:()=>lKo,boolean:()=>wKo,booleanLiteral:()=>EKo,date:()=>pKo,discriminant:()=>RKo,enum_:()=>EHt,getObjectLikeUtils:()=>i8,getObjectUtils:()=>A_e,getSchemaUtils:()=>hd,isProperty:()=>one,lazy:()=>fKo,lazyObject:()=>yKo,list:()=>IHt,never:()=>CKo,number:()=>xKo,object:()=>vHt,objectWithoutOptionalProperties:()=>AKo,optional:()=>tKn,property:()=>mKo,record:()=>OKo,set:()=>PKo,string:()=>_Ko,stringLiteral:()=>vKo,transform:()=>rKn,undiscriminatedUnion:()=>DKo,union:()=>kKo,unknown:()=>SKo,withParsedProperties:()=>oKn});var ac={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",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function jf(e,t){return`Expected ${t}. Received ${skc(e)}.`}function skc(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 Hw(e){return{...e,json:cKo(e.json),parse:cKo(e.parse)}}function cKo(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(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
1461
1461
  `)),{ok:!0,value:t}):n}}function bHt(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var GLe=class e extends Error{errors;constructor(t){super(t.map(bHt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var WLe=class e extends Error{errors;constructor(t){super(t.map(bHt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function hd(e){return{nullable:()=>akc(e),optional:()=>tKn(e),optionalNullable:()=>ukc(e),transform:t=>rKn(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new WLe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new GLe(n.errors)}}}function akc(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:()=>ac.NULLABLE};return{...t,...hd(t)}}function tKn(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:()=>ac.OPTIONAL};return{...t,...hd(t)}}function ukc(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:()=>ac.OPTIONAL_NULLABLE};return{...t,...hd(t)}}function rKn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...hd(r)}}function lKo(){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:jf(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:jf(t,"bigint")}]}:{ok:!0,value:t},getType:()=>ac.BIGINT};return{...Hw(e),...hd(e)}}var ckc=/^([+-]?\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 pKo(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:jf(t,"string")}]}:ckc.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:jf(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:jf(t,"Date object")}]},getType:()=>ac.DATE};return{...Hw(e),...hd(e)}}function Kw(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...Hw(r),...hd(r)}}}function EHt(e){let t=new Set(e);return Kw(ac.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:jf(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:jf(n,"enum")}]}:{ok:!0,value:n})()}function fKo(e){let t=nKn(e);return{...t,...hd(t)}}function nKn(e){return{parse:(t,r)=>$Le(e).parse(t,r),json:(t,r)=>$Le(e).json(t,r),getType:()=>$Le(e).getType()}}function $Le(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function iKn(e){return Object.entries(e)}function Umt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function ine(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function zmt(e){return Object.keys(e)}function dKo(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var lkc=Object.prototype.hasOwnProperty;function i8(e){return{withParsedProperties:t=>oKn(e,t)}}function oKn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(lkc.call(t,a)){let u=t[a];s[a]=typeof u=="function"?u(o.value):u}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!ine(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:jf(n,"object")}]};let o=new Set(Object.keys(t)),s=Umt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...hd(r),...i8(r)}}function mKo(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function one(e){return e.isProperty}var pkc=Object.prototype.hasOwnProperty;function vHt(e){let t;function r(){if(t==null){t={};for(let[d,f]of iKn(e)){let m=one(f)?f.rawKey:d,h=one(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of iKn(e)){let m=one(f)?f.rawKey:d,h=one(f)?f.valueSchema:f;fkc(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function u(){return i==null&&a(),i}function c(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>one(f)?f.rawKey:d),_getParsedProperties:()=>zmt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return hKo({value:d,requiredKeys:a(),requiredKeysSet:c(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let b=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return hKo({value:d,requiredKeys:u(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return one(g)?{transformedKey:g.rawKey,transform:A=>{let b=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:b})}}:{transformedKey:h,transform:A=>{let b=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:b})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>ac.OBJECT};return{...Hw(p),...hd(p),...i8(p),...A_e(p)}}function hKo({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!ine(e))return{ok:!1,errors:[{path:s,message:jf(e,"object")}]};let a=t.length,u=[],c={};for(let l in e){if(!pkc.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?c[d.transformedKey]=f.value:(c[l]=p,u.push(...f.errors))}else switch(i){case"fail":u.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=p;break}}if(a>0)for(let l of t)l in e||u.push({path:s,message:`Missing required key "${l}"`});return u.length===0||o?{ok:!0,value:c}:{ok:!1,errors:u}}function A_e(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>gKo({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>gKo({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>ac.OBJECT};return{...r,...hd(r),...i8(r),...A_e(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))t.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))r.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},getType:()=>ac.OBJECT};return{...n,...hd(n),...i8(n),...A_e(n)}}}}function gKo({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!ine(t))return{ok:!1,errors:[{path:i,message:jf(t,"object")}]};let o=new Set(e),[s,a]=dKo(zmt(t),l=>o.has(l)),u=r(Umt(t,a)),c=n(Umt(t,s));return u.ok&&c.ok?{ok:!0,value:{...u.value,...c.value}}:{ok:!1,errors:[...u.ok?[]:u.errors,...c.ok?[]:c.errors]}}function fkc(e){return!dkc(e)}function dkc(e){switch(e.getType()){case ac.ANY:case ac.UNKNOWN:case ac.OPTIONAL:case ac.OPTIONAL_NULLABLE:return!0;default:return!1}}function AKo(e){return vHt(e)}function yKo(e){let t={...nKn(e),_getRawProperties:()=>$Le(e)._getRawProperties(),_getParsedProperties:()=>$Le(e)._getParsedProperties()};return{...t,...hd(t),...i8(t),...A_e(t)}}function IHt(e){let t={parse:(r,n)=>bKo(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>bKo(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>ac.LIST};return{...Hw(t),...hd(t)}}function bKo(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:jf(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function EKo(e){return Kw(ac.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:jf(r,`${e.toString()}`)}]})()}function vKo(e){return Kw(ac.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:jf(r,`"${e}"`)}]})()}var IKo=Kw(ac.ANY,e=>({ok:!0,value:e}));var wKo=Kw(ac.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:jf(e,"boolean")}]});var CKo=Kw(ac.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var xKo=Kw(ac.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:jf(e,"number")}]});var _Ko=Kw(ac.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:jf(e,"string")}]});var SKo=Kw(ac.UNKNOWN,e=>({ok:!0,value:e}));var mkc=Object.prototype.hasOwnProperty;function OKo(e,t){let r={parse:(n,i)=>BKo({value:n,isKeyNumeric:e.getType()===ac.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>BKo({value:n,isKeyNumeric:e.getType()===ac.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>ac.RECORD};return{...Hw(r),...hd(r)}}function BKo({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!ine(e))return{ok:!1,errors:[{path:i,message:jf(e,"object")}]};let o={},s=[];for(let a in e){if(!mkc.call(e,a))continue;let u=e[a];if(u===void 0)continue;let c=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(c=d)}let l=r(c),p=n(u,c);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function PKo(e){let t=IHt(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:jf(n,"Set")}]},getType:()=>ac.SET};return{...Hw(r),...hd(r)}}function DKo(e){let t={parse:(r,n)=>TKo((i,o)=>i.parse(r,o),e,n),json:(r,n)=>TKo((i,o)=>i.json(r,o),e,n),getType:()=>ac.UNDISCRIMINATED_UNION};return{...Hw(t),...hd(t)}}function TKo(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function RKo(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var hkc=Object.prototype.hasOwnProperty;function kKo(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=EHt(zmt(t)),o={parse:(s,a)=>FKo({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>i.parse(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.parse(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>FKo({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>i.json(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.json(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>ac.UNION};return{...Hw(o),...hd(o),...i8(o)}}function FKo({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!ine(e))return{ok:!1,errors:[{path:a,message:jf(e,"object")}]};let u=e[t],c={};for(let f in e)hkc.call(e,f)&&f!==t&&(c[f]=e[f]);if(u==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(u);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...c}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(c,p);return d.ok?{ok:!0,value:{[r]:u,...d.value}}:d}var wHt=W.objectWithoutOptionalProperties({usernameVariableName:W.string().optional(),usernameEnvVar:W.string().optional(),passwordVariableName:W.string().optional(),passwordEnvVar:W.string().optional()});var CHt=W.objectWithoutOptionalProperties({tokenVariableName:W.string().optional(),tokenEnvVar:W.string().optional()});var xHt=W.objectWithoutOptionalProperties({typeName:W.string()});var _Ht=W.union("type",{protobuf:xHt}).transform({transform:e=>e.type==="protobuf"?qLe.protobuf(e):e,untransform:({_visit:e,...t})=>t});var SHt=W.objectWithoutOptionalProperties({headerName:W.string(),prefix:W.string().optional(),headerVariableName:W.string().optional(),headerEnvVar:W.string().optional()});var BHt=W.objectWithoutOptionalProperties({type:W.stringLiteral("namespace"),name:W.string()});var OHt=W.string();var PHt=W.enum_(["GenerallyAvailable","Beta","Deprecated"]);var rs=W.objectWithoutOptionalProperties({availability:PHt.optional()});var fn=W.objectWithoutOptionalProperties({description:W.string().optional()});var ff=W.objectWithoutOptionalProperties({inline:W.boolean().optional()});var Eu=W.objectWithoutOptionalProperties({nameOverride:W.string().optional(),generatedName:W.string()});var Ga=W.objectWithoutOptionalProperties({namespace:W.string().optional()});var THt=W.undiscriminatedUnion([W.string(),BHt]);var Ape=W.list(THt);var uc=W.objectWithoutOptionalProperties({groupName:Ape.optional()});var DHt=W.objectWithoutOptionalProperties({file:W.string()});var RHt=W.objectWithoutOptionalProperties({file:W.string()});var FHt=W.union("type",{openapi:DHt,protobuf:RHt}).transform({transform:e=>{switch(e.type){case"openapi":return ES.openapi(e);case"protobuf":return ES.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Uo=W.objectWithoutOptionalProperties({source:FHt.optional()});var cc=W.objectWithoutOptionalProperties({title:W.string().optional()});var kHt=W.objectWithoutOptionalProperties({snake:W.string().optional(),camel:W.string().optional(),screamingSnake:W.string().optional(),pascal:W.string().optional()});var ype=W.objectWithoutOptionalProperties({nameOverride:W.string().optional(),generatedName:W.string(),value:W.string(),casing:kHt.optional()}).extend(fn).extend(rs);var HLe=W.objectWithoutOptionalProperties({default:ype.optional(),values:W.list(ype)}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(Uo).extend(cc).extend(ff);var QHt=W.objectWithoutOptionalProperties({scopesEnum:HLe.optional()});var NHt=W.objectWithoutOptionalProperties({queryParameterName:W.string()});var tP=W.string();var jHt=W.union("type",{basic:wHt,bearer:CHt,header:SHt,query:NHt,oauth:QHt}).transform({transform:e=>{switch(e.type){case"basic":return qw.basic(e);case"bearer":return qw.bearer(e);case"header":return qw.header(e);case"query":return qw.query(e);case"oauth":return qw.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var bpe=W.string();var MHt=W.objectWithoutOptionalProperties({id:W.string(),default:W.string().optional(),values:W.list(W.string()).optional()});var Vmt=W.objectWithoutOptionalProperties({name:W.string().optional(),url:W.string(),audiences:W.list(W.string()).optional(),defaultUrl:W.string().optional(),urlTemplate:W.string().optional(),variables:W.list(MHt).optional()}).extend(fn);var eG=W.number();var rP=W.string();var LHt=W.objectWithoutOptionalProperties({id:rP}).extend(fn);var Jw=W.objectWithoutOptionalProperties({encoding:_Ht.optional()});var tG=W.objectWithoutOptionalProperties({sdkMethodName:W.string().optional()});var pM=W.objectWithoutOptionalProperties({statusCode:eG.optional()});var aKn={};X(aKn,{FullExample:()=>pm,FullObjectExample:()=>VHt,FullOneOfExample:()=>qHt,KeyValuePair:()=>GHt,LiteralExample:()=>UHt,NullExample:()=>zHt,PrimitiveExample:()=>KLe,PropertyKey:()=>JLe});var UHt=W.union("type",{boolean:W.object({value:W.boolean()}),string:W.object({value:W.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return hpe.boolean(e.value);case"string":return hpe.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var zHt=W.objectWithoutOptionalProperties({});var KLe=W.union("type",{int:W.object({value:W.number()}),int64:W.object({value:W.number()}),uint:W.object({value:W.number()}),uint64:W.object({value:W.number()}),float:W.object({value:W.number()}),double:W.object({value:W.number()}),string:W.object({value:W.string()}),datetime:W.object({value:W.string()}),datetimeRfc2822:W.object({value:W.string()}),date:W.object({value:W.string()}),base64:W.object({value:W.string()}),boolean:W.object({value:W.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return us.int(e.value);case"int64":return us.int64(e.value);case"uint":return us.uint(e.value);case"uint64":return us.uint64(e.value);case"float":return us.float(e.value);case"double":return us.double(e.value);case"string":return us.string(e.value);case"datetime":return us.datetime(e.value);case"datetimeRfc2822":return us.datetimeRfc2822(e.value);case"date":return us.date(e.value);case"base64":return us.base64(e.value);case"boolean":return us.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var pm=W.union("type",{primitive:W.object({value:KLe}),object:W.lazyObject(()=>VHt),array:W.object({value:W.list(W.lazy(()=>pm))}),map:W.object({value:W.list(W.lazyObject(()=>GHt))}),enum:W.object({value:W.string()}),literal:W.object({value:UHt}),oneOf:W.object({value:W.lazy(()=>qHt)}),null:zHt,unknown:W.object({value:W.lazy(()=>pm)})}).transform({transform:e=>{switch(e.type){case"primitive":return Ka.primitive(e.value);case"object":return Ka.object(e);case"array":return Ka.array(e.value);case"map":return Ka.map(e.value);case"enum":return Ka.enum(e.value);case"literal":return Ka.literal(e.value);case"oneOf":return Ka.oneOf(e.value);case"null":return Ka.null(e);case"unknown":return Ka.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var JLe=W.string();var VHt=W.objectWithoutOptionalProperties({properties:W.record(JLe,W.lazy(()=>pm))});var qHt=W.union("type",{discriminated:W.object({value:W.record(JLe,W.lazy(()=>pm))}),undiscriminated:W.object({value:W.lazy(()=>pm)})}).transform({transform:e=>{switch(e.type){case"discriminated":return mpe.discriminated(e.value);case"undiscriminated":return mpe.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var GHt=W.objectWithoutOptionalProperties({key:KLe,value:W.lazy(()=>pm)});var uKn={};X(uKn,{AllOfPropertyConflict:()=>YLe,ArraySchema:()=>WHt,AsymmetricAlgorithm:()=>$Ht,AsymmetricWebhookSignatureVerification:()=>KHt,Availability:()=>PHt,BooleanSchema:()=>JHt,BytesResponse:()=>eUe,CasingOverrides:()=>kHt,CommonProperty:()=>YHt,CursorPagination:()=>XHt,CustomCodeSample:()=>rKt,CustomCodeSampleLanguage:()=>ZHt,CustomCodeSampleSdk:()=>tKt,CustomPagination:()=>nKt,DiscriminatedOneOfSchema:()=>iKt,DiscriminatorContext:()=>tUe,DoubleSchema:()=>oKt,Endpoint:()=>IKt,EndpointExample:()=>iUe,EndpointResponseExample:()=>uKt,EndpointSdkName:()=>rG,EndpointSecurity:()=>oUe,EnumSchema:()=>HLe,EnumValue:()=>ype,ErrorExample:()=>pKt,FernExample:()=>sKt,FileResponse:()=>dUe,FileSchema:()=>bKt,FormUrlEncodedRequest:()=>gKt,FullEndpointExample:()=>lKt,GlobalHeader:()=>wKt,GlobalSecurity:()=>CKt,Header:()=>Epe,HeaderExample:()=>rUe,HmacWebhookSignatureVerification:()=>BKt,HttpEndpointServer:()=>sUe,HttpError:()=>fKt,HttpMethod:()=>aUe,IdempotencyHeader:()=>OKt,IntSchema:()=>PKt,JsonRequest:()=>AKt,JsonResponse:()=>mUe,LiteralSchema:()=>AUe,LiteralSchemaValue:()=>TKt,LongSchema:()=>DKt,MapSchema:()=>kKt,MultipartFormDataWebhookPayload:()=>QKt,MultipartRequest:()=>pUe,MultipartRequestProperty:()=>vpe,MultipartRequestPropertyEncoding:()=>yKt,MultipartSchema:()=>EKt,NullableSchema:()=>NKt,ObjectProperty:()=>jKt,ObjectPropertyConflictInfo:()=>yUe,ObjectSchema:()=>MKt,OctetStreamRequest:()=>fUe,OffsetPagination:()=>dKt,OneOfSchema:()=>LKt,OpenApiIntermediateRepresentation:()=>QKo,OptionalSchema:()=>ZKt,Pagination:()=>uUe,PathPagination:()=>mKt,PathParameter:()=>cUe,PathParameterExample:()=>cKt,PrimitiveSchema:()=>wpe,PrimitiveSchemaValue:()=>FKt,QueryParameter:()=>lUe,QueryParameterExample:()=>nUe,ReferencedSchema:()=>nG,Request:()=>vKt,Response:()=>hUe,RetriesConfiguration:()=>gUe,Schema:()=>Pc,Schemas:()=>zKt,SdkGroupInfo:()=>VKt,StreamingResponseExample:()=>aKt,StringSchema:()=>RKt,SupportedSdkLanguage:()=>eKt,Tags:()=>qKt,TextResponse:()=>Ipe,UnDiscriminatedOneOfSchema:()=>UKt,UnknownSchema:()=>eJt,UriPagination:()=>hKt,Webhook:()=>GKt,WebhookExampleCall:()=>bUe,WebhookHttpMethod:()=>EUe,WebhookPayloadComponent:()=>xKt,WebhookPayloadFormat:()=>_Kt,WebhookSignatureAlgorithm:()=>SKt,WebhookSignatureEncoding:()=>XLe,WebhookSignatureVerification:()=>vUe,WebhookTimestamp:()=>ZLe,WebhookTimestampFormat:()=>HHt,WebsocketChannel:()=>XKt,WebsocketHandshake:()=>WKt,WebsocketMessageExample:()=>JKt,WebsocketMessageOrigin:()=>$Kt,WebsocketMessageSchema:()=>HKt,WebsocketServer:()=>KKt,WebsocketSessionExample:()=>YKt});var YLe=W.objectWithoutOptionalProperties({propertyKey:W.string(),allOfSchemaIds:W.list(tP),conflictingTypeSignatures:W.boolean()});var WHt=W.objectWithoutOptionalProperties({value:W.lazy(()=>Pc),minItems:W.number().optional(),maxItems:W.number().optional()}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(cc).extend(ff);var $Ht=W.enum_(["rsa-sha256","rsa-sha384","rsa-sha512","ecdsa-sha256","ecdsa-sha384","ecdsa-sha512","ed25519"]);var XLe=W.enum_(["base64","hex"]);var HHt=W.enum_(["unix-seconds","unix-millis","iso8601"]);var ZLe=W.objectWithoutOptionalProperties({header:W.string(),format:HHt.optional(),tolerance:W.number().optional()});var KHt=W.objectWithoutOptionalProperties({header:W.string(),asymmetricAlgorithm:$Ht,encoding:XLe.optional(),signaturePrefix:W.string().optional(),jwksUrl:W.string().optional(),keyIdHeader:W.string().optional(),timestamp:ZLe.optional()});var JHt=W.objectWithoutOptionalProperties({default:W.boolean().optional()});var eUe=W.objectWithoutOptionalProperties({}).extend(fn).extend(Uo).extend(pM);var YHt=W.objectWithoutOptionalProperties({key:W.string(),schema:W.lazy(()=>Pc)});var XHt=W.objectWithoutOptionalProperties({cursor:W.string(),nextCursor:W.property("next_cursor",W.string()),results:W.string()});var ZHt=W.objectWithoutOptionalProperties({name:W.string().optional(),language:W.string(),code:W.string(),install:W.string().optional()}).extend(fn);var eKt=W.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var tKt=W.objectWithoutOptionalProperties({name:W.string().optional(),sdk:eKt,code:W.string()}).extend(fn);var rKt=W.union("type",{language:ZHt,sdk:tKt}).transform({transform:e=>{switch(e.type){case"language":return Y9.language(e);case"sdk":return Y9.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var nKt=W.objectWithoutOptionalProperties({results:W.string()});var tUe=W.enum_(["data","protocol"]);var iKt=W.objectWithoutOptionalProperties({discriminantProperty:W.string(),discriminantPropertyNameOverride:W.string().optional(),discriminatorContext:tUe.optional(),commonProperties:W.list(W.lazyObject(()=>YHt)),schemas:W.record(W.string(),W.lazy(()=>Pc))}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(Jw).extend(Uo).extend(cc).extend(ff);var oKt=W.objectWithoutOptionalProperties({default:W.number().optional(),minimum:W.number().optional(),maximum:W.number().optional(),exclusiveMinimum:W.boolean().optional(),exclusiveMaximum:W.boolean().optional(),multipleOf:W.number().optional()});var sKt=W.unknown();var aKt=W.objectWithoutOptionalProperties({sse:W.boolean(),events:W.list(W.lazy(()=>pm))});var uKt=W.union("type",{withStreaming:aKt,withoutStreaming:W.object({value:W.lazy(()=>pm)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return lM.withStreaming(e);case"withoutStreaming":return lM.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var rUe=W.objectWithoutOptionalProperties({name:W.string(),value:W.lazy(()=>pm)});var cKt=W.objectWithoutOptionalProperties({name:W.string(),parameterNameOverride:W.string().optional(),value:W.lazy(()=>pm)});var nUe=W.objectWithoutOptionalProperties({name:W.string(),value:W.lazy(()=>pm)});var lKt=W.objectWithoutOptionalProperties({name:W.string().optional(),pathParameters:W.list(cKt).optional(),queryParameters:W.list(nUe).optional(),headers:W.list(rUe).optional(),request:W.lazy(()=>pm).optional(),response:uKt.optional(),codeSamples:W.list(rKt)}).extend(fn);var iUe=W.union("type",{unknown:W.object({value:sKt}),full:lKt}).transform({transform:e=>{switch(e.type){case"unknown":return cM.unknown(e.value);case"full":return cM.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var rG=W.objectWithoutOptionalProperties({groupName:Ape,methodName:W.string()});var oUe=W.list(W.record(bpe,W.list(W.string())));var Epe=W.objectWithoutOptionalProperties({name:W.string(),schema:W.lazy(()=>Pc),env:W.string().optional(),parameterNameOverride:W.string().optional()}).extend(fn).extend(rs).extend(Uo);var sUe=W.objectWithoutOptionalProperties({name:W.string().optional(),url:W.string().optional(),audiences:W.list(W.string()).optional()});var pKt=W.objectWithoutOptionalProperties({name:W.string().optional(),description:W.string().optional(),example:W.lazy(()=>pm)});var fKt=W.objectWithoutOptionalProperties({schema:W.lazy(()=>Pc).optional(),examples:W.list(pKt).optional()}).extend(fn).extend(Eu).extend(Uo);var aUe=W.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var dKt=W.objectWithoutOptionalProperties({offset:W.string(),results:W.string(),step:W.string().optional(),hasNextPage:W.string().optional()});var mKt=W.objectWithoutOptionalProperties({nextPath:W.string(),results:W.string()});var hKt=W.objectWithoutOptionalProperties({nextUri:W.string(),results:W.string()});var uUe=W.union("type",{cursor:XHt,offset:dKt,custom:nKt,uri:hKt,path:mKt}).transform({transform:e=>{switch(e.type){case"cursor":return xI.cursor(e);case"offset":return xI.offset(e);case"custom":return xI.custom(e);case"uri":return xI.uri(e);case"path":return xI.path(e);default:return e}},untransform:({_visit:e,...t})=>t});var cUe=W.objectWithoutOptionalProperties({name:W.string(),schema:W.lazy(()=>Pc),variableReference:W.string().optional(),parameterNameOverride:W.string().optional()}).extend(fn).extend(rs).extend(Uo);var lUe=W.objectWithoutOptionalProperties({name:W.string(),schema:W.lazy(()=>Pc),parameterNameOverride:W.string().optional(),explode:W.boolean().optional()}).extend(fn).extend(rs).extend(Uo);var gKt=W.objectWithoutOptionalProperties({schema:W.lazy(()=>Pc),contentType:W.string().optional(),additionalProperties:W.boolean()}).extend(fn).extend(Uo);var AKt=W.objectWithoutOptionalProperties({schema:W.lazy(()=>Pc),contentType:W.string().optional(),additionalProperties:W.boolean()}).extend(fn).extend(Uo);var yKt=W.enum_(["json","form"]);var bKt=W.objectWithoutOptionalProperties({isOptional:W.boolean(),isArray:W.boolean()}).extend(fn);var EKt=W.union("type",{file:bKt,json:W.object({value:W.lazy(()=>Pc)})}).transform({transform:e=>{switch(e.type){case"file":return X9.file(e);case"json":return X9.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var vpe=W.objectWithoutOptionalProperties({key:W.string(),schema:EKt,contentType:W.string().optional(),exploded:W.boolean().optional(),encoding:yKt.optional()}).extend(fn);var pUe=W.objectWithoutOptionalProperties({name:W.string().optional(),properties:W.list(vpe)}).extend(fn).extend(Uo);var fUe=W.objectWithoutOptionalProperties({contentType:W.string().optional()}).extend(fn).extend(Uo);var vKt=W.union("type",{octetStream:fUe,multipart:pUe,json:AKt,formUrlEncoded:gKt}).transform({transform:e=>{switch(e.type){case"octetStream":return n8.octetStream(e);case"multipart":return n8.multipart(e);case"json":return n8.json(e);case"formUrlEncoded":return n8.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var dUe=W.objectWithoutOptionalProperties({}).extend(fn).extend(Uo).extend(pM);var mUe=W.objectWithoutOptionalProperties({schema:W.lazy(()=>Pc),responseProperty:W.string().optional(),terminator:W.string().optional()}).extend(fn).extend(Uo).extend(pM);var Ipe=W.objectWithoutOptionalProperties({}).extend(fn).extend(Uo).extend(pM);var hUe=W.union("type",{file:dUe,json:mUe,text:Ipe,bytes:eUe,streamingSse:mUe,streamingText:Ipe,streamingJson:mUe}).transform({transform:e=>{switch(e.type){case"file":return m_.file(e);case"json":return m_.json(e);case"text":return m_.text(e);case"bytes":return m_.bytes(e);case"streamingSse":return m_.streamingSse(e);case"streamingText":return m_.streamingText(e);case"streamingJson":return m_.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var gUe=W.union("type",{disabled:W.object({value:W.boolean().optional()})}).transform({transform:e=>e.type==="disabled"?jmt.disabled(e.value):e,untransform:({_visit:e,...t})=>t});var IKt=W.objectWithoutOptionalProperties({authed:W.boolean(),security:oUe.optional(),internal:W.boolean().optional(),idempotent:W.boolean().optional(),method:aUe,audiences:W.list(W.string()),path:W.string(),summary:W.string().optional(),operationId:W.string().optional(),tags:W.list(rP),pathParameters:W.list(cUe),queryParameters:W.list(lUe),headers:W.list(Epe),sdkName:rG.optional(),generatedRequestName:W.string(),requestNameOverride:W.string().optional(),request:vKt.optional(),response:hUe.optional(),errors:W.record(eG,fKt),servers:W.list(sUe),examples:W.list(iUe),pagination:uUe.optional(),retries:gUe.optional()}).extend(fn).extend(rs).extend(Uo).extend(Ga);var wKt=W.objectWithoutOptionalProperties({header:W.string(),name:W.string().optional(),optional:W.boolean().optional(),env:W.string().optional(),schema:W.lazy(()=>Pc).optional()});var CKt=W.list(W.record(bpe,W.list(W.string())));var xKt=W.enum_(["body","timestamp","notification-url","message-id"]);var _Kt=W.objectWithoutOptionalProperties({components:W.list(xKt),delimiter:W.string().optional()});var SKt=W.enum_(["sha256","sha1","sha384","sha512"]);var BKt=W.objectWithoutOptionalProperties({header:W.string(),algorithm:SKt.optional(),encoding:XLe.optional(),signaturePrefix:W.string().optional(),payloadFormat:_Kt.optional(),timestamp:ZLe.optional()});var OKt=W.objectWithoutOptionalProperties({header:W.string(),name:W.string().optional(),env:W.string().optional(),schema:W.lazy(()=>Pc).optional()});var PKt=W.objectWithoutOptionalProperties({default:W.number().optional(),minimum:W.number().optional(),maximum:W.number().optional(),exclusiveMinimum:W.boolean().optional(),exclusiveMaximum:W.boolean().optional(),multipleOf:W.number().optional()});var TKt=W.union("type",{boolean:W.object({value:W.boolean()}),string:W.object({value:W.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return xg.boolean(e.value);case"string":return xg.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var AUe=W.objectWithoutOptionalProperties({value:TKt}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(cc);var DKt=W.objectWithoutOptionalProperties({default:W.number().optional()});var RKt=W.objectWithoutOptionalProperties({default:W.string().optional(),pattern:W.string().optional(),format:W.string().optional(),minLength:W.number().optional(),maxLength:W.number().optional()});var FKt=W.union("type",{int:PKt,int64:DKt,uint:W.object({}),uint64:W.object({}),float:W.object({}),double:oKt,string:RKt,datetime:W.object({}),datetimeRfc2822:W.object({}),date:W.object({}),base64:W.object({}),boolean:JHt}).transform({transform:e=>{switch(e.type){case"int":return Uc.int(e);case"int64":return Uc.int64(e);case"uint":return Uc.uint();case"uint64":return Uc.uint64();case"float":return Uc.float();case"double":return Uc.double(e);case"string":return Uc.string(e);case"datetime":return Uc.datetime();case"datetimeRfc2822":return Uc.datetimeRfc2822();case"date":return Uc.date();case"base64":return Uc.base64();case"boolean":return Uc.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var wpe=W.objectWithoutOptionalProperties({schema:FKt}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(cc);var kKt=W.objectWithoutOptionalProperties({key:wpe,value:W.lazy(()=>Pc),minProperties:W.number().optional(),maxProperties:W.number().optional()}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(Jw).extend(cc).extend(ff);var QKt=W.objectWithoutOptionalProperties({name:W.string().optional(),properties:W.list(vpe)}).extend(fn).extend(Uo);var NKt=W.objectWithoutOptionalProperties({value:W.lazy(()=>Pc)}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(cc).extend(ff);var yUe=W.objectWithoutOptionalProperties({differentSchema:W.boolean()});var jKt=W.objectWithoutOptionalProperties({key:W.string(),schema:W.lazy(()=>Pc),readonly:W.boolean().optional(),writeonly:W.boolean().optional(),conflict:W.record(tP,yUe),generatedName:W.string(),nameOverride:W.string().optional(),audiences:W.list(W.string())}).extend(rs);var nG=W.objectWithoutOptionalProperties({schema:tP}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(Uo).extend(cc);var MKt=W.objectWithoutOptionalProperties({allOf:W.list(nG),properties:W.list(W.lazyObject(()=>jKt)),allOfPropertyConflicts:W.list(YLe),additionalProperties:W.boolean(),minProperties:W.number().optional(),maxProperties:W.number().optional()}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(Jw).extend(Uo).extend(cc).extend(ff);var LKt=W.union("type",{discriminated:W.lazyObject(()=>iKt),undiscriminated:W.lazyObject(()=>UKt)}).transform({transform:e=>{switch(e.type){case"discriminated":return Z9.discriminated(e);case"undiscriminated":return Z9.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var zKt=W.objectWithoutOptionalProperties({rootSchemas:W.record(tP,W.lazy(()=>Pc)),namespacedSchemas:W.record(OHt,W.record(tP,W.lazy(()=>Pc)))});var VKt=W.objectWithoutOptionalProperties({summary:W.string().optional(),description:W.string().optional()});var qKt=W.objectWithoutOptionalProperties({tagsById:W.record(rP,LHt),orderedTagIds:W.list(rP).optional()});var bUe=W.objectWithoutOptionalProperties({name:W.string().optional(),payload:W.lazy(()=>pm)}).extend(fn);var EUe=W.enum_(["GET","POST"]);var vUe=W.union("type",{hmac:BKt,asymmetric:KHt}).transform({transform:e=>{switch(e.type){case"hmac":return g_e.hmac(e);case"asymmetric":return g_e.asymmetric(e);default:return e}},untransform:({_visit:e,...t})=>t});var GKt=W.objectWithoutOptionalProperties({audiences:W.list(W.string()),sdkName:rG.optional(),method:EUe,summary:W.string().optional(),operationId:W.string(),tags:W.list(rP),headers:W.list(Epe),generatedPayloadName:W.string(),payload:W.lazy(()=>Pc),multipartFormData:QKt.optional(),response:hUe.optional(),signatureVerification:vUe.optional(),examples:W.list(bUe)}).extend(fn).extend(Uo).extend(Ga);var WKt=W.objectWithoutOptionalProperties({queryParameters:W.list(lUe),headers:W.list(Epe),pathParameters:W.list(cUe)});var $Kt=W.enum_(["client","server"]);var HKt=W.objectWithoutOptionalProperties({name:W.string(),origin:$Kt,body:W.lazy(()=>Pc),methodName:W.string().optional()});var KKt=W.objectWithoutOptionalProperties({name:W.string(),url:W.string()});var JKt=W.objectWithoutOptionalProperties({messageType:W.string(),payload:W.lazy(()=>pm)}).extend(fn);var YKt=W.objectWithoutOptionalProperties({name:W.string().optional(),queryParameters:W.list(nUe).optional(),headers:W.list(rUe).optional(),messages:W.list(JKt)}).extend(fn);var XKt=W.objectWithoutOptionalProperties({audiences:W.list(W.string()),path:W.string(),groupName:Ape,summary:W.string().optional(),connectMethodName:W.string().optional(),handshake:WKt,messages:W.list(HKt),servers:W.list(KKt),examples:W.list(YKt)}).extend(fn).extend(Uo);var QKo=W.objectWithoutOptionalProperties({apiVersion:W.unknown().optional(),title:W.string().optional(),description:W.string().optional(),basePath:W.string().optional(),servers:W.list(Vmt),websocketServers:W.list(Vmt),groups:W.record(W.string(),VKt),tags:qKt,hasEndpointsMarkedInternal:W.boolean(),endpoints:W.list(IKt),webhooks:W.list(GKt),channels:W.record(W.string(),XKt),groupedSchemas:zKt,variables:W.record(W.string(),wpe),nonRequestReferencedSchemas:W.set(tP),securitySchemes:W.record(bpe,jHt),security:CKt.optional(),globalHeaders:W.list(wKt).optional(),idempotencyHeaders:W.list(OKt).optional()});var ZKt=W.objectWithoutOptionalProperties({value:W.lazy(()=>Pc)}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(cc).extend(ff);var eJt=W.objectWithoutOptionalProperties({}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(cc);var Pc=W.union("type",{primitive:wpe,object:W.lazyObject(()=>MKt),array:W.lazyObject(()=>WHt),map:W.lazyObject(()=>kKt),optional:W.lazyObject(()=>ZKt),enum:HLe,reference:nG,literal:AUe,oneOf:W.object({value:W.lazy(()=>LKt)}),nullable:W.lazyObject(()=>NKt),unknown:eJt}).transform({transform:e=>{switch(e.type){case"primitive":return la.primitive(e);case"object":return la.object(e);case"array":return la.array(e);case"map":return la.map(e);case"optional":return la.optional(e);case"enum":return la.enum(e);case"reference":return la.reference(e);case"literal":return la.literal(e);case"oneOf":return la.oneOf(e.value);case"nullable":return la.nullable(e);case"unknown":return la.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var UKt=W.objectWithoutOptionalProperties({schemas:W.list(W.lazy(()=>Pc))}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(Jw).extend(Uo).extend(cc).extend(ff);var cKn={};X(cKn,{ArraySchemaWithExample:()=>tJt,Base64WithExample:()=>rJt,BooleanWithExample:()=>nJt,CommonPropertyWithExample:()=>iJt,DateWithExample:()=>oJt,DatetimeWithExample:()=>qmt,DiscriminatedOneOfSchemaWithExample:()=>sJt,DoubleWithExample:()=>aJt,EndpointWithExample:()=>NKo,EnumSchemaWithExample:()=>hJt,FloatWithExample:()=>gJt,HeaderWithExample:()=>Cpe,HttpErrorWithExample:()=>uJt,Int64WithExample:()=>AJt,IntWithExample:()=>yJt,JsonRequestWithExample:()=>lJt,JsonResponseWithExample:()=>wUe,MapSchemaWithExample:()=>wJt,MultipartFormDataWebhookPayloadWithExample:()=>CJt,NamedFullExample:()=>KD,NullableSchemaWithExample:()=>xJt,ObjectPropertyWithExample:()=>_Jt,ObjectSchemaWithExample:()=>SJt,OneOfSchemaWithExample:()=>BJt,OptionalSchemaWithExample:()=>PJt,ParseFormUrlEncodedRequest:()=>pJt,ParseMultipartRequest:()=>fJt,ParseOctetStreamRequest:()=>dJt,PathParameterWithExample:()=>cJt,PrimitiveSchemaValueWithExample:()=>IJt,PrimitiveSchemaWithExample:()=>xUe,QueryParameterWithExample:()=>IUe,RequestWithExample:()=>mJt,ResponseWithExample:()=>CUe,SchemaWithExample:()=>df,StringSchemaWithExample:()=>bJt,Uint64WithExample:()=>EJt,UintWithExample:()=>vJt,UnDiscriminatedOneOfSchemaWithExample:()=>OJt,UnknownSchemaWithExample:()=>TJt,WebhookWithExample:()=>jKo,WebsocketHandshakeWithExample:()=>MKo});var tJt=W.objectWithoutOptionalProperties({value:W.lazy(()=>df),minItems:W.number().optional(),maxItems:W.number().optional(),example:W.list(W.unknown()).optional()}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(cc).extend(ff);var rJt=W.objectWithoutOptionalProperties({example:W.string().optional()});var nJt=W.objectWithoutOptionalProperties({default:W.boolean().optional(),example:W.boolean().optional()});var iJt=W.objectWithoutOptionalProperties({key:W.string(),schema:W.lazy(()=>df)});var qmt=W.objectWithoutOptionalProperties({example:W.string().optional()});var oJt=W.objectWithoutOptionalProperties({example:W.string().optional()});var sJt=W.objectWithoutOptionalProperties({discriminantProperty:W.string(),discriminantPropertyNameOverride:W.string().optional(),discriminatorContext:tUe.optional(),commonProperties:W.list(W.lazyObject(()=>iJt)),schemas:W.record(W.string(),W.lazy(()=>df))}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(Jw).extend(Uo).extend(cc).extend(ff);var aJt=W.objectWithoutOptionalProperties({default:W.number().optional(),minimum:W.number().optional(),maximum:W.number().optional(),exclusiveMinimum:W.boolean().optional(),exclusiveMaximum:W.boolean().optional(),multipleOf:W.number().optional(),example:W.number().optional()});var Cpe=W.objectWithoutOptionalProperties({name:W.string(),schema:W.lazy(()=>df),env:W.string().optional(),parameterNameOverride:W.string().optional()}).extend(fn).extend(rs).extend(Uo);var KD=W.objectWithoutOptionalProperties({name:W.string().optional(),value:W.unknown()}).extend(fn);var uJt=W.objectWithoutOptionalProperties({statusCode:eG,schema:W.lazy(()=>df),fullExamples:W.list(KD).optional()}).extend(fn).extend(Eu).extend(Uo);var cJt=W.objectWithoutOptionalProperties({name:W.string(),schema:W.lazy(()=>df),variableReference:W.string().optional(),parameterNameOverride:W.string().optional(),explode:W.boolean().optional()}).extend(fn).extend(rs).extend(Uo);var IUe=W.objectWithoutOptionalProperties({name:W.string(),schema:W.lazy(()=>df),parameterNameOverride:W.string().optional(),explode:W.boolean().optional()}).extend(fn).extend(rs).extend(Uo);var lJt=W.objectWithoutOptionalProperties({schema:W.lazy(()=>df),contentType:W.string().optional(),fullExamples:W.list(KD).optional(),additionalProperties:W.boolean()}).extend(fn).extend(Uo).extend(tG);var pJt=W.objectWithoutOptionalProperties({schema:W.lazy(()=>df),contentType:W.string().optional(),fullExamples:W.list(KD).optional(),additionalProperties:W.boolean()}).extend(fn).extend(Uo).extend(tG);var fJt=W.objectWithoutOptionalProperties({fullExamples:W.list(KD).optional()}).extend(pUe).extend(tG);var dJt=W.objectWithoutOptionalProperties({}).extend(fUe).extend(tG);var mJt=W.union("type",{octetStream:dJt,multipart:fJt,json:lJt,formUrlEncoded:pJt}).transform({transform:e=>{switch(e.type){case"octetStream":return eP.octetStream(e);case"multipart":return eP.multipart(e);case"json":return eP.json(e);case"formUrlEncoded":return eP.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var wUe=W.objectWithoutOptionalProperties({schema:W.lazy(()=>df),responseProperty:W.string().optional(),terminator:W.string().optional(),fullExamples:W.list(KD).optional()}).extend(fn).extend(Uo).extend(pM);var CUe=W.union("type",{file:dUe,json:wUe,text:Ipe,bytes:eUe,streamingSse:wUe,streamingText:Ipe,streamingJson:wUe}).transform({transform:e=>{switch(e.type){case"file":return Ch.file(e);case"json":return Ch.json(e);case"text":return Ch.text(e);case"bytes":return Ch.bytes(e);case"streamingSse":return Ch.streamingSse(e);case"streamingText":return Ch.streamingText(e);case"streamingJson":return Ch.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var NKo=W.objectWithoutOptionalProperties({authed:W.boolean(),security:oUe.optional(),internal:W.boolean().optional(),idempotent:W.boolean().optional(),method:aUe,audiences:W.list(W.string()),path:W.string(),summary:W.string().optional(),operationId:W.string().optional(),tags:W.list(rP),pathParameters:W.list(cJt),queryParameters:W.list(IUe),headers:W.list(Cpe),sdkName:rG.optional(),generatedRequestName:W.string(),requestNameOverride:W.string().optional(),request:mJt.optional(),response:CUe.optional(),errors:W.record(eG,uJt),servers:W.list(sUe),examples:W.list(iUe),pagination:uUe.optional(),retries:gUe.optional()}).extend(fn).extend(rs).extend(Uo).extend(Ga);var hJt=W.objectWithoutOptionalProperties({default:ype.optional(),values:W.list(ype),example:W.string().optional()}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(Uo).extend(cc).extend(ff);var gJt=W.objectWithoutOptionalProperties({example:W.number().optional()});var AJt=W.objectWithoutOptionalProperties({default:W.number().optional(),example:W.number().optional()});var yJt=W.objectWithoutOptionalProperties({default:W.number().optional(),minimum:W.number().optional(),maximum:W.number().optional(),exclusiveMinimum:W.boolean().optional(),exclusiveMaximum:W.boolean().optional(),multipleOf:W.number().optional(),example:W.number().optional()});var bJt=W.objectWithoutOptionalProperties({default:W.string().optional(),pattern:W.string().optional(),format:W.string().optional(),minLength:W.number().optional(),maxLength:W.number().optional(),example:W.string().optional()});var EJt=W.objectWithoutOptionalProperties({default:W.number().optional(),example:W.number().optional()});var vJt=W.objectWithoutOptionalProperties({default:W.number().optional(),example:W.number().optional()});var IJt=W.union("type",{int:yJt,int64:AJt,uint:vJt,uint64:EJt,float:gJt,double:aJt,string:bJt,datetime:qmt,datetimeRfc2822:qmt,date:oJt,base64:rJt,boolean:nJt}).transform({transform:e=>{switch(e.type){case"int":return Ii.int(e);case"int64":return Ii.int64(e);case"uint":return Ii.uint(e);case"uint64":return Ii.uint64(e);case"float":return Ii.float(e);case"double":return Ii.double(e);case"string":return Ii.string(e);case"datetime":return Ii.datetime(e);case"datetimeRfc2822":return Ii.datetimeRfc2822(e);case"date":return Ii.date(e);case"base64":return Ii.base64(e);case"boolean":return Ii.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var xUe=W.objectWithoutOptionalProperties({schema:IJt}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(cc);var wJt=W.objectWithoutOptionalProperties({key:xUe,value:W.lazy(()=>df),minProperties:W.number().optional(),maxProperties:W.number().optional(),example:W.unknown().optional()}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(Jw).extend(cc).extend(ff);var CJt=W.objectWithoutOptionalProperties({name:W.string().optional(),properties:W.list(vpe)}).extend(fn).extend(Uo);var xJt=W.objectWithoutOptionalProperties({value:W.lazy(()=>df)}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(cc).extend(ff);var _Jt=W.objectWithoutOptionalProperties({key:W.string(),schema:W.lazy(()=>df),readonly:W.boolean().optional(),writeonly:W.boolean().optional(),audiences:W.list(W.string()),conflict:W.record(tP,yUe),nameOverride:W.string().optional(),generatedName:W.string()}).extend(rs);var SJt=W.objectWithoutOptionalProperties({allOf:W.list(nG),properties:W.list(W.lazyObject(()=>_Jt)),allOfPropertyConflicts:W.list(YLe),fullExamples:W.list(KD).optional(),additionalProperties:W.boolean(),minProperties:W.number().optional(),maxProperties:W.number().optional()}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(Jw).extend(Uo).extend(cc).extend(ff);var BJt=W.union("type",{discriminated:W.lazyObject(()=>sJt),undiscriminated:W.lazyObject(()=>OJt)}).transform({transform:e=>{switch(e.type){case"discriminated":return iQ.discriminated(e);case"undiscriminated":return iQ.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var PJt=W.objectWithoutOptionalProperties({value:W.lazy(()=>df)}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(cc).extend(ff);var TJt=W.objectWithoutOptionalProperties({example:W.unknown()}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(cc);var df=W.union("type",{primitive:xUe,object:W.lazyObject(()=>SJt),array:W.lazyObject(()=>tJt),map:W.lazyObject(()=>wJt),optional:W.lazyObject(()=>PJt),enum:hJt,reference:nG,literal:AUe,oneOf:W.object({value:W.lazy(()=>BJt)}),nullable:W.lazyObject(()=>xJt),unknown:TJt}).transform({transform:e=>{switch(e.type){case"primitive":return kr.primitive(e);case"object":return kr.object(e);case"array":return kr.array(e);case"map":return kr.map(e);case"optional":return kr.optional(e);case"enum":return kr.enum(e);case"reference":return kr.reference(e);case"literal":return kr.literal(e);case"oneOf":return kr.oneOf(e.value);case"nullable":return kr.nullable(e);case"unknown":return kr.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var OJt=W.objectWithoutOptionalProperties({schemas:W.list(W.lazy(()=>df))}).extend(uc).extend(Ga).extend(Eu).extend(fn).extend(rs).extend(Jw).extend(Uo).extend(cc).extend(ff);var jKo=W.objectWithoutOptionalProperties({audiences:W.list(W.string()),sdkName:rG.optional(),method:EUe,summary:W.string().optional(),operationId:W.string(),tags:W.list(rP),headers:W.list(Cpe),generatedPayloadName:W.string(),payload:W.lazy(()=>df),multipartFormData:CJt.optional(),response:CUe.optional(),signatureVerification:vUe.optional(),examples:W.list(bUe)}).extend(fn).extend(Uo).extend(Ga);var MKo=W.objectWithoutOptionalProperties({queryParameters:W.list(IUe),headers:W.list(Cpe)});var LKo=/^(\d+)/,_Ue=/^[a-zA-Z][a-zA-Z0-9_]*$/,UKo={"<":"LESS_THAN",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL_TO","<=":"LESS_THAN_OR_EQUAL_TO","!=":"NOT_EQUALS","=":"EQUAL_TO","==":"EQUAL_TO","*":"ALL","":"EMPTY",'""':"EMPTY_STRING","-":"HYPHEN","|":"PIPE",".":"DOT","/":"SLASH"};function y_e(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],n=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let s=Math.floor(e/10),a=e%10;return a===0?n[s]:`${n[s]}_${t[a]}`}if(e<1e3){let s=Math.floor(e/100),a=e%100;return a===0?`${t[s]}_hundred`:`${t[s]}_hundred_${y_e(a)}`}let i=Math.floor(e/1e3),o=e%1e3;return o===0?`${t[i]}_thousand`:`${t[i]}_thousand_${y_e(o)}`}Ci();function Gmt(e){let t=e.match(LKo);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let o=y_e(i);return n.length>0?`${o}_${n}`:o}}}function SUe(e){let t=Gmt(e),r=UKo[e];return t!=null?Xu(zn(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":Xu(zn(e)))}Ci();function JD(e,t){return e.type==="primitive"&&t.type==="primitive"?zKo(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?gkc(e.values,t.values):e.type==="array"&&t.type==="array"?JD(e.value,t.value):e.type==="unknown"&&t.type==="unknown"?!0:e.type==="reference"&&t.type==="reference"?e.schema===t.schema:e.type==="optional"&&t.type==="optional"?JD(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?Akc(e.value,t.value):e.type==="object"&&t.type==="object"?ykc(e,t):e.type==="map"&&t.type==="map"?zKo(e.key.schema,t.key.schema)&&JD(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function zKo(e,t){return e.type===t.type}function gkc(e,t){let r=new Set(e.map(i=>i.value)),n=new Set(t.map(i=>i.value));return Lb(r,n)}function Akc(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,n])=>{let i=t.schemas[r];return i==null?!1:JD(n,i)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,n)=>{let i=t.schemas[n];return i==null?!1:JD(r,i)}):!1}function ykc(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(n=>[n.key,n.schema]));return Object.entries(t.properties).every(([n,i])=>{let o=r[n];return o==null?!1:JD(o,i.schema)})}St();function gy(e){switch(e){case Gw.Deprecated:return"deprecated";case Gw.Beta:return"pre-release";case Gw.GenerallyAvailable:return"generally-available";default:return}}St();function Wmt(e){if(e.type==="protobuf")return{proto:{type:e.typeName}};Be(e.type)}St();St();yg();Ci();function VKo(e){let t=e.match(/^(_+)/),r=e.match(/(_+)$/),n=t?.[1]??"",i=r?.[1]??"";if(n===""&&i==="")return zn(e);if(n.length+i.length>=e.length)return e;let o=e.slice(n.length,e.length-i.length||void 0);return`${n}${zn(o)}${i}`}function bkc(e){let t=e.find(n=>typeof n=="object"&&n.type==="namespace"),r=e.filter(n=>typeof n=="string"||n.type!=="namespace");return t?[t,...r]:r}function qKo(e){let t=e?bkc(e):void 0;if(t==null||t.length===0)return t_e;let r=[];for(let[n,i]of t.entries())typeof i=="string"?r.push(VKo(i)):typeof i=="object"?i.type==="namespace"?n<t.length-1?r.push(VKo(i.name)):r.push(i.name,t_e):Be(i.type):Be(i);return r.join("/")}function sne(e){return Bs.of(`${qKo(e)}.yml`)}function lKn({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?t_e:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,qKo(r))}function GKo({sdkName:e,namespaceOverride:t}){return Bs.of(`${lKn({sdkName:e,namespaceOverride:t})}.yml`)}function WKo({location:e,namespaceOverride:t}){return t!=null?Ub(Bs.of(t),e):e}function $Ko(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"unknown":return DJt({namespace:e.namespace,groupName:e.groupName});case"oneOf":return DJt({namespace:e.value.namespace,groupName:e.value.groupName});default:Be(e)}}function DJt({namespace:e,groupName:t}){return e!=null&&t!=null?sne([{type:"namespace",name:e},...t]):e!=null?sne([{type:"namespace",name:e}]):sne(t)}St();function ane(e){switch(e.type){case"object":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"primitive":case"unknown":return e.groupName??void 0;case"oneOf":return e.value.groupName??void 0;default:Be(e)}}function Jl(e){return typeof e=="string"?e:e.type}function BUe(e){if(typeof e!="string")return e.docs}function $mt(e){if(typeof e!="string")return e.default}function pKn(e){if(typeof e!="string")return e.validation}function OUe(e){let t=e.match(/^optional<\s*nullable<\s*(.+)\s*>\s*>$/);if(t!=null&&t[1]!=null)return t[1].trim();let r=e.match(/^nullable<\s*(.+)\s*>$/);return r!=null&&r[1]!=null?r[1].trim():e}function KKo(e){let t=Jl(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?HKo(e):{...e,type:HKo(e.type)}}function HKo(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function b_e(e){return Jl(e).startsWith("optional<")?e:typeof e=="string"?JKo(e):{...e,type:JKo(e.type)}}function JKo(e){return e.startsWith("optional<")?e:`optional<${e}>`}var Ekc=-2147483648,vkc=2147483647,Ikc=-17976931348623157e292,wkc=17976931348623157e292;function Ja({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i,declarationDepth:o,variant:s}){switch(n.shouldMarkSchemaAsReferenced()&&n.markSchemaAsReferenced(e,i),e.type){case"primitive":return RJt(e);case"array":return mKn({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"map":return hKn({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"reference":return dKn({schema:e,fileContainingReference:t,context:n,namespace:i,variant:s});case"unknown":return AKn();case"optional":return FJt({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"nullable":return gKn({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"enum":return Dkc({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:o});case"literal":return e.value,yKn(e);case"object":return Rkc({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"oneOf":return Fkc({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});default:Be(e)}}function RJt(e){switch(e.schema.type){case"string":return _kc({description:e.description,schema:e.schema});case"int":return Skc({description:e.description,schema:e.schema});case"float":return Bkc({description:e.description,schema:e.schema});case"double":return Okc({description:e.description,schema:e.schema});case"boolean":return Ckc({description:e.description,schema:e.schema});case"int64":return xkc({description:e.description,schema:e.schema})}let t=e.schema._visit({int:()=>"integer",int64:()=>"long",uint:()=>"uint",uint64:()=>"uint64",float:()=>"double",double:()=>"double",string:()=>"string",datetime:()=>"datetime",datetimeRfc2822:()=>"datetime-rfc-2822",date:()=>"date",base64:()=>"base64",boolean:()=>"boolean",_other:()=>"unknown"});return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:gy(e.availability)}:{}}}function Ckc({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function xkc({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function _kc({description:e,schema:t}){let r="string",n=Pkc(t);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function Skc({description:e,schema:t}){let r="integer",n=YKo(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function Bkc({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function Okc({description:e,schema:t}){let r="double",n=YKo(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function Pkc(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,o=Tkc(t);if(!(o==null&&r==null&&n==null&&i==null))return{format:o,pattern:r,minLength:n,maxLength:i}}function Tkc(e){switch(e){case"date":case"date-time":case"password":case"byte":case"bytes":case"binary":case"email":case"uuid":case"uri":case"hostname":case"ipv4":case"ipv6":return e;default:return}}function YKo(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:o,exclusiveMaximum:s}=e;if(r=fKn(r,t),n=fKn(n,t),i=fKn(i,t),!(r==null&&n==null&&o==null&&s==null&&i==null))return{min:r,max:n,exclusiveMin:o,exclusiveMax:s,multipleOf:i}}function fKn(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[Ekc,vkc]:[Ikc,wkc];return e<r||e>n?void 0:e}function dKn({schema:e,fileContainingReference:t,context:r,variant:n}){let i=r.getSchema(e.schema,e.namespace);if(i==null)return"unknown";let o=kkc(i)??e.schema,s=r.options.respectReadonlySchemas&&n!=null?r.getSchemaFinalName(o,n):o,a=ane(i),u=Qkc(i),l=kJt({context:r,fileContainingReference:t,declarationFile:DJt({namespace:e.namespace,groupName:a}),type:s});return i.type==="nullable"&&(l=r.options.wrapReferencesToNullableInOptional?`optional<${l}>`:`nullable<${l}>`),i.type==="optional"&&!l.startsWith("optional<")&&(l=`optional<${l}>`),e.description==null&&u==null?l:{type:l,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:gy(e.availability)}:{}}}function mKn({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=Ja({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=`list<${Jl(a)}>`;return e.description==null&&e.title==null?u:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:gy(e.availability)}:{},type:u}}function hKn({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=RJt(e.key),u=Ja({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=e.encoding!=null?Wmt(e.encoding):void 0,l=`map<${Jl(a)}, ${Jl(u)}>`;if(e.description==null&&c==null&&e.title==null)return l;let p={type:l};return e.description!=null&&(p.docs=e.description),e.encoding!=null&&(p.encoding=c),e.availability!=null&&(p.availability=gy(e.availability)),p}function gKn({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){if(!n.options.respectNullableSchemas)return FJt({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});let a=Ja({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=Jl(a),c=BUe(a),l=$mt(a),p=pKn(a),d=KKo(u);if(n.options.wrapReferencesToNullableInOptional&&(d=b_e(d)),e.availability==null&&e.description==null&&c==null&&l==null&&p==null&&e.title==null)return d;let f=typeof d=="string"?{type:d}:d;return(e.description!=null||c!=null)&&(f.docs=e.description??c),l!=null&&(f.default=l),p!=null&&(f.validation=p),e.availability!=null&&(f.availability=gy(e.availability)),f}function FJt({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=Ja({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=Jl(a),c=BUe(a),l=$mt(a),p=pKn(a),d=b_e(u);if(e.availability==null&&e.description==null&&c==null&&l==null&&p==null&&e.title==null)return d;let f=typeof d=="string"?{type:d}:d;return(e.description!=null||c!=null)&&(f.docs=e.description??c),l!=null&&(f.default=l),p!=null&&(f.validation=p),e.availability!=null&&(f.availability=gy(e.availability)),f}function AKn(){return"unknown"}function yKn(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Be(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:gy(e.availability)}:{}}}function Dkc({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let o=Hmt(e,i),s=e.nameOverride??e.generatedName;n.builder.addType(r,{name:s,schema:o.schema});let a=kJt({type:s,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return a;let u={type:a};return e.description!=null&&(u.docs=e.description),e.default!=null&&(u.default=e.default.value),e.availability!=null&&(u.availability=gy(e.availability)),u}function Rkc({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=E_e({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=e.nameOverride??e.generatedName;n.builder.addType(r,{name:u,schema:a.schema});let c=kJt({type:u,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?c:{type:c,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:gy(e.availability)}:{}}}function Fkc({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=bKn({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=e.nameOverride??e.generatedName;n.builder.addType(r,{name:u,schema:a.schema});let c=kJt({type:u,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?c:{...e.title!=null?{"display-name":e.title}:{},type:c,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:gy(e.availability)}:{}}}function kJt({type:e,fileContainingReference:t,declarationFile:r,context:n}){if(r===t)return e;let i=n.builder.addImport({file:t,fileToImport:r});return i!=null?`${i}.${e}`:e}function kkc(e){return la._visit(e,{primitive:t=>t.nameOverride??t.generatedName,object:t=>t.nameOverride??t.generatedName,array:t=>t.nameOverride??t.generatedName,map:t=>t.nameOverride??t.generatedName,enum:t=>t.nameOverride??t.generatedName,reference:t=>t.nameOverride??t.generatedName,literal:t=>t.nameOverride??t.generatedName,oneOf:t=>t.nameOverride??t.generatedName,optional:t=>t.nameOverride??t.generatedName,nullable:t=>t.nameOverride??t.generatedName,unknown:t=>t.nameOverride??t.generatedName,_other:()=>{}})}function Qkc(e){return la._visit(e,{primitive:t=>t.title,object:t=>t.title,array:t=>t.title,map:t=>t.title,enum:t=>t.title,reference:t=>t.title,literal:t=>t.title,oneOf:t=>t.title,optional:t=>t.title,nullable:t=>t.title,unknown:t=>{},_other:()=>{}})}St();function une(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Be(e)}}function ZKo({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s;switch(e.type){case"primitive":s=Mkc(e);break;case"array":s=Nkc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":s=jkc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":s=Lkc({schema:e,context:t,declarationFile:r,namespace:n,variant:o});break;case"unknown":s=zkc(e.nameOverride,e.generatedName,e.description);break;case"optional":s=tJo({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":s=Ukc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":s=Hmt(e,i);break;case"literal":s=Vkc(e,e.nameOverride,e.generatedName);break;case"object":s=E_e({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o});break;case"oneOf":s=bKn({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o});break;default:Be(e)}return s}function E_e({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,skipReadonlyProperties:o,variant:s}){let a=o===!0||s==="write",u=!1,c={},l=new Set;for(let g of e.properties){if(g.readonly&&(u=!0),a&&g.readonly)continue;if(Object.keys(g.conflict).length>0){if(Object.entries(g.conflict).every(([x,C])=>!C.differentSchema))continue;Object.entries(g.conflict).forEach(([x])=>{EKn({property:g.key,schemaId:x,context:t,namespace:n}).forEach(_=>{l.add(_)})})}let A=Ja({schema:g.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s}),b=g.audiences,v=g.nameOverride,E=gy(g.availability),I=$kc(g);c[g.key]=Wkc({typeReference:A,audiences:b,name:v,availability:E,propertyAccess:I})}let p=new Set;for(let g of e.allOfPropertyConflicts)g.allOfSchemaIds.forEach(A=>l.add(A)),g.conflictingTypeSignatures&&p.add(g.propertyKey);let d=[];for(let g of e.allOf){let A=QJt({schema:g.schema,context:t,namespace:n});if(A==null||l.has(g.schema)||l.has(A))continue;let b=Ja({schema:la.reference(g),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s});d.push(OUe(Jl(b)))}for(let g of l){let A=PUe(t,g,n);for(let b of A.properties)c[b.key]==null&&(p.has(b.key)&&(c[b.key]="unknown"),c[b.key]=Ja({schema:b.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s}));for(let b of A.allOf){if(l.has(b.schema))continue;let v=Ja({schema:la.reference(b),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s});d.push(OUe(Jl(v)))}}let f={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([g,A])=>Gkc(g)?[g,typeof A=="string"?{type:A,name:`_${g}`}:{...A,name:`_${g}`}]:[g,A]))};d.length>0&&(f.extends=d),e.additionalProperties&&(f["extra-properties"]=!0),e.availability!=null&&(f.availability=gy(e.availability)),e.source!=null&&(f.source=une(e.source)),e.encoding!=null&&(f.encoding=Wmt(e.encoding)),f.inline=vKn(e,i);let m=e.nameOverride??e.generatedName;return{name:s==="read"&&u&&t.options.respectReadonlySchemas&&t.hasReadVariant(m)?`${m}Read`:m,schema:f}}function EKn({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return EKn({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:o,allOf:s}=PUe(r,t,n),a=o.some(c=>c.key===e),u=[...s.flatMap(c=>EKn({property:e,context:r,schemaId:c.schema,namespace:n}))];if(a||u.length>0)return[t,...u]}return[]}function eJo(e,t,r){return t.type==="object"?{properties:t.properties,allOf:t.allOf}:t.type==="reference"?PUe(e,t.schema,r):t.type==="nullable"?eJo(e,t.value,r):{properties:[],allOf:[]}}function PUe(e,t,r){let n=e.getSchema(t,r);return n==null?{properties:[],allOf:[]}:eJo(e,n,r)}function Nkc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:mKn({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function jkc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:hKn({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function Mkc(e){let t=RJt(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...n}=t;return{name:e.nameOverride??e.generatedName,schema:{...n}}}function XKo(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function Hmt(e,t){let r={enum:e.values.map(o=>{let s=o.nameOverride??o.generatedName,a=o.value;if(s===a&&o.description==null&&(o.casing==null||XKo(o.casing)))return s;let u={value:o.value};if(s!==a&&(u.name=s),o.description!=null&&(u.docs=o.description),o.casing!=null&&!XKo(o.casing)){let c={},l=!1;o.casing.camel!=null&&(c.camel=o.casing.camel,l=!0),o.casing.screamingSnake!=null&&(c["screaming-snake"]=o.casing.screamingSnake,l=!0),o.casing.snake!=null&&(c.snake=o.casing.snake,l=!0),o.casing.pascal!=null&&(c.pascal=o.casing.pascal,l=!0),l&&(u.casing=c)}return u})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=vKn(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?une(e.source):void 0};for(let o of r.enum){let s=typeof o=="string"?o:o.name??o.value;n.has(s.toLowerCase())||(i.enum.push(o),n.add(s.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function Lkc({schema:e,context:t,declarationFile:r,namespace:n,variant:i}){return{name:e.nameOverride??e.generatedName,schema:dKn({schema:e,context:t,fileContainingReference:r,namespace:n,variant:i})}}function Ukc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.options.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:gKn({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:tJo({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function tJo({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:FJt({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function zkc(e,t,r){return r!=null?{name:e??t,schema:{type:"unknown",docs:r}}:{name:e??t,schema:AKn()}}function Vkc(e,t,r){return{name:t??r,schema:yKn(e)}}function bKn({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s=e.encoding!=null?Wmt(e.encoding):void 0;if(e.type==="discriminated"){let u={};for(let l of e.commonProperties)u[l.key]=Ja({schema:l.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o});let c={};for(let[l,p]of Object.entries(e.schemas))c[l]=Ja({schema:p,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:o});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantPropertyNameOverride!=null?{name:e.discriminantPropertyNameOverride,value:e.discriminantProperty}:e.discriminantProperty,"base-properties":u,docs:e.description??void 0,availability:e.availability!=null?gy(e.availability):void 0,union:c,encoding:s,source:e.source!=null?une(e.source):void 0,...e.discriminatorContext&&{context:e.discriminatorContext}}}}let a=[];for(let u of e.schemas)a.push(Ja({schema:u,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:a,encoding:s,source:e.source!=null?une(e.source):void 0,inline:vKn(e,i)}}}var qkc=/^[0-9]/;function Gkc(e){return qkc.test(e)}function QJt({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?QJt({context:t,schema:n.schema,namespace:r}):e}function Wkc({typeReference:e,audiences:t,name:r,availability:n,propertyAccess:i}){return t.length===0&&r==null&&n==null&&i==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...n!=null?{availability:n}:{},...i!=null?{access:i}:{}}}function vKn(e,t){return e.inline===!0||t>0?!0:void 0}function $kc(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return Hd.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return Hd.ObjectPropertyAccess.WriteOnly}}Ci();function rJo(e){let t=e.replace(/^x-|^X-/,"");return zn(t)}function nJo(e){if(e.authOverrides!=null){for(let[r,n]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:n});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,n]of Object.entries(e.ir.securitySchemes))if(n.type==="basic"){let i={scheme:"basic"};n.usernameVariableName!=null&&(i.username===void 0?i.username={name:n.usernameVariableName}:i.username.name=n.usernameVariableName),n.usernameEnvVar!=null&&(i.username===void 0?i.username={env:n.usernameEnvVar}:i.username.env=n.usernameEnvVar),n.passwordVariableName!=null&&(i.password===void 0?i.password={name:n.passwordVariableName}:i.password.name=n.passwordVariableName),n.passwordEnvVar!=null&&(i.password===void 0?i.password={env:n.passwordEnvVar}:i.password.env=n.passwordEnvVar),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="bearer"){let i={scheme:"bearer"};n.tokenVariableName!=null&&(i.token===void 0?i.token={name:n.tokenVariableName}:i.token.name=n.tokenVariableName),n.tokenEnvVar!=null&&(i.token===void 0?i.token={env:n.tokenEnvVar}:i.token.env=n.tokenEnvVar),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??rJo(n.headerName),env:n.headerEnvVar}});else{let i={header:n.headerName,name:n.headerVariableName??"apiKey",type:"string"};n.headerEnvVar!=null&&(i.env=n.headerEnvVar),n.prefix!=null&&(i.prefix=n.prefix),e.builder.addAuthScheme({name:r,schema:i}),e.builder.setAuth(r),t=!0}else if(n.type==="oauth"){let i={scheme:"bearer"};e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(Bs.of("__package__.yml"),{name:"OauthScope",schema:Hmt(n.scopesEnum,0).schema})}}Ci();function iG({header:e,context:t,fileContainingReference:r,namespace:n}){let i=Ja({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),o=Jl(i),s=e.name.replace(/^x-|^X-/,""),a=e.parameterNameOverride!=null?e.parameterNameOverride:zn(s);if(e.description==null&&e.name===a&&e.env==null&&e.availability==null)return o;let u={type:o};return a!==e.name&&(u.name=a),e.description!=null&&(u.docs=e.description),e.env!=null&&(u.env=e.env),e.availability!=null&&(u.availability=gy(e.availability)),u}function NJt({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=Ja({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return Jl(i);let o=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:Jl(i)};return e.description!=null&&(o.docs=e.description),e.availability!=null&&(o.availability=gy(e.availability)),o}yg();function MJt({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=IKn({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let o=Jl(i.value),s=$mt(i.value);o==="unknown"?o="string":o==="optional<unknown>"&&(o="optional<string>");let a={type:o};return s!=null&&(a.default=s),i.allowMultiple&&(a["allow-multiple"]=!0),e.explode!=null&&(a.explode=e.explode),e.description!=null&&(a.docs=e.description),e.parameterNameOverride!=null&&(a.name=e.parameterNameOverride),e.availability!=null&&(a.availability=gy(e.availability)),Hkc(i.value)&&i.value.validation!==void 0&&(a.validation=i.value.validation),a.default==null&&a["allow-multiple"]==null&&a.docs==null&&a.name==null&&a.availability==null&&a.validation==null&&a.explode==null?o:a}function IKn({schema:e,context:t,fileContainingReference:r,namespace:n}){if(e.type==="reference"){let i=t.getSchema(e.schema,n);if(i==null)return;if(i.type==="array")return{value:Ja({schema:la.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:Bs.of(Pp),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let o=[],s=!1;for(let[a,u]of Object.entries(i.value.schemas))u.type==="primitive"&&u.schema.type==="string"&&(s=!0),u.type==="literal"&&u.value.type==="string"&&(_Ue.test(u.value.value)?o.push(u.value.value):o.push({value:u.value.value,name:SUe(u.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),s&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[a,u]=i.value.schemas;if(a!=null&&u!=null&&jJt({array:a,primitive:u}))return{value:Ja({schema:la.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(a!=null&&u!=null&&jJt({array:u,primitive:a}))return{value:Ja({schema:la.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}for(let[a,u]of Object.entries(i.value.schemas))return IKn({schema:u,context:t,fileContainingReference:r,namespace:n})}else if(t.options.objectQueryParameters)return{value:Ja({schema:e,context:t,fileContainingReference:r,declarationFile:Bs.of(Pp),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let i=e.type==="optional"?la.optional:la.nullable;if(e.value.type==="reference"){let o=t.getSchema(e.value.schema,n);if(o==null)return;if(o.type==="array")return{value:Ja({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:o.value,description:e.description??o.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:Bs.of(Pp),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.options.objectQueryParameters)return{value:Ja({schema:e,context:t,fileContainingReference:r,declarationFile:Bs.of(Pp),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:Ja({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let o=[],s=!1;for(let[a,u]of Object.entries(e.value.value.schemas))u.type==="primitive"&&u.schema.type==="string"&&(s=!0),u.type==="literal"&&u.value.type==="string"&&(_Ue.test(u.value.value)?o.push(u.value.value):o.push({value:u.value.value,name:SUe(u.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),s&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[a,u]=e.value.value.schemas;if(a!=null&&u!=null&&jJt({array:a,primitive:u}))return{value:Ja({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(a!=null&&u!=null&&jJt({array:u,primitive:a}))return{value:Ja({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}if(t.options.objectQueryParameters)return{value:Ja({schema:e,context:t,fileContainingReference:r,declarationFile:Bs.of(Pp),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[a,u]of Object.entries(e.value.value.schemas))return IKn({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.options.objectQueryParameters?{value:Ja({schema:e,context:t,fileContainingReference:r,declarationFile:Bs.of(Pp),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:Ja({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:Ja({schema:la.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}:{value:Ja({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function jJt({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function Hkc(e){return typeof e=="object"&&e!==null&&"type"in e}St();function iJo({websocketExample:e,context:t}){let r={messages:[]};e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=Kkc(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=Jkc({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=xpe(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function Kkc(e){let t={};return e.forEach(r=>{let n=xpe(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function Jkc({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let o=xpe(i.value);r.has(i.name)||o!=null&&(n[i.name]=o)}),n}function xpe(e){switch(e.type){case"primitive":return oJo(e.value);case"object":return sJo(e.properties);case"array":return Ykc(e.value);case"map":return Xkc(e.value);case"oneOf":return Zkc(e.value);case"enum":return e.value;case"literal":return e2c(e.value);case"unknown":return xpe(e.value);case"null":return null;default:Be(e)}}function oJo(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`${e.value.slice(1)}`:e.value;case"datetime":try{return new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"datetimeRfc2822":return e.value;case"date":return e.value;case"base64":case"boolean":return e.value;default:Be(e)}}function sJo(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,xpe(r)]))}function Ykc(e){return e.map(t=>xpe(t))}function Xkc(e){return Object.fromEntries(e.map(t=>[oJo(t.key),xpe(t.value)]))}function Zkc(e){return e.type==="discriminated"?sJo(e.value):xpe(e.value)}function e2c(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Be(e)}}function Kmt(e){try{let r=new URL(e).pathname.split("/").filter(n=>n.length>0);if(r.length>0)return r[r.length-1]}catch{}}function LJt(e){try{return new URL(e).protocol.replace(":","")}catch{return}}function UJt(e,t,r=!1){let n=Kmt(t);return r&&n!=null?n:e!=null&&n!=null?`${e}_${n}`:n??e??"websocket"}function cne(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function zJt(e,t){return t??(e?.groupName!=null?cne(e.groupName):void 0)}function aJo({channel:e,context:t,declarationFile:r}){let n=e.servers[0],i=t.ir.servers.length===0&&t.ir.websocketServers.length<=1,o=n!=null&&!i?t.options.groupEnvironmentsByHost?t.getUrlId(n.url)??UJt(n.name,n.url,!0):n.name:void 0;t.logger.debug(`[buildChannel] Channel path="${e.path}", server name="${n?.name}", server url="${n?.url}", resolved urlId="${o}" (from collision map: ${t.getUrlId(n?.url??"")!=null})`);let s=e.path;for(let f of e.handshake.pathParameters)f.parameterNameOverride!=null&&(s=s.replace(`{${f.name}}`,`{${f.parameterNameOverride}}`));let a=t.authOverrides?.auth!=null,u={path:s,url:o,auth:a};e.audiences!=null&&e.audiences.length>0&&(u.audiences=e.audiences),e.summary!=null&&(u["display-name"]=e.summary),e.connectMethodName!=null&&(u["connect-method-name"]=e.connectMethodName),e.description!=null&&(u.docs=e.description);let c=cne(e.groupName),l={};if(e.handshake.pathParameters.length>0)for(let f of e.handshake.pathParameters){let m=f.parameterNameOverride??f.name;l[m]=NJt({pathParameter:f,context:t,fileContainingReference:r,namespace:c})}Object.keys(l).length>0&&(u["path-parameters"]=l);let p={};if(e.handshake.queryParameters.length>0)for(let f of e.handshake.queryParameters){let m=MJt({queryParameter:f,context:t,fileContainingReference:r,namespace:c});m!=null&&(p[f.name]=m)}Object.keys(p).length>0&&(u["query-parameters"]=p);let d={};if(e.handshake.headers.length>0)for(let f of e.handshake.headers){let m=iG({header:f,context:t,fileContainingReference:r,namespace:c});d[f.name]=m}Object.keys(d).length>0&&(u.headers=d),t.builder.addChannel(r,{channel:u});for(let f of e.messages){let m={origin:f.origin,body:Ja({schema:f.body,context:t,fileContainingReference:r,namespace:c,declarationDepth:0})};f.methodName!=null&&(m["method-name"]=f.methodName),t.builder.addChannelMessage(r,{messageId:f.name,message:m})}for(let f of e.examples){let m=iJo({context:t,websocketExample:f});t.builder.addChannelExample(r,{example:m})}}function wKn(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var av="Base",lJo="Default";function uJo(e){try{return new URL(e).hostname}catch{return}}function cJo(e){return e??lJo}function t2c(e,t){let r=new Map;for(let n of e){if(wKn(n)||!("url"in n)||!n.url)continue;let i=uJo(n.url)??n.url;r.has(i)||r.set(i,{environmentName:cJo(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.httpServers.push({name:n.name,url:n.url,audiences:n.audiences})}for(let n of t){let i=uJo(n.url)??n.url;r.has(i)||r.set(i,{environmentName:cJo(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.websocketServers.push(n)}return r}function v_e(e){return Object.entries(e).reduce((t,[r,n])=>(jD(n)?Object.entries(n.urls).forEach(([i,o])=>{t[i]=o}):t[r]=typeof n=="string"?n:n.url,t),{})}function pJo(e){if(e.environmentOverrides!=null){for(let[E,I]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:E,schema:I});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let t={},r=[],n=e.ir.servers.some(E=>wKn(E)),i=e.ir.servers;for(let E of i)if(wKn(E)){let I={urls:{}},w={},x={},C={};for(let[R,U]of Object.entries(E.urls))I.urls[R]=U.defaultUrl??U.url,U.urlTemplate&&(w[R]=U.urlTemplate),U.defaultUrl&&(x[R]=U.defaultUrl),U.variables&&U.variables.length>0&&(C[R]=U.variables);(Object.keys(w).length>0||Object.keys(C).length>0)&&(I["url-templates"]=w,I["default-urls"]=x,I.variables=C),E.name&&(t[E.name]=I)}else if("url"in E&&E.url){let w=E.urlTemplate!=null&&E.variables!=null&&E.variables.length>0?{url:E.url,audiences:E.audiences,"default-url":E.defaultUrl,"url-template":E.urlTemplate,variables:E.variables?.map(x=>({id:x.id,default:x.default,values:x.values}))}:E.audiences?{url:E.url,audiences:E.audiences}:E.url;if(E.name==null){r.push(w);continue}t[E.name]=w}let o={},s={},a=[],u={},c={},l={};for(let E of e.ir.endpoints)for(let I of E.servers){if(I.url==null&&I.name!=null){o[I.name]||(o[I.name]=[]);continue}if(I.url==null)continue;let w=I,x="defaultUrl"in I&&typeof w.defaultUrl=="string"?w.defaultUrl:void 0,C="urlTemplate"in I&&typeof w.urlTemplate=="string"?w.urlTemplate:void 0,_="variables"in I&&Array.isArray(w.variables)?w.variables:void 0,R=x??I.url,U=I.audiences?{url:R,audiences:I.audiences}:R;if(I.name==null){a.push(U);continue}o[I.name]||(o[I.name]=[]),o[I.name]?.push({url:R,audiences:I.audiences}),s[I.name]=U,C&&I.name&&(u[I.name]=C),x&&I.name&&(c[I.name]=x),_&&_.length>0&&I.name&&(l[I.name]=_)}let p={},d=[];for(let E of e.ir.websocketServers){e.logger.debug(`[buildEnvironments] Processing WebSocket server: name="${E.name}", url="${E.url}"`);let I=E.audiences?{url:E.url,audiences:E.audiences}:E.url;if(E.name==null){d.push(I);continue}p[E.name]=I}let f=Object.keys(t).length,m=f>0,h=Object.keys(s).length>0,g=Object.keys(o).some(E=>o[E]?.length===0),A=Object.keys(p).length>0;if(e.options.groupEnvironmentsByHost&&A&&(m||e.ir.servers.length>0)){let E=Object.entries(p).map(([w,x])=>({name:w,url:typeof x=="string"?x:x.url,audiences:typeof x=="string"?void 0:x.audiences})),I=t2c(i,E);if(I.size>0){let w=!0;for(let[x,C]of I.entries()){let _={},R=[...C.httpServers.map(q=>({...q,isHttp:!0})),...C.websocketServers.map(q=>({...q,isHttp:!1}))],U=new Map;for(let q of R){let z=Kmt(q.url),J=LJt(q.url);z&&J&&(U.has(z)||U.set(z,new Set),U.get(z)?.add(J))}if(C.httpServers.length>0){let q=C.httpServers[0];q!=null&&(_[av]=q.url,e.setUrlId(q.url,av));for(let z=1;z<C.httpServers.length;z++){let J=C.httpServers[z];if(J!=null){let ie=Kmt(J.url),V=LJt(J.url),H=ie?U.get(ie):void 0,ye=H&&H.size>1,K=ye&&V!=="https"?`${ie}_${V}`:ie||`Http${z+1}`;e.logger.debug(`[buildEnvironments] HTTP server: url="${J.url}", pathSegment="${ie}", protocol="${V}", hasCollision=${ye}, urlId="${K}"`),_[K]=J.url,e.setUrlId(J.url,K)}}}for(let q of C.websocketServers){let z=Kmt(q.url),J=LJt(q.url),ie=z?U.get(z):void 0,V=ie&&ie.size>1,H=V?`${z}_${J}`:UJt(q.name,q.url,!0);e.logger.debug(`[buildEnvironments] WebSocket server: name="${q.name}", url="${q.url}", pathSegment="${z}", protocol="${J}", hasCollision=${V}, urlId="${H}"`),_[H]=q.url,e.setUrlId(q.url,H)}if(Object.keys(_).length>1)e.builder.addEnvironment({name:C.environmentName,schema:{urls:_}});else if(Object.keys(_).length===1){let q=Object.values(_)[0];q!=null&&e.builder.addEnvironment({name:C.environmentName,schema:q})}w&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(C.environmentName),Object.keys(_).length>1&&e.builder.setDefaultUrl(av),w=!1)}return}}if(!m&&!h&&A&&e.ir.servers.length===0){for(let[E,I]of Object.entries(p))e.builder.addEnvironment({name:E,schema:I});e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(Object.keys(p)[0]),e.builder.setDefaultUrl(av);return}if(a.length>0&&e.logger.debug(`Skipping endpoint level servers ${a.map(E=>typeof E=="string"?E:E.url).join(", ")} because x-fern-server-name was not provided.`),!m){let E=e.ir.servers[0],I=E?.url,w=E?.audiences,x=E?.defaultUrl,C=E?.urlTemplate,_=E?.variables;if(I!=null){let U=C!=null&&_!=null&&_.length>0?{url:I,audiences:w,"default-url":x,"url-template":C,variables:_?.map(q=>({id:q.id,default:q.default,values:q.values}))}:w?{url:I,audiences:w}:I;t[lJo]=U}}let b=Object.values(t).map(E=>typeof E=="string"?E:jD(E)?Object.values(E.urls)[0]:E.url),v=r.filter(E=>{let I=typeof E=="string"?E:E.url;return!b.includes(I)});if(v.length>0&&e.logger.debug(`Skipping top level servers ${v.map(E=>typeof E=="string"?E:E.url).join(", ")} because x-fern-server-name was not provided.`),n){let E=!0;for(let[I,w]of Object.entries(t))if(e.builder.addEnvironment({name:I,schema:w}),E){if(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(I),jD(w)){let x=Object.keys(w.urls)[0];x&&e.builder.setDefaultUrl(x)}E=!1}return}if(!h&&!g){let E=!0;for(let[I,w]of Object.entries(t))if(E){if(A){let x=typeof w=="string"?w:jD(w)?Object.values(w.urls)[0]:w["default-url"]??w.url;x!=null&&e.setUrlId(x,av),e.builder.addEnvironment({name:I,schema:{urls:{[av]:x??"",...v_e(p)}}})}else e.builder.addEnvironment({name:I,schema:w});e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(I),E=!1}else if(A){let x=typeof w=="string"?w:jD(w)?Object.values(w.urls)[0]:w["default-url"]??w.url;x!=null&&e.setUrlId(x,av),e.builder.addEnvironment({name:I,schema:{urls:{[av]:x??"",...v_e(p)}}})}else e.builder.addEnvironment({name:I,schema:w});A&&e.builder.setDefaultUrl(av)}else if(f===1){let E=Object.keys(t)[0],I=Object.values(t)[0],w=typeof I=="string"?I:jD(I)?Object.values(I.urls)[0]:I["default-url"]??I.url,x={},C={},_={};typeof I!="string"&&!jD(I)&&(I["url-template"]&&(x[av]=I["url-template"]),I["default-url"]&&(C[av]=I["default-url"]),I.variables&&I.variables.length>0&&(_[av]=I.variables)),Object.assign(x,u),Object.assign(C,c),Object.assign(_,l);let R=Object.keys(x).length>0||Object.keys(_).length>0;w!=null&&e.setUrlId(w,av);let U={urls:{[av]:w??"",...v_e(s),...v_e(p)},...R?{"url-templates":x,"default-urls":C,variables:_}:{}};e.builder.addEnvironment({name:E,schema:U}),e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(E),e.builder.setDefaultUrl(av)}else{let E=new Map;for(let I of e.ir.endpoints)for(let w of I.servers)if(w.url!=null&&w.name!=null){E.has(w.name)||E.set(w.name,new Map);let x=w.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",C=E.get(w.name);C&&C.set(x,w.url)}if(E.size>0){let I=!0;for(let[w,x]of Object.entries(t)){let C=typeof x=="string"?x:jD(x)?Object.values(x.urls)[0]:x["default-url"]??x.url;if(!C)continue;e.setUrlId(C,av);let _=C.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",R={[av]:C};for(let[U,q]of E.entries()){let z=q.get(_)||q.get("production")||q.values().next().value;z&&(R[U]=z)}A&&Object.assign(R,v_e(p)),Object.keys(R).length>1?e.builder.addEnvironment({name:w,schema:{urls:R}}):e.builder.addEnvironment({name:w,schema:C}),I&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(w),I=!1)}E.size>0&&e.builder.setDefaultUrl(av)}else{let I=!0;for(let[w,x]of Object.entries(t)){if(A||Object.keys(s).length>0){let C=typeof x=="string"?x:jD(x)?Object.values(x.urls)[0]:x["default-url"]??x.url;C!=null&&e.setUrlId(C,av),e.builder.addEnvironment({name:w,schema:{urls:{[av]:C??"",...v_e(s),...v_e(p)}}})}else e.builder.addEnvironment({name:w,schema:x});I&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(w),I=!1)}}}}yg();Ci();var CKn=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},r2c=.75,n2c=new Set(["authorization"]);function fJo(e){if(e.globalHeaderOverrides!=null){for(let[r,n]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:n});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,n]of Object.entries(t)){let o=n.optional===!0?"optional<string>":"string",s=o;if(n.name==null&&n.env==null&&typeof n.schema=="string")s=n.schema;else if(n!=null){let a=n.schema?ane(n.schema):void 0,u=a!=null?cne(a):void 0,c=Bs.of("api.yml");s={name:n.name,env:n.env,type:n.schema!=null?Jl(Ja({schema:n.schema,context:e,fileContainingReference:u?Ub(Bs.of(zn(u)),c):c,namespace:u,declarationDepth:0}))??o:o}}e.builder.addGlobalHeader({name:r,schema:s})}if(e.options.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let o of i.headers){if(n2c.has(o.name.toLowerCase()))continue;let s=r[o.name];if(s==null){let a=t[o.name],u=iG({header:{...o,schema:a?.schema??o.schema,name:a?.name??o.name},fileContainingReference:Bs.of(qb),context:e,namespace:void 0});s=new CKn(u),r[o.name]=s}s.increment()}let n=e.ir.endpoints.length*r2c;for(let[i,o]of Object.entries(r)){let s=t[i],a=o.count===e.ir.endpoints.length,u=o.count>=n;s==null&&(a?e.builder.addGlobalHeader({name:i,schema:o.schema}):u&&e.builder.addGlobalHeader({name:i,schema:b_e(o.schema)}))}}}yg();function dJo(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?ane(t.schema):void 0,n=r!=null?cne(r):void 0,i=iG({header:{...t,schema:t.schema??la.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:Uc.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0})}),name:t.name??t.header,parameterNameOverride:void 0,description:void 0,availability:void 0,source:void 0},fileContainingReference:Bs.of(qb),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:b_e(i)})}}St();yg();St();St();function vS(e){switch(e.type){case"primitive":return hJo(e.value);case"object":return gJo(e.properties);case"array":return AJo(e.value);case"map":return o2c(e.value);case"oneOf":return s2c(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return a2c(e.value);case"unknown":return vS(e.value);case"null":return null;default:Be(e)}}function mJo(e){switch(e.type){case"withStreaming":return e.sse?{stream:i2c(e.events)}:{stream:AJo(e.events)};case"withoutStreaming":return{body:vS(e.value)};default:Be(e)}}function hJo(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"datetime":try{return!e.value.endsWith("Z")&&!e.value.includes("+")&&(e.value+="Z"),new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"datetimeRfc2822":return e.value;case"date":return e.value;case"base64":case"boolean":return e.value;default:Be(e)}}function gJo(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,vS(r)]))}function i2c(e){return e.map(t=>({event:"",data:vS(t)}))}function AJo(e){return e.map(t=>vS(t))}function o2c(e){return Object.fromEntries(e.map(t=>[hJo(t.key),vS(t.value)]))}function s2c(e){return e.type==="discriminated"?gJo(e.value):vS(e.value)}function a2c(e){switch(e.type){case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"boolean":return e.value;default:Be(e)}}function yJo({endpointExample:e,context:t}){let r={};if(e.type!=="full")return e.value;e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.pathParameters!=null&&e.pathParameters.length>0&&(r["path-parameters"]=u2c(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=c2c(e.queryParameters));let n=e.headers!=null&&e.headers.length>0,i=t.builder.getGlobalHeaders(),o=Object.keys(i).length>0,s=new Set(e.headers?.map(a=>a.name)??[]);if(n||o){let a=[];if(e.headers!=null)for(let u of e.headers)u.name!==t.builder.getAuthHeaderName()&&a.push(u);for(let[u,c]of Object.entries(i)){if(c!=null&&typeof c=="object"&&c.type!=null){let l=Q0({type:c.type,_default:void 0,validation:void 0,visitor:{primitive:ft,map:ft,list:ft,optional:p=>p,nullable:p=>p,set:ft,named:ft,literal:p=>{if(p.type==="string")return p.string;if(p.type==="boolean")return p.boolean.toString()},unknown:ft}});if(l!=null){let p=a.findIndex(f=>f.name===u),d={name:u,value:Ka.literal(hpe.string(l))};p>=0?a[p]=d:a.push(d);continue}}s.has(u)||a.push({name:u,value:Ka.primitive(us.string(u))})}r.headers=l2c({context:t,namedFullExamples:a})}return e.request!=null&&(r.request=vS(e.request)),e.response!=null&&(r.response=mJo(e.response)),e.codeSamples!=null&&e.codeSamples.length>0&&(r["code-samples"]=e.codeSamples.map(a=>a.type==="language"?{name:a.name??void 0,docs:a.description??void 0,language:a.language,code:a.code,install:a.install??void 0}:{name:a.name??void 0,docs:a.description??void 0,sdk:a.sdk,code:a.code}).filter(ua)),r}function u2c(e){let t={};return e.forEach(r=>{let n=vS(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function c2c(e){let t={};return e.forEach(r=>{let n=vS(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function l2c({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=vS(n.value);i!=null&&(r[n.name]=i)}),r}var h_;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(h_||(h_={}));function bJo(e){return Ww._visit(e,{get:()=>Hd.HttpMethodSchema.Get,post:()=>Hd.HttpMethodSchema.Post,put:()=>Hd.HttpMethodSchema.Put,patch:()=>Hd.HttpMethodSchema.Patch,delete:()=>Hd.HttpMethodSchema.Delete,head:()=>Hd.HttpMethodSchema.Head,options:()=>{throw new Error("OPTIONS is unsupported")},trace:()=>{throw new Error("TRACE is unsupported")},_other:()=>{throw new Error("Unknown http method is unsupported")}})}function xKn(e){return e==="POST"||e==="PUT"||e==="PATCH"}function EJo({endpoint:e,declarationFile:t,context:r}){let n=[],i=new Set,o=e.path,s=zJt(e.sdkName,e.namespace),a={};for(let h of e.pathParameters)h.parameterNameOverride&&(o=o.replace(h.name,h.parameterNameOverride)),a[h.parameterNameOverride??h.name]=NJt({pathParameter:h,context:r,fileContainingReference:t,namespace:s}),i.add(h.name);let u={};for(let h of e.queryParameters){let g=MJt({queryParameter:h,context:r,fileContainingReference:t,namespace:s});g!=null&&(u[h.name]=g,i.add(h.name))}let c;if(e.pagination!=null)switch(e.pagination.type){case"cursor":c={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":c={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":c={type:"custom",results:e.pagination.results};break;case"uri":c={next_uri:e.pagination.nextUri,results:e.pagination.results};break;case"path":c={next_path:e.pagination.nextPath,results:e.pagination.results};break;default:Be(e.pagination)}let l={path:o,method:bJo(e.method),auth:p2c({endpoint:e,context:r}),docs:e.description??void 0,pagination:c,source:e.source!=null?une(e.source):void 0};!h2c({context:r,request:e.request})&&Object.keys(a).length>0&&(l["path-parameters"]=a),e.summary!=null&&(l["display-name"]=e.summary);let p={},d=r.builder.getGlobalHeaderNames(),f=r.builder.getAuthHeaderName();f!=null&&d.add(f);let m=e.headers.filter(h=>!d.has(h.name));for(let h of m){let g=iG({header:h,context:r,fileContainingReference:t,namespace:s});p[h.name]=g,i.add(typeof g=="string"?h.name:g.name??h.name)}if(e.request!=null){r.setInState(h_.Request);let h=m2c({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.options.inlinePathParameters&&Object.keys(a).length>0?a:void 0,queryParameters:Object.keys(u).length>0?u:void 0,headers:Object.keys(p).length>0?p:void 0,usedNames:i,namespace:s});l.request=h.value,n=[...n,...h.schemaIdsToExclude??[]],r.unsetInState(h_.Request)}else{let h=r.options.inlinePathParameters&&Object.keys(a).length>0,g=Object.keys(u).length>0,A=Object.keys(p).length>0,b={};(h||g||A)&&(b.name=e.requestNameOverride??e.generatedRequestName),h&&(b["path-parameters"]=a),g&&(b["query-parameters"]=u),A&&(b.headers=p),Object.keys(b).length>0&&(l.request=b)}if(e.response!=null&&e.response._visit({json:h=>{let g=Ja({schema:h.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});l.response={docs:h.description??void 0,type:Jl(g)},h.statusCode!=null&&(l.response["status-code"]=h.statusCode),h.responseProperty!=null&&(l.response.property=h.responseProperty)},streamingJson:h=>{let g=Ja({schema:h.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});l["response-stream"]={docs:h.description??void 0,type:Jl(g),format:"json",terminator:h.terminator??void 0}},streamingSse:h=>{let g=Ja({schema:h.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});l["response-stream"]={docs:h.description??void 0,type:Jl(g),format:"sse",terminator:h.terminator??void 0}},file:h=>{l.response={docs:h.description??void 0,type:"file","status-code":h.statusCode}},bytes:h=>{l.response={docs:h.description??void 0,type:"bytes","status-code":h.statusCode}},streamingText:h=>{l["response-stream"]={docs:h.description??void 0,type:"text"}},text:h=>{l.response={docs:h.description??void 0,type:"text","status-code":h.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let h=r.getDefaultServerName(),g=e.servers[0];if(g==null)h!=null&&(l.url=h);else{let A=g.url!=null?r.getUrlId(g.url):void 0;l.url=A??g.name??void 0}}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=gy(e.availability)),Object.entries(e.errors).forEach(([h,g])=>{let A=g.generatedName,b=Bs.of(Pp);r.builder.enableUniqueErrorsPerEndpoint&&(A=`${e.generatedRequestName}${g.generatedName}`,g.schema!=null&&(g.schema.type!=="reference"&&g.schema.type!=="oneOf"?g.schema.generatedName=`${e.generatedRequestName}${g.schema.generatedName}`:g.schema.type==="oneOf"&&(g.schema.value.generatedName=`${e.generatedRequestName}${g.schema.value.generatedName}`)));let v={"status-code":parseInt(h)},E=WKo({location:vJo,namespaceOverride:s});if(g.schema!=null){let x=Ja({schema:g.schema,context:r,fileContainingReference:E,declarationFile:E,namespace:s,declarationDepth:0});v.type=Jl(x),v.docs=g.description}r.builder.addError(E,{name:A,schema:r.isErrorUnknownSchema(parseInt(h))?{...v,type:"unknown"}:v}),l.errors==null&&(l.errors=[]);let I=r.builder.addImport({file:t,fileToImport:E});l.errors.push(I!=null?`${I}.${A}`:A),v.type!=null&&g.examples?.forEach(x=>{let C={value:vS(x.example),name:x.name,docs:x.description};r.builder.addErrorExample(E,{name:A,example:C})})}),e.examples.length>0&&(l.examples=f2c({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=d2c({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[_Kn,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:n}}function p2c({endpoint:e,context:t}){if(e.security==null)return t.authOverrides?.auth!=null?!0:t.ir.security==null?void 0:t.ir.security.length>0?!0:void 0;if(e.security.length!==0)return JSON.stringify(e.security)===JSON.stringify(t.ir.security)?!0:e.security}function f2c({endpointExamples:e,context:t}){return e.map(r=>{try{return yJo({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function d2c({retries:e}){if(e!=null){if(e.type==="disabled")return{disabled:e.value??void 0};Be(e)}}function m2c({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:o,pathParameters:s,queryParameters:a,headers:u,usedNames:c,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let p=n.schema.type==="reference"?n.schema.schema:void 0,d=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(d?.type!=="object"||p!=null&&r.isResponseReachable(p)){let I=r.options.respectReadonlySchemas&&xKn(e.method)?"write":void 0,w=Ja({schema:n.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0,variant:I}),x={schemaIdsToExclude:[],value:{body:w}},C=Object.keys(s??{}).length>0,_=Object.keys(a??{}).length>0,R=Object.keys(u??{}).length>0;return C&&(x.value["path-parameters"]=s),_&&(x.value["query-parameters"]=a),R&&(x.value.headers=u),(C||_||R)&&(x.value.name=i??o),n.contentType!=null&&(x.value["content-type"]=n.contentType),n.description!=null&&(x.value.docs=n.description),x}let f=new Map;for(let E of d.allOf){let I=r.getSchema(E.schema,l);if(I==null)continue;let w=ane(I),x=sne(w),{properties:C}=PUe(r,E.schema,l);for(let _ of C)f.set(_.key,x)}let m=Object.fromEntries(d.properties.filter(E=>E.readonly==null?!0:!(xKn(e.method)&&E.readonly)).map(E=>{let I=f.get(E.key)??t,w=Ja({schema:E.schema,fileContainingReference:t,declarationFile:I,context:r,namespace:l,declarationDepth:1}),x=E.nameOverride??E.key,C=gy(E.availability);if(!c.has(x)&&E.audiences.length<=0)return c.add(x),E.nameOverride!=null?[E.key,{type:Jl(w),docs:BUe(w),name:E.nameOverride,availability:C}]:[E.key,C?{...typeof w=="string"?{type:w}:w,availability:C}:w];let _={type:Jl(w),docs:BUe(w)};return c.has(x)&&(_.name=E.generatedName),E.audiences.length>0&&(_.audiences=E.audiences),C!=null&&(_.availability=C),c.add(x),[E.key,_]})),h=new Set,g=new Set;for(let E of d.allOfPropertyConflicts)E.allOfSchemaIds.forEach(I=>h.add(I)),E.conflictingTypeSignatures&&g.add(E.propertyKey);let A=[];for(let E of d.allOf){let I=QJt({schema:E.schema,context:r,namespace:l});if(I==null||h.has(E.schema)||h.has(I))continue;let w=Ja({schema:la.reference(E),fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),x=OUe(Jl(w));x!=="unknown"&&A.push(x)}for(let E of h){let I=PUe(r,E,l),w=r.getSchema(E,l),x=w!=null?sne(ane(w)):t;for(let C of I.properties)m[C.key]==null&&(g.has(C.key)?m[C.key]="unknown":m[C.key]=Ja({schema:C.schema,fileContainingReference:t,declarationFile:x,context:r,namespace:l,declarationDepth:1}));for(let C of I.allOf){if(h.has(C.schema))continue;let _=Ja({schema:la.reference(C),fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),R=OUe(Jl(_));R!=="unknown"&&!A.includes(R)&&A.push(R)}}let b={properties:m};A.length>0&&(b.extends=A),n.additionalProperties&&(b["extra-properties"]=!0);let v={name:i??d.nameOverride??d.generatedName,"path-parameters":s,"query-parameters":a,headers:u,body:b};return n.contentType!=null&&(v["content-type"]=n.contentType),n.description!=null&&(v.docs=n.description),{schemaIdsToExclude:p!=null?[p]:[],value:v}}else if(n.type==="octetStream"){let p={body:"bytes","content-type":n.contentType??Wp.APPLICATION_OCTET_STREAM,"query-parameters":a};return a!=null&&(p.name=i??o),n.description!=null&&(p.docs=n.description),{schemaIdsToExclude:[],value:p}}else if(n.type==="multipart"){let p=Object.fromEntries(n.properties.map(d=>{if(d.schema.type==="file"){let f=d.schema.isArray?"list<file>":"file";if(f=d.schema.isOptional?`optional<${f}>`:f,d.description!=null||d.contentType!=null){let m={type:f};if(d.description!=null&&(m.docs=d.description),d.contentType!=null){let h=d.contentType.split(",")[0];m["content-type"]=h}return[d.key,m]}return[d.key,f]}else{let f=Ja({schema:d.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(d.contentType||d.exploded||d.encoding){let m=typeof f=="string"?{type:f}:f;d.contentType!=null&&(m["content-type"]=d.contentType),d.encoding==="form"?m.style="form":d.encoding==="json"?m.style="json":d.exploded&&(m.style="exploded"),f=m}return[d.key,f]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??o,"path-parameters":s,"query-parameters":a,headers:u,body:{properties:p},"content-type":Wp.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else Be(n)}function h2c({context:e,request:t}){if(!e.options.inlinePathParameters)return!1;if(t==null)return!0;switch(t.type){case"octetStream":return!1;case"multipart":return!0;case"json":return!0;case"formUrlEncoded":return!0;default:Be(t)}}yg();Ci();function g2c({location:e,namespaceOverride:t}){return t!=null?{...e,file:Ub(Bs.of(t),e.file)}:e}function A2c(e){let t=e.namespace,r=e.tags.filter(u=>u!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:Bs.of(`${zn(r)}.yml`),endpointId:e.summary!=null?zn(e.summary):zn(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:Bs.of(Pp),endpointId:zn(e.summary)}:{file:Bs.of(Pp),endpointId:zn(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:Bs.of(Pp),endpointId:n};let i=Jmt(r),o=Jmt(n);if(Lb(i,o))return{file:Bs.of("__package__.yml"),endpointId:r};let s=E2c({operationId:n,tag:r,path:e.path,method:e.method});if(s!=null)return s;let a=[];for(let u=0;u<i.length;++u){let c=i[u];if(c!=null&&c===o[u])a.push(c);else{let l=zn(r);return{file:Bs.of(`${l}.yml`),endpointId:n,tag:r}}}if(a.length>=o.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:Bs.of(zn(a.join("_"))+".yml"),endpointId:zn(o.slice(a.length).join("_")),tag:r}}function Ymt(e){let t=e.tags[0];if(e.sdkName!=null){let r=lKn({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:Bs.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return g2c({namespaceOverride:e.namespace,location:A2c(e)})}function Jmt(e){let t;return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)?t=e.split(/(?=[A-Z])/):t=e.split(/[^a-zA-Z0-9]+/),t=t.map(r=>r.toLowerCase()),t=Ej(t),t}var y2c=new RegExp("[^a-zA-Z0-9{}]+"),b2c=new RegExp("[{}]","g");function E2c({operationId:e,tag:t,path:r,method:n}){let o=`${r.split(y2c).join("_").replaceAll(b2c,"_")}_${n.toLowerCase()}`;if(e.endsWith(o))return{file:Bs.of(zn(t)+".yml"),endpointId:zn(e.slice(0,-1*o.length)),tag:t}}function IJo(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let o of r){let{endpointId:s,file:a,tag:u}=Ymt(o),c=a.split(".")[0];c!=null&&t.add(c);let l;if(o.sdkName!=null){let f=e.ir.groups;for(let m of o.sdkName.groupName){let h=typeof m=="string"?m:m.name,g=f[h];if(g==null)break;if(g.summary!=null||g.description!=null){l=f[h];break}}}let p=u==null?void 0:n.tagsById[u];e.setInState(h_.Endpoint),e.setEndpointMethod(o.method);let d=EJo({context:e,endpoint:o,declarationFile:a});e.unsetEndpointMethod(),e.unsetInState(h_.Endpoint),i=[...i,...d.schemaIdsToExclude],e.builder.addEndpoint(a,{name:s,schema:d.value,source:o.source!=null?une(o.source):void 0}),(p?.id!=null||p?.description!=null)&&e.builder.setServiceInfo(a,{"display-name":l?.summary??p?.id,docs:l?.description??p?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}yg();function wJo(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?cne(r.groupName):void 0,i=Ja({schema:la.primitive(r),context:e,fileContainingReference:Bs.of(Pp),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:Jl(i),docs:r.description??void 0}})}}yg();Ci();function _Jo(e){for(let t of e.ir.webhooks){let r=w2c({webhook:t,context:e});if(r==null)continue;let n=zJt(t.sdkName,t.namespace),i={};for(let s of t.headers)i[s.name]=iG({header:s,context:e,fileContainingReference:r.file,namespace:n});let o={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:Ja({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),signature:C2c(t.signatureVerification),examples:t.examples!=null?t.examples.map(s=>({docs:s.description,name:s.name,payload:vS(s.payload)})):void 0};t.response!=null&&t.response._visit({json:s=>{let a=Ja({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o.response={docs:s.description??void 0,type:Jl(a)},s.statusCode!=null&&(o.response["status-code"]=s.statusCode)},file:s=>{o.response={docs:s.description??void 0,type:"file","status-code":s.statusCode}},bytes:s=>{o.response={docs:s.description??void 0,type:"bytes","status-code":s.statusCode}},text:s=>{o.response={docs:s.description??void 0,type:"text","status-code":s.statusCode}},streamingJson:s=>{let a=Ja({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:s.description??void 0,type:Jl(a),format:"json"}},streamingSse:s=>{let a=Ja({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:s.description??void 0,type:Jl(a),format:"sse"}},streamingText:s=>{o["response-stream"]={docs:s.description??void 0,type:"text"}},_other:()=>{throw new Error("Unrecognized Response type: "+t.response?.type)}}),e.builder.addWebhook(r.file,{name:r.endpointId,schema:o}),t.description!=null&&(o.docs=t.description)}}function v2c({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:Ub(Bs.of(t),e.file)}:e}function I2c({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:Bs.of(Pp),endpointId:n};let i=Jmt(r),o=Jmt(n);if(Lb(i,o))return{file:Bs.of("__package__.yml"),endpointId:r};let s=[];for(let a=0;a<i.length;++a){let u=i[a];if(u!=null&&u===o[a])s.push(u);else{let c=zn(r);return{file:Bs.of(`${c}.yml`),endpointId:n,tag:r}}}if(s.length>=o.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:Bs.of(zn(s.join("_"))+".yml"),endpointId:zn(o.slice(s.length).join("_")),tag:r}}function w2c({webhook:e,context:t}){return e.sdkName!=null?{file:GKo({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:v2c({namespaceOverride:e.namespace,location:I2c({webhook:e,context:t})})}function C2c(e){if(e!=null)switch(e.type){case"hmac":return{type:"hmac",header:e.header,algorithm:x2c(e.algorithm),encoding:CJo(e.encoding),"signature-prefix":e.signaturePrefix,"payload-format":S2c(e.payloadFormat),timestamp:xJo(e.timestamp)};case"asymmetric":return{type:"asymmetric",header:e.header,"asymmetric-algorithm":_2c(e.asymmetricAlgorithm),encoding:CJo(e.encoding),"signature-prefix":e.signaturePrefix,"jwks-url":e.jwksUrl,"key-id-header":e.keyIdHeader,timestamp:xJo(e.timestamp)};default:return}}function x2c(e){if(e!=null)switch(e){case"sha256":return"sha256";case"sha1":return"sha1";case"sha384":return"sha384";case"sha512":return"sha512";default:return}}function CJo(e){if(e!=null)switch(e){case"base64":return"base64";case"hex":return"hex";default:return}}function _2c(e){switch(e){case"rsa-sha256":return"rsa-sha256";case"rsa-sha384":return"rsa-sha384";case"rsa-sha512":return"rsa-sha512";case"ecdsa-sha256":return"ecdsa-sha256";case"ecdsa-sha384":return"ecdsa-sha384";case"ecdsa-sha512":return"ecdsa-sha512";case"ed25519":return"ed25519";default:return"rsa-sha256"}}function S2c(e){if(e!=null)return{components:e.components.map(B2c),delimiter:e.delimiter}}function B2c(e){switch(e){case"body":return"body";case"timestamp":return"timestamp";case"notification-url":return"notification-url";case"message-id":return"message-id";default:return"body"}}function O2c(e){switch(e){case"unix-seconds":return"unix-seconds";case"unix-millis":return"unix-millis";case"iso8601":return"iso8601";default:return}}function xJo(e){if(e!=null)return{header:e.header,format:e.format!=null?O2c(e.format):void 0,tolerance:e.tolerance}}St();function _pe(e,t,r){switch(e.type){case"primitive":case"enum":case"literal":case"unknown":return;case"reference":{let n=e.schema;if(r.has(n))return;r.add(n);let i=SJo(n,e.namespace,t);i!=null&&_pe(i,t,r);return}case"object":for(let n of e.allOf)if(!r.has(n.schema)){r.add(n.schema);let i=SJo(n.schema,n.namespace,t);i!=null&&_pe(i,t,r)}for(let n of e.properties)_pe(n.schema,t,r);return;case"array":case"map":case"optional":case"nullable":_pe(e.value,t,r);return;case"oneOf":P2c(e.value,t,r);return;default:Be(e)}}function P2c(e,t,r){switch(e.type){case"discriminated":for(let n of Object.values(e.schemas))_pe(n,t,r);for(let n of e.commonProperties)_pe(n.schema,t,r);return;case"undiscriminated":for(let n of e.schemas)_pe(n,t,r);return;default:Be(e)}}function SJo(e,t,r){return t==null?r.rootSchemas[e]:r.namespacedSchemas[t]?.[e]}function fM(e,t,r){_pe(e,t,r)}function BJo(e){let t=new Set,r=new Set,{groupedSchemas:n}=e;for(let i of e.endpoints){if(i.request!=null)switch(i.request.type){case"json":case"formUrlEncoded":fM(i.request.schema,n,t);break;case"multipart":for(let o of i.request.properties)o.schema.type==="json"&&fM(o.schema.value,n,t);break;case"octetStream":break;default:Be(i.request)}if(i.response!=null)switch(i.response.type){case"json":case"streamingJson":case"streamingSse":fM(i.response.schema,n,r);break;case"file":case"text":case"bytes":case"streamingText":break;default:Be(i.response)}for(let o of Object.values(i.errors))o.schema!=null&&fM(o.schema,n,r);for(let o of i.pathParameters)fM(o.schema,n,r);for(let o of i.queryParameters)fM(o.schema,n,r);for(let o of i.headers)fM(o.schema,n,r)}for(let i of e.webhooks)fM(i.payload,n,r);for(let i of Object.values(e.channels)){for(let o of i.messages)fM(o.body,n,r);for(let o of i.handshake.queryParameters)fM(o.schema,n,r);for(let o of i.handshake.headers)fM(o.schema,n,r);for(let o of i.handshake.pathParameters)fM(o.schema,n,r)}return{requestReachable:t,responseReachable:r}}function T2c(e){return e.type!=="object"?!1:e.properties.some(t=>t.readonly===!0)}function OJo(e,t){let r=new Set,n=new Set,i=new Set;function o(s){for(let[a,u]of Object.entries(s)){if(!T2c(u))continue;let c=t.requestReachable.has(a),l=t.responseReachable.has(a);c&&l?r.add(a):c&&!l?n.add(a):!c&&l&&i.add(a)}}o(e.groupedSchemas.rootSchemas);for(let s of Object.values(e.groupedSchemas.namespacedSchemas))o(s);return{needsBothVariants:r,requestOnlyWithReadonly:n,responseOnlyWithReadonly:i}}var _Kn="external",vJo=Bs.of(Pp);function PJo({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,o]of Object.entries(e)){if(t.has(i))continue;let s=$Ko(o);if(n.options.respectReadonlySchemas&&n.needsBothVariants(i)&&o.type==="object"){let c=E_e({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,variant:"read"});n.builder.addType(s,{name:c.name??i,schema:c.schema});let l=E_e({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,skipReadonlyProperties:!0,variant:"write"});n.builder.addType(s,{name:l.name??i,schema:l.schema});continue}if(n.options.respectReadonlySchemas&&n.isRequestOnlyWithReadonly(i)&&o.type==="object"){let c=E_e({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,skipReadonlyProperties:!0,variant:"write"});n.builder.addType(s,{name:c.name??i,schema:c.schema});continue}let a;n.options.respectReadonlySchemas&&(a=n.isRequestOnly(i)?"write":"read");let u=ZKo({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,variant:a});if(Mle(u.schema)){let c=Jl(u.schema);if(c===(u.name??i)||c===`optional<${u.name??i}>`||c===`nullable<${u.name??i}>`||c===`optional<nullable<${u.name??i}>>`)continue}n.builder.addType(s,{name:u.name??i,schema:u.schema})}}function TJo(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),pJo(e),fJo(e),dJo(e),nJo(e),wJo(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(_Kn);let t=IJo(e),r=t.sdkGroups;e.setInState(h_.Webhook),_Jo(e),e.unsetInState(h_.Webhook),e.setInState(h_.Channel);for(let i of Object.values(e.ir.channels)){let o=sne(i.groupName);aJo({channel:i,context:e,declarationFile:o})}e.unsetInState(h_.Channel);let n=D2c({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});if(e.options.respectReadonlySchemas){let i=BJo(e.ir),o=OJo(e.ir,i);e.setVariantPlan(o,i)}PJo({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,o]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))PJo({schemas:o,schemaIdsToExclude:n,namespace:i,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(o=>r.has(o))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.optimizeServiceAuth(),e.builder.build()}function D2c({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return new Set(t);let n=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(o=>Object.keys(o))]),i=new Set(t);for(let o of n)r.includes(o)||i.add(o);return i}St();var Xmt=class{context;constructor(t){this.context=t}};yg();Ci();yg();var VJt=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[s,a]of Object.entries(n.files)){let u=i!=null?Bs.of(`${i}${"/"}${s}`):Bs.of(s);t[u]=a}let o=Object.keys(n.directories).sort();for(let s of o){let a=i!=null?`${i}${"/"}${s}`:s,u=n.directories[s];r(u,a)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Bs.of(t[0])]??={};let[r,...n]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(n)}};var I_e=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new VJt,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":n,"display-name":i,docs:o}){let s=this.getOrCreateFile(t);s.service==null&&(s.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(s.service.auth=r),n!=null&&(s.service["base-path"]=n),i!=null&&(s.service["display-name"]=i),o!=null&&(s.docs=o)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return N9(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let n of Object.values(this.rootApiFile["auth-schemes"]))DJo(n)&&t.push(n.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if(DJo(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let n=this.getVersionHeader();n!=null&&n===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}getGlobalHeaders(){return this.rootApiFile.headers??{}}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r,alias:n}){if(t===r)return;let i=n??zn((Pj(r)+"/"+tS(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Bs.of(qb))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=bje(Pj(yje.of(`/${t}`)),yje.of(`/${r}`)),i;let o=this.getOrCreateFile(t);return o.imports==null&&(o.imports={}),o.imports[i]=bje(Pj(yje.of(`/${t}`)),yje.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===Bs.of(qb))return;let i=this.getOrCreateFile(t);i.types==null&&(i.types={}),i.types[r]=n}addTypeExample(t,r,n){let i=this.getOrCreateFile(t);i.types==null&&(i.types={});let o=i.types[r];o!=null&&(typeof o=="string"?i.types[r]={type:o,examples:[n]}:(o.examples==null&&(o.examples=[]),o.examples.push(n)))}addError(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.errors==null&&(i.errors={}),i.errors[r]==null?i.errors[r]=n:i.errors[r]?.type!==n.type&&(i.errors[r]={"status-code":n["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:n}){let i=this.getOrCreateFile(t);if(i.errors==null)return;let o=i.errors[r];if(o==null)return;o.examples==null&&(o.examples=[]),(o.examples.some(a=>Lb(a,n))??!1)||o.examples?.push(n)}addEndpoint(t,{name:r,schema:n,source:i}){let o=this.getOrCreateFile(t);o.service==null&&(o.service={auth:!1,"base-path":"",endpoints:{}}),i!=null&&(o.service.source=i),o.service.endpoints[r]=n}addWebhook(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.webhooks==null&&(i.webhooks={}),i.webhooks[r]=n}addChannel(t,{channel:r}){let n=this.getOrCreateFile(t);n.channel=r;let i=this.basePath;i!=null&&(n.channel.path=Ub(i,r.path))}addChannelExample(t,{example:r}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.examples==null&&(n.channel.examples=[]),n.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:n}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.messages[r]=n}optimizeServiceAuth(){let t=[this.packageMarkerFile,...Object.values(this.root.getAllFiles())];for(let r of t){if(r.service==null)continue;let n=Object.values(r.service.endpoints);if(n.length===0)continue;if(n.every(o=>o.auth===!0)){r.service.auth=!0;for(let o of Object.values(r.service.endpoints))delete o.auth}}}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([i,o])=>[i,{...o,path:Ub(r,o.path)}]))});for(let i of Object.values(t))i.service!=null&&(i.service={...i.service,endpoints:Object.fromEntries(Object.entries(i.service.endpoints).map(([o,s])=>[o,{...s,path:Ub(r,s.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===Pp?this.packageMarkerFile:this.root.getOrCreateFile(t)}getVersionHeader(){if(this.rootApiFile.version!=null)return typeof this.rootApiFile.version.header=="string"?this.rootApiFile.version.header:this.rootApiFile.version.header.value}};function DJo(e){return e?.header!=null}var qJt=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;options;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;urlIdMap=new Map;endpointMethod;state=new Set;schemaNameMapping=new Map;variantPlan;reachability;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:o,authOverrides:s}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=s,this.globalHeaderOverrides=o,this.options=h_e({options:n}),this.enableUniqueErrorsPerEndpoint=this.options.enableUniqueErrorsPerEndpoint,this.referencedSchemaIds=this.options.onlyIncludeReferencedSchemas?new Set:void 0,this.builder=new I_e(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let a={};if(!this.enableUniqueErrorsPerEndpoint)for(let u of r.endpoints)for(let[c,l]of Object.entries(u.errors)){let p=parseInt(c),d=a[p];d==null&&l.schema!=null?a[p]=l.schema:d!=null&&l.schema!=null&&JD(d,l.schema)||this.unknownSchema.add(p)}}getReferencedSchemaIds(){if(this.referencedSchemaIds!=null)return Array.from(this.referencedSchemaIds)}getSchema(t,r){return r==null?this.ir.groupedSchemas.rootSchemas[t]:this.ir.groupedSchemas.namespacedSchemas[r]?.[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}setUrlId(t,r){this.urlIdMap.set(t,r)}getUrlId(t){return this.urlIdMap.get(t)}isErrorUnknownSchema(t){return this.unknownSchema.has(t)}getEndpointMethod(){return this.endpointMethod}setEndpointMethod(t){this.endpointMethod=t}unsetEndpointMethod(){this.endpointMethod=void 0}isInState(t){return this.state.has(t)}setInState(t){this.state.add(t)}unsetInState(t){this.state.delete(t)}shouldMarkSchemaAsReferenced(){return this.options.onlyIncludeReferencedSchemas&&this.isInAnyState(h_.Channel,h_.Endpoint,h_.Webhook)}markSchemaAsReferenced(t,r){switch(t.type){case"primitive":return;case"object":this.markObjectSchemaAsReferenced(t,r);return;case"array":this.markSchemaAsReferenced(t.value,r);return;case"map":this.markSchemaAsReferenced(t.value,r);return;case"optional":this.markSchemaAsReferenced(t.value,r);return;case"reference":this.markSchemaIdAsReferenced(t.schema,r);return;case"oneOf":this.markOneofSchemaAsReferenced(t.value,r);return;case"nullable":this.markSchemaAsReferenced(t.value,r);return;case"enum":return;case"literal":return;case"unknown":return;default:Be(t)}}markObjectSchemaAsReferenced(t,r){for(let n of t.allOf)this.markSchemaIdAsReferenced(n.schema,r);for(let n of t.properties)this.markSchemaAsReferenced(n.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let n of Object.values(t.schemas))this.markSchemaAsReferenced(n,r);return;case"undiscriminated":for(let n of t.schemas)this.markSchemaAsReferenced(n,r);return;default:Be(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let n=this.getSchema(t,r);n!=null&&this.markSchemaAsReferenced(n,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}setSchemaFinalName(t,r){this.schemaNameMapping.set(t,r)}hasReadVariant(t){return this.schemaNameMapping.has(t)}setVariantPlan(t,r){this.variantPlan=t,this.reachability=r;let n=[this.ir.groupedSchemas.rootSchemas,...Object.values(this.ir.groupedSchemas.namespacedSchemas)];for(let i of n)for(let[o,s]of Object.entries(i))if(t.needsBothVariants.has(o)&&s.type==="object"){let a=s.nameOverride??s.generatedName;this.schemaNameMapping.set(a,`${a}Read`)}}needsBothVariants(t){return this.variantPlan?.needsBothVariants.has(t)??!1}isRequestOnlyWithReadonly(t){return this.variantPlan?.requestOnlyWithReadonly.has(t)??!1}isResponseReachable(t){return this.reachability==null?this.ir.nonRequestReferencedSchemas.has(t):this.reachability.responseReachable.has(t)}isRequestOnly(t){return this.reachability==null?!this.ir.nonRequestReferencedSchemas.has(t):this.reachability.requestReachable.has(t)&&!this.reachability.responseReachable.has(t)}getSchemaFinalName(t,r){return!this.options.respectReadonlySchemas||r==="write"?t:this.schemaNameMapping.get(t)??t}};function SKn(e){let t=new qJt(e);return TJo(t)}yg();function HJo(e){return typeof e>"u"||e===null}function R2c(e){return typeof e=="object"&&e!==null}function F2c(e){return Array.isArray(e)?e:HJo(e)?[]:[e]}function k2c(e,t){var r,n,i,o;if(t)for(o=Object.keys(t),r=0,n=o.length;r<n;r+=1)i=o[r],e[i]=t[i];return e}function Q2c(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}function N2c(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var j2c=HJo,M2c=R2c,L2c=F2c,U2c=Q2c,z2c=N2c,V2c=k2c,_I={isNothing:j2c,isObject:M2c,toArray:L2c,repeat:U2c,isNegativeZero:z2c,extend:V2c};function KJo(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
1462
1462
 
1463
1463
  `+e.mark.snippet),n+" "+r):n}function eht(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=KJo(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}eht.prototype=Object.create(Error.prototype);eht.prototype.constructor=eht;eht.prototype.toString=function(t){return this.name+": "+KJo(this,t)};var nP=eht;function BKn(e,t,r,n,i){var o="",s="",a=Math.floor(i/2)-1;return n-t>a&&(o=" ... ",t=n-a+o.length),r-n>a&&(s=" ...",r=n+a-s.length),{str:o+e.slice(t,r).replace(/\t/g,"\u2192")+s,pos:n-t+o.length}}function OKn(e,t){return _I.repeat(" ",t-e.length)+e}function q2c(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],o,s=-1;o=r.exec(e.buffer);)i.push(o.index),n.push(o.index+o[0].length),e.position<=o.index&&s<0&&(s=n.length-2);s<0&&(s=n.length-1);var a="",u,c,l=Math.min(e.line+t.linesAfter,i.length).toString().length,p=t.maxLength-(t.indent+l+3);for(u=1;u<=t.linesBefore&&!(s-u<0);u++)c=BKn(e.buffer,n[s-u],i[s-u],e.position-(n[s]-n[s-u]),p),a=_I.repeat(" ",t.indent)+OKn((e.line-u+1).toString(),l)+" | "+c.str+`
@@ -1495,7 +1495,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
1495
1495
  `);s.push(u)}return s.push(""),s}),""].join(`
1496
1496
  `);try{LUe.writeFileSync(n,i,"utf8"),this.logger.info(`Missing examples report written to: ${n}`)}catch(o){this.logger.warn(`Failed to write missing examples report to ${n}:`,String(o))}}finalize(){}convertExampleToJson(t){switch(t.type){case"primitive":return t.value;case"array":return t.value.map(r=>this.convertExampleToJson(r));case"object":{let r={};return Object.entries(t.properties).forEach(([n,i])=>{r[n]=this.convertExampleToJson(i)}),r}case"map":{let r={};return t.value.forEach(n=>{r[String(n.key)]=this.convertExampleToJson(n.value)}),r}case"oneOf":if(t.value.type==="undiscriminated")return this.convertExampleToJson(t.value.value);{let r={};return Object.entries(t.value.value).forEach(([n,i])=>{r[n]=this.convertExampleToJson(i)}),r}case"enum":return t.value;case"literal":return t.value;case"null":return null;case"unknown":return this.convertExampleToJson(t.value);default:return t}}getSchemaDescription(t){if("description"in t)return t.description}getSchemaTypeName(t){switch(t.type){case"primitive":return`primitive (${t.schema.type})`;case"object":return t.generatedName||"object";case"array":return"array";case"map":return"map";case"optional":return`optional (${this.getSchemaTypeName(t.value)})`;case"nullable":return`nullable (${this.getSchemaTypeName(t.value)})`;case"reference":return t.generatedName||"reference";case"enum":return t.generatedName||"enum";case"literal":return"literal";case"oneOf":return"oneOf";case"unknown":return"unknown";default:return"unknown"}}buildEndpointExample(t){let r=Djc(t.request),n=Rjc(t.response);if(r?.type==="unsupported"||n?.type==="unsupported")return[];let i=[];if(r!=null&&r.type==="present"){let p=this.isSchemaRequired(r.schema);if(r.examples.length===0){let d=this.exampleTypeFactory.buildExample({skipReadonly:KKn(t.method),schema:r.schema,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});d!=null?(i.push([void 0,d]),this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),"No user-provided examples found in OpenAPI spec",{schemaDescription:this.getSchemaDescription(r.schema),autoGeneratedExample:this.convertExampleToJson(d)})):this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),"Auto-generation failed (schema too complex or circular references)",{schemaDescription:this.getSchemaDescription(r.schema)})}else for(let{name:d,value:f}of r.examples){let m=this.exampleTypeFactory.buildExample({skipReadonly:KKn(t.method),schema:r.schema,exampleId:d,example:f,options:{isParameter:!1,ignoreOptionals:!0}});m!=null?i.push([d,m]):this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),`Failed to build example from provided data (example id: ${d})`,{schemaDescription:this.getSchemaDescription(r.schema)})}if(p&&i.length===0)return this.logger.trace(`Failed to generate required request example for ${t.method.toUpperCase()} ${t.path}`),[]}let o=[];if(n!=null&&n.type==="present"){let p=this.isSchemaRequired(n.schema);if(n.examples.length===0){let d=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:n.schema,exampleId:void 0,example:void 0,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});d!=null?(t.response?.type==="json"?o.push([void 0,lM.withoutStreaming(d)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&o.push([void 0,lM.withStreaming({sse:t.response?.type==="streamingSse",events:[d]})]),this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),"No user-provided examples found in OpenAPI spec",{schemaDescription:this.getSchemaDescription(n.schema),autoGeneratedExample:this.convertExampleToJson(d)})):this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),"Auto-generation failed (schema too complex or circular references)",{schemaDescription:this.getSchemaDescription(n.schema)})}else for(let{name:d,value:f}of n.examples){let m=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:n.schema,exampleId:d,example:f,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});m!=null?t.response?.type==="json"?o.push([d,lM.withoutStreaming(m)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&o.push([void 0,lM.withStreaming({sse:t.response?.type==="streamingSse",events:[m]})]):this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),`Failed to build example from provided data (example id: ${d})`,{schemaDescription:this.getSchemaDescription(n.schema)})}if(p&&o.length===0)return this.logger.trace(`Failed to generate required response example for ${t.method.toUpperCase()} ${t.path}`),[]}let s=[];for(let p of t.pathParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!s8(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for path parameter ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&s.push({name:p.name,parameterNameOverride:p.parameterNameOverride,value:f})}let a=[];for(let p of t.queryParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!s8(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for query parameter ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&a.push({name:p.name,value:f})}let u=[];for(let p of t.headers){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!s8(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for header ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&u.push({name:p.name,value:f})}for(let p of this.globalHeaders){let d=p.schema!=null?o8(p.schema):kr.primitive({nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,schema:Ii.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})}),f=this.exampleTypeFactory.buildExample({schema:d,exampleId:void 0,example:void 0,options:{name:p.header,isParameter:!0,ignoreOptionals:!0}});f!=null&&!s8(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for global header ${p.header} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),f!=null&&u.push({name:p.header,value:f})}let c=[];t.request!=null&&t.response!=null?c=Tjc(i,o):t.request!=null?c=i.map(([p,d])=>({id:p,request:d,response:void 0})):t.response!=null&&(c=o.map(([p,d])=>({id:p,request:void 0,response:d})));let l=t.examples.filter(p=>pht(p)).flatMap(p=>{if(p.type==="unknown"){if(p.value!=null){let d=p.value["code-samples"];if(d!=null)return this.convertCodeSamples(d)}return}else return p.codeSamples}).filter(p=>ua(p));return c.length===0?[cM.full({name:void 0,description:void 0,pathParameters:s,queryParameters:a,headers:u,request:void 0,response:void 0,codeSamples:l})]:c.map(({id:p,request:d,response:f})=>cM.full({name:p,description:void 0,pathParameters:s,queryParameters:a,headers:u,request:d,response:f,codeSamples:l}))}convertCodeSamples(t){return t.map(r=>"language"in r?Y9.language({name:r.name??void 0,description:r.docs??void 0,language:r.language,code:r.code,install:r.install??void 0}):Y9.sdk({name:r.name??void 0,description:r.docs??void 0,sdk:r.sdk==="c#"?$w.Csharp:r.sdk,code:r.code})).filter(ua)}isSchemaRequired(t){return sYt(this.getResolvedSchema(t))}getResolvedSchema(t){return t}};function Tjc(e,t){let r=[];if(e.length<=1){let[i,o]=e[0]??[];if(t.length===0)return r.push({id:i,request:o,response:void 0}),r;for(let[s,a]of t)r.push({id:s??i,request:o,response:a});return r}if(t.length<=1){let[i,o]=t[0]??[];if(t.length===0)return r.push({id:i,request:void 0,response:o}),r;for(let[s,a]of e)r.push({id:s??i,request:a,response:o});return r}let n=new Set;for(let[i,o]of e){let s=t.find(([u])=>u==null)?.[1]??t[0]?.[1];if(i==null){if(s==null)continue;r.push({id:void 0,request:o,response:s});continue}let a=!1;for(let u=0;u<t.length;u++){let[c,l]=t[u];c==null||n.has(u)||i===c&&(r.push({id:i,request:o,response:l}),c!=null&&n.add(u),a=!0)}!a&&s!=null&&r.push({id:i,request:o,response:s})}for(let i=0;i<t.length;i++){if(n.has(i))continue;let[o,s]=t[i],a=e.find(([u])=>u==null)?.[1]??e[0]?.[1];a!=null&&r.push({id:o,request:a,response:s})}return r}function Djc(e){if(e!=null)return e.type==="multipart"?{type:"present",schema:Fjc(e),examples:[]}:e.type==="json"||e.type==="formUrlEncoded"?{type:"present",schema:e.schema,examples:e.fullExamples??[]}:{type:"unsupported"}}function Rjc(e){if(e!=null)return e.type!=="json"&&e.type!=="streamingJson"&&e.type!=="streamingSse"?{type:"unsupported"}:{type:"present",schema:e.schema,examples:e.fullExamples??[]}}function s8(e){switch(e.type){case"primitive":case"enum":case"literal":return!0;case"unknown":return s8(e);case"array":case"object":case"map":return!1;case"oneOf":switch(e.value.type){case"discriminated":return!1;case"undiscriminated":return s8(e.value.value);default:return!1}case"null":return!0;default:Be(e)}}function Fjc(e){return kr.object({properties:e.properties.map(t=>t.schema.type==="file"?null:{key:t.key,schema:o8(t.schema.value),audiences:[],conflict:{},generatedName:t.key,nameOverride:void 0,availability:void 0,readonly:void 0,writeonly:void 0,inline:void 0}).filter(ua),allOf:[],allOfPropertyConflicts:[],fullExamples:void 0,description:e.description,nameOverride:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,additionalProperties:!1,availability:void 0,encoding:void 0,source:e.source,inline:void 0,minProperties:void 0,maxProperties:void 0})}var UUe=class{exampleTypeFactory;schemas;constructor(t,r){this.exampleTypeFactory=new Rpe(t,new Set,r),this.schemas=t}buildWebsocketSessionExamplesForExtension({context:t,extensionExamples:r,handshake:n,source:i,namespace:o}){let s=[];for(let a of r){let u=[];for(let p of n.queryParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:a.queryParameters?.[p.name],options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});f!=null&&!s8(f)&&(f=void 0),!(d&&f==null)&&f!=null&&u.push({name:p.name,value:f})}let c=[];for(let p of n.headers){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:a.headers?.[p.name],options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});f!=null&&!s8(f)&&(f=void 0),!(d&&f==null)&&f!=null&&c.push({name:p.name,value:f})}let l=[];for(let p of a.messages){let d=t.getExampleMessageReference(p),f=t.resolveMessageReference({$ref:d}),m=jn(f.payload)?t.resolveSchemaReference(f.payload):f.payload,h=this.exampleTypeFactory.buildExample({schema:Da(m,!1,!1,t,[p.messageId],i,o),exampleId:void 0,example:p.value,options:{isParameter:!1,ignoreOptionals:!0}});h!=null&&l.push({messageType:p.type,payload:h,description:void 0})}s.push({name:a.summary,queryParameters:u,headers:c,description:a.description,messages:l})}return s}buildWebsocketSessionExample({handshake:t,messages:r}){let n={name:void 0,queryParameters:[],headers:[],description:void 0,messages:[]},i=[];for(let s of t.queryParameters){let a=this.isSchemaRequired(s.schema),u=this.exampleTypeFactory.buildExample({schema:s.schema,exampleId:void 0,example:void 0,options:{name:s.name,isParameter:!0,ignoreOptionals:!0}});if(u!=null&&!s8(u)&&(u=void 0),a&&u==null)return;u!=null&&i.push({name:s.name,value:u})}let o=[];for(let s of t.headers){let a=this.isSchemaRequired(s.schema),u=this.exampleTypeFactory.buildExample({schema:s.schema,exampleId:void 0,example:void 0,options:{name:s.name,isParameter:!0,ignoreOptionals:!0}});if(u!=null&&!s8(u)&&(u=void 0),a&&u==null)return;u!=null&&o.push({name:s.name,value:u})}for(let s of r){let a=this.exampleTypeFactory.buildExample({schema:s.payload,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});a!=null&&n.messages.push({messageType:s.type,payload:a,description:void 0})}return n}isSchemaRequired(t){return sYt(this.getResolvedSchema(t))}getResolvedSchema(t){for(;t.type==="reference";){let r=this.schemas[t.schema];if(r==null)throw new Error(`Unexpected error: Failed to resolve schema reference: ${t.schema}`);t=r}return t}};var tb={FERN_PARAMETER_OPTIONAL:"x-fern-optional",FERN_CHANNEL_ADDRESS:"x-fern-address",FERN_DISPLAY_NAME:"x-fern-display-name",FERN_SDK_GROUP_NAME:"x-fern-sdk-group-name",FERN_SDK_METHOD_NAME:"x-fern-sdk-method-name",FERN_EXAMPLES:"x-fern-examples",BASE_PATH:"x-fern-base-path",FERN_ENUM:"x-fern-enum",IGNORE:"x-fern-ignore",FERN_PARAMETER_NAME:"x-fern-parameter-name",FERN_SERVER_NAME:"x-fern-server-name"};function uYt(e){return jr(e,tb.FERN_EXAMPLES)??[]}function cYt(e,t){return t.includes("://")?t:`${e}://${t}`}function lYt(e){return e.startsWith("/")?e:"/"+e}function hXo({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){let o={},s={};for(let[c,l]of Object.entries(i.components?.schemas??{})){let p=Da(l,!1,!1,e,[c],r,e.namespace);o[c]=p}let a=new UUe(o,e),u={};for(let[c,l]of Object.entries(i.servers??{})){let p=jr(l,tb.FERN_SERVER_NAME);u[c]={name:p??c,url:cYt(l.protocol,l.url)}}for(let[c,l]of Object.entries(i.channels??{})){let p=jr(l,tb.IGNORE);if(p!=null&&p){e.logger.debug(`Channel ${c} is marked with x-fern-ignore. Skipping.`);continue}let d=[];if(l.parameters!=null)for(let[A,b]of Object.entries(l.parameters??{})){let v=jr(b,tb.FERN_PARAMETER_NAME);d.push({name:A,description:b.description,parameterNameOverride:v,schema:b.schema!=null?Da(b.schema,!1,!1,e,t,r,e.namespace):kr.primitive({schema:Ii.string({default:void 0,pattern:void 0,format:void 0,maxLength:void 0,minLength:void 0,example:void 0}),description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}),variableReference:void 0,availability:cv(b),source:r,explode:void 0})}let f=[],m=[];if(l.bindings?.ws!=null){if(l.bindings.ws.headers!=null){let A=l.bindings.ws.headers.required??[];for(let[b,v]of Object.entries(l.bindings.ws.headers.properties??{})){if(jn(v)){let x=e.resolveSchemaReference(v),C=A.includes(b),[_,R]=e.options.coerceOptionalSchemasToNullable?[!1,!C]:[!C,!1];f.push({name:b,schema:oQ(v,_,R,e,t,void 0,r,e.namespace),description:x.description,parameterNameOverride:void 0,env:void 0,availability:cv(x),source:r});continue}let E=A.includes(b),[I,w]=e.options.coerceOptionalSchemasToNullable?[!1,!E]:[!E,!1];f.push({name:b,schema:Da(v,I,w,e,[...t,b],r,e.namespace),description:v.description,parameterNameOverride:void 0,env:void 0,availability:cv(v),source:r})}}if(l.bindings.ws.query!=null){let A=l.bindings.ws.query.required??[];for(let[b,v]of Object.entries(l.bindings.ws.query.properties??{})){if(jn(v)){let x=e.resolveSchemaReference(v),C=A.includes(b),[_,R]=e.options.coerceOptionalSchemasToNullable?[!1,!C]:[!C,!1];m.push({name:b,schema:oQ(v,_,R,e,t,void 0,r,e.namespace),description:x.description,parameterNameOverride:void 0,availability:cv(x),source:r,explode:void 0});continue}let E=A.includes(b),[I,w]=e.options.coerceOptionalSchemasToNullable?[!1,!E]:[!E,!1];m.push({name:b,schema:Da(v,I,w,e,[...t,b],r,e.namespace),description:v.description,parameterNameOverride:void 0,availability:cv(v),source:r,explode:void 0})}}}let h;l.publish!=null&&("oneOf"in l.publish.message?h=dXo({generatedName:l.publish.operationId??"PublishEvent",event:l.publish,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):h=mXo({action:"Publish",channelPath:c,message:l.publish.message,context:e,source:r}));let g;if(l.subscribe!=null&&("oneOf"in l.subscribe.message?g=dXo({generatedName:l.subscribe.operationId??"SubscribeEvent",event:l.subscribe,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):g=mXo({action:"Subscribe",channelPath:c,message:l.subscribe.message,context:e,source:r})),f.length>0||m.length>0||h!=null||g!=null){let A=uYt(l),b=[];if(A.length>0)b=a.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:A,handshake:{headers:f,queryParameters:m},source:r,namespace:e.namespace});else{let w=[];h!=null&&w.push({type:"publish",payload:h}),g!=null&&w.push({type:"subscribe",payload:g});let x=a.buildWebsocketSessionExample({handshake:{headers:f,queryParameters:m},messages:w});x!=null&&b.push(x)}let v=jr(l,tb.FERN_CHANNEL_ADDRESS),E=v??lYt(c),I=[];h!=null&&I.push({origin:"client",name:"publish",body:mf(h),methodName:l.publish!=null?jr(l.publish,tb.FERN_SDK_METHOD_NAME):void 0}),g!=null&&I.push({origin:"server",name:"subscribe",body:mf(g),methodName:l.subscribe!=null?jr(l.subscribe,tb.FERN_SDK_METHOD_NAME):void 0}),s[c]={audiences:jr(l,En.AUDIENCES)??[],handshake:{headers:f.map(w=>({...w,schema:mf(w.schema),env:w.env})),queryParameters:m.map(w=>({...w,schema:mf(w.schema)})),pathParameters:d.map(w=>({...w,schema:mf(w.schema)}))},groupName:e.resolveGroupName([jr(l,tb.FERN_SDK_GROUP_NAME)??c]),messages:I,servers:(l.servers?.map(w=>u[w])??Object.values(u)).filter(w=>w!=null&&w.name!=null).map(w=>({...w,name:w.name})),summary:jr(l,tb.FERN_DISPLAY_NAME),connectMethodName:jr(l,tb.FERN_SDK_METHOD_NAME),path:E,description:l.description,examples:b,source:r}}}return{groupedSchemas:MUe(e.namespace,o),channels:s??void 0,servers:Object.values(u).map(c=>({...c,name:c.name})),basePath:jr(i,tb.BASE_PATH)}}function dXo({generatedName:e,event:t,context:r,breadcrumbs:n,source:i,options:o,asyncApiOptions:s}){if("oneOf"in t.message&&t.message.oneOf!=null){let a=[],u=[];for(let c of t.message.oneOf){let l,p={type:"notFound"};if(jn(c)){let d=r.resolveMessageReference(c);!jn(d.payload)&&s.naming==="v2"?(p=d.name?{type:"name",name:d.name}:p,l={...d.payload,title:d.name??d.payload.title,description:d.name??d.payload.description}):l=d.payload}else l=c;u.push(p),a.push(l)}return Tpe({description:t.description??t.message.description,availability:cv(t.message),subtypes:a,nameOverride:t.operationId,generatedName:e,title:t.message.title,groupName:void 0,wrapAsOptional:!1,wrapAsNullable:!1,breadcrumbs:n,context:r,encoding:void 0,source:i,namespace:r.namespace,subtypeSuffixOverrides:s.naming==="v2"?u:[]})}}function mXo({action:e,channelPath:t,message:r,context:n,source:i}){if(r.payload!=null){let o=r.payload;return jn(r.payload)&&(o=n.resolveSchemaReference(r.payload)),Da(o,!1,!1,n,[t,e],i,n.namespace)}}var pYt=class extends jUe{getExampleMessageReference(t){let r=t.channelId??this.getDefaultChannelId();if(r==null)throw new Error("Cannot resolve example message reference: no channelId provided and no channels found in document");return`#/channels/${r}/messages/${t.messageId}`}getDefaultChannelId(){return Object.keys(this.document.channels??{})[0]}resolveParameterReference(t){let r="#/components/parameters/";if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(r))throw new Error(`Failed to resolve ${t.$ref}`);let n=t.$ref.substring(r.length),i=this.document.components.parameters[n];if(i==null)throw new Error(`${t.$ref} is undefined`);return"$ref"in i?this.resolveParameterReference(i):i}resolveMessageReference(t,r=!1){let n="#/channels/",i="#/components/messages/";if(t==null)throw new Error("Cannot resolve message reference: message is null or undefined");if(!t.$ref)throw new Error("Cannot resolve message reference: message.$ref is undefined or empty");if(t.$ref.startsWith(n)){let u=t.$ref.split("/"),c=u[2],l=u[4],p=c?.replace(/~1/g,"/").replace(/~0/g,"~");if(p==null||l==null||!this.document.channels?.[p])throw new Error(`Failed to resolve message reference ${t.$ref} in channel ${p}`);let f=this.document.channels[p].messages?.[l];if(f==null)throw new Error(`${t.$ref} is undefined`);return"$ref"in f&&!r?this.resolveMessageReference(f):{...f,name:l}}let o=this.document.components;if(!t.$ref.startsWith(i)||!o?.messages)throw new Error(`Failed to resolve message reference: ${t.$ref} in v3 components`);let s=t.$ref.substring(i.length),a=o.messages[s];if(a==null)throw new Error(`${t.$ref} is undefined`);return{...a,name:s}}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}};St();Ci();var gXo="#/channels/",AXo="#/servers/",JKn="$message.";function bXo({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){iYt();let o={},s={},a={},u=[],c={};e.logger.debug("Parsing V3 AsyncAPI...");let l=sG();for(let[x,C]of Object.entries(i.components?.schemas??{})){let _=l.getUniqueSchemaId(x,e.logger,e.options.resolveSchemaCollisions);o[_]=Da(C,!1,!1,e,[_],r,e.namespace)}for(let[x,C]of Object.entries(i.channels??{}))if(s[x]||(s[x]={}),C.messages)for(let[_,R]of Object.entries(C.messages))if(a[_]||(a[_]=[]),e.isReferenceObject(R)){let U=e.resolveMessageReference(R);a[_].push({channelId:x,payload:U.payload})}else e.isMessageWithPayload(R)&&a[_].push({channelId:x,payload:R.payload});for(let[x,C]of Object.entries(a))if(C.length===1){let _=C[0],R=_.channelId;s[R]=s[R]||{},s[R][x]=Da(_.payload,!1,!1,e,[x],r,e.namespace)}else{u.push(x);for(let{channelId:_,payload:R}of C){let U=`${_}_${x}`;s[_]||(s[_]={}),s[_][U]=Da(R,!1,!1,e,[U],r,e.namespace)}}let p={},d=sG();for(let[x,C]of Object.entries(s))for(let[_,R]of Object.entries(C)){let U=d.getUniqueSchemaId(_,e.logger,e.options.resolveSchemaCollisions);p[U]=R}let f=new UUe({...o,...p},e),m={};for(let[x,C]of Object.entries(i.servers??{})){let _=jr(C,tb.FERN_SERVER_NAME);m[x]={name:_??x,url:cYt(C.protocol,C.host)}}let h={},g=Object.keys(i.channels??{});for(let[x,C]of Object.entries(i.operations??{})){if(jr(C,tb.IGNORE))continue;let _;if(C.channel==null||!("$ref"in C.channel)||C.channel.$ref==null)if(g.length===1&&g[0]!=null)_=g[0];else continue;else _=Qjc(C);h[_]||(h[_]={subscribe:[],publish:[],__parsedMessages:[]});let R=jr(C,tb.FERN_SDK_METHOD_NAME);if(!C.messages||!Array.isArray(C.messages))continue;let U=C.messages.filter(z=>z!=null&&z.$ref!=null).map(z=>({ref:z,methodName:R})),q=h[_];if(q==null)throw new Error(`Internal error: channelEvents["${_}"] is unexpectedly undefined for operation ${x}`);if(C.action==="receive")q.subscribe.push(...U);else if(C.action==="send")q.publish.push(...U);else throw new Error(`Operation ${x} has an invalid action: ${C.action}`)}for(let[x,C]of Object.entries(h)){let _=[];_.push(...yXo({messages:C.subscribe,channelPath:x,origin:"server",messageSchemas:s[x]??{},duplicatedMessageIds:u,context:e})),_.push(...yXo({messages:C.publish,channelPath:x,origin:"client",messageSchemas:s[x]??{},duplicatedMessageIds:u,context:e})),h[x]!=null&&(h[x].__parsedMessages=_)}for(let[x,C]of Object.entries(i.channels??{})){if(jr(C,tb.IGNORE))continue;let _=[],R=[],U=[];if(C.parameters!=null)for(let[q,z]of Object.entries(C.parameters)){let J=e.isReferenceObject(z)?e.resolveParameterReference(z):z,{type:ie,parameterKey:V}=J.location!=null?Njc(J.location):{type:C.address?.includes(`={${q}}`)?"query":"path",parameterKey:q},H=jr(J,tb.FERN_PARAMETER_OPTIONAL),ye=Xu(zn(x))+Xu(zn(q)),Ie=J.schema!=null?jn(J.schema)?oQ(J.schema,!1,!1,e,[V],void 0,r,e.namespace):Da(J.schema,!1,!1,e,[V],r,e.namespace):Da({...J,type:"string",title:ye,example:J.examples?.[0],default:J.default,enum:J.enum,required:void 0},!1,!1,e,[V],r,e.namespace),K=H?kr.optional({value:Ie,description:void 0,availability:void 0,generatedName:"",title:ye,namespace:void 0,groupName:void 0,nameOverride:void 0,inline:void 0}):Ie,Y={name:V,description:J.description,parameterNameOverride:void 0,schema:K,variableReference:void 0,availability:cv(z),source:r,explode:void 0};ie==="header"?_.push({...Y,env:void 0}):ie==="path"?R.push(Y):(ie==="payload"||ie==="query")&&U.push(Y)}if(C.bindings?.ws?.query!=null){let q=new Set(U.map(J=>J.name)),z=new Set(C.bindings.ws.query.required??[]);for(let[J,ie]of Object.entries(C.bindings.ws.query.properties??{})){if(q.has(J))continue;if(jn(ie)){let Ie=e.resolveSchemaReference(ie),K=z.has(J),[Y,ge]=e.options.coerceOptionalSchemasToNullable?[!1,!K]:[!K,!1];U.push({name:J,schema:oQ(ie,Y,ge,e,[x,J],void 0,r,e.namespace),description:Ie.description,parameterNameOverride:void 0,availability:cv(Ie),source:r,explode:void 0});continue}let V=z.has(J),[H,ye]=e.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1];U.push({name:J,schema:Da(ie,H,ye,e,[x,J],r,e.namespace),description:ie.description,parameterNameOverride:void 0,availability:cv(ie),source:r,explode:void 0})}}if(C.bindings?.ws?.headers!=null){let q=new Set(_.map(J=>J.name)),z=new Set(C.bindings.ws.headers.required??[]);for(let[J,ie]of Object.entries(C.bindings.ws.headers.properties??{})){if(q.has(J))continue;if(jn(ie)){let Ie=e.resolveSchemaReference(ie),K=z.has(J),[Y,ge]=e.options.coerceOptionalSchemasToNullable?[!1,!K]:[!K,!1];_.push({name:J,schema:oQ(ie,Y,ge,e,[x,J],void 0,r,e.namespace),description:Ie.description,parameterNameOverride:void 0,env:void 0,availability:cv(Ie),source:r});continue}let V=z.has(J),[H,ye]=e.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1];_.push({name:J,schema:Da(ie,H,ye,e,[x,J],r,e.namespace),description:ie.description,parameterNameOverride:void 0,env:void 0,availability:cv(ie),source:r})}}if(_.length>0||U.length>0||h[x]!=null&&(h[x].publish!=null||h[x].subscribe!=null)){let q=uYt(C),z=h[x]?.__parsedMessages??[],J=[];try{if(q.length>0)J=f.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:q,handshake:{headers:_,queryParameters:U},source:r,namespace:e.namespace});else{let Ie=[],{examplePublishMessage:K,exampleSubscribeMessage:Y}=Mjc({messages:z,messageSchemas:s[x]??{}});K!=null&&Ie.push(K),Y!=null&&Ie.push(Y);let ge=f.buildWebsocketSessionExample({handshake:{headers:_,queryParameters:U},messages:Ie});ge!=null&&J.push(ge)}}catch(Ie){e.logger.warn(`Failed to build examples for channel ${x}: ${xi(Ie)}`)}let ie=jr(C,tb.FERN_SDK_GROUP_NAME),V=jr(C,tb.FERN_SDK_METHOD_NAME),H=(C.servers?.map(Ie=>jjc(m,Ie))??Object.values(m)).map(Ie=>({...Ie,name:Ie.name})),ye=C.address?.split("?")[0]??lYt(x);c[x]={audiences:jr(C,En.AUDIENCES)??[],handshake:{headers:_.map(Ie=>({...Ie,schema:mf(Ie.schema),env:Ie.env})),queryParameters:U.map(Ie=>({...Ie,schema:mf(Ie.schema)})),pathParameters:R.map(Ie=>({...Ie,parameterNameOverride:void 0,schema:mf(Ie.schema)}))},groupName:e.resolveGroupName(typeof ie=="string"?[ie]:ie??[x]),messages:z,summary:jr(C,tb.FERN_DISPLAY_NAME),connectMethodName:V,servers:H,path:ye,description:C.description,examples:J,source:r}}else e.logger.warn(`Skipping AsyncAPI channel ${x} as it does not qualify for inclusion (no headers, query params, or operations)`)}let A={...o,...p},b={},v=sG();for(let[x,C]of Object.entries(A)){let _=v.getUniqueSchemaId(x,e.logger,e.options.resolveSchemaCollisions);b[_]=mf(C)}let E=MUe(e.namespace,o),I=Object.values(m).map(x=>({...x,name:x.name})),w=jr(i,tb.BASE_PATH);return{groupedSchemas:E,channels:c,servers:I,basePath:w}}function kjc(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Qjc(e){if(!e.channel)throw new Error("Operation is missing required 'channel' field");if(!e.channel.$ref)throw new Error("Operation channel is missing required '$ref' field");if(!e.channel.$ref.startsWith(gXo))throw new Error(`Failed to resolve channel path from operation ${e.channel.$ref}`);return kjc(e.channel.$ref.substring(gXo.length))}function Njc(e){try{let[t,r]=e.split("#/");if(t==null||r==null)throw new Error(`Invalid location format: ${e}; unable to parse message type and parameter key`);if(!t.startsWith(JKn))throw new Error(`Invalid location format: ${e}; expected ${JKn} prefix`);let n=t.substring(JKn.length);if(n!=="header"&&n!=="path"&&n!=="payload")throw new Error(`Invalid message type: ${n}. Must be one of: header, path, payload`);return{type:n,parameterKey:r}}catch{throw new Error(`Invalid location format: ${e}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`)}}function jjc(e,t){if(!t.$ref.startsWith(AXo))throw new Error(`Failed to resolve server name from server ref ${t.$ref}`);let r=t.$ref.substring(AXo.length),n=e[r];if(n==null)throw new Error(`Failed to find server with name ${r}`);return n}function yXo({messages:e,channelPath:t,origin:r,messageSchemas:n,duplicatedMessageIds:i,context:o}){let s=[];return e.forEach((a,u)=>{try{let l=o.resolveMessageReference(a.ref,!0).name;i.includes(l)&&(l=`${t}_${l}`);let p=n[l];p!=null&&s.push({origin:r,name:l??`${r}Message${u+1}`,body:mf(p),methodName:a.methodName})}catch(c){o.logger.warn(`Skipping message reference ${a.ref.$ref} in channel ${t}: ${xi(c)}`)}}),s}function Mjc({messages:e,messageSchemas:t}){let r=e.find(s=>s.origin==="client")?.name,n=e.find(s=>s.origin==="server")?.name,i=r!=null?t[r]:void 0,o=n!=null?t[n]:void 0;return{examplePublishMessage:i!=null&&r!=null?{type:r,payload:i}:void 0,exampleSubscribeMessage:o!=null&&n!=null?{type:n,payload:o}:void 0}}function EXo({document:e,taskContext:t,options:r,source:n,asyncApiOptions:i,namespace:o}){let s=[];if(o!=null&&s.push(o),parseFloat(e.asyncapi)<3){let a=e;a.tags?.[0]!=null?s.push(a.tags[0].name):i.naming!=="v2"&&s.push("websocket");let u=new oYt({document:a,taskContext:t,options:r,namespace:o});return hXo({context:u,breadcrumbs:s,source:n,asyncApiOptions:i,document:a})}else{let a=e,u=new pYt({document:a,taskContext:t,options:r,namespace:o});return bXo({context:u,breadcrumbs:s,source:n,asyncApiOptions:i,document:a})}}St();Ci();Ci();function vXo(e){return jr(e,En.ASYNC_CONFIG)}var IXo="$request.";function wXo(e){let t=jr(e,En.STREAMING);if(t!=null)return typeof t=="boolean"?t?{type:"stream",format:"json",terminator:void 0}:void 0:t["stream-condition"]==null&&t.format!=null?{type:"stream",format:t.format,terminator:t.terminator}:{type:"streamCondition",format:t.format??"json",terminator:t.terminator,streamDescription:t["stream-description"],streamConditionProperty:Ljc(t["stream-condition"]),streamRequestName:t["stream-request-name"],responseStream:t["response-stream"],response:t.response}}function Ljc(e){return e.startsWith(IXo)?e.slice(IXo.length):e}function CXo(e){let t=e;if(t.cursor!=null)return xI.cursor({cursor:t.cursor,nextCursor:t.next_cursor,results:t.results});let r=e;if("next_uri"in r)return xI.uri({nextUri:r.next_uri,results:r.results});let n=e;if("next_path"in n)return xI.path({nextPath:n.next_path,results:n.results});if("offset"in e){let i=e;return xI.offset({offset:i.offset,results:i.results,step:i.step,hasNextPage:i["has-next-page"]})}if("type"in e&&e.type==="custom"){let i=e;return xI.custom({results:i.results})}throw new Error("Invalid pagination extension")}function xXo(e,t){let r=jr(t,En.PAGINATION);if(r!=null){if(typeof r=="boolean"){let n=jr(e,En.PAGINATION);if(typeof n=="boolean")throw new Error("Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.");return n==null?void 0:CXo(n)}return CXo(r)}}function _Xo(e,t){for(let r of Object.keys(e))if(r.includes("text/event-stream")){let n=e[r];if(n==null)continue;let i=n,o=n.schema??i.itemSchema;return{contentType:r,schema:o??{},examples:zUe(n,t)}}}function SXo(e){let t=Object.keys(e);return t.length===1&&t[0]!=null&&t[0].includes("text/event-stream")}function Ujc(e){return e.includes("json")||e==="*/*"}function YKn({content:e,context:t}){for(let[r,n]of Object.entries(e))if(fYt({mediaType:r,mediaTypeObject:n,context:t})!=null)return[r,n]}function fYt({mediaType:e,mediaTypeObject:t,context:r}){if(!Ujc(e))return;let n=t.schema;return{contentType:e.includes("*")?void 0:e,schema:n??{},examples:zUe(t,r)}}function dYt({content:e,context:t}){let r=YKn({content:e,context:t});if(!r)return;let[n,i]=r;return fYt({mediaType:n,mediaTypeObject:i,context:t})}function BXo(e,t){for(let r of Object.keys(e)){let n=e[r];if(n==null)continue;return{schema:n.schema??{},examples:zUe(n,t)}}}function zUe(e,t){let r=[];e.example!=null&&r.push({name:void 0,value:e.example,description:void 0});let n=jr(e,A_.EXAMPLES);return n!=null&&Object.keys(n).length>0&&r.push(...Object.entries(n).map(([i,o])=>({name:o.summary??i,value:o.value,description:o.description}))),e.examples!=null&&Object.keys(e.examples).length>0&&r.push(...Object.entries(e.examples).map(([i,o])=>{let s=jn(o)?t.resolveExampleReference(o):o;return{name:s.summary??i,value:s.value,description:s.description}})),r}St();St();function OXo(e){let t=zjc(e),r={};return XKn({obj:t,occurrences:r,breadcrumbs:[]}),r}function XKn({obj:e,occurrences:t,breadcrumbs:r}){if(e!=null){if(Array.isArray(e)){for(let n of e)XKn({obj:n,occurrences:t,breadcrumbs:r});return}if(typeof e=="object"){if(e.$ref!=null&&typeof e.$ref=="string"){let n=e.$ref;t[n]==null?t[n]=1:t[n]+=1;return}for(let n in e)XKn({obj:e[n],occurrences:t,breadcrumbs:[...r,n]})}}}function zjc(e){return{...e,paths:Object.fromEntries(Object.entries(e.paths??{}).map(([t,r])=>[t,{...r,get:r?.get!=null?fht(r.get):void 0,put:r?.put!=null?fht(r.put):void 0,post:r?.post!=null?fht(r.post):void 0,patch:r?.patch!=null?fht(r.patch):void 0,delete:r?.delete!=null?fht(r.delete):void 0}]))}}function fht(e){return{...e,requestBody:e.requestBody!=null?jn(e.requestBody)?e.requestBody:Vjc(e.requestBody):void 0}}function Vjc(e){let t,r;for(let n in e.content){let i=Wp.parse(n);i!=null&&(i.isJSON()?t=e.content[n]:i.isMultipart()&&(r=e.content[n]))}return r!=null&&t!=null?{...e,content:{[Wp.MULTIPART_FORM_DATA]:r}}:e}var mYt=class{endpoints;parser=new kre;constructor({context:t,options:r}){this.endpoints=r.filter?.endpoints?new Set(this.validateAndFilterEndpoints({context:t,endpoints:r.filter.endpoints})):void 0}skipEndpoint({method:t,path:r}){return this.endpoints!=null&&!this.endpoints.has(`${t} ${r}`)}hasEndpoints(){return this.endpoints!=null}validateAndFilterEndpoints({context:t,endpoints:r}){let n=[];for(let i of r){let o=this.parser.tryParse(i);if(o==null){t.logger.debug(`Ignoring configured filter endpoint "${i}"; expected format "POST /users/get"`);continue}n.push(`${o.method} ${o.path}`)}return n}};var PXo="#/components/parameters/",TXo="#/components/responses/",DXo="#/components/examples/",RXo="#/components/requestBodies/",FXo="#/components/securitySchemes/",VUe=class{logger;document;taskContext;authHeaders;refOccurrences;DUMMY;options;source;filter;namespace;schemaNamespaceMapping;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s}){this.document=t,this.logger=r.logger,this.taskContext=r,this.authHeaders=n,this.refOccurrences=OXo(t),this.options=i,this.source=o,this.filter=new mYt({context:r,options:i}),this.DUMMY=this.getDummy(),this.namespace=s,this.schemaNamespaceMapping=this.buildSchemaNamespaceMapping()}getNumberOfOccurrencesForRef(t){return this.refOccurrences[t.$ref]??0}resolveTagsToTagIds(t){let r=[];return this.namespace!=null&&r.push(this.namespace),r.concat(t??[])}resolveTags(t){let r=[];if(this.namespace!=null){let n={type:"namespace",name:this.namespace};r.push(n)}return r.concat(t??[])}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveSchemaReference(t){let r=t.$ref.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return{"x-fern-type":"unknown"};if(Array.isArray(n)){let o=parseInt(i,10);if(isNaN(o)||o<0||o>=n.length)return{"x-fern-type":"unknown"};n=n[o]}else n=n[i]}return n==null?(this.logger.debug(`Encountered undefined reference: ${t.$ref}`),{"x-fern-type":"unknown"}):(jn(n)&&(n=this.resolveSchemaReference(n)),n)}resolveParameterReference(t){if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(PXo))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(PXo.length),n=this.document.components.parameters[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return jn(n)?this.resolveParameterReference(n):n}resolveRequestBodyReference(t){if(this.document.components==null||this.document.components.requestBodies==null||!t.$ref.startsWith(RXo))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(RXo.length),n=this.document.components.requestBodies[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return jn(n)?this.resolveRequestBodyReference(n):n}resolveResponseReference(t){if(this.document.components==null||this.document.components.responses==null||!t.$ref.startsWith(TXo))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(TXo.length),n=this.document.components.responses[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return jn(n)?this.resolveResponseReference(n):n}resolveExampleReference(t){if(this.document.components==null||this.document.components.examples==null||!t.$ref.startsWith(DXo))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(DXo.length),n=this.document.components.examples[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return jn(n)?this.resolveExampleReference(n):n}resolveSecuritySchemeReference(t){if(this.document.components==null||this.document.components.securitySchemes==null||!t.$ref.startsWith(FXo))throw new Error(`Failed to resolve ${t.$ref}`);let r=t.$ref.substring(FXo.length),n=this.document.components.securitySchemes[r];if(n==null)throw new Error(`${t.$ref} is undefined`);return jn(n)?this.resolveSecuritySchemeReference(n):n}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}getNamespace(t){return this.schemaNamespaceMapping?.get(t)}buildSchemaNamespaceMapping(){let t=new Map;if(!this.document.components?.schemas)return t;for(let[r,n]of Object.entries(this.document.components.schemas))!n||jn(n)||t.set(r,jr(n,En.SDK_NAMESPACE)||this.namespace);return t}};var O_e=class extends VUe{constructor({document:t,taskContext:r,options:n,source:i,namespace:o}){super({document:t,taskContext:r,authHeaders:new Set,options:n,source:i,namespace:o})}getDummy(){return this}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}getReferencedSchemas(){return new Set}markReferencedByDiscriminatedUnion(t,r,n){}getReferencesFromDiscriminatedUnion(t){}excludeSchema(t){}isSchemaExcluded(t){return!1}markSchemaWithDiscriminantValue(t,r,n){}getDiscriminatedUnionMetadata(t){}};St();var EYt=require("fs"),vYt=require("path");var mt={};X(mt,{BRAND:()=>hMc,DIRTY:()=>P_e,EMPTY_PATH:()=>$jc,INVALID:()=>ru,NEVER:()=>ZMc,OK:()=>wS,ParseStatus:()=>y_,Schema:()=>Ml,ZodAny:()=>Qpe,ZodArray:()=>gne,ZodBigInt:()=>D_e,ZodBoolean:()=>R_e,ZodBranded:()=>mht,ZodCatch:()=>q_e,ZodDate:()=>F_e,ZodDefault:()=>V_e,ZodDiscriminatedUnion:()=>AYt,ZodEffects:()=>AM,ZodEnum:()=>U_e,ZodError:()=>XD,ZodFirstPartyTypeKind:()=>Pu,ZodFunction:()=>bYt,ZodIntersection:()=>j_e,ZodIssueCode:()=>an,ZodLazy:()=>M_e,ZodLiteral:()=>L_e,ZodMap:()=>KUe,ZodNaN:()=>YUe,ZodNativeEnum:()=>z_e,ZodNever:()=>a8,ZodNull:()=>Q_e,ZodNullable:()=>lG,ZodNumber:()=>T_e,ZodObject:()=>ZD,ZodOptional:()=>hM,ZodParsedType:()=>zo,ZodPipeline:()=>hht,ZodPromise:()=>Npe,ZodReadonly:()=>G_e,ZodRecord:()=>yYt,ZodSchema:()=>Ml,ZodSet:()=>JUe,ZodString:()=>kpe,ZodSymbol:()=>$Ue,ZodTransformer:()=>AM,ZodTuple:()=>cG,ZodType:()=>Ml,ZodUndefined:()=>k_e,ZodUnion:()=>N_e,ZodUnknown:()=>hne,ZodVoid:()=>HUe,addIssueToContext:()=>po,any:()=>CMc,array:()=>BMc,bigint:()=>bMc,boolean:()=>GXo,coerce:()=>XMc,custom:()=>zXo,date:()=>EMc,datetimeRegex:()=>LXo,defaultErrorMap:()=>dne,discriminatedUnion:()=>DMc,effect:()=>qMc,enum:()=>UMc,function:()=>jMc,getErrorMap:()=>qUe,getParsedType:()=>uG,instanceof:()=>AMc,intersection:()=>RMc,isAborted:()=>hYt,isAsync:()=>GUe,isDirty:()=>gYt,isValid:()=>Fpe,late:()=>gMc,lazy:()=>MMc,literal:()=>LMc,makeIssue:()=>dht,map:()=>QMc,nan:()=>yMc,nativeEnum:()=>zMc,never:()=>_Mc,null:()=>wMc,nullable:()=>WMc,number:()=>qXo,object:()=>OMc,objectUtil:()=>ZKn,oboolean:()=>YMc,onumber:()=>JMc,optional:()=>GMc,ostring:()=>KMc,pipeline:()=>HMc,preprocess:()=>$Mc,promise:()=>VMc,quotelessJson:()=>qjc,record:()=>kMc,set:()=>NMc,setErrorMap:()=>Wjc,strictObject:()=>PMc,string:()=>VXo,symbol:()=>vMc,transformer:()=>qMc,tuple:()=>FMc,undefined:()=>IMc,union:()=>TMc,unknown:()=>xMc,util:()=>vp,void:()=>SMc});var vp;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(vp||(vp={}));var ZKn;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(ZKn||(ZKn={}));var zo=vp.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),uG=e=>{switch(typeof e){case"undefined":return zo.undefined;case"string":return zo.string;case"number":return Number.isNaN(e)?zo.nan:zo.number;case"boolean":return zo.boolean;case"function":return zo.function;case"bigint":return zo.bigint;case"symbol":return zo.symbol;case"object":return Array.isArray(e)?zo.array:e===null?zo.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?zo.promise:typeof Map<"u"&&e instanceof Map?zo.map:typeof Set<"u"&&e instanceof Set?zo.set:typeof Date<"u"&&e instanceof Date?zo.date:zo.object;default:return zo.unknown}};var an=vp.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"]),qjc=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),XD=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(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,u=0;for(;u<s.path.length;){let c=s.path[u];u===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],u++}}};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,vp.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 o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};XD.create=e=>new XD(e);var Gjc=(e,t)=>{let r;switch(e.code){case an.invalid_type:e.received===zo.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case an.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,vp.jsonStringifyReplacer)}`;break;case an.unrecognized_keys:r=`Unrecognized key(s) in object: ${vp.joinValues(e.keys,", ")}`;break;case an.invalid_union:r="Invalid input";break;case an.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${vp.joinValues(e.options)}`;break;case an.invalid_enum_value:r=`Invalid enum value. Expected ${vp.joinValues(e.options)}, received '${e.received}'`;break;case an.invalid_arguments:r="Invalid function arguments";break;case an.invalid_return_type:r="Invalid function return type";break;case an.invalid_date:r="Invalid date";break;case an.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}"`:vp.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case an.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 an.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 an.custom:r="Invalid input";break;case an.invalid_intersection_types:r="Intersection results could not be merged";break;case an.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case an.not_finite:r="Number must be finite";break;default:r=t.defaultError,vp.assertNever(e)}return{message:r}},dne=Gjc;var kXo=dne;function Wjc(e){kXo=e}function qUe(){return kXo}var dht=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",u=n.filter(c=>!!c).slice().reverse();for(let c of u)a=c(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},$jc=[];function po(e,t){let r=qUe(),n=dht({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===dne?void 0:dne].filter(i=>!!i)});e.common.issues.push(n)}var y_=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 ru;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 o=await i.key,s=await i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ru;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},ru=Object.freeze({status:"aborted"}),P_e=e=>({status:"dirty",value:e}),wS=e=>({status:"valid",value:e}),hYt=e=>e.status==="aborted",gYt=e=>e.status==="dirty",Fpe=e=>e.status==="valid",GUe=e=>typeof Promise<"u"&&e instanceof Promise;var ea;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ea||(ea={}));var gM=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}},QXo=(e,t)=>{if(Fpe(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 XD(e.common.issues);return this._error=r,this._error}}};function hl(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:(s,a)=>{let{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:u??r??a.defaultError}},description:i}}var Ml=class{get description(){return this._def.description}_getType(t){return uG(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:uG(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new y_,ctx:{common:t.parent.common,data:t.data,parsedType:uG(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(GUe(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:uG(t)},i=this._parseSync({data:t,path:n.path,parent:n});return QXo(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:uG(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Fpe(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=>Fpe(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:uG(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(GUe(i)?i:Promise.resolve(i));return QXo(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:an.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(a(),!1)):s?!0:(a(),!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 AM({schema:this,typeName:Pu.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 hM.create(this,this._def)}nullable(){return lG.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gne.create(this)}promise(){return Npe.create(this,this._def)}or(t){return N_e.create([this,t],this._def)}and(t){return j_e.create(this,t,this._def)}transform(t){return new AM({...hl(this._def),schema:this,typeName:Pu.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new V_e({...hl(this._def),innerType:this,defaultValue:r,typeName:Pu.ZodDefault})}brand(){return new mht({typeName:Pu.ZodBranded,type:this,...hl(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new q_e({...hl(this._def),innerType:this,catchValue:r,typeName:Pu.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return hht.create(this,t)}readonly(){return G_e.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Hjc=/^c[^\s-]{8,}$/i,Kjc=/^[0-9a-z]+$/,Jjc=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Yjc=/^[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,Xjc=/^[a-z0-9_-]{21}$/i,Zjc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,eMc=/^[-+]?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)?)??$/,tMc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rMc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",eJn,nMc=/^(?:(?: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])$/,iMc=/^(?:(?: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])$/,oMc=/^(([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]))$/,sMc=/^(([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])$/,aMc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,uMc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jXo="((\\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])))",cMc=new RegExp(`^${jXo}$`);function MXo(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 lMc(e){return new RegExp(`^${MXo(e)}$`)}function LXo(e){let t=`${jXo}T${MXo(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 pMc(e,t){return!!((t==="v4"||!t)&&nMc.test(e)||(t==="v6"||!t)&&oMc.test(e))}function fMc(e,t){if(!Zjc.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 dMc(e,t){return!!((t==="v4"||!t)&&iMc.test(e)||(t==="v6"||!t)&&sMc.test(e))}var kpe=class e extends Ml{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==zo.string){let o=this._getOrReturnCtx(t);return po(o,{code:an.invalid_type,expected:zo.string,received:o.parsedType}),ru}let n=new y_,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),po(i,{code:an.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),po(i,{code:an.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?po(i,{code:an.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&po(i,{code:an.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")tMc.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"email",code:an.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")eJn||(eJn=new RegExp(rMc,"u")),eJn.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"emoji",code:an.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")Yjc.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"uuid",code:an.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Xjc.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"nanoid",code:an.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Hjc.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"cuid",code:an.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")Kjc.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"cuid2",code:an.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")Jjc.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"ulid",code:an.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),po(i,{validation:"url",code:an.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"regex",code:an.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),po(i,{code:an.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),po(i,{code:an.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),po(i,{code:an.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?LXo(o).test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{code:an.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?cMc.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{code:an.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?lMc(o).test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{code:an.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?eMc.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"duration",code:an.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?pMc(t.data,o.version)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"ip",code:an.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?fMc(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"jwt",code:an.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?dMc(t.data,o.version)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"cidr",code:an.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?aMc.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"base64",code:an.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?uMc.test(t.data)||(i=this._getOrReturnCtx(t,i),po(i,{validation:"base64url",code:an.invalid_string,message:o.message}),n.dirty()):vp.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:an.invalid_string,...ea.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ea.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ea.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ea.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ea.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ea.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ea.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ea.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ea.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ea.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ea.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ea.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ea.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ea.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,...ea.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,...ea.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ea.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...ea.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...ea.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...ea.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...ea.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...ea.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...ea.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...ea.errToObj(r)})}nonempty(t){return this.min(1,ea.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}};kpe.create=e=>new kpe({checks:[],typeName:Pu.ZodString,coerce:e?.coerce??!1,...hl(e)});function mMc(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}var T_e=class e extends Ml{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)!==zo.number){let o=this._getOrReturnCtx(t);return po(o,{code:an.invalid_type,expected:zo.number,received:o.parsedType}),ru}let n,i=new y_;for(let o of this._def.checks)o.kind==="int"?vp.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),po(n,{code:an.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),po(n,{code:an.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),po(n,{code:an.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?mMc(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),po(n,{code:an.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),po(n,{code:an.not_finite,message:o.message}),i.dirty()):vp.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,ea.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ea.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ea.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ea.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ea.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ea.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ea.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ea.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ea.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ea.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ea.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:ea.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ea.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ea.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"&&vp.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)}};T_e.create=e=>new T_e({checks:[],typeName:Pu.ZodNumber,coerce:e?.coerce||!1,...hl(e)});var D_e=class e extends Ml{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)!==zo.bigint)return this._getInvalidInput(t);let n,i=new y_;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),po(n,{code:an.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),po(n,{code:an.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),po(n,{code:an.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):vp.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return po(r,{code:an.invalid_type,expected:zo.bigint,received:r.parsedType}),ru}gte(t,r){return this.setLimit("min",t,!0,ea.toString(r))}gt(t,r){return this.setLimit("min",t,!1,ea.toString(r))}lte(t,r){return this.setLimit("max",t,!0,ea.toString(r))}lt(t,r){return this.setLimit("max",t,!1,ea.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:ea.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:ea.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ea.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ea.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ea.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:ea.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}};D_e.create=e=>new D_e({checks:[],typeName:Pu.ZodBigInt,coerce:e?.coerce??!1,...hl(e)});var R_e=class extends Ml{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==zo.boolean){let n=this._getOrReturnCtx(t);return po(n,{code:an.invalid_type,expected:zo.boolean,received:n.parsedType}),ru}return wS(t.data)}};R_e.create=e=>new R_e({typeName:Pu.ZodBoolean,coerce:e?.coerce||!1,...hl(e)});var F_e=class e extends Ml{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==zo.date){let o=this._getOrReturnCtx(t);return po(o,{code:an.invalid_type,expected:zo.date,received:o.parsedType}),ru}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return po(o,{code:an.invalid_date}),ru}let n=new y_,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),po(i,{code:an.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),po(i,{code:an.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):vp.assertNever(o);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:ea.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:ea.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}};F_e.create=e=>new F_e({checks:[],coerce:e?.coerce||!1,typeName:Pu.ZodDate,...hl(e)});var $Ue=class extends Ml{_parse(t){if(this._getType(t)!==zo.symbol){let n=this._getOrReturnCtx(t);return po(n,{code:an.invalid_type,expected:zo.symbol,received:n.parsedType}),ru}return wS(t.data)}};$Ue.create=e=>new $Ue({typeName:Pu.ZodSymbol,...hl(e)});var k_e=class extends Ml{_parse(t){if(this._getType(t)!==zo.undefined){let n=this._getOrReturnCtx(t);return po(n,{code:an.invalid_type,expected:zo.undefined,received:n.parsedType}),ru}return wS(t.data)}};k_e.create=e=>new k_e({typeName:Pu.ZodUndefined,...hl(e)});var Q_e=class extends Ml{_parse(t){if(this._getType(t)!==zo.null){let n=this._getOrReturnCtx(t);return po(n,{code:an.invalid_type,expected:zo.null,received:n.parsedType}),ru}return wS(t.data)}};Q_e.create=e=>new Q_e({typeName:Pu.ZodNull,...hl(e)});var Qpe=class extends Ml{constructor(){super(...arguments),this._any=!0}_parse(t){return wS(t.data)}};Qpe.create=e=>new Qpe({typeName:Pu.ZodAny,...hl(e)});var hne=class extends Ml{constructor(){super(...arguments),this._unknown=!0}_parse(t){return wS(t.data)}};hne.create=e=>new hne({typeName:Pu.ZodUnknown,...hl(e)});var a8=class extends Ml{_parse(t){let r=this._getOrReturnCtx(t);return po(r,{code:an.invalid_type,expected:zo.never,received:r.parsedType}),ru}};a8.create=e=>new a8({typeName:Pu.ZodNever,...hl(e)});var HUe=class extends Ml{_parse(t){if(this._getType(t)!==zo.undefined){let n=this._getOrReturnCtx(t);return po(n,{code:an.invalid_type,expected:zo.void,received:n.parsedType}),ru}return wS(t.data)}};HUe.create=e=>new HUe({typeName:Pu.ZodVoid,...hl(e)});var gne=class e extends Ml{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==zo.array)return po(r,{code:an.invalid_type,expected:zo.array,received:r.parsedType}),ru;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(po(r,{code:s?an.too_big:an.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?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&&(po(r,{code:an.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&&(po(r,{code:an.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((s,a)=>i.type._parseAsync(new gM(r,s,r.path,a)))).then(s=>y_.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new gM(r,s,r.path,a)));return y_.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:ea.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:ea.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:ea.toString(r)}})}nonempty(t){return this.min(1,t)}};gne.create=(e,t)=>new gne({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pu.ZodArray,...hl(t)});function WUe(e){if(e instanceof ZD){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=hM.create(WUe(n))}return new ZD({...e._def,shape:()=>t})}else return e instanceof gne?new gne({...e._def,type:WUe(e.element)}):e instanceof hM?hM.create(WUe(e.unwrap())):e instanceof lG?lG.create(WUe(e.unwrap())):e instanceof cG?cG.create(e.items.map(t=>WUe(t))):e}var ZD=class e extends Ml{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=vp.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==zo.object){let c=this._getOrReturnCtx(t);return po(c,{code:an.invalid_type,expected:zo.object,received:c.parsedType}),ru}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof a8&&this._def.unknownKeys==="strip"))for(let c in i.data)s.includes(c)||a.push(c);let u=[];for(let c of s){let l=o[c],p=i.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new gM(i,p,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof a8){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of a)u.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(c==="strict")a.length>0&&(po(i,{code:an.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of a){let p=i.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new gM(i,p,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let l of u){let p=await l.key,d=await l.value;c.push({key:p,value:d,alwaysSet:l.alwaysSet})}return c}).then(c=>y_.mergeObjectSync(n,c)):y_.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return ea.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:ea.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:Pu.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 vp.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 vp.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return WUe(this)}partial(t){let r={};for(let n of vp.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 vp.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof hM;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return UXo(vp.objectKeys(this.shape))}};ZD.create=(e,t)=>new ZD({shape:()=>e,unknownKeys:"strip",catchall:a8.create(),typeName:Pu.ZodObject,...hl(t)});ZD.strictCreate=(e,t)=>new ZD({shape:()=>e,unknownKeys:"strict",catchall:a8.create(),typeName:Pu.ZodObject,...hl(t)});ZD.lazycreate=(e,t)=>new ZD({shape:e,unknownKeys:"strip",catchall:a8.create(),typeName:Pu.ZodObject,...hl(t)});var N_e=class extends Ml{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new XD(a.ctx.common.issues));return po(r,{code:an.invalid_union,unionErrors:s}),ru}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let u of n){let c={...r,common:{...r.common,issues:[]},parent:null},l=u._parseSync({data:r.data,path:r.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(u=>new XD(u));return po(r,{code:an.invalid_union,unionErrors:a}),ru}}get options(){return this._def.options}};N_e.create=(e,t)=>new N_e({options:e,typeName:Pu.ZodUnion,...hl(t)});var mne=e=>e instanceof M_e?mne(e.schema):e instanceof AM?mne(e.innerType()):e instanceof L_e?[e.value]:e instanceof U_e?e.options:e instanceof z_e?vp.objectValues(e.enum):e instanceof V_e?mne(e._def.innerType):e instanceof k_e?[void 0]:e instanceof Q_e?[null]:e instanceof hM?[void 0,...mne(e.unwrap())]:e instanceof lG?[null,...mne(e.unwrap())]:e instanceof mht||e instanceof G_e?mne(e.unwrap()):e instanceof q_e?mne(e._def.innerType):[],AYt=class e extends Ml{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==zo.object)return po(r,{code:an.invalid_type,expected:zo.object,received:r.parsedType}),ru;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(po(r,{code:an.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ru)}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 o of r){let s=mne(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:Pu.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...hl(n)})}};function tJn(e,t){let r=uG(e),n=uG(t);if(e===t)return{valid:!0,data:e};if(r===zo.object&&n===zo.object){let i=vp.objectKeys(t),o=vp.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let u=tJn(e[a],t[a]);if(!u.valid)return{valid:!1};s[a]=u.data}return{valid:!0,data:s}}else if(r===zo.array&&n===zo.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],u=tJn(s,a);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return r===zo.date&&n===zo.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var j_e=class extends Ml{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(hYt(o)||hYt(s))return ru;let a=tJn(o.value,s.value);return a.valid?((gYt(o)||gYt(s))&&r.dirty(),{status:r.value,value:a.data}):(po(n,{code:an.invalid_intersection_types}),ru)};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(([o,s])=>i(o,s)):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}))}};j_e.create=(e,t,r)=>new j_e({left:e,right:t,typeName:Pu.ZodIntersection,...hl(r)});var cG=class e extends Ml{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==zo.array)return po(n,{code:an.invalid_type,expected:zo.array,received:n.parsedType}),ru;if(n.data.length<this._def.items.length)return po(n,{code:an.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ru;!this._def.rest&&n.data.length>this._def.items.length&&(po(n,{code:an.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new gM(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>y_.mergeArray(r,s)):y_.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};cG.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new cG({items:e,typeName:Pu.ZodTuple,rest:null,...hl(t)})};var yYt=class e extends Ml{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!==zo.object)return po(n,{code:an.invalid_type,expected:zo.object,received:n.parsedType}),ru;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new gM(n,a,n.path,a)),value:s._parse(new gM(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?y_.mergeObjectAsync(r,i):y_.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Ml?new e({keyType:t,valueType:r,typeName:Pu.ZodRecord,...hl(n)}):new e({keyType:kpe.create(),valueType:t,typeName:Pu.ZodRecord,...hl(r)})}},KUe=class extends Ml{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!==zo.map)return po(n,{code:an.invalid_type,expected:zo.map,received:n.parsedType}),ru;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,u],c)=>({key:i._parse(new gM(n,a,n.path,[c,"key"])),value:o._parse(new gM(n,u,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of s){let c=await u.key,l=await u.value;if(c.status==="aborted"||l.status==="aborted")return ru;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(c.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let u of s){let c=u.key,l=u.value;if(c.status==="aborted"||l.status==="aborted")return ru;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(c.value,l.value)}return{status:r.value,value:a}}}};KUe.create=(e,t,r)=>new KUe({valueType:t,keyType:e,typeName:Pu.ZodMap,...hl(r)});var JUe=class e extends Ml{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==zo.set)return po(n,{code:an.invalid_type,expected:zo.set,received:n.parsedType}),ru;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(po(n,{code:an.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&&(po(n,{code:an.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(u){let c=new Set;for(let l of u){if(l.status==="aborted")return ru;l.status==="dirty"&&r.dirty(),c.add(l.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((u,c)=>o._parse(new gM(n,u,n.path,c)));return n.common.async?Promise.all(a).then(u=>s(u)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:ea.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:ea.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};JUe.create=(e,t)=>new JUe({valueType:e,minSize:null,maxSize:null,typeName:Pu.ZodSet,...hl(t)});var bYt=class e extends Ml{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==zo.function)return po(r,{code:an.invalid_type,expected:zo.function,received:r.parsedType}),ru;function n(a,u){return dht({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,qUe(),dne].filter(c=>!!c),issueData:{code:an.invalid_arguments,argumentsError:u}})}function i(a,u){return dht({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,qUe(),dne].filter(c=>!!c),issueData:{code:an.invalid_return_type,returnTypeError:u}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Npe){let a=this;return wS(async function(...u){let c=new XD([]),l=await a._def.args.parseAsync(u,o).catch(f=>{throw c.addIssue(n(u,f)),c}),p=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(p,o).catch(f=>{throw c.addIssue(i(p,f)),c})})}else{let a=this;return wS(function(...u){let c=a._def.args.safeParse(u,o);if(!c.success)throw new XD([n(u,c.error)]);let l=Reflect.apply(s,this,c.data),p=a._def.returns.safeParse(l,o);if(!p.success)throw new XD([i(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:cG.create(t).rest(hne.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||cG.create([]).rest(hne.create()),returns:r||hne.create(),typeName:Pu.ZodFunction,...hl(n)})}},M_e=class extends Ml{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})}};M_e.create=(e,t)=>new M_e({getter:e,typeName:Pu.ZodLazy,...hl(t)});var L_e=class extends Ml{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return po(r,{received:r.data,code:an.invalid_literal,expected:this._def.value}),ru}return{status:"valid",value:t.data}}get value(){return this._def.value}};L_e.create=(e,t)=>new L_e({value:e,typeName:Pu.ZodLiteral,...hl(t)});function UXo(e,t){return new U_e({values:e,typeName:Pu.ZodEnum,...hl(t)})}var U_e=class e extends Ml{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return po(r,{expected:vp.joinValues(n),received:r.parsedType,code:an.invalid_type}),ru}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 po(r,{received:r.data,code:an.invalid_enum_value,options:n}),ru}return wS(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})}};U_e.create=UXo;var z_e=class extends Ml{_parse(t){let r=vp.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==zo.string&&n.parsedType!==zo.number){let i=vp.objectValues(r);return po(n,{expected:vp.joinValues(i),received:n.parsedType,code:an.invalid_type}),ru}if(this._cache||(this._cache=new Set(vp.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=vp.objectValues(r);return po(n,{received:n.data,code:an.invalid_enum_value,options:i}),ru}return wS(t.data)}get enum(){return this._def.values}};z_e.create=(e,t)=>new z_e({values:e,typeName:Pu.ZodNativeEnum,...hl(t)});var Npe=class extends Ml{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==zo.promise&&r.common.async===!1)return po(r,{code:an.invalid_type,expected:zo.promise,received:r.parsedType}),ru;let n=r.parsedType===zo.promise?r.data:Promise.resolve(r.data);return wS(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Npe.create=(e,t)=>new Npe({type:e,typeName:Pu.ZodPromise,...hl(t)});var AM=class extends Ml{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pu.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{po(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ru;let u=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return u.status==="aborted"?ru:u.status==="dirty"?P_e(u.value):r.value==="dirty"?P_e(u.value):u});{if(r.value==="aborted")return ru;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ru:a.status==="dirty"?P_e(a.value):r.value==="dirty"?P_e(a.value):a}}if(i.type==="refinement"){let s=a=>{let u=i.refinement(a,o);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ru:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ru:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Fpe(s))return ru;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Fpe(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ru);vp.assertNever(i)}};AM.create=(e,t,r)=>new AM({schema:e,typeName:Pu.ZodEffects,effect:t,...hl(r)});AM.createWithPreprocess=(e,t,r)=>new AM({schema:t,effect:{type:"preprocess",transform:e},typeName:Pu.ZodEffects,...hl(r)});var hM=class extends Ml{_parse(t){return this._getType(t)===zo.undefined?wS(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};hM.create=(e,t)=>new hM({innerType:e,typeName:Pu.ZodOptional,...hl(t)});var lG=class extends Ml{_parse(t){return this._getType(t)===zo.null?wS(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};lG.create=(e,t)=>new lG({innerType:e,typeName:Pu.ZodNullable,...hl(t)});var V_e=class extends Ml{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===zo.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};V_e.create=(e,t)=>new V_e({innerType:e,typeName:Pu.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...hl(t)});var q_e=class extends Ml{_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 GUe(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new XD(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new XD(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};q_e.create=(e,t)=>new q_e({innerType:e,typeName:Pu.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...hl(t)});var YUe=class extends Ml{_parse(t){if(this._getType(t)!==zo.nan){let n=this._getOrReturnCtx(t);return po(n,{code:an.invalid_type,expected:zo.nan,received:n.parsedType}),ru}return{status:"valid",value:t.data}}};YUe.create=e=>new YUe({typeName:Pu.ZodNaN,...hl(e)});var hMc=Symbol("zod_brand"),mht=class extends Ml{_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}},hht=class e extends Ml{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ru:o.status==="dirty"?(r.dirty(),P_e(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ru: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:Pu.ZodPipeline})}},G_e=class extends Ml{_parse(t){let r=this._def.innerType._parse(t),n=i=>(Fpe(i)&&(i.value=Object.freeze(i.value)),i);return GUe(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};G_e.create=(e,t)=>new G_e({innerType:e,typeName:Pu.ZodReadonly,...hl(t)});function NXo(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function zXo(e,t={},r){return e?Qpe.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=NXo(t,n),u=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:u})}});if(!o){let s=NXo(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Qpe.create()}var gMc={object:ZD.lazycreate},Pu;(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"})(Pu||(Pu={}));var AMc=(e,t={message:`Input not instance of ${e.name}`})=>zXo(r=>r instanceof e,t),VXo=kpe.create,qXo=T_e.create,yMc=YUe.create,bMc=D_e.create,GXo=R_e.create,EMc=F_e.create,vMc=$Ue.create,IMc=k_e.create,wMc=Q_e.create,CMc=Qpe.create,xMc=hne.create,_Mc=a8.create,SMc=HUe.create,BMc=gne.create,OMc=ZD.create,PMc=ZD.strictCreate,TMc=N_e.create,DMc=AYt.create,RMc=j_e.create,FMc=cG.create,kMc=yYt.create,QMc=KUe.create,NMc=JUe.create,jMc=bYt.create,MMc=M_e.create,LMc=L_e.create,UMc=U_e.create,zMc=z_e.create,VMc=Npe.create,qMc=AM.create,GMc=hM.create,WMc=lG.create,$Mc=AM.createWithPreprocess,HMc=hht.create,KMc=()=>VXo().optional(),JMc=()=>qXo().optional(),YMc=()=>GXo().optional(),XMc={string:(e=>kpe.create({...e,coerce:!0})),number:(e=>T_e.create({...e,coerce:!0})),boolean:(e=>R_e.create({...e,coerce:!0})),bigint:(e=>D_e.create({...e,coerce:!0})),date:(e=>F_e.create({...e,coerce:!0}))};var ZMc=ru;var e4c=mt.object({lang:mt.string(),label:mt.optional(mt.string()),source:mt.string()}),rJn=mt.array(e4c);St();var WXo={README_EXT:"x-readme"};function t4c(e){if(!Array.isArray(e))return!1;for(let t of e)if(!Aa(t)||typeof t.language!="string"||typeof t.code!="string")return!1;return!0}function $Xo(e){let t=jr(e,WXo.README_EXT);if(!Aa(t))return[];let r=t["code-samples"];if(!t4c(r))return[];let n=[];for(let i of r)n.push({name:i.name,language:i.language,code:i.code,install:i.install,docs:void 0});return n}function r4c(e){return Aa(e)&&typeof e.$ref=="string"}function n4c(e,t){if(e!=null){if(typeof e=="string")return e;if(r4c(e)){let r=(0,vYt.resolve)(t??process.cwd(),e.$ref);if((0,EYt.existsSync)(r))try{return(0,EYt.readFileSync)(r,"utf-8")}catch{return}}}}function i4c(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){if(!Aa(n))continue;let o=n4c(n.code,t);o!=null&&r.push({...n,code:o})}return r}function HXo(e,t,r){let n=jr(t,En.EXAMPLES),i=r.source.type==="openapi"?(0,vYt.dirname)(r.source.file):void 0,s=(n??[]).map(p=>{if(!Aa(p))return p;let f=p["code-samples"];if(f!=null){let m=i4c(f,i);return{...p,"code-samples":m}}return p}).filter(p=>{let d=Hd.serialization.ExampleEndpointCallSchema.parse(p);return d.ok||r.logger.error(`Failed to parse x-fern-example in ${e.path}/${e.method}`),d.ok}),a=sht(t,A_.REDOCLY_CODE_SAMPLES_KEBAB,rJn,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],c=[...sht(t,A_.REDOCLY_CODE_SAMPLES_CAMEL,rJn,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],...a];c.length>0&&s.push({"code-samples":c.map(p=>({name:p.label??p.lang,language:p.lang,code:p.source,install:void 0,docs:void 0}))});let l=$Xo(t);return l.length>0&&s.push({"code-samples":l}),s.map(cM.unknown)}function KXo(e){let t=jr(e,En.AVAILABILITY);if(t==="ga"||t==="generally-available")return Gw.GenerallyAvailable;if(t==="beta"||t==="pre-release")return Gw.Beta;if(t==="deprecated")return Gw.Deprecated;if(e.deprecated)return Gw.Deprecated}function JXo(e){let t=jr(e,En.RETRIES);if(t!=null&&t.disabled===!0)return Yh.RetriesConfiguration.disabled(t.disabled)}var o4c="x-fern-default-url";function IYt(e,t){let r=e.variables!=null&&Object.keys(e.variables).length>0,n=s4c(e);return{url:u4c({url:e.url,variables:e.variables??{}}),description:e.description,name:c4c(e,t),audiences:jr(e,En.AUDIENCES),urlTemplate:r?e.url:void 0,variables:r&&e.variables!=null?a4c(e.variables):void 0,defaultUrl:r?n:void 0}}function s4c(e){let t=e[o4c];if(typeof t=="string")return t.endsWith("/")&&t!=="/"?t.slice(0,-1):t}function a4c(e){return Object.entries(e).map(([t,r])=>({id:t,default:r.default,values:r.enum}))}function u4c({url:e,variables:t}){let r=Object.fromEntries(Object.entries(t).map(([n,i])=>[n,i.default]));for(let[n,i]of Object.entries(r))e=e.replace(`{${n}}`,encodeURIComponent(i));return e}function c4c(e,t){let r=jr(e,[En.SERVER_NAME_V1,En.SERVER_NAME_V2]);if(r!=null)return r;if(e.description?.toLowerCase()==="production")return"Production";if(e.description?.toLowerCase()==="sandbox")return"Sandbox";if(t?.groupMultiApiEnvironments&&e.description!=null&&e.description.trim()!==""){let n=e.description.toLowerCase();return n==="prd"?"Production":n==="sbx"?"Sandbox":n==="staging"||n==="stg"?"Staging":n==="development"||n==="dev"?"Development":e.description}}function YXo(e){return jr(e,En.PARAMETER_NAME)}function XXo(e){return jr(e,En.SDK_VARIABLE)}function wYt({path:e,httpMethod:t,parameters:r,context:n,requestBreadcrumbs:i,source:o}){let s={pathParameters:[],queryParameters:[],headers:[]};for(let a of r){let u=jn(a)?n.resolveParameterReference(a):a,c=jr(a,En.IGNORE)??jr(u,En.IGNORE);if(c!=null&&c){n.logger.debug(`${t.toUpperCase()} ${e} has a parameter marked with x-fern-ignore. Skipping.`);continue}let l=u.required??!1,p=cv(u),d=[...i,u.name],f=Ay(d,n.options.preserveSchemaIds),m=u.in==="header",[h,g]=n.options.coerceOptionalSchemasToNullable&&!m?[!1,!l]:[!l,!1],A=u.schema!=null?Da(u.schema,h,g,n,d,o,n.namespace,!1,new Set,mM({schema:u,logger:n.logger})):l?kr.primitive({nameOverride:void 0,generatedName:f,title:void 0,schema:Ii.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:mM({schema:u,logger:n.logger})}),description:void 0,availability:p,namespace:void 0,groupName:void 0}):kr.optional({nameOverride:void 0,generatedName:f,title:void 0,value:kr.primitive({nameOverride:void 0,generatedName:f,title:void 0,schema:Ii.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:mM({schema:u,logger:n.logger})}),description:void 0,availability:void 0,namespace:void 0,groupName:void 0}),description:void 0,availability:p,namespace:void 0,groupName:void 0,inline:void 0});if(u.in==="header"&&u.schema!=null&&!jn(u.schema)&&u.schema.default!=null){let v=u.schema.default;typeof v=="string"&&v.length>0&&(A=kr.literal({nameOverride:void 0,generatedName:f,title:void 0,value:xg.string(v),description:void 0,availability:p,namespace:void 0,groupName:void 0}))}let b={name:u.name,schema:A,description:u.description,parameterNameOverride:YXo(u),availability:p,source:o};u.in==="query"?s.queryParameters.push({...b,explode:p4c(u)}):u.in==="path"?s.pathParameters.push({...b,variableReference:XXo(u),explode:f4c(u)}):u.in==="header"?!l4c.has(u.name.toLowerCase())&&!n.authHeaders.has(u.name)?s.headers.push({...b,env:void 0}):n.logger.debug(`Ignoring ${u.name} header, in ${t.toUpperCase()} ${e}`):n.logger.warn(`Skipping ${u.in} parameter, ${u.name}, in ${t.toUpperCase()} ${e}`)}return s}var l4c=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]);function p4c(e){let t=e.style??"form",r=e.explode;if(r!==void 0)return t==="form"||t==="deepObject"?r===!0?void 0:r:r===!1?void 0:r}function f4c(e){let t=e.explode;if(t!==void 0)return t===!1?void 0:t}St();function d4c({content:e,context:t}){for(let[r,n]of Object.entries(e))if(eZo({mediaType:r,mediaTypeObject:n,context:t}))return[r,n]}function eZo({mediaType:e,mediaTypeObject:t,context:r}){if(Wp.parse(e)?.isURLEncoded())return{schema:t.schema,contentType:e,examples:zUe(t,r)}}function m4c({content:e,context:t}){for(let[r,n]of Object.entries(e))if(tZo({mediaType:r,mediaTypeObject:n,context:t}))return[r,n]}function tZo({mediaType:e,mediaTypeObject:t,context:r}){if(Wp.parse(e)?.isMultipart())return{schema:t.schema,encoding:t.encoding,examples:zUe(t,r)}}function rZo({mediaType:e}){return Wp.parse(e)?.isBinary()??!1}function h4c({content:e}){for(let[t,r]of Object.entries(e))if(rZo({mediaType:t}))return[t,r]}function g4c(e,t){let r=jn(e)?nJn(e,t):{id:void 0,schema:e};return Object.entries(r.schema.properties??{}).find(([n,i])=>!jn(i)&&i.type==="string"&&(i.format==="binary"||i.format==null&&i.contentMediaType==="application/octet-stream"))!=null}function xYt({content:e,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s}){let a=h4c({content:e});if(a){let[d,f]=a;return pG({mediaType:d,mediaTypeObject:f,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s})}let u=m4c({content:e,context:n}),c=YKn({content:e,context:n}),l=A4c({json:c,multipart:u,document:r,visitor:{json:([d,f])=>pG({mediaType:d,mediaTypeObject:f,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s}),multipart:([d,f])=>pG({mediaType:d,mediaTypeObject:f,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s}),neither:()=>{}}});if(l)return l;let p=d4c({content:e,context:n});if(p){let[d,f]=p;return pG({mediaType:d,mediaTypeObject:f,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s})}}function A4c({json:e,multipart:t,document:r,visitor:n}){if(!e&&!t)return n.neither();let[,i]=e??[void 0,void 0],[,o]=t??[void 0,void 0];return!i?.schema&&!o?.schema?n.neither():i?.schema&&o?.schema?i.schema&&g4c(i.schema,r)?n.multipart(t):n.json(e):i?.schema?n.json(e):o?.schema?n.multipart(t):n.neither()}function pG({mediaType:e,mediaTypeObject:t,description:r,document:n,context:i,requestBreadcrumbs:o,source:s,namespace:a}){let u=y4c({mediaTypeObject:t});if(rZo({mediaType:e}))return eP.octetStream({description:r,source:s,sdkMethodName:u,contentType:e});let c=tZo({mediaType:e,mediaTypeObject:t,context:i}),l=c?.schema,p=c?.encoding,d=c?.examples;if(l){let h=jn(l)?nJn(l,n):{id:void 0,schema:l},g=Da(h.schema,!1,!1,i,o,s,a,!1),A=[];if(g.type==="object"){let b=new Set(h.schema.required??[]);for(let v of g.properties){let E=b.has(v.key),{isFile:I,isOptional:w,isArray:x,description:C}=CYt({schema:v.schema,isOptional:!E});if(I){let _=ZXo(v.key,p);A.push({key:v.key,schema:X9.file({isOptional:w,isArray:x,description:C}),description:C,contentType:_,exploded:!1,encoding:_==null?i.options.defaultFormParameterEncoding:void 0})}else{let _=ZXo(v.key,p);A.push({key:v.key,schema:X9.json(v.schema),description:void 0,contentType:_,exploded:p?.[v.key]?.explode,encoding:_==null?i.options.defaultFormParameterEncoding:E4c(_)})}}}return eP.multipart({name:jn(l)&&i.getNumberOfOccurrencesForRef(l)===1?h.id:void 0,description:h.schema.description,properties:A,source:s,sdkMethodName:u,fullExamples:d})}let f=fYt({mediaType:e,mediaTypeObject:t,context:i});if(f){let h=Da(f.schema,!1,!1,i,o,s,a,!0);return eP.json({description:void 0,schema:h,contentType:f.contentType,fullExamples:f.examples,additionalProperties:!jn(f.schema)&&uht(f.schema.additionalProperties,i.options),source:s,sdkMethodName:u})}let m=eZo({mediaType:e,mediaTypeObject:t,context:i});if(m!=null&&m.schema!=null){let h=Da(m.schema,!1,!1,i,o,s,a,!1);return eP.formUrlEncoded({schema:h,description:r,contentType:m.contentType,source:s,fullExamples:m.examples,additionalProperties:!1,sdkMethodName:u})}}function y4c({mediaTypeObject:e}){return jr(e,En.SDK_METHOD_NAME)}var b4c={"application/json":"json"};function E4c(e){return e?b4c[e]:void 0}function nJn(e,t){if(!e.$ref.startsWith(S_e))throw new Error(`Failed to resolve schema reference because of unsupported prefix: ${e.$ref}`);let r=fne(e);if(r==null)throw new Error(`Failed to resolve schema reference because missing schema id: ${e.$ref}`);let n=t.components?.schemas?.[r];if(n==null)throw new Error(`Failed to resolve schema reference because missing: ${e.$ref}`);return jn(n)?nJn(n,t):{id:r,schema:n}}function CYt({schema:e,isOptional:t,isArray:r,description:n}){return I4c(e)?CYt({schema:e.value,isOptional:!0,isArray:r,description:e.description}):w4c(e)?CYt({schema:e.value,isOptional:t,isArray:r,description:e.description}):C4c(e)?CYt({schema:e.value,isOptional:t,isArray:!0,description:e.description}):v4c(e)?{isFile:!0,isOptional:t??!1,isArray:r??!1,description:n??e.description}:{isFile:!1,isOptional:t??!1,isArray:r??!1,description:void 0}}function v4c(e){return e.type==="primitive"&&e.schema.type==="string"&&e.schema.format==="binary"}function I4c(e){return e.type==="optional"}function w4c(e){return e.type==="nullable"}function C4c(e){return e.type==="array"}function ZXo(e,t){return t?.[e]?.contentType}St();var iJn={400:"BadRequestError",401:"UnauthorizedError",402:"PaymentRequiredError",403:"ForbiddenError",404:"NotFoundError",405:"MethodNotAllowedError",406:"NotAcceptableError",407:"ProxyAuthenticationRequiredError",408:"RequestTimeoutError",409:"ConflictError",410:"GoneError",411:"LengthRequiredError",412:"PreconditionFailedError",413:"ContentTooLargeError",414:"URITooLongError",415:"UnsupportedMediaTypeError",416:"RangeNotSatisfiableError",417:"ExpectationFailedError",418:"ImATeapotError",419:"AuthenticationTimeoutError",420:"MethodFailureError",421:"MisdirectedRequestError",422:"UnprocessableEntityError",423:"LockedError",424:"FailedDependencyError",425:"TooEarlyError",426:"UpgradeRequiredError",428:"PreconditionError",429:"TooManyRequestsError",430:"RequestHeaderFieldsTooLargeError",431:"RequestHeaderFieldsTooLargeError",444:"NoResponseError",449:"RetryWithError",450:"BlockedByWindowsParentalControlsError",451:"UnavailableForLegalReasonsError",498:"InvalidTokenError",499:"ClientClosedRequestError",500:"InternalServerError",501:"NotImplementedError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError",505:"HTTPVersionNotSupportedError",506:"VariantAlsoNegotiatesError",507:"InsufficientStorageError",508:"LoopDetectedError",509:"BandwidthLimitExceededError",510:"NotExtendedError",511:"NetworkAuthenticationRequiredError"},nZo=new Set(Object.values(iJn));var x4c=["200","201","202","204"];function _Yt({operationContext:e,responses:t,context:r,responseBreadcrumbs:n,responseStatusCode:i,streamFormat:o,streamTerminator:s,source:a}){if(t==null)return{value:void 0,errors:{}};let u=_4c({responses:t,context:r,source:a,namespace:r.namespace}),c=!1,l;for(let p of i!=null?[i]:x4c){let d=t[p];d!=null&&(c=!0,l==null&&(l=iZo({operationContext:e,response:d,context:r,responseBreadcrumbs:n,streamFormat:o,streamTerminator:s,source:a,namespace:r.namespace,statusCode:typeof p=="string"?parseInt(p):p})))}if(l==null&&!c&&t.default!=null&&(l=iZo({operationContext:e,response:t.default,context:r,responseBreadcrumbs:n,streamFormat:o,streamTerminator:s,source:a,namespace:r.namespace})),l!=null)switch(l.type){case"json":return{value:l,errors:u};case"streamingJson":case"streamingSse":return{value:l,errors:u};case"bytes":case"file":case"text":case"streamingText":return{value:l,errors:u};default:Be(l)}return{value:void 0,errors:u}}function iZo({operationContext:e,streamFormat:t,streamTerminator:r,response:n,context:i,responseBreadcrumbs:o,source:s,namespace:a,statusCode:u}){let c=jn(n)?i.resolveResponseReference(n):n;if(c.content!=null&&Object.entries(c.content).find(([f,m])=>{if(m.schema==null)return!1;let h=jn(m.schema)?i.resolveSchemaReference(m.schema):m.schema;return h.type==="string"&&(h.format==="binary"||h.format==null&&h.contentMediaType==="application/octet-stream")}))return i.options.useBytesForBinaryResponse&&t==null?Ch.bytes({description:c.description,source:s,statusCode:u}):Ch.file({description:c.description,source:s,statusCode:u});let l=_Xo(c.content??{},i);if(l!=null&&t!=null)switch(t){case"json":return Ch.streamingJson({statusCode:u,description:c.description,responseProperty:jr(e.operation,En.RESPONSE_PROPERTY),terminator:r,fullExamples:l.examples,schema:Da(l.schema,!1,!1,i,o,s,a),source:s});case"sse":return Ch.streamingSse({description:c.description,responseProperty:void 0,terminator:r,fullExamples:l.examples,schema:Da(l.schema,!1,!1,i,o,s,a),source:s,statusCode:u})}let p=dYt({context:i,content:c.content??{}});if(p){if(t!=null)switch(t){case"json":return Ch.streamingJson({description:c.description,responseProperty:void 0,terminator:r,fullExamples:p.examples,schema:Da(p.schema,!1,!1,i,o,s,a),source:s,statusCode:u});case"sse":return Ch.streamingSse({description:c.description,responseProperty:void 0,terminator:r,fullExamples:p.examples,schema:Da(p.schema,!1,!1,i,o,s,a),source:s,statusCode:u})}return Ch.json({description:c.description,schema:Da(p.schema,!1,!1,i,o,s,a),responseProperty:jr(e.operation,En.RESPONSE_PROPERTY),terminator:void 0,fullExamples:p.examples,source:s,statusCode:u})}for(let[d,f]of Object.entries(c.content??{})){let m=Wp.parse(d);if(m!=null){if(m.isOctetStream()||m.isPDF()||m.isAudio()||m.isImage()||m.isVideo()||m.isMultiPartMixed())return Ch.file({description:c.description,source:s,statusCode:u});if(m.isText()&&!d.includes("event-stream")){let h=f.schema;if(h==null)return Ch.text({description:c.description,source:s,statusCode:u});let g=jn(h)?i.resolveSchemaReference(h):h;return g.type==="string"&&g.format==="byte"?Ch.file({description:c.description,source:s,statusCode:u}):Ch.text({description:c.description,source:s,statusCode:u})}}}}function _4c({responses:e,context:t,source:r,namespace:n}){let i={};for(let[o,s]of Object.entries(e)){if(o==="default")continue;let a=parseInt(o);if(a<400||a>600)continue;let u=jn(s)?t.resolveResponseReference(s):s,c=BXo(u.content??{},t),l=iJn[a];if(l==null){t.logger.warn(`No error name found for status code ${o}`);continue}i[a]={statusCode:a,nameOverride:void 0,generatedName:l,description:u.description,schema:Da(c?.schema??{},!1,!1,t,[l,"Body"],r,n),fullExamples:c?.examples,source:r}}return i}function Ane({operationContext:e,context:t,responseStatusCode:r,suffix:n,streamFormat:i,streamTerminator:o,source:s,streamRequestNameOverride:a}){let{document:u,operation:c,path:l,method:p,baseBreadcrumbs:d,pathItem:f}=e,m=jr(c,En.IDEMPOTENT),h=jr(c,[En.REQUEST_NAME_V1,En.REQUEST_NAME_V2]),g=[...d,"Request"],A=wYt({parameters:[...e.pathItemParameters,...e.operationParameters],context:t,requestBreadcrumbs:g,path:l,httpMethod:p,source:s}),b=/{([^}]+)}/g,v=[...l.matchAll(b)].map(z=>z[1]).filter(z=>z!==void 0),E=[...l.matchAll(b)].map(z=>z[1]);switch(t.options.pathParameterOrder){case bn.PathParameterOrder.SpecOrder:{let z=E.filter(J=>!A.pathParameters.some(ie=>ie.name===J));if(z.length>0)for(let J of z)A.pathParameters.push({name:J??"",variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:s,schema:kr.primitive({schema:Ii.string({default:void 0,example:void 0,format:void 0,maxLength:void 0,minLength:void 0,pattern:void 0}),description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0,availability:void 0,title:void 0}),description:void 0,explode:void 0})}break;case bn.PathParameterOrder.UrlOrder:if(v.length>0){let z=new Map(A.pathParameters.map(V=>[V.name,V])),J=[],ie=new Set;for(let V of v){let H=z.get(V);ie.add(V),H?J.push(H):J.push({name:V,variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:s,schema:kr.primitive({schema:Ii.string({default:void 0,example:void 0,format:void 0,maxLength:void 0,minLength:void 0,pattern:void 0}),description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0,availability:void 0,title:void 0}),description:void 0,explode:void 0})}for(let V of A.pathParameters)ie.has(V.name)||J.push(V);A.pathParameters=J}break;default:Be(t.options.pathParameterOrder)}let I=(()=>{if(e.method==="GET")return[void 0];if(!c.requestBody)return[void 0];let z=jn(c.requestBody)?t.resolveRequestBodyReference(c.requestBody):c.requestBody,J=Object.values(z.content).every(V=>B4c({mediaTypeObject:V})!=null),ie=[];if(J)return ie.push(...Object.entries(z.content).map(([V,H])=>{let ye=pG({mediaType:V,mediaTypeObject:H,description:z.description,document:u,context:new O_e({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:g,source:s,namespace:t.namespace});return oZo({context:t,convertedParameters:A})&&ye!=null&&(ye.type==="json"||ye.type==="formUrlEncoded")&&ye.schema.type!=="object"&&c.requestBody!=null?ye=pG({mediaType:V,mediaTypeObject:H,description:z.description,document:u,context:t,requestBreadcrumbs:[...g,"Body"],source:s,namespace:t.namespace}):c.requestBody!=null&&(ye=pG({mediaType:V,mediaTypeObject:H,description:z.description,document:u,context:t,requestBreadcrumbs:[...g],source:s,namespace:t.namespace})),ye}).filter(V=>V!=null)),ie.length===0?[void 0]:ie;{let V=xYt({content:z.content,description:z.description,document:u,context:new O_e({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:g,source:s,namespace:t.namespace});return oZo({context:t,convertedParameters:A})&&V!=null&&(V.type==="json"||V.type==="formUrlEncoded")&&V.schema.type!=="object"&&c.requestBody!=null?V=xYt({content:z.content,description:z.description,document:u,context:t,requestBreadcrumbs:[...g,"Body"],source:s,namespace:t.namespace}):c.requestBody!=null&&(V=xYt({content:z.content,description:z.description,document:u,context:t,requestBreadcrumbs:[...g],source:s,namespace:t.namespace})),[V]}})(),w=I.length>1,x=[...d,"Response"],C=_Yt({operationContext:e,streamFormat:i,streamTerminator:o,responses:c.responses,context:t,responseBreadcrumbs:x,responseStatusCode:r,source:s}),_=JXo(c),R=KXo(c),U=HXo(e,c,t),q=jr(c,En.SERVER_NAME_V2);return I.map(z=>({summary:c.summary,internal:jr(c,A_.INTERNAL),idempotent:m,audiences:jr(c,En.AUDIENCES)??[],operationId:c.operationId!=null&&n!=null?c.operationId+"_"+n:c.operationId,tags:t.resolveTagsToTagIds(c.tags),namespace:t.namespace,sdkName:O4c({operationContext:e,request:z}),pathParameters:A.pathParameters,queryParameters:A.queryParameters,headers:A.headers,requestNameOverride:a??h??void 0,generatedRequestName:Ay(w?S4c({breadcrumbs:g,request:z}):g,t.options.preserveSchemaIds),request:z,response:C.value,errors:C.errors,servers:q!=null?[{name:q,url:void 0,audiences:void 0}]:(c.servers??f.servers??[]).map(J=>IYt(J,{groupMultiApiEnvironments:t.options.groupMultiApiEnvironments})),description:c.description,authed:T4c(c,u),security:P4c(c),availability:R,method:p,path:l,examples:U,pagination:e.pagination,source:s,retries:_}))}function S4c({breadcrumbs:e,request:t}){return t?[...e,t.type]:e}function B4c({mediaTypeObject:e}){return jr(e,En.SDK_METHOD_NAME)}function O4c({operationContext:e,request:t}){return!t||!t.sdkMethodName?e.sdkMethodName:e.sdkMethodName?{groupName:[...e.sdkMethodName.groupName],methodName:t.sdkMethodName??e.sdkMethodName.methodName}:{groupName:[],methodName:t.sdkMethodName}}function P4c(e){return e.security}function T4c(e,t){return e.security!=null?Object.keys(e.security).length>0:t.security!=null?Object.keys(t.security).length>0:!1}function oZo({context:e,convertedParameters:t}){return e.options.inlinePathParameters&&t.pathParameters.length>0||t.queryParameters.length>0||t.headers.length>0}function aZo({operationContext:e,context:t,asyncExtension:r,source:n}){let{operation:i,pathItemParameters:o,operationParameters:s}=e,a=r.discriminant.name,u=r.discriminant.value,c=r["response-status-code"],l=sZo({context:t,headerToIgnore:a,parameters:o}),p=sZo({context:t,headerToIgnore:a,parameters:s}),d=Ane({operationContext:{...e,pathItemParameters:l,operationParameters:p,operation:{...i,responses:Object.fromEntries(Object.entries(i.responses).filter(([m])=>parseInt(m)!==c))}},context:t,streamFormat:void 0,source:n}),f=Ane({operationContext:{...e,pathItemParameters:l,operationParameters:p,baseBreadcrumbs:[...e.baseBreadcrumbs,"async"]},context:t,suffix:"async",responseStatusCode:c,streamFormat:void 0,source:n});return f.forEach(m=>{m.headers.push({name:a,schema:kr.literal({nameOverride:void 0,generatedName:Ay([a],t.options.preserveSchemaIds),title:void 0,description:void 0,availability:void 0,value:xg.string(u),namespace:void 0,groupName:void 0}),description:void 0,parameterNameOverride:void 0,env:void 0,availability:void 0,source:n})}),{sync:d,async:f}}function sZo({context:e,headerToIgnore:t,parameters:r}){return r.filter(n=>{let i=jn(n)?e.resolveParameterReference(n):n;return!(i.in==="header"&&i.name===t)})}St();var oJn="stream";function pZo({operationContext:e,context:t,streamingExtension:r}){switch(r.type){case"stream":return{streaming:Ane({operationContext:e,context:t,streamFormat:r.format,streamTerminator:r.terminator,source:t.source}),nonStreaming:[]};case"streamCondition":{let n=uZo({context:t,operation:e.operation,streamingExtension:r,isStreaming:!0});if(n?.schemaReference!=null){let l=fne(n.schemaReference);l!=null&&t.excludeSchema(l)}let i=cZo({operation:e.operation,response:r.responseStream}),o=(()=>{if(r.streamRequestName!=null)return r.streamRequestName;if(n?.schemaReference!=null){let l=fne(n.schemaReference);if(l!=null)return`${l}Streaming`}})(),s=Ane({operationContext:{...e,sdkMethodName:e.sdkMethodName!=null?{groupName:e.sdkMethodName.groupName,methodName:e.sdkMethodName.methodName+"_"+oJn}:void 0,operation:{...e.operation,description:r.streamDescription??e.operation.description,requestBody:n?.requestBody,responses:i},baseBreadcrumbs:[...e.baseBreadcrumbs,oJn]},context:t,streamFormat:r.format,streamTerminator:r.terminator,suffix:oJn,source:t.source,streamRequestNameOverride:o});s.forEach(l=>{l.examples=l.examples.filter(p=>lZo(p,t)!==!1)});let a=uZo({context:t,operation:e.operation,streamingExtension:r,isStreaming:!1}),u=cZo({operation:e.operation,response:r.response}),c=Ane({streamFormat:void 0,operationContext:{...e,operation:{...e.operation,requestBody:a?.requestBody,responses:u}},context:t,source:t.source});return c.forEach(l=>{l.examples=l.examples.filter(p=>lZo(p,t)!==!0)}),{streaming:s,nonStreaming:c}}default:Be(r)}}function uZo({context:e,operation:t,streamingExtension:r,isStreaming:n}){if(t.requestBody==null)return;let i=jn(t.requestBody)?e.resolveRequestBodyReference(t.requestBody):t.requestBody,o=dYt({content:i.content,context:e});if(o==null)return;let s=jn(o.schema)?e.resolveSchemaReference(o.schema):o.schema;if(s.allOf==null&&s.properties==null)return;let a=s.properties?.[r.streamConditionProperty];a!=null&&jn(a)&&(a=void 0);let u={...s,properties:{...s.properties,[r.streamConditionProperty]:{...a??{},type:"boolean","x-fern-boolean-literal":n}},title:void 0,required:[...s.required??[],r.streamConditionProperty]};return{requestBody:{content:{[Wp.APPLICATION_JSON]:{schema:u}}},schemaReference:jn(o.schema)?o.schema:void 0}}function cZo({operation:e,response:t}){return{...e.responses,200:{description:"",content:{[Wp.APPLICATION_JSON]:{schema:t}}}}}function lZo(e,t){return e._visit({unknown:r=>{let n=Hd.serialization.ExampleEndpointCallSchema.parse(r);if(n.ok&&n.value.response!=null)return n.value.response.stream!=null},full:()=>{},_other:()=>{}})}var AZo=require("crypto");function D4c(e){switch(e){case"unix-seconds":return Yh.WebhookTimestampFormat.UnixSeconds;case"unix-millis":return Yh.WebhookTimestampFormat.UnixMillis;case"iso8601":return Yh.WebhookTimestampFormat.Iso8601}}function fZo(e){if(e!=null)return{header:e.header,format:e.format!=null?D4c(e.format):void 0,tolerance:e.tolerance}}function R4c(e){if(e!=null)return{components:e.components.map(t=>{switch(t){case"body":return Yh.WebhookPayloadComponent.Body;case"timestamp":return Yh.WebhookPayloadComponent.Timestamp;case"notification-url":return Yh.WebhookPayloadComponent.NotificationUrl;case"message-id":return Yh.WebhookPayloadComponent.MessageId}}),delimiter:e.delimiter}}function F4c(e){if(e!=null)switch(e){case"sha256":return Yh.WebhookSignatureAlgorithm.Sha256;case"sha1":return Yh.WebhookSignatureAlgorithm.Sha1;case"sha384":return Yh.WebhookSignatureAlgorithm.Sha384;case"sha512":return Yh.WebhookSignatureAlgorithm.Sha512}}function dZo(e){if(e!=null)switch(e){case"base64":return Yh.WebhookSignatureEncoding.Base64;case"hex":return Yh.WebhookSignatureEncoding.Hex}}function k4c(e){if(e!=null)switch(e){case"rsa-sha256":return Yh.AsymmetricAlgorithm.RsaSha256;case"rsa-sha384":return Yh.AsymmetricAlgorithm.RsaSha384;case"rsa-sha512":return Yh.AsymmetricAlgorithm.RsaSha512;case"ecdsa-sha256":return Yh.AsymmetricAlgorithm.EcdsaSha256;case"ecdsa-sha384":return Yh.AsymmetricAlgorithm.EcdsaSha384;case"ecdsa-sha512":return Yh.AsymmetricAlgorithm.EcdsaSha512;case"ed25519":return Yh.AsymmetricAlgorithm.Ed25519}}function hZo(e){if(e.type==="hmac")return Yh.WebhookSignatureVerification.hmac({header:e.header,algorithm:F4c(e.algorithm),encoding:dZo(e.encoding),signaturePrefix:e["signature-prefix"],payloadFormat:R4c(e["payload-format"]),timestamp:fZo(e.timestamp)});if(e.type==="asymmetric"){let t=k4c(e["asymmetric-algorithm"]);return t==null?void 0:Yh.WebhookSignatureVerification.asymmetric({header:e.header,asymmetricAlgorithm:t,encoding:dZo(e.encoding),signaturePrefix:e["signature-prefix"],jwksUrl:e["jwks-url"],keyIdHeader:e["key-id-header"],timestamp:fZo(e.timestamp)})}}function mZo(e){let t=jr(e,En.WEBHOOK_SIGNATURE);if(!(t==null||typeof t=="boolean"))return hZo(t)}function gZo(e,t){let r=jr(t,En.WEBHOOK_SIGNATURE);return r!=null?typeof r=="boolean"?mZo(e):hZo(r):mZo(e)}function yZo({context:e,operationContext:t,source:r}){let{document:n,operation:i,path:o,method:s,baseBreadcrumbs:a,sdkMethodName:u}=t,c=[...a,"Payload"],l=[...a,"Response"],p=wYt({parameters:[...t.pathItemParameters,...t.operationParameters],context:e,requestBreadcrumbs:c,path:o,httpMethod:s,source:r});if(s!=="POST"&&s!=="GET")return e.logger.warn(`Skipping webhook ${s.toUpperCase()} ${o}: Only POST and GET methods are currently supported`),[];let d=i.operationId??N4c({path:o,method:s,sdkMethodName:u}),f=i.responses?_Yt({operationContext:t,streamFormat:void 0,responses:i.responses,context:e,responseBreadcrumbs:l,source:r}):void 0,m=gZo(n,i);if(i.requestBody==null){if(p.queryParameters.length===0)return e.logger.error(`Skipping webhook ${s.toUpperCase()} ${o}: Missing a request body and no query parameters`),[];let g=p.queryParameters.map(v=>({key:v.name,schema:v.schema,readonly:void 0,writeonly:void 0,audiences:[],conflict:{},nameOverride:v.parameterNameOverride,generatedName:Ay([...c,v.name],e.options.preserveSchemaIds),availability:v.availability})),A=kr.object({description:i.description,properties:g,nameOverride:void 0,generatedName:Ay(c,e.options.preserveSchemaIds),title:void 0,allOf:[],allOfPropertyConflicts:[],namespace:e.namespace,groupName:void 0,fullExamples:void 0,additionalProperties:!1,availability:void 0,encoding:void 0,source:r,inline:void 0,minProperties:void 0,maxProperties:void 0});return[{summary:i.summary,audiences:jr(i,En.AUDIENCES)??[],sdkName:u,namespace:e.namespace,method:s,operationId:d,tags:e.resolveTagsToTagIds(i.tags),headers:p.headers,generatedPayloadName:Ay(c,e.options.preserveSchemaIds),payload:A,signatureVerification:m,multipartFormData:void 0,response:f?.value,description:i.description,examples:[],source:r}]}let h=jn(i.requestBody)?e.resolveRequestBodyReference(i.requestBody):i.requestBody;return Object.entries(h.content).map(([g,A])=>pG({mediaType:g,mediaTypeObject:A,description:h.description,document:n,context:e,requestBreadcrumbs:[...a,"Payload"],source:r,namespace:e.namespace})).filter(g=>g!=null).map(g=>{if(g==null||g.type!=="json"&&g.type!=="formUrlEncoded"&&g.type!=="multipart"){e.logger.error(`Skipping webhook ${o} because non-json, non-formUrlEncoded, and non-multipart request body`);return}let A,b;return g.type==="multipart"?(A={name:g.name,properties:g.properties,description:g.description,source:g.source},b=kr.unknown({nameOverride:void 0,generatedName:Ay(c,e.options.preserveSchemaIds),title:void 0,description:g.description,availability:void 0,namespace:e.namespace,groupName:void 0,example:void 0})):b=g.schema,{summary:i.summary,audiences:jr(i,En.AUDIENCES)??[],sdkName:u,namespace:e.namespace,method:s,operationId:d,tags:e.resolveTagsToTagIds(i.tags),headers:p.headers,generatedPayloadName:Ay(c,e.options.preserveSchemaIds),payload:b,signatureVerification:m,multipartFormData:A,response:f?.value,description:i.description,examples:Q4c(g.fullExamples),source:r}}).filter(g=>g!=null)}function Q4c(e){if(e==null)return[];let t=[];for(let r of e){let n=Dpe(r.value);n!=null&&t.push({description:r.description,name:r.name,payload:n})}return t}function N4c({path:e,method:t,sdkMethodName:r}){if(r?.methodName!=null)return r.methodName;let n=j4c(e);if(n===e.toLowerCase())return e;let i=(0,AZo.createHash)("sha256").update(e).digest("hex").slice(0,8);return M4c(`${n}_${t.toLowerCase()}_${i}`)}function j4c(e){return e.replace(/[{$}#]/g,"").replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/_+/g,"_").toLowerCase().slice(0,64)}function M4c(e){return e.split("_").map((t,r)=>r===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function sJn({context:e,pathItemContext:t,operation:r,convertToWebhook:n}){let i=jr(r,En.IGNORE);if(i!=null&&i){e.logger.debug(`${t.method.toUpperCase()} ${t.path} is marked with x-fern-ignore. Skipping.`);return}let o=L4c(r,e),s=xXo(e.document,r),a={...t,sdkMethodName:o,baseBreadcrumbs:U4c({operation:r,sdkMethodName:o,httpMethod:t.method,path:t.path,shouldUseIdiomaticRequestNames:e.options.shouldUseIdiomaticRequestNames}),operation:r,operationParameters:r.parameters??[],pagination:s};if(n)return{type:"webhook",value:yZo({context:e,operationContext:a,source:e.source})};let u=wXo(r);if(u==null&&z4c({operation:r,context:e})&&(u={type:"stream",format:"sse",terminator:void 0}),u!=null){let p=pZo({context:e,operationContext:a,streamingExtension:u});return p!=null?{type:"streaming",streaming:p.streaming,nonStreaming:p.nonStreaming}:void 0}let c=vXo(r);if(c!=null){let p=aZo({context:e,operationContext:a,asyncExtension:c,source:e.source});return{type:"async",async:p.async,sync:p.sync}}return{type:"http",value:Ane({context:e,operationContext:a,streamFormat:void 0,source:e.source})}}function L4c(e,t){let r=jr(e,En.SDK_METHOD_NAME),n=jr(e,En.SDK_GROUP_NAME)??[];if(r!=null){let i=typeof n=="string"?[n]:n;return i=t.resolveGroupName(i),{groupName:i,methodName:r}}}function U4c({sdkMethodName:e,operation:t,httpMethod:r,path:n,shouldUseIdiomaticRequestNames:i}){let o=[];if(e!=null){if(i&&o.push(e.methodName),e.groupName.length>0){let s=e.groupName[e.groupName.length-1];s!=null&&o.push(typeof s=="string"?s:s.name)}i||o.push(e.methodName)}else t.operationId!=null?o.push(t.operationId):o.push(zn(`${r}_${n.split("/").join("_")}`));return o}function z4c({operation:e,context:t}){if(e.responses==null)return!1;for(let[r,n]of Object.entries(e.responses)){let i=parseInt(r);if(isNaN(i)||i<200||i>=300)continue;let o=jn(n)?t.resolveResponseReference(n):n;if(o.content!=null&&SXo(o.content))return!0}return!1}function bZo(e,t,r,n){let i=[],o=vZo(t),s={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let a of o){if(n.filter.skipEndpoint({method:a.method,path:e})){n.logger.debug(`Skipping endpoint "${a.method} ${e}"`);continue}let u=V4c({operation:a.operation}),c=sJn({context:n,pathItemContext:{...s,method:a.method},operation:a.operation,convertToWebhook:u});c&&i.push(c)}return i}function EZo(e,t,r,n){let i=[],o=vZo(t),s={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let a of o){if(n.filter.skipEndpoint({method:a.method,path:e})){n.logger.debug(`Skipping endpoint "${a.method} ${e}"`);continue}let u=sJn({context:n,pathItemContext:{...s,method:a.method},operation:a.operation,convertToWebhook:!0});u&&i.push(u)}return i}function vZo(e){let t=[];return e.get!=null&&t.push({method:Ww.Get,operation:e.get}),e.post!=null&&t.push({method:Ww.Post,operation:e.post}),e.put!=null&&t.push({method:Ww.Put,operation:e.put}),e.delete!=null&&t.push({method:Ww.Delete,operation:e.delete}),e.patch!=null&&t.push({method:Ww.Patch,operation:e.patch}),e.head!=null&&t.push({method:Ww.Head,operation:e.head}),t}function V4c({operation:e}){return jr(e,[En.WEBHOOK])??!1}function IZo(e){let t=jr(e,En.BASIC_AUTH_USERNAME_VARIABLE_NAME),r=jr(e,En.BASIC_AUTH_PASSWORD_VARIABLE_NAME);return{usernameVariable:t,passwordVariable:r}}function wZo(e){return jr(e,En.FERN_BASIC_AUTH)}function xZo(e,t,r,n){if(jn(e)){if(n==null)throw new Error(`Converting referenced security schemes requires context: ${JSON.stringify(e)}`);let i=n.resolveSecuritySchemeReference(e);return CZo(i,t,r)}return CZo(e,t,r)}function CZo(e,t,r){try{if(e.type==="apiKey"&&e.in==="header"){let n=jr(e,A_.BEARER_FORMAT),i=jr(e,En.FERN_HEADER_AUTH);return qw.header({headerName:e.name,prefix:n!=null?"Bearer":i?.prefix,headerVariableName:i?.name??jr(e,En.HEADER_VARIABLE_NAME),headerEnvVar:i?.env})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="bearer"){let n=jr(e,En.FERN_BEARER_TOKEN);return qw.bearer({tokenVariableName:n?.name??jr(e,En.BEARER_TOKEN_VARIABLE_NAME),tokenEnvVar:n?.env})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="basic"){let n=wZo(e),i=IZo(e);return qw.basic({usernameVariableName:n?.username?.name??i.usernameVariable,usernameEnvVar:n?.username?.env,passwordVariableName:n?.password?.name??i.passwordVariable,passwordEnvVar:n?.password?.env})}else{if(e.type==="openIdConnect")return qw.bearer({tokenVariableName:void 0,tokenEnvVar:void 0});if(e.type==="oauth2")return qw.oauth({scopesEnum:q4c(e,t)})}}catch(n){r.logger.debug(`Error converting security scheme: ${n?.message}`)}r.logger.debug(`Skipping security scheme: ${JSON.stringify(e,null)} - not currently supported. Please reach out to Fern support team!`)}function q4c(e,t){let r=e.flows.authorizationCode?.scopes??e.flows.clientCredentials?.scopes??e.flows.implicit?.scopes??e.flows.password?.scopes;if(r!=null){let n=Ppe({nameOverride:void 0,generatedName:"OauthScope",title:void 0,enumValues:Object.keys(r),fernEnum:Object.fromEntries(Object.entries(r).map(([o,s])=>[o,{description:s}])),_default:void 0,description:void 0,availability:void 0,enumVarNames:void 0,wrapAsOptional:!1,wrapAsNullable:!1,namespace:void 0,groupName:void 0,context:void 0,source:t,inline:void 0}),i=mf(n);if(i.type==="enum")return i}}function _Zo(e){return jr(e,En.BASE_PATH)}var G4c=mt.record(mt.string(),mt.object({summary:mt.string().optional(),description:mt.string().optional()}));function SZo({document:e,context:t}){return sht(e,En.GROUPS,G4c,t.logger)}function BZo({context:e,document:t}){return jr(t,En.FERN_VERSION)??void 0}function OZo(e){let t=jr(e,En.FERN_GLOBAL_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?aht({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function PZo(e){let t=jr(e,En.FERN_IDEMPOTENCY_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?aht({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}function TZo(e,t){let r=jr(e,En.SDK_VARIABLES);return r==null?{}:Object.fromEntries(Object.entries(r).map(([n,i])=>{if(i.type==="string")return[n,{nameOverride:void 0,generatedName:Ay([n],t),title:i.title,schema:Uc.string({default:NUe(i),pattern:i.pattern,format:i.format,minLength:i.minLength,maxLength:i.maxLength}),description:i.description,availability:void 0,namespace:void 0,groupName:void 0}];throw new Error(`Variable ${n} has unsupported schema ${JSON.stringify(i)}`)}))}var W4c="webhooks";function DZo(e){return jr(e,W4c)??{}}var ght=class extends VUe{nonRequestReferencedSchemas=new Set;twoOrMoreRequestsReferencedSchemas=new Set;singleRequestReferencedSchemas=new Set;discriminatedUnionReferences={};discriminatedUnionMetadata={};schemasToExclude=new Set;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s}){super({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s})}getDummy(){return new O_e({document:this.document,taskContext:this.taskContext,options:this.options,source:this.source,namespace:this.namespace})}markSchemaAsReferencedByNonRequest(t){this.nonRequestReferencedSchemas.add(t)}markSchemaAsReferencedByRequest(t){this.singleRequestReferencedSchemas.has(t)?this.twoOrMoreRequestsReferencedSchemas.add(t):this.singleRequestReferencedSchemas.add(t)}getReferencedSchemas(){return new Set([...this.nonRequestReferencedSchemas,...this.twoOrMoreRequestsReferencedSchemas])}markReferencedByDiscriminatedUnion(t,r,n){let i=this.discriminatedUnionReferences[t.$ref];i!=null?(i.discriminants.add(r),i.numReferences+=n):this.discriminatedUnionReferences[t.$ref]={discriminants:new Set([r]),numReferences:n}}getReferencesFromDiscriminatedUnion(t){return this.discriminatedUnionReferences[t.$ref]}markSchemaWithDiscriminantValue(t,r,n){let i=this.discriminatedUnionMetadata[t.$ref];i!=null?i.discriminants.set(r,n):this.discriminatedUnionMetadata[t.$ref]={discriminants:new Map([[r,n]])}}getDiscriminatedUnionMetadata(t){return this.discriminatedUnionMetadata[t.$ref]}excludeSchema(t){this.schemasToExclude.add(t)}isSchemaExcluded(t){return this.schemasToExclude.has(t)}};function RZo(e){return jr(e,En.RESOLUTIONS)}function FZo({openapi:e}){let t=RZo(e);if(t==null)return e;let r={};for(let n of t){let i=`#/components/schemas/${n.name}`;for(let o of n.resolutions)e=$4c({openapi:e,schemaReference:o,schemaName:n.name}),e=kZo({openapi:e,replaceReference:o,schemaReference:i,replacedReferences:r}),r={...r,...Object.fromEntries(n.resolutions.map(s=>[i,s]))}}return e}function $4c({openapi:e,schemaReference:t,schemaName:r}){let n=t.replace("#/","").split("/").map(o=>o.replaceAll("~1","/")),i=e;for(let o of n){let s=i[o];if(s==null)return e;i=s}return e.components==null&&(e.components={}),e.components.schemas==null&&(e.components.schemas={}),e.components.schemas[r]=i,e}function kZo({openapi:e,replaceReference:t,schemaReference:r,replacedReferences:n}){let i=Object.keys(n).filter(u=>t.startsWith(u)).sort((u,c)=>c.length-u.length)[0];if(i!=null){let u=n[i];if(u!=null){let c=r.replace(i,u);return kZo({openapi:e,replaceReference:t,schemaReference:c,replacedReferences:{}})}}let o=t.replace("#/","").split("/").map(u=>u.replaceAll("~1","/")),s=e;for(let u of o.slice(0,-1)){let c=s[u];if(c==null)return e;s=c}let a=o[o.length-1];return a==null||(s[a]={$ref:r}),e}function NZo({openApi:e,taskContext:t,options:r,source:n,namespace:i}){e=FZo({openapi:e}),iYt();let o=new ght({document:e,taskContext:t,authHeaders:new Set,options:r,source:n,namespace:i}),s=Object.fromEntries(Object.entries(e.components?.securitySchemes??{}).map(([U,q])=>{let z=xZo(q,n,t,o);return z==null?null:[U,z]}).filter(U=>U!==null)),a=e.security?.filter(U=>U!=null),u=new Set(Object.entries(s).map(([U,q])=>q.type==="basic"||q.type==="bearer"||q.type==="oauth"?"Authorization":q.type==="header"?q.headerName:null).filter(U=>U!=null)),c=TZo(e,r.preserveSchemaIds),l=OZo(e),p=PZo(e),d=r.audiences??[],f=[],m=[],h=new ght({document:e,taskContext:t,authHeaders:u,options:r,source:n,namespace:i});h.filter.hasEndpoints()&&t.logger.debug("Endpoint filter applied..."),Object.entries(e.paths??{}).forEach(([U,q])=>{if(q==null)return;let z=bZo(U,q,e,h);for(let J of z){let ie=QZo({operation:J});if(!(d.length>0&&!d.some(V=>ie.includes(V))))switch(J.type){case"async":f.push(...J.sync),f.push(...J.async);break;case"http":f.push(...J.value);break;case"streaming":f.push(...J.streaming),J.nonStreaming&&f.push(...J.nonStreaming);break;case"webhook":m.push(...J.value);break;default:Be(J)}}}),Object.entries(DZo(e)).forEach(([U,q])=>{if(q==null)return;t.logger.debug(`Converting path ${U}`);let z=EZo(U,q,e,h);for(let J of z){let ie=QZo({operation:J});d.length>0&&!d.some(V=>ie.includes(V))||m.push(...J.value)}});let g=Object.fromEntries(Object.entries(e.components?.schemas??{}).map(([U,q])=>{let z=jr(q,En.SDK_NAMESPACE);if(!jn(q)){let J=jr(q,En.IGNORE);if(J!=null&&J)return[];if(nZo.has(U))return[U,Da({...q,"x-fern-type-name":`${U}Body`},!1,!1,h,[U],n,z??i)]}return[U,Da(q,!1,!1,h,[U],n,z??i)]}).filter(U=>U.length>0)),A=H4c(g,h,n),b=K4c(A,h),v=sG(),E={};for(let[U,q]of Object.entries(b)){let z=mf(q);if(h.isSchemaExcluded(U))continue;let J=v.getUniqueSchemaId(U,h.logger,r.resolveSchemaCollisions);E[J]=z}let I=new Rpe(b,h.nonRequestReferencedSchemas,h),w=m.map(U=>{let z=U.examples;if(!r.disableExamples&&z.length===0){let J=I.buildExample({schema:U.payload,exampleId:void 0,example:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});J!=null&&(z=[{name:void 0,description:void 0,payload:J}])}return{...U,payload:mf(U.payload),examples:z}}),x=new aYt(b,h,l),C=f.map(U=>{let q=U.examples,z=q;if(!r.disableExamples&&(q.length===0||q.every(pht))){let V=x.buildEndpointExample(U);V.length>0&&(z=[...V,...q.filter(H=>!pht(H))])}let J=U.request,ie=U.response;return{...U,request:J?.type==="json"||J?.type==="formUrlEncoded"?{...J,schema:mf(J.schema)}:J,response:ie?.type==="json"?{...ie,schema:mf(ie.schema)}:ie,queryParameters:U.queryParameters.map(V=>({description:V.description,name:V.name,schema:mf(V.schema),parameterNameOverride:V.parameterNameOverride,explode:V.explode,availability:V.availability,source:V.source})),pathParameters:U.pathParameters.map(V=>({description:V.description,name:V.name,schema:mf(V.schema),parameterNameOverride:V.parameterNameOverride,variableReference:V.variableReference,availability:V.availability,source:V.source})),headers:U.headers.map(V=>({description:V.description,name:V.name,schema:mf(V.schema),parameterNameOverride:V.parameterNameOverride,env:V.env,availability:V.availability,source:V.source})),examples:z,errors:dl(U.errors,V=>{let H=V.fullExamples?.map(ye=>{let Ie=Dpe(ye.value);if(Ie!=null)return{name:ye.name,description:ye.description,example:Ie}}).filter(ua);if(H?.length===0){let ye=I.buildExample({schema:V.schema,example:void 0,exampleId:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});ye!=null&&H.push({name:void 0,description:void 0,example:ye})}return{generatedName:V.generatedName,nameOverride:V.nameOverride,schema:mf(V.schema),description:V.description,source:V.source,examples:H}}),retries:U.retries}});x.finalize();let _=SZo({document:e,context:h});return{apiVersion:BZo({context:h,document:e}),basePath:_Zo(e),title:e.info.title??"",description:e.info.description,groups:Object.fromEntries(Object.entries(_??{}).map(([U,q])=>[U,{summary:q.summary??void 0,description:q.description??void 0}])),servers:(e.servers??[]).map(U=>IYt(U,{groupMultiApiEnvironments:r.groupMultiApiEnvironments})),websocketServers:[],tags:{tagsById:Object.fromEntries((e.tags??[]).map(U=>[U.name,{id:U.name,description:U.description}])),orderedTagIds:e.tags?.map(U=>U.name)},endpoints:C,webhooks:w,channels:{},groupedSchemas:MUe(i,E),securitySchemes:s,security:a,hasEndpointsMarkedInternal:C.some(U=>U.internal),nonRequestReferencedSchemas:h.getReferencedSchemas(),variables:c,globalHeaders:l,idempotencyHeaders:p}}function H4c(e,t,r){if(t.options.removeDiscriminantsFromSchemas===bn.RemoveDiscriminantsFromSchemas.Never)return e;let n={};for(let[i,o]of Object.entries(e)){if(o.type!=="object"){n[i]=o;continue}let s={$ref:`#/components/schemas/${i}`},a=t.getReferencesFromDiscriminatedUnion(s);if(a==null){n[i]=o;continue}if(t.getReferencedSchemas().has(i)){n[i]=o;continue}let c={...o,type:"object",properties:o.properties.filter(p=>!a.discriminants.has(p.key)),allOfPropertyConflicts:o.allOfPropertyConflicts.filter(p=>!a.discriminants.has(p.propertyKey)),source:r};n[i]=c;let l=jZo({schema:o,schemas:e});for(let p of[...new Set(l)]){let d=n[p]??e[p];d==null||d.type!=="object"||(n[p]={...d,type:"object",properties:d.properties.filter(f=>!a.discriminants.has(f.key)),allOfPropertyConflicts:d.allOfPropertyConflicts.filter(f=>!a.discriminants.has(f.propertyKey))})}}return n}function K4c(e,t){let r={};for(let[n,i]of Object.entries(e)){if(i.type!=="object"){r[n]=i;continue}let o={$ref:`#/components/schemas/${n}`},s=t.getDiscriminatedUnionMetadata(o);if(s==null){r[n]=i;continue}let a=[];for(let c of i.properties)if(s.discriminants.has(c.key)){let l=s.discriminants.get(c.key);l!=null&&a.push({...c,schema:kr.literal({nameOverride:void 0,generatedName:Ay([i.generatedName,l],t.options.preserveSchemaIds),title:void 0,value:xg.string(l),namespace:void 0,groupName:void 0,description:void 0,availability:i.availability})})}else a.push(c);let u={...i,type:"object",properties:a};r[n]=u}return r}function jZo({schema:e,schemas:t}){let r=[];for(let n of e.allOf){r.push(n.schema);let i=t[n.schema];i!=null&&i.type==="object"&&r.push(...jZo({schema:i,schemas:t}))}return r}function SYt(e){return[...new Set(e)]}function QZo({operation:e}){let t=[];switch(e.type){case"async":t=SYt(e.async.flatMap(r=>r.audiences));break;case"http":t=SYt(e.value.flatMap(r=>r.audiences));break;case"streaming":t=SYt(e.streaming.flatMap(r=>r.audiences));break;case"webhook":t=SYt(e.value.flatMap(r=>r.audiences));break;default:Be(e)}return t}function W_e({context:e,documents:t,options:r}){let n={apiVersion:void 0,title:void 0,description:void 0,basePath:void 0,servers:[],websocketServers:[],tags:{tagsById:{},orderedTagIds:void 0},hasEndpointsMarkedInternal:!1,endpoints:[],webhooks:[],channels:{},groupedSchemas:{rootSchemas:{},namespacedSchemas:{}},variables:{},nonRequestReferencedSchemas:new Set,securitySchemes:{},security:void 0,globalHeaders:[],idempotencyHeaders:[],groups:{}},i=0;for(let o of t)try{let s=o.source!=null?o.source:ES.openapi({file:"<memory>"});switch(o.type){case"openapi":{let a=NZo({taskContext:e,openApi:o.value,options:dM({options:o.settings,overrides:r}),source:s,namespace:o.namespace});n=eLc(n,a,dM({options:o.settings,overrides:r})),i++;break}case"asyncapi":{let a=EXo({document:o.value,taskContext:e,options:dM({options:o.settings,overrides:r}),source:s,asyncApiOptions:J4c({options:o.settings}),namespace:o.namespace});a.servers!=null&&(n.websocketServers=[...n.websocketServers,...a.servers.map(u=>({...u,audiences:void 0,description:void 0,defaultUrl:void 0,urlTemplate:void 0,variables:void 0}))]),a.channels!=null&&(n.channels={...n.channels,...a.channels}),a.groupedSchemas!=null&&(n.groupedSchemas=BYt(n.groupedSchemas,a.groupedSchemas,r)),a.basePath!=null&&(n.basePath=a.basePath),i++;break}default:Be(o)}}catch(s){e.logger.error(`Failed to parse ${o.type} document ${o.type==="openapi"?o.value.info?.title:o.source?.file}`),s instanceof Error&&e.logger.error(s.message,s.stack?`
1497
1497
  `+s.stack:"")}return n}function J4c({options:e,overrides:t}){return{naming:t?.naming??e?.asyncApiNaming??jYo.naming}}function OYt(e){let t=String(e.description||e.name||e["x-fern-server-name"]||"default").trim(),r=t.toUpperCase();return r==="PRODUCTION"||r==="PRD"||r==="PROD"?"PRD":r==="SANDBOX"||r==="SBX"?"SBX":r==="STAGING"||r==="STG"?"STG":r==="PERFORMANCE"||r==="PRF"||r==="PERF"?"PRF":r==="E2E"||r==="E_2_E"?"E2E":r==="QAL"||r==="QUALITY"?"QAL":t}function uJn(e){try{let n=new URL(e).hostname.split("."),i=new Set(["api","www","service","services","example","com","org","net","io"]);for(let s of n){let a=s.split("-")[0],u=a&&a.length>2?a:s;if(u&&!i.has(u.toLowerCase())&&u.length>2)return u.toLowerCase()}let o=n[0];return o&&o.length>0?o.toLowerCase():"api"}catch{let t=e.match(/https?:\/\/([^./-]+)/);return t&&t[1]?t[1].toLowerCase():"api"}}function aJn(e,t){let r=e??[],n=t??[];if(r.length===0&&n.length===0)return;let i=new Map;for(let o of[...r,...n]){let s=Object.keys(o).sort(),a={};for(let c of s)a[c]=o[c]??[];let u=JSON.stringify(a);i.has(u)||i.set(u,o)}return Array.from(i.values())}function Y4c(e,t){if(Z4c(e))return!0;if(e.length===0||t.length===0||e.length!==t.length)return!1;let r=new Map;for(let o of e){if(o.type==="grouped")continue;let s=OYt(o);r.set(s,o.url)}let n=!0,i=!0;for(let o of t){if(o.type==="grouped")continue;let s=OYt(o),a=r.get(s);a?a===o.url&&(i=!1):n=!1}return n&&i}function cJn(e){return e.defaultUrl??e.url}function X4c(e){if(e.length===0||!e[0])return"api";let t=e[0];return t.type==="grouped"?Object.keys(t.urls)[0]??"api":uJn(cJn(t))}function Z4c(e){return e.some(t=>t.type==="grouped")}function eLc(e,t,r){if(!(r?.groupMultiApiEnvironments===!0))return{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:[...e.servers,...t.servers],websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:[...e.endpoints,...t.endpoints],webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:BYt(e.groupedSchemas,t.groupedSchemas,r),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:aJn(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}};if(Y4c(e.servers,t.servers)){let o=[],s=[],a=X4c(t.servers),u=new Map;for(let p of e.servers)if(p.type==="grouped"){let d=p.name??"default";u.has(d)||u.set(d,{});let f=u.get(d);if(f)for(let[m,h]of Object.entries(p.urls))f[m]=h}else{let d=uJn(cJn(p)),f=OYt(p);u.has(f)||u.set(f,{});let m=u.get(f);m&&(m[d]={url:p.url,audiences:p.audiences,defaultUrl:p.defaultUrl,urlTemplate:p.urlTemplate,variables:p.variables})}for(let p of t.servers){let d=OYt(p);u.has(d)||u.set(d,{});let f=u.get(d);f&&(f[a]={url:p.url,audiences:p.audiences,defaultUrl:p.defaultUrl,urlTemplate:p.urlTemplate,variables:p.variables})}for(let[p,d]of u.entries()){let f={type:"grouped",name:p,description:`${p} environment`,urls:d};o.push(f)}let c=e.endpoints.map(p=>{let d=p.__apiName;if(d)return{...p,type:"multi-api",apiName:d,servers:[{name:d,url:void 0,audiences:void 0}]};let f=e.servers[0],m=f!=null&&f.type!=="grouped"?uJn(cJn(f)):"api";return{...p,type:"multi-api",apiName:m,servers:[{name:m,url:void 0,audiences:void 0}]}}),l=t.endpoints.map(p=>({...p,type:"multi-api",apiName:a,servers:[{name:a,url:void 0,audiences:void 0}]}));return s=[...c,...l],{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:o,websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:s.map(p=>{if(p.type==="multi-api"){let{type:m,apiName:h,servers:g,...A}=p;return{...A,__apiName:h,servers:g}}let{type:d,...f}=p;return f}),webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:BYt(e.groupedSchemas,t.groupedSchemas,r),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:aJn(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}}}return{apiVersion:e.apiVersion??t.apiVersion,title:e.title??t.title,description:e.description??t.description,basePath:e.basePath??t.basePath,servers:[...e.servers,...t.servers],websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:[...e.endpoints,...t.endpoints],webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:BYt(e.groupedSchemas,t.groupedSchemas,r),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:aJn(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}}}function BYt(e,t,r){let n=sG(),i=r?.resolveSchemaCollisions??!1,o={...e.rootSchemas};for(let[s,a]of Object.entries(t.rootSchemas)){let u=n.getUniqueSchemaId(s,void 0,i);o[u]=a}e.rootSchemas=o;for(let[s,a]of Object.entries(t.namespacedSchemas))if(e.namespacedSchemas[s]!=null){let u=e.namespacedSchemas[s];for(let[c,l]of Object.entries(a)){let p=n.getUniqueSchemaId(c,void 0,i);u[p]=l}}else e.namespacedSchemas[s]=a;return e}var Als=xe(Dtr(),1),Rtr={config:new Als.Config({apis:{},styleguide:{plugins:[zKn],rules:{struct:"warn"}}},void 0),dereference:!1,removeUnusedComponents:!1,keepUrlRefs:!1};function h8({options:e,overrides:t}={}){return{...dM({options:e,overrides:t}),...h_e({options:e,overrides:t})}}var yal={shouldUseTitleAsName:"useTitlesAsName",shouldUseUndiscriminatedUnionsWithLiterals:["shouldUseUndiscriminatedUnionsWithLiterals","discriminatedUnionV2"],shouldUseIdiomaticRequestNames:"shouldUseIdiomaticRequestNames",asyncApiMessageNaming:"asyncApiNaming",shouldUseOptionalAdditionalProperties:"optionalAdditionalProperties",coerceEnumsToLiterals:"coerceEnumsToLiterals",objectQueryParameters:"objectQueryParameters",respectReadonlySchemas:"respectReadonlySchemas",respectNullableSchemas:"respectNullableSchemas",onlyIncludeReferencedSchemas:"onlyIncludeReferencedSchemas",inlinePathParameters:"inlinePathParameters",useBytesForBinaryResponse:"useBytesForBinaryResponse",respectForwardCompatibleEnums:"respectForwardCompatibleEnums",filter:"filter",defaultFormParameterEncoding:"defaultFormParameterEncoding",exampleGeneration:"exampleGeneration",additionalPropertiesDefaultsTo:"additionalPropertiesDefaultsTo",typeDatesAsStrings:"typeDatesAsStrings",preserveSingleSchemaOneOf:"preserveSingleSchemaOneOf",inlineAllOfSchemas:"inlineAllOfSchemas",resolveAliases:"resolveAliases",groupMultiApiEnvironments:"groupMultiApiEnvironments",groupEnvironmentsByHost:"groupEnvironmentsByHost",inferDefaultEnvironment:"inferDefaultEnvironment",wrapReferencesToNullableInOptional:"wrapReferencesToNullableInOptional",coerceOptionalSchemasToNullable:"coerceOptionalSchemasToNullable",removeDiscriminantsFromSchemas:"removeDiscriminantsFromSchemas",defaultIntegerFormat:"defaultIntegerFormat",pathParameterOrder:"pathParameterOrder",resolveSchemaCollisions:"resolveSchemaCollisions",inferForwardCompatible:"inferForwardCompatible",coerceConstsTo:"coerceConstsTo"};function bal(e,t,r){r!==void 0&&(e[t]=r)}function Ftr(e){let t={};if(e!=null)for(let[r,n]of Object.entries(yal)){let i=e[r],o=Array.isArray(n)?n:[n];for(let s of o)bal(t,s,i)}return h8({options:t})}function tze(e){if(e.settings==null&&e.apiOverride?.auth==null&&e.apiOverride?.["auth-schemes"]==null&&e.apiOverride?.headers==null)return;let t={detectGlobalHeaders:!0};return e.settings?.unions==="v1"&&(t.discriminatedUnionV2=!0),e.apiOverride?.auth!=null&&(t.auth=e.apiOverride.auth),e.apiOverride?.["auth-schemes"]!=null&&(t.authSchemes=e.apiOverride["auth-schemes"]),e.apiOverride?.headers!=null&&(t.headers=e.apiOverride.headers),t}function g8(e){return e.swagger!=null}function Hti(e){return e.openapi!=null}St();yg();Ci();function ffe(e,t={}){return{...Object.fromEntries(ay(e.namedDefinitionFiles).map(([r,n])=>[r,{...n,defaultUrl:t.defaultURL}])),...ay(e.importedDefinitions).reduce((r,[n,i])=>({...r,...Qpt(ffe(i.definition,{defaultURL:i.url}),(o,s)=>Ub(n,Bs.of(s)))}),{})}}St();yg();Ci();function Dgt(e,t={}){return{...Object.fromEntries(ay(e.packageMarkers).map(([r,n])=>[r,{...n,defaultUrl:t.defaultURL}])),...ay(e.importedDefinitions).reduce((r,[n,i])=>({...r,...Qpt(Dgt(i.definition,{defaultURL:i.url}),(o,s)=>Ub(n,Bs.of(s)))}),{})}}function Qne(e){return{...Dgt(e),...ffe(e)}}function BM(e,t){return Qne(e.definition)[t]?.contents}St();yg();function z0(e,t){for(let[r,n]of ay(Qne(e.definition)))t(r,n.contents,{isPackageMarker:tS(r)===Pp,defaultUrl:n.defaultUrl})}St();function x1e(e,t){for(let[r,n]of ay(Dgt(e.definition)))t(r,n.contents)}St();var yls=xe(require("path"),1);async function ktr({schema:e,value:t,context:r,filepathBeingParsed:n}){let i=await e.safeParseAsync(t);if(i.success)return i.data;let o=i.error.errors.map(a=>{let u=a.path.length>0?`${a.message} at "${Eal(a.path)}"`:a.message;return bj({content:u,prefix:" - "})}),s=[`Failed to parse file: ${yls.default.relative(process.cwd(),n)}`,...o].join(`
1498
- `);return r.failAndThrow(s)}function Eal(e){return e.reduce((t,r)=>typeof r=="number"?t+"["+r+"]":t+(t===""?"":".")+r,"")}qt();var fm=class e extends Error{constructor(){super(),Object.setPrototypeOf(this,e.prototype)}};var A8=class e extends Error{log;constructor(t){super(),this.log=t,Object.setPrototypeOf(this,e.prototype)}};var qn={Trace:"trace",Debug:"debug",Info:"info",Warn:"warn",Error:"error"},S_=Object.values(qn);var Kti=class{log;enabled;constructor(t,r=!0){this.log=t,this.enabled=r}disable(){this.enabled=!1}enable(){this.enabled=!0}debug(...t){this.enabled&&this.log(qn.Debug,...t)}info(...t){this.enabled&&this.log(qn.Info,...t)}warn(...t){this.enabled&&this.log(qn.Warn,...t)}error(...t){this.enabled&&this.log(qn.Error,...t)}trace(...t){this.enabled&&this.log(qn.Trace,...t)}};function fP(e){return new Kti(e)}var Jti=Object.freeze(fP(val));function val(e,...t){Ial(e)(...t)}function Ial(e){switch(e){case qn.Trace:return console.trace;case qn.Debug:return console.debug;case qn.Info:return console.info;case qn.Warn:return console.warn;case qn.Error:return console.error}}var Tp;(function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"})(Tp||(Tp={}));function Yti({logger:e=Jti}={}){let t={logger:e,takeOverTerminal:()=>{throw new Error("Not implemented")},failAndThrow:(r,n)=>{let i=[];throw r!=null&&i.push(r),n!=null&&i.push(JSON.stringify(n)),i.length>0&&t.logger.error(...i),new fm},failWithoutThrowing:(r,n)=>{t.failAndThrow(r,n)},getResult:()=>Tp.Success,addInteractiveTask:()=>{throw new Error("Not implemented")},runInteractiveTask:()=>{throw new Error("Not implemented")},instrumentPostHogEvent:()=>{throw new Error("Not implemented")}};return t}var bls=xe(require("path"),1),wal={dependencies:{}};async function Els({absolutePathToWorkspace:e,rawDependenciesConfiguration:t,context:r}){if(t==null)return wal;let n={};for(let[i,o]of Object.entries(t.dependencies))if(xal(o)){let s=Ut.of(bls.default.join(e,o));await Zt(s)?n[i]={type:"local",absoluteFilepath:s,path:o}:r.failWithoutThrowing(`Path to ${i} dependency does not exist: ${s}`)}else{let a=i.substring(1).split("/"),u=a[0],c=a[1];u!=null&&c!=null?n[i]={type:"version",organization:u,apiName:c,version:o}:r.failWithoutThrowing(`Failed to parse dependency: ${i}`)}return r.getResult()===Tp.Failure&&r.failAndThrow(),{dependencies:n}}var Cal=/^\.\.\/.*$/;function xal(e){return Cal.test(e)}qt();var Ils=require("fs/promises");var vls=mt.object({dependencies:mt.record(mt.string(),mt.string())});async function wls({absolutePathToWorkspace:e,context:t}){let r=We(e,_e.of(Qqo));if(!await Zt(r))return;let n=await(0,Ils.readFile)(r),i=xr.load(n.toString());return await ktr({schema:vls,value:i,context:t,filepathBeingParsed:r})}async function Xti({absolutePathToWorkspace:e,context:t}){let r=await wls({absolutePathToWorkspace:e,context:t});return Els({absolutePathToWorkspace:e,rawDependenciesConfiguration:r,context:t})}St();jtr();function Dls(e={accentPrimary:void 0,background:void 0},t){e.accentPrimary=e.accentPrimary??e.accentPrimaryDeprecated;let r=Ltr(e);switch(r){case"dark":return{type:"dark",...Mtr(e,t,"dark")};case"light":return{type:"light",...Mtr(e,t,"light")};case"darkAndLight":return{type:"darkAndLight",dark:Mtr(e,t,"dark"),light:Mtr(e,t,"light")};default:Be(r)}}function Ltr({background:e,accentPrimary:t,accentPrimaryDeprecated:r}){if(t=t??r,typeof e=="string"&&typeof t=="string")return Vo(e).isDark()?"dark":"light";if(e!=null){if(typeof e=="string")return Vo(e).isDark()?"dark":"light";if(e.dark!=null&&e.light!=null)return"darkAndLight"}if(t!=null){if(typeof t=="string")return Vo(t).isLight()?"dark":"light";if(t.dark!=null&&t.light!=null)return"darkAndLight"}if(t!=null&&e!=null){if(e.dark!=null&&t.dark!=null)return"dark";if(e.light!=null&&t.light!=null)return"light"}return"darkAndLight"}function Mtr(e,t,r){let n=eC(e.accentPrimary??e.accentPrimaryDeprecated,t,"accent-primary",r)??Vo.random(),i=eC(e.background,t,"background",r);return{accentPrimary:n.toRgb(),background:i?.toRgb(),border:eC(e.border,t,"border",r)?.toRgb(),sidebarBackground:eC(e.sidebarBackground,t,"sidebar-background",r)?.toRgb(),headerBackground:eC(e.headerBackground,t,"header-background",r)?.toRgb(),cardBackground:eC(e.cardBackground,t,"card-background",r)?.toRgb(),accent1:eC(e.accent1,t,"accent-1",r)?.toRgb(),accent2:eC(e.accent2,t,"accent-2",r)?.toRgb(),accent3:eC(e.accent3,t,"accent-3",r)?.toRgb(),accent4:eC(e.accent4,t,"accent-4",r)?.toRgb(),accent5:eC(e.accent5,t,"accent-5",r)?.toRgb(),accent6:eC(e.accent6,t,"accent-6",r)?.toRgb(),accent7:eC(e.accent7,t,"accent-7",r)?.toRgb(),accent8:eC(e.accent8,t,"accent-8",r)?.toRgb(),accent9:eC(e.accent9,t,"accent-9",r)?.toRgb(),accent10:eC(e.accent10,t,"accent-10",r)?.toRgb(),accent11:eC(e.accent11,t,"accent-11",r)?.toRgb(),accent12:eC(e.accent12,t,"accent-12",r)?.toRgb(),logo:void 0,backgroundImage:void 0}}function Fgt(e,t,r){if(e==null)return;let n=typeof e=="string"?e:e[r];if(n==null&&t==="accent-primary"&&typeof e!="string"&&(n=e[r==="dark"?"light":"dark"]),n!=null)return n}function eC(e,t,r,n){let i=Fgt(e,r,n);if(i==null)return;let o=Vo(i);return o.isValid()||t.failAndThrow(`'${typeof e=="string"?r:`colors.${r}.${n}`}' should be a hex color of the format #FFFFFF`),o}St();ng();qt();var Dsr=require("fs/promises");var S3s=xe(require("path"),1);St();qt();var iLs=require("fs/promises");Ci();var nLs=100;async function aep({files:e,absolutePathToFernFolder:t}){let r=await Promise.all(e.map(async n=>{let i=await(0,iLs.readFile)(n,"utf-8");return[Yy(t,n),i]}));return Object.fromEntries(r)}async function oLs({files:e,absolutePathToFernFolder:t}){let r={};for(let n=0;n<e.length;n+=nLs){let i=e.slice(n,n+nLs),o=await aep({files:i,absolutePathToFernFolder:t});Object.assign(r,o)}return r}function fsr({landingPage:e,navigation:t}){return Ej([e?.absolutePath,...uep(t)])}function uep(e){switch(e.type){case"tabbed":return e.items.flatMap(t=>t.child.type==="layout"?t.child.layout.flatMap(r=>psr({item:r})):t.child.type==="variants"?t.child.variants.flatMap(r=>r.layout.flatMap(n=>psr({item:n}))):t.child.type==="changelog"?t.child.changelog:[]);case"untabbed":return e.items.flatMap(t=>psr({item:t}));case"versioned":return e.versions.flatMap(t=>fsr({landingPage:t.landingPage,navigation:t.navigation}));case"productgroup":return e.products.flatMap(t=>t.type==="external"?[]:fsr({landingPage:t.landingPage,navigation:t.navigation}));default:Be(e)}}function psr({item:e}){switch(e.type){case"apiSection":return Ej([e.overviewAbsolutePath,...e.navigation.flatMap(t=>sLs({item:t}))]);case"link":return[];case"page":return[e.absolutePath];case"section":return Ej([e.overviewAbsolutePath,...e.contents.flatMap(t=>psr({item:t}))]);case"changelog":return e.changelog;case"librarySection":return[];default:Be(e)}}function sLs({item:e}){return e.type==="page"?[e.absolutePath]:e.type==="package"||e.type==="section"?Ej([e.overviewAbsolutePath,...e.contents.flatMap(t=>sLs({item:t}))]):[]}qt();var Ssr=require("fs/promises"),bpi=xe(b7(),1);function Csr({name:e}){return e.replace(/\.(md|mdx)$/i,"").toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")}function xsr({name:e}){return e.replace(/\.(md|mdx)$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}async function x3s({absolutePath:e,readFileFn:t=(r,n)=>(0,Ssr.readFile)(r,n)}){try{let r=await t(e,"utf-8"),{data:n}=(0,bpi.default)(r);if(n.position==null)return;let i=typeof n.position=="string"?parseFloat(n.position):n.position;return typeof i=="number"&&Number.isFinite(i)?i:void 0}catch{return}}async function _sr({absolutePath:e,readFileFn:t=(r,n)=>(0,Ssr.readFile)(r,n)}){try{let r=await t(e,"utf-8"),{data:n}=(0,bpi.default)(r);return typeof n.title=="string"&&n.title.trim().length>0?n.title.trim():void 0}catch{return}}async function Epi({directoryPath:e,titleSource:t,getDir:r=cy,readFileFn:n=(i,o)=>(0,Ssr.readFile)(i,o)}){let i=await r(e),o=t==="frontmatter",s=i.filter(f=>f.type==="file"&&(f.name.toLowerCase().endsWith(".md")||f.name.toLowerCase().endsWith(".mdx"))),a=i.filter(f=>f.type==="directory"),[u,c]=await Promise.all([Promise.all(s.map(f=>x3s({absolutePath:f.absolutePath,readFileFn:n}))),o?Promise.all(s.map(f=>_sr({absolutePath:f.absolutePath,readFileFn:n}))):Promise.resolve(s.map(()=>{}))]),l=s.map((f,m)=>({type:"page",title:c[m]??xsr({name:f.name}),absolutePath:f.absolutePath,slug:Csr({name:f.name}),icon:void 0,hidden:void 0,noindex:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0,availability:void 0})),p=await Promise.all(a.map(async f=>{let m=await Epi({directoryPath:f.absolutePath,titleSource:t,getDir:r,readFileFn:n}),h=m.find(E=>E.type==="page"&&(E.slug==="index"||E.absolutePath.toLowerCase().endsWith("/index.mdx")||E.absolutePath.toLowerCase().endsWith("/index.md"))),g=h?m.filter(E=>E!==h):m,b=(o&&h?.type==="page"?await _sr({absolutePath:h.absolutePath,readFileFn:n}):void 0)??xsr({name:f.name}),v=h?.type==="page"?await x3s({absolutePath:h.absolutePath,readFileFn:n}):void 0;return{section:{type:"section",title:b,slug:Csr({name:f.name}),icon:void 0,contents:g,collapsed:void 0,collapsible:void 0,collapsedByDefault:void 0,hidden:void 0,skipUrlSlug:!1,overviewAbsolutePath:h?.type==="page"?h.absolutePath:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0,availability:void 0},position:v}})),d=[...l.map((f,m)=>({item:f,title:f.type==="page"?f.title:"",position:u[m]})),...p.map(f=>({item:f.section,title:f.section.type==="section"?f.section.title:"",position:f.position}))];return d.sort((f,m)=>{let h=typeof f.position=="number",g=typeof m.position=="number";if(h&&!g)return-1;if(!h&&g)return 1;if(typeof f.position=="number"&&typeof m.position=="number"){let A=f.position-m.position;return A!==0?A:f.title.localeCompare(m.title,void 0,{sensitivity:"base"})}return f.title.localeCompare(m.title,void 0,{sensitivity:"base"})}),d.map(f=>f.item)}function Enp(e){return!e||e.startsWith("<")?!1:e.startsWith(".")||e.includes("/")||e.includes("\\")||e.includes(":")}function Ey(e,t){if(e)return Enp(e)?ib(e,t):e}async function Cpi({rawDocsConfiguration:e,absolutePathToFernFolder:t,absoluteFilepathToDocsConfig:r,context:n}){let{instances:i,title:o,tabs:s,products:a,versions:u,navigation:c,navbarLinks:l,footerLinks:p,defaultLanguage:d,metadata:f,redirects:m,logo:h,favicon:g,backgroundImage:A,colors:b,typography:v,layout:E,integrations:I,css:w,js:x,aiChat:C,aiSearch:_,pageActions:R,experimental:U}=e,q=Zbt(e.landingPage,r),z=e.settings?.folderTitleSource,J=Rnp({tabs:s,products:a,versions:u,navigation:c,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:z}),ie=J.then(qe=>oLs({files:fsr({navigation:qe,landingPage:q}),absolutePathToFernFolder:t})),V=vnp(h,r),H=ib(g,r),ye=Inp(A,r),Ie=v!=null?Fnp({rawTypography:v,absoluteFilepathToDocsConfig:r}):void 0,K=wnp(w,r),Y=_np(x,r),ge=nip(f,r),[he,Ce,Se,ae,ce,ke]=await Promise.all([J,ie,Ie,K,Y,ge]);return{title:o,instances:i,roles:e.roles,libraries:$np(e.libraries),pages:Ce,landingPage:q,navigation:he,navbarLinks:tip(l,r),footerLinks:rip(p),defaultLanguage:d,languages:e.languages,announcement:e.announcement,metadata:ke,redirects:m?.map(qe=>({...qe,permanent:qe?.permanent})),logo:V,favicon:H,backgroundImage:ye,colors:Dls(b,n),typography:Se,layout:Dnp(E),settings:Tnp(e.settings),theme:Pnp(e.theme),analyticsConfig:{...e.analytics,intercom:e.analytics?.intercom?{...e.analytics.intercom,appId:e.analytics.intercom.appId,apiBase:e.analytics.intercom.apiBase}:void 0,fullstory:e.analytics?.fullstory,posthog:e.analytics?.posthog?{...e.analytics.posthog,apiKey:e.analytics.posthog.apiKey,endpoint:e.analytics.posthog.endpoint}:void 0,segment:e.analytics?.segment,gtm:e.analytics?.gtm,ga4:e.analytics?.ga4,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},integrations:{...I,intercom:I?.intercom?I.intercom:void 0},css:ae,js:ce,aiChatConfig:_??C,pageActions:Snp(R,r),header:ib(e.header,r),footer:ib(e.footer,r),experimental:U}}function vnp(e,t){return e!=null?{dark:ib(e.dark,t),light:ib(e.light,t),height:e.height,href:e.href!=null?_r.Url(e.href):void 0,rightText:e.rightText}:void 0}function Inp(e,t){if(e!=null)if(typeof e=="string"){let r=ib(e,t);return{dark:r,light:r}}else{let r=ib(e.dark,t),n=ib(e.light,t);return{dark:r,light:n}}}async function wnp(e,t){if(e==null)return;let r=typeof e=="string"?[e]:e;return{inline:await Promise.all(r.map(async n=>(await(0,Dsr.readFile)(ib(n,t))).toString()))}}function Cnp(e){return Object.hasOwn(e,"url")}function xnp(e){return Object.hasOwn(e,"path")}async function _np(e,t){let r=[],n=[];if(e==null)return{files:[]};let i=Array.isArray(e)?e:[e];for(let o of i)typeof o=="string"?n.push({absolutePath:ib(o,t)}):Cnp(o)?r.push({strategy:o.strategy,url:_r.Url(o.url)}):xnp(o)&&n.push({absolutePath:ib(o.path,t),strategy:o.strategy});return{remote:r,files:n}}function Snp(e,t){return e==null?void 0:{default:e.default!=null?Bnp(e.default):void 0,options:{askAi:e.options?.askAi??!0,copyPage:e.options?.copyPage??!0,viewAsMarkdown:e.options?.viewAsMarkdown??!0,openAi:e.options?.chatgpt??!0,claude:e.options?.claude??!0,cursor:e.options?.cursor??!0,vscode:e.options?.vscode??!1,custom:(e.options?.custom??[]).map(n=>Onp(n,t))}}}function Bnp(e){switch(e){case"copy-page":return _r.docs.v1.commons.PageActionOption.CopyPage;case"view-as-markdown":return _r.docs.v1.commons.PageActionOption.ViewAsMarkdown;case"ask-ai":return _r.docs.v1.commons.PageActionOption.AskAi;case"chatgpt":return _r.docs.v1.commons.PageActionOption.OpenAi;case"claude":return _r.docs.v1.commons.PageActionOption.Claude;case"cursor":return _r.docs.v1.commons.PageActionOption.Cursor;case"vscode":return _r.docs.v1.commons.PageActionOption.Vscode;default:Be(e)}}function Onp(e,t){return{title:e.title,subtitle:e.subtitle,url:e.url,icon:Ey(e.icon,t),default:e.default}}function Pnp(e){if(e!=null)return{sidebar:e.sidebar??"default",tabs:e.tabs??"default",body:e.body??"default",pageActions:e.pageActions??"default",footerNav:e.footerNav??"default",languageSwitcher:e.languageSwitcher??"default",productSwitcher:e.productSwitcher??"default"}}function Tnp(e){if(e!=null)return{darkModeCode:e.darkModeCode??!1,defaultSearchFilters:e.defaultSearchFilters??!1,language:e.language??"en",disableSearch:e.disableSearch??!1,hide404Page:e.hide404Page??!1,httpSnippets:e.httpSnippets??!0,searchText:e.searchText??void 0,useJavascriptAsTypescript:e.useJavascriptAsTypescript??!1,disableExplorerProxy:e.disableExplorerProxy??!1,disableAnalytics:e.disableAnalytics??!1}}function Dnp(e){if(e!=null)return{pageWidth:e.pageWidth?.trim().toLowerCase()==="full"?{type:"full"}:Bsr(e.pageWidth),contentWidth:Bsr(e.contentWidth),sidebarWidth:Bsr(e.sidebarWidth),headerHeight:Bsr(e.headerHeight),searchbarPlacement:e.searchbarPlacement==="header"?_r.docs.v1.commons.SearchbarPlacement.Header:e.searchbarPlacement==="header-tabs"?_r.docs.v1.commons.SearchbarPlacement.HeaderTabs:_r.docs.v1.commons.SearchbarPlacement.Sidebar,switcherPlacement:!e.switcherPlacement||e.switcherPlacement==="header"?_r.docs.v1.commons.SwitcherPlacement.Header:_r.docs.v1.commons.SwitcherPlacement.Sidebar,tabsPlacement:e.tabsPlacement==="header"?_r.docs.v1.commons.TabsPlacement.Header:_r.docs.v1.commons.TabsPlacement.Sidebar,contentAlignment:e.contentAlignment==="left"?_r.docs.v1.commons.ContentAlignment.Left:_r.docs.v1.commons.ContentAlignment.Center,headerPosition:e.headerPosition==="static"?_r.docs.v1.commons.HeaderPosition.Absolute:_r.docs.v1.commons.HeaderPosition.Fixed,disableHeader:e.disableHeader??!1,hideNavLinks:e.hideNavLinks??!1,hideFeedback:e.hideFeedback??!1}}function Bsr(e){if(e==null)return;let t=e.trim().toLowerCase(),r=t.match(/^(\d+)px$/);if(r!=null&&r[1]!=null)return{type:"px",value:parseFloat(r[1])};let n=t.match(/^(\d+)rem$/);if(n!=null&&n[1]!=null)return{type:"rem",value:parseFloat(n[1])}}async function _3s({versions:e,absolutePathToFernFolder:t,context:r,folderTitleSource:n}){let i=[];for(let o of e){let s=Xi(t,o.path),a=xr.load((await(0,Dsr.readFile)(s)).toString()),u=[],c=V2(a,[],u);u.length>0&&r.logger.warn(`Version file ${o.path} contained null/undefined sections that were ignored: ${u.map(d=>d.join(".")).join(", ")}`);let l=Uw.RawSchemas.Serializer.VersionFileConfig.parseOrThrow(c),p=await wpi({tabs:l.tabs,rawNavigationConfig:l.navigation,absolutePathToFernFolder:t,absolutePathToConfig:s,context:r,folderTitleSource:n});i.push({landingPage:Zbt(l.landingPage,s),version:o.displayName,navigation:p,availability:o.availability,slug:o.slug,hidden:o.hidden,viewers:pC(o.viewers),orphaned:o.orphaned,featureFlags:lC(o.featureFlag),announcement:o.announcement})}return{type:"versioned",versions:i}}async function Rnp({tabs:e,products:t,versions:r,navigation:n,absolutePathToFernFolder:i,absolutePathToConfig:o,context:s,folderTitleSource:a}){if(n!=null)return await wpi({tabs:e,rawNavigationConfig:n,absolutePathToFernFolder:i,absolutePathToConfig:o,context:s,folderTitleSource:a});if(t!=null){let u=[];for(let c of t){let l=c.image!=null?Xi(i,c.image):void 0;if("path"in c){let p,d=Xi(i,c.path),f=xr.load((await(0,Dsr.readFile)(d)).toString()),m=[],h=V2(f,[],m);m.length>0&&s.logger.warn(`Product file ${c.path} contained null/undefined sections that were ignored: ${m.map(A=>A.join(".")).join(", ")}`);let g=Uw.RawSchemas.Serializer.ProductFileConfig.parseOrThrow(h);c.versions!=null&&c.versions.length>0?p=await _3s({versions:c.versions,absolutePathToFernFolder:i,context:s,folderTitleSource:a}):p=await wpi({tabs:g.tabs,rawNavigationConfig:g.navigation,absolutePathToFernFolder:i,absolutePathToConfig:d,context:s,folderTitleSource:a}),u.push({type:"internal",landingPage:Zbt(g.landingPage,d),product:c.displayName,navigation:p,slug:c.slug,subtitle:c.subtitle,icon:Ey(c.icon,o)||"fa-solid fa-code",image:l,viewers:pC(c.viewers),orphaned:c.orphaned,featureFlags:lC(c.featureFlag),announcement:c.announcement})}else if("href"in c&&c.href!=null)u.push({type:"external",product:c.displayName,href:c.href,target:c.target,subtitle:c.subtitle,icon:Ey(c.icon,o)||"fa-solid fa-code",image:l,viewers:pC(c.viewers),orphaned:c.orphaned,featureFlags:lC(c.featureFlag)});else throw new Error("Invalid product configuration: product must have either 'path' or valid 'href' property")}return{type:"productgroup",products:u}}else if(r!=null)return await _3s({versions:r,absolutePathToFernFolder:i,context:s,folderTitleSource:a});throw new Error("Unexpected. Docs have neither navigation or versions defined.")}function lC(e){if(e!=null)return typeof e=="string"?[{flag:e,match:!0,fallbackValue:void 0}]:Array.isArray(e)?e.map(t=>({flag:t.flag,match:t.match,fallbackValue:t.fallbackValue})):[{flag:e.flag,match:e.match??!0,fallbackValue:e.fallbackValue}]}async function Fnp({rawTypography:e,absoluteFilepathToDocsConfig:t}){return{headingsFont:e.headingsFont!=null?await vpi({rawFontConfig:e.headingsFont,absoluteFilepathToDocsConfig:t}):void 0,bodyFont:e.bodyFont!=null?await vpi({rawFontConfig:e.bodyFont,absoluteFilepathToDocsConfig:t}):void 0,codeFont:e.codeFont!=null?await vpi({rawFontConfig:e.codeFont,absoluteFilepathToDocsConfig:t}):void 0}}async function vpi({rawFontConfig:e,absoluteFilepathToDocsConfig:t}){return{name:e.name,variants:await knp(e,t),display:e.display,fallback:e.fallback,fontVariationSettings:e.fontVariationSettings}}function knp(e,t){let r=[];return e.path!=null&&r.push({path:e.path,weight:e.weight,style:e.style}),e.paths?.forEach(n=>{typeof n=="string"?r.push({path:n,weight:e.weight,style:e.style}):r.push({path:n.path,weight:n.weight??e.weight,style:n.style??e.style})}),Promise.all(r.map(async n=>({absolutePath:ib(n.path,t),weight:Qnp(n.weight),style:n.style})))}function Qnp(e){return e==null?void 0:typeof e=="number"?[e.toString()]:e.split(/\D+/).filter(r=>r!==""&&["100","200","300","400","500","600","700","800","900"].includes(r))}async function Nnp({tabs:e,item:t,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o}){let s=e[t.tab];if(s==null)throw new Error(`Tab ${t.tab} is not defined in the tabs config.`);if(eip(t)){let a=await Promise.all(t.variants.map(async u=>{let c=await Promise.all(u.layout.map(l=>Tsr({rawConfig:l,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})));return{title:u.title,subtitle:u.subtitle,icon:Ey(u.icon,n),layout:c,slug:u.slug,skipUrlSlug:u.skipSlug,hidden:u.hidden,default:u.default,viewers:pC(u.viewers),orphaned:u.orphaned,featureFlags:lC(u.featureFlag)}}));return{title:s.displayName,icon:Ey(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"variants",variants:a},viewers:pC(s.viewers),orphaned:s.orphaned,featureFlags:lC(s.featureFlag)}}if(Znp(t)){let a=await Promise.all(t.layout.map(u=>Tsr({rawConfig:u,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})));return{title:s.displayName,icon:Ey(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"layout",layout:a},viewers:pC(s.viewers),orphaned:s.orphaned,featureFlags:lC(s.featureFlag)}}if(s.href!=null)return{title:s.displayName,icon:Ey(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"link",href:s.href,target:s.target},viewers:pC(s.viewers),orphaned:s.orphaned,featureFlags:lC(s.featureFlag)};if(s.changelog!=null)return{title:s.displayName,icon:Ey(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"changelog",changelog:await Iw(ib(s.changelog,n),"{md,mdx}")},viewers:pC(s.viewers),orphaned:s.orphaned,featureFlags:lC(s.featureFlag)};Be(s)}async function wpi({tabs:e={},rawNavigationConfig:t,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o}){return Xnp(t)?{type:"tabbed",items:await Promise.all(t.map(a=>Nnp({tabs:e,item:a,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})))}:{type:"untabbed",items:await Promise.all(t.map(s=>Tsr({rawConfig:s,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})))}}var jnp="Changelog";async function Mnp({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}){let o=ib(e.folder,r);await Zt(o)||n.failAndThrow(`Folder not found: ${e.folder}`),xpi({context:n,sectionTitle:e.folder,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0});let s=e.titleSource??i,a=await Epi({directoryPath:o,titleSource:s}),u=a.find(m=>m.type==="page"&&(m.slug==="index"||m.absolutePath.toLowerCase().endsWith("/index.mdx")||m.absolutePath.toLowerCase().endsWith("/index.md"))),c=u?a.filter(m=>m!==u):a,l=S3s.default.basename(o),p=s==="frontmatter"&&u?.type==="page"?await _sr({absolutePath:u.absolutePath}):void 0,d=e.title??p??xsr({name:l}),f=e.slug??Csr({name:l});return{type:"section",title:d,icon:Ey(e.icon,r),contents:c,slug:f,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,hidden:e.hidden??void 0,skipUrlSlug:e.skipSlug??!1,overviewAbsolutePath:u?.type==="page"?u.absolutePath:void 0,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag),availability:e.availability}}async function Tsr({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}){if(B3s(e))return Zbt(e,r);if(Unp(e))return xpi({context:n,sectionTitle:e.section,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0}),{type:"section",title:e.section,icon:Ey(e.icon,r),contents:await Promise.all(e.contents.map(o=>Tsr({rawConfig:o,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}))),slug:e.slug??void 0,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,hidden:e.hidden??void 0,skipUrlSlug:e.skipSlug??!1,overviewAbsolutePath:ib(e.path,r),viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag),availability:e.availability};if(znp(e))return{type:"apiSection",openrpc:e.openrpc,title:e.api,icon:Ey(e.icon,r),apiName:e.apiName??void 0,audiences:e.audiences!=null?{type:"select",audiences:e0t(e.audiences)??[]}:{type:"all"},availability:e.availability,showErrors:e.displayErrors??!0,tagDescriptionPages:e.tagDescriptionPages??!1,snippetsConfiguration:e.snippets!=null?Lnp({rawConfig:e.snippets}):void 0,postman:e.postman,navigation:e.layout?.flatMap(o=>Psr(o,r,n))??[],overviewAbsolutePath:ib(e.summary,r),collapsed:e.collapsed??void 0,hidden:e.hidden??void 0,slug:e.slug,skipUrlSlug:e.skipSlug??!1,flattened:e.flattened??!1,alphabetized:e.alphabetized??!1,paginated:e.paginated??!1,playground:e.playground,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)};if(O3s(e))return{type:"link",text:e.link,url:e.href,icon:Ey(e.icon,r),target:e.target};if(Vnp(e))return{type:"changelog",changelog:await Iw(ib(e.changelog,r),"{md,mdx}"),hidden:e.hidden??!1,icon:Ey(e.icon,r),title:e.title??jnp,slug:e.slug,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)};if(qnp(e))return await Mnp({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i});if(Gnp(e))return{type:"librarySection",libraryName:e.library,title:e.title??void 0,slug:e.slug??void 0,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)};Be(e)}function Zbt(e,t){if(e!=null)return{type:"page",title:e.page,absolutePath:ib(e.path,t),slug:e.slug,icon:Ey(e.icon,t),hidden:e.hidden,noindex:e.noindex,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag),availability:e.availability}}function Psr(e,t,r){return typeof e=="string"?[{type:"item",value:e}]:B3s(e)?[Zbt(e,t)]:O3s(e)?[{type:"link",text:e.link,url:e.href,icon:Ey(e.icon,t),target:e.target}]:Hnp(e)?(r!=null&&xpi({context:r,sectionTitle:e.section,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0}),[{type:"section",title:e.section,referencedSubpackages:e.referencedPackages??[],overviewAbsolutePath:ib(e.summary,t),contents:e.contents?.flatMap(n=>Psr(n,t,r))??[],slug:e.slug,hidden:e.hidden,skipUrlSlug:e.skipSlug,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,availability:e.availability,icon:Ey(e.icon,t),playground:e.playground,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)}]):Knp(e)?[{type:"endpoint",endpoint:e.endpoint,title:e.title,icon:Ey(e.icon,t),slug:e.slug,hidden:e.hidden,availability:e.availability,playground:e.playground,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)}]:Jnp(e)?[{type:"operation",operation:e.operation,title:e.title,slug:e.slug,hidden:e.hidden,availability:e.availability,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)}]:Object.entries(e).map(([n,i])=>Ynp(i)?{type:"package",title:i.title,package:n,overviewAbsolutePath:ib(i.summary,t),contents:i.contents?.flatMap(o=>Psr(o,t,r))??[],slug:i.slug,hidden:i.hidden,skipUrlSlug:i.skipSlug,icon:Ey(i.icon,t),playground:i.playground,availability:i.availability,viewers:pC(i.viewers),orphaned:i.orphaned,featureFlags:lC(i.featureFlag)}:{type:"package",title:void 0,package:n,overviewAbsolutePath:void 0,contents:i.flatMap(o=>Psr(o,t,r)),hidden:!1,slug:void 0,skipUrlSlug:!1,icon:void 0,playground:void 0,availability:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}function Lnp({rawConfig:e}){return{python:e.python,typescript:e.typescript,go:e.go,java:e.java,ruby:e.ruby,csharp:e.csharp,php:e.php,swift:e.swift}}function B3s(e){return Aa(e)&&typeof e.page=="string"&&typeof e.path=="string"}function Unp(e){return e.section!=null}function znp(e){return e.api!=null}function O3s(e){return Uw.RawSchemas,Aa(e)&&typeof e.link=="string"&&typeof e.href=="string"}function Vnp(e){return Aa(e)&&typeof e.changelog=="string"}function qnp(e){return Aa(e)&&typeof e.folder=="string"}function Gnp(e){return Aa(e)&&typeof e.library=="string"}function Wnp(e){return"git"in e}function $np(e){if(e==null)return;let t={};for(let[r,n]of Object.entries(e)){if(!Wnp(n.input))throw new Error(`Library '${r}' uses 'path' input which is not yet supported. Please use 'git' input.`);t[r]={input:{git:n.input.git,subpath:n.input.subpath},output:{path:n.output.path},lang:n.lang}}return t}function Hnp(e){return Aa(e)&&typeof e.section=="string"&&Array.isArray(e.contents)}function Knp(e){return Aa(e)&&typeof e.endpoint=="string"}function Jnp(e){return Aa(e)&&typeof e.operation=="string"}function Ynp(e){return!Array.isArray(e)}function ib(e,t){if(e!=null)return Xi(An(t),e)}function Xnp(e){return Array.isArray(e)&&e.length>0&&e[0].tab!=null}function Znp(e){return"layout"in e&&Array.isArray(e.layout)}function eip(e){return"variants"in e&&Array.isArray(e.variants)}function tip(e,t){return e?.map(r=>{if(r.type==="github"){let i=r.value;return typeof i=="string"?{type:"github",url:_r.Url(i),viewers:void 0,target:void 0}:{type:"github",url:_r.Url(i.url),viewers:Ipi(i.viewers),target:i.target}}let n=Ipi(r.viewers);return r.type==="dropdown"?{type:"dropdown",text:r.text,icon:Ey(r.icon,t),rightIcon:Ey(r.rightIcon,t),rounded:r.rounded,viewers:n,links:r.links?.map(i=>({href:i.href,target:i.target,url:_r.Url(i.url??i.href??"/"),text:i.text,icon:Ey(i.icon,t),rightIcon:Ey(i.rightIcon,t),rounded:i.rounded,viewers:Ipi(i.viewers)}))??[]}:{type:r.type,text:r.text,url:_r.Url(r.href??r.url??"/"),target:r.target,icon:Ey(r.icon,t),rightIcon:Ey(r.rightIcon,t),rounded:r.rounded,viewers:n}})}function Ipi(e){if(e!=null)return Array.isArray(e)?e.map(t=>_r.RoleId(t)):[_r.RoleId(e)]}function rip(e){if(e==null)return;let t=[];if(Object.keys(e).forEach(r=>{let n=e[r];n!=null&&t.push({type:r,value:_r.Url(n)})}),t.length!==0)return t}async function nip(e,t){if(e!=null)return{"og:site_name":e.ogSiteName,"og:title":e.ogTitle,"og:description":e.ogDescription,"og:url":e.ogUrl,"og:image":await Osr(e.ogImage,t),"og:image:width":e.ogImageWidth,"og:image:height":e.ogImageHeight,"og:locale":e.ogLocale,"og:logo":await Osr(e.ogLogo,t),"twitter:title":e.twitterTitle,"twitter:description":e.twitterDescription,"twitter:image":await Osr(e.twitterImage,t),"twitter:handle":e.twitterHandle,"twitter:site":e.twitterSite,"twitter:url":e.twitterUrl,"twitter:card":e.twitterCard,"og:dynamic":e.ogDynamic,"og:background-image":await Osr(e.ogBackgroundImage,t),nofollow:void 0,noindex:void 0,canonicalHost:e.canonicalHost}}async function Osr(e,t){if(e==null)return;if(e.startsWith("http"))return{type:"url",value:e};let r=ib(e,t);return await Zt(r)?{type:"filepath",value:r}:{type:"url",value:e}}function pC(e){if(e!=null){if(typeof e=="string")return[_r.RoleId(e)];if(e.length!==0)return e.map(_r.RoleId)}}function e0t(e){if(e!=null){if(typeof e=="string")return[e];if(e.length!==0)return e}}function xpi({context:e,sectionTitle:t,collapsed:r,collapsible:n,collapsedByDefault:i}){n!=null&&r!=null&&e.failAndThrow(`Section "${t}": cannot use both "collapsible" and the deprecated "collapsed" property. Please use "collapsible" and "collapsed-by-default" instead.`),i!=null&&n!==!0&&e.failAndThrow(`Section "${t}": "collapsed-by-default" requires "collapsible: true". "collapsed-by-default" has no effect on a non-collapsible section.`)}qt();var T3s=require("fs/promises");var P3s=mt.strictObject({organization:mt.string(),version:mt.string()});async function bQ({directory:e,context:t}){let r=We(e,_e.of(Gb)),n=await(0,T3s.readFile)(r),i=JSON.parse(n.toString()),o=await ktr({schema:P3s,value:i,context:t,filepathBeingParsed:r});return{_absolutePath:r,rawConfig:o,organization:o.organization,version:o.version}}var tt={TYPESCRIPT:"fernapi/fern-typescript",TYPESCRIPT_SDK:"fernapi/fern-typescript-sdk",TYPESCRIPT_NODE_SDK:"fernapi/fern-typescript-node-sdk",TYPESCRIPT_BROWSER_SDK:"fernapi/fern-typescript-browser-sdk",TYPESCRIPT_EXPRESS:"fernapi/fern-typescript-express",JAVA:"fernapi/fern-java",JAVA_MODEL:"fernapi/fern-java-model",JAVA_SDK:"fernapi/fern-java-sdk",JAVA_SPRING:"fernapi/fern-java-spring",PYTHON_FASTAPI:"fernapi/fern-fastapi-server",PYTHON_PYDANTIC:"fernapi/fern-pydantic-model",PYTHON_SDK:"fernapi/fern-python-sdk",GO_MODEL:"fernapi/fern-go-model",GO_SDK:"fernapi/fern-go-sdk",RUBY_SDK:"fernapi/fern-ruby-sdk",CSHARP_MODEL:"fernapi/fern-csharp-model",CSHARP_SDK:"fernapi/fern-csharp-sdk",SWIFT_MODEL:"fernapi/fern-swift-model",SWIFT_SDK:"fernapi/fern-swift-sdk",PHP_MODEL:"fernapi/fern-php-model",PHP_SDK:"fernapi/fern-php-sdk",RUST_MODEL:"fernapi/fern-rust-model",RUST_SDK:"fernapi/fern-rust-sdk",OPENAPI:"fernapi/fern-openapi",STOPLIGHT:"fernapi/fern-stoplight",POSTMAN:"fernapi/fern-postman",OPENAPI_PYTHON_CLIENT:"fernapi/openapi-python-client"};var Wdi=xe(Xx(),1);var t0t={[tt.JAVA]:{version:"2.38.1"},[tt.TYPESCRIPT_EXPRESS]:{version:"0.18.4",output:{location:"local-file-system",path:"../src/fern"}},[tt.JAVA_MODEL]:{version:"1.0.0"},[tt.JAVA_SDK]:{version:"2.38.1",output:{location:"local-file-system",path:"../sdks/java/src/main/java/"}},[tt.JAVA_SPRING]:{version:"0.9.2",output:{location:"local-file-system",path:"../src/main/java/com/fern"}},[tt.TYPESCRIPT]:{version:"0.0.247"},[tt.TYPESCRIPT_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[tt.TYPESCRIPT_NODE_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[tt.TYPESCRIPT_BROWSER_SDK]:{version:"1.0.0",output:{location:"local-file-system",path:"../sdks/typescript"}},[tt.PYTHON_PYDANTIC]:{version:"1.4.7"},[tt.PYTHON_FASTAPI]:{version:"1.7.0",output:{location:"local-file-system",path:"../src/fern"}},[tt.PYTHON_SDK]:{version:"4.23.2",output:{location:"local-file-system",path:"../sdks/python"}},[tt.GO_MODEL]:{version:"0.23.5"},[tt.GO_SDK]:{version:"1.4.0",output:{location:"local-file-system",path:"../sdks/go"},config:{module:{path:"sdk"}}},[tt.RUBY_SDK]:{version:"0.8.2",output:{location:"local-file-system",path:"../sdks/ruby"}},[tt.OPENAPI]:{version:"0.1.7",config:{format:"yaml"},output:{location:"local-file-system",path:"../openapi"}},[tt.STOPLIGHT]:{version:"0.0.28",config:{format:"yaml"}},[tt.POSTMAN]:{version:"0.4.0",output:{location:"local-file-system",path:"../postman"}},[tt.OPENAPI_PYTHON_CLIENT]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/python"},config:{format:"yaml"}},[tt.CSHARP_MODEL]:{version:"0.0.1"},[tt.CSHARP_SDK]:{version:"2.0.2",output:{location:"local-file-system",path:"../sdks/csharp"}},[tt.SWIFT_MODEL]:{version:"0.0.0"},[tt.SWIFT_SDK]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/swift/sdk"}},[tt.PHP_MODEL]:{version:"0.0.0"},[tt.PHP_SDK]:{version:"1.16.3",output:{location:"local-file-system",path:"../sdks/php/sdk"}},[tt.RUST_MODEL]:{version:"0.0.1",output:{location:"local-file-system",path:"../models/rust"}},[tt.RUST_SDK]:{version:"0.0.1",output:{location:"local-file-system",path:"../sdks/rust"}}};var r0t="fernapi",yBe="fern-api";function fC(e){return e=Z5e(e),e.includes("/")?e:`${r0t}/${e}`}function Z5e(e){let t=`${yBe}/`;return e.startsWith(t)?`${r0t}/${e.slice(t.length)}`:e}function _pi(e,t){let r=`${yBe}/`;if(e.startsWith(r)){let n=`${r0t}/${e.slice(r.length)}`;return t.logger.warn(`"${e}" is not a valid generator name. Using "${n}" instead \u2014 the Docker org is "fernapi", not "fern-api".`),n}return e}function Spi(e){let t=`${r0t}/`;return e.startsWith(t)?e.slice(t.length):e}function Bpi(e,t){let r=bBe(e);return r??t.failAndThrow("Unrecognized generator: "+e)}var iip={"fernapi/java-model":tt.JAVA_MODEL,"fernapi/fern-typescript-node-sdk":tt.TYPESCRIPT_SDK};function bBe(e){e=fC(e);let t=iip[e];if(t!=null&&(e=t),oip(e))return e}function oip(e){return Object.values(tt).includes(e)}var bur=xe(k8e(),1),Q9s=xe(Xx(),1);async function VS({generatorName:e,cliVersion:t,channel:r,currentGeneratorVersion:n,includeMajor:i,context:o}){let s=Q9s.default.parse(n),a="https://registry.buildwithfern.com",u=new bur.FernRegistryClient({environment:a});o?.logger.debug(`Getting latest version for ${e} with CLI version ${t}, includeMajor: ${i}, prior version: ${s}, FDR origin: ${a}`);let c={generator:kAp(e,o),releaseTypes:[r??bur.FernRegistry.generators.ReleaseType.Ga],cliVersion:t};!i&&s!=null&&(c.generatorMajorVersion=s.major),o?.logger.debug(`[FDR] getLatestGeneratorRelease request: ${JSON.stringify(c)}`);let l=await u.generators.versions.getLatestGeneratorRelease(c);if(l.ok)return o?.logger.debug(`[FDR] getLatestGeneratorRelease response for ${e}: version=${l.body.version}, irVersion=${l.body.irVersion}`),l.body.version;o?.logger.debug(`[FDR] getLatestGeneratorRelease failed for ${e}: ${JSON.stringify(l)}`)}function kAp(e,t){switch(e.startsWith("fernapi/")&&(e=e.replace("fernapi/","")),e){case"fern-python-sdk":return"python-sdk";case"fern-pydantic-model":return"pydantic";case"fern-fastapi-server":return"fastapi";case"fern-typescript":case"fern-typescript-browser-sdk":case"fern-typescript-node-sdk":case"fern-typescript-sdk":return"ts-sdk";case"fern-typescript-express":return"ts-express";case"fern-java-sdk":return"java-sdk";case"fern-java-model":case"java-model":return"java-model";case"fern-java-spring":return"java-spring";case"fern-go-sdk":return"go-sdk";case"fern-go-model":return"go-model";case"fern-csharp-sdk":return"csharp-sdk";case"fern-csharp-model":return"csharp-model";case"fern-ruby-sdk":return"ruby-sdk";case"fern-postman":return"postman";case"fern-openapi":return"openapi";case"fern-php-sdk":return"php-sdk";case"fern-php-model":return"php-model";case"fern-rust-sdk":return"rust-sdk";case"fern-rust-model":return"rust-model";case"fern-swift-sdk":return"swift-sdk";case"fern-swift-model":return"swift-model";default:return t?.logger.warn(`Unrecognized generator name found, attempting to parse manually: ${e}`),e.startsWith("fern-")?e.replace("fern-",""):e}}async function N9s({generatorsConfiguration:e,groupName:t=e[bn.DEFAULT_GROUP_GENERATORS_CONFIG_KEY],context:r,update:n}){if(t==null){let s=Object.keys(e.groups??{});if(s.length>0){let a=`No group specified. Use the --group option:
1498
+ `);return r.failAndThrow(s)}function Eal(e){return e.reduce((t,r)=>typeof r=="number"?t+"["+r+"]":t+(t===""?"":".")+r,"")}qt();var fm=class e extends Error{constructor(){super(),Object.setPrototypeOf(this,e.prototype)}};var A8=class e extends Error{log;constructor(t){super(),this.log=t,Object.setPrototypeOf(this,e.prototype)}};var qn={Trace:"trace",Debug:"debug",Info:"info",Warn:"warn",Error:"error"},S_=Object.values(qn);var Kti=class{log;enabled;constructor(t,r=!0){this.log=t,this.enabled=r}disable(){this.enabled=!1}enable(){this.enabled=!0}debug(...t){this.enabled&&this.log(qn.Debug,...t)}info(...t){this.enabled&&this.log(qn.Info,...t)}warn(...t){this.enabled&&this.log(qn.Warn,...t)}error(...t){this.enabled&&this.log(qn.Error,...t)}trace(...t){this.enabled&&this.log(qn.Trace,...t)}};function fP(e){return new Kti(e)}var Jti=Object.freeze(fP(val));function val(e,...t){Ial(e)(...t)}function Ial(e){switch(e){case qn.Trace:return console.trace;case qn.Debug:return console.debug;case qn.Info:return console.info;case qn.Warn:return console.warn;case qn.Error:return console.error}}var Tp;(function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"})(Tp||(Tp={}));function Yti({logger:e=Jti}={}){let t={logger:e,takeOverTerminal:()=>{throw new Error("Not implemented")},failAndThrow:(r,n)=>{let i=[];throw r!=null&&i.push(r),n!=null&&i.push(JSON.stringify(n)),i.length>0&&t.logger.error(...i),new fm},failWithoutThrowing:(r,n)=>{t.failAndThrow(r,n)},getResult:()=>Tp.Success,addInteractiveTask:()=>{throw new Error("Not implemented")},runInteractiveTask:()=>{throw new Error("Not implemented")},instrumentPostHogEvent:()=>{throw new Error("Not implemented")}};return t}var bls=xe(require("path"),1),wal={dependencies:{}};async function Els({absolutePathToWorkspace:e,rawDependenciesConfiguration:t,context:r}){if(t==null)return wal;let n={};for(let[i,o]of Object.entries(t.dependencies))if(xal(o)){let s=Ut.of(bls.default.join(e,o));await Zt(s)?n[i]={type:"local",absoluteFilepath:s,path:o}:r.failWithoutThrowing(`Path to ${i} dependency does not exist: ${s}`)}else{let a=i.substring(1).split("/"),u=a[0],c=a[1];u!=null&&c!=null?n[i]={type:"version",organization:u,apiName:c,version:o}:r.failWithoutThrowing(`Failed to parse dependency: ${i}`)}return r.getResult()===Tp.Failure&&r.failAndThrow(),{dependencies:n}}var Cal=/^\.\.\/.*$/;function xal(e){return Cal.test(e)}qt();var Ils=require("fs/promises");var vls=mt.object({dependencies:mt.record(mt.string(),mt.string())});async function wls({absolutePathToWorkspace:e,context:t}){let r=We(e,_e.of(Qqo));if(!await Zt(r))return;let n=await(0,Ils.readFile)(r),i=xr.load(n.toString());return await ktr({schema:vls,value:i,context:t,filepathBeingParsed:r})}async function Xti({absolutePathToWorkspace:e,context:t}){let r=await wls({absolutePathToWorkspace:e,context:t});return Els({absolutePathToWorkspace:e,rawDependenciesConfiguration:r,context:t})}St();jtr();function Dls(e={accentPrimary:void 0,background:void 0},t){e.accentPrimary=e.accentPrimary??e.accentPrimaryDeprecated;let r=Ltr(e);switch(r){case"dark":return{type:"dark",...Mtr(e,t,"dark")};case"light":return{type:"light",...Mtr(e,t,"light")};case"darkAndLight":return{type:"darkAndLight",dark:Mtr(e,t,"dark"),light:Mtr(e,t,"light")};default:Be(r)}}function Ltr({background:e,accentPrimary:t,accentPrimaryDeprecated:r}){if(t=t??r,typeof e=="string"&&typeof t=="string")return Vo(e).isDark()?"dark":"light";if(e!=null){if(typeof e=="string")return Vo(e).isDark()?"dark":"light";if(e.dark!=null&&e.light!=null)return"darkAndLight"}if(t!=null){if(typeof t=="string")return Vo(t).isLight()?"dark":"light";if(t.dark!=null&&t.light!=null)return"darkAndLight"}if(t!=null&&e!=null){if(e.dark!=null&&t.dark!=null)return"dark";if(e.light!=null&&t.light!=null)return"light"}return"darkAndLight"}function Mtr(e,t,r){let n=eC(e.accentPrimary??e.accentPrimaryDeprecated,t,"accent-primary",r)??Vo.random(),i=eC(e.background,t,"background",r);return{accentPrimary:n.toRgb(),background:i?.toRgb(),border:eC(e.border,t,"border",r)?.toRgb(),sidebarBackground:eC(e.sidebarBackground,t,"sidebar-background",r)?.toRgb(),headerBackground:eC(e.headerBackground,t,"header-background",r)?.toRgb(),cardBackground:eC(e.cardBackground,t,"card-background",r)?.toRgb(),accent1:eC(e.accent1,t,"accent-1",r)?.toRgb(),accent2:eC(e.accent2,t,"accent-2",r)?.toRgb(),accent3:eC(e.accent3,t,"accent-3",r)?.toRgb(),accent4:eC(e.accent4,t,"accent-4",r)?.toRgb(),accent5:eC(e.accent5,t,"accent-5",r)?.toRgb(),accent6:eC(e.accent6,t,"accent-6",r)?.toRgb(),accent7:eC(e.accent7,t,"accent-7",r)?.toRgb(),accent8:eC(e.accent8,t,"accent-8",r)?.toRgb(),accent9:eC(e.accent9,t,"accent-9",r)?.toRgb(),accent10:eC(e.accent10,t,"accent-10",r)?.toRgb(),accent11:eC(e.accent11,t,"accent-11",r)?.toRgb(),accent12:eC(e.accent12,t,"accent-12",r)?.toRgb(),logo:void 0,backgroundImage:void 0}}function Fgt(e,t,r){if(e==null)return;let n=typeof e=="string"?e:e[r];if(n==null&&t==="accent-primary"&&typeof e!="string"&&(n=e[r==="dark"?"light":"dark"]),n!=null)return n}function eC(e,t,r,n){let i=Fgt(e,r,n);if(i==null)return;let o=Vo(i);return o.isValid()||t.failAndThrow(`'${typeof e=="string"?r:`colors.${r}.${n}`}' should be a hex color of the format #FFFFFF`),o}St();ng();qt();var Dsr=require("fs/promises");var S3s=xe(require("path"),1);St();qt();var iLs=require("fs/promises");Ci();var nLs=100;async function aep({files:e,absolutePathToFernFolder:t}){let r=await Promise.all(e.map(async n=>{let i=await(0,iLs.readFile)(n,"utf-8");return[Yy(t,n),i]}));return Object.fromEntries(r)}async function oLs({files:e,absolutePathToFernFolder:t}){let r={};for(let n=0;n<e.length;n+=nLs){let i=e.slice(n,n+nLs),o=await aep({files:i,absolutePathToFernFolder:t});Object.assign(r,o)}return r}function fsr({landingPage:e,navigation:t}){return Ej([e?.absolutePath,...uep(t)])}function uep(e){switch(e.type){case"tabbed":return e.items.flatMap(t=>t.child.type==="layout"?t.child.layout.flatMap(r=>psr({item:r})):t.child.type==="variants"?t.child.variants.flatMap(r=>r.layout.flatMap(n=>psr({item:n}))):t.child.type==="changelog"?t.child.changelog:[]);case"untabbed":return e.items.flatMap(t=>psr({item:t}));case"versioned":return e.versions.flatMap(t=>fsr({landingPage:t.landingPage,navigation:t.navigation}));case"productgroup":return e.products.flatMap(t=>t.type==="external"?[]:fsr({landingPage:t.landingPage,navigation:t.navigation}));default:Be(e)}}function psr({item:e}){switch(e.type){case"apiSection":return Ej([e.overviewAbsolutePath,...e.navigation.flatMap(t=>sLs({item:t}))]);case"link":return[];case"page":return[e.absolutePath];case"section":return Ej([e.overviewAbsolutePath,...e.contents.flatMap(t=>psr({item:t}))]);case"changelog":return e.changelog;case"librarySection":return[];default:Be(e)}}function sLs({item:e}){return e.type==="page"?[e.absolutePath]:e.type==="package"||e.type==="section"?Ej([e.overviewAbsolutePath,...e.contents.flatMap(t=>sLs({item:t}))]):[]}qt();var Ssr=require("fs/promises"),bpi=xe(b7(),1);function Csr({name:e}){return e.replace(/\.(md|mdx)$/i,"").toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")}function xsr({name:e}){return e.replace(/\.(md|mdx)$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}async function x3s({absolutePath:e,readFileFn:t=(r,n)=>(0,Ssr.readFile)(r,n)}){try{let r=await t(e,"utf-8"),{data:n}=(0,bpi.default)(r);if(n.position==null)return;let i=typeof n.position=="string"?parseFloat(n.position):n.position;return typeof i=="number"&&Number.isFinite(i)?i:void 0}catch{return}}async function _sr({absolutePath:e,readFileFn:t=(r,n)=>(0,Ssr.readFile)(r,n)}){try{let r=await t(e,"utf-8"),{data:n}=(0,bpi.default)(r);return typeof n.title=="string"&&n.title.trim().length>0?n.title.trim():void 0}catch{return}}async function Epi({directoryPath:e,titleSource:t,getDir:r=cy,readFileFn:n=(i,o)=>(0,Ssr.readFile)(i,o)}){let i=await r(e),o=t==="frontmatter",s=i.filter(f=>f.type==="file"&&!f.name.startsWith("_")&&(f.name.toLowerCase().endsWith(".md")||f.name.toLowerCase().endsWith(".mdx"))),a=i.filter(f=>f.type==="directory"&&!f.name.startsWith("_")),[u,c]=await Promise.all([Promise.all(s.map(f=>x3s({absolutePath:f.absolutePath,readFileFn:n}))),o?Promise.all(s.map(f=>_sr({absolutePath:f.absolutePath,readFileFn:n}))):Promise.resolve(s.map(()=>{}))]),l=s.map((f,m)=>({type:"page",title:c[m]??xsr({name:f.name}),absolutePath:f.absolutePath,slug:Csr({name:f.name}),icon:void 0,hidden:void 0,noindex:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0,availability:void 0})),p=await Promise.all(a.map(async f=>{let m=await Epi({directoryPath:f.absolutePath,titleSource:t,getDir:r,readFileFn:n}),h=m.find(E=>E.type==="page"&&(E.slug==="index"||E.absolutePath.toLowerCase().endsWith("/index.mdx")||E.absolutePath.toLowerCase().endsWith("/index.md"))),g=h?m.filter(E=>E!==h):m,b=(o&&h?.type==="page"?await _sr({absolutePath:h.absolutePath,readFileFn:n}):void 0)??xsr({name:f.name}),v=h?.type==="page"?await x3s({absolutePath:h.absolutePath,readFileFn:n}):void 0;return{section:{type:"section",title:b,slug:Csr({name:f.name}),icon:void 0,contents:g,collapsed:void 0,collapsible:void 0,collapsedByDefault:void 0,hidden:void 0,skipUrlSlug:!1,overviewAbsolutePath:h?.type==="page"?h.absolutePath:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0,availability:void 0},position:v}})),d=[...l.map((f,m)=>({item:f,title:f.type==="page"?f.title:"",position:u[m]})),...p.map(f=>({item:f.section,title:f.section.type==="section"?f.section.title:"",position:f.position}))];return d.sort((f,m)=>{let h=typeof f.position=="number",g=typeof m.position=="number";if(h&&!g)return-1;if(!h&&g)return 1;if(typeof f.position=="number"&&typeof m.position=="number"){let A=f.position-m.position;return A!==0?A:f.title.localeCompare(m.title,void 0,{sensitivity:"base"})}return f.title.localeCompare(m.title,void 0,{sensitivity:"base"})}),d.map(f=>f.item)}function Enp(e){return!e||e.startsWith("<")?!1:e.startsWith(".")||e.includes("/")||e.includes("\\")||e.includes(":")}function Ey(e,t){if(e)return Enp(e)?ib(e,t):e}async function Cpi({rawDocsConfiguration:e,absolutePathToFernFolder:t,absoluteFilepathToDocsConfig:r,context:n}){let{instances:i,title:o,tabs:s,products:a,versions:u,navigation:c,navbarLinks:l,footerLinks:p,defaultLanguage:d,metadata:f,redirects:m,logo:h,favicon:g,backgroundImage:A,colors:b,typography:v,layout:E,integrations:I,css:w,js:x,aiChat:C,aiSearch:_,pageActions:R,experimental:U}=e,q=Zbt(e.landingPage,r),z=e.settings?.folderTitleSource,J=Rnp({tabs:s,products:a,versions:u,navigation:c,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:z}),ie=J.then(qe=>oLs({files:fsr({navigation:qe,landingPage:q}),absolutePathToFernFolder:t})),V=vnp(h,r),H=ib(g,r),ye=Inp(A,r),Ie=v!=null?Fnp({rawTypography:v,absoluteFilepathToDocsConfig:r}):void 0,K=wnp(w,r),Y=_np(x,r),ge=nip(f,r),[he,Ce,Se,ae,ce,ke]=await Promise.all([J,ie,Ie,K,Y,ge]);return{title:o,instances:i,roles:e.roles,libraries:$np(e.libraries),pages:Ce,landingPage:q,navigation:he,navbarLinks:tip(l,r),footerLinks:rip(p),defaultLanguage:d,languages:e.languages,announcement:e.announcement,metadata:ke,redirects:m?.map(qe=>({...qe,permanent:qe?.permanent})),logo:V,favicon:H,backgroundImage:ye,colors:Dls(b,n),typography:Se,layout:Dnp(E),settings:Tnp(e.settings),theme:Pnp(e.theme),analyticsConfig:{...e.analytics,intercom:e.analytics?.intercom?{...e.analytics.intercom,appId:e.analytics.intercom.appId,apiBase:e.analytics.intercom.apiBase}:void 0,fullstory:e.analytics?.fullstory,posthog:e.analytics?.posthog?{...e.analytics.posthog,apiKey:e.analytics.posthog.apiKey,endpoint:e.analytics.posthog.endpoint}:void 0,segment:e.analytics?.segment,gtm:e.analytics?.gtm,ga4:e.analytics?.ga4,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},integrations:{...I,intercom:I?.intercom?I.intercom:void 0},css:ae,js:ce,aiChatConfig:_??C,pageActions:Snp(R,r),header:ib(e.header,r),footer:ib(e.footer,r),experimental:U}}function vnp(e,t){return e!=null?{dark:ib(e.dark,t),light:ib(e.light,t),height:e.height,href:e.href!=null?_r.Url(e.href):void 0,rightText:e.rightText}:void 0}function Inp(e,t){if(e!=null)if(typeof e=="string"){let r=ib(e,t);return{dark:r,light:r}}else{let r=ib(e.dark,t),n=ib(e.light,t);return{dark:r,light:n}}}async function wnp(e,t){if(e==null)return;let r=typeof e=="string"?[e]:e;return{inline:await Promise.all(r.map(async n=>(await(0,Dsr.readFile)(ib(n,t))).toString()))}}function Cnp(e){return Object.hasOwn(e,"url")}function xnp(e){return Object.hasOwn(e,"path")}async function _np(e,t){let r=[],n=[];if(e==null)return{files:[]};let i=Array.isArray(e)?e:[e];for(let o of i)typeof o=="string"?n.push({absolutePath:ib(o,t)}):Cnp(o)?r.push({strategy:o.strategy,url:_r.Url(o.url)}):xnp(o)&&n.push({absolutePath:ib(o.path,t),strategy:o.strategy});return{remote:r,files:n}}function Snp(e,t){return e==null?void 0:{default:e.default!=null?Bnp(e.default):void 0,options:{askAi:e.options?.askAi??!0,copyPage:e.options?.copyPage??!0,viewAsMarkdown:e.options?.viewAsMarkdown??!0,openAi:e.options?.chatgpt??!0,claude:e.options?.claude??!0,cursor:e.options?.cursor??!0,vscode:e.options?.vscode??!1,custom:(e.options?.custom??[]).map(n=>Onp(n,t))}}}function Bnp(e){switch(e){case"copy-page":return _r.docs.v1.commons.PageActionOption.CopyPage;case"view-as-markdown":return _r.docs.v1.commons.PageActionOption.ViewAsMarkdown;case"ask-ai":return _r.docs.v1.commons.PageActionOption.AskAi;case"chatgpt":return _r.docs.v1.commons.PageActionOption.OpenAi;case"claude":return _r.docs.v1.commons.PageActionOption.Claude;case"cursor":return _r.docs.v1.commons.PageActionOption.Cursor;case"vscode":return _r.docs.v1.commons.PageActionOption.Vscode;default:Be(e)}}function Onp(e,t){return{title:e.title,subtitle:e.subtitle,url:e.url,icon:Ey(e.icon,t),default:e.default}}function Pnp(e){if(e!=null)return{sidebar:e.sidebar??"default",tabs:e.tabs??"default",body:e.body??"default",pageActions:e.pageActions??"default",footerNav:e.footerNav??"default",languageSwitcher:e.languageSwitcher??"default",productSwitcher:e.productSwitcher??"default"}}function Tnp(e){if(e!=null)return{darkModeCode:e.darkModeCode??!1,defaultSearchFilters:e.defaultSearchFilters??!1,language:e.language??"en",disableSearch:e.disableSearch??!1,hide404Page:e.hide404Page??!1,httpSnippets:e.httpSnippets??!0,searchText:e.searchText??void 0,useJavascriptAsTypescript:e.useJavascriptAsTypescript??!1,disableExplorerProxy:e.disableExplorerProxy??!1,disableAnalytics:e.disableAnalytics??!1}}function Dnp(e){if(e!=null)return{pageWidth:e.pageWidth?.trim().toLowerCase()==="full"?{type:"full"}:Bsr(e.pageWidth),contentWidth:Bsr(e.contentWidth),sidebarWidth:Bsr(e.sidebarWidth),headerHeight:Bsr(e.headerHeight),searchbarPlacement:e.searchbarPlacement==="header"?_r.docs.v1.commons.SearchbarPlacement.Header:e.searchbarPlacement==="header-tabs"?_r.docs.v1.commons.SearchbarPlacement.HeaderTabs:_r.docs.v1.commons.SearchbarPlacement.Sidebar,switcherPlacement:!e.switcherPlacement||e.switcherPlacement==="header"?_r.docs.v1.commons.SwitcherPlacement.Header:_r.docs.v1.commons.SwitcherPlacement.Sidebar,tabsPlacement:e.tabsPlacement==="header"?_r.docs.v1.commons.TabsPlacement.Header:_r.docs.v1.commons.TabsPlacement.Sidebar,contentAlignment:e.contentAlignment==="left"?_r.docs.v1.commons.ContentAlignment.Left:_r.docs.v1.commons.ContentAlignment.Center,headerPosition:e.headerPosition==="static"?_r.docs.v1.commons.HeaderPosition.Absolute:_r.docs.v1.commons.HeaderPosition.Fixed,disableHeader:e.disableHeader??!1,hideNavLinks:e.hideNavLinks??!1,hideFeedback:e.hideFeedback??!1}}function Bsr(e){if(e==null)return;let t=e.trim().toLowerCase(),r=t.match(/^(\d+)px$/);if(r!=null&&r[1]!=null)return{type:"px",value:parseFloat(r[1])};let n=t.match(/^(\d+)rem$/);if(n!=null&&n[1]!=null)return{type:"rem",value:parseFloat(n[1])}}async function _3s({versions:e,absolutePathToFernFolder:t,context:r,folderTitleSource:n}){let i=[];for(let o of e){let s=Xi(t,o.path),a=xr.load((await(0,Dsr.readFile)(s)).toString()),u=[],c=V2(a,[],u);u.length>0&&r.logger.warn(`Version file ${o.path} contained null/undefined sections that were ignored: ${u.map(d=>d.join(".")).join(", ")}`);let l=Uw.RawSchemas.Serializer.VersionFileConfig.parseOrThrow(c),p=await wpi({tabs:l.tabs,rawNavigationConfig:l.navigation,absolutePathToFernFolder:t,absolutePathToConfig:s,context:r,folderTitleSource:n});i.push({landingPage:Zbt(l.landingPage,s),version:o.displayName,navigation:p,availability:o.availability,slug:o.slug,hidden:o.hidden,viewers:pC(o.viewers),orphaned:o.orphaned,featureFlags:lC(o.featureFlag),announcement:o.announcement})}return{type:"versioned",versions:i}}async function Rnp({tabs:e,products:t,versions:r,navigation:n,absolutePathToFernFolder:i,absolutePathToConfig:o,context:s,folderTitleSource:a}){if(n!=null)return await wpi({tabs:e,rawNavigationConfig:n,absolutePathToFernFolder:i,absolutePathToConfig:o,context:s,folderTitleSource:a});if(t!=null){let u=[];for(let c of t){let l=c.image!=null?Xi(i,c.image):void 0;if("path"in c){let p,d=Xi(i,c.path),f=xr.load((await(0,Dsr.readFile)(d)).toString()),m=[],h=V2(f,[],m);m.length>0&&s.logger.warn(`Product file ${c.path} contained null/undefined sections that were ignored: ${m.map(A=>A.join(".")).join(", ")}`);let g=Uw.RawSchemas.Serializer.ProductFileConfig.parseOrThrow(h);c.versions!=null&&c.versions.length>0?p=await _3s({versions:c.versions,absolutePathToFernFolder:i,context:s,folderTitleSource:a}):p=await wpi({tabs:g.tabs,rawNavigationConfig:g.navigation,absolutePathToFernFolder:i,absolutePathToConfig:d,context:s,folderTitleSource:a}),u.push({type:"internal",landingPage:Zbt(g.landingPage,d),product:c.displayName,navigation:p,slug:c.slug,subtitle:c.subtitle,icon:Ey(c.icon,o)||"fa-solid fa-code",image:l,viewers:pC(c.viewers),orphaned:c.orphaned,featureFlags:lC(c.featureFlag),announcement:c.announcement})}else if("href"in c&&c.href!=null)u.push({type:"external",product:c.displayName,href:c.href,target:c.target,subtitle:c.subtitle,icon:Ey(c.icon,o)||"fa-solid fa-code",image:l,viewers:pC(c.viewers),orphaned:c.orphaned,featureFlags:lC(c.featureFlag)});else throw new Error("Invalid product configuration: product must have either 'path' or valid 'href' property")}return{type:"productgroup",products:u}}else if(r!=null)return await _3s({versions:r,absolutePathToFernFolder:i,context:s,folderTitleSource:a});throw new Error("Unexpected. Docs have neither navigation or versions defined.")}function lC(e){if(e!=null)return typeof e=="string"?[{flag:e,match:!0,fallbackValue:void 0}]:Array.isArray(e)?e.map(t=>({flag:t.flag,match:t.match,fallbackValue:t.fallbackValue})):[{flag:e.flag,match:e.match??!0,fallbackValue:e.fallbackValue}]}async function Fnp({rawTypography:e,absoluteFilepathToDocsConfig:t}){return{headingsFont:e.headingsFont!=null?await vpi({rawFontConfig:e.headingsFont,absoluteFilepathToDocsConfig:t}):void 0,bodyFont:e.bodyFont!=null?await vpi({rawFontConfig:e.bodyFont,absoluteFilepathToDocsConfig:t}):void 0,codeFont:e.codeFont!=null?await vpi({rawFontConfig:e.codeFont,absoluteFilepathToDocsConfig:t}):void 0}}async function vpi({rawFontConfig:e,absoluteFilepathToDocsConfig:t}){return{name:e.name,variants:await knp(e,t),display:e.display,fallback:e.fallback,fontVariationSettings:e.fontVariationSettings}}function knp(e,t){let r=[];return e.path!=null&&r.push({path:e.path,weight:e.weight,style:e.style}),e.paths?.forEach(n=>{typeof n=="string"?r.push({path:n,weight:e.weight,style:e.style}):r.push({path:n.path,weight:n.weight??e.weight,style:n.style??e.style})}),Promise.all(r.map(async n=>({absolutePath:ib(n.path,t),weight:Qnp(n.weight),style:n.style})))}function Qnp(e){return e==null?void 0:typeof e=="number"?[e.toString()]:e.split(/\D+/).filter(r=>r!==""&&["100","200","300","400","500","600","700","800","900"].includes(r))}async function Nnp({tabs:e,item:t,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o}){let s=e[t.tab];if(s==null)throw new Error(`Tab ${t.tab} is not defined in the tabs config.`);if(eip(t)){let a=await Promise.all(t.variants.map(async u=>{let c=await Promise.all(u.layout.map(l=>Tsr({rawConfig:l,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})));return{title:u.title,subtitle:u.subtitle,icon:Ey(u.icon,n),layout:c,slug:u.slug,skipUrlSlug:u.skipSlug,hidden:u.hidden,default:u.default,viewers:pC(u.viewers),orphaned:u.orphaned,featureFlags:lC(u.featureFlag)}}));return{title:s.displayName,icon:Ey(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"variants",variants:a},viewers:pC(s.viewers),orphaned:s.orphaned,featureFlags:lC(s.featureFlag)}}if(Znp(t)){let a=await Promise.all(t.layout.map(u=>Tsr({rawConfig:u,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})));return{title:s.displayName,icon:Ey(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"layout",layout:a},viewers:pC(s.viewers),orphaned:s.orphaned,featureFlags:lC(s.featureFlag)}}if(s.href!=null)return{title:s.displayName,icon:Ey(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"link",href:s.href,target:s.target},viewers:pC(s.viewers),orphaned:s.orphaned,featureFlags:lC(s.featureFlag)};if(s.changelog!=null)return{title:s.displayName,icon:Ey(s.icon,n),slug:s.slug,skipUrlSlug:s.skipSlug,hidden:s.hidden,child:{type:"changelog",changelog:await Iw(ib(s.changelog,n),"{md,mdx}")},viewers:pC(s.viewers),orphaned:s.orphaned,featureFlags:lC(s.featureFlag)};Be(s)}async function wpi({tabs:e={},rawNavigationConfig:t,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o}){return Xnp(t)?{type:"tabbed",items:await Promise.all(t.map(a=>Nnp({tabs:e,item:a,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})))}:{type:"untabbed",items:await Promise.all(t.map(s=>Tsr({rawConfig:s,absolutePathToFernFolder:r,absolutePathToConfig:n,context:i,folderTitleSource:o})))}}var jnp="Changelog";async function Mnp({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}){let o=ib(e.folder,r);await Zt(o)||n.failAndThrow(`Folder not found: ${e.folder}`),xpi({context:n,sectionTitle:e.folder,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0});let s=e.titleSource??i,a=await Epi({directoryPath:o,titleSource:s}),u=a.find(m=>m.type==="page"&&(m.slug==="index"||m.absolutePath.toLowerCase().endsWith("/index.mdx")||m.absolutePath.toLowerCase().endsWith("/index.md"))),c=u?a.filter(m=>m!==u):a,l=S3s.default.basename(o),p=s==="frontmatter"&&u?.type==="page"?await _sr({absolutePath:u.absolutePath}):void 0,d=e.title??p??xsr({name:l}),f=e.slug??Csr({name:l});return{type:"section",title:d,icon:Ey(e.icon,r),contents:c,slug:f,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,hidden:e.hidden??void 0,skipUrlSlug:e.skipSlug??!1,overviewAbsolutePath:u?.type==="page"?u.absolutePath:void 0,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag),availability:e.availability}}async function Tsr({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}){if(B3s(e))return Zbt(e,r);if(Unp(e))return xpi({context:n,sectionTitle:e.section,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0}),{type:"section",title:e.section,icon:Ey(e.icon,r),contents:await Promise.all(e.contents.map(o=>Tsr({rawConfig:o,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i}))),slug:e.slug??void 0,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,hidden:e.hidden??void 0,skipUrlSlug:e.skipSlug??!1,overviewAbsolutePath:ib(e.path,r),viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag),availability:e.availability};if(znp(e))return{type:"apiSection",openrpc:e.openrpc,title:e.api,icon:Ey(e.icon,r),apiName:e.apiName??void 0,audiences:e.audiences!=null?{type:"select",audiences:e0t(e.audiences)??[]}:{type:"all"},availability:e.availability,showErrors:e.displayErrors??!0,tagDescriptionPages:e.tagDescriptionPages??!1,snippetsConfiguration:e.snippets!=null?Lnp({rawConfig:e.snippets}):void 0,postman:e.postman,navigation:e.layout?.flatMap(o=>Psr(o,r,n))??[],overviewAbsolutePath:ib(e.summary,r),collapsed:e.collapsed??void 0,hidden:e.hidden??void 0,slug:e.slug,skipUrlSlug:e.skipSlug??!1,flattened:e.flattened??!1,alphabetized:e.alphabetized??!1,paginated:e.paginated??!1,playground:e.playground,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)};if(O3s(e))return{type:"link",text:e.link,url:e.href,icon:Ey(e.icon,r),target:e.target};if(Vnp(e))return{type:"changelog",changelog:await Iw(ib(e.changelog,r),"{md,mdx}"),hidden:e.hidden??!1,icon:Ey(e.icon,r),title:e.title??jnp,slug:e.slug,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)};if(qnp(e))return await Mnp({rawConfig:e,absolutePathToFernFolder:t,absolutePathToConfig:r,context:n,folderTitleSource:i});if(Gnp(e))return{type:"librarySection",libraryName:e.library,title:e.title??void 0,slug:e.slug??void 0,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)};Be(e)}function Zbt(e,t){if(e!=null)return{type:"page",title:e.page,absolutePath:ib(e.path,t),slug:e.slug,icon:Ey(e.icon,t),hidden:e.hidden,noindex:e.noindex,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag),availability:e.availability}}function Psr(e,t,r){return typeof e=="string"?[{type:"item",value:e}]:B3s(e)?[Zbt(e,t)]:O3s(e)?[{type:"link",text:e.link,url:e.href,icon:Ey(e.icon,t),target:e.target}]:Hnp(e)?(r!=null&&xpi({context:r,sectionTitle:e.section,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0}),[{type:"section",title:e.section,referencedSubpackages:e.referencedPackages??[],overviewAbsolutePath:ib(e.summary,t),contents:e.contents?.flatMap(n=>Psr(n,t,r))??[],slug:e.slug,hidden:e.hidden,skipUrlSlug:e.skipSlug,collapsed:e.collapsed??void 0,collapsible:e.collapsible??void 0,collapsedByDefault:e.collapsedByDefault??void 0,availability:e.availability,icon:Ey(e.icon,t),playground:e.playground,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)}]):Knp(e)?[{type:"endpoint",endpoint:e.endpoint,title:e.title,icon:Ey(e.icon,t),slug:e.slug,hidden:e.hidden,availability:e.availability,playground:e.playground,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)}]:Jnp(e)?[{type:"operation",operation:e.operation,title:e.title,slug:e.slug,hidden:e.hidden,availability:e.availability,viewers:pC(e.viewers),orphaned:e.orphaned,featureFlags:lC(e.featureFlag)}]:Object.entries(e).map(([n,i])=>Ynp(i)?{type:"package",title:i.title,package:n,overviewAbsolutePath:ib(i.summary,t),contents:i.contents?.flatMap(o=>Psr(o,t,r))??[],slug:i.slug,hidden:i.hidden,skipUrlSlug:i.skipSlug,icon:Ey(i.icon,t),playground:i.playground,availability:i.availability,viewers:pC(i.viewers),orphaned:i.orphaned,featureFlags:lC(i.featureFlag)}:{type:"package",title:void 0,package:n,overviewAbsolutePath:void 0,contents:i.flatMap(o=>Psr(o,t,r)),hidden:!1,slug:void 0,skipUrlSlug:!1,icon:void 0,playground:void 0,availability:void 0,viewers:void 0,orphaned:void 0,featureFlags:void 0})}function Lnp({rawConfig:e}){return{python:e.python,typescript:e.typescript,go:e.go,java:e.java,ruby:e.ruby,csharp:e.csharp,php:e.php,swift:e.swift}}function B3s(e){return Aa(e)&&typeof e.page=="string"&&typeof e.path=="string"}function Unp(e){return e.section!=null}function znp(e){return e.api!=null}function O3s(e){return Uw.RawSchemas,Aa(e)&&typeof e.link=="string"&&typeof e.href=="string"}function Vnp(e){return Aa(e)&&typeof e.changelog=="string"}function qnp(e){return Aa(e)&&typeof e.folder=="string"}function Gnp(e){return Aa(e)&&typeof e.library=="string"}function Wnp(e){return"git"in e}function $np(e){if(e==null)return;let t={};for(let[r,n]of Object.entries(e)){if(!Wnp(n.input))throw new Error(`Library '${r}' uses 'path' input which is not yet supported. Please use 'git' input.`);t[r]={input:{git:n.input.git,subpath:n.input.subpath},output:{path:n.output.path},lang:n.lang}}return t}function Hnp(e){return Aa(e)&&typeof e.section=="string"&&Array.isArray(e.contents)}function Knp(e){return Aa(e)&&typeof e.endpoint=="string"}function Jnp(e){return Aa(e)&&typeof e.operation=="string"}function Ynp(e){return!Array.isArray(e)}function ib(e,t){if(e!=null)return Xi(An(t),e)}function Xnp(e){return Array.isArray(e)&&e.length>0&&e[0].tab!=null}function Znp(e){return"layout"in e&&Array.isArray(e.layout)}function eip(e){return"variants"in e&&Array.isArray(e.variants)}function tip(e,t){return e?.map(r=>{if(r.type==="github"){let i=r.value;return typeof i=="string"?{type:"github",url:_r.Url(i),viewers:void 0,target:void 0}:{type:"github",url:_r.Url(i.url),viewers:Ipi(i.viewers),target:i.target}}let n=Ipi(r.viewers);return r.type==="dropdown"?{type:"dropdown",text:r.text,icon:Ey(r.icon,t),rightIcon:Ey(r.rightIcon,t),rounded:r.rounded,viewers:n,links:r.links?.map(i=>({href:i.href,target:i.target,url:_r.Url(i.url??i.href??"/"),text:i.text,icon:Ey(i.icon,t),rightIcon:Ey(i.rightIcon,t),rounded:i.rounded,viewers:Ipi(i.viewers)}))??[]}:{type:r.type,text:r.text,url:_r.Url(r.href??r.url??"/"),target:r.target,icon:Ey(r.icon,t),rightIcon:Ey(r.rightIcon,t),rounded:r.rounded,viewers:n}})}function Ipi(e){if(e!=null)return Array.isArray(e)?e.map(t=>_r.RoleId(t)):[_r.RoleId(e)]}function rip(e){if(e==null)return;let t=[];if(Object.keys(e).forEach(r=>{let n=e[r];n!=null&&t.push({type:r,value:_r.Url(n)})}),t.length!==0)return t}async function nip(e,t){if(e!=null)return{"og:site_name":e.ogSiteName,"og:title":e.ogTitle,"og:description":e.ogDescription,"og:url":e.ogUrl,"og:image":await Osr(e.ogImage,t),"og:image:width":e.ogImageWidth,"og:image:height":e.ogImageHeight,"og:locale":e.ogLocale,"og:logo":await Osr(e.ogLogo,t),"twitter:title":e.twitterTitle,"twitter:description":e.twitterDescription,"twitter:image":await Osr(e.twitterImage,t),"twitter:handle":e.twitterHandle,"twitter:site":e.twitterSite,"twitter:url":e.twitterUrl,"twitter:card":e.twitterCard,"og:dynamic":e.ogDynamic,"og:background-image":await Osr(e.ogBackgroundImage,t),nofollow:void 0,noindex:void 0,canonicalHost:e.canonicalHost}}async function Osr(e,t){if(e==null)return;if(e.startsWith("http"))return{type:"url",value:e};let r=ib(e,t);return await Zt(r)?{type:"filepath",value:r}:{type:"url",value:e}}function pC(e){if(e!=null){if(typeof e=="string")return[_r.RoleId(e)];if(e.length!==0)return e.map(_r.RoleId)}}function e0t(e){if(e!=null){if(typeof e=="string")return[e];if(e.length!==0)return e}}function xpi({context:e,sectionTitle:t,collapsed:r,collapsible:n,collapsedByDefault:i}){n!=null&&r!=null&&e.failAndThrow(`Section "${t}": cannot use both "collapsible" and the deprecated "collapsed" property. Please use "collapsible" and "collapsed-by-default" instead.`),i!=null&&n!==!0&&e.failAndThrow(`Section "${t}": "collapsed-by-default" requires "collapsible: true". "collapsed-by-default" has no effect on a non-collapsible section.`)}qt();var T3s=require("fs/promises");var P3s=mt.strictObject({organization:mt.string(),version:mt.string()});async function bQ({directory:e,context:t}){let r=We(e,_e.of(Gb)),n=await(0,T3s.readFile)(r),i=JSON.parse(n.toString()),o=await ktr({schema:P3s,value:i,context:t,filepathBeingParsed:r});return{_absolutePath:r,rawConfig:o,organization:o.organization,version:o.version}}var tt={TYPESCRIPT:"fernapi/fern-typescript",TYPESCRIPT_SDK:"fernapi/fern-typescript-sdk",TYPESCRIPT_NODE_SDK:"fernapi/fern-typescript-node-sdk",TYPESCRIPT_BROWSER_SDK:"fernapi/fern-typescript-browser-sdk",TYPESCRIPT_EXPRESS:"fernapi/fern-typescript-express",JAVA:"fernapi/fern-java",JAVA_MODEL:"fernapi/fern-java-model",JAVA_SDK:"fernapi/fern-java-sdk",JAVA_SPRING:"fernapi/fern-java-spring",PYTHON_FASTAPI:"fernapi/fern-fastapi-server",PYTHON_PYDANTIC:"fernapi/fern-pydantic-model",PYTHON_SDK:"fernapi/fern-python-sdk",GO_MODEL:"fernapi/fern-go-model",GO_SDK:"fernapi/fern-go-sdk",RUBY_SDK:"fernapi/fern-ruby-sdk",CSHARP_MODEL:"fernapi/fern-csharp-model",CSHARP_SDK:"fernapi/fern-csharp-sdk",SWIFT_MODEL:"fernapi/fern-swift-model",SWIFT_SDK:"fernapi/fern-swift-sdk",PHP_MODEL:"fernapi/fern-php-model",PHP_SDK:"fernapi/fern-php-sdk",RUST_MODEL:"fernapi/fern-rust-model",RUST_SDK:"fernapi/fern-rust-sdk",OPENAPI:"fernapi/fern-openapi",STOPLIGHT:"fernapi/fern-stoplight",POSTMAN:"fernapi/fern-postman",OPENAPI_PYTHON_CLIENT:"fernapi/openapi-python-client"};var Wdi=xe(Xx(),1);var t0t={[tt.JAVA]:{version:"2.38.1"},[tt.TYPESCRIPT_EXPRESS]:{version:"0.18.4",output:{location:"local-file-system",path:"../src/fern"}},[tt.JAVA_MODEL]:{version:"1.0.0"},[tt.JAVA_SDK]:{version:"2.38.1",output:{location:"local-file-system",path:"../sdks/java/src/main/java/"}},[tt.JAVA_SPRING]:{version:"0.9.2",output:{location:"local-file-system",path:"../src/main/java/com/fern"}},[tt.TYPESCRIPT]:{version:"0.0.247"},[tt.TYPESCRIPT_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[tt.TYPESCRIPT_NODE_SDK]:{version:"2.3.2",output:{location:"local-file-system",path:"../sdks/typescript"}},[tt.TYPESCRIPT_BROWSER_SDK]:{version:"1.0.0",output:{location:"local-file-system",path:"../sdks/typescript"}},[tt.PYTHON_PYDANTIC]:{version:"1.4.7"},[tt.PYTHON_FASTAPI]:{version:"1.7.0",output:{location:"local-file-system",path:"../src/fern"}},[tt.PYTHON_SDK]:{version:"4.23.2",output:{location:"local-file-system",path:"../sdks/python"}},[tt.GO_MODEL]:{version:"0.23.5"},[tt.GO_SDK]:{version:"1.4.0",output:{location:"local-file-system",path:"../sdks/go"},config:{module:{path:"sdk"}}},[tt.RUBY_SDK]:{version:"0.8.2",output:{location:"local-file-system",path:"../sdks/ruby"}},[tt.OPENAPI]:{version:"0.1.7",config:{format:"yaml"},output:{location:"local-file-system",path:"../openapi"}},[tt.STOPLIGHT]:{version:"0.0.28",config:{format:"yaml"}},[tt.POSTMAN]:{version:"0.4.0",output:{location:"local-file-system",path:"../postman"}},[tt.OPENAPI_PYTHON_CLIENT]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/python"},config:{format:"yaml"}},[tt.CSHARP_MODEL]:{version:"0.0.1"},[tt.CSHARP_SDK]:{version:"2.0.2",output:{location:"local-file-system",path:"../sdks/csharp"}},[tt.SWIFT_MODEL]:{version:"0.0.0"},[tt.SWIFT_SDK]:{version:"0.0.0",output:{location:"local-file-system",path:"../sdks/swift/sdk"}},[tt.PHP_MODEL]:{version:"0.0.0"},[tt.PHP_SDK]:{version:"1.16.3",output:{location:"local-file-system",path:"../sdks/php/sdk"}},[tt.RUST_MODEL]:{version:"0.0.1",output:{location:"local-file-system",path:"../models/rust"}},[tt.RUST_SDK]:{version:"0.0.1",output:{location:"local-file-system",path:"../sdks/rust"}}};var r0t="fernapi",yBe="fern-api";function fC(e){return e=Z5e(e),e.includes("/")?e:`${r0t}/${e}`}function Z5e(e){let t=`${yBe}/`;return e.startsWith(t)?`${r0t}/${e.slice(t.length)}`:e}function _pi(e,t){let r=`${yBe}/`;if(e.startsWith(r)){let n=`${r0t}/${e.slice(r.length)}`;return t.logger.warn(`"${e}" is not a valid generator name. Using "${n}" instead \u2014 the Docker org is "fernapi", not "fern-api".`),n}return e}function Spi(e){let t=`${r0t}/`;return e.startsWith(t)?e.slice(t.length):e}function Bpi(e,t){let r=bBe(e);return r??t.failAndThrow("Unrecognized generator: "+e)}var iip={"fernapi/java-model":tt.JAVA_MODEL,"fernapi/fern-typescript-node-sdk":tt.TYPESCRIPT_SDK};function bBe(e){e=fC(e);let t=iip[e];if(t!=null&&(e=t),oip(e))return e}function oip(e){return Object.values(tt).includes(e)}var bur=xe(k8e(),1),Q9s=xe(Xx(),1);async function VS({generatorName:e,cliVersion:t,channel:r,currentGeneratorVersion:n,includeMajor:i,context:o}){let s=Q9s.default.parse(n),a="https://registry.buildwithfern.com",u=new bur.FernRegistryClient({environment:a});o?.logger.debug(`Getting latest version for ${e} with CLI version ${t}, includeMajor: ${i}, prior version: ${s}, FDR origin: ${a}`);let c={generator:kAp(e,o),releaseTypes:[r??bur.FernRegistry.generators.ReleaseType.Ga],cliVersion:t};!i&&s!=null&&(c.generatorMajorVersion=s.major),o?.logger.debug(`[FDR] getLatestGeneratorRelease request: ${JSON.stringify(c)}`);let l=await u.generators.versions.getLatestGeneratorRelease(c);if(l.ok)return o?.logger.debug(`[FDR] getLatestGeneratorRelease response for ${e}: version=${l.body.version}, irVersion=${l.body.irVersion}`),l.body.version;o?.logger.debug(`[FDR] getLatestGeneratorRelease failed for ${e}: ${JSON.stringify(l)}`)}function kAp(e,t){switch(e.startsWith("fernapi/")&&(e=e.replace("fernapi/","")),e){case"fern-python-sdk":return"python-sdk";case"fern-pydantic-model":return"pydantic";case"fern-fastapi-server":return"fastapi";case"fern-typescript":case"fern-typescript-browser-sdk":case"fern-typescript-node-sdk":case"fern-typescript-sdk":return"ts-sdk";case"fern-typescript-express":return"ts-express";case"fern-java-sdk":return"java-sdk";case"fern-java-model":case"java-model":return"java-model";case"fern-java-spring":return"java-spring";case"fern-go-sdk":return"go-sdk";case"fern-go-model":return"go-model";case"fern-csharp-sdk":return"csharp-sdk";case"fern-csharp-model":return"csharp-model";case"fern-ruby-sdk":return"ruby-sdk";case"fern-postman":return"postman";case"fern-openapi":return"openapi";case"fern-php-sdk":return"php-sdk";case"fern-php-model":return"php-model";case"fern-rust-sdk":return"rust-sdk";case"fern-rust-model":return"rust-model";case"fern-swift-sdk":return"swift-sdk";case"fern-swift-model":return"swift-model";default:return t?.logger.warn(`Unrecognized generator name found, attempting to parse manually: ${e}`),e.startsWith("fern-")?e.replace("fern-",""):e}}async function N9s({generatorsConfiguration:e,groupName:t=e[bn.DEFAULT_GROUP_GENERATORS_CONFIG_KEY],context:r,update:n}){if(t==null){let s=Object.keys(e.groups??{});if(s.length>0){let a=`No group specified. Use the --group option:
1499
1499
  `+s.map(u=>` \u203A ${u}`).join(`
1500
1500
  `);return r.failAndThrow(a)}return r.failAndThrow("No group specified.")}let i=e.groups??={},o=i[t];if(o==null){let s=i[t]??={generators:[]};await n(s,t)}else await n(o,t);return e}async function $di({generatorName:e,generatorsConfiguration:t,groupName:r=t[B4e],context:n,cliVersion:i}){let o=Bpi(e,n),s=Spi(o),a=t0t[o];return await N9s({generatorsConfiguration:t,groupName:r,context:n,update:async u=>{u.generators.some(p=>fC(p.name)===o)&&n.failAndThrow(`${e} is already installed in group ${r}.`);let c=await VS({cliVersion:i,generatorName:o,context:n,channel:void 0}),l=c!=null&&Wdi.default.valid(c)&&Wdi.default.gt(c,a.version)?c:a.version;u.generators.push({name:s,...a,version:l})}})}St();qt();$re();var Xp=xe(Aoe(),1),Hhi=xe(Tc(),1),oXs=require("fs/promises"),sXs=xe(require("path"),1);var aXs={shouldUseTitleAsName:void 0,shouldUseUndiscriminatedUnionsWithLiterals:void 0,shouldUseIdiomaticRequestNames:void 0,asyncApiMessageNaming:void 0,onlyIncludeReferencedSchemas:void 0,shouldUseOptionalAdditionalProperties:void 0,coerceEnumsToLiterals:void 0,objectQueryParameters:void 0,respectReadonlySchemas:void 0,respectNullableSchemas:void 0,inlinePathParameters:void 0,useBytesForBinaryResponse:void 0,respectForwardCompatibleEnums:void 0,filter:void 0,exampleGeneration:void 0,defaultFormParameterEncoding:void 0,additionalPropertiesDefaultsTo:void 0,typeDatesAsStrings:void 0,preserveSingleSchemaOneOf:void 0,inlineAllOfSchemas:void 0,resolveAliases:void 0,groupMultiApiEnvironments:void 0,groupEnvironmentsByHost:void 0,inferDefaultEnvironment:void 0,wrapReferencesToNullableInOptional:void 0,coerceOptionalSchemasToNullable:void 0,removeDiscriminantsFromSchemas:void 0,pathParameterOrder:void 0,defaultIntegerFormat:void 0,resolveSchemaCollisions:void 0,inferForwardCompatible:void 0,coerceConstsTo:void 0};async function uXs({absolutePathToGeneratorsConfiguration:e,rawGeneratorsConfiguration:t,context:r}){let n=dXs(t.metadata),i=t.readme;oSp(r,t);let o=await $1p(t);return{absolutePathToConfiguration:e,api:o,rawConfiguration:t,defaultGroup:t["default-group"],groupAliases:t.aliases??{},reviewers:t.reviewers,groups:t.groups!=null?await Promise.all(Object.entries(t.groups).map(([s,a])=>H1p({absolutePathToGeneratorsConfiguration:e,groupName:s,group:a,maybeTopLevelMetadata:n,maybeTopLevelReviewers:t.reviewers,readme:i,context:r}))):[],whitelabel:t.whitelabel!=null&&t.whitelabel.github!=null?{github:t.whitelabel.github}:void 0,ai:t.ai,replay:t.replay}}function qcr(e){return{...aXs,shouldUseTitleAsName:e?.["use-title"],shouldUseUndiscriminatedUnionsWithLiterals:e?.unions==="v1",asyncApiMessageNaming:e?.["message-naming"],respectNullableSchemas:e?.["respect-nullable-schemas"],wrapReferencesToNullableInOptional:e?.["wrap-references-to-nullable-in-optional"],coerceOptionalSchemasToNullable:e?.["coerce-optional-schemas-to-nullable"],onlyIncludeReferencedSchemas:e?.["only-include-referenced-schemas"],inlinePathParameters:e?.["inline-path-parameters"],shouldUseIdiomaticRequestNames:e?.["idiomatic-request-names"],removeDiscriminantsFromSchemas:lXs(e?.["remove-discriminants-from-schemas"]),pathParameterOrder:e?.["path-parameter-order"]}}function cXs(e){return{...Gcr(e),shouldUseUndiscriminatedUnionsWithLiterals:e?.["prefer-undiscriminated-unions-with-literals"],onlyIncludeReferencedSchemas:e?.["only-include-referenced-schemas"],objectQueryParameters:e?.["object-query-parameters"],respectReadonlySchemas:e?.["respect-readonly-schemas"],inlinePathParameters:e?.["inline-path-parameters"],filter:e?.filter,exampleGeneration:e?.["example-generation"],defaultFormParameterEncoding:e?.["default-form-parameter-encoding"],useBytesForBinaryResponse:e?.["use-bytes-for-binary-response"],respectForwardCompatibleEnums:e?.["respect-forward-compatible-enums"],additionalPropertiesDefaultsTo:e?.["additional-properties-defaults-to"],typeDatesAsStrings:e?.["type-dates-as-strings"],preserveSingleSchemaOneOf:e?.["preserve-single-schema-oneof"],inlineAllOfSchemas:e?.["inline-all-of-schemas"],resolveAliases:e?.["resolve-aliases"],groupMultiApiEnvironments:e?.["group-multi-api-environments"],groupEnvironmentsByHost:e?.["group-environments-by-host"],defaultIntegerFormat:e?.["default-integer-format"],pathParameterOrder:e?.["path-parameter-order"]}}function G1p(e){return{...Gcr(e),asyncApiMessageNaming:e?.["message-naming"]}}function Gcr(e){return{...aXs,shouldUseTitleAsName:e?.["title-as-schema-name"],shouldUseIdiomaticRequestNames:e?.["idiomatic-request-names"],shouldUseOptionalAdditionalProperties:e?.["optional-additional-properties"],coerceEnumsToLiterals:e?.["coerce-enums-to-literals"],respectNullableSchemas:e?.["respect-nullable-schemas"],wrapReferencesToNullableInOptional:e?.["wrap-references-to-nullable-in-optional"],coerceOptionalSchemasToNullable:e?.["coerce-optional-schemas-to-nullable"],groupEnvironmentsByHost:e?.["group-environments-by-host"],inferDefaultEnvironment:e?.["infer-default-environment"],groupMultiApiEnvironments:e!=null&&"group-multi-api-environments"in e?e["group-multi-api-environments"]:void 0,removeDiscriminantsFromSchemas:lXs(e?.["remove-discriminants-from-schemas"]),pathParameterOrder:e?.["path-parameter-order"],resolveSchemaCollisions:e?.["resolve-schema-collisions"],inferForwardCompatible:e?.["infer-forward-compatible"],coerceConstsTo:e?.["coerce-consts-to"]}}function lXs(e){if(e==null||e==="always")return bn.RemoveDiscriminantsFromSchemas.Always;if(e==="never")return bn.RemoveDiscriminantsFromSchemas.Never;throw new Error(`Unknown value for generators.yml API setting: remove-discriminants-from-schemas: ${e}`)}function jde(e,t){return{...e,...Object.fromEntries(Object.entries(t).filter(([r,n])=>n!==void 0))}}async function iXs(e,t,r){let n=[];if(e!=null)if(typeof e=="string")n.push({schema:{type:"oss",path:e},origin:void 0,overrides:void 0,overlays:void 0,audiences:[],settings:r});else if(bn.isRawProtobufAPIDefinitionSchema(e))n.push({schema:{type:"protobuf",root:e.proto.root,target:e.proto.target??"",localGeneration:e.proto["local-generation"]??!1,fromOpenAPI:e.proto["from-openapi"]??!1,dependencies:e.proto.dependencies??[]},origin:void 0,overrides:e.proto.overrides,overlays:void 0,audiences:[],settings:r});else if(Array.isArray(e))for(let i of e)typeof i=="string"?n.push({schema:{type:"oss",path:i},origin:void 0,overrides:void 0,overlays:void 0,audiences:[],settings:r}):bn.isRawProtobufAPIDefinitionSchema(i)?n.push({schema:{type:"protobuf",root:i.proto.root,target:i.proto.target??"",localGeneration:i.proto["local-generation"]??!1,fromOpenAPI:i.proto["from-openapi"]??!1,dependencies:i.proto.dependencies??[]},origin:void 0,overrides:i.proto.overrides,overlays:void 0,audiences:[],settings:r}):n.push({schema:{type:"oss",path:i.path},origin:i.origin,overrides:i.overrides,overlays:void 0,audiences:i.audiences,settings:jde(r,qcr(i.settings))});else n.push({schema:{type:"oss",path:e.path},origin:e.origin,overrides:e.overrides,overlays:void 0,audiences:e.audiences,settings:jde(r,qcr(e.settings))});else{let i=t[bn.API_SETTINGS_KEY],o=t[bn.OPENAPI_LOCATION_KEY],s=t[bn.API_ORIGIN_LOCATION_KEY],a=t[bn.OPENAPI_OVERRIDES_LOCATION_KEY],u=t[bn.ASYNC_API_LOCATION_KEY];o!=null&&(typeof o=="string"?n.push({schema:{type:"oss",path:o},origin:s,overrides:a,overlays:void 0,audiences:[],settings:jde(r,qcr(i))}):typeof o=="object"&&n.push({schema:{type:"oss",path:o.path},origin:o.origin,overrides:o.overrides,overlays:void 0,audiences:[],settings:jde(r,cXs(o.settings))})),u!=null&&n.push({schema:{type:"oss",path:u},origin:s,overrides:void 0,overlays:void 0,audiences:[],settings:jde(r,qcr(i))})}return n}async function W1p({apiConfiguration:e,rawConfiguration:t,apiSettings:r}){let n={"auth-schemes":t["auth-schemes"],...e};if(bn.isConjureSchema(e.specs))return{type:"conjure",pathToConjureDefinition:e.specs.conjure,...n,settings:r};let i=[],o={};for(let s of e.specs??[]){let a;if(bn.isOpenApiSpecSchema(s))a={schema:{type:"oss",path:s.openapi},origin:s.origin,overrides:s.overrides,overlays:s.overlays,audiences:[],settings:jde(r,cXs(s.settings))};else if(bn.isAsyncApiSpecSchema(s))a={schema:{type:"oss",path:s.asyncapi},origin:s.origin,overrides:s.overrides,overlays:void 0,audiences:[],settings:jde(r,G1p(s.settings))};else if(bn.isProtoSpecSchema(s))a={schema:{type:"protobuf",root:s.proto.root,target:s.proto.target??"",localGeneration:s.proto["local-generation"]??!1,fromOpenAPI:s.proto["from-openapi"]??!1,dependencies:s.proto.dependencies??[]},origin:void 0,overrides:s.proto.overrides,overlays:void 0,audiences:[],settings:r};else if(bn.isOpenRpcSpecSchema(s))a={schema:{type:"openrpc",path:s.openrpc},origin:void 0,overrides:s.overrides,overlays:void 0,audiences:[],settings:r};else if(bn.isGraphQLSpecSchema(s))a={schema:{type:"graphql",path:s.graphql},origin:s.origin,overrides:s.overrides,overlays:void 0,audiences:[],settings:r};else continue;let u=bn.isGraphQLSpecSchema(s)&&"name"in s?s.name:"namespace"in s?s.namespace:void 0;u!=null?(o[u]??=[],o[u].push(a)):i.push(a)}return Object.keys(o).length===0?{type:"singleNamespace",definitions:i,...n,settings:r}:{type:"multiNamespace",rootDefinitions:i,definitions:o,...n,settings:r}}async function $1p(e){let t=e.api;if(t!=null){if(bn.isApiConfigurationV2Schema(t)){let n=Gcr(t.settings);return W1p({apiConfiguration:t,rawConfiguration:e,apiSettings:n})}if(bn.isNamespacedApiConfiguration(t)){let n={},i={};for(let[o,s]of Object.entries(t.namespaces))n[o]=await iXs(s,e,i);return{type:"multiNamespace",rootDefinitions:void 0,definitions:n}}}return{type:"singleNamespace",definitions:await iXs(t,e,{})}}async function H1p({absolutePathToGeneratorsConfiguration:e,groupName:t,group:r,maybeTopLevelMetadata:n,maybeTopLevelReviewers:i,readme:o,context:s}){let a=dXs(r.metadata);return{groupName:t,reviewers:r.reviewers,audiences:r.audiences==null?{type:"all"}:{type:"select",audiences:r.audiences},generators:await Promise.all(r.generators.map(u=>K1p({absolutePathToGeneratorsConfiguration:e,generator:u,maybeTopLevelMetadata:n,maybeGroupLevelMetadata:a,maybeTopLevelReviewers:i,maybeGroupLevelReviewers:r.reviewers,readme:o,context:s})))}}async function K1p({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n,maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o,readme:s,context:a}){let u=_pi(t.name,a),c=fC(u);return{raw:t,name:c,version:t.version,config:t.config,outputMode:await Z1p({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n,maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o}),keywords:t.keywords,smartCasing:t["smart-casing"]??!0,disableExamples:t["disable-examples"]??!1,absolutePathToLocalOutput:t.output?.location==="local-file-system"?Xi(An(e),t.output.path):void 0,absolutePathToLocalSnippets:t.snippets?.path!=null?Xi(An(e),t.snippets.path):void 0,language:rSp(c),irVersionOverride:t["ir-version"]??void 0,publishMetadata:Y1p({generatorInvocation:t}),readme:s,settings:t.api?.settings??void 0,apiOverride:J1p({generator:t})}}function J1p({generator:e}){if(e.api?.specs!=null||e.api?.auth!=null||e.api?.["auth-schemes"]!=null||e.api?.headers!=null)return{specs:e.api?.specs,auth:e.api?.auth,"auth-schemes":e.api?.["auth-schemes"],headers:e.api?.headers}}function Y1p({generatorInvocation:e}){let t=e["publish-metadata"];if(t!=null)return{packageDescription:t["package-description"],publisherEmail:t.email,publisherName:t.author,referenceUrl:t["reference-url"]};if(e.metadata!=null)return{packageDescription:e.metadata["package-description"],publisherEmail:e.metadata.email,publisherName:e.metadata.author,referenceUrl:e.metadata["reference-url"]}}function pXs({pypiOutputMetadata:e,maybeGroupLevelMetadata:t,maybeTopLevelMetadata:r}){let n;return e!=null&&(n=iSp(e),n={...r,...t,...n}),n}function X1p({topLevelReviewers:e,groupLevelReviewers:t,outputModeReviewers:r}){let n=new Set,i=new Set,o=[],s=[...e?.teams??[],...t?.teams??[],...r?.teams??[]],a=[...e?.users??[],...t?.users??[],...r?.users??[]];for(let u of s)n.has(u.name)||(o.push(Hhi.GithubPullRequestReviewer.team({name:u.name})),n.add(u.name));for(let u of a)i.has(u.name)||(o.push(Hhi.GithubPullRequestReviewer.user({name:u.name})),i.add(u.name));return o}async function Z1p({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r={},maybeTopLevelMetadata:n={},maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o}){let s=t.snippets!=null&&t.snippets.path!=="";if(t.github){let a=Mde(t.github)?t.github.uri:t.github.repository,{owner:u,repo:c}=KO(a),l=t.output!=null?tSp(t.output,r,n):void 0,p=nSp(t),d=p!=null?await eSp({absolutePathToGeneratorsConfiguration:e,githubLicense:p}):void 0,f=t.github.mode??"release";switch(f){case"commit":case"release":return Xp.FernFiddle.OutputMode.githubV2(Xp.FernFiddle.GithubOutputModeV2.commitAndRelease({owner:u,repo:c,license:d,publishInfo:l,downloadSnippets:s}));case"pull-request":{let m=t.github,h=X1p({topLevelReviewers:o,groupLevelReviewers:i,outputModeReviewers:m.reviewers});return Xp.FernFiddle.OutputMode.githubV2(Xp.FernFiddle.GithubOutputModeV2.pullRequest({owner:u,repo:c,license:d,publishInfo:l,downloadSnippets:s,reviewers:h,branch:m.branch}))}case"push":return Xp.FernFiddle.OutputMode.githubV2(Xp.FernFiddle.GithubOutputModeV2.push({owner:u,repo:c,branch:t.github.mode==="push"?t.github.branch:void 0,license:d,publishInfo:l,downloadSnippets:s}));default:Be(f)}}if(t.output==null)return Xp.FernFiddle.remoteGen.OutputMode.publish({registryOverrides:{}});switch(t.output.location){case"local-file-system":return Xp.FernFiddle.OutputMode.downloadFiles({downloadSnippets:s});case"npm":return Xp.FernFiddle.OutputMode.publishV2(Xp.FernFiddle.remoteGen.PublishOutputModeV2.npmOverride({registryUrl:t.output.url??"https://registry.npmjs.org",packageName:t.output["package-name"],token:t.output.token??"",downloadSnippets:s}));case"maven":return Xp.FernFiddle.OutputMode.publishV2(Xp.FernFiddle.remoteGen.PublishOutputModeV2.mavenOverride({registryUrl:fXs(t.output),username:t.output.username??"",password:t.output.password??"",coordinate:t.output.coordinate,signature:t.output.signature!=null?{keyId:t.output.signature.keyId,secretKey:t.output.signature.secretKey,password:t.output.signature.password}:void 0,downloadSnippets:s}));case"postman":return Xp.FernFiddle.OutputMode.publishV2(Xp.FernFiddle.remoteGen.PublishOutputModeV2.postman({apiKey:t.output["api-key"],workspaceId:t.output["workspace-id"]}));case"pypi":return Xp.FernFiddle.OutputMode.publishV2(Xp.FernFiddle.remoteGen.PublishOutputModeV2.pypiOverride({registryUrl:t.output.url??"https://upload.pypi.org/legacy/",username:t.output.token!=null?"__token__":t.output.password??"",password:t.output.token??t.output.password??"",coordinate:t.output["package-name"],downloadSnippets:s,pypiMetadata:pXs({pypiOutputMetadata:t.output.metadata,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n})}));case"nuget":return Xp.FernFiddle.OutputMode.publishV2(Xp.FernFiddle.remoteGen.PublishOutputModeV2.nugetOverride({registryUrl:t.output.url??"https://nuget.org/",packageName:t.output["package-name"],apiKey:t.output["api-key"]??"",downloadSnippets:s}));case"rubygems":return Xp.FernFiddle.OutputMode.publishV2(Xp.FernFiddle.remoteGen.PublishOutputModeV2.rubyGemsOverride({registryUrl:t.output.url??"https://rubygems.org/",packageName:t.output["package-name"],apiKey:t.output["api-key"]??"",downloadSnippets:s}));case"crates":return Xp.FernFiddle.OutputMode.publishV2(Xp.FernFiddle.remoteGen.PublishOutputModeV2.cratesOverride({registryUrl:t.output.url??"https://crates.io/api/v1/crates",packageName:t.output["package-name"],token:t.output.token??"",downloadSnippets:s}));default:Be(t.output)}}async function eSp({absolutePathToGeneratorsConfiguration:e,githubLicense:t}){if(typeof t=="string")switch(t){case"MIT":return Xp.FernFiddle.GithubLicense.basic({id:Xp.FernFiddle.GithubLicenseId.Mit});case"Apache-2.0":return Xp.FernFiddle.GithubLicense.basic({id:Xp.FernFiddle.GithubLicenseId.Apache});default:Be(t)}let r=We(Ut.of(sXs.default.dirname(e)),_e.of(t.custom)),n=await(0,oXs.readFile)(r);return Xp.FernFiddle.GithubLicense.custom({contents:n.toString()})}function tSp(e,t,r){switch(e.location){case"local-file-system":throw new Error("Cannot use local-file-system with github publishing");case"npm":return Xp.FernFiddle.GithubPublishInfo.npm({registryUrl:e.url??"https://registry.npmjs.org",packageName:e["package-name"],token:e.token});case"maven":return Xp.FernFiddle.GithubPublishInfo.maven({registryUrl:fXs(e),coordinate:e.coordinate,credentials:e.username!=null&&e.password!=null?{username:e.username,password:e.password}:void 0,signature:e.signature!=null?{keyId:e.signature.keyId,password:e.signature.password,secretKey:e.signature.secretKey}:void 0});case"postman":return Xp.FernFiddle.GithubPublishInfo.postman({apiKey:e["api-key"],workspaceId:e["workspace-id"]});case"pypi":return Xp.FernFiddle.GithubPublishInfo.pypi({registryUrl:e.url??"https://upload.pypi.org/legacy/",packageName:e["package-name"],credentials:e.token!=null?{username:"__token__",password:e.token}:{username:e.username??"",password:e.password??""},pypiMetadata:pXs({pypiOutputMetadata:e.metadata,maybeGroupLevelMetadata:t,maybeTopLevelMetadata:r})});case"nuget":return Xp.FernFiddle.GithubPublishInfo.nuget({registryUrl:e.url??"https://nuget.org/",packageName:e["package-name"],apiKey:e["api-key"]});case"rubygems":return Xp.FernFiddle.GithubPublishInfo.rubygems({registryUrl:e.url??"https://rubygems.org/",packageName:e["package-name"],apiKey:e["api-key"]});case"crates":return Xp.FernFiddle.GithubPublishInfo.crates({registryUrl:e.url??"https://crates.io/api/v1/crates",packageName:e["package-name"],token:e.token});default:Be(e)}}function rSp(e){if(e.includes("csharp"))return bn.GenerationLanguage.CSHARP;if(e.includes("go"))return bn.GenerationLanguage.GO;if(e.includes("java")||e.includes("spring"))return bn.GenerationLanguage.JAVA;if(e.includes("php"))return bn.GenerationLanguage.PHP;if(e.includes("python")||e.includes("fastapi")||e.includes("pydantic"))return bn.GenerationLanguage.PYTHON;if(e.includes("ruby"))return bn.GenerationLanguage.RUBY;if(e.includes("swift"))return bn.GenerationLanguage.SWIFT;if(e.includes("typescript"))return bn.GenerationLanguage.TYPESCRIPT}function fXs(e){return e.url!=null?e.url:e.signature!=null?"https://oss.sonatype.org/service/local/staging/deploy/maven2/":"https://s01.oss.sonatype.org/content/repositories/releases/"}function nSp(e){return e["publish-metadata"]?.license!=null?e["publish-metadata"].license:e.metadata?.license!=null?e.metadata.license:Mde(e.github)&&e.github.license!=null?e.github.license:e.github?.license}function dXs(e){return e!=null?{description:e.description,authors:e.authors?.map(t=>({name:t.name,email:t.email}))}:void 0}function iSp(e){return e!=null?{description:e.description,authors:e.authors?.map(t=>({name:t.name,email:t.email})),keywords:e.keywords,documentationLink:e["documentation-link"],homepageLink:e["homepage-link"]}:void 0}function oSp(e,t){let r=[];t["api-settings"]!=null&&r.push('"api-settings" is deprecated. Please use "api.settings" for global defaults or "api.specs[].settings" for spec-specific settings instead.'),t["async-api"]!=null&&r.push('"async-api" is deprecated. Please use "api.specs[].asyncapi" instead.'),t.openapi!=null&&r.push('"openapi" is deprecated. Please use "api.specs[].openapi" instead.'),t["openapi-overrides"]!=null&&r.push('"openapi-overrides" is deprecated. Please use "api.specs[].overrides" instead.'),t["spec-origin"]&&r.push('"spec-origin" is deprecated. Please use "api.specs[].origin" instead.'),t.api!=null&&(typeof t.api=="string"&&r.push('Using an OpenAPI or AsyncAPI path string for "api" is deprecated. Please use "api.specs[].openapi" or "api.specs[].asyncapi" instead.'),Array.isArray(t.api)?r.push('Using an array for "api" is deprecated. Please use "api.specs[].openapi", "api.specs[].asyncapi", or "api.specs[].proto" instead.'):typeof t.api=="object"&&("path"in t.api&&r.push('Using "api.path" is deprecated. Please use "api.specs[].openapi" or "api.specs[].asyncapi" instead.'),"proto"in t.api&&r.push('Using "api.proto" is deprecated. Please use "api.specs[].proto" instead.'),"namespaces"in t.api&&r.push('Using "api.namespaces" is deprecated. Please use "api.specs[].openapi", "api.specs[].asyncapi", or "api.specs[].proto" with the "namespace" property instead.'))),r.length>0&&(e.logger.warn("Warnings for generators.yml:"),e.logger.warn(" "+r.join(`
1501
1501
  `)))}function Mde(e){return e==null?!1:"uri"in e&&"token"in e}qt();var mXs=require("fs/promises");var hXs=xe(require("path"),1);async function d6e({absolutePathToWorkspace:e,context:t,lenient:r}){let n=await Lde({absolutePathToWorkspace:e});if(n==null)return;let i=await(0,mXs.readFile)(n);try{let o=xr.load(i.toString()),s=bn.serialization.GeneratorsConfigurationSchema.parse(o,{allowUnrecognizedEnumValues:r===!0,unrecognizedObjectKeys:r===!0?"passthrough":"fail",allowUnrecognizedUnionMembers:r===!0,skipValidation:!1,breadcrumbsPrefix:void 0,omitUndefined:!1});if(s.ok)return s.value;throw new Error(s.errors.map(a=>a.message).join(`
@@ -1655,7 +1655,7 @@ ${p1a.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&jBi(th
1655
1655
  `+$Pe.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?$Pe.default.cyan(E1a(t,this.opt.mask)):$Pe.default.italic($Pe.default.dim("[hidden]")):this.opt.mask?E1a(t,this.opt.mask):$Pe.default.italic($Pe.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 _vr=xe(GI(),1);var bSa=xe(bOi(),1),Cvr=require("child_process"),q9e=require("fs"),wvr=xe(require("path"),1),ESa=xe(require("os"),1),vSa=require("crypto"),nPi=xe(ASa(),1);var Evr=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var lxt=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var vvr=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var Ivr=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function xvr(e="",t,r){let n=new iPi(e,r);n.runAsync((i,o)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,o)}catch(s){setImmediate(t,s,void 0)}})}function ySa(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function PEf(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 iPi=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=PEf(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??ESa.default.tmpdir(),r=(0,vSa.randomUUID)(),n=ySa(this.fileOptions.prefix),i=ySa(this.fileOptions.postfix),o=`${n}${r}${i}`,s=wvr.default.resolve(t,o),a=wvr.default.resolve(t)+wvr.default.sep;if(!s.startsWith(a))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=s;let u={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(u.mode=this.fileOptions.mode),(0,q9e.writeFileSync)(this.tempFile,this.text,u)}catch(t){throw new Evr(t)}}readTemporaryFile(){try{let t=(0,q9e.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,bSa.detect)(t)??"utf8";nPi.default.encodingExists(r)||(r="utf8"),this.text=nPi.default.decode(t,r)}}catch(t){throw new vvr(t)}}removeTemporaryFile(){try{(0,q9e.unlinkSync)(this.tempFile)}catch(t){throw new Ivr(t)}}launchEditor(){try{let t=(0,Cvr.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new lxt(t)}}launchEditorAsync(t){try{(0,Cvr.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new lxt(r)}}};var ISa=xe(WQ(),1);var pxt=class extends WI{_run(t){this.done=t,this.editorResult=new ISa.Subject;let r=c1(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"?_vr.default.dim("Received"):_vr.default.dim("Press <enter> to launch your preferred editor."),t&&(r=_vr.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),xvr(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 SSa=require("stream");var xSa=xe(require("readline"),1),_Sa=xe(CSa(),1),YPe=class{constructor(t){this.rl||=xSa.default.createInterface(DEf(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 DEf(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 _Sa.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var fxt=class extends YPe{constructor(t={}){super(t),this.log=new SSa.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return KCt(this.rl,this.bottomBar.split(`
1656
1656
  `).length),this}updateBottomBar(t){return KCt(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+`
1657
1657
  `}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&&HEr(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var vf=xe(WQ(),1),PSa=xe(_Ct(),1);var Svr=xe(WQ(),1),BSa=xe(_Ct(),1),Bvr=function(e,t,r){return typeof e[t]!="function"?(0,Svr.of)(e):(0,Svr.from)((0,BSa.default)(e[t])(r).then(n=>(e[t]=n,e)))};var OSa={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,o,s)=>{i==="__proto__"||i==="constructor"||(o===s.length-1?n[i]=r:(!(i in n)||typeof n[i]!="object")&&(n[i]={}),n=n[i])})},get:(e,t="",r)=>{let n=o=>String.prototype.split.call(t,o).filter(Boolean).reduce((s,a)=>s!=null?s[a]:s,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},G9e=class extends YPe{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,vf.from)(t):(0,vf.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,vf.from)(Object.entries(t).map(([i,o])=>({name:i,...o}))):n=(0,vf.from)([t]),this.process=n.pipe((0,vf.concatMap)(this.processQuestion.bind(this)),(0,vf.publish)()),this.process.connect(),this.process.pipe((0,vf.reduce)((i,o)=>(OSa.set(i,o.name,o.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,vf.defer)(()=>(0,vf.of)(t).pipe((0,vf.concatMap)(this.setDefaultType.bind(this)),(0,vf.concatMap)(this.filterIfRunnable.bind(this)),(0,vf.concatMap)(()=>Bvr(t,"message",this.answers)),(0,vf.concatMap)(()=>Bvr(t,"default",this.answers)),(0,vf.concatMap)(()=>Bvr(t,"choices",this.answers)),(0,vf.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,vf.defer)(()=>(0,vf.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,vf.defer)(()=>(0,vf.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&OSa.get(this.answers,t.name)!==void 0)return vf.EMPTY;if(t.when===!1)return vf.EMPTY;if(typeof t.when!="function")return(0,vf.of)(t);let{answers:r}=this;return(0,vf.defer)(()=>(0,vf.from)((0,PSa.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,vf.filter)(n=>n!=null)))}};function TSa(e){let t=function(r,n){let i;try{i=new G9e(t.prompts,e)}catch(s){return Promise.reject(s)}let o=i.run(r,n);return o.ui=i,o};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",YCt),this.registerPrompt("input",WPe),this.registerPrompt("number",XCt),this.registerPrompt("confirm",ZCt),this.registerPrompt("rawlist",ext),this.registerPrompt("expand",txt),this.registerPrompt("checkbox",rxt),this.registerPrompt("password",nxt),this.registerPrompt("editor",pxt)},t.restoreDefaultPrompts(),t}var sPi=TSa();function FEf(e,t){sPi.registerPrompt(e,t)}function kEf(){sPi.restoreDefaultPrompts()}var QEf={prompt:sPi,ui:{BottomBar:fxt,Prompt:G9e},createPromptModule:TSa,registerPrompt:FEf,restoreDefaultPrompts:kEf,Separator:EF},pp=QEf;var W9e=require("path");function RSa(){let e=NEf();return async t=>{for(let r of t)r.module=e(r.filename);return t}}function NEf(e=process.argv[1]?(0,W9e.dirname)(process.argv[1]):process.cwd(),t=W9e.sep==="\\"){let r=t?DSa(e):e;return n=>{if(!n)return;let i=t?DSa(n):n,{dir:o,base:s,ext:a}=W9e.posix.parse(i);(a===".js"||a===".mjs"||a===".cjs")&&(s=s.slice(0,-1*a.length));let u=decodeURIComponent(s);o||(o=".");let c=o.lastIndexOf("/node_modules");if(c>-1)return`${o.slice(c+14).replace(/\//g,".")}:${u}`;if(o.startsWith(r)){let l=o.slice(r.length+1).replace(/\//g,".");return l?`${l}:${u}`:u}return u}}function DSa(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var aPi=e=>{if("flags"in e){let t=FSa(e.flags),r=kSa(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,o])=>[i,uPi(o)])),n=Object.fromEntries(Object.entries(t).map(([i,o])=>[i,jEf(i,o,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function jEf(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 FSa=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,dxt(r)]).filter(([,t])=>t!==void 0)),kSa=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?uPi(n):void 0]}))};var dxt=e=>e===void 0?void 0:e.variant??e.enabled,uPi=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};var Ovr="0123456789abcdef",Pvr=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length===16)return new e(t);throw new TypeError("not 128-bit length")}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 o=new Uint8Array(16);return o[0]=t/2**40,o[1]=t/2**32,o[2]=t/2**24,o[3]=t/2**16,o[4]=t/256,o[5]=t,o[6]=112|r>>>8,o[7]=r,o[8]=128|n>>>24,o[9]=n>>>16,o[10]=n>>>8,o[11]=n,o[12]=i>>>24,o[13]=i>>>16,o[14]=i>>>8,o[15]=i,new e(o)}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;default:break}if(r){let n=new Uint8Array(16);for(let i=0;i<16;i+=4){let o=parseInt(r.substring(2*i,2*i+8),16);n[i+0]=o>>>24,n[i+1]=o>>>16,n[i+2]=o>>>8,n[i+3]=o}return new e(n)}throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=Ovr.charAt(this.bytes[r]>>>4),t+=Ovr.charAt(15&this.bytes[r]),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=Ovr.charAt(this.bytes[r]>>>4),t+=Ovr.charAt(15&this.bytes[r]);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}},cPi=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??MEf()}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))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return Pvr.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}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,Pvr.ofInner(t)}},MEf=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),QSa,pK=()=>LEf().toString(),LEf=()=>(QSa||(QSa=new cPi)).generate();var IF=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",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.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e})({});var UEf=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],NSa=function(e,t=[]){if(!e)return!1;let r=e.toLowerCase();return UEf.concat(t).some(n=>{let i=n.toLowerCase();return r.indexOf(i)!==-1})};var VEf=Array.isArray,jSa=Object.prototype,e4y=jSa.hasOwnProperty,lPi=jSa.toString,pPi=VEf||function(e){return lPi.call(e)==="[object Array]"};var fPi=e=>e===Object(e)&&!pPi(e);var $9e=e=>e===void 0,mxt=e=>lPi.call(e)=="[object String]",MSa=e=>mxt(e)&&e.trim().length===0;var LSa=e=>lPi.call(e)=="[object Number]"&&e===e;var dPi=e=>e instanceof Error;function hxt(e){return e===null||typeof e!="object"}function XPe(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function USa(e){return XPe(e,"ErrorEvent")}function Tvr(e){return!$9e(Event)&&qEf(e,Event)}function zSa(e){return XPe(e,"Object")}function qEf(e,t){try{return e instanceof t}catch{return!1}}function gxt(e,t,r,n,i){return t>r&&(n.warn("min cannot be greater than max."),t=r),LSa(e)?e>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e<t?(n.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+i),gxt(i||r,t,r,n))}var GEf=864e5,Dvr=class{constructor(t){this._buckets={},this._onBucketRateLimited=t._onBucketRateLimited,this._bucketSize=gxt(t.bucketSize,0,100,t._logger),this._refillRate=gxt(t.refillRate,0,this._bucketSize,t._logger),this._refillInterval=gxt(t.refillInterval,0,GEf,t._logger)}_applyRefill(t,r){let n=r-t.lastAccess,i=Math.floor(n/this._refillInterval);if(i>0){let o=i*this._refillRate;t.tokens=Math.min(t.tokens+o,this._bucketSize),t.lastAccess=t.lastAccess+i*this._refillInterval}}consumeRateLimit(t){let r=Date.now(),n=String(t),i=this._buckets[n];return i?this._applyRefill(i,r):(i={tokens:this._bucketSize,lastAccess:r},this._buckets[n]=i),i.tokens===0?!0:(i.tokens--,i.tokens===0&&this._onBucketRateLimited?.(t),i.tokens===0)}stop(){this._buckets={}}};var Rvr=class{add(t){let r=pK();return this.promiseByIds[r]=t,t.catch(()=>{}).finally(()=>{delete this.promiseByIds[r]}),t}async join(){let t=Object.values(this.promiseByIds),r=t.length;for(;r>0;)await Promise.all(t),t=Object.values(this.promiseByIds),r=t.length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}};function WEf(e=console){return{log:e.log.bind(e),warn:e.warn.bind(e),error:e.error.bind(e),debug:e.debug.bind(e)}}var VSa=(e,t,r)=>{function n(o,...s){t(()=>{let a=r[o];a(e,...s)})}return{info:(...o)=>{n("log",...o)},warn:(...o)=>{n("warn",...o)},error:(...o)=>{n("error",...o)},critical:(...o)=>{r.error(e,...o)},createLogger:o=>VSa(`${e} ${o}`,t,r)}},$Ef=e=>e();function qSa(e,t=$Ef){return VSa(e,t,WEf())}var K9e="Mobile",kvr="iOS",H9e="Android",GSa="Tablet",f4y=H9e+" "+GSa;var HEf="Apple",d4y=HEf+" Watch",WSa="Safari",Qvr="BlackBerry",$Sa="Samsung",KEf=$Sa+"Browser",JEf=$Sa+" Internet",Nvr="Chrome",YEf=Nvr+" OS",XEf=Nvr+" "+kvr,HSa="Internet Explorer",ZEf=HSa+" "+K9e,hPi="Opera",m4y=hPi+" Mini",KSa="Edge",evf="Microsoft "+KSa,gPi="Firefox",tvf=gPi+" "+kvr,APi="Nintendo",yPi="PlayStation",Fvr="Xbox",rvf=H9e+" "+K9e,nvf=K9e+" "+WSa,Axt="Windows",ivf=Axt+" Phone";var JSa="Generic",h4y=JSa+" "+K9e.toLowerCase(),g4y=JSa+" "+GSa.toLowerCase(),ovf="Konqueror",QP="(\\d+(\\.\\d+)?)",mPi=new RegExp("Version/"+QP),A4y=new RegExp(Fvr,"i"),y4y=new RegExp(yPi+" \\w+","i"),b4y=new RegExp(APi+" \\w+","i"),svf=new RegExp(Qvr+"|PlayBook|BB10","i"),avf={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000","5.1":"XP","5.2":"XP","6.0":"Vista","6.1":"7","6.2":"8","6.3":"8.1","6.4":"10","10.0":"10"};var E4y={[ZEf]:[new RegExp("rv:"+QP)],[evf]:[new RegExp(KSa+"?\\/"+QP)],[Nvr]:[new RegExp("("+Nvr+"|CrMo)\\/"+QP)],[XEf]:[new RegExp("CriOS\\/"+QP)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+QP)],[WSa]:[mPi],[nvf]:[mPi],[hPi]:[new RegExp("("+hPi+"|OPR)\\/"+QP)],[gPi]:[new RegExp(gPi+"\\/"+QP)],[tvf]:[new RegExp("FxiOS\\/"+QP)],[ovf]:[new RegExp("Konqueror[:/]?"+QP,"i")],[Qvr]:[new RegExp(Qvr+" "+QP),mPi],[rvf]:[new RegExp("android\\s"+QP,"i")],[JEf]:[new RegExp(KEf+"\\/"+QP)],[HSa]:[new RegExp("(rv:|MSIE )"+QP)],Mozilla:[new RegExp("rv:"+QP)]};var v4y=[[new RegExp(Fvr+"; "+Fvr+" (.*?)[);]","i"),e=>[Fvr,e&&e[1]||""]],[new RegExp(APi,"i"),[APi,""]],[new RegExp(yPi,"i"),[yPi,""]],[svf,[Qvr,""]],[new RegExp(Axt,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ivf,""];if(new RegExp(K9e).test(t)&&!/IEMobile\b/.test(t))return[Axt+" "+K9e,""];let r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let n=r[1],i=avf[n]||"";return/arm/i.test(t)&&(i="RT"),[Axt,i]}return[Axt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){let t=[e[3],e[4],e[5]||"0"];return[kvr,t.join(".")]}return[kvr,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=$9e(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+H9e+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+H9e+")","i"),e=>{if(e&&e[2]){let t=[e[2],e[3],e[4]||"0"];return[H9e,t.join(".")]}return[H9e,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];if(e&&e[1]){let r=[e[1],e[2],e[3]||"0"];t[1]=r.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[YEf,""]],[/Linux|debian/i,["Linux",""]]];var YSa="utf8";function XSa(e,t){if(!e||typeof e!="string"||uvf(e))throw new Error(t)}function uvf(e){return e.trim().length===0}function ZSa(e){return e?.replace(/\/+$/,"")}async function eBa(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 jvr(){return new Date().toISOString()}function ZPe(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var tBa=e=>e instanceof Error;function bPi(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var Mvr=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)}};function rBa(){return"CompressionStream"in globalThis}async function EPi(e,t=!0){try{let n=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(n).blob()}catch(r){return t&&console.error("Failed to gzip compress data",r),null}}var eTe=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()}},J9e=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function nBa(e){if(e instanceof eTe){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 vPi(e){return typeof e=="object"&&(e instanceof eTe||e instanceof J9e)}function iBa(e){return typeof e=="object"&&e instanceof eTe&&e.status===413}var yxt=class{constructor(t,r={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new Rvr,this._events=new Mvr,this._isInitialized=!1,XSa(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=ZSa(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.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:vPi},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,this._logger=qSa("[PostHog]",this.logMsgIfDebug.bind(this)),this.evaluationContexts=r?.evaluationContexts??r?.evaluationEnvironments,r?.evaluationEnvironments&&!r?.evaluationContexts&&this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version."),this.disableCompression=!rBa()||(r?.disableCompression??!1)}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(IF.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(IF.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(IF.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(n,i)=>this._logger.info(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){return this.promiseQueue.add(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 o=this.buildPayload({distinct_id:t,event:r,properties:n});this.enqueue("capture",o,i)})}async captureStatelessImmediate(t,r,n,i){let o=this.buildPayload({distinct_id:t,event:r,properties:n});await this.sendImmediate("capture",o,i)}aliasStateless(t,r,n,i){this.wrap(()=>{let o=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});this.enqueue("alias",o,i)})}async aliasStatelessImmediate(t,r,n,i){let o=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",o,i)}groupIdentifyStateless(t,r,n,i,o,s){this.wrap(()=>{let a=this.buildPayload({distinct_id:o||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...s||{}}});this.enqueue("capture",a,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._logger.error("Remote config could not be loaded",i),this._events.emit("error",i)})}async getFlags(t,r={},n={},i={},o={},s=!0){await this._initPromise;let a=s?"&config=true":"",u=`${this.host}/flags/?v=2${a}`,c={token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...o};this.evaluationContexts&&this.evaluationContexts.length>0&&(c.evaluation_contexts=this.evaluationContexts);let l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(c)};return this._logger.info("Flags URL",u),this.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(p=>p.json()).then(p=>({success:!0,response:aPi(p)})).catch(p=>(this._events.emit("error",p),{success:!1,error:this.categorizeRequestError(p)}))}categorizeRequestError(t){if(t instanceof eTe)return{type:"api_error",statusCode:t.status};if(t instanceof J9e){let r=t.error;return r instanceof Error&&(r.name==="AbortError"||r.name==="TimeoutError")?{type:"timeout"}:{type:"connection_error"}}return{type:"unknown_error"}}async getFeatureFlagStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagDetailStateless(t,r,n,i,o,s);if(a===void 0)return{response:void 0,requestId:void 0};let u=dxt(a.response);return u===void 0&&(u=!1),{response:u,requestId:a.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(r,n,i,o,s,[t]);return a===void 0?void 0:{response:a.flags[t],requestId:a.requestId,evaluatedAt:a.evaluatedAt}}async getFeatureFlagPayloadStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagPayloadsStateless(r,n,i,o,s,[t]);if(!a)return;let u=a[t];return u===void 0?null:u}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},o,s){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,s)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},o,s){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,s)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},o,s){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(t,r,n,i,o,s);return a?{flags:a.featureFlags,payloads:a.featureFlagPayloads,requestId:a.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},o,s){await this._initPromise;let a={};(o??this.disableGeoip)&&(a.geoip_disable=!0),s&&(a.flag_keys_to_evaluate=s);let u=await this.getFlags(t,r,n,i,a);if(!u.success)return;let c=u.response;return c.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"),c.quotaLimited?.includes("feature_flags")?(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:c?.requestId,quotaLimited:c.quotaLimited}):c}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this._logger.info("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(o=>{if(o.status!==200||!o.json){let s=`Surveys API could not be loaded: ${o.status}`,a=new Error(s);this._logger.error(a),this._events.emit("error",new Error(s));return}return o.json()}).catch(o=>{this._logger.error("Surveys API could not be loaded",o),this._events.emit("error",o)}))?.surveys;return i&&this._logger.info("Surveys fetched from API: ",JSON.stringify(i)),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(IF.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(IF.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(IF.Props,this.props)})}processBeforeEnqueue(t){return t}async flushStorage(){}enqueue(t,r,n){this.wrap(()=>{if(this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(t,r,n);if(i=this.processBeforeEnqueue(i),i===null)return;let o=this.getPersistedProperty(IF.Queue)||[];o.length>=this.maxQueueSize&&(o.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),o.push({message:i}),this.setPersistedProperty(IF.Queue,o),this._events.emit(t,i),o.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=ZPe(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,n){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized||await this._initPromise,this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(t,r,n);if(i=this.processBeforeEnqueue(i),i===null)return;let o={api_key:this.apiKey,batch:[i],sent_at:jvr()};this.historicalMigration&&(o.historical_migration=!0);let s=JSON.stringify(o),a=`${this.host}/batch/`,u=this.disableCompression?null:await EPi(s,this.isDebug),c={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...u!==null&&{"Content-Encoding":"gzip"}},body:u||s};try{await this.fetchWithRetry(a,c)}catch(l){this._events.emit("error",l)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:jvr(),uuid:n?.uuid?n.uuid:pK()};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 nBa(t)})}async flush(){let t=bPi([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),bPi([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(IF.Queue)||[];if(!t.length)return;let r=[],n=t.length;for(;t.length>0&&r.length<n;){let i=t.slice(0,this.maxBatchSize),o=i.map(f=>f.message),s=async()=>{let m=(this.getPersistedProperty(IF.Queue)||[]).slice(i.length);this.setPersistedProperty(IF.Queue,m),t=m,await this.flushStorage()},a={api_key:this.apiKey,batch:o,sent_at:jvr()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),c=`${this.host}/batch/`,l=this.disableCompression?null:await EPi(u,this.isDebug),p={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...l!==null&&{"Content-Encoding":"gzip"}},body:l||u},d={retryCheck:f=>iBa(f)?!1:vPi(f)};try{await this.fetchWithRetry(c,p,d)}catch(f){if(iBa(f)&&o.length>1){this.maxBatchSize=Math.max(1,Math.floor(o.length/2)),this._logger.warn(`Received 413 when sending batch of size ${o.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw f instanceof J9e||await s(),this._events.emit("error",f),f}await s(),r.push(...o)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){AbortSignal.timeout??=function(a){let u=new AbortController;return setTimeout(()=>u.abort(),a),u.signal};let o=r.body?r.body:"",s=-1;try{s=o instanceof Blob?o.size:Buffer.byteLength(o,YSa)}catch{o instanceof Blob?s=o.size:s=new TextEncoder().encode(o).length}return await eBa(async()=>{let a=null;try{a=await this.fetch(t,{signal:AbortSignal.timeout(i??this.requestTimeout),...r})}catch(c){throw new J9e(c)}if(!(r.mode==="no-cors")&&(a.status<200||a.status>=400))throw new eTe(a,s);return a},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let n=async()=>{try{for(await this.promiseQueue.join();!((this.getPersistedProperty(IF.Queue)||[]).length===0||(await this.flush(),r)););}catch(i){if(!vPi(i))throw i;await nBa(i)}};return Promise.race([new Promise((i,o)=>{ZPe(()=>{this._logger.error("Timed out while shutting down PostHog"),r=!0,o("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),n()])}async shutdown(t=3e4){return this.shutdownPromise?this._logger.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}};var wF={};X(wF,{DOMExceptionCoercer:()=>xPi,ErrorCoercer:()=>_Pi,ErrorEventCoercer:()=>SPi,ErrorPropertiesBuilder:()=>IPi,EventCoercer:()=>PPi,ObjectCoercer:()=>OPi,PrimitiveCoercer:()=>TPi,PromiseRejectionEventCoercer:()=>DPi,ReduceableCache:()=>RPi,StringCoercer:()=>BPi,chromeStackLineParser:()=>wPi,createDefaultStackParser:()=>wvf,createStackParser:()=>hBa,geckoStackLineParser:()=>CPi,nodeStackLineParser:()=>pBa,opera10StackLineParser:()=>uBa,opera11StackLineParser:()=>cBa,reverseAndStripFrames:()=>mBa,winjsStackLineParser:()=>aBa});var Lvr,oBa,Uvr;function sBa(e){let t=globalThis._posthogChunkIds;if(!t)return;let r=Object.keys(t);return Uvr&&r.length===oBa||(oBa=r.length,Uvr=r.reduce((n,i)=>{Lvr||(Lvr={});let o=Lvr[i];if(o)n[o[0]]=o[1];else{let s=e(i);for(let a=s.length-1;a>=0;a--){let c=s[a]?.filename,l=t[i];if(c&&l){n[c]=l,Lvr[i]=[c,l];break}}}return n},{})),Uvr}var lvf=4,IPi=class{constructor(t,r,n=[]){this.coercers=t,this.stackParser=r,this.modifiers=n}buildFromUnknown(t,r={}){let i=r&&r.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,r,0).apply(t),a=this.buildParsingContext(r),u=this.parseStacktrace(s,a);return{$exception_list:this.convertToExceptionList(u,i),$exception_level:"error"}}async modifyFrames(t){for(let r of t)r.stacktrace&&r.stacktrace.frames&&pPi(r.stacktrace.frames)&&(r.stacktrace.frames=await this.applyModifiers(r.stacktrace.frames));return t}coerceFallback(t){return{type:"Error",value:"Unknown error",stack:t.syntheticException?.stack,synthetic:!0}}parseStacktrace(t,r){let n;t.cause!=null&&(n=this.parseStacktrace(t.cause,r));let i;return t.stack!=""&&t.stack!=null&&(i=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?r.skipFirstLines:0),r.chunkIdMap)),{...t,cause:n,stack:i}}applyChunkIds(t,r){return t.map(n=>(n.filename&&r&&(n.chunk_id=r[n.filename]),n))}applyCoercers(t,r){for(let n of this.coercers)if(n.match(t))return n.coerce(t,r);return this.coerceFallback(r)}async applyModifiers(t){let r=t;for(let n of this.modifiers)r=await n(r);return r}convertToExceptionList(t,r){let n={type:t.type,value:t.value,mechanism:{type:r.type??"generic",handled:r.handled??!0,synthetic:t.synthetic??!1}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});let i=[n];return t.cause!=null&&i.push(...this.convertToExceptionList(t.cause,{...r,handled:!0})),i}buildParsingContext(t){return{chunkIdMap:sBa(this.stackParser),skipFirstLines:t.skipFirstLines??1}}buildCoercingContext(t,r,n=0){let i=(s,a)=>{if(a<=lvf){let u=this.buildCoercingContext(t,r,a);return this.applyCoercers(s,u)}};return{...r,syntheticException:n==0?r.syntheticException:void 0,mechanism:t,apply:s=>i(s,n),next:s=>i(s,n+1)}}};var p1="?";function fK(e,t,r,n,i){let o={platform:e,filename:t,function:r==="<anonymous>"?p1:r,in_app:!0};return $9e(n)||(o.lineno=n),$9e(i)||(o.colno=i),o}var zvr=(e,t)=>{let r=e.indexOf("safari-extension")!==-1,n=e.indexOf("safari-web-extension")!==-1;return r||n?[e.indexOf("@")!==-1?e.split("@")[0]:p1,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};var pvf=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,fvf=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,dvf=/\((\S*)(?::(\d+))(?::(\d+))\)/,wPi=(e,t)=>{let r=pvf.exec(e);if(r){let[,i,o,s]=r;return fK(t,i,p1,+o,+s)}let n=fvf.exec(e);if(n){if(n[2]&&n[2].indexOf("eval")===0){let a=dvf.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}let[o,s]=zvr(n[1]||p1,n[2]);return fK(t,s,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}};var mvf=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,hvf=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,CPi=(e,t)=>{let r=mvf.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){let s=hvf.exec(r[3]);s&&(r[1]=r[1]||"eval",r[3]=s[1],r[4]=s[2],r[5]="")}let i=r[3],o=r[1]||p1;return[o,i]=zvr(o,i),fK(t,i,o,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}};var gvf=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,aBa=(e,t)=>{let r=gvf.exec(e);return r?fK(t,r[2],r[1]||p1,+r[3],r[4]?+r[4]:void 0):void 0};var Avf=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,uBa=(e,t)=>{let r=Avf.exec(e);return r?fK(t,r[2],r[3]||p1,+r[1]):void 0},yvf=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,cBa=(e,t)=>{let r=yvf.exec(e);return r?fK(t,r[5],r[3]||r[4]||p1,+r[1],+r[2]):void 0};var bvf=/^\s*[-]{4,}$/,Evf=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,pBa=(e,t)=>{let r=e.match(Evf);if(r){let n,i,o,s,a;if(r[1]){o=r[1];let l=o.lastIndexOf(".");if(o[l-1]==="."&&l--,l>0){n=o.slice(0,l),i=o.slice(l+1);let p=n.indexOf(".Module");p>0&&(o=o.slice(p+1),n=n.slice(0,p))}s=void 0}i&&(s=n,a=i),i==="<anonymous>"&&(a=void 0,o=void 0),o===void 0&&(a=a||p1,o=s?`${s}.${a}`:a);let u=r[2]?.startsWith("file://")?r[2].slice(7):r[2],c=r[5]==="native";return u?.match(/\/[A-Z]:/)&&(u=u.slice(1)),!u&&r[5]&&!c&&(u=r[5]),{filename:u?decodeURI(u):void 0,module:void 0,function:o,lineno:lBa(r[3]),colno:lBa(r[4]),in_app:vvf(u||"",c),platform:t}}if(e.match(bvf))return{filename:e,platform:t}};function vvf(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 lBa(e){return parseInt(e||"",10)||void 0}var fBa=/\(error: (.*)\)/,dBa=50;function mBa(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,dBa).map(r=>({...r,filename:r.filename||Ivf(t).filename,function:r.function||p1}))}function Ivf(e){return e[e.length-1]||{}}function wvf(){return hBa("web:javascript",wPi,CPi)}function hBa(e,...t){return(r,n=0)=>{let i=[],o=r.split(`
1658
- `);for(let s=n;s<o.length;s++){let a=o[s];if(a.length>1024)continue;let u=fBa.test(a)?a.replace(fBa,"$1"):a;if(!u.match(/\S*Error: /)){for(let c of t){let l=c(u,e);if(l){i.push(l);break}}if(i.length>=dBa)break}}return mBa(i)}}var xPi=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=mxt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:n?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return XPe(t,"DOMException")}isDOMError(t){return XPe(t,"DOMError")}};var _Pi=class{match(t){return dPi(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let n=t.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(t){return t.stacktrace||t.stack||void 0}};var SPi=class{constructor(){}match(t){return USa(t)&&t.error!=null}coerce(t,r){let n=r.apply(t.error);return n||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var Cvf=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,BPi=class{match(t){return typeof t=="string"}coerce(t,r){let[n,i]=this.getInfos(t);return{type:n??"Error",value:i??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",n=t,i=t.match(Cvf);return i&&(r=i[1],n=i[2]),[r,n]}};var gBa=["fatal","error","warning","log","info","debug"];function Vvr(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){let i=r.slice(0,n).join(", ");if(!(i.length>t))return n===r.length||i.length<=t?i:`${i.slice(0,t)}...`}return""}var OPi=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let n=this.getErrorPropertyFromObject(t);return n?r.apply(n):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Tvr(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let i=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(i+=` with message: '${t.message}'`),i}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),n=Vvr(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return mxt(t)&&!MSa(t)&&gBa.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(tBa(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var PPi=class{match(t){return Tvr(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Vvr(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var TPi=class{match(t){return hxt(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var DPi=class{match(t){return XPe(t,"PromiseRejectionEvent")}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return hxt(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){if(hxt(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var RPi=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)}}};var bBa=require("fs"),EBa=require("readline"),qvr=new wF.ReduceableCache(25),vBa=new wF.ReduceableCache(20),FPi=7,xvf=1e3,_vf=1e4;async function IBa(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],s=o?.filename;if(!o||typeof s!="string"||typeof o.lineno!="number"||Pvf(s)||Tvf(o))continue;t[s]||(t[s]=[]),t[s].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(vBa.get(i))continue;let o=t[i];if(!o)continue;o.sort((u,c)=>u-c);let s=Rvf(o);if(s.every(u=>Dvf(i,u)))continue;let a=Fvf(qvr,i,{});n.push(Svf(i,s,a))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&Bvf(e,qvr),qvr.reduce(),e}function Svf(e,t,r){return new Promise(n=>{let i=(0,bBa.createReadStream)(e),o=(0,EBa.createInterface)({input:i});function s(){i.destroy(),n()}let a=0,u=0,c=t[u];if(c===void 0)return void s();let l=c[0],p=c[1];function d(){vBa.set(e,1),o.close(),o.removeAllListeners(),s()}i.on("error",d),o.on("error",d),o.on("close",s),o.on("line",f=>{if(a++,!(a<l)&&(r[a]=kvf(f,0),a>=p)){if(u===t.length-1){o.close(),o.removeAllListeners();return}u++;let m=t[u];if(m===void 0){o.close(),o.removeAllListeners();return}l=m[0],p=m[1]}})})}function Bvf(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;Ovf(r.lineno,r,n)}}function Ovf(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=wBa(e);i<e;i++){let o=r[i];if(o===void 0)return void ABa(t);t.pre_context.push(o)}if(r[e]===void 0)return void ABa(t);t.context_line=r[e];let n=CBa(e);t.post_context=[];for(let i=e+1;i<=n;i++){let o=r[i];if(o===void 0)break;t.post_context.push(o)}}function ABa(e){delete e.pre_context,delete e.context_line,delete e.post_context}function Pvf(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function Tvf(e){return e.lineno!==void 0&&e.lineno>_vf||e.colno!==void 0&&e.colno>xvf}function Dvf(e,t){let r=qvr.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 Rvf(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=yBa(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let o=e[t+1];if(typeof o!="number")break;o<=n[1]?n[1]=o+FPi:(i.push(n),n=yBa(o)),t++}return i}function yBa(e){return[wBa(e),CBa(e)]}function wBa(e){return Math.max(1,e-FPi)}function CBa(e){return e+FPi}function Fvf(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function kvf(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 o=Math.min(i+140,n);return o>n-5&&(o=n),o===n&&(i=Math.max(o-140,0)),r=r.slice(i,o),i>0&&(r=`...${r}`),o<n&&(r+="..."),r}function Qvf(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(s=>s.name!=="domainUncaughtExceptionClear"&&s._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function xBa(e,t){globalThis.process?.on("uncaughtException",Qvf(e,t))}function _Ba(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var Nvf=2e3,cV=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new Dvr({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return fPi(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i};n||(o.$process_person_profile=!1);let s=this.errorPropertiesBuilder.buildFromUnknown(t,r);return s.$exception_list=await this.errorPropertiesBuilder.modifyFrames(s.$exception_list),{event:"$exception",distinctId:n||pK(),properties:{...s,...o},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){this.isEnabled()&&(xBa(this.onException.bind(this),this.onFatalError.bind(this)),_Ba(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{if(!e.isPreviouslyCapturedError(t)){let n=await e.buildEventMessage(t,r),o=n.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(o)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:o}):this.client.capture(n)}})())}async onFatalError(t){console.error(t),await this.client.shutdown(Nvf),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var SBa="5.26.2";var bxt={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function BBa(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}var jvf=6e4,Mvf=1152921504606847e3,Lvf=["is_not"],Y9e=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},uh=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},dK=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Gvr=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:s,...a}){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=o,this.poller=void 0,this.fetch=a.fetch||fetch,this.onError=a.onError,this.customHeaders=s,this.onLoad=a.onLoad,this.cacheProvider=a.cacheProvider,this.strictLocalEvaluation=a.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}createEvaluationContext(t,r={},n={},i={},o={}){return{distinctId:t,groups:r,personProperties:n,groupProperties:i,evaluationCache:o}}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let s,a;if(!this.loadedSuccessfullyOnce)return s;if(a=this.featureFlagsByKey[t],a!==void 0){let u=this.createEvaluationContext(r,n,i,o);try{s=(await this.computeFlagAndPayloadLocally(a,u)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${s}`))}catch(c){c instanceof dK||c instanceof uh?this.logMsgIfDebug(()=>console.debug(`${c.name} when computing flag locally: ${t}: ${c.message}`)):c instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${c}`))}}return s}async getAllFlagsAndPayloads(t,r){await this.loadFeatureFlags();let n={},i={},o=this.featureFlags.length==0,s=r?r.map(u=>this.featureFlagsByKey[u]).filter(Boolean):this.featureFlags,a={...t,evaluationCache:t.evaluationCache??{}};return await Promise.all(s.map(async u=>{try{let{value:c,payload:l}=await this.computeFlagAndPayloadLocally(u,a);n[u.key]=c,l&&(i[u.key]=l)}catch(c){c instanceof dK||c instanceof uh?this.logMsgIfDebug(()=>console.debug(`${c.name} when computing flag locally: ${u.key}: ${c.message}`)):c instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${u.key}: ${c}`)),o=!0}})),{response:n,payloads:i,fallbackToFlags:o}}async computeFlagAndPayloadLocally(t,r,n={}){let{matchValue:i,skipLoadCheck:o=!1}=n;if(o||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=i!==void 0?i:await this.computeFlagValueLocally(t,r);let a=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:a}}async computeFlagValueLocally(t,r){let{distinctId:n,groups:i,personProperties:o,groupProperties:s}=r;if(t.ensure_experience_continuity)throw new uh("Flag has experience continuity enabled");if(!t.active)return!1;let u=(t.filters||{}).aggregation_group_type_index;if(u!=null){let c=this.groupTypeMapping[String(u)];if(!c)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${u} for feature flag ${t.key}`)),new uh("Flag has unknown group type index");if(!(c in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;t.bucketing_identifier==="device_id"&&(o?.$device_id===void 0||o?.$device_id===null||o?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${t.key}`));let l=s[c];return await this.matchFeatureFlagProperties(t,i[c],l,r)}{let c=this.getBucketingValueForFlag(t,n,o);if(c===void 0)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${t.key} without $device_id, falling back to server evaluation`)),new uh(`Can't compute feature flag: ${t.key} without $device_id`);return await this.matchFeatureFlagProperties(t,c,o,r)}}getBucketingValueForFlag(t,r,n){if(t.filters?.aggregation_group_type_index!=null)return r;if(t.bucketing_identifier==="device_id"){let i=n?.$device_id;return i==null||i===""?void 0:i}return r}getFeatureFlagPayload(t,r){let n=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),n!=null)){if(typeof n=="object")return n;if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}return null}async evaluateFlagDependency(t,r,n){let{evaluationCache:i}=n,o=t.key;if(!this.featureFlagsByKey)throw new uh("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new uh(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let s=t.dependency_chain;if(!Array.isArray(s))throw new uh(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof s})`);if(s.length===0)throw new uh(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let u of s){if(!(u in i)){let l=this.featureFlagsByKey[u];if(l)if(l.active)try{let p=await this.computeFlagValueLocally(l,n);i[u]=p}catch(p){throw new uh(`Error evaluating flag dependency '${u}' for flag '${o}': ${p}`)}else i[u]=!1;else throw new uh(`Missing flag dependency '${u}' for flag '${o}'`)}if(i[u]==null)throw new uh(`Dependency '${u}' could not be evaluated`)}let a=i[o];return this.flagEvaluatesToExpectedValue(t.value,a)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,n,i){let o=t.filters||{},s=o.groups||[],a=!1,u;for(let c of s)try{if(await this.isConditionMatch(t,r,c,n,i)){let l=c.variant,p=o.multivariate?.variants||[];u=l&&p.some(d=>d.key===l)?l:await this.getMatchingVariant(t,r)||!0;break}}catch(l){if(l instanceof dK)throw l;if(l instanceof uh)a=!0;else throw l}if(u!==void 0)return u;if(a)throw new uh("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o){let s=n.rollout_percentage,a=u=>{this.logMsgIfDebug(()=>console.warn(u))};if((n.properties||[]).length>0){for(let u of n.properties){let c=u.type,l=!1;if(l=c==="cohort"?RBa(u,i,this.cohorts,this.debugMode):c==="flag"?await this.evaluateFlagDependency(u,i,o):DBa(u,i,a),!l)return!1}if(s==null)return!0}return!(s!=null&&await OBa(t.key,r)>s/100)}async getMatchingVariant(t,r){let n=await OBa(t.key,r,"variant"),i=this.variantLookupTable(t).find(o=>n>=o.valueMin&&n<o.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(a=>{i=n+a.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:a.key}),n=i}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,n)=>(r[n.key]=n,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(t){if(this.strictLocalEvaluation)return;let r=t.filter(n=>n.ensure_experience_continuity);r.length>0&&console.warn(`[PostHog] You are using local evaluation but ${r.length} flag(s) have experience continuity enabled: ${r.map(n=>n.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(r.flags),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return!t&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(jvf,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(n){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${n}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new Y9e(`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.beginBackoff(),new Y9e(`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.beginBackoff(),new Y9e(`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 n=await r.json()??{};if(!("flags"in n))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let i={flags:n.flags??[],groupTypeMapping:n.group_type_mapping||{},cohorts:n.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(o){this.onError?.(new Error(`Failed to store in cache: ${o}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(t){t instanceof Y9e&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let n={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(n["If-None-Match"]=r),{method:t,headers:n}}_requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=ZPe(()=>{i.abort()},this.timeout),r.signal=i.signal}try{let i=this.fetch;return i(t,r)}finally{clearTimeout(n)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((n,i)=>setTimeout(()=>i(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function OBa(e,t,r=""){let n=await BBa(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/Mvf}function DBa(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")throw new uh("Operator is_not_set is not supported")}else throw new uh(`Property ${n} not found in propertyValues`);let s=t[n];if(s==null&&!Lvf.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function a(c,l){return Array.isArray(c)?c.map(p=>String(p).toLowerCase()).includes(String(l).toLowerCase()):String(c).toLowerCase()===String(l).toLowerCase()}function u(c,l,p){if(p==="gt")return c>l;if(p==="gte")return c>=l;if(p==="lt")return c<l;if(p==="lte")return c<=l;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return a(i,s);case"is_not":return!a(i,s);case"is_set":return n in t;case"icontains":return String(s).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(s).toLowerCase().includes(String(i).toLowerCase());case"regex":return PBa(String(i))&&String(s).match(String(i))!==null;case"not_regex":return PBa(String(i))&&String(s).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let c=typeof i=="number"?i:null;if(typeof i=="string")try{c=parseFloat(i)}catch{}return c==null||s==null?u(String(s),String(i),o):typeof s=="string"?u(s,String(i),o):u(s,c,o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new uh("Date operations cannot be performed on boolean values");let c=zvf(String(i));if(c==null&&(c=TBa(i)),c==null)throw new uh(`Invalid date: ${i}`);let l=TBa(s);return["is_date_before"].includes(o)?l<c:l>c}default:throw new uh(`Unknown operator: ${o}`)}}function Uvf(e,t){if(!(e in t))throw new dK(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function RBa(e,t,r,n=!1){let i=String(e.value);Uvf(i,r);let o=r[i];return FBa(o,t,r,n)}function FBa(e,t,r,n=!1){if(!e)return!0;let i=e.type,o=e.values;if(!o||o.length===0)return!0;let s=!1;if("values"in o[0]){for(let a of o)try{let u=FBa(a,t,r,n);if(i==="AND"){if(!u)return!1}else if(u)return!0}catch(u){if(u instanceof dK)throw u;if(u instanceof uh)n&&console.debug(`Failed to compute property ${a} locally: ${u}`),s=!0;else throw u}if(s)throw new uh("Can't match cohort without a given cohort property value");return i==="AND"}for(let a of o)try{let u;if(a.type==="cohort")u=RBa(a,t,r,n);else if(a.type==="flag"){n&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${a.key||"unknown"}'`);continue}else u=DBa(a,t);let c=a.negation||!1;if(i==="AND"){if(!u&&!c||u&&c)return!1}else if(u&&!c||!u&&c)return!0}catch(u){if(u instanceof dK)throw u;if(u instanceof uh)n&&console.debug(`Failed to compute property ${a} locally: ${u}`),s=!0;else throw u}if(s)throw new uh("can't match cohort without a given cohort property value");return i==="AND"}function PBa(e){try{return new RegExp(e),!0}catch{return!1}}function TBa(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 uh(`${e} is in an invalid date format`)}throw new uh(`The date provided ${e} must be a string, number, or date object`)}function zvf(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(!r)return null;{if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let o=r.groups.interval;if(o=="h")n.setUTCHours(n.getUTCHours()-i);else if(o=="d")n.setUTCDate(n.getUTCDate()-i);else if(o=="w")n.setUTCDate(n.getUTCDate()-7*i);else if(o=="m")n.setUTCMonth(n.getUTCMonth()-i);else{if(o!="y")return null;n.setUTCFullYear(n.getUTCFullYear()-i)}return n}}var Wvr=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var Vvf=100,kBa=3e4,qvf=5e4,$vr=class extends yxt{constructor(t,r={}){if(super(t,r),this._memoryStorage=new Wvr,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,Vvf):kBa,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.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new Gvr({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider,strictLocalEvaluation:r.strictLocalEvaluation}))}this.errorTracking=new cV(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||qvf}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):fetch(t,r)}getLibraryVersion(){return SBa}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._logger.warn("Called capture() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStateless(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStatelessImmediate(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStateless(t,l,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStatelessImmediate(t,l,{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=kBa){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",o=>{clearTimeout(n),i(),r(o>0)})})}_resolveDistinctId(t,r){return typeof t=="string"?{distinctId:t,options:r}:{distinctId:this.context?.get()?.distinctId,options:t}}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let w=this._flagOverrides[t];if(w===void 0)return;let x=this._payloadOverrides?.[t];return{key:t,enabled:w!==!1,variant:typeof w=="string"?w:void 0,payload:x}}let{groups:s,disableGeoip:a}=n,{onlyEvaluateLocally:u,personProperties:c,groupProperties:l}=n,p=this.addLocalPersonAndGroupProperties(r,s,c,l);c=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(r,s,c,l);u==null&&(u=this.options.strictLocalEvaluation??!1);let f,m=!1,h,g,A,b,v,E;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let w=this.featureFlagsPoller?.featureFlagsByKey[t];if(w)try{let x=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(w,d,{matchValue:i});if(x){m=!0;let C=x.value;b=w.id,E="Evaluated locally",f={key:t,enabled:C!==!1,variant:typeof C=="string"?C:void 0,payload:x.payload??void 0}}}catch(x){if(x instanceof dK||x instanceof uh)this._logger?.info(`${x.name} when computing flag locally: ${t}: ${x.message}`);else throw x}}if(!m&&!u){let w=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,a,[t]);if(w===void 0)A=bxt.UNKNOWN_ERROR;else{h=w.requestId,g=w.evaluatedAt;let x=[];w.errorsWhileComputingFlags&&x.push(bxt.ERRORS_WHILE_COMPUTING),w.quotaLimited?.includes("feature_flags")&&x.push(bxt.QUOTA_LIMITED);let C=w.flags[t];if(C===void 0)x.push(bxt.FLAG_MISSING);else{b=C.metadata?.id,v=C.metadata?.version,E=C.reason?.description??C.reason?.code;let _;if(C.metadata?.payload!==void 0)try{_=JSON.parse(C.metadata.payload)}catch{_=C.metadata.payload}f={key:t,enabled:C.enabled,variant:C.variant,payload:_}}x.length>0&&(A=x.join(","))}}if(o){let w=f===void 0?void 0:f.enabled===!1?!1:f.variant??!0,x=`${t}_${w}`;if(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(x)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(x):this.distinctIdHasSentFlagCalls[r]=[x];let C={$feature_flag:t,$feature_flag_response:w,$feature_flag_id:b,$feature_flag_version:v,$feature_flag_reason:E,locally_evaluated:m,[`$feature/${t}`]:w,$feature_flag_request_id:h,$feature_flag_evaluated_at:m?Date.now():g};if(m&&this.featureFlagsPoller){let _=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();_!==void 0&&(C.$feature_flag_definitions_loaded_at=_)}A&&(C.$feature_flag_error=A),this.capture({distinctId:r,event:"$feature_flag_called",properties:C,groups:s,disableGeoip:a})}}return f!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(f={...f,payload:this._payloadOverrides[t]}),f}async getFeatureFlag(t,r,n){let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(i!==void 0)return i.enabled===!1?!1:i.variant??!0}async getFeatureFlagPayload(t,r,n,i){if(this._payloadOverrides!==void 0&&t in this._payloadOverrides)return this._payloadOverrides[t];let o=await this._getFeatureFlagResult(t,r,{...i,sendFeatureFlagEvents:!1},n);if(o!==void 0)return o.payload??null}async getFeatureFlagResult(t,r,n){let{distinctId:i,options:o}=this._resolveDistinctId(r,n);return i?this._getFeatureFlagResult(t,i,{...o,sendFeatureFlagEvents:o?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()")}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let n=await r.json();if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);return n?(await this.getAllFlagsAndPayloads(n,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:u,personProperties:c,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,c,l);c=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,c,l);u==null&&(u=this.options.strictLocalEvaluation??!1);let f=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),m={},h={},g=!0;if(f&&(m=f.response,h=f.payloads,g=f.fallbackToFlags),g&&!u){let A=await super.getFeatureFlagsAndPayloadsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);m={...m,...A.flags||{}},h={...h,...A.payloads||{}}}return this._flagOverrides!==void 0&&(m={...m,...this._flagOverrides}),this._payloadOverrides!==void 0&&(h={...h,...this._payloadOverrides}),{featureFlags:m,featureFlagPayloads:h}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:o}){super.groupIdentifyStateless(t,r,n,{disableGeoip:o},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(t){let r=n=>Object.fromEntries(n.map(i=>[i,!0]));if(t===!1){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(t)){this._flagOverrides=r(t);return}if(this._isFeatureFlagOverrideOptions(t)){"flags"in t&&(t.flags===!1?this._flagOverrides=void 0:Array.isArray(t.flags)?this._flagOverrides=r(t.flags):t.flags!==void 0&&(this._flagOverrides={...t.flags})),"payloads"in t&&(t.payloads===!1?this._payloadOverrides=void 0:t.payloads!==void 0&&(this._payloadOverrides={...t.payloads}));return}this._flagOverrides={...t}}_isFeatureFlagOverrideOptions(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let r=t;if("flags"in r){let n=r.flags;if(n===!1||Array.isArray(n)||typeof n=="object"&&n!==null)return!0}if("payloads"in r){let n=r.payloads;if(n===!1||typeof n=="object"&&n!==null)return!0}return!1}withContext(t,r,n){return this.context?this.context.run(t,r,n):r()}getContext(){return this.context?.get()}enterContext(t,r){this.context?.enter(t,r)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown(),super._shutdown(t)}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let o=new AbortController;i=ZPe(()=>{o.abort()},this.options.requestTimeout),n.signal=o.signal}try{return await this.fetch(r,n)}catch(o){this._events.emit("error",o);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let n={},i={};for(let[o,s]of Object.entries(t))if(zSa(s)&&r&&o in r){let a={};for(let[u,c]of Object.entries(s))a[String(u)]=String(c);i[String(o)]=a}else n[String(o)]=String(s);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},s=i?.groupProperties||{},a=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let c={};for(let[l,p]of Object.entries(r||{}))c[l]=String(p);return await this.getAllFlags(t,{groups:c,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let c={};for(let[l,p]of Object.entries(r||{}))c[l]=String(p);return await this.getAllFlags(t,{groups:c,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}return(await super.getFeatureFlagsStateless(t,r,o,s,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},s={};if(r)for(let a of Object.keys(r))s[a]={$group_key:r[a],...i?.[a]||{}};return{allPersonProperties:o,allGroupProperties:s}}createFeatureFlagEvaluationContext(t,r,n,i){return{distinctId:t,groups:r||{},personProperties:n||{},groupProperties:i||{},evaluationCache:{}}}captureException(t,r,n,i){if(!cV.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");this.addPendingPromise(cV.buildEventMessage(t,{syntheticException:o},r,n).then(s=>this.capture({...s,uuid:i})))}}async captureExceptionImmediate(t,r,n){if(!cV.isPreviouslyCapturedError(t)){let i=new Error("PostHog syntheticException");this.addPendingPromise(cV.buildEventMessage(t,{syntheticException:i},r,n).then(o=>this.captureImmediate(o)))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:u,uuid:c}=t,l=this.context?.get(),p=r||l?.distinctId,d={...this.props,...l?.properties||{},...i||{}};p||(p=pK(),d.$process_person_profile=!1),l?.sessionId&&!d.$session_id&&(d.$session_id=l.sessionId);let f=this._runBeforeSend({distinctId:p,event:n,properties:d,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:u,uuid:c});if(!f)return Promise.reject(null);let m=await Promise.resolve().then(async()=>{if(s){let h=typeof s=="object"?s:void 0;return await this.getFeatureFlagsForEvent(f.distinctId,o,u,h)}return f.event,{}}).then(h=>{let g={};if(h)for(let[b,v]of Object.entries(h))g[`$feature/${b}`]=v;let A=Object.keys(h||{}).filter(b=>h?.[b]!==!1).sort();return A.length>0&&(g.$active_feature_flags=A),g}).catch(()=>({})).then(h=>({...h,...f.properties||{},$groups:f.groups||o}));return f.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof m.$raw_user_agent=="string"&&NSa(m.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(f.event="$bot_pageview",m.$browser_type="bot"),{distinctId:f.distinctId,event:f.event,properties:m,options:{timestamp:f.timestamp,disableGeoip:f.disableGeoip,uuid:f.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let n=Array.isArray(r)?r:[r],i=t;for(let o of n){if(i=o(i),!i)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!i.properties||Object.keys(i.properties).length===0){let s=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(s)}}return i}};var QBa=require("async_hooks"),Hvr=class{constructor(){this.storage=new QBa.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){return this.storage.run(this.resolve(t,n),r)}enter(t,r){this.storage.enterWith(this.resolve(t,r))}resolve(t,r){if(r?.fresh===!0)return t;let n=this.get()||{};return{distinctId:t.distinctId??n.distinctId,sessionId:t.sessionId??n.sessionId,properties:{...n.properties||{},...t.properties||{}}}}};var NBa="posthog-node";function Gvf(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return s=>{if(!(i==="*"||i.includes(s.level)))return s;s.tags||(s.tags={});let u=s.tags[kPi.POSTHOG_ID_TAG];if(u===void 0)return s;let c=e.options.host??"https://us.i.posthog.com",l=new URL(`/project/${e.apiKey}/person/${u}`,c).toString();s.tags["PostHog Person URL"]=l;let p=s.exception?.values||[],d=p.map(m=>({...m,stacktrace:m.stacktrace?{...m.stacktrace,type:"raw",frames:(m.stacktrace.frames||[]).map(h=>({...h,platform:"node:javascript"}))}:void 0})),f={$exception_message:p[0]?.value||s.message,$exception_type:p[0]?.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:p[0]?.value||s.message,$sentry_exception_type:p[0]?.type,$sentry_tags:s.tags};return t&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+s.event_id),o&&e.capture({event:"$exception",distinctId:u,properties:f}),s}}var kPi=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=NBa,this.name=NBa,this.setupOnce=function(s,a){let u=a()?.getClient()?.getDsn()?.projectId;s(Gvf(t,{organization:r,projectId:u,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};cV.errorPropertiesBuilder=new wF.ErrorPropertiesBuilder([new wF.EventCoercer,new wF.ErrorCoercer,new wF.ObjectCoercer,new wF.StringCoercer,new wF.PrimitiveCoercer],wF.createStackParser("node:javascript",wF.nodeStackLineParser),[RSa(),IBa]);var X9e=class extends $vr{getLibraryId(){return"posthog-node"}initializeContext(){return new Hvr}};var Kvr=class{posthog;constructor({posthogApiKey:t}){this.posthog=new X9e(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"4.39.0",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var Ext=class{async sendEvent(){}async identify(){}async flush(){}};qt();var Z9e=require("fs/promises"),jBa=require("os"),MBa=require("path");var Wvf="id",$vf=".fern",vxt=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new X9e(r),this.userId=t==null?void 0:XCi(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"4.39.0",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){await this.posthog.flush()}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await kA({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=We(Ut.of((0,jBa.homedir)()),_e.of($vf),_e.of(Wvf));await Zt(t)||(await(0,Z9e.mkdir)((0,MBa.dirname)(t),{recursive:!0}),await(0,Z9e.writeFile)(t,vC())),this.persistedDistinctId=(await(0,Z9e.readFile)(t)).toString()}return this.persistedDistinctId}};var QPi;async function eGe(){return QPi==null&&(QPi=await Hvf()),QPi}async function Hvf(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Ext;let r=await ugr();return r!=null?new vxt({token:r,posthogApiKey:e}):await HH()!=null?new Kvr({posthogApiKey:e}):new vxt({token:void 0,posthogApiKey:e})}catch{return new Ext}}St();var Ixt=xe(require("process"),1);ENe();var zBa=xe(KAi(),1),VBa=xe(UBa(),1);function jC(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=C5(e),e.length===0))return 0;e=e.replace((0,VBa.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let o=i.codePointAt(0);if(o<=31||o>=127&&o<=159||o>=768&&o<=879)continue;switch(zBa.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function Jvr(e){let t=0;for(let r of e.split(`
1658
+ `);for(let s=n;s<o.length;s++){let a=o[s];if(a.length>1024)continue;let u=fBa.test(a)?a.replace(fBa,"$1"):a;if(!u.match(/\S*Error: /)){for(let c of t){let l=c(u,e);if(l){i.push(l);break}}if(i.length>=dBa)break}}return mBa(i)}}var xPi=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=mxt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:n?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return XPe(t,"DOMException")}isDOMError(t){return XPe(t,"DOMError")}};var _Pi=class{match(t){return dPi(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let n=t.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(t){return t.stacktrace||t.stack||void 0}};var SPi=class{constructor(){}match(t){return USa(t)&&t.error!=null}coerce(t,r){let n=r.apply(t.error);return n||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var Cvf=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,BPi=class{match(t){return typeof t=="string"}coerce(t,r){let[n,i]=this.getInfos(t);return{type:n??"Error",value:i??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",n=t,i=t.match(Cvf);return i&&(r=i[1],n=i[2]),[r,n]}};var gBa=["fatal","error","warning","log","info","debug"];function Vvr(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){let i=r.slice(0,n).join(", ");if(!(i.length>t))return n===r.length||i.length<=t?i:`${i.slice(0,t)}...`}return""}var OPi=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let n=this.getErrorPropertyFromObject(t);return n?r.apply(n):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Tvr(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let i=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(i+=` with message: '${t.message}'`),i}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),n=Vvr(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return mxt(t)&&!MSa(t)&&gBa.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(tBa(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var PPi=class{match(t){return Tvr(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Vvr(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var TPi=class{match(t){return hxt(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var DPi=class{match(t){return XPe(t,"PromiseRejectionEvent")}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return hxt(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){if(hxt(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var RPi=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)}}};var bBa=require("fs"),EBa=require("readline"),qvr=new wF.ReduceableCache(25),vBa=new wF.ReduceableCache(20),FPi=7,xvf=1e3,_vf=1e4;async function IBa(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],s=o?.filename;if(!o||typeof s!="string"||typeof o.lineno!="number"||Pvf(s)||Tvf(o))continue;t[s]||(t[s]=[]),t[s].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(vBa.get(i))continue;let o=t[i];if(!o)continue;o.sort((u,c)=>u-c);let s=Rvf(o);if(s.every(u=>Dvf(i,u)))continue;let a=Fvf(qvr,i,{});n.push(Svf(i,s,a))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&Bvf(e,qvr),qvr.reduce(),e}function Svf(e,t,r){return new Promise(n=>{let i=(0,bBa.createReadStream)(e),o=(0,EBa.createInterface)({input:i});function s(){i.destroy(),n()}let a=0,u=0,c=t[u];if(c===void 0)return void s();let l=c[0],p=c[1];function d(){vBa.set(e,1),o.close(),o.removeAllListeners(),s()}i.on("error",d),o.on("error",d),o.on("close",s),o.on("line",f=>{if(a++,!(a<l)&&(r[a]=kvf(f,0),a>=p)){if(u===t.length-1){o.close(),o.removeAllListeners();return}u++;let m=t[u];if(m===void 0){o.close(),o.removeAllListeners();return}l=m[0],p=m[1]}})})}function Bvf(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;Ovf(r.lineno,r,n)}}function Ovf(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=wBa(e);i<e;i++){let o=r[i];if(o===void 0)return void ABa(t);t.pre_context.push(o)}if(r[e]===void 0)return void ABa(t);t.context_line=r[e];let n=CBa(e);t.post_context=[];for(let i=e+1;i<=n;i++){let o=r[i];if(o===void 0)break;t.post_context.push(o)}}function ABa(e){delete e.pre_context,delete e.context_line,delete e.post_context}function Pvf(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function Tvf(e){return e.lineno!==void 0&&e.lineno>_vf||e.colno!==void 0&&e.colno>xvf}function Dvf(e,t){let r=qvr.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 Rvf(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=yBa(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let o=e[t+1];if(typeof o!="number")break;o<=n[1]?n[1]=o+FPi:(i.push(n),n=yBa(o)),t++}return i}function yBa(e){return[wBa(e),CBa(e)]}function wBa(e){return Math.max(1,e-FPi)}function CBa(e){return e+FPi}function Fvf(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function kvf(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 o=Math.min(i+140,n);return o>n-5&&(o=n),o===n&&(i=Math.max(o-140,0)),r=r.slice(i,o),i>0&&(r=`...${r}`),o<n&&(r+="..."),r}function Qvf(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(s=>s.name!=="domainUncaughtExceptionClear"&&s._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function xBa(e,t){globalThis.process?.on("uncaughtException",Qvf(e,t))}function _Ba(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var Nvf=2e3,cV=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new Dvr({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return fPi(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i};n||(o.$process_person_profile=!1);let s=this.errorPropertiesBuilder.buildFromUnknown(t,r);return s.$exception_list=await this.errorPropertiesBuilder.modifyFrames(s.$exception_list),{event:"$exception",distinctId:n||pK(),properties:{...s,...o},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){this.isEnabled()&&(xBa(this.onException.bind(this),this.onFatalError.bind(this)),_Ba(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{if(!e.isPreviouslyCapturedError(t)){let n=await e.buildEventMessage(t,r),o=n.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(o)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:o}):this.client.capture(n)}})())}async onFatalError(t){console.error(t),await this.client.shutdown(Nvf),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var SBa="5.26.2";var bxt={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function BBa(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}var jvf=6e4,Mvf=1152921504606847e3,Lvf=["is_not"],Y9e=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},uh=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},dK=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Gvr=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:s,...a}){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=o,this.poller=void 0,this.fetch=a.fetch||fetch,this.onError=a.onError,this.customHeaders=s,this.onLoad=a.onLoad,this.cacheProvider=a.cacheProvider,this.strictLocalEvaluation=a.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}createEvaluationContext(t,r={},n={},i={},o={}){return{distinctId:t,groups:r,personProperties:n,groupProperties:i,evaluationCache:o}}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let s,a;if(!this.loadedSuccessfullyOnce)return s;if(a=this.featureFlagsByKey[t],a!==void 0){let u=this.createEvaluationContext(r,n,i,o);try{s=(await this.computeFlagAndPayloadLocally(a,u)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${s}`))}catch(c){c instanceof dK||c instanceof uh?this.logMsgIfDebug(()=>console.debug(`${c.name} when computing flag locally: ${t}: ${c.message}`)):c instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${c}`))}}return s}async getAllFlagsAndPayloads(t,r){await this.loadFeatureFlags();let n={},i={},o=this.featureFlags.length==0,s=r?r.map(u=>this.featureFlagsByKey[u]).filter(Boolean):this.featureFlags,a={...t,evaluationCache:t.evaluationCache??{}};return await Promise.all(s.map(async u=>{try{let{value:c,payload:l}=await this.computeFlagAndPayloadLocally(u,a);n[u.key]=c,l&&(i[u.key]=l)}catch(c){c instanceof dK||c instanceof uh?this.logMsgIfDebug(()=>console.debug(`${c.name} when computing flag locally: ${u.key}: ${c.message}`)):c instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${u.key}: ${c}`)),o=!0}})),{response:n,payloads:i,fallbackToFlags:o}}async computeFlagAndPayloadLocally(t,r,n={}){let{matchValue:i,skipLoadCheck:o=!1}=n;if(o||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=i!==void 0?i:await this.computeFlagValueLocally(t,r);let a=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:a}}async computeFlagValueLocally(t,r){let{distinctId:n,groups:i,personProperties:o,groupProperties:s}=r;if(t.ensure_experience_continuity)throw new uh("Flag has experience continuity enabled");if(!t.active)return!1;let u=(t.filters||{}).aggregation_group_type_index;if(u!=null){let c=this.groupTypeMapping[String(u)];if(!c)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${u} for feature flag ${t.key}`)),new uh("Flag has unknown group type index");if(!(c in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;t.bucketing_identifier==="device_id"&&(o?.$device_id===void 0||o?.$device_id===null||o?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${t.key}`));let l=s[c];return await this.matchFeatureFlagProperties(t,i[c],l,r)}{let c=this.getBucketingValueForFlag(t,n,o);if(c===void 0)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${t.key} without $device_id, falling back to server evaluation`)),new uh(`Can't compute feature flag: ${t.key} without $device_id`);return await this.matchFeatureFlagProperties(t,c,o,r)}}getBucketingValueForFlag(t,r,n){if(t.filters?.aggregation_group_type_index!=null)return r;if(t.bucketing_identifier==="device_id"){let i=n?.$device_id;return i==null||i===""?void 0:i}return r}getFeatureFlagPayload(t,r){let n=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),n!=null)){if(typeof n=="object")return n;if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}return null}async evaluateFlagDependency(t,r,n){let{evaluationCache:i}=n,o=t.key;if(!this.featureFlagsByKey)throw new uh("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new uh(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let s=t.dependency_chain;if(!Array.isArray(s))throw new uh(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof s})`);if(s.length===0)throw new uh(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let u of s){if(!(u in i)){let l=this.featureFlagsByKey[u];if(l)if(l.active)try{let p=await this.computeFlagValueLocally(l,n);i[u]=p}catch(p){throw new uh(`Error evaluating flag dependency '${u}' for flag '${o}': ${p}`)}else i[u]=!1;else throw new uh(`Missing flag dependency '${u}' for flag '${o}'`)}if(i[u]==null)throw new uh(`Dependency '${u}' could not be evaluated`)}let a=i[o];return this.flagEvaluatesToExpectedValue(t.value,a)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,n,i){let o=t.filters||{},s=o.groups||[],a=!1,u;for(let c of s)try{if(await this.isConditionMatch(t,r,c,n,i)){let l=c.variant,p=o.multivariate?.variants||[];u=l&&p.some(d=>d.key===l)?l:await this.getMatchingVariant(t,r)||!0;break}}catch(l){if(l instanceof dK)throw l;if(l instanceof uh)a=!0;else throw l}if(u!==void 0)return u;if(a)throw new uh("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o){let s=n.rollout_percentage,a=u=>{this.logMsgIfDebug(()=>console.warn(u))};if((n.properties||[]).length>0){for(let u of n.properties){let c=u.type,l=!1;if(l=c==="cohort"?RBa(u,i,this.cohorts,this.debugMode):c==="flag"?await this.evaluateFlagDependency(u,i,o):DBa(u,i,a),!l)return!1}if(s==null)return!0}return!(s!=null&&await OBa(t.key,r)>s/100)}async getMatchingVariant(t,r){let n=await OBa(t.key,r,"variant"),i=this.variantLookupTable(t).find(o=>n>=o.valueMin&&n<o.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(a=>{i=n+a.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:a.key}),n=i}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,n)=>(r[n.key]=n,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(t){if(this.strictLocalEvaluation)return;let r=t.filter(n=>n.ensure_experience_continuity);r.length>0&&console.warn(`[PostHog] You are using local evaluation but ${r.length} flag(s) have experience continuity enabled: ${r.map(n=>n.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(r.flags),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return!t&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(jvf,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(n){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${n}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new Y9e(`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.beginBackoff(),new Y9e(`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.beginBackoff(),new Y9e(`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 n=await r.json()??{};if(!("flags"in n))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let i={flags:n.flags??[],groupTypeMapping:n.group_type_mapping||{},cohorts:n.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(o){this.onError?.(new Error(`Failed to store in cache: ${o}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(t){t instanceof Y9e&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let n={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(n["If-None-Match"]=r),{method:t,headers:n}}_requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=ZPe(()=>{i.abort()},this.timeout),r.signal=i.signal}try{let i=this.fetch;return i(t,r)}finally{clearTimeout(n)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((n,i)=>setTimeout(()=>i(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function OBa(e,t,r=""){let n=await BBa(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/Mvf}function DBa(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")throw new uh("Operator is_not_set is not supported")}else throw new uh(`Property ${n} not found in propertyValues`);let s=t[n];if(s==null&&!Lvf.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function a(c,l){return Array.isArray(c)?c.map(p=>String(p).toLowerCase()).includes(String(l).toLowerCase()):String(c).toLowerCase()===String(l).toLowerCase()}function u(c,l,p){if(p==="gt")return c>l;if(p==="gte")return c>=l;if(p==="lt")return c<l;if(p==="lte")return c<=l;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return a(i,s);case"is_not":return!a(i,s);case"is_set":return n in t;case"icontains":return String(s).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(s).toLowerCase().includes(String(i).toLowerCase());case"regex":return PBa(String(i))&&String(s).match(String(i))!==null;case"not_regex":return PBa(String(i))&&String(s).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let c=typeof i=="number"?i:null;if(typeof i=="string")try{c=parseFloat(i)}catch{}return c==null||s==null?u(String(s),String(i),o):typeof s=="string"?u(s,String(i),o):u(s,c,o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new uh("Date operations cannot be performed on boolean values");let c=zvf(String(i));if(c==null&&(c=TBa(i)),c==null)throw new uh(`Invalid date: ${i}`);let l=TBa(s);return["is_date_before"].includes(o)?l<c:l>c}default:throw new uh(`Unknown operator: ${o}`)}}function Uvf(e,t){if(!(e in t))throw new dK(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function RBa(e,t,r,n=!1){let i=String(e.value);Uvf(i,r);let o=r[i];return FBa(o,t,r,n)}function FBa(e,t,r,n=!1){if(!e)return!0;let i=e.type,o=e.values;if(!o||o.length===0)return!0;let s=!1;if("values"in o[0]){for(let a of o)try{let u=FBa(a,t,r,n);if(i==="AND"){if(!u)return!1}else if(u)return!0}catch(u){if(u instanceof dK)throw u;if(u instanceof uh)n&&console.debug(`Failed to compute property ${a} locally: ${u}`),s=!0;else throw u}if(s)throw new uh("Can't match cohort without a given cohort property value");return i==="AND"}for(let a of o)try{let u;if(a.type==="cohort")u=RBa(a,t,r,n);else if(a.type==="flag"){n&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${a.key||"unknown"}'`);continue}else u=DBa(a,t);let c=a.negation||!1;if(i==="AND"){if(!u&&!c||u&&c)return!1}else if(u&&!c||!u&&c)return!0}catch(u){if(u instanceof dK)throw u;if(u instanceof uh)n&&console.debug(`Failed to compute property ${a} locally: ${u}`),s=!0;else throw u}if(s)throw new uh("can't match cohort without a given cohort property value");return i==="AND"}function PBa(e){try{return new RegExp(e),!0}catch{return!1}}function TBa(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 uh(`${e} is in an invalid date format`)}throw new uh(`The date provided ${e} must be a string, number, or date object`)}function zvf(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(!r)return null;{if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let o=r.groups.interval;if(o=="h")n.setUTCHours(n.getUTCHours()-i);else if(o=="d")n.setUTCDate(n.getUTCDate()-i);else if(o=="w")n.setUTCDate(n.getUTCDate()-7*i);else if(o=="m")n.setUTCMonth(n.getUTCMonth()-i);else{if(o!="y")return null;n.setUTCFullYear(n.getUTCFullYear()-i)}return n}}var Wvr=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var Vvf=100,kBa=3e4,qvf=5e4,$vr=class extends yxt{constructor(t,r={}){if(super(t,r),this._memoryStorage=new Wvr,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,Vvf):kBa,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.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new Gvr({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider,strictLocalEvaluation:r.strictLocalEvaluation}))}this.errorTracking=new cV(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||qvf}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):fetch(t,r)}getLibraryVersion(){return SBa}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._logger.warn("Called capture() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStateless(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStatelessImmediate(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStateless(t,l,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStatelessImmediate(t,l,{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=kBa){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",o=>{clearTimeout(n),i(),r(o>0)})})}_resolveDistinctId(t,r){return typeof t=="string"?{distinctId:t,options:r}:{distinctId:this.context?.get()?.distinctId,options:t}}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let w=this._flagOverrides[t];if(w===void 0)return;let x=this._payloadOverrides?.[t];return{key:t,enabled:w!==!1,variant:typeof w=="string"?w:void 0,payload:x}}let{groups:s,disableGeoip:a}=n,{onlyEvaluateLocally:u,personProperties:c,groupProperties:l}=n,p=this.addLocalPersonAndGroupProperties(r,s,c,l);c=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(r,s,c,l);u==null&&(u=this.options.strictLocalEvaluation??!1);let f,m=!1,h,g,A,b,v,E;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let w=this.featureFlagsPoller?.featureFlagsByKey[t];if(w)try{let x=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(w,d,{matchValue:i});if(x){m=!0;let C=x.value;b=w.id,E="Evaluated locally",f={key:t,enabled:C!==!1,variant:typeof C=="string"?C:void 0,payload:x.payload??void 0}}}catch(x){if(x instanceof dK||x instanceof uh)this._logger?.info(`${x.name} when computing flag locally: ${t}: ${x.message}`);else throw x}}if(!m&&!u){let w=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,a,[t]);if(w===void 0)A=bxt.UNKNOWN_ERROR;else{h=w.requestId,g=w.evaluatedAt;let x=[];w.errorsWhileComputingFlags&&x.push(bxt.ERRORS_WHILE_COMPUTING),w.quotaLimited?.includes("feature_flags")&&x.push(bxt.QUOTA_LIMITED);let C=w.flags[t];if(C===void 0)x.push(bxt.FLAG_MISSING);else{b=C.metadata?.id,v=C.metadata?.version,E=C.reason?.description??C.reason?.code;let _;if(C.metadata?.payload!==void 0)try{_=JSON.parse(C.metadata.payload)}catch{_=C.metadata.payload}f={key:t,enabled:C.enabled,variant:C.variant,payload:_}}x.length>0&&(A=x.join(","))}}if(o){let w=f===void 0?void 0:f.enabled===!1?!1:f.variant??!0,x=`${t}_${w}`;if(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(x)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(x):this.distinctIdHasSentFlagCalls[r]=[x];let C={$feature_flag:t,$feature_flag_response:w,$feature_flag_id:b,$feature_flag_version:v,$feature_flag_reason:E,locally_evaluated:m,[`$feature/${t}`]:w,$feature_flag_request_id:h,$feature_flag_evaluated_at:m?Date.now():g};if(m&&this.featureFlagsPoller){let _=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();_!==void 0&&(C.$feature_flag_definitions_loaded_at=_)}A&&(C.$feature_flag_error=A),this.capture({distinctId:r,event:"$feature_flag_called",properties:C,groups:s,disableGeoip:a})}}return f!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(f={...f,payload:this._payloadOverrides[t]}),f}async getFeatureFlag(t,r,n){let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(i!==void 0)return i.enabled===!1?!1:i.variant??!0}async getFeatureFlagPayload(t,r,n,i){if(this._payloadOverrides!==void 0&&t in this._payloadOverrides)return this._payloadOverrides[t];let o=await this._getFeatureFlagResult(t,r,{...i,sendFeatureFlagEvents:!1},n);if(o!==void 0)return o.payload??null}async getFeatureFlagResult(t,r,n){let{distinctId:i,options:o}=this._resolveDistinctId(r,n);return i?this._getFeatureFlagResult(t,i,{...o,sendFeatureFlagEvents:o?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()")}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let n=await r.json();if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);return n?(await this.getAllFlagsAndPayloads(n,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:u,personProperties:c,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,c,l);c=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,c,l);u==null&&(u=this.options.strictLocalEvaluation??!1);let f=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),m={},h={},g=!0;if(f&&(m=f.response,h=f.payloads,g=f.fallbackToFlags),g&&!u){let A=await super.getFeatureFlagsAndPayloadsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);m={...m,...A.flags||{}},h={...h,...A.payloads||{}}}return this._flagOverrides!==void 0&&(m={...m,...this._flagOverrides}),this._payloadOverrides!==void 0&&(h={...h,...this._payloadOverrides}),{featureFlags:m,featureFlagPayloads:h}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:o}){super.groupIdentifyStateless(t,r,n,{disableGeoip:o},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(t){let r=n=>Object.fromEntries(n.map(i=>[i,!0]));if(t===!1){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(t)){this._flagOverrides=r(t);return}if(this._isFeatureFlagOverrideOptions(t)){"flags"in t&&(t.flags===!1?this._flagOverrides=void 0:Array.isArray(t.flags)?this._flagOverrides=r(t.flags):t.flags!==void 0&&(this._flagOverrides={...t.flags})),"payloads"in t&&(t.payloads===!1?this._payloadOverrides=void 0:t.payloads!==void 0&&(this._payloadOverrides={...t.payloads}));return}this._flagOverrides={...t}}_isFeatureFlagOverrideOptions(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let r=t;if("flags"in r){let n=r.flags;if(n===!1||Array.isArray(n)||typeof n=="object"&&n!==null)return!0}if("payloads"in r){let n=r.payloads;if(n===!1||typeof n=="object"&&n!==null)return!0}return!1}withContext(t,r,n){return this.context?this.context.run(t,r,n):r()}getContext(){return this.context?.get()}enterContext(t,r){this.context?.enter(t,r)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown(),super._shutdown(t)}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let o=new AbortController;i=ZPe(()=>{o.abort()},this.options.requestTimeout),n.signal=o.signal}try{return await this.fetch(r,n)}catch(o){this._events.emit("error",o);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let n={},i={};for(let[o,s]of Object.entries(t))if(zSa(s)&&r&&o in r){let a={};for(let[u,c]of Object.entries(s))a[String(u)]=String(c);i[String(o)]=a}else n[String(o)]=String(s);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},s=i?.groupProperties||{},a=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let c={};for(let[l,p]of Object.entries(r||{}))c[l]=String(p);return await this.getAllFlags(t,{groups:c,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let c={};for(let[l,p]of Object.entries(r||{}))c[l]=String(p);return await this.getAllFlags(t,{groups:c,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}return(await super.getFeatureFlagsStateless(t,r,o,s,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},s={};if(r)for(let a of Object.keys(r))s[a]={$group_key:r[a],...i?.[a]||{}};return{allPersonProperties:o,allGroupProperties:s}}createFeatureFlagEvaluationContext(t,r,n,i){return{distinctId:t,groups:r||{},personProperties:n||{},groupProperties:i||{},evaluationCache:{}}}captureException(t,r,n,i){if(!cV.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");this.addPendingPromise(cV.buildEventMessage(t,{syntheticException:o},r,n).then(s=>this.capture({...s,uuid:i})))}}async captureExceptionImmediate(t,r,n){if(!cV.isPreviouslyCapturedError(t)){let i=new Error("PostHog syntheticException");this.addPendingPromise(cV.buildEventMessage(t,{syntheticException:i},r,n).then(o=>this.captureImmediate(o)))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:u,uuid:c}=t,l=this.context?.get(),p=r||l?.distinctId,d={...this.props,...l?.properties||{},...i||{}};p||(p=pK(),d.$process_person_profile=!1),l?.sessionId&&!d.$session_id&&(d.$session_id=l.sessionId);let f=this._runBeforeSend({distinctId:p,event:n,properties:d,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:u,uuid:c});if(!f)return Promise.reject(null);let m=await Promise.resolve().then(async()=>{if(s){let h=typeof s=="object"?s:void 0;return await this.getFeatureFlagsForEvent(f.distinctId,o,u,h)}return f.event,{}}).then(h=>{let g={};if(h)for(let[b,v]of Object.entries(h))g[`$feature/${b}`]=v;let A=Object.keys(h||{}).filter(b=>h?.[b]!==!1).sort();return A.length>0&&(g.$active_feature_flags=A),g}).catch(()=>({})).then(h=>({...h,...f.properties||{},$groups:f.groups||o}));return f.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof m.$raw_user_agent=="string"&&NSa(m.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(f.event="$bot_pageview",m.$browser_type="bot"),{distinctId:f.distinctId,event:f.event,properties:m,options:{timestamp:f.timestamp,disableGeoip:f.disableGeoip,uuid:f.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let n=Array.isArray(r)?r:[r],i=t;for(let o of n){if(i=o(i),!i)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!i.properties||Object.keys(i.properties).length===0){let s=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(s)}}return i}};var QBa=require("async_hooks"),Hvr=class{constructor(){this.storage=new QBa.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){return this.storage.run(this.resolve(t,n),r)}enter(t,r){this.storage.enterWith(this.resolve(t,r))}resolve(t,r){if(r?.fresh===!0)return t;let n=this.get()||{};return{distinctId:t.distinctId??n.distinctId,sessionId:t.sessionId??n.sessionId,properties:{...n.properties||{},...t.properties||{}}}}};var NBa="posthog-node";function Gvf(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return s=>{if(!(i==="*"||i.includes(s.level)))return s;s.tags||(s.tags={});let u=s.tags[kPi.POSTHOG_ID_TAG];if(u===void 0)return s;let c=e.options.host??"https://us.i.posthog.com",l=new URL(`/project/${e.apiKey}/person/${u}`,c).toString();s.tags["PostHog Person URL"]=l;let p=s.exception?.values||[],d=p.map(m=>({...m,stacktrace:m.stacktrace?{...m.stacktrace,type:"raw",frames:(m.stacktrace.frames||[]).map(h=>({...h,platform:"node:javascript"}))}:void 0})),f={$exception_message:p[0]?.value||s.message,$exception_type:p[0]?.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:p[0]?.value||s.message,$sentry_exception_type:p[0]?.type,$sentry_tags:s.tags};return t&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+s.event_id),o&&e.capture({event:"$exception",distinctId:u,properties:f}),s}}var kPi=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=NBa,this.name=NBa,this.setupOnce=function(s,a){let u=a()?.getClient()?.getDsn()?.projectId;s(Gvf(t,{organization:r,projectId:u,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};cV.errorPropertiesBuilder=new wF.ErrorPropertiesBuilder([new wF.EventCoercer,new wF.ErrorCoercer,new wF.ObjectCoercer,new wF.StringCoercer,new wF.PrimitiveCoercer],wF.createStackParser("node:javascript",wF.nodeStackLineParser),[RSa(),IBa]);var X9e=class extends $vr{getLibraryId(){return"posthog-node"}initializeContext(){return new Hvr}};var Kvr=class{posthog;constructor({posthogApiKey:t}){this.posthog=new X9e(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"4.40.0",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var Ext=class{async sendEvent(){}async identify(){}async flush(){}};qt();var Z9e=require("fs/promises"),jBa=require("os"),MBa=require("path");var Wvf="id",$vf=".fern",vxt=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new X9e(r),this.userId=t==null?void 0:XCi(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"4.40.0",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){await this.posthog.flush()}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await kA({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=We(Ut.of((0,jBa.homedir)()),_e.of($vf),_e.of(Wvf));await Zt(t)||(await(0,Z9e.mkdir)((0,MBa.dirname)(t),{recursive:!0}),await(0,Z9e.writeFile)(t,vC())),this.persistedDistinctId=(await(0,Z9e.readFile)(t)).toString()}return this.persistedDistinctId}};var QPi;async function eGe(){return QPi==null&&(QPi=await Hvf()),QPi}async function Hvf(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new Ext;let r=await ugr();return r!=null?new vxt({token:r,posthogApiKey:e}):await HH()!=null?new Kvr({posthogApiKey:e}):new vxt({token:void 0,posthogApiKey:e})}catch{return new Ext}}St();var Ixt=xe(require("process"),1);ENe();var zBa=xe(KAi(),1),VBa=xe(UBa(),1);function jC(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=C5(e),e.length===0))return 0;e=e.replace((0,VBa.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let o=i.codePointAt(0);if(o<=31||o>=127&&o<=159||o>=768&&o<=879)continue;switch(zBa.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function Jvr(e){let t=0;for(let r of e.split(`
1659
1659
  `))t=Math.max(t,jC(r));return t}var cOa=xe(jPi(),1);var Jvf=/[\p{Lu}]/u,Yvf=/[\p{Ll}]/u,WBa=/^[\p{Lu}](?![\p{Lu}])/gu,KBa=/([\p{Alpha}\p{N}_]|$)/u,MPi=/[_.\- ]+/,Xvf=new RegExp("^"+MPi.source),$Ba=new RegExp(MPi.source+KBa.source,"gu"),HBa=new RegExp("\\d+"+KBa.source,"gu"),Zvf=(e,t,r,n)=>{let i=!1,o=!1,s=!1,a=!1;for(let u=0;u<e.length;u++){let c=e[u];a=u>2?e[u-3]==="-":!0,i&&Jvf.test(c)?(e=e.slice(0,u)+"-"+e.slice(u),i=!1,s=o,o=!0,u++):o&&s&&Yvf.test(c)&&(!a||n)?(e=e.slice(0,u-1)+"-"+e.slice(u-1),s=o,o=!1,i=!0):(i=t(c)===c&&r(c)!==c,s=o,o=r(c)===c&&t(c)!==c)}return e},eIf=(e,t)=>(WBa.lastIndex=0,e.replace(WBa,r=>t(r))),tIf=(e,t)=>($Ba.lastIndex=0,HBa.lastIndex=0,e.replace($Ba,(r,n)=>t(n)).replace(HBa,r=>t(r)));function LPi(e,t){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";let r=t.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(t.locale),n=t.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(t.locale);return e.length===1?MPi.test(e)?"":t.pascalCase?n(e):r(e):(e!==r(e)&&(e=Zvf(e,r,n,t.preserveConsecutiveUppercase)),e=e.replace(Xvf,""),e=t.preserveConsecutiveUppercase?eIf(e,r):r(e),t.pascalCase&&(e=n(e.charAt(0))+e.slice(1)),tIf(e,n))}var qPi=xe(YBa(),1);ENe();var XBa=(e=0)=>t=>`\x1B[${t+e}m`,ZBa=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,eOa=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,By={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},O3y=Object.keys(By.modifier),oIf=Object.keys(By.color),sIf=Object.keys(By.bgColor),P3y=[...oIf,...sIf];function aIf(){let e=new Map;for(let[t,r]of Object.entries(By)){for(let[n,i]of Object.entries(r))By[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=By[n],e.set(i[0],i[1]);Object.defineProperty(By,t,{value:r,enumerable:!1})}return Object.defineProperty(By,"codes",{value:e,enumerable:!1}),By.color.close="\x1B[39m",By.bgColor.close="\x1B[49m",By.color.ansi=XBa(),By.color.ansi256=ZBa(),By.color.ansi16m=eOa(),By.bgColor.ansi=XBa(10),By.bgColor.ansi256=ZBa(10),By.bgColor.ansi16m=eOa(10),Object.defineProperties(By,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>By.rgbToAnsi256(...By.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>By.ansi256ToAnsi(By.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>By.ansi256ToAnsi(By.hexToAnsi256(t)),enumerable:!1}}),By}var uIf=aIf(),tOa=uIf;var Yvr=new Set(["\x1B","\x9B"]),cIf=39,zPi="\x07",iOa="[",lIf="]",oOa="m",VPi=`${lIf}8;;`,rOa=e=>`${Yvr.values().next().value}${iOa}${e}${oOa}`,nOa=e=>`${Yvr.values().next().value}${VPi}${e}${zPi}`,pIf=e=>e.split(" ").map(t=>jC(t)),UPi=(e,t,r)=>{let n=[...t],i=!1,o=!1,s=jC(C5(e[e.length-1]));for(let[a,u]of n.entries()){let c=jC(u);if(s+c<=r?e[e.length-1]+=u:(e.push(u),s=0),Yvr.has(u)&&(i=!0,o=n.slice(a+1).join("").startsWith(VPi)),i){o?u===zPi&&(i=!1,o=!1):u===oOa&&(i=!1);continue}s+=c,s===r&&a<n.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},fIf=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(jC(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},dIf=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",i,o,s=pIf(e),a=[""];for(let[c,l]of e.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let p=jC(a[a.length-1]);if(c!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),p=0),(p>0||r.trim===!1)&&(a[a.length-1]+=" ",p++)),r.hard&&s[c]>t){let d=t-p,f=1+Math.floor((s[c]-d-1)/t);Math.floor((s[c]-1)/t)<f&&a.push(""),UPi(a,l,t);continue}if(p+s[c]>t&&p>0&&s[c]>0){if(r.wordWrap===!1&&p<t){UPi(a,l,t);continue}a.push("")}if(p+s[c]>t&&r.wordWrap===!1){UPi(a,l,t);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>fIf(c)));let u=[...a.join(`
1660
1660
  `)];for(let[c,l]of u.entries()){if(n+=l,Yvr.has(l)){let{groups:d}=new RegExp(`(?:\\${iOa}(?<code>\\d+)m|\\${VPi}(?<uri>.*)${zPi})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===cIf?void 0:f}else d.uri!==void 0&&(o=d.uri.length===0?void 0:d.uri)}let p=tOa.codes.get(Number(i));u[c+1]===`
1661
1661
  `?(o&&(n+=nOa("")),i&&p&&(n+=rOa(p))):l===`
@@ -2165,7 +2165,7 @@ Hint: Values starting with "@" (such as scoped npm packages) must be wrapped in
2165
2165
  Example: package-name: "@scope/package"`)}return{success:!1,warnings:[{type:"conflict",message:`Failed to parse generators.yml: ${o}`}]}}}checkDeprecatedFields(t,r){t.openapi!=null&&r.push({type:"deprecated",message:"The 'openapi' field is deprecated",suggestion:"Use 'api.specs' instead"}),t["openapi-overrides"]!=null&&r.push({type:"deprecated",message:"The 'openapi-overrides' field is deprecated",suggestion:"Use 'api.specs.[].overrides' instead"}),t["spec-origin"]!=null&&r.push({type:"deprecated",message:"The 'spec-origin' field is deprecated",suggestion:"Use 'api.specs.[].origin' instead"}),t["async-api"]!=null&&r.push({type:"deprecated",message:"The 'async-api' field is deprecated",suggestion:"Use 'api.specs' with asyncapi instead"}),t["api-settings"]!=null&&r.push({type:"deprecated",message:"The 'api-settings' field is deprecated",suggestion:"Use 'api.specs.[].settings' instead"}),t.whitelabel!=null&&r.push({type:"unsupported",message:"Whitelabel configuration is not yet supported in fern.yml"}),t.metadata!=null&&r.push({type:"unsupported",message:"Metadata configuration is not yet supported in fern.yml"}),t.reviewers!=null&&r.push({type:"unsupported",message:"Reviewers configuration is not yet supported in fern.yml"}),t.aliases!=null&&r.push({type:"unsupported",message:"Group aliases are not yet supported in fern.yml",suggestion:"Use multiple group names in target.group array instead"}),t["auth-schemes"]!=null&&r.push({type:"info",message:"Auth schemes configuration detected but not yet migrated",suggestion:"Auth schemes will be supported in a future version"})}async getAbsoluteFilePath(){let t=We(this.cwd,_e.of(Kd)),r=We(this.cwd,_e.of(S4e));if(await Zt(t,"file"))return t;if(await Zt(r,"file"))return r}};var eBt=class{cwd;logger;deleteOriginals;constructor(t){this.cwd=t.cwd,this.logger=t.logger,this.deleteOriginals=t.deleteOriginals??!0}async migrate(){let t=[],r=[],n=await this.findFernDirectory();if(n==null)return{success:!1,warnings:[{type:"conflict",message:"Could not find fern directory",suggestion:"Run this command from a directory containing a 'fern' folder"}],migratedFiles:r};let o=await new ZSt({cwd:n}).migrate();if(t.push(...o.warnings),!o.success||o.org==null)return{success:!1,warnings:[...t,{type:"conflict",message:"Failed to migrate fern.config.json - organization is required"}],migratedFiles:r};o.absoluteFilePath!=null&&r.push(o.absoluteFilePath);let s=We(n,_e.of(JO)),a=await Zt(s,"directory"),u;if(a){let p=await this.migrateMultiApi({fernDir:n,apisDir:s,org:o.org,warnings:t,migratedFiles:r});if(!p.success)return{success:!1,warnings:t,migratedFiles:r};u=p.fernYml}else{let p=await this.migrateSingleApi({fernDir:n,org:o.org,warnings:t,migratedFiles:r});if(!p.success)return{success:!1,warnings:t,migratedFiles:r};u=p.fernYml}let c=We(this.cwd,_e.of(vE)),l=this.serializeFernYml(u);if(await(0,Drt.writeFile)(c,l,"utf-8"),this.deleteOriginals)for(let p of r)try{await(0,Drt.rm)(p),this.logger.debug(`Deleted ${p}`)}catch{t.push({type:"info",message:`Could not delete ${p}`})}return this.logger.info(`Created ${c}`),{success:!0,warnings:t,migratedFiles:r,outputPath:c}}async migrateSingleApi(t){let{fernDir:r,org:n,warnings:i,migratedFiles:o}=t,a=await new zDe({cwd:r}).migrate();i.push(...a.warnings),a.absoluteFilePath!=null&&o.push(a.absoluteFilePath);let u=await R8i({fernDir:r,generatorsYmlApi:a.rawApi});i.push(...u.warnings);let c={org:n};return u.api!=null&&(c.api=u.api),a.sdks!=null&&(c.sdks=a.sdks),{success:!0,fernYml:c}}async migrateMultiApi(t){let{fernDir:r,apisDir:n,org:i,warnings:o,migratedFiles:s}=t,u=(await(0,Drt.readdir)(n,{withFileTypes:!0})).filter(A=>A.isDirectory()).map(A=>A.name);if(u.length===0)return o.push({type:"conflict",message:"No API directories found in fern/apis/"}),{success:!1,fernYml:{org:i}};let c={},l={targets:{}},p,d;for(let A of u){let b=We(n,_e.of(A)),E=await new zDe({cwd:b,apiName:A}).migrate();if(o.push(...E.warnings),E.absoluteFilePath!=null&&s.push(E.absoluteFilePath),c[A]=E.rawApi,E.sdks!=null){for(let[I,w]of Object.entries(E.sdks.targets))l.targets[I]=w;E.sdks.defaultGroup!=null&&p==null&&(p=E.sdks.defaultGroup),E.sdks.autorelease!=null&&d==null&&(d=E.sdks.autorelease)}}let f=await F8i({fernDir:r,apisDir:n,generatorsYmlApis:c});o.push(...f.warnings);let m={org:i,apis:f.apis};Object.keys(l.targets).length>0&&(p!=null&&(l.defaultGroup=p),d!=null&&(l.autorelease=d),m.sdks=l);let g=await new zDe({cwd:r}).detect();return g.found&&g.absoluteFilePath!=null&&(o.push({type:"info",message:"Found generators.yml in fern root alongside apis/ directory",suggestion:"Review the migrated configuration to ensure it's correct"}),s.push(g.absoluteFilePath)),{success:!0,fernYml:m}}async findFernDirectory(){if(this.cwd.split("/").pop()===Hh)return this.cwd;let r=We(this.cwd,_e.of(Hh));if(await Zt(r,"directory"))return r}serializeFernYml(t){let r={edition:t.edition,org:t.org};return t.api!=null&&(r.api=t.api),t.apis!=null&&(r.apis=t.apis),t.ai!=null&&(r.ai=t.ai),t.cli!=null&&(r.cli=t.cli),t.sdks!=null&&(r.sdks=this.simplifySdks(t.sdks)),xr.dump(r,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"',forceQuotes:!1})}simplifySdks(t){let r={...t},n={};for(let[i,o]of Object.entries(t.targets)){let s=o.output;if(typeof s=="string"){n[i]=o;continue}if(s.git==null&&s.path!=null){n[i]={...o,output:s.path};continue}n[i]=o}return r.targets=n,r}};var k8i=class{async handle(t,r){let i=await new eBt({cwd:t.cwd,logger:t.stdout,deleteOriginals:r.delete}).migrate();for(let o of i.warnings){switch(o.type){case"deprecated":t.stdout.warn(`Deprecated: ${o.message}`);break;case"unsupported":t.stdout.warn(`Unsupported: ${o.message}`);break;case"conflict":t.stderr.error(`Error: ${o.message}`);break;case"info":t.stdout.info(o.message);break}o.suggestion!=null&&t.stdout.info(` Suggestion: ${o.suggestion}`)}if(i.success){i.outputPath!=null&&t.stdout.debug(`Created: ${i.outputPath}`);return}throw new Jr({message:"Migration failed"})}};function Q8i(e){let t=new k8i;Ia(e,"migrate","Migrate legacy configuration files to fern.yml",(r,n)=>t.handle(r,n),r=>r.option("delete",{type:"boolean",description:"Keep original files after migration",default:!0}))}function N8i(e){H1(e,"config","Configure, edit, and inspect your settings",[Q8i])}var j8i=class{async handle(t,r){let n=await t.loadWorkspaceOrThrow();if(n.docs==null)throw new Jr({message:`No docs configuration found in fern.yml.
2166
2166
 
2167
2167
  Add a 'docs:' section to your fern.yml to get started.`});let o=await new Sve({context:t}).check({workspace:n,strict:r.strict}),s=o.hasErrors||r.strict&&o.hasWarnings;if(r.json){let a=this.buildJsonResponse({result:o,hasErrors:s});if(t.stdout.info(JSON.stringify(a,null,2)),s)throw Jr.exit();return}if(o.violations.length>0)for(let a of o.violations){let u=a.severity==="warning"?Ee.yellow:Ee.red;process.stderr.write(`${u(`${a.displayRelativeFilepath}:${a.line}:${a.column}: ${a.message}`)}
2168
- `)}if(s)throw Jr.exit();if(o.warningCount>0){t.stderr.info(`${fo.warning} ${Ee.yellow(`Found ${o.warningCount} warnings`)}`),t.stderr.info(Ee.dim(" Run 'fern docs check --strict' to treat warnings as errors"));return}t.stderr.info(`${fo.success} ${Ee.green("All checks passed")}`)}buildJsonResponse({result:t,hasErrors:r}){let n={};return t.violations.length>0&&(n.docs=t.violations.map(i=>bK(i))),{success:!r,results:n}}};function M8i(e){let t=new j8i;Ia(e,"check","Validate docs configuration",(r,n)=>t.handle(r,n),r=>r.option("strict",{type:"boolean",description:"Treat warnings as errors",default:!1}).option("json",{type:"boolean",description:"Output results as JSON to stdout",default:!1}))}var vHa=xe(require("net"),1),IHa=xe(require("os"),1),yEn=class extends Error{constructor(t){super(`${t} is locked`)}},Rrt={old:new Set,young:new Set},fXf=1e3*15;var tBt,dXf=()=>{let e=IHa.default.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},bHa=e=>new Promise((t,r)=>{let n=vHa.default.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),EHa=async(e,t)=>{if(e.host||e.port===0)return bHa(e);for(let r of t)try{await bHa({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},mXf=function*(e){e&&(yield*e),yield 0};async function Bve(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let i=e.exclude;if(typeof i[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let o of i){if(typeof o!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(o))throw new TypeError(`Number ${o} in the exclude option is not a safe integer and can't be used`)}r=new Set(i)}tBt===void 0&&(tBt=setTimeout(()=>{tBt=void 0,Rrt.old=Rrt.young,Rrt.young=new Set},fXf),tBt.unref&&tBt.unref());let n=dXf();for(let i of mXf(t))try{if(r.has(i))continue;let o=await EHa({...e,port:i},n);for(;Rrt.old.has(o)||Rrt.young.has(o);){if(i!==0)throw new yEn(i);o=await EHa({...e,port:i},n)}return Rrt.young.add(o),o}catch(o){if(!["EADDRINUSE","EACCES"].includes(o.code)&&!(o instanceof yEn))throw o}throw new Error("No available ports found")}St();ng();qt();var Msu=xe(z8i(),1),Lsu=xe(ivn(),1),zIn=require("fs/promises"),Usu=xe(require("http"),1),zsu=xe(require("path"),1);var EZa=require("events"),cvn=xe(require("fs"),1),XDe=xe(require("path"),1);var rZa=xe(require("os"),1),nZa=300,kve=20,_Bt=1e7,iZa=rZa.default.platform();var Ood=iZa==="darwin",aVi=iZa==="win32",Qve=Ood||aVi,oZa=3e3,sZa=2e4,uVi=1250;var zX;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(zX||(zX={}));var YDe;(function(e){e.CHANGE="change",e.RENAME="rename"})(YDe||(YDe={}));var SBt;(function(e){e.CHANGE="change",e.ERROR="error"})(SBt||(SBt={}));var eu;(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"})(eu||(eu={}));var LT;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(LT||(LT={}));var Pod=(e,t=1,r)=>{t=Math.max(1,t);let n=r?.leading??!1,i=r?.trailing??!0,o=Math.max(r?.maxWait??1/0,t),s,a,u=0,c=0,l=()=>{let E=Date.now(),I=E-u,w=E-c,x=I>=t||w>=o;return[E,x]},p=E=>{if(c=E,!s)return;let I=s;s=void 0,e.apply(void 0,I)},d=()=>{b(0)},f=()=>{a&&(d(),p(Date.now()))},m=E=>{if(c=E,n)return p(E)},h=E=>{if(i&&s)return p(E);s=void 0},g=()=>{a=void 0;let[E,I]=l();return I?h(E):A(E)},A=E=>{let I=E-u,w=E-c,x=t-I,C=o-w,_=Math.min(x,C);return b(_)},b=E=>{a&&clearTimeout(a),!(E<=0)&&(a=setTimeout(g,E))},v=(...E)=>{let[I,w]=l(),x=!!a;if(s=E,u=I,(w||!a)&&b(t),w)return x?p(I):m(I)};return v.cancel=d,v.flush=f,v},ovn=Pod;var fVi=xe(require("fs"),1),avn=xe(require("path"),1);var wf=xe(require("fs"),1),x1=require("util");var wae=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},VX=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var cVi=xe(require("process"),1),aZa=cVi.default.getuid?!cVi.default.getuid():!1,uZa=1e4,Dk=()=>{};var BBt={isChangeErrorOk:e=>{if(!BBt.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!aZa&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!BBt.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(!BBt.isNodeError(e))throw e;if(!BBt.isChangeErrorOk(e))throw e}},OE=BBt;var lVi=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=uZa,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()}}}}},cZa=new lVi;var Cae=(e,t)=>function(n){return function i(...o){return cZa.schedule().then(s=>{let a=c=>(s(),c),u=c=>{if(s(),Date.now()>=n)throw c;if(t(c)){let l=Math.round(100*Math.random());return new Promise(d=>setTimeout(d,l)).then(()=>i.apply(void 0,o))}throw c};return e.apply(void 0,o).then(a,u)})}},xae=(e,t)=>function(n){return function i(...o){try{return e.apply(void 0,o)}catch(s){if(Date.now()>n)throw s;if(t(s))return i.apply(void 0,o);throw s}}};var Tod={attempt:{chmod:wae((0,x1.promisify)(wf.default.chmod),OE.onChangeError),chown:wae((0,x1.promisify)(wf.default.chown),OE.onChangeError),close:wae((0,x1.promisify)(wf.default.close),Dk),fsync:wae((0,x1.promisify)(wf.default.fsync),Dk),mkdir:wae((0,x1.promisify)(wf.default.mkdir),Dk),realpath:wae((0,x1.promisify)(wf.default.realpath),Dk),stat:wae((0,x1.promisify)(wf.default.stat),Dk),unlink:wae((0,x1.promisify)(wf.default.unlink),Dk),chmodSync:VX(wf.default.chmodSync,OE.onChangeError),chownSync:VX(wf.default.chownSync,OE.onChangeError),closeSync:VX(wf.default.closeSync,Dk),existsSync:VX(wf.default.existsSync,Dk),fsyncSync:VX(wf.default.fsync,Dk),mkdirSync:VX(wf.default.mkdirSync,Dk),realpathSync:VX(wf.default.realpathSync,Dk),statSync:VX(wf.default.statSync,Dk),unlinkSync:VX(wf.default.unlinkSync,Dk)},retry:{close:Cae((0,x1.promisify)(wf.default.close),OE.isRetriableError),fsync:Cae((0,x1.promisify)(wf.default.fsync),OE.isRetriableError),open:Cae((0,x1.promisify)(wf.default.open),OE.isRetriableError),readFile:Cae((0,x1.promisify)(wf.default.readFile),OE.isRetriableError),rename:Cae((0,x1.promisify)(wf.default.rename),OE.isRetriableError),stat:Cae((0,x1.promisify)(wf.default.stat),OE.isRetriableError),write:Cae((0,x1.promisify)(wf.default.write),OE.isRetriableError),writeFile:Cae((0,x1.promisify)(wf.default.writeFile),OE.isRetriableError),closeSync:xae(wf.default.closeSync,OE.isRetriableError),fsyncSync:xae(wf.default.fsyncSync,OE.isRetriableError),openSync:xae(wf.default.openSync,OE.isRetriableError),readFileSync:xae(wf.default.readFileSync,OE.isRetriableError),renameSync:xae(wf.default.renameSync,OE.isRetriableError),statSync:xae(wf.default.statSync,OE.isRetriableError),writeSync:xae(wf.default.writeSync,OE.isRetriableError),writeFileSync:xae(wf.default.writeFileSync,OE.isRetriableError)}},lZa=Tod;var svn=xe(require("fs"),1),OBt=xe(require("path"),1);var pVi=()=>{};var Dod=()=>{let e=pVi,t=pVi,r=!1,n=!1;return{promise:new Promise((u,c)=>{e=l=>(r=!0,u(l)),t=l=>(n=!0,c(l))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},pZa=Dod;var Rod=()=>{let{promise:e,resolve:t,isPending:r}=pZa(),n=0,i=()=>{n+=1},o=()=>{n-=1,!n&&t()};return i(),queueMicrotask(o),{promise:e,isPending:r,increment:i,decrement:o}},fZa=Rod;var dZa={then:e=>{e()}};var mZa=e=>Array.isArray(e)?e:[e],hZa=e=>typeof e=="function";var Fod=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,o=t?.ignore??[],s=mZa(o).map(K=>hZa(K)?K:Y=>K.test(Y)),a=K=>s.some(Y=>Y(K)),u=t?.signal??{aborted:!1},c=t?.onDirents||(()=>{}),l=[],p=new Set,d={},f=[],m=new Set,h={},g=[],A=new Set,b={},v={},E=new Set,I={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},w={directories:l,directoriesNames:p,directoriesNamesToPaths:d,files:f,filesNames:m,filesNamesToPaths:h,symlinks:g,symlinksNames:A,symlinksNamesToPaths:b,map:v},{promise:x,increment:C,decrement:_}=fZa(),R=0,U=(K,Y,ge,he)=>{E.has(Y)||R>=i||(R+=1,K.directories.push(Y),K.directoriesNames.add(ge),l.push(Y),p.add(ge),d.propertyIsEnumerable(ge)||(d[ge]=[]),d[ge].push(Y),E.add(Y),!(he>=n)&&(R>=i||H(Y,he+1)))},q=(K,Y,ge)=>{E.has(Y)||R>=i||(R+=1,K.files.push(Y),K.filesNames.add(ge),f.push(Y),m.add(ge),h.propertyIsEnumerable(ge)||(h[ge]=[]),h[ge].push(Y),E.add(Y))},z=(K,Y,ge,he)=>{E.has(Y)||R>=i||(R+=1,K.symlinks.push(Y),K.symlinksNames.add(ge),g.push(Y),A.add(ge),b.propertyIsEnumerable(ge)||(b[ge]=[]),b[ge].push(Y),E.add(Y),r&&(he>=n||R>=i||ye(Y,he+1)))},J=(K,Y,ge,he,Ce)=>{u.aborted||a(Y)||(he.isDirectory()?U(K,Y,ge,Ce):he.isFile()?q(K,Y,ge):he.isSymbolicLink()&&z(K,Y,ge,Ce))},ie=(K,Y,ge,he)=>{if(u.aborted)return;let Ce=Y===OBt.default.sep?"":OBt.default.sep,Se=ge.name,ae=`${Y}${Ce}${Se}`;a(ae)||(ge.isDirectory()?U(K,ae,Se,he):ge.isFile()?q(K,ae,Se):ge.isSymbolicLink()&&z(K,ae,Se,he))},V=(K,Y,ge,he)=>{for(let Ce=0,Se=ge.length;Ce<Se;Ce++)ie(K,Y,ge[Ce],he)},H=(K,Y)=>{u.aborted||Y>n||R>=i||(C(),svn.default.readdir(K,{withFileTypes:!0},(ge,he)=>{if(ge||u.aborted||!he.length)return _();(c(he)||dZa).then(()=>{let Se=v[K]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};V(Se,K,he,Y),_()})}))},ye=(K,Y)=>{C(),svn.default.realpath(K,(ge,he)=>{if(ge||u.aborted)return _();svn.default.stat(he,(Ce,Se)=>{if(Ce||u.aborted)return _();let ae=OBt.default.basename(he),ce=v[K]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};J(ce,he,ae,Se,Y),_()})})};return(async(K,Y=1)=>(K=OBt.default.normalize(K),E.add(K),H(K,Y),await x,u.aborted?I:w))(e)},gZa=Fod;var qX={lang:{debounce:ovn,attempt:e=>{try{return e()}catch(t){return qX.lang.castError(t)}},castArray:e=>qX.lang.isArray(e)?e:[e],castError:e=>qX.lang.isError(e)?e:qX.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(qX.lang.isNaN(e))return qX.lang.isNaN(t);if(qX.lang.isPrimitive(e)||qX.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(avn.default.sep).length-1),getRealPath:(e,t)=>{try{return t?fVi.default.realpathSync.native(e):fVi.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===avn.default.sep&&t.length-e.length>avn.default.sep.length,poll:(e,t=sZa)=>lZa.retry.stat(t)(e,{bigint:!0}).catch(qX.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,o)=>{if(o&&r===1&&e in o){let s=o[e];return[s.directories,s.files]}else{let s=await gZa(e,{depth:r,limit:n,ignore:t,signal:i});return[s.directories,s.files]}}}},pl=qX;var uvn=xe(require("path"),1);var dVi=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||pl.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=nZa){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,o=async(a,u)=>{let c=this.options.ignoreInitial?[]:a,l=await this.eventsPopulate([...u]),p=this.eventsDeduplicate([...c,...l]);this.onTargetEvents(p)},s=pl.lang.debounce(()=>{this.watcher.isClosed()||(r=o(n,i),n=[],i=new Set)},t);return async(a,u="",c=!1)=>{c?await this.eventsPopulate([u],n,!0):i.add(u),r.then(s)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[o,s]=i,a=r[s];return o===a||o===eu.CHANGE&&a===eu.ADD||(r[s]=o,n.push(i)),n},[])}async eventsPopulate(t,r=[],n=!1){return await Promise.all(t.map(async i=>{let o=await this.watcher._poller.update(i,this.options.pollingTimeout);await Promise.all(o.map(async s=>{r.push([s,i]),s===eu.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):s===eu.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,i,r,n)}))})),r}async eventsPopulateAddDir(t,r,n=[],i=!1){if(i)return n;let o=this.options.recursive?this.options.depth??kve:Math.min(1,this.options.depth??kve),s=this.options.limit??_Bt,[a,u]=await pl.fs.readdir(r,this.options.ignore,o,s,this.watcher._closeSignal),c=[...a,...u];return await Promise.all(c.map(l=>{if(!this.watcher.isIgnored(l,this.options.ignore)&&!t.includes(l))return this.eventsPopulate([l],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let o of this.watcher._poller.stats.keys())pl.fs.isSubPath(r,o)&&(t.includes(o)||await this.eventsPopulate([o],n,!0));return n}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(eu.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!Qve&&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(eu.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(eu.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(uvn.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(eu.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(uvn.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(eu.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===eu.ADD?this.onTargetAdd(n):r===eu.ADD_DIR?this.onTargetAddDir(n):r===eu.CHANGE?this.onTargetChange(n):r===eu.UNLINK?this.onTargetUnlink(n):r===eu.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=YDe.CHANGE,r){if(this.watcher.isClosed())return;let n=uvn.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){aVi&&t.code==="EPERM"?this.onWatcherChange(YDe.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(SBt.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(SBt.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(YDe.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&Qve&&this.options.native!==!1?this.options.depth??kve:Math.min(1,this.options.depth??kve),n=this.options.limit??_Bt,[i,o]=await pl.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),s=[this.folderPath,...i,...o];await Promise.all(s.map(a=>{if(!this.watcher._poller.stats.has(a)&&!this.watcher.isIgnored(a,this.options.ignore))return this.onWatcherEvent(YDe.CHANGE,a,t)}))}}},AZa=dVi;var UT={interval:100,intervalId:void 0,fns:new Map,init:()=>{UT.intervalId||(UT.intervalId=setInterval(UT.resolve,UT.interval))},reset:()=>{UT.intervalId&&(clearInterval(UT.intervalId),delete UT.intervalId)},add:(e,t)=>{UT.fns.set(e,Date.now()+t),UT.init()},remove:e=>{UT.fns.delete(e)},resolve:()=>{if(!UT.fns.size)return UT.reset();let e=Date.now();for(let[t,r]of UT.fns)r>=e||(UT.remove(t),t())}},PBt=UT;var TBt=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=uVi){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{let p=this._watcher._poller.paths.find(n||-1,d=>d!==i);if(p&&p!==i){if(pl.fs.getRealPath(i,!0)===p)return;this._watcher.event(o.rename,p,i)}else this._watcher.event(o.add,i)};if(!n)return a();let u=()=>{s.add.delete(n),PBt.remove(c)},c=()=>{u(),a()};PBt.add(c,r);let l=()=>{let p=s.unlink.get(n);if(!p)return;u();let d=p();i===d?o.change&&this._watcher._poller.stats.has(i)&&this._watcher.event(o.change,i):this._watcher.event(o.rename,d,i)};s.add.set(n,l),l()}getLockUnlink(t,r=uVi){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{this._watcher.event(o.unlink,i)};if(!n)return a();let u=()=>{s.unlink.delete(n),PBt.remove(c)},c=()=>{u(),a()};PBt.add(c,r);let l=()=>(u(),i);s.unlink.set(n,l),s.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,eu.ADD,zX.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,eu.ADD_DIR,zX.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,eu.UNLINK,zX.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,eu.UNLINK_DIR,zX.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}}};TBt.DIR_EVENTS={add:eu.ADD_DIR,rename:eu.RENAME_DIR,unlink:eu.UNLINK_DIR};TBt.FILE_EVENTS={add:eu.ADD,change:eu.CHANGE,rename:eu.RENAME,unlink:eu.UNLINK};var yZa=TBt;var mVi=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(pl.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(pl.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(pl.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(pl.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return pl.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);pl.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},hVi=mVi;var gVi=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}},bZa=gVi;var AVi=class{constructor(){this.inos={},this.paths=new hVi,this.stats=new Map}getIno(t,r,n){let i=this.inos[r];if(!i)return;let o=i[t];if(o&&!(n&&o[1]!==n))return o[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let n=await pl.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new bZa(n)}reset(){this.inos={},this.paths=new hVi,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,eu.ADD,i),[eu.ADD];if(i.isDirectory())return this.updateIno(t,eu.ADD_DIR,i),[eu.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,eu.UNLINK,n),[eu.UNLINK];if(n.isDirectory())return this.updateIno(t,eu.UNLINK_DIR,n),[eu.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,eu.CHANGE,i),[eu.CHANGE]);if(i.isDirectory())return this.updateIno(t,eu.UNLINK,n),this.updateIno(t,eu.ADD_DIR,i),[eu.UNLINK,eu.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,eu.UNLINK_DIR,n),this.updateIno(t,eu.ADD,i),[eu.UNLINK_DIR,eu.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,eu.UNLINK_DIR,n),this.updateIno(t,eu.ADD_DIR,i),[eu.UNLINK_DIR,eu.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=n.isFile()?zX.FILE:zX.DIR;i[t]=[n.ino,o]}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)}}},yVi=AVi;var bVi=class e extends EZa.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(LT.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on(LT.CLOSE,i)),this._readyWait=new Promise(i=>this.on(LT.READY,i)),this._locker=new yZa(this),this._roots=new Set,this._poller=new yVi,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&&(pl.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(LT.CLOSE))}error(t){if(this.isClosed())return!1;let r=pl.lang.castError(t);return this.emit(LT.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit(LT.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(LT.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&pl.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&pl.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 o of[...i])r&&o.filePath!==r||this.watcherClose(o);if(n)for(let o in this._watchers)pl.fs.isSubPath(t,o)&&this.watchersClose(o,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 o=new AZa(this,t,r);return await o.init(),o}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let o=r.indexOf(t);r.splice(o,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=pl.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(a=>a.handler===n&&(!a.filePath||a.filePath===i)&&a.options.ignore===r.ignore&&!!a.options.native==!!r.native&&(!r.recursive||a.options.recursive)))return!0;let s=XDe.default.dirname(t);for(let a=1;a<1/0;a++){if(this._watchers[s]?.find(l=>(a===1||l.options.recursive&&a<=(l.options.depth??kve))&&l.handler===n&&(!l.filePath||l.filePath===i)&&l.options.ignore===r.ignore&&!!l.options.native==!!r.native&&(!r.recursive||l.options.recursive&&Qve&&l.options.native!==!1)))return!0;if(!Qve)break;let c=XDe.default.dirname(t);if(s===c)break;s=c}return!1}async watchDirectories(t,r,n,i,o){if(this.isClosed())return;t=pl.lang.uniq(t).sort();let s;for(let a of t)if(!this.isIgnored(a,r.ignore)&&!this.watcherExists(a,r,n,i))try{let u=!r.recursive||Qve&&r.native!==!1?r:{...r,recursive:!1},l={watcher:cvn.default.watch(a,u),handler:n,options:r,folderPath:a,filePath:i},p=s=await this.watcherAdd(l,o);if(this._roots.has(i||a)){let f={...r,ignoreInitial:!0,recursive:!1},m=XDe.default.dirname(a),h=a;await this.watchDirectories([m],f,n,h,p)}}catch(u){this.error(u)}return s}async watchDirectory(t,r,n,i,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||Qve&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,o));{r={...r,recursive:!0};let s=r.depth??kve,a=r.limit??_Bt,[u]=await pl.fs.readdir(t,r.ignore,s,a,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let c=await this.watchDirectories([t],r,n,i,o);if(u.length){let l=pl.fs.getDepth(t);for(let p of u){let d=pl.fs.getDepth(p),f=Math.max(0,s-(d-l)),m={...r,depth:f};await this.watchDirectories([p],m,n,i,o||c)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},o=(c,l)=>{l===t&&(u(),n())},s=new e(o),a=()=>{this._subwatchers.add(i),this.on(LT.CLOSE,u),s.watchFile(t,r,o)},u=()=>{this._subwatchers.delete(i),this.removeListener(LT.CLOSE,u),s.close()};return a()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=XDe.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,o=new yVi,s=await this.watchPolling(t,r,async()=>{i||!(await o.update(t,r.pollingTimeout)).length||i||(i=!0,s(),n())})}async watchPolling(t,r,n){if(this.isClosed())return pl.lang.noop;if(this.pollerExists(t,r))return pl.lang.noop;let i={...r,interval:r.pollingInterval??oZa},o={targetPath:t,options:r},s=()=>{this._pollers.add(o),this.on(LT.CLOSE,a),cvn.default.watchFile(t,i,n)},a=()=>{this._pollers.delete(o),this.removeListener(LT.CLOSE,a),cvn.default.unwatchFile(t,n)};return pl.lang.attempt(s),()=>pl.lang.attempt(a)}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=pl.lang.uniq(t).sort(),t.every((o,s)=>t.every((a,u)=>u===s||!pl.fs.isSubPath(o,a))))await Promise.all(t.map(o=>this.watchPath(o,r,n)));else for(let o of t)await this.watchPath(o,r,n)}async watchPath(t,r,n){if(this.isClosed()||(t=XDe.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await pl.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 o=XDe.default.dirname(t);return(await pl.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=pl.lang.noop){if(pl.lang.isFunction(t))return this.watch([],{},t);if(pl.lang.isUndefined(t))return this.watch([],r,n);if(pl.lang.isFunction(r))return this.watch(t,{},r);if(pl.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=pl.lang.castArray(t);i.forEach(o=>this._roots.add(o)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==pl.lang.noop&&this.on(LT.ALL,n),r.readdirMap=void 0,this.ready())}},lvn=bVi;Cvn();qt();var nnt=require("fs/promises"),_eu=require("os"),Seu=xe(require("path"),1),nad=".fern",iad="logs";function oad(){return"cli@4.39.0"}var iRe=class{logFilePath=null;initialized=!1;sessionStartTime;constructor(){this.sessionStartTime=Date.now()}async initialize(){if(this.initialized)return;let t=We(Ut.of((0,_eu.homedir)()),_e.of(nad)),r=We(t,_e.of(iad));await Zt(r)||await(0,nnt.mkdir)(r,{recursive:!0});let i=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=We(r,_e.of(i));let o=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${Seu.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
2168
+ `)}if(s)throw Jr.exit();if(o.warningCount>0){t.stderr.info(`${fo.warning} ${Ee.yellow(`Found ${o.warningCount} warnings`)}`),t.stderr.info(Ee.dim(" Run 'fern docs check --strict' to treat warnings as errors"));return}t.stderr.info(`${fo.success} ${Ee.green("All checks passed")}`)}buildJsonResponse({result:t,hasErrors:r}){let n={};return t.violations.length>0&&(n.docs=t.violations.map(i=>bK(i))),{success:!r,results:n}}};function M8i(e){let t=new j8i;Ia(e,"check","Validate docs configuration",(r,n)=>t.handle(r,n),r=>r.option("strict",{type:"boolean",description:"Treat warnings as errors",default:!1}).option("json",{type:"boolean",description:"Output results as JSON to stdout",default:!1}))}var vHa=xe(require("net"),1),IHa=xe(require("os"),1),yEn=class extends Error{constructor(t){super(`${t} is locked`)}},Rrt={old:new Set,young:new Set},fXf=1e3*15;var tBt,dXf=()=>{let e=IHa.default.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},bHa=e=>new Promise((t,r)=>{let n=vHa.default.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),EHa=async(e,t)=>{if(e.host||e.port===0)return bHa(e);for(let r of t)try{await bHa({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},mXf=function*(e){e&&(yield*e),yield 0};async function Bve(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let i=e.exclude;if(typeof i[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let o of i){if(typeof o!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(o))throw new TypeError(`Number ${o} in the exclude option is not a safe integer and can't be used`)}r=new Set(i)}tBt===void 0&&(tBt=setTimeout(()=>{tBt=void 0,Rrt.old=Rrt.young,Rrt.young=new Set},fXf),tBt.unref&&tBt.unref());let n=dXf();for(let i of mXf(t))try{if(r.has(i))continue;let o=await EHa({...e,port:i},n);for(;Rrt.old.has(o)||Rrt.young.has(o);){if(i!==0)throw new yEn(i);o=await EHa({...e,port:i},n)}return Rrt.young.add(o),o}catch(o){if(!["EADDRINUSE","EACCES"].includes(o.code)&&!(o instanceof yEn))throw o}throw new Error("No available ports found")}St();ng();qt();var Msu=xe(z8i(),1),Lsu=xe(ivn(),1),zIn=require("fs/promises"),Usu=xe(require("http"),1),zsu=xe(require("path"),1);var EZa=require("events"),cvn=xe(require("fs"),1),XDe=xe(require("path"),1);var rZa=xe(require("os"),1),nZa=300,kve=20,_Bt=1e7,iZa=rZa.default.platform();var Ood=iZa==="darwin",aVi=iZa==="win32",Qve=Ood||aVi,oZa=3e3,sZa=2e4,uVi=1250;var zX;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(zX||(zX={}));var YDe;(function(e){e.CHANGE="change",e.RENAME="rename"})(YDe||(YDe={}));var SBt;(function(e){e.CHANGE="change",e.ERROR="error"})(SBt||(SBt={}));var eu;(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"})(eu||(eu={}));var LT;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(LT||(LT={}));var Pod=(e,t=1,r)=>{t=Math.max(1,t);let n=r?.leading??!1,i=r?.trailing??!0,o=Math.max(r?.maxWait??1/0,t),s,a,u=0,c=0,l=()=>{let E=Date.now(),I=E-u,w=E-c,x=I>=t||w>=o;return[E,x]},p=E=>{if(c=E,!s)return;let I=s;s=void 0,e.apply(void 0,I)},d=()=>{b(0)},f=()=>{a&&(d(),p(Date.now()))},m=E=>{if(c=E,n)return p(E)},h=E=>{if(i&&s)return p(E);s=void 0},g=()=>{a=void 0;let[E,I]=l();return I?h(E):A(E)},A=E=>{let I=E-u,w=E-c,x=t-I,C=o-w,_=Math.min(x,C);return b(_)},b=E=>{a&&clearTimeout(a),!(E<=0)&&(a=setTimeout(g,E))},v=(...E)=>{let[I,w]=l(),x=!!a;if(s=E,u=I,(w||!a)&&b(t),w)return x?p(I):m(I)};return v.cancel=d,v.flush=f,v},ovn=Pod;var fVi=xe(require("fs"),1),avn=xe(require("path"),1);var wf=xe(require("fs"),1),x1=require("util");var wae=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},VX=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var cVi=xe(require("process"),1),aZa=cVi.default.getuid?!cVi.default.getuid():!1,uZa=1e4,Dk=()=>{};var BBt={isChangeErrorOk:e=>{if(!BBt.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!aZa&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!BBt.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(!BBt.isNodeError(e))throw e;if(!BBt.isChangeErrorOk(e))throw e}},OE=BBt;var lVi=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=uZa,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()}}}}},cZa=new lVi;var Cae=(e,t)=>function(n){return function i(...o){return cZa.schedule().then(s=>{let a=c=>(s(),c),u=c=>{if(s(),Date.now()>=n)throw c;if(t(c)){let l=Math.round(100*Math.random());return new Promise(d=>setTimeout(d,l)).then(()=>i.apply(void 0,o))}throw c};return e.apply(void 0,o).then(a,u)})}},xae=(e,t)=>function(n){return function i(...o){try{return e.apply(void 0,o)}catch(s){if(Date.now()>n)throw s;if(t(s))return i.apply(void 0,o);throw s}}};var Tod={attempt:{chmod:wae((0,x1.promisify)(wf.default.chmod),OE.onChangeError),chown:wae((0,x1.promisify)(wf.default.chown),OE.onChangeError),close:wae((0,x1.promisify)(wf.default.close),Dk),fsync:wae((0,x1.promisify)(wf.default.fsync),Dk),mkdir:wae((0,x1.promisify)(wf.default.mkdir),Dk),realpath:wae((0,x1.promisify)(wf.default.realpath),Dk),stat:wae((0,x1.promisify)(wf.default.stat),Dk),unlink:wae((0,x1.promisify)(wf.default.unlink),Dk),chmodSync:VX(wf.default.chmodSync,OE.onChangeError),chownSync:VX(wf.default.chownSync,OE.onChangeError),closeSync:VX(wf.default.closeSync,Dk),existsSync:VX(wf.default.existsSync,Dk),fsyncSync:VX(wf.default.fsync,Dk),mkdirSync:VX(wf.default.mkdirSync,Dk),realpathSync:VX(wf.default.realpathSync,Dk),statSync:VX(wf.default.statSync,Dk),unlinkSync:VX(wf.default.unlinkSync,Dk)},retry:{close:Cae((0,x1.promisify)(wf.default.close),OE.isRetriableError),fsync:Cae((0,x1.promisify)(wf.default.fsync),OE.isRetriableError),open:Cae((0,x1.promisify)(wf.default.open),OE.isRetriableError),readFile:Cae((0,x1.promisify)(wf.default.readFile),OE.isRetriableError),rename:Cae((0,x1.promisify)(wf.default.rename),OE.isRetriableError),stat:Cae((0,x1.promisify)(wf.default.stat),OE.isRetriableError),write:Cae((0,x1.promisify)(wf.default.write),OE.isRetriableError),writeFile:Cae((0,x1.promisify)(wf.default.writeFile),OE.isRetriableError),closeSync:xae(wf.default.closeSync,OE.isRetriableError),fsyncSync:xae(wf.default.fsyncSync,OE.isRetriableError),openSync:xae(wf.default.openSync,OE.isRetriableError),readFileSync:xae(wf.default.readFileSync,OE.isRetriableError),renameSync:xae(wf.default.renameSync,OE.isRetriableError),statSync:xae(wf.default.statSync,OE.isRetriableError),writeSync:xae(wf.default.writeSync,OE.isRetriableError),writeFileSync:xae(wf.default.writeFileSync,OE.isRetriableError)}},lZa=Tod;var svn=xe(require("fs"),1),OBt=xe(require("path"),1);var pVi=()=>{};var Dod=()=>{let e=pVi,t=pVi,r=!1,n=!1;return{promise:new Promise((u,c)=>{e=l=>(r=!0,u(l)),t=l=>(n=!0,c(l))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},pZa=Dod;var Rod=()=>{let{promise:e,resolve:t,isPending:r}=pZa(),n=0,i=()=>{n+=1},o=()=>{n-=1,!n&&t()};return i(),queueMicrotask(o),{promise:e,isPending:r,increment:i,decrement:o}},fZa=Rod;var dZa={then:e=>{e()}};var mZa=e=>Array.isArray(e)?e:[e],hZa=e=>typeof e=="function";var Fod=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,o=t?.ignore??[],s=mZa(o).map(K=>hZa(K)?K:Y=>K.test(Y)),a=K=>s.some(Y=>Y(K)),u=t?.signal??{aborted:!1},c=t?.onDirents||(()=>{}),l=[],p=new Set,d={},f=[],m=new Set,h={},g=[],A=new Set,b={},v={},E=new Set,I={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},w={directories:l,directoriesNames:p,directoriesNamesToPaths:d,files:f,filesNames:m,filesNamesToPaths:h,symlinks:g,symlinksNames:A,symlinksNamesToPaths:b,map:v},{promise:x,increment:C,decrement:_}=fZa(),R=0,U=(K,Y,ge,he)=>{E.has(Y)||R>=i||(R+=1,K.directories.push(Y),K.directoriesNames.add(ge),l.push(Y),p.add(ge),d.propertyIsEnumerable(ge)||(d[ge]=[]),d[ge].push(Y),E.add(Y),!(he>=n)&&(R>=i||H(Y,he+1)))},q=(K,Y,ge)=>{E.has(Y)||R>=i||(R+=1,K.files.push(Y),K.filesNames.add(ge),f.push(Y),m.add(ge),h.propertyIsEnumerable(ge)||(h[ge]=[]),h[ge].push(Y),E.add(Y))},z=(K,Y,ge,he)=>{E.has(Y)||R>=i||(R+=1,K.symlinks.push(Y),K.symlinksNames.add(ge),g.push(Y),A.add(ge),b.propertyIsEnumerable(ge)||(b[ge]=[]),b[ge].push(Y),E.add(Y),r&&(he>=n||R>=i||ye(Y,he+1)))},J=(K,Y,ge,he,Ce)=>{u.aborted||a(Y)||(he.isDirectory()?U(K,Y,ge,Ce):he.isFile()?q(K,Y,ge):he.isSymbolicLink()&&z(K,Y,ge,Ce))},ie=(K,Y,ge,he)=>{if(u.aborted)return;let Ce=Y===OBt.default.sep?"":OBt.default.sep,Se=ge.name,ae=`${Y}${Ce}${Se}`;a(ae)||(ge.isDirectory()?U(K,ae,Se,he):ge.isFile()?q(K,ae,Se):ge.isSymbolicLink()&&z(K,ae,Se,he))},V=(K,Y,ge,he)=>{for(let Ce=0,Se=ge.length;Ce<Se;Ce++)ie(K,Y,ge[Ce],he)},H=(K,Y)=>{u.aborted||Y>n||R>=i||(C(),svn.default.readdir(K,{withFileTypes:!0},(ge,he)=>{if(ge||u.aborted||!he.length)return _();(c(he)||dZa).then(()=>{let Se=v[K]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};V(Se,K,he,Y),_()})}))},ye=(K,Y)=>{C(),svn.default.realpath(K,(ge,he)=>{if(ge||u.aborted)return _();svn.default.stat(he,(Ce,Se)=>{if(Ce||u.aborted)return _();let ae=OBt.default.basename(he),ce=v[K]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};J(ce,he,ae,Se,Y),_()})})};return(async(K,Y=1)=>(K=OBt.default.normalize(K),E.add(K),H(K,Y),await x,u.aborted?I:w))(e)},gZa=Fod;var qX={lang:{debounce:ovn,attempt:e=>{try{return e()}catch(t){return qX.lang.castError(t)}},castArray:e=>qX.lang.isArray(e)?e:[e],castError:e=>qX.lang.isError(e)?e:qX.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(qX.lang.isNaN(e))return qX.lang.isNaN(t);if(qX.lang.isPrimitive(e)||qX.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(avn.default.sep).length-1),getRealPath:(e,t)=>{try{return t?fVi.default.realpathSync.native(e):fVi.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===avn.default.sep&&t.length-e.length>avn.default.sep.length,poll:(e,t=sZa)=>lZa.retry.stat(t)(e,{bigint:!0}).catch(qX.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,o)=>{if(o&&r===1&&e in o){let s=o[e];return[s.directories,s.files]}else{let s=await gZa(e,{depth:r,limit:n,ignore:t,signal:i});return[s.directories,s.files]}}}},pl=qX;var uvn=xe(require("path"),1);var dVi=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||pl.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=nZa){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,o=async(a,u)=>{let c=this.options.ignoreInitial?[]:a,l=await this.eventsPopulate([...u]),p=this.eventsDeduplicate([...c,...l]);this.onTargetEvents(p)},s=pl.lang.debounce(()=>{this.watcher.isClosed()||(r=o(n,i),n=[],i=new Set)},t);return async(a,u="",c=!1)=>{c?await this.eventsPopulate([u],n,!0):i.add(u),r.then(s)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[o,s]=i,a=r[s];return o===a||o===eu.CHANGE&&a===eu.ADD||(r[s]=o,n.push(i)),n},[])}async eventsPopulate(t,r=[],n=!1){return await Promise.all(t.map(async i=>{let o=await this.watcher._poller.update(i,this.options.pollingTimeout);await Promise.all(o.map(async s=>{r.push([s,i]),s===eu.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):s===eu.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,i,r,n)}))})),r}async eventsPopulateAddDir(t,r,n=[],i=!1){if(i)return n;let o=this.options.recursive?this.options.depth??kve:Math.min(1,this.options.depth??kve),s=this.options.limit??_Bt,[a,u]=await pl.fs.readdir(r,this.options.ignore,o,s,this.watcher._closeSignal),c=[...a,...u];return await Promise.all(c.map(l=>{if(!this.watcher.isIgnored(l,this.options.ignore)&&!t.includes(l))return this.eventsPopulate([l],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let o of this.watcher._poller.stats.keys())pl.fs.isSubPath(r,o)&&(t.includes(o)||await this.eventsPopulate([o],n,!0));return n}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(eu.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!Qve&&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(eu.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(eu.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(uvn.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(eu.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(uvn.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(eu.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===eu.ADD?this.onTargetAdd(n):r===eu.ADD_DIR?this.onTargetAddDir(n):r===eu.CHANGE?this.onTargetChange(n):r===eu.UNLINK?this.onTargetUnlink(n):r===eu.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=YDe.CHANGE,r){if(this.watcher.isClosed())return;let n=uvn.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){aVi&&t.code==="EPERM"?this.onWatcherChange(YDe.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(SBt.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(SBt.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(YDe.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&Qve&&this.options.native!==!1?this.options.depth??kve:Math.min(1,this.options.depth??kve),n=this.options.limit??_Bt,[i,o]=await pl.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),s=[this.folderPath,...i,...o];await Promise.all(s.map(a=>{if(!this.watcher._poller.stats.has(a)&&!this.watcher.isIgnored(a,this.options.ignore))return this.onWatcherEvent(YDe.CHANGE,a,t)}))}}},AZa=dVi;var UT={interval:100,intervalId:void 0,fns:new Map,init:()=>{UT.intervalId||(UT.intervalId=setInterval(UT.resolve,UT.interval))},reset:()=>{UT.intervalId&&(clearInterval(UT.intervalId),delete UT.intervalId)},add:(e,t)=>{UT.fns.set(e,Date.now()+t),UT.init()},remove:e=>{UT.fns.delete(e)},resolve:()=>{if(!UT.fns.size)return UT.reset();let e=Date.now();for(let[t,r]of UT.fns)r>=e||(UT.remove(t),t())}},PBt=UT;var TBt=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=uVi){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{let p=this._watcher._poller.paths.find(n||-1,d=>d!==i);if(p&&p!==i){if(pl.fs.getRealPath(i,!0)===p)return;this._watcher.event(o.rename,p,i)}else this._watcher.event(o.add,i)};if(!n)return a();let u=()=>{s.add.delete(n),PBt.remove(c)},c=()=>{u(),a()};PBt.add(c,r);let l=()=>{let p=s.unlink.get(n);if(!p)return;u();let d=p();i===d?o.change&&this._watcher._poller.stats.has(i)&&this._watcher.event(o.change,i):this._watcher.event(o.rename,d,i)};s.add.set(n,l),l()}getLockUnlink(t,r=uVi){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{this._watcher.event(o.unlink,i)};if(!n)return a();let u=()=>{s.unlink.delete(n),PBt.remove(c)},c=()=>{u(),a()};PBt.add(c,r);let l=()=>(u(),i);s.unlink.set(n,l),s.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,eu.ADD,zX.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,eu.ADD_DIR,zX.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,eu.UNLINK,zX.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,eu.UNLINK_DIR,zX.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}}};TBt.DIR_EVENTS={add:eu.ADD_DIR,rename:eu.RENAME_DIR,unlink:eu.UNLINK_DIR};TBt.FILE_EVENTS={add:eu.ADD,change:eu.CHANGE,rename:eu.RENAME,unlink:eu.UNLINK};var yZa=TBt;var mVi=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(pl.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(pl.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(pl.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(pl.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return pl.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);pl.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},hVi=mVi;var gVi=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}},bZa=gVi;var AVi=class{constructor(){this.inos={},this.paths=new hVi,this.stats=new Map}getIno(t,r,n){let i=this.inos[r];if(!i)return;let o=i[t];if(o&&!(n&&o[1]!==n))return o[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let n=await pl.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new bZa(n)}reset(){this.inos={},this.paths=new hVi,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,eu.ADD,i),[eu.ADD];if(i.isDirectory())return this.updateIno(t,eu.ADD_DIR,i),[eu.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,eu.UNLINK,n),[eu.UNLINK];if(n.isDirectory())return this.updateIno(t,eu.UNLINK_DIR,n),[eu.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,eu.CHANGE,i),[eu.CHANGE]);if(i.isDirectory())return this.updateIno(t,eu.UNLINK,n),this.updateIno(t,eu.ADD_DIR,i),[eu.UNLINK,eu.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,eu.UNLINK_DIR,n),this.updateIno(t,eu.ADD,i),[eu.UNLINK_DIR,eu.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,eu.UNLINK_DIR,n),this.updateIno(t,eu.ADD_DIR,i),[eu.UNLINK_DIR,eu.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=n.isFile()?zX.FILE:zX.DIR;i[t]=[n.ino,o]}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)}}},yVi=AVi;var bVi=class e extends EZa.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(LT.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on(LT.CLOSE,i)),this._readyWait=new Promise(i=>this.on(LT.READY,i)),this._locker=new yZa(this),this._roots=new Set,this._poller=new yVi,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&&(pl.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(LT.CLOSE))}error(t){if(this.isClosed())return!1;let r=pl.lang.castError(t);return this.emit(LT.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit(LT.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(LT.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&pl.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&pl.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 o of[...i])r&&o.filePath!==r||this.watcherClose(o);if(n)for(let o in this._watchers)pl.fs.isSubPath(t,o)&&this.watchersClose(o,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 o=new AZa(this,t,r);return await o.init(),o}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let o=r.indexOf(t);r.splice(o,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=pl.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(a=>a.handler===n&&(!a.filePath||a.filePath===i)&&a.options.ignore===r.ignore&&!!a.options.native==!!r.native&&(!r.recursive||a.options.recursive)))return!0;let s=XDe.default.dirname(t);for(let a=1;a<1/0;a++){if(this._watchers[s]?.find(l=>(a===1||l.options.recursive&&a<=(l.options.depth??kve))&&l.handler===n&&(!l.filePath||l.filePath===i)&&l.options.ignore===r.ignore&&!!l.options.native==!!r.native&&(!r.recursive||l.options.recursive&&Qve&&l.options.native!==!1)))return!0;if(!Qve)break;let c=XDe.default.dirname(t);if(s===c)break;s=c}return!1}async watchDirectories(t,r,n,i,o){if(this.isClosed())return;t=pl.lang.uniq(t).sort();let s;for(let a of t)if(!this.isIgnored(a,r.ignore)&&!this.watcherExists(a,r,n,i))try{let u=!r.recursive||Qve&&r.native!==!1?r:{...r,recursive:!1},l={watcher:cvn.default.watch(a,u),handler:n,options:r,folderPath:a,filePath:i},p=s=await this.watcherAdd(l,o);if(this._roots.has(i||a)){let f={...r,ignoreInitial:!0,recursive:!1},m=XDe.default.dirname(a),h=a;await this.watchDirectories([m],f,n,h,p)}}catch(u){this.error(u)}return s}async watchDirectory(t,r,n,i,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||Qve&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,o));{r={...r,recursive:!0};let s=r.depth??kve,a=r.limit??_Bt,[u]=await pl.fs.readdir(t,r.ignore,s,a,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let c=await this.watchDirectories([t],r,n,i,o);if(u.length){let l=pl.fs.getDepth(t);for(let p of u){let d=pl.fs.getDepth(p),f=Math.max(0,s-(d-l)),m={...r,depth:f};await this.watchDirectories([p],m,n,i,o||c)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},o=(c,l)=>{l===t&&(u(),n())},s=new e(o),a=()=>{this._subwatchers.add(i),this.on(LT.CLOSE,u),s.watchFile(t,r,o)},u=()=>{this._subwatchers.delete(i),this.removeListener(LT.CLOSE,u),s.close()};return a()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=XDe.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,o=new yVi,s=await this.watchPolling(t,r,async()=>{i||!(await o.update(t,r.pollingTimeout)).length||i||(i=!0,s(),n())})}async watchPolling(t,r,n){if(this.isClosed())return pl.lang.noop;if(this.pollerExists(t,r))return pl.lang.noop;let i={...r,interval:r.pollingInterval??oZa},o={targetPath:t,options:r},s=()=>{this._pollers.add(o),this.on(LT.CLOSE,a),cvn.default.watchFile(t,i,n)},a=()=>{this._pollers.delete(o),this.removeListener(LT.CLOSE,a),cvn.default.unwatchFile(t,n)};return pl.lang.attempt(s),()=>pl.lang.attempt(a)}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=pl.lang.uniq(t).sort(),t.every((o,s)=>t.every((a,u)=>u===s||!pl.fs.isSubPath(o,a))))await Promise.all(t.map(o=>this.watchPath(o,r,n)));else for(let o of t)await this.watchPath(o,r,n)}async watchPath(t,r,n){if(this.isClosed()||(t=XDe.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await pl.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 o=XDe.default.dirname(t);return(await pl.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=pl.lang.noop){if(pl.lang.isFunction(t))return this.watch([],{},t);if(pl.lang.isUndefined(t))return this.watch([],r,n);if(pl.lang.isFunction(r))return this.watch(t,{},r);if(pl.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=pl.lang.castArray(t);i.forEach(o=>this._roots.add(o)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==pl.lang.noop&&this.on(LT.ALL,n),r.readdirMap=void 0,this.ready())}},lvn=bVi;Cvn();qt();var nnt=require("fs/promises"),_eu=require("os"),Seu=xe(require("path"),1),nad=".fern",iad="logs";function oad(){return"cli@4.40.0"}var iRe=class{logFilePath=null;initialized=!1;sessionStartTime;constructor(){this.sessionStartTime=Date.now()}async initialize(){if(this.initialized)return;let t=We(Ut.of((0,_eu.homedir)()),_e.of(nad)),r=We(t,_e.of(iad));await Zt(r)||await(0,nnt.mkdir)(r,{recursive:!0});let i=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=We(r,_e.of(i));let o=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${Seu.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
2169
2169
  `);await(0,nnt.writeFile)(this.logFilePath,o,"utf-8"),this.initialized=!0}getLogFilePath(){return this.logFilePath}async writeEntry(t){if(!this.initialized||!this.logFilePath)return;let r=JSON.stringify(t)+`
2170
2170
  `;try{await(0,nnt.appendFile)(this.logFilePath,r,"utf-8")}catch{}}async logFrontendMetrics(t){let r={timestamp:t.timestamp,source:t.source,level:t.level,eventType:this.getEventType(t.payload,t.isAggregate),isAggregate:t.isAggregate,data:t.payload};await this.writeEntry(r)}async logCliMetric(t,r="info"){let n={timestamp:t.timestamp,source:oad(),level:r,eventType:t.type,data:{durationMs:t.durationMs,metadata:t.metadata}};await this.writeEntry(n)}async logCliMemory(){let t=process.memoryUsage(),r={type:"cli_memory",timestamp:new Date().toISOString(),metadata:{heapUsed:t.heapUsed,heapTotal:t.heapTotal,external:t.external,rss:t.rss,heapUsedMB:Math.round(t.heapUsed/1024/1024*100)/100,heapTotalMB:Math.round(t.heapTotal/1024/1024*100)/100,rssMB:Math.round(t.rss/1024/1024*100)/100}};await this.logCliMetric(r)}async logCliReloadStart(){let t={type:"cli_reload_start",timestamp:new Date().toISOString()};await this.logCliMetric(t)}async logCliReloadFinish(t,r){let n={type:"cli_reload_finish",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(n)}async logCliDocsGeneration(t,r){let n={type:"cli_docs_generation",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(n)}async logCliValidation(t,r){let n={type:"cli_validation",timestamp:new Date().toISOString(),durationMs:t,metadata:{success:r}};await this.logCliMetric(n)}getEventType(t,r){return r?"aggregate_summary":"type"in t&&typeof t.type=="string"?t.type:"unknown"}static isMetricsMessage(t){if(typeof t!="object"||t===null)return!1;let r=t;return r.type==="metrics"&&typeof r.timestamp=="string"&&typeof r.source=="string"}};var UVi={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"};function Beu(e){let t=sad();if(t==null)return;let{port:r,debugLogger:n,getDocsLoadResponse:i}=e,o=new Map;function s(u){let c=JSON.stringify(u),l=[];for(let[p]of o)try{p.send(c)}catch{l.push(p)}for(let p of l){let d=o.get(p);d&&(clearInterval(d.pingInterval),o.delete(p))}}let a=t.serve({port:r,fetch(u,c){if(u.method==="OPTIONS")return new Response(null,{status:204,headers:UVi});let l=new URL(u.url);if(u.headers.get("upgrade")?.toLowerCase()==="websocket"){c.upgrade(u,{data:{connectionId:`${Date.now()}`}});return}if(u.method==="POST"&&l.pathname==="/v2/registry/docs/load-with-url")return new Response(JSON.stringify(i()),{headers:{"Content-Type":"application/json",...UVi}});let p=/^\/_local\/(.*)/.exec(l.pathname);return u.method==="GET"&&p!=null?new Response(t.file(`/${p[1]}`),{headers:UVi}):new Response("Not Found",{status:404})},websocket:{open(u){let{connectionId:c}=u.data,l=setInterval(()=>{let p=o.get(u);if(!p)return;let d=Date.now();if(d-p.lastPong>9e4){u.close();return}try{u.send(JSON.stringify({type:"ping",timestamp:d}))}catch{u.close()}},3e4);o.set(u,{pingInterval:l,lastPong:Date.now()});try{u.send(JSON.stringify({type:"connected",connectionId:c}))}catch{}},message(u,c){try{let l=JSON.parse(c.toString());if(l.type==="pong"){let p=o.get(u);p&&(p.lastPong=Date.now())}else iRe.isMetricsMessage(l)&&n.logFrontendMetrics(l)}catch{}},close(u){let c=o.get(u);c&&(clearInterval(c.pingInterval),o.delete(u))}}});return{sendData:s,stop:u=>a.stop(u)}}function sad(){return globalThis.Bun}qt();var v9i=xe(JVi(),1),Tsu=xe(c9i(),1),Rk=require("fs/promises"),Dsu=require("os"),Rsu=xe(Cw(),1),Fsu=xe(Osu(),1),QIn=process.platform==="win32",E9i=Ee.cyan("[docs]:"),Qpd="etag",Npd=23,Psu=e=>e.padEnd(Npd," "),jpd="preview",Mpd="app-preview",Lpd="bundle",Upd=".next",zpd="standalone",Vpd=".fern",qpd="packages/fern-docs/bundle/.next/server/instrumentation.js",Gpd=".npmrc",Wpd=".pnpmfile.cjs",$pd="pnpm-workspace.yaml",Hpd='Cannot find matching keyid: {"signatures":';function Kpd(){return We(Ut.of((0,Dsu.homedir)()),_e.of(Vpd))}function vnt({app:e=!1}){return We(Kpd(),_e.of(e?Mpd:jpd))}function $ve({app:e=!1}){return We(vnt({app:e}),_e.of(e?Upd:Lpd))}function lOt({app:e=!1}){return We($ve({app:e}),_e.of(zpd))}function Jpd({app:e=!1}){return We(lOt({app:e}),_e.of(qpd))}function Ypd({app:e=!1}){return We(lOt({app:e}),_e.of($pd))}function Xpd({app:e=!1}){return We(lOt({app:e}),_e.of(Wpd))}function Zpd({app:e=!1}){return We(lOt({app:e}),_e.of(Gpd))}function dRe(e){return new Error(`${e}. Please reach out to support@buildwithfern.com.`)}function efd({app:e=!1}){return We(vnt({app:e}),_e.of(Qpd))}var tfd=`module.exports = {
2171
2171
  hooks: {
@@ -2206,7 +2206,7 @@ Please ensure you have membership at https://dashboard.buildwithfern.com, and as
2206
2206
 
2207
2207
  Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`);case"UnavailableError":return t.failAndThrow("Failed to publish docs. Please try again later or reach out to Fern support at support@buildwithfern.com.");default:return t.failAndThrow("Failed to publish docs.",e)}}function $md(e,t){let n=e?.content;if(n?.reason==="status-code"){let i=n.statusCode;if(i===401||i===403)return`${`You do not have permission to publish docs to organization '${t}'. Please run 'fern login' to ensure you are logged in with the correct account.`}
2208
2208
 
2209
- Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`}}function Hmd(e){try{return new URL(RT(e)).pathname}catch{return}}async function Kmd({fdr:e,workspace:t,organization:r,context:n,snippetsConfig:i}){if(!t)return;let o=await Jmd({fdr:e,workspace:t,snippetsConfig:i,context:n});if(Object.keys(o).length===0){n.logger.debug("[SDK Dynamic IR] No snippet configs found, skipping S3 check");return}try{let s=await e.api.v1.register.checkSdkDynamicIrExists({orgId:_r.OrgId(r),snippetConfiguration:o});if(!s.ok||!s.body){n.logger.debug("[SDK Dynamic IR] API call failed or returned empty body");return}let a=s.body.existingDynamicIrs;if(Object.keys(a).length===0){n.logger.debug("[SDK Dynamic IR] No existing SDK dynamic IRs found in S3");return}let u={};for(let[c,l]of Object.entries(a))try{n.logger.debug(`Downloading existing SDK dynamic IR for ${c}...`);let p=await fetch(l.downloadUrl);if(p.ok){let d=await p.json();u[c]={dynamicIR:d},n.logger.debug(`Successfully downloaded SDK dynamic IR for ${c}`)}else n.logger.warn(`Failed to download SDK dynamic IR for ${c}: ${p.status}`)}catch(p){n.logger.warn(`Error downloading SDK dynamic IR for ${c}: ${p}`)}return Object.keys(u).length>0?u:void 0}catch(s){n.logger.debug(`Error checking for existing SDK dynamic IRs: ${s}`);return}}function Euu(e){return e.replace(/^https:\/\//,"")}async function Jmd({fdr:e,workspace:t,snippetsConfig:r,context:n}){let i={},o=[{language:"typescript",snippetName:r.typescriptSdk?.package,explicitVersion:r.typescriptSdk?.version},{language:"python",snippetName:r.pythonSdk?.package,explicitVersion:r.pythonSdk?.version},{language:"java",snippetName:r.javaSdk?.coordinate,explicitVersion:r.javaSdk?.version},{language:"go",snippetName:r.goSdk?.githubRepo&&Euu(r.goSdk?.githubRepo),explicitVersion:r.goSdk?.version},{language:"csharp",snippetName:r.csharpSdk?.package,explicitVersion:r.csharpSdk?.version},{language:"ruby",snippetName:r.rubySdk?.gem,explicitVersion:r.rubySdk?.version},{language:"php",snippetName:r.phpSdk?.package,explicitVersion:r.phpSdk?.version},{language:"swift",snippetName:r.swiftSdk?.package,explicitVersion:r.swiftSdk?.version},{language:"rust",snippetName:r.rustSdk?.package,explicitVersion:r.rustSdk?.version}];for(let s of o){if(!s.snippetName)continue;let a=s.explicitVersion;a||(a=(await Ymd({fdr:e,workspace:t,language:s.language,snippetName:s.snippetName,context:n}))?.version),i[s.language]={packageName:s.snippetName,version:a},a||n.logger.debug(`[SDK Dynamic IR] ${s.language}: no version specified, will use latest`)}return i}async function Ymd({fdr:e,workspace:t,language:r,snippetName:n,context:i}){let o;switch(r){case"csharp":o="Csharp";break;case"go":o="Go";break;case"java":o="Java";break;case"python":o="Python";break;case"ruby":o="Ruby";break;case"typescript":o="TypeScript";break;case"php":o="Php";break;case"swift":o="Swift";break;default:return}let s,a,u;if(t.generatorsConfiguration?.groups){let c=[];for(let l of t.generatorsConfiguration.groups)for(let p of l.generators)if(p.language===r){let d=bn.getPackageName({generatorInvocation:p});d&&c.push(d),!a&&d&&(a=d,u=p.name,p.outputMode.type==="githubV2"&&(s=`${p.outputMode.githubV2.owner}/${p.outputMode.githubV2.repo}`))}}if(!a){i.logger.debug(`[SDK Dynamic IR] ${r}: no generator found with a package name`);return}try{let c=await e.sdks.versions.computeSemanticVersion({githubRepository:s,language:o,package:a});if(!c.ok){i.logger.debug(`[SDK Dynamic IR] ${r}: version computation failed for package "${a}"`);return}return i.logger.debug(`[SDK Dynamic IR] ${r}: computed version ${c.body.version} for package "${a}"`),{version:c.body.version,generatorPackage:a}}catch(c){i.logger.debug(`[SDK Dynamic IR] ${r}: error computing version: ${c}`);return}}async function Xmd({workspace:e,organization:t,context:r,snippetsConfig:n,skipLanguages:i=new Set}){let o={};if(!e)return;let s={typescript:n.typescriptSdk?.package,python:n.pythonSdk?.package,java:n.javaSdk?.coordinate,go:n.goSdk?.githubRepo&&Euu(n.goSdk?.githubRepo),csharp:n.csharpSdk?.package,ruby:n.rubySdk?.gem,php:n.phpSdk?.package,swift:n.swiftSdk?.package,rust:n.rustSdk?.package};if(e.generatorsConfiguration?.groups)for(let a of e.generatorsConfiguration.groups)for(let u of a.generators){let c=mRe({apiName:e.workspaceName??"",organization:t,generatorInvocation:u}),l="";if(c?.outputConfig.type==="publish")switch(c.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":l=c.outputConfig.value.packageName;break;case"maven":l=c.outputConfig.value.coordinate;break;case"go":l=c.outputConfig.value.repoUrl;break;case"swift":l=c.outputConfig.value.repoUrl;break;case"crates":l=c.outputConfig.value.packageName;break}if(u.language==="php"&&u.config&&typeof u.config=="object"&&"packageName"in u.config&&(l=u.config.packageName??""),!!u.language){if(i.has(u.language)){r.logger.debug(`Skipping dynamic IR generation for ${u.language} (using existing SDK dynamic IR)`);continue}if(u.language&&s[u.language]===l){let p=eh({workspace:e,generationLanguage:u.language,keywords:void 0,smartCasing:u.smartCasing,exampleGeneration:{disabled:!0,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},audiences:{type:"all"},readme:void 0,packageName:l,version:void 0,context:r,sourceResolver:new rm(r,e),dynamicGeneratorConfig:c}),d=oOe({ir:p,disableExamples:!0,smartCasing:u.smartCasing,generationLanguage:u.language,generatorConfig:c});d?o[u.language]={dynamicIR:d}:r.logger.debug(`Failed to create dynamic IR for ${u.language}`)}}}for(let[a,u]of Object.entries(s))a&&u&&!Object.keys(o).includes(a)&&!i.has(a)&&(r.logger.warn(),r.logger.warn(`Failed to upload ${a} SDK snippets because of unknown package \`${u}\`.`),r.logger.warn(`Please make sure your ${e.workspaceName?`${e.workspaceName}/`:""}generators.yml has a generator that publishes a ${u} package.`),r.logger.warn());if(Object.keys(o).length>0)return o}async function Zmd({dynamicIRs:e,dynamicIRUploadUrls:t,context:r,apiId:n}){if(Object.keys(t).length>0)for(let[i,o]of Object.entries(t)){let s=e[i]?.dynamicIR;if(s){let a=JSON.stringify(s);(await fetch(o.uploadUrl,{method:"PUT",body:a,headers:{"Content-Type":"application/octet-stream","Content-Length":Buffer.byteLength(a,"utf8").toString()}})).ok?r.logger.debug(`Uploaded dynamic IR for ${n}:${i}`):r.logger.warn(`Failed to upload dynamic IR for ${n}:${i}`)}else r.logger.warn(`Could not find matching dynamic IR to upload for ${n}:${i}`)}}async function ehd({docsDefinition:e,isPreview:t,context:r}){e.config.aiChatConfig==null||t||r.logger.warn(Ee.yellow("Enabling Ask Fern from docs.yml is deprecated. Please enable it from the Fern dashboard instead."))}function thd(e,t){if(e)return{enabled:!0,model:process.env.FERN_AI_MODEL||"gpt-4o-mini",maxRetries:parseInt(process.env.FERN_AI_MAX_RETRIES||"3"),requestTimeoutMs:parseInt(process.env.FERN_AI_TIMEOUT_MS||"25000"),styleInstructions:t}}function rhd(e){let t=e,r=t?.content;return{errorType:t?.error,statusCode:t?.statusCode??r?.statusCode,reason:r?.reason,errorMessage:r?.errorMessage??r?.message,body:r?.body,cause:r?.cause,rawError:e}}var yOt=[60*1e3,300*1e3,300*1e3];async function bOt({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:o,instanceUrl:s,preview:a,previewId:u,disableTemplates:c,skipUpload:l,cliVersion:p,ciSource:d}){let f=a&&!n.config.settings?.substituteEnvVars;n.config=uy(n.config,{onError:b=>i.failAndThrow(b)},{substituteAsEmpty:f});let m=n.config.instances;if(m.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.");return}if(m.length>1&&s==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${m[0]?.url})`);return}let h=m.find(b=>b.url===s)??m[0];if(h==null){i.failAndThrow(`No docs instance with url ${s}. Failed to register.`);return}let g=[];h.customDomain!=null&&(typeof h.customDomain=="string"?g.push(h.customDomain):Array.isArray(h.customDomain)&&g.push(...h.customDomain)),i.logger.info(`Starting docs publishing for ${a?"preview":"production"}: ${h.url}`),i.logger.debug(`Organization: ${e}, Preview: ${a}, APIs: ${t.length}, OSS: ${r.length}`);let A;return await i.runInteractiveTask({name:h.url},async()=>{let b=performance.now(),v=()=>buu({docsWorkspace:n,customDomains:g,domain:h.url,token:o,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:a,previewId:u,editThisPage:h.editThisPage,isPrivate:h.private,disableTemplates:c,skipUpload:l,withAiExamples:n.config.aiExamples?.enabled??n.config.experimental?.aiExamples??!0,excludeApis:n.config.experimental?.excludeApis??!1,targetAudiences:h.audiences?Array.isArray(h.audiences)?h.audiences:[h.audiences]:void 0,docsUrl:h.url,cliVersion:p,ciSource:d});for(let I=0;;I++)try{A=await v();break}catch(w){if(!(w instanceof xnt)||I>=yOt.length){if(w instanceof xnt)return i.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.");throw w}let x=yOt[I]??yOt[yOt.length-1]??6e4,C=x/6e4;i.logger.warn(`Another docs publish is in progress. Retrying in ${C} minute${C===1?"":"s"} (attempt ${I+1}/${yOt.length})...`),await new Promise(_=>setTimeout(_,x))}let E=performance.now()-b;i.logger.debug(`Docs publishing completed in ${E.toFixed(0)}ms`)}),A}var Dwn=class{context;task;project;docsWorkspace;ossWorkspaces;token;constructor({context:t,task:r,project:n,docsWorkspace:i,ossWorkspaces:o,token:s}){this.context=t,this.task=r,this.project=n,this.docsWorkspace=i,this.ossWorkspaces=o,this.token=s}async publish({instanceUrl:t,preview:r,skipUpload:n}){let i=new oh({context:this.context,task:this.task});try{let o=await bOt({organization:this.project.config.organization,apiWorkspaces:this.project.apiWorkspaces,ossWorkspaces:this.ossWorkspaces,docsWorkspace:this.docsWorkspace,context:i,token:this.token,instanceUrl:t,preview:r,previewId:void 0,disableTemplates:void 0,skipUpload:n,cliVersion:"4.39.0"});return i.getResult()===Tp.Failure?{success:!1}:{success:!0,url:o}}catch(o){return{success:!1,error:xi(o)}}}};St();var _nt=class e{static MAX_DISPLAYED_LOGS_TTY=10;static URL_PATTERN=/https?:\/\/[^\s]+/;context;stream;tasks={};taskOrder=[];startTime;isRegistered=!1;constructor(t){this.context=t.context,this.stream=t.stream??process.stderr}addTask(t){let r={...t,status:t.status??"pending"};return this.tasks[t.id]=r,this.taskOrder.push(t.id),this}async start(t){return this.startTime=Date.now(),t!=null&&await this.context.ttyAwareLogger.takeOverTerminal(()=>{this.stream.write(`
2209
+ Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`}}function Hmd(e){try{return new URL(RT(e)).pathname}catch{return}}async function Kmd({fdr:e,workspace:t,organization:r,context:n,snippetsConfig:i}){if(!t)return;let o=await Jmd({fdr:e,workspace:t,snippetsConfig:i,context:n});if(Object.keys(o).length===0){n.logger.debug("[SDK Dynamic IR] No snippet configs found, skipping S3 check");return}try{let s=await e.api.v1.register.checkSdkDynamicIrExists({orgId:_r.OrgId(r),snippetConfiguration:o});if(!s.ok||!s.body){n.logger.debug("[SDK Dynamic IR] API call failed or returned empty body");return}let a=s.body.existingDynamicIrs;if(Object.keys(a).length===0){n.logger.debug("[SDK Dynamic IR] No existing SDK dynamic IRs found in S3");return}let u={};for(let[c,l]of Object.entries(a))try{n.logger.debug(`Downloading existing SDK dynamic IR for ${c}...`);let p=await fetch(l.downloadUrl);if(p.ok){let d=await p.json();u[c]={dynamicIR:d},n.logger.debug(`Successfully downloaded SDK dynamic IR for ${c}`)}else n.logger.warn(`Failed to download SDK dynamic IR for ${c}: ${p.status}`)}catch(p){n.logger.warn(`Error downloading SDK dynamic IR for ${c}: ${p}`)}return Object.keys(u).length>0?u:void 0}catch(s){n.logger.debug(`Error checking for existing SDK dynamic IRs: ${s}`);return}}function Euu(e){return e.replace(/^https:\/\//,"")}async function Jmd({fdr:e,workspace:t,snippetsConfig:r,context:n}){let i={},o=[{language:"typescript",snippetName:r.typescriptSdk?.package,explicitVersion:r.typescriptSdk?.version},{language:"python",snippetName:r.pythonSdk?.package,explicitVersion:r.pythonSdk?.version},{language:"java",snippetName:r.javaSdk?.coordinate,explicitVersion:r.javaSdk?.version},{language:"go",snippetName:r.goSdk?.githubRepo&&Euu(r.goSdk?.githubRepo),explicitVersion:r.goSdk?.version},{language:"csharp",snippetName:r.csharpSdk?.package,explicitVersion:r.csharpSdk?.version},{language:"ruby",snippetName:r.rubySdk?.gem,explicitVersion:r.rubySdk?.version},{language:"php",snippetName:r.phpSdk?.package,explicitVersion:r.phpSdk?.version},{language:"swift",snippetName:r.swiftSdk?.package,explicitVersion:r.swiftSdk?.version},{language:"rust",snippetName:r.rustSdk?.package,explicitVersion:r.rustSdk?.version}];for(let s of o){if(!s.snippetName)continue;let a=s.explicitVersion;a||(a=(await Ymd({fdr:e,workspace:t,language:s.language,snippetName:s.snippetName,context:n}))?.version),i[s.language]={packageName:s.snippetName,version:a},a||n.logger.debug(`[SDK Dynamic IR] ${s.language}: no version specified, will use latest`)}return i}async function Ymd({fdr:e,workspace:t,language:r,snippetName:n,context:i}){let o;switch(r){case"csharp":o="Csharp";break;case"go":o="Go";break;case"java":o="Java";break;case"python":o="Python";break;case"ruby":o="Ruby";break;case"typescript":o="TypeScript";break;case"php":o="Php";break;case"swift":o="Swift";break;default:return}let s,a,u;if(t.generatorsConfiguration?.groups){let c=[];for(let l of t.generatorsConfiguration.groups)for(let p of l.generators)if(p.language===r){let d=bn.getPackageName({generatorInvocation:p});d&&c.push(d),!a&&d&&(a=d,u=p.name,p.outputMode.type==="githubV2"&&(s=`${p.outputMode.githubV2.owner}/${p.outputMode.githubV2.repo}`))}}if(!a){i.logger.debug(`[SDK Dynamic IR] ${r}: no generator found with a package name`);return}try{let c=await e.sdks.versions.computeSemanticVersion({githubRepository:s,language:o,package:a});if(!c.ok){i.logger.debug(`[SDK Dynamic IR] ${r}: version computation failed for package "${a}"`);return}return i.logger.debug(`[SDK Dynamic IR] ${r}: computed version ${c.body.version} for package "${a}"`),{version:c.body.version,generatorPackage:a}}catch(c){i.logger.debug(`[SDK Dynamic IR] ${r}: error computing version: ${c}`);return}}async function Xmd({workspace:e,organization:t,context:r,snippetsConfig:n,skipLanguages:i=new Set}){let o={};if(!e)return;let s={typescript:n.typescriptSdk?.package,python:n.pythonSdk?.package,java:n.javaSdk?.coordinate,go:n.goSdk?.githubRepo&&Euu(n.goSdk?.githubRepo),csharp:n.csharpSdk?.package,ruby:n.rubySdk?.gem,php:n.phpSdk?.package,swift:n.swiftSdk?.package,rust:n.rustSdk?.package};if(e.generatorsConfiguration?.groups)for(let a of e.generatorsConfiguration.groups)for(let u of a.generators){let c=mRe({apiName:e.workspaceName??"",organization:t,generatorInvocation:u}),l="";if(c?.outputConfig.type==="publish")switch(c.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":l=c.outputConfig.value.packageName;break;case"maven":l=c.outputConfig.value.coordinate;break;case"go":l=c.outputConfig.value.repoUrl;break;case"swift":l=c.outputConfig.value.repoUrl;break;case"crates":l=c.outputConfig.value.packageName;break}if(u.language==="php"&&u.config&&typeof u.config=="object"&&"packageName"in u.config&&(l=u.config.packageName??""),!!u.language){if(i.has(u.language)){r.logger.debug(`Skipping dynamic IR generation for ${u.language} (using existing SDK dynamic IR)`);continue}if(u.language&&s[u.language]===l){let p=eh({workspace:e,generationLanguage:u.language,keywords:void 0,smartCasing:u.smartCasing,exampleGeneration:{disabled:!0,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},audiences:{type:"all"},readme:void 0,packageName:l,version:void 0,context:r,sourceResolver:new rm(r,e),dynamicGeneratorConfig:c}),d=oOe({ir:p,disableExamples:!0,smartCasing:u.smartCasing,generationLanguage:u.language,generatorConfig:c});d?o[u.language]={dynamicIR:d}:r.logger.debug(`Failed to create dynamic IR for ${u.language}`)}}}for(let[a,u]of Object.entries(s))a&&u&&!Object.keys(o).includes(a)&&!i.has(a)&&(r.logger.warn(),r.logger.warn(`Failed to upload ${a} SDK snippets because of unknown package \`${u}\`.`),r.logger.warn(`Please make sure your ${e.workspaceName?`${e.workspaceName}/`:""}generators.yml has a generator that publishes a ${u} package.`),r.logger.warn());if(Object.keys(o).length>0)return o}async function Zmd({dynamicIRs:e,dynamicIRUploadUrls:t,context:r,apiId:n}){if(Object.keys(t).length>0)for(let[i,o]of Object.entries(t)){let s=e[i]?.dynamicIR;if(s){let a=JSON.stringify(s);(await fetch(o.uploadUrl,{method:"PUT",body:a,headers:{"Content-Type":"application/octet-stream","Content-Length":Buffer.byteLength(a,"utf8").toString()}})).ok?r.logger.debug(`Uploaded dynamic IR for ${n}:${i}`):r.logger.warn(`Failed to upload dynamic IR for ${n}:${i}`)}else r.logger.warn(`Could not find matching dynamic IR to upload for ${n}:${i}`)}}async function ehd({docsDefinition:e,isPreview:t,context:r}){e.config.aiChatConfig==null||t||r.logger.warn(Ee.yellow("Enabling Ask Fern from docs.yml is deprecated. Please enable it from the Fern dashboard instead."))}function thd(e,t){if(e)return{enabled:!0,model:process.env.FERN_AI_MODEL||"gpt-4o-mini",maxRetries:parseInt(process.env.FERN_AI_MAX_RETRIES||"3"),requestTimeoutMs:parseInt(process.env.FERN_AI_TIMEOUT_MS||"25000"),styleInstructions:t}}function rhd(e){let t=e,r=t?.content;return{errorType:t?.error,statusCode:t?.statusCode??r?.statusCode,reason:r?.reason,errorMessage:r?.errorMessage??r?.message,body:r?.body,cause:r?.cause,rawError:e}}var yOt=[60*1e3,300*1e3,300*1e3];async function bOt({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:o,instanceUrl:s,preview:a,previewId:u,disableTemplates:c,skipUpload:l,cliVersion:p,ciSource:d}){let f=a&&!n.config.settings?.substituteEnvVars;n.config=uy(n.config,{onError:b=>i.failAndThrow(b)},{substituteAsEmpty:f});let m=n.config.instances;if(m.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.");return}if(m.length>1&&s==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${m[0]?.url})`);return}let h=m.find(b=>b.url===s)??m[0];if(h==null){i.failAndThrow(`No docs instance with url ${s}. Failed to register.`);return}let g=[];h.customDomain!=null&&(typeof h.customDomain=="string"?g.push(h.customDomain):Array.isArray(h.customDomain)&&g.push(...h.customDomain)),i.logger.info(`Starting docs publishing for ${a?"preview":"production"}: ${h.url}`),i.logger.debug(`Organization: ${e}, Preview: ${a}, APIs: ${t.length}, OSS: ${r.length}`);let A;return await i.runInteractiveTask({name:h.url},async()=>{let b=performance.now(),v=()=>buu({docsWorkspace:n,customDomains:g,domain:h.url,token:o,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:a,previewId:u,editThisPage:h.editThisPage,isPrivate:h.private,disableTemplates:c,skipUpload:l,withAiExamples:n.config.aiExamples?.enabled??n.config.experimental?.aiExamples??!0,excludeApis:n.config.experimental?.excludeApis??!1,targetAudiences:h.audiences?Array.isArray(h.audiences)?h.audiences:[h.audiences]:void 0,docsUrl:h.url,cliVersion:p,ciSource:d});for(let I=0;;I++)try{A=await v();break}catch(w){if(!(w instanceof xnt)||I>=yOt.length){if(w instanceof xnt)return i.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.");throw w}let x=yOt[I]??yOt[yOt.length-1]??6e4,C=x/6e4;i.logger.warn(`Another docs publish is in progress. Retrying in ${C} minute${C===1?"":"s"} (attempt ${I+1}/${yOt.length})...`),await new Promise(_=>setTimeout(_,x))}let E=performance.now()-b;i.logger.debug(`Docs publishing completed in ${E.toFixed(0)}ms`)}),A}var Dwn=class{context;task;project;docsWorkspace;ossWorkspaces;token;constructor({context:t,task:r,project:n,docsWorkspace:i,ossWorkspaces:o,token:s}){this.context=t,this.task=r,this.project=n,this.docsWorkspace=i,this.ossWorkspaces=o,this.token=s}async publish({instanceUrl:t,preview:r,skipUpload:n}){let i=new oh({context:this.context,task:this.task});try{let o=await bOt({organization:this.project.config.organization,apiWorkspaces:this.project.apiWorkspaces,ossWorkspaces:this.ossWorkspaces,docsWorkspace:this.docsWorkspace,context:i,token:this.token,instanceUrl:t,preview:r,previewId:void 0,disableTemplates:void 0,skipUpload:n,cliVersion:"4.40.0"});return i.getResult()===Tp.Failure?{success:!1}:{success:!0,url:o}}catch(o){return{success:!1,error:xi(o)}}}};St();var _nt=class e{static MAX_DISPLAYED_LOGS_TTY=10;static URL_PATTERN=/https?:\/\/[^\s]+/;context;stream;tasks={};taskOrder=[];startTime;isRegistered=!1;constructor(t){this.context=t.context,this.stream=t.stream??process.stderr}addTask(t){let r={...t,status:t.status??"pending"};return this.tasks[t.id]=r,this.taskOrder.push(t.id),this}async start(t){return this.startTime=Date.now(),t!=null&&await this.context.ttyAwareLogger.takeOverTerminal(()=>{this.stream.write(`
2210
2210
  `),this.stream.write(`${Ee.cyan("\u25C6")} ${Ee.bold(t.title)}
2211
2211
  `),t.subtitle!=null&&this.stream.write(` ${Ee.dim(t.subtitle)}
2212
2212
  `),this.stream.write(`
@@ -3603,7 +3603,7 @@ For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides
3603
3603
  Run ${Ee.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
3604
3604
  Run ${Ee.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),tGe(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function C0o({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!qzu(e))return;let i=t??"",o=e.filter(a=>a.isUpgradeAvailable);r!=null&&(o=o.slice(0,r+1));let s=o.sort((a,u)=>a.generatorName.localeCompare(u.generatorName)||a.currentVersion.localeCompare(u.currentVersion));for(let a of s)i+=`
3605
3605
  ${await VPm(a.generatorName)} (${a.apiName!=null?"API: "+a.apiName+", ":""}Group: ${a.generatorGroup}) `+Ee.dim(a.currentVersion)+Ee.reset(" \u2192 ")+Ee.green(a.latestVersion);return i+=`
3606
- `,n?tGe(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function VPm(e){let r=await new Vzu.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 qPm({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){if(t.length===1){let a={type:"singleApi",versions:{}};return await Wzu({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(u,c,l,p)=>{a.versions[c]==null&&(a.versions[c]={});let d=bBe(l.name);if(d==null){p.logger.debug(`Skipping unknown generator: ${l.name}`);return}let f=await VS({generatorName:d,cliVersion:e.environment.packageVersion,currentGeneratorVersion:l.version,channel:i,includeMajor:o,context:p});f!=null&&(a.versions[c][l.name]={previousVersion:l.version,latestVersion:f})},generatorFilter:r,groupFilter:n}),a}let s={type:"multiApi",versions:{}};return await Wzu({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(a,u,c,l)=>{if(a==null)return;s.versions[a]==null&&(s.versions[a]={}),s.versions[a][u]==null&&(s.versions[a][u]={});let p=bBe(c.name);if(p==null){l.logger.debug(`Skipping unknown generator: ${c.name}`);return}let d=await VS({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:c.version,channel:i,includeMajor:o,context:l});d!=null&&(s.versions[a][u][c.name]={previousVersion:c.version,latestVersion:d})},generatorFilter:r,groupFilter:n}),s}async function Wzu({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async s=>{let a=await xQ({absolutePathToWorkspace:o.absoluteFilePath,context:s});if(a==null||a.groups==null)return;let u=n!=null?fC(n):void 0;for(let c of a.groups)if(!(i!=null&&c.groupName!==i))for(let l of c.generators)u!=null&&l.name!==u||await r(o.workspaceName,c.groupName,l,s)})}))}function $zu(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[s,a]of Object.entries(o)){r.debug(`Checking if ${s} in group ${i} has an upgrade available...`);let u=rF(a.latestVersion,a.previousVersion);r.debug(`Latest version: ${a.latestVersion}. `+(u?"Upgrade available.":"No upgrade available.")),n.push({generatorName:s,generatorGroup:i,apiName:t,isUpgradeAvailable:u,currentVersion:a.previousVersion,latestVersion:a.latestVersion})}return n}async function Q2n({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let s=[];if(e!=null){let a=await qPm({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(a.type==="multiApi")for(let[u,c]of Object.entries(a.versions))s.push(...$zu(c,u,t.logger));else s.push(...$zu(a.versions,void 0,t.logger))}return s}async function dce({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Ndt(e.packageName,{version:t?"prerelease":"latest"})}var Hzu=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],N2n=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=qn.Info;isLocal;stdoutRedirector=new k2n;jsonMode=!1;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new EOe(t,r),this.isLocal=n??!1;let i=this.getPackageName(),o=this.getPackageVersion(),s=this.getCliName();(i==null||o==null||s==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:o,cliName:s}}getPackageName(){return"fern-api"}getPackageVersion(){return"4.39.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Ee.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new fm}failWithoutThrowing(t,r){this.didSucceed=!1,_Et({message:t,error:r,logger:this.logger})}enableJsonMode(){this.jsonMode||(this.jsonMode=!0,this.stdoutRedirector.redirect())}get isJsonMode(){return this.jsonMode}writeJsonToStdout(t){this.stdoutRedirector.restore(),process.stdout.write(JSON.stringify(t,null,2)+`
3606
+ `,n?tGe(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function VPm(e){let r=await new Vzu.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 qPm({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){if(t.length===1){let a={type:"singleApi",versions:{}};return await Wzu({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(u,c,l,p)=>{a.versions[c]==null&&(a.versions[c]={});let d=bBe(l.name);if(d==null){p.logger.debug(`Skipping unknown generator: ${l.name}`);return}let f=await VS({generatorName:d,cliVersion:e.environment.packageVersion,currentGeneratorVersion:l.version,channel:i,includeMajor:o,context:p});f!=null&&(a.versions[c][l.name]={previousVersion:l.version,latestVersion:f})},generatorFilter:r,groupFilter:n}),a}let s={type:"multiApi",versions:{}};return await Wzu({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(a,u,c,l)=>{if(a==null)return;s.versions[a]==null&&(s.versions[a]={}),s.versions[a][u]==null&&(s.versions[a][u]={});let p=bBe(c.name);if(p==null){l.logger.debug(`Skipping unknown generator: ${c.name}`);return}let d=await VS({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:c.version,channel:i,includeMajor:o,context:l});d!=null&&(s.versions[a][u][c.name]={previousVersion:c.version,latestVersion:d})},generatorFilter:r,groupFilter:n}),s}async function Wzu({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async s=>{let a=await xQ({absolutePathToWorkspace:o.absoluteFilePath,context:s});if(a==null||a.groups==null)return;let u=n!=null?fC(n):void 0;for(let c of a.groups)if(!(i!=null&&c.groupName!==i))for(let l of c.generators)u!=null&&l.name!==u||await r(o.workspaceName,c.groupName,l,s)})}))}function $zu(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[s,a]of Object.entries(o)){r.debug(`Checking if ${s} in group ${i} has an upgrade available...`);let u=rF(a.latestVersion,a.previousVersion);r.debug(`Latest version: ${a.latestVersion}. `+(u?"Upgrade available.":"No upgrade available.")),n.push({generatorName:s,generatorGroup:i,apiName:t,isUpgradeAvailable:u,currentVersion:a.previousVersion,latestVersion:a.latestVersion})}return n}async function Q2n({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let s=[];if(e!=null){let a=await qPm({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(a.type==="multiApi")for(let[u,c]of Object.entries(a.versions))s.push(...$zu(c,u,t.logger));else s.push(...$zu(a.versions,void 0,t.logger))}return s}async function dce({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Ndt(e.packageName,{version:t?"prerelease":"latest"})}var Hzu=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],N2n=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=qn.Info;isLocal;stdoutRedirector=new k2n;jsonMode=!1;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new EOe(t,r),this.isLocal=n??!1;let i=this.getPackageName(),o=this.getPackageVersion(),s=this.getCliName();(i==null||o==null||s==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:o,cliName:s}}getPackageName(){return"fern-api"}getPackageVersion(){return"4.40.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${Ee.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new fm}failWithoutThrowing(t,r){this.didSucceed=!1,_Et({message:t,error:r,logger:this.logger})}enableJsonMode(){this.jsonMode||(this.jsonMode=!0,this.stdoutRedirector.redirect())}get isJsonMode(){return this.jsonMode}writeJsonToStdout(t){this.stdoutRedirector.restore(),process.stdout.write(JSON.stringify(t,null,2)+`
3607
3607
  `),this.jsonMode&&this.stdoutRedirector.redirect()}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await eGe()).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 Gzu({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
3608
3608
  `)||(r+=`
3609
3609
  `),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=hUn(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 ckt(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(o){throw o.message.includes("globalThis")?(n.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),n.failWithoutThrowing()):n.failWithoutThrowing(void 0,o),new fm}finally{n.finish()}return i}async instrumentPostHogEvent(t){this.isLocal||(await eGe()).sendEvent(t)}logger=fP((t,...r)=>this.log(t,...r));stderr=fP((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=Kzu(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?Kzu(this.longestWorkspaceName):r).length,i=r.padEnd(n),o=Hzu[this.numTasks++%Hzu.length],s=Ee.hex(o)(i);return{...this.constructTaskInit(),logPrefix:s}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===Tp.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=>S_.indexOf(i.level)>=S_.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===qn.Debug,stderr:r||this.jsonMode})}_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 dce({cliEnvironment:this.environment,includePreReleases:t}),n=rF(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},o=await Q2n({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:o}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){try{return await I0o({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r,theme:{prefix:Ee.yellow("?"),style:{answer:i=>Ee.cyan(i),message:i=>Ee.bold(i),highlight:i=>Ee.cyan(i)}}})}catch(n){throw n?.name==="ExitPromptError"?(this.logger.info(`