@medialane/ui 0.238.0 → 0.239.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.
@@ -1,7 +1,7 @@
1
1
  import * as input_otp from 'input-otp';
2
2
  import * as React from 'react';
3
3
 
4
- declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
4
+ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
5
5
  value?: string;
6
6
  onChange?: (newValue: string) => unknown;
7
7
  maxLength: number;
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
14
14
  } & {
15
15
  render: (props: input_otp.RenderProps) => React.ReactNode;
16
16
  children?: never;
17
- } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
17
+ } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
18
18
  value?: string;
19
19
  onChange?: (newValue: string) => unknown;
20
20
  maxLength: number;
@@ -1,7 +1,7 @@
1
1
  import * as input_otp from 'input-otp';
2
2
  import * as React from 'react';
3
3
 
4
- declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
4
+ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
5
5
  value?: string;
6
6
  onChange?: (newValue: string) => unknown;
7
7
  maxLength: number;
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
14
14
  } & {
15
15
  render: (props: input_otp.RenderProps) => React.ReactNode;
16
16
  children?: never;
17
- } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
17
+ } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
18
18
  value?: string;
19
19
  onChange?: (newValue: string) => unknown;
20
20
  maxLength: number;
@@ -3,8 +3,8 @@ import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const buttonVariants: (props?: ({
6
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
7
- size?: "default" | "icon" | "sm" | "lg" | null | undefined;
6
+ variant?: "ghost" | "link" | "default" | "destructive" | "outline" | "secondary" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
7
+ size?: "icon" | "default" | "sm" | "lg" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
10
10
  asChild?: boolean;
@@ -3,8 +3,8 @@ import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const buttonVariants: (props?: ({
6
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
7
- size?: "default" | "icon" | "sm" | "lg" | null | undefined;
6
+ variant?: "ghost" | "link" | "default" | "destructive" | "outline" | "secondary" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
7
+ size?: "icon" | "default" | "sm" | "lg" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
10
10
  asChild?: boolean;
@@ -16,6 +16,7 @@ declare const editionMintSchema: zod.ZodObject<{
16
16
  royalty: zod.ZodNumber;
17
17
  }, "strip", zod.ZodTypeAny, {
18
18
  name: string;
19
+ value: string;
19
20
  ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "Software" | "RWA" | "Patents" | "Posts" | "Publications" | "Documents" | "Custom";
20
21
  licenseType: string;
21
22
  commercialUse: "Yes" | "No";
@@ -24,12 +25,12 @@ declare const editionMintSchema: zod.ZodObject<{
24
25
  geographicScope: string;
25
26
  aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
26
27
  royalty: number;
27
- value: string;
28
28
  recipient: string;
29
29
  description?: string | undefined;
30
30
  external_url?: string | undefined;
31
31
  }, {
32
32
  name: string;
33
+ value: string;
33
34
  ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "Software" | "RWA" | "Patents" | "Posts" | "Publications" | "Documents" | "Custom";
34
35
  licenseType: string;
35
36
  commercialUse: "Yes" | "No";
@@ -38,7 +39,6 @@ declare const editionMintSchema: zod.ZodObject<{
38
39
  geographicScope: string;
39
40
  aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
40
41
  royalty: number;
41
- value: string;
42
42
  recipient: string;
43
43
  description?: string | undefined;
44
44
  external_url?: string | undefined;
@@ -16,6 +16,7 @@ declare const editionMintSchema: zod.ZodObject<{
16
16
  royalty: zod.ZodNumber;
17
17
  }, "strip", zod.ZodTypeAny, {
18
18
  name: string;
19
+ value: string;
19
20
  ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "Software" | "RWA" | "Patents" | "Posts" | "Publications" | "Documents" | "Custom";
20
21
  licenseType: string;
21
22
  commercialUse: "Yes" | "No";
@@ -24,12 +25,12 @@ declare const editionMintSchema: zod.ZodObject<{
24
25
  geographicScope: string;
25
26
  aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
26
27
  royalty: number;
27
- value: string;
28
28
  recipient: string;
29
29
  description?: string | undefined;
30
30
  external_url?: string | undefined;
31
31
  }, {
32
32
  name: string;
33
+ value: string;
33
34
  ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "Software" | "RWA" | "Patents" | "Posts" | "Publications" | "Documents" | "Custom";
34
35
  licenseType: string;
35
36
  commercialUse: "Yes" | "No";
@@ -38,7 +39,6 @@ declare const editionMintSchema: zod.ZodObject<{
38
39
  geographicScope: string;
39
40
  aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
40
41
  royalty: number;
41
- value: string;
42
42
  recipient: string;
43
43
  description?: string | undefined;
44
44
  external_url?: string | undefined;
@@ -0,0 +1,423 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var remix_mint_exports = {};
31
+ __export(remix_mint_exports, {
32
+ RemixMint: () => RemixMint
33
+ });
34
+ module.exports = __toCommonJS(remix_mint_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_react = require("react");
37
+ var import_lucide_react = require("lucide-react");
38
+ var import_sdk = require("@medialane/sdk");
39
+ var import_starknet = require("@medialane/sdk/starknet");
40
+ var import_image = __toESM(require("../image.js"), 1);
41
+ var import_link = __toESM(require("../link.js"), 1);
42
+ var import_router = require("../router.js");
43
+ var import_badge = require("../badge.js");
44
+ var import_button = require("../button.js");
45
+ var import_input = require("../input.js");
46
+ var import_label = require("../label.js");
47
+ var import_skeleton = require("../skeleton.js");
48
+ var import_textarea = require("../textarea.js");
49
+ var import_select = require("../select.js");
50
+ var import_collapsible = require("../collapsible.js");
51
+ var import_create_form_primitives = require("../create-form-primitives.js");
52
+ var import_creation_success = require("../creation-success.js");
53
+ var import_transaction_dialog = require("../transaction-dialog.js");
54
+ var import_wallet_required = require("../wallet-required.js");
55
+ var import_medialane_app = require("../medialane-app.js");
56
+ var import_reward_earned = require("../rewards/reward-earned.js");
57
+ var import_ip = require("../../data/ip.js");
58
+ var import_cn = require("../../utils/cn.js");
59
+ var import_ipfs_upload = require("../../utils/ipfs-upload.js");
60
+ var import_run_intent_calls = require("../../utils/run-intent-calls.js");
61
+ var import_ownership = require("../../utils/ownership.js");
62
+ var import_use_collections = require("../../utils/use-collections.js");
63
+ var import_use_tokens = require("../../utils/use-tokens.js");
64
+ var import_use_image_url = require("../../utils/use-image-url.js");
65
+ var import_use_transaction = require("../../utils/use-transaction.js");
66
+ var import_portfolio_cache = require("../../utils/portfolio-cache.js");
67
+ function RemixMint({ contract, tokenId }) {
68
+ const app = (0, import_medialane_app.useMedialaneApp)();
69
+ const router = (0, import_router.useRouter)();
70
+ const resolveImage = (0, import_use_image_url.useImageUrl)();
71
+ const walletAddress = app.walletAddress;
72
+ const tx = (0, import_use_transaction.useTransaction)();
73
+ const { token, isLoading: tokenLoading } = (0, import_use_tokens.useToken)(contract, tokenId);
74
+ const { collection: parentCollection } = (0, import_use_collections.useCollection)(contract);
75
+ const { collections: allCollections, isLoading: collectionsLoading } = (0, import_use_collections.useCollectionsByOwner)(walletAddress ?? null);
76
+ const eligibleCollections = allCollections.filter(
77
+ (c) => (0, import_sdk.getService)(c.service)?.id === "mip-erc1155" || (0, import_sdk.getService)(c.service)?.id === "mip-erc721" && c.collectionId != null
78
+ );
79
+ const { amount: walletBalance } = (0, import_use_tokens.useTokenBalance)(contract, tokenId, walletAddress);
80
+ const viewerIsOwner = (0, import_ownership.checkIsOwner)(token, walletAddress, walletBalance);
81
+ const originalName = token?.metadata?.name ?? `Token #${tokenId}`;
82
+ const originalImage = resolveImage(token?.metadata?.image);
83
+ const originalAttributes = Array.isArray(token?.metadata?.attributes) ? token.metadata.attributes : [];
84
+ const attr = (t) => originalAttributes.find((a) => a.trait_type === t)?.value;
85
+ const remixPolicy = (0, import_sdk.resolveRemixPolicy)({
86
+ parentNoDerivatives: (0, import_sdk.getDerivativesTerm)(originalAttributes) === "Not Allowed",
87
+ viewerIsParentOwner: viewerIsOwner,
88
+ dealAvailable: !!(0, import_sdk.getService)(parentCollection?.service)
89
+ });
90
+ const [imageFile, setImageFile] = (0, import_react.useState)(null);
91
+ const [imagePreview, setImagePreview] = (0, import_react.useState)(null);
92
+ const [name, setName] = (0, import_react.useState)("");
93
+ const [description, setDescription] = (0, import_react.useState)("");
94
+ const [collectionKey, setCollectionKey] = (0, import_react.useState)("");
95
+ const [ipType, setIpType] = (0, import_react.useState)("Art");
96
+ const [licenseType, setLicenseType] = (0, import_react.useState)("CC BY");
97
+ const [commercial, setCommercial] = (0, import_react.useState)(false);
98
+ const [derivatives, setDerivatives] = (0, import_react.useState)(true);
99
+ const [royalty, setRoyalty] = (0, import_react.useState)("");
100
+ const [advancedOpen, setAdvancedOpen] = (0, import_react.useState)(false);
101
+ const [formError, setFormError] = (0, import_react.useState)(null);
102
+ const [remixHref, setRemixHref] = (0, import_react.useState)(null);
103
+ const previewUrlRef = (0, import_react.useRef)(null);
104
+ const fileInputRef = (0, import_react.useRef)(null);
105
+ (0, import_react.useEffect)(() => {
106
+ if (token && !name) setName(`Remix of ${originalName}`);
107
+ }, [token]);
108
+ const getCollectionKey = (c) => c.collectionId ?? c.contractAddress;
109
+ (0, import_react.useEffect)(() => {
110
+ if (eligibleCollections.length > 0 && !collectionKey) {
111
+ const match = eligibleCollections.find((c) => (0, import_sdk.normalizeAddress)("STARKNET", c.contractAddress) === (0, import_sdk.normalizeAddress)("STARKNET", contract));
112
+ setCollectionKey(getCollectionKey(match ?? eligibleCollections[0]));
113
+ }
114
+ }, [eligibleCollections.length]);
115
+ (0, import_react.useEffect)(() => {
116
+ return () => {
117
+ if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);
118
+ };
119
+ }, []);
120
+ const redirected = (0, import_react.useRef)(false);
121
+ (0, import_react.useEffect)(() => {
122
+ if (!token || remixPolicy.canRemixDirect || redirected.current) return;
123
+ redirected.current = true;
124
+ router.replace((0, import_sdk.assetHref)("STARKNET", contract, tokenId));
125
+ }, [token, remixPolicy.canRemixDirect, router, contract, tokenId]);
126
+ const handleLicenseChange = (value) => {
127
+ setLicenseType(value);
128
+ const preset = import_ip.LICENSE_TYPES.find((l) => l.value === value);
129
+ if (preset) {
130
+ setCommercial(preset.commercialUse === "Yes");
131
+ setDerivatives(preset.derivatives !== "Not Allowed");
132
+ }
133
+ };
134
+ const handleImageChange = (file) => {
135
+ const fileError = (0, import_sdk.uploadError)(file, "image");
136
+ if (fileError) {
137
+ setFormError(fileError);
138
+ return;
139
+ }
140
+ setFormError(null);
141
+ if (previewUrlRef.current) URL.revokeObjectURL(previewUrlRef.current);
142
+ const url = URL.createObjectURL(file);
143
+ previewUrlRef.current = url;
144
+ setImageFile(file);
145
+ setImagePreview(url);
146
+ };
147
+ const handleSubmit = () => {
148
+ if (!name.trim()) return setFormError("Remix name is required");
149
+ if (!collectionKey) return setFormError("Select a collection");
150
+ if (!walletAddress) return;
151
+ setFormError(null);
152
+ void tx.run(async (signer) => {
153
+ await app.ensureSignedIn?.();
154
+ const client = app.getClient();
155
+ const api = client.api;
156
+ const selected = eligibleCollections.find((c) => getCollectionKey(c) === collectionKey);
157
+ if (!selected) throw new Error("Collection not found");
158
+ let tokenUri;
159
+ if (imageFile) {
160
+ tokenUri = (await (0, import_ipfs_upload.pinAssetMetadata)(api, {
161
+ imageFile,
162
+ name: name.trim(),
163
+ description: description.trim() || `Remix of ${originalName}`,
164
+ creator: walletAddress,
165
+ ipType,
166
+ licenseType,
167
+ commercialUse: commercial ? "Yes" : "No",
168
+ derivatives: derivatives ? "Allowed" : "Not Allowed",
169
+ attribution: "Required",
170
+ geographicScope: "Worldwide",
171
+ aiPolicy: "Not Allowed",
172
+ royalty: royalty || "0",
173
+ templateTraits: [
174
+ { traitType: "Parent Contract", value: contract },
175
+ { traitType: "Parent Token ID", value: tokenId }
176
+ ]
177
+ })).uri;
178
+ } else {
179
+ tokenUri = await (0, import_ipfs_upload.uploadJsonToIpfs)(api, {
180
+ name: name.trim(),
181
+ description: description.trim() || `Remix of ${originalName}`,
182
+ image: token?.metadata?.image ?? "",
183
+ attributes: [
184
+ { trait_type: "Parent Contract", value: contract },
185
+ { trait_type: "Parent Token ID", value: tokenId },
186
+ { trait_type: "Remix Type", value: "Derivative" },
187
+ { trait_type: "IP Type", value: ipType },
188
+ { trait_type: "License", value: licenseType },
189
+ { trait_type: "Commercial Use", value: commercial ? "Yes" : "No" },
190
+ { trait_type: "Derivatives", value: derivatives ? "Allowed" : "Not Allowed" },
191
+ ...royalty ? [{ trait_type: "Royalty", value: `${royalty}%` }] : [],
192
+ { trait_type: "Creator", value: walletAddress }
193
+ ]
194
+ });
195
+ }
196
+ const { txHash } = await (0, import_run_intent_calls.runIntentCalls)(
197
+ signer,
198
+ () => api.intents.create(
199
+ "mint",
200
+ selected.standard === "ERC1155" ? { owner: walletAddress, recipient: walletAddress, collectionContract: selected.contractAddress, tokenUri, value: "1" } : { owner: walletAddress, collectionId: selected.collectionId, recipient: walletAddress, tokenUri, royaltyBps: 0 }
201
+ )
202
+ );
203
+ const receipt = await (0, import_starknet.assertTransactionSucceeded)(client.provider, txHash);
204
+ const remixTokenId = (0, import_starknet.mintedTokenIdFromReceipt)(receipt, selected.contractAddress);
205
+ if (!remixTokenId) throw new Error("Minted, but could not read the new token id from the receipt");
206
+ await api.remix.confirmSelf({
207
+ originalContract: contract,
208
+ originalTokenId: tokenId,
209
+ remixContract: selected.contractAddress,
210
+ remixTokenId,
211
+ txHash,
212
+ licenseType,
213
+ commercial,
214
+ derivatives
215
+ });
216
+ setRemixHref((0, import_sdk.assetHref)("STARKNET", selected.contractAddress, remixTokenId));
217
+ (0, import_portfolio_cache.invalidatePortfolioCache)(walletAddress);
218
+ });
219
+ };
220
+ const handleAgain = () => {
221
+ tx.reset();
222
+ setRemixHref(null);
223
+ };
224
+ const gate = { icon: import_lucide_react.GitBranch, title: "Connect to create a remix", description: "Connect to mint a derivative of this asset." };
225
+ if (tokenLoading) {
226
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_required.WalletRequired, { ...gate, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-5xl mx-auto px-4 pt-14 pb-8 space-y-6", children: [
227
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-8 w-48" }),
228
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-[1fr_340px] gap-8", children: [
229
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "space-y-4", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-32 w-full rounded-xl" }, i)) }),
230
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-80 w-full rounded-xl" })
231
+ ] })
232
+ ] }) });
233
+ }
234
+ if (!token) {
235
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-5xl mx-auto px-4 py-24 text-center space-y-4", children: [
236
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-2xl font-bold", children: "Asset not found" }),
237
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { asChild: true, variant: "outline", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: "/", children: "Go home" }) })
238
+ ] });
239
+ }
240
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_wallet_required.WalletRequired, { ...gate, children: [
241
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_transaction_dialog.TransactionDialog, { tx, title: "Mint a remix", workingLabel: "Minting your remix\u2026", firstStepLabel: "Upload to IPFS", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
242
+ import_creation_success.CreationSuccess,
243
+ {
244
+ name,
245
+ image: imagePreview ?? originalImage ?? null,
246
+ caption: "Your remix is live",
247
+ primary: remixHref ? { href: remixHref, label: "View remix" } : { href: "/portfolio/assets", label: "View portfolio" },
248
+ secondary: remixHref ? { href: "/portfolio/assets", label: "View portfolio" } : void 0,
249
+ onAgain: handleAgain,
250
+ againLabel: "Close",
251
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_reward_earned.RewardEarned, { actionType: "mint_asset" })
252
+ }
253
+ ) }),
254
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-5xl mx-auto px-4 pt-14 pb-12 space-y-6", children: [
255
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-3", children: [
256
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_link.default, { href: (0, import_sdk.assetHref)("STARKNET", contract, tokenId), className: "inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors", children: [
257
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronLeft, { className: "h-4 w-4" }),
258
+ "Back to asset"
259
+ ] }),
260
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 text-primary", children: [
261
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.GitBranch, { className: "h-5 w-5" }),
262
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm font-semibold", children: "Create Remix" })
263
+ ] }),
264
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-3xl font-bold", children: "Mint a Remix" }),
265
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground max-w-xl", children: "Mint a derivative work based on this asset. The parent attribution is embedded in the IPFS metadata." })
266
+ ] }),
267
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-8 items-start", children: [
268
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-4", children: [
269
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_create_form_primitives.Section, { title: "Remix Artwork", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ImagePlus, { className: "h-4 w-4" }), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
270
+ "div",
271
+ {
272
+ className: (0, import_cn.cn)("relative group rounded-xl border-2 border-dashed border-border transition-colors cursor-pointer overflow-hidden", "hover:border-primary/50 hover:bg-muted/30"),
273
+ onClick: () => fileInputRef.current?.click(),
274
+ children: [
275
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ref: fileInputRef, type: "file", accept: (0, import_sdk.acceptFor)("image"), className: "hidden", onChange: (e) => {
276
+ const f = e.target.files?.[0];
277
+ if (f) handleImageChange(f);
278
+ } }),
279
+ imagePreview ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative aspect-square w-full", children: [
280
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: imagePreview, alt: "Remix preview", fill: true, unoptimized: true, className: "object-cover" }),
281
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-white text-sm font-medium flex items-center gap-2", children: [
282
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Upload, { className: "h-4 w-4" }),
283
+ " Change image"
284
+ ] }) })
285
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "aspect-square flex flex-col items-center justify-center gap-3 text-muted-foreground p-8", children: [
286
+ originalImage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative h-20 w-20 rounded-xl overflow-hidden opacity-40 mb-1 ring-2 ring-border", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: originalImage, alt: "", fill: true, unoptimized: true, className: "object-cover" }) }),
287
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Upload, { className: "h-8 w-8" }),
288
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-center", children: [
289
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium", children: "Upload remix artwork" }),
290
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs mt-0.5", children: originalImage ? "Leave empty to inherit original artwork" : "PNG, JPG, GIF, WebP up to 10MB" })
291
+ ] })
292
+ ] })
293
+ ]
294
+ }
295
+ ) }),
296
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_create_form_primitives.Section, { title: "Remix Details", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.GitBranch, { className: "h-4 w-4" }), children: [
297
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
298
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { children: "Remix Name *" }),
299
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { value: name, onChange: (e) => setName(e.target.value), placeholder: `Remix of ${originalName}` })
300
+ ] }),
301
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
302
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { children: "Description" }),
303
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_textarea.Textarea, { value: description, onChange: (e) => setDescription(e.target.value), placeholder: "Describe your remix, the creative changes you're making, or your vision for it\u2026", rows: 3, className: "resize-none" })
304
+ ] })
305
+ ] }),
306
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_create_form_primitives.Section, { title: "Collection", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Boxes, { className: "h-4 w-4" }), children: collectionsLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-10 w-full rounded-md" }) : eligibleCollections.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-lg border border-dashed border-border p-4 text-center space-y-2", children: [
307
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: "No eligible collections. Create one first." }),
308
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { size: "sm", variant: "outline", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_link.default, { href: "/launchpad/single-editions/collection", children: [
309
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Plus, { className: "h-3.5 w-3.5 mr-1.5" }),
310
+ "Create collection"
311
+ ] }) })
312
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_select.Select, { value: collectionKey, onValueChange: setCollectionKey, children: [
313
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectValue, { placeholder: "Select a collection" }) }),
314
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectContent, { children: eligibleCollections.map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectItem, { value: getCollectionKey(c), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "flex items-center gap-2", children: [
315
+ c.name ?? c.contractAddress.slice(0, 14) + "\u2026",
316
+ c.standard && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-2xs tabular-nums text-muted-foreground", children: c.standard })
317
+ ] }) }, getCollectionKey(c))) })
318
+ ] }) }),
319
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_create_form_primitives.Section, { title: "IP Type", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Info, { className: "h-4 w-4" }), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_select.Select, { value: ipType, onValueChange: setIpType, children: [
320
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectValue, {}) }),
321
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectContent, { children: import_ip.IP_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectItem, { value: t, children: t }, t)) })
322
+ ] }) }),
323
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_create_form_primitives.Section, { title: "License Terms", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Shield, { className: "h-4 w-4" }), children: [
324
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
325
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { children: "License Type" }),
326
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_select.Select, { value: licenseType, onValueChange: handleLicenseChange, children: [
327
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectValue, {}) }),
328
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectContent, { children: import_ip.LICENSE_TYPES.map((l) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.SelectItem, { value: l.value, children: l.value }, l.value)) })
329
+ ] })
330
+ ] }),
331
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
332
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
333
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { className: "text-xs text-muted-foreground uppercase tracking-wide", children: "Commercial Use" }),
334
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_create_form_primitives.ToggleGroup, { value: commercial ? "Yes" : "No", options: ["Yes", "No"], onChange: (v) => setCommercial(v === "Yes") })
335
+ ] }),
336
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
337
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { className: "text-xs text-muted-foreground uppercase tracking-wide", children: "Derivatives" }),
338
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_create_form_primitives.ToggleGroup, { value: derivatives ? "Allowed" : "Not Allowed", options: ["Allowed", "Not Allowed"], onChange: (v) => setDerivatives(v === "Allowed") })
339
+ ] })
340
+ ] }),
341
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_collapsible.Collapsible, { open: advancedOpen, onOpenChange: setAdvancedOpen, children: [
342
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_collapsible.CollapsibleTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { type: "button", className: "flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors", children: [
343
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDown, { className: (0, import_cn.cn)("h-3.5 w-3.5 transition-transform", advancedOpen && "rotate-180") }),
344
+ "Royalty & advanced"
345
+ ] }) }),
346
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_collapsible.CollapsibleContent, { className: "pt-3 space-y-3", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
347
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_label.Label, { className: "flex items-center gap-1.5", children: [
348
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Percent, { className: "h-3.5 w-3.5" }),
349
+ "Royalty %"
350
+ ] }),
351
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { type: "number", min: "0", max: "50", step: "1", placeholder: "0", value: royalty, onChange: (e) => setRoyalty(e.target.value) }),
352
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: "Percentage of future sales sent back to you (0\u201350%)" })
353
+ ] }) })
354
+ ] })
355
+ ] }),
356
+ formError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "alert", className: "text-sm text-destructive", children: formError }),
357
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btn-border-animated p-[1px] rounded-xl", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
358
+ "button",
359
+ {
360
+ type: "button",
361
+ disabled: tx.phase !== "idle",
362
+ onClick: handleSubmit,
363
+ className: "w-full h-12 rounded-[11px] flex items-center justify-center gap-2 text-base font-semibold text-white transition-all hover:brightness-110 active:scale-[0.98] bg-brand-rose disabled:opacity-50",
364
+ children: [
365
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.GitBranch, { className: "h-5 w-5" }),
366
+ "Mint Remix"
367
+ ]
368
+ }
369
+ ) }),
370
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-center text-muted-foreground", children: "Two operations: IPFS metadata upload + on-chain mint. Gas is free." })
371
+ ] }),
372
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-4 lg:sticky lg:top-16", children: [
373
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-border overflow-hidden bg-card", children: [
374
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative aspect-square w-full bg-muted", children: [
375
+ originalImage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: originalImage, alt: originalName, fill: true, unoptimized: true, className: "object-cover" }),
376
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute top-2 left-2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_badge.Badge, { variant: "secondary", className: "text-2xs gap-1", children: [
377
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.GitBranch, { className: "h-3 w-3" }),
378
+ "Original"
379
+ ] }) })
380
+ ] }),
381
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "p-4 space-y-3", children: [
382
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
383
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-semibold truncate", children: originalName }),
384
+ token.metadata?.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground line-clamp-2 mt-0.5", children: token.metadata.description })
385
+ ] }),
386
+ (attr("License") || attr("Commercial Use") || attr("Derivatives")) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-lg bg-muted/40 p-3 space-y-1.5 text-xs", children: [
387
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-2xs font-semibold text-muted-foreground", children: "Original License" }),
388
+ attr("License") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between", children: [
389
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground", children: "License" }),
390
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-medium", children: attr("License") })
391
+ ] }),
392
+ attr("Commercial Use") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between", children: [
393
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground", children: "Commercial" }),
394
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-medium", children: attr("Commercial Use") })
395
+ ] }),
396
+ attr("Derivatives") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between", children: [
397
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground", children: "Derivatives" }),
398
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-medium", children: attr("Derivatives") })
399
+ ] })
400
+ ] })
401
+ ] })
402
+ ] }),
403
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-primary/20 bg-primary/5 p-4 space-y-3 text-sm", children: [
404
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "font-semibold flex items-center gap-2", children: [
405
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Info, { className: "h-4 w-4 text-primary" }),
406
+ "What happens next"
407
+ ] }),
408
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ol", { className: "space-y-2 text-muted-foreground text-xs list-decimal list-inside", children: [
409
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: "Your artwork and metadata are uploaded to IPFS" }),
410
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: "A new NFT is minted in the selected collection" }),
411
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: "Parent attribution is embedded on-chain permanently" })
412
+ ] })
413
+ ] })
414
+ ] })
415
+ ] })
416
+ ] })
417
+ ] });
418
+ }
419
+ // Annotate the CommonJS export names for ESM import in node:
420
+ 0 && (module.exports = {
421
+ RemixMint
422
+ });
423
+ //# sourceMappingURL=remix-mint.cjs.map