@blakearoberts/visage 0.0.1-rc.5 → 0.0.1-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -13
- package/dist/config.d.ts +5 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/index.js +58 -35
- package/dist/types.d.ts +14 -12
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,31 +33,36 @@ Visage is configured through `visage(options?)` in `vite.config.ts`.
|
|
|
33
33
|
|
|
34
34
|
The top-level `host` and `port` configure the local Visage origin that the browser visits:
|
|
35
35
|
|
|
36
|
+
```ts
|
|
37
|
+
visage({ host: 'localhost', port: 9001 });
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Services
|
|
41
|
+
|
|
42
|
+
Services are Docker Compose services managed by the Vite dev-server lifecycle.
|
|
43
|
+
Additional services automatically get a matching managed upstream with the same
|
|
44
|
+
name, host, and default `/{name}/` location.
|
|
45
|
+
|
|
36
46
|
```ts
|
|
37
47
|
visage({
|
|
38
|
-
|
|
39
|
-
port: 9001,
|
|
48
|
+
services: { whoami: { image: 'traefik/whoami' } },
|
|
40
49
|
});
|
|
41
50
|
```
|
|
42
51
|
|
|
43
|
-
|
|
52
|
+
### Upstreams
|
|
53
|
+
|
|
54
|
+
Upstreams are proxy targets that Visage routes to. A top-level upstream with no
|
|
55
|
+
matching service entry is treated as an external upstream.
|
|
44
56
|
|
|
45
57
|
```ts
|
|
46
58
|
visage({
|
|
47
|
-
services: {
|
|
48
|
-
whoami: { image: 'traefik/whoami' },
|
|
49
|
-
},
|
|
50
59
|
upstreams: {
|
|
51
|
-
|
|
52
|
-
host: 'whoami',
|
|
53
|
-
port: 80,
|
|
54
|
-
locations: { '/whoami/': {} },
|
|
55
|
-
},
|
|
60
|
+
api: { host: 'api.local.test', locations: { '/api/': {} } },
|
|
56
61
|
},
|
|
57
62
|
});
|
|
58
63
|
```
|
|
59
64
|
|
|
60
|
-
See `VisageOptions` for the full option surface.
|
|
65
|
+
See [`VisageOptions`](src/types.ts) for the full option surface.
|
|
61
66
|
|
|
62
67
|
## Expected Local URLs
|
|
63
68
|
|
|
@@ -124,6 +129,7 @@ Do not treat the managed Dex and OAuth2 Proxy defaults as production auth infras
|
|
|
124
129
|
|
|
125
130
|
## TO-DO
|
|
126
131
|
|
|
132
|
+
- [ ] Support SSR injection of identity into HTML responses as script tag elements.
|
|
127
133
|
- [ ] Support configuring [Dex connectors](https://dexidp.io/docs/connectors/).
|
|
128
|
-
- [ ] Support configuring Dex on a distinct subdomain, such as `auth.
|
|
134
|
+
- [ ] Support configuring Dex on a distinct subdomain, such as `auth.localhost`.
|
|
129
135
|
- [ ] Support optional [HTTP mode without local TLS](docs/tls-http-mode.md).
|
package/dist/config.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ type ResolvedCookiePolicy = {
|
|
|
9
9
|
readonly cookie_path: string;
|
|
10
10
|
};
|
|
11
11
|
type ResolvedIdpOption = {
|
|
12
|
-
readonly kind: 'dex';
|
|
13
12
|
readonly dex: VisageDexOptions;
|
|
14
13
|
} | VisageExternalIdpOptions;
|
|
15
14
|
type ResolvedOAuth2Client = {
|
|
@@ -18,10 +17,10 @@ type ResolvedOAuth2Client = {
|
|
|
18
17
|
readonly scopes: readonly string[];
|
|
19
18
|
readonly public: boolean;
|
|
20
19
|
};
|
|
21
|
-
type ResolvedService = VisageService
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
type ResolvedService = Omit<VisageService, 'upstream'>;
|
|
21
|
+
type ResolvedUpstream = Omit<VisageUpstream, 'host' | 'port' | 'scheme'> & {
|
|
22
|
+
readonly host: string;
|
|
23
|
+
readonly port: number;
|
|
25
24
|
readonly scheme: 'http' | 'https';
|
|
26
25
|
};
|
|
27
26
|
type ResolvedVisageOptions = {
|
|
@@ -41,14 +40,13 @@ type ResolvedBaseIdpConfig = {
|
|
|
41
40
|
readonly jwks: string;
|
|
42
41
|
};
|
|
43
42
|
type ResolvedDexIdpConfig = ResolvedBaseIdpConfig & {
|
|
44
|
-
readonly kind: 'dex';
|
|
45
43
|
readonly dex: {
|
|
46
44
|
readonly expiry?: VisageDexExpiry;
|
|
47
45
|
readonly users: readonly VisageDexUser[];
|
|
48
46
|
};
|
|
49
47
|
};
|
|
50
48
|
type ResolvedExternalIdpConfig = ResolvedBaseIdpConfig & {
|
|
51
|
-
readonly
|
|
49
|
+
readonly dex?: never;
|
|
52
50
|
};
|
|
53
51
|
type ResolvedIdpConfig = ResolvedDexIdpConfig | ResolvedExternalIdpConfig;
|
|
54
52
|
export type VisageConfig = {
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE3C,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,wBAAwB,EACxB,aAAa,EAEb,aAAa,EACb,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,KAAK,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;AAElD,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,KAAK,iBAAiB,GAClB;IACE,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAA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C;IAEtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;KAC1C,CAAC;IAEF,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IAC7D,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;CAChE,CAAC;AA2GF,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,qBAAqB,CAmE5E;AAqHD,wBAAgB,aAAa,CAC3B,OAAO,EAAE,qBAAqB,EAC9B,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,MAAM,GACf,YAAY,CAsDd"}
|
package/dist/index.js
CHANGED
|
@@ -165,7 +165,7 @@ function renderComposeConfig(config) {
|
|
|
165
165
|
const { dex, nginx, oauth2_proxy, ...services } = config.services;
|
|
166
166
|
return stringify({
|
|
167
167
|
services: {
|
|
168
|
-
...(config.idp.
|
|
168
|
+
...(config.idp.dex !== undefined
|
|
169
169
|
? {
|
|
170
170
|
dex: {
|
|
171
171
|
...config.services.dex,
|
|
@@ -200,14 +200,15 @@ function writeDexConfig(config) {
|
|
|
200
200
|
writeFileSync(file, render, 'utf-8');
|
|
201
201
|
}
|
|
202
202
|
function renderDexConfig(config) {
|
|
203
|
-
|
|
203
|
+
const { idp } = config;
|
|
204
|
+
if (idp.dex === undefined) {
|
|
204
205
|
throw new Error('Dex config is required to render Dex');
|
|
205
206
|
}
|
|
206
207
|
const origin = `https://${config.host}:${config.port}`;
|
|
207
208
|
const redirect = `${origin}/oauth2/callback`;
|
|
208
|
-
const upstream = config.upstreams[
|
|
209
|
+
const upstream = config.upstreams[idp.upstream];
|
|
209
210
|
return stringify({
|
|
210
|
-
issuer:
|
|
211
|
+
issuer: idp.issuer,
|
|
211
212
|
storage: { type: 'memory' },
|
|
212
213
|
web: { http: `0.0.0.0:${upstream.port}` },
|
|
213
214
|
oauth2: { skipApprovalScreen: true },
|
|
@@ -222,10 +223,8 @@ function renderDexConfig(config) {
|
|
|
222
223
|
},
|
|
223
224
|
],
|
|
224
225
|
enablePasswordDB: true,
|
|
225
|
-
...(
|
|
226
|
-
|
|
227
|
-
: { expiry: config.idp.dex.expiry }),
|
|
228
|
-
staticPasswords: config.idp.dex.users.map(({ password, ...user }) => ({
|
|
226
|
+
...(idp.dex.expiry === undefined ? {} : { expiry: idp.dex.expiry }),
|
|
227
|
+
staticPasswords: idp.dex.users.map(({ password, ...user }) => ({
|
|
229
228
|
...user,
|
|
230
229
|
hash: hashSync(password, 10),
|
|
231
230
|
})),
|
|
@@ -360,7 +359,7 @@ function renderOauth2ProxyConfig(config) {
|
|
|
360
359
|
|
|
361
360
|
function render(config) {
|
|
362
361
|
writeComposeConfig(config);
|
|
363
|
-
if (config.idp.
|
|
362
|
+
if (config.idp.dex !== undefined) {
|
|
364
363
|
writeDexConfig(config);
|
|
365
364
|
}
|
|
366
365
|
writeNginxConfig(config);
|
|
@@ -459,9 +458,13 @@ const DefaultProxyPolicy = {
|
|
|
459
458
|
},
|
|
460
459
|
};
|
|
461
460
|
function resolveOptions(options) {
|
|
462
|
-
const { host = '
|
|
461
|
+
const { host = 'localhost', port = 9001, cookie = {}, oauth2 = {} } = options;
|
|
463
462
|
const cookieName = cookie.name ?? 'session';
|
|
464
463
|
const publicClient = oauth2.clientSecret === null;
|
|
464
|
+
const upstreams = {
|
|
465
|
+
...resolveServiceUpstreams(options.services),
|
|
466
|
+
...resolveUpstreams(options.upstreams),
|
|
467
|
+
};
|
|
465
468
|
return {
|
|
466
469
|
host,
|
|
467
470
|
port,
|
|
@@ -491,11 +494,14 @@ function resolveOptions(options) {
|
|
|
491
494
|
public: publicClient,
|
|
492
495
|
},
|
|
493
496
|
services: {
|
|
494
|
-
...options.services,
|
|
497
|
+
...Object.fromEntries(Object.entries(options.services ?? {}).map(([name, service]) => [
|
|
498
|
+
name,
|
|
499
|
+
resolveService(service),
|
|
500
|
+
])),
|
|
495
501
|
nginx: {
|
|
496
502
|
...BaseServiceNginx,
|
|
497
503
|
...{
|
|
498
|
-
...options.services?.nginx,
|
|
504
|
+
...resolveService(options.services?.nginx ?? {}),
|
|
499
505
|
extra_hosts: [
|
|
500
506
|
...BaseServiceNginx.extra_hosts,
|
|
501
507
|
...(options.services?.nginx?.extra_hosts ?? []),
|
|
@@ -505,7 +511,7 @@ function resolveOptions(options) {
|
|
|
505
511
|
oauth2_proxy: {
|
|
506
512
|
...BaseOAuth2ProxyService,
|
|
507
513
|
...{
|
|
508
|
-
...options.services?.oauth2_proxy,
|
|
514
|
+
...resolveService(options.services?.oauth2_proxy ?? {}),
|
|
509
515
|
extra_hosts: [
|
|
510
516
|
...BaseOAuth2ProxyService.extra_hosts,
|
|
511
517
|
...(options.services?.oauth2_proxy?.extra_hosts ?? []),
|
|
@@ -513,20 +519,41 @@ function resolveOptions(options) {
|
|
|
513
519
|
},
|
|
514
520
|
},
|
|
515
521
|
},
|
|
516
|
-
...(
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
522
|
+
...(Object.keys(upstreams).length === 0 ? {} : { upstreams }),
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
function resolveService(service) {
|
|
526
|
+
const { upstream: _upstream, ...resolved } = service;
|
|
527
|
+
return resolved;
|
|
528
|
+
}
|
|
529
|
+
function resolveServiceUpstreams(services = {}) {
|
|
530
|
+
return Object.fromEntries(Object.entries(services)
|
|
531
|
+
.filter(([name]) =>
|
|
532
|
+
// Exclude base services handled separately.
|
|
533
|
+
name !== 'dex' && name !== 'nginx' && name !== 'oauth2_proxy')
|
|
534
|
+
.map(([name, service]) => [
|
|
535
|
+
name,
|
|
536
|
+
resolveUpstream(name, service.upstream ?? {}),
|
|
537
|
+
]));
|
|
538
|
+
}
|
|
539
|
+
function resolveUpstreams(upstreams = {}) {
|
|
540
|
+
return Object.fromEntries(Object.entries(upstreams).map(([name, upstream]) => [
|
|
541
|
+
name,
|
|
542
|
+
resolveUpstream(name, upstream),
|
|
543
|
+
]));
|
|
544
|
+
}
|
|
545
|
+
function resolveUpstream(name, upstream) {
|
|
546
|
+
return {
|
|
547
|
+
...upstream,
|
|
548
|
+
host: upstream.host ?? name,
|
|
549
|
+
locations: upstream.locations ?? { [`/${name}/`]: {} },
|
|
550
|
+
port: upstream.port ?? 80,
|
|
551
|
+
scheme: upstream.scheme ?? 'http',
|
|
524
552
|
};
|
|
525
553
|
}
|
|
526
554
|
function resolveIdpOption(idp) {
|
|
527
|
-
if (idp
|
|
555
|
+
if (idp && 'issuer' in idp) {
|
|
528
556
|
return {
|
|
529
|
-
kind: 'external',
|
|
530
557
|
issuer: idp.issuer,
|
|
531
558
|
authorization: idp.authorization ?? '/auth',
|
|
532
559
|
token: idp.token ?? '/token',
|
|
@@ -534,7 +561,6 @@ function resolveIdpOption(idp) {
|
|
|
534
561
|
};
|
|
535
562
|
}
|
|
536
563
|
return {
|
|
537
|
-
kind: 'dex',
|
|
538
564
|
dex: {
|
|
539
565
|
...(idp?.expiry ? { expiry: idp.expiry } : {}),
|
|
540
566
|
users: (idp?.users ?? DefaultDexUsers).map((user) => ({
|
|
@@ -547,11 +573,10 @@ function resolveIdpOption(idp) {
|
|
|
547
573
|
};
|
|
548
574
|
}
|
|
549
575
|
function resolveIdpConfig({ host, port, idp, }) {
|
|
550
|
-
if (
|
|
576
|
+
if ('dex' in idp) {
|
|
551
577
|
const issuer = `https://${host}:${port}/dex`;
|
|
552
578
|
const upstream = `http://dex:5556/dex`;
|
|
553
579
|
return {
|
|
554
|
-
kind: 'dex',
|
|
555
580
|
upstream: 'dex',
|
|
556
581
|
issuer,
|
|
557
582
|
authorization: `${issuer}/auth`,
|
|
@@ -569,7 +594,6 @@ function resolveIdpConfig({ host, port, idp, }) {
|
|
|
569
594
|
};
|
|
570
595
|
}
|
|
571
596
|
return {
|
|
572
|
-
kind: 'external',
|
|
573
597
|
upstream: 'idp',
|
|
574
598
|
issuer: idp.issuer,
|
|
575
599
|
authorization: idp.issuer + (idp.authorization ?? '/auth'),
|
|
@@ -583,7 +607,6 @@ function resolveExternalIdpUpstream(idp) {
|
|
|
583
607
|
host: issuer.hostname,
|
|
584
608
|
scheme: issuer.protocol === 'https:' ? 'https' : 'http',
|
|
585
609
|
port: Number(issuer.port) || (issuer.protocol === 'https:' ? 443 : 80),
|
|
586
|
-
locations: { [issuer.pathname]: { auth: { enabled: false } } },
|
|
587
610
|
};
|
|
588
611
|
}
|
|
589
612
|
function resolveConfig(options, config, vitePort) {
|
|
@@ -591,9 +614,9 @@ function resolveConfig(options, config, vitePort) {
|
|
|
591
614
|
const upstreams = {
|
|
592
615
|
oauth2_proxy: BaseOauth2ProxyUpstream,
|
|
593
616
|
vite: { ...BaseViteUpstream, port: vitePort },
|
|
594
|
-
...(idp.
|
|
595
|
-
? {
|
|
596
|
-
: {
|
|
617
|
+
...(idp.dex === undefined
|
|
618
|
+
? { idp: resolveExternalIdpUpstream(idp) }
|
|
619
|
+
: { dex: BaseDexUpstream }),
|
|
597
620
|
...options.upstreams,
|
|
598
621
|
};
|
|
599
622
|
return {
|
|
@@ -605,8 +628,9 @@ function resolveConfig(options, config, vitePort) {
|
|
|
605
628
|
cache: join(config.cacheDir, 'visage'),
|
|
606
629
|
files: { ...BaseFiles },
|
|
607
630
|
services: {
|
|
608
|
-
...(idp.
|
|
609
|
-
?
|
|
631
|
+
...(idp.dex === undefined
|
|
632
|
+
? BaseServices
|
|
633
|
+
: {
|
|
610
634
|
dex: BaseDexService,
|
|
611
635
|
nginx: {
|
|
612
636
|
...BaseServices.nginx,
|
|
@@ -618,8 +642,7 @@ function resolveConfig(options, config, vitePort) {
|
|
|
618
642
|
image: BaseServices.oauth2_proxy.image,
|
|
619
643
|
depends_on: ['dex'],
|
|
620
644
|
},
|
|
621
|
-
}
|
|
622
|
-
: BaseServices),
|
|
645
|
+
}),
|
|
623
646
|
...options.services,
|
|
624
647
|
},
|
|
625
648
|
upstreams: Object.fromEntries(Object.entries(upstreams).map(([name, upstream]) => [
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type VisageOptions = {
|
|
|
5
5
|
/**
|
|
6
6
|
* Browser-facing hostname for the local Visage HTTPS origin.
|
|
7
7
|
*
|
|
8
|
-
* @defaultValue `'
|
|
8
|
+
* @defaultValue `'localhost'`
|
|
9
9
|
*/
|
|
10
10
|
readonly host?: string;
|
|
11
11
|
/**
|
|
@@ -78,11 +78,6 @@ export type VisageCookiePolicy = {
|
|
|
78
78
|
* Managed Dex identity provider options.
|
|
79
79
|
*/
|
|
80
80
|
export type VisageDexOptions = {
|
|
81
|
-
/**
|
|
82
|
-
* Selects the managed Dex provider. Omit this for the default managed Dex
|
|
83
|
-
* provider.
|
|
84
|
-
*/
|
|
85
|
-
readonly kind?: 'dex';
|
|
86
81
|
/**
|
|
87
82
|
* Token expiration and rotation settings rendered into the Dex config.
|
|
88
83
|
*/
|
|
@@ -165,10 +160,6 @@ export type VisageDexUser = {
|
|
|
165
160
|
* External OpenID Connect identity provider options.
|
|
166
161
|
*/
|
|
167
162
|
export type VisageExternalIdpOptions = {
|
|
168
|
-
/**
|
|
169
|
-
* Selects the external IdP flow.
|
|
170
|
-
*/
|
|
171
|
-
readonly kind: 'external';
|
|
172
163
|
/**
|
|
173
164
|
* OIDC issuer URL used by OAuth2 Proxy.
|
|
174
165
|
*/
|
|
@@ -244,6 +235,11 @@ export type VisageService = {
|
|
|
244
235
|
* Additional host-to-IP mappings rendered into the Compose service.
|
|
245
236
|
*/
|
|
246
237
|
readonly extra_hosts?: readonly string[];
|
|
238
|
+
/**
|
|
239
|
+
* Optional upstream override for this service. Omit this to create a default
|
|
240
|
+
* upstream from the service name.
|
|
241
|
+
*/
|
|
242
|
+
readonly upstream?: VisageUpstream;
|
|
247
243
|
};
|
|
248
244
|
/**
|
|
249
245
|
* Named proxy target that NGINX routes to for one or more locations.
|
|
@@ -251,8 +247,10 @@ export type VisageService = {
|
|
|
251
247
|
export type VisageUpstream = {
|
|
252
248
|
/**
|
|
253
249
|
* Hostname or Compose service name NGINX should proxy to.
|
|
250
|
+
*
|
|
251
|
+
* @defaultValue The upstream name.
|
|
254
252
|
*/
|
|
255
|
-
readonly host
|
|
253
|
+
readonly host?: string;
|
|
256
254
|
/**
|
|
257
255
|
* URL scheme NGINX should use when proxying to this upstream.
|
|
258
256
|
*
|
|
@@ -261,10 +259,14 @@ export type VisageUpstream = {
|
|
|
261
259
|
readonly scheme?: 'http' | 'https';
|
|
262
260
|
/**
|
|
263
261
|
* Port NGINX should proxy to on {@link VisageUpstream.host}.
|
|
262
|
+
*
|
|
263
|
+
* @defaultValue `80`
|
|
264
264
|
*/
|
|
265
|
-
readonly port
|
|
265
|
+
readonly port?: number;
|
|
266
266
|
/**
|
|
267
267
|
* Path-location policies for this upstream, keyed by NGINX location path.
|
|
268
|
+
*
|
|
269
|
+
* @defaultValue `/{upstreamName}/`
|
|
268
270
|
*/
|
|
269
271
|
readonly locations?: {
|
|
270
272
|
readonly [path: string]: VisageProxyPolicy;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,C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