@fern-api/php-dynamic-snippets 0.0.5 → 0.0.6

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 (50) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +16 -15
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
  3. package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
  4. package/cjs/EndpointSnippetGenerator.cjs +27 -15
  5. package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
  6. package/cjs/EndpointSnippetGenerator.d.cts +2 -0
  7. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +15 -14
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
  9. package/cjs/context/DynamicTypeLiteralMapper.cjs +26 -14
  10. package/cjs/context/DynamicTypeLiteralMapper.cjs.map +1 -0
  11. package/cjs/context/FilePropertyMapper.cjs +26 -14
  12. package/cjs/context/FilePropertyMapper.cjs.map +1 -0
  13. package/cjs/index.cjs +28 -27
  14. package/cjs/index.cjs.map +1 -0
  15. package/cjs/index.d.cts +1 -1
  16. package/esm/DynamicSnippetsGenerator.d.ts +1 -1
  17. package/esm/DynamicSnippetsGenerator.js +2 -1
  18. package/esm/DynamicSnippetsGenerator.js.map +1 -0
  19. package/esm/EndpointSnippetGenerator.d.ts +2 -0
  20. package/esm/EndpointSnippetGenerator.js +2 -1
  21. package/esm/EndpointSnippetGenerator.js.map +1 -0
  22. package/esm/{chunk-NXBUWG6C.js → chunk-625QSFAH.js} +2 -1
  23. package/esm/chunk-625QSFAH.js.map +1 -0
  24. package/esm/chunk-7MI6WLZG.js +2 -0
  25. package/esm/chunk-7MI6WLZG.js.map +1 -0
  26. package/esm/chunk-BYNT7UJT.js +2 -0
  27. package/esm/chunk-BYNT7UJT.js.map +1 -0
  28. package/esm/chunk-J4Y3S6QS.js +40 -0
  29. package/esm/chunk-J4Y3S6QS.js.map +1 -0
  30. package/esm/{chunk-2MVLIJOX.js → chunk-KU3OGJUU.js} +2 -1
  31. package/esm/chunk-KU3OGJUU.js.map +1 -0
  32. package/esm/chunk-YKXTGZL6.js +4 -0
  33. package/esm/chunk-YKXTGZL6.js.map +1 -0
  34. package/esm/chunk-ZYT6M32A.js +2 -0
  35. package/esm/chunk-ZYT6M32A.js.map +1 -0
  36. package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
  37. package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
  38. package/esm/context/DynamicTypeLiteralMapper.js +2 -1
  39. package/esm/context/DynamicTypeLiteralMapper.js.map +1 -0
  40. package/esm/context/FilePropertyMapper.js +2 -1
  41. package/esm/context/FilePropertyMapper.js.map +1 -0
  42. package/esm/index.d.ts +1 -1
  43. package/esm/index.js +12 -11
  44. package/esm/index.js.map +1 -0
  45. package/package.json +1 -1
  46. package/esm/chunk-6U4ZJ2VA.js +0 -14
  47. package/esm/chunk-AEXR2D5H.js +0 -1
  48. package/esm/chunk-ESPGWZRY.js +0 -3
  49. package/esm/chunk-H4KXMOP7.js +0 -1
  50. package/esm/chunk-JCUQ3FQP.js +0 -28
