artifactuse 0.3.2 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/binaryPreview.d.ts +3 -0
- package/dist/core/detector.d.ts +32 -0
- package/dist/{index-ABusvYh9.js → index-CBGheZYZ.js} +360 -309
- package/dist/index.js +1 -1
- package/dist/{jszip.min-CdmYyw5L.js → jszip.min-BdBnWAEK.js} +896 -854
- package/dist/react/index.js +810 -782
- package/dist/styles/components/panel.css +75 -0
- package/dist/svelte/index.js +2283 -2118
- package/dist/vue/index.js +1515 -1425
- package/dist/vue2/index.js +421 -79
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -1,210 +1,210 @@
|
|
|
1
|
-
import e, { useState as y, useMemo as
|
|
2
|
-
import { g as
|
|
3
|
-
import { J as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
function
|
|
1
|
+
import e, { useState as y, useMemo as N, useCallback as d, useRef as F, useEffect as I, createContext as Ea, useContext as va } from "react";
|
|
2
|
+
import { g as Qe, f as Rt, a as Et, b as vt, n as ha, i as Ht, c as ga, D as zt, d as _a } from "../index-CBGheZYZ.js";
|
|
3
|
+
import { b as ya, g as Bt, r as Ft, J as ba } from "../jszip.min-BdBnWAEK.js";
|
|
4
|
+
import { createPortal as Na } from "react-dom";
|
|
5
|
+
function wa({
|
|
6
6
|
artifact: t,
|
|
7
|
-
isActive:
|
|
7
|
+
isActive: n = !1,
|
|
8
8
|
onOpen: c,
|
|
9
9
|
onCopy: l,
|
|
10
10
|
onDownload: i,
|
|
11
11
|
className: u = ""
|
|
12
12
|
}) {
|
|
13
|
-
const [
|
|
14
|
-
var
|
|
15
|
-
return
|
|
16
|
-
}, [t.size, t.code]),
|
|
17
|
-
|
|
18
|
-
}, [t, c]),
|
|
19
|
-
|
|
13
|
+
const [g, v] = y(!1), o = N(() => Qe(t.language), [t.language]), a = N(() => {
|
|
14
|
+
var L;
|
|
15
|
+
return Rt(t.size || ((L = t.code) == null ? void 0 : L.length) || 0);
|
|
16
|
+
}, [t.size, t.code]), x = N(() => Et(t.language), [t.language]), S = d((L) => {
|
|
17
|
+
L.stopPropagation(), c && c(t);
|
|
18
|
+
}, [t, c]), A = d(async (L) => {
|
|
19
|
+
L.stopPropagation();
|
|
20
20
|
try {
|
|
21
|
-
await navigator.clipboard.writeText(t.code),
|
|
22
|
-
|
|
21
|
+
await navigator.clipboard.writeText(t.code), v(!0), l && l(t), setTimeout(() => {
|
|
22
|
+
v(!1);
|
|
23
23
|
}, 2e3);
|
|
24
24
|
} catch {
|
|
25
25
|
const s = document.createElement("textarea");
|
|
26
26
|
s.value = t.code, s.style.position = "fixed", s.style.opacity = "0", document.body.appendChild(s), s.select();
|
|
27
27
|
try {
|
|
28
|
-
document.execCommand("copy"),
|
|
29
|
-
|
|
28
|
+
document.execCommand("copy"), v(!0), l && l(t), setTimeout(() => {
|
|
29
|
+
v(!1);
|
|
30
30
|
}, 2e3);
|
|
31
|
-
} catch (
|
|
32
|
-
console.error("Failed to copy:",
|
|
31
|
+
} catch (Z) {
|
|
32
|
+
console.error("Failed to copy:", Z);
|
|
33
33
|
}
|
|
34
34
|
document.body.removeChild(s);
|
|
35
35
|
}
|
|
36
|
-
}, [t, l]),
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
const p = new Blob([t.code], { type: "text/plain" }), s = URL.createObjectURL(p),
|
|
40
|
-
|
|
36
|
+
}, [t, l]), R = d((L) => {
|
|
37
|
+
var V;
|
|
38
|
+
L.stopPropagation();
|
|
39
|
+
const p = new Blob([t.code], { type: "text/plain" }), s = URL.createObjectURL(p), Z = document.createElement("a"), Y = vt(t.editorLanguage || t.language), z = ((V = t.title) == null ? void 0 : V.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
|
|
40
|
+
Z.href = s, Z.download = `${z}.${Y}`, document.body.appendChild(Z), Z.click(), document.body.removeChild(Z), URL.revokeObjectURL(s), i && i(t);
|
|
41
41
|
}, [t, i]), _ = [
|
|
42
42
|
"artifactuse-card",
|
|
43
|
-
|
|
43
|
+
n && "artifactuse-card--active",
|
|
44
44
|
u
|
|
45
45
|
].filter(Boolean).join(" ");
|
|
46
|
-
return /* @__PURE__ */ e.createElement("div", { className: _, onClick:
|
|
46
|
+
return /* @__PURE__ */ e.createElement("div", { className: _, onClick: S }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__icon" }, /* @__PURE__ */ e.createElement(
|
|
47
47
|
"svg",
|
|
48
48
|
{
|
|
49
49
|
viewBox: "0 0 24 24",
|
|
50
50
|
fill: "none",
|
|
51
51
|
stroke: "currentColor",
|
|
52
52
|
strokeWidth: "1.5",
|
|
53
|
-
dangerouslySetInnerHTML: { __html:
|
|
53
|
+
dangerouslySetInnerHTML: { __html: x }
|
|
54
54
|
}
|
|
55
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" }, o), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__separator" }, "•"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__size" }, a))), /* @__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: g ? "Copied!" : "Copy code",
|
|
60
|
+
onClick: A
|
|
61
61
|
},
|
|
62
|
-
|
|
62
|
+
g ? /* @__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
|
{
|
|
66
66
|
className: "artifactuse-card__action",
|
|
67
67
|
title: "Download file",
|
|
68
|
-
onClick:
|
|
68
|
+
onClick: R
|
|
69
69
|
},
|
|
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 ka(t) {
|
|
74
74
|
if (!t) return null;
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
let i =
|
|
75
|
+
const n = t.trim();
|
|
76
|
+
if (n.startsWith("#")) {
|
|
77
|
+
let i = n.slice(1);
|
|
78
78
|
if (i.length === 3 && (i = i.split("").map((u) => u + u).join("")), i.length === 6) {
|
|
79
|
-
const u = parseInt(i.slice(0, 2), 16),
|
|
80
|
-
if (!isNaN(u) && !isNaN(
|
|
79
|
+
const u = parseInt(i.slice(0, 2), 16), g = parseInt(i.slice(2, 4), 16), v = parseInt(i.slice(4, 6), 16);
|
|
80
|
+
if (!isNaN(u) && !isNaN(g) && !isNaN(v)) return `${u}, ${g}, ${v}`;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
const c =
|
|
83
|
+
const c = n.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
|
|
84
84
|
if (c) return `${c[1]}, ${c[2]}, ${c[3]}`;
|
|
85
|
-
const l =
|
|
85
|
+
const l = n.split(/[\s,]+/).map(Number).filter((i) => !isNaN(i));
|
|
86
86
|
return l.length >= 3 ? `${l[0]}, ${l[1]}, ${l[2]}` : null;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
return t ? t.map((
|
|
88
|
+
function It(t) {
|
|
89
|
+
return t ? t.map((n) => typeof n == "string" ? { label: n, value: n } : n) : [];
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function xa(t) {
|
|
92
92
|
return ["text", "email", "password", "tel", "url", "number", "date", "time", "datetime-local"].includes(t);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Ca({
|
|
95
95
|
artifact: t,
|
|
96
|
-
onSubmit:
|
|
96
|
+
onSubmit: n,
|
|
97
97
|
onCancel: c,
|
|
98
98
|
onReset: l,
|
|
99
99
|
onButtonClick: i,
|
|
100
100
|
className: u = "",
|
|
101
|
-
theme:
|
|
102
|
-
accent:
|
|
101
|
+
theme: g = "dark",
|
|
102
|
+
accent: v = null,
|
|
103
103
|
initialState: o = "active"
|
|
104
104
|
// 'active' | 'submitted' | 'cancelled' | 'inactive'
|
|
105
105
|
}) {
|
|
106
|
-
var
|
|
107
|
-
const a =
|
|
106
|
+
var fe, be, pe;
|
|
107
|
+
const a = F(null), [x, S] = y(o), A = x !== "active", R = x === "active" ? "" : `artifactuse-form--${x}`, _ = N(() => {
|
|
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
|
|
113
|
+
}, [t.code]), L = t.id || _.id || `form-${Date.now()}`, p = ((fe = _.data) == null ? void 0 : fe.fields) || [], s = _.title || "Form", Z = N(() => p.some((m) => m.type === "buttons"), [p]), Y = N(() => _.variant === "buttons" ? p : [], [_.variant, p]), [z, V] = y(() => {
|
|
114
|
+
var $;
|
|
115
115
|
const m = {};
|
|
116
116
|
return p.forEach((b) => {
|
|
117
117
|
["buttons", "divider", "heading"].includes(b.type) || (b.defaultValue !== void 0 ? m[b.name] = b.defaultValue : b.type === "checkbox" ? m[b.name] = !1 : m[b.name] = "");
|
|
118
|
-
}), (
|
|
119
|
-
}), [
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}, [o]),
|
|
123
|
-
var
|
|
118
|
+
}), ($ = _.data) != null && $.defaults && Object.assign(m, _.data.defaults), m;
|
|
119
|
+
}), [se, U] = y({}), [q, H] = y(!1);
|
|
120
|
+
I(() => {
|
|
121
|
+
S(o);
|
|
122
|
+
}, [o]), I(() => {
|
|
123
|
+
var $;
|
|
124
124
|
const m = {};
|
|
125
125
|
p.forEach((b) => {
|
|
126
126
|
["buttons", "divider", "heading"].includes(b.type) || (b.defaultValue !== void 0 ? m[b.name] = b.defaultValue : b.type === "checkbox" ? m[b.name] = !1 : m[b.name] = "");
|
|
127
|
-
}), (
|
|
128
|
-
}, [t.code]),
|
|
129
|
-
if (a.current && (a.current.setAttribute("data-artifactuse-theme",
|
|
130
|
-
const m =
|
|
127
|
+
}), ($ = _.data) != null && $.defaults && Object.assign(m, _.data.defaults), V(m), U({});
|
|
128
|
+
}, [t.code]), I(() => {
|
|
129
|
+
if (a.current && (a.current.setAttribute("data-artifactuse-theme", g), v)) {
|
|
130
|
+
const m = ka(v);
|
|
131
131
|
m && a.current.style.setProperty("--artifactuse-primary", m);
|
|
132
132
|
}
|
|
133
|
-
}, [
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
}, []),
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
return delete
|
|
133
|
+
}, [g, v]);
|
|
134
|
+
const G = d((m) => {
|
|
135
|
+
S(m);
|
|
136
|
+
}, []), _e = d((m, $) => {
|
|
137
|
+
V((b) => ({ ...b, [m]: $ })), U((b) => {
|
|
138
|
+
const k = { ...b };
|
|
139
|
+
return delete k[m], k;
|
|
140
140
|
});
|
|
141
|
-
}, []),
|
|
141
|
+
}, []), ie = d(() => {
|
|
142
142
|
var b;
|
|
143
143
|
const m = {};
|
|
144
|
-
p.forEach((
|
|
145
|
-
if (["buttons", "divider", "heading"].includes(
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
m[
|
|
144
|
+
p.forEach((k) => {
|
|
145
|
+
if (["buttons", "divider", "heading"].includes(k.type)) return;
|
|
146
|
+
const P = z[k.name];
|
|
147
|
+
if (k.required && !P && P !== 0 && P !== !1) {
|
|
148
|
+
m[k.name] = `${k.label || "This field"} is required`;
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
if (
|
|
152
|
-
m[
|
|
151
|
+
if (k.pattern && P && !new RegExp(k.pattern).test(P)) {
|
|
152
|
+
m[k.name] = k.patternMessage || `${k.label || "This field"} is invalid`;
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
|
-
if (
|
|
156
|
-
m[
|
|
155
|
+
if (k.type === "email" && P && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(P)) {
|
|
156
|
+
m[k.name] = "Please enter a valid email address";
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
|
-
if (
|
|
160
|
-
m[
|
|
159
|
+
if (k.minLength && P && P.length < k.minLength) {
|
|
160
|
+
m[k.name] = `Minimum ${k.minLength} characters required`;
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
|
-
if (
|
|
164
|
-
m[
|
|
163
|
+
if (k.maxLength && P && P.length > k.maxLength) {
|
|
164
|
+
m[k.name] = `Maximum ${k.maxLength} characters allowed`;
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
|
-
const
|
|
169
|
-
return
|
|
170
|
-
if (m[
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
}),
|
|
174
|
-
}, [p, z, (
|
|
175
|
-
var
|
|
168
|
+
const $ = (b = _.data) == null ? void 0 : b.validation;
|
|
169
|
+
return $ && Object.entries($).forEach(([k, P]) => {
|
|
170
|
+
if (m[k]) return;
|
|
171
|
+
const M = z[k];
|
|
172
|
+
P.pattern && M && (new RegExp(P.pattern).test(M) || (m[k] = P.message || `${k} is invalid`));
|
|
173
|
+
}), U(m), Object.keys(m).length === 0;
|
|
174
|
+
}, [p, z, (be = _.data) == null ? void 0 : be.validation]), ye = d(() => {
|
|
175
|
+
var $;
|
|
176
176
|
const m = {};
|
|
177
177
|
p.forEach((b) => {
|
|
178
178
|
["buttons", "divider", "heading"].includes(b.type) || (b.defaultValue !== void 0 ? m[b.name] = b.defaultValue : b.type === "checkbox" ? m[b.name] = !1 : m[b.name] = "");
|
|
179
|
-
}), (
|
|
180
|
-
}, [p, (
|
|
181
|
-
m == null || m.preventDefault(),
|
|
182
|
-
formId:
|
|
179
|
+
}), ($ = _.data) != null && $.defaults && Object.assign(m, _.data.defaults), V(m), U({});
|
|
180
|
+
}, [p, (pe = _.data) == null ? void 0 : pe.defaults]), oe = d((m) => {
|
|
181
|
+
m == null || m.preventDefault(), ie() && (H(!0), n == null || n({
|
|
182
|
+
formId: L,
|
|
183
183
|
action: "submit",
|
|
184
184
|
values: { ...z },
|
|
185
185
|
timestamp: Date.now()
|
|
186
186
|
}), setTimeout(() => {
|
|
187
|
-
H(!1),
|
|
187
|
+
H(!1), G("submitted");
|
|
188
188
|
}, 300));
|
|
189
|
-
}, [
|
|
190
|
-
const
|
|
191
|
-
switch (
|
|
189
|
+
}, [L, z, n, ie, G]), de = d((m) => {
|
|
190
|
+
const $ = m.action || "custom";
|
|
191
|
+
switch ($) {
|
|
192
192
|
case "submit":
|
|
193
|
-
|
|
193
|
+
oe();
|
|
194
194
|
break;
|
|
195
195
|
case "cancel":
|
|
196
196
|
c == null || c({
|
|
197
|
-
formId:
|
|
197
|
+
formId: L,
|
|
198
198
|
action: "cancel",
|
|
199
199
|
buttonName: m.name || "cancel",
|
|
200
200
|
timestamp: Date.now()
|
|
201
201
|
}), setTimeout(() => {
|
|
202
|
-
|
|
202
|
+
G("cancelled");
|
|
203
203
|
}, 150);
|
|
204
204
|
break;
|
|
205
205
|
case "reset":
|
|
206
|
-
|
|
207
|
-
formId:
|
|
206
|
+
ye(), l == null || l({
|
|
207
|
+
formId: L,
|
|
208
208
|
action: "reset",
|
|
209
209
|
buttonName: m.name || "reset",
|
|
210
210
|
timestamp: Date.now()
|
|
@@ -213,42 +213,42 @@ function pa({
|
|
|
213
213
|
case "custom":
|
|
214
214
|
default:
|
|
215
215
|
i == null || i({
|
|
216
|
-
formId:
|
|
217
|
-
action:
|
|
216
|
+
formId: L,
|
|
217
|
+
action: $,
|
|
218
218
|
buttonName: m.name || m.label,
|
|
219
219
|
buttonLabel: m.label,
|
|
220
220
|
values: { ...z },
|
|
221
221
|
timestamp: Date.now()
|
|
222
222
|
}), setTimeout(() => {
|
|
223
|
-
|
|
223
|
+
G("submitted");
|
|
224
224
|
}, 150);
|
|
225
225
|
break;
|
|
226
226
|
}
|
|
227
|
-
}, [
|
|
228
|
-
return
|
|
227
|
+
}, [L, z, oe, c, l, i, ye, G]);
|
|
228
|
+
return A ? /* @__PURE__ */ e.createElement(
|
|
229
229
|
"div",
|
|
230
230
|
{
|
|
231
231
|
ref: a,
|
|
232
|
-
className: `artifactuse-inline-form artifactuse-form-${_.variant || "fields"} ${
|
|
233
|
-
"data-artifactuse-theme":
|
|
232
|
+
className: `artifactuse-inline-form artifactuse-form-${_.variant || "fields"} ${R} ${u}`,
|
|
233
|
+
"data-artifactuse-theme": g
|
|
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" }, s))
|
|
236
236
|
) : _.variant === "buttons" ? /* @__PURE__ */ e.createElement(
|
|
237
237
|
"div",
|
|
238
238
|
{
|
|
239
239
|
ref: a,
|
|
240
240
|
className: `artifactuse-inline-form artifactuse-form-buttons ${u}`,
|
|
241
|
-
"data-artifactuse-theme":
|
|
241
|
+
"data-artifactuse-theme": g
|
|
242
242
|
},
|
|
243
243
|
(_.title || _.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, _.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, _.title), _.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, _.description)),
|
|
244
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" },
|
|
244
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, Y.map((m, $) => /* @__PURE__ */ e.createElement(
|
|
245
245
|
"button",
|
|
246
246
|
{
|
|
247
|
-
key: m.name || m.label ||
|
|
247
|
+
key: m.name || m.label || $,
|
|
248
248
|
type: "button",
|
|
249
249
|
className: `artifactuse-form-btn artifactuse-form-btn-${m.variant || "secondary"}`,
|
|
250
|
-
onClick: () =>
|
|
251
|
-
disabled: m.disabled ||
|
|
250
|
+
onClick: () => de(m),
|
|
251
|
+
disabled: m.disabled || q
|
|
252
252
|
},
|
|
253
253
|
m.icon && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-icon", dangerouslySetInnerHTML: { __html: m.icon } }),
|
|
254
254
|
m.label
|
|
@@ -258,27 +258,27 @@ function pa({
|
|
|
258
258
|
{
|
|
259
259
|
ref: a,
|
|
260
260
|
className: `artifactuse-inline-form artifactuse-form-fields ${u}`,
|
|
261
|
-
"data-artifactuse-theme":
|
|
261
|
+
"data-artifactuse-theme": g
|
|
262
262
|
},
|
|
263
263
|
(_.title || _.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, _.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, _.title), _.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, _.description)),
|
|
264
|
-
/* @__PURE__ */ e.createElement("form", { onSubmit:
|
|
265
|
-
|
|
264
|
+
/* @__PURE__ */ e.createElement("form", { onSubmit: oe, className: "artifactuse-form" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-fields" }, p.map((m, $) => /* @__PURE__ */ e.createElement(
|
|
265
|
+
La,
|
|
266
266
|
{
|
|
267
|
-
key: m.name ||
|
|
267
|
+
key: m.name || $,
|
|
268
268
|
field: m,
|
|
269
|
-
formId:
|
|
269
|
+
formId: L,
|
|
270
270
|
value: z[m.name],
|
|
271
|
-
error:
|
|
272
|
-
isSubmitting:
|
|
273
|
-
onChange: (b) =>
|
|
274
|
-
onButtonAction:
|
|
271
|
+
error: se[m.name],
|
|
272
|
+
isSubmitting: q,
|
|
273
|
+
onChange: (b) => _e(m.name, b),
|
|
274
|
+
onButtonAction: de
|
|
275
275
|
}
|
|
276
|
-
))), !
|
|
276
|
+
))), !Z && /* @__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: () => de({ action: "cancel", label: "Cancel" })
|
|
282
282
|
},
|
|
283
283
|
"Cancel"
|
|
284
284
|
), /* @__PURE__ */ e.createElement(
|
|
@@ -286,23 +286,23 @@ function pa({
|
|
|
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 La({ field: t, formId: n, value: c, error: l, isSubmitting: i, onChange: u, onButtonAction: g }) {
|
|
297
|
+
const v = `${n}-${t.name}`;
|
|
298
298
|
if (t.type === "buttons")
|
|
299
|
-
return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, (t.fields || []).map((a,
|
|
299
|
+
return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, (t.fields || []).map((a, x) => /* @__PURE__ */ e.createElement(
|
|
300
300
|
"button",
|
|
301
301
|
{
|
|
302
|
-
key: a.name || a.label ||
|
|
302
|
+
key: a.name || a.label || x,
|
|
303
303
|
type: a.action === "submit" ? "submit" : "button",
|
|
304
304
|
className: `artifactuse-form-btn artifactuse-form-btn-${a.variant || "secondary"}`,
|
|
305
|
-
onClick: a.action !== "submit" ? () =>
|
|
305
|
+
onClick: a.action !== "submit" ? () => g(a) : void 0,
|
|
306
306
|
disabled: a.disabled || a.action === "submit" && i
|
|
307
307
|
},
|
|
308
308
|
i && a.action === "submit" ? /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-spinner" }) : a.icon ? /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-icon", dangerouslySetInnerHTML: { __html: a.icon } }) : null,
|
|
@@ -317,7 +317,7 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
|
|
|
317
317
|
"input",
|
|
318
318
|
{
|
|
319
319
|
type: "checkbox",
|
|
320
|
-
id:
|
|
320
|
+
id: v,
|
|
321
321
|
name: t.name,
|
|
322
322
|
checked: c || !1,
|
|
323
323
|
disabled: t.disabled,
|
|
@@ -326,7 +326,7 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
|
|
|
326
326
|
}
|
|
327
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" }, It(t.options).map((a) => /* @__PURE__ */ e.createElement("label", { key: a.value, className: "artifactuse-radio-label" }, /* @__PURE__ */ e.createElement(
|
|
330
330
|
"input",
|
|
331
331
|
{
|
|
332
332
|
type: "radio",
|
|
@@ -338,11 +338,11 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
|
|
|
338
338
|
onChange: () => u(a.value)
|
|
339
339
|
}
|
|
340
340
|
), /* @__PURE__ */ e.createElement("span", null, a.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 o = () =>
|
|
341
|
+
const o = () => xa(t.type) ? /* @__PURE__ */ e.createElement(
|
|
342
342
|
"input",
|
|
343
343
|
{
|
|
344
344
|
type: t.type,
|
|
345
|
-
id:
|
|
345
|
+
id: v,
|
|
346
346
|
name: t.name,
|
|
347
347
|
value: c || "",
|
|
348
348
|
placeholder: t.placeholder,
|
|
@@ -354,7 +354,7 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
|
|
|
354
354
|
) : t.type === "textarea" ? /* @__PURE__ */ e.createElement(
|
|
355
355
|
"textarea",
|
|
356
356
|
{
|
|
357
|
-
id:
|
|
357
|
+
id: v,
|
|
358
358
|
name: t.name,
|
|
359
359
|
value: c || "",
|
|
360
360
|
placeholder: t.placeholder,
|
|
@@ -367,7 +367,7 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
|
|
|
367
367
|
) : t.type === "select" ? /* @__PURE__ */ e.createElement(
|
|
368
368
|
"select",
|
|
369
369
|
{
|
|
370
|
-
id:
|
|
370
|
+
id: v,
|
|
371
371
|
name: t.name,
|
|
372
372
|
value: c || "",
|
|
373
373
|
disabled: t.disabled,
|
|
@@ -376,12 +376,12 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
|
|
|
376
376
|
onChange: (a) => u(a.target.value)
|
|
377
377
|
},
|
|
378
378
|
/* @__PURE__ */ e.createElement("option", { value: "" }, t.placeholder || "Select..."),
|
|
379
|
-
|
|
379
|
+
It(t.options).map((a) => /* @__PURE__ */ e.createElement("option", { key: a.value, value: a.value, disabled: a.disabled }, a.label))
|
|
380
380
|
) : /* @__PURE__ */ e.createElement(
|
|
381
381
|
"input",
|
|
382
382
|
{
|
|
383
383
|
type: "text",
|
|
384
|
-
id:
|
|
384
|
+
id: v,
|
|
385
385
|
name: t.name,
|
|
386
386
|
value: c || "",
|
|
387
387
|
disabled: t.disabled,
|
|
@@ -389,9 +389,9 @@ function Ea({ field: t, formId: r, value: c, error: l, isSubmitting: i, onChange
|
|
|
389
389
|
onChange: (a) => u(a.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: v, className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), o(), 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 K = '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>', Ta = {
|
|
395
395
|
twitter: 280,
|
|
396
396
|
linkedin: 3e3,
|
|
397
397
|
instagram: 2200,
|
|
@@ -399,7 +399,7 @@ const J = '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
|
+
}, Ma = {
|
|
403
403
|
twitter: "X",
|
|
404
404
|
linkedin: "LinkedIn",
|
|
405
405
|
instagram: "Instagram",
|
|
@@ -407,130 +407,130 @@ const J = '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
|
+
}, et = ({ 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" })), D = (t) => t ? t >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : t >= 1e3 ? `${(t / 1e3).toFixed(1)}K` : t.toString() : "0", ht = (t) => {
|
|
411
411
|
try {
|
|
412
412
|
return new URL(t).hostname.replace("www.", "");
|
|
413
413
|
} catch {
|
|
414
414
|
return t;
|
|
415
415
|
}
|
|
416
|
-
},
|
|
416
|
+
}, $e = (t) => {
|
|
417
417
|
if (!t) return "";
|
|
418
|
-
let
|
|
419
|
-
return
|
|
420
|
-
},
|
|
421
|
-
var
|
|
422
|
-
const i =
|
|
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
|
|
425
|
-
return /* @__PURE__ */ e.createElement("div", { key:
|
|
426
|
-
}), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" },
|
|
427
|
-
},
|
|
418
|
+
let n = t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
419
|
+
return n = n.replace(/\n/g, "<br>"), n = n.replace(/#(\w+)/g, '<span class="artifactuse-social-hashtag">#$1</span>'), n = n.replace(/@(\w+)/g, '<span class="artifactuse-social-mention">@$1</span>'), n;
|
|
420
|
+
}, Vt = ({ author: t, content: n, engagement: c, meta: l }) => {
|
|
421
|
+
var g, v, o;
|
|
422
|
+
const i = n.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 || K, alt: t.name, className: "artifactuse-social-avatar", onError: (a) => a.target.src = K }), /* @__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(et, { 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: $e(n.text) } }), i.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social-media-grid ${i.length === 1 ? "artifactuse-social-media-single" : ""}`, "data-count": i.length }, i.slice(0, 4).map((a, x) => /* @__PURE__ */ e.createElement("img", { key: x, src: a.url, alt: a.alt || "", onError: (S) => S.target.style.display = "none" })))), n.link && !i.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, n.link.image && /* @__PURE__ */ e.createElement("img", { src: n.link.image, alt: n.link.title, className: "artifactuse-social-link-image", onError: (a) => a.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, n.link.domain || ht(n.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, n.link.title), n.link.description && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-description" }, n.link.description))), n.poll && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll" }, n.poll.options.map((a, x) => {
|
|
424
|
+
var S, 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: `${((S = n.poll.votes) == null ? void 0 : S[x]) || 0}%` } }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-label" }, /* @__PURE__ */ e.createElement("span", null, a), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-poll-percent" }, ((A = n.poll.votes) == null ? void 0 : A[x]) || 0, "%")));
|
|
426
|
+
}), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" }, D(n.poll.totalVotes || 0), " votes · ", n.poll.duration || "Poll ended")), n.quote && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote-header" }, /* @__PURE__ */ e.createElement("img", { src: ((g = n.quote.author) == null ? void 0 : g.avatar) || K, className: "artifactuse-social-quote-avatar", alt: "" }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-author" }, (v = n.quote.author) == null ? void 0 : v.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-handle" }, (o = n.quote.author) == null ? void 0 : o.handle)), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-quote-text" }, n.quote.text))), u && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, D(c.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, D(c.retweets || 0), " reposts"), /* @__PURE__ */ e.createElement("span", null, D(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, D(c.views || 0), " views")));
|
|
427
|
+
}, Pa = ({ author: t, content: n, engagement: c, meta: l }) => {
|
|
428
428
|
const i = 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 ||
|
|
430
|
-
},
|
|
431
|
-
const i =
|
|
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 i =
|
|
435
|
-
const
|
|
436
|
-
return Object.values(
|
|
437
|
-
}, [c]),
|
|
438
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar ||
|
|
439
|
-
},
|
|
429
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || K, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = K }), /* @__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: $e(n.text) } }), n.link && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, n.link.image && /* @__PURE__ */ e.createElement("img", { src: n.link.image, alt: n.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" }, n.link.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, n.link.domain || ht(n.link.url))))), i && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, D(c.likes || 0), " reactions"), /* @__PURE__ */ e.createElement("span", null, D(c.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, D(c.shares || c.reposts || 0), " reposts")));
|
|
430
|
+
}, Sa = ({ author: t, content: n, engagement: c, meta: l }) => {
|
|
431
|
+
const i = n.media || [];
|
|
432
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || K, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = K }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(et, { type: "blue" })), l.location && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-location" }, l.location))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, i[0] ? /* @__PURE__ */ e.createElement("img", { src: i[0].url, alt: i[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" }, D(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: $e(n.text) } })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, l.timestamp || "JUST NOW"));
|
|
433
|
+
}, $a = ({ author: t, content: n, engagement: c, meta: l }) => {
|
|
434
|
+
const i = n.media || [], u = N(() => {
|
|
435
|
+
const v = c.reactions || {};
|
|
436
|
+
return Object.values(v).reduce((o, a) => o + (a || 0), 0) || c.likes || 0;
|
|
437
|
+
}, [c]), g = 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 || K, alt: t.name, className: "artifactuse-social-avatar", onError: (v) => v.target.src = K }), /* @__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: $e(n.text) } }), i.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-grid", "data-count": i.length }, i.slice(0, 4).map((v, o) => /* @__PURE__ */ e.createElement("img", { key: o, src: v.url, alt: v.alt || "", onError: (a) => a.target.style.display = "none" })))), n.link && !i.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, n.link.image && /* @__PURE__ */ e.createElement("img", { src: n.link.image, alt: n.link.title, className: "artifactuse-social-link-image", onError: (v) => v.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, n.link.domain || ht(n.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, n.link.title)))), g && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, "👍❤️ ", D(u)), /* @__PURE__ */ e.createElement("span", null, D(c.comments || 0), " comments · ", D(c.shares || 0), " shares")));
|
|
439
|
+
}, Aa = ({ author: t, content: n, engagement: c, meta: l }) => {
|
|
440
440
|
const i = 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 ||
|
|
442
|
-
},
|
|
443
|
-
const i =
|
|
444
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, i[0] ? /* @__PURE__ */ e.createElement("img", { src: i[0].url, alt: "Video thumbnail", onError: (
|
|
445
|
-
},
|
|
446
|
-
const i =
|
|
447
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, i[0] ? /* @__PURE__ */ e.createElement("img", { src: i[0].url, alt: "Video thumbnail", onError: (u) => u.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }),
|
|
441
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || K, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = K }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(et, { 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: $e(n.text) } })), i && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, D(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, D(c.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, D(c.reposts || 0), " reposts")));
|
|
442
|
+
}, Ha = ({ author: t, content: n, engagement: c, meta: l }) => {
|
|
443
|
+
const i = n.media || [], u = c.likes || c.comments || c.shares;
|
|
444
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, i[0] ? /* @__PURE__ */ e.createElement("img", { src: i[0].url, alt: "Video thumbnail", onError: (g) => g.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), n.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, n.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || K, alt: t.name, className: "artifactuse-social-avatar", onError: (g) => g.target.src = K }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-name" }, "@", t.name), t.verified && /* @__PURE__ */ e.createElement(et, { type: "blue" })), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: $e(n.text) } }), n.sound && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-sound" }, "🎵 ", n.sound)), u && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, D(c.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, D(c.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, D(c.shares || 0), " shares")));
|
|
445
|
+
}, Ba = ({ author: t, content: n, engagement: c, meta: l }) => {
|
|
446
|
+
const i = n.media || [];
|
|
447
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, i[0] ? /* @__PURE__ */ e.createElement("img", { src: i[0].url, alt: "Video thumbnail", onError: (u) => u.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), n.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, n.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || K, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = K }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-details" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-title" }, n.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-channel" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-meta" }, D(c.views || 0), " views · ", l.timestamp || "Just now"))));
|
|
448
448
|
};
|
|
449
|
-
function
|
|
450
|
-
const [l, i] = y("Copy"), u =
|
|
449
|
+
function Fa({ artifact: t, theme: n = "dark", onCopy: c }) {
|
|
450
|
+
const [l, i] = y("Copy"), u = N(() => {
|
|
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]), g = (u == null ? void 0 : u.platform) || "twitter", v = (u == null ? void 0 : u.data) || {}, { author: o = {}, content: a = {}, engagement: x = {}, meta: S = {} } = v, A = Ta[g] || 280, R = (a.text || "").length, _ = R > A ? "error" : R > A * 0.9 ? "warning" : "", L = d(() => {
|
|
457
457
|
const s = a.text || "";
|
|
458
458
|
navigator.clipboard.writeText(s).then(() => {
|
|
459
|
-
i("Copied!"), setTimeout(() => i("Copy"), 2e3), c == null || c({ platform:
|
|
459
|
+
i("Copied!"), setTimeout(() => i("Copy"), 2e3), c == null || c({ platform: g, text: s });
|
|
460
460
|
});
|
|
461
|
-
}, [a.text,
|
|
462
|
-
const s = { author: o, content: a, engagement:
|
|
463
|
-
switch (
|
|
461
|
+
}, [a.text, g, c]), p = () => {
|
|
462
|
+
const s = { author: o, content: a, engagement: x, meta: S };
|
|
463
|
+
switch (g) {
|
|
464
464
|
case "twitter":
|
|
465
|
-
return /* @__PURE__ */ e.createElement(
|
|
465
|
+
return /* @__PURE__ */ e.createElement(Vt, { ...s });
|
|
466
466
|
case "linkedin":
|
|
467
|
-
return /* @__PURE__ */ e.createElement(
|
|
467
|
+
return /* @__PURE__ */ e.createElement(Pa, { ...s });
|
|
468
468
|
case "instagram":
|
|
469
|
-
return /* @__PURE__ */ e.createElement(
|
|
469
|
+
return /* @__PURE__ */ e.createElement(Sa, { ...s });
|
|
470
470
|
case "facebook":
|
|
471
|
-
return /* @__PURE__ */ e.createElement(
|
|
471
|
+
return /* @__PURE__ */ e.createElement($a, { ...s });
|
|
472
472
|
case "threads":
|
|
473
|
-
return /* @__PURE__ */ e.createElement(
|
|
473
|
+
return /* @__PURE__ */ e.createElement(Aa, { ...s });
|
|
474
474
|
case "tiktok":
|
|
475
|
-
return /* @__PURE__ */ e.createElement(
|
|
475
|
+
return /* @__PURE__ */ e.createElement(Ha, { ...s });
|
|
476
476
|
case "youtube":
|
|
477
|
-
return /* @__PURE__ */ e.createElement(
|
|
477
|
+
return /* @__PURE__ */ e.createElement(Ba, { ...s });
|
|
478
478
|
default:
|
|
479
|
-
return /* @__PURE__ */ e.createElement(
|
|
479
|
+
return /* @__PURE__ */ e.createElement(Vt, { ...s });
|
|
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-${g}`, "data-artifactuse-theme": n }, p(), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-bar" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-platform-badge" }, /* @__PURE__ */ e.createElement("span", null, Ma[g] || g)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-right" }, /* @__PURE__ */ e.createElement("span", { className: `artifactuse-social-char-counter ${_}` }, R, "/", A), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-social-copy-btn", onClick: L }, l))));
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function Ia({
|
|
485
485
|
isOpen: t = !1,
|
|
486
|
-
type:
|
|
486
|
+
type: n = "image",
|
|
487
487
|
src: c = "",
|
|
488
488
|
alt: l = "",
|
|
489
489
|
caption: i = "",
|
|
490
490
|
onClose: u,
|
|
491
|
-
className:
|
|
491
|
+
className: g = ""
|
|
492
492
|
}) {
|
|
493
|
-
const
|
|
494
|
-
|
|
493
|
+
const v = F(null), [o, a] = y(!1), [x, S] = y(!1);
|
|
494
|
+
I(() => (S(!0), () => S(!1)), []), I(() => {
|
|
495
495
|
var p;
|
|
496
|
-
return t ? (document.body.style.overflow = "hidden", (p =
|
|
496
|
+
return t ? (document.body.style.overflow = "hidden", (p = v.current) == null || p.focus()) : (document.body.style.overflow = "", a(!1)), () => {
|
|
497
497
|
document.body.style.overflow = "";
|
|
498
498
|
};
|
|
499
|
-
}, [t]),
|
|
499
|
+
}, [t]), I(() => {
|
|
500
500
|
function p(s) {
|
|
501
501
|
s.key === "Escape" && t && u && u();
|
|
502
502
|
}
|
|
503
503
|
return document.addEventListener("keydown", p), () => document.removeEventListener("keydown", p);
|
|
504
504
|
}, [t, u]);
|
|
505
|
-
const
|
|
505
|
+
const A = d(() => {
|
|
506
506
|
a(!1), u && u();
|
|
507
|
-
}, [u]),
|
|
508
|
-
|
|
509
|
-
}, [
|
|
507
|
+
}, [u]), R = d(() => {
|
|
508
|
+
n === "image" && a((p) => !p);
|
|
509
|
+
}, [n]), _ = d(() => {
|
|
510
510
|
const p = document.createElement("a");
|
|
511
511
|
p.href = c, p.download = l || "download", document.body.appendChild(p), p.click(), document.body.removeChild(p);
|
|
512
512
|
}, [c, l]);
|
|
513
|
-
if (!t || !
|
|
513
|
+
if (!t || !x)
|
|
514
514
|
return null;
|
|
515
|
-
const
|
|
515
|
+
const L = /* @__PURE__ */ e.createElement(
|
|
516
516
|
"div",
|
|
517
517
|
{
|
|
518
|
-
ref:
|
|
519
|
-
className: `artifactuse-viewer-overlay ${
|
|
520
|
-
onClick:
|
|
518
|
+
ref: v,
|
|
519
|
+
className: `artifactuse-viewer-overlay ${g}`,
|
|
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: (p) => p.stopPropagation() },
|
|
525
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-content", onClick: (p) => p.stopPropagation() }, n === "image" && /* @__PURE__ */ e.createElement(
|
|
526
526
|
"img",
|
|
527
527
|
{
|
|
528
528
|
src: c,
|
|
529
529
|
alt: l,
|
|
530
530
|
className: `artifactuse-viewer-image ${o ? "artifactuse-viewer-image--zoomed" : ""}`,
|
|
531
|
-
onClick:
|
|
531
|
+
onClick: R
|
|
532
532
|
}
|
|
533
|
-
),
|
|
533
|
+
), n === "pdf" && /* @__PURE__ */ e.createElement(
|
|
534
534
|
"iframe",
|
|
535
535
|
{
|
|
536
536
|
src: c,
|
|
@@ -541,15 +541,15 @@ function xa({
|
|
|
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" }))
|
|
548
|
-
),
|
|
548
|
+
), n === "image" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-controls" }, /* @__PURE__ */ e.createElement(
|
|
549
549
|
"button",
|
|
550
550
|
{
|
|
551
551
|
className: "artifactuse-viewer-control",
|
|
552
|
-
onClick:
|
|
552
|
+
onClick: R,
|
|
553
553
|
title: o ? "Zoom out" : "Zoom in"
|
|
554
554
|
},
|
|
555
555
|
o ? /* @__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" }))
|
|
@@ -563,13 +563,13 @@ function xa({
|
|
|
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
|
)), i && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-caption" }, i))
|
|
565
565
|
);
|
|
566
|
-
return
|
|
566
|
+
return Na(L, document.body);
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function Va(t) {
|
|
569
569
|
if (!t) return null;
|
|
570
570
|
try {
|
|
571
|
-
const
|
|
572
|
-
return JSON.parse(
|
|
571
|
+
const n = decodeURIComponent(escape(atob(t)));
|
|
572
|
+
return JSON.parse(n);
|
|
573
573
|
} catch {
|
|
574
574
|
try {
|
|
575
575
|
const c = t.replace(/ /g, `
|
|
@@ -580,70 +580,70 @@ function Ca(t) {
|
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
function
|
|
584
|
-
const
|
|
585
|
-
if (!t) return
|
|
583
|
+
function Wa(t) {
|
|
584
|
+
const n = [];
|
|
585
|
+
if (!t) return n;
|
|
586
586
|
const c = /<div\s+class="artifactuse-placeholder[^"]*"[^>]*data-artifact-id="([^"]+)"[^>]*data-artifact-type="([^"]+)"[^>]*data-artifact=["']([^"']*)["'][^>]*><\/div>/gi;
|
|
587
587
|
let l = 0, i;
|
|
588
588
|
for (; (i = c.exec(t)) !== null; ) {
|
|
589
589
|
if (i.index > l) {
|
|
590
|
-
const
|
|
591
|
-
|
|
590
|
+
const v = t.slice(l, i.index);
|
|
591
|
+
v.trim() && n.push({ type: "html", content: v });
|
|
592
592
|
}
|
|
593
|
-
const u =
|
|
594
|
-
u && (
|
|
593
|
+
const u = Va(i[3]), g = i[2];
|
|
594
|
+
u && (g === "form" && u.isInline ? n.push({ type: "form", artifact: u }) : g === "social" ? n.push({ type: "social", artifact: u }) : n.push({ type: "panel", artifact: u })), l = i.index + i[0].length;
|
|
595
595
|
}
|
|
596
596
|
if (l < t.length) {
|
|
597
597
|
const u = t.slice(l);
|
|
598
|
-
u.trim() &&
|
|
598
|
+
u.trim() && n.push({ type: "html", content: u });
|
|
599
599
|
}
|
|
600
|
-
return
|
|
600
|
+
return n.length === 0 && t.trim() && n.push({ type: "html", content: t }), n;
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function Ra() {
|
|
603
603
|
return `msg-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function za({
|
|
606
606
|
content: t,
|
|
607
|
-
messageId:
|
|
607
|
+
messageId: n = Ra(),
|
|
608
608
|
inlineCards: c = !0,
|
|
609
609
|
typing: l = !1,
|
|
610
610
|
isLastMessage: i = !1,
|
|
611
611
|
// Whether this is the last/most recent message
|
|
612
612
|
inlinePreview: u = null,
|
|
613
|
-
inlineCode:
|
|
614
|
-
tabs:
|
|
613
|
+
inlineCode: g = null,
|
|
614
|
+
tabs: v = null,
|
|
615
615
|
viewMode: o = null,
|
|
616
616
|
onArtifactDetected: a,
|
|
617
|
-
onArtifactOpen:
|
|
618
|
-
onArtifactCopy:
|
|
619
|
-
onArtifactDownload:
|
|
620
|
-
onFormSubmit:
|
|
617
|
+
onArtifactOpen: x,
|
|
618
|
+
onArtifactCopy: S,
|
|
619
|
+
onArtifactDownload: A,
|
|
620
|
+
onFormSubmit: R,
|
|
621
621
|
onFormCancel: _,
|
|
622
|
-
onFormButtonClick:
|
|
622
|
+
onFormButtonClick: L,
|
|
623
623
|
onSocialCopy: p,
|
|
624
624
|
onMediaOpen: s,
|
|
625
|
-
className:
|
|
625
|
+
className: Z = ""
|
|
626
626
|
}) {
|
|
627
|
-
var
|
|
627
|
+
var ke;
|
|
628
628
|
const {
|
|
629
|
-
processMessage:
|
|
629
|
+
processMessage: Y,
|
|
630
630
|
openArtifact: z,
|
|
631
|
-
state:
|
|
632
|
-
getTheme:
|
|
633
|
-
instance:
|
|
634
|
-
} =
|
|
635
|
-
|
|
636
|
-
l &&
|
|
631
|
+
state: V,
|
|
632
|
+
getTheme: se,
|
|
633
|
+
instance: U
|
|
634
|
+
} = Ae(), q = F(null), H = F(null), G = F(null), _e = F(l), [ie, ye] = y(""), [oe, de] = y([]), [fe, be] = y(!1), [pe, m] = y(!1), [$, b] = y("image"), [k, P] = y(""), [M, Ee] = y(""), [Le, He] = y(""), Ne = N(() => typeof se == "function" ? se() : "dark", [se]), tt = (V == null ? void 0 : V.activeArtifactId) || null, te = c ?? ((ke = U == null ? void 0 : U.config) == null ? void 0 : ke.inlineCards) ?? !0, De = N(() => Wa(ie), [ie]), Be = N(() => fe || i ? "active" : "inactive", [fe, i]);
|
|
635
|
+
I(() => {
|
|
636
|
+
l && be(!0);
|
|
637
637
|
}, [l]);
|
|
638
|
-
const
|
|
639
|
-
b(
|
|
640
|
-
}, [s]),
|
|
641
|
-
m(!1),
|
|
642
|
-
}, []),
|
|
638
|
+
const le = d((h) => {
|
|
639
|
+
b(h.type || "image"), P(h.src || ""), Ee(h.alt || ""), He(h.caption || ""), m(!0), s && s(h);
|
|
640
|
+
}, [s]), Te = d(() => {
|
|
641
|
+
m(!1), P(""), Ee(""), He("");
|
|
642
|
+
}, []), Fe = d(() => {
|
|
643
643
|
if (!H.current) return;
|
|
644
644
|
H.current.querySelectorAll('img[data-lightbox="true"]').forEach((f) => {
|
|
645
|
-
f._lightboxHandler && f.removeEventListener("click", f._lightboxHandler), f._lightboxHandler = (
|
|
646
|
-
|
|
645
|
+
f._lightboxHandler && f.removeEventListener("click", f._lightboxHandler), f._lightboxHandler = (B) => {
|
|
646
|
+
B.preventDefault(), B.stopPropagation(), le({
|
|
647
647
|
type: "image",
|
|
648
648
|
src: f.src,
|
|
649
649
|
alt: f.alt || "",
|
|
@@ -651,30 +651,30 @@ function Ma({
|
|
|
651
651
|
});
|
|
652
652
|
}, f.addEventListener("click", f._lightboxHandler), f.style.cursor = "zoom-in";
|
|
653
653
|
}), H.current.querySelectorAll(".artifactuse-image-container img").forEach((f) => {
|
|
654
|
-
f._lightboxHandler || (f._lightboxHandler = (
|
|
655
|
-
|
|
656
|
-
const
|
|
657
|
-
|
|
654
|
+
f._lightboxHandler || (f._lightboxHandler = (B) => {
|
|
655
|
+
B.preventDefault(), B.stopPropagation();
|
|
656
|
+
const j = f.closest(".artifactuse-image-container"), W = j == null ? void 0 : j.querySelector(".artifactuse-image-caption"), ee = (W == null ? void 0 : W.textContent) || f.dataset.caption || f.alt || "";
|
|
657
|
+
le({
|
|
658
658
|
type: "image",
|
|
659
659
|
src: f.src,
|
|
660
660
|
alt: f.alt || "",
|
|
661
|
-
caption:
|
|
661
|
+
caption: ee
|
|
662
662
|
});
|
|
663
663
|
}, f.addEventListener("click", f._lightboxHandler), f.style.cursor = "zoom-in");
|
|
664
664
|
}), H.current.querySelectorAll(".artifactuse-gallery-item img, .artifactuse-image-gallery img").forEach((f) => {
|
|
665
|
-
f._lightboxHandler || (f._lightboxHandler = (
|
|
666
|
-
|
|
667
|
-
const
|
|
668
|
-
|
|
665
|
+
f._lightboxHandler || (f._lightboxHandler = (B) => {
|
|
666
|
+
B.preventDefault(), B.stopPropagation();
|
|
667
|
+
const j = f.closest(".artifactuse-gallery-item"), W = j == null ? void 0 : j.querySelector(".artifactuse-gallery-caption"), ee = (W == null ? void 0 : W.textContent) || f.dataset.caption || f.alt || "";
|
|
668
|
+
le({
|
|
669
669
|
type: "image",
|
|
670
670
|
src: f.src,
|
|
671
671
|
alt: f.alt || "",
|
|
672
|
-
caption:
|
|
672
|
+
caption: ee
|
|
673
673
|
});
|
|
674
674
|
}, f.addEventListener("click", f._lightboxHandler), f.style.cursor = "zoom-in");
|
|
675
675
|
}), H.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((f) => {
|
|
676
|
-
f._pdfHandler && f.removeEventListener("click", f._pdfHandler), f._pdfHandler = (
|
|
677
|
-
|
|
676
|
+
f._pdfHandler && f.removeEventListener("click", f._pdfHandler), f._pdfHandler = (B) => {
|
|
677
|
+
B.preventDefault(), B.stopPropagation(), le({
|
|
678
678
|
type: "pdf",
|
|
679
679
|
src: f.href,
|
|
680
680
|
alt: f.textContent || "PDF Document",
|
|
@@ -682,128 +682,128 @@ function Ma({
|
|
|
682
682
|
});
|
|
683
683
|
}, f.addEventListener("click", f._pdfHandler);
|
|
684
684
|
}), H.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((f) => {
|
|
685
|
-
var
|
|
685
|
+
var j;
|
|
686
686
|
f._pdfHandler && f.removeEventListener("click", f._pdfHandler);
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
|
|
687
|
+
const B = f.dataset.pdfSrc || ((j = f.querySelector("iframe")) == null ? void 0 : j.src) || "";
|
|
688
|
+
B && (f._pdfHandler = (W) => {
|
|
689
|
+
W.preventDefault(), W.stopPropagation(), le({
|
|
690
690
|
type: "pdf",
|
|
691
|
-
src:
|
|
691
|
+
src: B,
|
|
692
692
|
alt: "PDF Document",
|
|
693
693
|
caption: f.dataset.caption || ""
|
|
694
694
|
});
|
|
695
695
|
}, f.addEventListener("click", f._pdfHandler), f.style.cursor = "pointer");
|
|
696
696
|
}), H.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((f) => {
|
|
697
|
-
f._clickHandler && f.removeEventListener("click", f._clickHandler), f._clickHandler = (
|
|
698
|
-
if (
|
|
699
|
-
const
|
|
700
|
-
|
|
697
|
+
f._clickHandler && f.removeEventListener("click", f._clickHandler), f._clickHandler = (B) => {
|
|
698
|
+
if (B.target.closest(".artifactuse-video-play-button")) return;
|
|
699
|
+
const j = f.dataset.videoUrl || f.dataset.url;
|
|
700
|
+
j && window.open(j, "_blank", "noopener,noreferrer");
|
|
701
701
|
}, f.addEventListener("click", f._clickHandler);
|
|
702
702
|
});
|
|
703
|
-
}, [
|
|
703
|
+
}, [le]), Ue = d(() => {
|
|
704
704
|
if (!H.current) return;
|
|
705
|
-
H.current.querySelectorAll("img").forEach((
|
|
706
|
-
|
|
707
|
-
}), H.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((
|
|
708
|
-
|
|
709
|
-
}), H.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((
|
|
710
|
-
|
|
711
|
-
}), H.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((
|
|
712
|
-
|
|
705
|
+
H.current.querySelectorAll("img").forEach((T) => {
|
|
706
|
+
T._lightboxHandler && (T.removeEventListener("click", T._lightboxHandler), delete T._lightboxHandler);
|
|
707
|
+
}), H.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((T) => {
|
|
708
|
+
T._pdfHandler && (T.removeEventListener("click", T._pdfHandler), delete T._pdfHandler);
|
|
709
|
+
}), H.current.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((T) => {
|
|
710
|
+
T._pdfHandler && (T.removeEventListener("click", T._pdfHandler), delete T._pdfHandler);
|
|
711
|
+
}), H.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((T) => {
|
|
712
|
+
T._clickHandler && (T.removeEventListener("click", T._clickHandler), delete T._clickHandler);
|
|
713
713
|
});
|
|
714
|
-
}, []),
|
|
715
|
-
|
|
716
|
-
if (
|
|
714
|
+
}, []), we = d(() => {
|
|
715
|
+
G.current && clearTimeout(G.current), G.current = setTimeout(async () => {
|
|
716
|
+
if (U != null && U.initializeContent && H.current)
|
|
717
717
|
try {
|
|
718
|
-
await
|
|
719
|
-
} catch (
|
|
720
|
-
console.error("Failed to initialize content:",
|
|
718
|
+
await U.initializeContent(H.current);
|
|
719
|
+
} catch (h) {
|
|
720
|
+
console.error("Failed to initialize content:", h);
|
|
721
721
|
}
|
|
722
|
-
|
|
722
|
+
Fe();
|
|
723
723
|
}, 100);
|
|
724
|
-
}, [
|
|
725
|
-
|
|
724
|
+
}, [U, Fe]);
|
|
725
|
+
I(() => {
|
|
726
726
|
if (t) {
|
|
727
|
-
const
|
|
727
|
+
const h = Y(t, n, {
|
|
728
728
|
inlinePreview: u,
|
|
729
|
-
inlineCode:
|
|
730
|
-
tabs:
|
|
729
|
+
inlineCode: g,
|
|
730
|
+
tabs: v,
|
|
731
731
|
viewMode: o
|
|
732
732
|
});
|
|
733
|
-
|
|
733
|
+
ye(h.html), de(h.artifacts), h.artifacts.length > 0 && a && a(h.artifacts), l || we();
|
|
734
734
|
}
|
|
735
|
-
}, [t,
|
|
736
|
-
|
|
737
|
-
}, [l,
|
|
738
|
-
|
|
735
|
+
}, [t, n, Y, l, we, a]), I(() => {
|
|
736
|
+
_e.current === !0 && l === !1 && we(), _e.current = l;
|
|
737
|
+
}, [l, we]), I(() => (l && be(!0), l || we(), () => {
|
|
738
|
+
G.current && clearTimeout(G.current), Ue();
|
|
739
739
|
}), []);
|
|
740
|
-
const
|
|
741
|
-
const
|
|
742
|
-
if (
|
|
743
|
-
if (
|
|
744
|
-
const
|
|
745
|
-
if (
|
|
746
|
-
const
|
|
747
|
-
|
|
740
|
+
const Ie = d((h) => {
|
|
741
|
+
const ce = h.target.closest(".artifactuse-inline-preview");
|
|
742
|
+
if (ce) {
|
|
743
|
+
if (ce.dataset.nonClickable) return;
|
|
744
|
+
const ue = ce.dataset.artifactId;
|
|
745
|
+
if (ue) {
|
|
746
|
+
const he = V.artifacts.find((T) => T.id === ue);
|
|
747
|
+
he && (z(he), x && x(he));
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
}, [
|
|
751
|
-
z(
|
|
752
|
-
}, [z,
|
|
753
|
-
|
|
754
|
-
}, [
|
|
755
|
-
|
|
756
|
-
}, [
|
|
757
|
-
|
|
758
|
-
}, [
|
|
759
|
-
_ && _(
|
|
760
|
-
}, [_]),
|
|
761
|
-
|
|
762
|
-
}, [
|
|
763
|
-
p && p(
|
|
764
|
-
}, [p]),
|
|
765
|
-
switch (
|
|
750
|
+
}, [V, z, x]), at = d((h) => {
|
|
751
|
+
z(h), x && x(h);
|
|
752
|
+
}, [z, x]), qe = d((h) => {
|
|
753
|
+
S && S(h);
|
|
754
|
+
}, [S]), Q = d((h) => {
|
|
755
|
+
A && A(h);
|
|
756
|
+
}, [A]), Ve = d((h) => {
|
|
757
|
+
R && R(h);
|
|
758
|
+
}, [R]), Me = d((h) => {
|
|
759
|
+
_ && _(h);
|
|
760
|
+
}, [_]), We = d((h) => {
|
|
761
|
+
L && L(h);
|
|
762
|
+
}, [L]), ve = d((h) => {
|
|
763
|
+
p && p(h);
|
|
764
|
+
}, [p]), rt = (h, ce) => {
|
|
765
|
+
switch (h.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-${ce}`,
|
|
771
|
+
dangerouslySetInnerHTML: { __html: h.content }
|
|
772
772
|
}
|
|
773
773
|
);
|
|
774
774
|
case "form":
|
|
775
|
-
return
|
|
776
|
-
|
|
775
|
+
return h.artifact.isInline ? /* @__PURE__ */ e.createElement(
|
|
776
|
+
Ca,
|
|
777
777
|
{
|
|
778
|
-
key: `form-${
|
|
779
|
-
artifact:
|
|
780
|
-
theme:
|
|
781
|
-
initialState:
|
|
782
|
-
onSubmit:
|
|
783
|
-
onCancel:
|
|
784
|
-
onButtonClick:
|
|
778
|
+
key: `form-${h.artifact.id}`,
|
|
779
|
+
artifact: h.artifact,
|
|
780
|
+
theme: Ne,
|
|
781
|
+
initialState: Be,
|
|
782
|
+
onSubmit: Ve,
|
|
783
|
+
onCancel: Me,
|
|
784
|
+
onButtonClick: We
|
|
785
785
|
}
|
|
786
786
|
) : null;
|
|
787
787
|
case "social":
|
|
788
788
|
return /* @__PURE__ */ e.createElement(
|
|
789
|
-
|
|
789
|
+
Fa,
|
|
790
790
|
{
|
|
791
|
-
key: `social-${
|
|
792
|
-
artifact:
|
|
793
|
-
theme:
|
|
794
|
-
onCopy:
|
|
791
|
+
key: `social-${h.artifact.id}`,
|
|
792
|
+
artifact: h.artifact,
|
|
793
|
+
theme: Ne,
|
|
794
|
+
onCopy: ve
|
|
795
795
|
}
|
|
796
796
|
);
|
|
797
797
|
case "panel":
|
|
798
|
-
return
|
|
799
|
-
|
|
798
|
+
return te ? /* @__PURE__ */ e.createElement(
|
|
799
|
+
wa,
|
|
800
800
|
{
|
|
801
|
-
key: `panel-${
|
|
802
|
-
artifact:
|
|
803
|
-
isActive:
|
|
804
|
-
onOpen:
|
|
805
|
-
onCopy:
|
|
806
|
-
onDownload:
|
|
801
|
+
key: `panel-${h.artifact.id}`,
|
|
802
|
+
artifact: h.artifact,
|
|
803
|
+
isActive: tt === h.artifact.id,
|
|
804
|
+
onOpen: at,
|
|
805
|
+
onCopy: qe,
|
|
806
|
+
onDownload: Q
|
|
807
807
|
}
|
|
808
808
|
) : null;
|
|
809
809
|
default:
|
|
@@ -813,424 +813,452 @@ 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 ${Z}`.trim()
|
|
818
818
|
},
|
|
819
|
-
/* @__PURE__ */ e.createElement("div", { ref: H, className: "artifactuse-message-content", onClick:
|
|
819
|
+
/* @__PURE__ */ e.createElement("div", { ref: H, className: "artifactuse-message-content", onClick: Ie }, De.map(rt)),
|
|
820
820
|
/* @__PURE__ */ e.createElement(
|
|
821
|
-
|
|
821
|
+
Ia,
|
|
822
822
|
{
|
|
823
|
-
isOpen:
|
|
824
|
-
type:
|
|
825
|
-
src:
|
|
826
|
-
alt:
|
|
827
|
-
caption:
|
|
828
|
-
onClose:
|
|
823
|
+
isOpen: pe,
|
|
824
|
+
type: $,
|
|
825
|
+
src: k,
|
|
826
|
+
alt: M,
|
|
827
|
+
caption: Le,
|
|
828
|
+
onClose: Te
|
|
829
829
|
}
|
|
830
830
|
)
|
|
831
831
|
);
|
|
832
832
|
}
|
|
833
|
-
|
|
833
|
+
za.propTypes = {
|
|
834
834
|
/** The raw message content (markdown/HTML from AI) */
|
|
835
|
-
content: (t,
|
|
836
|
-
if (typeof t[
|
|
837
|
-
return new Error(`${
|
|
835
|
+
content: (t, n) => {
|
|
836
|
+
if (typeof t[n] != "string")
|
|
837
|
+
return new Error(`${n} must be a string`);
|
|
838
838
|
},
|
|
839
839
|
/** Unique message ID */
|
|
840
|
-
messageId: (t,
|
|
841
|
-
if (t[
|
|
842
|
-
return new Error(`${
|
|
840
|
+
messageId: (t, n) => {
|
|
841
|
+
if (t[n] !== void 0 && typeof t[n] != "string")
|
|
842
|
+
return new Error(`${n} must be a string`);
|
|
843
843
|
},
|
|
844
844
|
/** Whether to show artifact cards inline */
|
|
845
|
-
inlineCards: (t,
|
|
846
|
-
if (t[
|
|
847
|
-
return new Error(`${
|
|
845
|
+
inlineCards: (t, n) => {
|
|
846
|
+
if (t[n] !== void 0 && typeof t[n] != "boolean")
|
|
847
|
+
return new Error(`${n} must be a boolean`);
|
|
848
848
|
},
|
|
849
849
|
/** Whether the message is still being typed/streamed */
|
|
850
|
-
typing: (t,
|
|
851
|
-
if (t[
|
|
852
|
-
return new Error(`${
|
|
850
|
+
typing: (t, n) => {
|
|
851
|
+
if (t[n] !== void 0 && typeof t[n] != "boolean")
|
|
852
|
+
return new Error(`${n} must be a boolean`);
|
|
853
853
|
},
|
|
854
854
|
/** Whether this is the last/most recent message in the conversation */
|
|
855
|
-
isLastMessage: (t,
|
|
856
|
-
if (t[
|
|
857
|
-
return new Error(`${
|
|
855
|
+
isLastMessage: (t, n) => {
|
|
856
|
+
if (t[n] !== void 0 && typeof t[n] != "boolean")
|
|
857
|
+
return new Error(`${n} must be a boolean`);
|
|
858
858
|
},
|
|
859
859
|
/** Override global inlinePreview config for this message */
|
|
860
|
-
inlinePreview: (t,
|
|
861
|
-
if (t[
|
|
862
|
-
return new Error(`${
|
|
860
|
+
inlinePreview: (t, n) => {
|
|
861
|
+
if (t[n] !== void 0 && t[n] !== null && typeof t[n] != "object")
|
|
862
|
+
return new Error(`${n} must be an object or null`);
|
|
863
863
|
},
|
|
864
864
|
/** Show full inline code (no extraction) for listed languages */
|
|
865
|
-
inlineCode: (t,
|
|
866
|
-
if (t[
|
|
867
|
-
return new Error(`${
|
|
865
|
+
inlineCode: (t, n) => {
|
|
866
|
+
if (t[n] !== void 0 && t[n] !== null && typeof t[n] != "object")
|
|
867
|
+
return new Error(`${n} must be an object or null`);
|
|
868
868
|
},
|
|
869
869
|
/** Override visible panel tabs for artifacts from this message */
|
|
870
|
-
tabs: (t,
|
|
871
|
-
if (t[
|
|
872
|
-
return new Error(`${
|
|
870
|
+
tabs: (t, n) => {
|
|
871
|
+
if (t[n] !== void 0 && t[n] !== null && !Array.isArray(t[n]))
|
|
872
|
+
return new Error(`${n} must be an array or null`);
|
|
873
873
|
},
|
|
874
874
|
/** Override initial panel view mode for artifacts from this message */
|
|
875
|
-
viewMode: (t,
|
|
876
|
-
if (t[
|
|
877
|
-
return new Error(`${
|
|
875
|
+
viewMode: (t, n) => {
|
|
876
|
+
if (t[n] !== void 0 && t[n] !== null && typeof t[n] != "string")
|
|
877
|
+
return new Error(`${n} must be a string or null`);
|
|
878
878
|
}
|
|
879
879
|
};
|
|
880
|
-
|
|
880
|
+
const Wt = ["image", "audio", "video", "pdf", "font", "binary"];
|
|
881
|
+
function Za({
|
|
881
882
|
onAIRequest: t,
|
|
882
|
-
onSave:
|
|
883
|
+
onSave: n,
|
|
883
884
|
onExport: c,
|
|
884
885
|
className: l = "",
|
|
885
886
|
panelWidth: i,
|
|
886
887
|
splitPosition: u,
|
|
887
|
-
externalPreview:
|
|
888
|
-
consolePanel:
|
|
888
|
+
externalPreview: g,
|
|
889
|
+
consolePanel: v
|
|
889
890
|
}) {
|
|
890
|
-
var
|
|
891
|
+
var $t, At;
|
|
891
892
|
const {
|
|
892
893
|
state: o,
|
|
893
894
|
activeArtifact: a,
|
|
894
|
-
artifactCount:
|
|
895
|
-
hasArtifacts:
|
|
896
|
-
closePanel:
|
|
897
|
-
toggleFullscreen:
|
|
895
|
+
artifactCount: x,
|
|
896
|
+
hasArtifacts: S,
|
|
897
|
+
closePanel: A,
|
|
898
|
+
toggleFullscreen: R,
|
|
898
899
|
setViewMode: _,
|
|
899
|
-
getPanelUrl:
|
|
900
|
+
getPanelUrl: L,
|
|
900
901
|
openArtifact: p,
|
|
901
902
|
instance: s
|
|
902
|
-
} =
|
|
903
|
+
} = Ae(), Z = F(null), Y = F(null), z = F(null), V = F(null), se = F(null), U = F(null), q = F(null), [H, G] = y(!1), [_e, ie] = y(!1), [ye, oe] = y(!0), [de, fe] = y(!1), [be, pe] = y(!1), [m, $] = y(!1), [b, k] = y(!1), [P, M] = y("options"), [Ee, Le] = y(""), [He, Ne] = y(null), [tt, te] = y(""), [De, Be] = y(!1), [le, Te] = y(!1), [Fe, Ue] = y([]), [we, Ie] = y(!1), [at, qe] = y(""), [Q, Ve] = y([]), [Me, We] = y(!1), [ve, rt] = y(/* @__PURE__ */ new Set(["log", "warn", "error", "info"])), ke = F(null), [h, ce] = y(
|
|
903
904
|
() => {
|
|
904
|
-
var
|
|
905
|
-
return Math.min(Math.max(i ?? ((
|
|
905
|
+
var r;
|
|
906
|
+
return Math.min(Math.max(i ?? ((r = s == null ? void 0 : s.config) == null ? void 0 : r.panelWidth) ?? 65, 25), 75);
|
|
906
907
|
}
|
|
907
|
-
), [
|
|
908
|
+
), [ue, he] = y(
|
|
908
909
|
() => {
|
|
909
|
-
var
|
|
910
|
-
return Math.min(Math.max(u ?? ((
|
|
910
|
+
var r;
|
|
911
|
+
return Math.min(Math.max(u ?? ((r = s == null ? void 0 : s.config) == null ? void 0 : r.splitPosition) ?? 50, 20), 80);
|
|
911
912
|
}
|
|
912
|
-
),
|
|
913
|
-
|
|
914
|
-
i !== void 0 &&
|
|
915
|
-
}, [i]),
|
|
916
|
-
u !== void 0 &&
|
|
913
|
+
), T = F(null), Pe = F(null);
|
|
914
|
+
I(() => {
|
|
915
|
+
i !== void 0 && ce(Math.min(Math.max(i, 25), 75));
|
|
916
|
+
}, [i]), I(() => {
|
|
917
|
+
u !== void 0 && he(Math.min(Math.max(u, 20), 80));
|
|
917
918
|
}, [u]);
|
|
918
|
-
const f =
|
|
919
|
+
const f = F(null), B = F(null), j = F(null), W = F({}), ee = F(null), gt = N(() => a ? Qe(a.language) : "", [a]), Ut = N(() => a ? Et(a.language) : "", [a]), ge = N(() => {
|
|
919
920
|
if (!a) return null;
|
|
920
|
-
let
|
|
921
|
-
return
|
|
922
|
-
}, [a,
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
),
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
),
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
921
|
+
let r = L(a);
|
|
922
|
+
return r && a._refreshToken && (r += (r.includes("?") ? "&" : "?") + "_t=" + a._refreshToken), r;
|
|
923
|
+
}, [a, L]), Re = N(() => a ? ha(a.language) : "plaintext", [a]), Se = N(() => Wt.includes(a == null ? void 0 : a.language), [a]), ae = N(() => Se ? a.language : null, [Se, a]), ze = N(() => ae !== "font" || !a ? null : "apfont_" + a.id, [ae, a]), qt = N(() => {
|
|
924
|
+
if (ae !== "binary" || !(a != null && a.code)) return "";
|
|
925
|
+
try {
|
|
926
|
+
const r = atob(a.code.slice(0, 684)), E = new Uint8Array(r.length);
|
|
927
|
+
for (let w = 0; w < r.length; w++) E[w] = r.charCodeAt(w);
|
|
928
|
+
const C = [];
|
|
929
|
+
for (let w = 0; w < Math.min(E.length, 512); w += 16) {
|
|
930
|
+
const J = E.slice(w, w + 16), xe = Array.from(J).map((X) => X.toString(16).padStart(2, "0")).join(" "), re = Array.from(J).map((X) => X >= 32 && X < 127 ? String.fromCharCode(X) : ".").join("");
|
|
931
|
+
C.push(`${w.toString(16).padStart(8, "0")} ${xe.padEnd(47)} |${re}|`);
|
|
932
|
+
}
|
|
933
|
+
return C.join(`
|
|
934
|
+
`);
|
|
935
|
+
} catch {
|
|
936
|
+
return "";
|
|
937
|
+
}
|
|
938
|
+
}, [ae, a]), O = N(() => o.artifacts.filter((r) => !r.isInline), [o.artifacts]), me = N(() => a ? O.findIndex((r) => r.id === a.id) : -1, [a, O]), nt = N(() => {
|
|
939
|
+
var r;
|
|
940
|
+
return ((r = s == null ? void 0 : s.config) == null ? void 0 : r.branding) !== !1;
|
|
941
|
+
}, [s]), jt = N(() => {
|
|
942
|
+
var r;
|
|
943
|
+
return ge ? (a == null ? void 0 : a.externalPreview) !== void 0 ? a.externalPreview : g !== void 0 ? g : ((r = s == null ? void 0 : s.config) == null ? void 0 : r.externalPreview) ?? !1 : !1;
|
|
944
|
+
}, [a, g, s, ge]), st = N(
|
|
945
|
+
() => Q.filter((r) => r.type === "error").length,
|
|
946
|
+
[Q]
|
|
947
|
+
), _t = N(
|
|
948
|
+
() => Q.filter((r) => r.type === "warn").length,
|
|
949
|
+
[Q]
|
|
950
|
+
), yt = N(
|
|
951
|
+
() => Q.filter((r) => r.type === "info").length,
|
|
952
|
+
[Q]
|
|
953
|
+
), bt = N(
|
|
954
|
+
() => Q.filter((r) => r.type === "log").length,
|
|
955
|
+
[Q]
|
|
956
|
+
), Ot = N(
|
|
957
|
+
() => Q.filter((r) => ve.has(r.type)),
|
|
958
|
+
[Q, ve]
|
|
959
|
+
), Jt = (v ?? (($t = s == null ? void 0 : s.config) == null ? void 0 : $t.consolePanel)) !== !1 && Q.length > 0, je = d((r) => {
|
|
960
|
+
if (!r || !r.code) return null;
|
|
961
|
+
if (W.current[r.id]) return W.current[r.id];
|
|
962
|
+
const E = ya(r.code, Bt(r.fileExtension || r.language));
|
|
963
|
+
return W.current[r.id] = E, E;
|
|
964
|
+
}, []), Nt = d((r) => {
|
|
965
|
+
W.current[r] && (Ft(W.current[r]), delete W.current[r]);
|
|
966
|
+
}, []);
|
|
967
|
+
function Oe(r) {
|
|
968
|
+
rt((E) => {
|
|
969
|
+
const C = new Set(E);
|
|
970
|
+
return C.has(r) ? C.delete(r) : C.add(r), C;
|
|
948
971
|
});
|
|
949
972
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
const
|
|
953
|
-
return
|
|
954
|
-
}),
|
|
955
|
-
}) : void 0, [s]),
|
|
956
|
-
|
|
957
|
-
}, [a == null ? void 0 : a.id]),
|
|
958
|
-
|
|
959
|
-
}, [
|
|
960
|
-
const
|
|
961
|
-
var
|
|
962
|
-
return ((
|
|
963
|
-
}, [s]),
|
|
964
|
-
var
|
|
965
|
-
return ((
|
|
966
|
-
}, [s]),
|
|
967
|
-
var
|
|
968
|
-
return ((
|
|
973
|
+
I(() => s ? s.on("console:log", ({ entry: E }) => {
|
|
974
|
+
Ve((C) => {
|
|
975
|
+
const w = [...C, E];
|
|
976
|
+
return w.length > 500 ? w.slice(-500) : w;
|
|
977
|
+
}), E.type === "error" && We(!0);
|
|
978
|
+
}) : void 0, [s]), I(() => {
|
|
979
|
+
Ve([]), We(!1);
|
|
980
|
+
}, [a == null ? void 0 : a.id]), I(() => {
|
|
981
|
+
ke.current && Me && (ke.current.scrollTop = ke.current.scrollHeight);
|
|
982
|
+
}, [Q, Me]);
|
|
983
|
+
const Xt = N(() => {
|
|
984
|
+
var r;
|
|
985
|
+
return ((r = s == null ? void 0 : s.share) == null ? void 0 : r.enabled) !== !1;
|
|
986
|
+
}, [s]), Je = N(() => {
|
|
987
|
+
var r;
|
|
988
|
+
return ((r = s == null ? void 0 : s.share) == null ? void 0 : r.isAuthenticated()) || !1;
|
|
989
|
+
}, [s]), wt = N(() => !a && !o.forceEmptyView ? Math.min(h, 30) : h, [a, h, o.forceEmptyView]), Xe = N(() => {
|
|
990
|
+
var r;
|
|
991
|
+
return ((r = s == null ? void 0 : s.config) == null ? void 0 : r.multiTab) === !0;
|
|
969
992
|
}, [s]);
|
|
970
|
-
|
|
971
|
-
const
|
|
972
|
-
|
|
973
|
-
}, [s]),
|
|
974
|
-
if (
|
|
993
|
+
N(() => Xe ? o.openTabs.map((r) => o.artifacts.find((E) => E.id === r)).filter(Boolean) : [], [Xe, o.openTabs, o.artifacts]);
|
|
994
|
+
const kt = d((r) => `<svg viewBox="0 0 24 24" fill="currentColor">${Et(r)}</svg>`, []), Zt = d(() => {
|
|
995
|
+
pe(!1), s.state.clearActiveArtifact();
|
|
996
|
+
}, [s]), Ze = d((r) => {
|
|
997
|
+
if (r.language !== "smartdiff") return null;
|
|
975
998
|
try {
|
|
976
|
-
const
|
|
977
|
-
if (
|
|
978
|
-
const
|
|
999
|
+
const E = JSON.parse(r.code);
|
|
1000
|
+
if (E.oldCode === void 0 || E.newCode === void 0) return null;
|
|
1001
|
+
const C = E.language || "plaintext", w = Ht() && window.Prism.languages[C], J = ga(E.oldCode, E.newCode).split(`
|
|
979
1002
|
`);
|
|
980
|
-
return { html:
|
|
981
|
-
const
|
|
982
|
-
return
|
|
1003
|
+
return { html: J.map((re) => {
|
|
1004
|
+
const X = re[0], ne = re.slice(1), Ce = w ? window.Prism.highlight(ne, w, C) : ne;
|
|
1005
|
+
return X === "-" ? `<span class="token deleted">${Ce}</span>` : X === "+" ? `<span class="token inserted">${Ce}</span>` : Ce;
|
|
983
1006
|
}).join(`
|
|
984
|
-
`), lineCount:
|
|
1007
|
+
`), lineCount: J.length };
|
|
985
1008
|
} catch {
|
|
986
1009
|
return null;
|
|
987
1010
|
}
|
|
988
|
-
}, []),
|
|
989
|
-
if (!
|
|
990
|
-
const
|
|
991
|
-
`).length,
|
|
992
|
-
|
|
993
|
-
}, [a,
|
|
994
|
-
if (
|
|
995
|
-
const
|
|
996
|
-
if (
|
|
997
|
-
|
|
1011
|
+
}, []), xt = d(() => {
|
|
1012
|
+
if (!V.current || !(a != null && a.code)) return;
|
|
1013
|
+
const r = Ze(a), E = r ? r.lineCount : a.code.split(`
|
|
1014
|
+
`).length, C = Array.from({ length: E }, (w, J) => `<div>${J + 1}</div>`).join("");
|
|
1015
|
+
V.current.innerHTML = C;
|
|
1016
|
+
}, [a, Ze]), Ct = d(() => {
|
|
1017
|
+
if (Y.current && Ht() && (a != null && a.code)) {
|
|
1018
|
+
const r = Ze(a);
|
|
1019
|
+
if (r)
|
|
1020
|
+
Y.current.innerHTML = r.html;
|
|
998
1021
|
else {
|
|
999
|
-
const
|
|
1000
|
-
|
|
1022
|
+
const E = window.Prism.languages[Re];
|
|
1023
|
+
E ? Y.current.innerHTML = window.Prism.highlight(
|
|
1001
1024
|
a.code,
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
) :
|
|
1025
|
+
E,
|
|
1026
|
+
Re
|
|
1027
|
+
) : Y.current.textContent = a.code;
|
|
1005
1028
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1029
|
+
Y.current.dataset.highlighted = "true", setTimeout(() => {
|
|
1030
|
+
Kt();
|
|
1008
1031
|
}, 0);
|
|
1009
1032
|
}
|
|
1010
|
-
}, [a == null ? void 0 : a.code,
|
|
1011
|
-
var
|
|
1012
|
-
const
|
|
1013
|
-
if (
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1033
|
+
}, [a == null ? void 0 : a.code, Re, Ze]), Kt = d(() => {
|
|
1034
|
+
var E;
|
|
1035
|
+
const r = (E = Y.current) == null ? void 0 : E.closest("pre");
|
|
1036
|
+
if (r && se.current && V.current) {
|
|
1037
|
+
const w = window.getComputedStyle(r).backgroundColor;
|
|
1038
|
+
w && w !== "rgba(0, 0, 0, 0)" && w !== "transparent" && (se.current.style.backgroundColor = w, V.current.style.backgroundColor = w);
|
|
1016
1039
|
}
|
|
1017
|
-
}, []),
|
|
1018
|
-
|
|
1019
|
-
}, []),
|
|
1020
|
-
|
|
1021
|
-
}, [
|
|
1022
|
-
!
|
|
1040
|
+
}, []), Lt = d(() => {
|
|
1041
|
+
se.current && (se.current.style.backgroundColor = ""), V.current && (V.current.style.backgroundColor = "");
|
|
1042
|
+
}, []), lt = d(() => {
|
|
1043
|
+
xt(), Ct();
|
|
1044
|
+
}, [xt, Ct]), ct = ((At = s.editor) == null ? void 0 : At.isAvailable()) || !1, Tt = d(() => {
|
|
1045
|
+
!ct || !U.current || !a || (q.current && (q.current.destroy(), q.current = null), q.current = s.editor.create(U.current, {
|
|
1023
1046
|
code: a.code || "",
|
|
1024
1047
|
language: a.editorLanguage || a.language || "plaintext",
|
|
1025
1048
|
sdkTheme: s.getTheme()
|
|
1026
1049
|
}));
|
|
1027
|
-
}, [
|
|
1028
|
-
if (!
|
|
1029
|
-
const
|
|
1050
|
+
}, [ct, a, s]), Yt = d(() => {
|
|
1051
|
+
if (!q.current || !a) return;
|
|
1052
|
+
const r = q.current.getCode();
|
|
1030
1053
|
s.emit("edit:save", {
|
|
1031
1054
|
artifactId: a.id,
|
|
1032
1055
|
artifact: a,
|
|
1033
|
-
code:
|
|
1056
|
+
code: r
|
|
1034
1057
|
});
|
|
1035
|
-
}, [a, s]),
|
|
1036
|
-
|
|
1037
|
-
}, [
|
|
1038
|
-
clearTimeout(
|
|
1039
|
-
}, [a, s]),
|
|
1040
|
-
clearTimeout(
|
|
1041
|
-
}, []),
|
|
1042
|
-
clearTimeout(
|
|
1043
|
-
|
|
1058
|
+
}, [a, s]), Gt = d(() => {
|
|
1059
|
+
ge && window.open(ge, "_blank", "noopener,noreferrer");
|
|
1060
|
+
}, [ge]), Qt = d(() => {
|
|
1061
|
+
clearTimeout(B.current), oe(!1), Z.current && a && (s.bridge.setIframe(Z.current), s.bridge.loadArtifact(a));
|
|
1062
|
+
}, [a, s]), ea = d(() => {
|
|
1063
|
+
clearTimeout(B.current), oe(!1);
|
|
1064
|
+
}, []), ta = d(() => {
|
|
1065
|
+
clearTimeout(B.current), B.current = setTimeout(() => {
|
|
1066
|
+
oe(!1);
|
|
1044
1067
|
}, 1e3);
|
|
1045
|
-
}, []),
|
|
1068
|
+
}, []), aa = d(async () => {
|
|
1046
1069
|
if (a)
|
|
1047
1070
|
try {
|
|
1048
|
-
await navigator.clipboard.writeText(a.code),
|
|
1049
|
-
} catch (
|
|
1050
|
-
console.error("Failed to copy:",
|
|
1071
|
+
await navigator.clipboard.writeText(a.code), G(!0), setTimeout(() => G(!1), 2e3);
|
|
1072
|
+
} catch (r) {
|
|
1073
|
+
console.error("Failed to copy:", r);
|
|
1051
1074
|
}
|
|
1052
|
-
}, [a]),
|
|
1075
|
+
}, [a]), ra = d(() => {
|
|
1053
1076
|
if (!a) return;
|
|
1054
|
-
const { code:
|
|
1055
|
-
|
|
1056
|
-
}, [a]),
|
|
1057
|
-
if (!(m ||
|
|
1058
|
-
|
|
1077
|
+
const { code: r, language: E, editorLanguage: C, title: w } = a, J = vt(C || E), xe = `${w.toLowerCase().replace(/\s+/g, "-")}.${J}`, re = new Blob([r], { type: "text/plain" }), X = URL.createObjectURL(re), ne = document.createElement("a");
|
|
1078
|
+
ne.href = X, ne.download = xe, document.body.appendChild(ne), ne.click(), document.body.removeChild(ne), URL.revokeObjectURL(X);
|
|
1079
|
+
}, [a]), na = d(async () => {
|
|
1080
|
+
if (!(m || O.length === 0)) {
|
|
1081
|
+
$(!0);
|
|
1059
1082
|
try {
|
|
1060
|
-
const
|
|
1061
|
-
for (const
|
|
1062
|
-
if (!
|
|
1063
|
-
const
|
|
1064
|
-
let
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1083
|
+
const r = new ba(), E = /* @__PURE__ */ new Map();
|
|
1084
|
+
for (const X of O) {
|
|
1085
|
+
if (!X.code) continue;
|
|
1086
|
+
const ne = vt(X.editorLanguage || X.language);
|
|
1087
|
+
let Ce = (X.title || "untitled").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-_]/g, ""), ft = `${Ce}.${ne}`;
|
|
1088
|
+
const pt = E.get(ft) || 0;
|
|
1089
|
+
pt > 0 && (ft = `${Ce}-${pt}.${ne}`), E.set(`${Ce}.${ne}`, pt + 1), r.file(ft, X.code);
|
|
1067
1090
|
}
|
|
1068
|
-
const
|
|
1069
|
-
|
|
1070
|
-
} catch (
|
|
1071
|
-
console.error("Failed to create ZIP:",
|
|
1091
|
+
const C = await r.generateAsync({ type: "blob" }), J = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, xe = URL.createObjectURL(C), re = document.createElement("a");
|
|
1092
|
+
re.href = xe, re.download = J, document.body.appendChild(re), re.click(), document.body.removeChild(re), URL.revokeObjectURL(xe);
|
|
1093
|
+
} catch (r) {
|
|
1094
|
+
console.error("Failed to create ZIP:", r);
|
|
1072
1095
|
} finally {
|
|
1073
|
-
|
|
1096
|
+
$(!1);
|
|
1074
1097
|
}
|
|
1075
1098
|
}
|
|
1076
|
-
}, [m,
|
|
1099
|
+
}, [m, O]), Mt = d((r) => r ? new Date(r).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : "", []), sa = d(() => {
|
|
1077
1100
|
if (b) {
|
|
1078
|
-
|
|
1101
|
+
k(!1);
|
|
1079
1102
|
return;
|
|
1080
1103
|
}
|
|
1081
|
-
a && (
|
|
1082
|
-
}, [a, s, b]),
|
|
1083
|
-
|
|
1084
|
-
}, []),
|
|
1104
|
+
a && (M("options"), Le(""), Ne(null), te(""), Be(!1), Te(!1), Ue([]), Ie(!1), qe(""), k(!0));
|
|
1105
|
+
}, [a, s, b]), la = d(() => {
|
|
1106
|
+
k(!1);
|
|
1107
|
+
}, []), it = d(async () => {
|
|
1085
1108
|
if (!(!a || !(s != null && s.share))) {
|
|
1086
|
-
|
|
1109
|
+
M("loading"), te("");
|
|
1087
1110
|
try {
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
} catch (
|
|
1091
|
-
|
|
1111
|
+
const r = await s.share.share(a);
|
|
1112
|
+
Le(r.url), Ne(r.expiresAt), Te(!1), M("success");
|
|
1113
|
+
} catch (r) {
|
|
1114
|
+
te(r.message || "Failed to create share link"), M("error");
|
|
1092
1115
|
}
|
|
1093
1116
|
}
|
|
1094
|
-
}, [a, s]),
|
|
1095
|
-
if (
|
|
1096
|
-
|
|
1117
|
+
}, [a, s]), Pt = d(async () => {
|
|
1118
|
+
if (Je)
|
|
1119
|
+
Ke();
|
|
1097
1120
|
else {
|
|
1098
|
-
|
|
1121
|
+
M("loading");
|
|
1099
1122
|
try {
|
|
1100
|
-
await s.share.openAuthPopup(),
|
|
1101
|
-
} catch (
|
|
1102
|
-
|
|
1123
|
+
await s.share.openAuthPopup(), Ke();
|
|
1124
|
+
} catch (r) {
|
|
1125
|
+
r.message === "Authentication cancelled" ? M("options") : (te(r.message || "Authentication failed"), M("error"));
|
|
1103
1126
|
}
|
|
1104
1127
|
}
|
|
1105
|
-
}, [
|
|
1128
|
+
}, [Je, s]), Ke = d(async () => {
|
|
1106
1129
|
if (!(!a || !(s != null && s.share))) {
|
|
1107
|
-
|
|
1130
|
+
M("loading"), te("");
|
|
1108
1131
|
try {
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1111
|
-
} catch (
|
|
1112
|
-
|
|
1132
|
+
const r = await s.share.save(a);
|
|
1133
|
+
Le(r.url), Ne(null), Te(!0), M("success");
|
|
1134
|
+
} catch (r) {
|
|
1135
|
+
te(r.message || "Failed to save artifact"), M("error");
|
|
1113
1136
|
}
|
|
1114
1137
|
}
|
|
1115
|
-
}, [a, s]),
|
|
1116
|
-
|
|
1117
|
-
}, [
|
|
1138
|
+
}, [a, s]), ca = d(() => {
|
|
1139
|
+
le ? Ke() : it();
|
|
1140
|
+
}, [le, Ke, it]), ia = d(async () => {
|
|
1118
1141
|
if (s != null && s.share) {
|
|
1119
|
-
if (!
|
|
1120
|
-
|
|
1142
|
+
if (!Je) {
|
|
1143
|
+
M("loading");
|
|
1121
1144
|
try {
|
|
1122
1145
|
await s.share.openAuthPopup();
|
|
1123
|
-
} catch (
|
|
1124
|
-
|
|
1146
|
+
} catch (r) {
|
|
1147
|
+
r.message === "Authentication cancelled" ? M("options") : (te(r.message || "Authentication failed"), M("error"));
|
|
1125
1148
|
return;
|
|
1126
1149
|
}
|
|
1127
1150
|
}
|
|
1128
|
-
|
|
1151
|
+
M("update-list"), Ie(!0);
|
|
1129
1152
|
try {
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1132
|
-
} catch (
|
|
1133
|
-
|
|
1153
|
+
const r = (a == null ? void 0 : a.language) || null, E = await s.share.listArtifacts(r);
|
|
1154
|
+
Ue(E.projects || []);
|
|
1155
|
+
} catch (r) {
|
|
1156
|
+
te(r.message || "Failed to load artifacts"), M("error");
|
|
1134
1157
|
} finally {
|
|
1135
|
-
|
|
1158
|
+
Ie(!1);
|
|
1136
1159
|
}
|
|
1137
1160
|
}
|
|
1138
|
-
}, [a, s,
|
|
1139
|
-
var
|
|
1161
|
+
}, [a, s, Je]), oa = d(async (r) => {
|
|
1162
|
+
var C, w;
|
|
1140
1163
|
if (!a || !(s != null && s.share)) return;
|
|
1141
|
-
const
|
|
1142
|
-
if (
|
|
1143
|
-
|
|
1164
|
+
const E = (C = r.project) == null ? void 0 : C.uuid;
|
|
1165
|
+
if (E) {
|
|
1166
|
+
M("loading"), te("");
|
|
1144
1167
|
try {
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1147
|
-
} catch (
|
|
1148
|
-
|
|
1168
|
+
const J = await s.share.updateArtifact(E, a);
|
|
1169
|
+
Le(J.url || ""), Ne(null), Te(!0), qe(((w = r.project) == null ? void 0 : w.name) || "Untitled"), M("success");
|
|
1170
|
+
} catch (J) {
|
|
1171
|
+
te(J.message || "Failed to update artifact"), M("error");
|
|
1149
1172
|
}
|
|
1150
1173
|
}
|
|
1151
|
-
}, [a, s]),
|
|
1152
|
-
if (
|
|
1174
|
+
}, [a, s]), ua = d(async () => {
|
|
1175
|
+
if (Ee)
|
|
1153
1176
|
try {
|
|
1154
|
-
await navigator.clipboard.writeText(
|
|
1155
|
-
} catch (
|
|
1156
|
-
console.error("Failed to copy link:",
|
|
1177
|
+
await navigator.clipboard.writeText(Ee), Be(!0), setTimeout(() => Be(!1), 2e3);
|
|
1178
|
+
} catch (r) {
|
|
1179
|
+
console.error("Failed to copy link:", r);
|
|
1157
1180
|
}
|
|
1158
|
-
}, [
|
|
1159
|
-
d((
|
|
1160
|
-
p(
|
|
1161
|
-
}, [p]), d((
|
|
1162
|
-
s.closeTab(
|
|
1163
|
-
}, [s, o.openTabs]);
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1166
|
-
}, [
|
|
1167
|
-
|
|
1168
|
-
}, [
|
|
1169
|
-
|
|
1170
|
-
}, [p]),
|
|
1171
|
-
|
|
1172
|
-
startX:
|
|
1173
|
-
startWidth:
|
|
1174
|
-
}, document.addEventListener("mousemove",
|
|
1175
|
-
|
|
1181
|
+
}, [Ee]);
|
|
1182
|
+
d((r) => {
|
|
1183
|
+
p(r);
|
|
1184
|
+
}, [p]), d((r) => {
|
|
1185
|
+
Nt(r), s.closeTab(r), o.openTabs.length === 0 && pe(!1);
|
|
1186
|
+
}, [s, o.openTabs, Nt]);
|
|
1187
|
+
const ma = d(() => {
|
|
1188
|
+
me > 0 && p(O[me - 1]);
|
|
1189
|
+
}, [me, p, O]), da = d(() => {
|
|
1190
|
+
me < O.length - 1 && p(O[me + 1]);
|
|
1191
|
+
}, [me, p, O]), St = d((r) => {
|
|
1192
|
+
pe(!0), p(r), ie(!1);
|
|
1193
|
+
}, [p]), ot = d((r) => {
|
|
1194
|
+
T.current = {
|
|
1195
|
+
startX: r.clientX,
|
|
1196
|
+
startWidth: h
|
|
1197
|
+
}, document.addEventListener("mousemove", ut), document.addEventListener("mouseup", Ye), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((E) => {
|
|
1198
|
+
E.style.pointerEvents = "none";
|
|
1176
1199
|
});
|
|
1177
|
-
}, [
|
|
1178
|
-
if (!
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1181
|
-
}, []),
|
|
1182
|
-
|
|
1183
|
-
|
|
1200
|
+
}, [h]), ut = d((r) => {
|
|
1201
|
+
if (!T.current) return;
|
|
1202
|
+
const E = window.innerWidth, w = (T.current.startX - r.clientX) / E * 100, J = T.current.startWidth + w;
|
|
1203
|
+
ce(Math.min(Math.max(J, 25), 75));
|
|
1204
|
+
}, []), Ye = d(() => {
|
|
1205
|
+
T.current = null, document.removeEventListener("mousemove", ut), document.removeEventListener("mouseup", Ye), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((r) => {
|
|
1206
|
+
r.style.pointerEvents = "";
|
|
1184
1207
|
});
|
|
1185
|
-
}, [
|
|
1208
|
+
}, [ut]), fa = d((r) => {
|
|
1186
1209
|
if (!z.current) return;
|
|
1187
|
-
const
|
|
1188
|
-
|
|
1189
|
-
startX:
|
|
1190
|
-
startPosition:
|
|
1191
|
-
contentLeft:
|
|
1192
|
-
contentWidth:
|
|
1193
|
-
}, document.addEventListener("mousemove",
|
|
1194
|
-
|
|
1210
|
+
const E = z.current.getBoundingClientRect();
|
|
1211
|
+
Pe.current = {
|
|
1212
|
+
startX: r.clientX,
|
|
1213
|
+
startPosition: ue,
|
|
1214
|
+
contentLeft: E.left,
|
|
1215
|
+
contentWidth: E.width
|
|
1216
|
+
}, document.addEventListener("mousemove", mt), document.addEventListener("mouseup", Ge), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((C) => {
|
|
1217
|
+
C.style.pointerEvents = "none";
|
|
1195
1218
|
});
|
|
1196
|
-
}, [
|
|
1197
|
-
if (!
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1200
|
-
}, []),
|
|
1201
|
-
|
|
1202
|
-
|
|
1219
|
+
}, [ue]), mt = d((r) => {
|
|
1220
|
+
if (!Pe.current) return;
|
|
1221
|
+
const C = (r.clientX - Pe.current.contentLeft) / Pe.current.contentWidth * 100;
|
|
1222
|
+
he(Math.min(Math.max(C, 20), 80));
|
|
1223
|
+
}, []), Ge = d(() => {
|
|
1224
|
+
Pe.current = null, document.removeEventListener("mousemove", mt), document.removeEventListener("mouseup", Ge), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((r) => {
|
|
1225
|
+
r.style.pointerEvents = "";
|
|
1203
1226
|
});
|
|
1204
|
-
}, [
|
|
1205
|
-
if (
|
|
1206
|
-
a && (
|
|
1207
|
-
}, [a == null ? void 0 : a.id,
|
|
1208
|
-
(
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1227
|
+
}, [mt]);
|
|
1228
|
+
if (I(() => {
|
|
1229
|
+
a && (j.current && j.current.isPreviewable !== a.isPreviewable && (fe(!0), setTimeout(() => fe(!1), 150)), j.current = a, Wt.includes(a.language) && _("preview"), Lt(), oe(!0), ta(), lt());
|
|
1230
|
+
}, [a == null ? void 0 : a.id, Lt]), I(() => {
|
|
1231
|
+
if (ae === "font" && ze && (a != null && a.code)) {
|
|
1232
|
+
const r = `@font-face { font-family: "${ze}"; src: url("data:${Bt(a.fileExtension || "woff2")};base64,${a.code}"); }`;
|
|
1233
|
+
ee.current || (ee.current = document.createElement("style"), document.head.appendChild(ee.current)), ee.current.textContent = r;
|
|
1234
|
+
} else ee.current && (ee.current.textContent = "");
|
|
1235
|
+
}, [ae, ze, a]), I(() => {
|
|
1236
|
+
(o.viewMode === "code" || o.viewMode === "split") && lt(), o.viewMode === "edit" && Tt();
|
|
1237
|
+
}, [o.viewMode, lt, Tt]), I(() => (t && s.on("ai:request", t), n && s.on("save:request", n), c && s.on("export:complete", c), () => {
|
|
1238
|
+
t && s.off("ai:request", t), n && s.off("save:request", n), c && s.off("export:complete", c);
|
|
1239
|
+
}), [s, t, n, c]), I(() => () => {
|
|
1240
|
+
Ye(), Ge(), q.current && (q.current.destroy(), q.current = null), clearTimeout(f.current), clearTimeout(B.current), Object.keys(W.current).forEach((r) => Ft(W.current[r])), W.current = {}, ee.current && (ee.current.remove(), ee.current = null);
|
|
1241
|
+
}, [Ye, Ge]), !o.isPanelOpen) return null;
|
|
1242
|
+
const dt = [
|
|
1215
1243
|
"artifactuse-panel",
|
|
1216
1244
|
o.isFullscreen && "artifactuse-panel--fullscreen",
|
|
1217
|
-
!a &&
|
|
1218
|
-
!
|
|
1245
|
+
!a && S && !o.forceEmptyView && "artifactuse-panel--list",
|
|
1246
|
+
!S && !o.forceEmptyView && "artifactuse-panel--empty",
|
|
1219
1247
|
l
|
|
1220
|
-
].filter(Boolean).join(" "),
|
|
1248
|
+
].filter(Boolean).join(" "), pa = [
|
|
1221
1249
|
"artifactuse-panel__content",
|
|
1222
1250
|
`artifactuse-panel__content--${o.viewMode}`,
|
|
1223
|
-
|
|
1251
|
+
de && "artifactuse-panel__content--transitioning"
|
|
1224
1252
|
].filter(Boolean).join(" ");
|
|
1225
|
-
return !
|
|
1253
|
+
return !S || o.forceEmptyView ? /* @__PURE__ */ e.createElement("div", { className: dt, style: o.isFullscreen ? void 0 : { width: `${wt}%` } }, !o.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: ot }, /* @__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" }, o.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" }, o.forceEmptyView ? "Artifact Viewer" : "Artifacts"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
|
|
1226
1254
|
"button",
|
|
1227
1255
|
{
|
|
1228
1256
|
className: "artifactuse-panel__action artifactuse-panel__action--close",
|
|
1229
1257
|
title: "Close panel",
|
|
1230
|
-
onClick:
|
|
1258
|
+
onClick: A
|
|
1231
1259
|
},
|
|
1232
1260
|
/* @__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" }))
|
|
1233
|
-
))), /* @__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" }, o.forceEmptyView ? "No artifact selected" : "No artifacts yet"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-panel__empty-text" }, o.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" },
|
|
1261
|
+
))), /* @__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" }, o.forceEmptyView ? "No artifact selected" : "No artifacts yet"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-panel__empty-text" }, o.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" }, nt && /* @__PURE__ */ e.createElement(
|
|
1234
1262
|
"a",
|
|
1235
1263
|
{
|
|
1236
1264
|
href: "https://artifactuse.com",
|
|
@@ -1243,32 +1271,32 @@ function Fa({
|
|
|
1243
1271
|
))) : a ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
1244
1272
|
"div",
|
|
1245
1273
|
{
|
|
1246
|
-
className:
|
|
1247
|
-
style: o.isFullscreen ? void 0 : { width: `${
|
|
1274
|
+
className: dt,
|
|
1275
|
+
style: o.isFullscreen ? void 0 : { width: `${h}%` }
|
|
1248
1276
|
},
|
|
1249
1277
|
!o.isFullscreen && /* @__PURE__ */ e.createElement(
|
|
1250
1278
|
"div",
|
|
1251
1279
|
{
|
|
1252
1280
|
className: "artifactuse-panel__resize-handle",
|
|
1253
|
-
onMouseDown:
|
|
1281
|
+
onMouseDown: ot
|
|
1254
1282
|
},
|
|
1255
1283
|
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle-line" })
|
|
1256
1284
|
),
|
|
1257
|
-
/* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, (
|
|
1285
|
+
/* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, (Xe || be) && /* @__PURE__ */ e.createElement(
|
|
1258
1286
|
"button",
|
|
1259
1287
|
{
|
|
1260
1288
|
className: "artifactuse-panel__back",
|
|
1261
|
-
title:
|
|
1262
|
-
onClick:
|
|
1289
|
+
title: Xe ? "Browse artifacts" : "Back to list",
|
|
1290
|
+
onClick: Zt
|
|
1263
1291
|
},
|
|
1264
1292
|
/* @__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" }))
|
|
1265
1293
|
), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title" }, /* @__PURE__ */ e.createElement(
|
|
1266
1294
|
"span",
|
|
1267
1295
|
{
|
|
1268
1296
|
className: "artifactuse-panel__icon",
|
|
1269
|
-
dangerouslySetInnerHTML: { __html: `<svg viewBox="0 0 24 24" fill="currentColor">${
|
|
1297
|
+
dangerouslySetInnerHTML: { __html: `<svg viewBox="0 0 24 24" fill="currentColor">${Ut}</svg>` }
|
|
1270
1298
|
}
|
|
1271
|
-
), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, a.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__meta" },
|
|
1299
|
+
), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, a.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__meta" }, gt, a.lineCount && ` • ${a.lineCount} lines`))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__tabs" }, (!a.tabs || a.tabs.includes("preview")) && /* @__PURE__ */ e.createElement(
|
|
1272
1300
|
"button",
|
|
1273
1301
|
{
|
|
1274
1302
|
className: `artifactuse-panel__tab ${o.viewMode === "preview" ? "artifactuse-panel__tab--active" : ""}`,
|
|
@@ -1277,7 +1305,7 @@ function Fa({
|
|
|
1277
1305
|
onClick: () => _("preview")
|
|
1278
1306
|
},
|
|
1279
1307
|
/* @__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" }))
|
|
1280
|
-
), (!a.tabs || a.tabs.includes("code")) && /* @__PURE__ */ e.createElement(
|
|
1308
|
+
), (!a.tabs || a.tabs.includes("code")) && !Se && /* @__PURE__ */ e.createElement(
|
|
1281
1309
|
"button",
|
|
1282
1310
|
{
|
|
1283
1311
|
className: `artifactuse-panel__tab ${o.viewMode === "code" ? "artifactuse-panel__tab--active" : ""}`,
|
|
@@ -1285,7 +1313,7 @@ function Fa({
|
|
|
1285
1313
|
onClick: () => _("code")
|
|
1286
1314
|
},
|
|
1287
1315
|
/* @__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" }))
|
|
1288
|
-
), (!a.tabs || a.tabs.includes("split")) && /* @__PURE__ */ e.createElement(
|
|
1316
|
+
), (!a.tabs || a.tabs.includes("split")) && !Se && /* @__PURE__ */ e.createElement(
|
|
1289
1317
|
"button",
|
|
1290
1318
|
{
|
|
1291
1319
|
className: `artifactuse-panel__tab ${o.viewMode === "split" ? "artifactuse-panel__tab--active" : ""}`,
|
|
@@ -1294,7 +1322,7 @@ function Fa({
|
|
|
1294
1322
|
onClick: () => _("split")
|
|
1295
1323
|
},
|
|
1296
1324
|
/* @__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" }))
|
|
1297
|
-
), a.tabs && a.tabs.includes("edit") &&
|
|
1325
|
+
), a.tabs && a.tabs.includes("edit") && ct && /* @__PURE__ */ e.createElement(
|
|
1298
1326
|
"button",
|
|
1299
1327
|
{
|
|
1300
1328
|
className: `artifactuse-panel__tab ${o.viewMode === "edit" ? "artifactuse-panel__tab--active" : ""}`,
|
|
@@ -1307,15 +1335,15 @@ function Fa({
|
|
|
1307
1335
|
{
|
|
1308
1336
|
className: "artifactuse-panel__action artifactuse-panel__action--save",
|
|
1309
1337
|
title: "Save",
|
|
1310
|
-
onClick:
|
|
1338
|
+
onClick: Yt
|
|
1311
1339
|
},
|
|
1312
1340
|
/* @__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" }))
|
|
1313
|
-
),
|
|
1341
|
+
), jt && /* @__PURE__ */ e.createElement(
|
|
1314
1342
|
"button",
|
|
1315
1343
|
{
|
|
1316
1344
|
className: "artifactuse-panel__action",
|
|
1317
1345
|
title: "Open in new tab",
|
|
1318
|
-
onClick:
|
|
1346
|
+
onClick: Gt
|
|
1319
1347
|
},
|
|
1320
1348
|
/* @__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" }))
|
|
1321
1349
|
), /* @__PURE__ */ e.createElement(
|
|
@@ -1323,7 +1351,7 @@ function Fa({
|
|
|
1323
1351
|
{
|
|
1324
1352
|
className: "artifactuse-panel__action",
|
|
1325
1353
|
title: o.isFullscreen ? "Exit fullscreen" : "Fullscreen",
|
|
1326
|
-
onClick:
|
|
1354
|
+
onClick: R
|
|
1327
1355
|
},
|
|
1328
1356
|
o.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" }))
|
|
1329
1357
|
), /* @__PURE__ */ e.createElement(
|
|
@@ -1331,35 +1359,35 @@ function Fa({
|
|
|
1331
1359
|
{
|
|
1332
1360
|
className: "artifactuse-panel__action artifactuse-panel__action--close",
|
|
1333
1361
|
title: "Close",
|
|
1334
|
-
onClick:
|
|
1362
|
+
onClick: A
|
|
1335
1363
|
},
|
|
1336
1364
|
/* @__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" }))
|
|
1337
1365
|
))),
|
|
1338
|
-
/* @__PURE__ */ e.createElement("div", { className:
|
|
1366
|
+
/* @__PURE__ */ e.createElement("div", { className: pa, ref: z }, de && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })), (o.viewMode === "preview" || o.viewMode === "split") && /* @__PURE__ */ e.createElement(
|
|
1339
1367
|
"div",
|
|
1340
1368
|
{
|
|
1341
1369
|
className: "artifactuse-panel__preview",
|
|
1342
|
-
style: o.viewMode === "split" ? { width: `${
|
|
1370
|
+
style: o.viewMode === "split" ? { width: `${ue}%` } : void 0
|
|
1343
1371
|
},
|
|
1344
|
-
ge &&
|
|
1345
|
-
|
|
1372
|
+
ye && ge && !Se && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })),
|
|
1373
|
+
Se ? /* @__PURE__ */ e.createElement(e.Fragment, null, ae === "image" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--image" }, /* @__PURE__ */ e.createElement("img", { src: je(a), alt: a.title || "image" })), ae === "audio" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--audio" }, /* @__PURE__ */ e.createElement("audio", { controls: !0, src: je(a) })), ae === "video" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--video" }, /* @__PURE__ */ e.createElement("video", { controls: !0, src: je(a) })), ae === "pdf" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--pdf" }, /* @__PURE__ */ e.createElement("iframe", { src: je(a) + "#toolbar=1", title: a.title || "PDF" })), ae === "font" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--font" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__font-sample", style: { fontFamily: ze } }, "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__font-sample artifactuse-panel__font-sample--sm", style: { fontFamily: ze } }, "0123456789 !@#$%^&*()")), ae === "binary" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__binary artifactuse-panel__binary--hex" }, /* @__PURE__ */ e.createElement("pre", { className: "artifactuse-panel__hex-dump" }, qt))) : ge ? /* @__PURE__ */ e.createElement(
|
|
1346
1374
|
"iframe",
|
|
1347
1375
|
{
|
|
1348
|
-
ref:
|
|
1349
|
-
src:
|
|
1350
|
-
className: `artifactuse-panel__iframe ${
|
|
1376
|
+
ref: Z,
|
|
1377
|
+
src: ge,
|
|
1378
|
+
className: `artifactuse-panel__iframe ${ye ? "artifactuse-panel__iframe--loading" : ""}`,
|
|
1351
1379
|
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads allow-top-navigation-by-user-activation",
|
|
1352
1380
|
allow: "camera; microphone; fullscreen; geolocation; display-capture; autoplay; clipboard-write; encrypted-media; gyroscope; accelerometer; picture-in-picture",
|
|
1353
|
-
onLoad:
|
|
1354
|
-
onError:
|
|
1381
|
+
onLoad: Qt,
|
|
1382
|
+
onError: ea
|
|
1355
1383
|
}
|
|
1356
|
-
) : /* @__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 ",
|
|
1384
|
+
) : /* @__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 ", gt))
|
|
1357
1385
|
), /* @__PURE__ */ e.createElement(
|
|
1358
1386
|
"div",
|
|
1359
1387
|
{
|
|
1360
1388
|
className: "artifactuse-panel__code",
|
|
1361
1389
|
style: {
|
|
1362
|
-
...o.viewMode === "split" ? { width: `${100 -
|
|
1390
|
+
...o.viewMode === "split" ? { width: `${100 - ue}%` } : {},
|
|
1363
1391
|
display: o.viewMode === "code" || o.viewMode === "split" ? void 0 : "none"
|
|
1364
1392
|
}
|
|
1365
1393
|
},
|
|
@@ -1367,15 +1395,15 @@ function Fa({
|
|
|
1367
1395
|
"div",
|
|
1368
1396
|
{
|
|
1369
1397
|
className: "artifactuse-panel__split-handle",
|
|
1370
|
-
onMouseDown:
|
|
1398
|
+
onMouseDown: fa
|
|
1371
1399
|
},
|
|
1372
1400
|
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__split-handle-line" })
|
|
1373
1401
|
),
|
|
1374
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__code-scroll", ref:
|
|
1402
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__code-scroll", ref: se }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__line-numbers", ref: V }), /* @__PURE__ */ e.createElement("pre", { className: `artifactuse-panel__code-block language-${Re}` }, /* @__PURE__ */ e.createElement(
|
|
1375
1403
|
"code",
|
|
1376
1404
|
{
|
|
1377
|
-
ref:
|
|
1378
|
-
className: `language-${
|
|
1405
|
+
ref: Y,
|
|
1406
|
+
className: `language-${Re}`
|
|
1379
1407
|
}
|
|
1380
1408
|
)))
|
|
1381
1409
|
), /* @__PURE__ */ e.createElement(
|
|
@@ -1384,29 +1412,29 @@ function Fa({
|
|
|
1384
1412
|
className: "artifactuse-panel__edit",
|
|
1385
1413
|
style: { display: o.viewMode === "edit" ? void 0 : "none" }
|
|
1386
1414
|
},
|
|
1387
|
-
/* @__PURE__ */ e.createElement("div", { ref:
|
|
1415
|
+
/* @__PURE__ */ e.createElement("div", { ref: U, className: "artifactuse-panel__editor-container" })
|
|
1388
1416
|
)),
|
|
1389
|
-
|
|
1417
|
+
Jt && /* @__PURE__ */ e.createElement("div", { className: `artifactuse-panel__console ${Me ? "artifactuse-panel__console--expanded" : ""}` }, /* @__PURE__ */ e.createElement(
|
|
1390
1418
|
"div",
|
|
1391
1419
|
{
|
|
1392
1420
|
className: "artifactuse-panel__console-header",
|
|
1393
|
-
onClick: () =>
|
|
1421
|
+
onClick: () => We((r) => !r)
|
|
1394
1422
|
},
|
|
1395
1423
|
/* @__PURE__ */ e.createElement("svg", { className: "artifactuse-panel__console-chevron", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "18 15 12 9 6 15" })),
|
|
1396
1424
|
/* @__PURE__ */ e.createElement("span", null, "Console"),
|
|
1397
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__console-filters", onClick: (
|
|
1425
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__console-filters", onClick: (r) => r.stopPropagation() }, st > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--error${ve.has("error") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => Oe("error") }, st, " error", st !== 1 ? "s" : ""), _t > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--warn${ve.has("warn") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => Oe("warn") }, _t, " warn"), yt > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--info${ve.has("info") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => Oe("info") }, yt, " info"), bt > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--log${ve.has("log") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => Oe("log") }, bt, " log")),
|
|
1398
1426
|
/* @__PURE__ */ e.createElement(
|
|
1399
1427
|
"button",
|
|
1400
1428
|
{
|
|
1401
1429
|
className: "artifactuse-panel__console-clear",
|
|
1402
|
-
onClick: (
|
|
1403
|
-
|
|
1430
|
+
onClick: (r) => {
|
|
1431
|
+
r.stopPropagation(), Ve([]);
|
|
1404
1432
|
}
|
|
1405
1433
|
},
|
|
1406
1434
|
"Clear"
|
|
1407
1435
|
)
|
|
1408
|
-
),
|
|
1409
|
-
/* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-left" },
|
|
1436
|
+
), Me && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__console-entries", ref: ke }, Ot.map((r, E) => /* @__PURE__ */ e.createElement("div", { key: E, className: `artifactuse-panel__console-entry artifactuse-panel__console-entry--${r.type}` }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-type" }, "[", r.type, "]"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-content" }, r.content), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-timestamp" }, new Date(r.timestamp).toLocaleTimeString()))))),
|
|
1437
|
+
/* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-left" }, nt && /* @__PURE__ */ e.createElement(
|
|
1410
1438
|
"a",
|
|
1411
1439
|
{
|
|
1412
1440
|
href: "https://artifactuse.com",
|
|
@@ -1417,12 +1445,12 @@ function Fa({
|
|
|
1417
1445
|
},
|
|
1418
1446
|
/* @__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" })),
|
|
1419
1447
|
/* @__PURE__ */ e.createElement("span", null, "Artifactuse")
|
|
1420
|
-
), a.code && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__badge artifactuse-panel__badge--secondary" },
|
|
1448
|
+
), a.code && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__badge artifactuse-panel__badge--secondary" }, Rt(a.size))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-right" }, /* @__PURE__ */ e.createElement(
|
|
1421
1449
|
"button",
|
|
1422
1450
|
{
|
|
1423
1451
|
className: `artifactuse-panel__footer-action ${H ? "artifactuse-panel__footer-action--success" : ""}`,
|
|
1424
1452
|
title: H ? "Copied!" : "Copy code",
|
|
1425
|
-
onClick:
|
|
1453
|
+
onClick: aa
|
|
1426
1454
|
},
|
|
1427
1455
|
H ? /* @__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" }))
|
|
1428
1456
|
), /* @__PURE__ */ e.createElement(
|
|
@@ -1430,102 +1458,102 @@ function Fa({
|
|
|
1430
1458
|
{
|
|
1431
1459
|
className: "artifactuse-panel__footer-action",
|
|
1432
1460
|
title: "Download",
|
|
1433
|
-
onClick:
|
|
1461
|
+
onClick: ra
|
|
1434
1462
|
},
|
|
1435
1463
|
/* @__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" }))
|
|
1436
|
-
),
|
|
1464
|
+
), Xt && /* @__PURE__ */ e.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ e.createElement(
|
|
1437
1465
|
"button",
|
|
1438
1466
|
{
|
|
1439
1467
|
className: "artifactuse-panel__footer-action",
|
|
1440
1468
|
title: "Share",
|
|
1441
|
-
onClick:
|
|
1469
|
+
onClick: sa
|
|
1442
1470
|
},
|
|
1443
1471
|
/* @__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" }))
|
|
1444
|
-
), b && /* @__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" },
|
|
1445
|
-
var
|
|
1472
|
+
), b && /* @__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" }, P === "success" ? at ? "Artifact updated!" : "Link created!" : P === "update-list" ? "Update saved artifact" : "Share Artifact"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__close", onClick: la }, /* @__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" }, P === "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...")), P === "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" }, tt)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__actions" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--secondary", onClick: () => M("options") }, "Back"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--primary", onClick: ca }, "Retry"))), P === "options" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__options" }, /* @__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("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: Pt }, /* @__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: ia }, /* @__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")))), P === "update-list" && /* @__PURE__ */ e.createElement("div", null, we ? /* @__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...")) : Fe.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" }, Fe.map((r) => {
|
|
1473
|
+
var E, C, w;
|
|
1446
1474
|
return /* @__PURE__ */ e.createElement(
|
|
1447
1475
|
"button",
|
|
1448
1476
|
{
|
|
1449
|
-
key: ((
|
|
1477
|
+
key: ((E = r.project) == null ? void 0 : E.uuid) || r.id,
|
|
1450
1478
|
className: "artifactuse-share-popup__artifact-item",
|
|
1451
|
-
onClick: () =>
|
|
1479
|
+
onClick: () => oa(r)
|
|
1452
1480
|
},
|
|
1453
|
-
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-name" }, ((
|
|
1454
|
-
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-date" },
|
|
1481
|
+
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-name" }, ((C = r.project) == null ? void 0 : C.name) || "Untitled"),
|
|
1482
|
+
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__artifact-date" }, Mt((w = r.project) == null ? void 0 : w.created_at))
|
|
1455
1483
|
);
|
|
1456
|
-
})), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__back-btn", onClick: () =>
|
|
1484
|
+
})), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__back-btn", onClick: () => M("options") }, "Back")), P === "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(
|
|
1457
1485
|
"input",
|
|
1458
1486
|
{
|
|
1459
1487
|
type: "text",
|
|
1460
1488
|
className: "artifactuse-share-popup__link",
|
|
1461
|
-
value:
|
|
1489
|
+
value: Ee,
|
|
1462
1490
|
readOnly: !0,
|
|
1463
|
-
onClick: (
|
|
1491
|
+
onClick: (r) => r.target.select()
|
|
1464
1492
|
}
|
|
1465
1493
|
), /* @__PURE__ */ e.createElement(
|
|
1466
1494
|
"button",
|
|
1467
1495
|
{
|
|
1468
|
-
className: `artifactuse-share-popup__copy-btn ${
|
|
1469
|
-
onClick:
|
|
1496
|
+
className: `artifactuse-share-popup__copy-btn ${De ? "artifactuse-share-popup__copy-btn--copied" : ""}`,
|
|
1497
|
+
onClick: ua
|
|
1470
1498
|
},
|
|
1471
|
-
|
|
1472
|
-
)),
|
|
1499
|
+
De ? "Copied!" : "Copy"
|
|
1500
|
+
)), He && !le && /* @__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 ", Mt(He))), !le && /* @__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: Pt }, "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"))))), O.length > 1 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__nav" }, /* @__PURE__ */ e.createElement(
|
|
1473
1501
|
"button",
|
|
1474
1502
|
{
|
|
1475
1503
|
className: "artifactuse-panel__nav-btn",
|
|
1476
|
-
disabled:
|
|
1504
|
+
disabled: me <= 0,
|
|
1477
1505
|
title: "Previous artifact",
|
|
1478
|
-
onClick:
|
|
1506
|
+
onClick: ma
|
|
1479
1507
|
},
|
|
1480
1508
|
/* @__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" }))
|
|
1481
1509
|
), /* @__PURE__ */ e.createElement(
|
|
1482
1510
|
"button",
|
|
1483
1511
|
{
|
|
1484
1512
|
className: "artifactuse-panel__nav-trigger",
|
|
1485
|
-
onClick: () =>
|
|
1513
|
+
onClick: () => ie(!_e)
|
|
1486
1514
|
},
|
|
1487
|
-
/* @__PURE__ */ e.createElement("span", null,
|
|
1515
|
+
/* @__PURE__ */ e.createElement("span", null, me + 1, " / ", O.length),
|
|
1488
1516
|
/* @__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" }))
|
|
1489
1517
|
), /* @__PURE__ */ e.createElement(
|
|
1490
1518
|
"button",
|
|
1491
1519
|
{
|
|
1492
1520
|
className: "artifactuse-panel__nav-btn",
|
|
1493
|
-
disabled:
|
|
1521
|
+
disabled: me >= O.length - 1,
|
|
1494
1522
|
title: "Next artifact",
|
|
1495
|
-
onClick:
|
|
1523
|
+
onClick: da
|
|
1496
1524
|
},
|
|
1497
1525
|
/* @__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" }))
|
|
1498
|
-
),
|
|
1526
|
+
), _e && /* @__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 (", O.length, ")"), /* @__PURE__ */ e.createElement(
|
|
1499
1527
|
"button",
|
|
1500
1528
|
{
|
|
1501
1529
|
className: "artifactuse-panel__artifact-list-close",
|
|
1502
|
-
onClick: () =>
|
|
1530
|
+
onClick: () => ie(!1)
|
|
1503
1531
|
},
|
|
1504
1532
|
/* @__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" }))
|
|
1505
|
-
)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-items" },
|
|
1533
|
+
)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-items" }, O.map((r, E) => /* @__PURE__ */ e.createElement(
|
|
1506
1534
|
"button",
|
|
1507
1535
|
{
|
|
1508
|
-
key:
|
|
1509
|
-
className: `artifactuse-panel__artifact-item ${
|
|
1510
|
-
onClick: () =>
|
|
1536
|
+
key: r.id,
|
|
1537
|
+
className: `artifactuse-panel__artifact-item ${r.id === a.id ? "artifactuse-panel__artifact-item--active" : ""}`,
|
|
1538
|
+
onClick: () => St(r)
|
|
1511
1539
|
},
|
|
1512
1540
|
/* @__PURE__ */ e.createElement(
|
|
1513
1541
|
"span",
|
|
1514
1542
|
{
|
|
1515
1543
|
className: "artifactuse-panel__artifact-item-icon",
|
|
1516
|
-
dangerouslySetInnerHTML: { __html:
|
|
1544
|
+
dangerouslySetInnerHTML: { __html: kt(r.language) }
|
|
1517
1545
|
}
|
|
1518
1546
|
),
|
|
1519
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-title" },
|
|
1520
|
-
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-index" },
|
|
1547
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-title" }, r.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-meta" }, Qe(r.language), r.lineCount && ` • ${r.lineCount} lines`)),
|
|
1548
|
+
/* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-index" }, E + 1)
|
|
1521
1549
|
)))))))
|
|
1522
|
-
)) : /* @__PURE__ */ e.createElement("div", { className:
|
|
1550
|
+
)) : /* @__PURE__ */ e.createElement("div", { className: dt, style: o.isFullscreen ? void 0 : { width: `${wt}%` } }, !o.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: ot }, /* @__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" }, O.length, " available"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
|
|
1523
1551
|
"button",
|
|
1524
1552
|
{
|
|
1525
1553
|
className: `artifactuse-panel__action ${m ? "artifactuse-panel__action--loading" : ""}`,
|
|
1526
1554
|
disabled: m,
|
|
1527
1555
|
title: "Download all as ZIP",
|
|
1528
|
-
onClick:
|
|
1556
|
+
onClick: na
|
|
1529
1557
|
},
|
|
1530
1558
|
m ? /* @__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" }))
|
|
1531
1559
|
), /* @__PURE__ */ e.createElement(
|
|
@@ -1533,26 +1561,26 @@ function Fa({
|
|
|
1533
1561
|
{
|
|
1534
1562
|
className: "artifactuse-panel__action artifactuse-panel__action--close",
|
|
1535
1563
|
title: "Close panel",
|
|
1536
|
-
onClick:
|
|
1564
|
+
onClick: A
|
|
1537
1565
|
},
|
|
1538
1566
|
/* @__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" }))
|
|
1539
|
-
))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-items" },
|
|
1567
|
+
))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-items" }, O.map((r, E) => /* @__PURE__ */ e.createElement(
|
|
1540
1568
|
"button",
|
|
1541
1569
|
{
|
|
1542
|
-
key:
|
|
1570
|
+
key: r.id,
|
|
1543
1571
|
className: "artifactuse-panel__list-item",
|
|
1544
|
-
onClick: () =>
|
|
1572
|
+
onClick: () => St(r)
|
|
1545
1573
|
},
|
|
1546
1574
|
/* @__PURE__ */ e.createElement(
|
|
1547
1575
|
"span",
|
|
1548
1576
|
{
|
|
1549
1577
|
className: "artifactuse-panel__list-item-icon",
|
|
1550
|
-
dangerouslySetInnerHTML: { __html:
|
|
1578
|
+
dangerouslySetInnerHTML: { __html: kt(r.language) }
|
|
1551
1579
|
}
|
|
1552
1580
|
),
|
|
1553
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-title" },
|
|
1581
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-title" }, r.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-meta" }, Qe(r.language), r.lineCount && ` • ${r.lineCount} lines`)),
|
|
1554
1582
|
/* @__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" })))
|
|
1555
|
-
)))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" },
|
|
1583
|
+
)))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, nt && /* @__PURE__ */ e.createElement(
|
|
1556
1584
|
"a",
|
|
1557
1585
|
{
|
|
1558
1586
|
href: "https://artifactuse.com",
|
|
@@ -1564,28 +1592,28 @@ function Fa({
|
|
|
1564
1592
|
/* @__PURE__ */ e.createElement("span", null, "Artifactuse")
|
|
1565
1593
|
)));
|
|
1566
1594
|
}
|
|
1567
|
-
function
|
|
1568
|
-
const { state:
|
|
1595
|
+
function Ka({ className: t = "" }) {
|
|
1596
|
+
const { state: n, artifactCount: c, hasArtifacts: l, togglePanel: i } = Ae(), u = N(() => c > 99 ? "99+" : String(c), [c]), g = [
|
|
1569
1597
|
"artifactuse-panel-toggle",
|
|
1570
|
-
|
|
1598
|
+
n.isPanelOpen && "artifactuse-panel-toggle--active",
|
|
1571
1599
|
l && "artifactuse-panel-toggle--has-artifacts",
|
|
1572
1600
|
t
|
|
1573
1601
|
].filter(Boolean).join(" ");
|
|
1574
1602
|
return /* @__PURE__ */ e.createElement(
|
|
1575
1603
|
"button",
|
|
1576
1604
|
{
|
|
1577
|
-
className:
|
|
1605
|
+
className: g,
|
|
1578
1606
|
onClick: i,
|
|
1579
|
-
title:
|
|
1607
|
+
title: n.isPanelOpen ? "Close artifacts panel" : "Open artifacts panel"
|
|
1580
1608
|
},
|
|
1581
1609
|
/* @__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" })),
|
|
1582
1610
|
c > 0 && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel-toggle-badge" }, u)
|
|
1583
1611
|
);
|
|
1584
1612
|
}
|
|
1585
|
-
const
|
|
1586
|
-
function
|
|
1587
|
-
const c =
|
|
1588
|
-
c.current || (c.current =
|
|
1613
|
+
const Dt = Ea(null);
|
|
1614
|
+
function Da({ children: t, config: n = {} }) {
|
|
1615
|
+
const c = F(null);
|
|
1616
|
+
c.current || (c.current = _a(n));
|
|
1589
1617
|
const l = c.current, [i, u] = y({
|
|
1590
1618
|
artifacts: [],
|
|
1591
1619
|
activeArtifactId: null,
|
|
@@ -1595,8 +1623,8 @@ function Pa({ children: t, config: r = {} }) {
|
|
|
1595
1623
|
openTabs: [],
|
|
1596
1624
|
tabViewModes: {},
|
|
1597
1625
|
forceEmptyView: !1
|
|
1598
|
-
}), [
|
|
1599
|
-
|
|
1626
|
+
}), [g, v] = y(() => l.getPanelTypes());
|
|
1627
|
+
I(() => {
|
|
1600
1628
|
const p = l.state.subscribe((s) => {
|
|
1601
1629
|
u({
|
|
1602
1630
|
artifacts: s.artifacts,
|
|
@@ -1613,21 +1641,21 @@ function Pa({ children: t, config: r = {} }) {
|
|
|
1613
1641
|
p(), l.destroy();
|
|
1614
1642
|
};
|
|
1615
1643
|
}, [l]);
|
|
1616
|
-
const o =
|
|
1644
|
+
const o = N(() => i.activeArtifactId && i.artifacts.find((p) => p.id === i.activeArtifactId) || null, [i.artifacts, i.activeArtifactId]), a = i.artifacts.filter((p) => !p.isInline).length, x = a > 0, S = N(() => o ? l.getPanelUrl(o) : null, [o, l]), A = d((p) => {
|
|
1617
1645
|
l.setTheme(p), l.applyTheme();
|
|
1618
|
-
}, [l]),
|
|
1619
|
-
l.registerPanel(p, s),
|
|
1646
|
+
}, [l]), R = d((p, s) => {
|
|
1647
|
+
l.registerPanel(p, s), v(l.getPanelTypes());
|
|
1620
1648
|
}, [l]), _ = d((p) => {
|
|
1621
|
-
l.unregisterPanel(p),
|
|
1622
|
-
}, [l]),
|
|
1649
|
+
l.unregisterPanel(p), v(l.getPanelTypes());
|
|
1650
|
+
}, [l]), L = N(() => ({
|
|
1623
1651
|
instance: l,
|
|
1624
1652
|
state: i,
|
|
1625
1653
|
activeArtifact: o,
|
|
1626
1654
|
artifactCount: a,
|
|
1627
|
-
hasArtifacts:
|
|
1655
|
+
hasArtifacts: x,
|
|
1628
1656
|
// Panel computed
|
|
1629
|
-
panelTypes:
|
|
1630
|
-
activePanelUrl:
|
|
1657
|
+
panelTypes: g,
|
|
1658
|
+
activePanelUrl: S,
|
|
1631
1659
|
// Methods
|
|
1632
1660
|
processMessage: l.processMessage,
|
|
1633
1661
|
initializeContent: l.initializeContent,
|
|
@@ -1644,7 +1672,7 @@ function Pa({ children: t, config: r = {} }) {
|
|
|
1644
1672
|
sendToPanel: l.sendToPanel,
|
|
1645
1673
|
// Panel management
|
|
1646
1674
|
hasPanel: l.hasPanel,
|
|
1647
|
-
registerPanel:
|
|
1675
|
+
registerPanel: R,
|
|
1648
1676
|
unregisterPanel: _,
|
|
1649
1677
|
getPanelTypes: l.getPanelTypes,
|
|
1650
1678
|
// Multi-tab
|
|
@@ -1658,76 +1686,76 @@ function Pa({ children: t, config: r = {} }) {
|
|
|
1658
1686
|
clearArtifacts: () => l.state.clear(),
|
|
1659
1687
|
// Theme
|
|
1660
1688
|
applyTheme: l.applyTheme,
|
|
1661
|
-
setTheme:
|
|
1689
|
+
setTheme: A,
|
|
1662
1690
|
getTheme: l.getTheme
|
|
1663
1691
|
}), [
|
|
1664
1692
|
l,
|
|
1665
1693
|
i,
|
|
1666
1694
|
o,
|
|
1667
1695
|
a,
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1696
|
+
x,
|
|
1697
|
+
g,
|
|
1698
|
+
S,
|
|
1699
|
+
A,
|
|
1700
|
+
R,
|
|
1673
1701
|
_
|
|
1674
1702
|
]);
|
|
1675
|
-
return /* @__PURE__ */ e.createElement(
|
|
1703
|
+
return /* @__PURE__ */ e.createElement(Dt.Provider, { value: L }, t);
|
|
1676
1704
|
}
|
|
1677
|
-
function
|
|
1678
|
-
const t =
|
|
1705
|
+
function Ae() {
|
|
1706
|
+
const t = va(Dt);
|
|
1679
1707
|
if (!t)
|
|
1680
1708
|
throw new Error("useArtifactuse must be used within an ArtifactuseProvider");
|
|
1681
1709
|
return t;
|
|
1682
1710
|
}
|
|
1683
|
-
function
|
|
1684
|
-
const { on: c, off: l } =
|
|
1685
|
-
|
|
1686
|
-
const i = c(t,
|
|
1711
|
+
function Ua(t, n) {
|
|
1712
|
+
const { on: c, off: l } = Ae();
|
|
1713
|
+
I(() => {
|
|
1714
|
+
const i = c(t, n);
|
|
1687
1715
|
return () => {
|
|
1688
|
-
typeof i == "function" ? i() : l(t,
|
|
1716
|
+
typeof i == "function" ? i() : l(t, n);
|
|
1689
1717
|
};
|
|
1690
|
-
}, [t,
|
|
1718
|
+
}, [t, n, c, l]);
|
|
1691
1719
|
}
|
|
1692
|
-
function
|
|
1720
|
+
function qa() {
|
|
1693
1721
|
const {
|
|
1694
1722
|
registerPanel: t,
|
|
1695
|
-
unregisterPanel:
|
|
1723
|
+
unregisterPanel: n,
|
|
1696
1724
|
hasPanel: c,
|
|
1697
1725
|
panelTypes: l,
|
|
1698
1726
|
instance: i
|
|
1699
|
-
} =
|
|
1727
|
+
} = Ae(), u = d((v) => c({ type: v }), [c]), g = d((v, o = {}) => {
|
|
1700
1728
|
var a;
|
|
1701
|
-
return ((a = i.panelResolver) == null ? void 0 : a.resolve(
|
|
1729
|
+
return ((a = i.panelResolver) == null ? void 0 : a.resolve(v, o)) || null;
|
|
1702
1730
|
}, [i]);
|
|
1703
1731
|
return {
|
|
1704
1732
|
register: t,
|
|
1705
|
-
unregister:
|
|
1733
|
+
unregister: n,
|
|
1706
1734
|
isRegistered: u,
|
|
1707
|
-
getPanelUrl:
|
|
1735
|
+
getPanelUrl: g,
|
|
1708
1736
|
types: l,
|
|
1709
|
-
defaults:
|
|
1737
|
+
defaults: zt
|
|
1710
1738
|
};
|
|
1711
1739
|
}
|
|
1712
|
-
const
|
|
1713
|
-
ArtifactuseProvider:
|
|
1714
|
-
useArtifactuse:
|
|
1715
|
-
useArtifactuseEvent:
|
|
1716
|
-
usePanelRegistry:
|
|
1717
|
-
DEFAULT_PANELS:
|
|
1740
|
+
const Ya = {
|
|
1741
|
+
ArtifactuseProvider: Da,
|
|
1742
|
+
useArtifactuse: Ae,
|
|
1743
|
+
useArtifactuseEvent: Ua,
|
|
1744
|
+
usePanelRegistry: qa,
|
|
1745
|
+
DEFAULT_PANELS: zt
|
|
1718
1746
|
};
|
|
1719
1747
|
export {
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1748
|
+
za as ArtifactuseAgentMessage,
|
|
1749
|
+
wa as ArtifactuseCard,
|
|
1750
|
+
Ca as ArtifactuseInlineForm,
|
|
1751
|
+
Za as ArtifactusePanel,
|
|
1752
|
+
Ka as ArtifactusePanelToggle,
|
|
1753
|
+
Da as ArtifactuseProvider,
|
|
1754
|
+
Fa as ArtifactuseSocialPreview,
|
|
1755
|
+
Ia as ArtifactuseViewer,
|
|
1756
|
+
zt as DEFAULT_PANELS,
|
|
1757
|
+
Ya as default,
|
|
1758
|
+
Ae as useArtifactuse,
|
|
1759
|
+
Ua as useArtifactuseEvent,
|
|
1760
|
+
qa as usePanelRegistry
|
|
1733
1761
|
};
|