@polyxd/verifier 0.1.0
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 +202 -0
- package/NOTICE +177 -0
- package/README.md +29 -0
- package/dist/agent.d.ts +47 -0
- package/dist/agent.js +82 -0
- package/dist/agent.js.map +1 -0
- package/dist/browser.d.ts +22 -0
- package/dist/browser.js +41 -0
- package/dist/browser.js.map +1 -0
- package/dist/checkset.d.ts +7 -0
- package/dist/checkset.js +25 -0
- package/dist/checkset.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +74 -0
- package/dist/cli.js.map +1 -0
- package/dist/consistency.d.ts +26 -0
- package/dist/consistency.js +71 -0
- package/dist/consistency.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/rendered.d.ts +16 -0
- package/dist/rendered.js +85 -0
- package/dist/rendered.js.map +1 -0
- package/dist/reward.d.ts +68 -0
- package/dist/reward.js +188 -0
- package/dist/reward.js.map +1 -0
- package/dist/static.d.ts +15 -0
- package/dist/static.js +235 -0
- package/dist/static.js.map +1 -0
- package/dist/verify.d.ts +43 -0
- package/dist/verify.js +81 -0
- package/dist/verify.js.map +1 -0
- package/harness-dist/assets/index-C1BzlRVN.js +49 -0
- package/harness-dist/assets/index-D6-rG5Hn.css +1 -0
- package/harness-dist/index.html +14 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
package/NOTICE
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Polyxd
|
|
2
|
+
Copyright 2026 the Polyxd authors
|
|
3
|
+
|
|
4
|
+
This product includes software developed at Polyxd, licensed under the Apache
|
|
5
|
+
License, Version 2.0 (see LICENSE).
|
|
6
|
+
|
|
7
|
+
It also includes material from the projects below. Each is used under its own
|
|
8
|
+
licence, and each licence is included in full beside the material it covers.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Design-system packs
|
|
12
|
+
|
|
13
|
+
A pack reads a design system's published tokens and maps them onto Polyxd's
|
|
14
|
+
semantic token contract. The upstream token files are vendored verbatim — so a
|
|
15
|
+
pack can be regenerated and audited without a network — under that pack's
|
|
16
|
+
`scripts/sources/` directory, together with the upstream licence.
|
|
17
|
+
|
|
18
|
+
The packs are Polyxd's work, not the work of the design systems they read. The
|
|
19
|
+
names below identify whose tokens a pack reads. Polyxd is not affiliated with,
|
|
20
|
+
endorsed by, or sponsored by any of these projects or their owners, and each
|
|
21
|
+
name is the trademark of its owner.
|
|
22
|
+
|
|
23
|
+
### Ant Design (`@polyxd/ds-antd`)
|
|
24
|
+
|
|
25
|
+
Upstream: https://github.com/ant-design/ant-design
|
|
26
|
+
|
|
27
|
+
- npm:antd 6.6.4 — MIT
|
|
28
|
+
- npm:@ant-design/colors 8.0.1 — MIT
|
|
29
|
+
|
|
30
|
+
Vendored under `packages/ds-antd/scripts/sources/`, with the upstream licence file beside it.
|
|
31
|
+
|
|
32
|
+
### Bootstrap 5 (`@polyxd/ds-bootstrap`)
|
|
33
|
+
|
|
34
|
+
Upstream: https://github.com/twbs/bootstrap
|
|
35
|
+
|
|
36
|
+
- npm:bootstrap dist/css/bootstrap.css 5.3.8 — MIT
|
|
37
|
+
|
|
38
|
+
Vendored under `packages/ds-bootstrap/scripts/sources/`, with the upstream licence file beside it.
|
|
39
|
+
|
|
40
|
+
### IBM Carbon (`@polyxd/ds-carbon`)
|
|
41
|
+
|
|
42
|
+
Upstream: https://github.com/carbon-design-system/carbon
|
|
43
|
+
|
|
44
|
+
- npm:@carbon/colors 11.58.0 — Apache-2.0
|
|
45
|
+
- npm:@carbon/themes 11.81.0 — Apache-2.0
|
|
46
|
+
- npm:@carbon/layout 11.59.0 — Apache-2.0
|
|
47
|
+
- npm:@carbon/type 11.67.0 — Apache-2.0
|
|
48
|
+
- npm:@carbon/motion 11.52.0 — Apache-2.0
|
|
49
|
+
- npm:@carbon/charts scss/_color-palette.scss 1.27.20 — Apache-2.0
|
|
50
|
+
- npm:@carbon/styles scss/utilities/_box-shadow.scss and _focus-outline.scss 1.115.0 — Apache-2.0
|
|
51
|
+
|
|
52
|
+
Vendored under `packages/ds-carbon/scripts/sources/`, with the upstream licence file beside it.
|
|
53
|
+
|
|
54
|
+
### Chakra UI 3 (`@polyxd/ds-chakra`)
|
|
55
|
+
|
|
56
|
+
Upstream: https://github.com/chakra-ui/chakra-ui
|
|
57
|
+
|
|
58
|
+
- npm:@chakra-ui/react defaultSystem.getTokenCss 3.37.0 — MIT
|
|
59
|
+
|
|
60
|
+
Vendored under `packages/ds-chakra/scripts/sources/`, with the upstream licence file beside it.
|
|
61
|
+
|
|
62
|
+
### Microsoft Fluent 2 (`@polyxd/ds-fluent`)
|
|
63
|
+
|
|
64
|
+
Upstream: https://github.com/microsoft/fluentui
|
|
65
|
+
|
|
66
|
+
- npm:@fluentui/tokens 1.0.0-alpha.24 — MIT
|
|
67
|
+
|
|
68
|
+
Vendored under `packages/ds-fluent/scripts/sources/`, with the upstream licence file beside it.
|
|
69
|
+
|
|
70
|
+
### GOV.UK Frontend (`@polyxd/ds-govuk`)
|
|
71
|
+
|
|
72
|
+
Upstream: https://github.com/alphagov/govuk-frontend
|
|
73
|
+
|
|
74
|
+
- npm:govuk-frontend dist/govuk/settings 6.5.1 — MIT
|
|
75
|
+
|
|
76
|
+
Vendored under `packages/ds-govuk/scripts/sources/`, with the upstream licence file beside it.
|
|
77
|
+
|
|
78
|
+
### Mantine 8 (`@polyxd/ds-mantine`)
|
|
79
|
+
|
|
80
|
+
Upstream: https://github.com/mantinedev/mantine
|
|
81
|
+
|
|
82
|
+
- npm:@mantine/core styles.css 8.4.2 — MIT
|
|
83
|
+
|
|
84
|
+
Vendored under `packages/ds-mantine/scripts/sources/`, with the upstream licence file beside it.
|
|
85
|
+
|
|
86
|
+
### Material 3 (`@polyxd/ds-material3`)
|
|
87
|
+
|
|
88
|
+
Upstream: https://github.com/material-components/material-web
|
|
89
|
+
|
|
90
|
+
- npm:@material/material-color-utilities 0.4.0 — Apache-2.0
|
|
91
|
+
- github:material-components/material-web tokens/versions/v0_192/_md-ref-typeface.scss, _md-sys-typescale.scss, _md-sys-shape.scss, _md-sys-motion.scss, _md-sys-state.scss, _md-sys-elevation.scss v2.5.0 (commit b4de401eb665ec63474f39319a4ba8f2145974cc) — Apache-2.0
|
|
92
|
+
- github:material-components/material-web tokens/versions/v0_192/_md-comp-scrim.scss, _md-comp-filled-button.scss, _md-comp-icon-button.scss, _md-comp-outlined-text-field.scss v2.5.0 (commit b4de401eb665ec63474f39319a4ba8f2145974cc) — Apache-2.0
|
|
93
|
+
- github:material-components/material-web tokens/_md-comp-focus-ring.scss and elevation/internal/_elevation.scss v2.5.0 (commit b4de401eb665ec63474f39319a4ba8f2145974cc) — Apache-2.0
|
|
94
|
+
|
|
95
|
+
Vendored under `packages/ds-material3/scripts/sources/`, with the upstream licence file beside it.
|
|
96
|
+
|
|
97
|
+
### Shopify Polaris (`@polyxd/ds-polaris`)
|
|
98
|
+
|
|
99
|
+
Upstream: https://github.com/Shopify/polaris
|
|
100
|
+
|
|
101
|
+
- npm:@shopify/polaris-tokens dist/css/styles.css 9.4.2 — MIT
|
|
102
|
+
|
|
103
|
+
Vendored under `packages/ds-polaris/scripts/sources/`, with the upstream licence file beside it.
|
|
104
|
+
|
|
105
|
+
### GitHub Primer (`@polyxd/ds-primer`)
|
|
106
|
+
|
|
107
|
+
Upstream: https://github.com/primer/primitives
|
|
108
|
+
|
|
109
|
+
- npm:@primer/primitives dist/css 11.10.0 — MIT
|
|
110
|
+
|
|
111
|
+
Vendored under `packages/ds-primer/scripts/sources/`, with the upstream licence file beside it.
|
|
112
|
+
|
|
113
|
+
### Radix Themes 3 (`@polyxd/ds-radix`)
|
|
114
|
+
|
|
115
|
+
Upstream: https://github.com/radix-ui/themes
|
|
116
|
+
|
|
117
|
+
- npm:@radix-ui/themes styles.css 3.3.0 — MIT
|
|
118
|
+
|
|
119
|
+
Vendored under `packages/ds-radix/scripts/sources/`, with the upstream licence file beside it.
|
|
120
|
+
|
|
121
|
+
### shadcn/ui on Tailwind CSS (`@polyxd/ds-shadcn`)
|
|
122
|
+
|
|
123
|
+
Upstream: https://github.com/shadcn-ui/ui
|
|
124
|
+
|
|
125
|
+
- shadcn/ui default theme main @ 2026-09-20 — MIT
|
|
126
|
+
- npm:tailwindcss theme.css 4.3.3 — MIT
|
|
127
|
+
|
|
128
|
+
Vendored under `packages/ds-shadcn/scripts/sources/`, with the upstream licence file beside it.
|
|
129
|
+
|
|
130
|
+
### Adobe Spectrum 2 (`@polyxd/ds-spectrum`)
|
|
131
|
+
|
|
132
|
+
Upstream: https://github.com/adobe/spectrum-tokens
|
|
133
|
+
|
|
134
|
+
- npm:@adobe/spectrum-tokens dist/json/variables.json 15.4.1 — Apache-2.0
|
|
135
|
+
|
|
136
|
+
Vendored under `packages/ds-spectrum/scripts/sources/`, with the upstream licence file beside it.
|
|
137
|
+
|
|
138
|
+
## Specification
|
|
139
|
+
|
|
140
|
+
### A2UI
|
|
141
|
+
|
|
142
|
+
- `packages/a2ui/vendor/a2ui/v1_0-04e6f07/` — Apache-2.0
|
|
143
|
+
|
|
144
|
+
Vendored at a pinned commit so the component catalogue can be checked against
|
|
145
|
+
A2UI's schema without a network.
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
## Dependencies
|
|
149
|
+
|
|
150
|
+
Everything Polyxd depends on at runtime or to build is fetched from npm rather
|
|
151
|
+
than vendored, so the licences below are recorded rather than reproduced.
|
|
152
|
+
|
|
153
|
+
Apache-2.0: playwright
|
|
154
|
+
MIT: react, react-dom, radix-ui, ajv, ajv-formats, vite, @vitejs/plugin-react,
|
|
155
|
+
marked, lenis, @types/react, @types/react-dom
|
|
156
|
+
MIT OR Apache-2.0: wrangler, @cloudflare/workers-types
|
|
157
|
+
|
|
158
|
+
Two need a word.
|
|
159
|
+
|
|
160
|
+
**axe-core** (Mozilla Public License 2.0) runs inside the verifier's rendered
|
|
161
|
+
audit. MPL-2.0 is file-level copyleft: it attaches to modified MPL files, and
|
|
162
|
+
axe-core is used unmodified, as a library. No Polyxd file is covered by it.
|
|
163
|
+
|
|
164
|
+
**GSAP** (https://gsap.com/standard-license) drives the motion on polyxd.com
|
|
165
|
+
only, and is not an OSI-approved licence. It is not used by the spec, the
|
|
166
|
+
renderer, the packs or the verifier, none of which it can reach; and no GSAP
|
|
167
|
+
file is committed to this repository — the site's build copies them out of
|
|
168
|
+
node_modules into its own output. Anyone building the site is therefore subject
|
|
169
|
+
to GSAP's licence, and anyone using the rest of Polyxd is not.
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
## Fonts
|
|
173
|
+
|
|
174
|
+
No font files are distributed. polyxd.com loads its typefaces from Google Fonts
|
|
175
|
+
at request time, and a design-system pack names the typeface its system
|
|
176
|
+
specifies without shipping it — a pack that asks for Adobe Clean, for example,
|
|
177
|
+
names an open metric-compatible fallback for anyone who does not have it.
|
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @polyxd/verifier
|
|
2
|
+
|
|
3
|
+
Scores a Polyxd UI document the way it will actually be used: rendered, in every design system, by people and by agents.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm run verify:examples -w @polyxd/verifier # all spec examples, full matrix, with agent tasks
|
|
7
|
+
npm run verify -w @polyxd/verifier -- my-ui.json --themes carbon --modes light --widths 390 --json report.json
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## What it checks
|
|
11
|
+
|
|
12
|
+
| Layer | Checks |
|
|
13
|
+
|---|---|
|
|
14
|
+
| **Document** | Spec validation (schema, references, one primary action per view, data bindings…), the declared pattern's rules, capability safety (destructive only in a Confirm, consequential only after review), Design Direction / acceptance rules, at most 6 inputs per view, no empty text, unique control names, labels that say what happens |
|
|
15
|
+
| **Rendered** (headless Chromium, per design system × mode × width) | axe-core WCAG 2.2 AA, horizontal overflow, target size (WCAG 2.5.8 and the pack's own minimum), runtime errors |
|
|
16
|
+
| **Agent** | Scripted tasks (`bench/tasks.json`) performed only through the accessibility tree: roles and accessible names, never CSS selectors. The host must receive the expected capability event |
|
|
17
|
+
| **Consistency** | `compare(previous, current)`: pattern, key coverage, component per key, relative order and labels, with a plain-language list of differences |
|
|
18
|
+
|
|
19
|
+
Default matrix: Material 3, Carbon and Ant Design × light and dark × 390px and 1100px.
|
|
20
|
+
|
|
21
|
+
## Score (v0)
|
|
22
|
+
|
|
23
|
+
Start at 100. Each distinct failing error check costs 20, each distinct warning 4, and failed agent runs cost up to 40 in proportion. A document that fails the schema scores 0. The weights are a starting point; the gold set (`bench/gold`) exists to calibrate them against designers' rankings.
|
|
24
|
+
|
|
25
|
+
## Results today
|
|
26
|
+
|
|
27
|
+
- All 20 spec examples score 100 across 240 renders; 216/216 agent task runs succeed.
|
|
28
|
+
- 20/20 injected defects are caught (`test/defects.test.ts`), across schema, structure, patterns, capabilities, copy, rendered accessibility, layout and agent operability.
|
|
29
|
+
- Building the verifier found real renderer bugs, since fixed: graphics-only colours used for text (failed WCAG contrast in Carbon and Ant), selection rows below each pack's target size, "(required)" and option descriptions leaking into accessible names, and root confirmations blocking the host page.
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Page } from "playwright";
|
|
2
|
+
/**
|
|
3
|
+
* A task step, written the way a user or agent would describe it: by visible names only.
|
|
4
|
+
* The agent resolves every step through the accessibility tree (roles + accessible names),
|
|
5
|
+
* never CSS selectors, so a task that passes is operable by assistive technology and AI agents.
|
|
6
|
+
*/
|
|
7
|
+
export type Step = {
|
|
8
|
+
fill: string;
|
|
9
|
+
value: string;
|
|
10
|
+
} | {
|
|
11
|
+
choose: string;
|
|
12
|
+
in?: string;
|
|
13
|
+
} | {
|
|
14
|
+
check: string;
|
|
15
|
+
} | {
|
|
16
|
+
toggle: string;
|
|
17
|
+
} | {
|
|
18
|
+
press: string;
|
|
19
|
+
} | {
|
|
20
|
+
tab: string;
|
|
21
|
+
} | {
|
|
22
|
+
setDate: string;
|
|
23
|
+
value: string;
|
|
24
|
+
};
|
|
25
|
+
export interface Task {
|
|
26
|
+
id: string;
|
|
27
|
+
/** Example document file name (in @polyxd/spec examples) */
|
|
28
|
+
document: string;
|
|
29
|
+
journey?: string;
|
|
30
|
+
instruction: string;
|
|
31
|
+
steps: Step[];
|
|
32
|
+
expect: {
|
|
33
|
+
event: string;
|
|
34
|
+
context?: Record<string, unknown>;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface AgentResult {
|
|
38
|
+
success: boolean;
|
|
39
|
+
steps: number;
|
|
40
|
+
error?: string;
|
|
41
|
+
sent: {
|
|
42
|
+
name: string;
|
|
43
|
+
context: Record<string, unknown>;
|
|
44
|
+
}[];
|
|
45
|
+
}
|
|
46
|
+
/** Runs a task on a rendered surface and checks the host received the expected capability event. */
|
|
47
|
+
export declare function runTask(page: Page, task: Task): Promise<AgentResult>;
|
package/dist/agent.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { sentActions } from "./browser.js";
|
|
2
|
+
const exact = (name) => ({ name, exact: true });
|
|
3
|
+
async function one(locator, what) {
|
|
4
|
+
const n = await locator.count();
|
|
5
|
+
if (n === 0)
|
|
6
|
+
throw new Error(`no ${what}`);
|
|
7
|
+
if (n > 1)
|
|
8
|
+
throw new Error(`${n} elements match ${what}; names must be unique for agents`);
|
|
9
|
+
return locator;
|
|
10
|
+
}
|
|
11
|
+
async function runStep(root, step) {
|
|
12
|
+
if ("fill" in step) {
|
|
13
|
+
// By role and computed accessible name, as assistive technology and agents see it.
|
|
14
|
+
const field = await one(root.getByRole("textbox", exact(step.fill)).or(root.getByRole("searchbox", exact(step.fill))).or(root.getByRole("spinbutton", exact(step.fill))), `field named "${step.fill}"`);
|
|
15
|
+
await field.fill(step.value);
|
|
16
|
+
}
|
|
17
|
+
else if ("choose" in step) {
|
|
18
|
+
const scope = step.in ? await one(root.getByRole("radiogroup", exact(step.in)).or(root.getByRole("group", exact(step.in))), `group "${step.in}"`) : root;
|
|
19
|
+
const option = await one(scope.getByRole("radio", exact(step.choose)), `option "${step.choose}"`);
|
|
20
|
+
await option.click();
|
|
21
|
+
}
|
|
22
|
+
else if ("check" in step) {
|
|
23
|
+
const box = await one(root.getByRole("checkbox", exact(step.check)), `checkbox "${step.check}"`);
|
|
24
|
+
await box.click();
|
|
25
|
+
}
|
|
26
|
+
else if ("toggle" in step) {
|
|
27
|
+
const control = await one(root.getByRole("switch", exact(step.toggle)).or(root.getByRole("checkbox", exact(step.toggle))), `toggle "${step.toggle}"`);
|
|
28
|
+
await control.click();
|
|
29
|
+
}
|
|
30
|
+
else if ("press" in step) {
|
|
31
|
+
const button = await one(root.getByRole("button", exact(step.press)), `button "${step.press}"`);
|
|
32
|
+
await button.click();
|
|
33
|
+
}
|
|
34
|
+
else if ("tab" in step) {
|
|
35
|
+
const tab = await one(root.getByRole("tab", exact(step.tab)), `tab "${step.tab}"`);
|
|
36
|
+
await tab.click();
|
|
37
|
+
}
|
|
38
|
+
else if ("setDate" in step) {
|
|
39
|
+
const field = await one(root.getByLabel(step.setDate, { exact: true }), `date field "${step.setDate}"`);
|
|
40
|
+
await field.fill(step.value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const matches = (actual, expected) => expected !== null && typeof expected === "object" && !Array.isArray(expected)
|
|
44
|
+
? actual !== null && typeof actual === "object" && Object.entries(expected).every(([k, v]) => matches(actual[k], v))
|
|
45
|
+
: JSON.stringify(actual) === JSON.stringify(expected);
|
|
46
|
+
/** Opens any collapsed Disclosure, so hidden detail doesn't look like a missing control. */
|
|
47
|
+
async function openDetail(root) {
|
|
48
|
+
const closed = root.locator('.pxd-disclosure-trigger[aria-expanded="false"]');
|
|
49
|
+
const n = await closed.count();
|
|
50
|
+
for (let i = 0; i < n; i++)
|
|
51
|
+
await closed.nth(0).click();
|
|
52
|
+
return n > 0;
|
|
53
|
+
}
|
|
54
|
+
/** Runs a task on a rendered surface and checks the host received the expected capability event. */
|
|
55
|
+
export async function runTask(page, task) {
|
|
56
|
+
const root = page.locator(".pxd-surface");
|
|
57
|
+
let done = 0;
|
|
58
|
+
try {
|
|
59
|
+
for (const step of task.steps) {
|
|
60
|
+
try {
|
|
61
|
+
await runStep(root, step);
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
// Detail behind progressive disclosure is hidden, not unavailable: open it and try again,
|
|
65
|
+
// which is what a capable agent (or a person) does.
|
|
66
|
+
if (!/^no /.test(e.message) || !(await openDetail(root)))
|
|
67
|
+
throw e;
|
|
68
|
+
await runStep(root, step);
|
|
69
|
+
}
|
|
70
|
+
done++;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
return { success: false, steps: done, error: `step ${done + 1} (${JSON.stringify(task.steps[done])}): ${e.message.split("\n")[0]}`, sent: await sentActions(page) };
|
|
75
|
+
}
|
|
76
|
+
const sent = await sentActions(page);
|
|
77
|
+
const hit = sent.find((a) => a.name === task.expect.event && matches(a.context, task.expect.context ?? {}));
|
|
78
|
+
return hit
|
|
79
|
+
? { success: true, steps: done, sent }
|
|
80
|
+
: { success: false, steps: done, error: `expected ${task.expect.event} ${JSON.stringify(task.expect.context ?? {})}, host received ${JSON.stringify(sent)}`, sent };
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"m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W,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;IACjL,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5G,OAAO,GAAG;QACR,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE;QACtC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC;AACxK,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Browser, type Page } from "playwright";
|
|
2
|
+
export interface RenderTarget {
|
|
3
|
+
theme: string;
|
|
4
|
+
mode: "light" | "dark";
|
|
5
|
+
/** Viewport width in CSS pixels, e.g. 390 (phone) or 1100 (desktop) */
|
|
6
|
+
width: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function launch(): Promise<Browser>;
|
|
9
|
+
/**
|
|
10
|
+
* Opens a page with one document rendered in one theme/mode/width. The harness is served from
|
|
11
|
+
* disk through request interception, so nothing listens on a port.
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderPage(browser: Browser, document: unknown, target: RenderTarget): Promise<{
|
|
14
|
+
page: Page;
|
|
15
|
+
errors: string[];
|
|
16
|
+
}>;
|
|
17
|
+
/** Actions the rendered UI has sent to the host so far. */
|
|
18
|
+
export declare function sentActions(page: Page): Promise<{
|
|
19
|
+
name: string;
|
|
20
|
+
context: Record<string, unknown>;
|
|
21
|
+
source: string;
|
|
22
|
+
}[]>;
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { extname } from "node:path";
|
|
4
|
+
import { chromium } from "playwright";
|
|
5
|
+
const HARNESS = new URL("../harness-dist/", import.meta.url);
|
|
6
|
+
const ORIGIN = "http://harness.polyxd.local";
|
|
7
|
+
const TYPES = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml" };
|
|
8
|
+
const axeSource = readFile(createRequire(import.meta.url).resolve("axe-core/axe.min.js"), "utf8");
|
|
9
|
+
export async function launch() {
|
|
10
|
+
return chromium.launch();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Opens a page with one document rendered in one theme/mode/width. The harness is served from
|
|
14
|
+
* disk through request interception, so nothing listens on a port.
|
|
15
|
+
*/
|
|
16
|
+
export async function renderPage(browser, document, target) {
|
|
17
|
+
const page = await browser.newPage({ viewport: { width: target.width, height: 900 }, reducedMotion: "reduce" });
|
|
18
|
+
const errors = [];
|
|
19
|
+
page.on("pageerror", (e) => errors.push(e.message));
|
|
20
|
+
page.on("console", (m) => m.type() === "error" && errors.push(m.text()));
|
|
21
|
+
await page.route(`${ORIGIN}/**`, async (route) => {
|
|
22
|
+
const path = new URL(route.request().url()).pathname.slice(1) || "index.html";
|
|
23
|
+
try {
|
|
24
|
+
const body = await readFile(new URL(path, HARNESS));
|
|
25
|
+
await route.fulfill({ body, contentType: TYPES[extname(path)] ?? "application/octet-stream" });
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
await route.fulfill({ status: 404 });
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
await page.addInitScript((cfg) => (window.__PXD__ = cfg), { document, theme: target.theme, mode: target.mode });
|
|
32
|
+
await page.goto(`${ORIGIN}/index.html`);
|
|
33
|
+
await page.waitForFunction(() => window.__pxdReady === true, undefined, { timeout: 10_000 });
|
|
34
|
+
await page.addScriptTag({ content: await axeSource });
|
|
35
|
+
return { page, errors };
|
|
36
|
+
}
|
|
37
|
+
/** Actions the rendered UI has sent to the host so far. */
|
|
38
|
+
export function sentActions(page) {
|
|
39
|
+
return page.evaluate(() => window.__pxdActions);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAA2B,MAAM,YAAY,CAAC;AAE/D,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,kBAAkB,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,MAAM,GAAG,6BAA6B,CAAC;AAC7C,MAAM,KAAK,GAA2B,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;AACtI,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC,CAAC;AASlG,MAAM,CAAC,KAAK,UAAU,MAAM;IAC1B,OAAO,QAAQ,CAAC,MAAM,EAAE,CAAC;AAC3B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C;QACvC,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAE,MAAc,CAAC,OAAO,GAAG,GAAG,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACzH,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,aAAa,CAAC,CAAC;IACxC,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,CAAE,MAAc,CAAC,UAAU,KAAK,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACtG,MAAM,IAAI,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,MAAM,SAAS,EAAE,CAAC,CAAC;IACtD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,WAAW,CAAC,IAAU;IACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAE,MAAc,CAAC,YAAY,CAAC,CAAC;AAC3D,CAAC"}
|
package/dist/checkset.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A fingerprint of the checks a score was produced under.
|
|
3
|
+
*
|
|
4
|
+
* Two scores are only comparable if the same checks produced them. This has caught us out twice:
|
|
5
|
+
* sft-v3 was compared to sft-v2 across a change in the checks, and then rl-1 was compared to
|
|
6
|
+
* sft-v3 the same way — a seven-point "regression" that was five points of improvement once both
|
|
7
|
+
* were re-scored. A number in a table looks identical either way, so the fingerprint travels with
|
|
8
|
+
* it and the leaderboard refuses to rank across a change.
|
|
9
|
+
*
|
|
10
|
+
* The list is read from the source rather than maintained by hand, because a list maintained by
|
|
11
|
+
* hand is one someone forgets to update on the commit that matters.
|
|
12
|
+
*/
|
|
13
|
+
import { readFileSync } from "node:fs";
|
|
14
|
+
import { createHash } from "node:crypto";
|
|
15
|
+
/** Every check id the static audit can emit, in order. */
|
|
16
|
+
export function checkIds() {
|
|
17
|
+
const source = readFileSync(new URL("./static.ts", import.meta.url), "utf8");
|
|
18
|
+
return [...new Set([...source.matchAll(/check: "([a-z0-9:_-]+)"/g)].map((m) => m[1]))].sort();
|
|
19
|
+
}
|
|
20
|
+
/** A short, stable fingerprint of that list. */
|
|
21
|
+
export function checkSet() {
|
|
22
|
+
const checks = checkIds();
|
|
23
|
+
return { id: createHash("sha256").update(checks.join(",")).digest("hex").slice(0, 8), checks };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=checkset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkset.js","sourceRoot":"","sources":["../src/checkset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,0DAA0D;AAC1D,MAAM,UAAU,QAAQ;IACtB,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7E,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAChG,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,QAAQ;IACtB,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAC;IAC1B,OAAO,EAAE,EAAE,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;AACjG,CAAC"}
|