@barndoor-ai/sdk 1.3.0 → 2.0.0-dev.g37b8897

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 (1188) hide show
  1. package/README.md +98 -254
  2. package/dist/apis/DlpApi.d.ts +666 -0
  3. package/dist/apis/DlpApi.js +1983 -0
  4. package/dist/apis/IdentityApi.d.ts +168 -0
  5. package/dist/apis/IdentityApi.js +545 -0
  6. package/dist/apis/LlmGatewayApi.d.ts +1250 -0
  7. package/dist/apis/LlmGatewayApi.js +3724 -0
  8. package/dist/apis/NotificationApi.d.ts +145 -0
  9. package/dist/apis/NotificationApi.js +442 -0
  10. package/dist/apis/PolicyApi.d.ts +510 -0
  11. package/dist/apis/PolicyApi.js +1213 -0
  12. package/dist/apis/RegistryApi.d.ts +594 -0
  13. package/dist/apis/RegistryApi.js +1387 -0
  14. package/dist/apis/SystemManagementApi.d.ts +265 -0
  15. package/dist/apis/SystemManagementApi.js +661 -0
  16. package/dist/apis/index.d.ts +7 -0
  17. package/dist/apis/index.js +25 -0
  18. package/dist/esm/apis/DlpApi.d.ts +666 -0
  19. package/dist/esm/apis/DlpApi.js +1946 -0
  20. package/dist/esm/apis/IdentityApi.d.ts +168 -0
  21. package/dist/esm/apis/IdentityApi.js +508 -0
  22. package/dist/esm/apis/LlmGatewayApi.d.ts +1250 -0
  23. package/dist/esm/apis/LlmGatewayApi.js +3687 -0
  24. package/dist/esm/apis/NotificationApi.d.ts +145 -0
  25. package/dist/esm/apis/NotificationApi.js +405 -0
  26. package/dist/esm/apis/PolicyApi.d.ts +510 -0
  27. package/dist/esm/apis/PolicyApi.js +1176 -0
  28. package/dist/esm/apis/RegistryApi.d.ts +594 -0
  29. package/dist/esm/apis/RegistryApi.js +1350 -0
  30. package/dist/esm/apis/SystemManagementApi.d.ts +265 -0
  31. package/dist/esm/apis/SystemManagementApi.js +624 -0
  32. package/dist/esm/apis/index.d.ts +7 -0
  33. package/dist/esm/apis/index.js +9 -0
  34. package/dist/esm/index.d.ts +4 -0
  35. package/dist/esm/index.js +6 -0
  36. package/dist/esm/lib/auth.d.ts +95 -0
  37. package/dist/esm/lib/auth.js +175 -0
  38. package/dist/esm/lib/cli.d.ts +44 -0
  39. package/dist/esm/lib/cli.js +89 -0
  40. package/dist/esm/lib/client.d.ts +51 -0
  41. package/dist/esm/lib/client.js +45 -0
  42. package/dist/esm/lib/config.d.ts +14 -0
  43. package/dist/esm/lib/config.js +62 -0
  44. package/dist/esm/lib/http.d.ts +23 -0
  45. package/dist/esm/lib/http.js +80 -0
  46. package/dist/esm/lib/index.d.ts +15 -0
  47. package/dist/esm/lib/index.js +15 -0
  48. package/dist/esm/lib/mcp.d.ts +41 -0
  49. package/dist/esm/lib/mcp.js +78 -0
  50. package/dist/esm/models/AWSTrustInfoResponse.d.ts +34 -0
  51. package/dist/esm/models/AWSTrustInfoResponse.js +47 -0
  52. package/dist/esm/models/AddRouteGroupMembersRequest.d.ts +36 -0
  53. package/dist/esm/models/AddRouteGroupMembersRequest.js +45 -0
  54. package/dist/esm/models/AdminModelPricing.d.ts +133 -0
  55. package/dist/esm/models/AdminModelPricing.js +101 -0
  56. package/dist/esm/models/AffectedPoliciesResponse.d.ts +48 -0
  57. package/dist/esm/models/AffectedPoliciesResponse.js +52 -0
  58. package/dist/esm/models/AffectedPolicyPreview.d.ts +49 -0
  59. package/dist/esm/models/AffectedPolicyPreview.js +57 -0
  60. package/dist/esm/models/AgentPolicyCounts.d.ts +36 -0
  61. package/dist/esm/models/AgentPolicyCounts.js +43 -0
  62. package/dist/esm/models/AgentRuntimeCapabilities.d.ts +85 -0
  63. package/dist/esm/models/AgentRuntimeCapabilities.js +67 -0
  64. package/dist/esm/models/AgentRuntimeProfile.d.ts +77 -0
  65. package/dist/esm/models/AgentRuntimeProfile.js +89 -0
  66. package/dist/esm/models/AgentType.d.ts +25 -0
  67. package/dist/esm/models/AgentType.js +43 -0
  68. package/dist/esm/models/AlertType.d.ts +44 -0
  69. package/dist/esm/models/AlertType.js +62 -0
  70. package/dist/esm/models/AlertTypeOption.d.ts +42 -0
  71. package/dist/esm/models/AlertTypeOption.js +55 -0
  72. package/dist/esm/models/AllowListEntryResponse.d.ts +58 -0
  73. package/dist/esm/models/AllowListEntryResponse.js +71 -0
  74. package/dist/esm/models/ApiKey.d.ts +89 -0
  75. package/dist/esm/models/ApiKey.js +85 -0
  76. package/dist/esm/models/ApiKeyDisabledResponse.d.ts +30 -0
  77. package/dist/esm/models/ApiKeyDisabledResponse.js +43 -0
  78. package/dist/esm/models/ApiKeyKind.d.ts +36 -0
  79. package/dist/esm/models/ApiKeyKind.js +54 -0
  80. package/dist/esm/models/AppType.d.ts +30 -0
  81. package/dist/esm/models/AppType.js +48 -0
  82. package/dist/esm/models/Application.d.ts +58 -0
  83. package/dist/esm/models/Application.js +72 -0
  84. package/dist/esm/models/ApplicationCounts.d.ts +38 -0
  85. package/dist/esm/models/ApplicationCounts.js +51 -0
  86. package/dist/esm/models/ApplicationDirectoryBase.d.ts +87 -0
  87. package/dist/esm/models/ApplicationDirectoryBase.js +101 -0
  88. package/dist/esm/models/ApplicationDirectoryResponse.d.ts +92 -0
  89. package/dist/esm/models/ApplicationDirectoryResponse.js +106 -0
  90. package/dist/esm/models/ApplicationLlmGatewayPayload.d.ts +30 -0
  91. package/dist/esm/models/ApplicationLlmGatewayPayload.js +43 -0
  92. package/dist/esm/models/ApplicationPayload.d.ts +38 -0
  93. package/dist/esm/models/ApplicationPayload.js +47 -0
  94. package/dist/esm/models/ApplicationResponse.d.ts +68 -0
  95. package/dist/esm/models/ApplicationResponse.js +81 -0
  96. package/dist/esm/models/ApplicationWriteConfirmationsPayload.d.ts +30 -0
  97. package/dist/esm/models/ApplicationWriteConfirmationsPayload.js +43 -0
  98. package/dist/esm/models/ArchivePricingResponse.d.ts +45 -0
  99. package/dist/esm/models/ArchivePricingResponse.js +55 -0
  100. package/dist/esm/models/AttentionTier.d.ts +34 -0
  101. package/dist/esm/models/AttentionTier.js +52 -0
  102. package/dist/esm/models/AutoDisabledReason.d.ts +27 -0
  103. package/dist/esm/models/AutoDisabledReason.js +45 -0
  104. package/dist/esm/models/AwsBedrockGuardrailsConnectionResponse.d.ts +66 -0
  105. package/dist/esm/models/AwsBedrockGuardrailsConnectionResponse.js +71 -0
  106. package/dist/esm/models/AwsComprehendPiiConnectionResponse.d.ts +62 -0
  107. package/dist/esm/models/AwsComprehendPiiConnectionResponse.js +67 -0
  108. package/dist/esm/models/AwsRoleConfigResponse.d.ts +34 -0
  109. package/dist/esm/models/AwsRoleConfigResponse.js +45 -0
  110. package/dist/esm/models/AwsRoleValidationResponse.d.ts +31 -0
  111. package/dist/esm/models/AwsRoleValidationResponse.js +43 -0
  112. package/dist/esm/models/AzureAiLanguagePiiConnectionResponse.d.ts +46 -0
  113. package/dist/esm/models/AzureAiLanguagePiiConnectionResponse.js +59 -0
  114. package/dist/esm/models/AzureContentSafetyConnectionResponse.d.ts +46 -0
  115. package/dist/esm/models/AzureContentSafetyConnectionResponse.js +59 -0
  116. package/dist/esm/models/BillingMode.d.ts +36 -0
  117. package/dist/esm/models/BillingMode.js +54 -0
  118. package/dist/esm/models/BillingReason.d.ts +42 -0
  119. package/dist/esm/models/BillingReason.js +60 -0
  120. package/dist/esm/models/BudgetAction.d.ts +26 -0
  121. package/dist/esm/models/BudgetAction.js +44 -0
  122. package/dist/esm/models/BudgetLimitKind.d.ts +25 -0
  123. package/dist/esm/models/BudgetLimitKind.js +43 -0
  124. package/dist/esm/models/BudgetPeriod.d.ts +33 -0
  125. package/dist/esm/models/BudgetPeriod.js +51 -0
  126. package/dist/esm/models/BudgetTargetKind.d.ts +28 -0
  127. package/dist/esm/models/BudgetTargetKind.js +46 -0
  128. package/dist/esm/models/BudgetTargetStatus.d.ts +58 -0
  129. package/dist/esm/models/BudgetTargetStatus.js +69 -0
  130. package/dist/esm/models/ChangeAttribution.d.ts +73 -0
  131. package/dist/esm/models/ChangeAttribution.js +56 -0
  132. package/dist/esm/models/ChannelListResponse.d.ts +32 -0
  133. package/dist/esm/models/ChannelListResponse.js +44 -0
  134. package/dist/esm/models/ChannelOptionsResponse.d.ts +43 -0
  135. package/dist/esm/models/ChannelOptionsResponse.js +53 -0
  136. package/dist/esm/models/ChannelResponse.d.ts +87 -0
  137. package/dist/esm/models/ChannelResponse.js +92 -0
  138. package/dist/esm/models/ChannelSubscription.d.ts +31 -0
  139. package/dist/esm/models/ChannelSubscription.js +44 -0
  140. package/dist/esm/models/ChannelSubscriptionInput.d.ts +38 -0
  141. package/dist/esm/models/ChannelSubscriptionInput.js +44 -0
  142. package/dist/esm/models/ChannelTestResponse.d.ts +37 -0
  143. package/dist/esm/models/ChannelTestResponse.js +45 -0
  144. package/dist/esm/models/ChannelType.d.ts +49 -0
  145. package/dist/esm/models/ChannelType.js +67 -0
  146. package/dist/esm/models/ChannelUpsertRequest.d.ts +86 -0
  147. package/dist/esm/models/ChannelUpsertRequest.js +61 -0
  148. package/dist/esm/models/ConditionOfInput.d.ts +31 -0
  149. package/dist/esm/models/ConditionOfInput.js +44 -0
  150. package/dist/esm/models/ConditionOfOutput.d.ts +31 -0
  151. package/dist/esm/models/ConditionOfOutput.js +44 -0
  152. package/dist/esm/models/ConfigureDestinationRequest.d.ts +78 -0
  153. package/dist/esm/models/ConfigureDestinationRequest.js +65 -0
  154. package/dist/esm/models/Connection.d.ts +126 -0
  155. package/dist/esm/models/Connection.js +102 -0
  156. package/dist/esm/models/ConnectionInitiateResponse.d.ts +42 -0
  157. package/dist/esm/models/ConnectionInitiateResponse.js +53 -0
  158. package/dist/esm/models/ConnectionRead.d.ts +58 -0
  159. package/dist/esm/models/ConnectionRead.js +64 -0
  160. package/dist/esm/models/ConnectionStatus.d.ts +26 -0
  161. package/dist/esm/models/ConnectionStatus.js +31 -0
  162. package/dist/esm/models/CreateAllowListEntryRequest.d.ts +42 -0
  163. package/dist/esm/models/CreateAllowListEntryRequest.js +51 -0
  164. package/dist/esm/models/CreateApiKeyRequest.d.ts +51 -0
  165. package/dist/esm/models/CreateApiKeyRequest.js +54 -0
  166. package/dist/esm/models/CreateApiKeyResponse.d.ts +58 -0
  167. package/dist/esm/models/CreateApiKeyResponse.js +68 -0
  168. package/dist/esm/models/CreateBudgetRequest.d.ts +110 -0
  169. package/dist/esm/models/CreateBudgetRequest.js +81 -0
  170. package/dist/esm/models/CreateConnectionRequest.d.ts +61 -0
  171. package/dist/esm/models/CreateConnectionRequest.js +61 -0
  172. package/dist/esm/models/CreateCustomDetectionTypeRequest.d.ts +47 -0
  173. package/dist/esm/models/CreateCustomDetectionTypeRequest.js +54 -0
  174. package/dist/esm/models/CreateDetectionEngineRequest.d.ts +46 -0
  175. package/dist/esm/models/CreateDetectionEngineRequest.js +53 -0
  176. package/dist/esm/models/CreateEnforcementPolicyRequest.d.ts +77 -0
  177. package/dist/esm/models/CreateEnforcementPolicyRequest.js +70 -0
  178. package/dist/esm/models/CreateModelAccessRequest.d.ts +60 -0
  179. package/dist/esm/models/CreateModelAccessRequest.js +64 -0
  180. package/dist/esm/models/CreateModelMappingRequest.d.ts +103 -0
  181. package/dist/esm/models/CreateModelMappingRequest.js +70 -0
  182. package/dist/esm/models/CreatePolicy.d.ts +60 -0
  183. package/dist/esm/models/CreatePolicy.js +61 -0
  184. package/dist/esm/models/CreatePricingRequest.d.ts +88 -0
  185. package/dist/esm/models/CreatePricingRequest.js +72 -0
  186. package/dist/esm/models/CreateProfileRequest.d.ts +49 -0
  187. package/dist/esm/models/CreateProfileRequest.js +58 -0
  188. package/dist/esm/models/CreateProviderRequest.d.ts +124 -0
  189. package/dist/esm/models/CreateProviderRequest.js +84 -0
  190. package/dist/esm/models/CreateRateLimitRequest.d.ts +95 -0
  191. package/dist/esm/models/CreateRateLimitRequest.js +69 -0
  192. package/dist/esm/models/CreateRouteGroupRequest.d.ts +46 -0
  193. package/dist/esm/models/CreateRouteGroupRequest.js +49 -0
  194. package/dist/esm/models/CredentialsPayload.d.ts +52 -0
  195. package/dist/esm/models/CredentialsPayload.js +51 -0
  196. package/dist/esm/models/CustomDetectionPatternRequest.d.ts +34 -0
  197. package/dist/esm/models/CustomDetectionPatternRequest.js +47 -0
  198. package/dist/esm/models/CustomDetectionPatternResponse.d.ts +34 -0
  199. package/dist/esm/models/CustomDetectionPatternResponse.js +47 -0
  200. package/dist/esm/models/CustomDetectionTypeResponse.d.ts +71 -0
  201. package/dist/esm/models/CustomDetectionTypeResponse.js +84 -0
  202. package/dist/esm/models/CustomDetectionTypesResponse.d.ts +31 -0
  203. package/dist/esm/models/CustomDetectionTypesResponse.js +44 -0
  204. package/dist/esm/models/DefaultModelAccess.d.ts +35 -0
  205. package/dist/esm/models/DefaultModelAccess.js +53 -0
  206. package/dist/esm/models/DefaultPricingEntry.d.ts +81 -0
  207. package/dist/esm/models/DefaultPricingEntry.js +78 -0
  208. package/dist/esm/models/DeletedResponse.d.ts +35 -0
  209. package/dist/esm/models/DeletedResponse.js +43 -0
  210. package/dist/esm/models/DestinationResponse.d.ts +48 -0
  211. package/dist/esm/models/DestinationResponse.js +61 -0
  212. package/dist/esm/models/DetectionEngineCapabilitiesResponse.d.ts +62 -0
  213. package/dist/esm/models/DetectionEngineCapabilitiesResponse.js +75 -0
  214. package/dist/esm/models/DetectionEngineResponse.d.ts +93 -0
  215. package/dist/esm/models/DetectionEngineResponse.js +99 -0
  216. package/dist/esm/models/DetectionTypeInfoResponse.d.ts +59 -0
  217. package/dist/esm/models/DetectionTypeInfoResponse.js +71 -0
  218. package/dist/esm/models/DetectionTypesResponse.d.ts +31 -0
  219. package/dist/esm/models/DetectionTypesResponse.js +44 -0
  220. package/dist/esm/models/DlpAwsTrustInfoResponse.d.ts +34 -0
  221. package/dist/esm/models/DlpAwsTrustInfoResponse.js +47 -0
  222. package/dist/esm/models/DlpErrorResponse.d.ts +41 -0
  223. package/dist/esm/models/DlpErrorResponse.js +43 -0
  224. package/dist/esm/models/EffectivePricing.d.ts +89 -0
  225. package/dist/esm/models/EffectivePricing.js +56 -0
  226. package/dist/esm/models/EnforcementPoliciesResponse.d.ts +31 -0
  227. package/dist/esm/models/EnforcementPoliciesResponse.js +44 -0
  228. package/dist/esm/models/EnforcementPolicyMcpTargetRequest.d.ts +34 -0
  229. package/dist/esm/models/EnforcementPolicyMcpTargetRequest.js +47 -0
  230. package/dist/esm/models/EnforcementPolicyMcpTargetResponse.d.ts +38 -0
  231. package/dist/esm/models/EnforcementPolicyMcpTargetResponse.js +51 -0
  232. package/dist/esm/models/EnforcementPolicyPrincipalRequest.d.ts +34 -0
  233. package/dist/esm/models/EnforcementPolicyPrincipalRequest.js +47 -0
  234. package/dist/esm/models/EnforcementPolicyPrincipalResponse.d.ts +38 -0
  235. package/dist/esm/models/EnforcementPolicyPrincipalResponse.js +51 -0
  236. package/dist/esm/models/EnforcementPolicyResponse.d.ts +101 -0
  237. package/dist/esm/models/EnforcementPolicyResponse.js +110 -0
  238. package/dist/esm/models/ErrorDetail.d.ts +38 -0
  239. package/dist/esm/models/ErrorDetail.js +45 -0
  240. package/dist/esm/models/ErrorModel.d.ts +51 -0
  241. package/dist/esm/models/ErrorModel.js +52 -0
  242. package/dist/esm/models/ExportDestination.d.ts +74 -0
  243. package/dist/esm/models/ExportDestination.js +63 -0
  244. package/dist/esm/models/ExportHealthCheck.d.ts +42 -0
  245. package/dist/esm/models/ExportHealthCheck.js +48 -0
  246. package/dist/esm/models/ExportResponse.d.ts +69 -0
  247. package/dist/esm/models/ExportResponse.js +83 -0
  248. package/dist/esm/models/ExportRuntimeStatus.d.ts +47 -0
  249. package/dist/esm/models/ExportRuntimeStatus.js +51 -0
  250. package/dist/esm/models/ExportSettings.d.ts +50 -0
  251. package/dist/esm/models/ExportSettings.js +61 -0
  252. package/dist/esm/models/ExportsResponse.d.ts +31 -0
  253. package/dist/esm/models/ExportsResponse.js +44 -0
  254. package/dist/esm/models/Expression.d.ts +30 -0
  255. package/dist/esm/models/Expression.js +43 -0
  256. package/dist/esm/models/FieldControlPoliciesResponse.d.ts +31 -0
  257. package/dist/esm/models/FieldControlPoliciesResponse.js +44 -0
  258. package/dist/esm/models/FieldControlPolicyResponse.d.ts +70 -0
  259. package/dist/esm/models/FieldControlPolicyResponse.js +83 -0
  260. package/dist/esm/models/FilterCategory.d.ts +39 -0
  261. package/dist/esm/models/FilterCategory.js +50 -0
  262. package/dist/esm/models/FilterOption.d.ts +38 -0
  263. package/dist/esm/models/FilterOption.js +49 -0
  264. package/dist/esm/models/GoogleDlpConnectionResponse.d.ts +46 -0
  265. package/dist/esm/models/GoogleDlpConnectionResponse.js +59 -0
  266. package/dist/esm/models/GovernanceConfig.d.ts +52 -0
  267. package/dist/esm/models/GovernanceConfig.js +48 -0
  268. package/dist/esm/models/HTTPValidationError.d.ts +31 -0
  269. package/dist/esm/models/HTTPValidationError.js +42 -0
  270. package/dist/esm/models/IdListResponse.d.ts +30 -0
  271. package/dist/esm/models/IdListResponse.js +41 -0
  272. package/dist/esm/models/IdpConnectionConfig.d.ts +89 -0
  273. package/dist/esm/models/IdpConnectionConfig.js +85 -0
  274. package/dist/esm/models/IdpConnectionResponse.d.ts +86 -0
  275. package/dist/esm/models/IdpConnectionResponse.js +69 -0
  276. package/dist/esm/models/IdpRoleMappingConfig.d.ts +30 -0
  277. package/dist/esm/models/IdpRoleMappingConfig.js +41 -0
  278. package/dist/esm/models/IdpRoleMappingResponse.d.ts +38 -0
  279. package/dist/esm/models/IdpRoleMappingResponse.js +45 -0
  280. package/dist/esm/models/IdpSettingsResponse.d.ts +38 -0
  281. package/dist/esm/models/IdpSettingsResponse.js +45 -0
  282. package/dist/esm/models/IdpTestResult.d.ts +40 -0
  283. package/dist/esm/models/IdpTestResult.js +49 -0
  284. package/dist/esm/models/LabeledOption.d.ts +34 -0
  285. package/dist/esm/models/LabeledOption.js +47 -0
  286. package/dist/esm/models/ListProfilesResponse.d.ts +31 -0
  287. package/dist/esm/models/ListProfilesResponse.js +44 -0
  288. package/dist/esm/models/ListRoutingRulesResponse.d.ts +40 -0
  289. package/dist/esm/models/ListRoutingRulesResponse.js +49 -0
  290. package/dist/esm/models/LlmGatewayAwsRoleConfigResponse.d.ts +42 -0
  291. package/dist/esm/models/LlmGatewayAwsRoleConfigResponse.js +45 -0
  292. package/dist/esm/models/LlmGatewayAwsTrustInfoResponse.d.ts +34 -0
  293. package/dist/esm/models/LlmGatewayAwsTrustInfoResponse.js +47 -0
  294. package/dist/esm/models/LocationInner.d.ts +26 -0
  295. package/dist/esm/models/LocationInner.js +31 -0
  296. package/dist/esm/models/LongContextTier.d.ts +58 -0
  297. package/dist/esm/models/LongContextTier.js +55 -0
  298. package/dist/esm/models/LongContextTierEntry.d.ts +48 -0
  299. package/dist/esm/models/LongContextTierEntry.js +55 -0
  300. package/dist/esm/models/LongContextTierRequest.d.ts +53 -0
  301. package/dist/esm/models/LongContextTierRequest.js +55 -0
  302. package/dist/esm/models/MCPServerCategory.d.ts +50 -0
  303. package/dist/esm/models/MCPServerCategory.js +64 -0
  304. package/dist/esm/models/MCPServerDirectoryBase.d.ts +126 -0
  305. package/dist/esm/models/MCPServerDirectoryBase.js +134 -0
  306. package/dist/esm/models/MCPServerDirectoryRead.d.ts +135 -0
  307. package/dist/esm/models/MCPServerDirectoryRead.js +143 -0
  308. package/dist/esm/models/MCPServerDirectoryReadWithServers.d.ts +140 -0
  309. package/dist/esm/models/MCPServerDirectoryReadWithServers.js +148 -0
  310. package/dist/esm/models/MaskFormat.d.ts +45 -0
  311. package/dist/esm/models/MaskFormat.js +52 -0
  312. package/dist/esm/models/MaskKeep.d.ts +25 -0
  313. package/dist/esm/models/MaskKeep.js +43 -0
  314. package/dist/esm/models/Match.d.ts +25 -0
  315. package/dist/esm/models/Match.js +65 -0
  316. package/dist/esm/models/Match1.d.ts +25 -0
  317. package/dist/esm/models/Match1.js +65 -0
  318. package/dist/esm/models/MetadataPatchRequest.d.ts +34 -0
  319. package/dist/esm/models/MetadataPatchRequest.js +43 -0
  320. package/dist/esm/models/ModelAccessTarget.d.ts +43 -0
  321. package/dist/esm/models/ModelAccessTarget.js +72 -0
  322. package/dist/esm/models/ModelAccessTargetOneOf.d.ts +46 -0
  323. package/dist/esm/models/ModelAccessTargetOneOf.js +55 -0
  324. package/dist/esm/models/ModelAccessTargetOneOf1.d.ts +46 -0
  325. package/dist/esm/models/ModelAccessTargetOneOf1.js +55 -0
  326. package/dist/esm/models/ModelAccessTargetOneOf2.d.ts +46 -0
  327. package/dist/esm/models/ModelAccessTargetOneOf2.js +55 -0
  328. package/dist/esm/models/ModelAccessTargetOneOf3.d.ts +46 -0
  329. package/dist/esm/models/ModelAccessTargetOneOf3.js +59 -0
  330. package/dist/esm/models/ModelAccessTargetOneOf4.d.ts +55 -0
  331. package/dist/esm/models/ModelAccessTargetOneOf4.js +55 -0
  332. package/dist/esm/models/ModelMapping.d.ts +155 -0
  333. package/dist/esm/models/ModelMapping.js +104 -0
  334. package/dist/esm/models/ModelMappingWithBudgetStatus.d.ts +192 -0
  335. package/dist/esm/models/ModelMappingWithBudgetStatus.js +118 -0
  336. package/dist/esm/models/ModelMappingWithProvider.d.ts +134 -0
  337. package/dist/esm/models/ModelMappingWithProvider.js +116 -0
  338. package/dist/esm/models/ModelMappingWithProviderAndBudgetStatus.d.ts +155 -0
  339. package/dist/esm/models/ModelMappingWithProviderAndBudgetStatus.js +130 -0
  340. package/dist/esm/models/ModelPricing.d.ts +94 -0
  341. package/dist/esm/models/ModelPricing.js +79 -0
  342. package/dist/esm/models/ModelRouteGroup.d.ts +92 -0
  343. package/dist/esm/models/ModelRouteGroup.js +76 -0
  344. package/dist/esm/models/ModelSource.d.ts +35 -0
  345. package/dist/esm/models/ModelSource.js +53 -0
  346. package/dist/esm/models/ModelStaleStatus.d.ts +31 -0
  347. package/dist/esm/models/ModelStaleStatus.js +44 -0
  348. package/dist/esm/models/ModelSyncMode.d.ts +35 -0
  349. package/dist/esm/models/ModelSyncMode.js +53 -0
  350. package/dist/esm/models/OAuthConfig.d.ts +39 -0
  351. package/dist/esm/models/OAuthConfig.js +46 -0
  352. package/dist/esm/models/OfInner.d.ts +25 -0
  353. package/dist/esm/models/OfInner.js +65 -0
  354. package/dist/esm/models/OfInner1.d.ts +25 -0
  355. package/dist/esm/models/OfInner1.js +65 -0
  356. package/dist/esm/models/OperatorAllInput.d.ts +31 -0
  357. package/dist/esm/models/OperatorAllInput.js +44 -0
  358. package/dist/esm/models/OperatorAllOutput.d.ts +31 -0
  359. package/dist/esm/models/OperatorAllOutput.js +44 -0
  360. package/dist/esm/models/OperatorAnyInput.d.ts +31 -0
  361. package/dist/esm/models/OperatorAnyInput.js +44 -0
  362. package/dist/esm/models/OperatorAnyOutput.d.ts +31 -0
  363. package/dist/esm/models/OperatorAnyOutput.js +44 -0
  364. package/dist/esm/models/OperatorNoneInput.d.ts +31 -0
  365. package/dist/esm/models/OperatorNoneInput.js +44 -0
  366. package/dist/esm/models/OperatorNoneOutput.d.ts +31 -0
  367. package/dist/esm/models/OperatorNoneOutput.js +44 -0
  368. package/dist/esm/models/OrgConfigResponse.d.ts +50 -0
  369. package/dist/esm/models/OrgConfigResponse.js +63 -0
  370. package/dist/esm/models/OrganizationRolesGroupsResponse.d.ts +39 -0
  371. package/dist/esm/models/OrganizationRolesGroupsResponse.js +47 -0
  372. package/dist/esm/models/PaginatedResponseAllowListEntryResponse.d.ts +39 -0
  373. package/dist/esm/models/PaginatedResponseAllowListEntryResponse.js +52 -0
  374. package/dist/esm/models/PaginatedResponseAllowListEntryResponseItemsInner.d.ts +58 -0
  375. package/dist/esm/models/PaginatedResponseAllowListEntryResponseItemsInner.js +71 -0
  376. package/dist/esm/models/PaginationMeta.d.ts +50 -0
  377. package/dist/esm/models/PaginationMeta.js +63 -0
  378. package/dist/esm/models/PaginationResponseApplicationDirectoryResponse.d.ts +36 -0
  379. package/dist/esm/models/PaginationResponseApplicationDirectoryResponse.js +49 -0
  380. package/dist/esm/models/PaginationResponseApplicationResponse.d.ts +36 -0
  381. package/dist/esm/models/PaginationResponseApplicationResponse.js +49 -0
  382. package/dist/esm/models/PaginationResponseMCPServerDirectoryReadWithServers.d.ts +36 -0
  383. package/dist/esm/models/PaginationResponseMCPServerDirectoryReadWithServers.js +49 -0
  384. package/dist/esm/models/PaginationResponsePolicyImpactSummary.d.ts +36 -0
  385. package/dist/esm/models/PaginationResponsePolicyImpactSummary.js +49 -0
  386. package/dist/esm/models/PaginationResponsePolicyRevisionSummary.d.ts +36 -0
  387. package/dist/esm/models/PaginationResponsePolicyRevisionSummary.js +49 -0
  388. package/dist/esm/models/PaginationResponsePolicySummary.d.ts +36 -0
  389. package/dist/esm/models/PaginationResponsePolicySummary.js +49 -0
  390. package/dist/esm/models/PaginationResponseServerListResponse.d.ts +36 -0
  391. package/dist/esm/models/PaginationResponseServerListResponse.js +49 -0
  392. package/dist/esm/models/PolicyAttributionResponse.d.ts +47 -0
  393. package/dist/esm/models/PolicyAttributionResponse.js +56 -0
  394. package/dist/esm/models/PolicyDetail.d.ts +83 -0
  395. package/dist/esm/models/PolicyDetail.js +87 -0
  396. package/dist/esm/models/PolicyDetailResponse.d.ts +31 -0
  397. package/dist/esm/models/PolicyDetailResponse.js +44 -0
  398. package/dist/esm/models/PolicyImpactSeverityCounts.d.ts +51 -0
  399. package/dist/esm/models/PolicyImpactSeverityCounts.js +47 -0
  400. package/dist/esm/models/PolicyImpactSummary.d.ts +105 -0
  401. package/dist/esm/models/PolicyImpactSummary.js +98 -0
  402. package/dist/esm/models/PolicyRevisionCompareResponse.d.ts +58 -0
  403. package/dist/esm/models/PolicyRevisionCompareResponse.js +60 -0
  404. package/dist/esm/models/PolicyRevisionCompareSide.d.ts +54 -0
  405. package/dist/esm/models/PolicyRevisionCompareSide.js +62 -0
  406. package/dist/esm/models/PolicyRevisionDetailResponse.d.ts +37 -0
  407. package/dist/esm/models/PolicyRevisionDetailResponse.js +46 -0
  408. package/dist/esm/models/PolicyRevisionSummary.d.ts +79 -0
  409. package/dist/esm/models/PolicyRevisionSummary.js +75 -0
  410. package/dist/esm/models/PolicyRuleConditionInput.d.ts +31 -0
  411. package/dist/esm/models/PolicyRuleConditionInput.js +44 -0
  412. package/dist/esm/models/PolicyRuleConditionOutput.d.ts +31 -0
  413. package/dist/esm/models/PolicyRuleConditionOutput.js +44 -0
  414. package/dist/esm/models/PolicyRuleInput.d.ts +55 -0
  415. package/dist/esm/models/PolicyRuleInput.js +56 -0
  416. package/dist/esm/models/PolicyRuleOutput.d.ts +55 -0
  417. package/dist/esm/models/PolicyRuleOutput.js +56 -0
  418. package/dist/esm/models/PolicyStatus.d.ts +34 -0
  419. package/dist/esm/models/PolicyStatus.js +52 -0
  420. package/dist/esm/models/PolicySummary.d.ts +86 -0
  421. package/dist/esm/models/PolicySummary.js +82 -0
  422. package/dist/esm/models/PolicySummaryResponse.d.ts +46 -0
  423. package/dist/esm/models/PolicySummaryResponse.js +49 -0
  424. package/dist/esm/models/Posture.d.ts +31 -0
  425. package/dist/esm/models/Posture.js +49 -0
  426. package/dist/esm/models/PresidioConnectionResponse.d.ts +46 -0
  427. package/dist/esm/models/PresidioConnectionResponse.js +59 -0
  428. package/dist/esm/models/PricingChangeSource.d.ts +34 -0
  429. package/dist/esm/models/PricingChangeSource.js +52 -0
  430. package/dist/esm/models/PricingRuleSummary.d.ts +146 -0
  431. package/dist/esm/models/PricingRuleSummary.js +111 -0
  432. package/dist/esm/models/PricingSyncMode.d.ts +27 -0
  433. package/dist/esm/models/PricingSyncMode.js +45 -0
  434. package/dist/esm/models/Protocol.d.ts +25 -0
  435. package/dist/esm/models/Protocol.js +43 -0
  436. package/dist/esm/models/Provider.d.ts +200 -0
  437. package/dist/esm/models/Provider.js +137 -0
  438. package/dist/esm/models/ProviderConnectionResponse.d.ts +28 -0
  439. package/dist/esm/models/ProviderConnectionResponse.js +86 -0
  440. package/dist/esm/models/ProviderConnectionResponseOneOf.d.ts +57 -0
  441. package/dist/esm/models/ProviderConnectionResponseOneOf.js +71 -0
  442. package/dist/esm/models/ProviderConnectionResponseOneOf1.d.ts +49 -0
  443. package/dist/esm/models/ProviderConnectionResponseOneOf1.js +63 -0
  444. package/dist/esm/models/ProviderConnectionResponseOneOf2.d.ts +57 -0
  445. package/dist/esm/models/ProviderConnectionResponseOneOf2.js +71 -0
  446. package/dist/esm/models/ProviderConnectionResponseOneOf3.d.ts +73 -0
  447. package/dist/esm/models/ProviderConnectionResponseOneOf3.js +79 -0
  448. package/dist/esm/models/ProviderConnectionResponseOneOf4.d.ts +77 -0
  449. package/dist/esm/models/ProviderConnectionResponseOneOf4.js +83 -0
  450. package/dist/esm/models/ProviderConnectionResponseOneOf5.d.ts +57 -0
  451. package/dist/esm/models/ProviderConnectionResponseOneOf5.js +71 -0
  452. package/dist/esm/models/ProviderConnectionResponseOneOf6.d.ts +57 -0
  453. package/dist/esm/models/ProviderConnectionResponseOneOf6.js +71 -0
  454. package/dist/esm/models/PublishBlocker.d.ts +27 -0
  455. package/dist/esm/models/PublishBlocker.js +45 -0
  456. package/dist/esm/models/ReorderEntry.d.ts +34 -0
  457. package/dist/esm/models/ReorderEntry.js +47 -0
  458. package/dist/esm/models/ReorderModelMappingsRequest.d.ts +31 -0
  459. package/dist/esm/models/ReorderModelMappingsRequest.js +44 -0
  460. package/dist/esm/models/ReorderedResponse.d.ts +30 -0
  461. package/dist/esm/models/ReorderedResponse.js +43 -0
  462. package/dist/esm/models/ResolvedProtectionResponse.d.ts +31 -0
  463. package/dist/esm/models/ResolvedProtectionResponse.js +44 -0
  464. package/dist/esm/models/ResolvedProtectionRuleResponse.d.ts +87 -0
  465. package/dist/esm/models/ResolvedProtectionRuleResponse.js +84 -0
  466. package/dist/esm/models/ResolvedRef.d.ts +42 -0
  467. package/dist/esm/models/ResolvedRef.js +54 -0
  468. package/dist/esm/models/RevokedResponse.d.ts +30 -0
  469. package/dist/esm/models/RevokedResponse.js +43 -0
  470. package/dist/esm/models/RouteHealthStatus.d.ts +53 -0
  471. package/dist/esm/models/RouteHealthStatus.js +59 -0
  472. package/dist/esm/models/RoutingPolicy.d.ts +90 -0
  473. package/dist/esm/models/RoutingPolicy.js +92 -0
  474. package/dist/esm/models/RoutingPolicyDraft.d.ts +68 -0
  475. package/dist/esm/models/RoutingPolicyDraft.js +65 -0
  476. package/dist/esm/models/RoutingPolicyUpdate.d.ts +69 -0
  477. package/dist/esm/models/RoutingPolicyUpdate.js +61 -0
  478. package/dist/esm/models/RoutingRule.d.ts +60 -0
  479. package/dist/esm/models/RoutingRule.js +69 -0
  480. package/dist/esm/models/RoutingRuleDraft.d.ts +46 -0
  481. package/dist/esm/models/RoutingRuleDraft.js +53 -0
  482. package/dist/esm/models/RoutingRuleWriteResponse.d.ts +65 -0
  483. package/dist/esm/models/RoutingRuleWriteResponse.js +74 -0
  484. package/dist/esm/models/RoutingSlot.d.ts +41 -0
  485. package/dist/esm/models/RoutingSlot.js +47 -0
  486. package/dist/esm/models/RuleConflict.d.ts +43 -0
  487. package/dist/esm/models/RuleConflict.js +51 -0
  488. package/dist/esm/models/ScopeJson.d.ts +42 -0
  489. package/dist/esm/models/ScopeJson.js +47 -0
  490. package/dist/esm/models/ScopeType.d.ts +43 -0
  491. package/dist/esm/models/ScopeType.js +61 -0
  492. package/dist/esm/models/ServerConnectionResponse.d.ts +62 -0
  493. package/dist/esm/models/ServerConnectionResponse.js +66 -0
  494. package/dist/esm/models/ServerListResponse.d.ts +156 -0
  495. package/dist/esm/models/ServerListResponse.js +163 -0
  496. package/dist/esm/models/ServerResponse.d.ts +158 -0
  497. package/dist/esm/models/ServerResponse.js +167 -0
  498. package/dist/esm/models/ServerSource.d.ts +30 -0
  499. package/dist/esm/models/ServerSource.js +48 -0
  500. package/dist/esm/models/SetApiKeyDisabledRequest.d.ts +30 -0
  501. package/dist/esm/models/SetApiKeyDisabledRequest.js +43 -0
  502. package/dist/esm/models/StaleReason.d.ts +24 -0
  503. package/dist/esm/models/StaleReason.js +42 -0
  504. package/dist/esm/models/TestFindingResponse.d.ts +90 -0
  505. package/dist/esm/models/TestFindingResponse.js +99 -0
  506. package/dist/esm/models/TestProcessTextRequest.d.ts +55 -0
  507. package/dist/esm/models/TestProcessTextRequest.js +58 -0
  508. package/dist/esm/models/TestProcessTextResponse.d.ts +56 -0
  509. package/dist/esm/models/TestProcessTextResponse.js +65 -0
  510. package/dist/esm/models/TokenizationConnectionResponse.d.ts +38 -0
  511. package/dist/esm/models/TokenizationConnectionResponse.js +51 -0
  512. package/dist/esm/models/TrafficType.d.ts +26 -0
  513. package/dist/esm/models/TrafficType.js +44 -0
  514. package/dist/esm/models/UpdateBudgetRequest.d.ts +64 -0
  515. package/dist/esm/models/UpdateBudgetRequest.js +57 -0
  516. package/dist/esm/models/UpdateConnectionRequest.d.ts +56 -0
  517. package/dist/esm/models/UpdateConnectionRequest.js +53 -0
  518. package/dist/esm/models/UpdateContractRequest.d.ts +41 -0
  519. package/dist/esm/models/UpdateContractRequest.js +48 -0
  520. package/dist/esm/models/UpdateCustomDetectionTypeRequest.d.ts +47 -0
  521. package/dist/esm/models/UpdateCustomDetectionTypeRequest.js +50 -0
  522. package/dist/esm/models/UpdateDetectionEngineRequest.d.ts +46 -0
  523. package/dist/esm/models/UpdateDetectionEngineRequest.js +49 -0
  524. package/dist/esm/models/UpdateEnforcementPolicyRequest.d.ts +77 -0
  525. package/dist/esm/models/UpdateEnforcementPolicyRequest.js +66 -0
  526. package/dist/esm/models/UpdateFieldControlPolicyRequest.d.ts +42 -0
  527. package/dist/esm/models/UpdateFieldControlPolicyRequest.js +47 -0
  528. package/dist/esm/models/UpdateModelAccessRequest.d.ts +70 -0
  529. package/dist/esm/models/UpdateModelAccessRequest.js +58 -0
  530. package/dist/esm/models/UpdateModelMappingRequest.d.ts +79 -0
  531. package/dist/esm/models/UpdateModelMappingRequest.js +59 -0
  532. package/dist/esm/models/UpdateOrgConfigRequest.d.ts +34 -0
  533. package/dist/esm/models/UpdateOrgConfigRequest.js +43 -0
  534. package/dist/esm/models/UpdatePolicy.d.ts +56 -0
  535. package/dist/esm/models/UpdatePolicy.js +55 -0
  536. package/dist/esm/models/UpdatePricingRequest.d.ts +70 -0
  537. package/dist/esm/models/UpdatePricingRequest.js +58 -0
  538. package/dist/esm/models/UpdateProviderRequest.d.ts +124 -0
  539. package/dist/esm/models/UpdateProviderRequest.js +74 -0
  540. package/dist/esm/models/UpdateRateLimitRequest.d.ts +87 -0
  541. package/dist/esm/models/UpdateRateLimitRequest.js +65 -0
  542. package/dist/esm/models/UpdateRouteGroupRequest.d.ts +46 -0
  543. package/dist/esm/models/UpdateRouteGroupRequest.js +47 -0
  544. package/dist/esm/models/UpdateSettingsRequest.d.ts +50 -0
  545. package/dist/esm/models/UpdateSettingsRequest.js +51 -0
  546. package/dist/esm/models/UpsertAwsBedrockGuardrailsRequest.d.ts +66 -0
  547. package/dist/esm/models/UpsertAwsBedrockGuardrailsRequest.js +61 -0
  548. package/dist/esm/models/UpsertAwsComprehendPiiRequest.d.ts +62 -0
  549. package/dist/esm/models/UpsertAwsComprehendPiiRequest.js +57 -0
  550. package/dist/esm/models/UpsertAzureAiLanguagePiiRequest.d.ts +42 -0
  551. package/dist/esm/models/UpsertAzureAiLanguagePiiRequest.js +49 -0
  552. package/dist/esm/models/UpsertAzureContentSafetyRequest.d.ts +42 -0
  553. package/dist/esm/models/UpsertAzureContentSafetyRequest.js +49 -0
  554. package/dist/esm/models/UpsertConnectionRequest.d.ts +28 -0
  555. package/dist/esm/models/UpsertConnectionRequest.js +86 -0
  556. package/dist/esm/models/UpsertConnectionRequestOneOf.d.ts +53 -0
  557. package/dist/esm/models/UpsertConnectionRequestOneOf.js +61 -0
  558. package/dist/esm/models/UpsertConnectionRequestOneOf1.d.ts +45 -0
  559. package/dist/esm/models/UpsertConnectionRequestOneOf1.js +57 -0
  560. package/dist/esm/models/UpsertConnectionRequestOneOf2.d.ts +53 -0
  561. package/dist/esm/models/UpsertConnectionRequestOneOf2.js +61 -0
  562. package/dist/esm/models/UpsertConnectionRequestOneOf3.d.ts +73 -0
  563. package/dist/esm/models/UpsertConnectionRequestOneOf3.js +69 -0
  564. package/dist/esm/models/UpsertConnectionRequestOneOf4.d.ts +77 -0
  565. package/dist/esm/models/UpsertConnectionRequestOneOf4.js +73 -0
  566. package/dist/esm/models/UpsertConnectionRequestOneOf5.d.ts +53 -0
  567. package/dist/esm/models/UpsertConnectionRequestOneOf5.js +61 -0
  568. package/dist/esm/models/UpsertConnectionRequestOneOf6.d.ts +53 -0
  569. package/dist/esm/models/UpsertConnectionRequestOneOf6.js +61 -0
  570. package/dist/esm/models/UpsertFieldControlPolicyRequest.d.ts +46 -0
  571. package/dist/esm/models/UpsertFieldControlPolicyRequest.js +53 -0
  572. package/dist/esm/models/UpsertGoogleDlpRequest.d.ts +42 -0
  573. package/dist/esm/models/UpsertGoogleDlpRequest.js +49 -0
  574. package/dist/esm/models/UpsertPresidioRequest.d.ts +42 -0
  575. package/dist/esm/models/UpsertPresidioRequest.js +49 -0
  576. package/dist/esm/models/UpsertTokenizationRequest.d.ts +34 -0
  577. package/dist/esm/models/UpsertTokenizationRequest.js +45 -0
  578. package/dist/esm/models/ValidateAwsRoleRequest.d.ts +38 -0
  579. package/dist/esm/models/ValidateAwsRoleRequest.js +51 -0
  580. package/dist/esm/models/ValidatePolicyRequest.d.ts +42 -0
  581. package/dist/esm/models/ValidatePolicyRequest.js +49 -0
  582. package/dist/esm/models/ValidatePolicyResponse.d.ts +38 -0
  583. package/dist/esm/models/ValidatePolicyResponse.js +49 -0
  584. package/dist/esm/models/ValidationError.d.ts +47 -0
  585. package/dist/esm/models/ValidationError.js +56 -0
  586. package/dist/esm/models/WebhookSecretResponse.d.ts +30 -0
  587. package/dist/esm/models/WebhookSecretResponse.js +43 -0
  588. package/dist/esm/models/WithAttributionModelAccessPolicy.d.ts +119 -0
  589. package/dist/esm/models/WithAttributionModelAccessPolicy.js +93 -0
  590. package/dist/esm/models/WithAttributionRateLimitPolicy.d.ts +188 -0
  591. package/dist/esm/models/WithAttributionRateLimitPolicy.js +100 -0
  592. package/dist/esm/models/WithAttributionTokenBudget.d.ts +200 -0
  593. package/dist/esm/models/WithAttributionTokenBudget.js +120 -0
  594. package/dist/esm/models/index.d.ts +272 -0
  595. package/dist/esm/models/index.js +274 -0
  596. package/dist/esm/package.json +1 -0
  597. package/dist/esm/runtime.d.ts +214 -0
  598. package/dist/esm/runtime.js +416 -0
  599. package/dist/index.d.ts +4 -42
  600. package/dist/index.js +22 -13
  601. package/dist/lib/auth.d.ts +95 -0
  602. package/dist/lib/auth.js +215 -0
  603. package/dist/lib/cli.d.ts +44 -0
  604. package/dist/lib/cli.js +92 -0
  605. package/dist/lib/client.d.ts +51 -0
  606. package/dist/lib/client.js +48 -0
  607. package/dist/lib/config.d.ts +14 -0
  608. package/dist/lib/config.js +66 -0
  609. package/dist/lib/http.d.ts +23 -0
  610. package/dist/lib/http.js +83 -0
  611. package/dist/lib/index.d.ts +15 -0
  612. package/dist/lib/index.js +30 -0
  613. package/dist/lib/mcp.d.ts +41 -0
  614. package/dist/lib/mcp.js +82 -0
  615. package/dist/models/AWSTrustInfoResponse.d.ts +34 -0
  616. package/dist/models/AWSTrustInfoResponse.js +54 -0
  617. package/dist/models/AddRouteGroupMembersRequest.d.ts +36 -0
  618. package/dist/models/AddRouteGroupMembersRequest.js +52 -0
  619. package/dist/models/AdminModelPricing.d.ts +133 -0
  620. package/dist/models/AdminModelPricing.js +108 -0
  621. package/dist/models/AffectedPoliciesResponse.d.ts +48 -0
  622. package/dist/models/AffectedPoliciesResponse.js +59 -0
  623. package/dist/models/AffectedPolicyPreview.d.ts +49 -0
  624. package/dist/models/AffectedPolicyPreview.js +64 -0
  625. package/dist/models/AgentPolicyCounts.d.ts +36 -0
  626. package/dist/models/AgentPolicyCounts.js +50 -0
  627. package/dist/models/AgentRuntimeCapabilities.d.ts +85 -0
  628. package/dist/models/AgentRuntimeCapabilities.js +74 -0
  629. package/dist/models/AgentRuntimeProfile.d.ts +77 -0
  630. package/dist/models/AgentRuntimeProfile.js +96 -0
  631. package/dist/models/AgentType.d.ts +25 -0
  632. package/dist/models/AgentType.js +51 -0
  633. package/dist/models/AlertType.d.ts +44 -0
  634. package/dist/models/AlertType.js +70 -0
  635. package/dist/models/AlertTypeOption.d.ts +42 -0
  636. package/dist/models/AlertTypeOption.js +62 -0
  637. package/dist/models/AllowListEntryResponse.d.ts +58 -0
  638. package/dist/models/AllowListEntryResponse.js +78 -0
  639. package/dist/models/ApiKey.d.ts +89 -0
  640. package/dist/models/ApiKey.js +92 -0
  641. package/dist/models/ApiKeyDisabledResponse.d.ts +30 -0
  642. package/dist/models/ApiKeyDisabledResponse.js +50 -0
  643. package/dist/models/ApiKeyKind.d.ts +36 -0
  644. package/dist/models/ApiKeyKind.js +62 -0
  645. package/dist/models/AppType.d.ts +30 -0
  646. package/dist/models/AppType.js +56 -0
  647. package/dist/models/Application.d.ts +58 -0
  648. package/dist/models/Application.js +79 -0
  649. package/dist/models/ApplicationCounts.d.ts +38 -0
  650. package/dist/models/ApplicationCounts.js +58 -0
  651. package/dist/models/ApplicationDirectoryBase.d.ts +87 -0
  652. package/dist/models/ApplicationDirectoryBase.js +108 -0
  653. package/dist/models/ApplicationDirectoryResponse.d.ts +92 -0
  654. package/dist/models/ApplicationDirectoryResponse.js +113 -0
  655. package/dist/models/ApplicationLlmGatewayPayload.d.ts +30 -0
  656. package/dist/models/ApplicationLlmGatewayPayload.js +50 -0
  657. package/dist/models/ApplicationPayload.d.ts +38 -0
  658. package/dist/models/ApplicationPayload.js +54 -0
  659. package/dist/models/ApplicationResponse.d.ts +68 -0
  660. package/dist/models/ApplicationResponse.js +88 -0
  661. package/dist/models/ApplicationWriteConfirmationsPayload.d.ts +30 -0
  662. package/dist/models/ApplicationWriteConfirmationsPayload.js +50 -0
  663. package/dist/models/ArchivePricingResponse.d.ts +45 -0
  664. package/dist/models/ArchivePricingResponse.js +62 -0
  665. package/dist/models/AttentionTier.d.ts +34 -0
  666. package/dist/models/AttentionTier.js +60 -0
  667. package/dist/models/AutoDisabledReason.d.ts +27 -0
  668. package/dist/models/AutoDisabledReason.js +53 -0
  669. package/dist/models/AwsBedrockGuardrailsConnectionResponse.d.ts +66 -0
  670. package/dist/models/AwsBedrockGuardrailsConnectionResponse.js +78 -0
  671. package/dist/models/AwsComprehendPiiConnectionResponse.d.ts +62 -0
  672. package/dist/models/AwsComprehendPiiConnectionResponse.js +74 -0
  673. package/dist/models/AwsRoleConfigResponse.d.ts +34 -0
  674. package/dist/models/AwsRoleConfigResponse.js +52 -0
  675. package/dist/models/AwsRoleValidationResponse.d.ts +31 -0
  676. package/dist/models/AwsRoleValidationResponse.js +50 -0
  677. package/dist/models/AzureAiLanguagePiiConnectionResponse.d.ts +46 -0
  678. package/dist/models/AzureAiLanguagePiiConnectionResponse.js +66 -0
  679. package/dist/models/AzureContentSafetyConnectionResponse.d.ts +46 -0
  680. package/dist/models/AzureContentSafetyConnectionResponse.js +66 -0
  681. package/dist/models/BillingMode.d.ts +36 -0
  682. package/dist/models/BillingMode.js +62 -0
  683. package/dist/models/BillingReason.d.ts +42 -0
  684. package/dist/models/BillingReason.js +68 -0
  685. package/dist/models/BudgetAction.d.ts +26 -0
  686. package/dist/models/BudgetAction.js +52 -0
  687. package/dist/models/BudgetLimitKind.d.ts +25 -0
  688. package/dist/models/BudgetLimitKind.js +51 -0
  689. package/dist/models/BudgetPeriod.d.ts +33 -0
  690. package/dist/models/BudgetPeriod.js +59 -0
  691. package/dist/models/BudgetTargetKind.d.ts +28 -0
  692. package/dist/models/BudgetTargetKind.js +54 -0
  693. package/dist/models/BudgetTargetStatus.d.ts +58 -0
  694. package/dist/models/BudgetTargetStatus.js +76 -0
  695. package/dist/models/ChangeAttribution.d.ts +73 -0
  696. package/dist/models/ChangeAttribution.js +63 -0
  697. package/dist/models/ChannelListResponse.d.ts +32 -0
  698. package/dist/models/ChannelListResponse.js +51 -0
  699. package/dist/models/ChannelOptionsResponse.d.ts +43 -0
  700. package/dist/models/ChannelOptionsResponse.js +60 -0
  701. package/dist/models/ChannelResponse.d.ts +87 -0
  702. package/dist/models/ChannelResponse.js +99 -0
  703. package/dist/models/ChannelSubscription.d.ts +31 -0
  704. package/dist/models/ChannelSubscription.js +51 -0
  705. package/dist/models/ChannelSubscriptionInput.d.ts +38 -0
  706. package/dist/models/ChannelSubscriptionInput.js +51 -0
  707. package/dist/models/ChannelTestResponse.d.ts +37 -0
  708. package/dist/models/ChannelTestResponse.js +52 -0
  709. package/dist/models/ChannelType.d.ts +49 -0
  710. package/dist/models/ChannelType.js +75 -0
  711. package/dist/models/ChannelUpsertRequest.d.ts +86 -0
  712. package/dist/models/ChannelUpsertRequest.js +68 -0
  713. package/dist/models/ConditionOfInput.d.ts +31 -0
  714. package/dist/models/ConditionOfInput.js +51 -0
  715. package/dist/models/ConditionOfOutput.d.ts +31 -0
  716. package/dist/models/ConditionOfOutput.js +51 -0
  717. package/dist/models/ConfigureDestinationRequest.d.ts +78 -0
  718. package/dist/models/ConfigureDestinationRequest.js +72 -0
  719. package/dist/models/Connection.d.ts +126 -0
  720. package/dist/models/Connection.js +109 -0
  721. package/dist/models/ConnectionInitiateResponse.d.ts +42 -0
  722. package/dist/models/ConnectionInitiateResponse.js +60 -0
  723. package/dist/models/ConnectionRead.d.ts +58 -0
  724. package/dist/models/ConnectionRead.js +71 -0
  725. package/dist/models/ConnectionStatus.d.ts +26 -0
  726. package/dist/models/ConnectionStatus.js +38 -0
  727. package/dist/models/CreateAllowListEntryRequest.d.ts +42 -0
  728. package/dist/models/CreateAllowListEntryRequest.js +58 -0
  729. package/dist/models/CreateApiKeyRequest.d.ts +51 -0
  730. package/dist/models/CreateApiKeyRequest.js +61 -0
  731. package/dist/models/CreateApiKeyResponse.d.ts +58 -0
  732. package/dist/models/CreateApiKeyResponse.js +75 -0
  733. package/dist/models/CreateBudgetRequest.d.ts +110 -0
  734. package/dist/models/CreateBudgetRequest.js +88 -0
  735. package/dist/models/CreateConnectionRequest.d.ts +61 -0
  736. package/dist/models/CreateConnectionRequest.js +68 -0
  737. package/dist/models/CreateCustomDetectionTypeRequest.d.ts +47 -0
  738. package/dist/models/CreateCustomDetectionTypeRequest.js +61 -0
  739. package/dist/models/CreateDetectionEngineRequest.d.ts +46 -0
  740. package/dist/models/CreateDetectionEngineRequest.js +60 -0
  741. package/dist/models/CreateEnforcementPolicyRequest.d.ts +77 -0
  742. package/dist/models/CreateEnforcementPolicyRequest.js +77 -0
  743. package/dist/models/CreateModelAccessRequest.d.ts +60 -0
  744. package/dist/models/CreateModelAccessRequest.js +71 -0
  745. package/dist/models/CreateModelMappingRequest.d.ts +103 -0
  746. package/dist/models/CreateModelMappingRequest.js +77 -0
  747. package/dist/models/CreatePolicy.d.ts +60 -0
  748. package/dist/models/CreatePolicy.js +68 -0
  749. package/dist/models/CreatePricingRequest.d.ts +88 -0
  750. package/dist/models/CreatePricingRequest.js +79 -0
  751. package/dist/models/CreateProfileRequest.d.ts +49 -0
  752. package/dist/models/CreateProfileRequest.js +65 -0
  753. package/dist/models/CreateProviderRequest.d.ts +124 -0
  754. package/dist/models/CreateProviderRequest.js +91 -0
  755. package/dist/models/CreateRateLimitRequest.d.ts +95 -0
  756. package/dist/models/CreateRateLimitRequest.js +76 -0
  757. package/dist/models/CreateRouteGroupRequest.d.ts +46 -0
  758. package/dist/models/CreateRouteGroupRequest.js +56 -0
  759. package/dist/models/CredentialsPayload.d.ts +52 -0
  760. package/dist/models/CredentialsPayload.js +58 -0
  761. package/dist/models/CustomDetectionPatternRequest.d.ts +34 -0
  762. package/dist/models/CustomDetectionPatternRequest.js +54 -0
  763. package/dist/models/CustomDetectionPatternResponse.d.ts +34 -0
  764. package/dist/models/CustomDetectionPatternResponse.js +54 -0
  765. package/dist/models/CustomDetectionTypeResponse.d.ts +71 -0
  766. package/dist/models/CustomDetectionTypeResponse.js +91 -0
  767. package/dist/models/CustomDetectionTypesResponse.d.ts +31 -0
  768. package/dist/models/CustomDetectionTypesResponse.js +51 -0
  769. package/dist/models/DefaultModelAccess.d.ts +35 -0
  770. package/dist/models/DefaultModelAccess.js +61 -0
  771. package/dist/models/DefaultPricingEntry.d.ts +81 -0
  772. package/dist/models/DefaultPricingEntry.js +85 -0
  773. package/dist/models/DeletedResponse.d.ts +35 -0
  774. package/dist/models/DeletedResponse.js +50 -0
  775. package/dist/models/DestinationResponse.d.ts +48 -0
  776. package/dist/models/DestinationResponse.js +68 -0
  777. package/dist/models/DetectionEngineCapabilitiesResponse.d.ts +62 -0
  778. package/dist/models/DetectionEngineCapabilitiesResponse.js +82 -0
  779. package/dist/models/DetectionEngineResponse.d.ts +93 -0
  780. package/dist/models/DetectionEngineResponse.js +106 -0
  781. package/dist/models/DetectionTypeInfoResponse.d.ts +59 -0
  782. package/dist/models/DetectionTypeInfoResponse.js +78 -0
  783. package/dist/models/DetectionTypesResponse.d.ts +31 -0
  784. package/dist/models/DetectionTypesResponse.js +51 -0
  785. package/dist/models/DlpAwsTrustInfoResponse.d.ts +34 -0
  786. package/dist/models/DlpAwsTrustInfoResponse.js +54 -0
  787. package/dist/models/DlpErrorResponse.d.ts +41 -0
  788. package/dist/models/DlpErrorResponse.js +50 -0
  789. package/dist/models/EffectivePricing.d.ts +89 -0
  790. package/dist/models/EffectivePricing.js +63 -0
  791. package/dist/models/EnforcementPoliciesResponse.d.ts +31 -0
  792. package/dist/models/EnforcementPoliciesResponse.js +51 -0
  793. package/dist/models/EnforcementPolicyMcpTargetRequest.d.ts +34 -0
  794. package/dist/models/EnforcementPolicyMcpTargetRequest.js +54 -0
  795. package/dist/models/EnforcementPolicyMcpTargetResponse.d.ts +38 -0
  796. package/dist/models/EnforcementPolicyMcpTargetResponse.js +58 -0
  797. package/dist/models/EnforcementPolicyPrincipalRequest.d.ts +34 -0
  798. package/dist/models/EnforcementPolicyPrincipalRequest.js +54 -0
  799. package/dist/models/EnforcementPolicyPrincipalResponse.d.ts +38 -0
  800. package/dist/models/EnforcementPolicyPrincipalResponse.js +58 -0
  801. package/dist/models/EnforcementPolicyResponse.d.ts +101 -0
  802. package/dist/models/EnforcementPolicyResponse.js +117 -0
  803. package/dist/models/ErrorDetail.d.ts +38 -0
  804. package/dist/models/ErrorDetail.js +52 -0
  805. package/dist/models/ErrorModel.d.ts +51 -0
  806. package/dist/models/ErrorModel.js +59 -0
  807. package/dist/models/ExportDestination.d.ts +74 -0
  808. package/dist/models/ExportDestination.js +70 -0
  809. package/dist/models/ExportHealthCheck.d.ts +42 -0
  810. package/dist/models/ExportHealthCheck.js +55 -0
  811. package/dist/models/ExportResponse.d.ts +69 -0
  812. package/dist/models/ExportResponse.js +90 -0
  813. package/dist/models/ExportRuntimeStatus.d.ts +47 -0
  814. package/dist/models/ExportRuntimeStatus.js +58 -0
  815. package/dist/models/ExportSettings.d.ts +50 -0
  816. package/dist/models/ExportSettings.js +68 -0
  817. package/dist/models/ExportsResponse.d.ts +31 -0
  818. package/dist/models/ExportsResponse.js +51 -0
  819. package/dist/models/Expression.d.ts +30 -0
  820. package/dist/models/Expression.js +50 -0
  821. package/dist/models/FieldControlPoliciesResponse.d.ts +31 -0
  822. package/dist/models/FieldControlPoliciesResponse.js +51 -0
  823. package/dist/models/FieldControlPolicyResponse.d.ts +70 -0
  824. package/dist/models/FieldControlPolicyResponse.js +90 -0
  825. package/dist/models/FilterCategory.d.ts +39 -0
  826. package/dist/models/FilterCategory.js +57 -0
  827. package/dist/models/FilterOption.d.ts +38 -0
  828. package/dist/models/FilterOption.js +56 -0
  829. package/dist/models/GoogleDlpConnectionResponse.d.ts +46 -0
  830. package/dist/models/GoogleDlpConnectionResponse.js +66 -0
  831. package/dist/models/GovernanceConfig.d.ts +52 -0
  832. package/dist/models/GovernanceConfig.js +55 -0
  833. package/dist/models/HTTPValidationError.d.ts +31 -0
  834. package/dist/models/HTTPValidationError.js +49 -0
  835. package/dist/models/IdListResponse.d.ts +30 -0
  836. package/dist/models/IdListResponse.js +48 -0
  837. package/dist/models/IdpConnectionConfig.d.ts +89 -0
  838. package/dist/models/IdpConnectionConfig.js +93 -0
  839. package/dist/models/IdpConnectionResponse.d.ts +86 -0
  840. package/dist/models/IdpConnectionResponse.js +76 -0
  841. package/dist/models/IdpRoleMappingConfig.d.ts +30 -0
  842. package/dist/models/IdpRoleMappingConfig.js +48 -0
  843. package/dist/models/IdpRoleMappingResponse.d.ts +38 -0
  844. package/dist/models/IdpRoleMappingResponse.js +52 -0
  845. package/dist/models/IdpSettingsResponse.d.ts +38 -0
  846. package/dist/models/IdpSettingsResponse.js +52 -0
  847. package/dist/models/IdpTestResult.d.ts +40 -0
  848. package/dist/models/IdpTestResult.js +56 -0
  849. package/dist/models/LabeledOption.d.ts +34 -0
  850. package/dist/models/LabeledOption.js +54 -0
  851. package/dist/models/ListProfilesResponse.d.ts +31 -0
  852. package/dist/models/ListProfilesResponse.js +51 -0
  853. package/dist/models/ListRoutingRulesResponse.d.ts +40 -0
  854. package/dist/models/ListRoutingRulesResponse.js +56 -0
  855. package/dist/models/LlmGatewayAwsRoleConfigResponse.d.ts +42 -0
  856. package/dist/models/LlmGatewayAwsRoleConfigResponse.js +52 -0
  857. package/dist/models/LlmGatewayAwsTrustInfoResponse.d.ts +34 -0
  858. package/dist/models/LlmGatewayAwsTrustInfoResponse.js +54 -0
  859. package/dist/models/LocationInner.d.ts +26 -0
  860. package/dist/models/LocationInner.js +38 -0
  861. package/dist/models/LongContextTier.d.ts +58 -0
  862. package/dist/models/LongContextTier.js +62 -0
  863. package/dist/models/LongContextTierEntry.d.ts +48 -0
  864. package/dist/models/LongContextTierEntry.js +62 -0
  865. package/dist/models/LongContextTierRequest.d.ts +53 -0
  866. package/dist/models/LongContextTierRequest.js +62 -0
  867. package/dist/models/MCPServerCategory.d.ts +50 -0
  868. package/dist/models/MCPServerCategory.js +71 -0
  869. package/dist/models/MCPServerDirectoryBase.d.ts +126 -0
  870. package/dist/models/MCPServerDirectoryBase.js +141 -0
  871. package/dist/models/MCPServerDirectoryRead.d.ts +135 -0
  872. package/dist/models/MCPServerDirectoryRead.js +150 -0
  873. package/dist/models/MCPServerDirectoryReadWithServers.d.ts +140 -0
  874. package/dist/models/MCPServerDirectoryReadWithServers.js +155 -0
  875. package/dist/models/MaskFormat.d.ts +45 -0
  876. package/dist/models/MaskFormat.js +59 -0
  877. package/dist/models/MaskKeep.d.ts +25 -0
  878. package/dist/models/MaskKeep.js +51 -0
  879. package/dist/models/Match.d.ts +25 -0
  880. package/dist/models/Match.js +71 -0
  881. package/dist/models/Match1.d.ts +25 -0
  882. package/dist/models/Match1.js +71 -0
  883. package/dist/models/MetadataPatchRequest.d.ts +34 -0
  884. package/dist/models/MetadataPatchRequest.js +50 -0
  885. package/dist/models/ModelAccessTarget.d.ts +43 -0
  886. package/dist/models/ModelAccessTarget.js +78 -0
  887. package/dist/models/ModelAccessTargetOneOf.d.ts +46 -0
  888. package/dist/models/ModelAccessTargetOneOf.js +63 -0
  889. package/dist/models/ModelAccessTargetOneOf1.d.ts +46 -0
  890. package/dist/models/ModelAccessTargetOneOf1.js +63 -0
  891. package/dist/models/ModelAccessTargetOneOf2.d.ts +46 -0
  892. package/dist/models/ModelAccessTargetOneOf2.js +63 -0
  893. package/dist/models/ModelAccessTargetOneOf3.d.ts +46 -0
  894. package/dist/models/ModelAccessTargetOneOf3.js +67 -0
  895. package/dist/models/ModelAccessTargetOneOf4.d.ts +55 -0
  896. package/dist/models/ModelAccessTargetOneOf4.js +63 -0
  897. package/dist/models/ModelMapping.d.ts +155 -0
  898. package/dist/models/ModelMapping.js +111 -0
  899. package/dist/models/ModelMappingWithBudgetStatus.d.ts +192 -0
  900. package/dist/models/ModelMappingWithBudgetStatus.js +125 -0
  901. package/dist/models/ModelMappingWithProvider.d.ts +134 -0
  902. package/dist/models/ModelMappingWithProvider.js +123 -0
  903. package/dist/models/ModelMappingWithProviderAndBudgetStatus.d.ts +155 -0
  904. package/dist/models/ModelMappingWithProviderAndBudgetStatus.js +137 -0
  905. package/dist/models/ModelPricing.d.ts +94 -0
  906. package/dist/models/ModelPricing.js +86 -0
  907. package/dist/models/ModelRouteGroup.d.ts +92 -0
  908. package/dist/models/ModelRouteGroup.js +83 -0
  909. package/dist/models/ModelSource.d.ts +35 -0
  910. package/dist/models/ModelSource.js +61 -0
  911. package/dist/models/ModelStaleStatus.d.ts +31 -0
  912. package/dist/models/ModelStaleStatus.js +51 -0
  913. package/dist/models/ModelSyncMode.d.ts +35 -0
  914. package/dist/models/ModelSyncMode.js +61 -0
  915. package/dist/models/OAuthConfig.d.ts +39 -0
  916. package/dist/models/OAuthConfig.js +53 -0
  917. package/dist/models/OfInner.d.ts +25 -0
  918. package/dist/models/OfInner.js +71 -0
  919. package/dist/models/OfInner1.d.ts +25 -0
  920. package/dist/models/OfInner1.js +71 -0
  921. package/dist/models/OperatorAllInput.d.ts +31 -0
  922. package/dist/models/OperatorAllInput.js +51 -0
  923. package/dist/models/OperatorAllOutput.d.ts +31 -0
  924. package/dist/models/OperatorAllOutput.js +51 -0
  925. package/dist/models/OperatorAnyInput.d.ts +31 -0
  926. package/dist/models/OperatorAnyInput.js +51 -0
  927. package/dist/models/OperatorAnyOutput.d.ts +31 -0
  928. package/dist/models/OperatorAnyOutput.js +51 -0
  929. package/dist/models/OperatorNoneInput.d.ts +31 -0
  930. package/dist/models/OperatorNoneInput.js +51 -0
  931. package/dist/models/OperatorNoneOutput.d.ts +31 -0
  932. package/dist/models/OperatorNoneOutput.js +51 -0
  933. package/dist/models/OrgConfigResponse.d.ts +50 -0
  934. package/dist/models/OrgConfigResponse.js +70 -0
  935. package/dist/models/OrganizationRolesGroupsResponse.d.ts +39 -0
  936. package/dist/models/OrganizationRolesGroupsResponse.js +54 -0
  937. package/dist/models/PaginatedResponseAllowListEntryResponse.d.ts +39 -0
  938. package/dist/models/PaginatedResponseAllowListEntryResponse.js +59 -0
  939. package/dist/models/PaginatedResponseAllowListEntryResponseItemsInner.d.ts +58 -0
  940. package/dist/models/PaginatedResponseAllowListEntryResponseItemsInner.js +78 -0
  941. package/dist/models/PaginationMeta.d.ts +50 -0
  942. package/dist/models/PaginationMeta.js +70 -0
  943. package/dist/models/PaginationResponseApplicationDirectoryResponse.d.ts +36 -0
  944. package/dist/models/PaginationResponseApplicationDirectoryResponse.js +56 -0
  945. package/dist/models/PaginationResponseApplicationResponse.d.ts +36 -0
  946. package/dist/models/PaginationResponseApplicationResponse.js +56 -0
  947. package/dist/models/PaginationResponseMCPServerDirectoryReadWithServers.d.ts +36 -0
  948. package/dist/models/PaginationResponseMCPServerDirectoryReadWithServers.js +56 -0
  949. package/dist/models/PaginationResponsePolicyImpactSummary.d.ts +36 -0
  950. package/dist/models/PaginationResponsePolicyImpactSummary.js +56 -0
  951. package/dist/models/PaginationResponsePolicyRevisionSummary.d.ts +36 -0
  952. package/dist/models/PaginationResponsePolicyRevisionSummary.js +56 -0
  953. package/dist/models/PaginationResponsePolicySummary.d.ts +36 -0
  954. package/dist/models/PaginationResponsePolicySummary.js +56 -0
  955. package/dist/models/PaginationResponseServerListResponse.d.ts +36 -0
  956. package/dist/models/PaginationResponseServerListResponse.js +56 -0
  957. package/dist/models/PolicyAttributionResponse.d.ts +47 -0
  958. package/dist/models/PolicyAttributionResponse.js +63 -0
  959. package/dist/models/PolicyDetail.d.ts +83 -0
  960. package/dist/models/PolicyDetail.js +94 -0
  961. package/dist/models/PolicyDetailResponse.d.ts +31 -0
  962. package/dist/models/PolicyDetailResponse.js +51 -0
  963. package/dist/models/PolicyImpactSeverityCounts.d.ts +51 -0
  964. package/dist/models/PolicyImpactSeverityCounts.js +54 -0
  965. package/dist/models/PolicyImpactSummary.d.ts +105 -0
  966. package/dist/models/PolicyImpactSummary.js +105 -0
  967. package/dist/models/PolicyRevisionCompareResponse.d.ts +58 -0
  968. package/dist/models/PolicyRevisionCompareResponse.js +67 -0
  969. package/dist/models/PolicyRevisionCompareSide.d.ts +54 -0
  970. package/dist/models/PolicyRevisionCompareSide.js +69 -0
  971. package/dist/models/PolicyRevisionDetailResponse.d.ts +37 -0
  972. package/dist/models/PolicyRevisionDetailResponse.js +53 -0
  973. package/dist/models/PolicyRevisionSummary.d.ts +79 -0
  974. package/dist/models/PolicyRevisionSummary.js +82 -0
  975. package/dist/models/PolicyRuleConditionInput.d.ts +31 -0
  976. package/dist/models/PolicyRuleConditionInput.js +51 -0
  977. package/dist/models/PolicyRuleConditionOutput.d.ts +31 -0
  978. package/dist/models/PolicyRuleConditionOutput.js +51 -0
  979. package/dist/models/PolicyRuleInput.d.ts +55 -0
  980. package/dist/models/PolicyRuleInput.js +63 -0
  981. package/dist/models/PolicyRuleOutput.d.ts +55 -0
  982. package/dist/models/PolicyRuleOutput.js +63 -0
  983. package/dist/models/PolicyStatus.d.ts +34 -0
  984. package/dist/models/PolicyStatus.js +60 -0
  985. package/dist/models/PolicySummary.d.ts +86 -0
  986. package/dist/models/PolicySummary.js +89 -0
  987. package/dist/models/PolicySummaryResponse.d.ts +46 -0
  988. package/dist/models/PolicySummaryResponse.js +56 -0
  989. package/dist/models/Posture.d.ts +31 -0
  990. package/dist/models/Posture.js +57 -0
  991. package/dist/models/PresidioConnectionResponse.d.ts +46 -0
  992. package/dist/models/PresidioConnectionResponse.js +66 -0
  993. package/dist/models/PricingChangeSource.d.ts +34 -0
  994. package/dist/models/PricingChangeSource.js +60 -0
  995. package/dist/models/PricingRuleSummary.d.ts +146 -0
  996. package/dist/models/PricingRuleSummary.js +118 -0
  997. package/dist/models/PricingSyncMode.d.ts +27 -0
  998. package/dist/models/PricingSyncMode.js +53 -0
  999. package/dist/models/Protocol.d.ts +25 -0
  1000. package/dist/models/Protocol.js +51 -0
  1001. package/dist/models/Provider.d.ts +200 -0
  1002. package/dist/models/Provider.js +144 -0
  1003. package/dist/models/ProviderConnectionResponse.d.ts +28 -0
  1004. package/dist/models/ProviderConnectionResponse.js +92 -0
  1005. package/dist/models/ProviderConnectionResponseOneOf.d.ts +57 -0
  1006. package/dist/models/ProviderConnectionResponseOneOf.js +79 -0
  1007. package/dist/models/ProviderConnectionResponseOneOf1.d.ts +49 -0
  1008. package/dist/models/ProviderConnectionResponseOneOf1.js +71 -0
  1009. package/dist/models/ProviderConnectionResponseOneOf2.d.ts +57 -0
  1010. package/dist/models/ProviderConnectionResponseOneOf2.js +79 -0
  1011. package/dist/models/ProviderConnectionResponseOneOf3.d.ts +73 -0
  1012. package/dist/models/ProviderConnectionResponseOneOf3.js +87 -0
  1013. package/dist/models/ProviderConnectionResponseOneOf4.d.ts +77 -0
  1014. package/dist/models/ProviderConnectionResponseOneOf4.js +91 -0
  1015. package/dist/models/ProviderConnectionResponseOneOf5.d.ts +57 -0
  1016. package/dist/models/ProviderConnectionResponseOneOf5.js +79 -0
  1017. package/dist/models/ProviderConnectionResponseOneOf6.d.ts +57 -0
  1018. package/dist/models/ProviderConnectionResponseOneOf6.js +79 -0
  1019. package/dist/models/PublishBlocker.d.ts +27 -0
  1020. package/dist/models/PublishBlocker.js +53 -0
  1021. package/dist/models/ReorderEntry.d.ts +34 -0
  1022. package/dist/models/ReorderEntry.js +54 -0
  1023. package/dist/models/ReorderModelMappingsRequest.d.ts +31 -0
  1024. package/dist/models/ReorderModelMappingsRequest.js +51 -0
  1025. package/dist/models/ReorderedResponse.d.ts +30 -0
  1026. package/dist/models/ReorderedResponse.js +50 -0
  1027. package/dist/models/ResolvedProtectionResponse.d.ts +31 -0
  1028. package/dist/models/ResolvedProtectionResponse.js +51 -0
  1029. package/dist/models/ResolvedProtectionRuleResponse.d.ts +87 -0
  1030. package/dist/models/ResolvedProtectionRuleResponse.js +91 -0
  1031. package/dist/models/ResolvedRef.d.ts +42 -0
  1032. package/dist/models/ResolvedRef.js +62 -0
  1033. package/dist/models/RevokedResponse.d.ts +30 -0
  1034. package/dist/models/RevokedResponse.js +50 -0
  1035. package/dist/models/RouteHealthStatus.d.ts +53 -0
  1036. package/dist/models/RouteHealthStatus.js +66 -0
  1037. package/dist/models/RoutingPolicy.d.ts +90 -0
  1038. package/dist/models/RoutingPolicy.js +99 -0
  1039. package/dist/models/RoutingPolicyDraft.d.ts +68 -0
  1040. package/dist/models/RoutingPolicyDraft.js +72 -0
  1041. package/dist/models/RoutingPolicyUpdate.d.ts +69 -0
  1042. package/dist/models/RoutingPolicyUpdate.js +68 -0
  1043. package/dist/models/RoutingRule.d.ts +60 -0
  1044. package/dist/models/RoutingRule.js +76 -0
  1045. package/dist/models/RoutingRuleDraft.d.ts +46 -0
  1046. package/dist/models/RoutingRuleDraft.js +60 -0
  1047. package/dist/models/RoutingRuleWriteResponse.d.ts +65 -0
  1048. package/dist/models/RoutingRuleWriteResponse.js +81 -0
  1049. package/dist/models/RoutingSlot.d.ts +41 -0
  1050. package/dist/models/RoutingSlot.js +54 -0
  1051. package/dist/models/RuleConflict.d.ts +43 -0
  1052. package/dist/models/RuleConflict.js +58 -0
  1053. package/dist/models/ScopeJson.d.ts +42 -0
  1054. package/dist/models/ScopeJson.js +54 -0
  1055. package/dist/models/ScopeType.d.ts +43 -0
  1056. package/dist/models/ScopeType.js +69 -0
  1057. package/dist/models/ServerConnectionResponse.d.ts +62 -0
  1058. package/dist/models/ServerConnectionResponse.js +73 -0
  1059. package/dist/models/ServerListResponse.d.ts +156 -0
  1060. package/dist/models/ServerListResponse.js +170 -0
  1061. package/dist/models/ServerResponse.d.ts +158 -0
  1062. package/dist/models/ServerResponse.js +174 -0
  1063. package/dist/models/ServerSource.d.ts +30 -0
  1064. package/dist/models/ServerSource.js +56 -0
  1065. package/dist/models/SetApiKeyDisabledRequest.d.ts +30 -0
  1066. package/dist/models/SetApiKeyDisabledRequest.js +50 -0
  1067. package/dist/models/StaleReason.d.ts +24 -0
  1068. package/dist/models/StaleReason.js +50 -0
  1069. package/dist/models/TestFindingResponse.d.ts +90 -0
  1070. package/dist/models/TestFindingResponse.js +106 -0
  1071. package/dist/models/TestProcessTextRequest.d.ts +55 -0
  1072. package/dist/models/TestProcessTextRequest.js +65 -0
  1073. package/dist/models/TestProcessTextResponse.d.ts +56 -0
  1074. package/dist/models/TestProcessTextResponse.js +72 -0
  1075. package/dist/models/TokenizationConnectionResponse.d.ts +38 -0
  1076. package/dist/models/TokenizationConnectionResponse.js +58 -0
  1077. package/dist/models/TrafficType.d.ts +26 -0
  1078. package/dist/models/TrafficType.js +52 -0
  1079. package/dist/models/UpdateBudgetRequest.d.ts +64 -0
  1080. package/dist/models/UpdateBudgetRequest.js +64 -0
  1081. package/dist/models/UpdateConnectionRequest.d.ts +56 -0
  1082. package/dist/models/UpdateConnectionRequest.js +60 -0
  1083. package/dist/models/UpdateContractRequest.d.ts +41 -0
  1084. package/dist/models/UpdateContractRequest.js +55 -0
  1085. package/dist/models/UpdateCustomDetectionTypeRequest.d.ts +47 -0
  1086. package/dist/models/UpdateCustomDetectionTypeRequest.js +57 -0
  1087. package/dist/models/UpdateDetectionEngineRequest.d.ts +46 -0
  1088. package/dist/models/UpdateDetectionEngineRequest.js +56 -0
  1089. package/dist/models/UpdateEnforcementPolicyRequest.d.ts +77 -0
  1090. package/dist/models/UpdateEnforcementPolicyRequest.js +73 -0
  1091. package/dist/models/UpdateFieldControlPolicyRequest.d.ts +42 -0
  1092. package/dist/models/UpdateFieldControlPolicyRequest.js +54 -0
  1093. package/dist/models/UpdateModelAccessRequest.d.ts +70 -0
  1094. package/dist/models/UpdateModelAccessRequest.js +65 -0
  1095. package/dist/models/UpdateModelMappingRequest.d.ts +79 -0
  1096. package/dist/models/UpdateModelMappingRequest.js +66 -0
  1097. package/dist/models/UpdateOrgConfigRequest.d.ts +34 -0
  1098. package/dist/models/UpdateOrgConfigRequest.js +50 -0
  1099. package/dist/models/UpdatePolicy.d.ts +56 -0
  1100. package/dist/models/UpdatePolicy.js +62 -0
  1101. package/dist/models/UpdatePricingRequest.d.ts +70 -0
  1102. package/dist/models/UpdatePricingRequest.js +65 -0
  1103. package/dist/models/UpdateProviderRequest.d.ts +124 -0
  1104. package/dist/models/UpdateProviderRequest.js +81 -0
  1105. package/dist/models/UpdateRateLimitRequest.d.ts +87 -0
  1106. package/dist/models/UpdateRateLimitRequest.js +72 -0
  1107. package/dist/models/UpdateRouteGroupRequest.d.ts +46 -0
  1108. package/dist/models/UpdateRouteGroupRequest.js +54 -0
  1109. package/dist/models/UpdateSettingsRequest.d.ts +50 -0
  1110. package/dist/models/UpdateSettingsRequest.js +58 -0
  1111. package/dist/models/UpsertAwsBedrockGuardrailsRequest.d.ts +66 -0
  1112. package/dist/models/UpsertAwsBedrockGuardrailsRequest.js +68 -0
  1113. package/dist/models/UpsertAwsComprehendPiiRequest.d.ts +62 -0
  1114. package/dist/models/UpsertAwsComprehendPiiRequest.js +64 -0
  1115. package/dist/models/UpsertAzureAiLanguagePiiRequest.d.ts +42 -0
  1116. package/dist/models/UpsertAzureAiLanguagePiiRequest.js +56 -0
  1117. package/dist/models/UpsertAzureContentSafetyRequest.d.ts +42 -0
  1118. package/dist/models/UpsertAzureContentSafetyRequest.js +56 -0
  1119. package/dist/models/UpsertConnectionRequest.d.ts +28 -0
  1120. package/dist/models/UpsertConnectionRequest.js +92 -0
  1121. package/dist/models/UpsertConnectionRequestOneOf.d.ts +53 -0
  1122. package/dist/models/UpsertConnectionRequestOneOf.js +69 -0
  1123. package/dist/models/UpsertConnectionRequestOneOf1.d.ts +45 -0
  1124. package/dist/models/UpsertConnectionRequestOneOf1.js +65 -0
  1125. package/dist/models/UpsertConnectionRequestOneOf2.d.ts +53 -0
  1126. package/dist/models/UpsertConnectionRequestOneOf2.js +69 -0
  1127. package/dist/models/UpsertConnectionRequestOneOf3.d.ts +73 -0
  1128. package/dist/models/UpsertConnectionRequestOneOf3.js +77 -0
  1129. package/dist/models/UpsertConnectionRequestOneOf4.d.ts +77 -0
  1130. package/dist/models/UpsertConnectionRequestOneOf4.js +81 -0
  1131. package/dist/models/UpsertConnectionRequestOneOf5.d.ts +53 -0
  1132. package/dist/models/UpsertConnectionRequestOneOf5.js +69 -0
  1133. package/dist/models/UpsertConnectionRequestOneOf6.d.ts +53 -0
  1134. package/dist/models/UpsertConnectionRequestOneOf6.js +69 -0
  1135. package/dist/models/UpsertFieldControlPolicyRequest.d.ts +46 -0
  1136. package/dist/models/UpsertFieldControlPolicyRequest.js +60 -0
  1137. package/dist/models/UpsertGoogleDlpRequest.d.ts +42 -0
  1138. package/dist/models/UpsertGoogleDlpRequest.js +56 -0
  1139. package/dist/models/UpsertPresidioRequest.d.ts +42 -0
  1140. package/dist/models/UpsertPresidioRequest.js +56 -0
  1141. package/dist/models/UpsertTokenizationRequest.d.ts +34 -0
  1142. package/dist/models/UpsertTokenizationRequest.js +52 -0
  1143. package/dist/models/ValidateAwsRoleRequest.d.ts +38 -0
  1144. package/dist/models/ValidateAwsRoleRequest.js +58 -0
  1145. package/dist/models/ValidatePolicyRequest.d.ts +42 -0
  1146. package/dist/models/ValidatePolicyRequest.js +56 -0
  1147. package/dist/models/ValidatePolicyResponse.d.ts +38 -0
  1148. package/dist/models/ValidatePolicyResponse.js +56 -0
  1149. package/dist/models/ValidationError.d.ts +47 -0
  1150. package/dist/models/ValidationError.js +63 -0
  1151. package/dist/models/WebhookSecretResponse.d.ts +30 -0
  1152. package/dist/models/WebhookSecretResponse.js +50 -0
  1153. package/dist/models/WithAttributionModelAccessPolicy.d.ts +119 -0
  1154. package/dist/models/WithAttributionModelAccessPolicy.js +100 -0
  1155. package/dist/models/WithAttributionRateLimitPolicy.d.ts +188 -0
  1156. package/dist/models/WithAttributionRateLimitPolicy.js +107 -0
  1157. package/dist/models/WithAttributionTokenBudget.d.ts +200 -0
  1158. package/dist/models/WithAttributionTokenBudget.js +127 -0
  1159. package/dist/models/index.d.ts +272 -249
  1160. package/dist/models/index.js +290 -0
  1161. package/dist/runtime.d.ts +214 -0
  1162. package/dist/runtime.js +437 -0
  1163. package/package.json +28 -99
  1164. package/dist/auth/clientCredentials.d.ts +0 -67
  1165. package/dist/auth/clientCredentials.d.ts.map +0 -1
  1166. package/dist/auth/index.d.ts +0 -14
  1167. package/dist/auth/index.d.ts.map +0 -1
  1168. package/dist/auth/pkce.d.ts +0 -98
  1169. package/dist/auth/pkce.d.ts.map +0 -1
  1170. package/dist/auth/store.d.ts +0 -168
  1171. package/dist/auth/store.d.ts.map +0 -1
  1172. package/dist/client.d.ts +0 -363
  1173. package/dist/client.d.ts.map +0 -1
  1174. package/dist/config.d.ts +0 -154
  1175. package/dist/config.d.ts.map +0 -1
  1176. package/dist/exceptions/index.d.ts +0 -119
  1177. package/dist/exceptions/index.d.ts.map +0 -1
  1178. package/dist/http/client.d.ts +0 -82
  1179. package/dist/http/client.d.ts.map +0 -1
  1180. package/dist/index.d.ts.map +0 -1
  1181. package/dist/index.esm.js +0 -13
  1182. package/dist/logging.d.ts +0 -48
  1183. package/dist/logging.d.ts.map +0 -1
  1184. package/dist/models/index.d.ts.map +0 -1
  1185. package/dist/quickstart.d.ts +0 -106
  1186. package/dist/quickstart.d.ts.map +0 -1
  1187. package/dist/version.d.ts +0 -17
  1188. package/dist/version.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,13 +1,22 @@
1
- "use strict";var e=require("os"),t=require("path"),r=require("fs/promises"),n=require("jose"),o=require("crypto"),s=require("http"),a=require("url"),i=require("child_process"),c=require("readline"),l=require("pkce-challenge"),u=require("fs"),d="undefined"!=typeof document?document.currentScript:null;class p extends Error{constructor(e){super(e),this.name="BarndoorError"}}class h extends p{constructor(e,t=null){super(e),this.name="AuthenticationError",this.errorCode=t}}class f extends h{constructor(e,t=null){let r=e;r+=t?` ${t}`:" Run 'barndoor-login' to authenticate.",super(r),this.name="TokenError",this.helpText=t}}class m extends f{}class y extends p{constructor(e,t){let r;const n=t.toString().toLowerCase();r=n.includes("timeout")?`Connection to ${e} timed out. Please check your internet connection and try again.`:n.includes("connection refused")?`Could not connect to ${e}. The service may be unavailable.`:n.includes("name resolution")||n.includes("getaddrinfo")?`Could not resolve hostname for ${e}. Please check the URL and your DNS settings.`:`Failed to connect to ${e}. Please check your internet connection.`,super(r),this.url=e,this.originalError=t}}class g extends p{constructor(e,t,r=null){super(g._createUserFriendlyMessage(e,t,r)),this.name="HTTPError",this.statusCode=e,this.responseBody=r}static _createUserFriendlyMessage(e,t,r){const n=`Request failed (HTTP ${e})`;return 400===e?`${n}: Invalid request. Please check your input parameters.`:401===e?`${n}: Authentication failed. Please check your token or re-authenticate.`:403===e?`${n}: Access denied. You don't have permission for this operation.`:404===e?`${n}: Resource not found. Please check the server ID or URL.`:429===e?`${n}: Rate limit exceeded. Please wait before making more requests.`:e>=500&&e<600?`${n}: Server error. Please try again later or contact support.`:`${n}: ${t}`}}class v extends p{constructor(e,t=null){let r=`Server '${e}' not found`;r+=t?`. Available servers: ${t.join(", ")}`:". Use listServers() to see available servers.",super(r),this.serverIdentifier=e,this.availableServers=t}}let _=class extends h{};class w extends p{}class $ extends p{}class b{constructor(e=30,t=10){this.read=1e3*e,this.connect=1e3*t}}class k{constructor(e=new b,t=3){this.timeoutConfig=e,this.maxRetries=t,this.closed=!1}async request(e,t,r={}){if(this.closed)throw new Error("HTTP client has been closed");const{headers:n={},json:o,params:s,...a}=r,i=this._buildUrl(t,s),c={method:e.toUpperCase(),headers:{"Content-Type":"application/json","User-Agent":"barndoor-js-sdk/0.1.0",...n},...a};let l;o&&(c.body=JSON.stringify(o));for(let t=0;t<=this.maxRetries;t++){const r=new AbortController,n=this.timeoutConfig.connect+this.timeoutConfig.read,o=setTimeout(()=>r.abort(),n),s={...c,signal:r.signal};try{const e=await globalThis.fetch(i,s);if(clearTimeout(o),!e.ok){let t="";try{const r=e;"function"==typeof r.text?t=await r.text():"function"==typeof r.json&&(t=JSON.stringify(await r.json()))}catch{}throw new g(e.status,e.statusText,t)}if(204===e.status||205===e.status||304===e.status)return null;let t="";const r=e,n=r&&r.headers;let a;return n&&("function"==typeof n.get?t=n.get("content-type")||n.get("Content-Type")||"":"object"==typeof n&&(t=n["content-type"]||n["Content-Type"]||"")),a=t.includes("application/json")||!t&&"function"==typeof r.json?await e.json():t.includes("text/")||!t&&"function"==typeof r.text?await e.text():"function"==typeof r.arrayBuffer?await e.arrayBuffer():e,a}catch(r){if(clearTimeout(o),r instanceof Error&&"AbortError"===r.name){const e=this.timeoutConfig.connect+this.timeoutConfig.read;l=new $(`Request to ${i} timed out after ${e}ms`)}else if(r instanceof g){if(r.statusCode>=400&&r.statusCode<500)throw r;if(!(r.statusCode>=500&&r.statusCode<600))throw r;{const t=e.toUpperCase();if(!("GET"===t||"HEAD"===t||"OPTIONS"===t))throw r;l=r}}else l=r instanceof Error&&"TypeError"===r.name&&r.message.includes("fetch")?new y(i,r):r instanceof Error?r:new Error(String(r));if(t===this.maxRetries)break;const n=Math.min(1e3*Math.pow(2,t),1e4);await this._sleep(n)}}throw l||(l=new Error(`Request to ${i} failed after ${this.maxRetries+1} attempts with no specific error`)),l}_buildUrl(e,t){if(!t||0===Object.keys(t).length)return e;const r=new URL(e);return Object.entries(t).forEach(([e,t])=>{null!=t&&r.searchParams.append(e,String(t))}),r.toString()}_sleep(e){return new Promise(t=>setTimeout(t,e))}async close(){this.closed=!0}async aclose(){await this.close()}}class E{constructor(e){if(this.id=e.id,this.name=e.name,this.slug=e.slug,this.provider=e.provider??null,this.connection_status=e.connection_status,!(this.id&&this.name&&this.slug&&this.connection_status))throw new Error("ServerSummary missing required fields")}static fromApiResponse(e){return new E(e)}}class P extends E{constructor(e){super(e),this.url=e.url??null}static fromApiResponse(e){return new P(e)}}class S{constructor(e){if(this.agent_token=e.agent_token,this.expires_in=e.expires_in,!this.agent_token||"number"!=typeof this.expires_in)throw new Error("AgentToken missing required fields")}static fromApiResponse(e){return new S(e)}}const T={production:{issuer:"https://auth.barndoor.ai/realms/barndoor",audience:"https://barndoor.ai/",baseUrl:"https://{org_slug}.platform.barndoor.ai"},uat:{issuer:"https://auth.barndooruat.com/realms/barndoor",audience:"https://barndoor.ai/",baseUrl:"https://{org_slug}.trial.barndooruat.com"},dev:{issuer:"https://auth.barndoordev.com/realms/barndoor",audience:"https://barndoor.ai/",baseUrl:"https://{org_slug}.platform.barndoordev.com"},"enterprise-production":{issuer:"https://auth.barndoor.ai",audience:"https://barndoor.ai/",baseUrl:"https://{org_slug}.mcp.barndoor.ai"},"enterprise-uat":{issuer:"https://auth.barndooruat.com",audience:"https://barndoor.ai/",baseUrl:"https://{org_slug}.mcp.barndooruat.com"},"enterprise-dev":{issuer:"https://auth.barndoordev.com",audience:"https://barndoor.ai/",baseUrl:"https://{org_slug}.mcp.barndoordev.com"},localdev:{issuer:"http://localhost:8080/realms/barndoor",audience:"https://barndoor.ai/",baseUrl:"http://localhost:8000"}},x="undefined"!=typeof window&&void 0!==window.document,I="undefined"==typeof window&&"undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node;function C(e,t=""){return I?process.env[e]??t:x&&window.ENV?window.ENV[e]??t:t}class N{constructor(e={}){const t=e.environment??(C("MODE")||C("BARNDOOR_ENV")||"production");this.environment={production:"production",prod:"production",uat:"uat",dev:"dev",development:"dev","enterprise-production":"enterprise-production","enterprise-prod":"enterprise-production","enterprise-uat":"enterprise-uat","enterprise-dev":"enterprise-dev",enterprise:"enterprise-production",localdev:"localdev",local:"localdev"}[t.toLowerCase()]??"production";const r=T[this.environment]??T.production,n=C("AUTH_URL"),o=e.authDomain??C("AUTH_DOMAIN");e.authIssuer?this.authIssuer=e.authIssuer:this.authIssuer=n||(o?o.startsWith("http")?o:`https://${o}`:r.issuer),this.clientId=e.clientId??(C("AGENT_CLIENT_ID")||C("AUTH_CLIENT_ID")||""),this.clientSecret=e.clientSecret??(C("AGENT_CLIENT_SECRET")||C("AUTH_CLIENT_SECRET")||""),this.apiAudience=e.apiAudience??(C("API_AUDIENCE")||r.audience),this.promptForLogin=e.promptForLogin??!1,this.skipLoginLocal=e.skipLoginLocal??!1,this.baseUrl=e.baseUrl??(C("BARNDOOR_API")||C("BARNDOOR_URL")||r.baseUrl)}get authDomain(){let e=this.authIssuer;return e.startsWith("https://")?e=e.slice(8):e.startsWith("http://")&&(e=e.slice(7)),e}static getStaticConfig(){return new N}static getDynamicConfig(e,t={}){const{requireOrganization:r=!0,fallbackOrganizationId:n}=t,o=new N,s=j(e);if(s.hasOrganization){const e=String(s.organizationId??"").trim().toLowerCase();if(!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(e))throw new w("Invalid organization subdomain format from token");return o.baseUrl=o.baseUrl.replace("{org_slug}",e),o}if(n)return o.baseUrl=o.baseUrl.replace("{org_slug}",n),o;if(r){const e=s.error||"No organization information found in token";throw new w(`Failed to extract organization ID from token: ${e}. This token may be for a personal account or may be missing organization claims. Consider using getStaticConfig() for organization-independent operations or provide a fallbackOrganizationId in the options.`)}return o}validate(){if(!this.authIssuer||""===this.authIssuer.trim())throw new w("authIssuer is required");if(!this.apiAudience||""===this.apiAudience.trim())throw new w("apiAudience is required");if(!this.baseUrl||""===this.baseUrl.trim())throw new w("baseUrl is required")}}function j(e){try{const t=e.split(".");if(3!==t.length)return{hasOrganization:!1,error:"Invalid JWT format - expected 3 parts separated by dots"};let r,n;try{r=JSON.parse(function(e){if("undefined"!=typeof globalThis&&globalThis.atob)return globalThis.atob(e);if("undefined"!=typeof Buffer)return Buffer.from(e,"base64").toString("utf-8");throw new Error("No base64 decode function available")}(t[1].replace(/-/g,"+").replace(/_/g,"/")))}catch(e){return{hasOrganization:!1,error:"Failed to parse JWT payload - token may be corrupted"}}if(r.user&&"object"==typeof r.user&&(n=r.user.organization_name??r.user.organization_slug),!n){const e=r["https://barndoor.ai/organization_slug"],t=r.organization_slug,o=r.organization_name,s=r.org_slug;n=("string"==typeof o?o:void 0)??("string"==typeof e?e:void 0)??("string"==typeof t?t:void 0)??("string"==typeof s?s:void 0)}return n&&"string"==typeof n&&""!==n.trim()?{organizationId:n.trim(),hasOrganization:!0}:{hasOrganization:!1,error:"No organization information found in token. This token may be for a personal account or may be missing organization claims."}}catch(e){return{hasOrganization:!1,error:`Failed to decode JWT token: ${e instanceof Error?e.message:String(e)}`}}}function R(){return N.getStaticConfig()}function O(e,t){return N.getDynamicConfig(e,t)}function z(e){return j(e).hasOrganization}let A={debug:(e,...t)=>{"undefined"!=typeof console&&console.debug&&console.debug(e,...t)},info:(e,...t)=>{"undefined"!=typeof console&&console.info&&console.info(e,...t)},warn:(e,...t)=>{"undefined"!=typeof console&&console.warn&&console.warn(e,...t)},error:(e,...t)=>{"undefined"!=typeof console&&console.error&&console.error(e,...t)}};function M(e){return{debug:(t,...r)=>{A.debug(`[${e}] ${t}`,...r)},info:(t,...r)=>{A.info(`[${e}] ${t}`,...r)},warn:(t,...r)=>{A.warn(`[${e}] ${t}`,...r)},error:(t,...r)=>{A.error(`[${e}] ${t}`,...r)}}}const U=M("token"),D=new Map;async function q(e){if(D.has(e))return D.get(e);const t=e.replace(/\/$/,""),r=`${t}/.well-known/openid-configuration`;try{const t=new AbortController,n=setTimeout(()=>t.abort(),5e3);try{const n=await fetch(r,{signal:t.signal});if(!n.ok)throw new Error(`HTTP ${n.status}`);const o=await n.json();return D.set(e,o),U.debug(`OIDC discovery successful for ${e}`),o}finally{clearTimeout(n)}}catch(r){return U.warn(`OIDC discovery failed for ${e}:`,r),t.includes("/realms/")?{issuer:t,token_endpoint:`${t}/protocol/openid-connect/token`,authorization_endpoint:`${t}/protocol/openid-connect/auth`,userinfo_endpoint:`${t}/protocol/openid-connect/userinfo`,jwks_uri:`${t}/protocol/openid-connect/certs`}:{issuer:t,token_endpoint:`${t}/oauth/token`,authorization_endpoint:`${t}/authorize`,userinfo_endpoint:`${t}/userinfo`,jwks_uri:`${t}/.well-known/jwks.json`}}}function V(e){try{const t=e.split(".");if(3!==t.length)return null;const r=JSON.parse(function(e){const t=e.replace(/-/g,"+").replace(/_/g,"/");if(I)return Buffer.from(t,"base64").toString("utf8");if("undefined"!=typeof globalThis&&globalThis.atob)return globalThis.atob(t);throw new Error("No base64 decode function available")}(t[1]));return r}catch(e){return null}}function F(e,t){return"undefined"!=typeof AbortSignal&&"timeout"in AbortSignal?e:Promise.race([e,new Promise((e,r)=>{setTimeout(()=>r(new Error("Request timeout")),t)})])}var L;exports.JWTVerificationResult=void 0,(L=exports.JWTVerificationResult||(exports.JWTVerificationResult={})).VALID="valid",L.EXPIRED="expired",L.INVALID="invalid";const H=new Map;class K{constructor(e){this.lockAcquired=!1,this.lockFile=`${e}.lock`}async acquire(e=5e3){if(!I)return;const t=Date.now();for(;Date.now()-t<e;)try{return await r.writeFile(this.lockFile,process.pid.toString(),{flag:"wx"}),void(this.lockAcquired=!0)}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"EEXIST"!==e.code)throw new f(`Failed to acquire file lock: ${e}`);try{const e=await r.readFile(this.lockFile,"utf8"),t=parseInt(e.trim(),10);try{process.kill(t,0),await new Promise(e=>setTimeout(e,100));continue}catch(e){if(e&&"object"==typeof e&&"code"in e){const t=e;if("EPERM"===t.code){await new Promise(e=>setTimeout(e,100));continue}if("ESRCH"===t.code){await r.unlink(this.lockFile).catch(()=>{});continue}}await r.unlink(this.lockFile).catch(()=>{});continue}}catch{await r.unlink(this.lockFile).catch(()=>{});continue}}throw new f("Failed to acquire file lock: timeout")}async release(){if(I&&this.lockAcquired)try{await r.unlink(this.lockFile),this.lockAcquired=!1}catch(e){console.debug("Failed to release file lock:",e)}}}class Z{}class G extends Z{constructor(){super(),this.storageKey="barndoor_token"}async loadToken(){try{const e=localStorage.getItem(this.storageKey);return e?JSON.parse(e):null}catch(e){return U.warn("Failed to load token from localStorage:",e),null}}async saveToken(e){try{localStorage.setItem(this.storageKey,JSON.stringify(e))}catch(e){const t=e instanceof Error?e.message:String(e);throw new f(`Failed to save token: ${t}`)}}async clearToken(){try{localStorage.removeItem(this.storageKey)}catch(e){U.warn("Failed to clear token from localStorage:",e)}}}class J extends Z{constructor(){super(),this.tokenFile=this._getTokenFilePath()}_getTokenFilePath(){if(I)return t.join(e.homedir(),".barndoor","token.json");throw new Error("NodeTokenStorage can only be used in Node.js environment")}async loadToken(){if(!I)throw new Error("NodeTokenStorage can only be used in Node.js environment");const e=new K(this.tokenFile);try{await e.acquire();const t=await r.readFile(this.tokenFile,"utf8");return JSON.parse(t)}catch(e){return e&&"object"==typeof e&&"code"in e&&"ENOENT"===e.code||U.warn("Failed to load token from file:",e),null}finally{await e.release()}}async saveToken(e){if(!I)throw new Error("NodeTokenStorage can only be used in Node.js environment");const n=new K(this.tokenFile);try{await n.acquire(),await r.mkdir(t.dirname(this.tokenFile),{recursive:!0}),await r.writeFile(this.tokenFile,JSON.stringify(e,null,2)),await r.chmod(this.tokenFile,384),U.debug("Token saved to storage")}catch(e){const t=e instanceof Error?e.message:String(e);throw new f(`Failed to save token: ${t}`)}finally{await n.release()}}async clearToken(){if(!I)throw new Error("NodeTokenStorage can only be used in Node.js environment");try{await r.unlink(this.tokenFile)}catch(e){e&&"object"==typeof e&&"code"in e&&"ENOENT"!==e.code&&U.warn("Failed to clear token file:",e)}}}function W(){if(x)return new G;if(I)return new J;throw new Error("Unsupported environment for token storage")}async function B(e,t,r){try{const o=await async function(e){if(H.has(e))return H.get(e);try{const t=(await q(e)).jwks_uri;if(!t)throw U.debug(`No jwks_uri in OIDC config for ${e}`),new Error("No jwks_uri available");const r=n.createRemoteJWKSet(new URL(t));return H.set(e,r),r}catch(t){throw U.debug(`Failed to get JWKS for ${e}:`,t),t}}(t),s=`${t.replace(/\/$/,"")}/`;return await n.jwtVerify(e,o,{issuer:s,audience:r}),U.debug("Token verified locally using JWKS"),exports.JWTVerificationResult.VALID}catch(e){return e&&"object"==typeof e&&"code"in e&&"ERR_JWT_EXPIRED"===e.code?(U.debug("Token expired (verified locally)"),exports.JWTVerificationResult.EXPIRED):(U.debug("JWT verification failed:",e),exports.JWTVerificationResult.INVALID)}}class Q{constructor(){this._locked=!1,this._waitQueue=[]}async acquire(){return new Promise(e=>{this._locked?this._waitQueue.push(e):(this._locked=!0,e())})}release(){if(this._waitQueue.length>0){const e=this._waitQueue.shift();e&&e()}else this._locked=!1}async withLock(e){await this.acquire();try{return await e()}finally{this.release()}}}class Y{constructor(e){this._refreshMutex=new Q,this.storage=W()}async getValidToken(){return this._refreshMutex.withLock(async()=>{const e=await this.storage.loadToken();if(!e)throw new f("No token found. Please authenticate.");try{if(this._shouldRefreshToken(e)&&e.refresh_token){U.debug("Proactively refreshing token before expiration");const t=await this._refreshToken(e),r={...e,...t};return await this.storage.saveToken(r),r.access_token}const t=await this._validateOrRefresh(e);return await this.storage.saveToken(t),t.access_token}catch(e){throw U.error("Token validation/refresh failed:",e),new m("Token expired and refresh failed. Please re-authenticate.")}})}_shouldRefreshToken(e){const t=V(e.access_token);if(!t?.exp)return!0;const r=Math.floor(Date.now()/1e3);return t.exp-r<300}async _validateOrRefresh(e){const t=e.access_token,r=R(),n=await B(t,r.authIssuer,r.apiAudience);if(n===exports.JWTVerificationResult.VALID)return U.debug("Token validated locally"),e;if(n===exports.JWTVerificationResult.INVALID&&(U.debug("Local validation failed, trying remote"),await this._isTokenValidRemote(t)))return U.debug("Token validated remotely"),e;if(U.info("Token invalid or expired, attempting refresh"),e.refresh_token){const t=await this._refreshToken(e);return{...e,...t}}throw new m("Token expired and no refresh token available")}async _isTokenValidRemote(e){try{const t=R(),r=(await q(t.authIssuer)).userinfo_endpoint,n=fetch(r,{headers:{Authorization:`Bearer ${e}`},..."undefined"!=typeof AbortSignal&&"timeout"in AbortSignal?{signal:AbortSignal.timeout(5e3)}:{}});return(await F(n,5e3)).ok}catch(e){return U.debug("Remote token validation failed:",e),!1}}async _refreshToken(e){const t=e.refresh_token;if(!t)throw new f("No refresh token available");const r=R();if(x&&r.clientSecret)throw new f("Refresh flow requires a confidential client; run interactive login again.");const n=(await q(r.authIssuer)).token_endpoint,o=new URLSearchParams({grant_type:"refresh_token",client_id:r.clientId,refresh_token:t});r.clientSecret&&!x&&o.set("client_secret",r.clientSecret);try{const e=fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o.toString(),..."undefined"!=typeof AbortSignal&&"timeout"in AbortSignal?{signal:AbortSignal.timeout(15e3)}:{}}),t=await F(e,15e3);if(400===t.status){let e="Invalid refresh token";try{e=(await t.json()).error_description||e}catch{}throw U.warn(`Refresh token invalid: ${e}`),new m(`Refresh token expired or invalid: ${e}`)}if(429===t.status)throw U.warn("Rate limited during token refresh"),new f("Rate limited during token refresh. Please try again later.");if(t.status>=500)throw U.warn(`Auth server error during refresh: ${t.status}`),new f(`Auth server temporarily unavailable (HTTP ${t.status})`);if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);return await t.json()}catch(e){if(e instanceof f||e instanceof m)throw e;if(e&&"object"==typeof e&&"name"in e){if("TimeoutError"===e.name||"AbortError"===e.name)throw U.warn("Timeout during token refresh"),new f("Token refresh timed out. Please check your connection.");if("TypeError"===e.name&&"message"in e&&"string"==typeof e.message&&e.message.includes("fetch"))throw U.warn(`Network error during token refresh: ${e.message}`),new f("Network error during token refresh. Please check your connection.")}U.error("Unexpected error during token refresh:",e);const t=e instanceof Error?e.message:String(e);throw new f(`Token refresh failed: ${t}`)}}}async function X(){try{const e=W(),t=await e.loadToken();return t?.access_token??null}catch(e){return null}}async function ee(e){const t=W();let r;r="string"==typeof e?{access_token:e}:e,await t.saveToken(r)}class te{constructor(){this._codeVerifier=null,this._currentState=null,this._logger=M("pkce")}async buildAuthorizationUrl({domain:e,clientId:t,redirectUri:r,audience:n,scope:s="openid profile email",issuer:a}){this._codeVerifier=re(32);const i=ne(await async function(e){const t=(new TextEncoder).encode(e);if(x&&window.crypto&&window.crypto.subtle){const e=await window.crypto.subtle.digest("SHA-256",t);return new Uint8Array(e)}if(I){const t=o.createHash("sha256").update(e).digest();return new Uint8Array(t)}throw new Error("SHA256 not available in this environment")}(this._codeVerifier));this._currentState=re(16);const c=new URLSearchParams({response_type:"code",client_id:t,redirect_uri:r,scope:s,audience:n,state:this._currentState,code_challenge:i,code_challenge_method:"S256"});let l;if(a){l=(await q(a)).authorization_endpoint}else{if(!e)throw new _("Either issuer or domain must be provided");l=`https://${e}/authorize`}return`${l}?${c.toString()}`}async exchangeCodeForToken({domain:e,clientId:t,code:r,redirectUri:n,clientSecret:o,issuer:s}){const a=new URLSearchParams({grant_type:"authorization_code",client_id:t,code:r,redirect_uri:n});if(o&&a.set("client_secret",o),this._codeVerifier&&a.set("code_verifier",this._codeVerifier),!o&&!this._codeVerifier)throw new _("Either client_secret or PKCE verifier must be provided");let i;if(s){i=(await q(s)).token_endpoint}else{if(!e)throw new _("Either issuer or domain must be provided");i=`https://${e}/oauth/token`}try{const e=await fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a.toString()});if(!e.ok){const t=await e.json().catch(()=>({}));throw this._logger.error("Token endpoint response:",t),new _(`Token exchange failed: ${t.error??t.error_description??e.statusText}`)}const t=await e.json();return this.clearState(),t}catch(e){if(e instanceof _)throw e;const t=e instanceof Error?e.message:String(e);throw new _(`Token exchange failed: ${t}`)}}validateState(e){return Boolean(this._currentState&&e===this._currentState)}clearState(){this._codeVerifier=null,this._currentState=null}getState(){return this._codeVerifier&&this._currentState?{codeVerifier:this._codeVerifier,codeChallenge:"",state:this._currentState,timestamp:Date.now()}:null}}function re(e){const t=new Uint8Array(e);if(x&&window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(t);else{if(!I)throw new Error("Secure random generator not available for PKCE.");o.randomFillSync(t)}return ne(t)}function ne(e){const t=function(e){if("undefined"!=typeof globalThis&&globalThis.btoa)return globalThis.btoa(String.fromCharCode(...e));if("undefined"!=typeof Buffer)return Buffer.from(e).toString("base64");throw new Error("No base64 encode function available")}(e);return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function oe(e=52765){if(!I)throw new Error("Local callback server is only available in Node.js environment");const t=M("pkce"),r="undefined"!=typeof process&&process.env&&process.env.BARNDOOR_REDIRECT_HOST||"127.0.0.1",n=r.startsWith("http")?`${r}:${e}/cb`:`http://${r}:${e}/cb`,o=new Promise((r,o)=>{const i=s.createServer((e,n)=>{t.debug(`Callback server received request: ${e.method} ${e.url}`);const s=a.parse(e.url??"",!0);if(t.debug(`Parsed URL - pathname: ${s.pathname}, query:`,s.query),"/cb"===s.pathname){const{code:a,state:c,error:l,error_description:u}=s.query;t.debug(`Callback params - code: ${!!a}, state: ${!!c}, error: ${l}`),n.writeHead(200,{"Content-Type":"text/html"}),l?(t.error(`OAuth error: ${l} - ${u}`),n.end("\n <html>\n <body>\n <h1>Authentication Failed</h1>\n <p>Error: Authentication error occurred.</p>\n <p>Description: Please return to the application for details.</p>\n <p>You can close this window.</p>\n </body>\n </html>\n "),i.close(),o(new _(`OAuth error: ${l} - ${u}`))):a?(t.info("OAuth callback received successfully, closing server"),n.end("\n <html>\n <body>\n <h1>Authentication Successful</h1>\n <p>You can close this window and return to your application.</p>\n <script>\n console.log('Authentication callback received. You can close this window.');\n setTimeout(() => window.close(), 1000);\n <\/script>\n </body>\n </html>\n "),i.close(),r([a,c])):(t.warn("No authorization code received in callback"),t.warn(`Full URL: ${e.url}`),t.warn("Query params:",s.query),n.end(`\n <html>\n <body>\n <h1>Authentication Failed</h1>\n <p>No authorization code received.</p>\n <p>Full URL: ${e.url}</p>\n <p>You can close this window.</p>\n </body>\n </html>\n `),i.close(),o(new _("No authorization code received")))}else t.debug(`404 for path: ${s.pathname}`),n.writeHead(404,{"Content-Type":"text/plain"}),n.end("Not found")});i.listen(e,"0.0.0.0",()=>{console.log(`OAuth callback server listening on ${n}`)}),i.on("error",e=>{o(new _(`Failed to start callback server: ${e.message}`))}),i.on("connection",e=>{t.debug(`New connection from ${e.remoteAddress}:${e.remotePort}`)})});return[n,o]}const se=M("client-credentials");async function ae(e){const{timeoutMs:t=15e3}=e,{tokenEndpoint:r,body:n}=await async function(e){const{clientId:t,clientSecret:r,audience:n,issuer:o,domain:s}=e;let a;if(o)a=(await q(o)).token_endpoint;else{if(!s)throw new _("Either 'issuer' or 'domain' must be provided");a=`https://${s}/oauth/token`}return{tokenEndpoint:a,body:new URLSearchParams({grant_type:"client_credentials",client_id:t,client_secret:r,audience:n})}}(e),o=new AbortController,s=setTimeout(()=>o.abort(),t);try{const e=await fetch(r,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:n.toString(),signal:o.signal});if(!e.ok){const t=await e.json().catch(()=>({}));throw se.error("Client-credentials token endpoint error:",t),new _(`Client-credentials grant failed: ${t.error_description??t.error??e.statusText}`)}const t=await e.json();if(!t.access_token)throw new _("Client-credentials grant: response missing access_token");return t.access_token}catch(e){if(e instanceof _)throw e;if(e instanceof Error&&"AbortError"===e.name)throw new _(`Client-credentials grant timed out after ${t}ms`);const r=e instanceof Error?e.message:String(e);throw new _(`Client-credentials grant failed: ${r}`)}finally{clearTimeout(s)}}class ie{constructor(e,t={}){this._credentials=null,this._logger=M("client");const{token:r,timeout:n=30,maxRetries:o=3}=t;this.base=this._validateUrl(e,"API base URL").replace(/\/$/,"");const s=Object.prototype.hasOwnProperty.call(t,"token");if(this._token=s?this._validateToken(r):null,"number"!=typeof n||n<=0)throw new w("timeout must be a positive number");if(!Number.isInteger(o)||o<0)throw new w("maxRetries must be a non-negative integer");const a=new b(n,n/3);this._http=new k(a,o),this._tokenValidated=!1,this._closed=!1,this._logger.info(`Initialized BarndoorSDK for ${this.base}`)}static async fromClientCredentials(e,t){const{timeout:r,maxRetries:n,...o}=t,s={token:await ae(o)};void 0!==r&&(s.timeout=r),void 0!==n&&(s.maxRetries=n);const a=new ie(e,s);return a._credentials={...o},a._tokenValidated=!0,a}get token(){if(!this._token)throw new Error("No token available. Call authenticate() first or provide token in constructor.");return this._token}async authenticate(e){this._token=this._validateToken(e),this._tokenValidated=!1,await this.ensureValidToken(),this._logger.info("Authentication successful")}_validateUrl(e,t){if(!e||"string"!=typeof e)throw new w(`${t} must be a non-empty string`);try{return new URL(e),e}catch(e){throw new w(`${t} must be a valid URL`)}}_validateToken(e){if(!e||"string"!=typeof e)throw new f("Token must be a non-empty string");if(3!==e.split(".").length)throw new f("Token must be a valid JWT");return e}_ensureNotClosed(){if(this._closed)throw new Error("SDK has been closed. Create a new instance or use as context manager.")}async _req(e,t,r={}){this._ensureNotClosed(),await this.ensureValidToken(),await this._maybeRefreshM2MToken();const n=`${this.base}${t}`,o=()=>{const e={...r.headers??{}};return e.Authorization=`Bearer ${this.token}`,{...r,headers:e}};try{return await this._http.request(e,n,o())}catch(t){if(t instanceof g&&401===t.statusCode&&null!==this._credentials)return this._logger.info("M2M token rejected (401); refreshing and retrying once"),await this._refreshM2MToken(),await this._http.request(e,n,o());throw t}}async _maybeRefreshM2MToken(){null!==this._credentials&&function(e,t){const r=e.split(".");if(3!==r.length)return!0;const n=r[1];if(!n)return!0;let o;try{const e=n.replace(/-/g,"+").replace(/_/g,"/"),t="undefined"!=typeof Buffer?Buffer.from(e,"base64").toString("utf8"):globalThis.atob(e);o=JSON.parse(t)}catch{return!0}const s=o.exp;return"number"!=typeof s||s-Date.now()/1e3<=t}(this.token,60)&&(this._logger.debug("M2M token near expiry; refreshing"),await this._refreshM2MToken())}async _refreshM2MToken(){if(null===this._credentials)throw new Error("_refreshM2MToken() called on an SDK not created via BarndoorSDK.fromClientCredentials()");this._token=await ae(this._credentials),this._tokenValidated=!0}async validateCachedToken(){if(!this.token)return!1;try{const e=R(),t=(await q(e.authIssuer)).userinfo_endpoint,r=new AbortController,n=setTimeout(()=>r.abort(),1e4);try{const e=(await fetch(t,{headers:{Authorization:`Bearer ${this.token}`},signal:r.signal})).ok;return e&&(this._tokenValidated=!0),e}finally{clearTimeout(n)}}catch(e){return!1}}async ensureValidToken(){if(!this._token)throw new Error("No token available. Call authenticate() first or provide token in constructor.");if(this._tokenValidated)return;const e=(I?process.env.BARNDOOR_ENV:"")??"";if(["test","ci"].includes(e.toLowerCase()))return void(this._tokenValidated=!0);if(!await this.validateCachedToken())throw new f("Token validation failed. Please re-authenticate.");this._tokenValidated=!0}async listServers(){this._logger.debug("Fetching server list");try{const e=[];let t=1;for(;null!==t;){const r=1===t?"/api/servers":`/api/servers?page=${t}`,n=await this._req("GET",r),o=n.data.map(e=>E.fromApiResponse(e));e.push(...o),t=n.pagination.next_page}return this._logger.info(`Retrieved ${e.length} servers total`),e}catch(e){throw this._logger.error("Failed to list servers:",e),e}}async getServer(e){const t=this._validateServerId(e);this._logger.info(`Fetching server details for ${t}`);const r=this._isUuid(t)?`/api/servers/${t}`:`/api/servers/by-slug/${t}`,n=await this._req("GET",r);return P.fromApiResponse(n)}async initiateConnection(e,t){const r=this._validateServerId(e);let n;t&&(n=this._validateUrl(t,"Return URL")),this._logger.info(`Initiating connection for server ${r}`);const o=n?{return_url:n}:void 0;try{const e=this._isUuid(r)?`/api/servers/${r}/connect`:`/api/servers/by-slug/${r}/connect`;return await this._req("POST",e,{params:o,json:{}})}catch(e){if(e instanceof g&&500===e.statusCode&&e.responseBody?.includes("OAuth server configuration not found"))throw new Error("Server is missing OAuth configuration. Ask an admin to configure credentials before initiating a connection.");throw e}}async getConnectionStatus(e){const t=this._validateServerId(e);this._logger.info(`Checking connection status for server ${t}`);const r=this._isUuid(t)?`/api/servers/${t}/connection`:`/api/servers/by-slug/${t}/connection`;return(await this._req("GET",r)).status}async disconnectServer(e){const t=this._validateServerId(e);this._logger.info(`Disconnecting from server ${t}`);try{const e=this._isUuid(t)?`/api/servers/${t}/connection`:`/api/servers/by-slug/${t}/connection`;await this._req("DELETE",e),this._logger.info(`Successfully disconnected from server ${t}`)}catch(e){if(e instanceof g&&404===e.statusCode)throw new Error(`Connection not found for server ${t}. Server may not be connected.`);throw e}}async getChannelOptions(){return this._logger.debug("Fetching notification channel options"),await this._req("GET",`${ie.CHANNELS_PATH}/options`)}async listChannels(){this._logger.debug("Listing organization notification channels");const e=await this._req("GET",ie.CHANNELS_PATH);return e?.data??[]}async listUserChannels(){this._logger.debug("Listing caller's personal notification channels");const e=await this._req("GET",`${ie.CHANNELS_PATH}/user`);return e?.data??[]}async upsertChannel(e){if(!e||"object"!=typeof e)throw new Error("Channel input must be a non-empty object");if(!e.type||"string"!=typeof e.type)throw new Error("Channel type must be a non-empty string");const t={type:e.type,enabled:e.enabled??!0};void 0!==e.channelId&&(t.id=this._requireChannelId(e.channelId));const r=[["email_address",e.emailAddress],["url",e.url],["label",e.label],["slack_channel_id",e.slackChannelId],["teams_workflow_url",e.teamsWorkflowUrl]];for(const[e,n]of r)void 0!==n&&(t[e]=n);return t.subscriptions=(e.subscriptions??[]).map(e=>({alert_type:e})),this._logger.info(`Upserting notification channel (type=${e.type})`),await this._req("PUT",ie.CHANNELS_PATH,{json:t})}async deleteChannel(e){const t=this._requireChannelId(e);this._logger.info(`Deleting notification channel ${t}`),await this._req("DELETE",`${ie.CHANNELS_PATH}/${t}`)}async regenerateChannelSecret(e){const t=this._requireChannelId(e);return this._logger.info(`Rotating signing secret for notification channel ${t}`),await this._req("POST",`${ie.CHANNELS_PATH}/${t}/regenerate-secret`)}async testChannel(e){const t=this._requireChannelId(e);return this._logger.debug(`Testing notification channel ${t}`),await this._req("POST",`${ie.CHANNELS_PATH}/${t}/test`)}_requireChannelId(e){if(!e||"string"!=typeof e)throw new Error("Channel ID must be a non-empty string");const t=e.trim();if(!t)throw new Error("Channel ID cannot be empty or whitespace");return t}_validateServerId(e){if(!e||"string"!=typeof e)throw new Error("Server ID must be a non-empty string");if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)&&!/^[a-z0-9-]+$/.test(e))throw new Error("Server ID must be a valid UUID or slug (lowercase letters, numbers, and hyphens only)");return e}_isUuid(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}async listPolicies(e=1,t=10,r={}){if(!Number.isInteger(e)||e<1)throw new Error("Page must be a positive integer");if(!Number.isInteger(t)||t<1||t>1e3)throw new Error("Limit must be a positive integer between 1 and 1000");this._logger.debug(`Listing policies (page=${e}, limit=${t})`);const n={page:e,limit:t,...r};return this._req("GET","/api/v2/policies",{params:n})}async getPolicy(e){if(!e||"string"!=typeof e)throw new Error("Policy ID must be a non-empty string");if(!this._isUuid(e))throw new Error("Policy ID must be a valid UUID");return this._logger.debug(`Fetching policy details for ${e}`),this._req("GET",`/api/v2/policies/${e}`)}async createPolicy(e){if(!e||"object"!=typeof e)throw new Error("Policy data must be a non-empty object");return this._logger.debug("Creating new policy"),this._req("POST","/api/v2/policies",{json:e})}async updatePolicy(e,t){if(!e||"string"!=typeof e)throw new Error("Policy ID must be a non-empty string");if(!this._isUuid(e))throw new Error("Policy ID must be a valid UUID");if(!t||"object"!=typeof t)throw new Error("Policy data must be a non-empty object");return this._logger.debug(`Updating policy ${e}`),this._req("PATCH",`/api/v2/policies/${e}`,{json:t})}async clonePolicy(e,t){if(!e||"string"!=typeof e)throw new Error("Policy ID must be a non-empty string");if(!this._isUuid(e))throw new Error("Policy ID must be a valid UUID");if(!t||"string"!=typeof t)throw new Error("New name must be a non-empty string");return this._logger.debug(`Cloning policy ${e} with new name: ${t}`),this._req("POST",`/api/v2/policies/${e}/clone`,{json:{name:t}})}async validatePolicy(e){if(!e||"object"!=typeof e)throw new Error("Validation data must be a non-empty object");return this._logger.debug("Validating policy configuration"),this._req("POST","/api/v2/policies/validate",{json:e})}async getPolicySummary(){return this._logger.debug("Fetching policy summary"),this._req("GET","/api/v2/policies/summary")}async getPolicyFilterDefinitions(){return this._logger.debug("Fetching policy filter definitions"),this._req("GET","/api/v2/policies/filter-definitions")}async close(){this._closed||(await this._http.close(),this._closed=!0)}async aclose(){await this.close()}async ensureServerConnected(t,r={}){const{pollSeconds:n=60}=r;if(!I)throw new Error("ensureServerConnected requires Node.js environment for browser opening");let o;try{o=await this.getServer(t)}catch(e){if(e instanceof g&&404===e.statusCode)throw new v(t);throw e}if("connected"===o.connection_status)return;const s=o.slug||t,a=(await this.initiateConnection(s)).auth_url;if(!a)throw new Error("Registry did not return auth_url");const c=e.platform();let l;try{l=new URL(a)}catch{throw new Error("Invalid auth_url returned by server")}if("https:"!==l.protocol&&("http:"!==l.protocol||"localhost"!==l.hostname&&"127.0.0.1"!==l.hostname))throw new Error("Auth URL must use HTTPS (http allowed only for localhost)");try{"darwin"===c?i.spawn("open",[a],{detached:!0,stdio:"ignore"}).unref():"win32"===c?i.spawn("powershell",["-NoProfile","Start-Process",a],{detached:!0,stdio:"ignore"}).unref():i.spawn("xdg-open",[a],{detached:!0,stdio:"ignore"}).unref()}catch(e){this._logger.warn("Failed to open browser",e)}for(let e=0;e<n;e++){if("connected"===await this.getConnectionStatus(s))return;await new Promise(e=>setTimeout(e,1e3))}throw new Error("OAuth connection was not completed in time")}}ie.CHANNELS_PATH="/api/notification/public/v1/channels";const ce=Object.freeze({status:"aborted"});function le(e,t,r){function n(r,n){var o;Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(o=r._zod).traits??(o.traits=new Set),r._zod.traits.add(e),t(r,n);for(const e in a.prototype)e in r||Object.defineProperty(r,e,{value:a.prototype[e].bind(r)});r._zod.constr=a,r._zod.def=n}const o=r?.Parent??Object;class s extends o{}function a(e){var t;const o=r?.Parent?new s:this;n(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const e of o._zod.deferred)e();return o}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class ue extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const de={};function pe(e){return e&&Object.assign(de,e),de}function he(e,t){return"bigint"==typeof t?t.toString():t}function fe(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function me(e){return null==e}function ye(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ge(e,t,r){Object.defineProperty(e,t,{get(){{const n=r();return e[t]=n,n}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ve(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function _e(e){return JSON.stringify(e)}const we=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function $e(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const be=fe(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ke(e){if(!1===$e(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!1!==$e(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}const Ee=new Set(["string","number","symbol"]);function Pe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Se(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function Te(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const xe={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ie(e,t=0){for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function Ce(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Ne(e){return"string"==typeof e?e:e?.message}function je(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Ne(e.inst?._zod.def?.error?.(e))??Ne(t?.error?.(e))??Ne(r.customError?.(e))??Ne(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Re(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Oe(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const ze=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,he,2),enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ae=le("$ZodError",ze),Me=le("$ZodError",ze,{Parent:Error});const Ue=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new ue;if(a.issues.length){const t=new(o?.Err??e)(a.issues.map(e=>je(e,s,pe())));throw we(t,o?.callee),t}return a.value},De=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(o?.Err??e)(a.issues.map(e=>je(e,s,pe())));throw we(t,o?.callee),t}return a.value},qe=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ue;return s.issues.length?{success:!1,error:new(e??Ae)(s.issues.map(e=>je(e,o,pe())))}:{success:!0,data:s.value}},Ve=qe(Me),Fe=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>je(e,o,pe())))}:{success:!0,data:s.value}},Le=Fe(Me),He=/^[cC][^\s-]{8,}$/,Ke=/^[0-9a-z]+$/,Ze=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ge=/^[0-9a-vA-V]{20}$/,Je=/^[A-Za-z0-9]{27}$/,We=/^[a-zA-Z0-9_-]{21}$/,Be=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Qe=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ye=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,Xe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const et=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,rt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,nt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ot=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,st=/^[A-Za-z0-9_-]*$/,at=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,it=/^\+(?:[0-9]){6,14}[0-9]$/,ct="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",lt=new RegExp(`^${ct}$`);function ut(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const dt=/^\d+$/,pt=/^-?\d+(?:\.\d+)?/i,ht=/true|false/i,ft=/null/i,mt=/^[^A-Z]*$/,yt=/^[^a-z]*$/,gt=le("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),vt={number:"number",bigint:"bigint",object:"date"},_t=le("$ZodCheckLessThan",(e,t)=>{gt.init(e,t);const r=vt[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wt=le("$ZodCheckGreaterThan",(e,t)=>{gt.init(e,t);const r=vt[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$t=le("$ZodCheckMultipleOf",(e,t)=>{gt.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===function(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n;return Number.parseInt(e.toFixed(o).replace(".",""))%Number.parseInt(t.toFixed(o).replace(".",""))/10**o}(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),bt=le("$ZodCheckNumberFormat",(e,t)=>{gt.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,s]=xe[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=o,n.maximum=s,r&&(n.pattern=dt)}),e._zod.check=a=>{const i=a.value;if(r){if(!Number.isInteger(i))return void a.issues.push({expected:n,format:t.format,code:"invalid_type",input:i,inst:e});if(!Number.isSafeInteger(i))return void(i>0?a.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):a.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}))}i<o&&a.issues.push({origin:"number",input:i,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),i>s&&a.issues.push({origin:"number",input:i,code:"too_big",maximum:s,inst:e})}}),kt=le("$ZodCheckMaxLength",(e,t)=>{var r;gt.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!me(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const o=Re(n);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Et=le("$ZodCheckMinLength",(e,t)=>{var r;gt.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!me(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const o=Re(n);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Pt=le("$ZodCheckLengthEquals",(e,t)=>{var r;gt.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!me(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,o=n.length;if(o===t.length)return;const s=Re(n),a=o>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),St=le("$ZodCheckStringFormat",(e,t)=>{var r,n;gt.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Tt=le("$ZodCheckRegex",(e,t)=>{St.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),xt=le("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=mt),St.init(e,t)}),It=le("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=yt),St.init(e,t)}),Ct=le("$ZodCheckIncludes",(e,t)=>{gt.init(e,t);const r=Pe(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Nt=le("$ZodCheckStartsWith",(e,t)=>{gt.init(e,t);const r=new RegExp(`^${Pe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),jt=le("$ZodCheckEndsWith",(e,t)=>{gt.init(e,t);const r=new RegExp(`.*${Pe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Rt=le("$ZodCheckOverwrite",(e,t)=>{gt.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Ot{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const e of n)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const zt={major:4,minor:0,patch:0},At=le("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zt;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const t of n)for(const r of t._zod.onattach)r(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,o=Ie(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===r?.async)throw new ue;if(n||a instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await a;e.issues.length!==t&&(o||(o=Ie(e,t)))});else{if(e.issues.length===t)continue;o||(o=Ie(e,t))}}return n?n.then(()=>e):e};e._zod.run=(r,o)=>{const s=e._zod.parse(r,o);if(s instanceof Promise){if(!1===o.async)throw new ue;return s.then(e=>t(e,n,o))}return t(s,n,o)}}e["~standard"]={validate:t=>{try{const r=Ve(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Le(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),Mt=le("$ZodString",(e,t)=>{var r;At.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ut=le("$ZodStringFormat",(e,t)=>{St.init(e,t),Mt.init(e,t)}),Dt=le("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Qe),Ut.init(e,t)}),qt=le("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ye(e))}else t.pattern??(t.pattern=Ye());Ut.init(e,t)}),Vt=le("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Xe),Ut.init(e,t)}),Ft=le("$ZodURL",(e,t)=>{Ut.init(e,t),e._zod.check=r=>{try{const n=r.value,o=new URL(n),s=o.href;return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:at.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(!n.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Lt=le("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ut.init(e,t)}),Ht=le("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=We),Ut.init(e,t)}),Kt=le("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=He),Ut.init(e,t)}),Zt=le("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ke),Ut.init(e,t)}),Gt=le("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ze),Ut.init(e,t)}),Jt=le("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ge),Ut.init(e,t)}),Wt=le("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Je),Ut.init(e,t)}),Bt=le("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ut({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${ct}T(?:${n})$`)}(t)),Ut.init(e,t)}),Qt=le("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=lt),Ut.init(e,t)}),Yt=le("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ut(t)}$`)),Ut.init(e,t)}),Xt=le("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Be),Ut.init(e,t)}),er=le("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=et),Ut.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),tr=le("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=tt),Ut.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),rr=le("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=rt),Ut.init(e,t)}),nr=le("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=nt),Ut.init(e,t),e._zod.check=r=>{const[n,o]=r.value.split("/");try{if(!o)throw new Error;const e=Number(o);if(`${e}`!==o)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function or(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const sr=le("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ot),Ut.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{or(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const ar=le("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=st),Ut.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{(function(e){if(!st.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return or(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ir=le("$ZodE164",(e,t)=>{t.pattern??(t.pattern=it),Ut.init(e,t)});const cr=le("$ZodJWT",(e,t)=>{Ut.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),lr=le("$ZodNumber",(e,t)=>{At.init(e,t),e._zod.pattern=e._zod.bag.pattern??pt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}const o=r.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return r;const s="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),ur=le("$ZodNumber",(e,t)=>{bt.init(e,t),lr.init(e,t)}),dr=le("$ZodBoolean",(e,t)=>{At.init(e,t),e._zod.pattern=ht,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(e){}const o=r.value;return"boolean"==typeof o||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),pr=le("$ZodNull",(e,t)=>{At.init(e,t),e._zod.pattern=ft,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{const n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),hr=le("$ZodAny",(e,t)=>{At.init(e,t),e._zod.parse=e=>e}),fr=le("$ZodUnknown",(e,t)=>{At.init(e,t),e._zod.parse=e=>e}),mr=le("$ZodNever",(e,t)=>{At.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function yr(e,t,r){e.issues.length&&t.issues.push(...Ce(r,e.issues)),t.value[r]=e.value}const gr=le("$ZodArray",(e,t)=>{At.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const s=[];for(let e=0;e<o.length;e++){const a=o[e],i=t.element._zod.run({value:a,issues:[]},n);i instanceof Promise?s.push(i.then(t=>yr(t,r,e))):yr(i,r,e)}return s.length?Promise.all(s).then(()=>r):r}});function vr(e,t,r){e.issues.length&&t.issues.push(...Ce(r,e.issues)),t.value[r]=e.value}function _r(e,t,r,n){e.issues.length?void 0===n[r]?t.value[r]=r in n?void 0:e.value:t.issues.push(...Ce(r,e.issues)):void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}const wr=le("$ZodObject",(e,t)=>{At.init(e,t);const r=fe(()=>{const e=Object.keys(t.shape);for(const r of e)if(!(t.shape[r]instanceof At))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const r=(n=t.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}});ge(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});let n;const o=$e,s=!de.jitless,a=s&&be.value,i=t.catchall;let c;e._zod.parse=(l,u)=>{c??(c=r.value);const d=l.value;if(!o(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;const p=[];if(s&&a&&!1===u?.async&&!0!==u.jitless)n||(n=(e=>{const t=new Ot(["shape","payload","ctx"]),n=r.value,o=e=>{const t=_e(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);let a=0;for(const e of n.keys)s[e]="key_"+a++;t.write("const newResult = {}");for(const e of n.keys)if(n.optionalKeys.has(e)){const r=s[e];t.write(`const ${r} = ${o(e)};`);const n=_e(e);t.write(`\n if (${r}.issues.length) {\n if (input[${n}] === undefined) {\n if (${n} in input) {\n newResult[${n}] = undefined;\n }\n } else {\n payload.issues = payload.issues.concat(\n ${r}.issues.map((iss) => ({\n ...iss,\n path: iss.path ? [${n}, ...iss.path] : [${n}],\n }))\n );\n }\n } else if (${r}.value === undefined) {\n if (${n} in input) newResult[${n}] = undefined;\n } else {\n newResult[${n}] = ${r}.value;\n }\n `)}else{const r=s[e];t.write(`const ${r} = ${o(e)};`),t.write(`\n if (${r}.issues.length) payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${_e(e)}, ...iss.path] : [${_e(e)}]\n })));`),t.write(`newResult[${_e(e)}] = ${r}.value`)}t.write("payload.value = newResult;"),t.write("return payload;");const i=t.compile();return(t,r)=>i(e,t,r)})(t.shape)),l=n(l,u);else{l.value={};const e=c.shape;for(const t of c.keys){const r=e[t],n=r._zod.run({value:d[t],issues:[]},u),o="optional"===r._zod.optin&&"optional"===r._zod.optout;n instanceof Promise?p.push(n.then(e=>o?_r(e,l,t,d):vr(e,l,t))):o?_r(n,l,t,d):vr(n,l,t)}}if(!i)return p.length?Promise.all(p).then(()=>l):l;const h=[],f=c.keySet,m=i._zod,y=m.def.type;for(const e of Object.keys(d)){if(f.has(e))continue;if("never"===y){h.push(e);continue}const t=m.run({value:d[e],issues:[]},u);t instanceof Promise?p.push(t.then(t=>vr(t,l,e))):vr(t,l,e)}return h.length&&l.issues.push({code:"unrecognized_keys",keys:h,input:d,inst:e}),p.length?Promise.all(p).then(()=>l):l}});function $r(e,t,r,n){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>je(e,n,pe())))}),t}const br=le("$ZodUnion",(e,t)=>{At.init(e,t),ge(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),ge(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ge(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ge(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>ye(e.source)).join("|")})$`)}}),e._zod.parse=(r,n)=>{let o=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},n);if(t instanceof Promise)s.push(t),o=!0;else{if(0===t.issues.length)return t;s.push(t)}}return o?Promise.all(s).then(t=>$r(t,r,e,n)):$r(s,r,e,n)}}),kr=le("$ZodDiscriminatedUnion",(e,t)=>{br.init(e,t);const r=e._zod.parse;ge(e._zod,"propValues",()=>{const e={};for(const r of t.options){const n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const[t,r]of Object.entries(n)){e[t]||(e[t]=new Set);for(const n of r)e[t].add(n)}}return e});const n=fe(()=>{const e=t.options,r=new Map;for(const n of e){const e=n._zod.propValues[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const t of e){if(r.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(o,s)=>{const a=o.value;if(!$e(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const i=n.value.get(a?.[t.discriminator]);return i?i._zod.run(o,s):t.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[t.discriminator],inst:e}),o)}}),Er=le("$ZodIntersection",(e,t)=>{At.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,o=t.left._zod.run({value:n,issues:[]},r),s=t.right._zod.run({value:n,issues:[]},r);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([t,r])=>Sr(e,t,r)):Sr(e,o,s)}});function Pr(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ke(e)&&ke(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),o={...e,...t};for(const r of n){const n=Pr(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};o[r]=n.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=Pr(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Sr(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Ie(e))return e;const n=Pr(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const Tr=le("$ZodRecord",(e,t)=>{At.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!ke(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const s=[];if(t.keyType._zod.values){const a=t.keyType._zod.values;r.value={};for(const e of a)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const a=t.valueType._zod.run({value:o[e],issues:[]},n);a instanceof Promise?s.push(a.then(t=>{t.issues.length&&r.issues.push(...Ce(e,t.issues)),r.value[e]=t.value})):(a.issues.length&&r.issues.push(...Ce(e,a.issues)),r.value[e]=a.value)}let i;for(const e in o)a.has(e)||(i=i??[],i.push(e));i&&i.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:i})}else{r.value={};for(const a of Reflect.ownKeys(o)){if("__proto__"===a)continue;const i=t.keyType._zod.run({value:a,issues:[]},n);if(i instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(i.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:i.issues.map(e=>je(e,n,pe())),input:a,path:[a],inst:e}),r.value[i.value]=i.value;continue}const c=t.valueType._zod.run({value:o[a],issues:[]},n);c instanceof Promise?s.push(c.then(e=>{e.issues.length&&r.issues.push(...Ce(a,e.issues)),r.value[i.value]=e.value})):(c.issues.length&&r.issues.push(...Ce(a,c.issues)),r.value[i.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}}),xr=le("$ZodEnum",(e,t)=>{At.init(e,t);const r=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(e=>Ee.has(typeof e)).map(e=>"string"==typeof e?Pe(e):e.toString()).join("|")})$`),e._zod.parse=(t,n)=>{const o=t.value;return e._zod.values.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),Ir=le("$ZodLiteral",(e,t)=>{At.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?Pe(e):e?e.toString():String(e)).join("|")})$`),e._zod.parse=(r,n)=>{const o=r.value;return e._zod.values.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),Cr=le("$ZodTransform",(e,t)=>{At.init(e,t),e._zod.parse=(e,r)=>{const n=t.transform(e.value,e);if(r.async){return(n instanceof Promise?n:Promise.resolve(n)).then(t=>(e.value=t,e))}if(n instanceof Promise)throw new ue;return e.value=n,e}}),Nr=le("$ZodOptional",(e,t)=>{At.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ge(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ge(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ye(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>"optional"===t.innerType._zod.optin?t.innerType._zod.run(e,r):void 0===e.value?e:t.innerType._zod.run(e,r)}),jr=le("$ZodNullable",(e,t)=>{At.init(e,t),ge(e._zod,"optin",()=>t.innerType._zod.optin),ge(e._zod,"optout",()=>t.innerType._zod.optout),ge(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ye(e.source)}|null)$`):void 0}),ge(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Rr=le("$ZodDefault",(e,t)=>{At.init(e,t),e._zod.optin="optional",ge(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>Or(e,t)):Or(n,t)}});function Or(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const zr=le("$ZodPrefault",(e,t)=>{At.init(e,t),e._zod.optin="optional",ge(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),Ar=le("$ZodNonOptional",(e,t)=>{At.init(e,t),ge(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(t=>Mr(t,e)):Mr(o,e)}});function Mr(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Ur=le("$ZodCatch",(e,t)=>{At.init(e,t),e._zod.optin="optional",ge(e._zod,"optout",()=>t.innerType._zod.optout),ge(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>je(e,r,pe()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>je(e,r,pe()))},input:e.value}),e.issues=[]),e)}}),Dr=le("$ZodPipe",(e,t)=>{At.init(e,t),ge(e._zod,"values",()=>t.in._zod.values),ge(e._zod,"optin",()=>t.in._zod.optin),ge(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(e,r)=>{const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>qr(e,t,r)):qr(n,t,r)}});function qr(e,t,r){return Ie(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}const Vr=le("$ZodReadonly",(e,t)=>{At.init(e,t),ge(e._zod,"propValues",()=>t.innerType._zod.propValues),ge(e._zod,"values",()=>t.innerType._zod.values),ge(e._zod,"optin",()=>t.innerType._zod.optin),ge(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,r)=>{const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(Fr):Fr(n)}});function Fr(e){return e.value=Object.freeze(e.value),e}const Lr=le("$ZodCustom",(e,t)=>{gt.init(e,t),At.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(t=>Hr(t,r,n,e));Hr(o,r,n,e)}});function Hr(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(Oe(e))}}class Kr{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Zr(){return new Kr}const Gr=Zr();function Jr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Te(t)})}function Wr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Te(t)})}function Br(e,t){return new _t({check:"less_than",...Te(t),value:e,inclusive:!1})}function Qr(e,t){return new _t({check:"less_than",...Te(t),value:e,inclusive:!0})}function Yr(e,t){return new wt({check:"greater_than",...Te(t),value:e,inclusive:!1})}function Xr(e,t){return new wt({check:"greater_than",...Te(t),value:e,inclusive:!0})}function en(e,t){return new $t({check:"multiple_of",...Te(t),value:e})}function tn(e,t){return new kt({check:"max_length",...Te(t),maximum:e})}function rn(e,t){return new Et({check:"min_length",...Te(t),minimum:e})}function nn(e,t){return new Pt({check:"length_equals",...Te(t),length:e})}function on(e){return new Rt({check:"overwrite",tx:e})}function sn(e){return!!e._zod}function an(e,t){if(sn(e)){return Ve(e,t)}return e.safeParse(t)}function cn(e){if(!e)return;let t;if(sn(e)){const r=e;t=r._zod?.def?.shape}else{t=e.shape}if(t){if("function"==typeof t)try{return t()}catch{return}return t}}const ln=le("ZodISODateTime",(e,t)=>{Bt.init(e,t),Sn.init(e,t)});function un(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(t)})}(ln,e)}const dn=le("ZodISODate",(e,t)=>{Qt.init(e,t),Sn.init(e,t)});function pn(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Te(t)})}(dn,e)}const hn=le("ZodISOTime",(e,t)=>{Yt.init(e,t),Sn.init(e,t)});function fn(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Te(t)})}(hn,e)}const mn=le("ZodISODuration",(e,t)=>{Xt.init(e,t),Sn.init(e,t)});function yn(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Te(t)})}(mn,e)}const gn=le("ZodError",(e,t)=>{Ae.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const r=t||function(e){return e.message},n={_errors:[]},o=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>o({issues:e}));else if("invalid_key"===t.code)o({issues:t.issues});else if("invalid_element"===t.code)o({issues:t.issues});else if(0===t.path.length)n._errors.push(r(t));else{let e=n,o=0;for(;o<t.path.length;){const n=t.path[o];o===t.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(r(t))):e[n]=e[n]||{_errors:[]},e=e[n],o++}}};return o(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),vn=Ue(gn),_n=De(gn),wn=qe(gn),$n=Fe(gn),bn=le("ZodType",(e,t)=>(At.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,r)=>Se(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>vn(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>wn(e,t,r),e.parseAsync=async(t,r)=>_n(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>$n(e,t,r),e.spa=e.safeParseAsync,e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Te(r)})}(Ao,e,t)}(t,r)),e.superRefine=t=>e.check(function(e){const t=function(e){const t=new gt({check:"custom"});return t._zod.check=e,t}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(Oe(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(Oe(n))}},e(r.value,r)));return t}(t)),e.overwrite=t=>e.check(on(t)),e.optional=()=>So(e),e.nullable=()=>xo(e),e.nullish=()=>So(xo(e)),e.nonoptional=t=>function(e,t){return new No({type:"nonoptional",innerType:e,...Te(t)})}(e,t),e.array=()=>ao(e),e.or=t=>po([e,t]),e.and=t=>yo(e,t),e.transform=t=>Oo(e,Eo(t)),e.default=t=>{return r=t,new Io({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():r}});var r},e.prefault=t=>{return r=t,new Co({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():r}});var r},e.catch=t=>{return new jo({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Oo(e,t),e.readonly=()=>new zo({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Gr.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Gr.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Gr.get(e);const r=e.clone();return Gr.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),kn=le("_ZodString",(e,t)=>{Mt.init(e,t),bn.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new Tt({check:"string_format",format:"regex",...Te(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Ct({check:"string_format",format:"includes",...Te(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Nt({check:"string_format",format:"starts_with",...Te(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new jt({check:"string_format",format:"ends_with",...Te(t),suffix:e})}(...t)),e.min=(...t)=>e.check(rn(...t)),e.max=(...t)=>e.check(tn(...t)),e.length=(...t)=>e.check(nn(...t)),e.nonempty=(...t)=>e.check(rn(1,...t)),e.lowercase=t=>e.check(function(e){return new xt({check:"string_format",format:"lowercase",...Te(e)})}(t)),e.uppercase=t=>e.check(function(e){return new It({check:"string_format",format:"uppercase",...Te(e)})}(t)),e.trim=()=>e.check(on(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return on(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(on(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(on(e=>e.toUpperCase()))}),En=le("ZodString",(e,t)=>{Mt.init(e,t),kn.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Te(t)})}(Tn,t)),e.url=t=>e.check(Wr(Cn,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(t)})}(Kn,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(t)})}(Nn,t)),e.guid=t=>e.check(Jr(xn,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(t)})}(In,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(t)})}(In,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(t)})}(In,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(t)})}(In,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(t)})}(jn,t)),e.guid=t=>e.check(Jr(xn,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(t)})}(Rn,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(t)})}(On,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(t)})}(zn,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Te(t)})}(Fn,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(t)})}(Ln,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Te(t)})}(An,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(t)})}(Mn,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(t)})}(Un,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(t)})}(Dn,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(t)})}(qn,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(t)})}(Vn,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Te(t)})}(Hn,t)),e.datetime=t=>e.check(un(t)),e.date=t=>e.check(pn(t)),e.time=t=>e.check(fn(t)),e.duration=t=>e.check(yn(t))});function Pn(e){return function(e,t){return new e({type:"string",...Te(t)})}(En,e)}const Sn=le("ZodStringFormat",(e,t)=>{Ut.init(e,t),kn.init(e,t)}),Tn=le("ZodEmail",(e,t)=>{Vt.init(e,t),Sn.init(e,t)}),xn=le("ZodGUID",(e,t)=>{Dt.init(e,t),Sn.init(e,t)}),In=le("ZodUUID",(e,t)=>{qt.init(e,t),Sn.init(e,t)}),Cn=le("ZodURL",(e,t)=>{Ft.init(e,t),Sn.init(e,t)});const Nn=le("ZodEmoji",(e,t)=>{Lt.init(e,t),Sn.init(e,t)}),jn=le("ZodNanoID",(e,t)=>{Ht.init(e,t),Sn.init(e,t)}),Rn=le("ZodCUID",(e,t)=>{Kt.init(e,t),Sn.init(e,t)}),On=le("ZodCUID2",(e,t)=>{Zt.init(e,t),Sn.init(e,t)}),zn=le("ZodULID",(e,t)=>{Gt.init(e,t),Sn.init(e,t)}),An=le("ZodXID",(e,t)=>{Jt.init(e,t),Sn.init(e,t)}),Mn=le("ZodKSUID",(e,t)=>{Wt.init(e,t),Sn.init(e,t)}),Un=le("ZodIPv4",(e,t)=>{er.init(e,t),Sn.init(e,t)}),Dn=le("ZodIPv6",(e,t)=>{tr.init(e,t),Sn.init(e,t)}),qn=le("ZodCIDRv4",(e,t)=>{rr.init(e,t),Sn.init(e,t)}),Vn=le("ZodCIDRv6",(e,t)=>{nr.init(e,t),Sn.init(e,t)}),Fn=le("ZodBase64",(e,t)=>{sr.init(e,t),Sn.init(e,t)}),Ln=le("ZodBase64URL",(e,t)=>{ar.init(e,t),Sn.init(e,t)}),Hn=le("ZodE164",(e,t)=>{ir.init(e,t),Sn.init(e,t)}),Kn=le("ZodJWT",(e,t)=>{cr.init(e,t),Sn.init(e,t)}),Zn=le("ZodNumber",(e,t)=>{lr.init(e,t),bn.init(e,t),e.gt=(t,r)=>e.check(Yr(t,r)),e.gte=(t,r)=>e.check(Xr(t,r)),e.min=(t,r)=>e.check(Xr(t,r)),e.lt=(t,r)=>e.check(Br(t,r)),e.lte=(t,r)=>e.check(Qr(t,r)),e.max=(t,r)=>e.check(Qr(t,r)),e.int=t=>e.check(Wn(t)),e.safe=t=>e.check(Wn(t)),e.positive=t=>e.check(Yr(0,t)),e.nonnegative=t=>e.check(Xr(0,t)),e.negative=t=>e.check(Br(0,t)),e.nonpositive=t=>e.check(Qr(0,t)),e.multipleOf=(t,r)=>e.check(en(t,r)),e.step=(t,r)=>e.check(en(t,r)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Gn(e){return function(e,t){return new e({type:"number",checks:[],...Te(t)})}(Zn,e)}const Jn=le("ZodNumberFormat",(e,t)=>{ur.init(e,t),Zn.init(e,t)});function Wn(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Te(t)})}(Jn,e)}const Bn=le("ZodBoolean",(e,t)=>{dr.init(e,t),bn.init(e,t)});function Qn(e){return function(e,t){return new e({type:"boolean",...Te(t)})}(Bn,e)}const Yn=le("ZodNull",(e,t)=>{pr.init(e,t),bn.init(e,t)});function Xn(e){return function(e,t){return new e({type:"null",...Te(t)})}(Yn,e)}const eo=le("ZodAny",(e,t)=>{hr.init(e,t),bn.init(e,t)});const to=le("ZodUnknown",(e,t)=>{fr.init(e,t),bn.init(e,t)});function ro(){return new to({type:"unknown"})}const no=le("ZodNever",(e,t)=>{mr.init(e,t),bn.init(e,t)});function oo(e){return function(e,t){return new e({type:"never",...Te(t)})}(no,e)}const so=le("ZodArray",(e,t)=>{gr.init(e,t),bn.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(rn(t,r)),e.nonempty=t=>e.check(rn(1,t)),e.max=(t,r)=>e.check(tn(t,r)),e.length=(t,r)=>e.check(nn(t,r)),e.unwrap=()=>e.element});function ao(e,t){return function(e,t,r){return new e({type:"array",element:t,...Te(r)})}(so,e,t)}const io=le("ZodObject",(e,t)=>{wr.init(e,t),bn.init(e,t),ge(e,"shape",()=>t.shape),e.keyof=()=>wo(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ro()}),e.loose=()=>e.clone({...e._zod.def,catchall:ro()}),e.strict=()=>e.clone({...e._zod.def,catchall:oo()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!ke(t))throw new Error("Invalid input to extend: expected a plain object");const r={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return ve(this,"shape",r),r},checks:[]};return Se(e,r)}(e,t),e.merge=t=>{return n=t,Se(r=e,{...r._zod.def,get shape(){const e={...r._zod.def.shape,...n._zod.def.shape};return ve(this,"shape",e),e},catchall:n._zod.def.catchall,checks:[]});var r,n},e.pick=t=>function(e,t){const r={},n=e._zod.def;for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&(r[e]=n.shape[e])}return Se(e,{...e._zod.def,shape:r,checks:[]})}(e,t),e.omit=t=>function(e,t){const r={...e._zod.def.shape},n=e._zod.def;for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Se(e,{...e._zod.def,shape:r,checks:[]})}(e,t),e.partial=(...t)=>function(e,t,r){const n=t._zod.def.shape,o={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)o[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return Se(t,{...t._zod.def,shape:o,checks:[]})}(Po,e,t[0]),e.required=(...t)=>function(e,t,r){const n=t._zod.def.shape,o={...n};if(r)for(const t in r){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)o[t]=new e({type:"nonoptional",innerType:n[t]});return Se(t,{...t._zod.def,shape:o,checks:[]})}(No,e,t[0])});function co(e,t){const r={type:"object",get shape(){return ve(this,"shape",{...e}),this.shape},...Te(t)};return new io(r)}function lo(e,t){return new io({type:"object",get shape(){return ve(this,"shape",{...e}),this.shape},catchall:ro(),...Te(t)})}const uo=le("ZodUnion",(e,t)=>{br.init(e,t),bn.init(e,t),e.options=t.options});function po(e,t){return new uo({type:"union",options:e,...Te(t)})}const ho=le("ZodDiscriminatedUnion",(e,t)=>{uo.init(e,t),kr.init(e,t)});function fo(e,t,r){return new ho({type:"union",options:t,discriminator:e,...Te(r)})}const mo=le("ZodIntersection",(e,t)=>{Er.init(e,t),bn.init(e,t)});function yo(e,t){return new mo({type:"intersection",left:e,right:t})}const go=le("ZodRecord",(e,t)=>{Tr.init(e,t),bn.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function vo(e,t,r){return new go({type:"record",keyType:e,valueType:t,...Te(r)})}const _o=le("ZodEnum",(e,t)=>{xr.init(e,t),bn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const o={};for(const n of e){if(!r.has(n))throw new Error(`Key ${n} not found in enum`);o[n]=t.entries[n]}return new _o({...t,checks:[],...Te(n),entries:o})},e.exclude=(e,n)=>{const o={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new _o({...t,checks:[],...Te(n),entries:o})}});function wo(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new _o({type:"enum",entries:r,...Te(t)})}const $o=le("ZodLiteral",(e,t)=>{Ir.init(e,t),bn.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function bo(e,t){return new $o({type:"literal",values:Array.isArray(e)?e:[e],...Te(t)})}const ko=le("ZodTransform",(e,t)=>{Cr.init(e,t),bn.init(e,t),e._zod.parse=(r,n)=>{r.addIssue=n=>{if("string"==typeof n)r.issues.push(Oe(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),t.continue??(t.continue=!0),r.issues.push(Oe(t))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(e=>(r.value=e,r)):(r.value=o,r)}});function Eo(e){return new ko({type:"transform",transform:e})}const Po=le("ZodOptional",(e,t)=>{Nr.init(e,t),bn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function So(e){return new Po({type:"optional",innerType:e})}const To=le("ZodNullable",(e,t)=>{jr.init(e,t),bn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function xo(e){return new To({type:"nullable",innerType:e})}const Io=le("ZodDefault",(e,t)=>{Rr.init(e,t),bn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Co=le("ZodPrefault",(e,t)=>{zr.init(e,t),bn.init(e,t),e.unwrap=()=>e._zod.def.innerType});const No=le("ZodNonOptional",(e,t)=>{Ar.init(e,t),bn.init(e,t),e.unwrap=()=>e._zod.def.innerType});const jo=le("ZodCatch",(e,t)=>{Ur.init(e,t),bn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const Ro=le("ZodPipe",(e,t)=>{Dr.init(e,t),bn.init(e,t),e.in=t.in,e.out=t.out});function Oo(e,t){return new Ro({type:"pipe",in:e,out:t})}const zo=le("ZodReadonly",(e,t)=>{Vr.init(e,t),bn.init(e,t)});const Ao=le("ZodCustom",(e,t)=>{Lr.init(e,t),bn.init(e,t)});function Mo(e,t){return Oo(Eo(e),t)}const Uo="custom";const Do="2025-11-25",qo=[Do,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Vo="io.modelcontextprotocol/related-task",Fo="2.0",Lo=function(e,t,r){const n=Te(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}(Ao,(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),Ho);var Ho;const Ko=po([Pn(),Gn().int()]),Zo=Pn();lo({ttl:po([Gn(),Xn()]).optional(),pollInterval:Gn().optional()});const Go=co({ttl:Gn().optional()}),Jo=co({taskId:Pn()}),Wo=lo({progressToken:Ko.optional(),[Vo]:Jo.optional()}),Bo=co({_meta:Wo.optional()}),Qo=Bo.extend({task:Go.optional()}),Yo=co({method:Pn(),params:Bo.loose().optional()}),Xo=co({_meta:Wo.optional()}),es=co({method:Pn(),params:Xo.loose().optional()}),ts=lo({_meta:Wo.optional()}),rs=po([Pn(),Gn().int()]),ns=co({jsonrpc:bo(Fo),id:rs,...Yo.shape}).strict(),os=e=>ns.safeParse(e).success,ss=co({jsonrpc:bo(Fo),...es.shape}).strict(),as=co({jsonrpc:bo(Fo),id:rs,result:ts}).strict(),is=e=>as.safeParse(e).success;var cs;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"}(cs||(cs={}));const ls=co({jsonrpc:bo(Fo),id:rs.optional(),error:co({code:Gn().int(),message:Pn(),data:ro().optional()})}).strict(),us=po([ns,ss,as,ls]);po([as,ls]);const ds=ts.strict(),ps=Xo.extend({requestId:rs.optional(),reason:Pn().optional()}),hs=es.extend({method:bo("notifications/cancelled"),params:ps}),fs=co({src:Pn(),mimeType:Pn().optional(),sizes:ao(Pn()).optional(),theme:wo(["light","dark"]).optional()}),ms=co({icons:ao(fs).optional()}),ys=co({name:Pn(),title:Pn().optional()}),gs=ys.extend({...ys.shape,...ms.shape,version:Pn(),websiteUrl:Pn().optional(),description:Pn().optional()}),vs=yo(co({applyDefaults:Qn().optional()}),vo(Pn(),ro())),_s=Mo(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,yo(co({form:vs.optional(),url:Lo.optional()}),vo(Pn(),ro()).optional())),ws=lo({list:Lo.optional(),cancel:Lo.optional(),requests:lo({sampling:lo({createMessage:Lo.optional()}).optional(),elicitation:lo({create:Lo.optional()}).optional()}).optional()}),$s=lo({list:Lo.optional(),cancel:Lo.optional(),requests:lo({tools:lo({call:Lo.optional()}).optional()}).optional()}),bs=co({experimental:vo(Pn(),Lo).optional(),sampling:co({context:Lo.optional(),tools:Lo.optional()}).optional(),elicitation:_s.optional(),roots:co({listChanged:Qn().optional()}).optional(),tasks:ws.optional()}),ks=Bo.extend({protocolVersion:Pn(),capabilities:bs,clientInfo:gs}),Es=Yo.extend({method:bo("initialize"),params:ks}),Ps=co({experimental:vo(Pn(),Lo).optional(),logging:Lo.optional(),completions:Lo.optional(),prompts:co({listChanged:Qn().optional()}).optional(),resources:co({subscribe:Qn().optional(),listChanged:Qn().optional()}).optional(),tools:co({listChanged:Qn().optional()}).optional(),tasks:$s.optional()}),Ss=ts.extend({protocolVersion:Pn(),capabilities:Ps,serverInfo:gs,instructions:Pn().optional()}),Ts=es.extend({method:bo("notifications/initialized"),params:Xo.optional()}),xs=Yo.extend({method:bo("ping"),params:Bo.optional()}),Is=co({progress:Gn(),total:So(Gn()),message:So(Pn())}),Cs=co({...Xo.shape,...Is.shape,progressToken:Ko}),Ns=es.extend({method:bo("notifications/progress"),params:Cs}),js=Bo.extend({cursor:Zo.optional()}),Rs=Yo.extend({params:js.optional()}),Os=ts.extend({nextCursor:Zo.optional()}),zs=wo(["working","input_required","completed","failed","cancelled"]),As=co({taskId:Pn(),status:zs,ttl:po([Gn(),Xn()]),createdAt:Pn(),lastUpdatedAt:Pn(),pollInterval:So(Gn()),statusMessage:So(Pn())}),Ms=ts.extend({task:As}),Us=Xo.merge(As),Ds=es.extend({method:bo("notifications/tasks/status"),params:Us}),qs=Yo.extend({method:bo("tasks/get"),params:Bo.extend({taskId:Pn()})}),Vs=ts.merge(As),Fs=Yo.extend({method:bo("tasks/result"),params:Bo.extend({taskId:Pn()})});ts.loose();const Ls=Rs.extend({method:bo("tasks/list")}),Hs=Os.extend({tasks:ao(As)}),Ks=Yo.extend({method:bo("tasks/cancel"),params:Bo.extend({taskId:Pn()})}),Zs=ts.merge(As),Gs=co({uri:Pn(),mimeType:So(Pn()),_meta:vo(Pn(),ro()).optional()}),Js=Gs.extend({text:Pn()}),Ws=Pn().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Bs=Gs.extend({blob:Ws}),Qs=wo(["user","assistant"]),Ys=co({audience:ao(Qs).optional(),priority:Gn().min(0).max(1).optional(),lastModified:un({offset:!0}).optional()}),Xs=co({...ys.shape,...ms.shape,uri:Pn(),description:So(Pn()),mimeType:So(Pn()),annotations:Ys.optional(),_meta:So(lo({}))}),ea=co({...ys.shape,...ms.shape,uriTemplate:Pn(),description:So(Pn()),mimeType:So(Pn()),annotations:Ys.optional(),_meta:So(lo({}))}),ta=Rs.extend({method:bo("resources/list")}),ra=Os.extend({resources:ao(Xs)}),na=Rs.extend({method:bo("resources/templates/list")}),oa=Os.extend({resourceTemplates:ao(ea)}),sa=Bo.extend({uri:Pn()}),aa=sa,ia=Yo.extend({method:bo("resources/read"),params:aa}),ca=ts.extend({contents:ao(po([Js,Bs]))}),la=es.extend({method:bo("notifications/resources/list_changed"),params:Xo.optional()}),ua=sa,da=Yo.extend({method:bo("resources/subscribe"),params:ua}),pa=sa,ha=Yo.extend({method:bo("resources/unsubscribe"),params:pa}),fa=Xo.extend({uri:Pn()}),ma=es.extend({method:bo("notifications/resources/updated"),params:fa}),ya=co({name:Pn(),description:So(Pn()),required:So(Qn())}),ga=co({...ys.shape,...ms.shape,description:So(Pn()),arguments:So(ao(ya)),_meta:So(lo({}))}),va=Rs.extend({method:bo("prompts/list")}),_a=Os.extend({prompts:ao(ga)}),wa=Bo.extend({name:Pn(),arguments:vo(Pn(),Pn()).optional()}),$a=Yo.extend({method:bo("prompts/get"),params:wa}),ba=co({type:bo("text"),text:Pn(),annotations:Ys.optional(),_meta:vo(Pn(),ro()).optional()}),ka=co({type:bo("image"),data:Ws,mimeType:Pn(),annotations:Ys.optional(),_meta:vo(Pn(),ro()).optional()}),Ea=co({type:bo("audio"),data:Ws,mimeType:Pn(),annotations:Ys.optional(),_meta:vo(Pn(),ro()).optional()}),Pa=co({type:bo("tool_use"),name:Pn(),id:Pn(),input:vo(Pn(),ro()),_meta:vo(Pn(),ro()).optional()}),Sa=co({type:bo("resource"),resource:po([Js,Bs]),annotations:Ys.optional(),_meta:vo(Pn(),ro()).optional()}),Ta=po([ba,ka,Ea,Xs.extend({type:bo("resource_link")}),Sa]),xa=co({role:Qs,content:Ta}),Ia=ts.extend({description:Pn().optional(),messages:ao(xa)}),Ca=es.extend({method:bo("notifications/prompts/list_changed"),params:Xo.optional()}),Na=co({title:Pn().optional(),readOnlyHint:Qn().optional(),destructiveHint:Qn().optional(),idempotentHint:Qn().optional(),openWorldHint:Qn().optional()}),ja=co({taskSupport:wo(["required","optional","forbidden"]).optional()}),Ra=co({...ys.shape,...ms.shape,description:Pn().optional(),inputSchema:co({type:bo("object"),properties:vo(Pn(),Lo).optional(),required:ao(Pn()).optional()}).catchall(ro()),outputSchema:co({type:bo("object"),properties:vo(Pn(),Lo).optional(),required:ao(Pn()).optional()}).catchall(ro()).optional(),annotations:Na.optional(),execution:ja.optional(),_meta:vo(Pn(),ro()).optional()}),Oa=Rs.extend({method:bo("tools/list")}),za=Os.extend({tools:ao(Ra)}),Aa=ts.extend({content:ao(Ta).default([]),structuredContent:vo(Pn(),ro()).optional(),isError:Qn().optional()});Aa.or(ts.extend({toolResult:ro()}));const Ma=Qo.extend({name:Pn(),arguments:vo(Pn(),ro()).optional()}),Ua=Yo.extend({method:bo("tools/call"),params:Ma}),Da=es.extend({method:bo("notifications/tools/list_changed"),params:Xo.optional()}),qa=co({autoRefresh:Qn().default(!0),debounceMs:Gn().int().nonnegative().default(300)}),Va=wo(["debug","info","notice","warning","error","critical","alert","emergency"]),Fa=Bo.extend({level:Va}),La=Yo.extend({method:bo("logging/setLevel"),params:Fa}),Ha=Xo.extend({level:Va,logger:Pn().optional(),data:ro()}),Ka=es.extend({method:bo("notifications/message"),params:Ha}),Za=co({name:Pn().optional()}),Ga=co({hints:ao(Za).optional(),costPriority:Gn().min(0).max(1).optional(),speedPriority:Gn().min(0).max(1).optional(),intelligencePriority:Gn().min(0).max(1).optional()}),Ja=co({mode:wo(["auto","required","none"]).optional()}),Wa=co({type:bo("tool_result"),toolUseId:Pn().describe("The unique identifier for the corresponding tool call."),content:ao(Ta).default([]),structuredContent:co({}).loose().optional(),isError:Qn().optional(),_meta:vo(Pn(),ro()).optional()}),Ba=fo("type",[ba,ka,Ea]),Qa=fo("type",[ba,ka,Ea,Pa,Wa]),Ya=co({role:Qs,content:po([Qa,ao(Qa)]),_meta:vo(Pn(),ro()).optional()}),Xa=Qo.extend({messages:ao(Ya),modelPreferences:Ga.optional(),systemPrompt:Pn().optional(),includeContext:wo(["none","thisServer","allServers"]).optional(),temperature:Gn().optional(),maxTokens:Gn().int(),stopSequences:ao(Pn()).optional(),metadata:Lo.optional(),tools:ao(Ra).optional(),toolChoice:Ja.optional()}),ei=Yo.extend({method:bo("sampling/createMessage"),params:Xa}),ti=ts.extend({model:Pn(),stopReason:So(wo(["endTurn","stopSequence","maxTokens"]).or(Pn())),role:Qs,content:Ba}),ri=ts.extend({model:Pn(),stopReason:So(wo(["endTurn","stopSequence","maxTokens","toolUse"]).or(Pn())),role:Qs,content:po([Qa,ao(Qa)])}),ni=co({type:bo("boolean"),title:Pn().optional(),description:Pn().optional(),default:Qn().optional()}),oi=co({type:bo("string"),title:Pn().optional(),description:Pn().optional(),minLength:Gn().optional(),maxLength:Gn().optional(),format:wo(["email","uri","date","date-time"]).optional(),default:Pn().optional()}),si=co({type:wo(["number","integer"]),title:Pn().optional(),description:Pn().optional(),minimum:Gn().optional(),maximum:Gn().optional(),default:Gn().optional()}),ai=co({type:bo("string"),title:Pn().optional(),description:Pn().optional(),enum:ao(Pn()),default:Pn().optional()}),ii=co({type:bo("string"),title:Pn().optional(),description:Pn().optional(),oneOf:ao(co({const:Pn(),title:Pn()})),default:Pn().optional()}),ci=co({type:bo("string"),title:Pn().optional(),description:Pn().optional(),enum:ao(Pn()),enumNames:ao(Pn()).optional(),default:Pn().optional()}),li=po([ai,ii]),ui=po([co({type:bo("array"),title:Pn().optional(),description:Pn().optional(),minItems:Gn().optional(),maxItems:Gn().optional(),items:co({type:bo("string"),enum:ao(Pn())}),default:ao(Pn()).optional()}),co({type:bo("array"),title:Pn().optional(),description:Pn().optional(),minItems:Gn().optional(),maxItems:Gn().optional(),items:co({anyOf:ao(co({const:Pn(),title:Pn()}))}),default:ao(Pn()).optional()})]),di=po([ci,li,ui]),pi=po([di,ni,oi,si]),hi=po([Qo.extend({mode:bo("form").optional(),message:Pn(),requestedSchema:co({type:bo("object"),properties:vo(Pn(),pi),required:ao(Pn()).optional()})}),Qo.extend({mode:bo("url"),message:Pn(),elicitationId:Pn(),url:Pn().url()})]),fi=Yo.extend({method:bo("elicitation/create"),params:hi}),mi=Xo.extend({elicitationId:Pn()}),yi=es.extend({method:bo("notifications/elicitation/complete"),params:mi}),gi=ts.extend({action:wo(["accept","decline","cancel"]),content:Mo(e=>null===e?void 0:e,vo(Pn(),po([Pn(),Gn(),Qn(),ao(Pn())])).optional())}),vi=co({type:bo("ref/resource"),uri:Pn()}),_i=co({type:bo("ref/prompt"),name:Pn()}),wi=Bo.extend({ref:po([_i,vi]),argument:co({name:Pn(),value:Pn()}),context:co({arguments:vo(Pn(),Pn()).optional()}).optional()}),$i=Yo.extend({method:bo("completion/complete"),params:wi}),bi=ts.extend({completion:lo({values:ao(Pn()).max(100),total:So(Gn().int()),hasMore:So(Qn())})}),ki=co({uri:Pn().startsWith("file://"),name:Pn().optional(),_meta:vo(Pn(),ro()).optional()}),Ei=Yo.extend({method:bo("roots/list"),params:Bo.optional()}),Pi=ts.extend({roots:ao(ki)}),Si=es.extend({method:bo("notifications/roots/list_changed"),params:Xo.optional()});po([xs,Es,$i,La,$a,va,ta,na,ia,da,ha,Ua,Oa,qs,Fs,Ls,Ks]),po([hs,Ns,Ts,Si,Ds]),po([ds,ti,ri,gi,Pi,Vs,Hs,Ms]),po([xs,ei,fi,Ei,qs,Fs,Ls,Ks]),po([hs,Ns,Ka,ma,la,Da,Ca,Ds,yi]),po([ds,Ss,bi,Ia,_a,ra,oa,ca,Aa,za,Vs,Hs,Ms]);class Ti extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===cs.UrlElicitationRequired&&r){const e=r;if(e.elicitations)return new xi(e.elicitations,t)}return new Ti(e,t,r)}}class xi extends Ti{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(cs.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function Ii(e){return"completed"===e||"failed"===e||"cancelled"===e}function Ci(e){const t=cn(e),r=t?.method;if(!r)throw new Error("Schema is missing a method literal");const n=function(e){if(sn(e)){const t=e,r=t._zod?.def;if(r){if(void 0!==r.value)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}}const t=e._def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}const r=e.value;if(void 0!==r)return r}(r);if("string"!=typeof n)throw new Error("Schema method literal must be a string");return n}function Ni(e,t){const r=an(e,t);if(!r.success)throw r.error;return r.data}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");class ji{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(hs,e=>{this._oncancel(e)}),this.setNotificationHandler(Ns,e=>{this._onprogress(e)}),this.setRequestHandler(xs,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(qs,async(e,t)=>{const r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new Ti(cs.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(Fs,async(e,t)=>{const r=async()=>{const n=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(n,t.sessionId);){if("response"===e.type||"error"===e.type){const t=e.message,r=t.id,n=this._requestResolvers.get(r);if(n)if(this._requestResolvers.delete(r),"response"===e.type)n(t);else{const e=t;n(new Ti(e.error.code,e.error.message,e.error.data))}else{const t="response"===e.type?"Response":"Error";this._onerror(new Error(`${t} handler missing for request ${r}`))}continue}await(this._transport?.send(e.message,{relatedRequestId:t.requestId}))}}const o=await this._taskStore.getTask(n,t.sessionId);if(!o)throw new Ti(cs.InvalidParams,`Task not found: ${n}`);if(!Ii(o.status))return await this._waitForTaskUpdate(n,t.signal),await r();if(Ii(o.status)){const e=await this._taskStore.getTaskResult(n,t.sessionId);return this._clearTaskQueue(n),{...e,_meta:{...e._meta,[Vo]:{taskId:n}}}}return await r()};return await r()}),this.setRequestHandler(Ls,async(e,t)=>{try{const{tasks:r,nextCursor:n}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:r,nextCursor:n,_meta:{}}}catch(e){throw new Ti(cs.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(Ks,async(e,t)=>{try{const r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new Ti(cs.InvalidParams,`Task not found: ${e.params.taskId}`);if(Ii(r.status))throw new Ti(cs.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,"cancelled","Client cancelled task execution.",t.sessionId),this._clearTaskQueue(e.params.taskId);const n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Ti(cs.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...n}}catch(e){if(e instanceof Ti)throw e;throw new Ti(cs.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;const t=this._requestHandlerAbortControllers.get(e.params.requestId);t?.abort(e.params.reason)}_setupTimeout(e,t,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),Ti.fromError(cs.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};const r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};const n=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{var r;n?.(e,t),is(e)||(r=e,ls.safeParse(r).success)?this._onresponse(e):os(e)?this._onrequest(e,t):(e=>ss.safeParse(e).success)(e)?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();const t=Ti.fromError(cs.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){const t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;void 0!==t&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){const r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,o=e.params?._meta?.[Vo]?.taskId;if(void 0===r){const t={jsonrpc:"2.0",id:e.id,error:{code:cs.MethodNotFound,message:"Method not found"}};return void(o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:t,timestamp:Date.now()},n?.sessionId).catch(e=>this._onerror(new Error(`Failed to enqueue error response: ${e}`))):n?.send(t).catch(e=>this._onerror(new Error(`Failed to send an error response: ${e}`))))}const s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);const a=(i=e.params,Qo.safeParse(i).success?e.params.task:void 0);var i;const c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,l={signal:s.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(s.signal.aborted)return;const r={relatedRequestId:e.id};o&&(r.relatedTask={taskId:o}),await this.notification(t,r)},sendRequest:async(t,r,n)=>{if(s.signal.aborted)throw new Ti(cs.ConnectionClosed,"Request was cancelled");const a={...n,relatedRequestId:e.id};o&&!a.relatedTask&&(a.relatedTask={taskId:o});const i=a.relatedTask?.taskId??o;return i&&c&&await c.updateTaskStatus(i,"input_required"),await this.request(t,r,a)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,l)).then(async t=>{if(s.signal.aborted)return;const r={result:t,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:r,timestamp:Date.now()},n?.sessionId):await(n?.send(r))},async t=>{if(s.signal.aborted)return;const r={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:cs.InternalError,message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:r,timestamp:Date.now()},n?.sessionId):await(n?.send(r))}).catch(e=>this._onerror(new Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const s=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(e){return this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),void s(e)}o(r)}_onresponse(e){const t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),is(e))r(e);else{r(new Ti(e.error.code,e.error.message,e.error.data))}return}const n=this._responseHandlers.get(t);if(void 0===n)return void this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(is(e)&&e.result&&"object"==typeof e.result){const r=e.result;if(r.task&&"object"==typeof r.task){const e=r.task;"string"==typeof e.taskId&&(o=!0,this._taskProgressTokens.set(e.taskId,t))}}if(o||this._progressHandlers.delete(t),is(e))n(e);else{n(Ti.fromError(e.error.code,e.error.message,e.error.data))}}get transport(){return this._transport}async close(){await(this._transport?.close())}async*requestStream(e,t,r){const{task:n}=r??{};if(!n){try{const n=await this.request(e,t,r);yield{type:"result",result:n}}catch(e){yield{type:"error",error:e instanceof Ti?e:new Ti(cs.InternalError,String(e))}}return}let o;try{const n=await this.request(e,Ms,r);if(!n.task)throw new Ti(cs.InternalError,"Task creation did not return a task");for(o=n.task.taskId,yield{type:"taskCreated",task:n.task};;){const e=await this.getTask({taskId:o},r);if(yield{type:"taskStatus",task:e},Ii(e.status)){if("completed"===e.status){const e=await this.getTaskResult({taskId:o},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new Ti(cs.InternalError,`Task ${o} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new Ti(cs.InternalError,`Task ${o} was cancelled`)});return}if("input_required"===e.status){const e=await this.getTaskResult({taskId:o},t,r);return void(yield{type:"result",result:e})}const n=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,n)),r?.signal?.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof Ti?e:new Ti(cs.InternalError,String(e))}}}request(e,t,r){const{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:a,relatedTask:i}=r??{};return new Promise((c,l)=>{const u=e=>{l(e)};if(!this._transport)return void u(new Error("Not connected"));if(!0===this._options?.enforceStrictCapabilities)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(e){return void u(e)}r?.signal?.throwIfAborted();const d=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:d};r?.onprogress&&(this._progressHandlers.set(d,r.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),a&&(p.params={...p.params,task:a}),i&&(p.params={...p.params,_meta:{...p.params?._meta||{},[Vo]:i}});const h=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(e)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(e=>this._onerror(new Error(`Failed to send cancellation: ${e}`)));const t=e instanceof Ti?e:new Ti(cs.RequestTimeout,String(e));l(t)};this._responseHandlers.set(d,e=>{if(!r?.signal?.aborted){if(e instanceof Error)return l(e);try{const r=an(t,e.result);r.success?c(r.data):l(r.error)}catch(e){l(e)}}}),r?.signal?.addEventListener("abort",()=>{h(r?.signal?.reason)});const f=r?.timeout??6e4;this._setupTimeout(d,f,r?.maxTotalTimeout,()=>h(Ti.fromError(cs.RequestTimeout,"Request timed out",{timeout:f})),r?.resetTimeoutOnProgress??!1);const m=i?.taskId;if(m){const e=e=>{const t=this._responseHandlers.get(d);t?t(e):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,e),this._enqueueTaskMessage(m,{type:"request",message:p,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})}else this._transport.send(p,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Vs,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Hs,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Zs,t)}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const r=t?.relatedTask?.taskId;if(r){const n={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Vo]:t.relatedTask}}};return void await this._enqueueTaskMessage(r,{type:"notification",message:n,timestamp:Date.now()})}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;return this._pendingDebouncedNotifications.add(e.method),void Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let r={...e,jsonrpc:"2.0"};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[Vo]:t.relatedTask}}}),this._transport?.send(r,t).catch(e=>this._onerror(e))})}let n={...e,jsonrpc:"2.0"};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[Vo]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const r=Ci(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,n)=>{const o=Ni(e,r);return Promise.resolve(t(o,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const r=Ci(e);this._notificationHandlers.set(r,r=>{const n=Ni(e,r);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,n)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(e,t);for(const t of r)if("request"===t.type&&os(t.message)){const r=t.message.id,n=this._requestResolvers.get(r);n?(n(new Ti(cs.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(r)):this._onerror(new Error(`Resolver missing for request ${r} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1e3;try{const t=await(this._taskStore?.getTask(e));t?.pollInterval&&(r=t.pollInterval)}catch{}return new Promise((e,n)=>{if(t.aborted)return void n(new Ti(cs.InvalidRequest,"Request cancelled"));const o=setTimeout(e,r);t.addEventListener("abort",()=>{clearTimeout(o),n(new Ti(cs.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await r.createTask(n,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{const n=await r.getTask(e,t);if(!n)throw new Ti(cs.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(e,n,o)=>{await r.storeTaskResult(e,n,o,t);const s=await r.getTask(e,t);if(s){const t=Ds.parse({method:"notifications/tasks/status",params:s});await this.notification(t),Ii(s.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,n,o)=>{const s=await r.getTask(e,t);if(!s)throw new Ti(cs.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(Ii(s.status))throw new Ti(cs.InvalidParams,`Cannot update task "${e}" from terminal status "${s.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,n,o,t);const a=await r.getTask(e,t);if(a){const t=Ds.parse({method:"notifications/tasks/status",params:a});await this.notification(t),Ii(a.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function Ri(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function Oi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zi,Ai={exports:{}},Mi={},Ui={},Di={},qi={},Vi={},Fi={};function Li(){return zi||(zi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){const r=[e[0]];let o=0;for(;o<t.length;)i(r,t[o]),r.push(e[++o]);return new n(r)}e._Code=n,e.nil=new n(""),e._=o;const s=new n("+");function a(e,...t){const r=[l(e[0])];let o=0;for(;o<t.length;)r.push(s),i(r,t[o]),r.push(s,l(e[++o]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===s){const r=c(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new n(r)}function i(e,t){var o;t instanceof n?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(o=t)||"boolean"==typeof o||null===o?o:l(Array.isArray(o)?o.join(","):o))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof r?void 0:`"${e}${t.slice(1)}`}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=a,e.addCodeArg=i,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},e.stringify=function(e){return new n(l(e))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new n(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new n(e.toString())}}(Fi)),Fi}var Hi,Ki,Zi={};function Gi(){return Hi||(Hi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Li();class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var n;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}e.Scope=o;class s extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=t._`.${new t.Name(r)}[${n}]`}}e.ValueScopeName=s;const a=t._`\n`;e.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?a:t.nil}}get(){return this._scope}name(e){return new s(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e),{prefix:o}=n,s=null!==(r=t.key)&&void 0!==r?r:t.ref;let a=this._values[o];if(a){const e=a.get(s);if(e)return e}else a=this._values[o]=new Map;a.set(s,n);const i=this._scope[o]||(this._scope[o]=[]),c=i.length;return i[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(o,s,a={},i){let c=t.nil;for(const l in o){const u=o[l];if(!u)continue;const d=a[l]=a[l]||new Map;u.forEach(o=>{if(d.has(o))return;d.set(o,n.Started);let a=s(o);if(a){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${o} = ${a};${this.opts._n}`}else{if(!(a=null==i?void 0:i(o)))throw new r(o);c=t._`${c}${a}${this.opts._n}`}d.set(o,n.Completed)})}return c}}}(Zi)),Zi}function Ji(){return Ki||(Ki=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Li(),r=Gi();var n=Li();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=Gi();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class s{optimizeNodes(){return this}optimizeNames(e,t){return this}}class a extends s{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,o=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class i extends s{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,r),this}get names(){return x(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends i{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class l extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class u extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class d extends s{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends s{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=I(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class h extends s{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const o=r[n];o.optimizeNames(e,t)||(C(e,o.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>T(e,t.names),{})}}class f extends h{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends h{}class y extends f{}y.kind="else";class g extends f{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new y(e):e}return t?!1===e?t instanceof g?t:t.nodes:this.nodes.length?this:new g(N(e),t instanceof g?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=I(this.condition,e,t),this}get names(){const e=super.names;return x(e,this.condition),this.else&&T(e,this.else.names),e}}g.kind="if";class v extends f{}v.kind="for";class _ extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=I(this.iteration,e,t),this}get names(){return T(super.names,this.iteration.names)}}class w extends v{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${t} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){const e=x(super.names,this.from);return x(e,this.to)}}class $ extends v{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=I(this.iterable,e,t),this}get names(){return T(super.names,this.iterable.names)}}class b extends f{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}b.kind="func";class k extends h{render(e){return"return "+super.render(e)}}k.kind="return";class E extends f{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&T(e,this.catch.names),this.finally&&T(e,this.finally.names),e}}class P extends f{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}P.kind="catch";class S extends f{render(e){return"finally"+super.render(e)}}S.kind="finally";function T(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function x(e,r){return r instanceof t._CodeOrName?T(e,r.names):e}function I(e,r,n){return e instanceof t.Name?s(e):(o=e)instanceof t._Code&&o._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==n[e.str])?new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=s(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[])):e;var o;function s(e){const t=n[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function C(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function N(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${z(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const o=this._scope.toName(t);return void 0!==r&&n&&(this._constants[o.str]=r),this._leafNode(new a(e,o,r)),o}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,r){return this._leafNode(new i(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new p(e)),this}object(...e){const r=["{"];for(const[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,o));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new g(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new g(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(g,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const a=this._scope.toName(e);return this._for(new w(s,a,t,n),()=>o(a))}forOf(e,n,o,s=r.varKinds.const){const a=this._scope.toName(e);if(this.opts.es5){const e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,t._`${e}.length`,r=>{this.var(a,t._`${e}[${r}]`),o(a)})}return this._for(new $("of",s,a,n),()=>o(a))}forIn(e,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${n})`,o);const a=this._scope.toName(e);return this._for(new $("in",s,a,n),()=>o(a))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){const t=new k;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new E;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new P(e),t(e)}return r&&(this._currNode=n.finally=new S,this.code(r)),this._endBlockNode(P,S)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,n,o){return this._blockNode(new b(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=N;const j=O(e.operators.AND);e.and=function(...e){return e.reduce(j)};const R=O(e.operators.OR);function O(e){return(r,n)=>r===t.nil?n:n===t.nil?r:t._`${z(r)} ${e} ${z(n)}`}function z(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(R)}}(Vi)),Vi}var Wi={};Object.defineProperty(Wi,"__esModule",{value:!0}),Wi.checkStrictMode=Wi.getErrorPath=Wi.Type=Wi.useFunc=Wi.setEvaluated=Wi.evaluatedPropsToName=Wi.mergeEvaluated=Wi.eachItem=Wi.unescapeJsonPointer=Wi.escapeJsonPointer=Wi.escapeFragment=Wi.unescapeFragment=Wi.schemaRefOrVal=Wi.schemaHasRulesButRef=Wi.schemaHasRules=Wi.checkUnknownRules=Wi.alwaysValidSchema=Wi.toHash=void 0;const Bi=Ji(),Qi=Li();function Yi(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const o=n.RULES.keywords;for(const r in t)o[r]||ic(e,`unknown keyword: "${r}"`)}function Xi(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function ec(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function tc(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function rc({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,a,i)=>{const c=void 0===a?s:a instanceof Bi.Name?(s instanceof Bi.Name?e(o,s,a):t(o,s,a),a):s instanceof Bi.Name?(t(o,a,s),s):r(s,a);return i!==Bi.Name||c instanceof Bi.Name?c:n(o,c)}}function nc(e,t){if(!0===t)return e.var("props",!0);const r=e.var("props",Bi._`{}`);return void 0!==t&&oc(e,r,t),r}function oc(e,t,r){Object.keys(r).forEach(r=>e.assign(Bi._`${t}${(0,Bi.getProperty)(r)}`,!0))}Wi.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},Wi.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(Yi(e,t),!Xi(t,e.self.RULES.all))},Wi.checkUnknownRules=Yi,Wi.schemaHasRules=Xi,Wi.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},Wi.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return Bi._`${r}`}return Bi._`${e}${t}${(0,Bi.getProperty)(n)}`},Wi.unescapeFragment=function(e){return tc(decodeURIComponent(e))},Wi.escapeFragment=function(e){return encodeURIComponent(ec(e))},Wi.escapeJsonPointer=ec,Wi.unescapeJsonPointer=tc,Wi.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},Wi.mergeEvaluated={props:rc({mergeNames:(e,t,r)=>e.if(Bi._`${r} !== true && ${t} !== undefined`,()=>{e.if(Bi._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,Bi._`${r} || {}`).code(Bi._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(Bi._`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,Bi._`${r} || {}`),oc(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:nc}),items:rc({mergeNames:(e,t,r)=>e.if(Bi._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,Bi._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(Bi._`${r} !== true`,()=>e.assign(r,!0===t||Bi._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},Wi.evaluatedPropsToName=nc,Wi.setEvaluated=oc;const sc={};var ac;function ic(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}Wi.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:sc[t.code]||(sc[t.code]=new Qi._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(ac||(Wi.Type=ac={})),Wi.getErrorPath=function(e,t,r){if(e instanceof Bi.Name){const n=t===ac.Num;return r?n?Bi._`"[" + ${e} + "]"`:Bi._`"['" + ${e} + "']"`:n?Bi._`"/" + ${e}`:Bi._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Bi.getProperty)(e).toString():"/"+ec(e)},Wi.checkStrictMode=ic;var cc,lc,uc,dc={};function pc(){if(cc)return dc;cc=1,Object.defineProperty(dc,"__esModule",{value:!0});const e=Ji(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return dc.default=t,dc}function hc(){return lc||(lc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=Ji(),r=Wi,n=pc();function o(e,r){const o=e.const("err",r);e.if(t._`${n.default.vErrors} === null`,()=>e.assign(n.default.vErrors,t._`[${o}]`),t._`${n.default.vErrors}.push(${o})`),e.code(t._`${n.default.errors}++`)}function s(e,r){const{gen:n,validateName:o,schemaEnv:s}=e;s.$async?n.throw(t._`new ${e.ValidationError}(${r})`):(n.assign(t._`${o}.errors`,r),n.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,n=e.keywordError,a,c){const{it:l}=r,{gen:u,compositeRule:d,allErrors:p}=l,h=i(r,n,a);(null!=c?c:d||p)?o(u,h):s(l,t._`[${h}]`)},e.reportExtraError=function(t,r=e.keywordError,a){const{it:c}=t,{gen:l,compositeRule:u,allErrors:d}=c;o(l,i(t,r,a)),u||d||s(c,n.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(n.default.errors,r),e.if(t._`${n.default.vErrors} !== null`,()=>e.if(r,()=>e.assign(t._`${n.default.vErrors}.length`,r),()=>e.assign(n.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:o,data:s,errsCount:a,it:i}){if(void 0===a)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",a,n.default.errors,a=>{e.const(c,t._`${n.default.vErrors}[${a}]`),e.if(t._`${c}.instancePath === undefined`,()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(n.default.instancePath,i.errorPath))),e.assign(t._`${c}.schemaPath`,t.str`${i.errSchemaPath}/${r}`),i.opts.verbose&&(e.assign(t._`${c}.schema`,o),e.assign(t._`${c}.data`,s))})};const a={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function i(e,r,o){const{createErrors:s}=e.it;return!1===s?t._`{}`:function(e,r,o={}){const{gen:s,it:i}=e,u=[c(i,o),l(e,o)];return function(e,{params:r,message:o},s){const{keyword:i,data:c,schemaValue:l,it:u}=e,{opts:d,propertyName:p,topSchemaRef:h,schemaPath:f}=u;s.push([a.keyword,i],[a.params,"function"==typeof r?r(e):r||t._`{}`]),d.messages&&s.push([a.message,"function"==typeof o?o(e):o]);d.verbose&&s.push([a.schema,l],[a.parentSchema,t._`${h}${f}`],[n.default.data,c]);p&&s.push([a.propertyName,p])}(e,r,u),s.object(...u)}(e,r,o)}function c({errorPath:e},{instancePath:o}){const s=o?t.str`${e}${(0,r.getErrorPath)(o,r.Type.Str)}`:e;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,s)]}function l({keyword:e,it:{errSchemaPath:n}},{schemaPath:o,parentSchema:s}){let i=s?n:t.str`${n}/${e}`;return o&&(i=t.str`${i}${(0,r.getErrorPath)(o,r.Type.Str)}`),[a.schemaPath,i]}}(qi)),qi}var fc={},mc={};Object.defineProperty(mc,"__esModule",{value:!0}),mc.getRules=mc.isJSONType=void 0;const yc=new Set(["string","number","integer","boolean","null","object","array"]);mc.isJSONType=function(e){return"string"==typeof e&&yc.has(e)},mc.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}};var gc,vc={};function _c(){if(gc)return vc;function e(e,r){return r.rules.some(r=>t(e,r))}function t(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}return gc=1,Object.defineProperty(vc,"__esModule",{value:!0}),vc.shouldUseRule=vc.shouldUseGroup=vc.schemaHasRulesForType=void 0,vc.schemaHasRulesForType=function({schema:t,self:r},n){const o=r.RULES.types[n];return o&&!0!==o&&e(t,o)},vc.shouldUseGroup=e,vc.shouldUseRule=t,vc}Object.defineProperty(fc,"__esModule",{value:!0}),fc.reportTypeError=fc.checkDataTypes=fc.checkDataType=fc.coerceAndCheckDataType=fc.getJSONTypes=fc.getSchemaTypes=fc.DataType=void 0;const wc=mc,$c=_c(),bc=hc(),kc=Ji(),Ec=Wi;var Pc;function Sc(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(wc.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(Pc||(fc.DataType=Pc={})),fc.getSchemaTypes=function(e){const t=Sc(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},fc.getJSONTypes=Sc,fc.coerceAndCheckDataType=function(e,t){const{gen:r,data:n,opts:o}=e,s=function(e,t){return t?e.filter(e=>Tc.has(e)||"array"===t&&"array"===e):[]}(t,o.coerceTypes),a=t.length>0&&!(0===s.length&&1===t.length&&(0,$c.schemaHasRulesForType)(e,t[0]));if(a){const a=Ic(t,n,o.strictNumbers,Pc.Wrong);r.if(a,()=>{s.length?function(e,t,r){const{gen:n,data:o,opts:s}=e,a=n.let("dataType",kc._`typeof ${o}`),i=n.let("coerced",kc._`undefined`);"array"===s.coerceTypes&&n.if(kc._`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,kc._`${o}[0]`).assign(a,kc._`typeof ${o}`).if(Ic(t,o,s.strictNumbers),()=>n.assign(i,o)));n.if(kc._`${i} !== undefined`);for(const e of r)(Tc.has(e)||"array"===e&&"array"===s.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void n.elseIf(kc._`${a} == "number" || ${a} == "boolean"`).assign(i,kc._`"" + ${o}`).elseIf(kc._`${o} === null`).assign(i,kc._`""`);case"number":return void n.elseIf(kc._`${a} == "boolean" || ${o} === null
2
- || (${a} == "string" && ${o} && ${o} == +${o})`).assign(i,kc._`+${o}`);case"integer":return void n.elseIf(kc._`${a} === "boolean" || ${o} === null
3
- || (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(i,kc._`+${o}`);case"boolean":return void n.elseIf(kc._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(i,!1).elseIf(kc._`${o} === "true" || ${o} === 1`).assign(i,!0);case"null":return n.elseIf(kc._`${o} === "" || ${o} === 0 || ${o} === false`),void n.assign(i,null);case"array":n.elseIf(kc._`${a} === "string" || ${a} === "number"
4
- || ${a} === "boolean" || ${o} === null`).assign(i,kc._`[${o}]`)}}n.else(),Nc(e),n.endIf(),n.if(kc._`${i} !== undefined`,()=>{n.assign(o,i),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(kc._`${t} !== undefined`,()=>e.assign(kc._`${t}[${r}]`,n))}(e,i)})}(e,t,s):Nc(e)})}return a};const Tc=new Set(["string","number","integer","boolean","null"]);function xc(e,t,r,n=Pc.Correct){const o=n===Pc.Correct?kc.operators.EQ:kc.operators.NEQ;let s;switch(e){case"null":return kc._`${t} ${o} null`;case"array":s=kc._`Array.isArray(${t})`;break;case"object":s=kc._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=a(kc._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=a();break;default:return kc._`typeof ${t} ${o} ${e}`}return n===Pc.Correct?s:(0,kc.not)(s);function a(e=kc.nil){return(0,kc.and)(kc._`typeof ${t} == "number"`,e,r?kc._`isFinite(${t})`:kc.nil)}}function Ic(e,t,r,n){if(1===e.length)return xc(e[0],t,r,n);let o;const s=(0,Ec.toHash)(e);if(s.array&&s.object){const e=kc._`typeof ${t} != "object"`;o=s.null?e:kc._`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=kc.nil;s.number&&delete s.integer;for(const e in s)o=(0,kc.and)(o,xc(e,t,r,n));return o}fc.checkDataType=xc,fc.checkDataTypes=Ic;const Cc={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?kc._`{type: ${e}}`:kc._`{type: ${t}}`};function Nc(e){const t=function(e){const{gen:t,data:r,schema:n}=e,o=(0,Ec.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}(e);(0,bc.reportError)(t,Cc)}fc.reportTypeError=Nc;var jc,Rc={};var Oc,zc,Ac={},Mc={};function Uc(){if(Oc)return Mc;Oc=1,Object.defineProperty(Mc,"__esModule",{value:!0}),Mc.validateUnion=Mc.validateArray=Mc.usePattern=Mc.callValidateCode=Mc.schemaProperties=Mc.allSchemaProperties=Mc.noPropertyInData=Mc.propertyInData=Mc.isOwnProperty=Mc.hasPropFunc=Mc.reportMissingProp=Mc.checkMissingProp=Mc.checkReportMissingProp=void 0;const e=Ji(),t=Wi,r=pc(),n=Wi;function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}function s(t,r,n){return e._`${o(t)}.call(${r}, ${n})`}function a(t,r,n,o){const a=e._`${r}${(0,e.getProperty)(n)} === undefined`;return o?(0,e.or)(a,(0,e.not)(s(t,r,n))):a}function i(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}Mc.checkReportMissingProp=function(t,r){const{gen:n,data:o,it:s}=t;n.if(a(n,o,r,s.opts.ownProperties),()=>{t.setParams({missingProperty:e._`${r}`},!0),t.error()})},Mc.checkMissingProp=function({gen:t,data:r,it:{opts:n}},o,s){return(0,e.or)(...o.map(o=>(0,e.and)(a(t,r,o,n.ownProperties),e._`${s} = ${o}`)))},Mc.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},Mc.hasPropFunc=o,Mc.isOwnProperty=s,Mc.propertyInData=function(t,r,n,o){const a=e._`${r}${(0,e.getProperty)(n)} !== undefined`;return o?e._`${a} && ${s(t,r,n)}`:a},Mc.noPropertyInData=a,Mc.allSchemaProperties=i,Mc.schemaProperties=function(e,r){return i(r).filter(n=>!(0,t.alwaysValidSchema)(e,r[n]))},Mc.callValidateCode=function({schemaCode:t,data:n,it:{gen:o,topSchemaRef:s,schemaPath:a,errorPath:i},it:c},l,u,d){const p=d?e._`${t}, ${n}, ${s}${a}`:n,h=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,i)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&h.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const f=e._`${p}, ${o.object(...h)}`;return u!==e.nil?e._`${l}.call(${u}, ${f})`:e._`${l}(${f})`};const c=e._`new RegExp`;return Mc.usePattern=function({gen:t,it:{opts:r}},o){const s=r.unicodeRegExp?"u":"",{regExp:a}=r.code,i=a(o,s);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:e._`${"new RegExp"===a.code?c:(0,n.useFunc)(t,a)}(${o}, ${s})`})},Mc.validateArray=function(r){const{gen:n,data:o,keyword:s,it:a}=r,i=n.name("valid");if(a.allErrors){const e=n.let("valid",!0);return c(()=>n.assign(e,!1)),e}return n.var(i,!0),c(()=>n.break()),i;function c(a){const c=n.const("len",e._`${o}.length`);n.forRange("i",0,c,o=>{r.subschema({keyword:s,dataProp:o,dataPropType:t.Type.Num},i),n.if((0,e.not)(i),a)})}},Mc.validateUnion=function(r){const{gen:n,schema:o,keyword:s,it:a}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(o.some(e=>(0,t.alwaysValidSchema)(a,e))&&!a.opts.unevaluated)return;const i=n.let("valid",!1),c=n.name("_valid");n.block(()=>o.forEach((t,o)=>{const a=r.subschema({keyword:s,schemaProp:o,compositeRule:!0},c);n.assign(i,e._`${i} || ${c}`);r.mergeValidEvaluated(a,c)||n.if((0,e.not)(i))})),r.result(i,()=>r.reset(),()=>r.error(!0))},Mc}function Dc(){if(zc)return Ac;zc=1,Object.defineProperty(Ac,"__esModule",{value:!0}),Ac.validateKeywordUsage=Ac.validSchemaType=Ac.funcKeywordCode=Ac.macroKeywordCode=void 0;const e=Ji(),t=pc(),r=Uc(),n=hc();function o(t){const{gen:r,data:n,it:o}=t;r.if(o.parentData,()=>r.assign(n,e._`${o.parentData}[${o.parentDataProperty}]`))}function s(t,r,n){if(void 0===n)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,e.stringify)(n)})}return Ac.macroKeywordCode=function(t,r){const{gen:n,keyword:o,schema:a,parentSchema:i,it:c}=t,l=r.macro.call(c.self,a,i,c),u=s(n,o,l);!1!==c.opts.validateSchema&&c.self.validateSchema(l,!0);const d=n.name("valid");t.subschema({schema:l,schemaPath:e.nil,errSchemaPath:`${c.errSchemaPath}/${o}`,topSchemaRef:u,compositeRule:!0},d),t.pass(d,()=>t.error(!0))},Ac.funcKeywordCode=function(a,i){var c;const{gen:l,keyword:u,schema:d,parentSchema:p,$data:h,it:f}=a;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(f,i);const m=!h&&i.compile?i.compile.call(f.self,d,p,f):i.validate,y=s(l,u,m),g=l.let("valid");function v(n=(i.async?e._`await `:e.nil)){const o=f.opts.passContext?t.default.this:t.default.self,s=!("compile"in i&&!h||!1===i.schema);l.assign(g,e._`${n}${(0,r.callValidateCode)(a,y,o,s)}`,i.modifying)}function _(t){var r;l.if((0,e.not)(null!==(r=i.valid)&&void 0!==r?r:g),t)}a.block$data(g,function(){if(!1===i.errors)v(),i.modifying&&o(a),_(()=>a.error());else{const r=i.async?function(){const t=l.let("ruleErrs",null);return l.try(()=>v(e._`await `),r=>l.assign(g,!1).if(e._`${r} instanceof ${f.ValidationError}`,()=>l.assign(t,e._`${r}.errors`),()=>l.throw(r))),t}():function(){const t=e._`${y}.errors`;return l.assign(t,null),v(e.nil),t}();i.modifying&&o(a),_(()=>function(r,o){const{gen:s}=r;s.if(e._`Array.isArray(${o})`,()=>{s.assign(t.default.vErrors,e._`${t.default.vErrors} === null ? ${o} : ${t.default.vErrors}.concat(${o})`).assign(t.default.errors,e._`${t.default.vErrors}.length`),(0,n.extendErrors)(r)},()=>r.error())}(a,r))}}),a.ok(null!==(c=i.valid)&&void 0!==c?c:g)},Ac.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},Ac.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");const a=o.dependencies;if(null==a?void 0:a.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${s}: ${a.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},Ac}var qc,Vc={};var Fc={},Lc=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!==o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;0!==o--;){var a=s[o];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r},Hc={exports:{}},Kc=Hc.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),Zc(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function Zc(e,t,r,n,o,s,a,i,c,l){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var u in t(n,o,s,a,i,c,l),n){var d=n[u];if(Array.isArray(d)){if(u in Kc.arrayKeywords)for(var p=0;p<d.length;p++)Zc(e,t,r,d[p],o+"/"+u+"/"+p,s,o,u,n,p)}else if(u in Kc.propsKeywords){if(d&&"object"==typeof d)for(var h in d)Zc(e,t,r,d[h],o+"/"+u+"/"+Gc(h),s,o,u,n,h)}else(u in Kc.keywords||e.allKeys&&!(u in Kc.skipKeywords))&&Zc(e,t,r,d,o+"/"+u,s,o,u,n)}r(n,o,s,a,i,c,l)}}function Gc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}Kc.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Kc.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},Kc.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},Kc.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};var Jc=Hc.exports;Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.getSchemaRefs=Fc.resolveUrl=Fc.normalizeId=Fc._getFullPath=Fc.getFullPath=Fc.inlineRef=void 0;const Wc=Wi,Bc=Lc,Qc=Jc,Yc=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);Fc.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!el(e):!!t&&tl(e)<=t)};const Xc=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function el(e){for(const t in e){if(Xc.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(el))return!0;if("object"==typeof r&&el(r))return!0}return!1}function tl(e){let t=0;for(const r in e){if("$ref"===r)return 1/0;if(t++,!Yc.has(r)&&("object"==typeof e[r]&&(0,Wc.eachItem)(e[r],e=>t+=tl(e)),t===1/0))return 1/0}return t}function rl(e,t="",r){!1!==r&&(t=sl(t));const n=e.parse(t);return nl(e,n)}function nl(e,t){return e.serialize(t).split("#")[0]+"#"}Fc.getFullPath=rl,Fc._getFullPath=nl;const ol=/#\/?$/;function sl(e){return e?e.replace(ol,""):""}Fc.normalizeId=sl,Fc.resolveUrl=function(e,t,r){return r=sl(r),e.resolve(t,r)};const al=/^[a-z_][-a-z0-9._]*$/i;var il;function cl(){if(il)return Ui;il=1,Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.getData=Ui.KeywordCxt=Ui.validateFunctionCode=void 0;const e=function(){if(uc)return Di;uc=1,Object.defineProperty(Di,"__esModule",{value:!0}),Di.boolOrEmptySchema=Di.topBoolOrEmptySchema=void 0;const e=hc(),t=Ji(),r=pc(),n={message:"boolean schema is false"};function o(t,r){const{gen:o,data:s}=t,a={gen:o,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(a,n,void 0,r)}return Di.topBoolOrEmptySchema=function(e){const{gen:n,schema:s,validateName:a}=e;!1===s?o(e,!1):"object"==typeof s&&!0===s.$async?n.return(r.default.data):(n.assign(t._`${a}.errors`,null),n.return(!0))},Di.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),o(e)):r.var(t,!0)},Di}(),t=fc,r=_c(),n=fc,o=function(){if(jc)return Rc;jc=1,Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.assignDefaults=void 0;const e=Ji(),t=Wi;function r(r,n,o){const{gen:s,compositeRule:a,data:i,opts:c}=r;if(void 0===o)return;const l=e._`${i}${(0,e.getProperty)(n)}`;if(a)return void(0,t.checkStrictMode)(r,`default is ignored for: ${l}`);let u=e._`${l} === undefined`;"empty"===c.useDefaults&&(u=e._`${u} || ${l} === null || ${l} === ""`),s.if(u,e._`${l} = ${(0,e.stringify)(o)}`)}return Rc.assignDefaults=function(e,t){const{properties:n,items:o}=e.schema;if("object"===t&&n)for(const t in n)r(e,t,n[t].default);else"array"===t&&Array.isArray(o)&&o.forEach((t,n)=>r(e,n,t.default))},Rc}(),s=Dc(),a=function(){if(qc)return Vc;qc=1,Object.defineProperty(Vc,"__esModule",{value:!0}),Vc.extendSubschemaMode=Vc.extendSubschemaData=Vc.getSubschema=void 0;const e=Ji(),t=Wi;return Vc.getSubschema=function(r,{keyword:n,schemaProp:o,schema:s,schemaPath:a,errSchemaPath:i,topSchemaRef:c}){if(void 0!==n&&void 0!==s)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){const s=r.schema[n];return void 0===o?{schema:s,schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}`,errSchemaPath:`${r.errSchemaPath}/${n}`}:{schema:s[o],schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}${(0,e.getProperty)(o)}`,errSchemaPath:`${r.errSchemaPath}/${n}/${(0,t.escapeFragment)(o)}`}}if(void 0!==s){if(void 0===a||void 0===i||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:a,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')},Vc.extendSubschemaData=function(r,n,{dataProp:o,dataPropType:s,data:a,dataTypes:i,propertyName:c}){if(void 0!==a&&void 0!==o)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=n;if(void 0!==o){const{errorPath:a,dataPathArr:i,opts:c}=n;u(l.let("data",e._`${n.data}${(0,e.getProperty)(o)}`,!0)),r.errorPath=e.str`${a}${(0,t.getErrorPath)(o,s,c.jsPropertySyntax)}`,r.parentDataProperty=e._`${o}`,r.dataPathArr=[...i,r.parentDataProperty]}function u(e){r.data=e,r.dataLevel=n.dataLevel+1,r.dataTypes=[],n.definedProperties=new Set,r.parentData=n.data,r.dataNames=[...n.dataNames,e]}void 0!==a&&(u(a instanceof e.Name?a:l.let("data",a,!0)),void 0!==c&&(r.propertyName=c)),i&&(r.dataTypes=i)},Vc.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){void 0!==n&&(e.compositeRule=n),void 0!==o&&(e.createErrors=o),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r},Vc}(),i=Ji(),c=pc(),l=Fc,u=Wi,d=hc();function p({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,i._`${c.default.data}, ${c.default.valCxt}`,n.$async,()=>{e.code(i._`"use strict"; ${h(r,o)}`),function(e,t){e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,i._`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,i._`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,i._`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,i._`${c.default.valCxt}.${c.default.rootData}`),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,i._`""`),e.var(c.default.parentData,i._`undefined`),e.var(c.default.parentDataProperty,i._`undefined`),e.var(c.default.rootData,c.default.data),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`{}`)})}(e,o),e.code(s)}):e.func(t,i._`${c.default.data}, ${function(e){return i._`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${e.dynamicRef?i._`, ${c.default.dynamicAnchors}={}`:i.nil}}={}`}(o)}`,n.$async,()=>e.code(h(r,o)).code(s))}function h(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?i._`/*# sourceURL=${r} */`:i.nil}function f(t,r){y(t)&&(g(t),m(t))?function(e,t){const{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&_(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,l.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const s=n.const("_errs",c.default.errors);v(e,s),n.var(t,i._`${s} === ${c.default.errors}`)}(t,r):(0,e.boolOrEmptySchema)(t,r)}function m({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function y(e){return"boolean"!=typeof e.schema}function g(e){(0,u.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function v(e,r){if(e.opts.jtd)return w(e,[],!1,r);const n=(0,t.getSchemaTypes)(e.schema);w(e,n,!(0,t.coerceAndCheckDataType)(e,n),r)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){const s=r.$comment;if(!0===o.$comment)e.code(i._`${c.default.self}.logger.log(${s})`);else if("function"==typeof o.$comment){const r=i.str`${n}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code(i._`${c.default.self}.opts.$comment(${s}, ${r}, ${o}.schema)`)}}function w(e,t,o,s){const{gen:a,schema:l,data:d,allErrors:p,opts:h,self:f}=e,{RULES:m}=f;function y(u){(0,r.shouldUseGroup)(l,u)&&(u.type?(a.if((0,n.checkDataType)(u.type,d,h.strictNumbers)),$(e,u),1===t.length&&t[0]===u.type&&o&&(a.else(),(0,n.reportTypeError)(e)),a.endIf()):$(e,u),p||a.if(i._`${c.default.errors} === ${s||0}`))}!l.$ref||!h.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(l,m)?(h.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach(t=>{k(e.dataTypes,t)||E(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const n of e.dataTypes)k(t,n)?r.push(n):t.includes("integer")&&"number"===n&&r.push("integer");e.dataTypes=r}(e,t)})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&E(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const n=e.self.RULES.all;for(const o in n){const s=n[o];if("object"==typeof s&&(0,r.shouldUseRule)(e.schema,s)){const{type:r}=s.definition;r.length&&!r.some(e=>b(t,e))&&E(e,`missing type "${r.join(",")}" for keyword "${o}"`)}}}(e,e.dataTypes)}(e,t),a.block(()=>{for(const e of m.rules)y(e);y(m.post)})):a.block(()=>S(e,"$ref",m.all.$ref.definition))}function $(e,t){const{gen:n,schema:s,opts:{useDefaults:a}}=e;a&&(0,o.assignDefaults)(e,t.type),n.block(()=>{for(const n of t.rules)(0,r.shouldUseRule)(s,n)&&S(e,n.keyword,n.definition,t.type)})}function b(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function k(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function E(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,u.checkStrictMode)(e,t,e.opts.strictTypes)}Ui.validateFunctionCode=function(t){y(t)&&(g(t),m(t))?function(e){const{schema:t,opts:r,gen:n}=e;p(e,()=>{r.$comment&&t.$comment&&_(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,u.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(c.default.vErrors,null),n.let(c.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",i._`${r}.evaluated`),t.if(i._`${e.evaluated}.dynamicProps`,()=>t.assign(i._`${e.evaluated}.props`,i._`undefined`)),t.if(i._`${e.evaluated}.dynamicItems`,()=>t.assign(i._`${e.evaluated}.items`,i._`undefined`))}(e),v(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if(i._`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw(i._`new ${o}(${c.default.vErrors})`)):(t.assign(i._`${n}.errors`,c.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof i.Name&&e.assign(i._`${t}.props`,r);n instanceof i.Name&&e.assign(i._`${t}.items`,n)}(e),t.return(i._`${c.default.errors} === 0`))}(e)})}(t):p(t,()=>(0,e.topBoolOrEmptySchema)(t))};class P{constructor(e,t,r){if((0,s.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",I(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,i.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,i.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(i._`${t} !== undefined && (${(0,i.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?d.reportExtraError:d.reportError)(this,this.def.error,t)}$dataError(){(0,d.reportError)(this,this.def.$dataError||d.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,d.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=i.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=i.nil,t=i.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:o,def:s}=this;r.if((0,i.or)(i._`${n} === undefined`,t)),e!==i.nil&&r.assign(e,!0),(o.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==i.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:o,it:s}=this;return(0,i.or)(function(){if(r.length){if(!(t instanceof i.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return i._`${(0,n.checkDataTypes)(e,t,s.opts.strictNumbers,n.DataType.Wrong)}`}return i.nil}(),function(){if(o.validateSchema){const r=e.scopeValue("validate$data",{ref:o.validateSchema});return i._`!${r}(${t})`}return i.nil}())}subschema(e,t){const r=(0,a.getSubschema)(this.it,e);(0,a.extendSubschemaData)(r,this.it,e),(0,a.extendSubschemaMode)(r,e);const n={...this.it,...r,items:void 0,props:void 0};return f(n,t),n}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=u.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=u.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,()=>this.mergeEvaluated(e,i.Name)),!0}}function S(e,t,r,n){const o=new P(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,s.funcKeywordCode)(o,r):"macro"in r?(0,s.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,s.funcKeywordCode)(o,r)}Ui.KeywordCxt=P;const T=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function I(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(""===e)return c.default.rootData;if("/"===e[0]){if(!T.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=c.default.rootData}else{const a=x.exec(e);if(!a)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+a[1];if(o=a[2],"#"===o){if(i>=t)throw new Error(d("property/index",i));return n[t-i]}if(i>t)throw new Error(d("data",i));if(s=r[t-i],!o)return s}let a=s;const l=o.split("/");for(const e of l)e&&(s=i._`${s}${(0,i.getProperty)((0,u.unescapeJsonPointer)(e))}`,a=i._`${a} && ${s}`);return a;function d(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}return Ui.getData=I,Ui}Fc.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:r,uriResolver:n}=this.opts,o=sl(e[r]||t),s={"":o},a=rl(n,o,!1),i={},c=new Set;return Qc(e,{allKeys:!0},(e,t,n,o)=>{if(void 0===o)return;const d=a+t;let p=s[o];function h(t){const r=this.opts.uriResolver.resolve;if(t=sl(p?r(p,t):t),c.has(t))throw u(t);c.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?l(e,n.schema,t):t!==sl(d)&&("#"===t[0]?(l(e,i[t],t),i[t]=e):this.refs[t]=d),t}function f(e){if("string"==typeof e){if(!al.test(e))throw new Error(`invalid anchor "${e}"`);h.call(this,`#${e}`)}}"string"==typeof e[r]&&(p=h.call(this,e[r])),f.call(this,e.$anchor),f.call(this,e.$dynamicAnchor),s[t]=p}),i;function l(e,t,r){if(void 0!==t&&!Bc(e,t))throw u(r)}function u(e){return new Error(`reference "${e}" resolves to more than one schema`)}};var ll,ul={};function dl(){if(ll)return ul;ll=1,Object.defineProperty(ul,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return ul.default=e,ul}var pl,hl={};function fl(){if(pl)return hl;pl=1,Object.defineProperty(hl,"__esModule",{value:!0});const e=Fc;class t extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,e.resolveUrl)(t,r,n),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,this.missingRef))}}return hl.default=t,hl}var ml={};Object.defineProperty(ml,"__esModule",{value:!0}),ml.resolveSchema=ml.getCompilingSchema=ml.resolveRef=ml.compileSchema=ml.SchemaEnv=void 0;const yl=Ji(),gl=dl(),vl=pc(),_l=Fc,wl=Wi,$l=cl();let bl=class{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,_l.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}};function kl(e){const t=Pl.call(this,e);if(t)return t;const r=(0,_l.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,a=new yl.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s});let i;e.$async&&(i=a.scopeValue("Error",{ref:gl.default,code:yl._`require("ajv/dist/runtime/validation_error").default`}));const c=a.scopeName("validate");e.validateName=c;const l={gen:a,allErrors:this.opts.allErrors,data:vl.default.data,parentData:vl.default.parentData,parentDataProperty:vl.default.parentDataProperty,dataNames:[vl.default.data],dataPathArr:[yl.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,yl.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:i,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:yl.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:yl._`""`,opts:this.opts,self:this};let u;try{this._compilations.add(e),(0,$l.validateFunctionCode)(l),a.optimize(this.opts.code.optimize);const t=a.toString();u=`${a.scopeRefs(vl.default.scope)}return ${t}`,this.opts.code.process&&(u=this.opts.code.process(u,e));const r=new Function(`${vl.default.self}`,`${vl.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:c,validateCode:t,scopeValues:a._values}),this.opts.unevaluated){const{props:e,items:t}=l;r.evaluated={props:e instanceof yl.Name?void 0:e,items:t instanceof yl.Name?void 0:t,dynamicProps:e instanceof yl.Name,dynamicItems:t instanceof yl.Name},r.source&&(r.source.evaluated=(0,yl.stringify)(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),t}finally{this._compilations.delete(e)}}function El(e){return(0,_l.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:kl.call(this,e)}function Pl(e){for(const t of this._compilations)if(Sl(t,e))return t}function Sl(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Tl(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||xl.call(this,e,t)}function xl(e,t){const r=this.opts.uriResolver.parse(t),n=(0,_l._getFullPath)(this.opts.uriResolver,r);let o=(0,_l.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Cl.call(this,r,e);const s=(0,_l.normalizeId)(n),a=this.refs[s]||this.schemas[s];if("string"==typeof a){const t=xl.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return Cl.call(this,r,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||kl.call(this,a),s===(0,_l.normalizeId)(t)){const{schema:t}=a,{schemaId:r}=this.opts,n=t[r];return n&&(o=(0,_l.resolveUrl)(this.opts.uriResolver,o,n)),new bl({schema:t,schemaId:r,root:e,baseId:o})}return Cl.call(this,r,a)}}ml.SchemaEnv=bl,ml.compileSchema=kl,ml.resolveRef=function(e,t,r){var n;r=(0,_l.resolveUrl)(this.opts.uriResolver,t,r);const o=e.refs[r];if(o)return o;let s=Tl.call(this,e,r);if(void 0===s){const o=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:a}=this.opts;o&&(s=new bl({schema:o,schemaId:a,root:e,baseId:t}))}return void 0!==s?e.refs[r]=El.call(this,s):void 0},ml.getCompilingSchema=Pl,ml.resolveSchema=xl;const Il=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Cl(e,{baseId:t,schema:r,root:n}){var o;if("/"!==(null===(o=e.fragment)||void 0===o?void 0:o[0]))return;for(const n of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,wl.unescapeFragment)(n)];if(void 0===e)return;const o="object"==typeof(r=e)&&r[this.opts.schemaId];!Il.has(n)&&o&&(t=(0,_l.resolveUrl)(this.opts.uriResolver,t,o))}let s;if("boolean"!=typeof r&&r.$ref&&!(0,wl.schemaHasRulesButRef)(r,this.RULES)){const e=(0,_l.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=xl.call(this,n,e)}const{schemaId:a}=this.opts;return s=s||new bl({schema:r,schemaId:a,root:n,baseId:t}),s.schema!==s.root.schema?s:void 0}var Nl={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},jl={},Rl={exports:{}};const Ol=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),zl=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Al=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Ml=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Ul=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Dl(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),48!==r){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}const ql=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Vl(e){return e.length=0,!0}function Fl(e,t,r){if(e.length){const n=Dl(e);if(""===n)return r.error=!0,!1;t.push(n),e.length=0}return!0}function Ll(e){if(function(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}(e,":")<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const r={error:!1,address:"",zone:""},n=[],o=[];let s=!1,a=!1,i=Fl;for(let c=0;c<e.length;c++){const l=e[c];if("["!==l&&"]"!==l)if(":"!==l)if("%"===l){if(!i(o,n,r))break;i=Vl}else o.push(l);else{if(!0===s&&(a=!0),!i(o,n,r))break;if(++t>7){r.error=!0;break}c>0&&":"===e[c-1]&&(s=!0),n.push(":")}}return o.length&&(i===Vl?r.zone=o.join(""):a?n.push(o.join("")):n.push(Dl(o))),r.address=n.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}const Hl={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Kl=/[@/?#:]/g,Zl=/[@/?#]/g;function Gl(e,t){const r=t?Zl:Kl;return r.lastIndex=0,e.replace(r,e=>Hl[e])}var Jl={nonSimpleDomain:ql,recomposeAuthority:function(e){const t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let r=unescape(e.host);if(!zl(r)){const e=Ll(r);r=!0===e.isIPV6?`[${e.escapedHost}]`:Gl(r,!1)}t.push(r)}return"number"!=typeof e.port&&"string"!=typeof e.port||(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},reescapeHostDelimiters:Gl,normalizePercentEncoding:function(e,t=!1){if(-1===e.indexOf("%"))return e;let r="";for(let n=0;n<e.length;n++){if("%"===e[n]&&n+2<e.length){const o=e.slice(n+1,n+3);if(Al(o)){const e=o.toUpperCase(),s=String.fromCharCode(parseInt(e,16));t&&Ml(s)?r+=s:r+="%"+e,n+=2;continue}}r+=e[n]}return r},normalizePathEncoding:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){const n=e.slice(r+1,r+3);if(Al(n)){const e=n.toUpperCase(),o=String.fromCharCode(parseInt(e,16));"."!==o&&Ml(o)?t+=o:t+="%"+e,r+=2;continue}}Ul(e[r])?t+=e[r]:t+=escape(e[r])}return t},escapePreservingEscapes:function(e){let t="";for(let r=0;r<e.length;r++){if("%"===e[r]&&r+2<e.length){const n=e.slice(r+1,r+3);if(Al(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t},removeDotSegments:function(e){let t=e;const r=[];let n=-1,o=0;for(;o=t.length;){if(1===o){if("."===t)break;if("/"===t){r.push("/");break}r.push(t);break}if(2===o){if("."===t[0]){if("."===t[1])break;if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===o&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(n=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")},isIPv4:zl,isUUID:Ol,normalizeIPv6:Ll,stringArrayToHexStripped:Dl};const{isUUID:Wl}=Jl,Bl=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Ql=["http","https","ws","wss","urn","urn:uuid"];function Yl(e){return!0===e.secure||!1!==e.secure&&(!!e.scheme&&!(3!==e.scheme.length||"w"!==e.scheme[0]&&"W"!==e.scheme[0]||"s"!==e.scheme[1]&&"S"!==e.scheme[1]||"s"!==e.scheme[2]&&"S"!==e.scheme[2]))}function Xl(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function eu(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const tu={scheme:"http",domainHost:!0,parse:Xl,serialize:eu},ru={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=Yl(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(Yl(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},nu={http:tu,https:{scheme:"https",domainHost:tu.domainHost,parse:Xl,serialize:eu},ws:ru,wss:{scheme:"wss",domainHost:ru.domainHost,parse:ru.parse,serialize:ru.serialize},urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;const r=e.path.match(Bl);if(r){const n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];const o=ou(`${n}:${t.nid||e.nid}`);e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw new Error("URN without nid cannot be serialized");const r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=ou(`${r}:${t.nid||n}`);o&&(e=o.serialize(e,t));const s=e,a=e.nss;return s.path=`${n||t.nid}:${a}`,t.skipEscape=!0,s},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){const r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&Wl(r.uuid)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};function ou(e){return e&&(nu[e]||nu[e.toLowerCase()])||void 0}Object.setPrototypeOf(nu,null);var su={wsIsSecure:Yl,SCHEMES:nu,isValidSchemeName:function(e){return-1!==Ql.indexOf(e)},getSchemeHandler:ou};const{normalizeIPv6:au,removeDotSegments:iu,recomposeAuthority:cu,normalizePercentEncoding:lu,normalizePathEncoding:uu,escapePreservingEscapes:du,reescapeHostDelimiters:pu,isIPv4:hu,nonSimpleDomain:fu}=Jl,{SCHEMES:mu,getSchemeHandler:yu}=su;function gu(e,t,r,n){const o={};return n||(e=ku(vu(e,r),r),t=ku(vu(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=iu(t.path||""),o.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=iu(t.path||""),o.query=t.query):(t.path?("/"===t.path[0]?o.path=iu(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path:o.path="/"+t.path,o.path=iu(o.path)),o.query=t.query):(o.path=e.path,void 0!==t.query?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function vu(e,t){const r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[],s=yu(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),void 0!==r.path&&(n.skipEscape?r.path=lu(r.path):(r.path=du(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==n.reference&&r.scheme&&o.push(r.scheme,":");const a=cu(r);if(void 0!==a&&("suffix"!==n.reference&&o.push("//"),o.push(a),r.path&&"/"!==r.path[0]&&o.push("/")),void 0!==r.path){let e=r.path;n.absolutePath||s&&s.absolutePath||(e=iu(e)),void 0===a&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),o.push(e)}return void 0!==r.query&&o.push("?",r.query),void 0!==r.fragment&&o.push("#",r.fragment),o.join("")}const _u=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,wu=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,$u=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function bu(e,t){const r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let o=!1,s=!1;"suffix"===r.reference&&(e=r.scheme?r.scheme+":"+e:"//"+e);const a=e.match(wu);null!==a&&-1!==a[1].indexOf("\\")&&(n.error="URI authority must not contain a literal backslash.",o=!0);const i=e.match($u);if(null!==i){const e=i[1],t=e.replace(/[\t\n\r]/g,"");t.length>=2&&("//"!==t.slice(0,2)?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):e.length!==t.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}const c=e.match(_u);if(c){n.scheme=c[1],n.userinfo=c[3],n.host=c[4],n.port=parseInt(c[5],10),n.path=c[6]||"",n.query=c[7],n.fragment=c[8],isNaN(n.port)&&(n.port=c[5]);const t=function(e,t){return void 0!==t[2]&&e.path&&"/"!==e.path[0]?'URI path must start with "/" when authority is present.':"number"==typeof e.port&&(e.port<0||e.port>65535)?"URI port is malformed.":void 0}(n,c);if(void 0!==t&&(n.error=n.error||t,o=!0),n.host){if(!1===hu(n.host)){const e=au(n.host);n.host=e.host.toLowerCase(),s=e.isIPV6}else s=!0}void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||void 0!==n.query||n.path?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");const a=yu(r.scheme||n.scheme);if(!(r.unicodeSupport||a&&a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&!1===s&&fu(n.host))try{n.host=new URL("http://"+n.host).hostname}catch(e){n.error=n.error||"Host's domain name can not be converted to ASCII: "+e}if((!a||a&&!a.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==n.scheme&&(n.scheme=unescape(n.scheme)),void 0!==n.host&&(n.host=pu(unescape(n.host),s))),n.path&&(n.path=uu(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o}}function ku(e,t){return bu(e,t).parsed}function Eu(e,t){const{parsed:r,malformedAuthorityOrPort:n}=bu(e,t);return{normalized:n?e:vu(r,t),malformedAuthorityOrPort:n}}function Pu(e,t){if("string"==typeof e){const{normalized:r,malformedAuthorityOrPort:n}=Eu(e,t);return n?void 0:r}if("object"==typeof e)return vu(e,t)}const Su={SCHEMES:mu,normalize:function(e,t){return"string"==typeof e?e=function(e,t){return Eu(e,t).normalized}(e,t):"object"==typeof e&&(e=ku(vu(e,t),t)),e},resolve:function(e,t,r){const n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s}=bu(e,n),{parsed:a,malformedAuthorityOrPort:i}=bu(t,n);if(s||i)throw new Error(o.error||a.error||"URI is malformed.");const c=gu(o,a,n,!0);return n.skipEscape=!0,vu(c,n)},resolveComponent:gu,equal:function(e,t,r){const n=Pu(e,r),o=Pu(t,r);return void 0!==n&&void 0!==o&&n.toLowerCase()===o.toLowerCase()},serialize:vu,parse:ku};Rl.exports=Su,Rl.exports.default=Su,Rl.exports.fastUri=Su;var Tu=Rl.exports;Object.defineProperty(jl,"__esModule",{value:!0});const xu=Tu;xu.code='require("ajv/dist/runtime/uri").default',jl.default=xu,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=cl();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=Ji();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=dl(),o=fl(),s=mc,a=ml,i=Ji(),c=Fc,l=fc,u=Wi,d=Nl,p=jl,h=(e,t)=>new RegExp(e,t);h.code="new RegExp";const f=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function v(e){var t,r,n,o,s,a,i,c,l,u,d,f,m,y,g,v,_,w,$,b,k,E,P,S,T;const x=e.strict,I=null===(t=e.code)||void 0===t?void 0:t.optimize,C=!0===I||void 0===I?1:I||0,N=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:h,j=null!==(o=e.uriResolver)&&void 0!==o?o:p.default;return{strictSchema:null===(a=null!==(s=e.strictSchema)&&void 0!==s?s:x)||void 0===a||a,strictNumbers:null===(c=null!==(i=e.strictNumbers)&&void 0!==i?i:x)||void 0===c||c,strictTypes:null!==(u=null!==(l=e.strictTypes)&&void 0!==l?l:x)&&void 0!==u?u:"log",strictTuples:null!==(f=null!==(d=e.strictTuples)&&void 0!==d?d:x)&&void 0!==f?f:"log",strictRequired:null!==(y=null!==(m=e.strictRequired)&&void 0!==m?m:x)&&void 0!==y&&y,code:e.code?{...e.code,optimize:C,regExp:N}:{optimize:C,regExp:N},loopRequired:null!==(g=e.loopRequired)&&void 0!==g?g:200,loopEnum:null!==(v=e.loopEnum)&&void 0!==v?v:200,meta:null===(_=e.meta)||void 0===_||_,messages:null===(w=e.messages)||void 0===w||w,inlineRefs:null===($=e.inlineRefs)||void 0===$||$,schemaId:null!==(b=e.schemaId)&&void 0!==b?b:"$id",addUsedSchema:null===(k=e.addUsedSchema)||void 0===k||k,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(P=e.validateFormats)||void 0===P||P,unicodeRegExp:null===(S=e.unicodeRegExp)||void 0===S||S,int32range:null===(T=e.int32range)||void 0===T||T,uriResolver:j}}class _{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return S;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,s.getRules)(),w.call(this,y,e,"NOT SUPPORTED"),w.call(this,g,e,"DEPRECATED","warn"),this._metaOpts=P.call(this),e.formats&&k.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),b.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=d;"id"===r&&(n={...d},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await s.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||a.call(this,r)}async function s(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return i.call(this,t),await c.call(this,t.missingSchema),a.call(this,e)}}function i({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await l.call(this,e);this.refs[e]||await s.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function l(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let o;if("object"==typeof e){const{schemaId:t}=this.opts;if(o=e[t],void 0!==o&&"string"!=typeof o)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=$.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new a.SchemaEnv({schema:{},schemaId:r});if(t=a.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=$.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(x.call(this,r,t),!t)return(0,u.eachItem)(r,e=>I.call(this,e)),this;N.call(this,t);const n={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(r,0===n.type.length?e=>I.call(this,e,n):e=>n.type.forEach(t=>I.call(this,e,n,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let o=e;for(const e of t)o=o[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,s=o[e];n&&s&&(o[e]=R(s))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s;const{schemaId:i}=this.opts;if("object"==typeof e)s=e[i];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(void 0!==l)return l;r=(0,c.normalizeId)(s||r);const u=c.getSchemaRefs.call(this,e,r);return l=new a.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:u}),this._cache.set(l.schema,l),o&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=l),n&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):a.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,n="error"){for(const o in e){const s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function $(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function b(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function k(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function P(){const e={...this.opts};for(const t of f)delete e[t];return e}_.ValidationError=n.default,_.MissingRefError=o.default,e.default=_;const S={log(){},warn(){},error(){}};const T=/^[a-z_$][a-z0-9_$:-]*$/i;function x(e,t){const{RULES:r}=this;if((0,u.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!T.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function I(e,t,r){var n;const o=null==t?void 0:t.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let a=o?s.post:s.rules.find(({type:e})=>e===r);if(a||(a={type:r,rules:[]},s.rules.push(a)),s.keywords[e]=!0,!t)return;const i={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?C.call(this,a,i,t.before):a.rules.push(i),s.all[e]=i,null===(n=t.implements)||void 0===n||n.forEach(e=>this.addKeyword(e))}function C(e,t,r){const n=e.rules.findIndex(e=>e.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function N(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=R(t)),e.validateSchema=this.compile(t,!0))}const j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function R(e){return{anyOf:[e,j]}}}(Mi);var Iu={},Cu={},Nu={};Object.defineProperty(Nu,"__esModule",{value:!0});const ju={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Nu.default=ju;var Ru={};Object.defineProperty(Ru,"__esModule",{value:!0}),Ru.callRef=Ru.getValidate=void 0;const Ou=fl(),zu=Uc(),Au=Ji(),Mu=pc(),Uu=ml,Du=Wi,qu={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:a,opts:i,self:c}=n,{root:l}=s;if(("#"===r||"#/"===r)&&o===l.baseId)return function(){if(s===l)return Fu(e,a,s,s.$async);const r=t.scopeValue("root",{ref:l});return Fu(e,Au._`${r}.validate`,l,l.$async)}();const u=Uu.resolveRef.call(c,l,o,r);if(void 0===u)throw new Ou.default(n.opts.uriResolver,o,r);return u instanceof Uu.SchemaEnv?function(t){const r=Vu(e,t);Fu(e,r,t,t.$async)}(u):function(n){const o=t.scopeValue("schema",!0===i.code.source?{ref:n,code:(0,Au.stringify)(n)}:{ref:n}),s=t.name("valid"),a=e.subschema({schema:n,dataTypes:[],schemaPath:Au.nil,topSchemaRef:o,errSchemaPath:r},s);e.mergeEvaluated(a),e.ok(s)}(u)}};function Vu(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Au._`${r.scopeValue("wrapper",{ref:t})}.validate`}function Fu(e,t,r,n){const{gen:o,it:s}=e,{allErrors:a,schemaEnv:i,opts:c}=s,l=c.passContext?Mu.default.this:Au.nil;function u(e){const t=Au._`${e}.errors`;o.assign(Mu.default.vErrors,Au._`${Mu.default.vErrors} === null ? ${t} : ${Mu.default.vErrors}.concat(${t})`),o.assign(Mu.default.errors,Au._`${Mu.default.vErrors}.length`)}function d(e){var t;if(!s.opts.unevaluated)return;const n=null===(t=null==r?void 0:r.validate)||void 0===t?void 0:t.evaluated;if(!0!==s.props)if(n&&!n.dynamicProps)void 0!==n.props&&(s.props=Du.mergeEvaluated.props(o,n.props,s.props));else{const t=o.var("props",Au._`${e}.evaluated.props`);s.props=Du.mergeEvaluated.props(o,t,s.props,Au.Name)}if(!0!==s.items)if(n&&!n.dynamicItems)void 0!==n.items&&(s.items=Du.mergeEvaluated.items(o,n.items,s.items));else{const t=o.var("items",Au._`${e}.evaluated.items`);s.items=Du.mergeEvaluated.items(o,t,s.items,Au.Name)}}n?function(){if(!i.$async)throw new Error("async schema referenced by sync schema");const r=o.let("valid");o.try(()=>{o.code(Au._`await ${(0,zu.callValidateCode)(e,t,l)}`),d(t),a||o.assign(r,!0)},e=>{o.if(Au._`!(${e} instanceof ${s.ValidationError})`,()=>o.throw(e)),u(e),a||o.assign(r,!1)}),e.ok(r)}():e.result((0,zu.callValidateCode)(e,t,l),()=>d(t),()=>u(t))}Ru.getValidate=Vu,Ru.callRef=Fu,Ru.default=qu,Object.defineProperty(Cu,"__esModule",{value:!0});const Lu=Ru,Hu=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Nu.default,Lu.default];Cu.default=Hu;var Ku={},Zu={};Object.defineProperty(Zu,"__esModule",{value:!0});const Gu=Ji(),Ju=Gu.operators,Wu={maximum:{okStr:"<=",ok:Ju.LTE,fail:Ju.GT},minimum:{okStr:">=",ok:Ju.GTE,fail:Ju.LT},exclusiveMaximum:{okStr:"<",ok:Ju.LT,fail:Ju.GTE},exclusiveMinimum:{okStr:">",ok:Ju.GT,fail:Ju.LTE}},Bu={message:({keyword:e,schemaCode:t})=>Gu.str`must be ${Wu[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Gu._`{comparison: ${Wu[e].okStr}, limit: ${t}}`},Qu={keyword:Object.keys(Wu),type:"number",schemaType:"number",$data:!0,error:Bu,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data(Gu._`${r} ${Wu[t].fail} ${n} || isNaN(${r})`)}};Zu.default=Qu;var Yu={};Object.defineProperty(Yu,"__esModule",{value:!0});const Xu=Ji(),ed={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>Xu.str`must be multiple of ${e}`,params:({schemaCode:e})=>Xu._`{multipleOf: ${e}}`},code(e){const{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,a=t.let("res"),i=s?Xu._`Math.abs(Math.round(${a}) - ${a}) > 1e-${s}`:Xu._`${a} !== parseInt(${a})`;e.fail$data(Xu._`(${n} === 0 || (${a} = ${r}/${n}, ${i}))`)}};Yu.default=ed;var td={},rd={};function nd(e){const t=e.length;let r,n=0,o=0;for(;o<t;)n++,r=e.charCodeAt(o++),r>=55296&&r<=56319&&o<t&&(r=e.charCodeAt(o),56320==(64512&r)&&o++);return n}Object.defineProperty(rd,"__esModule",{value:!0}),rd.default=nd,nd.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(td,"__esModule",{value:!0});const od=Ji(),sd=Wi,ad=rd,id={message({keyword:e,schemaCode:t}){const r="maxLength"===e?"more":"fewer";return od.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>od._`{limit: ${e}}`},cd={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:id,code(e){const{keyword:t,data:r,schemaCode:n,it:o}=e,s="maxLength"===t?od.operators.GT:od.operators.LT,a=!1===o.opts.unicode?od._`${r}.length`:od._`${(0,sd.useFunc)(e.gen,ad.default)}(${r})`;e.fail$data(od._`${a} ${s} ${n}`)}};td.default=cd;var ld={};Object.defineProperty(ld,"__esModule",{value:!0});const ud=Uc(),dd=Wi,pd=Ji(),hd={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>pd.str`must match pattern "${e}"`,params:({schemaCode:e})=>pd._`{pattern: ${e}}`},code(e){const{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:a}=e,i=a.opts.unicodeRegExp?"u":"";if(n){const{regExp:n}=a.opts.code,o="new RegExp"===n.code?pd._`new RegExp`:(0,dd.useFunc)(t,n),c=t.let("valid");t.try(()=>t.assign(c,pd._`${o}(${s}, ${i}).test(${r})`),()=>t.assign(c,!1)),e.fail$data(pd._`!${c}`)}else{const t=(0,ud.usePattern)(e,o);e.fail$data(pd._`!${t}.test(${r})`)}}};ld.default=hd;var fd={};Object.defineProperty(fd,"__esModule",{value:!0});const md=Ji(),yd={message({keyword:e,schemaCode:t}){const r="maxProperties"===e?"more":"fewer";return md.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>md._`{limit: ${e}}`},gd={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:yd,code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxProperties"===t?md.operators.GT:md.operators.LT;e.fail$data(md._`Object.keys(${r}).length ${o} ${n}`)}};fd.default=gd;var vd={};Object.defineProperty(vd,"__esModule",{value:!0});const _d=Uc(),wd=Ji(),$d=Wi,bd={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>wd.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>wd._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:a}=e,{opts:i}=a;if(!s&&0===r.length)return;const c=r.length>=i.loopRequired;if(a.allErrors?function(){if(c||s)e.block$data(wd.nil,l);else for(const t of r)(0,_d.checkReportMissingProp)(e,t)}():function(){const a=t.let("missing");if(c||s){const r=t.let("valid",!0);e.block$data(r,()=>function(r,s){e.setParams({missingProperty:r}),t.forOf(r,n,()=>{t.assign(s,(0,_d.propertyInData)(t,o,r,i.ownProperties)),t.if((0,wd.not)(s),()=>{e.error(),t.break()})},wd.nil)}(a,r)),e.ok(r)}else t.if((0,_d.checkMissingProp)(e,r,a)),(0,_d.reportMissingProp)(e,a),t.else()}(),i.strictRequired){const t=e.parentSchema.properties,{definedProperties:n}=e.it;for(const e of r)if(void 0===(null==t?void 0:t[e])&&!n.has(e)){const t=`required property "${e}" is not defined at "${a.schemaEnv.baseId+a.errSchemaPath}" (strictRequired)`;(0,$d.checkStrictMode)(a,t,a.opts.strictRequired)}}function l(){t.forOf("prop",n,r=>{e.setParams({missingProperty:r}),t.if((0,_d.noPropertyInData)(t,o,r,i.ownProperties),()=>e.error())})}}};vd.default=bd;var kd={};Object.defineProperty(kd,"__esModule",{value:!0});const Ed=Ji(),Pd={message({keyword:e,schemaCode:t}){const r="maxItems"===e?"more":"fewer";return Ed.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>Ed._`{limit: ${e}}`},Sd={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Pd,code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxItems"===t?Ed.operators.GT:Ed.operators.LT;e.fail$data(Ed._`${r}.length ${o} ${n}`)}};kd.default=Sd;var Td={},xd={};Object.defineProperty(xd,"__esModule",{value:!0});const Id=Lc;Id.code='require("ajv/dist/runtime/equal").default',xd.default=Id,Object.defineProperty(Td,"__esModule",{value:!0});const Cd=fc,Nd=Ji(),jd=Wi,Rd=xd,Od={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>Nd.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Nd._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:a,it:i}=e;if(!n&&!o)return;const c=t.let("valid"),l=s.items?(0,Cd.getSchemaTypes)(s.items):[];function u(n,o){const s=t.name("item"),a=(0,Cd.checkDataTypes)(l,s,i.opts.strictNumbers,Cd.DataType.Wrong),u=t.const("indices",Nd._`{}`);t.for(Nd._`;${n}--;`,()=>{t.let(s,Nd._`${r}[${n}]`),t.if(a,Nd._`continue`),l.length>1&&t.if(Nd._`typeof ${s} == "string"`,Nd._`${s} += "_"`),t.if(Nd._`typeof ${u}[${s}] == "number"`,()=>{t.assign(o,Nd._`${u}[${s}]`),e.error(),t.assign(c,!1).break()}).code(Nd._`${u}[${s}] = ${n}`)})}function d(n,o){const s=(0,jd.useFunc)(t,Rd.default),a=t.name("outer");t.label(a).for(Nd._`;${n}--;`,()=>t.for(Nd._`${o} = ${n}; ${o}--;`,()=>t.if(Nd._`${s}(${r}[${n}], ${r}[${o}])`,()=>{e.error(),t.assign(c,!1).break(a)})))}e.block$data(c,function(){const n=t.let("i",Nd._`${r}.length`),o=t.let("j");e.setParams({i:n,j:o}),t.assign(c,!0),t.if(Nd._`${n} > 1`,()=>(l.length>0&&!l.some(e=>"object"===e||"array"===e)?u:d)(n,o))},Nd._`${a} === false`),e.ok(c)}};Td.default=Od;var zd={};Object.defineProperty(zd,"__esModule",{value:!0});const Ad=Ji(),Md=Wi,Ud=xd,Dd={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>Ad._`{allowedValue: ${e}}`},code(e){const{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&"object"==typeof s?e.fail$data(Ad._`!${(0,Md.useFunc)(t,Ud.default)}(${r}, ${o})`):e.fail(Ad._`${s} !== ${r}`)}};zd.default=Dd;var qd={};Object.defineProperty(qd,"__esModule",{value:!0});const Vd=Ji(),Fd=Wi,Ld=xd,Hd={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Vd._`{allowedValues: ${e}}`},code(e){const{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:a}=e;if(!n&&0===o.length)throw new Error("enum must have non-empty array");const i=o.length>=a.opts.loopEnum;let c;const l=()=>null!=c?c:c=(0,Fd.useFunc)(t,Ld.default);let u;if(i||n)u=t.let("valid"),e.block$data(u,function(){t.assign(u,!1),t.forOf("v",s,e=>t.if(Vd._`${l()}(${r}, ${e})`,()=>t.assign(u,!0).break()))});else{if(!Array.isArray(o))throw new Error("ajv implementation error");const e=t.const("vSchema",s);u=(0,Vd.or)(...o.map((t,n)=>function(e,t){const n=o[t];return"object"==typeof n&&null!==n?Vd._`${l()}(${r}, ${e}[${t}])`:Vd._`${r} === ${n}`}(e,n)))}e.pass(u)}};qd.default=Hd,Object.defineProperty(Ku,"__esModule",{value:!0});const Kd=Yu,Zd=td,Gd=ld,Jd=fd,Wd=vd,Bd=kd,Qd=Td,Yd=zd,Xd=qd,ep=[Zu.default,Kd.default,Zd.default,Gd.default,Jd.default,Wd.default,Bd.default,Qd.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Yd.default,Xd.default];Ku.default=ep;var tp={},rp={};Object.defineProperty(rp,"__esModule",{value:!0}),rp.validateAdditionalItems=void 0;const np=Ji(),op=Wi,sp={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>np.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>np._`{limit: ${e}}`},code(e){const{parentSchema:t,it:r}=e,{items:n}=t;Array.isArray(n)?ap(e,n):(0,op.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function ap(e,t){const{gen:r,schema:n,data:o,keyword:s,it:a}=e;a.items=!0;const i=r.const("len",np._`${o}.length`);if(!1===n)e.setParams({len:t.length}),e.pass(np._`${i} <= ${t.length}`);else if("object"==typeof n&&!(0,op.alwaysValidSchema)(a,n)){const n=r.var("valid",np._`${i} <= ${t.length}`);r.if((0,np.not)(n),()=>function(n){r.forRange("i",t.length,i,t=>{e.subschema({keyword:s,dataProp:t,dataPropType:op.Type.Num},n),a.allErrors||r.if((0,np.not)(n),()=>r.break())})}(n)),e.ok(n)}}rp.validateAdditionalItems=ap,rp.default=sp;var ip={},cp={};Object.defineProperty(cp,"__esModule",{value:!0}),cp.validateTuple=void 0;const lp=Ji(),up=Wi,dp=Uc(),pp={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return hp(e,"additionalItems",t);r.items=!0,(0,up.alwaysValidSchema)(r,t)||e.ok((0,dp.validateArray)(e))}};function hp(e,t,r=e.schema){const{gen:n,parentSchema:o,data:s,keyword:a,it:i}=e;!function(e){const{opts:n,errSchemaPath:o}=i,s=r.length,c=s===e.minItems&&(s===e.maxItems||!1===e[t]);if(n.strictTuples&&!c){const e=`"${a}" is ${s}-tuple, but minItems or maxItems/${t} are not specified or different at path "${o}"`;(0,up.checkStrictMode)(i,e,n.strictTuples)}}(o),i.opts.unevaluated&&r.length&&!0!==i.items&&(i.items=up.mergeEvaluated.items(n,r.length,i.items));const c=n.name("valid"),l=n.const("len",lp._`${s}.length`);r.forEach((t,r)=>{(0,up.alwaysValidSchema)(i,t)||(n.if(lp._`${l} > ${r}`,()=>e.subschema({keyword:a,schemaProp:r,dataProp:r},c)),e.ok(c))})}cp.validateTuple=hp,cp.default=pp,Object.defineProperty(ip,"__esModule",{value:!0});const fp=cp,mp={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,fp.validateTuple)(e,"items")};ip.default=mp;var yp={};Object.defineProperty(yp,"__esModule",{value:!0});const gp=Ji(),vp=Wi,_p=Uc(),wp=rp,$p={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>gp.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>gp._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,(0,vp.alwaysValidSchema)(n,t)||(o?(0,wp.validateAdditionalItems)(e,o):e.ok((0,_p.validateArray)(e)))}};yp.default=$p;var bp={};Object.defineProperty(bp,"__esModule",{value:!0});const kp=Ji(),Ep=Wi,Pp={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?kp.str`must contain at least ${e} valid item(s)`:kp.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?kp._`{minContains: ${e}}`:kp._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;let a,i;const{minContains:c,maxContains:l}=n;s.opts.next?(a=void 0===c?1:c,i=l):a=1;const u=t.const("len",kp._`${o}.length`);if(e.setParams({min:a,max:i}),void 0===i&&0===a)return void(0,Ep.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==i&&a>i)return(0,Ep.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,Ep.alwaysValidSchema)(s,r)){let t=kp._`${u} >= ${a}`;return void 0!==i&&(t=kp._`${t} && ${u} <= ${i}`),void e.pass(t)}s.items=!0;const d=t.name("valid");function p(){const e=t.name("_valid"),r=t.let("count",0);h(e,()=>t.if(e,()=>function(e){t.code(kp._`${e}++`),void 0===i?t.if(kp._`${e} >= ${a}`,()=>t.assign(d,!0).break()):(t.if(kp._`${e} > ${i}`,()=>t.assign(d,!1).break()),1===a?t.assign(d,!0):t.if(kp._`${e} >= ${a}`,()=>t.assign(d,!0)))}(r)))}function h(r,n){t.forRange("i",0,u,t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:Ep.Type.Num,compositeRule:!0},r),n()})}void 0===i&&1===a?h(d,()=>t.if(d,()=>t.break())):0===a?(t.let(d,!0),void 0!==i&&t.if(kp._`${o}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset())}};bp.default=Pp;var Sp={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=Ji(),r=Wi,n=Uc();e.error={message:({params:{property:e,depsCount:r,deps:n}})=>{const o=1===r?"property":"properties";return t.str`must have ${o} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:n,missingProperty:o}})=>t._`{property: ${e},
5
- missingProperty: ${o},
6
- depsCount: ${r},
7
- deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:r)[n]=e[n]}return[t,r]}(e);s(e,t),a(e,r)}};function s(e,r=e.schema){const{gen:o,data:s,it:a}=e;if(0===Object.keys(r).length)return;const i=o.let("missing");for(const c in r){const l=r[c];if(0===l.length)continue;const u=(0,n.propertyInData)(o,s,c,a.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),a.allErrors?o.if(u,()=>{for(const t of l)(0,n.checkReportMissingProp)(e,t)}):(o.if(t._`${u} && (${(0,n.checkMissingProp)(e,l,i)})`),(0,n.reportMissingProp)(e,i),o.else())}}function a(e,t=e.schema){const{gen:o,data:s,keyword:a,it:i}=e,c=o.name("valid");for(const l in t)(0,r.alwaysValidSchema)(i,t[l])||(o.if((0,n.propertyInData)(o,s,l,i.opts.ownProperties),()=>{const t=e.subschema({keyword:a,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>o.var(c,!0)),e.ok(c))}e.validatePropertyDeps=s,e.validateSchemaDeps=a,e.default=o}(Sp);var Tp={};Object.defineProperty(Tp,"__esModule",{value:!0});const xp=Ji(),Ip=Wi,Cp={message:"property name must be valid",params:({params:e})=>xp._`{propertyName: ${e.propertyName}}`},Np={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Cp,code(e){const{gen:t,schema:r,data:n,it:o}=e;if((0,Ip.alwaysValidSchema)(o,r))return;const s=t.name("valid");t.forIn("key",n,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},s),t.if((0,xp.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};Tp.default=Np;var jp={};Object.defineProperty(jp,"__esModule",{value:!0});const Rp=Uc(),Op=Ji(),zp=pc(),Ap=Wi,Mp={message:"must NOT have additional properties",params:({params:e})=>Op._`{additionalProperty: ${e.additionalProperty}}`},Up={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Mp,code(e){const{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:a}=e;if(!s)throw new Error("ajv implementation error");const{allErrors:i,opts:c}=a;if(a.props=!0,"all"!==c.removeAdditional&&(0,Ap.alwaysValidSchema)(a,r))return;const l=(0,Rp.allSchemaProperties)(n.properties),u=(0,Rp.allSchemaProperties)(n.patternProperties);function d(e){t.code(Op._`delete ${o}[${e}]`)}function p(n){if("all"===c.removeAdditional||c.removeAdditional&&!1===r)d(n);else{if(!1===r)return e.setParams({additionalProperty:n}),e.error(),void(i||t.break());if("object"==typeof r&&!(0,Ap.alwaysValidSchema)(a,r)){const r=t.name("valid");"failing"===c.removeAdditional?(h(n,r,!1),t.if((0,Op.not)(r),()=>{e.reset(),d(n)})):(h(n,r),i||t.if((0,Op.not)(r),()=>t.break()))}}}function h(t,r,n){const o={keyword:"additionalProperties",dataProp:t,dataPropType:Ap.Type.Str};!1===n&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(o,r)}t.forIn("key",o,r=>{l.length||u.length?t.if(function(r){let o;if(l.length>8){const e=(0,Ap.schemaRefOrVal)(a,n.properties,"properties");o=(0,Rp.isOwnProperty)(t,e,r)}else o=l.length?(0,Op.or)(...l.map(e=>Op._`${r} === ${e}`)):Op.nil;return u.length&&(o=(0,Op.or)(o,...u.map(t=>Op._`${(0,Rp.usePattern)(e,t)}.test(${r})`))),(0,Op.not)(o)}(r),()=>p(r)):p(r)}),e.ok(Op._`${s} === ${zp.default.errors}`)}};jp.default=Up;var Dp={};Object.defineProperty(Dp,"__esModule",{value:!0});const qp=cl(),Vp=Uc(),Fp=Wi,Lp=jp,Hp={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;"all"===s.opts.removeAdditional&&void 0===n.additionalProperties&&Lp.default.code(new qp.KeywordCxt(s,Lp.default,"additionalProperties"));const a=(0,Vp.allSchemaProperties)(r);for(const e of a)s.definedProperties.add(e);s.opts.unevaluated&&a.length&&!0!==s.props&&(s.props=Fp.mergeEvaluated.props(t,(0,Fp.toHash)(a),s.props));const i=a.filter(e=>!(0,Fp.alwaysValidSchema)(s,r[e]));if(0===i.length)return;const c=t.name("valid");for(const r of i)l(r)?u(r):(t.if((0,Vp.propertyInData)(t,o,r,s.opts.ownProperties)),u(r),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(r),e.ok(c);function l(e){return s.opts.useDefaults&&!s.compositeRule&&void 0!==r[e].default}function u(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},c)}}};Dp.default=Hp;var Kp={};Object.defineProperty(Kp,"__esModule",{value:!0});const Zp=Uc(),Gp=Ji(),Jp=Wi,Wp=Wi,Bp={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:a}=s,i=(0,Zp.allSchemaProperties)(r),c=i.filter(e=>(0,Jp.alwaysValidSchema)(s,r[e]));if(0===i.length||c.length===i.length&&(!s.opts.unevaluated||!0===s.props))return;const l=a.strictSchema&&!a.allowMatchingProperties&&o.properties,u=t.name("valid");!0===s.props||s.props instanceof Gp.Name||(s.props=(0,Wp.evaluatedPropsToName)(t,s.props));const{props:d}=s;function p(e){for(const t in l)new RegExp(e).test(t)&&(0,Jp.checkStrictMode)(s,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function h(r){t.forIn("key",n,n=>{t.if(Gp._`${(0,Zp.usePattern)(e,r)}.test(${n})`,()=>{const o=c.includes(r);o||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:n,dataPropType:Wp.Type.Str},u),s.opts.unevaluated&&!0!==d?t.assign(Gp._`${d}[${n}]`,!0):o||s.allErrors||t.if((0,Gp.not)(u),()=>t.break())})})}!function(){for(const e of i)l&&p(e),s.allErrors?h(e):(t.var(u,!0),h(e),t.if(u))}()}};Kp.default=Bp;var Qp={};Object.defineProperty(Qp,"__esModule",{value:!0});const Yp=Wi,Xp={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,Yp.alwaysValidSchema)(n,r))return void e.fail();const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Qp.default=Xp;var eh={};Object.defineProperty(eh,"__esModule",{value:!0});const th={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Uc().validateUnion,error:{message:"must match a schema in anyOf"}};eh.default=th;var rh={};Object.defineProperty(rh,"__esModule",{value:!0});const nh=Ji(),oh=Wi,sh={message:"must match exactly one schema in oneOf",params:({params:e})=>nh._`{passingSchemas: ${e.passing}}`},ah={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:sh,code(e){const{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;const s=r,a=t.let("valid",!1),i=t.let("passing",null),c=t.name("_valid");e.setParams({passing:i}),t.block(function(){s.forEach((r,n)=>{let s;(0,oh.alwaysValidSchema)(o,r)?t.var(c,!0):s=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},c),n>0&&t.if(nh._`${c} && ${a}`).assign(a,!1).assign(i,nh._`[${i}, ${n}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(i,n),s&&e.mergeEvaluated(s,nh.Name)})})}),e.result(a,()=>e.reset(),()=>e.error(!0))}};rh.default=ah;var ih={};Object.defineProperty(ih,"__esModule",{value:!0});const ch=Wi,lh={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const o=t.name("valid");r.forEach((t,r)=>{if((0,ch.alwaysValidSchema)(n,t))return;const s=e.subschema({keyword:"allOf",schemaProp:r},o);e.ok(o),e.mergeEvaluated(s)})}};ih.default=lh;var uh={};Object.defineProperty(uh,"__esModule",{value:!0});const dh=Ji(),ph=Wi,hh={message:({params:e})=>dh.str`must match "${e.ifClause}" schema`,params:({params:e})=>dh._`{failingKeyword: ${e.ifClause}}`},fh={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:hh,code(e){const{gen:t,parentSchema:r,it:n}=e;void 0===r.then&&void 0===r.else&&(0,ph.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const o=mh(n,"then"),s=mh(n,"else");if(!o&&!s)return;const a=t.let("valid",!0),i=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},i);e.mergeEvaluated(t)}(),e.reset(),o&&s){const r=t.let("ifClause");e.setParams({ifClause:r}),t.if(i,c("then",r),c("else",r))}else o?t.if(i,c("then")):t.if((0,dh.not)(i),c("else"));function c(r,n){return()=>{const o=e.subschema({keyword:r},i);t.assign(a,i),e.mergeValidEvaluated(o,a),n?t.assign(n,dh._`${r}`):e.setParams({ifClause:r})}}e.pass(a,()=>e.error(!0))}};function mh(e,t){const r=e.schema[t];return void 0!==r&&!(0,ph.alwaysValidSchema)(e,r)}uh.default=fh;var yh={};Object.defineProperty(yh,"__esModule",{value:!0});const gh=Wi,vh={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,gh.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};yh.default=vh,Object.defineProperty(tp,"__esModule",{value:!0});const _h=rp,wh=ip,$h=cp,bh=yp,kh=bp,Eh=Sp,Ph=Tp,Sh=jp,Th=Dp,xh=Kp,Ih=Qp,Ch=eh,Nh=rh,jh=ih,Rh=uh,Oh=yh;tp.default=function(e=!1){const t=[Ih.default,Ch.default,Nh.default,jh.default,Rh.default,Oh.default,Ph.default,Sh.default,Eh.default,Th.default,xh.default];return e?t.push(wh.default,bh.default):t.push(_h.default,$h.default),t.push(kh.default),t};var zh={},Ah={};Object.defineProperty(Ah,"__esModule",{value:!0});const Mh=Ji(),Uh={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>Mh.str`must match format "${e}"`,params:({schemaCode:e})=>Mh._`{format: ${e}}`},code(e,t){const{gen:r,data:n,$data:o,schema:s,schemaCode:a,it:i}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=i;c.validateFormats&&(o?function(){const o=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),s=r.const("fDef",Mh._`${o}[${a}]`),i=r.let("fType"),l=r.let("format");r.if(Mh._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,()=>r.assign(i,Mh._`${s}.type || "string"`).assign(l,Mh._`${s}.validate`),()=>r.assign(i,Mh._`"string"`).assign(l,s)),e.fail$data((0,Mh.or)(!1===c.strictSchema?Mh.nil:Mh._`${a} && !${l}`,function(){const e=u.$async?Mh._`(${s}.async ? await ${l}(${n}) : ${l}(${n}))`:Mh._`${l}(${n})`,r=Mh._`(typeof ${l} == "function" ? ${e} : ${l}.test(${n}))`;return Mh._`${l} && ${l} !== true && ${i} === ${t} && !${r}`}()))}():function(){const o=d.formats[s];if(!o)return void function(){if(!1===c.strictSchema)return void d.logger.warn(e());throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${l}"`}}();if(!0===o)return;const[a,i,p]=function(e){const t=e instanceof RegExp?(0,Mh.regexpCode)(e):c.code.formats?Mh._`${c.code.formats}${(0,Mh.getProperty)(s)}`:void 0,n=r.scopeValue("formats",{key:s,ref:e,code:t});if("object"==typeof e&&!(e instanceof RegExp))return[e.type||"string",e.validate,Mh._`${n}.validate`];return["string",e,n]}(o);a===t&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!u.$async)throw new Error("async format in sync schema");return Mh._`await ${p}(${n})`}return"function"==typeof i?Mh._`${p}(${n})`:Mh._`${p}.test(${n})`}())}())}};Ah.default=Uh,Object.defineProperty(zh,"__esModule",{value:!0});const Dh=[Ah.default];zh.default=Dh;var qh={};Object.defineProperty(qh,"__esModule",{value:!0}),qh.contentVocabulary=qh.metadataVocabulary=void 0,qh.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],qh.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(Iu,"__esModule",{value:!0});const Vh=Ku,Fh=tp,Lh=zh,Hh=qh,Kh=[Cu.default,Vh.default,(0,Fh.default)(),Lh.default,Hh.metadataVocabulary,Hh.contentVocabulary];Iu.default=Kh;var Zh,Gh={},Jh={};Object.defineProperty(Jh,"__esModule",{value:!0}),Jh.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(Zh||(Jh.DiscrError=Zh={})),Object.defineProperty(Gh,"__esModule",{value:!0});const Wh=Ji(),Bh=Jh,Qh=ml,Yh=fl(),Xh=Wi,ef={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===Bh.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>Wh._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){const{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:a}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");const i=n.propertyName;if("string"!=typeof i)throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",!1),l=t.const("tag",Wh._`${r}${(0,Wh.getProperty)(i)}`);function u(r){const n=t.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:r},n);return e.mergeEvaluated(o,Wh.Name),n}t.if(Wh._`typeof ${l} == "string"`,()=>function(){const r=function(){var e;const t={},r=c(o);let n=!0;for(let t=0;t<a.length;t++){let o=a[t];if((null==o?void 0:o.$ref)&&!(0,Xh.schemaHasRulesButRef)(o,s.self.RULES)){const e=o.$ref;if(o=Qh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,e),o instanceof Qh.SchemaEnv&&(o=o.schema),void 0===o)throw new Yh.default(s.opts.uriResolver,s.baseId,e)}const u=null===(e=null==o?void 0:o.properties)||void 0===e?void 0:e[i];if("object"!=typeof u)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);n=n&&(r||c(o)),l(u,t)}if(!n)throw new Error(`discriminator: "${i}" must be required`);return t;function c({required:e}){return Array.isArray(e)&&e.includes(i)}function l(e,t){if(e.const)u(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`);for(const r of e.enum)u(r,t)}}function u(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${i}" values must be unique strings`);t[e]=r}}();t.if(!1);for(const e in r)t.elseIf(Wh._`${l} === ${e}`),t.assign(c,u(r[e]));t.else(),e.error(!1,{discrError:Bh.DiscrError.Mapping,tag:l,tagName:i}),t.endIf()}(),()=>e.error(!1,{discrError:Bh.DiscrError.Tag,tag:l,tagName:i})),e.ok(c)}};Gh.default=ef;var tf={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const r=Mi,n=Iu,o=Gh,s=tf,a=["/properties"],i="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(e,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var l=cl();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=Ji();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=dl();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=fl();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}(Ai,Ai.exports);var rf=Oi(Ai.exports),nf={exports:{}},of={};!function(e){function t(e,t){return{validate:e,compare:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:t(o,s),time:t(i(!0),c),"date-time":t(d(!0),p),"iso-time":t(i(),l),"iso-date-time":t(d(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return f.test(e)&&m.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(w.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return y.lastIndex=0,y.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=v&&e>=g}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:_},double:{type:"number",validate:_},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(e){const t=r.exec(e);if(!t)return!1;const o=+t[1],s=+t[2],a=+t[3];return s>=1&&s<=12&&a>=1&&a<=(2===s&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(o)?29:n[s])}function s(e,t){if(e&&t)return e>t?1:e<t?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function i(e){return function(t){const r=a.exec(t);if(!r)return!1;const n=+r[1],o=+r[2],s=+r[3],i=r[4],c="-"===r[5]?-1:1,l=+(r[6]||0),u=+(r[7]||0);if(l>23||u>59||e&&!i)return!1;if(n<=23&&o<=59&&s<60)return!0;const d=o-u*c,p=n-l*c-(d<0?1:0);return(23===p||-1===p)&&(59===d||-1===d)&&s<61}}function c(e,t){if(!e||!t)return;const r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();return r&&n?r-n:void 0}function l(e,t){if(!e||!t)return;const r=a.exec(e),n=a.exec(t);return r&&n?(e=r[1]+r[2]+r[3])>(t=n[1]+n[2]+n[3])?1:e<t?-1:0:void 0}const u=/t|\s/i;function d(e){const t=i(e);return function(e){const r=e.split(u);return 2===r.length&&o(r[0])&&t(r[1])}}function p(e,t){if(!e||!t)return;const r=new Date(e).valueOf(),n=new Date(t).valueOf();return r&&n?r-n:void 0}function h(e,t){if(!e||!t)return;const[r,n]=e.split(u),[o,a]=t.split(u),i=s(r,o);return void 0!==i?i||c(n,a):void 0}const f=/\/|:/,m=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;const y=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;const g=-(2**31),v=2**31-1;function _(){return!0}const w=/[^\\]\\Z/}(of);var sf={},af={exports:{}},cf={},lf={},uf={},df={},pf={},hf={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){const r=[e[0]];let o=0;for(;o<t.length;)i(r,t[o]),r.push(e[++o]);return new n(r)}e._Code=n,e.nil=new n(""),e._=o;const s=new n("+");function a(e,...t){const r=[l(e[0])];let o=0;for(;o<t.length;)r.push(s),i(r,t[o]),r.push(s,l(e[++o]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===s){const r=c(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new n(r)}function i(e,t){var o;t instanceof n?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(o=t)||"boolean"==typeof o||null===o?o:l(Array.isArray(o)?o.join(","):o))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof r?void 0:`"${e}${t.slice(1)}`}function l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=a,e.addCodeArg=i,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},e.stringify=function(e){return new n(l(e))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new n(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new n(e.toString())}}(hf);var ff={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=hf;class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var n;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}e.Scope=o;class s extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=t._`.${new t.Name(r)}[${n}]`}}e.ValueScopeName=s;const a=t._`\n`;e.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?a:t.nil}}get(){return this._scope}name(e){return new s(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e),{prefix:o}=n,s=null!==(r=t.key)&&void 0!==r?r:t.ref;let a=this._values[o];if(a){const e=a.get(s);if(e)return e}else a=this._values[o]=new Map;a.set(s,n);const i=this._scope[o]||(this._scope[o]=[]),c=i.length;return i[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(o,s,a={},i){let c=t.nil;for(const l in o){const u=o[l];if(!u)continue;const d=a[l]=a[l]||new Map;u.forEach(o=>{if(d.has(o))return;d.set(o,n.Started);let a=s(o);if(a){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${o} = ${a};${this.opts._n}`}else{if(!(a=null==i?void 0:i(o)))throw new r(o);c=t._`${c}${a}${this.opts._n}`}d.set(o,n.Completed)})}return c}}}(ff),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=hf,r=ff;var n=hf;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=ff;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class s{optimizeNodes(){return this}optimizeNames(e,t){return this}}class a extends s{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,o=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class i extends s{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,r),this}get names(){return x(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends i{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class l extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class u extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class d extends s{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends s{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=I(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class h extends s{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const o=r[n];o.optimizeNames(e,t)||(C(e,o.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>T(e,t.names),{})}}class f extends h{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends h{}class y extends f{}y.kind="else";class g extends f{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new y(e):e}return t?!1===e?t instanceof g?t:t.nodes:this.nodes.length?this:new g(N(e),t instanceof g?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=I(this.condition,e,t),this}get names(){const e=super.names;return x(e,this.condition),this.else&&T(e,this.else.names),e}}g.kind="if";class v extends f{}v.kind="for";class _ extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=I(this.iteration,e,t),this}get names(){return T(super.names,this.iteration.names)}}class w extends v{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${t} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){const e=x(super.names,this.from);return x(e,this.to)}}class $ extends v{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=I(this.iterable,e,t),this}get names(){return T(super.names,this.iterable.names)}}class b extends f{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}b.kind="func";class k extends h{render(e){return"return "+super.render(e)}}k.kind="return";class E extends f{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&T(e,this.catch.names),this.finally&&T(e,this.finally.names),e}}class P extends f{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}P.kind="catch";class S extends f{render(e){return"finally"+super.render(e)}}S.kind="finally";function T(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function x(e,r){return r instanceof t._CodeOrName?T(e,r.names):e}function I(e,r,n){return e instanceof t.Name?s(e):(o=e)instanceof t._Code&&o._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==n[e.str])?new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=s(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[])):e;var o;function s(e){const t=n[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function C(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function N(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${z(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const o=this._scope.toName(t);return void 0!==r&&n&&(this._constants[o.str]=r),this._leafNode(new a(e,o,r)),o}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,r){return this._leafNode(new i(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new p(e)),this}object(...e){const r=["{"];for(const[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,o));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new g(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new g(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(g,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const a=this._scope.toName(e);return this._for(new w(s,a,t,n),()=>o(a))}forOf(e,n,o,s=r.varKinds.const){const a=this._scope.toName(e);if(this.opts.es5){const e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,t._`${e}.length`,r=>{this.var(a,t._`${e}[${r}]`),o(a)})}return this._for(new $("of",s,a,n),()=>o(a))}forIn(e,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${n})`,o);const a=this._scope.toName(e);return this._for(new $("in",s,a,n),()=>o(a))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){const t=new k;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new E;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new P(e),t(e)}return r&&(this._currNode=n.finally=new S,this.code(r)),this._endBlockNode(P,S)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,n,o){return this._blockNode(new b(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=N;const j=O(e.operators.AND);e.and=function(...e){return e.reduce(j)};const R=O(e.operators.OR);function O(e){return(r,n)=>r===t.nil?n:n===t.nil?r:t._`${z(r)} ${e} ${z(n)}`}function z(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(R)}}(pf);var mf={};Object.defineProperty(mf,"__esModule",{value:!0}),mf.checkStrictMode=mf.getErrorPath=mf.Type=mf.useFunc=mf.setEvaluated=mf.evaluatedPropsToName=mf.mergeEvaluated=mf.eachItem=mf.unescapeJsonPointer=mf.escapeJsonPointer=mf.escapeFragment=mf.unescapeFragment=mf.schemaRefOrVal=mf.schemaHasRulesButRef=mf.schemaHasRules=mf.checkUnknownRules=mf.alwaysValidSchema=mf.toHash=void 0;const yf=pf,gf=hf;function vf(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const o=n.RULES.keywords;for(const r in t)o[r]||Tf(e,`unknown keyword: "${r}"`)}function _f(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function wf(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function $f(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function bf({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,a,i)=>{const c=void 0===a?s:a instanceof yf.Name?(s instanceof yf.Name?e(o,s,a):t(o,s,a),a):s instanceof yf.Name?(t(o,a,s),s):r(s,a);return i!==yf.Name||c instanceof yf.Name?c:n(o,c)}}function kf(e,t){if(!0===t)return e.var("props",!0);const r=e.var("props",yf._`{}`);return void 0!==t&&Ef(e,r,t),r}function Ef(e,t,r){Object.keys(r).forEach(r=>e.assign(yf._`${t}${(0,yf.getProperty)(r)}`,!0))}mf.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},mf.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(vf(e,t),!_f(t,e.self.RULES.all))},mf.checkUnknownRules=vf,mf.schemaHasRules=_f,mf.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},mf.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return yf._`${r}`}return yf._`${e}${t}${(0,yf.getProperty)(n)}`},mf.unescapeFragment=function(e){return $f(decodeURIComponent(e))},mf.escapeFragment=function(e){return encodeURIComponent(wf(e))},mf.escapeJsonPointer=wf,mf.unescapeJsonPointer=$f,mf.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},mf.mergeEvaluated={props:bf({mergeNames:(e,t,r)=>e.if(yf._`${r} !== true && ${t} !== undefined`,()=>{e.if(yf._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,yf._`${r} || {}`).code(yf._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(yf._`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,yf._`${r} || {}`),Ef(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:kf}),items:bf({mergeNames:(e,t,r)=>e.if(yf._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,yf._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(yf._`${r} !== true`,()=>e.assign(r,!0===t||yf._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},mf.evaluatedPropsToName=kf,mf.setEvaluated=Ef;const Pf={};var Sf;function Tf(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}mf.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:Pf[t.code]||(Pf[t.code]=new gf._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(Sf||(mf.Type=Sf={})),mf.getErrorPath=function(e,t,r){if(e instanceof yf.Name){const n=t===Sf.Num;return r?n?yf._`"[" + ${e} + "]"`:yf._`"['" + ${e} + "']"`:n?yf._`"/" + ${e}`:yf._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,yf.getProperty)(e).toString():"/"+wf(e)},mf.checkStrictMode=Tf;var xf,If,Cf,Nf={};function jf(){if(xf)return Nf;xf=1,Object.defineProperty(Nf,"__esModule",{value:!0});const e=pf,t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return Nf.default=t,Nf}function Rf(){return If||(If=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=pf,r=mf,n=jf();function o(e,r){const o=e.const("err",r);e.if(t._`${n.default.vErrors} === null`,()=>e.assign(n.default.vErrors,t._`[${o}]`),t._`${n.default.vErrors}.push(${o})`),e.code(t._`${n.default.errors}++`)}function s(e,r){const{gen:n,validateName:o,schemaEnv:s}=e;s.$async?n.throw(t._`new ${e.ValidationError}(${r})`):(n.assign(t._`${o}.errors`,r),n.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,n=e.keywordError,a,c){const{it:l}=r,{gen:u,compositeRule:d,allErrors:p}=l,h=i(r,n,a);(null!=c?c:d||p)?o(u,h):s(l,t._`[${h}]`)},e.reportExtraError=function(t,r=e.keywordError,a){const{it:c}=t,{gen:l,compositeRule:u,allErrors:d}=c;o(l,i(t,r,a)),u||d||s(c,n.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(n.default.errors,r),e.if(t._`${n.default.vErrors} !== null`,()=>e.if(r,()=>e.assign(t._`${n.default.vErrors}.length`,r),()=>e.assign(n.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:o,data:s,errsCount:a,it:i}){if(void 0===a)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",a,n.default.errors,a=>{e.const(c,t._`${n.default.vErrors}[${a}]`),e.if(t._`${c}.instancePath === undefined`,()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(n.default.instancePath,i.errorPath))),e.assign(t._`${c}.schemaPath`,t.str`${i.errSchemaPath}/${r}`),i.opts.verbose&&(e.assign(t._`${c}.schema`,o),e.assign(t._`${c}.data`,s))})};const a={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function i(e,r,o){const{createErrors:s}=e.it;return!1===s?t._`{}`:function(e,r,o={}){const{gen:s,it:i}=e,u=[c(i,o),l(e,o)];return function(e,{params:r,message:o},s){const{keyword:i,data:c,schemaValue:l,it:u}=e,{opts:d,propertyName:p,topSchemaRef:h,schemaPath:f}=u;s.push([a.keyword,i],[a.params,"function"==typeof r?r(e):r||t._`{}`]),d.messages&&s.push([a.message,"function"==typeof o?o(e):o]);d.verbose&&s.push([a.schema,l],[a.parentSchema,t._`${h}${f}`],[n.default.data,c]);p&&s.push([a.propertyName,p])}(e,r,u),s.object(...u)}(e,r,o)}function c({errorPath:e},{instancePath:o}){const s=o?t.str`${e}${(0,r.getErrorPath)(o,r.Type.Str)}`:e;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,s)]}function l({keyword:e,it:{errSchemaPath:n}},{schemaPath:o,parentSchema:s}){let i=s?n:t.str`${n}/${e}`;return o&&(i=t.str`${i}${(0,r.getErrorPath)(o,r.Type.Str)}`),[a.schemaPath,i]}}(df)),df}var Of={},zf={};Object.defineProperty(zf,"__esModule",{value:!0}),zf.getRules=zf.isJSONType=void 0;const Af=new Set(["string","number","integer","boolean","null","object","array"]);zf.isJSONType=function(e){return"string"==typeof e&&Af.has(e)},zf.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}};var Mf,Uf={};function Df(){if(Mf)return Uf;function e(e,r){return r.rules.some(r=>t(e,r))}function t(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}return Mf=1,Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.shouldUseRule=Uf.shouldUseGroup=Uf.schemaHasRulesForType=void 0,Uf.schemaHasRulesForType=function({schema:t,self:r},n){const o=r.RULES.types[n];return o&&!0!==o&&e(t,o)},Uf.shouldUseGroup=e,Uf.shouldUseRule=t,Uf}Object.defineProperty(Of,"__esModule",{value:!0}),Of.reportTypeError=Of.checkDataTypes=Of.checkDataType=Of.coerceAndCheckDataType=Of.getJSONTypes=Of.getSchemaTypes=Of.DataType=void 0;const qf=zf,Vf=Df(),Ff=Rf(),Lf=pf,Hf=mf;var Kf;function Zf(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(qf.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(Kf||(Of.DataType=Kf={})),Of.getSchemaTypes=function(e){const t=Zf(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},Of.getJSONTypes=Zf,Of.coerceAndCheckDataType=function(e,t){const{gen:r,data:n,opts:o}=e,s=function(e,t){return t?e.filter(e=>Gf.has(e)||"array"===t&&"array"===e):[]}(t,o.coerceTypes),a=t.length>0&&!(0===s.length&&1===t.length&&(0,Vf.schemaHasRulesForType)(e,t[0]));if(a){const a=Wf(t,n,o.strictNumbers,Kf.Wrong);r.if(a,()=>{s.length?function(e,t,r){const{gen:n,data:o,opts:s}=e,a=n.let("dataType",Lf._`typeof ${o}`),i=n.let("coerced",Lf._`undefined`);"array"===s.coerceTypes&&n.if(Lf._`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,Lf._`${o}[0]`).assign(a,Lf._`typeof ${o}`).if(Wf(t,o,s.strictNumbers),()=>n.assign(i,o)));n.if(Lf._`${i} !== undefined`);for(const e of r)(Gf.has(e)||"array"===e&&"array"===s.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void n.elseIf(Lf._`${a} == "number" || ${a} == "boolean"`).assign(i,Lf._`"" + ${o}`).elseIf(Lf._`${o} === null`).assign(i,Lf._`""`);case"number":return void n.elseIf(Lf._`${a} == "boolean" || ${o} === null
8
- || (${a} == "string" && ${o} && ${o} == +${o})`).assign(i,Lf._`+${o}`);case"integer":return void n.elseIf(Lf._`${a} === "boolean" || ${o} === null
9
- || (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(i,Lf._`+${o}`);case"boolean":return void n.elseIf(Lf._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(i,!1).elseIf(Lf._`${o} === "true" || ${o} === 1`).assign(i,!0);case"null":return n.elseIf(Lf._`${o} === "" || ${o} === 0 || ${o} === false`),void n.assign(i,null);case"array":n.elseIf(Lf._`${a} === "string" || ${a} === "number"
10
- || ${a} === "boolean" || ${o} === null`).assign(i,Lf._`[${o}]`)}}n.else(),Qf(e),n.endIf(),n.if(Lf._`${i} !== undefined`,()=>{n.assign(o,i),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(Lf._`${t} !== undefined`,()=>e.assign(Lf._`${t}[${r}]`,n))}(e,i)})}(e,t,s):Qf(e)})}return a};const Gf=new Set(["string","number","integer","boolean","null"]);function Jf(e,t,r,n=Kf.Correct){const o=n===Kf.Correct?Lf.operators.EQ:Lf.operators.NEQ;let s;switch(e){case"null":return Lf._`${t} ${o} null`;case"array":s=Lf._`Array.isArray(${t})`;break;case"object":s=Lf._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=a(Lf._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=a();break;default:return Lf._`typeof ${t} ${o} ${e}`}return n===Kf.Correct?s:(0,Lf.not)(s);function a(e=Lf.nil){return(0,Lf.and)(Lf._`typeof ${t} == "number"`,e,r?Lf._`isFinite(${t})`:Lf.nil)}}function Wf(e,t,r,n){if(1===e.length)return Jf(e[0],t,r,n);let o;const s=(0,Hf.toHash)(e);if(s.array&&s.object){const e=Lf._`typeof ${t} != "object"`;o=s.null?e:Lf._`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=Lf.nil;s.number&&delete s.integer;for(const e in s)o=(0,Lf.and)(o,Jf(e,t,r,n));return o}Of.checkDataType=Jf,Of.checkDataTypes=Wf;const Bf={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?Lf._`{type: ${e}}`:Lf._`{type: ${t}}`};function Qf(e){const t=function(e){const{gen:t,data:r,schema:n}=e,o=(0,Hf.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}(e);(0,Ff.reportError)(t,Bf)}Of.reportTypeError=Qf;var Yf,Xf={};var em,tm,rm={},nm={};function om(){if(em)return nm;em=1,Object.defineProperty(nm,"__esModule",{value:!0}),nm.validateUnion=nm.validateArray=nm.usePattern=nm.callValidateCode=nm.schemaProperties=nm.allSchemaProperties=nm.noPropertyInData=nm.propertyInData=nm.isOwnProperty=nm.hasPropFunc=nm.reportMissingProp=nm.checkMissingProp=nm.checkReportMissingProp=void 0;const e=pf,t=mf,r=jf(),n=mf;function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}function s(t,r,n){return e._`${o(t)}.call(${r}, ${n})`}function a(t,r,n,o){const a=e._`${r}${(0,e.getProperty)(n)} === undefined`;return o?(0,e.or)(a,(0,e.not)(s(t,r,n))):a}function i(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}nm.checkReportMissingProp=function(t,r){const{gen:n,data:o,it:s}=t;n.if(a(n,o,r,s.opts.ownProperties),()=>{t.setParams({missingProperty:e._`${r}`},!0),t.error()})},nm.checkMissingProp=function({gen:t,data:r,it:{opts:n}},o,s){return(0,e.or)(...o.map(o=>(0,e.and)(a(t,r,o,n.ownProperties),e._`${s} = ${o}`)))},nm.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},nm.hasPropFunc=o,nm.isOwnProperty=s,nm.propertyInData=function(t,r,n,o){const a=e._`${r}${(0,e.getProperty)(n)} !== undefined`;return o?e._`${a} && ${s(t,r,n)}`:a},nm.noPropertyInData=a,nm.allSchemaProperties=i,nm.schemaProperties=function(e,r){return i(r).filter(n=>!(0,t.alwaysValidSchema)(e,r[n]))},nm.callValidateCode=function({schemaCode:t,data:n,it:{gen:o,topSchemaRef:s,schemaPath:a,errorPath:i},it:c},l,u,d){const p=d?e._`${t}, ${n}, ${s}${a}`:n,h=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,i)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&h.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const f=e._`${p}, ${o.object(...h)}`;return u!==e.nil?e._`${l}.call(${u}, ${f})`:e._`${l}(${f})`};const c=e._`new RegExp`;return nm.usePattern=function({gen:t,it:{opts:r}},o){const s=r.unicodeRegExp?"u":"",{regExp:a}=r.code,i=a(o,s);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:e._`${"new RegExp"===a.code?c:(0,n.useFunc)(t,a)}(${o}, ${s})`})},nm.validateArray=function(r){const{gen:n,data:o,keyword:s,it:a}=r,i=n.name("valid");if(a.allErrors){const e=n.let("valid",!0);return c(()=>n.assign(e,!1)),e}return n.var(i,!0),c(()=>n.break()),i;function c(a){const c=n.const("len",e._`${o}.length`);n.forRange("i",0,c,o=>{r.subschema({keyword:s,dataProp:o,dataPropType:t.Type.Num},i),n.if((0,e.not)(i),a)})}},nm.validateUnion=function(r){const{gen:n,schema:o,keyword:s,it:a}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(o.some(e=>(0,t.alwaysValidSchema)(a,e))&&!a.opts.unevaluated)return;const i=n.let("valid",!1),c=n.name("_valid");n.block(()=>o.forEach((t,o)=>{const a=r.subschema({keyword:s,schemaProp:o,compositeRule:!0},c);n.assign(i,e._`${i} || ${c}`);r.mergeValidEvaluated(a,c)||n.if((0,e.not)(i))})),r.result(i,()=>r.reset(),()=>r.error(!0))},nm}function sm(){if(tm)return rm;tm=1,Object.defineProperty(rm,"__esModule",{value:!0}),rm.validateKeywordUsage=rm.validSchemaType=rm.funcKeywordCode=rm.macroKeywordCode=void 0;const e=pf,t=jf(),r=om(),n=Rf();function o(t){const{gen:r,data:n,it:o}=t;r.if(o.parentData,()=>r.assign(n,e._`${o.parentData}[${o.parentDataProperty}]`))}function s(t,r,n){if(void 0===n)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,e.stringify)(n)})}return rm.macroKeywordCode=function(t,r){const{gen:n,keyword:o,schema:a,parentSchema:i,it:c}=t,l=r.macro.call(c.self,a,i,c),u=s(n,o,l);!1!==c.opts.validateSchema&&c.self.validateSchema(l,!0);const d=n.name("valid");t.subschema({schema:l,schemaPath:e.nil,errSchemaPath:`${c.errSchemaPath}/${o}`,topSchemaRef:u,compositeRule:!0},d),t.pass(d,()=>t.error(!0))},rm.funcKeywordCode=function(a,i){var c;const{gen:l,keyword:u,schema:d,parentSchema:p,$data:h,it:f}=a;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(f,i);const m=!h&&i.compile?i.compile.call(f.self,d,p,f):i.validate,y=s(l,u,m),g=l.let("valid");function v(n=(i.async?e._`await `:e.nil)){const o=f.opts.passContext?t.default.this:t.default.self,s=!("compile"in i&&!h||!1===i.schema);l.assign(g,e._`${n}${(0,r.callValidateCode)(a,y,o,s)}`,i.modifying)}function _(t){var r;l.if((0,e.not)(null!==(r=i.valid)&&void 0!==r?r:g),t)}a.block$data(g,function(){if(!1===i.errors)v(),i.modifying&&o(a),_(()=>a.error());else{const r=i.async?function(){const t=l.let("ruleErrs",null);return l.try(()=>v(e._`await `),r=>l.assign(g,!1).if(e._`${r} instanceof ${f.ValidationError}`,()=>l.assign(t,e._`${r}.errors`),()=>l.throw(r))),t}():function(){const t=e._`${y}.errors`;return l.assign(t,null),v(e.nil),t}();i.modifying&&o(a),_(()=>function(r,o){const{gen:s}=r;s.if(e._`Array.isArray(${o})`,()=>{s.assign(t.default.vErrors,e._`${t.default.vErrors} === null ? ${o} : ${t.default.vErrors}.concat(${o})`).assign(t.default.errors,e._`${t.default.vErrors}.length`),(0,n.extendErrors)(r)},()=>r.error())}(a,r))}}),a.ok(null!==(c=i.valid)&&void 0!==c?c:g)},rm.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},rm.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");const a=o.dependencies;if(null==a?void 0:a.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${s}: ${a.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},rm}var am,im={};var cm={},lm={exports:{}},um=lm.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),dm(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function dm(e,t,r,n,o,s,a,i,c,l){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var u in t(n,o,s,a,i,c,l),n){var d=n[u];if(Array.isArray(d)){if(u in um.arrayKeywords)for(var p=0;p<d.length;p++)dm(e,t,r,d[p],o+"/"+u+"/"+p,s,o,u,n,p)}else if(u in um.propsKeywords){if(d&&"object"==typeof d)for(var h in d)dm(e,t,r,d[h],o+"/"+u+"/"+pm(h),s,o,u,n,h)}else(u in um.keywords||e.allKeys&&!(u in um.skipKeywords))&&dm(e,t,r,d,o+"/"+u,s,o,u,n)}r(n,o,s,a,i,c,l)}}function pm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}um.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},um.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},um.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},um.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};var hm=lm.exports;Object.defineProperty(cm,"__esModule",{value:!0}),cm.getSchemaRefs=cm.resolveUrl=cm.normalizeId=cm._getFullPath=cm.getFullPath=cm.inlineRef=void 0;const fm=mf,mm=Lc,ym=hm,gm=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);cm.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!_m(e):!!t&&wm(e)<=t)};const vm=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function _m(e){for(const t in e){if(vm.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(_m))return!0;if("object"==typeof r&&_m(r))return!0}return!1}function wm(e){let t=0;for(const r in e){if("$ref"===r)return 1/0;if(t++,!gm.has(r)&&("object"==typeof e[r]&&(0,fm.eachItem)(e[r],e=>t+=wm(e)),t===1/0))return 1/0}return t}function $m(e,t="",r){!1!==r&&(t=Em(t));const n=e.parse(t);return bm(e,n)}function bm(e,t){return e.serialize(t).split("#")[0]+"#"}cm.getFullPath=$m,cm._getFullPath=bm;const km=/#\/?$/;function Em(e){return e?e.replace(km,""):""}cm.normalizeId=Em,cm.resolveUrl=function(e,t,r){return r=Em(r),e.resolve(t,r)};const Pm=/^[a-z_][-a-z0-9._]*$/i;var Sm;function Tm(){if(Sm)return lf;Sm=1,Object.defineProperty(lf,"__esModule",{value:!0}),lf.getData=lf.KeywordCxt=lf.validateFunctionCode=void 0;const e=function(){if(Cf)return uf;Cf=1,Object.defineProperty(uf,"__esModule",{value:!0}),uf.boolOrEmptySchema=uf.topBoolOrEmptySchema=void 0;const e=Rf(),t=pf,r=jf(),n={message:"boolean schema is false"};function o(t,r){const{gen:o,data:s}=t,a={gen:o,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(a,n,void 0,r)}return uf.topBoolOrEmptySchema=function(e){const{gen:n,schema:s,validateName:a}=e;!1===s?o(e,!1):"object"==typeof s&&!0===s.$async?n.return(r.default.data):(n.assign(t._`${a}.errors`,null),n.return(!0))},uf.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),o(e)):r.var(t,!0)},uf}(),t=Of,r=Df(),n=Of,o=function(){if(Yf)return Xf;Yf=1,Object.defineProperty(Xf,"__esModule",{value:!0}),Xf.assignDefaults=void 0;const e=pf,t=mf;function r(r,n,o){const{gen:s,compositeRule:a,data:i,opts:c}=r;if(void 0===o)return;const l=e._`${i}${(0,e.getProperty)(n)}`;if(a)return void(0,t.checkStrictMode)(r,`default is ignored for: ${l}`);let u=e._`${l} === undefined`;"empty"===c.useDefaults&&(u=e._`${u} || ${l} === null || ${l} === ""`),s.if(u,e._`${l} = ${(0,e.stringify)(o)}`)}return Xf.assignDefaults=function(e,t){const{properties:n,items:o}=e.schema;if("object"===t&&n)for(const t in n)r(e,t,n[t].default);else"array"===t&&Array.isArray(o)&&o.forEach((t,n)=>r(e,n,t.default))},Xf}(),s=sm(),a=function(){if(am)return im;am=1,Object.defineProperty(im,"__esModule",{value:!0}),im.extendSubschemaMode=im.extendSubschemaData=im.getSubschema=void 0;const e=pf,t=mf;return im.getSubschema=function(r,{keyword:n,schemaProp:o,schema:s,schemaPath:a,errSchemaPath:i,topSchemaRef:c}){if(void 0!==n&&void 0!==s)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){const s=r.schema[n];return void 0===o?{schema:s,schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}`,errSchemaPath:`${r.errSchemaPath}/${n}`}:{schema:s[o],schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}${(0,e.getProperty)(o)}`,errSchemaPath:`${r.errSchemaPath}/${n}/${(0,t.escapeFragment)(o)}`}}if(void 0!==s){if(void 0===a||void 0===i||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:a,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')},im.extendSubschemaData=function(r,n,{dataProp:o,dataPropType:s,data:a,dataTypes:i,propertyName:c}){if(void 0!==a&&void 0!==o)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=n;if(void 0!==o){const{errorPath:a,dataPathArr:i,opts:c}=n;u(l.let("data",e._`${n.data}${(0,e.getProperty)(o)}`,!0)),r.errorPath=e.str`${a}${(0,t.getErrorPath)(o,s,c.jsPropertySyntax)}`,r.parentDataProperty=e._`${o}`,r.dataPathArr=[...i,r.parentDataProperty]}function u(e){r.data=e,r.dataLevel=n.dataLevel+1,r.dataTypes=[],n.definedProperties=new Set,r.parentData=n.data,r.dataNames=[...n.dataNames,e]}void 0!==a&&(u(a instanceof e.Name?a:l.let("data",a,!0)),void 0!==c&&(r.propertyName=c)),i&&(r.dataTypes=i)},im.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){void 0!==n&&(e.compositeRule=n),void 0!==o&&(e.createErrors=o),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r},im}(),i=pf,c=jf(),l=cm,u=mf,d=Rf();function p({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,i._`${c.default.data}, ${c.default.valCxt}`,n.$async,()=>{e.code(i._`"use strict"; ${h(r,o)}`),function(e,t){e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,i._`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,i._`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,i._`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,i._`${c.default.valCxt}.${c.default.rootData}`),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,i._`""`),e.var(c.default.parentData,i._`undefined`),e.var(c.default.parentDataProperty,i._`undefined`),e.var(c.default.rootData,c.default.data),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`{}`)})}(e,o),e.code(s)}):e.func(t,i._`${c.default.data}, ${function(e){return i._`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${e.dynamicRef?i._`, ${c.default.dynamicAnchors}={}`:i.nil}}={}`}(o)}`,n.$async,()=>e.code(h(r,o)).code(s))}function h(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?i._`/*# sourceURL=${r} */`:i.nil}function f(t,r){y(t)&&(g(t),m(t))?function(e,t){const{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&_(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,l.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const s=n.const("_errs",c.default.errors);v(e,s),n.var(t,i._`${s} === ${c.default.errors}`)}(t,r):(0,e.boolOrEmptySchema)(t,r)}function m({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function y(e){return"boolean"!=typeof e.schema}function g(e){(0,u.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function v(e,r){if(e.opts.jtd)return w(e,[],!1,r);const n=(0,t.getSchemaTypes)(e.schema);w(e,n,!(0,t.coerceAndCheckDataType)(e,n),r)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){const s=r.$comment;if(!0===o.$comment)e.code(i._`${c.default.self}.logger.log(${s})`);else if("function"==typeof o.$comment){const r=i.str`${n}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code(i._`${c.default.self}.opts.$comment(${s}, ${r}, ${o}.schema)`)}}function w(e,t,o,s){const{gen:a,schema:l,data:d,allErrors:p,opts:h,self:f}=e,{RULES:m}=f;function y(u){(0,r.shouldUseGroup)(l,u)&&(u.type?(a.if((0,n.checkDataType)(u.type,d,h.strictNumbers)),$(e,u),1===t.length&&t[0]===u.type&&o&&(a.else(),(0,n.reportTypeError)(e)),a.endIf()):$(e,u),p||a.if(i._`${c.default.errors} === ${s||0}`))}!l.$ref||!h.ignoreKeywordsWithRef&&(0,u.schemaHasRulesButRef)(l,m)?(h.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach(t=>{k(e.dataTypes,t)||E(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const n of e.dataTypes)k(t,n)?r.push(n):t.includes("integer")&&"number"===n&&r.push("integer");e.dataTypes=r}(e,t)})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&E(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const n=e.self.RULES.all;for(const o in n){const s=n[o];if("object"==typeof s&&(0,r.shouldUseRule)(e.schema,s)){const{type:r}=s.definition;r.length&&!r.some(e=>b(t,e))&&E(e,`missing type "${r.join(",")}" for keyword "${o}"`)}}}(e,e.dataTypes)}(e,t),a.block(()=>{for(const e of m.rules)y(e);y(m.post)})):a.block(()=>S(e,"$ref",m.all.$ref.definition))}function $(e,t){const{gen:n,schema:s,opts:{useDefaults:a}}=e;a&&(0,o.assignDefaults)(e,t.type),n.block(()=>{for(const n of t.rules)(0,r.shouldUseRule)(s,n)&&S(e,n.keyword,n.definition,t.type)})}function b(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function k(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function E(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,u.checkStrictMode)(e,t,e.opts.strictTypes)}lf.validateFunctionCode=function(t){y(t)&&(g(t),m(t))?function(e){const{schema:t,opts:r,gen:n}=e;p(e,()=>{r.$comment&&t.$comment&&_(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,u.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(c.default.vErrors,null),n.let(c.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",i._`${r}.evaluated`),t.if(i._`${e.evaluated}.dynamicProps`,()=>t.assign(i._`${e.evaluated}.props`,i._`undefined`)),t.if(i._`${e.evaluated}.dynamicItems`,()=>t.assign(i._`${e.evaluated}.items`,i._`undefined`))}(e),v(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if(i._`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw(i._`new ${o}(${c.default.vErrors})`)):(t.assign(i._`${n}.errors`,c.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof i.Name&&e.assign(i._`${t}.props`,r);n instanceof i.Name&&e.assign(i._`${t}.items`,n)}(e),t.return(i._`${c.default.errors} === 0`))}(e)})}(t):p(t,()=>(0,e.topBoolOrEmptySchema)(t))};class P{constructor(e,t,r){if((0,s.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,u.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",I(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,i.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,i.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(i._`${t} !== undefined && (${(0,i.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?d.reportExtraError:d.reportError)(this,this.def.error,t)}$dataError(){(0,d.reportError)(this,this.def.$dataError||d.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,d.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=i.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=i.nil,t=i.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:o,def:s}=this;r.if((0,i.or)(i._`${n} === undefined`,t)),e!==i.nil&&r.assign(e,!0),(o.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==i.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:o,it:s}=this;return(0,i.or)(function(){if(r.length){if(!(t instanceof i.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return i._`${(0,n.checkDataTypes)(e,t,s.opts.strictNumbers,n.DataType.Wrong)}`}return i.nil}(),function(){if(o.validateSchema){const r=e.scopeValue("validate$data",{ref:o.validateSchema});return i._`!${r}(${t})`}return i.nil}())}subschema(e,t){const r=(0,a.getSubschema)(this.it,e);(0,a.extendSubschemaData)(r,this.it,e),(0,a.extendSubschemaMode)(r,e);const n={...this.it,...r,items:void 0,props:void 0};return f(n,t),n}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=u.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=u.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,()=>this.mergeEvaluated(e,i.Name)),!0}}function S(e,t,r,n){const o=new P(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,s.funcKeywordCode)(o,r):"macro"in r?(0,s.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,s.funcKeywordCode)(o,r)}lf.KeywordCxt=P;const T=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function I(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(""===e)return c.default.rootData;if("/"===e[0]){if(!T.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=c.default.rootData}else{const a=x.exec(e);if(!a)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+a[1];if(o=a[2],"#"===o){if(i>=t)throw new Error(d("property/index",i));return n[t-i]}if(i>t)throw new Error(d("data",i));if(s=r[t-i],!o)return s}let a=s;const l=o.split("/");for(const e of l)e&&(s=i._`${s}${(0,i.getProperty)((0,u.unescapeJsonPointer)(e))}`,a=i._`${a} && ${s}`);return a;function d(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}return lf.getData=I,lf}cm.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:r,uriResolver:n}=this.opts,o=Em(e[r]||t),s={"":o},a=$m(n,o,!1),i={},c=new Set;return ym(e,{allKeys:!0},(e,t,n,o)=>{if(void 0===o)return;const d=a+t;let p=s[o];function h(t){const r=this.opts.uriResolver.resolve;if(t=Em(p?r(p,t):t),c.has(t))throw u(t);c.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?l(e,n.schema,t):t!==Em(d)&&("#"===t[0]?(l(e,i[t],t),i[t]=e):this.refs[t]=d),t}function f(e){if("string"==typeof e){if(!Pm.test(e))throw new Error(`invalid anchor "${e}"`);h.call(this,`#${e}`)}}"string"==typeof e[r]&&(p=h.call(this,e[r])),f.call(this,e.$anchor),f.call(this,e.$dynamicAnchor),s[t]=p}),i;function l(e,t,r){if(void 0!==t&&!mm(e,t))throw u(r)}function u(e){return new Error(`reference "${e}" resolves to more than one schema`)}};var xm,Im={};function Cm(){if(xm)return Im;xm=1,Object.defineProperty(Im,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return Im.default=e,Im}var Nm,jm={};function Rm(){if(Nm)return jm;Nm=1,Object.defineProperty(jm,"__esModule",{value:!0});const e=cm;class t extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,e.resolveUrl)(t,r,n),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,this.missingRef))}}return jm.default=t,jm}var Om={};Object.defineProperty(Om,"__esModule",{value:!0}),Om.resolveSchema=Om.getCompilingSchema=Om.resolveRef=Om.compileSchema=Om.SchemaEnv=void 0;const zm=pf,Am=Cm(),Mm=jf(),Um=cm,Dm=mf,qm=Tm();class Vm{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,Um.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function Fm(e){const t=Hm.call(this,e);if(t)return t;const r=(0,Um.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,a=new zm.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s});let i;e.$async&&(i=a.scopeValue("Error",{ref:Am.default,code:zm._`require("ajv/dist/runtime/validation_error").default`}));const c=a.scopeName("validate");e.validateName=c;const l={gen:a,allErrors:this.opts.allErrors,data:Mm.default.data,parentData:Mm.default.parentData,parentDataProperty:Mm.default.parentDataProperty,dataNames:[Mm.default.data],dataPathArr:[zm.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,zm.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:i,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:zm.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:zm._`""`,opts:this.opts,self:this};let u;try{this._compilations.add(e),(0,qm.validateFunctionCode)(l),a.optimize(this.opts.code.optimize);const t=a.toString();u=`${a.scopeRefs(Mm.default.scope)}return ${t}`,this.opts.code.process&&(u=this.opts.code.process(u,e));const r=new Function(`${Mm.default.self}`,`${Mm.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:c,validateCode:t,scopeValues:a._values}),this.opts.unevaluated){const{props:e,items:t}=l;r.evaluated={props:e instanceof zm.Name?void 0:e,items:t instanceof zm.Name?void 0:t,dynamicProps:e instanceof zm.Name,dynamicItems:t instanceof zm.Name},r.source&&(r.source.evaluated=(0,zm.stringify)(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),t}finally{this._compilations.delete(e)}}function Lm(e){return(0,Um.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Fm.call(this,e)}function Hm(e){for(const t of this._compilations)if(Km(t,e))return t}function Km(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Zm(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||Gm.call(this,e,t)}function Gm(e,t){const r=this.opts.uriResolver.parse(t),n=(0,Um._getFullPath)(this.opts.uriResolver,r);let o=(0,Um.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Wm.call(this,r,e);const s=(0,Um.normalizeId)(n),a=this.refs[s]||this.schemas[s];if("string"==typeof a){const t=Gm.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return Wm.call(this,r,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||Fm.call(this,a),s===(0,Um.normalizeId)(t)){const{schema:t}=a,{schemaId:r}=this.opts,n=t[r];return n&&(o=(0,Um.resolveUrl)(this.opts.uriResolver,o,n)),new Vm({schema:t,schemaId:r,root:e,baseId:o})}return Wm.call(this,r,a)}}Om.SchemaEnv=Vm,Om.compileSchema=Fm,Om.resolveRef=function(e,t,r){var n;r=(0,Um.resolveUrl)(this.opts.uriResolver,t,r);const o=e.refs[r];if(o)return o;let s=Zm.call(this,e,r);if(void 0===s){const o=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:a}=this.opts;o&&(s=new Vm({schema:o,schemaId:a,root:e,baseId:t}))}return void 0!==s?e.refs[r]=Lm.call(this,s):void 0},Om.getCompilingSchema=Hm,Om.resolveSchema=Gm;const Jm=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Wm(e,{baseId:t,schema:r,root:n}){var o;if("/"!==(null===(o=e.fragment)||void 0===o?void 0:o[0]))return;for(const n of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,Dm.unescapeFragment)(n)];if(void 0===e)return;const o="object"==typeof(r=e)&&r[this.opts.schemaId];!Jm.has(n)&&o&&(t=(0,Um.resolveUrl)(this.opts.uriResolver,t,o))}let s;if("boolean"!=typeof r&&r.$ref&&!(0,Dm.schemaHasRulesButRef)(r,this.RULES)){const e=(0,Um.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=Gm.call(this,n,e)}const{schemaId:a}=this.opts;return s=s||new Vm({schema:r,schemaId:a,root:n,baseId:t}),s.schema!==s.root.schema?s:void 0}var Bm={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},Qm={};Object.defineProperty(Qm,"__esModule",{value:!0});const Ym=Tu;Ym.code='require("ajv/dist/runtime/uri").default',Qm.default=Ym,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Tm();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=pf;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=Cm(),o=Rm(),s=zf,a=Om,i=pf,c=cm,l=Of,u=mf,d=Bm,p=Qm,h=(e,t)=>new RegExp(e,t);h.code="new RegExp";const f=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function v(e){var t,r,n,o,s,a,i,c,l,u,d,f,m,y,g,v,_,w,$,b,k,E,P,S,T;const x=e.strict,I=null===(t=e.code)||void 0===t?void 0:t.optimize,C=!0===I||void 0===I?1:I||0,N=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:h,j=null!==(o=e.uriResolver)&&void 0!==o?o:p.default;return{strictSchema:null===(a=null!==(s=e.strictSchema)&&void 0!==s?s:x)||void 0===a||a,strictNumbers:null===(c=null!==(i=e.strictNumbers)&&void 0!==i?i:x)||void 0===c||c,strictTypes:null!==(u=null!==(l=e.strictTypes)&&void 0!==l?l:x)&&void 0!==u?u:"log",strictTuples:null!==(f=null!==(d=e.strictTuples)&&void 0!==d?d:x)&&void 0!==f?f:"log",strictRequired:null!==(y=null!==(m=e.strictRequired)&&void 0!==m?m:x)&&void 0!==y&&y,code:e.code?{...e.code,optimize:C,regExp:N}:{optimize:C,regExp:N},loopRequired:null!==(g=e.loopRequired)&&void 0!==g?g:200,loopEnum:null!==(v=e.loopEnum)&&void 0!==v?v:200,meta:null===(_=e.meta)||void 0===_||_,messages:null===(w=e.messages)||void 0===w||w,inlineRefs:null===($=e.inlineRefs)||void 0===$||$,schemaId:null!==(b=e.schemaId)&&void 0!==b?b:"$id",addUsedSchema:null===(k=e.addUsedSchema)||void 0===k||k,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(P=e.validateFormats)||void 0===P||P,unicodeRegExp:null===(S=e.unicodeRegExp)||void 0===S||S,int32range:null===(T=e.int32range)||void 0===T||T,uriResolver:j}}class _{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return S;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,s.getRules)(),w.call(this,y,e,"NOT SUPPORTED"),w.call(this,g,e,"DEPRECATED","warn"),this._metaOpts=P.call(this),e.formats&&k.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),b.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=d;"id"===r&&(n={...d},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await s.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||a.call(this,r)}async function s(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return i.call(this,t),await c.call(this,t.missingSchema),a.call(this,e)}}function i({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await l.call(this,e);this.refs[e]||await s.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function l(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let o;if("object"==typeof e){const{schemaId:t}=this.opts;if(o=e[t],void 0!==o&&"string"!=typeof o)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=$.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new a.SchemaEnv({schema:{},schemaId:r});if(t=a.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=$.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(x.call(this,r,t),!t)return(0,u.eachItem)(r,e=>I.call(this,e)),this;N.call(this,t);const n={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(r,0===n.type.length?e=>I.call(this,e,n):e=>n.type.forEach(t=>I.call(this,e,n,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let o=e;for(const e of t)o=o[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,s=o[e];n&&s&&(o[e]=R(s))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s;const{schemaId:i}=this.opts;if("object"==typeof e)s=e[i];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let l=this._cache.get(e);if(void 0!==l)return l;r=(0,c.normalizeId)(s||r);const u=c.getSchemaRefs.call(this,e,r);return l=new a.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:u}),this._cache.set(l.schema,l),o&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=l),n&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):a.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,n="error"){for(const o in e){const s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function $(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function b(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function k(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function P(){const e={...this.opts};for(const t of f)delete e[t];return e}_.ValidationError=n.default,_.MissingRefError=o.default,e.default=_;const S={log(){},warn(){},error(){}};const T=/^[a-z_$][a-z0-9_$:-]*$/i;function x(e,t){const{RULES:r}=this;if((0,u.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!T.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function I(e,t,r){var n;const o=null==t?void 0:t.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let a=o?s.post:s.rules.find(({type:e})=>e===r);if(a||(a={type:r,rules:[]},s.rules.push(a)),s.keywords[e]=!0,!t)return;const i={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?C.call(this,a,i,t.before):a.rules.push(i),s.all[e]=i,null===(n=t.implements)||void 0===n||n.forEach(e=>this.addKeyword(e))}function C(e,t,r){const n=e.rules.findIndex(e=>e.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function N(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=R(t)),e.validateSchema=this.compile(t,!0))}const j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function R(e){return{anyOf:[e,j]}}}(cf);var Xm={},ey={},ty={};Object.defineProperty(ty,"__esModule",{value:!0});const ry={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};ty.default=ry;var ny={};Object.defineProperty(ny,"__esModule",{value:!0}),ny.callRef=ny.getValidate=void 0;const oy=Rm(),sy=om(),ay=pf,iy=jf(),cy=Om,ly=mf,uy={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:a,opts:i,self:c}=n,{root:l}=s;if(("#"===r||"#/"===r)&&o===l.baseId)return function(){if(s===l)return py(e,a,s,s.$async);const r=t.scopeValue("root",{ref:l});return py(e,ay._`${r}.validate`,l,l.$async)}();const u=cy.resolveRef.call(c,l,o,r);if(void 0===u)throw new oy.default(n.opts.uriResolver,o,r);return u instanceof cy.SchemaEnv?function(t){const r=dy(e,t);py(e,r,t,t.$async)}(u):function(n){const o=t.scopeValue("schema",!0===i.code.source?{ref:n,code:(0,ay.stringify)(n)}:{ref:n}),s=t.name("valid"),a=e.subschema({schema:n,dataTypes:[],schemaPath:ay.nil,topSchemaRef:o,errSchemaPath:r},s);e.mergeEvaluated(a),e.ok(s)}(u)}};function dy(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):ay._`${r.scopeValue("wrapper",{ref:t})}.validate`}function py(e,t,r,n){const{gen:o,it:s}=e,{allErrors:a,schemaEnv:i,opts:c}=s,l=c.passContext?iy.default.this:ay.nil;function u(e){const t=ay._`${e}.errors`;o.assign(iy.default.vErrors,ay._`${iy.default.vErrors} === null ? ${t} : ${iy.default.vErrors}.concat(${t})`),o.assign(iy.default.errors,ay._`${iy.default.vErrors}.length`)}function d(e){var t;if(!s.opts.unevaluated)return;const n=null===(t=null==r?void 0:r.validate)||void 0===t?void 0:t.evaluated;if(!0!==s.props)if(n&&!n.dynamicProps)void 0!==n.props&&(s.props=ly.mergeEvaluated.props(o,n.props,s.props));else{const t=o.var("props",ay._`${e}.evaluated.props`);s.props=ly.mergeEvaluated.props(o,t,s.props,ay.Name)}if(!0!==s.items)if(n&&!n.dynamicItems)void 0!==n.items&&(s.items=ly.mergeEvaluated.items(o,n.items,s.items));else{const t=o.var("items",ay._`${e}.evaluated.items`);s.items=ly.mergeEvaluated.items(o,t,s.items,ay.Name)}}n?function(){if(!i.$async)throw new Error("async schema referenced by sync schema");const r=o.let("valid");o.try(()=>{o.code(ay._`await ${(0,sy.callValidateCode)(e,t,l)}`),d(t),a||o.assign(r,!0)},e=>{o.if(ay._`!(${e} instanceof ${s.ValidationError})`,()=>o.throw(e)),u(e),a||o.assign(r,!1)}),e.ok(r)}():e.result((0,sy.callValidateCode)(e,t,l),()=>d(t),()=>u(t))}ny.getValidate=dy,ny.callRef=py,ny.default=uy,Object.defineProperty(ey,"__esModule",{value:!0});const hy=ny,fy=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",ty.default,hy.default];ey.default=fy;var my={},yy={};Object.defineProperty(yy,"__esModule",{value:!0});const gy=pf,vy=gy.operators,_y={maximum:{okStr:"<=",ok:vy.LTE,fail:vy.GT},minimum:{okStr:">=",ok:vy.GTE,fail:vy.LT},exclusiveMaximum:{okStr:"<",ok:vy.LT,fail:vy.GTE},exclusiveMinimum:{okStr:">",ok:vy.GT,fail:vy.LTE}},wy={message:({keyword:e,schemaCode:t})=>gy.str`must be ${_y[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>gy._`{comparison: ${_y[e].okStr}, limit: ${t}}`},$y={keyword:Object.keys(_y),type:"number",schemaType:"number",$data:!0,error:wy,code(e){const{keyword:t,data:r,schemaCode:n}=e;e.fail$data(gy._`${r} ${_y[t].fail} ${n} || isNaN(${r})`)}};yy.default=$y;var by={};Object.defineProperty(by,"__esModule",{value:!0});const ky=pf,Ey={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>ky.str`must be multiple of ${e}`,params:({schemaCode:e})=>ky._`{multipleOf: ${e}}`},code(e){const{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,a=t.let("res"),i=s?ky._`Math.abs(Math.round(${a}) - ${a}) > 1e-${s}`:ky._`${a} !== parseInt(${a})`;e.fail$data(ky._`(${n} === 0 || (${a} = ${r}/${n}, ${i}))`)}};by.default=Ey;var Py={},Sy={};function Ty(e){const t=e.length;let r,n=0,o=0;for(;o<t;)n++,r=e.charCodeAt(o++),r>=55296&&r<=56319&&o<t&&(r=e.charCodeAt(o),56320==(64512&r)&&o++);return n}Object.defineProperty(Sy,"__esModule",{value:!0}),Sy.default=Ty,Ty.code='require("ajv/dist/runtime/ucs2length").default',Object.defineProperty(Py,"__esModule",{value:!0});const xy=pf,Iy=mf,Cy=Sy,Ny={message:({keyword:e,schemaCode:t})=>xy.str`must NOT have ${"maxLength"===e?"more":"fewer"} than ${t} characters`,params:({schemaCode:e})=>xy._`{limit: ${e}}`},jy={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Ny,code(e){const{keyword:t,data:r,schemaCode:n,it:o}=e,s="maxLength"===t?xy.operators.GT:xy.operators.LT,a=!1===o.opts.unicode?xy._`${r}.length`:xy._`${(0,Iy.useFunc)(e.gen,Cy.default)}(${r})`;e.fail$data(xy._`${a} ${s} ${n}`)}};Py.default=jy;var Ry={};Object.defineProperty(Ry,"__esModule",{value:!0});const Oy=om(),zy=mf,Ay=pf,My={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>Ay.str`must match pattern "${e}"`,params:({schemaCode:e})=>Ay._`{pattern: ${e}}`},code(e){const{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:a}=e,i=a.opts.unicodeRegExp?"u":"";if(n){const{regExp:n}=a.opts.code,o="new RegExp"===n.code?Ay._`new RegExp`:(0,zy.useFunc)(t,n),c=t.let("valid");t.try(()=>t.assign(c,Ay._`${o}(${s}, ${i}).test(${r})`),()=>t.assign(c,!1)),e.fail$data(Ay._`!${c}`)}else{const t=(0,Oy.usePattern)(e,o);e.fail$data(Ay._`!${t}.test(${r})`)}}};Ry.default=My;var Uy={};Object.defineProperty(Uy,"__esModule",{value:!0});const Dy=pf,qy={message:({keyword:e,schemaCode:t})=>Dy.str`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${t} properties`,params:({schemaCode:e})=>Dy._`{limit: ${e}}`},Vy={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:qy,code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxProperties"===t?Dy.operators.GT:Dy.operators.LT;e.fail$data(Dy._`Object.keys(${r}).length ${o} ${n}`)}};Uy.default=Vy;var Fy={};Object.defineProperty(Fy,"__esModule",{value:!0});const Ly=om(),Hy=pf,Ky=mf,Zy={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>Hy.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Hy._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:a}=e,{opts:i}=a;if(!s&&0===r.length)return;const c=r.length>=i.loopRequired;if(a.allErrors?function(){if(c||s)e.block$data(Hy.nil,l);else for(const t of r)(0,Ly.checkReportMissingProp)(e,t)}():function(){const a=t.let("missing");if(c||s){const r=t.let("valid",!0);e.block$data(r,()=>function(r,s){e.setParams({missingProperty:r}),t.forOf(r,n,()=>{t.assign(s,(0,Ly.propertyInData)(t,o,r,i.ownProperties)),t.if((0,Hy.not)(s),()=>{e.error(),t.break()})},Hy.nil)}(a,r)),e.ok(r)}else t.if((0,Ly.checkMissingProp)(e,r,a)),(0,Ly.reportMissingProp)(e,a),t.else()}(),i.strictRequired){const t=e.parentSchema.properties,{definedProperties:n}=e.it;for(const e of r)if(void 0===(null==t?void 0:t[e])&&!n.has(e)){const t=`required property "${e}" is not defined at "${a.schemaEnv.baseId+a.errSchemaPath}" (strictRequired)`;(0,Ky.checkStrictMode)(a,t,a.opts.strictRequired)}}function l(){t.forOf("prop",n,r=>{e.setParams({missingProperty:r}),t.if((0,Ly.noPropertyInData)(t,o,r,i.ownProperties),()=>e.error())})}}};Fy.default=Zy;var Gy={};Object.defineProperty(Gy,"__esModule",{value:!0});const Jy=pf,Wy={message:({keyword:e,schemaCode:t})=>Jy.str`must NOT have ${"maxItems"===e?"more":"fewer"} than ${t} items`,params:({schemaCode:e})=>Jy._`{limit: ${e}}`},By={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Wy,code(e){const{keyword:t,data:r,schemaCode:n}=e,o="maxItems"===t?Jy.operators.GT:Jy.operators.LT;e.fail$data(Jy._`${r}.length ${o} ${n}`)}};Gy.default=By;var Qy={},Yy={};Object.defineProperty(Yy,"__esModule",{value:!0});const Xy=Lc;Xy.code='require("ajv/dist/runtime/equal").default',Yy.default=Xy,Object.defineProperty(Qy,"__esModule",{value:!0});const eg=Of,tg=pf,rg=mf,ng=Yy,og={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>tg.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>tg._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:a,it:i}=e;if(!n&&!o)return;const c=t.let("valid"),l=s.items?(0,eg.getSchemaTypes)(s.items):[];function u(n,o){const s=t.name("item"),a=(0,eg.checkDataTypes)(l,s,i.opts.strictNumbers,eg.DataType.Wrong),u=t.const("indices",tg._`{}`);t.for(tg._`;${n}--;`,()=>{t.let(s,tg._`${r}[${n}]`),t.if(a,tg._`continue`),l.length>1&&t.if(tg._`typeof ${s} == "string"`,tg._`${s} += "_"`),t.if(tg._`typeof ${u}[${s}] == "number"`,()=>{t.assign(o,tg._`${u}[${s}]`),e.error(),t.assign(c,!1).break()}).code(tg._`${u}[${s}] = ${n}`)})}function d(n,o){const s=(0,rg.useFunc)(t,ng.default),a=t.name("outer");t.label(a).for(tg._`;${n}--;`,()=>t.for(tg._`${o} = ${n}; ${o}--;`,()=>t.if(tg._`${s}(${r}[${n}], ${r}[${o}])`,()=>{e.error(),t.assign(c,!1).break(a)})))}e.block$data(c,function(){const n=t.let("i",tg._`${r}.length`),o=t.let("j");e.setParams({i:n,j:o}),t.assign(c,!0),t.if(tg._`${n} > 1`,()=>(l.length>0&&!l.some(e=>"object"===e||"array"===e)?u:d)(n,o))},tg._`${a} === false`),e.ok(c)}};Qy.default=og;var sg={};Object.defineProperty(sg,"__esModule",{value:!0});const ag=pf,ig=mf,cg=Yy,lg={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>ag._`{allowedValue: ${e}}`},code(e){const{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&"object"==typeof s?e.fail$data(ag._`!${(0,ig.useFunc)(t,cg.default)}(${r}, ${o})`):e.fail(ag._`${s} !== ${r}`)}};sg.default=lg;var ug={};Object.defineProperty(ug,"__esModule",{value:!0});const dg=pf,pg=mf,hg=Yy,fg={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>dg._`{allowedValues: ${e}}`},code(e){const{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:a}=e;if(!n&&0===o.length)throw new Error("enum must have non-empty array");const i=o.length>=a.opts.loopEnum;let c;const l=()=>null!=c?c:c=(0,pg.useFunc)(t,hg.default);let u;if(i||n)u=t.let("valid"),e.block$data(u,function(){t.assign(u,!1),t.forOf("v",s,e=>t.if(dg._`${l()}(${r}, ${e})`,()=>t.assign(u,!0).break()))});else{if(!Array.isArray(o))throw new Error("ajv implementation error");const e=t.const("vSchema",s);u=(0,dg.or)(...o.map((t,n)=>function(e,t){const n=o[t];return"object"==typeof n&&null!==n?dg._`${l()}(${r}, ${e}[${t}])`:dg._`${r} === ${n}`}(e,n)))}e.pass(u)}};ug.default=fg,Object.defineProperty(my,"__esModule",{value:!0});const mg=by,yg=Py,gg=Ry,vg=Uy,_g=Fy,wg=Gy,$g=Qy,bg=sg,kg=ug,Eg=[yy.default,mg.default,yg.default,gg.default,vg.default,_g.default,wg.default,$g.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},bg.default,kg.default];my.default=Eg;var Pg={},Sg={};Object.defineProperty(Sg,"__esModule",{value:!0}),Sg.validateAdditionalItems=void 0;const Tg=pf,xg=mf,Ig={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>Tg.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Tg._`{limit: ${e}}`},code(e){const{parentSchema:t,it:r}=e,{items:n}=t;Array.isArray(n)?Cg(e,n):(0,xg.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}};function Cg(e,t){const{gen:r,schema:n,data:o,keyword:s,it:a}=e;a.items=!0;const i=r.const("len",Tg._`${o}.length`);if(!1===n)e.setParams({len:t.length}),e.pass(Tg._`${i} <= ${t.length}`);else if("object"==typeof n&&!(0,xg.alwaysValidSchema)(a,n)){const n=r.var("valid",Tg._`${i} <= ${t.length}`);r.if((0,Tg.not)(n),()=>function(n){r.forRange("i",t.length,i,t=>{e.subschema({keyword:s,dataProp:t,dataPropType:xg.Type.Num},n),a.allErrors||r.if((0,Tg.not)(n),()=>r.break())})}(n)),e.ok(n)}}Sg.validateAdditionalItems=Cg,Sg.default=Ig;var Ng={},jg={};Object.defineProperty(jg,"__esModule",{value:!0}),jg.validateTuple=void 0;const Rg=pf,Og=mf,zg=om(),Ag={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return Mg(e,"additionalItems",t);r.items=!0,(0,Og.alwaysValidSchema)(r,t)||e.ok((0,zg.validateArray)(e))}};function Mg(e,t,r=e.schema){const{gen:n,parentSchema:o,data:s,keyword:a,it:i}=e;!function(e){const{opts:n,errSchemaPath:o}=i,s=r.length,c=s===e.minItems&&(s===e.maxItems||!1===e[t]);if(n.strictTuples&&!c){const e=`"${a}" is ${s}-tuple, but minItems or maxItems/${t} are not specified or different at path "${o}"`;(0,Og.checkStrictMode)(i,e,n.strictTuples)}}(o),i.opts.unevaluated&&r.length&&!0!==i.items&&(i.items=Og.mergeEvaluated.items(n,r.length,i.items));const c=n.name("valid"),l=n.const("len",Rg._`${s}.length`);r.forEach((t,r)=>{(0,Og.alwaysValidSchema)(i,t)||(n.if(Rg._`${l} > ${r}`,()=>e.subschema({keyword:a,schemaProp:r,dataProp:r},c)),e.ok(c))})}jg.validateTuple=Mg,jg.default=Ag,Object.defineProperty(Ng,"__esModule",{value:!0});const Ug=jg,Dg={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Ug.validateTuple)(e,"items")};Ng.default=Dg;var qg={};Object.defineProperty(qg,"__esModule",{value:!0});const Vg=pf,Fg=mf,Lg=om(),Hg=Sg,Kg={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>Vg.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Vg._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,(0,Fg.alwaysValidSchema)(n,t)||(o?(0,Hg.validateAdditionalItems)(e,o):e.ok((0,Lg.validateArray)(e)))}};qg.default=Kg;var Zg={};Object.defineProperty(Zg,"__esModule",{value:!0});const Gg=pf,Jg=mf,Wg={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?Gg.str`must contain at least ${e} valid item(s)`:Gg.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?Gg._`{minContains: ${e}}`:Gg._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;let a,i;const{minContains:c,maxContains:l}=n;s.opts.next?(a=void 0===c?1:c,i=l):a=1;const u=t.const("len",Gg._`${o}.length`);if(e.setParams({min:a,max:i}),void 0===i&&0===a)return void(0,Jg.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==i&&a>i)return(0,Jg.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,Jg.alwaysValidSchema)(s,r)){let t=Gg._`${u} >= ${a}`;return void 0!==i&&(t=Gg._`${t} && ${u} <= ${i}`),void e.pass(t)}s.items=!0;const d=t.name("valid");function p(){const e=t.name("_valid"),r=t.let("count",0);h(e,()=>t.if(e,()=>function(e){t.code(Gg._`${e}++`),void 0===i?t.if(Gg._`${e} >= ${a}`,()=>t.assign(d,!0).break()):(t.if(Gg._`${e} > ${i}`,()=>t.assign(d,!1).break()),1===a?t.assign(d,!0):t.if(Gg._`${e} >= ${a}`,()=>t.assign(d,!0)))}(r)))}function h(r,n){t.forRange("i",0,u,t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:Jg.Type.Num,compositeRule:!0},r),n()})}void 0===i&&1===a?h(d,()=>t.if(d,()=>t.break())):0===a?(t.let(d,!0),void 0!==i&&t.if(Gg._`${o}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset())}};Zg.default=Wg;var Bg={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=pf,r=mf,n=om();e.error={message:({params:{property:e,depsCount:r,deps:n}})=>t.str`must have ${1===r?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:r,deps:n,missingProperty:o}})=>t._`{property: ${e},
11
- missingProperty: ${o},
12
- depsCount: ${r},
13
- deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:r)[n]=e[n]}return[t,r]}(e);s(e,t),a(e,r)}};function s(e,r=e.schema){const{gen:o,data:s,it:a}=e;if(0===Object.keys(r).length)return;const i=o.let("missing");for(const c in r){const l=r[c];if(0===l.length)continue;const u=(0,n.propertyInData)(o,s,c,a.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),a.allErrors?o.if(u,()=>{for(const t of l)(0,n.checkReportMissingProp)(e,t)}):(o.if(t._`${u} && (${(0,n.checkMissingProp)(e,l,i)})`),(0,n.reportMissingProp)(e,i),o.else())}}function a(e,t=e.schema){const{gen:o,data:s,keyword:a,it:i}=e,c=o.name("valid");for(const l in t)(0,r.alwaysValidSchema)(i,t[l])||(o.if((0,n.propertyInData)(o,s,l,i.opts.ownProperties),()=>{const t=e.subschema({keyword:a,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>o.var(c,!0)),e.ok(c))}e.validatePropertyDeps=s,e.validateSchemaDeps=a,e.default=o}(Bg);var Qg={};Object.defineProperty(Qg,"__esModule",{value:!0});const Yg=pf,Xg=mf,ev={message:"property name must be valid",params:({params:e})=>Yg._`{propertyName: ${e.propertyName}}`},tv={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ev,code(e){const{gen:t,schema:r,data:n,it:o}=e;if((0,Xg.alwaysValidSchema)(o,r))return;const s=t.name("valid");t.forIn("key",n,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},s),t.if((0,Yg.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};Qg.default=tv;var rv={};Object.defineProperty(rv,"__esModule",{value:!0});const nv=om(),ov=pf,sv=jf(),av=mf,iv={message:"must NOT have additional properties",params:({params:e})=>ov._`{additionalProperty: ${e.additionalProperty}}`},cv={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:iv,code(e){const{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:a}=e;if(!s)throw new Error("ajv implementation error");const{allErrors:i,opts:c}=a;if(a.props=!0,"all"!==c.removeAdditional&&(0,av.alwaysValidSchema)(a,r))return;const l=(0,nv.allSchemaProperties)(n.properties),u=(0,nv.allSchemaProperties)(n.patternProperties);function d(e){t.code(ov._`delete ${o}[${e}]`)}function p(n){if("all"===c.removeAdditional||c.removeAdditional&&!1===r)d(n);else{if(!1===r)return e.setParams({additionalProperty:n}),e.error(),void(i||t.break());if("object"==typeof r&&!(0,av.alwaysValidSchema)(a,r)){const r=t.name("valid");"failing"===c.removeAdditional?(h(n,r,!1),t.if((0,ov.not)(r),()=>{e.reset(),d(n)})):(h(n,r),i||t.if((0,ov.not)(r),()=>t.break()))}}}function h(t,r,n){const o={keyword:"additionalProperties",dataProp:t,dataPropType:av.Type.Str};!1===n&&Object.assign(o,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(o,r)}t.forIn("key",o,r=>{l.length||u.length?t.if(function(r){let o;if(l.length>8){const e=(0,av.schemaRefOrVal)(a,n.properties,"properties");o=(0,nv.isOwnProperty)(t,e,r)}else o=l.length?(0,ov.or)(...l.map(e=>ov._`${r} === ${e}`)):ov.nil;return u.length&&(o=(0,ov.or)(o,...u.map(t=>ov._`${(0,nv.usePattern)(e,t)}.test(${r})`))),(0,ov.not)(o)}(r),()=>p(r)):p(r)}),e.ok(ov._`${s} === ${sv.default.errors}`)}};rv.default=cv;var lv={};Object.defineProperty(lv,"__esModule",{value:!0});const uv=Tm(),dv=om(),pv=mf,hv=rv,fv={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;"all"===s.opts.removeAdditional&&void 0===n.additionalProperties&&hv.default.code(new uv.KeywordCxt(s,hv.default,"additionalProperties"));const a=(0,dv.allSchemaProperties)(r);for(const e of a)s.definedProperties.add(e);s.opts.unevaluated&&a.length&&!0!==s.props&&(s.props=pv.mergeEvaluated.props(t,(0,pv.toHash)(a),s.props));const i=a.filter(e=>!(0,pv.alwaysValidSchema)(s,r[e]));if(0===i.length)return;const c=t.name("valid");for(const r of i)l(r)?u(r):(t.if((0,dv.propertyInData)(t,o,r,s.opts.ownProperties)),u(r),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(r),e.ok(c);function l(e){return s.opts.useDefaults&&!s.compositeRule&&void 0!==r[e].default}function u(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},c)}}};lv.default=fv;var mv={};Object.defineProperty(mv,"__esModule",{value:!0});const yv=om(),gv=pf,vv=mf,_v=mf,wv={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:a}=s,i=(0,yv.allSchemaProperties)(r),c=i.filter(e=>(0,vv.alwaysValidSchema)(s,r[e]));if(0===i.length||c.length===i.length&&(!s.opts.unevaluated||!0===s.props))return;const l=a.strictSchema&&!a.allowMatchingProperties&&o.properties,u=t.name("valid");!0===s.props||s.props instanceof gv.Name||(s.props=(0,_v.evaluatedPropsToName)(t,s.props));const{props:d}=s;function p(e){for(const t in l)new RegExp(e).test(t)&&(0,vv.checkStrictMode)(s,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function h(r){t.forIn("key",n,n=>{t.if(gv._`${(0,yv.usePattern)(e,r)}.test(${n})`,()=>{const o=c.includes(r);o||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:n,dataPropType:_v.Type.Str},u),s.opts.unevaluated&&!0!==d?t.assign(gv._`${d}[${n}]`,!0):o||s.allErrors||t.if((0,gv.not)(u),()=>t.break())})})}!function(){for(const e of i)l&&p(e),s.allErrors?h(e):(t.var(u,!0),h(e),t.if(u))}()}};mv.default=wv;var $v={};Object.defineProperty($v,"__esModule",{value:!0});const bv=mf,kv={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:r,it:n}=e;if((0,bv.alwaysValidSchema)(n,r))return void e.fail();const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};$v.default=kv;var Ev={};Object.defineProperty(Ev,"__esModule",{value:!0});const Pv={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:om().validateUnion,error:{message:"must match a schema in anyOf"}};Ev.default=Pv;var Sv={};Object.defineProperty(Sv,"__esModule",{value:!0});const Tv=pf,xv=mf,Iv={message:"must match exactly one schema in oneOf",params:({params:e})=>Tv._`{passingSchemas: ${e.passing}}`},Cv={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Iv,code(e){const{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;const s=r,a=t.let("valid",!1),i=t.let("passing",null),c=t.name("_valid");e.setParams({passing:i}),t.block(function(){s.forEach((r,n)=>{let s;(0,xv.alwaysValidSchema)(o,r)?t.var(c,!0):s=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:!0},c),n>0&&t.if(Tv._`${c} && ${a}`).assign(a,!1).assign(i,Tv._`[${i}, ${n}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(i,n),s&&e.mergeEvaluated(s,Tv.Name)})})}),e.result(a,()=>e.reset(),()=>e.error(!0))}};Sv.default=Cv;var Nv={};Object.defineProperty(Nv,"__esModule",{value:!0});const jv=mf,Rv={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const o=t.name("valid");r.forEach((t,r)=>{if((0,jv.alwaysValidSchema)(n,t))return;const s=e.subschema({keyword:"allOf",schemaProp:r},o);e.ok(o),e.mergeEvaluated(s)})}};Nv.default=Rv;var Ov={};Object.defineProperty(Ov,"__esModule",{value:!0});const zv=pf,Av=mf,Mv={message:({params:e})=>zv.str`must match "${e.ifClause}" schema`,params:({params:e})=>zv._`{failingKeyword: ${e.ifClause}}`},Uv={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Mv,code(e){const{gen:t,parentSchema:r,it:n}=e;void 0===r.then&&void 0===r.else&&(0,Av.checkStrictMode)(n,'"if" without "then" and "else" is ignored');const o=Dv(n,"then"),s=Dv(n,"else");if(!o&&!s)return;const a=t.let("valid",!0),i=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},i);e.mergeEvaluated(t)}(),e.reset(),o&&s){const r=t.let("ifClause");e.setParams({ifClause:r}),t.if(i,c("then",r),c("else",r))}else o?t.if(i,c("then")):t.if((0,zv.not)(i),c("else"));function c(r,n){return()=>{const o=e.subschema({keyword:r},i);t.assign(a,i),e.mergeValidEvaluated(o,a),n?t.assign(n,zv._`${r}`):e.setParams({ifClause:r})}}e.pass(a,()=>e.error(!0))}};function Dv(e,t){const r=e.schema[t];return void 0!==r&&!(0,Av.alwaysValidSchema)(e,r)}Ov.default=Uv;var qv={};Object.defineProperty(qv,"__esModule",{value:!0});const Vv=mf,Fv={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,Vv.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};qv.default=Fv,Object.defineProperty(Pg,"__esModule",{value:!0});const Lv=Sg,Hv=Ng,Kv=jg,Zv=qg,Gv=Zg,Jv=Bg,Wv=Qg,Bv=rv,Qv=lv,Yv=mv,Xv=$v,e_=Ev,t_=Sv,r_=Nv,n_=Ov,o_=qv;Pg.default=function(e=!1){const t=[Xv.default,e_.default,t_.default,r_.default,n_.default,o_.default,Wv.default,Bv.default,Jv.default,Qv.default,Yv.default];return e?t.push(Hv.default,Zv.default):t.push(Lv.default,Kv.default),t.push(Gv.default),t};var s_={},a_={};Object.defineProperty(a_,"__esModule",{value:!0});const i_=pf,c_={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i_.str`must match format "${e}"`,params:({schemaCode:e})=>i_._`{format: ${e}}`},code(e,t){const{gen:r,data:n,$data:o,schema:s,schemaCode:a,it:i}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=i;c.validateFormats&&(o?function(){const o=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),s=r.const("fDef",i_._`${o}[${a}]`),i=r.let("fType"),l=r.let("format");r.if(i_._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,()=>r.assign(i,i_._`${s}.type || "string"`).assign(l,i_._`${s}.validate`),()=>r.assign(i,i_._`"string"`).assign(l,s)),e.fail$data((0,i_.or)(!1===c.strictSchema?i_.nil:i_._`${a} && !${l}`,function(){const e=u.$async?i_._`(${s}.async ? await ${l}(${n}) : ${l}(${n}))`:i_._`${l}(${n})`,r=i_._`(typeof ${l} == "function" ? ${e} : ${l}.test(${n}))`;return i_._`${l} && ${l} !== true && ${i} === ${t} && !${r}`}()))}():function(){const o=d.formats[s];if(!o)return void function(){if(!1===c.strictSchema)return void d.logger.warn(e());throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${l}"`}}();if(!0===o)return;const[a,i,p]=function(e){const t=e instanceof RegExp?(0,i_.regexpCode)(e):c.code.formats?i_._`${c.code.formats}${(0,i_.getProperty)(s)}`:void 0,n=r.scopeValue("formats",{key:s,ref:e,code:t});if("object"==typeof e&&!(e instanceof RegExp))return[e.type||"string",e.validate,i_._`${n}.validate`];return["string",e,n]}(o);a===t&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!u.$async)throw new Error("async format in sync schema");return i_._`await ${p}(${n})`}return"function"==typeof i?i_._`${p}(${n})`:i_._`${p}.test(${n})`}())}())}};a_.default=c_,Object.defineProperty(s_,"__esModule",{value:!0});const l_=[a_.default];s_.default=l_;var u_={};Object.defineProperty(u_,"__esModule",{value:!0}),u_.contentVocabulary=u_.metadataVocabulary=void 0,u_.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],u_.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(Xm,"__esModule",{value:!0});const d_=my,p_=Pg,h_=s_,f_=u_,m_=[ey.default,d_.default,(0,p_.default)(),h_.default,f_.metadataVocabulary,f_.contentVocabulary];Xm.default=m_;var y_,g_={},v_={};Object.defineProperty(v_,"__esModule",{value:!0}),v_.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(y_||(v_.DiscrError=y_={})),Object.defineProperty(g_,"__esModule",{value:!0});const __=pf,w_=v_,$_=Om,b_=Rm(),k_=mf,E_={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===w_.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>__._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){const{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:a}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");const i=n.propertyName;if("string"!=typeof i)throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");const c=t.let("valid",!1),l=t.const("tag",__._`${r}${(0,__.getProperty)(i)}`);function u(r){const n=t.name("valid"),o=e.subschema({keyword:"oneOf",schemaProp:r},n);return e.mergeEvaluated(o,__.Name),n}t.if(__._`typeof ${l} == "string"`,()=>function(){const r=function(){var e;const t={},r=c(o);let n=!0;for(let t=0;t<a.length;t++){let o=a[t];if((null==o?void 0:o.$ref)&&!(0,k_.schemaHasRulesButRef)(o,s.self.RULES)){const e=o.$ref;if(o=$_.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,e),o instanceof $_.SchemaEnv&&(o=o.schema),void 0===o)throw new b_.default(s.opts.uriResolver,s.baseId,e)}const u=null===(e=null==o?void 0:o.properties)||void 0===e?void 0:e[i];if("object"!=typeof u)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);n=n&&(r||c(o)),l(u,t)}if(!n)throw new Error(`discriminator: "${i}" must be required`);return t;function c({required:e}){return Array.isArray(e)&&e.includes(i)}function l(e,t){if(e.const)u(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`);for(const r of e.enum)u(r,t)}}function u(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${i}" values must be unique strings`);t[e]=r}}();t.if(!1);for(const e in r)t.elseIf(__._`${l} === ${e}`),t.assign(c,u(r[e]));t.else(),e.error(!1,{discrError:w_.DiscrError.Mapping,tag:l,tagName:i}),t.endIf()}(),()=>e.error(!1,{discrError:w_.DiscrError.Tag,tag:l,tagName:i})),e.ok(c)}};g_.default=E_;var P_={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const r=cf,n=Xm,o=g_,s=P_,a=["/properties"],i="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(e,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var l=Tm();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=pf;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=Cm();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=Rm();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}(af,af.exports);var S_=af.exports;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=S_,r=pf,n=r.operators,o={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},s={message:({keyword:e,schemaCode:t})=>r.str`should be ${o[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>r._`{comparison: ${o[e].okStr}, limit: ${t}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:s,code(e){const{gen:n,data:s,schemaCode:a,keyword:i,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;const d=new t.KeywordCxt(c,u.RULES.all.format.definition,"format");function p(e){return r._`${e}.compare(${s}, ${a}) ${o[i].fail} 0`}d.$data?function(){const t=n.scopeValue("formats",{ref:u.formats,code:l.code.formats}),o=n.const("fmt",r._`${t}[${d.schemaCode}]`);e.fail$data((0,r.or)(r._`typeof ${o} != "object"`,r._`${o} instanceof RegExp`,r._`typeof ${o}.compare != "function"`,p(o)))}():function(){const t=d.schema,o=u.formats[t];if(!o||!0===o)return;if("object"!=typeof o||o instanceof RegExp||"function"!=typeof o.compare)throw new Error(`"${i}": format "${t}" does not define "compare" function`);const s=n.scopeValue("formats",{key:t,ref:o,code:l.code.formats?r._`${l.code.formats}${(0,r.getProperty)(t)}`:void 0});e.fail$data(p(s))}()},dependencies:["format"]};e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}(sf),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=of,n=sf,o=pf,s=new o.Name("fullFormats"),a=new o.Name("fastFormats"),i=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,r.fullFormats,s),e;const[o,i]="fast"===t.mode?[r.fastFormats,a]:[r.fullFormats,s];return c(e,t.formats||r.formatNames,o,i),t.keywords&&(0,n.default)(e),e};function c(e,t,r,n){var s,a;null!==(s=(a=e.opts.code).formats)&&void 0!==s||(a.formats=o._`require("ajv-formats/dist/formats").${n}`);for(const n of t)e.addFormat(n,r[n])}i.get=(e,t="full")=>{const n=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n},e.exports=t=i,Object.defineProperty(t,"__esModule",{value:!0}),t.default=i}(nf,nf.exports);var T_=Oi(nf.exports);class x_{constructor(e){this._ajv=e??function(){const e=new rf({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return T_(e),e}()}getValidator(e){const t="$id"in e&&"string"==typeof e.$id?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class I_{constructor(e){this._client=e}async*callToolStream(e,t=Aa,r){const n=this._client,o={...r,task:r?.task??(n.isToolTask(e.name)?{}:void 0)},s=n.requestStream({method:"tools/call",params:e},t,o),a=n.getToolOutputValidator(e.name);for await(const t of s){if("result"===t.type&&a){const r=t.result;if(!r.structuredContent&&!r.isError)return void(yield{type:"error",error:new Ti(cs.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)});if(r.structuredContent)try{const e=a(r.structuredContent);if(!e.valid)return void(yield{type:"error",error:new Ti(cs.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)})}catch(e){return e instanceof Ti?void(yield{type:"error",error:e}):void(yield{type:"error",error:new Ti(cs.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)})}}yield t}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}function C_(e,t){if(e&&null!==t&&"object"==typeof t){if("object"===e.type&&e.properties&&"object"==typeof e.properties){const r=t,n=e.properties;for(const e of Object.keys(n)){const t=n[e];void 0===r[e]&&Object.prototype.hasOwnProperty.call(t,"default")&&(r[e]=t.default),void 0!==r[e]&&C_(t,r[e])}}if(Array.isArray(e.anyOf))for(const r of e.anyOf)"boolean"!=typeof r&&C_(r,t);if(Array.isArray(e.oneOf))for(const r of e.oneOf)"boolean"!=typeof r&&C_(r,t)}}class N_ extends ji{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new x_,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Da,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Ca,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",la,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new I_(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){const r={...e};for(const e in t){const n=e,o=t[n];if(void 0===o)continue;const s=r[n];Ri(s)&&Ri(o)?r[n]={...s,...o}:r[n]=o}return r}(this._capabilities,e)}setRequestHandler(e,t){const r=cn(e),n=r?.method;if(!n)throw new Error("Schema is missing a method literal");let o;if(sn(n)){const e=n,t=e._zod?.def;o=t?.value??e.value}else{const e=n,t=e._def;o=t?.value??e.value}if("string"!=typeof o)throw new Error("Schema method literal must be a string");const s=o;if("elicitation/create"===s){const r=async(e,r)=>{const n=an(fi,e);if(!n.success){const e=n.error instanceof Error?n.error.message:String(n.error);throw new Ti(cs.InvalidParams,`Invalid elicitation request: ${e}`)}const{params:o}=n.data;o.mode=o.mode??"form";const{supportsFormMode:s,supportsUrlMode:a}=function(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};const t=void 0!==e.form,r=void 0!==e.url;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}(this._capabilities.elicitation);if("form"===o.mode&&!s)throw new Ti(cs.InvalidParams,"Client does not support form-mode elicitation requests");if("url"===o.mode&&!a)throw new Ti(cs.InvalidParams,"Client does not support URL-mode elicitation requests");const i=await Promise.resolve(t(e,r));if(o.task){const e=an(Ms,i);if(!e.success){const t=e.error instanceof Error?e.error.message:String(e.error);throw new Ti(cs.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}const c=an(gi,i);if(!c.success){const e=c.error instanceof Error?c.error.message:String(c.error);throw new Ti(cs.InvalidParams,`Invalid elicitation result: ${e}`)}const l=c.data,u="form"===o.mode?o.requestedSchema:void 0;if("form"===o.mode&&"accept"===l.action&&l.content&&u&&this._capabilities.elicitation?.form?.applyDefaults)try{C_(u,l.content)}catch{}return l};return super.setRequestHandler(e,r)}if("sampling/createMessage"===s){const r=async(e,r)=>{const n=an(ei,e);if(!n.success){const e=n.error instanceof Error?n.error.message:String(n.error);throw new Ti(cs.InvalidParams,`Invalid sampling request: ${e}`)}const{params:o}=n.data,s=await Promise.resolve(t(e,r));if(o.task){const e=an(Ms,s);if(!e.success){const t=e.error instanceof Error?e.error.message:String(e.error);throw new Ti(cs.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}const a=an(o.tools||o.toolChoice?ri:ti,s);if(!a.success){const e=a.error instanceof Error?a.error.message:String(a.error);throw new Ti(cs.InvalidParams,`Invalid sampling result: ${e}`)}return a.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),void 0===e.sessionId)try{const r=await this.request({method:"initialize",params:{protocolVersion:Do,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ss,t);if(void 0===r)throw new Error(`Server sent invalid initialize result: ${r}`);if(!qo.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(e){throw this.close(),e}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if("resources/subscribe"===e&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){if("notifications/roots/list_changed"===e)if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){!function(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);if("tools/call"===t&&!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`)}(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&function(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`)}}(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},ds,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},bi,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},ds,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Ia,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},_a,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},ra,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},oa,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},ca,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},ds,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},ds,t)}async callTool(e,t=Aa,r){if(this.isToolTaskRequired(e.name))throw new Ti(cs.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const n=await this.request({method:"tools/call",params:e},t,r),o=this.getToolOutputValidator(e.name);if(o){if(!n.structuredContent&&!n.isError)throw new Ti(cs.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{const e=o(n.structuredContent);if(!e.valid)throw new Ti(cs.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){if(e instanceof Ti)throw e;throw new Ti(cs.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return n}isToolTask(e){return!!this._serverCapabilities?.tasks?.requests?.tools?.call&&this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const t of e){if(t.outputSchema){const e=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,e)}const e=t.execution?.taskSupport;"required"!==e&&"optional"!==e||this._cachedKnownTaskTools.add(t.name),"required"===e&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const r=await this.request({method:"tools/list",params:e},za,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,n){const o=qa.safeParse(r);if(!o.success)throw new Error(`Invalid ${e} listChanged options: ${o.error.message}`);if("function"!=typeof r.onChanged)throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);const{autoRefresh:s,debounceMs:a}=o.data,{onChanged:i}=r,c=async()=>{if(s)try{const e=await n();i(null,e)}catch(e){const t=e instanceof Error?e:new Error(String(e));i(t,null)}else i(null,null)};this.setNotificationHandler(t,()=>{if(a){const t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);const r=setTimeout(c,a);this._listChangedDebounceTimers.set(e,r)}else c()})}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function j_(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}const R_=Wr(Cn,O_).superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Uo,message:"URL must be parseable",fatal:!0}),ce}).refine(e=>{const t=new URL(e);return"javascript:"!==t.protocol&&"data:"!==t.protocol&&"vbscript:"!==t.protocol},{message:"URL cannot use javascript:, data:, or vbscript: scheme"});var O_;const z_=lo({resource:Pn().url(),authorization_servers:ao(R_).optional(),jwks_uri:Pn().url().optional(),scopes_supported:ao(Pn()).optional(),bearer_methods_supported:ao(Pn()).optional(),resource_signing_alg_values_supported:ao(Pn()).optional(),resource_name:Pn().optional(),resource_documentation:Pn().optional(),resource_policy_uri:Pn().url().optional(),resource_tos_uri:Pn().url().optional(),tls_client_certificate_bound_access_tokens:Qn().optional(),authorization_details_types_supported:ao(Pn()).optional(),dpop_signing_alg_values_supported:ao(Pn()).optional(),dpop_bound_access_tokens_required:Qn().optional()}),A_=lo({issuer:Pn(),authorization_endpoint:R_,token_endpoint:R_,registration_endpoint:R_.optional(),scopes_supported:ao(Pn()).optional(),response_types_supported:ao(Pn()),response_modes_supported:ao(Pn()).optional(),grant_types_supported:ao(Pn()).optional(),token_endpoint_auth_methods_supported:ao(Pn()).optional(),token_endpoint_auth_signing_alg_values_supported:ao(Pn()).optional(),service_documentation:R_.optional(),revocation_endpoint:R_.optional(),revocation_endpoint_auth_methods_supported:ao(Pn()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ao(Pn()).optional(),introspection_endpoint:Pn().optional(),introspection_endpoint_auth_methods_supported:ao(Pn()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ao(Pn()).optional(),code_challenge_methods_supported:ao(Pn()).optional(),client_id_metadata_document_supported:Qn().optional()}),M_=co({...lo({issuer:Pn(),authorization_endpoint:R_,token_endpoint:R_,userinfo_endpoint:R_.optional(),jwks_uri:R_,registration_endpoint:R_.optional(),scopes_supported:ao(Pn()).optional(),response_types_supported:ao(Pn()),response_modes_supported:ao(Pn()).optional(),grant_types_supported:ao(Pn()).optional(),acr_values_supported:ao(Pn()).optional(),subject_types_supported:ao(Pn()),id_token_signing_alg_values_supported:ao(Pn()),id_token_encryption_alg_values_supported:ao(Pn()).optional(),id_token_encryption_enc_values_supported:ao(Pn()).optional(),userinfo_signing_alg_values_supported:ao(Pn()).optional(),userinfo_encryption_alg_values_supported:ao(Pn()).optional(),userinfo_encryption_enc_values_supported:ao(Pn()).optional(),request_object_signing_alg_values_supported:ao(Pn()).optional(),request_object_encryption_alg_values_supported:ao(Pn()).optional(),request_object_encryption_enc_values_supported:ao(Pn()).optional(),token_endpoint_auth_methods_supported:ao(Pn()).optional(),token_endpoint_auth_signing_alg_values_supported:ao(Pn()).optional(),display_values_supported:ao(Pn()).optional(),claim_types_supported:ao(Pn()).optional(),claims_supported:ao(Pn()).optional(),service_documentation:Pn().optional(),claims_locales_supported:ao(Pn()).optional(),ui_locales_supported:ao(Pn()).optional(),claims_parameter_supported:Qn().optional(),request_parameter_supported:Qn().optional(),request_uri_parameter_supported:Qn().optional(),require_request_uri_registration:Qn().optional(),op_policy_uri:R_.optional(),op_tos_uri:R_.optional(),client_id_metadata_document_supported:Qn().optional()}).shape,...A_.pick({code_challenge_methods_supported:!0}).shape}),U_=co({access_token:Pn(),id_token:Pn().optional(),token_type:Pn(),expires_in:function(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...Te(t)})}(Zn,e)}().optional(),scope:Pn().optional(),refresh_token:Pn().optional()}).strip(),D_=co({error:Pn(),error_description:Pn().optional(),error_uri:Pn().optional()}),q_=R_.optional().or(bo("").transform(()=>{})),V_=co({redirect_uris:ao(R_),token_endpoint_auth_method:Pn().optional(),grant_types:ao(Pn()).optional(),response_types:ao(Pn()).optional(),client_name:Pn().optional(),client_uri:R_.optional(),logo_uri:q_,scope:Pn().optional(),contacts:ao(Pn()).optional(),tos_uri:q_,policy_uri:Pn().optional(),jwks_uri:R_.optional(),jwks:new eo({type:"any"}).optional(),software_id:Pn().optional(),software_version:Pn().optional(),software_statement:Pn().optional()}).strip(),F_=co({client_id:Pn(),client_secret:Pn().optional(),client_id_issued_at:Gn().optional(),client_secret_expires_at:Gn().optional()}).strip(),L_=V_.merge(F_);co({error:Pn(),error_description:Pn().optional()}).strip(),co({token:Pn(),token_type_hint:Pn().optional()}).strip();class H_ extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class K_ extends H_{}K_.errorCode="invalid_request";class Z_ extends H_{}Z_.errorCode="invalid_client";class G_ extends H_{}G_.errorCode="invalid_grant";class J_ extends H_{}J_.errorCode="unauthorized_client";class W_ extends H_{}W_.errorCode="unsupported_grant_type";class B_ extends H_{}B_.errorCode="invalid_scope";class Q_ extends H_{}Q_.errorCode="access_denied";class Y_ extends H_{}Y_.errorCode="server_error";class X_ extends H_{}X_.errorCode="temporarily_unavailable";class ew extends H_{}ew.errorCode="unsupported_response_type";class tw extends H_{}tw.errorCode="unsupported_token_type";class rw extends H_{}rw.errorCode="invalid_token";class nw extends H_{}nw.errorCode="method_not_allowed";class ow extends H_{}ow.errorCode="too_many_requests";class sw extends H_{}sw.errorCode="invalid_client_metadata";class aw extends H_{}aw.errorCode="insufficient_scope";class iw extends H_{}iw.errorCode="invalid_target";const cw={[K_.errorCode]:K_,[Z_.errorCode]:Z_,[G_.errorCode]:G_,[J_.errorCode]:J_,[W_.errorCode]:W_,[B_.errorCode]:B_,[Q_.errorCode]:Q_,[Y_.errorCode]:Y_,[X_.errorCode]:X_,[ew.errorCode]:ew,[tw.errorCode]:tw,[rw.errorCode]:rw,[nw.errorCode]:nw,[ow.errorCode]:ow,[sw.errorCode]:sw,[aw.errorCode]:aw,[iw.errorCode]:iw};class lw extends Error{constructor(e){super(e??"Unauthorized")}}const uw="code",dw="S256";function pw(e,t,r,n){const{client_id:o,client_secret:s}=t;switch(e){case"client_secret_basic":return void function(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const n=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${n}`)}(o,s,r);case"client_secret_post":return void function(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}(o,s,n);case"none":return void function(e,t){t.set("client_id",e)}(o,n);default:throw new Error(`Unsupported client authentication method: ${e}`)}}async function hw(e){const t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{const e=D_.parse(JSON.parse(r)),{error:t,error_description:n,error_uri:o}=e;return new(cw[t]||Y_)(n||"",o)}catch(e){return new Y_(`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${e}. Raw body: ${r}`)}}async function fw(e,t){try{return await mw(e,t)}catch(r){if(r instanceof Z_||r instanceof J_)return await(e.invalidateCredentials?.("all")),await mw(e,t);if(r instanceof G_)return await(e.invalidateCredentials?.("tokens")),await mw(e,t);throw r}}async function mw(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let a,i;try{a=await async function(e,t,r=fetch){const n=await async function(e,t,r,n){const o=new URL(e),s=n?.protocolVersion??Do;let a;if(n?.metadataUrl)a=new URL(n.metadataUrl);else{const e=function(e,t="",r={}){t.endsWith("/")&&(t=t.slice(0,-1));return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}(t,o.pathname);a=new URL(e,n?.metadataServerUrl??o),a.search=o.search}let i=await _w(a,s,r);if(!n?.metadataUrl&&function(e,t){return!e||e.status>=400&&e.status<500&&"/"!==t}(i,o.pathname)){const e=new URL(`/.well-known/${t}`,o);i=await _w(e,s,r)}return i}(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!n||404===n.status)throw await(n?.body?.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await(n.body?.cancel()),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return z_.parse(await n.json())}(t,{resourceMetadataUrl:o},s),a.authorization_servers&&a.authorization_servers.length>0&&(i=a.authorization_servers[0])}catch{}i||(i=new URL("/",t));const c=await async function(e,t,r){const n=function(e){const t="string"==typeof e?new URL(e):new URL(e.href);return t.hash="",t}(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r?.resource);if(!r)return;if(!function({requestedResource:e,configuredResource:t}){const r="string"==typeof e?new URL(e):new URL(e.href),n="string"==typeof t?new URL(t):new URL(t.href);if(r.origin!==n.origin)return!1;if(r.pathname.length<n.pathname.length)return!1;const o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}(t,e,a),u=await async function(e,{fetchFn:t=fetch,protocolVersion:r=Do}={}){const n={"MCP-Protocol-Version":r,Accept:"application/json"},o=function(e){const t="string"==typeof e?new URL(e):e,r="/"!==t.pathname,n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),n;let o=t.pathname;o.endsWith("/")&&(o=o.slice(0,-1));return n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),n}(e);for(const{url:e,type:r}of o){const o=await vw(e,n,t);if(o){if(!o.ok){if(await(o.body?.cancel()),o.status>=400&&o.status<500)continue;throw new Error(`HTTP ${o.status} trying to load ${"oauth"===r?"OAuth":"OpenID provider"} metadata from ${e}`)}return"oauth"===r?A_.parse(await o.json()):M_.parse(await o.json())}}return}(i,{fetchFn:s});let d=await Promise.resolve(e.clientInformation());if(!d){if(void 0!==r)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const t=!0===u?.client_id_metadata_document_supported,n=e.clientMetadataUrl;if(n&&!function(e){if(!e)return!1;try{const t=new URL(e);return"https:"===t.protocol&&"/"!==t.pathname}catch{return!1}}(n))throw new sw(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${n}`);if(t&&n)d={client_id:n},await(e.saveClientInformation?.(d));else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const t=await async function(e,{metadata:t,clientMetadata:r,fetchFn:n}){let o;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");o=new URL(t.registration_endpoint)}else o=new URL("/register",e);const s=await(n??fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok)throw await hw(s);return L_.parse(await s.json())}(i,{metadata:u,clientMetadata:e.clientMetadata,fetchFn:s});await e.saveClientInformation(t),d=t}}const p=!e.redirectUrl;if(void 0!==r||p){const t=await async function(e,t,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){const a=e.clientMetadata.scope;let i;e.prepareTokenRequest&&(i=await e.prepareTokenRequest(a));if(!i){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");i=function(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}(o,await e.codeVerifier(),e.redirectUrl)}const c=await e.clientInformation();return ww(t,{metadata:r,tokenRequestParams:i,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:s})}(e,i,{metadata:u,resource:c,authorizationCode:r,fetchFn:s});return await e.saveTokens(t),"AUTHORIZED"}const h=await e.tokens();if(h?.refresh_token)try{const t=await async function(e,{metadata:t,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:a}){const i=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await ww(e,{metadata:t,tokenRequestParams:i,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:a});return{refresh_token:n,...c}}(i,{metadata:u,clientInformation:d,refreshToken:h.refresh_token,resource:c,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens(t),"AUTHORIZED"}catch(e){if(e instanceof H_&&!(e instanceof Y_))throw e}const f=e.state?await e.state():void 0,{authorizationUrl:m,codeVerifier:y}=await async function(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:a}){let i;if(t){if(i=new URL(t.authorization_endpoint),!t.response_types_supported.includes(uw))throw new Error(`Incompatible auth server: does not support response type ${uw}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(dw))throw new Error(`Incompatible auth server: does not support code challenge method ${dw}`)}else i=new URL("/authorize",e);const c=await l(),u=c.code_verifier,d=c.code_challenge;i.searchParams.set("response_type",uw),i.searchParams.set("client_id",r.client_id),i.searchParams.set("code_challenge",d),i.searchParams.set("code_challenge_method",dw),i.searchParams.set("redirect_uri",String(n)),s&&i.searchParams.set("state",s);o&&i.searchParams.set("scope",o);o?.includes("offline_access")&&i.searchParams.append("prompt","consent");a&&i.searchParams.set("resource",a.href);return{authorizationUrl:i,codeVerifier:u}}(i,{metadata:u,clientInformation:d,state:f,redirectUrl:e.redirectUrl,scope:n||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,resource:c});return await e.saveCodeVerifier(y),await e.redirectToAuthorization(m),"REDIRECT"}function yw(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[r,n]=t.split(" ");if("bearer"!==r.toLowerCase()||!n)return{};const o=gw(e,"resource_metadata")||void 0;let s;if(o)try{s=new URL(o)}catch{}return{resourceMetadataUrl:s,scope:gw(e,"scope")||void 0,error:gw(e,"error")||void 0}}function gw(e,t){const r=e.headers.get("WWW-Authenticate");if(!r)return null;const n=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function vw(e,t,r=fetch){try{return await r(e,{headers:t})}catch(n){if(n instanceof TypeError)return t?vw(e,void 0,r):void 0;throw n}}async function _w(e,t,r=fetch){const n={"MCP-Protocol-Version":t};return await vw(e,n,r)}async function ww(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:a}){const i=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),o)await o(c,r,i,t);else if(n){const e=function(e,t){const r=void 0!==e.client_secret;return 0===t.length?r?"client_secret_post":"none":"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&(n=e.token_endpoint_auth_method,["client_secret_basic","client_secret_post","none"].includes(n))&&t.includes(e.token_endpoint_auth_method)?e.token_endpoint_auth_method:r&&t.includes("client_secret_basic")?"client_secret_basic":r&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":r?"client_secret_post":"none";var n}(n,t?.token_endpoint_auth_methods_supported??[]);pw(e,n,c,r)}const l=await(a??fetch)(i,{method:"POST",headers:c,body:r});if(!l.ok)throw await hw(l);return U_.parse(await l.json())}class $w extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function bw(e){}function kw(e){if("function"==typeof e)throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=bw,onError:r=bw,onRetry:n=bw,onComment:o}=e;let s,a="",i=!0,c="",l="";function u(e){if(""===e)return c.length>0&&t({id:s,event:l||void 0,data:c.endsWith("\n")?c.slice(0,-1):c}),s=void 0,c="",void(l="");if(e.startsWith(":"))return void(o&&o(e.slice(e.startsWith(": ")?2:1)));const r=e.indexOf(":");if(-1!==r){const t=e.slice(0,r),n=" "===e[r+1]?2:1;return void d(t,e.slice(r+n),e)}d(e,"",e)}function d(e,t,o){switch(e){case"event":l=t;break;case"data":c=`${c}${t}\n`;break;case"id":s=t.includes("\0")?void 0:t;break;case"retry":/^\d+$/.test(t)?n(parseInt(t,10)):r(new $w(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:o}));break;default:r(new $w(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:"unknown-field",field:e,value:t,line:o}))}}return{feed:function(e){const t=i?e.replace(/^\xEF\xBB\xBF/,""):e,[r,n]=function(e){const t=[];let r="",n=0;for(;n<e.length;){const o=e.indexOf("\r",n),s=e.indexOf("\n",n);let a=-1;if(-1!==o&&-1!==s?a=Math.min(o,s):-1!==o?a=o:-1!==s&&(a=s),-1===a){r=e.slice(n);break}{const r=e.slice(n,a);t.push(r),n=a+1,"\r"===e[n-1]&&"\n"===e[n]&&n++}}return[t,r]}(`${a}${t}`);for(const e of r)u(e);a=n,i=!1},reset:function(e={}){a&&e.consume&&u(a),i=!0,s=void 0,c="",l="",a=""}}}class Ew extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let n;super({start(o){n=kw({onEvent:e=>{o.enqueue(e)},onError(t){"terminate"===e?o.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:r})},transform(e){n.feed(e)}})}}const Pw={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Sw extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}}class Tw{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=function(e=fetch,t){return t?async(r,n)=>{const o={...t,...n,headers:n?.headers?{...j_(t.headers),...j_(n.headers)}:t.headers};return e(r,o)}:e}(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??Pw}async _authThenStart(){if(!this._authProvider)throw new lw("No auth provider");let e;try{e=await fw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(e){throw this.onerror?.(e),e}if("AUTHORIZED"!==e)throw new lw;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){const e={};if(this._authProvider){const t=await this._authProvider.tokens();t&&(e.Authorization=`Bearer ${t.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);const t=j_(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){const{resumptionToken:t}=e;try{const r=await this._commonHeaders();r.set("Accept","text/event-stream"),t&&r.set("last-event-id",t);const n=await(this._fetch??fetch)(this._url,{method:"GET",headers:r,signal:this._abortController?.signal});if(!n.ok){if(await(n.body?.cancel()),401===n.status&&this._authProvider)return await this._authThenStart();if(405===n.status)return;throw new Sw(n.status,`Failed to open SSE stream: ${n.statusText}`)}this._handleSseStream(n.body,e,!0)}catch(e){throw this.onerror?.(e),e}}_getNextReconnectionDelay(e){if(void 0!==this._serverRetryMs)return this._serverRetryMs;const t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(r,e),n)}_scheduleReconnection(e,t=0){const r=this._reconnectionOptions.maxRetries;if(t>=r)return void this.onerror?.(new Error(`Maximum reconnection attempts (${r}) exceeded.`));const n=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(r=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${r instanceof Error?r.message:String(r)}`)),this._scheduleReconnection(e,t+1)})},n)}_handleSseStream(e,t,r){if(!e)return;const{onresumptiontoken:n,replayMessageId:o}=t;let s,a=!1,i=!1;(async()=>{try{const t=e.pipeThrough(new TextDecoderStream).pipeThrough(new Ew({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){const{value:e,done:r}=await t.read();if(r)break;if(e.id&&(s=e.id,a=!0,n?.(e.id)),e.data&&(!e.event||"message"===e.event))try{const t=us.parse(JSON.parse(e.data));is(t)&&(i=!0,void 0!==o&&(t.id=o)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(r||a)&&!i&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:s,onresumptiontoken:n,replayMessageId:o},0)}catch(e){this.onerror?.(new Error(`SSE stream disconnected: ${e}`));if((r||a)&&!i&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:n,replayMessageId:o},0)}catch(e){this.onerror?.(new Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new lw("No auth provider");if("AUTHORIZED"!==await fw(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit}))throw new lw("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{const{resumptionToken:n,onresumptiontoken:o}=t||{};if(n)return void this._startOrAuthSse({resumptionToken:n,replayMessageId:os(e)?e.id:void 0}).catch(e=>this.onerror?.(e));const s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");const a={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._url,a),c=i.headers.get("mcp-session-id");if(c&&(this._sessionId=c),!i.ok){const t=await i.text().catch(()=>null);if(401===i.status&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Sw(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:t,scope:r}=yw(i);this._resourceMetadataUrl=t,this._scope=r;if("AUTHORIZED"!==await fw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit}))throw new lw;return this._hasCompletedAuthFlow=!0,this.send(e)}if(403===i.status&&this._authProvider){const{resourceMetadataUrl:t,scope:r,error:n}=yw(i);if("insufficient_scope"===n){const n=i.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===n)throw new Sw(403,"Server returned 403 after trying upscoping");r&&(this._scope=r),t&&(this._resourceMetadataUrl=t),this._lastUpscopingHeader=n??void 0;if("AUTHORIZED"!==await fw(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch}))throw new lw;return this.send(e)}}throw new Sw(i.status,`Error POSTing to endpoint: ${t}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,202===i.status)return await(i.body?.cancel()),r=e,void(Ts.safeParse(r).success&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e)));const l=(Array.isArray(e)?e:[e]).filter(e=>"method"in e&&"id"in e&&void 0!==e.id).length>0,u=i.headers.get("content-type");if(l)if(u?.includes("text/event-stream"))this._handleSseStream(i.body,{onresumptiontoken:o},!1);else{if(!u?.includes("application/json"))throw await(i.body?.cancel()),new Sw(-1,`Unexpected content type: ${u}`);{const e=await i.json(),t=Array.isArray(e)?e.map(e=>us.parse(e)):[us.parse(e)];for(const e of t)this.onmessage?.(e)}}else await(i.body?.cancel())}catch(e){throw this.onerror?.(e),e}var r}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{const e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await(this._fetch??fetch)(this._url,t);if(await(r.body?.cancel()),!r.ok&&405!==r.status)throw new Sw(r.status,`Failed to terminate session: ${r.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}}const xw=M("quickstart");async function Iw(e,t,r={}){const{serverId:n,serverSlug:o,proxyBaseUrl:s="http://proxy-ingress:8080",transport:a="streamable-http"}=r,i=n||o||t;let c;try{c=await e.getServer(i)}catch(e){if(e instanceof g&&404===e.statusCode)throw new v(i);throw e}const l=c.slug||i;let u;if(z(e.token)){u=`${O(e.token).baseUrl}/mcp/${l}`}else{xw.warn("Token has no organization information, using static config for MCP connection");u=`${R().baseUrl}/mcp/${l}`}return[{url:u,transport:a,headers:{Accept:"application/json, text/event-stream",Authorization:`Bearer ${e.token}`,"x-barndoor-session-id":Cw()}},u]}function Cw(){if(I&&"function"==typeof o.randomUUID)return o.randomUUID();if("undefined"!=typeof globalThis&&globalThis.crypto?.randomUUID)return globalThis.crypto.randomUUID();let e;if(I&&"function"==typeof o.randomBytes)e=o.randomBytes(16);else{if("undefined"==typeof globalThis||!globalThis.crypto?.getRandomValues)throw new Error("Secure random generator not available for UUID.");e=new Uint8Array(16),globalThis.crypto.getRandomValues(e)}const t=e??new Uint8Array(0);if(t.length<16)throw new Error("Secure random generator not available for UUID.");const r=t[6],n=t[8];t[6]=15&r|64,t[8]=63&n|128;const s=Array.from(t,e=>e.toString(16).padStart(2,"0")).join("");return`${s.substring(0,8)}-${s.substring(8,12)}-${s.substring(12,16)}-${s.substring(16,20)}-${s.substring(20)}`}const Nw=function(){try{if("undefined"!=typeof process&&process.versions?.node){const e=a.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(e).href:d&&"SCRIPT"===d.tagName.toUpperCase()&&d.src||new URL("index.js",document.baseURI).href),r=t.dirname(e),n=t.join(r,"..","package.json");return JSON.parse(u.readFileSync(n,"utf8")).version}return'"1.3.0"'}catch(e){return console.warn("Could not read version from package.json:",e),"0.1.0"}}();exports.AUTH_CONFIG=T,exports.AgentToken=S,exports.AuthenticationError=h,exports.BarndoorConfig=N,exports.BarndoorError=p,exports.BarndoorSDK=ie,exports.ConfigurationError=w,exports.ConnectionError=y,exports.HTTPError=g,exports.OAuthError=_,exports.PKCEManager=te,exports.ServerDetail=P,exports.ServerNotFoundError=v,exports.ServerSummary=E,exports.TimeoutError=$,exports.TokenError=f,exports.TokenExpiredError=m,exports.TokenManager=Y,exports.TokenValidationError=class extends f{},exports.checkTokenOrganization=function(e){return j(e)},exports.clearCachedToken=async function(){const e=W();await e.clearToken()},exports.clearOidcConfigCache=function(){D.clear()},exports.createScopedLogger=M,exports.debug=function(e,...t){A.debug(e,...t)},exports.ensureServerConnected=async function(e,t,r={}){const{timeout:n=90}=r;xw.info(`Ensuring ${t} server is connected`);try{await e.ensureServerConnected(t,{pollSeconds:n}),xw.info(`Server ${t} connected successfully`)}catch(e){throw e instanceof v?xw.error(`Server '${t}' not found`):xw.error(`Failed to connect to ${t}:`,e),e}},exports.error=function(e,...t){A.error(e,...t)},exports.getClientCredentialsToken=ae,exports.getDynamicConfig=O,exports.getLogger=function(){return A},exports.getOidcConfig=q,exports.getStaticConfig=R,exports.hasOrganizationInfo=z,exports.info=function(e,...t){A.info(e,...t)},exports.isBrowser=x,exports.isNode=I,exports.isTokenActive=async function(e){try{const e=W(),t=await e.loadToken();if(!t?.access_token)return!1;const r=R(),n=(await q(r.authIssuer)).userinfo_endpoint,o=fetch(n,{headers:{Authorization:`Bearer ${t.access_token}`},..."undefined"!=typeof AbortSignal&&"timeout"in AbortSignal?{signal:AbortSignal.timeout(1e4)}:{}});return(await F(o,1e4)).ok}catch(e){return!1}},exports.isTokenActiveWithRefresh=async function(e){try{const t=new Y(e||"");return await t.getValidToken(),!0}catch(e){return U.warn("Token validation/refresh failed:",e),!1}},exports.loadUserToken=X,exports.loginInteractive=async function(t={}){if(!I)throw new Error("Interactive login is only available in Node.js environment");xw.info("Starting interactive login flow");const r=R();let n;n=t.authIssuer?t.authIssuer:t.authDomain?t.authDomain.startsWith("http")?t.authDomain:`https://${t.authDomain}`:r.authIssuer;const{clientId:o=r.clientId,clientSecret:s=r.clientSecret,audience:a=r.apiAudience,baseUrl:l,port:u=52765}=t;if(!o||!s)throw new Error("AGENT_CLIENT_ID / AGENT_CLIENT_SECRET not set – create a .env file or export in the shell");const d=await X();if(d)try{let e;z(d)?e=O(d):(xw.warn("Cached token has no organization information, using static config"),e=R());const t=new ie(e.baseUrl,{token:d});return await t.validateCachedToken(),xw.info("Using cached valid token"),t}catch(e){xw.info("Cached token invalid, starting OAuth flow")}else xw.info("No cached token, starting OAuth flow");const p="undefined"!=typeof process&&!(!process.env||"1"!==process.env.BARNDOOR_MANUAL_CODE&&"true"!==process.env.BARNDOOR_MANUAL_CODE);let h,f=null;if(p){const e=process.env&&process.env.BARNDOOR_REDIRECT_HOST||"127.0.0.1";h=e.startsWith("http")?`${e}:${u}/cb`:`http://${e}:${u}/cb`}else{const e=oe(u);h=e[0],f=e[1]}const m=new te,y=await m.buildAuthorizationUrl({clientId:o,redirectUri:h,audience:a,issuer:n});xw.info(`Auth URL: ${y}`);const g=e.platform();let v,_;try{v=new URL(y)}catch{throw new Error("Invalid auth URL")}if("https:"!==v.protocol&&("http:"!==v.protocol||"localhost"!==v.hostname&&"127.0.0.1"!==v.hostname))throw new Error("Auth URL must use HTTPS (http allowed only for localhost)");try{"darwin"===g?i.spawn("open",[y],{detached:!0,stdio:"ignore"}).unref():"win32"===g?i.spawn("powershell",["-NoProfile","Start-Process",y],{detached:!0,stdio:"ignore"}).unref():i.spawn("xdg-open",[y],{detached:!0,stdio:"ignore"}).unref(),xw.info("Please complete login in your browser…")}catch(e){xw.warn("Failed to open browser automatically. Please visit:",y)}if(p){const e=await new Promise(e=>{const t=c.createInterface({input:process.stdin,output:process.stdout});t.question("Paste the full redirected URL (or just the code= value): ",r=>{t.close(),e(r.trim())})});try{const t=new URL(e);_=t.searchParams.get("code")||e}catch{_=e}}else{const e=new Promise((e,t)=>{setTimeout(()=>{t(new Error(`OAuth callback timeout after 2 minutes. This usually means the callback URL is not registered in Auth0. Please add "${h}" to Allowed Callback URLs in your Auth0 application settings.`))},12e4)});_=(await Promise.race([f,e]))[0]}const w=await m.exchangeCodeForToken({clientId:o,clientSecret:s,code:_,redirectUri:h,issuer:n});let $;if(await ee(w),l)$=l;else if(z(w.access_token)){$=O(w.access_token).baseUrl}else xw.warn("New token has no organization information, using static config"),$=R().baseUrl;return new ie($,{token:w.access_token})},exports.makeMcpClient=async function(e,t,r={}){const[n]=await Iw(e,t,r),o=n,s=new N_({name:"barndoor-js-sdk",version:"0.1.0"}),a=new Tw(new URL(o.url),{requestInit:{headers:o.headers}});return await s.connect(a),s},exports.makeMcpConnectionParams=Iw,exports.saveUserToken=ee,exports.setLogger=function(e){A=e},exports.setTokenLogger=function(e){console.warn("setTokenLogger is deprecated. Use setLogger from the main logging module instead.")},exports.startLocalCallbackServer=oe,exports.validateToken=async function(e,t){try{const t=R(),r=await B(e,t.authIssuer,t.apiAudience);if(r===exports.JWTVerificationResult.VALID)return{valid:!0};if(r===exports.JWTVerificationResult.INVALID)try{const r=(await q(t.authIssuer)).userinfo_endpoint,n=fetch(r,{headers:{Authorization:`Bearer ${e}`},..."undefined"!=typeof AbortSignal&&"timeout"in AbortSignal?{signal:AbortSignal.timeout(5e3)}:{}});return{valid:(await F(n,5e3)).ok}}catch(e){return U.warn("Remote token validation failed:",e),{valid:!1}}return{valid:!1}}catch(e){return U.warn("Token validation failed:",e),{valid:!1}}},exports.verifyJWTLocal=B,exports.version=Nw,exports.warn=function(e,...t){A.warn(e,...t)};
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /* tslint:disable */
18
+ /* eslint-disable */
19
+ __exportStar(require("./runtime.js"), exports);
20
+ __exportStar(require("./apis/index.js"), exports);
21
+ __exportStar(require("./models/index.js"), exports);
22
+ __exportStar(require("./lib/index.js"), exports);