c2pa-react-cawg-component 0.1.8

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matthew Rappard
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # c2pa-react-cawg-component
2
+
3
+ A plugin for [c2pa-react-component](https://github.com/matthewrappard/c2pa-react-component) that renders [CAWG (Creator Assertions Working Group)](https://creator-assertions.github.io/) manifest data — including author, publisher, and the full `stds.schema-org.CreativeWork` assertion — at three progressive levels of detail.
4
+
5
+ ## Requirements
6
+
7
+ This package is a plugin for `c2pa-react-component`. Install both:
8
+
9
+ ```bash
10
+ npm install c2pa-react-cawg-component c2pa-react-component
11
+ ```
12
+
13
+ ### Peer dependencies
14
+
15
+ | Package | Version |
16
+ |---|---|
17
+ | `react` | `^18.0.0 \|\| ^19.0.0` |
18
+ | `react-dom` | `^18.0.0 \|\| ^19.0.0` |
19
+
20
+ ## CSS
21
+
22
+ Import the stylesheet once at the root of your app:
23
+
24
+ ```ts
25
+ import "c2pa-react-cawg-component/style.css";
26
+ ```
27
+
28
+ **Next.js App Router** — add it to `app/layout.tsx`:
29
+
30
+ ```tsx
31
+ import "c2pa-react-cawg-component/style.css";
32
+
33
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
34
+ return (
35
+ <html>
36
+ <body>{children}</body>
37
+ </html>
38
+ );
39
+ }
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ Pass `CAWGManifest` as a plugin to the `C2paManifest` component from `c2pa-react-component`:
45
+
46
+ ```tsx
47
+ import { C2paManifest } from "c2pa-react-component";
48
+ import { CAWGManifest } from "c2pa-react-cawg-component";
49
+ import type { VerificationOutcome } from "c2pa-react-component-types";
50
+ import "c2pa-react-cawg-component/style.css";
51
+
52
+ export function MediaCard({ outcome }: { outcome: VerificationOutcome }) {
53
+ return (
54
+ <C2paManifest
55
+ manifest={outcome}
56
+ plugin={[CAWGManifest]}
57
+ />
58
+ );
59
+ }
60
+ ```
61
+
62
+ ## Component
63
+
64
+ ### `CAWGManifest`
65
+
66
+ Renders CAWG creator assertion data from a C2PA manifest at a configurable level of detail.
67
+
68
+ ```tsx
69
+ import { CAWGManifest } from "c2pa-react-cawg-component";
70
+
71
+ <CAWGManifest manifest={verificationOutcome} level={1} />
72
+ ```
73
+
74
+ #### Props
75
+
76
+ | Prop | Type | Default | Description |
77
+ |---|---|---|---|
78
+ | `manifest` | `VerificationOutcome` | required | Verification result from the C2PA SDK |
79
+ | `level` | `1 \| 2 \| 3` | `1` | Initial disclosure level |
80
+ | `className` | `string` | — | CSS class applied to the root element |
81
+
82
+ #### Disclosure levels
83
+
84
+ | Level | What is shown |
85
+ |---|---|
86
+ | `1` | Compact card: title, claim generator (thumbnail or initials badge), "More Info" button |
87
+ | `2` | Extends level 1 with author and publisher from the `stds.schema-org.CreativeWork` assertion |
88
+ | `3` | Full `stds.schema-org.CreativeWork` assertion — all present Schema.org fields rendered as key/value pairs |
89
+
90
+ Clicking "More Info" advances from level 1 → 2 → 3. Clicking "Small View" at level 3 returns to level 1.
91
+
92
+ ## Types
93
+
94
+ Types are provided by the shared `c2pa-react-component-types` package, which is installed automatically as a dependency.
95
+
96
+ ```ts
97
+ import type {
98
+ VerificationOutcome,
99
+ Manifest,
100
+ ManifestStore,
101
+ PluginC2PA,
102
+ } from "c2pa-react-component-types";
103
+ ```
104
+
105
+ ## Local development
106
+
107
+ Use [yalc](https://github.com/wclr/yalc) to consume the library in another local project without publishing to npm.
108
+
109
+ **Install yalc globally (once):**
110
+
111
+ ```bash
112
+ npm install -g yalc
113
+ ```
114
+
115
+ **Start watch mode in this repo:**
116
+
117
+ ```bash
118
+ # Terminal 1 — rebuild on every save
119
+ npm run dev:lib
120
+
121
+ # Terminal 2 — push updates to yalc's local store
122
+ yalc push --watch
123
+ ```
124
+
125
+ **In your consuming project:**
126
+
127
+ ```bash
128
+ yalc add c2pa-react-cawg-component
129
+ npm install
130
+ ```
131
+
132
+ **Revert to the published npm version:**
133
+
134
+ ```bash
135
+ yalc remove c2pa-react-cawg-component
136
+ npm install
137
+ ```
138
+
139
+ ## License
140
+
141
+ MIT
@@ -0,0 +1,2 @@
1
+ .cawg-card{background:#fff;border-radius:12px;width:95%;padding:16px;display:inline-block;box-shadow:0 4px 20px #00000014}.cawg-container{align-items:center;gap:16px;display:flex}.cawg-square{background-color:gold;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:48px;height:48px;display:flex}.cawg-logo-text{color:#000;letter-spacing:-.5px;font-size:18px;font-weight:700}.cawg-media-title{color:#333;letter-spacing:-.3px;font-size:20px;font-weight:600}.cawg-claim-generator{color:#666;font-size:14px}.cawg-thumbnail{object-fit:cover;border-radius:4px;width:48px;height:48px}.cawg-button{color:#666;cursor:pointer;background:#fff;border:2px solid #666;border-radius:999px;width:100%;height:42px;font-size:16px;font-weight:700;transition:background-color .16s,border-color .16s,color .16s,box-shadow .16s}.cawg-button:hover{color:#fff;background:#111;border-color:#111;box-shadow:0 4px 12px #00000024}.cawg-button:focus-visible{outline-offset:3px;outline:3px solid #11111140}.cawg-section-title{color:#333;margin-bottom:6px;font-size:16px;font-weight:600}.cawg-key-value{margin-top:16px}.cawg-key-value-label{color:#64748b;text-transform:uppercase;letter-spacing:.025em;margin-bottom:4px;font-size:14px;font-weight:600}.cawg-key-value-value{color:#1e293b;font-size:16px;line-height:1.5}.cawg-divider{background:#e2e8f0;height:1px;margin:16px 0}.cawg-roles{flex-wrap:wrap;gap:6px;margin-top:12px;display:flex}.cawg-role-badge{color:#475569;letter-spacing:.02em;background:#f0f4f8;border:1px solid #cbd5e1;border-radius:999px;align-items:center;padding:2px 10px;font-size:12px;font-weight:600;display:inline-flex}.cawg-identity-list{flex-direction:column;gap:8px;margin-top:10px;display:flex}.cawg-identity-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;align-items:flex-start;padding:10px 12px;display:flex}.cawg-identity-type-label{color:#64748b;text-transform:uppercase;letter-spacing:.06em;margin-bottom:2px;font-size:11px;font-weight:700}.cawg-identity-name{color:#1e293b;font-size:14px;font-weight:600}.cawg-identity-provider{color:#64748b;margin-top:1px;font-size:13px}.cawg-identity-link{color:#3b82f6;word-break:break-all;margin-top:2px;font-size:12px;text-decoration:none;display:block}.cawg-identity-link:hover{text-decoration:underline}.cawg-identity-meta{color:#94a3b8;margin-top:3px;font-size:11px}.cawg-training-list{flex-direction:column;gap:6px;margin-top:10px;display:flex}.cawg-training-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;justify-content:space-between;align-items:flex-start;gap:8px;padding:8px 12px;display:flex}.cawg-training-label{color:#374151;font-size:13px;font-weight:500}.cawg-constraint-info{color:#92400e;margin-top:3px;font-size:12px;font-style:italic}.cawg-use-badge{letter-spacing:.04em;text-transform:uppercase;border-radius:999px;flex-shrink:0;padding:2px 8px;font-size:11px;font-weight:700}.cawg-use-allowed{color:#166534;background:#dcfce7}.cawg-use-not-allowed{color:#991b1b;background:#fee2e2}.cawg-use-constrained{color:#854d0e;background:#fef9c3}
2
+ /*$vite$:1*/
@@ -0,0 +1,470 @@
1
+ import e from "react";
2
+ import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ //#region src/components/Cawg/CAWG_Header.tsx
4
+ var i = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_17170_59571)\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12.8875 2.20138C12.9985 0.955258 14.0434 0 15.2937 0H18.7065C19.9567 0 21.0017 0.955258 21.1127 2.20138L21.3059 4.36814C21.85 4.55372 22.3784 4.77304 22.8882 5.02387L24.555 3.62851C25.5149 2.8265 26.9306 2.88955 27.8143 3.77319L30.227 6.18588L30.2287 6.18758C31.1092 7.07235 31.1751 8.48356 30.3723 9.44443L28.9769 11.1112C29.2286 11.6219 29.4473 12.1506 29.6323 12.6944L31.7987 12.8875C33.0448 12.9984 34.0002 14.0434 34.0002 15.2937V18.7065C34.0002 19.9568 33.0448 21.0018 31.7987 21.1127L29.632 21.3059C29.4464 21.85 29.2271 22.3784 28.9763 22.8882L30.3717 24.555C31.1737 25.5149 31.1106 26.9307 30.227 27.8143L27.8143 30.227L27.8126 30.2287C26.9278 31.1092 25.5166 31.1751 24.5557 30.3723L22.889 28.9769C22.3782 29.2286 21.8496 29.4473 21.3058 29.6323L21.1127 31.7987C21.0017 33.0448 19.9567 34.0002 18.7065 34.0002H15.2937C14.0434 34.0002 12.9985 33.0449 12.8875 31.7988L12.6943 29.632C12.1502 29.4465 11.6218 29.2271 11.1119 28.9763L9.44515 30.3717C8.48529 31.1737 7.06951 31.1106 6.18588 30.227L3.77319 27.8143L3.77149 27.8126C2.89097 26.9278 2.82504 25.5166 3.6279 24.5557L5.02323 22.889C4.77158 22.3783 4.55287 21.8496 4.36784 21.3058L2.20148 21.1127C0.95531 21.0018 0 19.9568 0 18.7065V15.2937C0 14.0434 0.95531 12.9984 2.20148 12.8875L4.36814 12.6943C4.55372 12.1502 4.77304 11.6218 5.02387 11.112L3.62851 9.44515C2.8265 8.48529 2.88955 7.06952 3.77319 6.18588L6.18588 3.77319L6.18758 3.77149C7.07235 2.89097 8.48356 2.82504 9.44443 3.6279L11.1112 5.02323C11.6219 4.77158 12.1506 4.55288 12.6943 4.36784L12.8875 2.20138ZM15.2937 2.00016C15.0789 2.00016 14.8988 2.16494 14.8797 2.37888L14.6272 5.2117L14.5661 5.89685L13.9044 6.08489C13.0453 6.32903 12.2307 6.66675 11.4733 7.09234L10.8711 7.43075L10.3414 6.98733L8.16195 5.16279C7.99794 5.02598 7.75432 5.03471 7.59907 5.18865L5.18751 7.6002C5.03615 7.75156 5.02474 7.99645 5.16256 8.16168L6.98732 10.3414L7.42966 10.8698L7.09346 11.4713C6.66869 12.2313 6.32859 13.0469 6.08489 13.9045L5.89685 14.5661L5.2117 14.6272L2.37898 14.8797C2.16503 14.8988 2.00016 15.0789 2.00016 15.2937V18.7065C2.00016 18.9213 2.16493 19.1014 2.37888 19.1205L5.2117 19.373L5.89685 19.4341L6.08489 20.0957C6.32903 20.9548 6.66674 21.7695 7.09234 22.5269L7.43074 23.1291L6.98732 23.6588L5.16279 25.8382C5.02613 26.0022 5.03474 26.2457 5.18849 26.401L5.18921 26.4017L7.6002 28.8127C7.75162 28.9641 7.99664 28.9754 8.16187 28.8375L10.3414 27.0129L10.8698 26.5705L11.4713 26.9067C12.2313 27.3315 13.0469 27.6716 13.9044 27.9153L14.5661 28.1033L14.6272 28.7885L14.8797 31.6212C14.8988 31.8351 15.0789 32 15.2937 32H18.7065C18.9213 32 19.1014 31.8352 19.1204 31.6213L19.373 28.7885L19.434 28.1033L20.0957 27.9153C20.9548 27.6711 21.7695 27.3334 22.5269 26.9078L23.1291 26.5694L23.6588 27.0129L25.8382 28.8374C26.0022 28.9744 26.2458 28.9656 26.4011 28.8115L28.8126 26.4C28.964 26.2486 28.9754 26.0037 28.8376 25.8385L27.0128 23.6588L26.5705 23.1304L26.9067 22.5289C27.3315 21.7689 27.6716 20.9533 27.9153 20.0957L28.1033 19.4341L28.7885 19.373L31.6212 19.1205C31.8351 19.1014 32 18.9213 32 18.7065V15.2937C32 15.0789 31.8352 14.8988 31.6213 14.8797L28.7885 14.6272L28.1033 14.5661L27.9153 13.9045C27.6711 13.0454 27.3334 12.2307 26.9078 11.4733L26.5694 10.8711L27.0128 10.3414L28.8374 8.16195C28.9745 7.99789 28.9655 7.75428 28.8114 7.59895L26.4 5.18751C26.2485 5.03607 26.0034 5.02473 25.8382 5.16279L23.6588 6.98733L23.1304 7.42966L22.5289 7.09347C21.7689 6.66869 20.9533 6.3286 20.0957 6.08489L19.434 5.89685L19.373 5.2117L19.1204 2.37898C19.1014 2.16504 18.9213 2.00016 18.7065 2.00016H15.2937ZM12.1524 16.874C11.9997 17.8144 12.6384 18.7006 13.5788 18.8532C14.5193 19.0059 15.4054 18.3672 15.5581 17.4268C15.7108 16.4863 15.0721 15.6002 14.1317 15.4475C13.1912 15.2949 12.3051 15.9335 12.1524 16.874ZM13.2584 20.8275C11.2275 20.4979 9.84843 18.5843 10.1781 16.5535C10.5077 14.5226 12.4213 13.1436 14.4521 13.4732C16.483 13.8029 17.8621 15.7164 17.5324 17.7473C17.2028 19.7781 15.2892 21.1572 13.2584 20.8275ZM23.61 17.1489C23.61 18.104 22.8349 18.8791 21.8799 18.8791C20.9248 18.8791 20.1497 18.104 20.1497 17.1489C20.1497 16.1939 20.9248 15.4188 21.8799 15.4188C22.8349 15.4188 23.61 16.1939 23.61 17.1489Z\" fill=\"black\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_17170_59571\">\n<rect width=\"34\" height=\"34\" fill=\"black\"/>\n</clipPath>\n</defs>\n</svg>", a = () => /* @__PURE__ */ r("div", {
5
+ style: {
6
+ display: "flex",
7
+ alignItems: "center",
8
+ gap: "8px",
9
+ marginBottom: "16px"
10
+ },
11
+ children: [/* @__PURE__ */ n("div", {
12
+ dangerouslySetInnerHTML: { __html: i },
13
+ style: {
14
+ width: "24px",
15
+ height: "24px",
16
+ display: "flex",
17
+ alignItems: "center"
18
+ }
19
+ }), /* @__PURE__ */ n("span", {
20
+ style: {
21
+ fontSize: "14px",
22
+ fontWeight: 600,
23
+ color: "#333",
24
+ display: "flex",
25
+ alignItems: "center"
26
+ },
27
+ children: "Creator Assertions Working Group"
28
+ })]
29
+ }), o = {
30
+ "cawg.creator": "Creator",
31
+ "cawg.contributor": "Contributor",
32
+ "cawg.editor": "Editor",
33
+ "cawg.producer": "Producer",
34
+ "cawg.publisher": "Publisher",
35
+ "cawg.sponsor": "Sponsor",
36
+ "cawg.translator": "Translator"
37
+ };
38
+ function s({ manifest: e, moreInfo: t }) {
39
+ let i = e.title, s = e.claimGenerator ?? e.claimGeneratorInfo?.[0]?.name ?? "Unknown", c = s.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", l = (e.assertions?.["cawg.identity"])?.signer_payload?.role ?? [];
40
+ return /* @__PURE__ */ r("div", {
41
+ className: "cawg-card",
42
+ children: [
43
+ /* @__PURE__ */ n(a, {}),
44
+ /* @__PURE__ */ r("div", {
45
+ className: "cawg-container",
46
+ children: [e.thumbnail ? /* @__PURE__ */ n("img", {
47
+ src: e.thumbnail,
48
+ alt: "Thumbnail",
49
+ className: "cawg-thumbnail"
50
+ }) : /* @__PURE__ */ n("div", {
51
+ className: "cawg-square",
52
+ children: /* @__PURE__ */ n("span", {
53
+ className: "cawg-logo-text",
54
+ children: c
55
+ })
56
+ }), /* @__PURE__ */ r("div", {
57
+ style: {
58
+ display: "flex",
59
+ flexDirection: "column"
60
+ },
61
+ children: [/* @__PURE__ */ n("span", {
62
+ className: "cawg-media-title",
63
+ children: i
64
+ }), /* @__PURE__ */ n("span", {
65
+ className: "cawg-claim-generator",
66
+ children: s
67
+ })]
68
+ })]
69
+ }),
70
+ l.length > 0 && /* @__PURE__ */ n("div", {
71
+ className: "cawg-roles",
72
+ children: l.map((e) => /* @__PURE__ */ n("span", {
73
+ className: "cawg-role-badge",
74
+ children: o[e] ?? e
75
+ }, e))
76
+ }),
77
+ t && /* @__PURE__ */ n("div", {
78
+ style: { marginTop: 16 },
79
+ children: /* @__PURE__ */ n("button", {
80
+ onClick: t,
81
+ className: "cawg-button",
82
+ children: "More Info"
83
+ })
84
+ })
85
+ ]
86
+ });
87
+ }
88
+ //#endregion
89
+ //#region src/components/Cawg/levels/L2/CAWGL2.tsx
90
+ var c = {
91
+ "cawg.creator": "Creator",
92
+ "cawg.contributor": "Contributor",
93
+ "cawg.editor": "Editor",
94
+ "cawg.producer": "Producer",
95
+ "cawg.publisher": "Publisher",
96
+ "cawg.sponsor": "Sponsor",
97
+ "cawg.translator": "Translator"
98
+ }, l = {
99
+ "cawg.document_verification": "ID Verified",
100
+ "cawg.web_site": "Website",
101
+ "cawg.affiliation": "Affiliation",
102
+ "cawg.social_media": "Social Media",
103
+ "cawg.crypto_wallet": "Crypto Wallet"
104
+ }, u = {
105
+ "cawg.data_mining": "Data Mining",
106
+ "cawg.ai_inference": "AI Inference",
107
+ "cawg.ai_training": "AI Training",
108
+ "cawg.ai_generative_training": "AI Generative Training"
109
+ }, d = {
110
+ allowed: "cawg-use-badge cawg-use-allowed",
111
+ notAllowed: "cawg-use-badge cawg-use-not-allowed",
112
+ constrained: "cawg-use-badge cawg-use-constrained"
113
+ }, f = {
114
+ allowed: "Allowed",
115
+ notAllowed: "Not Allowed",
116
+ constrained: "Constrained"
117
+ };
118
+ function p({ manifest: e, moreInfo: i }) {
119
+ let o = e.title, s = e.claimGenerator ?? e.claimGeneratorInfo?.[0]?.name ?? "Unknown", p = s.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", m = e.assertions?.["cawg.identity"], h = m?.signer_payload?.role ?? [], g = m?.verifiedIdentities ?? [], _ = e.assertions?.["cawg.training-mining"]?.entries ?? {};
120
+ return /* @__PURE__ */ r("div", {
121
+ className: "cawg-card",
122
+ children: [
123
+ /* @__PURE__ */ n(a, {}),
124
+ /* @__PURE__ */ r("div", {
125
+ className: "cawg-container",
126
+ children: [e.thumbnail ? /* @__PURE__ */ n("img", {
127
+ src: e.thumbnail,
128
+ alt: "Thumbnail",
129
+ className: "cawg-thumbnail"
130
+ }) : /* @__PURE__ */ n("div", {
131
+ className: "cawg-square",
132
+ children: /* @__PURE__ */ n("span", {
133
+ className: "cawg-logo-text",
134
+ children: p
135
+ })
136
+ }), /* @__PURE__ */ r("div", {
137
+ style: {
138
+ display: "flex",
139
+ flexDirection: "column"
140
+ },
141
+ children: [/* @__PURE__ */ n("span", {
142
+ className: "cawg-media-title",
143
+ children: o
144
+ }), /* @__PURE__ */ n("span", {
145
+ className: "cawg-claim-generator",
146
+ children: s
147
+ })]
148
+ })]
149
+ }),
150
+ h.length > 0 && /* @__PURE__ */ n("div", {
151
+ className: "cawg-roles",
152
+ children: h.map((e) => /* @__PURE__ */ n("span", {
153
+ className: "cawg-role-badge",
154
+ children: c[e] ?? e
155
+ }, e))
156
+ }),
157
+ g.length > 0 && /* @__PURE__ */ r(t, { children: [
158
+ /* @__PURE__ */ n("div", { className: "cawg-divider" }),
159
+ /* @__PURE__ */ n("div", {
160
+ className: "cawg-section-title",
161
+ children: "Identity"
162
+ }),
163
+ /* @__PURE__ */ n("div", {
164
+ className: "cawg-identity-list",
165
+ children: g.map((e, t) => {
166
+ let i = e.type, a = e.name ?? e.username, o = e.provider;
167
+ return /* @__PURE__ */ n("div", {
168
+ className: "cawg-identity-item",
169
+ children: /* @__PURE__ */ r("div", {
170
+ style: { flex: 1 },
171
+ children: [
172
+ /* @__PURE__ */ n("div", {
173
+ className: "cawg-identity-type-label",
174
+ children: l[i] ?? i
175
+ }),
176
+ a && /* @__PURE__ */ n("div", {
177
+ className: "cawg-identity-name",
178
+ children: a
179
+ }),
180
+ o?.name && /* @__PURE__ */ n("div", {
181
+ className: "cawg-identity-provider",
182
+ children: o.name
183
+ })
184
+ ]
185
+ })
186
+ }, t);
187
+ })
188
+ })
189
+ ] }),
190
+ Object.keys(_).length > 0 && /* @__PURE__ */ r(t, { children: [
191
+ /* @__PURE__ */ n("div", { className: "cawg-divider" }),
192
+ /* @__PURE__ */ n("div", {
193
+ className: "cawg-section-title",
194
+ children: "Training & Data Mining"
195
+ }),
196
+ /* @__PURE__ */ n("div", {
197
+ className: "cawg-training-list",
198
+ children: Object.entries(_).map(([e, t]) => /* @__PURE__ */ r("div", {
199
+ className: "cawg-training-item",
200
+ children: [/* @__PURE__ */ n("span", {
201
+ className: "cawg-training-label",
202
+ children: u[e] ?? e
203
+ }), /* @__PURE__ */ n("span", {
204
+ className: d[t.use] ?? "cawg-use-badge",
205
+ children: f[t.use] ?? t.use
206
+ })]
207
+ }, e))
208
+ })
209
+ ] }),
210
+ i && /* @__PURE__ */ n("div", {
211
+ style: { marginTop: 16 },
212
+ children: /* @__PURE__ */ n("button", {
213
+ onClick: i,
214
+ className: "cawg-button",
215
+ children: "More Info"
216
+ })
217
+ })
218
+ ]
219
+ });
220
+ }
221
+ //#endregion
222
+ //#region src/components/Cawg/levels/L3/CAWGL3.tsx
223
+ var m = {
224
+ "cawg.creator": "Creator",
225
+ "cawg.contributor": "Contributor",
226
+ "cawg.editor": "Editor",
227
+ "cawg.producer": "Producer",
228
+ "cawg.publisher": "Publisher",
229
+ "cawg.sponsor": "Sponsor",
230
+ "cawg.translator": "Translator"
231
+ }, h = {
232
+ "cawg.document_verification": "ID Verified",
233
+ "cawg.web_site": "Website",
234
+ "cawg.affiliation": "Affiliation",
235
+ "cawg.social_media": "Social Media",
236
+ "cawg.crypto_wallet": "Crypto Wallet"
237
+ }, g = {
238
+ "cawg.data_mining": "Data Mining",
239
+ "cawg.ai_inference": "AI Inference",
240
+ "cawg.ai_training": "AI Training",
241
+ "cawg.ai_generative_training": "AI Generative Training"
242
+ }, _ = {
243
+ allowed: "cawg-use-badge cawg-use-allowed",
244
+ notAllowed: "cawg-use-badge cawg-use-not-allowed",
245
+ constrained: "cawg-use-badge cawg-use-constrained"
246
+ }, v = {
247
+ allowed: "Allowed",
248
+ notAllowed: "Not Allowed",
249
+ constrained: "Constrained"
250
+ }, y = {
251
+ "cawg.identity_claims_aggregation": "Identity Claims Aggregation",
252
+ "cawg.x509.cose": "X.509 Certificate",
253
+ "cawg.verifiable_credential_binding": "Verifiable Credential"
254
+ };
255
+ function b(e) {
256
+ try {
257
+ return new Date(e).toLocaleDateString(void 0, {
258
+ year: "numeric",
259
+ month: "long",
260
+ day: "numeric"
261
+ });
262
+ } catch {
263
+ return e;
264
+ }
265
+ }
266
+ function x(e) {
267
+ return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) => x(e)).filter(Boolean).join(", ") : typeof e == "object" ? Object.entries(e).filter(([e]) => !e.startsWith("@")).map(([e, t]) => `${e}: ${x(t)}`).join("; ") : String(e);
268
+ }
269
+ function S({ manifest: e, moreInfo: i }) {
270
+ let o = e.title, s = e.claimGenerator ?? e.claimGeneratorInfo?.[0]?.name ?? "Unknown", c = s.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", l = e.assertions?.["cawg.identity"], u = l?.signer_payload?.role ?? [], d = l?.verifiedIdentities ?? [], f = l?.signer_payload?.sig_type, p = l?.issuer, S = e.assertions?.["cawg.training-mining"]?.entries ?? {}, C = e.assertions?.["cawg.metadata"], w = C ? Object.entries(C).filter(([e]) => !e.startsWith("@")) : [];
271
+ return /* @__PURE__ */ r("div", {
272
+ className: "cawg-card",
273
+ children: [
274
+ /* @__PURE__ */ n(a, {}),
275
+ /* @__PURE__ */ r("div", {
276
+ className: "cawg-container",
277
+ children: [e.thumbnail ? /* @__PURE__ */ n("img", {
278
+ src: e.thumbnail,
279
+ alt: "Thumbnail",
280
+ className: "cawg-thumbnail"
281
+ }) : /* @__PURE__ */ n("div", {
282
+ className: "cawg-square",
283
+ children: /* @__PURE__ */ n("span", {
284
+ className: "cawg-logo-text",
285
+ children: c
286
+ })
287
+ }), /* @__PURE__ */ r("div", {
288
+ style: {
289
+ display: "flex",
290
+ flexDirection: "column"
291
+ },
292
+ children: [/* @__PURE__ */ n("span", {
293
+ className: "cawg-media-title",
294
+ children: o
295
+ }), /* @__PURE__ */ n("span", {
296
+ className: "cawg-claim-generator",
297
+ children: s
298
+ })]
299
+ })]
300
+ }),
301
+ u.length > 0 && /* @__PURE__ */ n("div", {
302
+ className: "cawg-roles",
303
+ children: u.map((e) => /* @__PURE__ */ n("span", {
304
+ className: "cawg-role-badge",
305
+ children: m[e] ?? e
306
+ }, e))
307
+ }),
308
+ l && /* @__PURE__ */ r(t, { children: [
309
+ /* @__PURE__ */ n("div", { className: "cawg-divider" }),
310
+ /* @__PURE__ */ n("div", {
311
+ className: "cawg-section-title",
312
+ children: "Identity Assertion"
313
+ }),
314
+ f && /* @__PURE__ */ r("div", {
315
+ className: "cawg-key-value",
316
+ children: [/* @__PURE__ */ n("div", {
317
+ className: "cawg-key-value-label",
318
+ children: "Credential Type"
319
+ }), /* @__PURE__ */ n("div", {
320
+ className: "cawg-key-value-value",
321
+ children: y[f] ?? f
322
+ })]
323
+ }),
324
+ p && /* @__PURE__ */ r("div", {
325
+ className: "cawg-key-value",
326
+ children: [/* @__PURE__ */ n("div", {
327
+ className: "cawg-key-value-label",
328
+ children: "Issuer"
329
+ }), /* @__PURE__ */ n("div", {
330
+ className: "cawg-key-value-value",
331
+ children: p
332
+ })]
333
+ }),
334
+ d.length > 0 && /* @__PURE__ */ n("div", {
335
+ className: "cawg-identity-list",
336
+ style: { marginTop: 12 },
337
+ children: d.map((e, t) => {
338
+ let i = e.type, a = e.name ?? e.username ?? e.address, o = e.provider, s = e.uri, c = e.verifiedAt;
339
+ return /* @__PURE__ */ n("div", {
340
+ className: "cawg-identity-item",
341
+ children: /* @__PURE__ */ r("div", {
342
+ style: { flex: 1 },
343
+ children: [
344
+ /* @__PURE__ */ n("div", {
345
+ className: "cawg-identity-type-label",
346
+ children: h[i] ?? i
347
+ }),
348
+ a && /* @__PURE__ */ n("div", {
349
+ className: "cawg-identity-name",
350
+ children: a
351
+ }),
352
+ o?.name && /* @__PURE__ */ r("div", {
353
+ className: "cawg-identity-provider",
354
+ children: ["via ", o.name]
355
+ }),
356
+ s && /* @__PURE__ */ n("a", {
357
+ href: s,
358
+ target: "_blank",
359
+ rel: "noopener noreferrer",
360
+ className: "cawg-identity-link",
361
+ children: s
362
+ }),
363
+ c && /* @__PURE__ */ r("div", {
364
+ className: "cawg-identity-meta",
365
+ children: ["Verified ", b(c)]
366
+ })
367
+ ]
368
+ })
369
+ }, t);
370
+ })
371
+ })
372
+ ] }),
373
+ Object.keys(S).length > 0 && /* @__PURE__ */ r(t, { children: [
374
+ /* @__PURE__ */ n("div", { className: "cawg-divider" }),
375
+ /* @__PURE__ */ n("div", {
376
+ className: "cawg-section-title",
377
+ children: "Training & Data Mining"
378
+ }),
379
+ /* @__PURE__ */ n("div", {
380
+ className: "cawg-training-list",
381
+ children: Object.entries(S).map(([e, t]) => /* @__PURE__ */ r("div", {
382
+ className: "cawg-training-item",
383
+ style: {
384
+ flexDirection: "column",
385
+ alignItems: "flex-start"
386
+ },
387
+ children: [/* @__PURE__ */ r("div", {
388
+ style: {
389
+ display: "flex",
390
+ justifyContent: "space-between",
391
+ width: "100%"
392
+ },
393
+ children: [/* @__PURE__ */ n("span", {
394
+ className: "cawg-training-label",
395
+ children: g[e] ?? e
396
+ }), /* @__PURE__ */ n("span", {
397
+ className: _[t.use] ?? "cawg-use-badge",
398
+ children: v[t.use] ?? t.use
399
+ })]
400
+ }), t.constraint_info && /* @__PURE__ */ n("div", {
401
+ className: "cawg-constraint-info",
402
+ children: t.constraint_info
403
+ })]
404
+ }, e))
405
+ })
406
+ ] }),
407
+ w.length > 0 && /* @__PURE__ */ r(t, { children: [
408
+ /* @__PURE__ */ n("div", { className: "cawg-divider" }),
409
+ /* @__PURE__ */ n("div", {
410
+ className: "cawg-section-title",
411
+ children: "Metadata"
412
+ }),
413
+ w.map(([e, t]) => {
414
+ let i = x(t);
415
+ return i ? /* @__PURE__ */ r("div", {
416
+ className: "cawg-key-value",
417
+ children: [/* @__PURE__ */ n("div", {
418
+ className: "cawg-key-value-label",
419
+ children: e
420
+ }), /* @__PURE__ */ n("div", {
421
+ className: "cawg-key-value-value",
422
+ children: i
423
+ })]
424
+ }, e) : null;
425
+ })
426
+ ] }),
427
+ i && /* @__PURE__ */ n("div", {
428
+ style: { marginTop: 16 },
429
+ children: /* @__PURE__ */ n("button", {
430
+ onClick: i,
431
+ className: "cawg-button",
432
+ children: "Small View"
433
+ })
434
+ })
435
+ ]
436
+ });
437
+ }
438
+ //#endregion
439
+ //#region src/components/Cawg/Cawg.tsx
440
+ var C = ({ manifest: t, level: r, className: i }) => {
441
+ let a = t.manifestStore?.activeManifest, o = t.manifests.find((e) => e.id === a || e.instanceId === a) ?? (a ? t.manifestStore.manifests[a] : void 0) ?? t.manifests[0];
442
+ if (!o) return /* @__PURE__ */ n("div", {
443
+ className: i,
444
+ children: "No active manifest found."
445
+ });
446
+ let [c, l] = e.useState(r || 1);
447
+ switch (c) {
448
+ case 1: return /* @__PURE__ */ n(s, {
449
+ manifest: o,
450
+ moreInfo: () => {
451
+ l(2);
452
+ }
453
+ });
454
+ case 2: return /* @__PURE__ */ n(p, {
455
+ manifest: o,
456
+ moreInfo: () => {
457
+ l(3);
458
+ }
459
+ });
460
+ case 3: return /* @__PURE__ */ n(S, {
461
+ manifest: o,
462
+ moreInfo: () => {
463
+ l(1);
464
+ }
465
+ });
466
+ }
467
+ return /* @__PURE__ */ n("div", { children: "Level Of Detail Not Selected" });
468
+ };
469
+ //#endregion
470
+ export { C as CAWGManifest };
@@ -0,0 +1,10 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.C2paReactCawgComponent={},e.React,e.ReactJSXRuntime))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:r(s(e)),l(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);var u=`<svg width="34" height="34" viewBox="0 0 34 34" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_17170_59571)">
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12.8875 2.20138C12.9985 0.955258 14.0434 0 15.2937 0H18.7065C19.9567 0 21.0017 0.955258 21.1127 2.20138L21.3059 4.36814C21.85 4.55372 22.3784 4.77304 22.8882 5.02387L24.555 3.62851C25.5149 2.8265 26.9306 2.88955 27.8143 3.77319L30.227 6.18588L30.2287 6.18758C31.1092 7.07235 31.1751 8.48356 30.3723 9.44443L28.9769 11.1112C29.2286 11.6219 29.4473 12.1506 29.6323 12.6944L31.7987 12.8875C33.0448 12.9984 34.0002 14.0434 34.0002 15.2937V18.7065C34.0002 19.9568 33.0448 21.0018 31.7987 21.1127L29.632 21.3059C29.4464 21.85 29.2271 22.3784 28.9763 22.8882L30.3717 24.555C31.1737 25.5149 31.1106 26.9307 30.227 27.8143L27.8143 30.227L27.8126 30.2287C26.9278 31.1092 25.5166 31.1751 24.5557 30.3723L22.889 28.9769C22.3782 29.2286 21.8496 29.4473 21.3058 29.6323L21.1127 31.7987C21.0017 33.0448 19.9567 34.0002 18.7065 34.0002H15.2937C14.0434 34.0002 12.9985 33.0449 12.8875 31.7988L12.6943 29.632C12.1502 29.4465 11.6218 29.2271 11.1119 28.9763L9.44515 30.3717C8.48529 31.1737 7.06951 31.1106 6.18588 30.227L3.77319 27.8143L3.77149 27.8126C2.89097 26.9278 2.82504 25.5166 3.6279 24.5557L5.02323 22.889C4.77158 22.3783 4.55287 21.8496 4.36784 21.3058L2.20148 21.1127C0.95531 21.0018 0 19.9568 0 18.7065V15.2937C0 14.0434 0.95531 12.9984 2.20148 12.8875L4.36814 12.6943C4.55372 12.1502 4.77304 11.6218 5.02387 11.112L3.62851 9.44515C2.8265 8.48529 2.88955 7.06952 3.77319 6.18588L6.18588 3.77319L6.18758 3.77149C7.07235 2.89097 8.48356 2.82504 9.44443 3.6279L11.1112 5.02323C11.6219 4.77158 12.1506 4.55288 12.6943 4.36784L12.8875 2.20138ZM15.2937 2.00016C15.0789 2.00016 14.8988 2.16494 14.8797 2.37888L14.6272 5.2117L14.5661 5.89685L13.9044 6.08489C13.0453 6.32903 12.2307 6.66675 11.4733 7.09234L10.8711 7.43075L10.3414 6.98733L8.16195 5.16279C7.99794 5.02598 7.75432 5.03471 7.59907 5.18865L5.18751 7.6002C5.03615 7.75156 5.02474 7.99645 5.16256 8.16168L6.98732 10.3414L7.42966 10.8698L7.09346 11.4713C6.66869 12.2313 6.32859 13.0469 6.08489 13.9045L5.89685 14.5661L5.2117 14.6272L2.37898 14.8797C2.16503 14.8988 2.00016 15.0789 2.00016 15.2937V18.7065C2.00016 18.9213 2.16493 19.1014 2.37888 19.1205L5.2117 19.373L5.89685 19.4341L6.08489 20.0957C6.32903 20.9548 6.66674 21.7695 7.09234 22.5269L7.43074 23.1291L6.98732 23.6588L5.16279 25.8382C5.02613 26.0022 5.03474 26.2457 5.18849 26.401L5.18921 26.4017L7.6002 28.8127C7.75162 28.9641 7.99664 28.9754 8.16187 28.8375L10.3414 27.0129L10.8698 26.5705L11.4713 26.9067C12.2313 27.3315 13.0469 27.6716 13.9044 27.9153L14.5661 28.1033L14.6272 28.7885L14.8797 31.6212C14.8988 31.8351 15.0789 32 15.2937 32H18.7065C18.9213 32 19.1014 31.8352 19.1204 31.6213L19.373 28.7885L19.434 28.1033L20.0957 27.9153C20.9548 27.6711 21.7695 27.3334 22.5269 26.9078L23.1291 26.5694L23.6588 27.0129L25.8382 28.8374C26.0022 28.9744 26.2458 28.9656 26.4011 28.8115L28.8126 26.4C28.964 26.2486 28.9754 26.0037 28.8376 25.8385L27.0128 23.6588L26.5705 23.1304L26.9067 22.5289C27.3315 21.7689 27.6716 20.9533 27.9153 20.0957L28.1033 19.4341L28.7885 19.373L31.6212 19.1205C31.8351 19.1014 32 18.9213 32 18.7065V15.2937C32 15.0789 31.8352 14.8988 31.6213 14.8797L28.7885 14.6272L28.1033 14.5661L27.9153 13.9045C27.6711 13.0454 27.3334 12.2307 26.9078 11.4733L26.5694 10.8711L27.0128 10.3414L28.8374 8.16195C28.9745 7.99789 28.9655 7.75428 28.8114 7.59895L26.4 5.18751C26.2485 5.03607 26.0034 5.02473 25.8382 5.16279L23.6588 6.98733L23.1304 7.42966L22.5289 7.09347C21.7689 6.66869 20.9533 6.3286 20.0957 6.08489L19.434 5.89685L19.373 5.2117L19.1204 2.37898C19.1014 2.16504 18.9213 2.00016 18.7065 2.00016H15.2937ZM12.1524 16.874C11.9997 17.8144 12.6384 18.7006 13.5788 18.8532C14.5193 19.0059 15.4054 18.3672 15.5581 17.4268C15.7108 16.4863 15.0721 15.6002 14.1317 15.4475C13.1912 15.2949 12.3051 15.9335 12.1524 16.874ZM13.2584 20.8275C11.2275 20.4979 9.84843 18.5843 10.1781 16.5535C10.5077 14.5226 12.4213 13.1436 14.4521 13.4732C16.483 13.8029 17.8621 15.7164 17.5324 17.7473C17.2028 19.7781 15.2892 21.1572 13.2584 20.8275ZM23.61 17.1489C23.61 18.104 22.8349 18.8791 21.8799 18.8791C20.9248 18.8791 20.1497 18.104 20.1497 17.1489C20.1497 16.1939 20.9248 15.4188 21.8799 15.4188C22.8349 15.4188 23.61 16.1939 23.61 17.1489Z" fill="black"/>
4
+ </g>
5
+ <defs>
6
+ <clipPath id="clip0_17170_59571">
7
+ <rect width="34" height="34" fill="black"/>
8
+ </clipPath>
9
+ </defs>
10
+ </svg>`,d=()=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`16px`},children:[(0,n.jsx)(`div`,{dangerouslySetInnerHTML:{__html:u},style:{width:`24px`,height:`24px`,display:`flex`,alignItems:`center`}}),(0,n.jsx)(`span`,{style:{fontSize:`14px`,fontWeight:600,color:`#333`,display:`flex`,alignItems:`center`},children:`Creator Assertions Working Group`})]}),f={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function p({manifest:e,moreInfo:t}){let r=e.title,i=e.claimGenerator??e.claimGeneratorInfo?.[0]?.name??`Unknown`,a=i.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,o=(e.assertions?.[`cawg.identity`])?.signer_payload?.role??[];return(0,n.jsxs)(`div`,{className:`cawg-card`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[e.thumbnail?(0,n.jsx)(`img`,{src:e.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:a})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:r}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:i})]})]}),o.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:o.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:f[e]??e},e))}),t&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:t,className:`cawg-button`,children:`More Info`})})]})}var m={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},h={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},g={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},_={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},v={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function y({manifest:e,moreInfo:t}){let r=e.title,i=e.claimGenerator??e.claimGeneratorInfo?.[0]?.name??`Unknown`,a=i.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,o=e.assertions?.[`cawg.identity`],s=o?.signer_payload?.role??[],c=o?.verifiedIdentities??[],l=e.assertions?.[`cawg.training-mining`]?.entries??{};return(0,n.jsxs)(`div`,{className:`cawg-card`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[e.thumbnail?(0,n.jsx)(`img`,{src:e.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:a})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:r}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:i})]})]}),s.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:s.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:m[e]??e},e))}),c.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity`}),(0,n.jsx)(`div`,{className:`cawg-identity-list`,children:c.map((e,t)=>{let r=e.type,i=e.name??e.username,a=e.provider;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:h[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsx)(`div`,{className:`cawg-identity-provider`,children:a.name})]})},t)})})]}),Object.keys(l).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(l).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:g[e]??e}),(0,n.jsx)(`span`,{className:_[t.use]??`cawg-use-badge`,children:v[t.use]??t.use})]},e))})]}),t&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:t,className:`cawg-button`,children:`More Info`})})]})}var b={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},x={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},S={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},C={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},w={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`},T={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function E(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function D(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>D(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${D(t)}`).join(`; `):String(e)}function O({manifest:e,moreInfo:t}){let r=e.title,i=e.claimGenerator??e.claimGeneratorInfo?.[0]?.name??`Unknown`,a=i.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,o=e.assertions?.[`cawg.identity`],s=o?.signer_payload?.role??[],c=o?.verifiedIdentities??[],l=o?.signer_payload?.sig_type,u=o?.issuer,f=e.assertions?.[`cawg.training-mining`]?.entries??{},p=e.assertions?.[`cawg.metadata`],m=p?Object.entries(p).filter(([e])=>!e.startsWith(`@`)):[];return(0,n.jsxs)(`div`,{className:`cawg-card`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[e.thumbnail?(0,n.jsx)(`img`,{src:e.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:a})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:r}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:i})]})]}),s.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:s.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:b[e]??e},e))}),o&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity Assertion`}),l&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Credential Type`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:T[l]??l})]}),u&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Issuer`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:u})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-identity-list`,style:{marginTop:12},children:c.map((e,t)=>{let r=e.type,i=e.name??e.username??e.address,a=e.provider,o=e.uri,s=e.verifiedAt;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:x[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsxs)(`div`,{className:`cawg-identity-provider`,children:[`via `,a.name]}),o&&(0,n.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`cawg-identity-link`,children:o}),s&&(0,n.jsxs)(`div`,{className:`cawg-identity-meta`,children:[`Verified `,E(s)]})]})},t)})})]}),Object.keys(f).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(f).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,style:{flexDirection:`column`,alignItems:`flex-start`},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,width:`100%`},children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:S[e]??e}),(0,n.jsx)(`span`,{className:C[t.use]??`cawg-use-badge`,children:w[t.use]??t.use})]}),t.constraint_info&&(0,n.jsx)(`div`,{className:`cawg-constraint-info`,children:t.constraint_info})]},e))})]}),m.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Metadata`}),m.map(([e,t])=>{let r=D(t);return r?(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:e}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:r})]},e):null})]}),t&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:t,className:`cawg-button`,children:`Small View`})})]})}e.CAWGManifest=({manifest:e,level:r,className:i})=>{let a=e.manifestStore?.activeManifest,o=e.manifests.find(e=>e.id===a||e.instanceId===a)??(a?e.manifestStore.manifests[a]:void 0)??e.manifests[0];if(!o)return(0,n.jsx)(`div`,{className:i,children:`No active manifest found.`});let[s,c]=t.default.useState(r||1);switch(s){case 1:return(0,n.jsx)(p,{manifest:o,moreInfo:()=>{c(2)}});case 2:return(0,n.jsx)(y,{manifest:o,moreInfo:()=>{c(3)}});case 3:return(0,n.jsx)(O,{manifest:o,moreInfo:()=>{c(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})}});
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ export declare const CAWG_LOGO_SVG = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_17170_59571)\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12.8875 2.20138C12.9985 0.955258 14.0434 0 15.2937 0H18.7065C19.9567 0 21.0017 0.955258 21.1127 2.20138L21.3059 4.36814C21.85 4.55372 22.3784 4.77304 22.8882 5.02387L24.555 3.62851C25.5149 2.8265 26.9306 2.88955 27.8143 3.77319L30.227 6.18588L30.2287 6.18758C31.1092 7.07235 31.1751 8.48356 30.3723 9.44443L28.9769 11.1112C29.2286 11.6219 29.4473 12.1506 29.6323 12.6944L31.7987 12.8875C33.0448 12.9984 34.0002 14.0434 34.0002 15.2937V18.7065C34.0002 19.9568 33.0448 21.0018 31.7987 21.1127L29.632 21.3059C29.4464 21.85 29.2271 22.3784 28.9763 22.8882L30.3717 24.555C31.1737 25.5149 31.1106 26.9307 30.227 27.8143L27.8143 30.227L27.8126 30.2287C26.9278 31.1092 25.5166 31.1751 24.5557 30.3723L22.889 28.9769C22.3782 29.2286 21.8496 29.4473 21.3058 29.6323L21.1127 31.7987C21.0017 33.0448 19.9567 34.0002 18.7065 34.0002H15.2937C14.0434 34.0002 12.9985 33.0449 12.8875 31.7988L12.6943 29.632C12.1502 29.4465 11.6218 29.2271 11.1119 28.9763L9.44515 30.3717C8.48529 31.1737 7.06951 31.1106 6.18588 30.227L3.77319 27.8143L3.77149 27.8126C2.89097 26.9278 2.82504 25.5166 3.6279 24.5557L5.02323 22.889C4.77158 22.3783 4.55287 21.8496 4.36784 21.3058L2.20148 21.1127C0.95531 21.0018 0 19.9568 0 18.7065V15.2937C0 14.0434 0.95531 12.9984 2.20148 12.8875L4.36814 12.6943C4.55372 12.1502 4.77304 11.6218 5.02387 11.112L3.62851 9.44515C2.8265 8.48529 2.88955 7.06952 3.77319 6.18588L6.18588 3.77319L6.18758 3.77149C7.07235 2.89097 8.48356 2.82504 9.44443 3.6279L11.1112 5.02323C11.6219 4.77158 12.1506 4.55288 12.6943 4.36784L12.8875 2.20138ZM15.2937 2.00016C15.0789 2.00016 14.8988 2.16494 14.8797 2.37888L14.6272 5.2117L14.5661 5.89685L13.9044 6.08489C13.0453 6.32903 12.2307 6.66675 11.4733 7.09234L10.8711 7.43075L10.3414 6.98733L8.16195 5.16279C7.99794 5.02598 7.75432 5.03471 7.59907 5.18865L5.18751 7.6002C5.03615 7.75156 5.02474 7.99645 5.16256 8.16168L6.98732 10.3414L7.42966 10.8698L7.09346 11.4713C6.66869 12.2313 6.32859 13.0469 6.08489 13.9045L5.89685 14.5661L5.2117 14.6272L2.37898 14.8797C2.16503 14.8988 2.00016 15.0789 2.00016 15.2937V18.7065C2.00016 18.9213 2.16493 19.1014 2.37888 19.1205L5.2117 19.373L5.89685 19.4341L6.08489 20.0957C6.32903 20.9548 6.66674 21.7695 7.09234 22.5269L7.43074 23.1291L6.98732 23.6588L5.16279 25.8382C5.02613 26.0022 5.03474 26.2457 5.18849 26.401L5.18921 26.4017L7.6002 28.8127C7.75162 28.9641 7.99664 28.9754 8.16187 28.8375L10.3414 27.0129L10.8698 26.5705L11.4713 26.9067C12.2313 27.3315 13.0469 27.6716 13.9044 27.9153L14.5661 28.1033L14.6272 28.7885L14.8797 31.6212C14.8988 31.8351 15.0789 32 15.2937 32H18.7065C18.9213 32 19.1014 31.8352 19.1204 31.6213L19.373 28.7885L19.434 28.1033L20.0957 27.9153C20.9548 27.6711 21.7695 27.3334 22.5269 26.9078L23.1291 26.5694L23.6588 27.0129L25.8382 28.8374C26.0022 28.9744 26.2458 28.9656 26.4011 28.8115L28.8126 26.4C28.964 26.2486 28.9754 26.0037 28.8376 25.8385L27.0128 23.6588L26.5705 23.1304L26.9067 22.5289C27.3315 21.7689 27.6716 20.9533 27.9153 20.0957L28.1033 19.4341L28.7885 19.373L31.6212 19.1205C31.8351 19.1014 32 18.9213 32 18.7065V15.2937C32 15.0789 31.8352 14.8988 31.6213 14.8797L28.7885 14.6272L28.1033 14.5661L27.9153 13.9045C27.6711 13.0454 27.3334 12.2307 26.9078 11.4733L26.5694 10.8711L27.0128 10.3414L28.8374 8.16195C28.9745 7.99789 28.9655 7.75428 28.8114 7.59895L26.4 5.18751C26.2485 5.03607 26.0034 5.02473 25.8382 5.16279L23.6588 6.98733L23.1304 7.42966L22.5289 7.09347C21.7689 6.66869 20.9533 6.3286 20.0957 6.08489L19.434 5.89685L19.373 5.2117L19.1204 2.37898C19.1014 2.16504 18.9213 2.00016 18.7065 2.00016H15.2937ZM12.1524 16.874C11.9997 17.8144 12.6384 18.7006 13.5788 18.8532C14.5193 19.0059 15.4054 18.3672 15.5581 17.4268C15.7108 16.4863 15.0721 15.6002 14.1317 15.4475C13.1912 15.2949 12.3051 15.9335 12.1524 16.874ZM13.2584 20.8275C11.2275 20.4979 9.84843 18.5843 10.1781 16.5535C10.5077 14.5226 12.4213 13.1436 14.4521 13.4732C16.483 13.8029 17.8621 15.7164 17.5324 17.7473C17.2028 19.7781 15.2892 21.1572 13.2584 20.8275ZM23.61 17.1489C23.61 18.104 22.8349 18.8791 21.8799 18.8791C20.9248 18.8791 20.1497 18.104 20.1497 17.1489C20.1497 16.1939 20.9248 15.4188 21.8799 15.4188C22.8349 15.4188 23.61 16.1939 23.61 17.1489Z\" fill=\"black\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_17170_59571\">\n<rect width=\"34\" height=\"34\" fill=\"black\"/>\n</clipPath>\n</defs>\n</svg>";
3
+ export declare const CAWG_Header: React.FC;
@@ -0,0 +1,3 @@
1
+ import { PluginC2PA } from 'c2pa-react-component-types';
2
+ export declare const CAWGManifest: PluginC2PA;
3
+ export default CAWGManifest;
@@ -0,0 +1,6 @@
1
+ import { Manifest } from 'c2pa-react-component-types';
2
+ export interface CAWGL1Props {
3
+ manifest: Manifest;
4
+ moreInfo?: () => void;
5
+ }
6
+ export declare function CAWGL1({ manifest, moreInfo }: CAWGL1Props): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { Manifest } from 'c2pa-react-component-types';
2
+ export interface CAWGL2Props {
3
+ manifest: Manifest;
4
+ moreInfo?: () => void;
5
+ }
6
+ export default function CAWGL2({ manifest, moreInfo }: CAWGL2Props): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { Manifest } from 'c2pa-react-component-types';
2
+ export interface CAWGL3Props {
3
+ manifest: Manifest;
4
+ moreInfo?: () => void;
5
+ }
6
+ export default function CAWGL3({ manifest, moreInfo }: CAWGL3Props): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Manifest } from 'c2pa-react-component-types';
2
+ export interface CreativeWorkProps {
3
+ manifest: Manifest;
4
+ }
5
+ export default function CreativeWork({ manifest }: CreativeWorkProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export interface KeyValueDisplayerProps {
3
+ label: string;
4
+ value: React.ReactNode;
5
+ }
6
+ export default function KeyValueDisplayer({ label, value }: KeyValueDisplayerProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1 @@
1
+ export * from './components/Cawg/Cawg';
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "c2pa-react-cawg-component",
3
+ "version": "0.1.8",
4
+ "description": "A React plugin for c2pa-react-component that renders Creator Assertions Working Group (CAWG) data — identity credentials, metadata, and training permissions.",
5
+ "type": "module",
6
+ "main": "./dist/c2pa-react-cawg-component.umd.cjs",
7
+ "module": "./dist/c2pa-react-cawg-component.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/c2pa-react-cawg-component.js",
12
+ "require": "./dist/c2pa-react-cawg-component.umd.cjs",
13
+ "types": "./dist/index.d.ts"
14
+ },
15
+ "./style.css": "./dist/c2pa-react-cawg-component.css",
16
+ "./dist/c2pa-react-cawg-component.css": "./dist/c2pa-react-cawg-component.css"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "sideEffects": [
22
+ "**/*.css"
23
+ ],
24
+ "scripts": {
25
+ "dev": "vite",
26
+ "build": "tsc && vite build",
27
+ "lint": "eslint src",
28
+ "preview": "vite preview",
29
+ "prepublishOnly": "npm run build",
30
+ "test": "vitest run --passWithNoTests",
31
+ "test:watch": "vitest",
32
+ "test:ui": "vitest --ui",
33
+ "dev:lib": "vite build --watch"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/matthewrappard/c2pa-react-cawg-component.git"
38
+ },
39
+ "keywords": [
40
+ "c2pa",
41
+ "cawg",
42
+ "creator-assertions",
43
+ "react",
44
+ "component",
45
+ "identity",
46
+ "provenance",
47
+ "content-credentials"
48
+ ],
49
+ "author": "Matthew Rappard",
50
+ "license": "MIT",
51
+ "peerDependencies": {
52
+ "react": "^18.0.0 || ^19.0.0",
53
+ "react-dom": "^18.0.0 || ^19.0.0"
54
+ },
55
+ "devDependencies": {
56
+ "@eslint/js": "^9.0.0",
57
+ "@testing-library/dom": "^10.4.1",
58
+ "@testing-library/jest-dom": "^6.9.1",
59
+ "@testing-library/react": "^16.3.2",
60
+ "@testing-library/user-event": "^14.6.1",
61
+ "@types/node": "^25.5.0",
62
+ "@types/react": "^18.2.0",
63
+ "@types/react-dom": "^18.2.0",
64
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
65
+ "@typescript-eslint/parser": "^8.0.0",
66
+ "@vitejs/plugin-react": "^6.0.1",
67
+ "@vitest/ui": "^4.1.5",
68
+ "eslint": "^9.0.0",
69
+ "eslint-plugin-react-hooks": "^5.0.0",
70
+ "eslint-plugin-react-refresh": "^0.4.5",
71
+ "globals": "^17.5.0",
72
+ "jsdom": "^29.0.2",
73
+ "react": "^19.2.5",
74
+ "react-dom": "^19.2.5",
75
+ "typescript": "^5.2.2",
76
+ "typescript-eslint": "^8.59.0",
77
+ "vite": "^8.0.1",
78
+ "vite-plugin-dts": "^5.0.1",
79
+ "vitest": "^4.1.5"
80
+ },
81
+ "dependencies": {
82
+ "c2pa-react-component-types": "^0.1.0"
83
+ }
84
+ }