@medialane/ui 0.336.0 → 0.337.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.
|
@@ -33,12 +33,6 @@ function licenseLabel(value) {
|
|
|
33
33
|
const label = import_ip.LICENSE_TYPES.find((license) => license.value === value)?.label ?? value;
|
|
34
34
|
return label.split(" \u2014 ")[1] ?? label;
|
|
35
35
|
}
|
|
36
|
-
function statusIcon(value) {
|
|
37
|
-
const v = value.trim().toLowerCase();
|
|
38
|
-
if (["yes", "allowed", "worldwide", "not required"].includes(v)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { className: "h-4 w-4 text-emerald-500" });
|
|
39
|
-
if (["no", "not allowed"].includes(v)) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { className: "h-4 w-4 text-destructive" });
|
|
40
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.CircleAlert, { className: "h-4 w-4 text-amber-500" });
|
|
41
|
-
}
|
|
42
36
|
const isAddressLike = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{16,}$/.test(v.trim());
|
|
43
37
|
function Cell({
|
|
44
38
|
icon,
|
|
@@ -80,12 +74,12 @@ function AssetOverviewContent({
|
|
|
80
74
|
const displayAttributes = attributes.filter((attribute) => isDisplayAttr(attribute));
|
|
81
75
|
const licenseDescription = import_ip.LICENSE_TYPES.find((license) => license.value === licenseType)?.description;
|
|
82
76
|
const facts = [
|
|
83
|
-
{ label: "Commercial use", value: commercialUse },
|
|
84
|
-
{ label: "Derivatives", value: derivatives },
|
|
85
|
-
{ label: "Attribution", value: attribution },
|
|
86
|
-
{ label: "Territory", value: territory },
|
|
87
|
-
{ label: "AI & data mining", value: aiPolicy },
|
|
88
|
-
{
|
|
77
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.DollarSign, { className: "h-4 w-4" }), label: "Commercial use", value: commercialUse },
|
|
78
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.GitBranch, { className: "h-4 w-4" }), label: "Derivatives", value: derivatives },
|
|
79
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.UserCheck, { className: "h-4 w-4" }), label: "Attribution", value: attribution },
|
|
80
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Globe, { className: "h-4 w-4" }), label: "Territory", value: territory },
|
|
81
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Bot, { className: "h-4 w-4" }), label: "AI & data mining", value: aiPolicy },
|
|
82
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Percent, { className: "h-4 w-4" }), label: "Royalty", value: royalty }
|
|
89
83
|
].filter((row) => !!row.value);
|
|
90
84
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mt-4 space-y-7", children: [
|
|
91
85
|
content ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "space-y-3", children: [
|
|
@@ -105,7 +99,7 @@ function AssetOverviewContent({
|
|
|
105
99
|
licenseDescription ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: licenseDescription }) : null,
|
|
106
100
|
summary ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-base sm:text-lg font-semibold leading-snug text-foreground", children: summary }) : null
|
|
107
101
|
] }),
|
|
108
|
-
facts.map(({ icon, label, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Cell, { icon
|
|
102
|
+
facts.map(({ icon, label, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Cell, { icon, label, value }, label)),
|
|
109
103
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "col-span-full rounded-xl bg-muted/25 ring-1 ring-border/40 p-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs leading-relaxed text-muted-foreground", children: "Creative work is protected with international copyright law. The Berne Convention for the Protection of Literary and Artistic Works is the foundational international copyright treaty, ratified by 181 signatory countries." }) })
|
|
110
104
|
] })
|
|
111
105
|
] }) : null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/asset-overview-content.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/components/asset-overview-content.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { Bot, DollarSign, ExternalLink, GitBranch, Globe, Percent, UserCheck } from \"lucide-react\";\nimport { IPTypeDisplay } from \"./ip-type-display.js\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { MarkdownText } from \"./markdown-text.js\";\nimport { licenseSummary } from \"../utils/license-summary.js\";\nimport { LICENSE_TYPES } from \"../data/ip.js\";\n\ninterface AssetAttribute {\n trait_type?: string;\n value?: string;\n}\n\ninterface AssetOverviewContentProps {\n attributes: AssetAttribute[];\n hasTemplateData: boolean;\n isDisplayAttr: (attribute: AssetAttribute) => boolean;\n content?: string | null;\n link?: string | null;\n}\n\nfunction licenseLabel(value: string): string {\n const label = LICENSE_TYPES.find((license) => license.value === value)?.label ?? value;\n return label.split(\" — \")[1] ?? label;\n}\n\nconst isAddressLike = (v?: unknown): boolean =>\n typeof v === \"string\" && /^0x[0-9a-fA-F]{16,}$/.test(v.trim());\n\nfunction Cell({\n icon,\n label,\n value,\n wide,\n}: {\n icon?: ReactNode;\n label: string;\n value: ReactNode;\n wide?: boolean;\n}) {\n return (\n <div\n className={`flex flex-col justify-between gap-2 rounded-xl bg-muted/25 ring-1 ring-border/40 p-3.5 ${\n wide ? \"col-span-2\" : \"\"\n }`}\n >\n {icon ? <span className=\"text-primary/70\">{icon}</span> : null}\n <div className=\"space-y-0.5\">\n <p className=\"text-2xs font-medium text-muted-foreground truncate\" title={label}>\n {label}\n </p>\n <div className=\"text-sm font-bold text-foreground truncate\">{value}</div>\n </div>\n </div>\n );\n}\n\nexport function AssetOverviewContent({\n attributes,\n hasTemplateData,\n isDisplayAttr,\n content,\n link,\n}: AssetOverviewContentProps) {\n const attr = (trait: string) => attributes.find((attribute) => attribute.trait_type === trait)?.value;\n const licenseType = attr(\"License\");\n const commercialUse = attr(\"Commercial Use\");\n const derivatives = attr(\"Derivatives\");\n const attribution = attr(\"Attribution\");\n const territory = attr(\"Territory\");\n const aiPolicy = attr(\"AI Policy\");\n const royalty = attr(\"Royalty\");\n const summary = licenseSummary(attributes);\n const hasLicenseData = !!(licenseType || commercialUse || derivatives || attribution);\n const displayAttributes = attributes.filter((attribute) => isDisplayAttr(attribute));\n\n const licenseDescription = LICENSE_TYPES.find((license) => license.value === licenseType)?.description;\n\n const facts = [\n { icon: <DollarSign className=\"h-4 w-4\" />, label: \"Commercial use\", value: commercialUse },\n { icon: <GitBranch className=\"h-4 w-4\" />, label: \"Derivatives\", value: derivatives },\n { icon: <UserCheck className=\"h-4 w-4\" />, label: \"Attribution\", value: attribution },\n { icon: <Globe className=\"h-4 w-4\" />, label: \"Territory\", value: territory },\n { icon: <Bot className=\"h-4 w-4\" />, label: \"AI & data mining\", value: aiPolicy },\n { icon: <Percent className=\"h-4 w-4\" />, label: \"Royalty\", value: royalty },\n ].filter((row) => !!row.value);\n\n return (\n <div className=\"mt-4 space-y-7\">\n {content ? (\n <section className=\"space-y-3\">\n <h3 className=\"text-sm font-semibold text-muted-foreground\">Content</h3>\n <MarkdownText text={content} />\n </section>\n ) : null}\n\n {link ? (\n <a href={link} target=\"_blank\" rel=\"noopener noreferrer\" className=\"inline-flex items-center gap-1.5 text-sm text-primary hover:underline\">\n <ExternalLink className=\"h-3.5 w-3.5\" />\n Open link\n </a>\n ) : null}\n\n {hasTemplateData ? <IPTypeDisplay attributes={attributes} /> : null}\n\n {hasLicenseData ? (\n <section className=\"space-y-3\">\n <h3 className=\"text-sm font-semibold text-muted-foreground\">Rights</h3>\n <div className=\"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3\">\n <div className=\"col-span-full flex flex-col gap-2 rounded-2xl bg-gradient-to-br from-primary/10 via-primary/5 to-accent/10 ring-1 ring-primary/15 p-5\">\n {licenseType ? (\n <p className=\"text-xl sm:text-2xl font-bold leading-tight text-foreground\">{licenseLabel(licenseType)}</p>\n ) : null}\n {licenseDescription ? (\n <p className=\"text-sm text-muted-foreground\">{licenseDescription}</p>\n ) : null}\n {summary ? (\n <p className=\"text-base sm:text-lg font-semibold leading-snug text-foreground\">{summary}</p>\n ) : null}\n </div>\n\n {facts.map(({ icon, label, value }) => (\n <Cell key={label} icon={icon} label={label} value={value} />\n ))}\n\n <div className=\"col-span-full rounded-xl bg-muted/25 ring-1 ring-border/40 p-3.5\">\n <p className=\"text-xs leading-relaxed text-muted-foreground\">\n Creative work is protected with international copyright law. The Berne Convention for the Protection of Literary and Artistic Works is the foundational international copyright treaty, ratified by 181 signatory countries.\n </p>\n </div>\n </div>\n </section>\n ) : null}\n\n {displayAttributes.length > 0 ? (\n <section className=\"space-y-3\">\n <h3 className=\"text-sm font-semibold text-muted-foreground\">Details</h3>\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-3 [grid-auto-flow:dense] auto-rows-[minmax(6rem,auto)]\">\n {displayAttributes.map((attribute, index) => (\n <Cell\n key={index}\n label={attribute.trait_type ?? \"Trait\"}\n wide={isAddressLike(attribute.value)}\n value={\n isAddressLike(attribute.value) ? (\n <AddressDisplay address={attribute.value!} chars={4} className=\"text-sm font-bold\" />\n ) : (\n attribute.value ?? \"—\"\n )\n }\n />\n ))}\n </div>\n </section>\n ) : null}\n\n {!hasTemplateData && !hasLicenseData && displayAttributes.length === 0 ? (\n <p className=\"text-sm text-muted-foreground\">No additional details available.</p>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDc;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BAAa,WAAW,GAAE,IACpG;AAAA,UACH,qBACC,4CAAC,OAAE,WAAU,iCAAiC,8BAAmB,IAC/D;AAAA,UACH,UACC,4CAAC,OAAE,WAAU,mEAAmE,mBAAQ,IACtF;AAAA,WACN;AAAA,QAEC,MAAM,IAAI,CAAC,EAAE,MAAM,OAAO,MAAM,MAC/B,4CAAC,QAAiB,MAAY,OAAc,SAAjC,KAA+C,CAC3D;AAAA,QAED,4CAAC,SAAI,WAAU,oEACb,sDAAC,OAAE,WAAU,iDAAgD,0OAE7D,GACF;AAAA,SACF;AAAA,OACF,IACE;AAAA,IAEH,kBAAkB,SAAS,IAC1B,6CAAC,aAAQ,WAAU,aACjB;AAAA,kDAAC,QAAG,WAAU,+CAA8C,qBAAO;AAAA,MACnE,4CAAC,SAAI,WAAU,8FACZ,4BAAkB,IAAI,CAAC,WAAW,UACjC;AAAA,QAAC;AAAA;AAAA,UAEC,OAAO,UAAU,cAAc;AAAA,UAC/B,MAAM,cAAc,UAAU,KAAK;AAAA,UACnC,OACE,cAAc,UAAU,KAAK,IAC3B,4CAAC,yCAAe,SAAS,UAAU,OAAQ,OAAO,GAAG,WAAU,qBAAoB,IAEnF,UAAU,SAAS;AAAA;AAAA,QAPlB;AAAA,MAUP,CACD,GACH;AAAA,OACF,IACE;AAAA,IAEH,CAAC,mBAAmB,CAAC,kBAAkB,kBAAkB,WAAW,IACnE,4CAAC,OAAE,WAAU,iCAAgC,8CAAgC,IAC3E;AAAA,KACN;AAEJ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { Bot, DollarSign, ExternalLink, GitBranch, Globe, Percent, UserCheck } from "lucide-react";
|
|
4
4
|
import { IPTypeDisplay } from "./ip-type-display.js";
|
|
5
5
|
import { AddressDisplay } from "./address-display.js";
|
|
6
6
|
import { MarkdownText } from "./markdown-text.js";
|
|
@@ -10,12 +10,6 @@ function licenseLabel(value) {
|
|
|
10
10
|
const label = LICENSE_TYPES.find((license) => license.value === value)?.label ?? value;
|
|
11
11
|
return label.split(" \u2014 ")[1] ?? label;
|
|
12
12
|
}
|
|
13
|
-
function statusIcon(value) {
|
|
14
|
-
const v = value.trim().toLowerCase();
|
|
15
|
-
if (["yes", "allowed", "worldwide", "not required"].includes(v)) return /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-emerald-500" });
|
|
16
|
-
if (["no", "not allowed"].includes(v)) return /* @__PURE__ */ jsx(X, { className: "h-4 w-4 text-destructive" });
|
|
17
|
-
return /* @__PURE__ */ jsx(CircleAlert, { className: "h-4 w-4 text-amber-500" });
|
|
18
|
-
}
|
|
19
13
|
const isAddressLike = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{16,}$/.test(v.trim());
|
|
20
14
|
function Cell({
|
|
21
15
|
icon,
|
|
@@ -57,12 +51,12 @@ function AssetOverviewContent({
|
|
|
57
51
|
const displayAttributes = attributes.filter((attribute) => isDisplayAttr(attribute));
|
|
58
52
|
const licenseDescription = LICENSE_TYPES.find((license) => license.value === licenseType)?.description;
|
|
59
53
|
const facts = [
|
|
60
|
-
{ label: "Commercial use", value: commercialUse },
|
|
61
|
-
{ label: "Derivatives", value: derivatives },
|
|
62
|
-
{ label: "Attribution", value: attribution },
|
|
63
|
-
{ label: "Territory", value: territory },
|
|
64
|
-
{ label: "AI & data mining", value: aiPolicy },
|
|
65
|
-
{
|
|
54
|
+
{ icon: /* @__PURE__ */ jsx(DollarSign, { className: "h-4 w-4" }), label: "Commercial use", value: commercialUse },
|
|
55
|
+
{ icon: /* @__PURE__ */ jsx(GitBranch, { className: "h-4 w-4" }), label: "Derivatives", value: derivatives },
|
|
56
|
+
{ icon: /* @__PURE__ */ jsx(UserCheck, { className: "h-4 w-4" }), label: "Attribution", value: attribution },
|
|
57
|
+
{ icon: /* @__PURE__ */ jsx(Globe, { className: "h-4 w-4" }), label: "Territory", value: territory },
|
|
58
|
+
{ icon: /* @__PURE__ */ jsx(Bot, { className: "h-4 w-4" }), label: "AI & data mining", value: aiPolicy },
|
|
59
|
+
{ icon: /* @__PURE__ */ jsx(Percent, { className: "h-4 w-4" }), label: "Royalty", value: royalty }
|
|
66
60
|
].filter((row) => !!row.value);
|
|
67
61
|
return /* @__PURE__ */ jsxs("div", { className: "mt-4 space-y-7", children: [
|
|
68
62
|
content ? /* @__PURE__ */ jsxs("section", { className: "space-y-3", children: [
|
|
@@ -82,7 +76,7 @@ function AssetOverviewContent({
|
|
|
82
76
|
licenseDescription ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: licenseDescription }) : null,
|
|
83
77
|
summary ? /* @__PURE__ */ jsx("p", { className: "text-base sm:text-lg font-semibold leading-snug text-foreground", children: summary }) : null
|
|
84
78
|
] }),
|
|
85
|
-
facts.map(({ icon, label, value }) => /* @__PURE__ */ jsx(Cell, { icon
|
|
79
|
+
facts.map(({ icon, label, value }) => /* @__PURE__ */ jsx(Cell, { icon, label, value }, label)),
|
|
86
80
|
/* @__PURE__ */ jsx("div", { className: "col-span-full rounded-xl bg-muted/25 ring-1 ring-border/40 p-3.5", children: /* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-muted-foreground", children: "Creative work is protected with international copyright law. The Berne Convention for the Protection of Literary and Artistic Works is the foundational international copyright treaty, ratified by 181 signatory countries." }) })
|
|
87
81
|
] })
|
|
88
82
|
] }) : null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/asset-overview-content.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/components/asset-overview-content.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { Bot, DollarSign, ExternalLink, GitBranch, Globe, Percent, UserCheck } from \"lucide-react\";\nimport { IPTypeDisplay } from \"./ip-type-display.js\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { MarkdownText } from \"./markdown-text.js\";\nimport { licenseSummary } from \"../utils/license-summary.js\";\nimport { LICENSE_TYPES } from \"../data/ip.js\";\n\ninterface AssetAttribute {\n trait_type?: string;\n value?: string;\n}\n\ninterface AssetOverviewContentProps {\n attributes: AssetAttribute[];\n hasTemplateData: boolean;\n isDisplayAttr: (attribute: AssetAttribute) => boolean;\n content?: string | null;\n link?: string | null;\n}\n\nfunction licenseLabel(value: string): string {\n const label = LICENSE_TYPES.find((license) => license.value === value)?.label ?? value;\n return label.split(\" — \")[1] ?? label;\n}\n\nconst isAddressLike = (v?: unknown): boolean =>\n typeof v === \"string\" && /^0x[0-9a-fA-F]{16,}$/.test(v.trim());\n\nfunction Cell({\n icon,\n label,\n value,\n wide,\n}: {\n icon?: ReactNode;\n label: string;\n value: ReactNode;\n wide?: boolean;\n}) {\n return (\n <div\n className={`flex flex-col justify-between gap-2 rounded-xl bg-muted/25 ring-1 ring-border/40 p-3.5 ${\n wide ? \"col-span-2\" : \"\"\n }`}\n >\n {icon ? <span className=\"text-primary/70\">{icon}</span> : null}\n <div className=\"space-y-0.5\">\n <p className=\"text-2xs font-medium text-muted-foreground truncate\" title={label}>\n {label}\n </p>\n <div className=\"text-sm font-bold text-foreground truncate\">{value}</div>\n </div>\n </div>\n );\n}\n\nexport function AssetOverviewContent({\n attributes,\n hasTemplateData,\n isDisplayAttr,\n content,\n link,\n}: AssetOverviewContentProps) {\n const attr = (trait: string) => attributes.find((attribute) => attribute.trait_type === trait)?.value;\n const licenseType = attr(\"License\");\n const commercialUse = attr(\"Commercial Use\");\n const derivatives = attr(\"Derivatives\");\n const attribution = attr(\"Attribution\");\n const territory = attr(\"Territory\");\n const aiPolicy = attr(\"AI Policy\");\n const royalty = attr(\"Royalty\");\n const summary = licenseSummary(attributes);\n const hasLicenseData = !!(licenseType || commercialUse || derivatives || attribution);\n const displayAttributes = attributes.filter((attribute) => isDisplayAttr(attribute));\n\n const licenseDescription = LICENSE_TYPES.find((license) => license.value === licenseType)?.description;\n\n const facts = [\n { icon: <DollarSign className=\"h-4 w-4\" />, label: \"Commercial use\", value: commercialUse },\n { icon: <GitBranch className=\"h-4 w-4\" />, label: \"Derivatives\", value: derivatives },\n { icon: <UserCheck className=\"h-4 w-4\" />, label: \"Attribution\", value: attribution },\n { icon: <Globe className=\"h-4 w-4\" />, label: \"Territory\", value: territory },\n { icon: <Bot className=\"h-4 w-4\" />, label: \"AI & data mining\", value: aiPolicy },\n { icon: <Percent className=\"h-4 w-4\" />, label: \"Royalty\", value: royalty },\n ].filter((row) => !!row.value);\n\n return (\n <div className=\"mt-4 space-y-7\">\n {content ? (\n <section className=\"space-y-3\">\n <h3 className=\"text-sm font-semibold text-muted-foreground\">Content</h3>\n <MarkdownText text={content} />\n </section>\n ) : null}\n\n {link ? (\n <a href={link} target=\"_blank\" rel=\"noopener noreferrer\" className=\"inline-flex items-center gap-1.5 text-sm text-primary hover:underline\">\n <ExternalLink className=\"h-3.5 w-3.5\" />\n Open link\n </a>\n ) : null}\n\n {hasTemplateData ? <IPTypeDisplay attributes={attributes} /> : null}\n\n {hasLicenseData ? (\n <section className=\"space-y-3\">\n <h3 className=\"text-sm font-semibold text-muted-foreground\">Rights</h3>\n <div className=\"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3\">\n <div className=\"col-span-full flex flex-col gap-2 rounded-2xl bg-gradient-to-br from-primary/10 via-primary/5 to-accent/10 ring-1 ring-primary/15 p-5\">\n {licenseType ? (\n <p className=\"text-xl sm:text-2xl font-bold leading-tight text-foreground\">{licenseLabel(licenseType)}</p>\n ) : null}\n {licenseDescription ? (\n <p className=\"text-sm text-muted-foreground\">{licenseDescription}</p>\n ) : null}\n {summary ? (\n <p className=\"text-base sm:text-lg font-semibold leading-snug text-foreground\">{summary}</p>\n ) : null}\n </div>\n\n {facts.map(({ icon, label, value }) => (\n <Cell key={label} icon={icon} label={label} value={value} />\n ))}\n\n <div className=\"col-span-full rounded-xl bg-muted/25 ring-1 ring-border/40 p-3.5\">\n <p className=\"text-xs leading-relaxed text-muted-foreground\">\n Creative work is protected with international copyright law. The Berne Convention for the Protection of Literary and Artistic Works is the foundational international copyright treaty, ratified by 181 signatory countries.\n </p>\n </div>\n </div>\n </section>\n ) : null}\n\n {displayAttributes.length > 0 ? (\n <section className=\"space-y-3\">\n <h3 className=\"text-sm font-semibold text-muted-foreground\">Details</h3>\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-3 [grid-auto-flow:dense] auto-rows-[minmax(6rem,auto)]\">\n {displayAttributes.map((attribute, index) => (\n <Cell\n key={index}\n label={attribute.trait_type ?? \"Trait\"}\n wide={isAddressLike(attribute.value)}\n value={\n isAddressLike(attribute.value) ? (\n <AddressDisplay address={attribute.value!} chars={4} className=\"text-sm font-bold\" />\n ) : (\n attribute.value ?? \"—\"\n )\n }\n />\n ))}\n </div>\n </section>\n ) : null}\n\n {!hasTemplateData && !hasLicenseData && displayAttributes.length === 0 ? (\n <p className=\"text-sm text-muted-foreground\">No additional details available.</p>\n ) : null}\n </div>\n );\n}\n"],"mappings":";AAgDc,cACR,YADQ;AA7Cd,SAAS,KAAK,YAAY,cAAc,WAAW,OAAO,SAAS,iBAAiB;AACpF,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAe9B,SAAS,aAAa,OAAuB;AAC3C,QAAM,QAAQ,cAAc,KAAK,CAAC,YAAY,QAAQ,UAAU,KAAK,GAAG,SAAS;AACjF,SAAO,MAAM,MAAM,UAAK,EAAE,CAAC,KAAK;AAClC;AAEA,MAAM,gBAAgB,CAAC,MACrB,OAAO,MAAM,YAAY,uBAAuB,KAAK,EAAE,KAAK,CAAC;AAE/D,SAAS,KAAK;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,0FACT,OAAO,eAAe,EACx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