@fern-api/python-dynamic-snippets 4.42.1 → 4.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +37 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +165 -0
- package/dist/index.d.ts +165 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/package.json +9 -10
- package/cjs/DynamicSnippetsGenerator.cjs +0 -42
- package/cjs/DynamicSnippetsGenerator.cjs.map +0 -1
- package/cjs/DynamicSnippetsGenerator.d.cts +0 -25
- package/cjs/DynamicSnippetsGeneratorContext-4_I0JAlU.d.cts +0 -87
- package/cjs/EndpointSnippetGenerator.cjs +0 -31
- package/cjs/EndpointSnippetGenerator.cjs.map +0 -1
- package/cjs/EndpointSnippetGenerator.d.cts +0 -68
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs +0 -42
- package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +0 -1
- package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +0 -5
- package/cjs/context/DynamicTypeLiteralMapper.cjs +0 -31
- package/cjs/context/DynamicTypeLiteralMapper.cjs.map +0 -1
- package/cjs/context/DynamicTypeLiteralMapper.d.cts +0 -5
- package/cjs/context/FilePropertyMapper.cjs +0 -31
- package/cjs/context/FilePropertyMapper.cjs.map +0 -1
- package/cjs/context/FilePropertyMapper.d.cts +0 -5
- package/cjs/index.cjs +0 -42
- package/cjs/index.cjs.map +0 -1
- package/cjs/index.d.cts +0 -7
- package/esm/DynamicSnippetsGenerator.d.ts +0 -25
- package/esm/DynamicSnippetsGenerator.js +0 -2
- package/esm/DynamicSnippetsGenerator.js.map +0 -1
- package/esm/DynamicSnippetsGeneratorContext-4_I0JAlU.d.ts +0 -87
- package/esm/EndpointSnippetGenerator.d.ts +0 -68
- package/esm/EndpointSnippetGenerator.js +0 -2
- package/esm/EndpointSnippetGenerator.js.map +0 -1
- package/esm/chunk-2KHLQG2A.js +0 -2
- package/esm/chunk-2KHLQG2A.js.map +0 -1
- package/esm/chunk-2SPAKVUZ.js +0 -2
- package/esm/chunk-2SPAKVUZ.js.map +0 -1
- package/esm/chunk-3XEFLXHY.js +0 -2
- package/esm/chunk-3XEFLXHY.js.map +0 -1
- package/esm/chunk-DP6NTUTQ.js +0 -2
- package/esm/chunk-DP6NTUTQ.js.map +0 -1
- package/esm/chunk-HGKGDQ5J.js +0 -15
- package/esm/chunk-HGKGDQ5J.js.map +0 -1
- package/esm/chunk-NHAFJ5OA.js +0 -31
- package/esm/chunk-NHAFJ5OA.js.map +0 -1
- package/esm/chunk-ULECZXWB.js +0 -2
- package/esm/chunk-ULECZXWB.js.map +0 -1
- package/esm/context/DynamicSnippetsGeneratorContext.d.ts +0 -5
- package/esm/context/DynamicSnippetsGeneratorContext.js +0 -2
- package/esm/context/DynamicSnippetsGeneratorContext.js.map +0 -1
- package/esm/context/DynamicTypeLiteralMapper.d.ts +0 -5
- package/esm/context/DynamicTypeLiteralMapper.js +0 -2
- package/esm/context/DynamicTypeLiteralMapper.js.map +0 -1
- package/esm/context/FilePropertyMapper.d.ts +0 -5
- package/esm/context/FilePropertyMapper.js +0 -2
- package/esm/context/FilePropertyMapper.js.map +0 -1
- package/esm/index.d.ts +0 -7
- package/esm/index.js +0 -2
- package/esm/index.js.map +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { AbstractDynamicSnippetsGenerator, FernGeneratorExec, AbstractAstNode } from '@fern-api/browser-compatible-base-generator';
|
|
2
|
-
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
-
import { python } from '@fern-api/python-ast';
|
|
4
|
-
import { D as DynamicSnippetsGeneratorContext } from './DynamicSnippetsGeneratorContext-4_I0JAlU.cjs';
|
|
5
|
-
import { EndpointSnippetGenerator } from './EndpointSnippetGenerator.cjs';
|
|
6
|
-
import '@fern-api/python-browser-compatible-base';
|
|
7
|
-
|
|
8
|
-
declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<DynamicSnippetsGeneratorContext, EndpointSnippetGenerator> {
|
|
9
|
-
constructor({ ir, config }: {
|
|
10
|
-
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
11
|
-
config: FernGeneratorExec.GeneratorConfig;
|
|
12
|
-
});
|
|
13
|
-
generate(request: FernIr.dynamic.EndpointSnippetRequest): Promise<FernIr.dynamic.EndpointSnippetResponse>;
|
|
14
|
-
generateSync(request: FernIr.dynamic.EndpointSnippetRequest): FernIr.dynamic.EndpointSnippetResponse;
|
|
15
|
-
generateSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest): Promise<AbstractAstNode>;
|
|
16
|
-
/**
|
|
17
|
-
* Generates just the method call AST without the client instantiation.
|
|
18
|
-
* This is useful for wire tests where the client is created separately
|
|
19
|
-
* with test-specific configuration.
|
|
20
|
-
*/
|
|
21
|
-
generateMethodCallSnippetAst(request: FernIr.dynamic.EndpointSnippetRequest): python.AstNode;
|
|
22
|
-
protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { DynamicSnippetsGenerator };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { AbstractDynamicSnippetsGeneratorContext, FernGeneratorExec } from '@fern-api/browser-compatible-base-generator';
|
|
2
|
-
import { FernIr } from '@fern-api/dynamic-ir-sdk';
|
|
3
|
-
import { python } from '@fern-api/python-ast';
|
|
4
|
-
import { BasePythonCustomConfigSchema } from '@fern-api/python-browser-compatible-base';
|
|
5
|
-
|
|
6
|
-
declare namespace DynamicTypeLiteralMapper {
|
|
7
|
-
interface Args {
|
|
8
|
-
typeReference: FernIr.dynamic.TypeReference;
|
|
9
|
-
value: unknown;
|
|
10
|
-
as?: ConvertedAs;
|
|
11
|
-
}
|
|
12
|
-
type ConvertedAs = "key";
|
|
13
|
-
}
|
|
14
|
-
declare class DynamicTypeLiteralMapper {
|
|
15
|
-
private context;
|
|
16
|
-
constructor({ context }: {
|
|
17
|
-
context: DynamicSnippetsGeneratorContext;
|
|
18
|
-
});
|
|
19
|
-
convert(args: DynamicTypeLiteralMapper.Args): python.TypeInstantiation;
|
|
20
|
-
private convertLiteral;
|
|
21
|
-
private convertList;
|
|
22
|
-
private convertSet;
|
|
23
|
-
private convertMap;
|
|
24
|
-
private convertNamed;
|
|
25
|
-
private convertDiscriminatedUnion;
|
|
26
|
-
private convertDiscriminatedUnionProperties;
|
|
27
|
-
private getBaseFields;
|
|
28
|
-
private convertObject;
|
|
29
|
-
private convertEnum;
|
|
30
|
-
private getEnumValue;
|
|
31
|
-
private convertUndiscriminatedUnion;
|
|
32
|
-
private findMatchingUndiscriminatedUnionType;
|
|
33
|
-
private convertPrimitive;
|
|
34
|
-
private getValueAsNumber;
|
|
35
|
-
private getValueAsBoolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface FilePropertyInfo {
|
|
39
|
-
fileFields: python.NamedValue[];
|
|
40
|
-
bodyPropertyFields: python.NamedValue[];
|
|
41
|
-
}
|
|
42
|
-
declare class FilePropertyMapper {
|
|
43
|
-
private context;
|
|
44
|
-
constructor({ context }: {
|
|
45
|
-
context: DynamicSnippetsGeneratorContext;
|
|
46
|
-
});
|
|
47
|
-
getFilePropertyInfo({ body, value }: {
|
|
48
|
-
body: FernIr.dynamic.FileUploadRequestBody;
|
|
49
|
-
value: unknown;
|
|
50
|
-
}): FilePropertyInfo;
|
|
51
|
-
private getSingleFileProperty;
|
|
52
|
-
private getArrayFileProperty;
|
|
53
|
-
private getBodyProperty;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
declare class DynamicSnippetsGeneratorContext extends AbstractDynamicSnippetsGeneratorContext {
|
|
57
|
-
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
58
|
-
customConfig: BasePythonCustomConfigSchema;
|
|
59
|
-
dynamicTypeLiteralMapper: DynamicTypeLiteralMapper;
|
|
60
|
-
filePropertyMapper: FilePropertyMapper;
|
|
61
|
-
constructor({ ir, config }: {
|
|
62
|
-
ir: FernIr.dynamic.DynamicIntermediateRepresentation;
|
|
63
|
-
config: FernGeneratorExec.GeneratorConfig;
|
|
64
|
-
});
|
|
65
|
-
clone(): DynamicSnippetsGeneratorContext;
|
|
66
|
-
getClassName(name: FernIr.Name): string;
|
|
67
|
-
getTypedDictClassName(name: FernIr.Name): string;
|
|
68
|
-
getPropertyName(name: FernIr.Name): string;
|
|
69
|
-
getMethodName(name: FernIr.Name): string;
|
|
70
|
-
getRootClientClassReference(): python.Reference;
|
|
71
|
-
getRootClientClassName(): string;
|
|
72
|
-
getEnvironmentClassName(): string;
|
|
73
|
-
getEnvironmentTypeReferenceFromID(environmentID: string): python.AstNode | undefined;
|
|
74
|
-
getEnvironmentClassReference(): python.Reference;
|
|
75
|
-
getEnvironmentEnumName(name: FernIr.Name): string;
|
|
76
|
-
isPrimitive(typeReference: FernIr.dynamic.TypeReference): boolean;
|
|
77
|
-
getFileFromString(content: string): python.TypeInstantiation;
|
|
78
|
-
getRootModulePath(): string[];
|
|
79
|
-
getCoreModulePath(): string[];
|
|
80
|
-
getEnvironmentModulePath(): string[];
|
|
81
|
-
shouldInlinePathParameters(): boolean;
|
|
82
|
-
private cleanOrganizationName;
|
|
83
|
-
private getApiName;
|
|
84
|
-
private pascalCase;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export { DynamicSnippetsGeneratorContext as D, type FilePropertyInfo as F, DynamicTypeLiteralMapper as a, FilePropertyMapper as b };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";var ve=Object.defineProperty,Rt=Object.defineProperties,It=Object.getOwnPropertyDescriptor,Et=Object.getOwnPropertyDescriptors,Nt=Object.getOwnPropertyNames,we=Object.getOwnPropertySymbols;var Ce=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable;var Be=(n,t,e)=>t in n?ve(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,de=(n,t)=>{for(var e in t||(t={}))Ce.call(t,e)&&Be(n,e,t[e]);if(we)for(var e of we(t))je.call(t,e)&&Be(n,e,t[e]);return n},Ue=(n,t)=>Rt(n,Et(t));var Qe=(n,t)=>{var e={};for(var r in n)Ce.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&we)for(var r of we(n))t.indexOf(r)<0&&je.call(n,r)&&(e[r]=n[r]);return e};var Me=(n,t)=>()=>(n&&(t=n(n=0)),t);var ze=(n,t)=>{for(var e in t)ve(n,e,{get:t[e],enumerable:!0})},Pt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Nt(t))!Ce.call(n,i)&&i!==e&&ve(n,i,{get:()=>t[i],enumerable:!(r=It(t,i))||r.enumerable});return n};var St=n=>Pt(ve({},"__esModule",{value:!0}),n);var c=(n,t,e)=>Be(n,typeof t!="symbol"?t+"":t,e);function He(){throw new Error("setTimeout has not been defined")}function Je(){throw new Error("clearTimeout has not been defined")}function Ke(n){if($===setTimeout)return setTimeout(n,0);if(($===He||!$)&&setTimeout)return $=setTimeout,setTimeout(n,0);try{return $(n,0)}catch(t){try{return $.call(null,n,0)}catch(e){return $.call(this,n,0)}}}function Ft(n){if(W===clearTimeout)return clearTimeout(n);if((W===Je||!W)&&clearTimeout)return W=clearTimeout,clearTimeout(n);try{return W(n)}catch(t){try{return W.call(null,n)}catch(e){return W.call(this,n)}}}function bt(){!re||!K||(re=!1,K.length?O=K.concat(O):Te=-1,O.length&&Ze())}function Ze(){if(!re){var n=Ke(bt);re=!0;for(var t=O.length;t;){for(K=O,O=[];++Te<t;)K&&K[Te].run();Te=-1,t=O.length}K=null,re=!1,Ft(n)}}function kt(n){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];O.push(new Xe(n,t)),O.length===1&&!re&&Ke(Ze)}function Xe(n,t){this.fun=n,this.array=t}function Z(){}function Gt(n){throw new Error("process.binding is not supported")}function Ht(){return"/"}function Jt(n){throw new Error("process.chdir is not supported")}function Kt(){return 0}function Xt(n){var t=Zt.call(te)*.001,e=Math.floor(t),r=Math.floor(t%1*1e9);return n&&(e=e-n[0],r=r-n[1],r<0&&(e--,r+=1e9)),[e,r]}function tr(){var n=new Date,t=n-er;return t/1e3}var $,W,O,re,K,Te,Lt,Bt,Ct,Ut,Mt,_t,Ot,qt,Dt,Vt,$t,Wt,Yt,jt,Qt,zt,te,Zt,er,g,Ge,f=Me(()=>{"use strict";$=He,W=Je;typeof globalThis.setTimeout=="function"&&($=setTimeout);typeof globalThis.clearTimeout=="function"&&(W=clearTimeout);O=[],re=!1,Te=-1;Xe.prototype.run=function(){this.fun.apply(null,this.array)};Lt="browser",Bt="browser",Ct=!0,Ut={},Mt=[],_t="",Ot={},qt={},Dt={};Vt=Z,$t=Z,Wt=Z,Yt=Z,jt=Z,Qt=Z,zt=Z;te=globalThis.performance||{},Zt=te.now||te.mozNow||te.msNow||te.oNow||te.webkitNow||function(){return new Date().getTime()};er=new Date;g={nextTick:kt,title:Lt,browser:Ct,env:Ut,argv:Mt,version:_t,versions:Ot,on:Vt,addListener:$t,once:Wt,off:Yt,removeListener:jt,removeAllListeners:Qt,emit:zt,binding:Gt,cwd:Ht,chdir:Jt,umask:Kt,hrtime:Xt,platform:Bt,release:qt,config:Dt,uptime:tr},Ge={};Object.keys(Ge).forEach(n=>{let t=n.split("."),e=g;for(let r=0;r<t.length;r++){let i=t[r];r===t.length-1?e[i]=Ge[n]:e=e[i]||(e[i]={})}})});function nt(){Oe=!0;for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=n.length;t<e;++t)C[t]=n[t],F[n.charCodeAt(t)]=t;F[45]=62,F[95]=63}function nr(n){Oe||nt();var t,e,r,i,s,o,u=n.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=n[u-2]==="="?2:n[u-1]==="="?1:0,o=new rr(u*3/4-s),r=s>0?u-4:u;var h=0;for(t=0,e=0;t<r;t+=4,e+=3)i=F[n.charCodeAt(t)]<<18|F[n.charCodeAt(t+1)]<<12|F[n.charCodeAt(t+2)]<<6|F[n.charCodeAt(t+3)],o[h++]=i>>16&255,o[h++]=i>>8&255,o[h++]=i&255;return s===2?(i=F[n.charCodeAt(t)]<<2|F[n.charCodeAt(t+1)]>>4,o[h++]=i&255):s===1&&(i=F[n.charCodeAt(t)]<<10|F[n.charCodeAt(t+1)]<<4|F[n.charCodeAt(t+2)]>>2,o[h++]=i>>8&255,o[h++]=i&255),o}function ir(n){return C[n>>18&63]+C[n>>12&63]+C[n>>6&63]+C[n&63]}function sr(n,t,e){for(var r,i=[],s=t;s<e;s+=3)r=(n[s]<<16)+(n[s+1]<<8)+n[s+2],i.push(ir(r));return i.join("")}function et(n){Oe||nt();for(var t,e=n.length,r=e%3,i="",s=[],o=16383,u=0,h=e-r;u<h;u+=o)s.push(sr(n,u,u+o>h?h:u+o));return r===1?(t=n[e-1],i+=C[t>>2],i+=C[t<<4&63],i+="=="):r===2&&(t=(n[e-2]<<8)+n[e-1],i+=C[t>>10],i+=C[t>>4&63],i+=C[t<<2&63],i+="="),s.push(i),s.join("")}function Ae(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function q(n,t){if(Ae()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t),n.__proto__=a.prototype):(n===null&&(n=new a(t)),n.length=t),n}function a(n,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(n,t,e);if(typeof n=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return qe(this,n)}return it(this,n,t,e)}function it(n,t,e,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?ur(n,t,e,r):typeof t=="string"?ar(n,t,e):cr(n,t)}function st(n){if(typeof n!="number")throw new TypeError('"size" argument must be a number');if(n<0)throw new RangeError('"size" argument must not be negative')}function or(n,t,e,r){return st(t),t<=0?q(n,t):e!==void 0?typeof r=="string"?q(n,t).fill(e,r):q(n,t).fill(e):q(n,t)}function qe(n,t){if(st(t),n=q(n,t<0?0:De(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)n[e]=0;return n}function ar(n,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=ot(t,e)|0;n=q(n,r);var i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function _e(n,t){var e=t.length<0?0:De(t.length)|0;n=q(n,e);for(var r=0;r<e;r+=1)n[r]=t[r]&255;return n}function ur(n,t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");return e===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,r),a.TYPED_ARRAY_SUPPORT?(n=t,n.__proto__=a.prototype):n=_e(n,t),n}function cr(n,t){if(U(t)){var e=De(t.length)|0;return n=q(n,e),n.length===0||t.copy(n,0,0,e),n}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||Sr(t.length)?q(n,0):_e(n,t);if(t.type==="Buffer"&&Array.isArray(t.data))return _e(n,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function De(n){if(n>=Ae())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ae().toString(16)+" bytes");return n|0}function U(n){return!!(n!=null&&n._isBuffer)}function ot(n,t){if(U(n))return n.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(n)||n instanceof ArrayBuffer))return n.byteLength;typeof n!="string"&&(n=""+n);var e=n.length;if(e===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return Re(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return pt(n).length;default:if(r)return Re(n).length;t=(""+t).toLowerCase(),r=!0}}function hr(n,t,e){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(n||(n="utf8");;)switch(n){case"hex":return vr(this,t,e);case"utf8":case"utf-8":return ct(this,t,e);case"ascii":return xr(this,t,e);case"latin1":case"binary":return wr(this,t,e);case"base64":return yr(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Tr(this,t,e);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}function X(n,t,e){var r=n[t];n[t]=n[e],n[e]=r}function at(n,t,e,r,i){if(n.length===0)return-1;if(typeof e=="string"?(r=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,r)),U(t))return t.length===0?-1:tt(n,t,e,r,i);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,t,e):Uint8Array.prototype.lastIndexOf.call(n,t,e):tt(n,[t],e,r,i);throw new TypeError("val must be string, number or Buffer")}function tt(n,t,e,r,i){var s=1,o=n.length,u=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||t.length<2)return-1;s=2,o/=2,u/=2,e/=2}function h(v,y){return s===1?v[y]:v.readUInt16BE(y*s)}var m;if(i){var p=-1;for(m=e;m<o;m++)if(h(n,m)===h(t,p===-1?0:m-p)){if(p===-1&&(p=m),m-p+1===u)return p*s}else p!==-1&&(m-=m-p),p=-1}else for(e+u>o&&(e=o-u),m=e;m>=0;m--){for(var d=!0,T=0;T<u;T++)if(h(n,m+T)!==h(t,T)){d=!1;break}if(d)return m}return-1}function fr(n,t,e,r){e=Number(e)||0;var i=n.length-e;r?(r=Number(r),r>i&&(r=i)):r=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var u=parseInt(t.substr(o*2,2),16);if(isNaN(u))return o;n[e+o]=u}return o}function lr(n,t,e,r){return Ne(Re(t,n.length-e),n,e,r)}function ut(n,t,e,r){return Ne(Nr(t),n,e,r)}function pr(n,t,e,r){return ut(n,t,e,r)}function mr(n,t,e,r){return Ne(pt(t),n,e,r)}function dr(n,t,e,r){return Ne(Pr(t,n.length-e),n,e,r)}function yr(n,t,e){return t===0&&e===n.length?et(n):et(n.slice(t,e))}function ct(n,t,e){e=Math.min(n.length,e);for(var r=[],i=t;i<e;){var s=n[i],o=null,u=s>239?4:s>223?3:s>191?2:1;if(i+u<=e){var h,m,p,d;switch(u){case 1:s<128&&(o=s);break;case 2:h=n[i+1],(h&192)===128&&(d=(s&31)<<6|h&63,d>127&&(o=d));break;case 3:h=n[i+1],m=n[i+2],(h&192)===128&&(m&192)===128&&(d=(s&15)<<12|(h&63)<<6|m&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:h=n[i+1],m=n[i+2],p=n[i+3],(h&192)===128&&(m&192)===128&&(p&192)===128&&(d=(s&15)<<18|(h&63)<<12|(m&63)<<6|p&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=u}return gr(r)}function gr(n){var t=n.length;if(t<=rt)return String.fromCharCode.apply(String,n);for(var e="",r=0;r<t;)e+=String.fromCharCode.apply(String,n.slice(r,r+=rt));return e}function xr(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]&127);return r}function wr(n,t,e){var r="";e=Math.min(n.length,e);for(var i=t;i<e;++i)r+=String.fromCharCode(n[i]);return r}function vr(n,t,e){var r=n.length;(!t||t<0)&&(t=0),(!e||e<0||e>r)&&(e=r);for(var i="",s=t;s<e;++s)i+=Er(n[s]);return i}function Tr(n,t,e){for(var r=n.slice(t,e),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+r[s+1]*256);return i}function R(n,t,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+t>e)throw new RangeError("Trying to access beyond buffer length")}function S(n,t,e,r,i,s){if(!U(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}function Ie(n,t,e,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(n.length-e,2);i<s;++i)n[e+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}function Ee(n,t,e,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(n.length-e,4);i<s;++i)n[e+i]=t>>>(r?i:3-i)*8&255}function ht(n,t,e,r,i,s){if(e+r>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function ft(n,t,e,r,i){return i||ht(n,t,e,4,34028234663852886e22,-34028234663852886e22),dt(n,t,e,r,23,4),e+4}function lt(n,t,e,r,i){return i||ht(n,t,e,8,17976931348623157e292,-17976931348623157e292),dt(n,t,e,r,52,8),e+8}function Rr(n){if(n=Ir(n).replace(Ar,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function Ir(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Er(n){return n<16?"0"+n.toString(16):n.toString(16)}function Re(n,t){t=t||1/0;for(var e,r=n.length,i=null,s=[],o=0;o<r;++o){if(e=n.charCodeAt(o),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function Nr(n){for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e)&255);return t}function Pr(n,t){for(var e,r,i,s=[],o=0;o<n.length&&!((t-=2)<0);++o)e=n.charCodeAt(o),r=e>>8,i=e%256,s.push(i),s.push(r);return s}function pt(n){return nr(Rr(n))}function Ne(n,t,e,r){for(var i=0;i<r&&!(i+e>=t.length||i>=n.length);++i)t[i+e]=n[i];return i}function Sr(n){return n!==n}function Fr(n){return n!=null&&(!!n._isBuffer||mt(n)||br(n))}function mt(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function br(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&mt(n.slice(0,0))}function Pe(n,t,e,r,i){var s,o,u=i*8-r-1,h=(1<<u)-1,m=h>>1,p=-7,d=e?i-1:0,T=e?-1:1,v=n[t+d];for(d+=T,s=v&(1<<-p)-1,v>>=-p,p+=u;p>0;s=s*256+n[t+d],d+=T,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=r;p>0;o=o*256+n[t+d],d+=T,p-=8);if(s===0)s=1-m;else{if(s===h)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-m}return(v?-1:1)*o*Math.pow(2,s-r)}function dt(n,t,e,r,i,s){var o,u,h,m=s*8-i-1,p=(1<<m)-1,d=p>>1,T=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=r?0:s-1,y=r?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=p):(o=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-o))<1&&(o--,h*=2),o+d>=1?t+=T/h:t+=T*Math.pow(2,1-d),t*h>=2&&(o++,h/=2),o+d>=p?(u=0,o=p):o+d>=1?(u=(t*h-1)*Math.pow(2,i),o=o+d):(u=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;n[e+v]=u&255,v+=y,u/=256,i-=8);for(o=o<<i|u,m+=i;m>0;n[e+v]=o&255,v+=y,o/=256,m-=8);n[e+v-y]|=A*128}var C,F,rr,Oe,rt,Ar,yt=Me(()=>{"use strict";f();l();C=[],F=[],rr=typeof Uint8Array!="undefined"?Uint8Array:Array,Oe=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(n){return n.__proto__=a.prototype,n};a.from=function(n,t,e){return it(null,n,t,e)};a.kMaxLength=Ae();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(n,t,e){return or(null,n,t,e)};a.allocUnsafe=function(n){return qe(null,n)};a.allocUnsafeSlow=function(n){return qe(null,n)};a.isBuffer=Fr;a.compare=function(t,e){if(!U(t)||!U(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,s=0,o=Math.min(r,i);s<o;++s)if(t[s]!==e[s]){r=t[s],i=e[s];break}return r<i?-1:i<r?1:0};a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=a.allocUnsafe(e),s=0;for(r=0;r<t.length;++r){var o=t[r];if(!U(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,s),s+=o.length}return i};a.byteLength=ot;a.prototype._isBuffer=!0;a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)X(this,e,e+1);return this};a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)X(this,e,e+3),X(this,e+1,e+2);return this};a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)X(this,e,e+7),X(this,e+1,e+6),X(this,e+2,e+5),X(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?ct(this,0,t):hr.apply(this,arguments)};a.prototype.equals=function(t){if(!U(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,r,i,s){if(!U(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||r>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&e>=r)return 0;if(i>=s)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,u=r-e,h=Math.min(o,u),m=this.slice(i,s),p=t.slice(e,r),d=0;d<h;++d)if(m[d]!==p[d]){o=m[d],u=p[d];break}return o<u?-1:u<o?1:0};a.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1};a.prototype.indexOf=function(t,e,r){return at(this,t,e,r,!0)};a.prototype.lastIndexOf=function(t,e,r){return at(this,t,e,r,!1)};a.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-e;if((r===void 0||r>s)&&(r=s),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return fr(this,t,e,r);case"utf8":case"utf-8":return lr(this,t,e,r);case"ascii":return ut(this,t,e,r);case"latin1":case"binary":return pr(this,t,e,r);case"base64":return mr(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dr(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};rt=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var s=e-t;i=new a(s,void 0);for(var o=0;o<s;++o)i[o]=this[o+t]}return i};a.prototype.readUIntLE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return i};a.prototype.readUIntBE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var i=this[t+--e],s=1;e>0&&(s*=256);)i+=this[t+--e]*s;return i};a.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var i=this[t],s=1,o=0;++o<e&&(s*=256);)i+=this[t+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,r){t=t|0,e=e|0,r||R(t,e,this.length);for(var i=e,s=1,o=this[t+--i];i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};a.prototype.readInt8=function(t,e){return e||R(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r};a.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r};a.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),Pe(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),Pe(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),Pe(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),Pe(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;S(this,t,e,r,s,0)}var o=1,u=0;for(this[e]=t&255;++u<r&&(o*=256);)this[e+u]=t/o&255;return e+r};a.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;S(this,t,e,r,s,0)}var o=r-1,u=1;for(this[e+o]=t&255;--o>=0&&(u*=256);)this[e+o]=t/u&255;return e+r};a.prototype.writeUInt8=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Ie(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Ie(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):Ee(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Ee(this,t,e,!1),e+4};a.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);S(this,t,e,r,s-1,-s)}var o=0,u=1,h=0;for(this[e]=t&255;++o<r&&(u*=256);)t<0&&h===0&&this[e+o-1]!==0&&(h=1),this[e+o]=(t/u>>0)-h&255;return e+r};a.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e|0,!i){var s=Math.pow(2,8*r-1);S(this,t,e,r,s-1,-s)}var o=r-1,u=1,h=0;for(this[e+o]=t&255;--o>=0&&(u*=256);)t<0&&h===0&&this[e+o+1]!==0&&(h=1),this[e+o]=(t/u>>0)-h&255;return e+r};a.prototype.writeInt8=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):Ie(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):Ie(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Ee(this,t,e,!0),e+4};a.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e|0,r||S(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):Ee(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,r){return ft(this,t,e,!0,r)};a.prototype.writeFloatBE=function(t,e,r){return ft(this,t,e,!1,r)};a.prototype.writeDoubleLE=function(t,e,r){return lt(this,t,e,!0,r)};a.prototype.writeDoubleBE=function(t,e,r){return lt(this,t,e,!1,r)};a.prototype.copy=function(t,e,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var s=i-r,o;if(this===t&&r<e&&e<i)for(o=s-1;o>=0;--o)t[o+e]=this[o+r];else if(s<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),e);return s};a.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var s=t.charCodeAt(0);s<256&&(t=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var o;if(typeof t=="number")for(o=e;o<r;++o)this[o]=t;else{var u=U(t)?t:Re(new a(t,i).toString()),h=u.length;for(o=0;o<r-e;++o)this[o+e]=u[o%h]}return this};Ar=/[^+\/0-9A-Za-z-_]/g});var l=Me(()=>{"use strict";yt()});var nn={};ze(nn,{EndpointSnippetGenerator:()=>Ye});module.exports=St(nn);f();l();f();l();f();l();function N(n){throw new Error("Unexpected value: "+JSON.stringify(n))}f();l();f();l();f();l();var gt,xt,ye=(xt=(gt=g.env.FERN_STACK_TRACK)==null?void 0:gt.toLowerCase())!=null?xt:"",M=ye!==""&&ye!=="0"&&ye!=="false",Ve=["single","multiline","box"].includes(ye)?ye:"single";M&&(Error.stackTraceLimit=50);var kr=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Lr=new Set(["stacktrace"]);function Fe({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:s=!0,filterJs:o=!0,formatFilename:u=h=>h}={}){var m;if(!M)return[];r=[...r,...kr],e=[...e,...Lr],i=[...i,"runInteractiveTask"];let h=!1;return((m=new Error().stack)!=null?m:"").split(`
|
|
2
|
-
`).map(p=>{let d=p.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(d&&d.length===5){let[,T,v,y,A]=d;if(!T||!v||!y||!A)return;if(h||i.some(I=>T==null?void 0:T.includes(I))){h=!0;return}switch(T){case"Object.<anonymous>":T="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":T=`${T.substring(T.indexOf(".")+1)}()=> { ... }`;break}return{fn:T,path:u(v),position:`${y}:${A}`}}}).filter(p=>{var d,T;return p&&!r.some(v=>p.fn.includes(v))&&!(s&&((d=p.path)!=null&&d.startsWith("node:")))&&!(o&&((T=p.path)!=null&&T.endsWith(".js")))&&!e.some(v=>p.path.includes(v))}).slice(t,t+n)}var Se=class{constructor({maxFrames:t=50,skip:e=0,filterPaths:r=[],filterFunctions:i=[],stopOn:s=[],filterNode:o=!0,filterJs:u=!0,multiline:h=!1,formatFilename:m=p=>p}={}){c(this,"maxFrames");c(this,"skip");c(this,"filterPaths");c(this,"filterFunctions");c(this,"stopOn");c(this,"filterNode");c(this,"filterJs");c(this,"multiline");c(this,"formatFilename");c(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=e,this.filterPaths=r,this.filterFunctions=i,this.stopOn=s,this.filterNode=o,this.filterJs=u,this.multiline=h,this.formatFilename=m}tag(t){let e=this.tracking.get(t)||new Set;Fe({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>e.add(r)),this.tracking.set(t,e)}trace(t){if(!M)return"";let e=this.tracking.get(t);return e?[...e].map(r=>`${this.multiline?`
|
|
3
|
-
`:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(t){let e=this.tracking.get(t);return e?[...e]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},D;function wt({maxFrames:n=50,skip:t=0,filterPaths:e=[],filterFunctions:r=[],stopOn:i=[],filterNode:s=!0,filterJs:o=!0,multiline:u=!1,formatFilename:h=m=>m}={}){M&&(D!=null||(D=new Se({maxFrames:n,skip:t,filterPaths:e,filterFunctions:r,stopOn:i,filterNode:s,filterJs:o,multiline:u,formatFilename:h})))}function vt(n){D==null||D.tag(n)}function $e(n){var t;return(t=D==null?void 0:D.frames(n))!=null?t:[]}var ee=class{constructor(){vt(this)}};f();l();f();l();f();l();var L=class extends ee{constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):typeof this.value=="function"?this.value(e):this.value.write(e)}};var Br=4;wt({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var ge=class{constructor(){c(this,"lineBuffer",[]);c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(this,"lastCharacterIsSemicolon",!1);c(this,"lastCharacterIsNewline",!1);c(this,"nodeStackFrames",[])}get buffer(){return M&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
4
|
-
`),this.lineBuffer.join(`
|
|
5
|
-
`)+(this.lastCharacterIsNewline?`
|
|
6
|
-
`:"")}write(...t){for(let e of t)if(e!=null)if(typeof e=="string"){let r=e.length>0&&e.endsWith(`
|
|
7
|
-
`),i=r?e.substring(0,e.length-1):e,s=this.getIndentString(),o=i.replaceAll(`
|
|
8
|
-
`,`
|
|
9
|
-
${s}`);this.isAtStartOfLine()&&(o=s+o),r&&(o+=`
|
|
10
|
-
`),this.writeInternal(o)}else this.writeNode(e)}writeStatement(...t){this.write(...t),this.write(";"),this.writeNewLineIfLastLineNot()}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){M&&this.nodeStackFrames.push(...$e(t)),t.write(this),M&&Ve!=="single"&&this.writeInternal(`
|
|
11
|
-
`)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){this.writeNode(t),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new L(t).write(this),t.endsWith(";")||this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new L(t).write(this),this.write(" (",e,")"),this.pushScope()}controlFlowWithoutStatement(t){new L(t).write(this),this.pushScope()}endControlFlow(){this.popScope()}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new L(t).write(this),this.write(" (",e,")"),this.pushScope()}alternativeControlFlow(t){this.dedent(),this.write("} "),new L(t).write(this),this.pushScope()}pushScope(){this.writeLine("{"),this.indent()}popScope(t=!0){this.dedent(),this.writeNewLineIfLastLineNot(),t?this.writeLine("}"):this.write("}")}writeLine(...t){this.write(...t.length===0?[""]:t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
|
|
12
|
-
`)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
|
|
13
|
-
`)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:r}){if(t.length>0){let i=t[0];i!=null&&r(i);for(let s=1;s<t.length;s++){this.write(e);let o=t[s];o!=null&&r(o)}}}toString(){return this.buffer}writeInternal(t){if(t.length===0)return;let e=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
|
|
14
|
-
`),this.lastCharacterIsSemicolon=t.endsWith(";");let r=t.split(`
|
|
15
|
-
`),i=M&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;e&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),i&&this.appendTrackingComment()}set lastLine(t){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=t:this.lineBuffer.push(t)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(t){return!1}formatStack(t,e=""){return t.map(r=>`${e?`(${e}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(t){return t.filter(e=>!e.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let t=[...this.formatStack(this.filterStack(Fe({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,Ve){case"single":return this.singleLineTrackingComment(t);case"multiline":return this.multiLineTrackingComment(t);case"box":return this.boxTrackingComment(t)}}singleLineTrackingComment(t){this.lastLine=`${this.lastLine} // ${t.join(" ")}`}multiLineTrackingComment(t){this.lineBuffer.push(...t.map(e=>` // ${e}`))}boxTrackingComment(t){this.lineBuffer.push("/*",...t.map(e=>` ${e}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return Br}};f();l();f();l();var Y={Critical:"CRITICAL",Warning:"WARNING"};f();l();var B={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};f();l();var x={};ze(x,{AccessAttribute:()=>ne,AstNode:()=>w,Class:()=>j,ClassInstantiation:()=>se,CodeBlock:()=>V,Comment:()=>oe,Decorator:()=>ae,Field:()=>Q,Lambda:()=>ue,LambdaParameter:()=>ce,Method:()=>G,MethodArgument:()=>fe,MethodInvocation:()=>le,Operator:()=>pe,Parameter:()=>z,PythonFile:()=>me,Reference:()=>b,StarImport:()=>H,Type:()=>ke,TypeInstantiation:()=>J,accessAttribute:()=>Mr,assign:()=>_r,class_:()=>qr,codeBlock:()=>jr,comment:()=>Qr,decorator:()=>Vr,field:()=>Yr,file:()=>Or,instantiateClass:()=>Dr,invokeFunction:()=>Jr,invokeMethod:()=>Kr,lambda:()=>zr,lambdaParameter:()=>Gr,method:()=>Hr,methodArgument:()=>Xr,operator:()=>en,parameter:()=>Zr,reference:()=>$r,starImport:()=>Wr});f();l();f();l();f();l();f();l();var xe=class extends ge{constructor(){super(...arguments);c(this,"fullyQualifiedModulePathsToImportedNames",{})}setRefNameOverrides(e){this.fullyQualifiedModulePathsToImportedNames=e}unsetRefNameOverrides(){this.fullyQualifiedModulePathsToImportedNames={}}getRefNameOverride(e){var i;let r=this.fullyQualifiedModulePathsToImportedNames[e.getFullyQualifiedModulePath()];return r||{name:(i=e.alias)!=null?i:e.name,isAlias:!!e.alias}}toString(){return this.buffer}async toStringFormatted(e){return e.format(this.buffer)}};var w=class extends ee{constructor(){super(...arguments);c(this,"references",[])}addReference(e){this.references.push(e)}inheritReferences(e){e!==void 0&&e.references.forEach(r=>{this.references.includes(r)||this.addReference(r)})}getReferences(){return this.references}toString(){let e=new xe;return this.write(e),e.toString()}async toStringFormatted(e){let r=new xe;return this.write(r),r.toStringFormatted(e)}};var ne=class extends w{constructor({lhs:e,rhs:r}){super();c(this,"lhs");c(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=r,this.inheritReferences(r)}write(e){this.lhs.write(e),e.write("."),this.rhs.write(e)}};f();l();var be=class extends w{constructor({lhs:e,rhs:r}){super();c(this,"lhs");c(this,"rhs");this.lhs=e,this.inheritReferences(e),this.rhs=r,this.inheritReferences(r)}write(e){this.lhs.write(e),e.write(" = "),this.rhs.write(e)}};f();l();var ie=class extends w{constructor({reference:e,arguments_:r,multiline:i}){super();c(this,"reference");c(this,"arguments");c(this,"multiline");this.reference=e,this.arguments=r,this.multiline=i!=null?i:!1,this.inheritReferences(e),this.arguments.forEach(s=>{this.inheritReferences(s)})}write(e){if(this.reference.write(e),this.arguments.length===0){e.write("()");return}e.write("("),this.multiline&&(e.newLine(),e.indent()),this.arguments.forEach((r,i)=>{r.write(e),i<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};f();l();var j=class extends w{constructor({docs:e,name:r,extends_:i,decorators:s}){super();c(this,"name");c(this,"extends_");c(this,"decorators");c(this,"fields",[]);c(this,"docs");c(this,"statements",[]);this.name=r,this.extends_=i!=null?i:[],this.decorators=s!=null?s:[],this.docs=e,this.extends_.forEach(o=>{this.inheritReferences(o)}),this.decorators.forEach(o=>{this.inheritReferences(o)})}write(e){this.decorators.forEach(r=>{r.write(e)}),e.write(`class ${this.name}`),this.extends_.length>0&&(e.write("("),this.extends_.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write(")")),e.write(":"),e.newLine(),e.indent(),this.docs!=null&&(e.write('"""'),e.write(this.docs),e.write('"""')),e.writeNewLineIfLastLineNot(),this.fields.forEach(r=>{r.write(e),e.writeNewLineIfLastLineNot()}),e.dedent(),e.indent(),this.statements.length?this.writeStatements({writer:e}):e.write("pass"),e.dedent()}add(e){this.statements.push(e),this.inheritReferences(e)}writeStatements({writer:e}){this.statements.forEach((r,i)=>{r.write(e),e.writeNewLineIfLastLineNot()})}addField(e){this.add(e)}};f();l();var se=class extends ie{constructor(r){var i=r,{classReference:t}=i,e=Qe(i,["classReference"]);super(de({reference:t},e))}};f();l();var V=class extends w{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new L(this.arg).write(e)}};f();l();var oe=class extends w{constructor({docs:e}){super();c(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
|
|
16
|
-
`).forEach(r=>{e.writeLine(`# ${r}`)})}};f();l();var ae=class extends w{constructor({callable:e}){super();c(this,"callable");this.callable=e,this.inheritReferences(e)}write(e){e.write("@"),this.callable.write(e),e.newLine()}};f();l();var Q=class extends w{constructor({name:e,type:r,initializer:i,docs:s}){super();c(this,"name");c(this,"type");c(this,"initializer");c(this,"docs");this.name=e,this.type=r,this.initializer=i,this.docs=s,this.inheritReferences(this.type),this.inheritReferences(this.initializer)}write(e){e.write(this.name),this.type!==void 0&&(e.write(": "),this.type.write(e)),this.initializer!==void 0&&(e.write(" = "),this.initializer.write(e)),this.docs!=null&&(e.newLine(),e.write('"""'),e.newLine(),e.write(this.docs),e.newLine(),e.write('"""'))}};f();l();var ue=class extends w{constructor({parameters:e,body:r}){super();c(this,"parameters");c(this,"body");this.parameters=e!=null?e:[],this.body=r,this.inheritReferences(r)}write(e){e.write("lambda"),this.parameters&&this.parameters.length&&(e.write(" "),this.parameters.forEach((r,i)=>{r.write(e),i<this.parameters.length-1&&e.write(", ")})),e.write(": "),this.body.write(e)}};f();l();f();l();var z=class extends w{constructor({name:e,type:r,initializer:i}){super();c(this,"name");c(this,"initializer");c(this,"type");this.name=e,this.type=r,this.initializer=i}write(e){e.write(this.name),this.type&&(e.write(": "),this.type.write(e)),this.initializer!==void 0&&(e.write(" = "),this.initializer.write(e))}};var ce=class extends z{constructor({name:t,initializer:e}){super({name:t,initializer:e,type:void 0})}};f();l();var he;(function(n){n[n.STATIC=0]="STATIC",n[n.INSTANCE=1]="INSTANCE",n[n.CLASS=2]="CLASS"})(he||(he={}));var G=class extends w{constructor({static_:e,name:r,parameters:i,return_:s,docstring:o,type:u,decorators:h}){super();c(this,"name");c(this,"return");c(this,"docstring");c(this,"type");c(this,"parameters");c(this,"decorators");c(this,"statements",[]);c(this,"static_");this.name=r,this.parameters=i!=null?i:[],this.return=s,this.docstring=o,this.type=u,this.decorators=h!=null?h:[],this.static_=e!=null?e:!1,this.parameters.forEach(m=>{this.inheritReferences(m)}),this.inheritReferences(this.return),this.decorators.forEach(m=>{this.inheritReferences(m)}),this.statements.forEach(m=>{this.inheritReferences(m)})}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){this.static_&&this.decorators.push(x.decorator({callable:x.codeBlock("staticmethod")})),this.decorators.forEach(s=>{s.write(e)}),this.type===he.CLASS?x.decorator({callable:new V("classmethod")}).write(e):this.type===he.STATIC&&x.decorator({callable:new V("staticmethod")}).write(e),e.write(`def ${this.name}(`);let i=this.parameters.length>3;i&&(e.newLine(),e.indent()),this.type===he.INSTANCE?(e.write("self"),this.parameters.length>0&&(e.write(i?",":", "),i&&e.newLine())):this.type===he.CLASS&&(e.write("cls"),this.parameters.length>0&&(e.write(i?",":", "),i&&e.newLine())),this.parameters.forEach((s,o)=>{s.write(e),o<this.parameters.length-1&&(e.write(i?",":", "),i&&e.newLine())}),i&&(e.write(","),e.dedent(),e.newLine()),e.write(")"),this.return&&(e.write(" -> "),this.return.write(e)),e.write(":"),e.newLine(),this.docstring&&(e.indent(),e.write('"""'),e.write(this.docstring),e.write('"""'),e.newLine(),e.dedent()),this.statements.length?(e.indent(),this.statements.forEach((s,o)=>{s.write(e),o<this.statements.length-1&&e.newLine()}),e.dedent()):(e.indent(),e.write("pass"),e.dedent()),e.newLine()}};f();l();var fe=class extends w{constructor({name:e,value:r}){super();c(this,"name");c(this,"value");this.name=e,this.value=r,this.inheritReferences(this.value)}write(e){this.name!==void 0&&(e.write(this.name),e.write("=")),this.value.write(e)}};f();l();var le=class extends w{constructor({on:e,method:r,arguments_:i,multiline:s}){super();c(this,"on");c(this,"method");c(this,"arguments");c(this,"multiline");this.on=e,this.method=r,this.arguments=i,this.multiline=s!=null?s:!1,this.inheritReferences(e),this.arguments.forEach(o=>{this.inheritReferences(o)})}write(e){if(this.on.write(e),e.write("."),e.write(this.method),this.arguments.length===0){e.write("()");return}e.write("("),this.multiline&&(e.newLine(),e.indent()),this.arguments.forEach((r,i)=>{r.write(e),i<this.arguments.length-1&&(e.write(","),this.multiline?e.newLine():e.write(" "))}),this.multiline&&(e.newLine(),e.dedent()),e.write(")")}};f();l();f();l();var _={Or:"or",And:"and",Add:"add",Subtract:"subtract",Multiply:"multiple",Divide:"divide",Modulo:"modulo",LeftShift:"leftShift",RightShift:"rightShift"};var pe=class extends w{constructor({operator:e,lhs:r,rhs:i}){super();c(this,"operator");c(this,"lhs");c(this,"rhs");this.operator=e,this.lhs=r,this.inheritReferences(r),this.rhs=i,this.inheritReferences(i)}getOperatorString(){switch(this.operator){case _.Or:return"or";case _.And:return"and";case _.Add:return"+";case _.Subtract:return"-";case _.Multiply:return"*";case _.Divide:return"/";case _.Modulo:return"%";case _.LeftShift:return"<<";case _.RightShift:return">>";default:N(this.operator)}}write(e){this.lhs.write(e),e.write(" "),e.write(this.getOperatorString()),e.write(" "),this.rhs.write(e)}};f();l();f();l();function Tt(n){if(!n)return"Class";let t=n.replace(/[^a-zA-Z0-9\s_-]/g," ").replace(/[-_\s]+/g," ").trim();return!t||/^\d+$/.test(t)?"Class"+(t||""):(/^\d/.test(t)&&(t="Class"+t),t.split(/(?=[A-Z])|[-_\s]+/).filter(r=>r.length>0).map(r=>r.split(new RegExp("(?<=\\d)(?=[a-zA-Z])|(?<=[a-zA-Z])(?=\\d)")).filter(i=>i.length>0)).flat().map((r,i)=>i===0&&/^\d/.test(r)?"Class"+r.charAt(0).toUpperCase()+r.slice(1).toLowerCase():r.length>1&&r===r.toUpperCase()&&!/^\d+$/.test(r)?r:r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(""))}f();l();f();l();var b=class extends w{constructor({name:e,modulePath:r,genericTypes:i,alias:s,attribute:o}){super();c(this,"name");c(this,"modulePath");c(this,"genericTypes");c(this,"alias");c(this,"attribute");this.name=e,this.modulePath=r!=null?r:[],this.genericTypes=i!=null?i:[],this.alias=s,this.attribute=o!=null?o:[],this.references.push(this),this.genericTypes.forEach(u=>{this.inheritReferences(u)})}write(e){let r=e.getRefNameOverride(this);e.write(r.name),this.genericTypes.length>0&&(e.write("["),this.genericTypes.forEach((i,s)=>{s>0&&e.write(", "),i.write(e)}),e.write("]")),this.attribute.length>0&&(e.write("."),this.attribute.forEach((i,s)=>{s>0&&e.write("."),e.write(i)}))}getFullyQualifiedPath(){return this.modulePath.join(".")}getFullyQualifiedModulePath(){return`${this.getFullyQualifiedPath()}.${this.name}`}};var H=class extends b{constructor({modulePath:e}){super({name:"*",modulePath:e});c(this,"docs")}write(e){throw new Error("Not intended to be written outside the context of a PythonFile.")}};var me=class extends w{constructor({path:e,statements:r,isInitFile:i=!1,comments:s,imports:o}){super();c(this,"path");c(this,"isInitFile");c(this,"statements",[]);c(this,"comments");this.path=e,this.isInitFile=i,r==null||r.forEach(u=>this.addStatement(u)),this.comments=s!=null?s:[],o==null||o.forEach(u=>this.addReference(u))}addStatement(e){this.statements.push(e),this.inheritReferences(e)}write(e){let r=this.deduplicateReferences();this.updateWriterRefNameOverrides({writer:e,uniqueReferences:r}),this.writeComments(e),this.writeImports({writer:e,uniqueReferences:r}),this.statements.forEach((i,s)=>{i.write(e),e.newLine(),s<this.statements.length-1&&e.newLine()}),e.unsetRefNameOverrides()}updateWriterRefNameOverrides({writer:e,uniqueReferences:r}){let i=new Map(r),s={},o=this.getInitialUsedNames(),u=this.path.join("."),h=r.get(u);if(h){let{references:p}=h;p.forEach(d=>{let T=d.getFullyQualifiedModulePath(),v=d.name;s[T]={name:v,isAlias:!1},o.add(d.name)}),i.delete(u)}Array.from(i.values()).flatMap(({references:p})=>p).forEach(p=>{var I;if(p instanceof H)return;let d=(I=p.alias)!=null?I:p.name,T=p.getFullyQualifiedModulePath(),v=d,y=p.modulePath.length-1,A=!!p.alias;for(;o.has(v);){A=!0;let E=p.modulePath[y];y<0||!E?v=`_${v}`:v=`${Tt(E)}${v}`,y--}o.add(v),s[T]={name:v,isAlias:A}}),e.setRefNameOverrides(s)}getInitialUsedNames(){let e=new Set;return this.statements.forEach(r=>{(r instanceof j||r instanceof G||r instanceof Q)&&e.add(r.name)}),e}deduplicateReferences(){let e=new Map;for(let r of this.references){let i=r.name,s=r.getFullyQualifiedPath();if(s==="")continue;let o=e.get(s);o?o.referenceNames.has(i)||(o.references.push(r),o.referenceNames.add(i)):e.set(s,{modulePath:r.modulePath,references:[r],referenceNames:new Set([i])})}return e}writeComments(e){this.comments.forEach(r=>{r.write(e)}),this.comments.length>0&&e.newLine()}getImportName({writer:e,reference:r}){let i=e.getRefNameOverride(r),s=r.name,o=i.isAlias?i.name:void 0;return`${s}${o?` as ${o}`:""}`}writeImports({writer:e,uniqueReferences:r}){if(r.size!==0){for(let[i,{modulePath:s,references:o}]of r){let u=s;if(!this.isDefinedInFile(u)){if(u[0]===this.path[0]){let h=0;for(;h<this.path.length&&h<u.length&&this.path[h]===u[h];)h++;let m=this.path.length-h;this.isInitFile&&m++;let p=m>0?".".repeat(m):".";p+=u.slice(h).join("."),e.write(`from ${p} import ${o.map(d=>this.getImportName({writer:e,reference:d})).join(", ")}`)}else e.write(`from ${i} import ${o.map(h=>this.getImportName({writer:e,reference:h})).join(", ")}`);e.newLine()}}e.newLine()}}isDefinedInFile(e){return e.length===this.path.length&&e.every((r,i)=>r===this.path[i])}};f();l();var ke=class extends w{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"int":e.write("int");break;case"float":e.write("float");break;case"bool":e.write("bool");break;case"str":e.write("str");break;case"bytes":e.write("bytes");break;case"list":e.write("List["),this.internalType.value.write(e),e.write("]");break;case"set":e.write("Set["),this.internalType.value.write(e),e.write("]");break;case"tuple":e.write("Tuple["),this.internalType.values.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]");break;case"dict":e.write("Dict["),this.internalType.keyType.write(e),e.write(", "),this.internalType.valueType.write(e),e.write("]");break;case"none":e.write("None");break;case"uuid":e.write("UUID");break;case"optional":e.write("Optional["),this.internalType.value.write(e),e.write("]");break;case"union":e.write("Union["),this.internalType.values.forEach((r,i)=>{i>0&&e.write(", "),r.write(e)}),e.write("]");break;case"any":e.write("Any");break;case"reference":this.internalType.value.write(e);break;case"datetime":e.write("datetime");break;case"literal":typeof this.internalType.value=="string"?e.write(`Literal["${this.internalType.value}"]`):e.write(`Literal[${this.internalType.value}]`);break;default:N(this.internalType)}}static int(){return new this({type:"int"})}static float(){return new this({type:"float"})}static bool(){return new this({type:"bool"})}static str(){return new this({type:"str"})}static bytes(){return new this({type:"bytes"})}static list(e){let r=new this({type:"list",value:e});return r.addReference(x.reference({name:"List",modulePath:["typing"]})),r.inheritReferences(e),r}static set(e){let r=new this({type:"set",value:e});return r.addReference(x.reference({name:"Set",modulePath:["typing"]})),r.inheritReferences(e),r}static tuple(e){let r=new this({type:"tuple",values:e});return r.addReference(x.reference({name:"Tuple",modulePath:["typing"]})),e.forEach(i=>r.inheritReferences(i)),r}static dict(e,r){let i=new this({type:"dict",keyType:e,valueType:r});return i.addReference(x.reference({name:"Dict",modulePath:["typing"]})),i.inheritReferences(e),i.inheritReferences(r),i}static none(){return new this({type:"none"})}static uuid(){let e=new this({type:"uuid"});return e.addReference(x.reference({name:"UUID",modulePath:["uuid"]})),e}static optional(e){if(this.isAlreadyOptional(e))return e;let r=new this({type:"optional",value:e});return r.addReference(x.reference({name:"Optional",modulePath:["typing"]})),r.inheritReferences(e),r}static union(e){let r=new this({type:"union",values:e});return r.addReference(x.reference({name:"Union",modulePath:["typing"]})),e.forEach(i=>r.inheritReferences(i)),r}static any(){let e=new this({type:"any"});return e.addReference(x.reference({name:"Any",modulePath:["typing"]})),e}static datetime(){let e=new this({type:"datetime"});return e.addReference(x.reference({name:"datetime",modulePath:["datetime"]})),e}static reference(e){let r=new this({type:"reference",value:e});return r.addReference(e),r}static literal(e){let r=new this({type:"literal",value:e});return r.addReference(x.reference({name:"Literal",modulePath:["typing"]})),r}static isAlreadyOptional(e){return e.internalType.type==="optional"}};f();l();var J=class n extends w{constructor(e){super();c(this,"internalType");this.internalType=e}static int(e){return new this({type:"int",value:e})}static float(e){return new this({type:"float",value:e})}static bool(e){return new this({type:"bool",value:e})}static str(e,r={multiline:!1,startOnNewLine:!1,endWithNewLine:!1}){return new this({type:"str",value:e,config:r})}static bytes(e){return new this({type:"bytes",value:e})}static list(e,r={endWithComma:!1}){let i=new this({type:"list",values:e,config:r});return e.forEach(s=>i.inheritReferences(s)),i}static set(e,r={endWithComma:!1}){let i=new this({type:"set",values:e,config:r});return e.forEach(s=>i.inheritReferences(s)),i}static tuple(e,r={endWithComma:!1}){let i=new this({type:"tuple",values:e,config:r});return e.forEach(s=>i.inheritReferences(s)),i}static typedDict(e,r={endWithComma:!1}){let i=new this({type:"typedDict",entries:e,config:r});return e.forEach(s=>i.inheritReferences(s.value)),i}static date(e){let r=new this({type:"date",value:e});return r.addReference(new b({name:"date",modulePath:["datetime"]})),r}static datetime(e){let r=new this({type:"datetime",value:e});return r.addReference(new b({name:"datetime",modulePath:["datetime"]})),r}static dict(e,r={endWithComma:!1}){let i=new this({type:"dict",entries:e,config:r});return e.forEach(s=>{i.inheritReferences(s.key),i.inheritReferences(s.value)}),i}static reference(e){let r=new this({type:"reference",value:e});return r.inheritReferences(e),r}static none(){return new this({type:"none"})}static unknown(e){return new this({type:"unknown",value:e})}static uuid(e){let r=new this({type:"uuid",value:e});return r.addReference(new b({name:"UUID",modulePath:["uuid"]})),r}static nop(){return new this({type:"nop"})}static isNop(e){return e instanceof n&&e.internalType.type==="nop"}isTypedDict(){return this.internalType.type==="typedDict"}asTypedDictOrThrow(){if(this.isTypedDict())return this.internalType;throw new Error("Internal error; python.TypeInstantiation is not a TypedDict")}write(e){var r,i,s,o,u,h,m,p,d,T,v;switch(this.internalType.type){case"int":e.write(this.internalType.value.toString());break;case"float":e.write(this.internalType.value.toString());break;case"bool":this.internalType.value?e.write("True"):e.write("False");break;case"str":if((r=this.internalType.config)!=null&&r.multiline){let{startOnNewLine:y,endWithNewLine:A}=this.internalType.config;this.writeStringWithTripleQuotes({writer:e,value:this.internalType.value,startOnNewLine:y,endWithNewLine:A})}else e.write(`"${this.escapeString(this.internalType.value)}"`);break;case"date":e.write(`date.fromisoformat("${this.internalType.value}")`);break;case"datetime":e.write(`datetime.fromisoformat("${this.internalType.value}")`);break;case"bytes":e.write(`b"${this.internalType.value}"`);break;case"list":{let y=this.internalType,A=We({values:y.values});if(A.length===0){e.write("[]");break}e.write("["),(i=y.config)!=null&&i.multiline&&(e.newLine(),e.indent()),A.forEach((I,E)=>{var P,k;E>0&&(e.write(","),(P=y.config)!=null&&P.multiline?e.newLine():e.write(" ")),I.write(e),E===A.length-1&&((k=y.config)!=null&&k.endWithComma)&&e.write(",")}),(s=y.config)!=null&&s.multiline&&(e.newLine(),e.dedent()),e.write("]");break}case"set":{let y=this.internalType,A=We({values:y.values});if(A.length===0){e.write("{}");break}e.write("{"),(o=y.config)!=null&&o.multiline&&(e.newLine(),e.indent()),A.forEach((I,E)=>{var P,k;E>0&&(e.write(","),(P=y.config)!=null&&P.multiline?e.newLine():e.write(" ")),I.write(e),E===A.length-1&&((k=y.config)!=null&&k.endWithComma)&&e.write(",")}),(u=y.config)!=null&&u.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"tuple":{let y=this.internalType,A=We({values:y.values});if(A.length===0){e.write("()");break}e.write("("),(h=y.config)!=null&&h.multiline&&(e.newLine(),e.indent()),A.forEach((I,E)=>{var P,k;E>0&&(e.write(","),(P=y.config)!=null&&P.multiline?e.newLine():e.write(" ")),I.write(e),(A.length===1||E===A.length-1&&((k=y.config)!=null&&k.endWithComma))&&e.write(",")}),(m=y.config)!=null&&m.multiline&&(e.newLine(),e.dedent()),e.write(")");break}case"dict":{let y=this.internalType,A=Cr({entries:y.entries});if(A.length===0){e.write("{}");break}e.write("{"),(p=y.config)!=null&&p.multiline&&(e.newLine(),e.indent()),A.forEach((I,E)=>{var P,k;E>0&&(e.write(","),(P=y.config)!=null&&P.multiline?e.newLine():e.write(" ")),I.key.write(e),e.write(": "),I.value.write(e),E===A.length-1&&((k=y.config)!=null&&k.endWithComma)&&e.write(",")}),(d=y.config)!=null&&d.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"typedDict":{let y=this.internalType,A=Ur({entries:y.entries});if(A.length===0){e.write("{}");break}e.write("{"),(T=y.config)!=null&&T.multiline&&(e.writeLine(),e.indent()),A.forEach((I,E)=>{var P;E>0&&(e.write(","),(P=y.config)!=null&&P.multiline?e.newLine():e.write(" ")),e.write(`"${I.name}": `),I.value.write(e)}),(v=y.config)!=null&&v.multiline&&(e.newLine(),e.dedent()),e.write("}");break}case"reference":{this.internalType.value.write(e);break}case"none":e.write("None");break;case"unknown":this.writeUnknown({writer:e,value:this.internalType.value});break;case"uuid":e.write(`UUID("${this.internalType.value}")`);break;case"nop":break;default:N(this.internalType)}}writeStringWithTripleQuotes({writer:e,value:r,startOnNewLine:i,endWithNewLine:s}){var u;e.write('"""');let o=r.split(`
|
|
17
|
-
`);if(o.length<=1){e.write(this.escapeString((u=o[0])!=null?u:"")),e.write('"""');return}i&&e.writeNoIndent(`\\
|
|
18
|
-
`),o.forEach((h,m)=>{e.writeNoIndent(this.escapeString(h)),m===o.length-1?s&&e.writeNoIndent(`\\
|
|
19
|
-
`):e.writeNoIndent(`
|
|
20
|
-
`)}),e.writeNoIndent('"""')}escapeString(e){let r=new RegExp(`(?<!\\\\)(["'\\\\\\t\\n\\r])`,"g"),i={'"':'\\"',"'":"\\'","\\":"\\\\"," ":"\\t","\n":"\\n","\r":"\\r"};return e.replace(r,s=>{var o;return(o=i[s])!=null?o:s})}writeUnknown({writer:e,value:r}){switch(typeof r){case"boolean":e.write(r?"True":"False");return;case"string":e.write(`"${this.escapeString(r)}"`);return;case"number":e.write(r.toString());return;case"object":if(r==null){e.write("None");return}if(Array.isArray(r)){this.writeUnknownArray({writer:e,value:r});return}this.writeUnknownObject({writer:e,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:e,value:r}){if(r.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let i of r)e.writeNode(n.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownObject({writer:e,value:r}){let i=Object.entries(r);if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let[s,o]of i)e.write(`"${s}": `),e.writeNode(n.unknown(o)),e.writeLine(",");e.dedent(),e.write("}")}};function Cr({entries:n}){return n.filter(t=>!J.isNop(t.key)&&!J.isNop(t.value))}function Ur({entries:n}){return n.filter(t=>!J.isNop(t.value))}function We({values:n}){return n.filter(t=>!J.isNop(t))}function Mr(n){return new ne(n)}function _r(n){return new be(n)}function Or(n){return new me(n)}function qr(n){return new j(n)}function Dr(n){return new se(n)}function Vr(n){return new ae(n)}function $r(n){return new b(n)}function Wr(n){return new H(n)}function Yr(n){return new Q(n)}function jr(n){return new V(n)}function Qr(n){return new oe(n)}function zr(n){return new ue(n)}function Gr(n){return new ce(n)}function Hr(n){return new G(n)}function Jr(n){return new ie(n)}function Kr(n){return new le(n)}function Zr(n){return new z(n)}function Xr(n){return new fe(n)}function en(n){return new pe(n)}var tn={type:"primitive",value:"STRING"},rn=["example"],At="client",Le="request",Ye=class{constructor({context:t}){c(this,"context");this.context=t}async generateSnippet({endpoint:t,request:e}){return this.buildPythonFile({endpoint:t,snippet:e}).toString()}generateSnippetSync({endpoint:t,request:e}){return this.buildPythonFile({endpoint:t,snippet:e}).toString()}async generateSnippetAst({endpoint:t,request:e}){return this.buildPythonFile({endpoint:t,snippet:e})}generateMethodCallSnippetAst({endpoint:t,request:e}){return this.callMethod({endpoint:t,snippet:e})}buildPythonFile({endpoint:t,snippet:e}){return x.file({path:rn,statements:[this.constructClient({endpoint:t,snippet:e}),this.callMethod({endpoint:t,snippet:e})]})}constructClient({endpoint:t,snippet:e}){return x.assign({lhs:x.reference({name:At}),rhs:x.instantiateClass({classReference:this.context.getRootClientClassReference(),arguments_:this.getConstructorArgs({endpoint:t,snippet:e}).map(r=>x.methodArgument({name:r.name,value:r.value})),multiline:!0})})}getConstructorArgs({endpoint:t,snippet:e}){let r=[],i=this.getConstructorEnvironmentArgs({baseUrl:e.baseURL,environment:e.environment});return i.length>0&&r.push(...i),t.auth!=null&&(e.auth!=null?r.push(...this.getConstructorAuthArgs({auth:t.auth,values:e.auth})):this.context.errors.add({severity:Y.Warning,message:`Auth with ${t.auth.type} configuration is required for this endpoint`})),this.context.errors.scope(B.PathParameters),this.context.ir.pathParameters!=null&&r.push(...this.getPathParameters({namedParameters:this.context.ir.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(B.Headers),this.context.ir.headers!=null&&e.headers!=null&&r.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:e.headers})),this.context.errors.unscope(),r}getConstructorEnvironmentArgs({baseUrl:t,environment:e}){let r=this.getEnvironmentValue({baseUrl:t,environment:e});return r==null?[]:e!=null&&this.context.isMultiEnvironmentValues(e)?[{name:"environment",value:r}]:[{name:this.getEnvironmentOptionName({environment:e}),value:r}]}getEnvironmentValue({baseUrl:t,environment:e}){if(t!=null&&e!=null){this.context.errors.add({severity:Y.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(t!=null)return x.TypeInstantiation.str(t);if(e!=null){if(this.context.isSingleEnvironmentID(e)){let r=this.context.getEnvironmentTypeReferenceFromID(e);if(r==null){this.context.errors.add({severity:Y.Warning,message:`Environment ${JSON.stringify(e)} was not found`});return}return x.TypeInstantiation.reference(r)}if(this.context.isMultiEnvironmentValues(e))return this.context.validateMultiEnvironmentUrlValues(e)?x.TypeInstantiation.reference(x.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.entries(e).map(([r,i])=>({name:r,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:tn,value:i})})).map(r=>x.methodArgument({name:r.name,value:r.value})),multiline:!0})):void 0}}getConstructorAuthArgs({auth:t,values:e}){switch(t.type){case"basic":return e.type!=="basic"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBasicAuthArg({auth:t,values:e});case"bearer":return e.type!=="bearer"?(this.addAuthMismatchError(t,e),[]):this.getConstructorBearerAuthArgs({auth:t,values:e});case"header":return e.type!=="header"?(this.addAuthMismatchError(t,e),[]):this.getConstructorHeaderAuthArgs({auth:t,values:e});case"oauth":return e.type!=="oauth"?(this.addAuthMismatchError(t,e),[]):this.getConstructorOAuthArgs({auth:t,values:e});case"inferred":return e.type!=="inferred"?(this.addAuthMismatchError(t,e),[]):(this.addWarning("The Python SDK Generator does not support Inferred auth scheme yet"),[]);default:N(t)}}addAuthMismatchError(t,e){this.context.errors.add({severity:Y.Critical,message:this.context.newAuthMismatchError({auth:t,values:e}).message})}addWarning(t){this.context.errors.add({severity:Y.Warning,message:t})}getConstructorBasicAuthArg({auth:t,values:e}){return[{name:this.context.getPropertyName(t.username),value:x.TypeInstantiation.str(e.username)},{name:this.context.getPropertyName(t.password),value:x.TypeInstantiation.str(e.password)}]}getConstructorBearerAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.token),value:x.TypeInstantiation.str(e.token)}]}getConstructorHeaderAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t.header.typeReference,value:e.value})}]}getConstructorOAuthArgs({auth:t,values:e}){return[{name:this.context.getPropertyName(t.clientId),value:x.TypeInstantiation.str(e.clientId)},{name:this.context.getPropertyName(t.clientSecret),value:x.TypeInstantiation.str(e.clientSecret)}]}getConstructorHeaderArgs({headers:t,values:e}){let r=[];for(let i of t){let s=this.getConstructorHeaderArg({header:i,value:e.value});s!=null&&r.push(s)}return r}getConstructorHeaderArg({header:t,value:e}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:t.typeReference,value:e});if(!x.TypeInstantiation.isNop(r))return{name:this.context.getPropertyName(t.name.name),value:r}}callMethod({endpoint:t,snippet:e}){return x.invokeMethod({on:x.reference({name:At}),method:this.getMethod({endpoint:t}),arguments_:this.getMethodArgs({endpoint:t,snippet:e}).map(r=>x.methodArgument({name:r.name,value:r.value})),multiline:!0})}getMethodArgs({endpoint:t,snippet:e}){switch(t.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:t.request,snippet:e});case"body":return this.getMethodArgsForBodyRequest({request:t.request,snippet:e});default:N(t.request)}}getMethodArgsForBodyRequest({request:t,snippet:e}){var o,u;let r=[];this.context.errors.scope(B.PathParameters);let i=[...(o=this.context.ir.pathParameters)!=null?o:[],...(u=t.pathParameters)!=null?u:[]],s=new Set;if(t.body!=null){let h=this.getBodyRequestArgs({body:t.body,value:e.requestBody});s=new Set(h.map(m=>m.name))}if(i.length>0){let m=this.getPathParameters({namedParameters:i,snippet:e}).map(p=>s.has(p.name)?Ue(de({},p),{name:p.name+"_"}):p);r.push(...m)}return this.context.errors.unscope(),this.context.errors.scope(B.RequestBody),t.body!=null&&r.push(...this.getBodyRequestArgs({body:t.body,value:e.requestBody})),this.context.errors.unscope(),r}getBodyRequestArgs({body:t,value:e}){switch(t.type){case"bytes":return[{name:Le,value:this.getBytesBodyRequestTypeInstantiation({value:e})}];case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:e});default:N(t)}}getBodyRequestArgsForTypeReference({typeReference:t,value:e}){switch(t.type){case"named":{let r=this.context.resolveNamedType({typeId:t.value});return r==null?[]:this.getBodyRequestArgsForNamedTypeReference({typeReference:t,named:r,value:e})}case"nullable":case"optional":{let r=t.value;if(r.type==="named"){let i=this.context.resolveNamedType({typeId:r.value});if((i==null?void 0:i.type)==="object")return[{name:Le,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:r,value:e})}]}return this.getBodyRequestArgsForTypeReference({typeReference:t.value,value:e})}case"list":case"map":case"set":case"literal":case"primitive":case"unknown":return[{name:Le,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:e})}];default:N(t)}}getBodyRequestArgsForNamedTypeReference({typeReference:t,named:e,value:r}){var i;switch(e.type){case"alias":return this.getBodyRequestArgsForTypeReference({typeReference:e.typeReference,value:r});case"enum":case"discriminatedUnion":case"undiscriminatedUnion":return[{name:Le,value:this.context.dynamicTypeLiteralMapper.convert({typeReference:t,value:r})}];case"object":return this.context.associateByWireValue({parameters:e.properties,values:(i=this.context.getRecord(r))!=null?i:{}}).filter(u=>!this.resolvesToLiteralType(u.typeReference)).map(u=>({name:this.context.getPropertyName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert(u)}));default:N(e)}}resolvesToLiteralType(t){switch(t.type){case"literal":return!0;case"optional":case"nullable":return this.resolvesToLiteralType(t.value);case"named":{let e=this.context.resolveNamedType({typeId:t.value});return e==null?!1:e.type==="alias"?this.resolvesToLiteralType(e.typeReference):!1}case"list":case"map":case"set":case"primitive":case"unknown":return!1;default:N(t)}}getBodyRequestArgsForBytes({body:t,value:e}){let r=this.getBytesBodyRequestTypeInstantiation({value:e});return x.TypeInstantiation.isNop(r)?[]:[{name:this.context.getPropertyName(t.bodyKey),value:r}]}getBytesBodyRequestTypeInstantiation({value:t}){return typeof t!="string"?(this.context.errors.add({severity:Y.Critical,message:`Expected bytes value to be a string, got ${typeof t}`}),x.TypeInstantiation.nop()):x.TypeInstantiation.bytes(t)}getMethodArgsForInlinedRequest({request:t,snippet:e}){let r=[],i=this.context.shouldInlinePathParameters();this.context.errors.scope(B.PathParameters);let s=[];t.pathParameters!=null&&s.push(...this.getPathParameters({namedParameters:t.pathParameters,snippet:e})),this.context.errors.unscope(),this.context.errors.scope(B.RequestBody);let o=this.getFilePropertyInfo({request:t,snippet:e});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})||r.push(...s),this.context.needsRequestParameter({request:t,inlinePathParameters:i,inlineFileProperties:!0})&&r.push(...this.getInlinedRequestArgs({request:t,snippet:e,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:t,inlinePathParameters:i})?s:[],filePropertyInfo:o})),r}getFilePropertyInfo({request:t,snippet:e}){return t.body==null||!this.context.isFileUploadRequestBody(t.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:t.body,value:e.requestBody})}getInlinedRequestArgs({request:t,snippet:e,pathParameterFields:r,filePropertyInfo:i}){var p,d,T,v;this.context.errors.scope(B.QueryParameters);let o=this.context.associateQueryParametersByWireValue({parameters:(p=t.queryParameters)!=null?p:[],values:(d=e.queryParameters)!=null?d:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(B.Headers);let h=this.context.associateByWireValue({parameters:(T=t.headers)!=null?T:[],values:(v=e.headers)!=null?v:{}}).map(y=>({name:this.context.getPropertyName(y.name.name),value:this.context.dynamicTypeLiteralMapper.convert(y)}));this.context.errors.unscope(),this.context.errors.scope(B.RequestBody);let m=t.body!=null?this.getInlinedRequestBodyObjectFields({body:t.body,value:e.requestBody,filePropertyInfo:i}):[];return this.context.errors.unscope(),[...r,...o,...h,...m]}getInlinedRequestBodyObjectFields({body:t,value:e,filePropertyInfo:r}){switch(t.type){case"properties":return this.getInlinedRequestBodyPropertyObjectFields({parameters:t.value,value:e});case"referenced":return this.getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:e});case"fileUpload":return this.getFileUploadRequestBodyObjectFields({filePropertyInfo:r});default:N(t)}}getFileUploadRequestBodyObjectFields({filePropertyInfo:t}){return[...t.fileFields,...t.bodyPropertyFields]}getReferencedRequestBodyPropertyTypeInstantiation({body:t,value:e}){let r=t.bodyType;switch(r.type){case"bytes":return this.getBodyRequestArgsForBytes({body:t,value:e});case"typeReference":return this.getBodyRequestArgsForTypeReference({typeReference:r.value,value:e});default:N(r)}}getInlinedRequestBodyPropertyObjectFields({parameters:t,value:e}){var o;let r=[],s=this.context.associateByWireValue({parameters:t,values:(o=this.context.getRecord(e))!=null?o:{}}).filter(u=>!this.resolvesToLiteralType(u.typeReference));for(let u of s)r.push({name:this.context.getPropertyName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert(u)});return r}getPathParameters({namedParameters:t,snippet:e}){var o;let r=[],i=t.filter(u=>!this.resolvesToLiteralType(u.typeReference)),s=this.context.associateByWireValue({parameters:i,values:(o=e.pathParameters)!=null?o:{},ignoreMissingParameters:!0});for(let u of s)r.push({name:this.context.getPropertyName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert(u)});return r}getMethod({endpoint:t}){return t.declaration.fernFilepath.allParts.length>0?`${t.declaration.fernFilepath.allParts.map(e=>this.context.getMethodName(e)).join(".")}.${this.context.getMethodName(t.declaration.name)}`:this.context.getMethodName(t.declaration.name)}getEnvironmentOptionName({environment:t}){return t!=null?"environment":"base_url"}};0&&(module.exports={EndpointSnippetGenerator});
|
|
21
|
-
/*! Bundled license information:
|
|
22
|
-
|
|
23
|
-
@esbuild-plugins/node-globals-polyfill/Buffer.js:
|
|
24
|
-
(*!
|
|
25
|
-
* The buffer module from node.js, for the browser.
|
|
26
|
-
*
|
|
27
|
-
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
28
|
-
* @license MIT
|
|
29
|
-
*)
|
|
30
|
-
*/
|
|
31
|
-
//# sourceMappingURL=EndpointSnippetGenerator.cjs.map
|