artifactuse 0.2.4 → 0.2.6
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/README.md +5 -1
- package/dist/{index-C_15PkcN.js → index-W575iBkm.js} +5 -2
- package/dist/index.js +1 -1
- package/dist/react/ArtifactusePanel.d.ts +2 -1
- package/dist/react/index.js +817 -803
- package/dist/svelte/index.js +1751 -1730
- package/dist/vue/index.js +693 -667
- package/dist/vue2/index.js +80 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import e, { useState as w, useMemo as
|
|
2
|
-
import { g as
|
|
3
|
-
import { J as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
function
|
|
1
|
+
import e, { useState as w, useMemo as L, useCallback as p, useRef as W, useEffect as D, createContext as qt, useContext as Dt } from "react";
|
|
2
|
+
import { g as De, f as yt, a as rt, b as st, n as Ut, i as vt, c as jt, D as _t, d as Ot } from "../index-W575iBkm.js";
|
|
3
|
+
import { J as Jt } from "../jszip.min-CdmYyw5L.js";
|
|
4
|
+
import { createPortal as Xt } from "react-dom";
|
|
5
|
+
function Zt({
|
|
6
6
|
artifact: t,
|
|
7
7
|
isActive: a = !1,
|
|
8
|
-
onOpen:
|
|
9
|
-
onCopy:
|
|
8
|
+
onOpen: c,
|
|
9
|
+
onCopy: l,
|
|
10
10
|
onDownload: o,
|
|
11
11
|
className: u = ""
|
|
12
12
|
}) {
|
|
13
|
-
const [
|
|
14
|
-
var
|
|
15
|
-
return
|
|
16
|
-
}, [t.size, t.code]),
|
|
17
|
-
|
|
18
|
-
}, [t,
|
|
19
|
-
|
|
13
|
+
const [E, i] = w(!1), r = L(() => De(t.language), [t.language]), m = L(() => {
|
|
14
|
+
var k;
|
|
15
|
+
return yt(t.size || ((k = t.code) == null ? void 0 : k.length) || 0);
|
|
16
|
+
}, [t.size, t.code]), x = L(() => rt(t.language), [t.language]), T = p((k) => {
|
|
17
|
+
k.stopPropagation(), c && c(t);
|
|
18
|
+
}, [t, c]), A = p(async (k) => {
|
|
19
|
+
k.stopPropagation();
|
|
20
20
|
try {
|
|
21
|
-
await navigator.clipboard.writeText(t.code),
|
|
22
|
-
|
|
21
|
+
await navigator.clipboard.writeText(t.code), i(!0), l && l(t), setTimeout(() => {
|
|
22
|
+
i(!1);
|
|
23
23
|
}, 2e3);
|
|
24
24
|
} catch {
|
|
25
25
|
const g = document.createElement("textarea");
|
|
26
26
|
g.value = t.code, g.style.position = "fixed", g.style.opacity = "0", document.body.appendChild(g), g.select();
|
|
27
27
|
try {
|
|
28
|
-
document.execCommand("copy"),
|
|
29
|
-
|
|
28
|
+
document.execCommand("copy"), i(!0), l && l(t), setTimeout(() => {
|
|
29
|
+
i(!1);
|
|
30
30
|
}, 2e3);
|
|
31
|
-
} catch (
|
|
32
|
-
console.error("Failed to copy:",
|
|
31
|
+
} catch (F) {
|
|
32
|
+
console.error("Failed to copy:", F);
|
|
33
33
|
}
|
|
34
34
|
document.body.removeChild(g);
|
|
35
35
|
}
|
|
36
|
-
}, [t,
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
36
|
+
}, [t, l]), $ = p((k) => {
|
|
37
|
+
var R;
|
|
38
|
+
k.stopPropagation();
|
|
39
|
+
const n = new Blob([t.code], { type: "text/plain" }), g = URL.createObjectURL(n), F = document.createElement("a"), ae = st(t.language), P = ((R = t.title) == null ? void 0 : R.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
|
|
40
|
+
F.href = g, F.download = `${P}.${ae}`, document.body.appendChild(F), F.click(), document.body.removeChild(F), URL.revokeObjectURL(g), o && o(t);
|
|
41
41
|
}, [t, o]), h = [
|
|
42
42
|
"artifactuse-card",
|
|
43
43
|
a && "artifactuse-card--active",
|
|
@@ -50,16 +50,16 @@ function Ot({
|
|
|
50
50
|
fill: "none",
|
|
51
51
|
stroke: "currentColor",
|
|
52
52
|
strokeWidth: "1.5",
|
|
53
|
-
dangerouslySetInnerHTML: { __html:
|
|
53
|
+
dangerouslySetInnerHTML: { __html: x }
|
|
54
54
|
}
|
|
55
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__content" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__title" }, t.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__meta" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__type" },
|
|
55
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__content" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__title" }, t.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__meta" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__type" }, r), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__separator" }, "•"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__size" }, m))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__actions" }, /* @__PURE__ */ e.createElement(
|
|
56
56
|
"button",
|
|
57
57
|
{
|
|
58
58
|
className: "artifactuse-card__action",
|
|
59
|
-
title:
|
|
60
|
-
onClick:
|
|
59
|
+
title: E ? "Copied!" : "Copy code",
|
|
60
|
+
onClick: A
|
|
61
61
|
},
|
|
62
|
-
|
|
62
|
+
E ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "20 6 9 17 4 12" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), /* @__PURE__ */ e.createElement("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }))
|
|
63
63
|
), /* @__PURE__ */ e.createElement(
|
|
64
64
|
"button",
|
|
65
65
|
{
|
|
@@ -70,215 +70,215 @@ function Ot({
|
|
|
70
70
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 10 12 15 17 10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "15", x2: "12", y2: "3" }))
|
|
71
71
|
)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__arrow" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "9 18 15 12 9 6" }))));
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function Kt(t) {
|
|
74
74
|
if (!t) return null;
|
|
75
75
|
const a = t.trim();
|
|
76
76
|
if (a.startsWith("#")) {
|
|
77
77
|
let o = a.slice(1);
|
|
78
78
|
if (o.length === 3 && (o = o.split("").map((u) => u + u).join("")), o.length === 6) {
|
|
79
|
-
const u = parseInt(o.slice(0, 2), 16),
|
|
80
|
-
if (!isNaN(u) && !isNaN(
|
|
79
|
+
const u = parseInt(o.slice(0, 2), 16), E = parseInt(o.slice(2, 4), 16), i = parseInt(o.slice(4, 6), 16);
|
|
80
|
+
if (!isNaN(u) && !isNaN(E) && !isNaN(i)) return `${u}, ${E}, ${i}`;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
const
|
|
86
|
-
return
|
|
83
|
+
const c = a.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
|
|
84
|
+
if (c) return `${c[1]}, ${c[2]}, ${c[3]}`;
|
|
85
|
+
const l = a.split(/[\s,]+/).map(Number).filter((o) => !isNaN(o));
|
|
86
|
+
return l.length >= 3 ? `${l[0]}, ${l[1]}, ${l[2]}` : null;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function ht(t) {
|
|
89
89
|
return t ? t.map((a) => typeof a == "string" ? { label: a, value: a } : a) : [];
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Yt(t) {
|
|
92
92
|
return ["text", "email", "password", "tel", "url", "number", "date", "time", "datetime-local"].includes(t);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Qt({
|
|
95
95
|
artifact: t,
|
|
96
96
|
onSubmit: a,
|
|
97
|
-
onCancel:
|
|
98
|
-
onReset:
|
|
97
|
+
onCancel: c,
|
|
98
|
+
onReset: l,
|
|
99
99
|
onButtonClick: o,
|
|
100
100
|
className: u = "",
|
|
101
|
-
theme:
|
|
102
|
-
accent:
|
|
103
|
-
initialState:
|
|
101
|
+
theme: E = "dark",
|
|
102
|
+
accent: i = null,
|
|
103
|
+
initialState: r = "active"
|
|
104
104
|
// 'active' | 'submitted' | 'cancelled' | 'inactive'
|
|
105
105
|
}) {
|
|
106
|
-
var
|
|
107
|
-
const m =
|
|
106
|
+
var he, ce, re;
|
|
107
|
+
const m = W(null), [x, T] = w(r), A = x !== "active", $ = x === "active" ? "" : `artifactuse-form--${x}`, h = L(() => {
|
|
108
108
|
try {
|
|
109
109
|
return JSON.parse(t.code);
|
|
110
110
|
} catch {
|
|
111
111
|
return { title: "Invalid Form", variant: "fields", data: { fields: [] } };
|
|
112
112
|
}
|
|
113
|
-
}, [t.code]),
|
|
114
|
-
var
|
|
115
|
-
const
|
|
116
|
-
return
|
|
117
|
-
["buttons", "divider", "heading"].includes(
|
|
118
|
-
}), (
|
|
119
|
-
}), [
|
|
120
|
-
|
|
121
|
-
T(
|
|
122
|
-
}, [
|
|
123
|
-
var
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
["buttons", "divider", "heading"].includes(
|
|
127
|
-
}), (
|
|
128
|
-
}, [t.code]),
|
|
129
|
-
if (m.current && (m.current.setAttribute("data-artifactuse-theme",
|
|
130
|
-
const
|
|
131
|
-
|
|
113
|
+
}, [t.code]), k = t.id || h.id || `form-${Date.now()}`, n = ((he = h.data) == null ? void 0 : he.fields) || [], g = h.title || "Form", F = L(() => n.some((f) => f.type === "buttons"), [n]), ae = L(() => h.variant === "buttons" ? n : [], [h.variant, n]), [P, R] = w(() => {
|
|
114
|
+
var M;
|
|
115
|
+
const f = {};
|
|
116
|
+
return n.forEach((b) => {
|
|
117
|
+
["buttons", "divider", "heading"].includes(b.type) || (b.defaultValue !== void 0 ? f[b.name] = b.defaultValue : b.type === "checkbox" ? f[b.name] = !1 : f[b.name] = "");
|
|
118
|
+
}), (M = h.data) != null && M.defaults && Object.assign(f, h.data.defaults), f;
|
|
119
|
+
}), [ne, S] = w({}), [Q, H] = w(!1);
|
|
120
|
+
D(() => {
|
|
121
|
+
T(r);
|
|
122
|
+
}, [r]), D(() => {
|
|
123
|
+
var M;
|
|
124
|
+
const f = {};
|
|
125
|
+
n.forEach((b) => {
|
|
126
|
+
["buttons", "divider", "heading"].includes(b.type) || (b.defaultValue !== void 0 ? f[b.name] = b.defaultValue : b.type === "checkbox" ? f[b.name] = !1 : f[b.name] = "");
|
|
127
|
+
}), (M = h.data) != null && M.defaults && Object.assign(f, h.data.defaults), R(f), S({});
|
|
128
|
+
}, [t.code]), D(() => {
|
|
129
|
+
if (m.current && (m.current.setAttribute("data-artifactuse-theme", E), i)) {
|
|
130
|
+
const f = Kt(i);
|
|
131
|
+
f && m.current.style.setProperty("--artifactuse-primary", f);
|
|
132
132
|
}
|
|
133
|
-
}, [
|
|
134
|
-
const
|
|
135
|
-
T(
|
|
136
|
-
}, []),
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
return delete
|
|
133
|
+
}, [E, i]);
|
|
134
|
+
const O = p((f) => {
|
|
135
|
+
T(f);
|
|
136
|
+
}, []), oe = p((f, M) => {
|
|
137
|
+
R((b) => ({ ...b, [f]: M })), S((b) => {
|
|
138
|
+
const N = { ...b };
|
|
139
|
+
return delete N[f], N;
|
|
140
140
|
});
|
|
141
|
-
}, []),
|
|
142
|
-
var
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
if (["buttons", "divider", "heading"].includes(
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
|
|
141
|
+
}, []), me = p(() => {
|
|
142
|
+
var b;
|
|
143
|
+
const f = {};
|
|
144
|
+
n.forEach((N) => {
|
|
145
|
+
if (["buttons", "divider", "heading"].includes(N.type)) return;
|
|
146
|
+
const _ = P[N.name];
|
|
147
|
+
if (N.required && !_ && _ !== 0 && _ !== !1) {
|
|
148
|
+
f[N.name] = `${N.label || "This field"} is required`;
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
if (
|
|
152
|
-
|
|
151
|
+
if (N.pattern && _ && !new RegExp(N.pattern).test(_)) {
|
|
152
|
+
f[N.name] = N.patternMessage || `${N.label || "This field"} is invalid`;
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
|
-
if (
|
|
156
|
-
|
|
155
|
+
if (N.type === "email" && _ && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(_)) {
|
|
156
|
+
f[N.name] = "Please enter a valid email address";
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
|
-
if (
|
|
160
|
-
|
|
159
|
+
if (N.minLength && _ && _.length < N.minLength) {
|
|
160
|
+
f[N.name] = `Minimum ${N.minLength} characters required`;
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
|
-
if (
|
|
164
|
-
|
|
163
|
+
if (N.maxLength && _ && _.length > N.maxLength) {
|
|
164
|
+
f[N.name] = `Maximum ${N.maxLength} characters allowed`;
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
|
-
const
|
|
169
|
-
return
|
|
170
|
-
if (
|
|
171
|
-
const G =
|
|
172
|
-
|
|
173
|
-
}),
|
|
174
|
-
}, [
|
|
175
|
-
var
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
["buttons", "divider", "heading"].includes(
|
|
179
|
-
}), (
|
|
180
|
-
}, [
|
|
181
|
-
|
|
182
|
-
formId:
|
|
168
|
+
const M = (b = h.data) == null ? void 0 : b.validation;
|
|
169
|
+
return M && Object.entries(M).forEach(([N, _]) => {
|
|
170
|
+
if (f[N]) return;
|
|
171
|
+
const G = P[N];
|
|
172
|
+
_.pattern && G && (new RegExp(_.pattern).test(G) || (f[N] = _.message || `${N} is invalid`));
|
|
173
|
+
}), S(f), Object.keys(f).length === 0;
|
|
174
|
+
}, [n, P, (ce = h.data) == null ? void 0 : ce.validation]), le = p(() => {
|
|
175
|
+
var M;
|
|
176
|
+
const f = {};
|
|
177
|
+
n.forEach((b) => {
|
|
178
|
+
["buttons", "divider", "heading"].includes(b.type) || (b.defaultValue !== void 0 ? f[b.name] = b.defaultValue : b.type === "checkbox" ? f[b.name] = !1 : f[b.name] = "");
|
|
179
|
+
}), (M = h.data) != null && M.defaults && Object.assign(f, h.data.defaults), R(f), S({});
|
|
180
|
+
}, [n, (re = h.data) == null ? void 0 : re.defaults]), ve = p((f) => {
|
|
181
|
+
f == null || f.preventDefault(), me() && (H(!0), a == null || a({
|
|
182
|
+
formId: k,
|
|
183
183
|
action: "submit",
|
|
184
|
-
values: { ...
|
|
184
|
+
values: { ...P },
|
|
185
185
|
timestamp: Date.now()
|
|
186
186
|
}), setTimeout(() => {
|
|
187
|
-
|
|
187
|
+
H(!1), O("submitted");
|
|
188
188
|
}, 300));
|
|
189
|
-
}, [
|
|
190
|
-
const
|
|
191
|
-
switch (
|
|
189
|
+
}, [k, P, a, me, O]), ue = p((f) => {
|
|
190
|
+
const M = f.action || "custom";
|
|
191
|
+
switch (M) {
|
|
192
192
|
case "submit":
|
|
193
|
-
|
|
193
|
+
ve();
|
|
194
194
|
break;
|
|
195
195
|
case "cancel":
|
|
196
|
-
|
|
197
|
-
formId:
|
|
196
|
+
c == null || c({
|
|
197
|
+
formId: k,
|
|
198
198
|
action: "cancel",
|
|
199
|
-
buttonName:
|
|
199
|
+
buttonName: f.name || "cancel",
|
|
200
200
|
timestamp: Date.now()
|
|
201
201
|
}), setTimeout(() => {
|
|
202
|
-
|
|
202
|
+
O("cancelled");
|
|
203
203
|
}, 150);
|
|
204
204
|
break;
|
|
205
205
|
case "reset":
|
|
206
|
-
|
|
207
|
-
formId:
|
|
206
|
+
le(), l == null || l({
|
|
207
|
+
formId: k,
|
|
208
208
|
action: "reset",
|
|
209
|
-
buttonName:
|
|
209
|
+
buttonName: f.name || "reset",
|
|
210
210
|
timestamp: Date.now()
|
|
211
211
|
});
|
|
212
212
|
break;
|
|
213
213
|
case "custom":
|
|
214
214
|
default:
|
|
215
215
|
o == null || o({
|
|
216
|
-
formId:
|
|
217
|
-
action:
|
|
218
|
-
buttonName:
|
|
219
|
-
buttonLabel:
|
|
220
|
-
values: { ...
|
|
216
|
+
formId: k,
|
|
217
|
+
action: M,
|
|
218
|
+
buttonName: f.name || f.label,
|
|
219
|
+
buttonLabel: f.label,
|
|
220
|
+
values: { ...P },
|
|
221
221
|
timestamp: Date.now()
|
|
222
222
|
}), setTimeout(() => {
|
|
223
|
-
|
|
223
|
+
O("submitted");
|
|
224
224
|
}, 150);
|
|
225
225
|
break;
|
|
226
226
|
}
|
|
227
|
-
}, [
|
|
228
|
-
return
|
|
227
|
+
}, [k, P, ve, c, l, o, le, O]);
|
|
228
|
+
return A ? /* @__PURE__ */ e.createElement(
|
|
229
229
|
"div",
|
|
230
230
|
{
|
|
231
231
|
ref: m,
|
|
232
232
|
className: `artifactuse-inline-form artifactuse-form-${h.variant || "fields"} ${$} ${u}`,
|
|
233
|
-
"data-artifactuse-theme":
|
|
233
|
+
"data-artifactuse-theme": E
|
|
234
234
|
},
|
|
235
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed-icon" },
|
|
235
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed-icon" }, x === "submitted" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("polyline", { points: "20 6 9 17 4 12" })), x === "cancelled" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })), x === "inactive" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("line", { x1: "5", y1: "12", x2: "19", y2: "12" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-collapsed-title" }, g))
|
|
236
236
|
) : h.variant === "buttons" ? /* @__PURE__ */ e.createElement(
|
|
237
237
|
"div",
|
|
238
238
|
{
|
|
239
239
|
ref: m,
|
|
240
240
|
className: `artifactuse-inline-form artifactuse-form-buttons ${u}`,
|
|
241
|
-
"data-artifactuse-theme":
|
|
241
|
+
"data-artifactuse-theme": E
|
|
242
242
|
},
|
|
243
243
|
(h.title || h.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, h.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, h.title), h.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, h.description)),
|
|
244
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" },
|
|
244
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, ae.map((f, M) => /* @__PURE__ */ e.createElement(
|
|
245
245
|
"button",
|
|
246
246
|
{
|
|
247
|
-
key:
|
|
247
|
+
key: f.name || f.label || M,
|
|
248
248
|
type: "button",
|
|
249
|
-
className: `artifactuse-form-btn artifactuse-form-btn-${
|
|
250
|
-
onClick: () =>
|
|
251
|
-
disabled:
|
|
249
|
+
className: `artifactuse-form-btn artifactuse-form-btn-${f.variant || "secondary"}`,
|
|
250
|
+
onClick: () => ue(f),
|
|
251
|
+
disabled: f.disabled || Q
|
|
252
252
|
},
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
f.icon && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-icon", dangerouslySetInnerHTML: { __html: f.icon } }),
|
|
254
|
+
f.label
|
|
255
255
|
)))
|
|
256
256
|
) : /* @__PURE__ */ e.createElement(
|
|
257
257
|
"div",
|
|
258
258
|
{
|
|
259
259
|
ref: m,
|
|
260
260
|
className: `artifactuse-inline-form artifactuse-form-fields ${u}`,
|
|
261
|
-
"data-artifactuse-theme":
|
|
261
|
+
"data-artifactuse-theme": E
|
|
262
262
|
},
|
|
263
263
|
(h.title || h.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, h.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, h.title), h.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, h.description)),
|
|
264
|
-
/* @__PURE__ */ e.createElement("form", { onSubmit:
|
|
265
|
-
|
|
264
|
+
/* @__PURE__ */ e.createElement("form", { onSubmit: ve, className: "artifactuse-form" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-fields" }, n.map((f, M) => /* @__PURE__ */ e.createElement(
|
|
265
|
+
Gt,
|
|
266
266
|
{
|
|
267
|
-
key:
|
|
268
|
-
field:
|
|
269
|
-
formId:
|
|
270
|
-
value:
|
|
271
|
-
error:
|
|
272
|
-
isSubmitting:
|
|
273
|
-
onChange: (
|
|
274
|
-
onButtonAction:
|
|
267
|
+
key: f.name || M,
|
|
268
|
+
field: f,
|
|
269
|
+
formId: k,
|
|
270
|
+
value: P[f.name],
|
|
271
|
+
error: ne[f.name],
|
|
272
|
+
isSubmitting: Q,
|
|
273
|
+
onChange: (b) => oe(f.name, b),
|
|
274
|
+
onButtonAction: ue
|
|
275
275
|
}
|
|
276
|
-
))), !
|
|
276
|
+
))), !F && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons artifactuse-form-buttons-default" }, /* @__PURE__ */ e.createElement(
|
|
277
277
|
"button",
|
|
278
278
|
{
|
|
279
279
|
type: "button",
|
|
280
280
|
className: "artifactuse-form-btn artifactuse-form-btn-ghost",
|
|
281
|
-
onClick: () =>
|
|
281
|
+
onClick: () => ue({ action: "cancel", label: "Cancel" })
|
|
282
282
|
},
|
|
283
283
|
"Cancel"
|
|
284
284
|
), /* @__PURE__ */ e.createElement(
|
|
@@ -286,23 +286,23 @@ function Zt({
|
|
|
286
286
|
{
|
|
287
287
|
type: "submit",
|
|
288
288
|
className: "artifactuse-form-btn artifactuse-form-btn-primary",
|
|
289
|
-
disabled:
|
|
289
|
+
disabled: Q
|
|
290
290
|
},
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
Q && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-spinner" }),
|
|
292
|
+
Q ? "Submitting..." : "Submit"
|
|
293
293
|
)))
|
|
294
294
|
);
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
const
|
|
296
|
+
function Gt({ field: t, formId: a, value: c, error: l, isSubmitting: o, onChange: u, onButtonAction: E }) {
|
|
297
|
+
const i = `${a}-${t.name}`;
|
|
298
298
|
if (t.type === "buttons")
|
|
299
|
-
return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, (t.fields || []).map((m,
|
|
299
|
+
return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, (t.fields || []).map((m, x) => /* @__PURE__ */ e.createElement(
|
|
300
300
|
"button",
|
|
301
301
|
{
|
|
302
|
-
key: m.name || m.label ||
|
|
302
|
+
key: m.name || m.label || x,
|
|
303
303
|
type: m.action === "submit" ? "submit" : "button",
|
|
304
304
|
className: `artifactuse-form-btn artifactuse-form-btn-${m.variant || "secondary"}`,
|
|
305
|
-
onClick: m.action !== "submit" ? () =>
|
|
305
|
+
onClick: m.action !== "submit" ? () => E(m) : void 0,
|
|
306
306
|
disabled: m.disabled || m.action === "submit" && o
|
|
307
307
|
},
|
|
308
308
|
o && m.action === "submit" ? /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-spinner" }) : m.icon ? /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-icon", dangerouslySetInnerHTML: { __html: m.icon } }) : null,
|
|
@@ -317,34 +317,34 @@ function Kt({ field: t, formId: a, value: l, error: n, isSubmitting: o, onChange
|
|
|
317
317
|
"input",
|
|
318
318
|
{
|
|
319
319
|
type: "checkbox",
|
|
320
|
-
id:
|
|
320
|
+
id: i,
|
|
321
321
|
name: t.name,
|
|
322
|
-
checked:
|
|
322
|
+
checked: c || !1,
|
|
323
323
|
disabled: t.disabled,
|
|
324
324
|
className: "artifactuse-checkbox",
|
|
325
325
|
onChange: (m) => u(m.target.checked)
|
|
326
326
|
}
|
|
327
|
-
), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-checkbox-text" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*"))), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText),
|
|
327
|
+
), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-checkbox-text" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*"))), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), l && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, l));
|
|
328
328
|
if (t.type === "radio")
|
|
329
|
-
return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, t.label && /* @__PURE__ */ e.createElement("label", { className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-radio-group" },
|
|
329
|
+
return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, t.label && /* @__PURE__ */ e.createElement("label", { className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-radio-group" }, ht(t.options).map((m) => /* @__PURE__ */ e.createElement("label", { key: m.value, className: "artifactuse-radio-label" }, /* @__PURE__ */ e.createElement(
|
|
330
330
|
"input",
|
|
331
331
|
{
|
|
332
332
|
type: "radio",
|
|
333
333
|
name: t.name,
|
|
334
334
|
value: m.value,
|
|
335
|
-
checked:
|
|
335
|
+
checked: c === m.value,
|
|
336
336
|
disabled: m.disabled || t.disabled,
|
|
337
337
|
className: "artifactuse-radio",
|
|
338
338
|
onChange: () => u(m.value)
|
|
339
339
|
}
|
|
340
|
-
), /* @__PURE__ */ e.createElement("span", null, m.label)))), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText),
|
|
341
|
-
const
|
|
340
|
+
), /* @__PURE__ */ e.createElement("span", null, m.label)))), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), l && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, l));
|
|
341
|
+
const r = () => Yt(t.type) ? /* @__PURE__ */ e.createElement(
|
|
342
342
|
"input",
|
|
343
343
|
{
|
|
344
344
|
type: t.type,
|
|
345
|
-
id:
|
|
345
|
+
id: i,
|
|
346
346
|
name: t.name,
|
|
347
|
-
value:
|
|
347
|
+
value: c || "",
|
|
348
348
|
placeholder: t.placeholder,
|
|
349
349
|
disabled: t.disabled,
|
|
350
350
|
required: t.required,
|
|
@@ -354,9 +354,9 @@ function Kt({ field: t, formId: a, value: l, error: n, isSubmitting: o, onChange
|
|
|
354
354
|
) : t.type === "textarea" ? /* @__PURE__ */ e.createElement(
|
|
355
355
|
"textarea",
|
|
356
356
|
{
|
|
357
|
-
id:
|
|
357
|
+
id: i,
|
|
358
358
|
name: t.name,
|
|
359
|
-
value:
|
|
359
|
+
value: c || "",
|
|
360
360
|
placeholder: t.placeholder,
|
|
361
361
|
disabled: t.disabled,
|
|
362
362
|
required: t.required,
|
|
@@ -367,31 +367,31 @@ function Kt({ field: t, formId: a, value: l, error: n, isSubmitting: o, onChange
|
|
|
367
367
|
) : t.type === "select" ? /* @__PURE__ */ e.createElement(
|
|
368
368
|
"select",
|
|
369
369
|
{
|
|
370
|
-
id:
|
|
370
|
+
id: i,
|
|
371
371
|
name: t.name,
|
|
372
|
-
value:
|
|
372
|
+
value: c || "",
|
|
373
373
|
disabled: t.disabled,
|
|
374
374
|
required: t.required,
|
|
375
375
|
className: "artifactuse-select",
|
|
376
376
|
onChange: (m) => u(m.target.value)
|
|
377
377
|
},
|
|
378
378
|
/* @__PURE__ */ e.createElement("option", { value: "" }, t.placeholder || "Select..."),
|
|
379
|
-
|
|
379
|
+
ht(t.options).map((m) => /* @__PURE__ */ e.createElement("option", { key: m.value, value: m.value, disabled: m.disabled }, m.label))
|
|
380
380
|
) : /* @__PURE__ */ e.createElement(
|
|
381
381
|
"input",
|
|
382
382
|
{
|
|
383
383
|
type: "text",
|
|
384
|
-
id:
|
|
384
|
+
id: i,
|
|
385
385
|
name: t.name,
|
|
386
|
-
value:
|
|
386
|
+
value: c || "",
|
|
387
387
|
disabled: t.disabled,
|
|
388
388
|
className: "artifactuse-input",
|
|
389
389
|
onChange: (m) => u(m.target.value)
|
|
390
390
|
}
|
|
391
391
|
);
|
|
392
|
-
return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, /* @__PURE__ */ e.createElement("label", { htmlFor:
|
|
392
|
+
return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, /* @__PURE__ */ e.createElement("label", { htmlFor: i, className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), r(), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), l && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, l));
|
|
393
393
|
}
|
|
394
|
-
const
|
|
394
|
+
const j = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23888"><circle cx="12" cy="8" r="4"/><path d="M12 14c-6 0-8 3-8 6v2h16v-2c0-3-2-6-8-6z"/></svg>', ea = {
|
|
395
395
|
twitter: 280,
|
|
396
396
|
linkedin: 3e3,
|
|
397
397
|
instagram: 2200,
|
|
@@ -399,7 +399,7 @@ const O = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0
|
|
|
399
399
|
threads: 500,
|
|
400
400
|
tiktok: 2200,
|
|
401
401
|
youtube: 100
|
|
402
|
-
},
|
|
402
|
+
}, ta = {
|
|
403
403
|
twitter: "X",
|
|
404
404
|
linkedin: "LinkedIn",
|
|
405
405
|
instagram: "Instagram",
|
|
@@ -407,141 +407,141 @@ const O = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0
|
|
|
407
407
|
threads: "Threads",
|
|
408
408
|
tiktok: "TikTok",
|
|
409
409
|
youtube: "YouTube"
|
|
410
|
-
},
|
|
410
|
+
}, Ue = ({ type: t = "blue" }) => /* @__PURE__ */ e.createElement("svg", { className: `artifactuse-social-verified artifactuse-social-verified-${t}`, viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ e.createElement("path", { d: "M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.34 2.19c-1.39-.46-2.9-.2-3.91.81s-1.27 2.52-.81 3.91C2.63 9.33 1.75 10.57 1.75 12s.88 2.67 2.19 3.34c-.46 1.39-.2 2.9.81 3.91s2.52 1.27 3.91.81c.66 1.31 1.91 2.19 3.34 2.19s2.67-.88 3.34-2.19c1.39.46 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z" })), z = (t) => t ? t >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : t >= 1e3 ? `${(t / 1e3).toFixed(1)}K` : t.toString() : "0", nt = (t) => {
|
|
411
411
|
try {
|
|
412
412
|
return new URL(t).hostname.replace("www.", "");
|
|
413
413
|
} catch {
|
|
414
414
|
return t;
|
|
415
415
|
}
|
|
416
|
-
},
|
|
416
|
+
}, Ce = (t) => {
|
|
417
417
|
if (!t) return "";
|
|
418
418
|
let a = t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
419
419
|
return a = a.replace(/\n/g, "<br>"), a = a.replace(/#(\w+)/g, '<span class="artifactuse-social-hashtag">#$1</span>'), a = a.replace(/@(\w+)/g, '<span class="artifactuse-social-mention">@$1</span>'), a;
|
|
420
|
-
},
|
|
421
|
-
var i, r
|
|
422
|
-
const o = a.media || [], u =
|
|
423
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar ||
|
|
424
|
-
var T,
|
|
425
|
-
return /* @__PURE__ */ e.createElement("div", { key:
|
|
426
|
-
}), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" },
|
|
427
|
-
},
|
|
428
|
-
const o =
|
|
429
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar ||
|
|
430
|
-
},
|
|
420
|
+
}, gt = ({ author: t, content: a, engagement: c, meta: l }) => {
|
|
421
|
+
var E, i, r;
|
|
422
|
+
const o = a.media || [], u = c.likes || c.retweets || c.replies || c.views;
|
|
423
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || j, alt: t.name, className: "artifactuse-social-avatar", onError: (m) => m.target.src = j }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, /* @__PURE__ */ e.createElement("span", null, t.name), t.verified && /* @__PURE__ */ e.createElement(Ue, { type: t.verifiedType || "blue" })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-meta" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-handle" }, t.handle), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-timestamp" }, "· ", l.timestamp || "Just now")))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: Ce(a.text) } }), o.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social-media-grid ${o.length === 1 ? "artifactuse-social-media-single" : ""}`, "data-count": o.length }, o.slice(0, 4).map((m, x) => /* @__PURE__ */ e.createElement("img", { key: x, src: m.url, alt: m.alt || "", onError: (T) => T.target.style.display = "none" })))), a.link && !o.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, a.link.image && /* @__PURE__ */ e.createElement("img", { src: a.link.image, alt: a.link.title, className: "artifactuse-social-link-image", onError: (m) => m.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, a.link.domain || nt(a.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, a.link.title), a.link.description && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-description" }, a.link.description))), a.poll && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll" }, a.poll.options.map((m, x) => {
|
|
424
|
+
var T, A;
|
|
425
|
+
return /* @__PURE__ */ e.createElement("div", { key: x, className: "artifactuse-social-poll-option" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-bar", style: { width: `${((T = a.poll.votes) == null ? void 0 : T[x]) || 0}%` } }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-label" }, /* @__PURE__ */ e.createElement("span", null, m), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-poll-percent" }, ((A = a.poll.votes) == null ? void 0 : A[x]) || 0, "%")));
|
|
426
|
+
}), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" }, z(a.poll.totalVotes || 0), " votes · ", a.poll.duration || "Poll ended")), a.quote && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote-header" }, /* @__PURE__ */ e.createElement("img", { src: ((E = a.quote.author) == null ? void 0 : E.avatar) || j, className: "artifactuse-social-quote-avatar", alt: "" }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-author" }, (i = a.quote.author) == null ? void 0 : i.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-handle" }, (r = a.quote.author) == null ? void 0 : r.handle)), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-quote-text" }, a.quote.text))), u && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, z(c.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, z(c.retweets || 0), " reposts"), /* @__PURE__ */ e.createElement("span", null, z(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, z(c.views || 0), " views")));
|
|
427
|
+
}, aa = ({ author: t, content: a, engagement: c, meta: l }) => {
|
|
428
|
+
const o = c.likes || c.comments || c.shares || c.reposts;
|
|
429
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || j, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = j }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.connection && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-connection" }, "· ", t.connection)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-headline" }, t.headline), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, l.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: Ce(a.text) } }), a.link && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, a.link.image && /* @__PURE__ */ e.createElement("img", { src: a.link.image, alt: a.link.title, className: "artifactuse-social-link-image", onError: (u) => u.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, a.link.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, a.link.domain || nt(a.link.url))))), o && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, z(c.likes || 0), " reactions"), /* @__PURE__ */ e.createElement("span", null, z(c.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, z(c.shares || c.reposts || 0), " reposts")));
|
|
430
|
+
}, ra = ({ author: t, content: a, engagement: c, meta: l }) => {
|
|
431
431
|
const o = a.media || [];
|
|
432
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar ||
|
|
433
|
-
},
|
|
434
|
-
const o = a.media || [], u =
|
|
435
|
-
const
|
|
436
|
-
return Object.values(
|
|
437
|
-
}, [
|
|
438
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar ||
|
|
439
|
-
},
|
|
440
|
-
const o =
|
|
441
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar ||
|
|
442
|
-
},
|
|
443
|
-
const o = a.media || [], u =
|
|
444
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, o[0] ? /* @__PURE__ */ e.createElement("img", { src: o[0].url, alt: "Video thumbnail", onError: (
|
|
445
|
-
},
|
|
432
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || j, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = j }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Ue, { type: "blue" })), l.location && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-location" }, l.location))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, o[0] ? /* @__PURE__ */ e.createElement("img", { src: o[0].url, alt: o[0].alt || "", onError: (u) => u.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-placeholder" })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-likes" }, z(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-caption" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-author" }, t.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-text", dangerouslySetInnerHTML: { __html: Ce(a.text) } })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, l.timestamp || "JUST NOW"));
|
|
433
|
+
}, sa = ({ author: t, content: a, engagement: c, meta: l }) => {
|
|
434
|
+
const o = a.media || [], u = L(() => {
|
|
435
|
+
const i = c.reactions || {};
|
|
436
|
+
return Object.values(i).reduce((r, m) => r + (m || 0), 0) || c.likes || 0;
|
|
437
|
+
}, [c]), E = c.likes || c.comments || c.shares || u;
|
|
438
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || j, alt: t.name, className: "artifactuse-social-avatar", onError: (i) => i.target.src = j }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, l.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: Ce(a.text) } }), o.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-grid", "data-count": o.length }, o.slice(0, 4).map((i, r) => /* @__PURE__ */ e.createElement("img", { key: r, src: i.url, alt: i.alt || "", onError: (m) => m.target.style.display = "none" })))), a.link && !o.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, a.link.image && /* @__PURE__ */ e.createElement("img", { src: a.link.image, alt: a.link.title, className: "artifactuse-social-link-image", onError: (i) => i.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, a.link.domain || nt(a.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, a.link.title)))), E && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, "👍❤️ ", z(u)), /* @__PURE__ */ e.createElement("span", null, z(c.comments || 0), " comments · ", z(c.shares || 0), " shares")));
|
|
439
|
+
}, na = ({ author: t, content: a, engagement: c, meta: l }) => {
|
|
440
|
+
const o = c.likes || c.replies || c.reposts;
|
|
441
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || j, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = j }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Ue, { type: "blue" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-timestamp" }, l.timestamp || "Just now")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: Ce(a.text) } })), o && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, z(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, z(c.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, z(c.reposts || 0), " reposts")));
|
|
442
|
+
}, la = ({ author: t, content: a, engagement: c, meta: l }) => {
|
|
443
|
+
const o = a.media || [], u = c.likes || c.comments || c.shares;
|
|
444
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, o[0] ? /* @__PURE__ */ e.createElement("img", { src: o[0].url, alt: "Video thumbnail", onError: (E) => E.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), a.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, a.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || j, alt: t.name, className: "artifactuse-social-avatar", onError: (E) => E.target.src = j }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-name" }, "@", t.name), t.verified && /* @__PURE__ */ e.createElement(Ue, { type: "blue" })), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: Ce(a.text) } }), a.sound && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-sound" }, "🎵 ", a.sound)), u && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, z(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, z(c.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, z(c.shares || 0), " shares")));
|
|
445
|
+
}, ca = ({ author: t, content: a, engagement: c, meta: l }) => {
|
|
446
446
|
const o = a.media || [];
|
|
447
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, o[0] ? /* @__PURE__ */ e.createElement("img", { src: o[0].url, alt: "Video thumbnail", onError: (u) => u.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), a.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, a.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar ||
|
|
447
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, o[0] ? /* @__PURE__ */ e.createElement("img", { src: o[0].url, alt: "Video thumbnail", onError: (u) => u.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), a.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, a.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || j, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = j }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-details" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-title" }, a.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-channel" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-meta" }, z(c.views || 0), " views · ", l.timestamp || "Just now"))));
|
|
448
448
|
};
|
|
449
|
-
function
|
|
450
|
-
const [
|
|
449
|
+
function ia({ artifact: t, theme: a = "dark", onCopy: c }) {
|
|
450
|
+
const [l, o] = w("Copy"), u = L(() => {
|
|
451
451
|
try {
|
|
452
452
|
return JSON.parse(t.code);
|
|
453
453
|
} catch {
|
|
454
454
|
return { platform: "twitter", data: {} };
|
|
455
455
|
}
|
|
456
|
-
}, [t.code]),
|
|
456
|
+
}, [t.code]), E = (u == null ? void 0 : u.platform) || "twitter", i = (u == null ? void 0 : u.data) || {}, { author: r = {}, content: m = {}, engagement: x = {}, meta: T = {} } = i, A = ea[E] || 280, $ = (m.text || "").length, h = $ > A ? "error" : $ > A * 0.9 ? "warning" : "", k = p(() => {
|
|
457
457
|
const g = m.text || "";
|
|
458
458
|
navigator.clipboard.writeText(g).then(() => {
|
|
459
|
-
o("Copied!"), setTimeout(() => o("Copy"), 2e3),
|
|
459
|
+
o("Copied!"), setTimeout(() => o("Copy"), 2e3), c == null || c({ platform: E, text: g });
|
|
460
460
|
});
|
|
461
|
-
}, [m.text,
|
|
462
|
-
const g = { author:
|
|
463
|
-
switch (
|
|
461
|
+
}, [m.text, E, c]), n = () => {
|
|
462
|
+
const g = { author: r, content: m, engagement: x, meta: T };
|
|
463
|
+
switch (E) {
|
|
464
464
|
case "twitter":
|
|
465
|
-
return /* @__PURE__ */ e.createElement(
|
|
465
|
+
return /* @__PURE__ */ e.createElement(gt, { ...g });
|
|
466
466
|
case "linkedin":
|
|
467
|
-
return /* @__PURE__ */ e.createElement(
|
|
467
|
+
return /* @__PURE__ */ e.createElement(aa, { ...g });
|
|
468
468
|
case "instagram":
|
|
469
|
-
return /* @__PURE__ */ e.createElement(
|
|
469
|
+
return /* @__PURE__ */ e.createElement(ra, { ...g });
|
|
470
470
|
case "facebook":
|
|
471
|
-
return /* @__PURE__ */ e.createElement(
|
|
471
|
+
return /* @__PURE__ */ e.createElement(sa, { ...g });
|
|
472
472
|
case "threads":
|
|
473
|
-
return /* @__PURE__ */ e.createElement(
|
|
473
|
+
return /* @__PURE__ */ e.createElement(na, { ...g });
|
|
474
474
|
case "tiktok":
|
|
475
|
-
return /* @__PURE__ */ e.createElement(
|
|
475
|
+
return /* @__PURE__ */ e.createElement(la, { ...g });
|
|
476
476
|
case "youtube":
|
|
477
|
-
return /* @__PURE__ */ e.createElement(
|
|
477
|
+
return /* @__PURE__ */ e.createElement(ca, { ...g });
|
|
478
478
|
default:
|
|
479
|
-
return /* @__PURE__ */ e.createElement(
|
|
479
|
+
return /* @__PURE__ */ e.createElement(gt, { ...g });
|
|
480
480
|
}
|
|
481
481
|
};
|
|
482
|
-
return /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social artifactuse-social-${
|
|
482
|
+
return /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social artifactuse-social-${E}`, "data-artifactuse-theme": a }, n(), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-bar" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-platform-badge" }, /* @__PURE__ */ e.createElement("span", null, ta[E] || E)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-right" }, /* @__PURE__ */ e.createElement("span", { className: `artifactuse-social-char-counter ${h}` }, $, "/", A), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-social-copy-btn", onClick: k }, l))));
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function oa({
|
|
485
485
|
isOpen: t = !1,
|
|
486
486
|
type: a = "image",
|
|
487
|
-
src:
|
|
488
|
-
alt:
|
|
487
|
+
src: c = "",
|
|
488
|
+
alt: l = "",
|
|
489
489
|
caption: o = "",
|
|
490
490
|
onClose: u,
|
|
491
|
-
className:
|
|
491
|
+
className: E = ""
|
|
492
492
|
}) {
|
|
493
|
-
const
|
|
494
|
-
|
|
495
|
-
var
|
|
496
|
-
return t ? (document.body.style.overflow = "hidden", (
|
|
493
|
+
const i = W(null), [r, m] = w(!1), [x, T] = w(!1);
|
|
494
|
+
D(() => (T(!0), () => T(!1)), []), D(() => {
|
|
495
|
+
var n;
|
|
496
|
+
return t ? (document.body.style.overflow = "hidden", (n = i.current) == null || n.focus()) : (document.body.style.overflow = "", m(!1)), () => {
|
|
497
497
|
document.body.style.overflow = "";
|
|
498
498
|
};
|
|
499
|
-
}, [t]),
|
|
500
|
-
function
|
|
499
|
+
}, [t]), D(() => {
|
|
500
|
+
function n(g) {
|
|
501
501
|
g.key === "Escape" && t && u && u();
|
|
502
502
|
}
|
|
503
|
-
return document.addEventListener("keydown",
|
|
503
|
+
return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
504
504
|
}, [t, u]);
|
|
505
|
-
const
|
|
505
|
+
const A = p(() => {
|
|
506
506
|
m(!1), u && u();
|
|
507
507
|
}, [u]), $ = p(() => {
|
|
508
|
-
a === "image" && m((
|
|
508
|
+
a === "image" && m((n) => !n);
|
|
509
509
|
}, [a]), h = p(() => {
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
}, [
|
|
513
|
-
if (!t || !
|
|
510
|
+
const n = document.createElement("a");
|
|
511
|
+
n.href = c, n.download = l || "download", document.body.appendChild(n), n.click(), document.body.removeChild(n);
|
|
512
|
+
}, [c, l]);
|
|
513
|
+
if (!t || !x)
|
|
514
514
|
return null;
|
|
515
|
-
const
|
|
515
|
+
const k = /* @__PURE__ */ e.createElement(
|
|
516
516
|
"div",
|
|
517
517
|
{
|
|
518
|
-
ref:
|
|
519
|
-
className: `artifactuse-viewer-overlay ${
|
|
520
|
-
onClick:
|
|
518
|
+
ref: i,
|
|
519
|
+
className: `artifactuse-viewer-overlay ${E}`,
|
|
520
|
+
onClick: A,
|
|
521
521
|
tabIndex: -1,
|
|
522
522
|
role: "dialog",
|
|
523
523
|
"aria-modal": "true"
|
|
524
524
|
},
|
|
525
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-content", onClick: (
|
|
525
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-content", onClick: (n) => n.stopPropagation() }, a === "image" && /* @__PURE__ */ e.createElement(
|
|
526
526
|
"img",
|
|
527
527
|
{
|
|
528
|
-
src:
|
|
529
|
-
alt:
|
|
530
|
-
className: `artifactuse-viewer-image ${
|
|
528
|
+
src: c,
|
|
529
|
+
alt: l,
|
|
530
|
+
className: `artifactuse-viewer-image ${r ? "artifactuse-viewer-image--zoomed" : ""}`,
|
|
531
531
|
onClick: $
|
|
532
532
|
}
|
|
533
533
|
), a === "pdf" && /* @__PURE__ */ e.createElement(
|
|
534
534
|
"iframe",
|
|
535
535
|
{
|
|
536
|
-
src:
|
|
536
|
+
src: c,
|
|
537
537
|
className: "artifactuse-viewer-pdf",
|
|
538
|
-
title:
|
|
538
|
+
title: l || "PDF Viewer"
|
|
539
539
|
}
|
|
540
540
|
), /* @__PURE__ */ e.createElement(
|
|
541
541
|
"button",
|
|
542
542
|
{
|
|
543
543
|
className: "artifactuse-viewer-close",
|
|
544
|
-
onClick:
|
|
544
|
+
onClick: A,
|
|
545
545
|
title: "Close (Esc)"
|
|
546
546
|
},
|
|
547
547
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))
|
|
@@ -550,9 +550,9 @@ function la({
|
|
|
550
550
|
{
|
|
551
551
|
className: "artifactuse-viewer-control",
|
|
552
552
|
onClick: $,
|
|
553
|
-
title:
|
|
553
|
+
title: r ? "Zoom out" : "Zoom in"
|
|
554
554
|
},
|
|
555
|
-
|
|
555
|
+
r ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "11", x2: "14", y2: "11" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }), /* @__PURE__ */ e.createElement("line", { x1: "11", y1: "8", x2: "11", y2: "14" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "11", x2: "14", y2: "11" }))
|
|
556
556
|
), /* @__PURE__ */ e.createElement(
|
|
557
557
|
"button",
|
|
558
558
|
{
|
|
@@ -563,247 +563,247 @@ function la({
|
|
|
563
563
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 10 12 15 17 10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "15", x2: "12", y2: "3" }))
|
|
564
564
|
)), o && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-caption" }, o))
|
|
565
565
|
);
|
|
566
|
-
return
|
|
566
|
+
return Xt(k, document.body);
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function ma(t) {
|
|
569
569
|
if (!t) return null;
|
|
570
570
|
try {
|
|
571
571
|
const a = decodeURIComponent(escape(atob(t)));
|
|
572
572
|
return JSON.parse(a);
|
|
573
573
|
} catch {
|
|
574
574
|
try {
|
|
575
|
-
const
|
|
575
|
+
const c = t.replace(/ /g, `
|
|
576
576
|
`).replace(/ /g, "\r").replace(/	/g, " ").replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
577
|
-
return JSON.parse(
|
|
578
|
-
} catch (
|
|
579
|
-
return console.error("Failed to parse artifact data:",
|
|
577
|
+
return JSON.parse(c);
|
|
578
|
+
} catch (c) {
|
|
579
|
+
return console.error("Failed to parse artifact data:", c), null;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
function
|
|
583
|
+
function ua(t) {
|
|
584
584
|
const a = [];
|
|
585
585
|
if (!t) return a;
|
|
586
|
-
const
|
|
587
|
-
let
|
|
588
|
-
for (; (o =
|
|
589
|
-
if (o.index >
|
|
590
|
-
const
|
|
591
|
-
|
|
586
|
+
const c = /<div\s+class="artifactuse-placeholder[^"]*"[^>]*data-artifact-id="([^"]+)"[^>]*data-artifact-type="([^"]+)"[^>]*data-artifact=["']([^"']*)["'][^>]*><\/div>/gi;
|
|
587
|
+
let l = 0, o;
|
|
588
|
+
for (; (o = c.exec(t)) !== null; ) {
|
|
589
|
+
if (o.index > l) {
|
|
590
|
+
const i = t.slice(l, o.index);
|
|
591
|
+
i.trim() && a.push({ type: "html", content: i });
|
|
592
592
|
}
|
|
593
|
-
const u =
|
|
594
|
-
u && (
|
|
593
|
+
const u = ma(o[3]), E = o[2];
|
|
594
|
+
u && (E === "form" && u.isInline ? a.push({ type: "form", artifact: u }) : E === "social" ? a.push({ type: "social", artifact: u }) : a.push({ type: "panel", artifact: u })), l = o.index + o[0].length;
|
|
595
595
|
}
|
|
596
|
-
if (
|
|
597
|
-
const u = t.slice(
|
|
596
|
+
if (l < t.length) {
|
|
597
|
+
const u = t.slice(l);
|
|
598
598
|
u.trim() && a.push({ type: "html", content: u });
|
|
599
599
|
}
|
|
600
600
|
return a.length === 0 && t.trim() && a.push({ type: "html", content: t }), a;
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function da() {
|
|
603
603
|
return `msg-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function fa({
|
|
606
606
|
content: t,
|
|
607
|
-
messageId: a =
|
|
608
|
-
inlineCards:
|
|
609
|
-
typing:
|
|
607
|
+
messageId: a = da(),
|
|
608
|
+
inlineCards: c = !0,
|
|
609
|
+
typing: l = !1,
|
|
610
610
|
isLastMessage: o = !1,
|
|
611
611
|
// Whether this is the last/most recent message
|
|
612
612
|
inlinePreview: u = null,
|
|
613
|
-
inlineCode:
|
|
614
|
-
tabs:
|
|
615
|
-
viewMode:
|
|
613
|
+
inlineCode: E = null,
|
|
614
|
+
tabs: i = null,
|
|
615
|
+
viewMode: r = null,
|
|
616
616
|
onArtifactDetected: m,
|
|
617
|
-
onArtifactOpen:
|
|
617
|
+
onArtifactOpen: x,
|
|
618
618
|
onArtifactCopy: T,
|
|
619
|
-
onArtifactDownload:
|
|
619
|
+
onArtifactDownload: A,
|
|
620
620
|
onFormSubmit: $,
|
|
621
621
|
onFormCancel: h,
|
|
622
|
-
onFormButtonClick:
|
|
623
|
-
onSocialCopy:
|
|
622
|
+
onFormButtonClick: k,
|
|
623
|
+
onSocialCopy: n,
|
|
624
624
|
onMediaOpen: g,
|
|
625
|
-
className:
|
|
625
|
+
className: F = ""
|
|
626
626
|
}) {
|
|
627
|
-
var
|
|
627
|
+
var pe;
|
|
628
628
|
const {
|
|
629
|
-
processMessage:
|
|
630
|
-
openArtifact:
|
|
631
|
-
state:
|
|
632
|
-
getTheme:
|
|
633
|
-
instance:
|
|
634
|
-
} =
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}, [
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
}, [g]),
|
|
641
|
-
|
|
642
|
-
}, []),
|
|
643
|
-
if (!
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
629
|
+
processMessage: ae,
|
|
630
|
+
openArtifact: P,
|
|
631
|
+
state: R,
|
|
632
|
+
getTheme: ne,
|
|
633
|
+
instance: S
|
|
634
|
+
} = Le(), Q = W(null), H = W(null), O = W(null), oe = W(l), [me, le] = w(""), [ve, ue] = w([]), [he, ce] = w(!1), [re, f] = w(!1), [M, b] = w("image"), [N, _] = w(""), [G, de] = w(""), [Se, ge] = w(""), Ae = L(() => typeof ne == "function" ? ne() : "dark", [ne]), K = (R == null ? void 0 : R.activeArtifactId) || null, $e = c ?? ((pe = S == null ? void 0 : S.config) == null ? void 0 : pe.inlineCards) ?? !0, Me = L(() => ua(me), [me]), Ne = L(() => he || o ? "active" : "inactive", [he, o]);
|
|
635
|
+
D(() => {
|
|
636
|
+
l && ce(!0);
|
|
637
|
+
}, [l]);
|
|
638
|
+
const ee = p((v) => {
|
|
639
|
+
b(v.type || "image"), _(v.src || ""), de(v.alt || ""), ge(v.caption || ""), f(!0), g && g(v);
|
|
640
|
+
}, [g]), He = p(() => {
|
|
641
|
+
f(!1), _(""), de(""), ge("");
|
|
642
|
+
}, []), Te = p(() => {
|
|
643
|
+
if (!H.current) return;
|
|
644
|
+
H.current.querySelectorAll('img[data-lightbox="true"]').forEach((d) => {
|
|
645
|
+
d._lightboxHandler && d.removeEventListener("click", d._lightboxHandler), d._lightboxHandler = (I) => {
|
|
646
|
+
I.preventDefault(), I.stopPropagation(), ee({
|
|
647
647
|
type: "image",
|
|
648
|
-
src:
|
|
649
|
-
alt:
|
|
650
|
-
caption:
|
|
648
|
+
src: d.src,
|
|
649
|
+
alt: d.alt || "",
|
|
650
|
+
caption: d.dataset.caption || d.alt || ""
|
|
651
651
|
});
|
|
652
|
-
},
|
|
653
|
-
}),
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
const
|
|
657
|
-
|
|
652
|
+
}, d.addEventListener("click", d._lightboxHandler), d.style.cursor = "zoom-in";
|
|
653
|
+
}), H.current.querySelectorAll(".artifactuse-image-container img").forEach((d) => {
|
|
654
|
+
d._lightboxHandler || (d._lightboxHandler = (I) => {
|
|
655
|
+
I.preventDefault(), I.stopPropagation();
|
|
656
|
+
const U = d.closest(".artifactuse-image-container"), Y = U == null ? void 0 : U.querySelector(".artifactuse-image-caption"), Ee = (Y == null ? void 0 : Y.textContent) || d.dataset.caption || d.alt || "";
|
|
657
|
+
ee({
|
|
658
658
|
type: "image",
|
|
659
|
-
src:
|
|
660
|
-
alt:
|
|
661
|
-
caption:
|
|
659
|
+
src: d.src,
|
|
660
|
+
alt: d.alt || "",
|
|
661
|
+
caption: Ee
|
|
662
662
|
});
|
|
663
|
-
},
|
|
664
|
-
}),
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
const
|
|
668
|
-
|
|
663
|
+
}, d.addEventListener("click", d._lightboxHandler), d.style.cursor = "zoom-in");
|
|
664
|
+
}), H.current.querySelectorAll(".artifactuse-gallery-item img, .artifactuse-image-gallery img").forEach((d) => {
|
|
665
|
+
d._lightboxHandler || (d._lightboxHandler = (I) => {
|
|
666
|
+
I.preventDefault(), I.stopPropagation();
|
|
667
|
+
const U = d.closest(".artifactuse-gallery-item"), Y = U == null ? void 0 : U.querySelector(".artifactuse-gallery-caption"), Ee = (Y == null ? void 0 : Y.textContent) || d.dataset.caption || d.alt || "";
|
|
668
|
+
ee({
|
|
669
669
|
type: "image",
|
|
670
|
-
src:
|
|
671
|
-
alt:
|
|
672
|
-
caption:
|
|
670
|
+
src: d.src,
|
|
671
|
+
alt: d.alt || "",
|
|
672
|
+
caption: Ee
|
|
673
673
|
});
|
|
674
|
-
},
|
|
675
|
-
}),
|
|
676
|
-
|
|
677
|
-
|
|
674
|
+
}, d.addEventListener("click", d._lightboxHandler), d.style.cursor = "zoom-in");
|
|
675
|
+
}), H.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((d) => {
|
|
676
|
+
d._pdfHandler && d.removeEventListener("click", d._pdfHandler), d._pdfHandler = (I) => {
|
|
677
|
+
I.preventDefault(), I.stopPropagation(), ee({
|
|
678
678
|
type: "pdf",
|
|
679
|
-
src:
|
|
680
|
-
alt:
|
|
681
|
-
caption:
|
|
679
|
+
src: d.href,
|
|
680
|
+
alt: d.textContent || "PDF Document",
|
|
681
|
+
caption: d.title || d.textContent || ""
|
|
682
682
|
});
|
|
683
|
-
},
|
|
684
|
-
}),
|
|
685
|
-
var
|
|
686
|
-
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
|
|
683
|
+
}, d.addEventListener("click", d._pdfHandler);
|
|
684
|
+
}), H.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((d) => {
|
|
685
|
+
var U;
|
|
686
|
+
d._pdfHandler && d.removeEventListener("click", d._pdfHandler);
|
|
687
|
+
const I = d.dataset.pdfSrc || ((U = d.querySelector("iframe")) == null ? void 0 : U.src) || "";
|
|
688
|
+
I && (d._pdfHandler = (Y) => {
|
|
689
|
+
Y.preventDefault(), Y.stopPropagation(), ee({
|
|
690
690
|
type: "pdf",
|
|
691
|
-
src:
|
|
691
|
+
src: I,
|
|
692
692
|
alt: "PDF Document",
|
|
693
|
-
caption:
|
|
693
|
+
caption: d.dataset.caption || ""
|
|
694
694
|
});
|
|
695
|
-
},
|
|
696
|
-
}),
|
|
697
|
-
|
|
698
|
-
if (
|
|
699
|
-
const
|
|
700
|
-
|
|
701
|
-
},
|
|
695
|
+
}, d.addEventListener("click", d._pdfHandler), d.style.cursor = "pointer");
|
|
696
|
+
}), H.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((d) => {
|
|
697
|
+
d._clickHandler && d.removeEventListener("click", d._clickHandler), d._clickHandler = (I) => {
|
|
698
|
+
if (I.target.closest(".artifactuse-video-play-button")) return;
|
|
699
|
+
const U = d.dataset.videoUrl || d.dataset.url;
|
|
700
|
+
U && window.open(U, "_blank", "noopener,noreferrer");
|
|
701
|
+
}, d.addEventListener("click", d._clickHandler);
|
|
702
702
|
});
|
|
703
|
-
}, [
|
|
704
|
-
if (!
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
}),
|
|
708
|
-
|
|
709
|
-
}),
|
|
710
|
-
|
|
711
|
-
}),
|
|
712
|
-
|
|
703
|
+
}, [ee]), je = p(() => {
|
|
704
|
+
if (!H.current) return;
|
|
705
|
+
H.current.querySelectorAll("img").forEach((C) => {
|
|
706
|
+
C._lightboxHandler && (C.removeEventListener("click", C._lightboxHandler), delete C._lightboxHandler);
|
|
707
|
+
}), H.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((C) => {
|
|
708
|
+
C._pdfHandler && (C.removeEventListener("click", C._pdfHandler), delete C._pdfHandler);
|
|
709
|
+
}), H.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((C) => {
|
|
710
|
+
C._pdfHandler && (C.removeEventListener("click", C._pdfHandler), delete C._pdfHandler);
|
|
711
|
+
}), H.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((C) => {
|
|
712
|
+
C._clickHandler && (C.removeEventListener("click", C._clickHandler), delete C._clickHandler);
|
|
713
713
|
});
|
|
714
|
-
}, []),
|
|
715
|
-
|
|
716
|
-
if (
|
|
714
|
+
}, []), ie = p(() => {
|
|
715
|
+
O.current && clearTimeout(O.current), O.current = setTimeout(async () => {
|
|
716
|
+
if (S != null && S.initializeContent && H.current)
|
|
717
717
|
try {
|
|
718
|
-
await
|
|
719
|
-
} catch (
|
|
720
|
-
console.error("Failed to initialize content:",
|
|
718
|
+
await S.initializeContent(H.current);
|
|
719
|
+
} catch (v) {
|
|
720
|
+
console.error("Failed to initialize content:", v);
|
|
721
721
|
}
|
|
722
|
-
|
|
722
|
+
Te();
|
|
723
723
|
}, 100);
|
|
724
|
-
}, [
|
|
725
|
-
|
|
724
|
+
}, [S, Te]);
|
|
725
|
+
D(() => {
|
|
726
726
|
if (t) {
|
|
727
|
-
const
|
|
727
|
+
const v = ae(t, a, {
|
|
728
728
|
inlinePreview: u,
|
|
729
|
-
inlineCode:
|
|
730
|
-
tabs:
|
|
731
|
-
viewMode:
|
|
729
|
+
inlineCode: E,
|
|
730
|
+
tabs: i,
|
|
731
|
+
viewMode: r
|
|
732
732
|
});
|
|
733
|
-
|
|
733
|
+
le(v.html), ue(v.artifacts), v.artifacts.length > 0 && m && m(v.artifacts), l || ie();
|
|
734
734
|
}
|
|
735
|
-
}, [t, a,
|
|
736
|
-
|
|
737
|
-
}, [
|
|
738
|
-
|
|
735
|
+
}, [t, a, ae, l, ie, m]), D(() => {
|
|
736
|
+
oe.current === !0 && l === !1 && ie(), oe.current = l;
|
|
737
|
+
}, [l, ie]), D(() => (l && ce(!0), l || ie(), () => {
|
|
738
|
+
O.current && clearTimeout(O.current), je();
|
|
739
739
|
}), []);
|
|
740
|
-
const
|
|
741
|
-
const
|
|
742
|
-
if (
|
|
743
|
-
if (
|
|
744
|
-
const
|
|
745
|
-
if (
|
|
746
|
-
const
|
|
747
|
-
|
|
740
|
+
const Oe = p((v) => {
|
|
741
|
+
const se = v.target.closest(".artifactuse-inline-preview");
|
|
742
|
+
if (se) {
|
|
743
|
+
if (se.dataset.nonClickable) return;
|
|
744
|
+
const ke = se.dataset.artifactId;
|
|
745
|
+
if (ke) {
|
|
746
|
+
const J = R.artifacts.find((C) => C.id === ke);
|
|
747
|
+
J && (P(J), x && x(J));
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
}, [
|
|
751
|
-
|
|
752
|
-
}, [
|
|
753
|
-
T && T(
|
|
754
|
-
}, [T]),
|
|
755
|
-
|
|
756
|
-
}, [
|
|
757
|
-
$ && $(
|
|
758
|
-
}, [$]),
|
|
759
|
-
h && h(
|
|
760
|
-
}, [h]),
|
|
761
|
-
|
|
762
|
-
}, [
|
|
763
|
-
|
|
764
|
-
}, [
|
|
765
|
-
switch (
|
|
750
|
+
}, [R, P, x]), Ie = p((v) => {
|
|
751
|
+
P(v), x && x(v);
|
|
752
|
+
}, [P, x]), fe = p((v) => {
|
|
753
|
+
T && T(v);
|
|
754
|
+
}, [T]), Be = p((v) => {
|
|
755
|
+
A && A(v);
|
|
756
|
+
}, [A]), we = p((v) => {
|
|
757
|
+
$ && $(v);
|
|
758
|
+
}, [$]), Ve = p((v) => {
|
|
759
|
+
h && h(v);
|
|
760
|
+
}, [h]), ye = p((v) => {
|
|
761
|
+
k && k(v);
|
|
762
|
+
}, [k]), _e = p((v) => {
|
|
763
|
+
n && n(v);
|
|
764
|
+
}, [n]), Je = (v, se) => {
|
|
765
|
+
switch (v.type) {
|
|
766
766
|
case "html":
|
|
767
767
|
return /* @__PURE__ */ e.createElement(
|
|
768
768
|
"div",
|
|
769
769
|
{
|
|
770
|
-
key: `html-${
|
|
771
|
-
dangerouslySetInnerHTML: { __html:
|
|
770
|
+
key: `html-${se}`,
|
|
771
|
+
dangerouslySetInnerHTML: { __html: v.content }
|
|
772
772
|
}
|
|
773
773
|
);
|
|
774
774
|
case "form":
|
|
775
|
-
return
|
|
776
|
-
|
|
775
|
+
return v.artifact.isInline ? /* @__PURE__ */ e.createElement(
|
|
776
|
+
Qt,
|
|
777
777
|
{
|
|
778
|
-
key: `form-${
|
|
779
|
-
artifact:
|
|
780
|
-
theme:
|
|
781
|
-
initialState:
|
|
782
|
-
onSubmit:
|
|
783
|
-
onCancel:
|
|
784
|
-
onButtonClick:
|
|
778
|
+
key: `form-${v.artifact.id}`,
|
|
779
|
+
artifact: v.artifact,
|
|
780
|
+
theme: Ae,
|
|
781
|
+
initialState: Ne,
|
|
782
|
+
onSubmit: we,
|
|
783
|
+
onCancel: Ve,
|
|
784
|
+
onButtonClick: ye
|
|
785
785
|
}
|
|
786
786
|
) : null;
|
|
787
787
|
case "social":
|
|
788
788
|
return /* @__PURE__ */ e.createElement(
|
|
789
|
-
|
|
789
|
+
ia,
|
|
790
790
|
{
|
|
791
|
-
key: `social-${
|
|
792
|
-
artifact:
|
|
793
|
-
theme:
|
|
794
|
-
onCopy:
|
|
791
|
+
key: `social-${v.artifact.id}`,
|
|
792
|
+
artifact: v.artifact,
|
|
793
|
+
theme: Ae,
|
|
794
|
+
onCopy: _e
|
|
795
795
|
}
|
|
796
796
|
);
|
|
797
797
|
case "panel":
|
|
798
|
-
return
|
|
799
|
-
|
|
798
|
+
return $e ? /* @__PURE__ */ e.createElement(
|
|
799
|
+
Zt,
|
|
800
800
|
{
|
|
801
|
-
key: `panel-${
|
|
802
|
-
artifact:
|
|
803
|
-
isActive:
|
|
804
|
-
onOpen:
|
|
805
|
-
onCopy:
|
|
806
|
-
onDownload:
|
|
801
|
+
key: `panel-${v.artifact.id}`,
|
|
802
|
+
artifact: v.artifact,
|
|
803
|
+
isActive: K === v.artifact.id,
|
|
804
|
+
onOpen: Ie,
|
|
805
|
+
onCopy: fe,
|
|
806
|
+
onDownload: Be
|
|
807
807
|
}
|
|
808
808
|
) : null;
|
|
809
809
|
default:
|
|
@@ -813,24 +813,24 @@ function ma({
|
|
|
813
813
|
return /* @__PURE__ */ e.createElement(
|
|
814
814
|
"div",
|
|
815
815
|
{
|
|
816
|
-
ref:
|
|
817
|
-
className: `artifactuse-agent-message ${
|
|
816
|
+
ref: Q,
|
|
817
|
+
className: `artifactuse-agent-message ${F}`.trim()
|
|
818
818
|
},
|
|
819
|
-
/* @__PURE__ */ e.createElement("div", { ref:
|
|
819
|
+
/* @__PURE__ */ e.createElement("div", { ref: H, className: "artifactuse-message-content", onClick: Oe }, Me.map(Je)),
|
|
820
820
|
/* @__PURE__ */ e.createElement(
|
|
821
|
-
|
|
821
|
+
oa,
|
|
822
822
|
{
|
|
823
|
-
isOpen:
|
|
824
|
-
type:
|
|
825
|
-
src:
|
|
823
|
+
isOpen: re,
|
|
824
|
+
type: M,
|
|
825
|
+
src: N,
|
|
826
826
|
alt: G,
|
|
827
|
-
caption:
|
|
828
|
-
onClose:
|
|
827
|
+
caption: Se,
|
|
828
|
+
onClose: He
|
|
829
829
|
}
|
|
830
830
|
)
|
|
831
831
|
);
|
|
832
832
|
}
|
|
833
|
-
|
|
833
|
+
fa.propTypes = {
|
|
834
834
|
/** The raw message content (markdown/HTML from AI) */
|
|
835
835
|
content: (t, a) => {
|
|
836
836
|
if (typeof t[a] != "string")
|
|
@@ -877,321 +877,327 @@ ma.propTypes = {
|
|
|
877
877
|
return new Error(`${a} must be a string or null`);
|
|
878
878
|
}
|
|
879
879
|
};
|
|
880
|
-
function
|
|
880
|
+
function ba({
|
|
881
881
|
onAIRequest: t,
|
|
882
882
|
onSave: a,
|
|
883
|
-
onExport:
|
|
884
|
-
className:
|
|
883
|
+
onExport: c,
|
|
884
|
+
className: l = "",
|
|
885
885
|
panelWidth: o,
|
|
886
|
-
splitPosition: u
|
|
886
|
+
splitPosition: u,
|
|
887
|
+
externalPreview: E
|
|
887
888
|
}) {
|
|
888
|
-
var
|
|
889
|
+
var Et;
|
|
889
890
|
const {
|
|
890
891
|
state: i,
|
|
891
892
|
activeArtifact: r,
|
|
892
|
-
artifactCount:
|
|
893
|
-
hasArtifacts:
|
|
894
|
-
closePanel:
|
|
895
|
-
toggleFullscreen:
|
|
896
|
-
setViewMode:
|
|
897
|
-
getPanelUrl:
|
|
898
|
-
openArtifact:
|
|
899
|
-
instance:
|
|
900
|
-
} =
|
|
893
|
+
artifactCount: m,
|
|
894
|
+
hasArtifacts: x,
|
|
895
|
+
closePanel: T,
|
|
896
|
+
toggleFullscreen: A,
|
|
897
|
+
setViewMode: $,
|
|
898
|
+
getPanelUrl: h,
|
|
899
|
+
openArtifact: k,
|
|
900
|
+
instance: n
|
|
901
|
+
} = Le(), g = W(null), F = W(null), ae = W(null), P = W(null), R = W(null), ne = W(null), S = W(null), [Q, H] = w(!1), [O, oe] = w(!1), [me, le] = w(!0), [ve, ue] = w(!1), [he, ce] = w(!1), [re, f] = w(!1), [M, b] = w(!1), [N, _] = w("options"), [G, de] = w(""), [Se, ge] = w(null), [Ae, K] = w(""), [$e, Me] = w(!1), [Ne, ee] = w(!1), [He, Te] = w([]), [je, ie] = w(!1), [Oe, Ie] = w(""), [fe, Be] = w(
|
|
901
902
|
() => {
|
|
902
903
|
var s;
|
|
903
|
-
return Math.min(Math.max(o ?? ((s =
|
|
904
|
+
return Math.min(Math.max(o ?? ((s = n == null ? void 0 : n.config) == null ? void 0 : s.panelWidth) ?? 65, 25), 75);
|
|
904
905
|
}
|
|
905
|
-
), [
|
|
906
|
+
), [we, Ve] = w(
|
|
906
907
|
() => {
|
|
907
908
|
var s;
|
|
908
|
-
return Math.min(Math.max(u ?? ((s =
|
|
909
|
+
return Math.min(Math.max(u ?? ((s = n == null ? void 0 : n.config) == null ? void 0 : s.splitPosition) ?? 50, 20), 80);
|
|
909
910
|
}
|
|
910
|
-
),
|
|
911
|
-
|
|
912
|
-
o !== void 0 &&
|
|
913
|
-
}, [o]),
|
|
914
|
-
u !== void 0 &&
|
|
911
|
+
), ye = W(null), _e = W(null);
|
|
912
|
+
D(() => {
|
|
913
|
+
o !== void 0 && Be(Math.min(Math.max(o, 25), 75));
|
|
914
|
+
}, [o]), D(() => {
|
|
915
|
+
u !== void 0 && Ve(Math.min(Math.max(u, 20), 80));
|
|
915
916
|
}, [u]);
|
|
916
|
-
const
|
|
917
|
+
const Je = W(null), pe = W(null), v = W(null), se = L(() => r ? De(r.language) : "", [r]), ke = L(() => r ? rt(r.language) : "", [r]), J = L(() => {
|
|
917
918
|
if (!r) return null;
|
|
918
|
-
let s =
|
|
919
|
+
let s = h(r);
|
|
919
920
|
return s && r._refreshToken && (s += (s.includes("?") ? "&" : "?") + "_t=" + r._refreshToken), s;
|
|
920
|
-
}, [r,
|
|
921
|
+
}, [r, h]), C = L(() => r ? Ut(r.language) : "plaintext", [r]), q = L(() => i.artifacts.filter((s) => !s.isInline), [i.artifacts]), d = L(() => r ? q.findIndex((s) => s.id === r.id) : -1, [r, q]), I = L(() => {
|
|
922
|
+
var s;
|
|
923
|
+
return ((s = n == null ? void 0 : n.config) == null ? void 0 : s.branding) !== !1;
|
|
924
|
+
}, [n]), U = L(() => {
|
|
921
925
|
var s;
|
|
922
|
-
return ((s =
|
|
923
|
-
}, [
|
|
926
|
+
return J ? (r == null ? void 0 : r.externalPreview) !== void 0 ? r.externalPreview : E !== void 0 ? E : ((s = n == null ? void 0 : n.config) == null ? void 0 : s.externalPreview) ?? !1 : !1;
|
|
927
|
+
}, [r, E, n, J]), Y = L(() => {
|
|
924
928
|
var s;
|
|
925
|
-
return ((s =
|
|
926
|
-
}, [
|
|
929
|
+
return ((s = n == null ? void 0 : n.share) == null ? void 0 : s.enabled) !== !1;
|
|
930
|
+
}, [n]), Ee = L(() => {
|
|
927
931
|
var s;
|
|
928
|
-
return ((s =
|
|
929
|
-
}, [
|
|
932
|
+
return ((s = n == null ? void 0 : n.share) == null ? void 0 : s.isAuthenticated()) || !1;
|
|
933
|
+
}, [n]), lt = L(() => !r && !i.forceEmptyView ? Math.min(fe, 30) : fe, [r, fe, i.forceEmptyView]), Fe = L(() => {
|
|
930
934
|
var s;
|
|
931
|
-
return ((s =
|
|
932
|
-
}, [
|
|
933
|
-
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
}, [
|
|
935
|
+
return ((s = n == null ? void 0 : n.config) == null ? void 0 : s.multiTab) === !0;
|
|
936
|
+
}, [n]);
|
|
937
|
+
L(() => Fe ? i.openTabs.map((s) => i.artifacts.find((y) => y.id === s)).filter(Boolean) : [], [Fe, i.openTabs, i.artifacts]);
|
|
938
|
+
const ct = p((s) => `<svg viewBox="0 0 24 24" fill="currentColor">${rt(s)}</svg>`, []), Nt = p(() => {
|
|
939
|
+
ce(!1), n.state.clearActiveArtifact();
|
|
940
|
+
}, [n]), We = p((s) => {
|
|
937
941
|
if (s.language !== "smartdiff") return null;
|
|
938
942
|
try {
|
|
939
|
-
const
|
|
940
|
-
if (
|
|
941
|
-
const
|
|
943
|
+
const y = JSON.parse(s.code);
|
|
944
|
+
if (y.oldCode === void 0 || y.newCode === void 0) return null;
|
|
945
|
+
const B = y.language || "plaintext", V = vt() && window.Prism.languages[B], X = jt(y.oldCode, y.newCode).split(`
|
|
942
946
|
`);
|
|
943
947
|
return { html: X.map((te) => {
|
|
944
|
-
const
|
|
945
|
-
return
|
|
948
|
+
const Z = te[0], xe = te.slice(1), be = V ? window.Prism.highlight(xe, V, B) : xe;
|
|
949
|
+
return Z === "-" ? `<span class="token deleted">${be}</span>` : Z === "+" ? `<span class="token inserted">${be}</span>` : be;
|
|
946
950
|
}).join(`
|
|
947
951
|
`), lineCount: X.length };
|
|
948
952
|
} catch {
|
|
949
953
|
return null;
|
|
950
954
|
}
|
|
951
|
-
}, []),
|
|
952
|
-
if (!
|
|
953
|
-
const s =
|
|
954
|
-
`).length,
|
|
955
|
-
|
|
956
|
-
}, [r,
|
|
957
|
-
if (
|
|
958
|
-
const s =
|
|
955
|
+
}, []), it = p(() => {
|
|
956
|
+
if (!P.current || !(r != null && r.code)) return;
|
|
957
|
+
const s = We(r), y = s ? s.lineCount : r.code.split(`
|
|
958
|
+
`).length, B = Array.from({ length: y }, (V, X) => `<div>${X + 1}</div>`).join("");
|
|
959
|
+
P.current.innerHTML = B;
|
|
960
|
+
}, [r, We]), ot = p(() => {
|
|
961
|
+
if (F.current && vt() && (r != null && r.code)) {
|
|
962
|
+
const s = We(r);
|
|
959
963
|
if (s)
|
|
960
|
-
|
|
964
|
+
F.current.innerHTML = s.html;
|
|
961
965
|
else {
|
|
962
|
-
const
|
|
963
|
-
|
|
966
|
+
const y = window.Prism.languages[C];
|
|
967
|
+
y ? F.current.innerHTML = window.Prism.highlight(
|
|
964
968
|
r.code,
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
) :
|
|
969
|
+
y,
|
|
970
|
+
C
|
|
971
|
+
) : F.current.textContent = r.code;
|
|
968
972
|
}
|
|
969
|
-
|
|
970
|
-
|
|
973
|
+
F.current.dataset.highlighted = "true", setTimeout(() => {
|
|
974
|
+
wt();
|
|
971
975
|
}, 0);
|
|
972
976
|
}
|
|
973
|
-
}, [r == null ? void 0 : r.code,
|
|
974
|
-
var
|
|
975
|
-
const s = (
|
|
976
|
-
if (s &&
|
|
977
|
-
const
|
|
978
|
-
|
|
977
|
+
}, [r == null ? void 0 : r.code, C, We]), wt = p(() => {
|
|
978
|
+
var y;
|
|
979
|
+
const s = (y = F.current) == null ? void 0 : y.closest("pre");
|
|
980
|
+
if (s && R.current && P.current) {
|
|
981
|
+
const V = window.getComputedStyle(s).backgroundColor;
|
|
982
|
+
V && V !== "rgba(0, 0, 0, 0)" && V !== "transparent" && (R.current.style.backgroundColor = V, P.current.style.backgroundColor = V);
|
|
979
983
|
}
|
|
980
|
-
}, []),
|
|
981
|
-
|
|
982
|
-
}, []),
|
|
983
|
-
|
|
984
|
-
}, [
|
|
985
|
-
!
|
|
984
|
+
}, []), mt = p(() => {
|
|
985
|
+
R.current && (R.current.style.backgroundColor = ""), P.current && (P.current.style.backgroundColor = "");
|
|
986
|
+
}, []), Xe = p(() => {
|
|
987
|
+
it(), ot();
|
|
988
|
+
}, [it, ot]), Ze = ((Et = n.editor) == null ? void 0 : Et.isAvailable()) || !1, ut = p(() => {
|
|
989
|
+
!Ze || !ne.current || !r || (S.current && (S.current.destroy(), S.current = null), S.current = n.editor.create(ne.current, {
|
|
986
990
|
code: r.code || "",
|
|
987
991
|
language: r.editorLanguage || r.language || "plaintext",
|
|
988
|
-
sdkTheme:
|
|
992
|
+
sdkTheme: n.getTheme()
|
|
989
993
|
}));
|
|
990
|
-
}, [
|
|
991
|
-
if (!
|
|
992
|
-
const s =
|
|
993
|
-
|
|
994
|
+
}, [Ze, r, n]), kt = p(() => {
|
|
995
|
+
if (!S.current || !r) return;
|
|
996
|
+
const s = S.current.getCode();
|
|
997
|
+
n.emit("edit:save", {
|
|
994
998
|
artifactId: r.id,
|
|
995
999
|
artifact: r,
|
|
996
1000
|
code: s
|
|
997
1001
|
});
|
|
998
|
-
}, [r,
|
|
999
|
-
|
|
1000
|
-
}, [
|
|
1001
|
-
clearTimeout(
|
|
1002
|
-
}, []),
|
|
1003
|
-
clearTimeout(
|
|
1004
|
-
|
|
1002
|
+
}, [r, n]), xt = p(() => {
|
|
1003
|
+
J && window.open(J, "_blank", "noopener,noreferrer");
|
|
1004
|
+
}, [J]), Ct = p(() => {
|
|
1005
|
+
clearTimeout(pe.current), le(!1), g.current && r && (n.bridge.setIframe(g.current), n.bridge.loadArtifact(r));
|
|
1006
|
+
}, [r, n]), Lt = p(() => {
|
|
1007
|
+
clearTimeout(pe.current), le(!1);
|
|
1008
|
+
}, []), Mt = p(() => {
|
|
1009
|
+
clearTimeout(pe.current), pe.current = setTimeout(() => {
|
|
1010
|
+
le(!1);
|
|
1005
1011
|
}, 1e3);
|
|
1006
|
-
}, []),
|
|
1012
|
+
}, []), Tt = p(async () => {
|
|
1007
1013
|
if (r)
|
|
1008
1014
|
try {
|
|
1009
|
-
await navigator.clipboard.writeText(r.code),
|
|
1015
|
+
await navigator.clipboard.writeText(r.code), H(!0), setTimeout(() => H(!1), 2e3);
|
|
1010
1016
|
} catch (s) {
|
|
1011
1017
|
console.error("Failed to copy:", s);
|
|
1012
1018
|
}
|
|
1013
|
-
}, [r]),
|
|
1019
|
+
}, [r]), Pt = p(() => {
|
|
1014
1020
|
if (!r) return;
|
|
1015
|
-
const { code: s, language:
|
|
1016
|
-
|
|
1017
|
-
}, [r]),
|
|
1018
|
-
if (!(
|
|
1019
|
-
|
|
1021
|
+
const { code: s, language: y, title: B } = r, V = st(y), X = `${B.toLowerCase().replace(/\s+/g, "-")}.${V}`, Pe = new Blob([s], { type: "text/plain" }), te = URL.createObjectURL(Pe), Z = document.createElement("a");
|
|
1022
|
+
Z.href = te, Z.download = X, document.body.appendChild(Z), Z.click(), document.body.removeChild(Z), URL.revokeObjectURL(te);
|
|
1023
|
+
}, [r]), St = p(async () => {
|
|
1024
|
+
if (!(re || q.length === 0)) {
|
|
1025
|
+
f(!0);
|
|
1020
1026
|
try {
|
|
1021
|
-
const s = new
|
|
1022
|
-
for (const
|
|
1023
|
-
if (!
|
|
1024
|
-
const
|
|
1025
|
-
let
|
|
1026
|
-
const
|
|
1027
|
-
|
|
1027
|
+
const s = new Jt(), y = /* @__PURE__ */ new Map();
|
|
1028
|
+
for (const Z of q) {
|
|
1029
|
+
if (!Z.code) continue;
|
|
1030
|
+
const xe = st(Z.language);
|
|
1031
|
+
let be = (Z.title || "untitled").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-_]/g, ""), tt = `${be}.${xe}`;
|
|
1032
|
+
const at = y.get(tt) || 0;
|
|
1033
|
+
at > 0 && (tt = `${be}-${at}.${xe}`), y.set(`${be}.${xe}`, at + 1), s.file(tt, Z.code);
|
|
1028
1034
|
}
|
|
1029
|
-
const
|
|
1030
|
-
te.href =
|
|
1035
|
+
const B = await s.generateAsync({ type: "blob" }), X = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, Pe = URL.createObjectURL(B), te = document.createElement("a");
|
|
1036
|
+
te.href = Pe, te.download = X, document.body.appendChild(te), te.click(), document.body.removeChild(te), URL.revokeObjectURL(Pe);
|
|
1031
1037
|
} catch (s) {
|
|
1032
1038
|
console.error("Failed to create ZIP:", s);
|
|
1033
1039
|
} finally {
|
|
1034
|
-
|
|
1040
|
+
f(!1);
|
|
1035
1041
|
}
|
|
1036
1042
|
}
|
|
1037
|
-
}, [
|
|
1038
|
-
if (
|
|
1039
|
-
|
|
1043
|
+
}, [re, q]), dt = p((s) => s ? new Date(s).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : "", []), At = p(() => {
|
|
1044
|
+
if (M) {
|
|
1045
|
+
b(!1);
|
|
1040
1046
|
return;
|
|
1041
1047
|
}
|
|
1042
|
-
r && (
|
|
1043
|
-
}, [r,
|
|
1044
|
-
|
|
1045
|
-
}, []),
|
|
1046
|
-
if (!(!r || !(
|
|
1047
|
-
|
|
1048
|
+
r && (_("options"), de(""), ge(null), K(""), Me(!1), ee(!1), Te([]), ie(!1), Ie(""), b(!0));
|
|
1049
|
+
}, [r, n, M]), $t = p(() => {
|
|
1050
|
+
b(!1);
|
|
1051
|
+
}, []), Ke = p(async () => {
|
|
1052
|
+
if (!(!r || !(n != null && n.share))) {
|
|
1053
|
+
_("loading"), K("");
|
|
1048
1054
|
try {
|
|
1049
|
-
const s = await
|
|
1050
|
-
|
|
1055
|
+
const s = await n.share.share(r);
|
|
1056
|
+
de(s.url), ge(s.expiresAt), ee(!1), _("success");
|
|
1051
1057
|
} catch (s) {
|
|
1052
|
-
|
|
1058
|
+
K(s.message || "Failed to create share link"), _("error");
|
|
1053
1059
|
}
|
|
1054
1060
|
}
|
|
1055
|
-
}, [r,
|
|
1056
|
-
if (
|
|
1057
|
-
|
|
1061
|
+
}, [r, n]), ft = p(async () => {
|
|
1062
|
+
if (Ee)
|
|
1063
|
+
ze();
|
|
1058
1064
|
else {
|
|
1059
|
-
|
|
1065
|
+
_("loading");
|
|
1060
1066
|
try {
|
|
1061
|
-
await
|
|
1067
|
+
await n.share.openAuthPopup(), ze();
|
|
1062
1068
|
} catch (s) {
|
|
1063
|
-
s.message === "Authentication cancelled" ?
|
|
1069
|
+
s.message === "Authentication cancelled" ? _("options") : (K(s.message || "Authentication failed"), _("error"));
|
|
1064
1070
|
}
|
|
1065
1071
|
}
|
|
1066
|
-
}, [
|
|
1067
|
-
if (!(!r || !(
|
|
1068
|
-
|
|
1072
|
+
}, [Ee, n]), ze = p(async () => {
|
|
1073
|
+
if (!(!r || !(n != null && n.share))) {
|
|
1074
|
+
_("loading"), K("");
|
|
1069
1075
|
try {
|
|
1070
|
-
const s = await
|
|
1071
|
-
|
|
1076
|
+
const s = await n.share.save(r);
|
|
1077
|
+
de(s.url), ge(null), ee(!0), _("success");
|
|
1072
1078
|
} catch (s) {
|
|
1073
|
-
|
|
1079
|
+
K(s.message || "Failed to save artifact"), _("error");
|
|
1074
1080
|
}
|
|
1075
1081
|
}
|
|
1076
|
-
}, [r,
|
|
1077
|
-
|
|
1078
|
-
}, [
|
|
1079
|
-
if (
|
|
1080
|
-
if (!
|
|
1081
|
-
|
|
1082
|
+
}, [r, n]), Ht = p(() => {
|
|
1083
|
+
Ne ? ze() : Ke();
|
|
1084
|
+
}, [Ne, ze, Ke]), It = p(async () => {
|
|
1085
|
+
if (n != null && n.share) {
|
|
1086
|
+
if (!Ee) {
|
|
1087
|
+
_("loading");
|
|
1082
1088
|
try {
|
|
1083
|
-
await
|
|
1089
|
+
await n.share.openAuthPopup();
|
|
1084
1090
|
} catch (s) {
|
|
1085
|
-
s.message === "Authentication cancelled" ?
|
|
1091
|
+
s.message === "Authentication cancelled" ? _("options") : (K(s.message || "Authentication failed"), _("error"));
|
|
1086
1092
|
return;
|
|
1087
1093
|
}
|
|
1088
1094
|
}
|
|
1089
|
-
|
|
1095
|
+
_("update-list"), ie(!0);
|
|
1090
1096
|
try {
|
|
1091
|
-
const s = (r == null ? void 0 : r.language) || null,
|
|
1092
|
-
|
|
1097
|
+
const s = (r == null ? void 0 : r.language) || null, y = await n.share.listArtifacts(s);
|
|
1098
|
+
Te(y.projects || []);
|
|
1093
1099
|
} catch (s) {
|
|
1094
|
-
|
|
1100
|
+
K(s.message || "Failed to load artifacts"), _("error");
|
|
1095
1101
|
} finally {
|
|
1096
|
-
|
|
1102
|
+
ie(!1);
|
|
1097
1103
|
}
|
|
1098
1104
|
}
|
|
1099
|
-
}, [r,
|
|
1100
|
-
var
|
|
1101
|
-
if (!r || !(
|
|
1102
|
-
const
|
|
1103
|
-
if (
|
|
1104
|
-
|
|
1105
|
+
}, [r, n, Ee]), Bt = p(async (s) => {
|
|
1106
|
+
var B, V;
|
|
1107
|
+
if (!r || !(n != null && n.share)) return;
|
|
1108
|
+
const y = (B = s.project) == null ? void 0 : B.uuid;
|
|
1109
|
+
if (y) {
|
|
1110
|
+
_("loading"), K("");
|
|
1105
1111
|
try {
|
|
1106
|
-
const X = await
|
|
1107
|
-
|
|
1112
|
+
const X = await n.share.updateArtifact(y, r);
|
|
1113
|
+
de(X.url || ""), ge(null), ee(!0), Ie(((V = s.project) == null ? void 0 : V.name) || "Untitled"), _("success");
|
|
1108
1114
|
} catch (X) {
|
|
1109
|
-
|
|
1115
|
+
K(X.message || "Failed to update artifact"), _("error");
|
|
1110
1116
|
}
|
|
1111
1117
|
}
|
|
1112
|
-
}, [r,
|
|
1113
|
-
if (
|
|
1118
|
+
}, [r, n]), Vt = p(async () => {
|
|
1119
|
+
if (G)
|
|
1114
1120
|
try {
|
|
1115
|
-
await navigator.clipboard.writeText(
|
|
1121
|
+
await navigator.clipboard.writeText(G), Me(!0), setTimeout(() => Me(!1), 2e3);
|
|
1116
1122
|
} catch (s) {
|
|
1117
1123
|
console.error("Failed to copy link:", s);
|
|
1118
1124
|
}
|
|
1119
|
-
}, [
|
|
1125
|
+
}, [G]);
|
|
1120
1126
|
p((s) => {
|
|
1121
|
-
|
|
1122
|
-
}, [
|
|
1123
|
-
|
|
1124
|
-
}, [
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1127
|
-
}, [
|
|
1128
|
-
|
|
1129
|
-
}, [
|
|
1130
|
-
|
|
1131
|
-
}, [
|
|
1132
|
-
|
|
1127
|
+
k(s);
|
|
1128
|
+
}, [k]), p((s) => {
|
|
1129
|
+
n.closeTab(s), i.openTabs.length === 0 && ce(!1);
|
|
1130
|
+
}, [n, i.openTabs]);
|
|
1131
|
+
const Ft = p(() => {
|
|
1132
|
+
d > 0 && k(q[d - 1]);
|
|
1133
|
+
}, [d, k, q]), Wt = p(() => {
|
|
1134
|
+
d < q.length - 1 && k(q[d + 1]);
|
|
1135
|
+
}, [d, k, q]), pt = p((s) => {
|
|
1136
|
+
ce(!0), k(s), oe(!1);
|
|
1137
|
+
}, [k]), Ye = p((s) => {
|
|
1138
|
+
ye.current = {
|
|
1133
1139
|
startX: s.clientX,
|
|
1134
|
-
startWidth:
|
|
1135
|
-
}, document.addEventListener("mousemove",
|
|
1136
|
-
|
|
1140
|
+
startWidth: fe
|
|
1141
|
+
}, document.addEventListener("mousemove", Qe), document.addEventListener("mouseup", Re), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((y) => {
|
|
1142
|
+
y.style.pointerEvents = "none";
|
|
1137
1143
|
});
|
|
1138
|
-
}, [
|
|
1139
|
-
if (!
|
|
1140
|
-
const
|
|
1141
|
-
|
|
1142
|
-
}, []),
|
|
1143
|
-
|
|
1144
|
+
}, [fe]), Qe = p((s) => {
|
|
1145
|
+
if (!ye.current) return;
|
|
1146
|
+
const y = window.innerWidth, V = (ye.current.startX - s.clientX) / y * 100, X = ye.current.startWidth + V;
|
|
1147
|
+
Be(Math.min(Math.max(X, 25), 75));
|
|
1148
|
+
}, []), Re = p(() => {
|
|
1149
|
+
ye.current = null, document.removeEventListener("mousemove", Qe), document.removeEventListener("mouseup", Re), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((s) => {
|
|
1144
1150
|
s.style.pointerEvents = "";
|
|
1145
1151
|
});
|
|
1146
|
-
}, [
|
|
1147
|
-
if (!
|
|
1148
|
-
const
|
|
1149
|
-
|
|
1152
|
+
}, [Qe]), zt = p((s) => {
|
|
1153
|
+
if (!ae.current) return;
|
|
1154
|
+
const y = ae.current.getBoundingClientRect();
|
|
1155
|
+
_e.current = {
|
|
1150
1156
|
startX: s.clientX,
|
|
1151
|
-
startPosition:
|
|
1152
|
-
contentLeft:
|
|
1153
|
-
contentWidth:
|
|
1154
|
-
}, document.addEventListener("mousemove",
|
|
1155
|
-
|
|
1157
|
+
startPosition: we,
|
|
1158
|
+
contentLeft: y.left,
|
|
1159
|
+
contentWidth: y.width
|
|
1160
|
+
}, document.addEventListener("mousemove", Ge), document.addEventListener("mouseup", qe), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((B) => {
|
|
1161
|
+
B.style.pointerEvents = "none";
|
|
1156
1162
|
});
|
|
1157
|
-
}, [
|
|
1158
|
-
if (!
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1161
|
-
}, []),
|
|
1162
|
-
|
|
1163
|
+
}, [we]), Ge = p((s) => {
|
|
1164
|
+
if (!_e.current) return;
|
|
1165
|
+
const B = (s.clientX - _e.current.contentLeft) / _e.current.contentWidth * 100;
|
|
1166
|
+
Ve(Math.min(Math.max(B, 20), 80));
|
|
1167
|
+
}, []), qe = p(() => {
|
|
1168
|
+
_e.current = null, document.removeEventListener("mousemove", Ge), document.removeEventListener("mouseup", qe), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((s) => {
|
|
1163
1169
|
s.style.pointerEvents = "";
|
|
1164
1170
|
});
|
|
1165
|
-
}, [
|
|
1166
|
-
if (
|
|
1167
|
-
r && (
|
|
1168
|
-
}, [r == null ? void 0 : r.id,
|
|
1169
|
-
(i.viewMode === "code" || i.viewMode === "split") &&
|
|
1170
|
-
}, [i.viewMode,
|
|
1171
|
-
t &&
|
|
1172
|
-
}), [
|
|
1173
|
-
|
|
1174
|
-
}, [
|
|
1175
|
-
const
|
|
1171
|
+
}, [Ge]);
|
|
1172
|
+
if (D(() => {
|
|
1173
|
+
r && (v.current && v.current.isPreviewable !== r.isPreviewable && (ue(!0), setTimeout(() => ue(!1), 150)), v.current = r, mt(), le(!0), Mt(), Xe());
|
|
1174
|
+
}, [r == null ? void 0 : r.id, mt]), D(() => {
|
|
1175
|
+
(i.viewMode === "code" || i.viewMode === "split") && Xe(), i.viewMode === "edit" && ut();
|
|
1176
|
+
}, [i.viewMode, Xe, ut]), D(() => (t && n.on("ai:request", t), a && n.on("save:request", a), c && n.on("export:complete", c), () => {
|
|
1177
|
+
t && n.off("ai:request", t), a && n.off("save:request", a), c && n.off("export:complete", c);
|
|
1178
|
+
}), [n, t, a, c]), D(() => () => {
|
|
1179
|
+
Re(), qe(), S.current && (S.current.destroy(), S.current = null), clearTimeout(Je.current), clearTimeout(pe.current);
|
|
1180
|
+
}, [Re, qe]), !i.isPanelOpen) return null;
|
|
1181
|
+
const et = [
|
|
1176
1182
|
"artifactuse-panel",
|
|
1177
1183
|
i.isFullscreen && "artifactuse-panel--fullscreen",
|
|
1178
|
-
!r &&
|
|
1179
|
-
!
|
|
1180
|
-
|
|
1181
|
-
].filter(Boolean).join(" "),
|
|
1184
|
+
!r && x && !i.forceEmptyView && "artifactuse-panel--list",
|
|
1185
|
+
!x && !i.forceEmptyView && "artifactuse-panel--empty",
|
|
1186
|
+
l
|
|
1187
|
+
].filter(Boolean).join(" "), Rt = [
|
|
1182
1188
|
"artifactuse-panel__content",
|
|
1183
1189
|
`artifactuse-panel__content--${i.viewMode}`,
|
|
1184
|
-
|
|
1190
|
+
ve && "artifactuse-panel__content--transitioning"
|
|
1185
1191
|
].filter(Boolean).join(" ");
|
|
1186
|
-
return !
|
|
1192
|
+
return !x || i.forceEmptyView ? /* @__PURE__ */ e.createElement("div", { className: et, style: i.isFullscreen ? void 0 : { width: `${lt}%` } }, !i.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: Ye }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle-line" })), /* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header artifactuse-panel__header--simple" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__icon" }, i.forceEmptyView ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "14 2 14 8 20 8" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "16 18 22 12 16 6" }), /* @__PURE__ */ e.createElement("polyline", { points: "8 6 2 12 8 18" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, i.forceEmptyView ? "Artifact Viewer" : "Artifacts"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
|
|
1187
1193
|
"button",
|
|
1188
1194
|
{
|
|
1189
1195
|
className: "artifactuse-panel__action artifactuse-panel__action--close",
|
|
1190
1196
|
title: "Close panel",
|
|
1191
|
-
onClick:
|
|
1197
|
+
onClick: T
|
|
1192
1198
|
},
|
|
1193
1199
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))
|
|
1194
|
-
))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__empty" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__empty-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }, /* @__PURE__ */ e.createElement("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "14 2 14 8 20 8" }))), /* @__PURE__ */ e.createElement("h3", { className: "artifactuse-panel__empty-title" }, i.forceEmptyView ? "No artifact selected" : "No artifacts yet"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-panel__empty-text" }, i.forceEmptyView ? "Open an artifact to have it appear here" : "Code blocks, forms, and other interactive content will appear here as the AI generates them.")), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" },
|
|
1200
|
+
))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__empty" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__empty-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }, /* @__PURE__ */ e.createElement("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "14 2 14 8 20 8" }))), /* @__PURE__ */ e.createElement("h3", { className: "artifactuse-panel__empty-title" }, i.forceEmptyView ? "No artifact selected" : "No artifacts yet"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-panel__empty-text" }, i.forceEmptyView ? "Open an artifact to have it appear here" : "Code blocks, forms, and other interactive content will appear here as the AI generates them.")), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, I && /* @__PURE__ */ e.createElement(
|
|
1195
1201
|
"a",
|
|
1196
1202
|
{
|
|
1197
1203
|
href: "https://artifactuse.com",
|
|
@@ -1204,38 +1210,38 @@ function ga({
|
|
|
1204
1210
|
))) : r ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
1205
1211
|
"div",
|
|
1206
1212
|
{
|
|
1207
|
-
className:
|
|
1208
|
-
style: i.isFullscreen ? void 0 : { width: `${
|
|
1213
|
+
className: et,
|
|
1214
|
+
style: i.isFullscreen ? void 0 : { width: `${fe}%` }
|
|
1209
1215
|
},
|
|
1210
1216
|
!i.isFullscreen && /* @__PURE__ */ e.createElement(
|
|
1211
1217
|
"div",
|
|
1212
1218
|
{
|
|
1213
1219
|
className: "artifactuse-panel__resize-handle",
|
|
1214
|
-
onMouseDown:
|
|
1220
|
+
onMouseDown: Ye
|
|
1215
1221
|
},
|
|
1216
1222
|
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle-line" })
|
|
1217
1223
|
),
|
|
1218
|
-
/* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, (
|
|
1224
|
+
/* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, (Fe || he) && /* @__PURE__ */ e.createElement(
|
|
1219
1225
|
"button",
|
|
1220
1226
|
{
|
|
1221
1227
|
className: "artifactuse-panel__back",
|
|
1222
|
-
title:
|
|
1223
|
-
onClick:
|
|
1228
|
+
title: Fe ? "Browse artifacts" : "Back to list",
|
|
1229
|
+
onClick: Nt
|
|
1224
1230
|
},
|
|
1225
1231
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "15 18 9 12 15 6" }))
|
|
1226
1232
|
), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title" }, /* @__PURE__ */ e.createElement(
|
|
1227
1233
|
"span",
|
|
1228
1234
|
{
|
|
1229
1235
|
className: "artifactuse-panel__icon",
|
|
1230
|
-
dangerouslySetInnerHTML: { __html: `<svg viewBox="0 0 24 24" fill="currentColor">${
|
|
1236
|
+
dangerouslySetInnerHTML: { __html: `<svg viewBox="0 0 24 24" fill="currentColor">${ke}</svg>` }
|
|
1231
1237
|
}
|
|
1232
|
-
), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, r.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__meta" },
|
|
1238
|
+
), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, r.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__meta" }, se, r.lineCount && ` • ${r.lineCount} lines`))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__tabs" }, (!r.tabs || r.tabs.includes("preview")) && /* @__PURE__ */ e.createElement(
|
|
1233
1239
|
"button",
|
|
1234
1240
|
{
|
|
1235
1241
|
className: `artifactuse-panel__tab ${i.viewMode === "preview" ? "artifactuse-panel__tab--active" : ""}`,
|
|
1236
1242
|
disabled: !r.isPreviewable,
|
|
1237
1243
|
title: "Preview",
|
|
1238
|
-
onClick: () =>
|
|
1244
|
+
onClick: () => $("preview")
|
|
1239
1245
|
},
|
|
1240
1246
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }), /* @__PURE__ */ e.createElement("circle", { cx: "12", cy: "12", r: "3" }))
|
|
1241
1247
|
), (!r.tabs || r.tabs.includes("code")) && /* @__PURE__ */ e.createElement(
|
|
@@ -1243,7 +1249,7 @@ function ga({
|
|
|
1243
1249
|
{
|
|
1244
1250
|
className: `artifactuse-panel__tab ${i.viewMode === "code" ? "artifactuse-panel__tab--active" : ""}`,
|
|
1245
1251
|
title: "Code",
|
|
1246
|
-
onClick: () =>
|
|
1252
|
+
onClick: () => $("code")
|
|
1247
1253
|
},
|
|
1248
1254
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "16 18 22 12 16 6" }), /* @__PURE__ */ e.createElement("polyline", { points: "8 6 2 12 8 18" }))
|
|
1249
1255
|
), (!r.tabs || r.tabs.includes("split")) && /* @__PURE__ */ e.createElement(
|
|
@@ -1252,15 +1258,15 @@ function ga({
|
|
|
1252
1258
|
className: `artifactuse-panel__tab ${i.viewMode === "split" ? "artifactuse-panel__tab--active" : ""}`,
|
|
1253
1259
|
disabled: !r.isPreviewable,
|
|
1254
1260
|
title: "Split view",
|
|
1255
|
-
onClick: () =>
|
|
1261
|
+
onClick: () => $("split")
|
|
1256
1262
|
},
|
|
1257
1263
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "3", x2: "12", y2: "21" }))
|
|
1258
|
-
), r.tabs && r.tabs.includes("edit") &&
|
|
1264
|
+
), r.tabs && r.tabs.includes("edit") && Ze && /* @__PURE__ */ e.createElement(
|
|
1259
1265
|
"button",
|
|
1260
1266
|
{
|
|
1261
1267
|
className: `artifactuse-panel__tab ${i.viewMode === "edit" ? "artifactuse-panel__tab--active" : ""}`,
|
|
1262
1268
|
title: "Edit",
|
|
1263
|
-
onClick: () =>
|
|
1269
|
+
onClick: () => $("edit")
|
|
1264
1270
|
},
|
|
1265
1271
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), /* @__PURE__ */ e.createElement("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" }))
|
|
1266
1272
|
)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, i.viewMode === "edit" && /* @__PURE__ */ e.createElement(
|
|
@@ -1268,15 +1274,23 @@ function ga({
|
|
|
1268
1274
|
{
|
|
1269
1275
|
className: "artifactuse-panel__action artifactuse-panel__action--save",
|
|
1270
1276
|
title: "Save",
|
|
1271
|
-
onClick:
|
|
1277
|
+
onClick: kt
|
|
1272
1278
|
},
|
|
1273
1279
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "17 21 17 13 7 13 7 21" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 3 7 8 15 8" }))
|
|
1280
|
+
), U && /* @__PURE__ */ e.createElement(
|
|
1281
|
+
"button",
|
|
1282
|
+
{
|
|
1283
|
+
className: "artifactuse-panel__action",
|
|
1284
|
+
title: "Open in new tab",
|
|
1285
|
+
onClick: xt
|
|
1286
|
+
},
|
|
1287
|
+
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }), /* @__PURE__ */ e.createElement("polyline", { points: "15 3 21 3 21 9" }), /* @__PURE__ */ e.createElement("line", { x1: "10", y1: "14", x2: "21", y2: "3" }))
|
|
1274
1288
|
), /* @__PURE__ */ e.createElement(
|
|
1275
1289
|
"button",
|
|
1276
1290
|
{
|
|
1277
1291
|
className: "artifactuse-panel__action",
|
|
1278
1292
|
title: i.isFullscreen ? "Exit fullscreen" : "Fullscreen",
|
|
1279
|
-
onClick:
|
|
1293
|
+
onClick: A
|
|
1280
1294
|
},
|
|
1281
1295
|
i.isFullscreen ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "4 14 10 14 10 20" }), /* @__PURE__ */ e.createElement("polyline", { points: "20 10 14 10 14 4" }), /* @__PURE__ */ e.createElement("line", { x1: "14", y1: "10", x2: "21", y2: "3" }), /* @__PURE__ */ e.createElement("line", { x1: "3", y1: "21", x2: "10", y2: "14" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "15 3 21 3 21 9" }), /* @__PURE__ */ e.createElement("polyline", { points: "9 21 3 21 3 15" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "3", x2: "14", y2: "10" }), /* @__PURE__ */ e.createElement("line", { x1: "3", y1: "21", x2: "10", y2: "14" }))
|
|
1282
1296
|
), /* @__PURE__ */ e.createElement(
|
|
@@ -1284,35 +1298,35 @@ function ga({
|
|
|
1284
1298
|
{
|
|
1285
1299
|
className: "artifactuse-panel__action artifactuse-panel__action--close",
|
|
1286
1300
|
title: "Close",
|
|
1287
|
-
onClick:
|
|
1301
|
+
onClick: T
|
|
1288
1302
|
},
|
|
1289
1303
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))
|
|
1290
1304
|
))),
|
|
1291
|
-
/* @__PURE__ */ e.createElement("div", { className:
|
|
1305
|
+
/* @__PURE__ */ e.createElement("div", { className: Rt, ref: ae }, ve && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })), (i.viewMode === "preview" || i.viewMode === "split") && /* @__PURE__ */ e.createElement(
|
|
1292
1306
|
"div",
|
|
1293
1307
|
{
|
|
1294
1308
|
className: "artifactuse-panel__preview",
|
|
1295
|
-
style: i.viewMode === "split" ? { width: `${
|
|
1309
|
+
style: i.viewMode === "split" ? { width: `${we}%` } : void 0
|
|
1296
1310
|
},
|
|
1297
|
-
|
|
1298
|
-
|
|
1311
|
+
me && J && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })),
|
|
1312
|
+
J ? /* @__PURE__ */ e.createElement(
|
|
1299
1313
|
"iframe",
|
|
1300
1314
|
{
|
|
1301
|
-
ref:
|
|
1302
|
-
src:
|
|
1303
|
-
className: `artifactuse-panel__iframe ${
|
|
1315
|
+
ref: g,
|
|
1316
|
+
src: J,
|
|
1317
|
+
className: `artifactuse-panel__iframe ${me ? "artifactuse-panel__iframe--loading" : ""}`,
|
|
1304
1318
|
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads allow-top-navigation-by-user-activation",
|
|
1305
|
-
allow: "camera; microphone; fullscreen; geolocation; display-capture; autoplay; clipboard-write",
|
|
1306
|
-
onLoad:
|
|
1307
|
-
onError:
|
|
1319
|
+
allow: "camera; microphone; fullscreen; geolocation; display-capture; autoplay; clipboard-write; encrypted-media; gyroscope; accelerometer; picture-in-picture",
|
|
1320
|
+
onLoad: Ct,
|
|
1321
|
+
onError: Lt
|
|
1308
1322
|
}
|
|
1309
|
-
) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__no-preview" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }, /* @__PURE__ */ e.createElement("path", { d: "M9 17H7A5 5 0 0 1 7 7h2" }), /* @__PURE__ */ e.createElement("path", { d: "M15 7h2a5 5 0 1 1 0 10h-2" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "12", x2: "16", y2: "12" })), /* @__PURE__ */ e.createElement("p", null, "Preview not available for ",
|
|
1323
|
+
) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__no-preview" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }, /* @__PURE__ */ e.createElement("path", { d: "M9 17H7A5 5 0 0 1 7 7h2" }), /* @__PURE__ */ e.createElement("path", { d: "M15 7h2a5 5 0 1 1 0 10h-2" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "12", x2: "16", y2: "12" })), /* @__PURE__ */ e.createElement("p", null, "Preview not available for ", se))
|
|
1310
1324
|
), /* @__PURE__ */ e.createElement(
|
|
1311
1325
|
"div",
|
|
1312
1326
|
{
|
|
1313
1327
|
className: "artifactuse-panel__code",
|
|
1314
1328
|
style: {
|
|
1315
|
-
...i.viewMode === "split" ? { width: `${100 -
|
|
1329
|
+
...i.viewMode === "split" ? { width: `${100 - we}%` } : {},
|
|
1316
1330
|
display: i.viewMode === "code" || i.viewMode === "split" ? void 0 : "none"
|
|
1317
1331
|
}
|
|
1318
1332
|
},
|
|
@@ -1320,15 +1334,15 @@ function ga({
|
|
|
1320
1334
|
"div",
|
|
1321
1335
|
{
|
|
1322
1336
|
className: "artifactuse-panel__split-handle",
|
|
1323
|
-
onMouseDown:
|
|
1337
|
+
onMouseDown: zt
|
|
1324
1338
|
},
|
|
1325
1339
|
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__split-handle-line" })
|
|
1326
1340
|
),
|
|
1327
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__code-scroll", ref:
|
|
1341
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__code-scroll", ref: R }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__line-numbers", ref: P }), /* @__PURE__ */ e.createElement("pre", { className: `artifactuse-panel__code-block language-${C}` }, /* @__PURE__ */ e.createElement(
|
|
1328
1342
|
"code",
|
|
1329
1343
|
{
|
|
1330
|
-
ref:
|
|
1331
|
-
className: `language-${
|
|
1344
|
+
ref: F,
|
|
1345
|
+
className: `language-${C}`
|
|
1332
1346
|
}
|
|
1333
1347
|
)))
|
|
1334
1348
|
), /* @__PURE__ */ e.createElement(
|
|
@@ -1337,9 +1351,9 @@ function ga({
|
|
|
1337
1351
|
className: "artifactuse-panel__edit",
|
|
1338
1352
|
style: { display: i.viewMode === "edit" ? void 0 : "none" }
|
|
1339
1353
|
},
|
|
1340
|
-
/* @__PURE__ */ e.createElement("div", { ref:
|
|
1354
|
+
/* @__PURE__ */ e.createElement("div", { ref: ne, className: "artifactuse-panel__editor-container" })
|
|
1341
1355
|
)),
|
|
1342
|
-
/* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-left" },
|
|
1356
|
+
/* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-left" }, I && /* @__PURE__ */ e.createElement(
|
|
1343
1357
|
"a",
|
|
1344
1358
|
{
|
|
1345
1359
|
href: "https://artifactuse.com",
|
|
@@ -1350,142 +1364,142 @@ function ga({
|
|
|
1350
1364
|
},
|
|
1351
1365
|
/* @__PURE__ */ e.createElement("svg", { width: "16", height: "16", viewBox: "0 0 42 42", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement("path", { d: "M16.6667 41.6673V10.4173C16.6667 9.86478 16.4472 9.33488 16.0565 8.94418C15.6658 8.55348 15.1359 8.33398 14.5833 8.33398H4.16667C3.0616 8.33398 2.00179 8.77297 1.22039 9.55437C0.438987 10.3358 0 11.3956 0 12.5007V37.5006C0 38.6057 0.438987 39.6655 1.22039 40.4469C2.00179 41.2283 3.0616 41.6673 4.16667 41.6673H29.1667C30.2717 41.6673 31.3315 41.2283 32.1129 40.4469C32.8943 39.6655 33.3333 38.6057 33.3333 37.5006V27.084C33.3333 26.5314 33.1138 26.0015 32.7231 25.6108C32.3324 25.2201 31.8025 25.0007 31.25 25.0007H0", fill: "#5F51C8" }), /* @__PURE__ */ e.createElement("path", { d: "M39.5833 0H27.0833C25.9327 0 25 0.93274 25 2.08333V14.5833C25 15.7339 25.9327 16.6667 27.0833 16.6667H39.5833C40.7339 16.6667 41.6667 15.7339 41.6667 14.5833V2.08333C41.6667 0.93274 40.7339 0 39.5833 0Z", fill: "#695AE0" })),
|
|
1352
1366
|
/* @__PURE__ */ e.createElement("span", null, "Artifactuse")
|
|
1353
|
-
), r.code && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__badge artifactuse-panel__badge--secondary" },
|
|
1367
|
+
), r.code && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__badge artifactuse-panel__badge--secondary" }, yt(r.size))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-right" }, /* @__PURE__ */ e.createElement(
|
|
1354
1368
|
"button",
|
|
1355
1369
|
{
|
|
1356
|
-
className: `artifactuse-panel__footer-action ${
|
|
1357
|
-
title:
|
|
1358
|
-
onClick:
|
|
1370
|
+
className: `artifactuse-panel__footer-action ${Q ? "artifactuse-panel__footer-action--success" : ""}`,
|
|
1371
|
+
title: Q ? "Copied!" : "Copy code",
|
|
1372
|
+
onClick: Tt
|
|
1359
1373
|
},
|
|
1360
|
-
|
|
1374
|
+
Q ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "20 6 9 17 4 12" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), /* @__PURE__ */ e.createElement("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }))
|
|
1361
1375
|
), /* @__PURE__ */ e.createElement(
|
|
1362
1376
|
"button",
|
|
1363
1377
|
{
|
|
1364
1378
|
className: "artifactuse-panel__footer-action",
|
|
1365
1379
|
title: "Download",
|
|
1366
|
-
onClick:
|
|
1380
|
+
onClick: Pt
|
|
1367
1381
|
},
|
|
1368
1382
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 10 12 15 17 10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "15", x2: "12", y2: "3" }))
|
|
1369
|
-
),
|
|
1383
|
+
), Y && /* @__PURE__ */ e.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ e.createElement(
|
|
1370
1384
|
"button",
|
|
1371
1385
|
{
|
|
1372
1386
|
className: "artifactuse-panel__footer-action",
|
|
1373
1387
|
title: "Share",
|
|
1374
|
-
onClick:
|
|
1388
|
+
onClick: At
|
|
1375
1389
|
},
|
|
1376
1390
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "18", cy: "5", r: "3" }), /* @__PURE__ */ e.createElement("circle", { cx: "6", cy: "12", r: "3" }), /* @__PURE__ */ e.createElement("circle", { cx: "18", cy: "19", r: "3" }), /* @__PURE__ */ e.createElement("line", { x1: "8.59", y1: "13.51", x2: "15.42", y2: "17.49" }), /* @__PURE__ */ e.createElement("line", { x1: "15.41", y1: "6.51", x2: "8.59", y2: "10.49" }))
|
|
1377
|
-
),
|
|
1378
|
-
var
|
|
1391
|
+
), M && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__header" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__title" }, N === "success" ? Oe ? "Artifact updated!" : "Link created!" : N === "update-list" ? "Update saved artifact" : "Share Artifact"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__close", onClick: $t }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__body" }, N === "loading" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__spinner" }), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__loading-text" }, "Creating link...")), N === "error" && /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__error" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__error-text" }, Ae)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__actions" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--secondary", onClick: () => _("options") }, "Back"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--primary", onClick: Ht }, "Retry"))), N === "options" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__options" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: Ke }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ e.createElement("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Share link"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Expires in 30 days"))), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: ft }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "17 21 17 13 7 13 7 21" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 3 7 8 15 8" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Save to account"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Permanent, manageable"))), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: It }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "23 4 23 10 17 10" }), /* @__PURE__ */ e.createElement("polyline", { points: "1 20 1 14 7 14" }), /* @__PURE__ */ e.createElement("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Update saved"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Replace an existing artifact")))), N === "update-list" && /* @__PURE__ */ e.createElement("div", null, je ? /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__spinner" }), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__loading-text" }, "Loading artifacts...")) : He.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__empty" }, "No saved artifacts of this type") : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__artifact-list" }, He.map((s) => {
|
|
1392
|
+
var y, B, V;
|
|
1379
1393
|
return /* @__PURE__ */ e.createElement(
|
|
1380
1394
|
"button",
|
|
1381
1395
|
{
|
|
1382
|
-
key: ((
|
|
1396
|
+
key: ((y = s.project) == null ? void 0 : y.uuid) || s.id,
|
|
1383
1397
|
className: "artifactuse-share-popup__artifact-item",
|
|
1384
|
-
onClick: () =>
|
|
1398
|
+
onClick: () => Bt(s)
|
|
1385
1399
|
},
|
|
1386
|
-
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-name" }, ((
|
|
1387
|
-
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-date" },
|
|
1400
|
+
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-name" }, ((B = s.project) == null ? void 0 : B.name) || "Untitled"),
|
|
1401
|
+
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-date" }, dt((V = s.project) == null ? void 0 : V.created_at))
|
|
1388
1402
|
);
|
|
1389
|
-
})), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__back-btn", onClick: () =>
|
|
1403
|
+
})), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__back-btn", onClick: () => _("options") }, "Back")), N === "success" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__success" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__success-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "20 6 9 17 4 12" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__link-wrapper" }, /* @__PURE__ */ e.createElement(
|
|
1390
1404
|
"input",
|
|
1391
1405
|
{
|
|
1392
1406
|
type: "text",
|
|
1393
1407
|
className: "artifactuse-share-popup__link",
|
|
1394
|
-
value:
|
|
1408
|
+
value: G,
|
|
1395
1409
|
readOnly: !0,
|
|
1396
1410
|
onClick: (s) => s.target.select()
|
|
1397
1411
|
}
|
|
1398
1412
|
), /* @__PURE__ */ e.createElement(
|
|
1399
1413
|
"button",
|
|
1400
1414
|
{
|
|
1401
|
-
className: `artifactuse-share-popup__copy-btn ${
|
|
1402
|
-
onClick:
|
|
1415
|
+
className: `artifactuse-share-popup__copy-btn ${$e ? "artifactuse-share-popup__copy-btn--copied" : ""}`,
|
|
1416
|
+
onClick: Vt
|
|
1403
1417
|
},
|
|
1404
|
-
|
|
1405
|
-
)),
|
|
1418
|
+
$e ? "Copied!" : "Copy"
|
|
1419
|
+
)), Se && !Ne && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__expiry" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__expiry-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "12", cy: "12", r: "10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "8", x2: "12", y2: "12" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__expiry-text" }, "Expires ", dt(Se))), !Ne && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__save-prompt" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__save-prompt-text" }, "Keep it permanently?"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__save-prompt-btn", onClick: ft }, "Save to account")))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__footer" }, /* @__PURE__ */ e.createElement("a", { href: "https://artifactuse.com", target: "_blank", rel: "noopener noreferrer", className: "artifactuse-share-popup__branding" }, /* @__PURE__ */ e.createElement("svg", { width: "12", height: "12", viewBox: "0 0 42 42", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement("path", { d: "M16.6667 41.6673V10.4173C16.6667 9.86478 16.4472 9.33488 16.0565 8.94418C15.6658 8.55348 15.1359 8.33398 14.5833 8.33398H4.16667C3.0616 8.33398 2.00179 8.77297 1.22039 9.55437C0.438987 10.3358 0 11.3956 0 12.5007V37.5006C0 38.6057 0.438987 39.6655 1.22039 40.4469C2.00179 41.2283 3.0616 41.6673 4.16667 41.6673H29.1667C30.2717 41.6673 31.3315 41.2283 32.1129 40.4469C32.8943 39.6655 33.3333 38.6057 33.3333 37.5006V27.084C33.3333 26.5314 33.1138 26.0015 32.7231 25.6108C32.3324 25.2201 31.8025 25.0007 31.25 25.0007H0", fill: "#5F51C8" }), /* @__PURE__ */ e.createElement("path", { d: "M39.5833 0H27.0833C25.9327 0 25 0.93274 25 2.08333V14.5833C25 15.7339 25.9327 16.6667 27.0833 16.6667H39.5833C40.7339 16.6667 41.6667 15.7339 41.6667 14.5833V2.08333C41.6667 0.93274 40.7339 0 39.5833 0Z", fill: "#695AE0" })), /* @__PURE__ */ e.createElement("span", null, "Powered by Artifactuse"))))), q.length > 1 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__nav" }, /* @__PURE__ */ e.createElement(
|
|
1406
1420
|
"button",
|
|
1407
1421
|
{
|
|
1408
1422
|
className: "artifactuse-panel__nav-btn",
|
|
1409
|
-
disabled:
|
|
1423
|
+
disabled: d <= 0,
|
|
1410
1424
|
title: "Previous artifact",
|
|
1411
|
-
onClick:
|
|
1425
|
+
onClick: Ft
|
|
1412
1426
|
},
|
|
1413
1427
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "15 18 9 12 15 6" }))
|
|
1414
1428
|
), /* @__PURE__ */ e.createElement(
|
|
1415
1429
|
"button",
|
|
1416
1430
|
{
|
|
1417
1431
|
className: "artifactuse-panel__nav-trigger",
|
|
1418
|
-
onClick: () =>
|
|
1432
|
+
onClick: () => oe(!O)
|
|
1419
1433
|
},
|
|
1420
|
-
/* @__PURE__ */ e.createElement("span", null,
|
|
1434
|
+
/* @__PURE__ */ e.createElement("span", null, d + 1, " / ", q.length),
|
|
1421
1435
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "6 9 12 15 18 9" }))
|
|
1422
1436
|
), /* @__PURE__ */ e.createElement(
|
|
1423
1437
|
"button",
|
|
1424
1438
|
{
|
|
1425
1439
|
className: "artifactuse-panel__nav-btn",
|
|
1426
|
-
disabled:
|
|
1440
|
+
disabled: d >= q.length - 1,
|
|
1427
1441
|
title: "Next artifact",
|
|
1428
|
-
onClick:
|
|
1442
|
+
onClick: Wt
|
|
1429
1443
|
},
|
|
1430
1444
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "9 18 15 12 9 6" }))
|
|
1431
|
-
),
|
|
1445
|
+
), O && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-header" }, /* @__PURE__ */ e.createElement("span", null, "All Artifacts (", q.length, ")"), /* @__PURE__ */ e.createElement(
|
|
1432
1446
|
"button",
|
|
1433
1447
|
{
|
|
1434
1448
|
className: "artifactuse-panel__artifact-list-close",
|
|
1435
|
-
onClick: () =>
|
|
1449
|
+
onClick: () => oe(!1)
|
|
1436
1450
|
},
|
|
1437
1451
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))
|
|
1438
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-items" },
|
|
1452
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-items" }, q.map((s, y) => /* @__PURE__ */ e.createElement(
|
|
1439
1453
|
"button",
|
|
1440
1454
|
{
|
|
1441
1455
|
key: s.id,
|
|
1442
1456
|
className: `artifactuse-panel__artifact-item ${s.id === r.id ? "artifactuse-panel__artifact-item--active" : ""}`,
|
|
1443
|
-
onClick: () =>
|
|
1457
|
+
onClick: () => pt(s)
|
|
1444
1458
|
},
|
|
1445
1459
|
/* @__PURE__ */ e.createElement(
|
|
1446
1460
|
"span",
|
|
1447
1461
|
{
|
|
1448
1462
|
className: "artifactuse-panel__artifact-item-icon",
|
|
1449
|
-
dangerouslySetInnerHTML: { __html:
|
|
1463
|
+
dangerouslySetInnerHTML: { __html: ct(s.language) }
|
|
1450
1464
|
}
|
|
1451
1465
|
),
|
|
1452
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-title" }, s.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-meta" },
|
|
1453
|
-
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-index" },
|
|
1466
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-title" }, s.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-meta" }, De(s.language), s.lineCount && ` • ${s.lineCount} lines`)),
|
|
1467
|
+
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-index" }, y + 1)
|
|
1454
1468
|
)))))))
|
|
1455
|
-
)) : /* @__PURE__ */ e.createElement("div", { className:
|
|
1469
|
+
)) : /* @__PURE__ */ e.createElement("div", { className: et, style: i.isFullscreen ? void 0 : { width: `${lt}%` } }, !i.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: Ye }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle-line" })), /* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header artifactuse-panel__header--simple" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "16 18 22 12 16 6" }), /* @__PURE__ */ e.createElement("polyline", { points: "8 6 2 12 8 18" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, "Artifacts"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__meta" }, q.length, " available"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
|
|
1456
1470
|
"button",
|
|
1457
1471
|
{
|
|
1458
|
-
className: `artifactuse-panel__action ${
|
|
1459
|
-
disabled:
|
|
1472
|
+
className: `artifactuse-panel__action ${re ? "artifactuse-panel__action--loading" : ""}`,
|
|
1473
|
+
disabled: re,
|
|
1460
1474
|
title: "Download all as ZIP",
|
|
1461
|
-
onClick:
|
|
1475
|
+
onClick: St
|
|
1462
1476
|
},
|
|
1463
|
-
|
|
1477
|
+
re ? /* @__PURE__ */ e.createElement("svg", { className: "artifactuse-panel__spinner-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "12", cy: "12", r: "10", strokeDasharray: "32", strokeDashoffset: "32" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 10 12 15 17 10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "15", x2: "12", y2: "3" }))
|
|
1464
1478
|
), /* @__PURE__ */ e.createElement(
|
|
1465
1479
|
"button",
|
|
1466
1480
|
{
|
|
1467
1481
|
className: "artifactuse-panel__action artifactuse-panel__action--close",
|
|
1468
1482
|
title: "Close panel",
|
|
1469
|
-
onClick:
|
|
1483
|
+
onClick: T
|
|
1470
1484
|
},
|
|
1471
1485
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))
|
|
1472
|
-
))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-items" },
|
|
1486
|
+
))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-items" }, q.map((s, y) => /* @__PURE__ */ e.createElement(
|
|
1473
1487
|
"button",
|
|
1474
1488
|
{
|
|
1475
1489
|
key: s.id,
|
|
1476
1490
|
className: "artifactuse-panel__list-item",
|
|
1477
|
-
onClick: () =>
|
|
1491
|
+
onClick: () => pt(s)
|
|
1478
1492
|
},
|
|
1479
1493
|
/* @__PURE__ */ e.createElement(
|
|
1480
1494
|
"span",
|
|
1481
1495
|
{
|
|
1482
1496
|
className: "artifactuse-panel__list-item-icon",
|
|
1483
|
-
dangerouslySetInnerHTML: { __html:
|
|
1497
|
+
dangerouslySetInnerHTML: { __html: ct(s.language) }
|
|
1484
1498
|
}
|
|
1485
1499
|
),
|
|
1486
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-title" }, s.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-meta" },
|
|
1500
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-title" }, s.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-meta" }, De(s.language), s.lineCount && ` • ${s.lineCount} lines`)),
|
|
1487
1501
|
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-arrow" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "9 18 15 12 9 6" })))
|
|
1488
|
-
)))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" },
|
|
1502
|
+
)))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, I && /* @__PURE__ */ e.createElement(
|
|
1489
1503
|
"a",
|
|
1490
1504
|
{
|
|
1491
1505
|
href: "https://artifactuse.com",
|
|
@@ -1497,29 +1511,29 @@ function ga({
|
|
|
1497
1511
|
/* @__PURE__ */ e.createElement("span", null, "Artifactuse")
|
|
1498
1512
|
)));
|
|
1499
1513
|
}
|
|
1500
|
-
function
|
|
1501
|
-
const { state: a, artifactCount:
|
|
1514
|
+
function Na({ className: t = "" }) {
|
|
1515
|
+
const { state: a, artifactCount: c, hasArtifacts: l, togglePanel: o } = Le(), u = L(() => c > 99 ? "99+" : String(c), [c]), E = [
|
|
1502
1516
|
"artifactuse-panel-toggle",
|
|
1503
1517
|
a.isPanelOpen && "artifactuse-panel-toggle--active",
|
|
1504
|
-
|
|
1518
|
+
l && "artifactuse-panel-toggle--has-artifacts",
|
|
1505
1519
|
t
|
|
1506
1520
|
].filter(Boolean).join(" ");
|
|
1507
1521
|
return /* @__PURE__ */ e.createElement(
|
|
1508
1522
|
"button",
|
|
1509
1523
|
{
|
|
1510
|
-
className:
|
|
1524
|
+
className: E,
|
|
1511
1525
|
onClick: o,
|
|
1512
1526
|
title: a.isPanelOpen ? "Close artifacts panel" : "Open artifacts panel"
|
|
1513
1527
|
},
|
|
1514
1528
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("polyline", { points: "16 18 22 12 16 6" }), /* @__PURE__ */ e.createElement("polyline", { points: "8 6 2 12 8 18" })),
|
|
1515
|
-
|
|
1529
|
+
c > 0 && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel-toggle-badge" }, u)
|
|
1516
1530
|
);
|
|
1517
1531
|
}
|
|
1518
|
-
const
|
|
1519
|
-
function
|
|
1520
|
-
const
|
|
1521
|
-
|
|
1522
|
-
const
|
|
1532
|
+
const bt = qt(null);
|
|
1533
|
+
function pa({ children: t, config: a = {} }) {
|
|
1534
|
+
const c = W(null);
|
|
1535
|
+
c.current || (c.current = Ot(a));
|
|
1536
|
+
const l = c.current, [o, u] = w({
|
|
1523
1537
|
artifacts: [],
|
|
1524
1538
|
activeArtifactId: null,
|
|
1525
1539
|
isPanelOpen: !1,
|
|
@@ -1528,9 +1542,9 @@ function ua({ children: t, config: a = {} }) {
|
|
|
1528
1542
|
openTabs: [],
|
|
1529
1543
|
tabViewModes: {},
|
|
1530
1544
|
forceEmptyView: !1
|
|
1531
|
-
}), [
|
|
1532
|
-
|
|
1533
|
-
const
|
|
1545
|
+
}), [E, i] = w(() => l.getPanelTypes());
|
|
1546
|
+
D(() => {
|
|
1547
|
+
const n = l.state.subscribe((g) => {
|
|
1534
1548
|
u({
|
|
1535
1549
|
artifacts: g.artifacts,
|
|
1536
1550
|
activeArtifactId: g.activeArtifactId,
|
|
@@ -1542,125 +1556,125 @@ function ua({ children: t, config: a = {} }) {
|
|
|
1542
1556
|
forceEmptyView: g.forceEmptyView
|
|
1543
1557
|
});
|
|
1544
1558
|
});
|
|
1545
|
-
return
|
|
1546
|
-
|
|
1559
|
+
return l.applyTheme(), () => {
|
|
1560
|
+
n(), l.destroy();
|
|
1547
1561
|
};
|
|
1548
|
-
}, [
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1551
|
-
}, [
|
|
1552
|
-
|
|
1553
|
-
}, [
|
|
1554
|
-
|
|
1555
|
-
}, [
|
|
1556
|
-
instance:
|
|
1562
|
+
}, [l]);
|
|
1563
|
+
const r = L(() => o.activeArtifactId && o.artifacts.find((n) => n.id === o.activeArtifactId) || null, [o.artifacts, o.activeArtifactId]), m = o.artifacts.filter((n) => !n.isInline).length, x = m > 0, T = L(() => r ? l.getPanelUrl(r) : null, [r, l]), A = p((n) => {
|
|
1564
|
+
l.setTheme(n), l.applyTheme();
|
|
1565
|
+
}, [l]), $ = p((n, g) => {
|
|
1566
|
+
l.registerPanel(n, g), i(l.getPanelTypes());
|
|
1567
|
+
}, [l]), h = p((n) => {
|
|
1568
|
+
l.unregisterPanel(n), i(l.getPanelTypes());
|
|
1569
|
+
}, [l]), k = L(() => ({
|
|
1570
|
+
instance: l,
|
|
1557
1571
|
state: o,
|
|
1558
|
-
activeArtifact:
|
|
1572
|
+
activeArtifact: r,
|
|
1559
1573
|
artifactCount: m,
|
|
1560
|
-
hasArtifacts:
|
|
1574
|
+
hasArtifacts: x,
|
|
1561
1575
|
// Panel computed
|
|
1562
|
-
panelTypes:
|
|
1576
|
+
panelTypes: E,
|
|
1563
1577
|
activePanelUrl: T,
|
|
1564
1578
|
// Methods
|
|
1565
|
-
processMessage:
|
|
1566
|
-
initializeContent:
|
|
1567
|
-
openArtifact:
|
|
1568
|
-
openFile:
|
|
1569
|
-
openCode:
|
|
1570
|
-
updateFile:
|
|
1571
|
-
openPanel:
|
|
1572
|
-
closePanel:
|
|
1573
|
-
togglePanel:
|
|
1574
|
-
toggleFullscreen:
|
|
1575
|
-
setViewMode:
|
|
1576
|
-
getPanelUrl:
|
|
1577
|
-
sendToPanel:
|
|
1579
|
+
processMessage: l.processMessage,
|
|
1580
|
+
initializeContent: l.initializeContent,
|
|
1581
|
+
openArtifact: l.openArtifact,
|
|
1582
|
+
openFile: l.openFile,
|
|
1583
|
+
openCode: l.openCode,
|
|
1584
|
+
updateFile: l.updateFile,
|
|
1585
|
+
openPanel: l.openPanel,
|
|
1586
|
+
closePanel: l.closePanel,
|
|
1587
|
+
togglePanel: l.togglePanel,
|
|
1588
|
+
toggleFullscreen: l.toggleFullscreen,
|
|
1589
|
+
setViewMode: l.setViewMode,
|
|
1590
|
+
getPanelUrl: l.getPanelUrl,
|
|
1591
|
+
sendToPanel: l.sendToPanel,
|
|
1578
1592
|
// Panel management
|
|
1579
|
-
hasPanel:
|
|
1593
|
+
hasPanel: l.hasPanel,
|
|
1580
1594
|
registerPanel: $,
|
|
1581
1595
|
unregisterPanel: h,
|
|
1582
|
-
getPanelTypes:
|
|
1596
|
+
getPanelTypes: l.getPanelTypes,
|
|
1583
1597
|
// Multi-tab
|
|
1584
|
-
closeTab:
|
|
1585
|
-
closeOtherTabs:
|
|
1586
|
-
closeAllTabs:
|
|
1598
|
+
closeTab: l.closeTab,
|
|
1599
|
+
closeOtherTabs: l.closeOtherTabs,
|
|
1600
|
+
closeAllTabs: l.closeAllTabs,
|
|
1587
1601
|
// Events
|
|
1588
|
-
on:
|
|
1589
|
-
off:
|
|
1602
|
+
on: l.on,
|
|
1603
|
+
off: l.off,
|
|
1590
1604
|
// State management
|
|
1591
|
-
clearArtifacts: () =>
|
|
1605
|
+
clearArtifacts: () => l.state.clear(),
|
|
1592
1606
|
// Theme
|
|
1593
|
-
applyTheme:
|
|
1594
|
-
setTheme:
|
|
1595
|
-
getTheme:
|
|
1607
|
+
applyTheme: l.applyTheme,
|
|
1608
|
+
setTheme: A,
|
|
1609
|
+
getTheme: l.getTheme
|
|
1596
1610
|
}), [
|
|
1597
|
-
|
|
1611
|
+
l,
|
|
1598
1612
|
o,
|
|
1599
|
-
|
|
1613
|
+
r,
|
|
1600
1614
|
m,
|
|
1601
|
-
|
|
1602
|
-
|
|
1615
|
+
x,
|
|
1616
|
+
E,
|
|
1603
1617
|
T,
|
|
1604
|
-
|
|
1618
|
+
A,
|
|
1605
1619
|
$,
|
|
1606
1620
|
h
|
|
1607
1621
|
]);
|
|
1608
|
-
return /* @__PURE__ */ e.createElement(
|
|
1622
|
+
return /* @__PURE__ */ e.createElement(bt.Provider, { value: k }, t);
|
|
1609
1623
|
}
|
|
1610
|
-
function
|
|
1611
|
-
const t =
|
|
1624
|
+
function Le() {
|
|
1625
|
+
const t = Dt(bt);
|
|
1612
1626
|
if (!t)
|
|
1613
1627
|
throw new Error("useArtifactuse must be used within an ArtifactuseProvider");
|
|
1614
1628
|
return t;
|
|
1615
1629
|
}
|
|
1616
|
-
function
|
|
1617
|
-
const { on:
|
|
1618
|
-
|
|
1619
|
-
const o =
|
|
1630
|
+
function Ea(t, a) {
|
|
1631
|
+
const { on: c, off: l } = Le();
|
|
1632
|
+
D(() => {
|
|
1633
|
+
const o = c(t, a);
|
|
1620
1634
|
return () => {
|
|
1621
|
-
typeof o == "function" ? o() :
|
|
1635
|
+
typeof o == "function" ? o() : l(t, a);
|
|
1622
1636
|
};
|
|
1623
|
-
}, [t, a,
|
|
1637
|
+
}, [t, a, c, l]);
|
|
1624
1638
|
}
|
|
1625
|
-
function
|
|
1639
|
+
function va() {
|
|
1626
1640
|
const {
|
|
1627
1641
|
registerPanel: t,
|
|
1628
1642
|
unregisterPanel: a,
|
|
1629
|
-
hasPanel:
|
|
1630
|
-
panelTypes:
|
|
1643
|
+
hasPanel: c,
|
|
1644
|
+
panelTypes: l,
|
|
1631
1645
|
instance: o
|
|
1632
|
-
} =
|
|
1646
|
+
} = Le(), u = p((i) => c({ type: i }), [c]), E = p((i, r = {}) => {
|
|
1633
1647
|
var m;
|
|
1634
|
-
return ((m = o.panelResolver) == null ? void 0 : m.resolve(
|
|
1648
|
+
return ((m = o.panelResolver) == null ? void 0 : m.resolve(i, r)) || null;
|
|
1635
1649
|
}, [o]);
|
|
1636
1650
|
return {
|
|
1637
1651
|
register: t,
|
|
1638
1652
|
unregister: a,
|
|
1639
1653
|
isRegistered: u,
|
|
1640
|
-
getPanelUrl:
|
|
1641
|
-
types:
|
|
1642
|
-
defaults:
|
|
1654
|
+
getPanelUrl: E,
|
|
1655
|
+
types: l,
|
|
1656
|
+
defaults: _t
|
|
1643
1657
|
};
|
|
1644
1658
|
}
|
|
1645
|
-
const
|
|
1646
|
-
ArtifactuseProvider:
|
|
1647
|
-
useArtifactuse:
|
|
1648
|
-
useArtifactuseEvent:
|
|
1649
|
-
usePanelRegistry:
|
|
1650
|
-
DEFAULT_PANELS:
|
|
1659
|
+
const wa = {
|
|
1660
|
+
ArtifactuseProvider: pa,
|
|
1661
|
+
useArtifactuse: Le,
|
|
1662
|
+
useArtifactuseEvent: Ea,
|
|
1663
|
+
usePanelRegistry: va,
|
|
1664
|
+
DEFAULT_PANELS: _t
|
|
1651
1665
|
};
|
|
1652
1666
|
export {
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1667
|
+
fa as ArtifactuseAgentMessage,
|
|
1668
|
+
Zt as ArtifactuseCard,
|
|
1669
|
+
Qt as ArtifactuseInlineForm,
|
|
1670
|
+
ba as ArtifactusePanel,
|
|
1671
|
+
Na as ArtifactusePanelToggle,
|
|
1672
|
+
pa as ArtifactuseProvider,
|
|
1673
|
+
ia as ArtifactuseSocialPreview,
|
|
1674
|
+
oa as ArtifactuseViewer,
|
|
1675
|
+
_t as DEFAULT_PANELS,
|
|
1676
|
+
wa as default,
|
|
1677
|
+
Le as useArtifactuse,
|
|
1678
|
+
Ea as useArtifactuseEvent,
|
|
1679
|
+
va as usePanelRegistry
|
|
1666
1680
|
};
|