@slashgear/gdpr-cookie-scanner 3.4.0 → 3.5.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/.github/workflows/update-cookie-db.yml +94 -0
- package/CHANGELOG.md +44 -0
- package/CLAUDE.md +18 -0
- package/Dockerfile +1 -0
- package/README.md +11 -10
- package/dist/classifiers/cookie-lookup.d.ts +8 -0
- package/dist/classifiers/cookie-lookup.d.ts.map +1 -0
- package/dist/classifiers/cookie-lookup.js +50 -0
- package/dist/classifiers/cookie-lookup.js.map +1 -0
- package/dist/cli.js +4 -3
- package/dist/cli.js.map +1 -1
- package/dist/data/open-cookie-database.json +25614 -0
- package/dist/report/generator.d.ts +1 -0
- package/dist/report/generator.d.ts.map +1 -1
- package/dist/report/generator.js +100 -4
- package/dist/report/generator.js.map +1 -1
- package/dist/report/html.d.ts.map +1 -1
- package/dist/report/html.js +16 -2
- package/dist/report/html.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -3
- package/scripts/copy-data.mjs +4 -0
- package/scripts/update-cookie-db.mjs +15 -0
- package/src/classifiers/cookie-lookup.ts +72 -0
- package/src/cli.ts +8 -3
- package/src/data/open-cookie-database.json +25614 -0
- package/src/report/generator.ts +119 -6
- package/src/report/html.ts +16 -2
- package/src/types.ts +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
name: Update Cookie DB
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
# 1st of every month at 04:00 UTC
|
|
6
|
+
- cron: "0 4 1 * *"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
update:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
pull-requests: write
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v6
|
|
18
|
+
|
|
19
|
+
- uses: pnpm/action-setup@v4
|
|
20
|
+
with:
|
|
21
|
+
version: latest
|
|
22
|
+
|
|
23
|
+
- uses: actions/setup-node@v4
|
|
24
|
+
with:
|
|
25
|
+
node-version: 24
|
|
26
|
+
cache: pnpm
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: pnpm install --frozen-lockfile
|
|
30
|
+
|
|
31
|
+
- name: Fetch Open Cookie Database
|
|
32
|
+
run: pnpm update:ocd
|
|
33
|
+
|
|
34
|
+
- name: Detect changes
|
|
35
|
+
id: diff
|
|
36
|
+
run: |
|
|
37
|
+
git diff --quiet src/data/open-cookie-database.json \
|
|
38
|
+
&& echo "changed=false" >> "$GITHUB_OUTPUT" \
|
|
39
|
+
|| echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
40
|
+
|
|
41
|
+
- name: Type-check
|
|
42
|
+
if: steps.diff.outputs.changed == 'true'
|
|
43
|
+
run: pnpm typecheck
|
|
44
|
+
|
|
45
|
+
- name: Format
|
|
46
|
+
if: steps.diff.outputs.changed == 'true'
|
|
47
|
+
run: pnpm format
|
|
48
|
+
|
|
49
|
+
- name: Create PR
|
|
50
|
+
if: steps.diff.outputs.changed == 'true'
|
|
51
|
+
env:
|
|
52
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
53
|
+
run: |
|
|
54
|
+
BRANCH="chore/cookie-db-$(date +%Y%m)"
|
|
55
|
+
DATE="$(date +%Y-%m-%d)"
|
|
56
|
+
SLUG="cookie-db-update-${DATE}"
|
|
57
|
+
|
|
58
|
+
git config user.name "github-actions[bot]"
|
|
59
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
60
|
+
git checkout -b "$BRANCH"
|
|
61
|
+
|
|
62
|
+
# Write changeset
|
|
63
|
+
cat > ".changeset/${SLUG}.md" << EOF
|
|
64
|
+
---
|
|
65
|
+
"@slashgear/gdpr-cookie-scanner": patch
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
chore: monthly Open Cookie Database update
|
|
69
|
+
EOF
|
|
70
|
+
|
|
71
|
+
git add src/data/open-cookie-database.json ".changeset/${SLUG}.md"
|
|
72
|
+
git commit -m "chore: update Open Cookie Database"
|
|
73
|
+
git push origin "$BRANCH"
|
|
74
|
+
|
|
75
|
+
gh pr create \
|
|
76
|
+
--title "chore: monthly Open Cookie Database update ($(date +%B %Y))" \
|
|
77
|
+
--body "$(cat <<'BODY'
|
|
78
|
+
## Summary
|
|
79
|
+
|
|
80
|
+
Automated monthly update of `src/data/open-cookie-database.json`.
|
|
81
|
+
|
|
82
|
+
- **Source**: [Open Cookie Database](https://github.com/jkwakman/Open-Cookie-Database) (Apache 2.0)
|
|
83
|
+
- Cookie descriptions are used to pre-fill the Description column in reports.
|
|
84
|
+
|
|
85
|
+
## Test plan
|
|
86
|
+
|
|
87
|
+
- [ ] `pnpm typecheck` passes (validated by CI)
|
|
88
|
+
- [ ] `pnpm build` produces `dist/data/open-cookie-database.json`
|
|
89
|
+
- [ ] Spot-check a few cookie descriptions in the updated file
|
|
90
|
+
|
|
91
|
+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
92
|
+
BODY
|
|
93
|
+
)" \
|
|
94
|
+
--base main
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @slashgear/gdpr-cookie-scanner
|
|
2
2
|
|
|
3
|
+
## 3.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2893782: fix: copy scripts/ directory into Docker build stage
|
|
8
|
+
|
|
9
|
+
The `pnpm build` script now runs `tsc && node scripts/copy-data.mjs` to copy
|
|
10
|
+
the vendored Open Cookie Database into `dist/data/`. The Dockerfile only copied
|
|
11
|
+
`src/` and `tsconfig.json`, so the build stage was missing `scripts/`, causing
|
|
12
|
+
the Docker image build to fail with `Cannot find module '/app/scripts/copy-data.mjs'`.
|
|
13
|
+
|
|
14
|
+
## 3.5.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- f41d0a0: feat: pre-fill cookie descriptions from Open Cookie Database and add CSV output format
|
|
19
|
+
|
|
20
|
+
Cookie reports now automatically include descriptions, platform names, retention
|
|
21
|
+
periods, and privacy-policy links for ~2 000+ recognised cookies, sourced from the
|
|
22
|
+
Open Cookie Database (Apache 2.0, vendored at `src/data/open-cookie-database.json`).
|
|
23
|
+
|
|
24
|
+
Previously the Description column in the Markdown cookie inventory was left as a
|
|
25
|
+
`<!-- fill in -->` placeholder. It is now pre-populated whenever the OCD contains a
|
|
26
|
+
matching entry (exact name or wildcard prefix), with the placeholder kept only for
|
|
27
|
+
unrecognised cookies.
|
|
28
|
+
|
|
29
|
+
The same enrichment is applied to the HTML report (new Description column in every
|
|
30
|
+
cookie table, with the platform and privacy-policy link surfaced in a tooltip) and to
|
|
31
|
+
the new `csv` output format (`gdpr-cookies-*.csv`), which includes all cookie
|
|
32
|
+
metadata plus the OCD fields in a machine-readable file suitable for DPA submissions
|
|
33
|
+
or spreadsheet review.
|
|
34
|
+
|
|
35
|
+
A `pnpm update:ocd` script and a monthly GitHub Actions workflow
|
|
36
|
+
(`.github/workflows/update-cookie-db.yml`) keep the vendored database up to date.
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- b88dad5: fix: truncate long cookie names with ellipsis in HTML cookie tables
|
|
41
|
+
|
|
42
|
+
Cookie names that contain URLs or other unusually long strings (e.g. Optimizely
|
|
43
|
+
session keys) were breaking the table layout in the HTML report. The Name column
|
|
44
|
+
now clamps to 220 px with `text-overflow: ellipsis`; hovering the cell reveals
|
|
45
|
+
the full name via the `title` attribute.
|
|
46
|
+
|
|
3
47
|
## 3.4.0
|
|
4
48
|
|
|
5
49
|
### Minor Changes
|
package/CLAUDE.md
CHANGED
|
@@ -85,3 +85,21 @@ Grade thresholds: A ≥ 90, B ≥ 75, C ≥ 55, D ≥ 35, F < 35. Exit code 1 on
|
|
|
85
85
|
### Module system
|
|
86
86
|
|
|
87
87
|
The project uses `"type": "module"` with `"moduleResolution": "NodeNext"`. All local imports **must** include the `.js` extension even for `.ts` source files.
|
|
88
|
+
|
|
89
|
+
## Cookie database (Open Cookie Database)
|
|
90
|
+
|
|
91
|
+
The file `src/data/open-cookie-database.json` is vendored from
|
|
92
|
+
https://github.com/jkwakman/Open-Cookie-Database (Apache 2.0).
|
|
93
|
+
|
|
94
|
+
To update manually:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pnpm update:ocd # fetches latest JSON, overwrites src/data/open-cookie-database.json
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
A GitHub Actions workflow (`.github/workflows/update-cookie-db.yml`) runs this
|
|
101
|
+
automatically on the 1st of each month and opens a PR if the file changed.
|
|
102
|
+
|
|
103
|
+
The lookup module (`src/classifiers/cookie-lookup.ts`) builds an exact-match index
|
|
104
|
+
and a wildcard-prefix index at startup. `src/data/` is copied to `dist/data/` by
|
|
105
|
+
`scripts/copy-data.mjs` as part of the `pnpm build` step.
|
package/Dockerfile
CHANGED
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ gdpr-scan scan <url> [options]
|
|
|
67
67
|
| ------------------------ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
68
68
|
| `-o, --output <dir>` | `./gdpr-reports` | Output directory for the report |
|
|
69
69
|
| `-t, --timeout <ms>` | `30000` | Navigation timeout |
|
|
70
|
-
| `-f, --format <formats>` | `html` | Output formats: `md`, `html`, `json`, `pdf` (comma-separated)
|
|
70
|
+
| `-f, --format <formats>` | `html` | Output formats: `md`, `html`, `json`, `pdf`, `csv` (comma-separated) |
|
|
71
71
|
| `--viewport <preset>` | `desktop` | Viewport preset: `desktop` (1280×900), `tablet` (768×1024), `mobile` (390×844) |
|
|
72
72
|
| `--fail-on <threshold>` | `F` | Exit with code 1 if grade is below this letter (`A`/`B`/`C`/`D`/`F`) or score is below this number (`0–100`) |
|
|
73
73
|
| `--json-summary` | — | Emit a machine-readable JSON line to stdout after the scan (parseable by `jq`) |
|
|
@@ -92,7 +92,7 @@ gdpr-scan scan https://example.com --locale en-US --screenshots
|
|
|
92
92
|
gdpr-scan scan https://example.com -f md
|
|
93
93
|
|
|
94
94
|
# Generate all formats at once
|
|
95
|
-
gdpr-scan scan https://example.com -f md,html,json,pdf
|
|
95
|
+
gdpr-scan scan https://example.com -f md,html,json,pdf,csv
|
|
96
96
|
|
|
97
97
|
# Scan with a mobile viewport (390×844, iPhone UA)
|
|
98
98
|
gdpr-scan scan https://example.com --viewport mobile
|
|
@@ -262,7 +262,7 @@ const result = await scan("https://example.com", { locale: "fr-FR" });
|
|
|
262
262
|
const generator = new ReportGenerator({
|
|
263
263
|
url: result.url,
|
|
264
264
|
outputDir: "./reports",
|
|
265
|
-
formats: ["html", "json"], // 'md' | 'html' | 'json' | 'pdf'
|
|
265
|
+
formats: ["html", "json"], // 'md' | 'html' | 'json' | 'pdf' | 'csv'
|
|
266
266
|
locale: "fr-FR",
|
|
267
267
|
timeout: 30_000,
|
|
268
268
|
screenshots: false,
|
|
@@ -300,14 +300,15 @@ A real Chromium browser loads the page, interacts with the consent modal (reject
|
|
|
300
300
|
|
|
301
301
|
## Generated reports
|
|
302
302
|
|
|
303
|
-
Each scan produces up to
|
|
303
|
+
Each scan produces up to 5 file types in `<output-dir>/<hostname>/`:
|
|
304
304
|
|
|
305
|
-
| Format | Files | Description
|
|
306
|
-
| ------ | -------------------------------------------------------------- |
|
|
307
|
-
| `md` | `gdpr-report-*.md`, `gdpr-checklist-*.md`, `gdpr-cookies-*.md` | Main compliance report, per-rule checklist with legal references, and deduplicated cookie inventory
|
|
308
|
-
| `html` | `gdpr-report-*.html` | Self-contained styled report — grade badge, score cards, dark-pattern issues, cookie and tracker tables. Opens in any browser, no dependencies
|
|
309
|
-
| `json` | `gdpr-report-*.json` | Full raw scan result for programmatic processing or CI integration
|
|
310
|
-
| `pdf` | `gdpr-report-*.pdf` | PDF built from the Markdown reports via Playwright
|
|
305
|
+
| Format | Files | Description |
|
|
306
|
+
| ------ | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
307
|
+
| `md` | `gdpr-report-*.md`, `gdpr-checklist-*.md`, `gdpr-cookies-*.md` | Main compliance report, per-rule checklist with legal references, and deduplicated cookie inventory |
|
|
308
|
+
| `html` | `gdpr-report-*.html` | Self-contained styled report — grade badge, score cards, dark-pattern issues, cookie and tracker tables. Opens in any browser, no dependencies |
|
|
309
|
+
| `json` | `gdpr-report-*.json` | Full raw scan result for programmatic processing or CI integration |
|
|
310
|
+
| `pdf` | `gdpr-report-*.pdf` | PDF built from the Markdown reports via Playwright |
|
|
311
|
+
| `csv` | `gdpr-cookies-*.csv` | Deduplicated cookie inventory with OCD descriptions, platform, retention period and privacy link — ready for spreadsheet review or DPA submissions |
|
|
311
312
|
|
|
312
313
|
All formats contain:
|
|
313
314
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-lookup.d.ts","sourceRoot":"","sources":["../../src/classifiers/cookie-lookup.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB;AA6CD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAiB1D"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join, dirname } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
// Build indexes once at module load time
|
|
5
|
+
const exactIndex = new Map();
|
|
6
|
+
const wildcardEntries = [];
|
|
7
|
+
function buildIndexes() {
|
|
8
|
+
const dbPath = join(dirname(fileURLToPath(import.meta.url)), "../data/open-cookie-database.json");
|
|
9
|
+
const raw = JSON.parse(readFileSync(dbPath, "utf-8"));
|
|
10
|
+
for (const entries of Object.values(raw)) {
|
|
11
|
+
for (const e of entries) {
|
|
12
|
+
if (!e.cookie)
|
|
13
|
+
continue;
|
|
14
|
+
const ocdEntry = {
|
|
15
|
+
description: e.description,
|
|
16
|
+
platform: e.dataController,
|
|
17
|
+
retentionPeriod: e.retentionPeriod,
|
|
18
|
+
privacyLink: e.privacyLink,
|
|
19
|
+
};
|
|
20
|
+
if (e.wildcardMatch === "1") {
|
|
21
|
+
wildcardEntries.push({ prefix: e.cookie.toLowerCase(), entry: ocdEntry });
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const key = e.cookie.toLowerCase();
|
|
25
|
+
if (!exactIndex.has(key)) {
|
|
26
|
+
exactIndex.set(key, ocdEntry);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
buildIndexes();
|
|
33
|
+
export function lookupCookie(name) {
|
|
34
|
+
const lower = name.toLowerCase();
|
|
35
|
+
// 1. Exact match
|
|
36
|
+
const exact = exactIndex.get(lower);
|
|
37
|
+
if (exact)
|
|
38
|
+
return exact;
|
|
39
|
+
// 2. Wildcard prefix match (longest prefix wins)
|
|
40
|
+
let best = null;
|
|
41
|
+
let bestLen = 0;
|
|
42
|
+
for (const { prefix, entry } of wildcardEntries) {
|
|
43
|
+
if (lower.startsWith(prefix) && prefix.length > bestLen) {
|
|
44
|
+
best = entry;
|
|
45
|
+
bestLen = prefix.length;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return best;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=cookie-lookup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-lookup.js","sourceRoot":"","sources":["../../src/classifiers/cookie-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;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;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,YAAY,EAAE,CAAC;AAEf,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAEjC,iBAAiB;IACjB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IAExB,iDAAiD;IACjD,IAAI,IAAI,GAAoB,IAAI,CAAC;IACjC,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,eAAe,EAAE,CAAC;QAChD,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,OAAO,EAAE,CAAC;YACxD,IAAI,GAAG,KAAK,CAAC;YACb,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ program
|
|
|
19
19
|
.option("--screenshots", "Capture full-page screenshots after reject and accept interactions (the consent modal is always screenshotted when detected)")
|
|
20
20
|
.option("-l, --locale <locale>", "Browser locale for language detection", "fr-FR")
|
|
21
21
|
.option("-v, --verbose", "Show detailed output", false)
|
|
22
|
-
.option("-f, --format <formats>", "Output formats: md, html, json, pdf (comma-separated)", "html")
|
|
22
|
+
.option("-f, --format <formats>", "Output formats: md, html, json, pdf, csv (comma-separated)", "html")
|
|
23
23
|
.option("--viewport <preset>", "Viewport preset: desktop (1280×900), tablet (768×1024), mobile (390×844)", "desktop")
|
|
24
24
|
.option("--fail-on <threshold>", "Exit with code 1 if grade is below this letter (A/B/C/D/F) or score is below this number", "F")
|
|
25
25
|
.option("--json-summary", "Emit a JSON summary line to stdout after the scan (machine-readable)", false)
|
|
@@ -41,13 +41,13 @@ program
|
|
|
41
41
|
console.log(styleText("gray", ` Output : ${outputDir}`));
|
|
42
42
|
console.log(styleText("gray", ` Viewport : ${viewport}`));
|
|
43
43
|
console.log();
|
|
44
|
-
const validFormats = new Set(["md", "html", "json", "pdf"]);
|
|
44
|
+
const validFormats = new Set(["md", "html", "json", "pdf", "csv"]);
|
|
45
45
|
const formats = opts.format
|
|
46
46
|
.split(",")
|
|
47
47
|
.map((f) => f.trim().toLowerCase())
|
|
48
48
|
.filter((f) => validFormats.has(f));
|
|
49
49
|
if (formats.length === 0) {
|
|
50
|
-
console.error(styleText("red", " Invalid --format value. Valid options: md, html, json, pdf"));
|
|
50
|
+
console.error(styleText("red", " Invalid --format value. Valid options: md, html, json, pdf, csv"));
|
|
51
51
|
process.exit(2);
|
|
52
52
|
}
|
|
53
53
|
const options = {
|
|
@@ -90,6 +90,7 @@ program
|
|
|
90
90
|
html: "HTML",
|
|
91
91
|
json: "JSON",
|
|
92
92
|
pdf: "PDF",
|
|
93
|
+
csv: "CSV",
|
|
93
94
|
};
|
|
94
95
|
for (const [fmt, path] of Object.entries(paths)) {
|
|
95
96
|
console.log(styleText("green", ` ${(labels[fmt] ?? fmt).padEnd(8)} ${path}`));
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAA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