@eva_solutions/auth-sdk 0.0.0-stage → 3.0.0-dev-20261107051125

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 (205) hide show
  1. package/CHANGELOG.md +290 -0
  2. package/LICENSE +21 -0
  3. package/README.md +481 -2
  4. package/dist/admin/index.cjs +4 -0
  5. package/dist/admin/index.d.cts +2 -0
  6. package/dist/admin/index.d.ts +2 -0
  7. package/dist/admin/index.js +1 -0
  8. package/dist/admin-DjvuvuI8.js +408 -0
  9. package/dist/admin-DjvuvuI8.js.map +1 -0
  10. package/dist/admin-Q6lbWqLM.cjs +419 -0
  11. package/dist/admin-Q6lbWqLM.cjs.map +1 -0
  12. package/dist/api-path-2Ulruz7R.cjs +34 -0
  13. package/dist/api-path-2Ulruz7R.cjs.map +1 -0
  14. package/dist/api-path-B-vSkL2H.js +29 -0
  15. package/dist/api-path-B-vSkL2H.js.map +1 -0
  16. package/dist/auth-19r-Q6X2.js +84 -0
  17. package/dist/auth-19r-Q6X2.js.map +1 -0
  18. package/dist/auth-DX1N5JA4.cjs +131 -0
  19. package/dist/auth-DX1N5JA4.cjs.map +1 -0
  20. package/dist/auth-handlers-B3iJaPln.js +343 -0
  21. package/dist/auth-handlers-B3iJaPln.js.map +1 -0
  22. package/dist/auth-handlers-BTbXKJms.d.ts +15 -0
  23. package/dist/auth-handlers-BTbXKJms.d.ts.map +1 -0
  24. package/dist/auth-handlers-CDzGFDTu.cjs +404 -0
  25. package/dist/auth-handlers-CDzGFDTu.cjs.map +1 -0
  26. package/dist/auth-handlers-DRUUTEtW.d.cts +15 -0
  27. package/dist/auth-handlers-DRUUTEtW.d.cts.map +1 -0
  28. package/dist/catalog-CHPqldcj.cjs +172 -0
  29. package/dist/catalog-CHPqldcj.cjs.map +1 -0
  30. package/dist/catalog-CIqpzgsM.d.cts +75 -0
  31. package/dist/catalog-CIqpzgsM.d.cts.map +1 -0
  32. package/dist/catalog-CIqpzgsM.d.ts +75 -0
  33. package/dist/catalog-CIqpzgsM.d.ts.map +1 -0
  34. package/dist/catalog-DqPhtCKZ.js +95 -0
  35. package/dist/catalog-DqPhtCKZ.js.map +1 -0
  36. package/dist/config-D6Tr7ev6.d.cts +95 -0
  37. package/dist/config-D6Tr7ev6.d.cts.map +1 -0
  38. package/dist/config-rl4_-VAq.d.ts +95 -0
  39. package/dist/config-rl4_-VAq.d.ts.map +1 -0
  40. package/dist/constants-BE1_9Tod.cjs +52 -0
  41. package/dist/constants-BE1_9Tod.cjs.map +1 -0
  42. package/dist/constants-BY7QZokc.js +29 -0
  43. package/dist/constants-BY7QZokc.js.map +1 -0
  44. package/dist/constants-CcbhOaAP.cjs +153 -0
  45. package/dist/constants-CcbhOaAP.cjs.map +1 -0
  46. package/dist/constants-rNuD5qJn.js +94 -0
  47. package/dist/constants-rNuD5qJn.js.map +1 -0
  48. package/dist/contracts/index.cjs +1006 -0
  49. package/dist/contracts/index.cjs.map +1 -0
  50. package/dist/contracts/index.d.cts +488 -0
  51. package/dist/contracts/index.d.cts.map +1 -0
  52. package/dist/contracts/index.d.ts +488 -0
  53. package/dist/contracts/index.d.ts.map +1 -0
  54. package/dist/contracts/index.js +817 -0
  55. package/dist/contracts/index.js.map +1 -0
  56. package/dist/cookies-DCIcr7uy.cjs +94 -0
  57. package/dist/cookies-DCIcr7uy.cjs.map +1 -0
  58. package/dist/cookies-DKEC7AWv.js +71 -0
  59. package/dist/cookies-DKEC7AWv.js.map +1 -0
  60. package/dist/delegated-token-CVNbMNfy.js +426 -0
  61. package/dist/delegated-token-CVNbMNfy.js.map +1 -0
  62. package/dist/delegated-token-DHSK4rHI.cjs +461 -0
  63. package/dist/delegated-token-DHSK4rHI.cjs.map +1 -0
  64. package/dist/error-helpers-BenWu-_u.d.ts +105 -0
  65. package/dist/error-helpers-BenWu-_u.d.ts.map +1 -0
  66. package/dist/error-helpers-KBHUbkOM.d.cts +105 -0
  67. package/dist/error-helpers-KBHUbkOM.d.cts.map +1 -0
  68. package/dist/error-helpers-XCh4ZJ-g.cjs +282 -0
  69. package/dist/error-helpers-XCh4ZJ-g.cjs.map +1 -0
  70. package/dist/error-helpers-lnwgNOw9.js +145 -0
  71. package/dist/error-helpers-lnwgNOw9.js.map +1 -0
  72. package/dist/error-messages-CGpW1fsg.d.cts +48 -0
  73. package/dist/error-messages-CGpW1fsg.d.cts.map +1 -0
  74. package/dist/error-messages-CGpW1fsg.d.ts +48 -0
  75. package/dist/error-messages-CGpW1fsg.d.ts.map +1 -0
  76. package/dist/event-codes-BBJHon-I.cjs +48 -0
  77. package/dist/event-codes-BBJHon-I.cjs.map +1 -0
  78. package/dist/event-codes-BgcJWsov.d.cts +42 -0
  79. package/dist/event-codes-BgcJWsov.d.cts.map +1 -0
  80. package/dist/event-codes-BgcJWsov.d.ts +42 -0
  81. package/dist/event-codes-BgcJWsov.d.ts.map +1 -0
  82. package/dist/event-codes-DR5_VlaR.js +43 -0
  83. package/dist/event-codes-DR5_VlaR.js.map +1 -0
  84. package/dist/generic/index.cjs +91 -0
  85. package/dist/generic/index.cjs.map +1 -0
  86. package/dist/generic/index.d.cts +27 -0
  87. package/dist/generic/index.d.cts.map +1 -0
  88. package/dist/generic/index.d.ts +27 -0
  89. package/dist/generic/index.d.ts.map +1 -0
  90. package/dist/generic/index.js +80 -0
  91. package/dist/generic/index.js.map +1 -0
  92. package/dist/hono/index.cjs +309 -0
  93. package/dist/hono/index.cjs.map +1 -0
  94. package/dist/hono/index.d.cts +272 -0
  95. package/dist/hono/index.d.cts.map +1 -0
  96. package/dist/hono/index.d.ts +272 -0
  97. package/dist/hono/index.d.ts.map +1 -0
  98. package/dist/hono/index.js +290 -0
  99. package/dist/hono/index.js.map +1 -0
  100. package/dist/hono-openapi/index.cjs +326 -0
  101. package/dist/hono-openapi/index.cjs.map +1 -0
  102. package/dist/hono-openapi/index.d.cts +14 -0
  103. package/dist/hono-openapi/index.d.cts.map +1 -0
  104. package/dist/hono-openapi/index.d.ts +14 -0
  105. package/dist/hono-openapi/index.d.ts.map +1 -0
  106. package/dist/hono-openapi/index.js +307 -0
  107. package/dist/hono-openapi/index.js.map +1 -0
  108. package/dist/http-client-BVF3iktR.cjs +211 -0
  109. package/dist/http-client-BVF3iktR.cjs.map +1 -0
  110. package/dist/http-client-Da0-OMfc.js +206 -0
  111. package/dist/http-client-Da0-OMfc.js.map +1 -0
  112. package/dist/index-BYzDaMR9.d.ts +312 -0
  113. package/dist/index-BYzDaMR9.d.ts.map +1 -0
  114. package/dist/index-CNNMCrdl.d.ts +66 -0
  115. package/dist/index-CNNMCrdl.d.ts.map +1 -0
  116. package/dist/index-DBZoLU4E.d.ts +240 -0
  117. package/dist/index-DBZoLU4E.d.ts.map +1 -0
  118. package/dist/index-DcvQWByo.d.cts +66 -0
  119. package/dist/index-DcvQWByo.d.cts.map +1 -0
  120. package/dist/index-Dold-Ycb.d.cts +1711 -0
  121. package/dist/index-Dold-Ycb.d.cts.map +1 -0
  122. package/dist/index-Dold-Ycb.d.ts +1711 -0
  123. package/dist/index-Dold-Ycb.d.ts.map +1 -0
  124. package/dist/index-jAO62-OD.d.cts +240 -0
  125. package/dist/index-jAO62-OD.d.cts.map +1 -0
  126. package/dist/index-o7nXcl7z.d.cts +312 -0
  127. package/dist/index-o7nXcl7z.d.cts.map +1 -0
  128. package/dist/index.cjs +89 -0
  129. package/dist/index.cjs.map +1 -0
  130. package/dist/index.d.cts +114 -0
  131. package/dist/index.d.cts.map +1 -0
  132. package/dist/index.d.ts +114 -0
  133. package/dist/index.d.ts.map +1 -0
  134. package/dist/index.js +28 -0
  135. package/dist/index.js.map +1 -0
  136. package/dist/jwt-BBNqk0TV.cjs +155 -0
  137. package/dist/jwt-BBNqk0TV.cjs.map +1 -0
  138. package/dist/jwt-DhqgH94B.js +150 -0
  139. package/dist/jwt-DhqgH94B.js.map +1 -0
  140. package/dist/key-resolver-CESqj4-P.cjs +45 -0
  141. package/dist/key-resolver-CESqj4-P.cjs.map +1 -0
  142. package/dist/key-resolver-D56I2Zpz.js +34 -0
  143. package/dist/key-resolver-D56I2Zpz.js.map +1 -0
  144. package/dist/parse-error-response-6qOQS5y9.cjs +316 -0
  145. package/dist/parse-error-response-6qOQS5y9.cjs.map +1 -0
  146. package/dist/parse-error-response-BM9-kjs0.js +239 -0
  147. package/dist/parse-error-response-BM9-kjs0.js.map +1 -0
  148. package/dist/path-segment-C25i6aaH.cjs +29 -0
  149. package/dist/path-segment-C25i6aaH.cjs.map +1 -0
  150. package/dist/path-segment-CyqnaFrP.js +24 -0
  151. package/dist/path-segment-CyqnaFrP.js.map +1 -0
  152. package/dist/react/index.cjs +336 -0
  153. package/dist/react/index.cjs.map +1 -0
  154. package/dist/react/index.d.cts +151 -0
  155. package/dist/react/index.d.cts.map +1 -0
  156. package/dist/react/index.d.ts +151 -0
  157. package/dist/react/index.d.ts.map +1 -0
  158. package/dist/react/index.js +300 -0
  159. package/dist/react/index.js.map +1 -0
  160. package/dist/refresh-dedup-CKaHHe7m.js +14 -0
  161. package/dist/refresh-dedup-CKaHHe7m.js.map +1 -0
  162. package/dist/refresh-dedup-CLdACQXR.cjs +19 -0
  163. package/dist/refresh-dedup-CLdACQXR.cjs.map +1 -0
  164. package/dist/rolldown-runtime-CmQyd0Gu.cjs +27 -0
  165. package/dist/routes-DpAzgY1V.cjs +424 -0
  166. package/dist/routes-DpAzgY1V.cjs.map +1 -0
  167. package/dist/routes-F1g5aVqP.js +347 -0
  168. package/dist/routes-F1g5aVqP.js.map +1 -0
  169. package/dist/s2s/index.cjs +24 -0
  170. package/dist/s2s/index.d.cts +5 -0
  171. package/dist/s2s/index.d.ts +5 -0
  172. package/dist/s2s/index.js +5 -0
  173. package/dist/s2s-6wbotr78.cjs +926 -0
  174. package/dist/s2s-6wbotr78.cjs.map +1 -0
  175. package/dist/s2s-B_0SIQzn.js +897 -0
  176. package/dist/s2s-B_0SIQzn.js.map +1 -0
  177. package/dist/sign-C7y6xdvT.cjs +324 -0
  178. package/dist/sign-C7y6xdvT.cjs.map +1 -0
  179. package/dist/sign-HFtcYwa-.js +259 -0
  180. package/dist/sign-HFtcYwa-.js.map +1 -0
  181. package/dist/tokens-C1nzkn21.cjs +232 -0
  182. package/dist/tokens-C1nzkn21.cjs.map +1 -0
  183. package/dist/tokens-C3Z40qd7.js +107 -0
  184. package/dist/tokens-C3Z40qd7.js.map +1 -0
  185. package/dist/types-B5sf7kKE.d.cts +52 -0
  186. package/dist/types-B5sf7kKE.d.cts.map +1 -0
  187. package/dist/types-CLOIHzRu.d.ts +96 -0
  188. package/dist/types-CLOIHzRu.d.ts.map +1 -0
  189. package/dist/types-CQTZdZIF.d.ts +52 -0
  190. package/dist/types-CQTZdZIF.d.ts.map +1 -0
  191. package/dist/types-DGeQ8j4k.d.cts +538 -0
  192. package/dist/types-DGeQ8j4k.d.cts.map +1 -0
  193. package/dist/types-DIUWza9-.d.ts +538 -0
  194. package/dist/types-DIUWza9-.d.ts.map +1 -0
  195. package/dist/types-qh6ANBCV.d.cts +96 -0
  196. package/dist/types-qh6ANBCV.d.cts.map +1 -0
  197. package/dist/webhooks/index.cjs +8 -0
  198. package/dist/webhooks/index.d.cts +5 -0
  199. package/dist/webhooks/index.d.ts +5 -0
  200. package/dist/webhooks/index.js +4 -0
  201. package/dist/webhooks-B5sAWC9W.js +74 -0
  202. package/dist/webhooks-B5sAWC9W.js.map +1 -0
  203. package/dist/webhooks-Cx11psg1.cjs +79 -0
  204. package/dist/webhooks-Cx11psg1.cjs.map +1 -0
  205. package/package.json +192 -3