@@ -1,3 +0,0 @@
1
- import{b as o,d as c}from"./chunk-H4KXMOP7.js";import{j as P,k as v,m as x,n as p,p as s}from"./chunk-JCUQ3FQP.js";v();x();var I="$client",f="Example",R=`<?php
2
-
3
- `,A=class{constructor({context:e}){P(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){var n;let r=this.buildCodeBlock({endpoint:e,snippet:t});return R+await r.toStringAsync({namespace:f,rootNamespace:f,customConfig:(n=this.context.customConfig)!=null?n:{}})}generateSnippetSync({endpoint:e,request:t}){var n;let r=this.buildCodeBlock({endpoint:e,snippet:t});return R+r.toString({namespace:f,rootNamespace:f,customConfig:(n=this.context.customConfig)!=null?n:{}})}buildCodeBlock({endpoint:e,snippet:t}){return s.codeblock(r=>{r.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),r.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})}constructClient({endpoint:e,snippet:t}){return s.codeblock(r=>{r.write(`${I} = `),r.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){return s.invokeMethod({on:s.codeblock(I),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}),multiline:!0})}getConstructorArgs({endpoint:e,snippet:t}){let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:o.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let n=[],a=this.getConstructorBaseUrlArgs({baseUrl:t.baseURL,environment:t.environment});return a.length>0&&n.push(...a),this.context.errors.scope(c.Headers),this.context.ir.headers!=null&&t.headers!=null&&n.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),n.length===0?r:[...r,{name:"options",assignment:s.TypeLiteral.map({entries:n.map(i=>({key:s.TypeLiteral.string(i.name),value:i.value}))})}]}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorBasicAuthArgs({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorBearerAuthArgs({auth:e,values:t});case"header":return t.type!=="header"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});case"oauth":return t.type!=="oauth"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):(this.context.errors.add({severity:o.Warning,message:"The PHP SDK doesn't support OAuth client credentials yet"}),[]);default:p(e)}}getConstructorBasicAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),assignment:s.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),assignment:s.TypeLiteral.string(t.password)}]}getConstructorBaseUrlArgs({baseUrl:e,environment:t}){let r=this.getBaseUrlArg({baseUrl:e,environment:t});return s.TypeLiteral.isNop(r)?[]:[{name:"baseUrl",value:r}]}getBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null)return this.context.errors.add({severity:o.Critical,message:"Cannot specify both baseUrl and environment options"}),s.TypeLiteral.nop();if(e!=null)return s.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentClassAccessFromID(t);return r==null?(this.context.errors.add({severity:o.Warning,message:`Environment ${JSON.stringify(t)} was not found`}),s.TypeLiteral.nop()):s.TypeLiteral.reference(s.codeblock(n=>{n.writeNode(r),n.write("->value")}))}this.context.isMultiEnvironmentValues(t)&&this.context.errors.add({severity:o.Warning,message:"The PHP SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}return s.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),assignment:s.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let n of e){let a=this.getConstructorHeaderArg({header:n,value:t.value});a!=null&&r.push({name:this.context.getPropertyName(n.name.name),value:a})}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!s.TypeLiteral.isNop(r))return r}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:p(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var a,i;let r=[];this.context.errors.scope(c.PathParameters);let n=[...(a=this.context.ir.pathParameters)!=null?a:[],...(i=e.pathParameters)!=null?i:[]];return n.length>0&&r.push(...this.getPathParameters({namedParameters:n,snippet:t}).map(h=>h.value)),this.context.errors.unscope(),this.context.errors.scope(c.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:p(e)}}getBytesBodyRequestArg({value:e}){return this.context.errors.add({severity:o.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),s.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:e,snippet:t}){var m,y,d,u;let r=[],n=(y=(m=this.context.customConfig)==null?void 0:m.inlinePathParameters)!=null?y:!1;this.context.errors.scope(c.PathParameters);let a=[],i=[...(d=this.context.ir.pathParameters)!=null?d:[],...(u=e.pathParameters)!=null?u:[]];i.length>0&&a.push(...this.getPathParameters({namedParameters:i,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(c.RequestBody);let h=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:n})||r.push(...a.map(g=>g.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:n,inlineFileProperties:!0})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:n})?a:[],filePropertyInfo:h})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:n}){var d,u,g,F;this.context.errors.scope(c.QueryParameters);let i=this.context.associateQueryParametersByWireValue({parameters:(d=e.queryParameters)!=null?d:[],values:(u=t.queryParameters)!=null?u:{}}).map(l=>({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicTypeLiteralMapper.convert(l)}));this.context.errors.unscope(),this.context.errors.scope(c.Headers);let m=this.context.associateByWireValue({parameters:(g=e.headers)!=null?g:[],values:(F=t.headers)!=null?F:{}}).map(l=>({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicTypeLiteralMapper.convert(l)}));this.context.errors.unscope(),this.context.errors.scope(c.RequestBody);let y=e.body!=null?this.getInlinedRequestBodyConstructorFields({body:e.body,value:t.requestBody,filePropertyInfo:n}):[];return this.context.errors.unscope(),s.TypeLiteral.class_({reference:s.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getRequestNamespace(e.declaration.fernFilepath)}),fields:[...r,...i,...m,...y]})}getInlinedRequestBodyConstructorFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:r});default:p(e)}}getFileUploadRequestBodyConstructorFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:p(e)}}getInlinedRequestBodyPropertyConstructorFields({parameters:e,value:t}){var a;let r=[],n=this.context.associateByWireValue({parameters:e,values:(a=this.context.getRecord(t))!=null?a:{}});for(let i of n)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getPathParameters({namedParameters:e,snippet:t}){var a;let r=[],n=this.context.associateByWireValue({parameters:e,values:(a=t.pathParameters)!=null?a:{}});for(let i of n)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getPropertyName(t)).join("->")}->${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getRootClientClassInstantiation(e){return s.instantiateClass({classReference:s.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:e,multiline:!0})}};export{A as a};
@@ -1 +0,0 @@
1
- import{a as P,b as T,c as S,d as b,j as a,k as p,m as l,n as f,o as E}from"./chunk-JCUQ3FQP.js";p();l();p();l();var y=class{constructor(){a(this,"reporter");a(this,"snippet");a(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){(this.reporter==null||this.reporter.size()>e.errors.size())&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}};var R=class{constructor(e){a(this,"context");this.context=e}async generate(e){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let t=new y;for(let n of r){let i=this.context.clone(),u=this.createSnippetGenerator(i);try{let o=await u.generateSnippet({endpoint:n,request:e});if(i.errors.empty())return{snippet:o,errors:void 0};t.update({context:i,snippet:o})}catch(o){t.err==null&&(t.err=o)}}return t.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let t=new y;for(let n of r){let i=this.context.clone(),u=this.createSnippetGenerator(i);try{let o=u.generateSnippetSync({endpoint:n,request:e});if(i.errors.empty())return{snippet:o,errors:void 0};t.update({context:i,snippet:o})}catch(o){t.err==null&&(t.err=o)}}return t.getResponseOrThrow({endpoint:e.endpoint})}};p();l();var s={Critical:"CRITICAL",Warning:"WARNING"},g=class h{constructor(){a(this,"errors");a(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(T(P({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new h;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};p();l();p();l();p();l();var v=class{constructor(){a(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var w=class{constructor({ir:e,config:r}){a(this,"config");a(this,"errors");a(this,"_ir");a(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.errors=new g,this.httpEndpointReferenceParser=new v}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let u=e.find(m=>m.name.wireValue===n);if(u==null)throw this.newParameterNotRecognizedError(n);let o=this.isListTypeReference(u.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:u.name,typeReference:u.typeReference,value:o})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,u]of Object.entries(r)){this.errors.scope(i);try{let o=e.find(m=>m.name.wireValue===i);if(o==null){if(t)continue;this.errors.add({severity:s.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:o.name,typeReference:o.typeReference,value:u})}finally{this.errors.unscope()}}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:s.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:s.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:s.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:s.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:s.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:s.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:s.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let u=e.types[i];if(u==null){this.errors.add({severity:s.Critical,message:`No type found for discriminant value "${i}"`});return}let x=t,{[n]:o}=x,m=b(x,[S(n)]);return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:m}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocationOrThrow(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:f(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:f(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(E(t.urls));for(let i of E(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:s.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${E(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:f(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:f(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:f(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};p();l();var A={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();l();export{R as a,s as b,w as c,A as d};
@@ -1,28 +0,0 @@
1
- var lt=Object.create;var ae=Object.defineProperty,ht=Object.defineProperties,pt=Object.getOwnPropertyDescriptor,mt=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertyNames,he=Object.getOwnPropertySymbols,wt=Object.getPrototypeOf,Ne=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable;var ve=(r,t,e)=>t in r?ae(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pe=(r,t)=>{for(var e in t||(t={}))Ne.call(t,e)&&ve(r,e,t[e]);if(he)for(var e of he(t))Ce.call(t,e)&&ve(r,e,t[e]);return r},me=(r,t)=>ht(r,mt(t));var Hr=r=>typeof r=="symbol"?r:r+"",Qr=(r,t)=>{var e={};for(var i in r)Ne.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&he)for(var i of he(r))t.indexOf(i)<0&&Ce.call(r,i)&&(e[i]=r[i]);return e};var Le=(r,t)=>()=>(r&&(t=r(r=0)),t);var jr=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),xt=(r,t)=>{for(var e in t)ae(r,e,{get:t[e],enumerable:!0})},Se=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of dt(t))!Ne.call(r,n)&&n!==e&&ae(r,n,{get:()=>t[n],enumerable:!(i=pt(t,n))||i.enumerable});return r};var Xr=(r,t,e)=>(e=r!=null?lt(wt(r)):{},Se(t||!r||!r.__esModule?ae(e,"default",{value:r,enumerable:!0}):e,r)),Zr=r=>Se(ae({},"__esModule",{value:!0}),r);var f=(r,t,e)=>ve(r,typeof t!="symbol"?t+"":t,e);function Ue(){throw new Error("setTimeout has not been defined")}function Pe(){throw new Error("clearTimeout has not been defined")}function Me(r){if(Y===setTimeout)return setTimeout(r,0);if((Y===Ue||!Y)&&setTimeout)return Y=setTimeout,setTimeout(r,0);try{return Y(r,0)}catch(t){try{return Y.call(null,r,0)}catch(e){return Y.call(this,r,0)}}}function yt(r){if(F===clearTimeout)return clearTimeout(r);if((F===Pe||!F)&&clearTimeout)return F=clearTimeout,clearTimeout(r);try{return F(r)}catch(t){try{return F.call(null,r)}catch(e){return F.call(this,r)}}}function gt(){!se||!q||(se=!1,q.length?B=q.concat(B):de=-1,B.length&&$e())}function $e(){if(!se){var r=Me(gt);se=!0;for(var t=B.length;t;){for(q=B,B=[];++de<t;)q&&q[de].run();de=-1,t=B.length}q=null,se=!1,yt(r)}}function Tt(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];B.push(new De(r,t)),B.length===1&&!se&&Me($e)}function De(r,t){this.fun=r,this.array=t}function G(){}function $t(r){throw new Error("process.binding is not supported")}function Dt(){return"/"}function Ot(r){throw new Error("process.chdir is not supported")}function Yt(){return 0}function Wt(r){var t=Ft.call(ne)*.001,e=Math.floor(t),i=Math.floor(t%1*1e9);return r&&(e=e-r[0],i=i-r[1],i<0&&(e--,i+=1e9)),[e,i]}function zt(){var r=new Date,t=r-Vt;return t/1e3}var Y,F,B,se,q,de,At,Et,vt,Nt,Lt,It,_t,Rt,kt,bt,Ct,St,Bt,Ut,Pt,Mt,ne,Ft,Vt,d,Be,u=Le(()=>{"use strict";Y=Ue,F=Pe;typeof globalThis.setTimeout=="function"&&(Y=setTimeout);typeof globalThis.clearTimeout=="function"&&(F=clearTimeout);B=[],se=!1,de=-1;De.prototype.run=function(){this.fun.apply(null,this.array)};At="browser",Et="browser",vt=!0,Nt={},Lt=[],It="",_t={},Rt={},kt={};bt=G,Ct=G,St=G,Bt=G,Ut=G,Pt=G,Mt=G;ne=globalThis.performance||{},Ft=ne.now||ne.mozNow||ne.msNow||ne.oNow||ne.webkitNow||function(){return new Date().getTime()};Vt=new Date;d={nextTick:Tt,title:At,browser:vt,env:Nt,argv:Lt,version:It,versions:_t,on:bt,addListener:Ct,once:St,off:Bt,removeListener:Ut,removeAllListeners:Pt,emit:Mt,binding:$t,cwd:Dt,chdir:Ot,umask:Yt,hrtime:Wt,platform:Et,release:Rt,config:kt,uptime:zt},Be={};Object.keys(Be).forEach(r=>{let t=r.split("."),e=d;for(let i=0;i<t.length;i++){let n=t[i];i===t.length-1?e[n]=Be[r]:e=e[n]||(e[n]={})}})});function We(){_e=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=r.length;t<e;++t)R[t]=r[t],N[r.charCodeAt(t)]=t;N[45]=62,N[95]=63}function Gt(r){_e||We();var t,e,i,n,s,o,c=r.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=r[c-2]==="="?2:r[c-1]==="="?1:0,o=new qt(c*3/4-s),i=s>0?c-4:c;var h=0;for(t=0,e=0;t<i;t+=4,e+=3)n=N[r.charCodeAt(t)]<<18|N[r.charCodeAt(t+1)]<<12|N[r.charCodeAt(t+2)]<<6|N[r.charCodeAt(t+3)],o[h++]=n>>16&255,o[h++]=n>>8&255,o[h++]=n&255;return s===2?(n=N[r.charCodeAt(t)]<<2|N[r.charCodeAt(t+1)]>>4,o[h++]=n&255):s===1&&(n=N[r.charCodeAt(t)]<<10|N[r.charCodeAt(t+1)]<<4|N[r.charCodeAt(t+2)]>>2,o[h++]=n>>8&255,o[h++]=n&255),o}function Jt(r){return R[r>>18&63]+R[r>>12&63]+R[r>>6&63]+R[r&63]}function Ht(r,t,e){for(var i,n=[],s=t;s<e;s+=3)i=(r[s]<<16)+(r[s+1]<<8)+r[s+2],n.push(Jt(i));return n.join("")}function Oe(r){_e||We();for(var t,e=r.length,i=e%3,n="",s=[],o=16383,c=0,h=e-i;c<h;c+=o)s.push(Ht(r,c,c+o>h?h:c+o));return i===1?(t=r[e-1],n+=R[t>>2],n+=R[t<<4&63],n+="=="):i===2&&(t=(r[e-2]<<8)+r[e-1],n+=R[t>>10],n+=R[t>>4&63],n+=R[t<<2&63],n+="="),s.push(n),s.join("")}function we(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(r,t){if(we()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(t),r.__proto__=a.prototype):(r===null&&(r=new a(t)),r.length=t),r}function a(r,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(r,t,e);if(typeof r=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Re(this,r)}return Ve(this,r,t,e)}function Ve(r,t,e,i){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?Xt(r,t,e,i):typeof t=="string"?jt(r,t,e):Zt(r,t)}function ze(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function Qt(r,t,e,i){return ze(t),t<=0?U(r,t):e!==void 0?typeof i=="string"?U(r,t).fill(e,i):U(r,t).fill(e):U(r,t)}function Re(r,t){if(ze(t),r=U(r,t<0?0:ke(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)r[e]=0;return r}function jt(r,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var i=qe(t,e)|0;r=U(r,i);var n=r.write(t,e);return n!==i&&(r=r.slice(0,n)),r}function Ie(r,t){var e=t.length<0?0:ke(t.length)|0;r=U(r,e);for(var i=0;i<e;i+=1)r[i]=t[i]&255;return r}function Xt(r,t,e,i){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(i||0))throw new RangeError("'length' is out of bounds");return e===void 0&&i===void 0?t=new Uint8Array(t):i===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,i),a.TYPED_ARRAY_SUPPORT?(r=t,r.__proto__=a.prototype):r=Ie(r,t),r}function Zt(r,t){if(k(t)){var e=ke(t.length)|0;return r=U(r,e),r.length===0||t.copy(r,0,0,e),r}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||xr(t.length)?U(r,0):Ie(r,t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ie(r,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ke(r){if(r>=we())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+we().toString(16)+" bytes");return r|0}function k(r){return!!(r!=null&&r._isBuffer)}function qe(r,t){if(k(r))return r.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var e=r.length;if(e===0)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return xe(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Ze(r).length;default:if(i)return xe(r).length;t=(""+t).toLowerCase(),i=!0}}function Kt(r,t,e){var i=!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(r||(r="utf8");;)switch(r){case"hex":return cr(this,t,e);case"utf8":case"utf-8":return He(this,t,e);case"ascii":return ar(this,t,e);case"latin1":case"binary":return fr(this,t,e);case"base64":return sr(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ur(this,t,e);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}function J(r,t,e){var i=r[t];r[t]=r[e],r[e]=i}function Ge(r,t,e,i,n){if(r.length===0)return-1;if(typeof e=="string"?(i=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=n?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(n)return-1;e=r.length-1}else if(e<0)if(n)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,i)),k(t))return t.length===0?-1:Ye(r,t,e,i,n);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Ye(r,[t],e,i,n);throw new TypeError("val must be string, number or Buffer")}function Ye(r,t,e,i,n){var s=1,o=r.length,c=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,o/=2,c/=2,e/=2}function h(E,ie){return s===1?E[ie]:E.readUInt16BE(ie*s)}var m;if(n){var w=-1;for(m=e;m<o;m++)if(h(r,m)===h(t,w===-1?0:m-w)){if(w===-1&&(w=m),m-w+1===c)return w*s}else w!==-1&&(m-=m-w),w=-1}else for(e+c>o&&(e=o-c),m=e;m>=0;m--){for(var x=!0,L=0;L<c;L++)if(h(r,m+L)!==h(t,L)){x=!1;break}if(x)return m}return-1}function er(r,t,e,i){e=Number(e)||0;var n=r.length-e;i?(i=Number(i),i>n&&(i=n)):i=n;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var o=0;o<i;++o){var c=parseInt(t.substr(o*2,2),16);if(isNaN(c))return o;r[e+o]=c}return o}function tr(r,t,e,i){return Te(xe(t,r.length-e),r,e,i)}function Je(r,t,e,i){return Te(dr(t),r,e,i)}function rr(r,t,e,i){return Je(r,t,e,i)}function ir(r,t,e,i){return Te(Ze(t),r,e,i)}function nr(r,t,e,i){return Te(wr(t,r.length-e),r,e,i)}function sr(r,t,e){return t===0&&e===r.length?Oe(r):Oe(r.slice(t,e))}function He(r,t,e){e=Math.min(r.length,e);for(var i=[],n=t;n<e;){var s=r[n],o=null,c=s>239?4:s>223?3:s>191?2:1;if(n+c<=e){var h,m,w,x;switch(c){case 1:s<128&&(o=s);break;case 2:h=r[n+1],(h&192)===128&&(x=(s&31)<<6|h&63,x>127&&(o=x));break;case 3:h=r[n+1],m=r[n+2],(h&192)===128&&(m&192)===128&&(x=(s&15)<<12|(h&63)<<6|m&63,x>2047&&(x<55296||x>57343)&&(o=x));break;case 4:h=r[n+1],m=r[n+2],w=r[n+3],(h&192)===128&&(m&192)===128&&(w&192)===128&&(x=(s&15)<<18|(h&63)<<12|(m&63)<<6|w&63,x>65535&&x<1114112&&(o=x))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=c}return or(i)}function or(r){var t=r.length;if(t<=Fe)return String.fromCharCode.apply(String,r);for(var e="",i=0;i<t;)e+=String.fromCharCode.apply(String,r.slice(i,i+=Fe));return e}function ar(r,t,e){var i="";e=Math.min(r.length,e);for(var n=t;n<e;++n)i+=String.fromCharCode(r[n]&127);return i}function fr(r,t,e){var i="";e=Math.min(r.length,e);for(var n=t;n<e;++n)i+=String.fromCharCode(r[n]);return i}function cr(r,t,e){var i=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>i)&&(e=i);for(var n="",s=t;s<e;++s)n+=mr(r[s]);return n}function ur(r,t,e){for(var i=r.slice(t,e),n="",s=0;s<i.length;s+=2)n+=String.fromCharCode(i[s]+i[s+1]*256);return n}function y(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}function A(r,t,e,i,n,s){if(!k(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(e+i>r.length)throw new RangeError("Index out of range")}function ye(r,t,e,i){t<0&&(t=65535+t+1);for(var n=0,s=Math.min(r.length-e,2);n<s;++n)r[e+n]=(t&255<<8*(i?n:1-n))>>>(i?n:1-n)*8}function ge(r,t,e,i){t<0&&(t=4294967295+t+1);for(var n=0,s=Math.min(r.length-e,4);n<s;++n)r[e+n]=t>>>(i?n:3-n)*8&255}function Qe(r,t,e,i,n,s){if(e+i>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function je(r,t,e,i,n){return n||Qe(r,t,e,4,34028234663852886e22,-34028234663852886e22),et(r,t,e,i,23,4),e+4}function Xe(r,t,e,i,n){return n||Qe(r,t,e,8,17976931348623157e292,-17976931348623157e292),et(r,t,e,i,52,8),e+8}function hr(r){if(r=pr(r).replace(lr,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function pr(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function mr(r){return r<16?"0"+r.toString(16):r.toString(16)}function xe(r,t){t=t||1/0;for(var e,i=r.length,n=null,s=[],o=0;o<i;++o){if(e=r.charCodeAt(o),e>55295&&e<57344){if(!n){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),n=e;continue}e=(n-55296<<10|e-56320)+65536}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=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 dr(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function wr(r,t){for(var e,i,n,s=[],o=0;o<r.length&&!((t-=2)<0);++o)e=r.charCodeAt(o),i=e>>8,n=e%256,s.push(n),s.push(i);return s}function Ze(r){return Gt(hr(r))}function Te(r,t,e,i){for(var n=0;n<i&&!(n+e>=t.length||n>=r.length);++n)t[n+e]=r[n];return n}function xr(r){return r!==r}function yr(r){return r!=null&&(!!r._isBuffer||Ke(r)||gr(r))}function Ke(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function gr(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&Ke(r.slice(0,0))}function Ae(r,t,e,i,n){var s,o,c=n*8-i-1,h=(1<<c)-1,m=h>>1,w=-7,x=e?n-1:0,L=e?-1:1,E=r[t+x];for(x+=L,s=E&(1<<-w)-1,E>>=-w,w+=c;w>0;s=s*256+r[t+x],x+=L,w-=8);for(o=s&(1<<-w)-1,s>>=-w,w+=i;w>0;o=o*256+r[t+x],x+=L,w-=8);if(s===0)s=1-m;else{if(s===h)return o?NaN:(E?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-m}return(E?-1:1)*o*Math.pow(2,s-i)}function et(r,t,e,i,n,s){var o,c,h,m=s*8-n-1,w=(1<<m)-1,x=w>>1,L=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=i?0:s-1,ie=i?1:-1,ut=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,o=w):(o=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-o))<1&&(o--,h*=2),o+x>=1?t+=L/h:t+=L*Math.pow(2,1-x),t*h>=2&&(o++,h/=2),o+x>=w?(c=0,o=w):o+x>=1?(c=(t*h-1)*Math.pow(2,n),o=o+x):(c=t*Math.pow(2,x-1)*Math.pow(2,n),o=0));n>=8;r[e+E]=c&255,E+=ie,c/=256,n-=8);for(o=o<<n|c,m+=n;m>0;r[e+E]=o&255,E+=ie,o/=256,m-=8);r[e+E-ie]|=ut*128}var R,N,qt,_e,Fe,lr,tt=Le(()=>{"use strict";u();l();R=[],N=[],qt=typeof Uint8Array!="undefined"?Uint8Array:Array,_e=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(r){return r.__proto__=a.prototype,r};a.from=function(r,t,e){return Ve(null,r,t,e)};a.kMaxLength=we();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(r,t,e){return Qt(null,r,t,e)};a.allocUnsafe=function(r){return Re(null,r)};a.allocUnsafeSlow=function(r){return Re(null,r)};a.isBuffer=yr;a.compare=function(t,e){if(!k(t)||!k(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,n=e.length,s=0,o=Math.min(i,n);s<o;++s)if(t[s]!==e[s]){i=t[s],n=e[s];break}return i<n?-1:n<i?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 i;if(e===void 0)for(e=0,i=0;i<t.length;++i)e+=t[i].length;var n=a.allocUnsafe(e),s=0;for(i=0;i<t.length;++i){var o=t[i];if(!k(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,s),s+=o.length}return n};a.byteLength=qe;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)J(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)J(this,e,e+3),J(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)J(this,e,e+7),J(this,e+1,e+6),J(this,e+2,e+5),J(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?He(this,0,t):Kt.apply(this,arguments)};a.prototype.equals=function(t){if(!k(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,i,n,s){if(!k(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),i===void 0&&(i=t?t.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),e<0||i>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&e>=i)return 0;if(n>=s)return-1;if(e>=i)return 1;if(e>>>=0,i>>>=0,n>>>=0,s>>>=0,this===t)return 0;for(var o=s-n,c=i-e,h=Math.min(o,c),m=this.slice(n,s),w=t.slice(e,i),x=0;x<h;++x)if(m[x]!==w[x]){o=m[x],c=w[x];break}return o<c?-1:c<o?1:0};a.prototype.includes=function(t,e,i){return this.indexOf(t,e,i)!==-1};a.prototype.indexOf=function(t,e,i){return Ge(this,t,e,i,!0)};a.prototype.lastIndexOf=function(t,e,i){return Ge(this,t,e,i,!1)};a.prototype.write=function(t,e,i,n){if(e===void 0)n="utf8",i=this.length,e=0;else if(i===void 0&&typeof e=="string")n=e,i=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(i)?(i=i|0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-e;if((i===void 0||i>s)&&(i=s),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return er(this,t,e,i);case"utf8":case"utf-8":return tr(this,t,e,i);case"ascii":return Je(this,t,e,i);case"latin1":case"binary":return rr(this,t,e,i);case"base64":return ir(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nr(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Fe=4096;a.prototype.slice=function(t,e){var i=this.length;t=~~t,e=e===void 0?i:~~e,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),e<t&&(e=t);var n;if(a.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=a.prototype;else{var s=e-t;n=new a(s,void 0);for(var o=0;o<s;++o)n[o]=this[o+t]}return n};a.prototype.readUIntLE=function(t,e,i){t=t|0,e=e|0,i||y(t,e,this.length);for(var n=this[t],s=1,o=0;++o<e&&(s*=256);)n+=this[t+o]*s;return n};a.prototype.readUIntBE=function(t,e,i){t=t|0,e=e|0,i||y(t,e,this.length);for(var n=this[t+--e],s=1;e>0&&(s*=256);)n+=this[t+--e]*s;return n};a.prototype.readUInt8=function(t,e){return e||y(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||y(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||y(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||y(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||y(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,i){t=t|0,e=e|0,i||y(t,e,this.length);for(var n=this[t],s=1,o=0;++o<e&&(s*=256);)n+=this[t+o]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*e)),n};a.prototype.readIntBE=function(t,e,i){t=t|0,e=e|0,i||y(t,e,this.length);for(var n=e,s=1,o=this[t+--n];n>0&&(s*=256);)o+=this[t+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};a.prototype.readInt8=function(t,e){return e||y(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||y(t,2,this.length);var i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};a.prototype.readInt16BE=function(t,e){e||y(t,2,this.length);var i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};a.prototype.readInt32LE=function(t,e){return e||y(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||y(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||y(t,4,this.length),Ae(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||y(t,4,this.length),Ae(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||y(t,8,this.length),Ae(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||y(t,8,this.length),Ae(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,i,n){if(t=+t,e=e|0,i=i|0,!n){var s=Math.pow(2,8*i)-1;A(this,t,e,i,s,0)}var o=1,c=0;for(this[e]=t&255;++c<i&&(o*=256);)this[e+c]=t/o&255;return e+i};a.prototype.writeUIntBE=function(t,e,i,n){if(t=+t,e=e|0,i=i|0,!n){var s=Math.pow(2,8*i)-1;A(this,t,e,i,s,0)}var o=i-1,c=1;for(this[e+o]=t&255;--o>=0&&(c*=256);)this[e+o]=t/c&255;return e+i};a.prototype.writeUInt8=function(t,e,i){return t=+t,e=e|0,i||A(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,i){return t=+t,e=e|0,i||A(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ye(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,i){return t=+t,e=e|0,i||A(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ye(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,i){return t=+t,e=e|0,i||A(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):ge(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,i){return t=+t,e=e|0,i||A(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):ge(this,t,e,!1),e+4};a.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e=e|0,!n){var s=Math.pow(2,8*i-1);A(this,t,e,i,s-1,-s)}var o=0,c=1,h=0;for(this[e]=t&255;++o<i&&(c*=256);)t<0&&h===0&&this[e+o-1]!==0&&(h=1),this[e+o]=(t/c>>0)-h&255;return e+i};a.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e=e|0,!n){var s=Math.pow(2,8*i-1);A(this,t,e,i,s-1,-s)}var o=i-1,c=1,h=0;for(this[e+o]=t&255;--o>=0&&(c*=256);)t<0&&h===0&&this[e+o+1]!==0&&(h=1),this[e+o]=(t/c>>0)-h&255;return e+i};a.prototype.writeInt8=function(t,e,i){return t=+t,e=e|0,i||A(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,i){return t=+t,e=e|0,i||A(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ye(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,i){return t=+t,e=e|0,i||A(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ye(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,i){return t=+t,e=e|0,i||A(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):ge(this,t,e,!0),e+4};a.prototype.writeInt32BE=function(t,e,i){return t=+t,e=e|0,i||A(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):ge(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,i){return je(this,t,e,!0,i)};a.prototype.writeFloatBE=function(t,e,i){return je(this,t,e,!1,i)};a.prototype.writeDoubleLE=function(t,e,i){return Xe(this,t,e,!0,i)};a.prototype.writeDoubleBE=function(t,e,i){return Xe(this,t,e,!1,i)};a.prototype.copy=function(t,e,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<i&&(n=i),n===i||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-i&&(n=t.length-e+i);var s=n-i,o;if(this===t&&i<e&&e<n)for(o=s-1;o>=0;--o)t[o+e]=this[o+i];else if(s<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+s),e);return s};a.prototype.fill=function(t,e,i,n){if(typeof t=="string"){if(typeof e=="string"?(n=e,e=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),t.length===1){var s=t.charCodeAt(0);s<256&&(t=s)}if(n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;e=e>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);var o;if(typeof t=="number")for(o=e;o<i;++o)this[o]=t;else{var c=k(t)?t:xe(new a(t,n).toString()),h=c.length;for(o=0;o<i-e;++o)this[o+e]=c[o%h]}return this};lr=/[^+\/0-9A-Za-z-_]/g});var l=Le(()=>{"use strict";tt()});u();l();function H(r){throw new Error("Unexpected value: "+JSON.stringify(r))}u();l();u();l();function Tr(r){return Object.keys(r)}var le={};xt(le,{Access:()=>W,Array:()=>Q,AstNode:()=>p,Attribute:()=>j,Class:()=>M,ClassInstantiation:()=>S,ClassReference:()=>g,CodeBlock:()=>T,DataClass:()=>Z,Enum:()=>K,Field:()=>ee,Map:()=>te,Method:()=>O,MethodInvocation:()=>D,Parameter:()=>$,Trait:()=>X,Type:()=>_,TypeLiteral:()=>I,Writer:()=>C,array:()=>kr,assignVariable:()=>Vr,attribute:()=>br,classReference:()=>Br,class_:()=>Cr,codeblock:()=>re,dataClass:()=>Ur,enum_:()=>Pr,field:()=>Mr,instantiateClass:()=>ct,invokeMethod:()=>$r,map:()=>Or,mergeArrays:()=>Gr,method:()=>Yr,parameter:()=>Fr,string:()=>qr,ternary:()=>Wr,this_:()=>Jr,throwException:()=>Dr,trait:()=>Sr,variable:()=>zr});u();l();u();l();u();l();var P=class{};u();l();u();l();var b=class extends P{constructor(e){super();f(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var Ar=4,fe=class{constructor(){f(this,"buffer","");f(this,"indentLevel",0);f(this,"hasWrittenAnything",!1);f(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
2
- `),i=e?t.substring(0,t.length-1):t,n=this.getIndentString(),s=i.replaceAll(`
3
- `,`
4
- ${n}`);this.isAtStartOfLine()&&(s=n+s),e&&(s+=`
5
- `),this.writeInternal(s)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new b(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new b(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new b(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new b(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}openBlock(t,e="{",i,n="}"){let s=t.filter(o=>o!==void 0).join(" ");s?this.write(`${s} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),i(),this.dedent()}finally{this.write(n!=null?n:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
- `)}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
- `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:i}){if(t.length>0){let n=t[0];n!=null&&i(n);for(let s=1;s<t.length;s++){this.write(e);let o=t[s];o!=null&&i(o)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
8
- `)),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*Ar)}};u();l();function be(r){return(r==null?void 0:r.name)!=null}u();l();var ce=class extends P{constructor({condition:e,true_:i,false_:n}){super();f(this,"condition");f(this,"true_");f(this,"false_");this.condition=e,this.true_=i,this.false_=n}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};u();l();u();l();var W={Public:"public",PublicReadonly:"public readonly",Protected:"protected",Private:"private"};u();l();u();l();u();l();u();l();var ue="",rt="self",it="static";function nt(r){return{namespace:r.substring(0,r.lastIndexOf("\\")),name:r.substring(r.lastIndexOf("\\")+1)}}var C=class extends fe{constructor({namespace:e,rootNamespace:i,customConfig:n}){super();f(this,"namespace");f(this,"rootNamespace");f(this,"customConfig");f(this,"references",{});this.namespace=e,this.rootNamespace=i,this.customConfig=n}addReference(e){var o,c;if(e.namespace==null)return;if(Object.keys(this.references).filter(h=>{let m=nt(h);return m.namespace!==e.namespace&&m.name===e.name}).length>0){e.requireFullyQualified();return}let n=e.namespace===ue?e.name:`${e.namespace}\\${e.name}`;((c=(o=this.references)[n])!=null?c:o[n]=[]).push(e)}toString(){let e=`namespace ${this.namespace};`,i=this.stringifyImports();return i.length>0?`${e}
9
-
10
- ${i}
11
-
12
- ${this.buffer}`:e+`
13
-
14
- `+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(i=>nt(i).namespace!==this.namespace).map(i=>`use ${i};`).join(`
15
- `)}};var p=class extends P{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:i,customConfig:n}=t,s=new C({namespace:e,rootNamespace:i,customConfig:n});return this.write(s),s.toString()}async toStringAsync({namespace:t,rootNamespace:e,customConfig:i}){let n=new C({namespace:t,rootNamespace:e,customConfig:i});return this.write(n),n.toString()}};var Q=class extends p{constructor({entries:e}){super();f(this,"entries");this.entries=e!=null?e:[]}write(e){e.write("["),this.entries.forEach((i,n)=>{n>0&&e.write(", "),i.write(e)}),e.write("]")}};u();l();var j=class extends p{constructor(e){var i;super();f(this,"reference");f(this,"arguments");this.reference=e.reference,this.arguments=(i=e.arguments)!=null?i:[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((i,n)=>{n>0&&e.write(","),typeof i=="string"?e.write(i):i.write(e)}),e.write(")"))}};u();l();u();l();var g=class extends p{constructor({name:e,namespace:i,generics:n}){super();f(this,"name");f(this,"namespace");f(this,"generics");f(this,"fullyQualified");this.name=e,this.namespace=i,this.generics=n,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let i=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${i}`)}};u();l();u();l();function V(r){return r.startsWith("$")?r:`$${r}`}var v=class extends p{constructor({docs:e}={}){super();f(this,"docs");f(this,"tags",[]);this.docs=e}addTag(e){this.tags.push(me(pe({},e),{name:e.name!=null?V(e.name):void 0}))}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
16
- `).forEach(i=>{e.writeLine(` * ${i}`)}),this.tags.length>0&&e.writeLine(" *"));for(let i of this.tags)this.writeTag({writer:e,tag:i});e.writeLine(" */")}writeTag({writer:e,tag:i}){let n=i.docs!=null?i.docs.split(`
17
- `):void 0;n!=null&&n.length>1&&(n.forEach(s=>{e.writeLine(` * ${s}`)}),e.writeLine(" *")),e.write(` * @${i.tagType} `),i.type.write(e,{comment:!0}),i.name!=null&&e.write(` ${i.name}`),n!=null&&n.length===1&&e.write(` ${n[0]}`),e.newLine()}};u();l();function z(r){return Er(r,[W.Public,W.PublicReadonly,W.Protected,W.Private])}function Er(r,t){return t.reduce((e,i)=>[...e,...r.filter(n=>n.access===i)],[])}var M=class extends p{constructor({name:e,namespace:i,abstract:n,docs:s,parentClassReference:o,traits:c}){super();f(this,"name");f(this,"namespace");f(this,"abstract");f(this,"docs");f(this,"parentClassReference");f(this,"traits");f(this,"fields",[]);f(this,"methods",[]);f(this,"constructor_");this.name=e,this.namespace=i,this.abstract=n!=null?n:!1,this.docs=s,this.parentClassReference=o,this.traits=c!=null?c:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addMethods(e){this.methods.push(...e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new g({name:this.name,namespace:this.namespace})),this.abstract&&e.write("abstract "),this.writeComment(e),e.write(`class ${this.name} `),this.parentClassReference!=null&&(e.write("extends "),this.parentClassReference.write(e)),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((i,n)=>{n>0&&e.write(","),e.writeNode(i)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:z(this.fields)}),(this.constructor!=null||this.methods.length>0)&&e.newLine(),this.constructor_!=null&&(this.writeConstructor({writer:e,constructor:this.constructor_}),this.methods.length>0&&e.newLine()),this.writeMethods({writer:e,methods:z(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new v({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:i}){var n;this.writeConstructorComment({writer:e,constructor:i}),i.access!=null&&e.write(`${i.access} `),e.write("function __construct("),e.indent(),i.parameters.forEach((s,o)=>{o===0&&e.newLine(),s.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),(n=i.body)==null||n.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:i}){if(i.parameters.length===0)return;let n=new v;for(let s of i.parameters)n.addTag(s.getCommentTag());n.write(e)}writeFields({writer:e,fields:i}){i.filter(n=>!n.inherited).forEach((n,s)=>{s>0&&e.newLine(),n.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:i}){i.forEach((n,s)=>{s>0&&e.newLine(),n.write(e),e.writeNewLineIfLastLineNot()})}};u();l();var X=class extends p{constructor({name:e,namespace:i,docs:n,traits:s}){super();f(this,"name");f(this,"namespace");f(this,"docs");f(this,"traits");f(this,"fields",[]);f(this,"methods",[]);this.name=e,this.namespace=i,this.docs=n,this.traits=s!=null?s:[]}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}write(e){this.writeComment(e),e.write(`trait ${this.name} `),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((i,n)=>{n>0&&e.write(","),e.writeNode(i)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:z(this.fields)}),this.fields.length>0&&this.methods.length>0&&e.newLine(),this.writeMethods({writer:e,methods:z(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){let i=new v({docs:this.docs});for(let n of this.fields)i.addTag({tagType:"property",type:n.type,name:n.name});i.write(e)}writeFields({writer:e,fields:i}){i.forEach((n,s)=>{s>0&&e.newLine(),n.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:i}){i.forEach((n,s)=>{s>0&&e.newLine(),n.write(e),e.writeNewLineIfLastLineNot()})}};u();l();u();l();function oe({writer:r,arguments_:t,multiline:e}){if(t.length===0){r.write("()");return}if(e){vr({writer:r,arguments_:t});return}Nr({writer:r,arguments_:t})}function vr({writer:r,arguments_:t}){r.writeLine("("),r.indent();for(let e of t)st({writer:r,argument:e,writeCompact:!1}),r.writeLine(",");r.dedent(),r.write(")")}function Nr({writer:r,arguments_:t}){r.write("("),t.forEach((e,i)=>{i>0&&r.write(", "),st({writer:r,argument:e,writeCompact:!0})}),r.write(")")}function st({writer:r,argument:t,writeCompact:e}){be(t)?(t.docs&&(e?r.write(`/* ${t.docs} */ `):r.writeLine(`/* ${t.docs} */`)),r.write(`${t.name}: `),r.writeNodeOrString(t.assignment)):t.write(r)}var S=class extends p{constructor({classReference:e,arguments_:i,multiline:n}){super();f(this,"classReference");f(this,"arguments_");f(this,"multiline");this.classReference=e,this.arguments_=i,this.multiline=n!=null?n:!1}write(e){e.write("new "),e.writeNode(this.classReference),oe({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};u();l();var T=class extends p{constructor(e){super();f(this,"arg");this.arg=e}write(e){return new b(this.arg).write(e)}};u();l();u();l();u();l();var $=class extends p{constructor({name:e,type:i,docs:n,initializer:s,access:o,readonly_:c}){super();f(this,"name");f(this,"type");f(this,"docs");f(this,"initializer");f(this,"access");f(this,"readonly_");this.name=V(e),this.type=i,this.docs=n,this.initializer=s,this.access=o,this.readonly_=c!=null?c:!1}getCommentTag(){return{tagType:"param",type:this.type,name:this.name,docs:this.docs}}write(e){this.access!=null&&e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null?(e.write(" = "),this.initializer.write(e)):this.type.isOptional()&&e.write(" = null")}};u();l();u();l();u();l();var D=class extends p{constructor({method:e,arguments_:i,static_:n,multiline:s,on:o}){super();f(this,"method");f(this,"arguments_");f(this,"multiline");f(this,"static_");f(this,"on");this.method=e,this.arguments_=i,this.static_=n!=null?n:!1,this.multiline=s!=null?s:!1,this.on=o}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),oe({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};u();l();var I=class r extends p{constructor(e){super();f(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"list":{this.writeList({writer:e,list:this.internalType});break}case"boolean":{e.write(this.internalType.value.toString());break}case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"file":{e.writeNode(Ir({writer:e,value:this.internalType.value}));break}case"float":{e.write(this.internalType.value.toString());break}case"number":{e.write(this.internalType.value.toString());break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"datetime":{e.writeNode(Lr({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
18
- `)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}if(this.internalType.value.includes("'")){e.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}e.write(`'${this.internalType.value}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:H(this.internalType)}}isClass(){return this.internalType.type==="class"}asClassOrThrow(){if(this.isClass())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a class")}writeStringWithHeredoc({writer:e,value:i}){e.writeLine("<<<EOT"),e.writeNoIndent(i),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:i}){e.writeNode(new S({classReference:i.reference,arguments_:[r.map({entries:i.fields.map(n=>({key:r.string(n.name),value:n.value}))})]}))}writeList({writer:e,list:i}){let n=Rr({values:i.values});if(n.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let s of n)s.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:i}){let n=_r({entries:i.entries});if(n.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let s of n)s.key.write(e),e.write(" => "),s.value.write(e),e.writeLine(",");e.dedent(),e.write("]")}static list({values:e}){return new this({type:"list",values:e})}static boolean(e){return new this({type:"boolean",value:e})}static class_({reference:e,fields:i}){return new this({type:"class",reference:e,fields:i})}static file(e){return new this({type:"file",value:e})}static float(e){return new this({type:"float",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static map({entries:e}){return new this({type:"map",entries:e})}static reference(e){return new this({type:"reference",value:e})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:i}){switch(typeof i){case"boolean":e.write(i.toString());return;case"string":e.write(i.includes('"')?`\`${i}\``:`"${i}"`);return;case"number":e.write(i.toString());return;case"object":if(i==null){e.write("null");return}if(Array.isArray(i)){this.writeUnknownArray({writer:e,value:i});return}this.writeUnknownMap({writer:e,value:i});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof i}`)}}writeUnknownArray({writer:e,value:i}){if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let n of i)e.writeNode(r.unknown(n)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:i}){let n=Object.entries(i);if(n.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[s,o]of n)e.write(`'${s}' => `),e.writeNode(r.unknown(o)),e.writeLine(",");e.dedent(),e.write("]")}};function Lr({writer:r,value:t}){return new S({classReference:new g({name:"DateTime",namespace:""}),arguments_:[new T(`'${t}'`)]})}function Ir({writer:r,value:t}){return new D({on:new g({name:"File",namespace:`${r.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new T(`"${t}"`)]})}function _r({entries:r}){return r.filter(t=>!I.isNop(t.key)&&!I.isNop(t.value))}function Rr({values:r}){return r.filter(t=>!I.isNop(t))}var _=class r extends p{constructor(e){super();f(this,"internalType");this.internalType=e}write(e,{comment:i}={}){switch(this.internalType.type){case"int":e.write("int");break;case"string":e.write("string");break;case"bool":e.write("bool");break;case"float":e.write("float");break;case"date":e.addReference(ot),e.write("DateTime");break;case"dateTime":e.addReference(ot),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!i){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:i}),e.write(">");break;case"map":{if(!i){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:i}),e.write(", "),this.internalType.valueType.write(e,{comment:i}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!i){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");let n=this.internalType.entries.filter(c=>!c.valueType.isOptional()),s=this.internalType.entries.filter(c=>c.valueType.isOptional()),o=[...n,...s];for(let c of o)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:c,comment:i}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((n,s)=>{s>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:n,comment:i})}),e.write("}");break}case"union":{let n=this.getUniqueTypes({types:this.internalType.types,comment:i,writer:e}),s=n.filter(o=>o.underlyingType().internalType.type==="mixed").length>0;if(s&&!i){e.write("mixed");break}n.length>0&&i?(e.writeLine("("),n.forEach((o,c)=>{c>0?e.write(" * |"):e.write(" * "),s&&(o=o.underlyingType()),o.write(e,{comment:i}),e.writeLine(),c++}),e.write(" * )")):n.forEach((o,c)=>{c>0&&e.write("|"),s&&(o=o.underlyingType()),o.write(e,{comment:i}),c++});break}case"optional":{let n=this.internalType.value.internalType.type==="mixed",s=this.internalType.value.internalType.type==="union";!s&&!n&&e.write("?"),this.internalType.value.write(e,{comment:i}),s&&(e.write("|"),e.writeNode(r.null()));break}case"reference":if(i){e.writeNode(this.internalType.value);let n=this.internalType.value.generics;n&&n.length>0&&(e.write("<"),n.forEach((s,o)=>{o>0&&e.write(", "),s.write(e,{comment:i})}),e.write(">"))}else e.writeNode(this.internalType.value);break;case"enumString":i?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;case"literal":if(i)e.writeNode(this.internalType.value);else switch(this.internalType.value.internalType.type){case"string":e.write("string");break;case"boolean":e.write("bool");break;default:H(this.internalType.value.internalType)}break;default:H(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:r.optional(this)}underlyingTypeIfOptional(){if(this.internalType.type==="optional")return this.internalType.value}underlyingType(){var e;return(e=this.underlyingTypeIfOptional())!=null?e:this}isOptional(){return this.internalType.type==="optional"}getClassReference(){switch(this.internalType.type){case"date":case"dateTime":return new g({name:"DateTime",namespace:ue});case"enumString":case"reference":return this.internalType.value;case"int":case"string":case"bool":case"float":case"object":case"map":case"array":case"null":case"mixed":case"optional":case"typeDict":case"union":case"literal":throw new Error("Cannot get class reference for "+this.internalType.type);default:H(this.internalType)}}static int(){return new this({type:"int"})}static string(){return new this({type:"string"})}static bool(){return new this({type:"bool"})}static float(){return new this({type:"float"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static mixed(){return new this({type:"mixed"})}static object(){return new this({type:"object"})}static array(e){return new this({type:"array",value:e})}static map(e,i){return new this({type:"map",keyType:e,valueType:i})}static typeDict(e,{multiline:i}={}){return new this({type:"typeDict",entries:e,multiline:i})}static union(e){return new this({type:"union",types:e})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static null(){return new this({type:"null"})}static reference(e){return new this({type:"reference",value:e})}static enumString(e){return new this({type:"enumString",value:e})}static literalString(e){return new this({type:"literal",value:I.string(e)})}static literalBoolean(e){return new this({type:"literal",value:I.boolean(e)})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeTypeDictEntry({writer:e,entry:i,comment:n}){e.write(i.key),i.optional&&e.write("?"),e.write(": "),i.valueType.write(e,{comment:n})}getUniqueTypes({writer:e,types:i,comment:n}){let s=new Set;return i.filter(o=>{let c=o.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig,comment:n});return s.has(c)?!1:(s.add(c),!0)})}toString({namespace:e,rootNamespace:i,customConfig:n,comment:s}){let o=new C({namespace:e,rootNamespace:i,customConfig:n});return this.write(o,{comment:s!=null?s:!1}),o.toString()}},ot=new g({namespace:ue,name:"DateTime"});u();l();function at(r){return r.startsWith("$")?r.slice(1):r}var ft="values",Z=class extends p{constructor({name:e,namespace:i,abstract:n,docs:s,parentClassReference:o,traits:c,constructorAccess:h}){super();f(this,"name");f(this,"namespace");f(this,"constructorAccess");f(this,"class_");this.name=e,this.namespace=i,this.constructorAccess=h!=null?h:"public",this.class_=new M({name:e,namespace:i,abstract:n,docs:s,parentClassReference:o,traits:c})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let i=z(this.class_.fields).map(n=>me(pe({},n),{name:at(n.name)}));i.length>0&&this.class_.addConstructor({access:this.constructorAccess,parameters:this.getConstructorParameters({orderedFields:i}),body:le.codeblock(n=>{for(let s of i)n.write(`$this->${s.name} = $${ft}['${s.name}']`),s.type.isOptional()&&n.write(" ?? null"),n.write(";")})}),this.class_.write(e)}allFieldsAreOptional(){return this.class_.fields.every(e=>e.type.isOptional())}getConstructorParameters({orderedFields:e}){return[new $({name:ft,type:_.typeDict(e.map(i=>({key:i.name,valueType:i.type,optional:i.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new T("[]"):void 0})]}};u();l();u();l();var O=class extends p{constructor({name:e,access:i,parameters:n,throws:s,return_:o,body:c,docs:h,classReference:m,static_:w}){super();f(this,"name");f(this,"access");f(this,"parameters");f(this,"throws");f(this,"return_");f(this,"body");f(this,"docs");f(this,"classReference");f(this,"static_");this.name=e,this.access=i,this.parameters=n,this.throws=s!=null?s:[],this.return_=o,this.body=c,this.docs=h,this.classReference=m,this.static_=w!=null?w:!1}write(e){var o;this.writeComment(e),e.write(`${this.access}${this.static_?" static":""} function ${this.name}(`);let i=this.parameters.filter(c=>!c.type.isOptional()),n=this.parameters.filter(c=>c.type.isOptional());[...i,...n].forEach((c,h)=>{h>0&&e.write(", "),c.write(e)}),e.write("): "),this.return_!=null?e.writeNodeOrString(this.return_):e.write("void"),e.writeLine(" {"),e.indent(),(o=this.body)==null||o.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let i=new v({docs:this.docs});for(let n of this.parameters)i.addTag({tagType:"param",type:n.type,name:n.name,docs:n.docs});this.return_!=null&&this.return_!==rt&&this.return_!==it&&i.addTag({tagType:"return",type:this.return_});for(let n of this.throws)i.addTag({tagType:"throws",type:_.reference(n)});e.writeNode(i)}};var K=class extends p{constructor({name:e,namespace:i,backing:n,docs:s,serializable:o}){super();f(this,"name");f(this,"namespace");f(this,"backing");f(this,"docs");f(this,"members",[]);f(this,"serializable");this.name=e,this.namespace=i,this.backing=n,this.docs=s,this.serializable=o!=null?o:!1}addMember(e){this.members.push(e)}write(e){this.writeComment(e),e.write("enum "),e.writeLine(`${this.name}`),this.backing!=null&&e.write(` : ${this.backing}`),this.serializable&&(e.addReference(new g({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let i of this.members)e.write(`case ${i.name}`),i.value!=null&&(typeof i.value=="string"?e.write(` = "${i.value}"`):e.write(` = ${i.value}`)),e.writeTextStatement("");this.serializable&&(e.newLine(),e.writeNode(new O({name:"jsonSerialize",return_:_.string(),access:"public",parameters:[],body:new T("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new v({docs:this.docs}).write(e)}};u();l();var ee=class extends p{constructor({name:e,type:i,access:n,readonly_:s,initializer:o,docs:c,inlineDocs:h,attributes:m,inherited:w}){super();f(this,"name");f(this,"type");f(this,"access");f(this,"readonly_");f(this,"initializer");f(this,"docs");f(this,"inlineDocs");f(this,"attributes");f(this,"inherited");this.name=V(e),this.type=i,this.access=n,this.readonly_=s!=null?s:!1,this.initializer=o,this.docs=c,this.inlineDocs=h,this.attributes=m!=null?m:[],this.inherited=w!=null?w:!1}write(e){this.writeComment(e),this.writeAttributesIfPresent(e),e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null&&(e.write(" = "),this.initializer.write(e)),e.write(";"),this.inlineDocs!=null&&e.write(` // ${this.inlineDocs}`),e.newLine()}writeComment(e){let i=new v;i.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),i.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((i,n)=>{n>0&&e.write(", "),i.write(e)}),e.writeLine("]"))}};u();l();var te=class extends p{constructor({entries:e,multiline:i}){super();f(this,"entries");f(this,"multiline");this.entries=e!=null?e:[],this.multiline=i!=null?i:!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:i,value:n}of this.entries)i.write(e),e.write(" => "),n.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[i,{key:n,value:s}]of this.entries.entries())i>0&&e.write(", "),n.write(e),e.write(" => "),s.write(e);e.write("]")}};u();l();var Ee=class extends p{constructor(e){super();f(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),oe({writer:e,arguments_:this.arrays.map(i=>re(n=>{if(typeof i=="string"||i instanceof p){n.writeNodeOrString(i);return}n.writeNodeOrString(i.ref),i.fallback&&(n.write(" ?? "),n.writeNodeOrString(i.fallback))}))})}};function kr(r){return new Q(r)}function br(r){return new j(r)}function Cr(r){return new M(r)}function Sr(r){return new X(r)}function Br(r){return new g(r)}function re(r){return new T(r)}function Ur(r){return new Z(r)}function Pr(r){return new K(r)}function Mr(r){return new ee(r)}function ct(r){return new S(r)}function $r(r){return new D(r)}function Dr(r){return re(t=>{t.write("throw "),t.writeNode(ct(r))})}function Or(r){return new te(r)}function Yr(r){return new O(r)}function Fr(r){return new $(r)}function Wr(r){return new ce(r)}function Vr(r,t){return re(e=>{e.writeNodeOrString(r),e.write(" = "),e.writeNodeOrString(t)})}function zr(r){return re(V(r))}function qr(r){return re(`"${r}"`)}function Gr(...r){return new Ee(r)}function Jr(){return new T(r=>{r.write("$this")})}export{pe as a,me as b,Hr as c,Qr as d,Le as e,jr as f,xt as g,Xr as h,Zr as i,f as j,u as k,a as l,l as m,H as n,Tr as o,le as p};
19
- /*! Bundled license information:
20
-
21
- @esbuild-plugins/node-globals-polyfill/Buffer.js:
22
- (*!
23
- * The buffer module from node.js, for the browser.
24
- *
25
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
26
- * @license MIT
27
- *)
28
- */