@ouispec/bindings 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +18 -2
- package/dist/binding.d.ts +46 -0
- package/dist/binding.d.ts.map +1 -0
- package/dist/binding.js +51 -0
- package/dist/binding.js.map +1 -0
- package/dist/controls.d.ts +69 -0
- package/dist/controls.d.ts.map +1 -0
- package/dist/controls.js +334 -0
- package/dist/controls.js.map +1 -0
- package/dist/effect.d.ts +54 -0
- package/dist/effect.d.ts.map +1 -0
- package/dist/effect.js +88 -0
- package/dist/effect.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/interactive.d.ts +12 -0
- package/dist/interactive.d.ts.map +1 -0
- package/dist/interactive.js +21 -0
- package/dist/interactive.js.map +1 -0
- package/dist/jobs.d.ts +54 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +74 -0
- package/dist/jobs.js.map +1 -0
- package/dist/json-schema.d.ts +36 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +196 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/jsx.d.ts +19 -0
- package/dist/jsx.d.ts.map +1 -0
- package/dist/jsx.js +2 -0
- package/dist/jsx.js.map +1 -0
- package/dist/manifest.d.ts +35 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +77 -0
- package/dist/manifest.js.map +1 -0
- package/dist/oui.d.ts +112 -0
- package/dist/oui.d.ts.map +1 -0
- package/dist/oui.js +514 -0
- package/dist/oui.js.map +1 -0
- package/dist/package-declaration.d.ts +24 -0
- package/dist/package-declaration.d.ts.map +1 -0
- package/dist/package-declaration.js +24 -0
- package/dist/package-declaration.js.map +1 -0
- package/dist/react.d.ts +74 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +179 -0
- package/dist/react.js.map +1 -0
- package/dist/registry.d.ts +103 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +146 -0
- package/dist/registry.js.map +1 -0
- package/dist/room.d.ts +79 -0
- package/dist/room.d.ts.map +1 -0
- package/dist/room.js +111 -0
- package/dist/room.js.map +1 -0
- package/dist/tier2-react.d.ts +35 -0
- package/dist/tier2-react.d.ts.map +1 -0
- package/dist/tier2-react.js +186 -0
- package/dist/tier2-react.js.map +1 -0
- package/dist/tier2.d.ts +68 -0
- package/dist/tier2.d.ts.map +1 -0
- package/dist/tier2.js +129 -0
- package/dist/tier2.js.map +1 -0
- package/package.json +74 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the generator emits for each build (ADR-0220 §2.4–2.5), and how the
|
|
3
|
+
* runtime reads it: the manifest of every surface, action and observation the
|
|
4
|
+
* build's UI offers, and the knowledge generated from the same declarations.
|
|
5
|
+
*
|
|
6
|
+
* Both are data. The runtime offers the intersection of the manifest and the
|
|
7
|
+
* handlers mounted right now; the knowledge rides each turn for the page the
|
|
8
|
+
* user is on.
|
|
9
|
+
*/
|
|
10
|
+
import type { GeneratedKnowledge, KnowledgeEntry, KnowledgeRecipe, PageKnowledge } from '@ouispec/contract';
|
|
11
|
+
export { MANIFEST_VERSION } from '@ouispec/contract';
|
|
12
|
+
export type { GeneratedKnowledge, KnowledgeEntry, KnowledgeRecipe, ManifestAction, ManifestActionSource, ManifestObservation, ManifestSurface, ManifestSurfaceKind, OuiManifest, PageKnowledge, ReachStep, } from '@ouispec/contract';
|
|
13
|
+
/** What rides a turn as `context.uiKnowledge`. */
|
|
14
|
+
export interface ResolvedKnowledge {
|
|
15
|
+
entries: KnowledgeEntry[];
|
|
16
|
+
workflows: KnowledgeRecipe[];
|
|
17
|
+
}
|
|
18
|
+
/** A route pattern (`/voices/:id`) as a matcher for a path. */
|
|
19
|
+
export declare function routeMatcher(pattern: string): RegExp;
|
|
20
|
+
/** The page surface for a path: the one whose route matches, preferring the most specific pattern. */
|
|
21
|
+
export declare function pageForPath(knowledge: GeneratedKnowledge, path: string): PageKnowledge | null;
|
|
22
|
+
/**
|
|
23
|
+
* The knowledge for the page the user is on: the app's map, the page in full
|
|
24
|
+
* with its relationships and recipes, and one paragraph for each adjacent page.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveKnowledge(knowledge: GeneratedKnowledge, path: string): ResolvedKnowledge;
|
|
27
|
+
/** The id of the surface that goes to a page by its address, generated from the app's routes. */
|
|
28
|
+
export declare const NAVIGATION_SURFACE_ID = "app:navigation";
|
|
29
|
+
/** Its one action: go to a page. */
|
|
30
|
+
export declare const NAVIGATE_ACTION_ID = "app.navigate";
|
|
31
|
+
/** Its observation: the address of the page the person is on. */
|
|
32
|
+
export declare const LOCATION_OBSERVATION_ID = "location";
|
|
33
|
+
/** Whether a path is one of these route patterns, a `:param` standing for any one segment. */
|
|
34
|
+
export declare function isRoutePath(routes: readonly string[], path: string): boolean;
|
|
35
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAK5G,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B,kDAAkD;AAClD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQpD;AAED,sGAAsG;AACtG,wBAAgB,WAAW,CAAC,SAAS,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAY7F;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAoB/F;AAID,iGAAiG;AACjG,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AACtD,oCAAoC;AACpC,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AACjD,iEAAiE;AACjE,eAAO,MAAM,uBAAuB,aAAa,CAAC;AAElD,8FAA8F;AAC9F,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG5E"}
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the generator emits for each build (ADR-0220 §2.4–2.5), and how the
|
|
3
|
+
* runtime reads it: the manifest of every surface, action and observation the
|
|
4
|
+
* build's UI offers, and the knowledge generated from the same declarations.
|
|
5
|
+
*
|
|
6
|
+
* Both are data. The runtime offers the intersection of the manifest and the
|
|
7
|
+
* handlers mounted right now; the knowledge rides each turn for the page the
|
|
8
|
+
* user is on.
|
|
9
|
+
*/
|
|
10
|
+
// The manifest and the knowledge are the contract's (`oui-manifest.json`,
|
|
11
|
+
// `generated-knowledge.json`), generated from its schemas, and versioned with
|
|
12
|
+
// its major.
|
|
13
|
+
export { MANIFEST_VERSION } from '@ouispec/contract';
|
|
14
|
+
/** A route pattern (`/voices/:id`) as a matcher for a path. */
|
|
15
|
+
export function routeMatcher(pattern) {
|
|
16
|
+
const escaped = pattern
|
|
17
|
+
.split('/')
|
|
18
|
+
.map(seg => seg.startsWith(':') ? '[^/]+' : seg === '*' ? '.*' : seg.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
|
|
19
|
+
.join('/');
|
|
20
|
+
return new RegExp(`^${escaped}/?$`);
|
|
21
|
+
}
|
|
22
|
+
/** The page surface for a path: the one whose route matches, preferring the most specific pattern. */
|
|
23
|
+
export function pageForPath(knowledge, path) {
|
|
24
|
+
const clean = path.split(/[?#]/)[0] || '/';
|
|
25
|
+
let best = null;
|
|
26
|
+
for (const page of knowledge.pages) {
|
|
27
|
+
for (const route of page.routes) {
|
|
28
|
+
if (!routeMatcher(route).test(clean))
|
|
29
|
+
continue;
|
|
30
|
+
const score = route.split('/').filter(s => s && !s.startsWith(':')).length * 10 - (route.match(/:/g)?.length ?? 0);
|
|
31
|
+
if (!best || score > best.score)
|
|
32
|
+
best = { page, score };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return best?.page ?? null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The knowledge for the page the user is on: the app's map, the page in full
|
|
39
|
+
* with its relationships and recipes, and one paragraph for each adjacent page.
|
|
40
|
+
*/
|
|
41
|
+
export function resolveKnowledge(knowledge, path) {
|
|
42
|
+
const entries = [knowledge.overview];
|
|
43
|
+
const workflows = [];
|
|
44
|
+
// The frame is on the page too: what it offers comes first, as it is always there.
|
|
45
|
+
const clean = path.split(/[?#]/)[0] || '/';
|
|
46
|
+
for (const frame of knowledge.frames ?? []) {
|
|
47
|
+
if (frame.routes.some(route => routeMatcher(route).test(clean)))
|
|
48
|
+
entries.push(frame.detail);
|
|
49
|
+
}
|
|
50
|
+
const page = pageForPath(knowledge, path);
|
|
51
|
+
if (page) {
|
|
52
|
+
entries.push(page.detail);
|
|
53
|
+
if (page.relationships)
|
|
54
|
+
entries.push(page.relationships);
|
|
55
|
+
workflows.push(...page.recipes);
|
|
56
|
+
const bySurface = new Map(knowledge.pages.map(p => [p.surface, p]));
|
|
57
|
+
for (const id of page.adjacent) {
|
|
58
|
+
const other = bySurface.get(id);
|
|
59
|
+
if (other)
|
|
60
|
+
entries.push(other.summary);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { entries, workflows };
|
|
64
|
+
}
|
|
65
|
+
// ─── Navigation ──────────────────────────────────────────────────────────────
|
|
66
|
+
/** The id of the surface that goes to a page by its address, generated from the app's routes. */
|
|
67
|
+
export const NAVIGATION_SURFACE_ID = 'app:navigation';
|
|
68
|
+
/** Its one action: go to a page. */
|
|
69
|
+
export const NAVIGATE_ACTION_ID = 'app.navigate';
|
|
70
|
+
/** Its observation: the address of the page the person is on. */
|
|
71
|
+
export const LOCATION_OBSERVATION_ID = 'location';
|
|
72
|
+
/** Whether a path is one of these route patterns, a `:param` standing for any one segment. */
|
|
73
|
+
export function isRoutePath(routes, path) {
|
|
74
|
+
const clean = path.split('?')[0].split('#')[0].replace(/\/+$/, '') || '/';
|
|
75
|
+
return routes.some(route => routeMatcher(route).test(clean));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,0EAA0E;AAC1E,8EAA8E;AAC9E,aAAa;AACb,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAqBrD,+DAA+D;AAC/D,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,OAAO,GAAG,OAAO;SACpB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,GAAG,CAAC,EAAE,CACT,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAChG;SACA,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,IAAI,MAAM,CAAC,IAAI,OAAO,KA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AAU,WAAW,CAAC,MAAyB,EAAE,IAAY;IACjE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC;IAC1E,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/D,CAAC"}
|
package/dist/oui.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tab's OUI surfaces, built from the build's generated manifest and what
|
|
3
|
+
* is mounted right now (ADR-0220 §2.2, ADR-0209).
|
|
4
|
+
*
|
|
5
|
+
* A turn's UI tools are the intersection of the two: an action the build
|
|
6
|
+
* declares whose control (or room) is on screen. Each action runs the
|
|
7
|
+
* control's own handler, or the room's own entry, so the assistant and the
|
|
8
|
+
* person go through one code path.
|
|
9
|
+
*/
|
|
10
|
+
import { type SurfaceRuntime } from 'oui-spec/core';
|
|
11
|
+
import { type JsonSchema } from './json-schema.js';
|
|
12
|
+
import { type OuiManifest } from './manifest.js';
|
|
13
|
+
import type { BindingRegistry, ControlRegistration } from './registry.js';
|
|
14
|
+
import type { JobOutcome } from '@ouispec/contract';
|
|
15
|
+
/** The id of a page or shared surface's observation of what it shows. */
|
|
16
|
+
export declare const PAGE_STATE_OBSERVATION_ID = "state";
|
|
17
|
+
/** Something the build and the running page disagree on. Reported once each; the conformance test keeps them from shipping. */
|
|
18
|
+
export type BindingDefect = {
|
|
19
|
+
kind: 'unknown-binding';
|
|
20
|
+
id: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'widened-schema';
|
|
23
|
+
id: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'unknown-room';
|
|
26
|
+
room: string;
|
|
27
|
+
};
|
|
28
|
+
export interface ConnectBindingsOptions {
|
|
29
|
+
registry: BindingRegistry;
|
|
30
|
+
runtime: SurfaceRuntime;
|
|
31
|
+
manifest: OuiManifest;
|
|
32
|
+
onDefect?: (defect: BindingDefect) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Where job outcomes arrive, for controls whose binding declares a
|
|
35
|
+
* `{ kind: 'job' }` effect. Without it such an action is reported as started
|
|
36
|
+
* and never as done: nothing could confirm it.
|
|
37
|
+
*/
|
|
38
|
+
jobs?: JobTracker;
|
|
39
|
+
/**
|
|
40
|
+
* The app's router, for the generated navigation surface: going to a page
|
|
41
|
+
* by its address, and which page the person is on. Without it that surface
|
|
42
|
+
* is not offered.
|
|
43
|
+
*/
|
|
44
|
+
navigation?: AppNavigation;
|
|
45
|
+
}
|
|
46
|
+
/** How the app goes to a page, and tells which page it is on. */
|
|
47
|
+
export interface AppNavigation {
|
|
48
|
+
navigate(path: string): void;
|
|
49
|
+
/** The address of the page the person is on. */
|
|
50
|
+
location(): string;
|
|
51
|
+
/** Called with a listener for every change of location; returns how to stop. */
|
|
52
|
+
subscribe(listener: () => void): () => void;
|
|
53
|
+
}
|
|
54
|
+
/** A job's end, as the assistant is told it: the contract's `JobOutcome` (`action-effect.json`). */
|
|
55
|
+
export type { JobOutcome } from '@ouispec/contract';
|
|
56
|
+
/**
|
|
57
|
+
* The app's record of job outcomes (its completion events): `track` a job once
|
|
58
|
+
* it is started, read its `outcome` when it has one, and `forget` it after.
|
|
59
|
+
*/
|
|
60
|
+
export interface JobTracker {
|
|
61
|
+
track(jobId: string): void;
|
|
62
|
+
outcome(jobId: string): JobOutcome | null;
|
|
63
|
+
forget(jobId: string): void;
|
|
64
|
+
}
|
|
65
|
+
export { createDeclaredJobTracker } from './jobs.js';
|
|
66
|
+
export type { DeclaredJobTrackerOptions, JobEventSource, JobTrackerExtension } from './jobs.js';
|
|
67
|
+
/** How often a started job's outcome is read: a lookup, not a request. */
|
|
68
|
+
export declare const JOB_POLL_INTERVAL_MS = 1000;
|
|
69
|
+
/** How long a job may take before its action is reported as not finished. */
|
|
70
|
+
export declare const DEFAULT_JOB_TIMEOUT_MS = 300000;
|
|
71
|
+
/**
|
|
72
|
+
* How long a control disabled by its own press is reported busy before it is
|
|
73
|
+
* treated as simply unavailable: long enough for a save or a request, short
|
|
74
|
+
* enough that a control that stays disabled does not stay offered.
|
|
75
|
+
*/
|
|
76
|
+
export declare const BUSY_AFTER_PRESS_MS = 60000;
|
|
77
|
+
/** Keep the runtime's surfaces equal to what the manifest declares and the page has mounted. Returns a disconnect. */
|
|
78
|
+
export declare function connectBindings({ registry, runtime, manifest, onDefect, jobs, navigation, }: ConnectBindingsOptions): () => void;
|
|
79
|
+
/** One row of a list, as the page state shows it. */
|
|
80
|
+
export interface PageStateRow {
|
|
81
|
+
key: string;
|
|
82
|
+
title: string;
|
|
83
|
+
/** What the row is, when the page says (rows known only at run time). */
|
|
84
|
+
description?: string;
|
|
85
|
+
/** The row's own value schema (its range, step or options), when it takes a value. */
|
|
86
|
+
schema?: JsonSchema;
|
|
87
|
+
/** Its current value. */
|
|
88
|
+
value?: unknown;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A row's schema as the page state shows it: an enum longer than
|
|
92
|
+
* `MAX_DESCRIBED_OPTIONS` keeps that many values, and the row's current value
|
|
93
|
+
* if it is not among them, and says how many it leaves out. A language picker's
|
|
94
|
+
* hundreds of options would otherwise fill the page state the assistant reads.
|
|
95
|
+
* The row's tool still takes, and validates against, every value.
|
|
96
|
+
*/
|
|
97
|
+
export declare function summarisedSchema(schema: JsonSchema, value?: unknown): JsonSchema;
|
|
98
|
+
/**
|
|
99
|
+
* What a page surface shows: each field's value, each list's rows, what cannot
|
|
100
|
+
* be used right now, and what is busy with its last press (a Save button while
|
|
101
|
+
* it saves: it worked, and it comes back when done). A row that takes a value
|
|
102
|
+
* carries its own schema and value, so rows whose meanings are only known at
|
|
103
|
+
* run time (a model's parameters) are readable without their definitions in the
|
|
104
|
+
* build.
|
|
105
|
+
*/
|
|
106
|
+
export declare function pageState(controls: readonly ControlRegistration[], isBusy?: (bindingId: string) => boolean): {
|
|
107
|
+
busy?: string[] | undefined;
|
|
108
|
+
values: Record<string, unknown>;
|
|
109
|
+
lists: Record<string, PageStateRow[]>;
|
|
110
|
+
unavailable: string[];
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=oui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oui.d.ts","sourceRoot":"","sources":["../src/oui.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAA8B,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAoB,MAAM,eAAe,CAAC;AAC5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,UAAU,CAAC;AAEjD,+HAA+H;AAC/H,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU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