@@ -0,0 +1,538 @@
1
+ import { Ar as UsersBatchResponse, At as CreateEmpresaRequest, Bt as ListEmpresasQuery, C as DeleteAutorizacionRequest, Ft as EmpresaMemberResponse, H as DirectorioQuery, J as CreateGrupoRequest, Jt as UpdateEmpresaMemberRequest, Lt as EmpresaRecortadaResponse, Mt as DeactivateSucursalRequest, Nt as EmpresaDetailResponse, O as VerificarAutorizacionQuery, Pt as EmpresaEstadoResponse, Q as RenameGrupoRequest, Rt as EmpresaResponse, S as CreateAutorizacionRequest, T as ListAutorizacionesResponse, U as DirectorioResponse, Vt as ListEmpresasResponse, Wt as RemoveEmpresaMemberRequest, X as GrupoResponse, Xt as UpdateSucursalRequest, Yt as UpdateEmpresaRequest, Z as RemoveGrupoEmpresaRequest, ar as CreateSubscriptionRequest, ct as SetContratacionRequest, gr as UpdateSubscriptionRequest, jt as CreateSucursalRequest, k as VerificarAutorizacionResponse, kr as UsersBatchRequest, kt as AddEmpresaMemberRequest, ot as ContratacionResponse, q as AddGrupoEmpresaRequest, qt as SucursalResponse, st as ContratadoResponse, w as ListAutorizacionesQuery, x as AutorizacionResponse, zr as ProfileResponse, zt as GetEmpresaResponse } from "./index-Dold-Ycb.cjs";
2
+ import { f as ServiceAudience, i as DelegableAudience } from "./catalog-CIqpzgsM.cjs";
3
+ import { d as Result } from "./types-qh6ANBCV.cjs";
4
+ import "./types-B5sf7kKE.cjs";
5
+ import { JWTVerifyGetKey } from "jose";
6
+ /** Tolerancia por defecto al desfase de relojes, en segundos. */
7
+ declare const SERVICE_TOKEN_CLOCK_TOLERANCE_SECONDS = 5;
8
+ /**
9
+ * Motivos de rechazo de `verifyServiceToken`.
10
+ *
11
+ * - `token_missing` — no hay `Authorization: Bearer <jwt>` (solo lo produce el middleware).
12
+ * - `token_malformed` — no es un JWT bien formado.
13
+ * - `token_expired` — `exp` ya pasó (más la tolerancia).
14
+ * - `signature_invalid` — firma inválida, `kid` ausente, de otro tipo o desconocido, o algoritmo distinto de ES256.
15
+ * - `claims_invalid` — `typ`, `iss`, `aud`, `sub`, `client_id`, `iat`/`exp` ausentes o fuera de rango, o vida mayor al máximo.
16
+ * - `scope_insufficient` — el claim `scope` no cubre el permiso requerido.
17
+ */
18
+ type ServiceTokenVerifyReason = 'token_missing' | 'token_malformed' | 'token_expired' | 'signature_invalid' | 'claims_invalid' | 'scope_insufficient';
19
+ type ServiceTokenVerifyError = {
20
+ reason: ServiceTokenVerifyReason;
21
+ message: string;
22
+ };
23
+ /** Datos verificados del token de servicio. */
24
+ type ServiceTokenClaims = {
25
+ /** `sub`: id interno estable del service client. Es la identidad; no cambia ni se reutiliza. */
26
+ serviceClientId: string;
27
+ /** `client_id`: slug del service client. Dato visible (logs, UI); no usarlo como identidad. */
28
+ serviceClientSlug: string;
29
+ /** Permisos del claim `scope` (separado por espacios). */
30
+ scopes: readonly string[];
31
+ /** `jti` del token, si lo trae. */
32
+ jti: string | undefined;
33
+ };
34
+ type ServiceTokenVerifyResult = {
35
+ ok: true;
36
+ data: ServiceTokenClaims;
37
+ } | {
38
+ ok: false;
39
+ error: ServiceTokenVerifyError;
40
+ };
41
+ /**
42
+ * Permiso exigido: uno concreto (`requiredScope`), al menos uno de varios (`anyScope`) o
43
+ * `scopeCheck: 'deferred'`, que no exige ninguno aquí y deja el permiso por ruta a `requireScope`
44
+ * (cadena Bearer + permiso por ruta). Es explícito para que olvidar el permiso no abra la ruta.
45
+ */
46
+ type ServiceTokenScopeRequirement = {
47
+ requiredScope: string;
48
+ anyScope?: never;
49
+ scopeCheck?: never;
50
+ } | {
51
+ anyScope: readonly string[];
52
+ requiredScope?: never;
53
+ scopeCheck?: never;
54
+ } | {
55
+ scopeCheck: 'deferred';
56
+ requiredScope?: never;
57
+ anyScope?: never;
58
+ };
59
+ type ServiceTokenVerifyOptions = ServiceTokenScopeRequirement & {
60
+ /**
61
+ * Audiencia propia del servicio receptor (`'whatsapp-api'`), del catálogo de `auth-contracts`.
62
+ * Un slug de producto o cualquier otro valor lanza `TypeError`.
63
+ */
64
+ audience: ServiceAudience;
65
+ /**
66
+ * Resolutor de claves. Por defecto el JWKS remoto del Auth Service (`getJwksKeyFn()`, requiere
67
+ * `configureEvaAuth({ authUrl })`). Inyectable para tests. Siempre se filtra por el prefijo
68
+ * `svc-`, también el inyectado.
69
+ */
70
+ jwks?: JWTVerifyGetKey;
71
+ /** Vida máxima aceptada (`exp - iat`). Default: `SERVICE_TOKEN_LIFETIME_SECONDS` (300). */
72
+ maxLifetimeSeconds?: number;
73
+ /** Tolerancia de reloj. Default: `SERVICE_TOKEN_CLOCK_TOLERANCE_SECONDS` (5). */
74
+ clockToleranceSeconds?: number;
75
+ /** Overrides de mensajes (i18n). Las keys no provistas usan el default en inglés. */
76
+ messages?: Partial<Record<ServiceTokenVerifyReason, string>>;
77
+ };
78
+ /**
79
+ * Verifica un token de servicio.
80
+ *
81
+ * Contrato del token (lo emite el Auth Service):
82
+ * - Header: `alg: 'ES256'`, `typ: 'svc-at+jwt'`, `kid` con prefijo `svc-`.
83
+ * - Claims: `iss: 'auth-service'`, `aud` (una sola, la del receptor), `sub` (id del service
84
+ * client), `client_id` (su slug), `scope` (separado por espacios), `iat`, `exp` (con
85
+ * `exp - iat` <= `maxLifetimeSeconds`) y `jti`.
86
+ *
87
+ * Un token de servicio es reutilizable dentro de su vida: no hay replay cache.
88
+ *
89
+ * @throws `TypeError` si `audience` no es del catálogo, si no se indica exactamente uno de
90
+ * `requiredScope` / `anyScope`, o si un permiso no pertenece a la audiencia.
91
+ * @throws Error de configuración (`EvaAuthConfigError`) si falta `authUrl` y no se inyecta `jwks`, y
92
+ * los fallos de red del JWKS: son errores de infraestructura, no un token inválido, así que no
93
+ * se degradan a un rechazo.
94
+ */
95
+ declare function verifyServiceToken(token: string, opts: ServiceTokenVerifyOptions): Promise<ServiceTokenVerifyResult>;
96
+ /** Motivos de rechazo: los mismos que los del token de servicio. */
97
+ type DelegatedTokenVerifyReason = ServiceTokenVerifyReason;
98
+ type DelegatedTokenVerifyError = {
99
+ reason: DelegatedTokenVerifyReason;
100
+ message: string;
101
+ };
102
+ /** Un actor de la cadena: el servicio que intercambió el token. */
103
+ type DelegatedActor = {
104
+ /** `act.sub`: id interno estable del service client. */
105
+ serviceClientId: string;
106
+ /** `act.client_id`: slug del service client. Dato visible, no identidad. */
107
+ serviceClientSlug: string;
108
+ };
109
+ /** Datos verificados del token delegado. */
110
+ type DelegatedTokenClaims = {
111
+ /** `sub`: el usuario en cuyo nombre se actúa. */
112
+ userId: string;
113
+ /** `empresa`: obligatoria e inmutable en toda la cadena. */
114
+ empresaId: string;
115
+ /** `producto`: producto de origen de la cadena. */
116
+ producto: string;
117
+ /** `sid`: sesión de origen. */
118
+ sessionId: string;
119
+ /**
120
+ * Cadena de actores, del último (quien llama a este servicio) al primero (quien partió del
121
+ * access token del usuario). Siempre tiene al menos uno y como máximo `DELEGATED_TOKEN_MAX_DEPTH`.
122
+ */
123
+ actorChain: readonly DelegatedActor[];
124
+ /** `client_id` del token: slug del actor, para logs y rate limit. */
125
+ clientId: string;
126
+ /** Permisos del claim `scope` (separado por espacios). */
127
+ scopes: readonly string[];
128
+ /** `jti` del token (obligatorio). */
129
+ jti: string;
130
+ };
131
+ type DelegatedTokenVerifyResult = {
132
+ ok: true;
133
+ data: DelegatedTokenClaims;
134
+ } | {
135
+ ok: false;
136
+ error: DelegatedTokenVerifyError;
137
+ };
138
+ type DelegatedTokenVerifyOptions = ServiceTokenScopeRequirement & {
139
+ /**
140
+ * Audiencia propia del servicio receptor, del catálogo delegable de `auth-contracts`. `auth-api`
141
+ * (o cualquier otro valor) lanza `TypeError`: Auth nunca es destino de un token delegado.
142
+ */
143
+ audience: DelegableAudience;
144
+ /** Resolutor de claves; por defecto el JWKS remoto. Siempre se filtra por el prefijo `svc-`. */
145
+ jwks?: JWTVerifyGetKey;
146
+ /** Vida máxima aceptada (`exp - iat`). Default: `DELEGATED_TOKEN_LIFETIME_SECONDS` (120). */
147
+ maxLifetimeSeconds?: number;
148
+ /** Tolerancia de reloj. Default: 5 s. */
149
+ clockToleranceSeconds?: number;
150
+ /** Overrides de mensajes (i18n). */
151
+ messages?: Partial<Record<DelegatedTokenVerifyReason, string>>;
152
+ };
153
+ /**
154
+ * Verifica un token delegado.
155
+ *
156
+ * Contrato del token (lo emite el Auth Service en `POST /internal/token-exchange`):
157
+ * - Header: `alg: 'ES256'`, `typ: 'dlg-at+jwt'`, `kid` con prefijo `svc-`.
158
+ * - Claims: `iss: 'auth-service'`, `aud` (una sola, la del receptor), `sub` (el usuario),
159
+ * `client_id`, `act` (cadena de actores), `empresa`, `producto` y `sid` (obligatorios: la
160
+ * empresa es inmutable en la cadena), `scope`, `iat`, `exp` (con `exp - iat` <=
161
+ * `maxLifetimeSeconds`) y `jti`.
162
+ *
163
+ * Un token delegado sin empresa se rechaza (`claims_invalid`): la delegación sin empresa no existe.
164
+ * Es reutilizable dentro de su vida (120 s): no hay replay cache.
165
+ *
166
+ * @throws `TypeError` si `audience` no es delegable o los permisos exigidos no lo son.
167
+ * @throws Error de configuración si falta `authUrl` y no se inyecta `jwks`, y los fallos de red del
168
+ * JWKS (son de infraestructura, no un token inválido).
169
+ */
170
+ declare function verifyDelegatedToken(token: string, opts: DelegatedTokenVerifyOptions): Promise<DelegatedTokenVerifyResult>;
171
+ /** Cuánto antes del vencimiento se renueva el token, en milisegundos. */
172
+ declare const SERVICE_TOKEN_RENEW_MARGIN_MS = 30000;
173
+ type ServiceTokenProviderConfig = {
174
+ /**
175
+ * URL base del Auth Service (sin `/api/v1`). Se requiere https (o http con host loopback para
176
+ * tests); admite path (`https://host/auth`).
177
+ */
178
+ authUrl: string;
179
+ /** Slug del service client (`clientId`) que firma el pedido. */
180
+ clientId: string;
181
+ /** Clave del service client en hex (64 chars). Nunca viaja: solo firma el pedido. */
182
+ secretHex: string;
183
+ /** Servicio destino del token (`'auth-api'`, `'whatsapp-api'`). */
184
+ audience: string;
185
+ /** Permisos pedidos separados por espacio. Si falta, se piden todos los concedidos. */
186
+ scope?: string;
187
+ };
188
+ /**
189
+ * What the clients that call a service need from a provider: a token and a way to drop a rejected
190
+ * one. `createServiceTokenProvider` returns more ({@link ServiceTokenProvider}); a hand-made source
191
+ * (tests, another credential flow) only needs these two.
192
+ */
193
+ type ServiceTokenSource = {
194
+ /**
195
+ * Devuelve un token vigente: el guardado mientras falten más de 30 s para su vencimiento, o uno
196
+ * nuevo. Los pedidos simultáneos comparten una sola llamada al Auth Service.
197
+ * @throws {ServiceTokenRequestError} si el Auth Service rechaza el pedido; `Error` de red si no responde.
198
+ */
199
+ getToken(): Promise<string>;
200
+ /**
201
+ * Descarta el token guardado para que la próxima `getToken()` pida uno nuevo. Úsalo cuando el
202
+ * servicio destino responde 401 con un token que creías vigente, pasando ESE token:
203
+ * solo se descarta si sigue siendo el guardado. Así, N respuestas 401 simultáneas del mismo
204
+ * token provocan UN pedido nuevo (la primera descarta; las demás ven que ya no es el guardado
205
+ * y comparten el pedido en curso o el token renovado). Nunca descarta un pedido en curso.
206
+ * Sin argumento descarta el token guardado, sea cual sea.
207
+ */
208
+ invalidate(rejectedToken?: string): void;
209
+ };
210
+ /** Input of {@link ServiceTokenProvider.exchangeToken}. */
211
+ type ExchangeTokenInput = {
212
+ /**
213
+ * Token to exchange: the access token of the user (`aud` = product of this actor) or a delegated
214
+ * token (`aud` = audience of this actor, for a re-exchange). Pass one your service has ALREADY
215
+ * verified (`verifyAccessToken`, `verifyDelegatedToken` or the middleware): the SDK does not.
216
+ */
217
+ subjectToken: string;
218
+ /** Destination service of the delegated token: one audience with a delegation edge from this client. Never `auth-api`. */
219
+ audience: string;
220
+ /** Permissions asked for, separated by space. If absent, everything delegable on that edge. */
221
+ scope?: string;
222
+ };
223
+ /** A delegated token (`typ: dlg-at+jwt`) and the permissions it carries. */
224
+ type DelegatedTokenGrant = {
225
+ accessToken: string;
226
+ /** Permissions issued, separated by space (they can be fewer than asked for). */
227
+ scope: string;
228
+ };
229
+ /**
230
+ * Provider of service tokens for ONE (audience, scope), plus the token exchange of the same client.
231
+ */
232
+ type ServiceTokenProvider = ServiceTokenSource & {
233
+ /**
234
+ * Exchanges a subject token for a delegated one (RFC 8693) so this service can call another one
235
+ * on behalf of the user. Authenticates with its own service token (`aud: auth-api`, permission
236
+ * `tokens:exchange`), which it obtains and renews by itself whatever the audience of this
237
+ * provider is.
238
+ *
239
+ * Caches the delegated token in this isolate until 30 s before its `exp` (it lives 120 s). The
240
+ * key is the audience, the scope and a fingerprint of the WHOLE subject token: a token with other
241
+ * claims (another session, user or company), or the same re-exchanged from another token of the
242
+ * chain (other `jti`), never reuses an entry. Errors are not cached.
243
+ *
244
+ * Returns a Result: `invalid_grant` (session closed, user or company out, product not contracted,
245
+ * depth or cycle) is a normal answer, not an exception. The failures of Auth keep their RFC code
246
+ * in `error.code` (`invalid_grant`, `invalid_target`, `invalid_scope`, `invalid_client`, ...).
247
+ */
248
+ exchangeToken(input: ExchangeTokenInput): Promise<Result<DelegatedTokenGrant>>;
249
+ };
250
+ /** El Auth Service rechazó el pedido de token. `code` es el `error` de RFC 6749 (`invalid_client`, …). */
251
+ declare class ServiceTokenRequestError extends Error {
252
+ readonly code: string;
253
+ readonly status: number;
254
+ /** Segundos de espera que pidió Auth con `Retry-After` (429 / 503), si los mandó. */
255
+ readonly retryAfterSeconds?: number;
256
+ constructor(code: string, status: number, description?: string, retryAfterSeconds?: number);
257
+ }
258
+ /**
259
+ * Crea un proveedor de tokens de servicio.
260
+ *
261
+ * Deduplica los pedidos simultáneos dentro del mismo proceso (isolate): N llamadas concurrentes a
262
+ * `getToken()` con el caché vacío o vencido hacen UN pedido al Auth Service. Un pedido fallido no
263
+ * se guarda: la siguiente llamada reintenta.
264
+ *
265
+ * Valida su configuración al crearse (audiencia del catálogo, permisos de esa audiencia, clave hex).
266
+ *
267
+ * @example
268
+ * ```ts
269
+ * const provider = createServiceTokenProvider({
270
+ * authUrl: env.AUTH_URL,
271
+ * clientId: env.AUTH_CLIENT_ID,
272
+ * secretHex: env.AUTH_CLIENT_SECRET_HEX,
273
+ * audience: 'auth-api',
274
+ * })
275
+ * const s2s = createS2SClient({ baseUrl: env.AUTH_URL, tokenProvider: provider })
276
+ * ```
277
+ */
278
+ declare function createServiceTokenProvider(config: ServiceTokenProviderConfig): ServiceTokenProvider;
279
+ /**
280
+ * Configuración del cliente S2S.
281
+ */
282
+ type S2SClientConfig = {
283
+ /**
284
+ * URL base del Auth Service API (sin trailing slash).
285
+ * Validada en `createS2SClient`: se requiere https (o http con host loopback para tests).
286
+ */
287
+ baseUrl: string;
288
+ /**
289
+ * Proveedor del token de servicio con audiencia `auth-api` (`createServiceTokenProvider`). El
290
+ * cliente lo usa en cada llamada y, ante un 401, lo invalida y reintenta una vez.
291
+ */
292
+ tokenProvider: ServiceTokenSource;
293
+ };
294
+ /**
295
+ * Partes del request necesarias para construir el canonical string SigV4-style
296
+ * (7 líneas: método, path, query, timestamp, nonce, clientId, hash del body).
297
+ */
298
+ type S2SCanonicalParts = {
299
+ /** HTTP method en uppercase (GET, POST, PATCH, DELETE). */
300
+ method: string;
301
+ /** Pathname del request sin query string ni fragment. */
302
+ path: string;
303
+ /** Query string crudo (sin el `?`). String vacío si no hay query. */
304
+ rawQuery: string;
305
+ /** Unix timestamp en segundos como string decimal. */
306
+ timestamp: string;
307
+ /** Nonce del request: 32 hex en minúsculas (ver `generateS2SNonce`). */
308
+ nonce: string;
309
+ /** Slug del service client (clientId). */
310
+ clientId: string;
311
+ /** Bytes raw del body. GET/sin body → `new Uint8Array(0)`. */
312
+ bodyBytes: Uint8Array;
313
+ };
314
+ /**
315
+ * Resultado de `getUser` — perfil público del usuario (alias del `data` de la respuesta del
316
+ * contrato). El wire es `{ data: perfil }` y `result.data` es el perfil directamente, sin
317
+ * envoltorio. Un usuario inexistente o soft-deleted llega como error `user_not_found` (404).
318
+ */
319
+ type S2SGetUserResult = ProfileResponse['data'];
320
+ /**
321
+ * Input para `batchUsers` — lista de IDs a consultar (alias del request del contrato).
322
+ * El tope de `USERS_BATCH_MAX_IDS` lo aplica el cliente, no el tipo.
323
+ */
324
+ type S2SBatchUsersInput = UsersBatchRequest;
325
+ /**
326
+ * Resultado de `batchUsers` — usuarios activos encontrados (alias del `data` de la respuesta del
327
+ * contrato). IDs inválidos, inexistentes o soft-deleted se omiten.
328
+ */
329
+ type S2SBatchUsersResult = UsersBatchResponse['data'];
330
+ /**
331
+ * Input para crear una subscription de webhook (alias del request del contrato): `url` donde el
332
+ * Auth Service enviará los eventos, `eventCodes` a suscribir (al menos uno) y `enabled` (por
333
+ * defecto `true` en el API).
334
+ */
335
+ type CreateWebhookSubscriptionInput = CreateSubscriptionRequest;
336
+ /**
337
+ * Input para actualizar una subscription de webhook (patch parcial; alias del request del
338
+ * contrato).
339
+ */
340
+ type UpdateWebhookSubscriptionInput = UpdateSubscriptionRequest;
341
+ /**
342
+ * Query params para listar deliveries.
343
+ *
344
+ * Tipo propio del SDK, no alias del contrato: el query del contrato coacciona strings a números y
345
+ * por eso su tipo de entrada es `unknown`; aquí `limit` y `offset` son `number`.
346
+ */
347
+ type ListWebhookDeliveriesQuery = {
348
+ event_id?: string;
349
+ subscription_id?: string;
350
+ status?: 'pending' | 'delivering' | 'success' | 'expired';
351
+ limit?: number;
352
+ offset?: number;
353
+ };
354
+ /**
355
+ * Toda acción de una persona sobre una empresa lleva su access token como `subjectToken`: el
356
+ * backend del producto manda su token de servicio y, en el body, el token de la persona.
357
+ */
358
+ type SubjectTokenInput = RemoveEmpresaMemberRequest;
359
+ /**
360
+ * Input para crear una empresa (alias del request del contrato). La persona del `subjectToken`
361
+ * queda como titular y el producto del actor queda en `prueba`.
362
+ */
363
+ type CreateEmpresaInput = CreateEmpresaRequest;
364
+ /** Input para editar datos maestros, perfil y visibilidad (RUC y slug son inmutables). */
365
+ type UpdateEmpresaInput = UpdateEmpresaRequest;
366
+ /** Query de `listEmpresas`: `q` y `cursor` (la siguiente página sale de `nextCursor`). */
367
+ type ListEmpresasInput = ListEmpresasQuery;
368
+ /** Página de empresas contratadas por el producto del actor. */
369
+ type ListEmpresasResult = ListEmpresasResponse['data'];
370
+ /** Input para agregar un miembro (entra como `miembro`). */
371
+ type AddEmpresaMemberInput = AddEmpresaMemberRequest;
372
+ /** Input para cambiar el rol de un miembro (solo el titular). */
373
+ type UpdateEmpresaMemberInput = UpdateEmpresaMemberRequest;
374
+ /** Input para quitar un miembro; `userId` = la persona del token es salir por cuenta propia. */
375
+ type RemoveEmpresaMemberInput = RemoveEmpresaMemberRequest;
376
+ /** Input para crear una sucursal (alias del request del contrato). */
377
+ type CreateSucursalInput = CreateSucursalRequest;
378
+ /** Input para editar una sucursal. */
379
+ type UpdateSucursalInput = UpdateSucursalRequest;
380
+ /** Input para dar de baja lógica una sucursal (`activa = false`). */
381
+ type DeactivateSucursalInput = DeactivateSucursalRequest;
382
+ /** Empresa creada o editada (`data` de la respuesta). */
383
+ type EmpresaResult = EmpresaResponse['data'];
384
+ /** Vista completa de una empresa: el actor tiene su producto contratado (`vista: 'completa'`). */
385
+ type EmpresaDetailResult = EmpresaDetailResponse['data'];
386
+ /** Vista recortada para un actor sin producto: sin contacto ni miembros (`vista: 'recortada'`). */
387
+ type EmpresaRecortadaResult = EmpresaRecortadaResponse['data'];
388
+ /** Resultado de `getEmpresa`: una de las dos vistas, distinguidas por `vista`. */
389
+ type GetEmpresaResult = GetEmpresaResponse['data'];
390
+ /** Miembro agregado o con rol cambiado (`data` de la respuesta). */
391
+ type EmpresaMemberResult = EmpresaMemberResponse['data'];
392
+ /** Sucursal creada o editada (`data` de la respuesta). */
393
+ type SucursalResult = SucursalResponse['data'];
394
+ /** Estado de la empresa tras `bajaEmpresa` / `reactivarEmpresa`. */
395
+ type EmpresaEstadoResult = EmpresaEstadoResponse['data'];
396
+ /** Contratación de un producto por una empresa. */
397
+ type ContratacionResult = ContratacionResponse['data'];
398
+ /** Input de `setContratacion` (facturación y admin): estado y vencimiento. */
399
+ type SetContratacionInput = SetContratacionRequest;
400
+ /** `{ contratado }`: ¿la empresa tiene el producto en `prueba` o `activo` y sin vencer? */
401
+ type ContratadoResult = ContratadoResponse['data'];
402
+ /** Input para crear un grupo con una empresa de la persona. */
403
+ type CreateGrupoInput = CreateGrupoRequest;
404
+ /** Input para renombrar un grupo. */
405
+ type RenameGrupoInput = RenameGrupoRequest;
406
+ /** Input para agregar una empresa a un grupo. */
407
+ type AddGrupoEmpresaInput = AddGrupoEmpresaRequest;
408
+ /** Input para quitar una empresa de un grupo. */
409
+ type RemoveGrupoEmpresaInput = RemoveGrupoEmpresaRequest;
410
+ /** Grupo con los ids de sus empresas. */
411
+ type GrupoResult = GrupoResponse['data'];
412
+ /** Query del directorio: `q`, `rubro`, `ciudad` y `cursor`. */
413
+ type SearchDirectorioInput = DirectorioQuery;
414
+ /** Página del directorio: solo campos de perfil público. */
415
+ type DirectorioResult = DirectorioResponse['data'];
416
+ /** Input para conceder una autorización a otra empresa (solo permisos del catálogo entre empresas). */
417
+ type CreateAutorizacionInput = CreateAutorizacionRequest;
418
+ /** Input para revocar (otorgante) o renunciar (beneficiaria) a una autorización. */
419
+ type DeleteAutorizacionInput = DeleteAutorizacionRequest;
420
+ /** Input de `listAutorizaciones`: dirección y persona (viaja en el header `x-eva-subject-token`). */
421
+ type ListAutorizacionesInput = ListAutorizacionesQuery & {
422
+ subjectToken: string;
423
+ };
424
+ /** Autorización vigente. */
425
+ type AutorizacionResult = AutorizacionResponse['data'];
426
+ /** Autorizaciones vigentes de una empresa. */
427
+ type ListAutorizacionesResult = ListAutorizacionesResponse['data'];
428
+ /** Input de `checkAutorizacion`: otorgante, beneficiaria y permiso. */
429
+ type CheckAutorizacionInput = VerificarAutorizacionQuery;
430
+ /** `{ autorizado }`. */
431
+ type CheckAutorizacionResult = VerificarAutorizacionResponse['data'];
432
+ /**
433
+ * All possible reasons why an S2S request verification can fail.
434
+ *
435
+ * - `header_missing` — one or more required headers are absent (client id, timestamp, nonce, signature).
436
+ * - `timestamp_invalid` — the `x-eva-timestamp` header is not a valid integer string.
437
+ * - `timestamp_expired` — the timestamp is outside the allowed window (default ±120 s).
438
+ * - `nonce_malformed` — the `x-eva-nonce` header is not 32 lowercase hex chars.
439
+ * - `signature_malformed` — the `x-eva-signature` header is not in `sha256=<hex64>` format.
440
+ * - `client_unknown` — `secretStore` returned null for the given clientId.
441
+ * - `signature_invalid` — the HMAC signature does not match the expected value.
442
+ * - `replay_detected` — the `(clientId, nonce)` pair has already been seen (only when `replayCache` is configured).
443
+ *
444
+ * `client_unknown` and `signature_invalid` share the same human-readable message
445
+ * ("Authentication failed") to avoid revealing whether the clientId exists.
446
+ */
447
+ type S2SVerifyReason = 'header_missing' | 'timestamp_invalid' | 'timestamp_expired' | 'nonce_malformed' | 'signature_malformed' | 'client_unknown' | 'signature_invalid' | 'replay_detected';
448
+ /**
449
+ * Discriminated union of all S2S verification failure modes.
450
+ * Q-E01 LOCKED — this is a module-specific type, NOT the global Result<T, E>.
451
+ */
452
+ type S2SVerifyError = {
453
+ reason: S2SVerifyReason;
454
+ message: string;
455
+ };
456
+ /**
457
+ * Result of S2S verification.
458
+ *
459
+ * Use the `ok` discriminant to narrow:
460
+ * ```ts
461
+ * const result = await verifyS2SRequest(req, opts)
462
+ * if (!result.ok) return new Response(result.error.message, { status: 401 })
463
+ * const { clientId } = result.data
464
+ * ```
465
+ */
466
+ type S2SVerifyResult<T> = {
467
+ ok: true;
468
+ data: T;
469
+ } | {
470
+ ok: false;
471
+ error: S2SVerifyError;
472
+ };
473
+ /**
474
+ * Input options for `verifyS2SRequest`.
475
+ */
476
+ type S2SVerifyOptions = {
477
+ /**
478
+ * Callback that must return the plaintext secret (64 hex chars = 32 bytes) for the given
479
+ * clientId, or null if the client is unknown. The SDK applies a timing-safe dummy HMAC
480
+ * when null — callers MUST NOT throw; return null for unknown clients instead.
481
+ */
482
+ secretStore: (clientId: string) => Promise<string | null>;
483
+ /**
484
+ * Override timestamp validation window in seconds.
485
+ * Default: `S2S_TIMESTAMP_WINDOW_SECONDS` (120).
486
+ */
487
+ timestampWindowSeconds?: number;
488
+ /**
489
+ * Optional nonce store for replay protection. When provided, `verifyS2SRequest`
490
+ * calls `setIfAbsent` after a successful HMAC verify to detect replayed requests.
491
+ *
492
+ * The SDK builds the key internally as `${clientId}:${nonce}` (`nonce` is the validated
493
+ * `x-eva-nonce` header, 32 lowercase hex). The TTL passed to `setIfAbsent` is
494
+ * `2 * timestampWindowSeconds + 1` (default 241 s): the current time is floored to seconds
495
+ * and the window is inclusive on both sides (±W), so a request stays acceptable for 2W + 1
496
+ * seconds and the key must outlive that.
497
+ *
498
+ * @remarks
499
+ * The implementation MUST be atomic (e.g. Redis `SET key value NX EX ttl`).
500
+ * Non-atomic implementations are vulnerable to TOCTOU race conditions.
501
+ *
502
+ * The store SHOULD be shared across all instances of the same service that share
503
+ * the clientId/secret pair. Independent per-instance stores allow cross-instance
504
+ * replay attacks.
505
+ *
506
+ * @security Critical for replay protection — must be atomic.
507
+ * @security Check occurs AFTER HMAC verify (D16) to preserve timing-safe invariant.
508
+ */
509
+ replayCache?: {
510
+ /**
511
+ * Atomically insert `key` (`${clientId}:${nonce}`) if not present, expiring after `ttlSeconds`
512
+ * (`2 * timestampWindowSeconds + 1`).
513
+ * @returns `true` if inserted (request is fresh); `false` if the key already existed (replay detected).
514
+ *
515
+ * Implementation MUST be atomic (e.g. Redis `SET ... NX EX ttl`).
516
+ * Non-atomic implementations are vulnerable to TOCTOU race conditions.
517
+ *
518
+ * @security Critical for replay protection — must be atomic.
519
+ */
520
+ setIfAbsent(key: string, ttlSeconds: number): Promise<boolean>;
521
+ };
522
+ /**
523
+ * Optional message overrides for i18n. Keys not provided fall back to the
524
+ * default English messages. An empty string `''` is respected as an explicit
525
+ * override (D12 LOCKED).
526
+ *
527
+ * @example
528
+ * ```ts
529
+ * messages: {
530
+ * timestamp_expired: 'El timestamp está fuera del rango permitido',
531
+ * replay_detected: 'Firma ya utilizada',
532
+ * }
533
+ * ```
534
+ */
535
+ messages?: Partial<Record<S2SVerifyReason, string>>;
536
+ };
537
+ export { ServiceTokenRequestError as $, RenameGrupoInput as A, SearchDirectorioInput as B, ListAutorizacionesInput as C, ListWebhookDeliveriesQuery as D, ListEmpresasResult as E, S2SGetUserResult as F, UpdateEmpresaMemberInput as G, SubjectTokenInput as H, S2SVerifyError as I, DelegatedTokenGrant as J, UpdateSucursalInput as K, S2SVerifyOptions as L, S2SBatchUsersResult as M, S2SCanonicalParts as N, RemoveEmpresaMemberInput as O, S2SClientConfig as P, ServiceTokenProviderConfig as Q, S2SVerifyReason as R, GrupoResult as S, ListEmpresasInput as T, SucursalResult as U, SetContratacionInput as V, UpdateEmpresaInput as W, SERVICE_TOKEN_RENEW_MARGIN_MS as X, ExchangeTokenInput as Y, ServiceTokenProvider as Z, EmpresaEstadoResult as _, CheckAutorizacionResult as a, DelegatedTokenVerifyOptions as at, EmpresaResult as b, CreateAutorizacionInput as c, verifyDelegatedToken as ct, CreateSucursalInput as d, ServiceTokenScopeRequirement as dt, ServiceTokenSource as et, CreateWebhookSubscriptionInput as f, ServiceTokenVerifyError as ft, EmpresaDetailResult as g, verifyServiceToken as gt, DirectorioResult as h, ServiceTokenVerifyResult as ht, CheckAutorizacionInput as i, DelegatedTokenVerifyError as it, S2SBatchUsersInput as j, RemoveGrupoEmpresaInput as k, CreateEmpresaInput as l, SERVICE_TOKEN_CLOCK_TOLERANCE_SECONDS as lt, DeleteAutorizacionInput as m, ServiceTokenVerifyReason as mt, AddGrupoEmpresaInput as n, DelegatedActor as nt, ContratacionResult as o, DelegatedTokenVerifyReason as ot, DeactivateSucursalInput as p, ServiceTokenVerifyOptions as pt, UpdateWebhookSubscriptionInput as q, AutorizacionResult as r, DelegatedTokenClaims as rt, ContratadoResult as s, DelegatedTokenVerifyResult as st, AddEmpresaMemberInput as t, createServiceTokenProvider as tt, CreateGrupoInput as u, ServiceTokenClaims as ut, EmpresaMemberResult as v, ListAutorizacionesResult as w, GetEmpresaResult as x, EmpresaRecortadaResult as y, S2SVerifyResult as z };
538
+ //# sourceMappingURL=types-DGeQ8j4k.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DGeQ8j4k.d.cts","names":[],"sources":["../src/s2s/service-token.ts","../src/s2s/delegated-token.ts","../src/s2s/token-provider.ts","../src/s2s/types.ts"],"mappings":";;;;;;cA4Ba;;;;;;;;;;;KAYD;KAQA;EACV,QAAQ;EACR;;;KAIU;;EAEV;;EAEA;;EAEA;;EAEA;;KAGU;EACN;EAAU,MAAM;;EAChB;EAAW,OAAO;;;;;;;KAOZ;EACN;EAAuB;EAAkB;;EACzC;EAA6B;EAAuB;;EACpD;EAAwB;EAAuB;;KAEzC,4BAA4B;;;;;EAKtC,UAAU;;;;;;EAMV,OAAO;;EAEP;;EAEA;;EAEA,WAAW,QAAQ,OAAO;;;;;;;;;;;;;;;;;;;iBAuGN,mBACpB,eACA,MAAM,4BACL,QAAQ;;KClKC,6BAA6B;KAE7B;EACV,QAAQ;EACR;;;KAIU;;EAEV;;EAEA;;;KAIU;;EAEV;;EAEA;;EAEA;;EAEA;;;;;EAKA,qBAAqB;;EAErB;;EAEA;;EAEA;;KAGU;EACN;EAAU,MAAM;;EAChB;EAAW,OAAO;;KAEZ,8BAA8B;;;;;EAKxC,UAAU;;EAEV,OAAO;;EAEP;;EAEA;;EAEA,WAAW,QAAQ,OAAO;;;;;;;;;;;;;;;;;;;iBAiGN,qBACpB,eACA,MAAM,8BACL,QAAQ;;cC1KE;KASD;;;;;EAKV;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;KAQU;;;;;;EAMV,YAAY;;;;;;;;;EASZ,WAAW;;;KAID;;;;;;EAMV;;EAEA;;EAEA;;;KAIU;EACV;;EAEA;;;;;KAMU,uBAAuB;;;;;;;;;;;;;;;;EAgBjC,cAAc,OAAO,qBAAqB,QAAQ,OAAO;;;cAI9C,iCAAiC;WACnC;WACA;;WAEA;EAGP,YAAA,cACA,gBACA,sBACA;;;;;;;;;;;;;;;;;;;;;;iBAyKY,2BACd,QAAQ,6BACP;;;;KCxOS;;;;;EAKV;;;;;EAKA,eAAe;;;;;;KAOL;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,WAAW;;;;;;;KAQD,mBAAmB;;;;;KAMnB,qBAAqB;;;;;KAMrB,sBAAsB;;;;;;KAOtB,iCAAiC;;;;;KAMjC,iCAAiC;;;;;;;KAQjC;EACV;EACA;EACA;EACA;EACA;;;;;;KAOU,oBAAoB;;;;;KAMpB,qBAAqB;;KAGrB,qBAAqB;;KAGrB,oBAAoB;;KAGpB,qBAAqB;;KAGrB,wBAAwB;;KAGxB,2BAA2B;;KAG3B,2BAA2B;;KAG3B,sBAAsB;;KAGtB,sBAAsB;;KAGtB,0BAA0B;;KAG1B,gBAAgB;;KAGhB,sBAAsB;;KAGtB,yBAAyB;;KAGzB,mBAAmB;;KAGnB,sBAAsB;;KAGtB,iBAAiB;;KAGjB,sBAAsB;;KAGtB,qBAAqB;;KAGrB,uBAAuB;;KAGvB,mBAAmB;;KAGnB,mBAAmB;;KAGnB,mBAAmB;;KAGnB,uBAAuB;;KAGvB,0BAA0B;;KAG1B,cAAc;;KAGd,wBAAwB;;KAGxB,mBAAmB;;KAGnB,0BAA0B;;KAG1B,0BAA0B;;KAG1B,0BAA0B;EACpC;;;KAIU,qBAAqB;;KAGrB,2BAA2B;;KAG3B,yBAAyB;;KAGzB,0BAA0B;;;;;;;;;;;;;;;;KAmB1B;;;;;KAcA;EACV,QAAQ;EACR;;;;;;;;;;;;KAaU,gBAAgB;EACtB;EAAU,MAAM;;EAChB;EAAW,OAAO;;;;;KAKZ;;;;;;EAMV,cAAc,qBAAqB;;;;;EAKnC;;;;;;;;;;;;;;;;;;;;;;EAsBA;;;;;;;;;;;IAWE,YAAY,aAAa,qBAAqB;;;;;;;;;;;;;;;EAehD,WAAW,QAAQ,OAAO"}