artifactuse 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +771 -0
- package/dist/core/bridge.d.ts +37 -0
- package/dist/core/detector.d.ts +134 -0
- package/dist/core/highlight.d.ts +53 -0
- package/dist/core/index.d.ts +124 -0
- package/dist/core/processors/audio.d.ts +36 -0
- package/dist/core/processors/audioPlayer.d.ts +39 -0
- package/dist/core/processors/codeEmbed.d.ts +58 -0
- package/dist/core/processors/dataViz.d.ts +28 -0
- package/dist/core/processors/design.d.ts +50 -0
- package/dist/core/processors/document.d.ts +38 -0
- package/dist/core/processors/image.d.ts +23 -0
- package/dist/core/processors/index.d.ts +62 -0
- package/dist/core/processors/interactive.d.ts +57 -0
- package/dist/core/processors/map.d.ts +29 -0
- package/dist/core/processors/math.d.ts +75 -0
- package/dist/core/processors/mermaid.d.ts +72 -0
- package/dist/core/processors/social.d.ts +63 -0
- package/dist/core/processors/table.d.ts +43 -0
- package/dist/core/processors/video.d.ts +69 -0
- package/dist/core/state.d.ts +37 -0
- package/dist/core/theme.d.ts +109 -0
- package/dist/index-_nD5FZzs.js +4300 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +115 -0
- package/dist/jszip.min-CdmYyw5L.js +2324 -0
- package/dist/react/ArtifactuseAgentMessage.d.ts +31 -0
- package/dist/react/ArtifactuseCard.d.ts +13 -0
- package/dist/react/ArtifactuseInlineForm.d.ts +16 -0
- package/dist/react/ArtifactusePanel.d.ts +12 -0
- package/dist/react/ArtifactusePanelToggle.d.ts +8 -0
- package/dist/react/ArtifactuseSocialPreview.d.ts +6 -0
- package/dist/react/ArtifactuseViewer.d.ts +14 -0
- package/dist/react/index.d.ts +108 -0
- package/dist/react/index.js +1387 -0
- package/dist/svelte/index.d.ts +439 -0
- package/dist/svelte/index.js +2556 -0
- package/dist/vue/index.d.ts +296 -0
- package/dist/vue/index.js +2745 -0
- package/dist/vue2/composables.d.ts +291 -0
- package/dist/vue2/index.d.ts +10 -0
- package/dist/vue2/index.js +27979 -0
- package/package.json +127 -0
|
@@ -0,0 +1,2745 @@
|
|
|
1
|
+
import { ref as A, computed as C, createElementBlock as a, openBlock as t, normalizeClass as j, createElementVNode as e, toDisplayString as i, withModifiers as fe, onMounted as ge, watch as ue, Fragment as I, createCommentVNode as p, renderList as ce, createTextVNode as J, h as ae, normalizeStyle as $e, createStaticVNode as at, createBlock as ye, resolveDynamicComponent as st, nextTick as he, onUnmounted as Fe, Teleport as Ue, createVNode as be, Transition as Me, withCtx as Le, withKeys as it, onBeforeUnmount as lt, unref as k, reactive as Ne, provide as nt, inject as ot } from "vue";
|
|
2
|
+
import { g as Te, f as je, a as Ie, b as qe, n as rt, i as ct, D as ut, c as Je } from "../index-_nD5FZzs.js";
|
|
3
|
+
import { J as dt } from "../jszip.min-CdmYyw5L.js";
|
|
4
|
+
const vt = { class: "artifactuse-card__icon" }, ft = ["innerHTML"], pt = { class: "artifactuse-card__content" }, mt = { class: "artifactuse-card__title" }, _t = { class: "artifactuse-card__meta" }, ht = { class: "artifactuse-card__type" }, yt = { class: "artifactuse-card__size" }, gt = { class: "artifactuse-card__actions" }, kt = ["title"], wt = {
|
|
5
|
+
key: 0,
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
fill: "none",
|
|
8
|
+
stroke: "currentColor",
|
|
9
|
+
"stroke-width": "2"
|
|
10
|
+
}, bt = {
|
|
11
|
+
key: 1,
|
|
12
|
+
viewBox: "0 0 24 24",
|
|
13
|
+
fill: "none",
|
|
14
|
+
stroke: "currentColor",
|
|
15
|
+
"stroke-width": "2"
|
|
16
|
+
}, Ct = {
|
|
17
|
+
__name: "ArtifactuseCard",
|
|
18
|
+
props: {
|
|
19
|
+
artifact: {
|
|
20
|
+
type: Object,
|
|
21
|
+
required: !0
|
|
22
|
+
},
|
|
23
|
+
isActive: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !1
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
emits: ["open", "copy", "download"],
|
|
29
|
+
setup(M, { emit: u }) {
|
|
30
|
+
const f = M, y = u, r = A(!1), F = C(() => Te(f.artifact.language)), E = C(() => {
|
|
31
|
+
var w;
|
|
32
|
+
return je(f.artifact.size || ((w = f.artifact.code) == null ? void 0 : w.length) || 0);
|
|
33
|
+
}), $ = C(() => Ie(f.artifact.language));
|
|
34
|
+
function _(w) {
|
|
35
|
+
w.stopPropagation(), y("open", f.artifact);
|
|
36
|
+
}
|
|
37
|
+
async function l() {
|
|
38
|
+
try {
|
|
39
|
+
await navigator.clipboard.writeText(f.artifact.code), r.value = !0, setTimeout(() => {
|
|
40
|
+
r.value = !1;
|
|
41
|
+
}, 2e3), y("copy", f.artifact);
|
|
42
|
+
} catch (w) {
|
|
43
|
+
console.error("Failed to copy:", w);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function h() {
|
|
47
|
+
var q;
|
|
48
|
+
const w = new Blob([f.artifact.code], { type: "text/plain" }), L = URL.createObjectURL(w), S = document.createElement("a"), V = qe(f.artifact.language), U = ((q = f.artifact.title) == null ? void 0 : q.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
|
|
49
|
+
S.href = L, S.download = `${U}.${V}`, document.body.appendChild(S), S.click(), document.body.removeChild(S), URL.revokeObjectURL(L), y("download", f.artifact);
|
|
50
|
+
}
|
|
51
|
+
return (w, L) => (t(), a("div", {
|
|
52
|
+
class: j(["artifactuse-card", { "artifactuse-card--active": M.isActive }]),
|
|
53
|
+
onClick: _
|
|
54
|
+
}, [
|
|
55
|
+
e("div", vt, [
|
|
56
|
+
(t(), a("svg", {
|
|
57
|
+
viewBox: "0 0 24 24",
|
|
58
|
+
fill: "none",
|
|
59
|
+
stroke: "currentColor",
|
|
60
|
+
"stroke-width": "1.5",
|
|
61
|
+
innerHTML: $.value
|
|
62
|
+
}, null, 8, ft))
|
|
63
|
+
]),
|
|
64
|
+
e("div", pt, [
|
|
65
|
+
e("div", mt, i(M.artifact.title), 1),
|
|
66
|
+
e("div", _t, [
|
|
67
|
+
e("span", ht, i(F.value), 1),
|
|
68
|
+
L[0] || (L[0] = e("span", { class: "artifactuse-card__separator" }, "•", -1)),
|
|
69
|
+
e("span", yt, i(E.value), 1)
|
|
70
|
+
])
|
|
71
|
+
]),
|
|
72
|
+
e("div", gt, [
|
|
73
|
+
e("button", {
|
|
74
|
+
class: "artifactuse-card__action",
|
|
75
|
+
onClick: fe(l, ["stop"]),
|
|
76
|
+
title: r.value ? "Copied!" : "Copy code"
|
|
77
|
+
}, [
|
|
78
|
+
r.value ? (t(), a("svg", bt, [...L[2] || (L[2] = [
|
|
79
|
+
e("polyline", { points: "20 6 9 17 4 12" }, null, -1)
|
|
80
|
+
])])) : (t(), a("svg", wt, [...L[1] || (L[1] = [
|
|
81
|
+
e("rect", {
|
|
82
|
+
x: "9",
|
|
83
|
+
y: "9",
|
|
84
|
+
width: "13",
|
|
85
|
+
height: "13",
|
|
86
|
+
rx: "2",
|
|
87
|
+
ry: "2"
|
|
88
|
+
}, null, -1),
|
|
89
|
+
e("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
|
|
90
|
+
])]))
|
|
91
|
+
], 8, kt),
|
|
92
|
+
e("button", {
|
|
93
|
+
class: "artifactuse-card__action",
|
|
94
|
+
onClick: fe(h, ["stop"]),
|
|
95
|
+
title: "Download file"
|
|
96
|
+
}, [...L[3] || (L[3] = [
|
|
97
|
+
e("svg", {
|
|
98
|
+
viewBox: "0 0 24 24",
|
|
99
|
+
fill: "none",
|
|
100
|
+
stroke: "currentColor",
|
|
101
|
+
"stroke-width": "2"
|
|
102
|
+
}, [
|
|
103
|
+
e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
104
|
+
e("polyline", { points: "7 10 12 15 17 10" }),
|
|
105
|
+
e("line", {
|
|
106
|
+
x1: "12",
|
|
107
|
+
y1: "15",
|
|
108
|
+
x2: "12",
|
|
109
|
+
y2: "3"
|
|
110
|
+
})
|
|
111
|
+
], -1)
|
|
112
|
+
])])
|
|
113
|
+
]),
|
|
114
|
+
L[4] || (L[4] = e("div", { class: "artifactuse-card__arrow" }, [
|
|
115
|
+
e("svg", {
|
|
116
|
+
viewBox: "0 0 24 24",
|
|
117
|
+
fill: "none",
|
|
118
|
+
stroke: "currentColor",
|
|
119
|
+
"stroke-width": "2"
|
|
120
|
+
}, [
|
|
121
|
+
e("polyline", { points: "9 18 15 12 9 6" })
|
|
122
|
+
])
|
|
123
|
+
], -1))
|
|
124
|
+
], 2));
|
|
125
|
+
}
|
|
126
|
+
}, xt = ["data-artifactuse-theme"], $t = {
|
|
127
|
+
key: 0,
|
|
128
|
+
class: "artifactuse-form-collapsed"
|
|
129
|
+
}, Mt = { class: "artifactuse-form-collapsed-icon" }, Lt = {
|
|
130
|
+
key: 0,
|
|
131
|
+
viewBox: "0 0 24 24",
|
|
132
|
+
fill: "none",
|
|
133
|
+
stroke: "currentColor",
|
|
134
|
+
"stroke-width": "2.5",
|
|
135
|
+
"stroke-linecap": "round",
|
|
136
|
+
"stroke-linejoin": "round"
|
|
137
|
+
}, Tt = {
|
|
138
|
+
key: 1,
|
|
139
|
+
viewBox: "0 0 24 24",
|
|
140
|
+
fill: "none",
|
|
141
|
+
stroke: "currentColor",
|
|
142
|
+
"stroke-width": "2.5",
|
|
143
|
+
"stroke-linecap": "round",
|
|
144
|
+
"stroke-linejoin": "round"
|
|
145
|
+
}, Ht = {
|
|
146
|
+
key: 2,
|
|
147
|
+
viewBox: "0 0 24 24",
|
|
148
|
+
fill: "none",
|
|
149
|
+
stroke: "currentColor",
|
|
150
|
+
"stroke-width": "2.5",
|
|
151
|
+
"stroke-linecap": "round",
|
|
152
|
+
"stroke-linejoin": "round"
|
|
153
|
+
}, Pt = { class: "artifactuse-form-collapsed-title" }, At = {
|
|
154
|
+
key: 0,
|
|
155
|
+
class: "artifactuse-form-header"
|
|
156
|
+
}, Bt = {
|
|
157
|
+
key: 0,
|
|
158
|
+
class: "artifactuse-form-title"
|
|
159
|
+
}, Et = {
|
|
160
|
+
key: 1,
|
|
161
|
+
class: "artifactuse-form-description"
|
|
162
|
+
}, zt = {
|
|
163
|
+
key: 1,
|
|
164
|
+
class: "artifactuse-form-buttons"
|
|
165
|
+
}, St = ["disabled", "onClick"], It = ["innerHTML"], qt = { class: "artifactuse-form-fields" }, Ft = {
|
|
166
|
+
key: 0,
|
|
167
|
+
class: "artifactuse-form-buttons"
|
|
168
|
+
}, Vt = ["type", "disabled", "onClick"], Rt = {
|
|
169
|
+
key: 0,
|
|
170
|
+
class: "artifactuse-form-btn-spinner"
|
|
171
|
+
}, Ot = ["innerHTML"], Dt = {
|
|
172
|
+
key: 1,
|
|
173
|
+
class: "artifactuse-form-divider"
|
|
174
|
+
}, Ut = {
|
|
175
|
+
key: 2,
|
|
176
|
+
class: "artifactuse-form-heading"
|
|
177
|
+
}, Nt = {
|
|
178
|
+
key: 3,
|
|
179
|
+
class: "artifactuse-form-field"
|
|
180
|
+
}, jt = { class: "artifactuse-checkbox-label" }, Jt = ["checked", "disabled", "onChange"], Xt = { class: "artifactuse-checkbox-text" }, Wt = {
|
|
181
|
+
key: 0,
|
|
182
|
+
class: "artifactuse-required"
|
|
183
|
+
}, Zt = {
|
|
184
|
+
key: 0,
|
|
185
|
+
class: "artifactuse-help-text"
|
|
186
|
+
}, Kt = {
|
|
187
|
+
key: 1,
|
|
188
|
+
class: "artifactuse-error-text"
|
|
189
|
+
}, Yt = {
|
|
190
|
+
key: 4,
|
|
191
|
+
class: "artifactuse-form-field"
|
|
192
|
+
}, Gt = ["for"], Qt = {
|
|
193
|
+
key: 0,
|
|
194
|
+
class: "artifactuse-required"
|
|
195
|
+
}, ea = ["id", "type", "value", "placeholder", "disabled", "required", "onInput"], ta = ["id", "value", "placeholder", "disabled", "required", "rows", "onInput"], aa = ["id", "value", "disabled", "required", "onChange"], sa = { value: "" }, ia = ["value", "disabled"], la = {
|
|
196
|
+
key: 3,
|
|
197
|
+
class: "artifactuse-radio-group"
|
|
198
|
+
}, na = ["name", "value", "checked", "disabled", "onChange"], oa = {
|
|
199
|
+
key: 4,
|
|
200
|
+
class: "artifactuse-help-text"
|
|
201
|
+
}, ra = {
|
|
202
|
+
key: 5,
|
|
203
|
+
class: "artifactuse-error-text"
|
|
204
|
+
}, ca = {
|
|
205
|
+
key: 0,
|
|
206
|
+
class: "artifactuse-form-buttons artifactuse-form-buttons-default"
|
|
207
|
+
}, ua = ["disabled"], da = {
|
|
208
|
+
key: 0,
|
|
209
|
+
class: "artifactuse-form-btn-spinner"
|
|
210
|
+
}, va = {
|
|
211
|
+
__name: "ArtifactuseInlineForm",
|
|
212
|
+
props: {
|
|
213
|
+
artifact: { type: Object, required: !0 },
|
|
214
|
+
theme: { type: String, default: "dark" },
|
|
215
|
+
accent: { type: String, default: null },
|
|
216
|
+
initialState: {
|
|
217
|
+
type: String,
|
|
218
|
+
default: "active",
|
|
219
|
+
validator: (M) => ["active", "submitted", "cancelled", "inactive"].includes(M)
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
emits: ["submit", "cancel", "reset", "button-click"],
|
|
223
|
+
setup(M, { emit: u }) {
|
|
224
|
+
const f = M, y = u, r = A(f.initialState), F = C(() => r.value !== "active"), E = C(() => r.value === "active" ? "" : `artifactuse-form--${r.value}`);
|
|
225
|
+
function $(g) {
|
|
226
|
+
r.value = g;
|
|
227
|
+
}
|
|
228
|
+
const _ = C(() => {
|
|
229
|
+
try {
|
|
230
|
+
return JSON.parse(f.artifact.code);
|
|
231
|
+
} catch {
|
|
232
|
+
return { title: "Invalid Form", variant: "fields", data: { fields: [] } };
|
|
233
|
+
}
|
|
234
|
+
}), l = A(null), h = C(() => f.artifact.id || _.value.id || `form-${Date.now()}`), w = C(() => `artifactuse-form-${_.value.variant || "fields"}`), L = C(() => _.value.title || "Form"), S = A({}), V = A({}), U = A(!1), q = C(() => {
|
|
235
|
+
var g;
|
|
236
|
+
return ((g = _.value.data) == null ? void 0 : g.fields) || [];
|
|
237
|
+
}), se = C(() => {
|
|
238
|
+
var g;
|
|
239
|
+
return _.value.variant === "buttons" ? ((g = _.value.data) == null ? void 0 : g.fields) || [] : [];
|
|
240
|
+
}), B = C(() => q.value.some((g) => g.type === "buttons"));
|
|
241
|
+
function Z(g) {
|
|
242
|
+
if (!g) return null;
|
|
243
|
+
const T = g.trim();
|
|
244
|
+
if (T.startsWith("#")) {
|
|
245
|
+
let o = T.slice(1);
|
|
246
|
+
if (o.length === 3 && (o = o.split("").map((H) => H + H).join("")), o.length === 6) {
|
|
247
|
+
const H = parseInt(o.slice(0, 2), 16), ie = parseInt(o.slice(2, 4), 16), pe = parseInt(o.slice(4, 6), 16);
|
|
248
|
+
if (!isNaN(H) && !isNaN(ie) && !isNaN(pe)) return `${H}, ${ie}, ${pe}`;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const n = T.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
|
|
252
|
+
if (n) return `${n[1]}, ${n[2]}, ${n[3]}`;
|
|
253
|
+
const z = T.split(/[\s,]+/).map(Number).filter((o) => !isNaN(o));
|
|
254
|
+
return z.length >= 3 ? `${z[0]}, ${z[1]}, ${z[2]}` : null;
|
|
255
|
+
}
|
|
256
|
+
function D() {
|
|
257
|
+
if (l.value && f.accent) {
|
|
258
|
+
const g = Z(f.accent);
|
|
259
|
+
g && l.value.style.setProperty("--artifactuse-primary", g);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
ge(() => {
|
|
263
|
+
D(), r.value = f.initialState;
|
|
264
|
+
}), ue(() => f.accent, D), ue(() => f.initialState, (g) => {
|
|
265
|
+
r.value = g;
|
|
266
|
+
});
|
|
267
|
+
function X() {
|
|
268
|
+
var n;
|
|
269
|
+
const g = {};
|
|
270
|
+
q.value.forEach((z) => {
|
|
271
|
+
["buttons", "divider", "heading"].includes(z.type) || (z.defaultValue !== void 0 ? g[z.name] = z.defaultValue : z.type === "checkbox" ? g[z.name] = !1 : g[z.name] = "");
|
|
272
|
+
}), (n = _.value.data) != null && n.defaults && Object.assign(g, _.value.data.defaults), S.value = g;
|
|
273
|
+
}
|
|
274
|
+
X(), ue(() => f.artifact.code, X);
|
|
275
|
+
function Q(g) {
|
|
276
|
+
return ["text", "email", "password", "tel", "url", "number", "date", "time", "datetime-local"].includes(g);
|
|
277
|
+
}
|
|
278
|
+
function d(g) {
|
|
279
|
+
return g ? g.map((T) => typeof T == "string" ? { label: T, value: T } : T) : [];
|
|
280
|
+
}
|
|
281
|
+
function m(g, T) {
|
|
282
|
+
S.value[g] = T, V.value[g] && delete V.value[g];
|
|
283
|
+
}
|
|
284
|
+
function ee() {
|
|
285
|
+
var z;
|
|
286
|
+
const g = {};
|
|
287
|
+
q.value.forEach((o) => {
|
|
288
|
+
if (["buttons", "divider", "heading"].includes(o.type)) return;
|
|
289
|
+
const H = S.value[o.name];
|
|
290
|
+
if (o.required && !H && H !== 0 && H !== !1) {
|
|
291
|
+
g[o.name] = `${o.label || "This field"} is required`;
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
if (o.pattern && H && !new RegExp(o.pattern).test(H)) {
|
|
295
|
+
g[o.name] = o.patternMessage || `${o.label || "This field"} is invalid`;
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if (o.type === "email" && H && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(H)) {
|
|
299
|
+
g[o.name] = "Please enter a valid email address";
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (o.minLength && H && H.length < o.minLength) {
|
|
303
|
+
g[o.name] = `Minimum ${o.minLength} characters required`;
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
if (o.maxLength && H && H.length > o.maxLength) {
|
|
307
|
+
g[o.name] = `Maximum ${o.maxLength} characters allowed`;
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
const n = (z = _.value.data) == null ? void 0 : z.validation;
|
|
312
|
+
return n && Object.entries(n).forEach(([o, H]) => {
|
|
313
|
+
if (g[o]) return;
|
|
314
|
+
const ie = S.value[o];
|
|
315
|
+
H.pattern && ie && (new RegExp(H.pattern).test(ie) || (g[o] = H.message || `${o} is invalid`));
|
|
316
|
+
}), V.value = g, Object.keys(g).length === 0;
|
|
317
|
+
}
|
|
318
|
+
function K() {
|
|
319
|
+
X(), V.value = {};
|
|
320
|
+
}
|
|
321
|
+
function Y() {
|
|
322
|
+
ee() && (U.value = !0, y("submit", {
|
|
323
|
+
formId: h.value,
|
|
324
|
+
action: "submit",
|
|
325
|
+
values: { ...S.value },
|
|
326
|
+
timestamp: Date.now()
|
|
327
|
+
}), setTimeout(() => {
|
|
328
|
+
U.value = !1, $("submitted");
|
|
329
|
+
}, 300));
|
|
330
|
+
}
|
|
331
|
+
function te(g) {
|
|
332
|
+
const T = g.action || "custom";
|
|
333
|
+
switch (T) {
|
|
334
|
+
case "submit":
|
|
335
|
+
Y();
|
|
336
|
+
break;
|
|
337
|
+
case "cancel":
|
|
338
|
+
y("cancel", {
|
|
339
|
+
formId: h.value,
|
|
340
|
+
action: "cancel",
|
|
341
|
+
buttonName: g.name || "cancel",
|
|
342
|
+
timestamp: Date.now()
|
|
343
|
+
}), setTimeout(() => {
|
|
344
|
+
$("cancelled");
|
|
345
|
+
}, 150);
|
|
346
|
+
break;
|
|
347
|
+
case "reset":
|
|
348
|
+
K(), y("reset", {
|
|
349
|
+
formId: h.value,
|
|
350
|
+
action: "reset",
|
|
351
|
+
buttonName: g.name || "reset",
|
|
352
|
+
timestamp: Date.now()
|
|
353
|
+
});
|
|
354
|
+
break;
|
|
355
|
+
case "custom":
|
|
356
|
+
default:
|
|
357
|
+
y("button-click", {
|
|
358
|
+
formId: h.value,
|
|
359
|
+
action: T,
|
|
360
|
+
buttonName: g.name || g.label,
|
|
361
|
+
buttonLabel: g.label,
|
|
362
|
+
values: { ...S.value },
|
|
363
|
+
timestamp: Date.now()
|
|
364
|
+
}), setTimeout(() => {
|
|
365
|
+
$("submitted");
|
|
366
|
+
}, 150);
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return (g, T) => (t(), a("div", {
|
|
371
|
+
ref_key: "containerRef",
|
|
372
|
+
ref: l,
|
|
373
|
+
class: j([
|
|
374
|
+
"artifactuse-inline-form",
|
|
375
|
+
w.value,
|
|
376
|
+
E.value
|
|
377
|
+
]),
|
|
378
|
+
"data-artifactuse-theme": M.theme
|
|
379
|
+
}, [
|
|
380
|
+
F.value ? (t(), a("div", $t, [
|
|
381
|
+
e("div", Mt, [
|
|
382
|
+
r.value === "submitted" ? (t(), a("svg", Lt, [...T[1] || (T[1] = [
|
|
383
|
+
e("polyline", { points: "20 6 9 17 4 12" }, null, -1)
|
|
384
|
+
])])) : r.value === "cancelled" ? (t(), a("svg", Tt, [...T[2] || (T[2] = [
|
|
385
|
+
e("line", {
|
|
386
|
+
x1: "18",
|
|
387
|
+
y1: "6",
|
|
388
|
+
x2: "6",
|
|
389
|
+
y2: "18"
|
|
390
|
+
}, null, -1),
|
|
391
|
+
e("line", {
|
|
392
|
+
x1: "6",
|
|
393
|
+
y1: "6",
|
|
394
|
+
x2: "18",
|
|
395
|
+
y2: "18"
|
|
396
|
+
}, null, -1)
|
|
397
|
+
])])) : (t(), a("svg", Ht, [...T[3] || (T[3] = [
|
|
398
|
+
e("line", {
|
|
399
|
+
x1: "5",
|
|
400
|
+
y1: "12",
|
|
401
|
+
x2: "19",
|
|
402
|
+
y2: "12"
|
|
403
|
+
}, null, -1)
|
|
404
|
+
])]))
|
|
405
|
+
]),
|
|
406
|
+
e("span", Pt, i(L.value), 1)
|
|
407
|
+
])) : (t(), a(I, { key: 1 }, [
|
|
408
|
+
_.value.title || _.value.description ? (t(), a("div", At, [
|
|
409
|
+
_.value.title ? (t(), a("div", Bt, i(_.value.title), 1)) : p("", !0),
|
|
410
|
+
_.value.description ? (t(), a("p", Et, i(_.value.description), 1)) : p("", !0)
|
|
411
|
+
])) : p("", !0),
|
|
412
|
+
_.value.variant === "buttons" ? (t(), a("div", zt, [
|
|
413
|
+
(t(!0), a(I, null, ce(se.value, (n) => (t(), a("button", {
|
|
414
|
+
key: n.name || n.label,
|
|
415
|
+
type: "button",
|
|
416
|
+
class: j(["artifactuse-form-btn", `artifactuse-form-btn-${n.variant || "secondary"}`]),
|
|
417
|
+
disabled: n.disabled || U.value,
|
|
418
|
+
onClick: (z) => te(n)
|
|
419
|
+
}, [
|
|
420
|
+
n.icon ? (t(), a("span", {
|
|
421
|
+
key: 0,
|
|
422
|
+
class: "artifactuse-form-btn-icon",
|
|
423
|
+
innerHTML: n.icon
|
|
424
|
+
}, null, 8, It)) : p("", !0),
|
|
425
|
+
J(" " + i(n.label), 1)
|
|
426
|
+
], 10, St))), 128))
|
|
427
|
+
])) : (t(), a("form", {
|
|
428
|
+
key: 2,
|
|
429
|
+
class: "artifactuse-form",
|
|
430
|
+
onSubmit: fe(Y, ["prevent"])
|
|
431
|
+
}, [
|
|
432
|
+
e("div", qt, [
|
|
433
|
+
(t(!0), a(I, null, ce(q.value, (n, z) => (t(), a(I, {
|
|
434
|
+
key: n.name || z
|
|
435
|
+
}, [
|
|
436
|
+
n.type === "buttons" ? (t(), a("div", Ft, [
|
|
437
|
+
(t(!0), a(I, null, ce(n.fields || [], (o) => (t(), a("button", {
|
|
438
|
+
key: o.name || o.label,
|
|
439
|
+
type: o.action === "submit" ? "submit" : "button",
|
|
440
|
+
class: j(["artifactuse-form-btn", `artifactuse-form-btn-${o.variant || "secondary"}`]),
|
|
441
|
+
disabled: o.disabled || o.action === "submit" && U.value,
|
|
442
|
+
onClick: (H) => o.action !== "submit" ? te(o) : null
|
|
443
|
+
}, [
|
|
444
|
+
U.value && o.action === "submit" ? (t(), a("span", Rt)) : o.icon ? (t(), a("span", {
|
|
445
|
+
key: 1,
|
|
446
|
+
class: "artifactuse-form-btn-icon",
|
|
447
|
+
innerHTML: o.icon
|
|
448
|
+
}, null, 8, Ot)) : p("", !0),
|
|
449
|
+
J(" " + i(U.value && o.action === "submit" ? "Submitting..." : o.label), 1)
|
|
450
|
+
], 10, Vt))), 128))
|
|
451
|
+
])) : n.type === "divider" ? (t(), a("div", Dt)) : n.type === "heading" ? (t(), a("div", Ut, i(n.label), 1)) : n.type === "checkbox" ? (t(), a("div", Nt, [
|
|
452
|
+
e("label", jt, [
|
|
453
|
+
e("input", {
|
|
454
|
+
type: "checkbox",
|
|
455
|
+
checked: S.value[n.name],
|
|
456
|
+
disabled: n.disabled,
|
|
457
|
+
class: "artifactuse-checkbox",
|
|
458
|
+
onChange: (o) => m(n.name, o.target.checked)
|
|
459
|
+
}, null, 40, Jt),
|
|
460
|
+
e("span", Xt, [
|
|
461
|
+
J(i(n.label) + " ", 1),
|
|
462
|
+
n.required ? (t(), a("span", Wt, "*")) : p("", !0)
|
|
463
|
+
])
|
|
464
|
+
]),
|
|
465
|
+
n.helpText ? (t(), a("span", Zt, i(n.helpText), 1)) : p("", !0),
|
|
466
|
+
V.value[n.name] ? (t(), a("span", Kt, i(V.value[n.name]), 1)) : p("", !0)
|
|
467
|
+
])) : (t(), a("div", Yt, [
|
|
468
|
+
e("label", {
|
|
469
|
+
for: `${h.value}-${n.name}`,
|
|
470
|
+
class: "artifactuse-label"
|
|
471
|
+
}, [
|
|
472
|
+
J(i(n.label) + " ", 1),
|
|
473
|
+
n.required ? (t(), a("span", Qt, "*")) : p("", !0)
|
|
474
|
+
], 8, Gt),
|
|
475
|
+
Q(n.type) ? (t(), a("input", {
|
|
476
|
+
key: 0,
|
|
477
|
+
id: `${h.value}-${n.name}`,
|
|
478
|
+
type: n.type,
|
|
479
|
+
value: S.value[n.name],
|
|
480
|
+
placeholder: n.placeholder,
|
|
481
|
+
disabled: n.disabled,
|
|
482
|
+
required: n.required,
|
|
483
|
+
class: "artifactuse-input",
|
|
484
|
+
onInput: (o) => m(n.name, o.target.value)
|
|
485
|
+
}, null, 40, ea)) : n.type === "textarea" ? (t(), a("textarea", {
|
|
486
|
+
key: 1,
|
|
487
|
+
id: `${h.value}-${n.name}`,
|
|
488
|
+
value: S.value[n.name],
|
|
489
|
+
placeholder: n.placeholder,
|
|
490
|
+
disabled: n.disabled,
|
|
491
|
+
required: n.required,
|
|
492
|
+
rows: n.rows || 3,
|
|
493
|
+
class: "artifactuse-textarea",
|
|
494
|
+
onInput: (o) => m(n.name, o.target.value)
|
|
495
|
+
}, null, 40, ta)) : n.type === "select" ? (t(), a("select", {
|
|
496
|
+
key: 2,
|
|
497
|
+
id: `${h.value}-${n.name}`,
|
|
498
|
+
value: S.value[n.name],
|
|
499
|
+
disabled: n.disabled,
|
|
500
|
+
required: n.required,
|
|
501
|
+
class: "artifactuse-select",
|
|
502
|
+
onChange: (o) => m(n.name, o.target.value)
|
|
503
|
+
}, [
|
|
504
|
+
e("option", sa, i(n.placeholder || "Select..."), 1),
|
|
505
|
+
(t(!0), a(I, null, ce(d(n.options), (o) => (t(), a("option", {
|
|
506
|
+
key: o.value,
|
|
507
|
+
value: o.value,
|
|
508
|
+
disabled: o.disabled
|
|
509
|
+
}, i(o.label), 9, ia))), 128))
|
|
510
|
+
], 40, aa)) : n.type === "radio" ? (t(), a("div", la, [
|
|
511
|
+
(t(!0), a(I, null, ce(d(n.options), (o) => (t(), a("label", {
|
|
512
|
+
key: o.value,
|
|
513
|
+
class: "artifactuse-radio-label"
|
|
514
|
+
}, [
|
|
515
|
+
e("input", {
|
|
516
|
+
type: "radio",
|
|
517
|
+
name: n.name,
|
|
518
|
+
value: o.value,
|
|
519
|
+
checked: S.value[n.name] === o.value,
|
|
520
|
+
disabled: o.disabled || n.disabled,
|
|
521
|
+
class: "artifactuse-radio",
|
|
522
|
+
onChange: (H) => m(n.name, o.value)
|
|
523
|
+
}, null, 40, na),
|
|
524
|
+
e("span", null, i(o.label), 1)
|
|
525
|
+
]))), 128))
|
|
526
|
+
])) : p("", !0),
|
|
527
|
+
n.helpText ? (t(), a("span", oa, i(n.helpText), 1)) : p("", !0),
|
|
528
|
+
V.value[n.name] ? (t(), a("span", ra, i(V.value[n.name]), 1)) : p("", !0)
|
|
529
|
+
]))
|
|
530
|
+
], 64))), 128))
|
|
531
|
+
]),
|
|
532
|
+
B.value ? p("", !0) : (t(), a("div", ca, [
|
|
533
|
+
e("button", {
|
|
534
|
+
type: "button",
|
|
535
|
+
class: "artifactuse-form-btn artifactuse-form-btn-ghost",
|
|
536
|
+
onClick: T[0] || (T[0] = (n) => te({ action: "cancel", label: "Cancel" }))
|
|
537
|
+
}, " Cancel "),
|
|
538
|
+
e("button", {
|
|
539
|
+
type: "submit",
|
|
540
|
+
class: "artifactuse-form-btn artifactuse-form-btn-primary",
|
|
541
|
+
disabled: U.value
|
|
542
|
+
}, [
|
|
543
|
+
U.value ? (t(), a("span", da)) : p("", !0),
|
|
544
|
+
J(" " + i(U.value ? "Submitting..." : "Submit"), 1)
|
|
545
|
+
], 8, ua)
|
|
546
|
+
]))
|
|
547
|
+
], 32))
|
|
548
|
+
], 64))
|
|
549
|
+
], 10, xt));
|
|
550
|
+
}
|
|
551
|
+
}, fa = ["data-artifactuse-theme"], pa = { class: "artifactuse-social-header" }, ma = ["src", "alt"], _a = { class: "artifactuse-social-author" }, ha = { class: "artifactuse-social-author-name" }, ya = { class: "artifactuse-social-author-meta" }, ga = { class: "artifactuse-social-author-handle" }, ka = { class: "artifactuse-social-timestamp" }, wa = { class: "artifactuse-social-content" }, ba = ["innerHTML"], Ca = {
|
|
552
|
+
key: 0,
|
|
553
|
+
class: "artifactuse-social-media"
|
|
554
|
+
}, xa = ["data-count"], $a = ["src", "alt"], Ma = {
|
|
555
|
+
key: 1,
|
|
556
|
+
class: "artifactuse-social-link-card"
|
|
557
|
+
}, La = ["src", "alt"], Ta = { class: "artifactuse-social-link-info" }, Ha = { class: "artifactuse-social-link-domain" }, Pa = { class: "artifactuse-social-link-title" }, Aa = {
|
|
558
|
+
key: 0,
|
|
559
|
+
class: "artifactuse-social-link-description"
|
|
560
|
+
}, Ba = {
|
|
561
|
+
key: 2,
|
|
562
|
+
class: "artifactuse-social-poll"
|
|
563
|
+
}, Ea = { class: "artifactuse-social-poll-label" }, za = { class: "artifactuse-social-poll-label-percent" }, Sa = { class: "artifactuse-social-poll-meta" }, Ia = {
|
|
564
|
+
key: 3,
|
|
565
|
+
class: "artifactuse-social-quote"
|
|
566
|
+
}, qa = { class: "artifactuse-social-quote-header" }, Fa = ["src"], Va = { class: "artifactuse-social-quote-author" }, Ra = { class: "artifactuse-social-quote-handle" }, Oa = { class: "artifactuse-social-quote-text" }, Da = {
|
|
567
|
+
key: 0,
|
|
568
|
+
class: "artifactuse-social-engagement"
|
|
569
|
+
}, Ua = { class: "artifactuse-social-stat" }, Na = { class: "artifactuse-social-stat" }, ja = { class: "artifactuse-social-stat" }, Ja = { class: "artifactuse-social-stat" }, Xa = { class: "artifactuse-social-header" }, Wa = ["src", "alt"], Za = { class: "artifactuse-social-author-info" }, Ka = { class: "artifactuse-social-author-name" }, Ya = {
|
|
570
|
+
key: 0,
|
|
571
|
+
class: "artifactuse-social-author-connection"
|
|
572
|
+
}, Ga = { class: "artifactuse-social-author-headline" }, Qa = { class: "artifactuse-social-timestamp" }, es = { class: "artifactuse-social-content" }, ts = ["innerHTML"], as = {
|
|
573
|
+
key: 0,
|
|
574
|
+
class: "artifactuse-social-link-card"
|
|
575
|
+
}, ss = ["src", "alt"], is = { class: "artifactuse-social-link-info" }, ls = { class: "artifactuse-social-link-title" }, ns = { class: "artifactuse-social-link-domain" }, os = {
|
|
576
|
+
key: 0,
|
|
577
|
+
class: "artifactuse-social-engagement"
|
|
578
|
+
}, rs = { class: "artifactuse-social-reactions" }, cs = { class: "artifactuse-social-header" }, us = ["src", "alt"], ds = { class: "artifactuse-social-author-name" }, vs = {
|
|
579
|
+
key: 0,
|
|
580
|
+
class: "artifactuse-social-verified",
|
|
581
|
+
viewBox: "0 0 24 24",
|
|
582
|
+
fill: "currentColor"
|
|
583
|
+
}, fs = {
|
|
584
|
+
key: 0,
|
|
585
|
+
class: "artifactuse-social-media"
|
|
586
|
+
}, ps = ["src", "alt"], ms = { class: "artifactuse-social-likes" }, _s = { class: "artifactuse-social-caption" }, hs = { class: "artifactuse-social-caption-author" }, ys = ["innerHTML"], gs = { class: "artifactuse-social-timestamp" }, ks = { class: "artifactuse-social-header" }, ws = ["src", "alt"], bs = { class: "artifactuse-social-author-info" }, Cs = { class: "artifactuse-social-author-name" }, xs = { class: "artifactuse-social-timestamp" }, $s = { class: "artifactuse-social-content" }, Ms = ["innerHTML"], Ls = {
|
|
587
|
+
key: 0,
|
|
588
|
+
class: "artifactuse-social-link-card"
|
|
589
|
+
}, Ts = ["src", "alt"], Hs = { class: "artifactuse-social-link-info" }, Ps = { class: "artifactuse-social-link-domain" }, As = { class: "artifactuse-social-link-title" }, Bs = {
|
|
590
|
+
key: 0,
|
|
591
|
+
class: "artifactuse-social-link-description"
|
|
592
|
+
}, Es = {
|
|
593
|
+
key: 0,
|
|
594
|
+
class: "artifactuse-social-engagement"
|
|
595
|
+
}, zs = { class: "artifactuse-social-reactions" }, Ss = { class: "artifactuse-social-reaction-count" }, Is = { class: "artifactuse-social-comments-shares" }, qs = { class: "artifactuse-social-header" }, Fs = ["src", "alt"], Vs = { class: "artifactuse-social-author-info" }, Rs = { class: "artifactuse-social-author-name" }, Os = {
|
|
596
|
+
key: 0,
|
|
597
|
+
class: "artifactuse-social-verified",
|
|
598
|
+
viewBox: "0 0 24 24",
|
|
599
|
+
fill: "currentColor"
|
|
600
|
+
}, Ds = { class: "artifactuse-social-timestamp" }, Us = { class: "artifactuse-social-content" }, Ns = ["innerHTML"], js = {
|
|
601
|
+
key: 0,
|
|
602
|
+
class: "artifactuse-social-engagement"
|
|
603
|
+
}, Js = { class: "artifactuse-social-stat" }, Xs = { class: "artifactuse-social-stat" }, Ws = { class: "artifactuse-social-stat" }, Zs = { class: "artifactuse-social-thumbnail" }, Ks = ["src", "alt"], Ys = {
|
|
604
|
+
key: 1,
|
|
605
|
+
class: "artifactuse-social-duration"
|
|
606
|
+
}, Gs = { class: "artifactuse-social-info" }, Qs = { class: "artifactuse-social-header" }, ei = ["src", "alt"], ti = { class: "artifactuse-social-author-name" }, ai = ["innerHTML"], si = {
|
|
607
|
+
key: 0,
|
|
608
|
+
class: "artifactuse-social-sound"
|
|
609
|
+
}, ii = {
|
|
610
|
+
key: 1,
|
|
611
|
+
class: "artifactuse-social-engagement"
|
|
612
|
+
}, li = { class: "artifactuse-social-thumbnail" }, ni = ["src", "alt"], oi = {
|
|
613
|
+
key: 1,
|
|
614
|
+
class: "artifactuse-social-duration"
|
|
615
|
+
}, ri = { class: "artifactuse-social-info" }, ci = ["src", "alt"], ui = { class: "artifactuse-social-title" }, di = { class: "artifactuse-social-channel" }, vi = { class: "artifactuse-social-meta" }, fi = { class: "artifactuse-social-actions-bar" }, pi = { class: "artifactuse-social-platform-badge" }, de = '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>', mi = {
|
|
616
|
+
__name: "ArtifactuseSocialPreview",
|
|
617
|
+
props: {
|
|
618
|
+
artifact: {
|
|
619
|
+
type: Object,
|
|
620
|
+
required: !0
|
|
621
|
+
},
|
|
622
|
+
theme: {
|
|
623
|
+
type: String,
|
|
624
|
+
default: "dark"
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
emits: ["copy", "edit"],
|
|
628
|
+
setup(M, { emit: u }) {
|
|
629
|
+
const f = M, y = u, r = A(null), F = A("Copy"), E = C(() => {
|
|
630
|
+
try {
|
|
631
|
+
return JSON.parse(f.artifact.code);
|
|
632
|
+
} catch {
|
|
633
|
+
return { platform: "twitter", data: {} };
|
|
634
|
+
}
|
|
635
|
+
}), $ = C(() => {
|
|
636
|
+
var d;
|
|
637
|
+
return ((d = E.value) == null ? void 0 : d.platform) || "twitter";
|
|
638
|
+
});
|
|
639
|
+
C(() => {
|
|
640
|
+
var d;
|
|
641
|
+
return ((d = E.value) == null ? void 0 : d.variant) || "post";
|
|
642
|
+
});
|
|
643
|
+
const _ = C(() => {
|
|
644
|
+
var d, m;
|
|
645
|
+
return ((m = (d = E.value) == null ? void 0 : d.data) == null ? void 0 : m.author) || {};
|
|
646
|
+
}), l = C(() => {
|
|
647
|
+
var d, m;
|
|
648
|
+
return ((m = (d = E.value) == null ? void 0 : d.data) == null ? void 0 : m.content) || {};
|
|
649
|
+
}), h = C(() => {
|
|
650
|
+
var d, m;
|
|
651
|
+
return ((m = (d = E.value) == null ? void 0 : d.data) == null ? void 0 : m.engagement) || {};
|
|
652
|
+
}), w = C(() => {
|
|
653
|
+
var d, m;
|
|
654
|
+
return ((m = (d = E.value) == null ? void 0 : d.data) == null ? void 0 : m.meta) || {};
|
|
655
|
+
}), L = C(() => {
|
|
656
|
+
const d = h.value;
|
|
657
|
+
return d.likes || d.comments || d.shares || d.retweets || d.replies || d.views;
|
|
658
|
+
}), S = C(() => `artifactuse-social-verified-${_.value.verifiedType || "blue"}`), V = C(() => ({
|
|
659
|
+
twitter: "X",
|
|
660
|
+
linkedin: "LinkedIn",
|
|
661
|
+
instagram: "Instagram",
|
|
662
|
+
facebook: "Facebook",
|
|
663
|
+
threads: "Threads",
|
|
664
|
+
tiktok: "TikTok",
|
|
665
|
+
youtube: "YouTube"
|
|
666
|
+
})[$.value] || $.value), U = C(() => {
|
|
667
|
+
const d = {
|
|
668
|
+
twitter: () => ae("svg", { viewBox: "0 0 24 24", fill: "currentColor" }, [
|
|
669
|
+
ae("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" })
|
|
670
|
+
]),
|
|
671
|
+
linkedin: () => ae("svg", { viewBox: "0 0 24 24", fill: "currentColor" }, [
|
|
672
|
+
ae("path", { d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" })
|
|
673
|
+
]),
|
|
674
|
+
instagram: () => ae("svg", { viewBox: "0 0 24 24", fill: "currentColor" }, [
|
|
675
|
+
ae("path", { d: "M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z" })
|
|
676
|
+
]),
|
|
677
|
+
facebook: () => ae("svg", { viewBox: "0 0 24 24", fill: "currentColor" }, [
|
|
678
|
+
ae("path", { d: "M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" })
|
|
679
|
+
]),
|
|
680
|
+
threads: () => ae("svg", { viewBox: "0 0 24 24", fill: "currentColor" }, [
|
|
681
|
+
ae("path", { d: "M12.186 24h-.007c-3.581-.024-6.334-1.205-8.184-3.509C2.35 18.44 1.5 15.586 1.472 12.01v-.017c.03-3.579.879-6.43 2.525-8.482C5.845 1.205 8.6.024 12.18 0h.014c2.746.02 5.043.725 6.826 2.098 1.677 1.29 2.858 3.13 3.509 5.467l-2.04.569c-1.104-3.96-3.898-5.984-8.304-6.015-2.91.022-5.11.936-6.54 2.717C4.307 6.504 3.616 8.914 3.59 12c.025 3.086.718 5.496 2.057 7.164 1.43 1.783 3.631 2.698 6.54 2.717 2.623-.02 4.358-.631 5.8-2.045 1.647-1.613 1.618-3.593 1.09-4.798-.31-.71-.873-1.3-1.634-1.75-.192 1.352-.622 2.446-1.284 3.272-.886 1.102-2.14 1.704-3.73 1.79-1.202.065-2.361-.218-3.259-.801-1.063-.689-1.685-1.74-1.752-2.96-.065-1.182.408-2.256 1.33-3.022.88-.73 2.108-1.152 3.457-1.187 1.357-.035 2.573.283 3.58.89.034-.497.04-1.017.015-1.558-.083-1.792-.648-3.095-1.68-3.876-.99-.75-2.453-1.123-4.35-1.108-.987.008-1.866.09-2.613.246l-.464-2.086c.912-.19 1.965-.29 3.133-.298 2.467-.02 4.42.554 5.807 1.706 1.46 1.213 2.24 3.007 2.354 5.411.039.827.026 1.69-.04 2.576.962.681 1.735 1.542 2.268 2.553.846 1.6 1.026 3.639.508 5.622-.57 2.181-1.782 3.94-3.503 5.079C17.194 23.394 14.88 24 12.186 24zM9.15 13.476c-.927.037-1.628.282-2.085.728-.418.408-.618.945-.578 1.553.04.638.347 1.165.866 1.483.586.36 1.39.521 2.266.45 1.053-.085 1.86-.473 2.4-1.153.457-.576.763-1.39.884-2.356-.893-.41-1.944-.636-3.095-.705h-.009c-.216-.008-.436-.008-.65 0z" })
|
|
682
|
+
]),
|
|
683
|
+
tiktok: () => ae("svg", { viewBox: "0 0 24 24", fill: "currentColor" }, [
|
|
684
|
+
ae("path", { d: "M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z" })
|
|
685
|
+
]),
|
|
686
|
+
youtube: () => ae("svg", { viewBox: "0 0 24 24", fill: "currentColor" }, [
|
|
687
|
+
ae("path", { d: "M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" })
|
|
688
|
+
])
|
|
689
|
+
};
|
|
690
|
+
return d[$.value] || d.twitter;
|
|
691
|
+
}), q = C(() => {
|
|
692
|
+
let d = l.value.text || "";
|
|
693
|
+
return d = d.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), d = d.replace(/#(\w+)/g, '<span class="artifactuse-social-hashtag">#$1</span>'), d = d.replace(/@(\w+)/g, '<span class="artifactuse-social-mention">@$1</span>'), d = d.replace(
|
|
694
|
+
/(https?:\/\/[^\s]+)/g,
|
|
695
|
+
'<a href="$1" target="_blank" rel="noopener">$1</a>'
|
|
696
|
+
), d;
|
|
697
|
+
}), se = C(() => {
|
|
698
|
+
const d = h.value.reactions || {};
|
|
699
|
+
return Object.values(d).reduce((m, ee) => m + (ee || 0), 0) || h.value.likes || 0;
|
|
700
|
+
});
|
|
701
|
+
function B(d) {
|
|
702
|
+
return d ? d >= 1e6 ? `${(d / 1e6).toFixed(1)}M` : d >= 1e3 ? `${(d / 1e3).toFixed(1)}K` : d.toString() : "0";
|
|
703
|
+
}
|
|
704
|
+
function Z(d) {
|
|
705
|
+
try {
|
|
706
|
+
return new URL(d).hostname.replace("www.", "");
|
|
707
|
+
} catch {
|
|
708
|
+
return d;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
function D(d) {
|
|
712
|
+
d.target.src = de;
|
|
713
|
+
}
|
|
714
|
+
function X(d) {
|
|
715
|
+
d.target.style.display = "none";
|
|
716
|
+
}
|
|
717
|
+
function Q() {
|
|
718
|
+
const d = l.value.text || "";
|
|
719
|
+
navigator.clipboard.writeText(d).then(() => {
|
|
720
|
+
F.value = "Copied!", setTimeout(() => {
|
|
721
|
+
F.value = "Copy";
|
|
722
|
+
}, 2e3), y("copy", { platform: $.value, text: d });
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
return (d, m) => {
|
|
726
|
+
var ee, K, Y, te, g, T;
|
|
727
|
+
return t(), a("div", {
|
|
728
|
+
ref_key: "containerRef",
|
|
729
|
+
ref: r,
|
|
730
|
+
class: j(["artifactuse-social", [`artifactuse-social-${$.value}`]]),
|
|
731
|
+
"data-artifactuse-theme": M.theme
|
|
732
|
+
}, [
|
|
733
|
+
$.value === "twitter" ? (t(), a(I, { key: 0 }, [
|
|
734
|
+
e("div", pa, [
|
|
735
|
+
e("img", {
|
|
736
|
+
src: _.value.avatar || de,
|
|
737
|
+
alt: _.value.name,
|
|
738
|
+
class: "artifactuse-social-avatar",
|
|
739
|
+
onError: D
|
|
740
|
+
}, null, 40, ma),
|
|
741
|
+
e("div", _a, [
|
|
742
|
+
e("div", ha, [
|
|
743
|
+
e("span", null, i(_.value.name), 1),
|
|
744
|
+
_.value.verified ? (t(), a("svg", {
|
|
745
|
+
key: 0,
|
|
746
|
+
class: j(["artifactuse-social-verified", S.value]),
|
|
747
|
+
viewBox: "0 0 24 24",
|
|
748
|
+
fill: "currentColor"
|
|
749
|
+
}, [...m[0] || (m[0] = [
|
|
750
|
+
e("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" }, null, -1)
|
|
751
|
+
])], 2)) : p("", !0)
|
|
752
|
+
]),
|
|
753
|
+
e("div", ya, [
|
|
754
|
+
e("span", ga, i(_.value.handle), 1),
|
|
755
|
+
e("span", ka, "· " + i(w.value.timestamp || "Just now"), 1)
|
|
756
|
+
])
|
|
757
|
+
])
|
|
758
|
+
]),
|
|
759
|
+
e("div", wa, [
|
|
760
|
+
e("p", {
|
|
761
|
+
class: "artifactuse-social-text",
|
|
762
|
+
innerHTML: q.value
|
|
763
|
+
}, null, 8, ba),
|
|
764
|
+
(ee = l.value.media) != null && ee.length ? (t(), a("div", Ca, [
|
|
765
|
+
e("div", {
|
|
766
|
+
class: j(["artifactuse-social-media-grid", { "artifactuse-social-media-single": l.value.media.length === 1 }]),
|
|
767
|
+
"data-count": l.value.media.length
|
|
768
|
+
}, [
|
|
769
|
+
(t(!0), a(I, null, ce(l.value.media.slice(0, 4), (n, z) => (t(), a("img", {
|
|
770
|
+
key: z,
|
|
771
|
+
src: n.url,
|
|
772
|
+
alt: n.alt || "",
|
|
773
|
+
onError: X
|
|
774
|
+
}, null, 40, $a))), 128))
|
|
775
|
+
], 10, xa)
|
|
776
|
+
])) : p("", !0),
|
|
777
|
+
l.value.link && !((K = l.value.media) != null && K.length) ? (t(), a("div", Ma, [
|
|
778
|
+
l.value.link.image ? (t(), a("img", {
|
|
779
|
+
key: 0,
|
|
780
|
+
src: l.value.link.image,
|
|
781
|
+
alt: l.value.link.title,
|
|
782
|
+
class: "artifactuse-social-link-image",
|
|
783
|
+
onError: X
|
|
784
|
+
}, null, 40, La)) : p("", !0),
|
|
785
|
+
e("div", Ta, [
|
|
786
|
+
e("div", Ha, [
|
|
787
|
+
m[1] || (m[1] = e("svg", {
|
|
788
|
+
fill: "none",
|
|
789
|
+
viewBox: "0 0 24 24",
|
|
790
|
+
stroke: "currentColor"
|
|
791
|
+
}, [
|
|
792
|
+
e("path", {
|
|
793
|
+
"stroke-linecap": "round",
|
|
794
|
+
"stroke-linejoin": "round",
|
|
795
|
+
"stroke-width": "2",
|
|
796
|
+
d: "M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"
|
|
797
|
+
})
|
|
798
|
+
], -1)),
|
|
799
|
+
J(" " + i(l.value.link.domain || Z(l.value.link.url)), 1)
|
|
800
|
+
]),
|
|
801
|
+
e("div", Pa, i(l.value.link.title), 1),
|
|
802
|
+
l.value.link.description ? (t(), a("div", Aa, i(l.value.link.description), 1)) : p("", !0)
|
|
803
|
+
])
|
|
804
|
+
])) : p("", !0),
|
|
805
|
+
l.value.poll ? (t(), a("div", Ba, [
|
|
806
|
+
(t(!0), a(I, null, ce(l.value.poll.options, (n, z) => {
|
|
807
|
+
var o, H;
|
|
808
|
+
return t(), a("div", {
|
|
809
|
+
key: z,
|
|
810
|
+
class: "artifactuse-social-poll-option"
|
|
811
|
+
}, [
|
|
812
|
+
e("div", {
|
|
813
|
+
class: "artifactuse-social-poll-bar",
|
|
814
|
+
style: $e({ width: `${((o = l.value.poll.votes) == null ? void 0 : o[z]) || 0}%` })
|
|
815
|
+
}, null, 4),
|
|
816
|
+
e("div", Ea, [
|
|
817
|
+
e("span", null, i(n), 1),
|
|
818
|
+
e("span", za, i(((H = l.value.poll.votes) == null ? void 0 : H[z]) || 0) + "%", 1)
|
|
819
|
+
])
|
|
820
|
+
]);
|
|
821
|
+
}), 128)),
|
|
822
|
+
e("div", Sa, i(B(l.value.poll.totalVotes || 0)) + " votes · " + i(l.value.poll.duration || "Poll ended"), 1)
|
|
823
|
+
])) : p("", !0),
|
|
824
|
+
l.value.quote ? (t(), a("div", Ia, [
|
|
825
|
+
e("div", qa, [
|
|
826
|
+
e("img", {
|
|
827
|
+
src: ((Y = l.value.quote.author) == null ? void 0 : Y.avatar) || de,
|
|
828
|
+
class: "artifactuse-social-quote-avatar"
|
|
829
|
+
}, null, 8, Fa),
|
|
830
|
+
e("span", Va, i((te = l.value.quote.author) == null ? void 0 : te.name), 1),
|
|
831
|
+
e("span", Ra, i((g = l.value.quote.author) == null ? void 0 : g.handle), 1)
|
|
832
|
+
]),
|
|
833
|
+
e("p", Oa, i(l.value.quote.text), 1)
|
|
834
|
+
])) : p("", !0)
|
|
835
|
+
]),
|
|
836
|
+
L.value ? (t(), a("div", Da, [
|
|
837
|
+
e("div", Ua, [
|
|
838
|
+
m[2] || (m[2] = e("svg", {
|
|
839
|
+
viewBox: "0 0 24 24",
|
|
840
|
+
fill: "none",
|
|
841
|
+
stroke: "currentColor",
|
|
842
|
+
"stroke-width": "1.5"
|
|
843
|
+
}, [
|
|
844
|
+
e("path", { d: "M12 21C6.5 21 2 16.5 2 11V3l7 3 3-3 3 3 7-3v8c0 5.5-4.5 10-10 10z" })
|
|
845
|
+
], -1)),
|
|
846
|
+
e("span", null, i(B(h.value.replies || 0)), 1)
|
|
847
|
+
]),
|
|
848
|
+
e("div", Na, [
|
|
849
|
+
m[3] || (m[3] = e("svg", {
|
|
850
|
+
viewBox: "0 0 24 24",
|
|
851
|
+
fill: "none",
|
|
852
|
+
stroke: "currentColor",
|
|
853
|
+
"stroke-width": "1.5"
|
|
854
|
+
}, [
|
|
855
|
+
e("path", { d: "M7 17L17 7M17 7H8M17 7V16" })
|
|
856
|
+
], -1)),
|
|
857
|
+
e("span", null, i(B(h.value.retweets || 0)), 1)
|
|
858
|
+
]),
|
|
859
|
+
e("div", ja, [
|
|
860
|
+
m[4] || (m[4] = e("svg", {
|
|
861
|
+
viewBox: "0 0 24 24",
|
|
862
|
+
fill: "none",
|
|
863
|
+
stroke: "currentColor",
|
|
864
|
+
"stroke-width": "1.5"
|
|
865
|
+
}, [
|
|
866
|
+
e("path", { d: "M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" })
|
|
867
|
+
], -1)),
|
|
868
|
+
e("span", null, i(B(h.value.likes || 0)), 1)
|
|
869
|
+
]),
|
|
870
|
+
e("div", Ja, [
|
|
871
|
+
m[5] || (m[5] = e("svg", {
|
|
872
|
+
viewBox: "0 0 24 24",
|
|
873
|
+
fill: "none",
|
|
874
|
+
stroke: "currentColor",
|
|
875
|
+
"stroke-width": "1.5"
|
|
876
|
+
}, [
|
|
877
|
+
e("path", { d: "M15 3h4a2 2 0 012 2v14a2 2 0 01-2 2h-4M10 17l5-5-5-5M13.8 12H3" })
|
|
878
|
+
], -1)),
|
|
879
|
+
e("span", null, i(B(h.value.views || 0)), 1)
|
|
880
|
+
])
|
|
881
|
+
])) : p("", !0)
|
|
882
|
+
], 64)) : $.value === "linkedin" ? (t(), a(I, { key: 1 }, [
|
|
883
|
+
e("div", Xa, [
|
|
884
|
+
e("img", {
|
|
885
|
+
src: _.value.avatar || de,
|
|
886
|
+
alt: _.value.name,
|
|
887
|
+
class: "artifactuse-social-avatar",
|
|
888
|
+
onError: D
|
|
889
|
+
}, null, 40, Wa),
|
|
890
|
+
e("div", Za, [
|
|
891
|
+
e("div", Ka, [
|
|
892
|
+
J(i(_.value.name) + " ", 1),
|
|
893
|
+
_.value.connection ? (t(), a("span", Ya, "· " + i(_.value.connection), 1)) : p("", !0)
|
|
894
|
+
]),
|
|
895
|
+
e("div", Ga, i(_.value.headline), 1),
|
|
896
|
+
e("div", Qa, [
|
|
897
|
+
J(i(w.value.timestamp || "Just now") + " · ", 1),
|
|
898
|
+
m[6] || (m[6] = e("svg", {
|
|
899
|
+
viewBox: "0 0 24 24",
|
|
900
|
+
fill: "currentColor"
|
|
901
|
+
}, [
|
|
902
|
+
e("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z" })
|
|
903
|
+
], -1))
|
|
904
|
+
])
|
|
905
|
+
])
|
|
906
|
+
]),
|
|
907
|
+
e("div", es, [
|
|
908
|
+
e("p", {
|
|
909
|
+
class: "artifactuse-social-text",
|
|
910
|
+
innerHTML: q.value
|
|
911
|
+
}, null, 8, ts),
|
|
912
|
+
l.value.link ? (t(), a("div", as, [
|
|
913
|
+
l.value.link.image ? (t(), a("img", {
|
|
914
|
+
key: 0,
|
|
915
|
+
src: l.value.link.image,
|
|
916
|
+
alt: l.value.link.title,
|
|
917
|
+
class: "artifactuse-social-link-image",
|
|
918
|
+
onError: X
|
|
919
|
+
}, null, 40, ss)) : p("", !0),
|
|
920
|
+
e("div", is, [
|
|
921
|
+
e("div", ls, i(l.value.link.title), 1),
|
|
922
|
+
e("div", ns, i(l.value.link.domain || Z(l.value.link.url)), 1)
|
|
923
|
+
])
|
|
924
|
+
])) : p("", !0)
|
|
925
|
+
]),
|
|
926
|
+
L.value ? (t(), a("div", os, [
|
|
927
|
+
e("div", rs, [
|
|
928
|
+
m[7] || (m[7] = e("div", { class: "artifactuse-social-reaction-icons" }, [
|
|
929
|
+
e("span", { class: "artifactuse-social-reaction-icon" }, "👍"),
|
|
930
|
+
e("span", { class: "artifactuse-social-reaction-icon" }, "❤️"),
|
|
931
|
+
e("span", { class: "artifactuse-social-reaction-icon" }, "👏")
|
|
932
|
+
], -1)),
|
|
933
|
+
e("span", null, i(B(h.value.likes || 0)), 1)
|
|
934
|
+
]),
|
|
935
|
+
e("span", null, i(B(h.value.comments || 0)) + " comments · " + i(B(h.value.shares || 0)) + " shares", 1)
|
|
936
|
+
])) : p("", !0)
|
|
937
|
+
], 64)) : $.value === "instagram" ? (t(), a(I, { key: 2 }, [
|
|
938
|
+
e("div", cs, [
|
|
939
|
+
e("img", {
|
|
940
|
+
src: _.value.avatar || de,
|
|
941
|
+
alt: _.value.name,
|
|
942
|
+
class: "artifactuse-social-avatar",
|
|
943
|
+
onError: D
|
|
944
|
+
}, null, 40, us),
|
|
945
|
+
e("div", ds, [
|
|
946
|
+
J(i(_.value.name) + " ", 1),
|
|
947
|
+
_.value.verified ? (t(), a("svg", vs, [...m[8] || (m[8] = [
|
|
948
|
+
e("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" }, null, -1)
|
|
949
|
+
])])) : p("", !0)
|
|
950
|
+
])
|
|
951
|
+
]),
|
|
952
|
+
(T = l.value.media) != null && T.length ? (t(), a("div", fs, [
|
|
953
|
+
e("img", {
|
|
954
|
+
src: l.value.media[0].url,
|
|
955
|
+
alt: l.value.media[0].alt || "",
|
|
956
|
+
onError: X
|
|
957
|
+
}, null, 40, ps)
|
|
958
|
+
])) : p("", !0),
|
|
959
|
+
m[9] || (m[9] = at('<div class="artifactuse-social-actions"><div class="artifactuse-social-action"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"></path></svg></div><div class="artifactuse-social-action"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z"></path></svg></div><div class="artifactuse-social-action"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"></path></svg></div></div>', 1)),
|
|
960
|
+
e("div", ms, i(B(h.value.likes || 0)) + " likes", 1),
|
|
961
|
+
e("div", _s, [
|
|
962
|
+
e("span", hs, i(_.value.name), 1),
|
|
963
|
+
e("span", {
|
|
964
|
+
class: "artifactuse-social-caption-text",
|
|
965
|
+
innerHTML: q.value
|
|
966
|
+
}, null, 8, ys)
|
|
967
|
+
]),
|
|
968
|
+
e("div", gs, i(w.value.timestamp || "Just now"), 1)
|
|
969
|
+
], 64)) : $.value === "facebook" ? (t(), a(I, { key: 3 }, [
|
|
970
|
+
e("div", ks, [
|
|
971
|
+
e("img", {
|
|
972
|
+
src: _.value.avatar || de,
|
|
973
|
+
alt: _.value.name,
|
|
974
|
+
class: "artifactuse-social-avatar",
|
|
975
|
+
onError: D
|
|
976
|
+
}, null, 40, ws),
|
|
977
|
+
e("div", bs, [
|
|
978
|
+
e("div", Cs, i(_.value.name), 1),
|
|
979
|
+
e("div", xs, [
|
|
980
|
+
J(i(w.value.timestamp || "Just now") + " · ", 1),
|
|
981
|
+
m[10] || (m[10] = e("svg", {
|
|
982
|
+
viewBox: "0 0 24 24",
|
|
983
|
+
fill: "currentColor"
|
|
984
|
+
}, [
|
|
985
|
+
e("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z" })
|
|
986
|
+
], -1))
|
|
987
|
+
])
|
|
988
|
+
])
|
|
989
|
+
]),
|
|
990
|
+
e("div", $s, [
|
|
991
|
+
e("p", {
|
|
992
|
+
class: "artifactuse-social-text",
|
|
993
|
+
innerHTML: q.value
|
|
994
|
+
}, null, 8, Ms),
|
|
995
|
+
l.value.link ? (t(), a("div", Ls, [
|
|
996
|
+
l.value.link.image ? (t(), a("img", {
|
|
997
|
+
key: 0,
|
|
998
|
+
src: l.value.link.image,
|
|
999
|
+
alt: l.value.link.title,
|
|
1000
|
+
class: "artifactuse-social-link-image",
|
|
1001
|
+
onError: X
|
|
1002
|
+
}, null, 40, Ts)) : p("", !0),
|
|
1003
|
+
e("div", Hs, [
|
|
1004
|
+
e("div", Ps, i(l.value.link.domain || Z(l.value.link.url)), 1),
|
|
1005
|
+
e("div", As, i(l.value.link.title), 1),
|
|
1006
|
+
l.value.link.description ? (t(), a("div", Bs, i(l.value.link.description), 1)) : p("", !0)
|
|
1007
|
+
])
|
|
1008
|
+
])) : p("", !0)
|
|
1009
|
+
]),
|
|
1010
|
+
L.value ? (t(), a("div", Es, [
|
|
1011
|
+
e("div", zs, [
|
|
1012
|
+
m[11] || (m[11] = e("div", { class: "artifactuse-social-reaction-emojis" }, [
|
|
1013
|
+
e("span", { class: "artifactuse-social-reaction-emoji" }, "👍"),
|
|
1014
|
+
e("span", { class: "artifactuse-social-reaction-emoji" }, "❤️"),
|
|
1015
|
+
e("span", { class: "artifactuse-social-reaction-emoji" }, "😂")
|
|
1016
|
+
], -1)),
|
|
1017
|
+
e("span", Ss, i(B(se.value)), 1)
|
|
1018
|
+
]),
|
|
1019
|
+
e("span", Is, i(B(h.value.comments || 0)) + " comments · " + i(B(h.value.shares || 0)) + " shares", 1)
|
|
1020
|
+
])) : p("", !0)
|
|
1021
|
+
], 64)) : $.value === "threads" ? (t(), a(I, { key: 4 }, [
|
|
1022
|
+
e("div", qs, [
|
|
1023
|
+
e("img", {
|
|
1024
|
+
src: _.value.avatar || de,
|
|
1025
|
+
alt: _.value.name,
|
|
1026
|
+
class: "artifactuse-social-avatar",
|
|
1027
|
+
onError: D
|
|
1028
|
+
}, null, 40, Fs),
|
|
1029
|
+
e("div", Vs, [
|
|
1030
|
+
e("div", Rs, [
|
|
1031
|
+
J(i(_.value.name) + " ", 1),
|
|
1032
|
+
_.value.verified ? (t(), a("svg", Os, [...m[12] || (m[12] = [
|
|
1033
|
+
e("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" }, null, -1)
|
|
1034
|
+
])])) : p("", !0)
|
|
1035
|
+
]),
|
|
1036
|
+
e("span", Ds, i(w.value.timestamp || "Just now"), 1)
|
|
1037
|
+
])
|
|
1038
|
+
]),
|
|
1039
|
+
e("div", Us, [
|
|
1040
|
+
e("p", {
|
|
1041
|
+
class: "artifactuse-social-text",
|
|
1042
|
+
innerHTML: q.value
|
|
1043
|
+
}, null, 8, Ns)
|
|
1044
|
+
]),
|
|
1045
|
+
L.value ? (t(), a("div", js, [
|
|
1046
|
+
e("div", Js, [
|
|
1047
|
+
m[13] || (m[13] = e("svg", {
|
|
1048
|
+
viewBox: "0 0 24 24",
|
|
1049
|
+
fill: "none",
|
|
1050
|
+
stroke: "currentColor",
|
|
1051
|
+
"stroke-width": "1.5"
|
|
1052
|
+
}, [
|
|
1053
|
+
e("path", { d: "M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" })
|
|
1054
|
+
], -1)),
|
|
1055
|
+
e("span", null, i(B(h.value.likes || 0)), 1)
|
|
1056
|
+
]),
|
|
1057
|
+
e("div", Xs, [
|
|
1058
|
+
m[14] || (m[14] = e("svg", {
|
|
1059
|
+
viewBox: "0 0 24 24",
|
|
1060
|
+
fill: "none",
|
|
1061
|
+
stroke: "currentColor",
|
|
1062
|
+
"stroke-width": "1.5"
|
|
1063
|
+
}, [
|
|
1064
|
+
e("path", { d: "M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z" })
|
|
1065
|
+
], -1)),
|
|
1066
|
+
e("span", null, i(B(h.value.comments || 0)), 1)
|
|
1067
|
+
]),
|
|
1068
|
+
e("div", Ws, [
|
|
1069
|
+
m[15] || (m[15] = e("svg", {
|
|
1070
|
+
viewBox: "0 0 24 24",
|
|
1071
|
+
fill: "none",
|
|
1072
|
+
stroke: "currentColor",
|
|
1073
|
+
"stroke-width": "1.5"
|
|
1074
|
+
}, [
|
|
1075
|
+
e("path", { d: "M7 17L17 7M17 7H8M17 7V16" })
|
|
1076
|
+
], -1)),
|
|
1077
|
+
e("span", null, i(B(h.value.shares || 0)), 1)
|
|
1078
|
+
])
|
|
1079
|
+
])) : p("", !0)
|
|
1080
|
+
], 64)) : $.value === "tiktok" ? (t(), a(I, { key: 5 }, [
|
|
1081
|
+
e("div", Zs, [
|
|
1082
|
+
l.value.thumbnail ? (t(), a("img", {
|
|
1083
|
+
key: 0,
|
|
1084
|
+
src: l.value.thumbnail,
|
|
1085
|
+
alt: l.value.text,
|
|
1086
|
+
onError: X
|
|
1087
|
+
}, null, 40, Ks)) : p("", !0),
|
|
1088
|
+
m[16] || (m[16] = e("div", { class: "artifactuse-social-play-button" }, [
|
|
1089
|
+
e("div", { class: "artifactuse-social-play-icon" }, [
|
|
1090
|
+
e("svg", {
|
|
1091
|
+
viewBox: "0 0 24 24",
|
|
1092
|
+
fill: "currentColor"
|
|
1093
|
+
}, [
|
|
1094
|
+
e("path", { d: "M8 5v14l11-7z" })
|
|
1095
|
+
])
|
|
1096
|
+
])
|
|
1097
|
+
], -1)),
|
|
1098
|
+
l.value.duration ? (t(), a("div", Ys, i(l.value.duration), 1)) : p("", !0)
|
|
1099
|
+
]),
|
|
1100
|
+
e("div", Gs, [
|
|
1101
|
+
e("div", Qs, [
|
|
1102
|
+
e("img", {
|
|
1103
|
+
src: _.value.avatar || de,
|
|
1104
|
+
alt: _.value.name,
|
|
1105
|
+
class: "artifactuse-social-avatar",
|
|
1106
|
+
onError: D
|
|
1107
|
+
}, null, 40, ei),
|
|
1108
|
+
e("span", ti, i(_.value.name), 1)
|
|
1109
|
+
]),
|
|
1110
|
+
e("p", {
|
|
1111
|
+
class: "artifactuse-social-text",
|
|
1112
|
+
innerHTML: q.value
|
|
1113
|
+
}, null, 8, ai),
|
|
1114
|
+
l.value.sound ? (t(), a("div", si, [
|
|
1115
|
+
m[17] || (m[17] = e("svg", {
|
|
1116
|
+
viewBox: "0 0 24 24",
|
|
1117
|
+
fill: "currentColor"
|
|
1118
|
+
}, [
|
|
1119
|
+
e("path", { d: "M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z" })
|
|
1120
|
+
], -1)),
|
|
1121
|
+
J(" " + i(l.value.sound), 1)
|
|
1122
|
+
])) : p("", !0),
|
|
1123
|
+
L.value ? (t(), a("div", ii, [
|
|
1124
|
+
e("span", null, i(B(h.value.likes || 0)) + " likes", 1),
|
|
1125
|
+
e("span", null, i(B(h.value.comments || 0)) + " comments", 1),
|
|
1126
|
+
e("span", null, i(B(h.value.shares || 0)) + " shares", 1)
|
|
1127
|
+
])) : p("", !0)
|
|
1128
|
+
])
|
|
1129
|
+
], 64)) : $.value === "youtube" ? (t(), a(I, { key: 6 }, [
|
|
1130
|
+
e("div", li, [
|
|
1131
|
+
l.value.thumbnail ? (t(), a("img", {
|
|
1132
|
+
key: 0,
|
|
1133
|
+
src: l.value.thumbnail,
|
|
1134
|
+
alt: l.value.title,
|
|
1135
|
+
onError: X
|
|
1136
|
+
}, null, 40, ni)) : p("", !0),
|
|
1137
|
+
l.value.duration ? (t(), a("div", oi, i(l.value.duration), 1)) : p("", !0)
|
|
1138
|
+
]),
|
|
1139
|
+
e("div", ri, [
|
|
1140
|
+
e("img", {
|
|
1141
|
+
src: _.value.avatar || de,
|
|
1142
|
+
alt: _.value.name,
|
|
1143
|
+
class: "artifactuse-social-avatar",
|
|
1144
|
+
onError: D
|
|
1145
|
+
}, null, 40, ci),
|
|
1146
|
+
e("div", null, [
|
|
1147
|
+
e("div", ui, i(l.value.title || l.value.text), 1),
|
|
1148
|
+
e("div", di, i(_.value.name), 1),
|
|
1149
|
+
e("div", vi, i(B(h.value.views || 0)) + " views · " + i(w.value.timestamp || "Just now"), 1)
|
|
1150
|
+
])
|
|
1151
|
+
])
|
|
1152
|
+
], 64)) : p("", !0),
|
|
1153
|
+
e("div", fi, [
|
|
1154
|
+
e("div", pi, [
|
|
1155
|
+
(t(), ye(st(U.value))),
|
|
1156
|
+
e("span", null, i(V.value), 1)
|
|
1157
|
+
]),
|
|
1158
|
+
e("button", {
|
|
1159
|
+
class: "artifactuse-social-copy-btn",
|
|
1160
|
+
onClick: Q
|
|
1161
|
+
}, [
|
|
1162
|
+
m[18] || (m[18] = e("svg", {
|
|
1163
|
+
viewBox: "0 0 24 24",
|
|
1164
|
+
fill: "none",
|
|
1165
|
+
stroke: "currentColor",
|
|
1166
|
+
"stroke-width": "2"
|
|
1167
|
+
}, [
|
|
1168
|
+
e("rect", {
|
|
1169
|
+
x: "9",
|
|
1170
|
+
y: "9",
|
|
1171
|
+
width: "13",
|
|
1172
|
+
height: "13",
|
|
1173
|
+
rx: "2",
|
|
1174
|
+
ry: "2"
|
|
1175
|
+
}),
|
|
1176
|
+
e("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" })
|
|
1177
|
+
], -1)),
|
|
1178
|
+
J(" " + i(F.value), 1)
|
|
1179
|
+
])
|
|
1180
|
+
])
|
|
1181
|
+
], 10, fa);
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
}, _i = ["src", "alt"], hi = ["src"], yi = {
|
|
1185
|
+
key: 2,
|
|
1186
|
+
class: "artifactuse-viewer-controls"
|
|
1187
|
+
}, gi = ["title"], ki = {
|
|
1188
|
+
key: 0,
|
|
1189
|
+
viewBox: "0 0 24 24",
|
|
1190
|
+
fill: "none",
|
|
1191
|
+
stroke: "currentColor",
|
|
1192
|
+
"stroke-width": "2"
|
|
1193
|
+
}, wi = {
|
|
1194
|
+
key: 1,
|
|
1195
|
+
viewBox: "0 0 24 24",
|
|
1196
|
+
fill: "none",
|
|
1197
|
+
stroke: "currentColor",
|
|
1198
|
+
"stroke-width": "2"
|
|
1199
|
+
}, bi = {
|
|
1200
|
+
key: 3,
|
|
1201
|
+
class: "artifactuse-viewer-caption"
|
|
1202
|
+
}, Ci = {
|
|
1203
|
+
__name: "ArtifactuseViewer",
|
|
1204
|
+
props: {
|
|
1205
|
+
// Whether the viewer is open
|
|
1206
|
+
isOpen: {
|
|
1207
|
+
type: Boolean,
|
|
1208
|
+
default: !1
|
|
1209
|
+
},
|
|
1210
|
+
// Content type: 'image' | 'pdf'
|
|
1211
|
+
type: {
|
|
1212
|
+
type: String,
|
|
1213
|
+
default: "image"
|
|
1214
|
+
},
|
|
1215
|
+
// Source URL
|
|
1216
|
+
src: {
|
|
1217
|
+
type: String,
|
|
1218
|
+
default: ""
|
|
1219
|
+
},
|
|
1220
|
+
// Alt text for images
|
|
1221
|
+
alt: {
|
|
1222
|
+
type: String,
|
|
1223
|
+
default: ""
|
|
1224
|
+
},
|
|
1225
|
+
// Caption text
|
|
1226
|
+
caption: {
|
|
1227
|
+
type: String,
|
|
1228
|
+
default: ""
|
|
1229
|
+
}
|
|
1230
|
+
},
|
|
1231
|
+
emits: ["close"],
|
|
1232
|
+
setup(M, { emit: u }) {
|
|
1233
|
+
const f = M, y = u, r = A(null), F = A(!1);
|
|
1234
|
+
function E() {
|
|
1235
|
+
F.value = !1, y("close");
|
|
1236
|
+
}
|
|
1237
|
+
function $() {
|
|
1238
|
+
f.type === "image" && (F.value = !F.value);
|
|
1239
|
+
}
|
|
1240
|
+
function _() {
|
|
1241
|
+
const h = document.createElement("a");
|
|
1242
|
+
h.href = f.src, h.download = f.alt || "download", document.body.appendChild(h), h.click(), document.body.removeChild(h);
|
|
1243
|
+
}
|
|
1244
|
+
function l(h) {
|
|
1245
|
+
h.key === "Escape" && f.isOpen && E();
|
|
1246
|
+
}
|
|
1247
|
+
return ue(() => f.isOpen, (h) => {
|
|
1248
|
+
h ? (he(() => {
|
|
1249
|
+
var w;
|
|
1250
|
+
(w = r.value) == null || w.focus();
|
|
1251
|
+
}), document.body.style.overflow = "hidden") : (document.body.style.overflow = "", F.value = !1);
|
|
1252
|
+
}), ge(() => {
|
|
1253
|
+
document.addEventListener("keydown", l);
|
|
1254
|
+
}), Fe(() => {
|
|
1255
|
+
document.removeEventListener("keydown", l), document.body.style.overflow = "";
|
|
1256
|
+
}), (h, w) => (t(), ye(Ue, { to: "body" }, [
|
|
1257
|
+
be(Me, { name: "artifactuse-viewer" }, {
|
|
1258
|
+
default: Le(() => [
|
|
1259
|
+
M.isOpen ? (t(), a("div", {
|
|
1260
|
+
key: 0,
|
|
1261
|
+
class: "artifactuse-viewer-overlay",
|
|
1262
|
+
onClick: E,
|
|
1263
|
+
onKeydown: it(E, ["escape"]),
|
|
1264
|
+
tabindex: "-1",
|
|
1265
|
+
ref_key: "overlayRef",
|
|
1266
|
+
ref: r
|
|
1267
|
+
}, [
|
|
1268
|
+
e("div", {
|
|
1269
|
+
class: "artifactuse-viewer-content",
|
|
1270
|
+
onClick: w[0] || (w[0] = fe(() => {
|
|
1271
|
+
}, ["stop"]))
|
|
1272
|
+
}, [
|
|
1273
|
+
M.type === "image" ? (t(), a("img", {
|
|
1274
|
+
key: 0,
|
|
1275
|
+
src: M.src,
|
|
1276
|
+
alt: M.alt,
|
|
1277
|
+
class: j(["artifactuse-viewer-image", { "artifactuse-viewer-image--zoomed": F.value }]),
|
|
1278
|
+
onClick: $
|
|
1279
|
+
}, null, 10, _i)) : M.type === "pdf" ? (t(), a("iframe", {
|
|
1280
|
+
key: 1,
|
|
1281
|
+
src: M.src,
|
|
1282
|
+
class: "artifactuse-viewer-pdf"
|
|
1283
|
+
}, null, 8, hi)) : p("", !0),
|
|
1284
|
+
e("button", {
|
|
1285
|
+
class: "artifactuse-viewer-close",
|
|
1286
|
+
onClick: E,
|
|
1287
|
+
title: "Close (Esc)"
|
|
1288
|
+
}, [...w[1] || (w[1] = [
|
|
1289
|
+
e("svg", {
|
|
1290
|
+
viewBox: "0 0 24 24",
|
|
1291
|
+
fill: "none",
|
|
1292
|
+
stroke: "currentColor",
|
|
1293
|
+
"stroke-width": "2"
|
|
1294
|
+
}, [
|
|
1295
|
+
e("line", {
|
|
1296
|
+
x1: "18",
|
|
1297
|
+
y1: "6",
|
|
1298
|
+
x2: "6",
|
|
1299
|
+
y2: "18"
|
|
1300
|
+
}),
|
|
1301
|
+
e("line", {
|
|
1302
|
+
x1: "6",
|
|
1303
|
+
y1: "6",
|
|
1304
|
+
x2: "18",
|
|
1305
|
+
y2: "18"
|
|
1306
|
+
})
|
|
1307
|
+
], -1)
|
|
1308
|
+
])]),
|
|
1309
|
+
M.type === "image" ? (t(), a("div", yi, [
|
|
1310
|
+
e("button", {
|
|
1311
|
+
class: "artifactuse-viewer-control",
|
|
1312
|
+
onClick: fe($, ["stop"]),
|
|
1313
|
+
title: F.value ? "Zoom out" : "Zoom in"
|
|
1314
|
+
}, [
|
|
1315
|
+
F.value ? (t(), a("svg", wi, [...w[3] || (w[3] = [
|
|
1316
|
+
e("circle", {
|
|
1317
|
+
cx: "11",
|
|
1318
|
+
cy: "11",
|
|
1319
|
+
r: "8"
|
|
1320
|
+
}, null, -1),
|
|
1321
|
+
e("line", {
|
|
1322
|
+
x1: "21",
|
|
1323
|
+
y1: "21",
|
|
1324
|
+
x2: "16.65",
|
|
1325
|
+
y2: "16.65"
|
|
1326
|
+
}, null, -1),
|
|
1327
|
+
e("line", {
|
|
1328
|
+
x1: "8",
|
|
1329
|
+
y1: "11",
|
|
1330
|
+
x2: "14",
|
|
1331
|
+
y2: "11"
|
|
1332
|
+
}, null, -1)
|
|
1333
|
+
])])) : (t(), a("svg", ki, [...w[2] || (w[2] = [
|
|
1334
|
+
e("circle", {
|
|
1335
|
+
cx: "11",
|
|
1336
|
+
cy: "11",
|
|
1337
|
+
r: "8"
|
|
1338
|
+
}, null, -1),
|
|
1339
|
+
e("line", {
|
|
1340
|
+
x1: "21",
|
|
1341
|
+
y1: "21",
|
|
1342
|
+
x2: "16.65",
|
|
1343
|
+
y2: "16.65"
|
|
1344
|
+
}, null, -1),
|
|
1345
|
+
e("line", {
|
|
1346
|
+
x1: "11",
|
|
1347
|
+
y1: "8",
|
|
1348
|
+
x2: "11",
|
|
1349
|
+
y2: "14"
|
|
1350
|
+
}, null, -1),
|
|
1351
|
+
e("line", {
|
|
1352
|
+
x1: "8",
|
|
1353
|
+
y1: "11",
|
|
1354
|
+
x2: "14",
|
|
1355
|
+
y2: "11"
|
|
1356
|
+
}, null, -1)
|
|
1357
|
+
])]))
|
|
1358
|
+
], 8, gi),
|
|
1359
|
+
e("button", {
|
|
1360
|
+
class: "artifactuse-viewer-control",
|
|
1361
|
+
onClick: fe(_, ["stop"]),
|
|
1362
|
+
title: "Download"
|
|
1363
|
+
}, [...w[4] || (w[4] = [
|
|
1364
|
+
e("svg", {
|
|
1365
|
+
viewBox: "0 0 24 24",
|
|
1366
|
+
fill: "none",
|
|
1367
|
+
stroke: "currentColor",
|
|
1368
|
+
"stroke-width": "2"
|
|
1369
|
+
}, [
|
|
1370
|
+
e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1371
|
+
e("polyline", { points: "7 10 12 15 17 10" }),
|
|
1372
|
+
e("line", {
|
|
1373
|
+
x1: "12",
|
|
1374
|
+
y1: "15",
|
|
1375
|
+
x2: "12",
|
|
1376
|
+
y2: "3"
|
|
1377
|
+
})
|
|
1378
|
+
], -1)
|
|
1379
|
+
])])
|
|
1380
|
+
])) : p("", !0),
|
|
1381
|
+
M.caption ? (t(), a("div", bi, i(M.caption), 1)) : p("", !0)
|
|
1382
|
+
])
|
|
1383
|
+
], 544)) : p("", !0)
|
|
1384
|
+
]),
|
|
1385
|
+
_: 1
|
|
1386
|
+
})
|
|
1387
|
+
]));
|
|
1388
|
+
}
|
|
1389
|
+
}, xi = ["innerHTML"], Il = {
|
|
1390
|
+
__name: "ArtifactuseAgentMessage",
|
|
1391
|
+
props: {
|
|
1392
|
+
// The raw message content (markdown/HTML from AI)
|
|
1393
|
+
content: {
|
|
1394
|
+
type: String,
|
|
1395
|
+
required: !0
|
|
1396
|
+
},
|
|
1397
|
+
// Unique message ID
|
|
1398
|
+
messageId: {
|
|
1399
|
+
type: String,
|
|
1400
|
+
default: () => `msg-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
|
|
1401
|
+
},
|
|
1402
|
+
// Whether to show artifact cards inline
|
|
1403
|
+
inlineCards: {
|
|
1404
|
+
type: Boolean,
|
|
1405
|
+
default: !0
|
|
1406
|
+
},
|
|
1407
|
+
// Whether the message is still being typed/streamed
|
|
1408
|
+
typing: {
|
|
1409
|
+
type: Boolean,
|
|
1410
|
+
default: !1
|
|
1411
|
+
},
|
|
1412
|
+
// Whether this is the last/most recent message in the conversation
|
|
1413
|
+
// Used to keep forms active after page reload for the latest message
|
|
1414
|
+
isLastMessage: {
|
|
1415
|
+
type: Boolean,
|
|
1416
|
+
default: !1
|
|
1417
|
+
}
|
|
1418
|
+
},
|
|
1419
|
+
emits: [
|
|
1420
|
+
"artifact-detected",
|
|
1421
|
+
"artifact-open",
|
|
1422
|
+
"artifact-copy",
|
|
1423
|
+
"artifact-download",
|
|
1424
|
+
"form-submit",
|
|
1425
|
+
"form-cancel",
|
|
1426
|
+
"form-button-click",
|
|
1427
|
+
"social-copy",
|
|
1428
|
+
"media-open"
|
|
1429
|
+
],
|
|
1430
|
+
setup(M, { expose: u, emit: f }) {
|
|
1431
|
+
const y = M, r = f, {
|
|
1432
|
+
processMessage: F,
|
|
1433
|
+
openArtifact: E,
|
|
1434
|
+
state: $,
|
|
1435
|
+
getTheme: _,
|
|
1436
|
+
instance: l
|
|
1437
|
+
} = He(), h = A(null), w = A(null), L = A(""), S = A([]);
|
|
1438
|
+
let V = null;
|
|
1439
|
+
const U = A(!1), q = A("image"), se = A(""), B = A(""), Z = A(""), D = C(() => (_ == null ? void 0 : _()) || "dark"), X = C(() => $.activeArtifactId), Q = A(!1);
|
|
1440
|
+
ge(() => {
|
|
1441
|
+
y.typing && (Q.value = !0);
|
|
1442
|
+
}), ue(() => y.typing, (b) => {
|
|
1443
|
+
b && (Q.value = !0);
|
|
1444
|
+
});
|
|
1445
|
+
const d = C(() => Q.value || y.isLastMessage ? "active" : "inactive");
|
|
1446
|
+
function m(b) {
|
|
1447
|
+
if (!b) return null;
|
|
1448
|
+
try {
|
|
1449
|
+
const R = decodeURIComponent(escape(atob(b)));
|
|
1450
|
+
return JSON.parse(R);
|
|
1451
|
+
} catch {
|
|
1452
|
+
try {
|
|
1453
|
+
const N = b.replace(/ /g, `
|
|
1454
|
+
`).replace(/ /g, "\r").replace(/	/g, " ").replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1455
|
+
return JSON.parse(N);
|
|
1456
|
+
} catch (N) {
|
|
1457
|
+
return console.error("Failed to parse artifact data:", N), null;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
const ee = C(() => {
|
|
1462
|
+
const b = [], R = L.value;
|
|
1463
|
+
if (!R) return b;
|
|
1464
|
+
const N = /<div\s+class="artifactuse-placeholder[^"]*"[^>]*data-artifact-id="([^"]+)"[^>]*data-artifact-type="([^"]+)"[^>]*data-artifact=["']([^"']*)["'][^>]*><\/div>/gi;
|
|
1465
|
+
let ne = 0, P;
|
|
1466
|
+
for (; (P = N.exec(R)) !== null; ) {
|
|
1467
|
+
if (P.index > ne) {
|
|
1468
|
+
const O = R.slice(ne, P.index);
|
|
1469
|
+
O.trim() && b.push({ type: "html", content: O });
|
|
1470
|
+
}
|
|
1471
|
+
const oe = m(P[3]), c = P[2];
|
|
1472
|
+
oe && (c === "form" && oe.isInline ? b.push({ type: "form", artifact: oe }) : c === "social" ? b.push({ type: "social", artifact: oe }) : b.push({ type: "panel", artifact: oe })), ne = P.index + P[0].length;
|
|
1473
|
+
}
|
|
1474
|
+
if (ne < R.length) {
|
|
1475
|
+
const oe = R.slice(ne);
|
|
1476
|
+
oe.trim() && b.push({ type: "html", content: oe });
|
|
1477
|
+
}
|
|
1478
|
+
return b.length === 0 && R.trim() && b.push({ type: "html", content: R }), b;
|
|
1479
|
+
});
|
|
1480
|
+
function K(b) {
|
|
1481
|
+
q.value = b.type || "image", se.value = b.src || "", B.value = b.alt || "", Z.value = b.caption || "", U.value = !0, r("media-open", b);
|
|
1482
|
+
}
|
|
1483
|
+
function Y() {
|
|
1484
|
+
U.value = !1, se.value = "", B.value = "", Z.value = "";
|
|
1485
|
+
}
|
|
1486
|
+
function te() {
|
|
1487
|
+
if (!w.value) return;
|
|
1488
|
+
w.value.querySelectorAll('img[data-lightbox="true"]').forEach((c) => {
|
|
1489
|
+
c._lightboxHandler && c.removeEventListener("click", c._lightboxHandler), c._lightboxHandler = (O) => {
|
|
1490
|
+
O.preventDefault(), O.stopPropagation(), K({
|
|
1491
|
+
type: "image",
|
|
1492
|
+
src: c.src,
|
|
1493
|
+
alt: c.alt || "",
|
|
1494
|
+
caption: c.dataset.caption || c.alt || ""
|
|
1495
|
+
});
|
|
1496
|
+
}, c.addEventListener("click", c._lightboxHandler), c.style.cursor = "zoom-in";
|
|
1497
|
+
}), w.value.querySelectorAll(".artifactuse-image-container img").forEach((c) => {
|
|
1498
|
+
c._lightboxHandler || (c._lightboxHandler = (O) => {
|
|
1499
|
+
O.preventDefault(), O.stopPropagation();
|
|
1500
|
+
const G = c.closest(".artifactuse-image-container"), le = G == null ? void 0 : G.querySelector(".artifactuse-image-caption"), ke = (le == null ? void 0 : le.textContent) || c.dataset.caption || c.alt || "";
|
|
1501
|
+
K({
|
|
1502
|
+
type: "image",
|
|
1503
|
+
src: c.src,
|
|
1504
|
+
alt: c.alt || "",
|
|
1505
|
+
caption: ke
|
|
1506
|
+
});
|
|
1507
|
+
}, c.addEventListener("click", c._lightboxHandler), c.style.cursor = "zoom-in");
|
|
1508
|
+
}), w.value.querySelectorAll(".artifactuse-gallery-item img, .artifactuse-image-gallery img").forEach((c) => {
|
|
1509
|
+
c._lightboxHandler || (c._lightboxHandler = (O) => {
|
|
1510
|
+
O.preventDefault(), O.stopPropagation();
|
|
1511
|
+
const G = c.closest(".artifactuse-gallery-item"), le = G == null ? void 0 : G.querySelector(".artifactuse-gallery-caption"), ke = (le == null ? void 0 : le.textContent) || c.dataset.caption || c.alt || "";
|
|
1512
|
+
K({
|
|
1513
|
+
type: "image",
|
|
1514
|
+
src: c.src,
|
|
1515
|
+
alt: c.alt || "",
|
|
1516
|
+
caption: ke
|
|
1517
|
+
});
|
|
1518
|
+
}, c.addEventListener("click", c._lightboxHandler), c.style.cursor = "zoom-in");
|
|
1519
|
+
}), w.value.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((c) => {
|
|
1520
|
+
c._pdfHandler && c.removeEventListener("click", c._pdfHandler), c._pdfHandler = (O) => {
|
|
1521
|
+
O.preventDefault(), O.stopPropagation(), K({
|
|
1522
|
+
type: "pdf",
|
|
1523
|
+
src: c.href,
|
|
1524
|
+
alt: c.textContent || "PDF Document",
|
|
1525
|
+
caption: c.title || c.textContent || ""
|
|
1526
|
+
});
|
|
1527
|
+
}, c.addEventListener("click", c._pdfHandler);
|
|
1528
|
+
}), w.value.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((c) => {
|
|
1529
|
+
var G;
|
|
1530
|
+
c._pdfHandler && c.removeEventListener("click", c._pdfHandler);
|
|
1531
|
+
const O = c.dataset.pdfSrc || ((G = c.querySelector("iframe")) == null ? void 0 : G.src) || "";
|
|
1532
|
+
O && (c._pdfHandler = (le) => {
|
|
1533
|
+
le.preventDefault(), le.stopPropagation(), K({
|
|
1534
|
+
type: "pdf",
|
|
1535
|
+
src: O,
|
|
1536
|
+
alt: "PDF Document",
|
|
1537
|
+
caption: c.dataset.caption || ""
|
|
1538
|
+
});
|
|
1539
|
+
}, c.addEventListener("click", c._pdfHandler), c.style.cursor = "pointer");
|
|
1540
|
+
}), w.value.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((c) => {
|
|
1541
|
+
c._clickHandler && c.removeEventListener("click", c._clickHandler), c._clickHandler = (O) => {
|
|
1542
|
+
if (O.target.closest(".artifactuse-video-play-button")) return;
|
|
1543
|
+
const G = c.dataset.videoUrl || c.dataset.url;
|
|
1544
|
+
G && window.open(G, "_blank", "noopener,noreferrer");
|
|
1545
|
+
}, c.addEventListener("click", c._clickHandler);
|
|
1546
|
+
});
|
|
1547
|
+
}
|
|
1548
|
+
function g() {
|
|
1549
|
+
if (!w.value) return;
|
|
1550
|
+
w.value.querySelectorAll("img").forEach((P) => {
|
|
1551
|
+
P._lightboxHandler && (P.removeEventListener("click", P._lightboxHandler), delete P._lightboxHandler);
|
|
1552
|
+
}), w.value.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((P) => {
|
|
1553
|
+
P._pdfHandler && (P.removeEventListener("click", P._pdfHandler), delete P._pdfHandler);
|
|
1554
|
+
}), w.value.querySelectorAll(".artifactuse-pdf-container, [data-pdf-viewer]").forEach((P) => {
|
|
1555
|
+
P._pdfHandler && (P.removeEventListener("click", P._pdfHandler), delete P._pdfHandler);
|
|
1556
|
+
}), w.value.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((P) => {
|
|
1557
|
+
P._clickHandler && (P.removeEventListener("click", P._clickHandler), delete P._clickHandler);
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
function T() {
|
|
1561
|
+
V && clearTimeout(V), V = setTimeout(async () => {
|
|
1562
|
+
if (await he(), l != null && l.initializeContent && w.value)
|
|
1563
|
+
try {
|
|
1564
|
+
await l.initializeContent(w.value);
|
|
1565
|
+
} catch (b) {
|
|
1566
|
+
console.error("Failed to initialize content:", b);
|
|
1567
|
+
}
|
|
1568
|
+
te();
|
|
1569
|
+
}, 100);
|
|
1570
|
+
}
|
|
1571
|
+
ue(
|
|
1572
|
+
() => y.content,
|
|
1573
|
+
(b) => {
|
|
1574
|
+
if (b) {
|
|
1575
|
+
const R = F(b, y.messageId);
|
|
1576
|
+
L.value = R.html, S.value = R.artifacts, R.artifacts.length > 0 && r("artifact-detected", R.artifacts), y.typing || T();
|
|
1577
|
+
}
|
|
1578
|
+
},
|
|
1579
|
+
{ immediate: !0 }
|
|
1580
|
+
), ue(
|
|
1581
|
+
() => y.typing,
|
|
1582
|
+
(b, R) => {
|
|
1583
|
+
R === !0 && b === !1 && T();
|
|
1584
|
+
}
|
|
1585
|
+
), ge(() => {
|
|
1586
|
+
y.typing || T();
|
|
1587
|
+
}), lt(() => {
|
|
1588
|
+
V && clearTimeout(V), g();
|
|
1589
|
+
});
|
|
1590
|
+
function n(b) {
|
|
1591
|
+
E(b), r("artifact-open", b);
|
|
1592
|
+
}
|
|
1593
|
+
function z(b) {
|
|
1594
|
+
r("artifact-copy", b);
|
|
1595
|
+
}
|
|
1596
|
+
function o(b) {
|
|
1597
|
+
r("artifact-download", b);
|
|
1598
|
+
}
|
|
1599
|
+
function H(b) {
|
|
1600
|
+
r("form-submit", b);
|
|
1601
|
+
}
|
|
1602
|
+
function ie(b) {
|
|
1603
|
+
r("form-cancel", b);
|
|
1604
|
+
}
|
|
1605
|
+
function pe(b) {
|
|
1606
|
+
r("form-button-click", b);
|
|
1607
|
+
}
|
|
1608
|
+
function Ce(b) {
|
|
1609
|
+
r("social-copy", b);
|
|
1610
|
+
}
|
|
1611
|
+
return C(() => $.artifacts.filter((b) => b.messageId === y.messageId)), u({
|
|
1612
|
+
openViewer: K,
|
|
1613
|
+
closeViewer: Y,
|
|
1614
|
+
attachMediaListeners: te
|
|
1615
|
+
}), (b, R) => (t(), a("div", {
|
|
1616
|
+
class: "artifactuse-agent-message",
|
|
1617
|
+
ref_key: "messageRef",
|
|
1618
|
+
ref: h
|
|
1619
|
+
}, [
|
|
1620
|
+
e("div", {
|
|
1621
|
+
class: "artifactuse-message-content",
|
|
1622
|
+
ref_key: "contentRef",
|
|
1623
|
+
ref: w
|
|
1624
|
+
}, [
|
|
1625
|
+
(t(!0), a(I, null, ce(ee.value, (N, ne) => (t(), a(I, { key: ne }, [
|
|
1626
|
+
N.type === "html" ? (t(), a("div", {
|
|
1627
|
+
key: 0,
|
|
1628
|
+
innerHTML: N.content
|
|
1629
|
+
}, null, 8, xi)) : N.type === "form" && N.artifact.isInline ? (t(), ye(va, {
|
|
1630
|
+
key: 1,
|
|
1631
|
+
artifact: N.artifact,
|
|
1632
|
+
theme: D.value,
|
|
1633
|
+
"initial-state": d.value,
|
|
1634
|
+
onSubmit: H,
|
|
1635
|
+
onCancel: ie,
|
|
1636
|
+
onButtonClick: pe
|
|
1637
|
+
}, null, 8, ["artifact", "theme", "initial-state"])) : N.type === "social" ? (t(), ye(mi, {
|
|
1638
|
+
key: 2,
|
|
1639
|
+
artifact: N.artifact,
|
|
1640
|
+
theme: D.value,
|
|
1641
|
+
onCopy: Ce
|
|
1642
|
+
}, null, 8, ["artifact", "theme"])) : N.type === "panel" && M.inlineCards ? (t(), ye(Ct, {
|
|
1643
|
+
key: 3,
|
|
1644
|
+
artifact: N.artifact,
|
|
1645
|
+
"is-active": X.value === N.artifact.id,
|
|
1646
|
+
onOpen: n,
|
|
1647
|
+
onCopy: z,
|
|
1648
|
+
onDownload: o
|
|
1649
|
+
}, null, 8, ["artifact", "is-active"])) : p("", !0)
|
|
1650
|
+
], 64))), 128))
|
|
1651
|
+
], 512),
|
|
1652
|
+
be(Ci, {
|
|
1653
|
+
"is-open": U.value,
|
|
1654
|
+
type: q.value,
|
|
1655
|
+
src: se.value,
|
|
1656
|
+
alt: B.value,
|
|
1657
|
+
caption: Z.value,
|
|
1658
|
+
onClose: Y
|
|
1659
|
+
}, null, 8, ["is-open", "type", "src", "alt", "caption"])
|
|
1660
|
+
], 512));
|
|
1661
|
+
}
|
|
1662
|
+
}, $i = { class: "artifactuse-panel__header artifactuse-panel__header--simple" }, Mi = { class: "artifactuse-panel__actions" }, Li = { class: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, Ti = {
|
|
1663
|
+
key: 0,
|
|
1664
|
+
href: "https://artifactuse.com",
|
|
1665
|
+
target: "_blank",
|
|
1666
|
+
rel: "noopener noreferrer",
|
|
1667
|
+
class: "artifactuse-panel__branding"
|
|
1668
|
+
}, Hi = { class: "artifactuse-panel__header artifactuse-panel__header--simple" }, Pi = { class: "artifactuse-panel__title" }, Ai = { class: "artifactuse-panel__title-content" }, Bi = { class: "artifactuse-panel__meta" }, Ei = { class: "artifactuse-panel__actions" }, zi = ["disabled"], Si = {
|
|
1669
|
+
key: 0,
|
|
1670
|
+
viewBox: "0 0 24 24",
|
|
1671
|
+
fill: "none",
|
|
1672
|
+
stroke: "currentColor",
|
|
1673
|
+
"stroke-width": "2"
|
|
1674
|
+
}, Ii = {
|
|
1675
|
+
key: 1,
|
|
1676
|
+
class: "artifactuse-panel__spinner-icon",
|
|
1677
|
+
viewBox: "0 0 24 24",
|
|
1678
|
+
fill: "none",
|
|
1679
|
+
stroke: "currentColor",
|
|
1680
|
+
"stroke-width": "2"
|
|
1681
|
+
}, qi = { class: "artifactuse-panel__list" }, Fi = { class: "artifactuse-panel__list-items" }, Vi = ["onClick"], Ri = ["innerHTML"], Oi = { class: "artifactuse-panel__list-item-content" }, Di = { class: "artifactuse-panel__list-item-title" }, Ui = { class: "artifactuse-panel__list-item-meta" }, Ni = { class: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, ji = {
|
|
1682
|
+
key: 0,
|
|
1683
|
+
href: "https://artifactuse.com",
|
|
1684
|
+
target: "_blank",
|
|
1685
|
+
rel: "noopener noreferrer",
|
|
1686
|
+
class: "artifactuse-panel__branding"
|
|
1687
|
+
}, Ji = { class: "artifactuse-panel__header" }, Xi = { class: "artifactuse-panel__title" }, Wi = ["innerHTML"], Zi = { class: "artifactuse-panel__title-content" }, Ki = { class: "artifactuse-panel__name" }, Yi = { class: "artifactuse-panel__meta" }, Gi = { class: "artifactuse-panel__tabs" }, Qi = ["disabled"], el = ["disabled"], tl = { class: "artifactuse-panel__actions" }, al = ["title"], sl = {
|
|
1688
|
+
key: 0,
|
|
1689
|
+
viewBox: "0 0 24 24",
|
|
1690
|
+
fill: "none",
|
|
1691
|
+
stroke: "currentColor",
|
|
1692
|
+
"stroke-width": "2"
|
|
1693
|
+
}, il = {
|
|
1694
|
+
key: 1,
|
|
1695
|
+
viewBox: "0 0 24 24",
|
|
1696
|
+
fill: "none",
|
|
1697
|
+
stroke: "currentColor",
|
|
1698
|
+
"stroke-width": "2"
|
|
1699
|
+
}, ll = {
|
|
1700
|
+
key: 0,
|
|
1701
|
+
class: "artifactuse-panel__loading"
|
|
1702
|
+
}, nl = ["src"], ol = {
|
|
1703
|
+
key: 2,
|
|
1704
|
+
class: "artifactuse-panel__no-preview"
|
|
1705
|
+
}, rl = { class: "artifactuse-panel__code-block" }, cl = ["textContent"], ul = { class: "artifactuse-panel__footer" }, dl = { class: "artifactuse-panel__footer-left" }, vl = {
|
|
1706
|
+
key: 0,
|
|
1707
|
+
href: "https://artifactuse.com",
|
|
1708
|
+
target: "_blank",
|
|
1709
|
+
rel: "noopener noreferrer",
|
|
1710
|
+
class: "artifactuse-panel__branding"
|
|
1711
|
+
}, fl = {
|
|
1712
|
+
key: 1,
|
|
1713
|
+
class: "artifactuse-panel__badge"
|
|
1714
|
+
}, pl = { class: "artifactuse-panel__footer-right" }, ml = ["title"], _l = {
|
|
1715
|
+
key: 0,
|
|
1716
|
+
viewBox: "0 0 24 24",
|
|
1717
|
+
fill: "none",
|
|
1718
|
+
stroke: "currentColor",
|
|
1719
|
+
"stroke-width": "2"
|
|
1720
|
+
}, hl = {
|
|
1721
|
+
key: 1,
|
|
1722
|
+
viewBox: "0 0 24 24",
|
|
1723
|
+
fill: "none",
|
|
1724
|
+
stroke: "currentColor",
|
|
1725
|
+
"stroke-width": "2"
|
|
1726
|
+
}, yl = {
|
|
1727
|
+
key: 1,
|
|
1728
|
+
class: "artifactuse-panel__nav"
|
|
1729
|
+
}, gl = ["disabled"], kl = ["disabled"], wl = {
|
|
1730
|
+
key: 0,
|
|
1731
|
+
class: "artifactuse-panel__artifact-list"
|
|
1732
|
+
}, bl = { class: "artifactuse-panel__artifact-list-header" }, Cl = { class: "artifactuse-panel__artifact-list-items" }, xl = ["onClick"], $l = ["innerHTML"], Ml = { class: "artifactuse-panel__artifact-item-content" }, Ll = { class: "artifactuse-panel__artifact-item-title" }, Tl = { class: "artifactuse-panel__artifact-item-meta" }, Hl = { class: "artifactuse-panel__artifact-item-index" }, ql = {
|
|
1733
|
+
__name: "ArtifactusePanel",
|
|
1734
|
+
emits: ["close", "ai-request", "save", "export", "resize"],
|
|
1735
|
+
setup(M, { emit: u }) {
|
|
1736
|
+
const f = u, {
|
|
1737
|
+
state: y,
|
|
1738
|
+
activeArtifact: r,
|
|
1739
|
+
artifactCount: F,
|
|
1740
|
+
hasArtifacts: E,
|
|
1741
|
+
closePanel: $,
|
|
1742
|
+
toggleFullscreen: _,
|
|
1743
|
+
setViewMode: l,
|
|
1744
|
+
getPanelUrl: h,
|
|
1745
|
+
openArtifact: w,
|
|
1746
|
+
instance: L
|
|
1747
|
+
} = He(), S = A(null), V = A(null), U = A(null), q = A(null), se = A(null), B = A(!1), Z = A(!1), D = A(!0), X = A(!1), Q = A(!1);
|
|
1748
|
+
let d = null, m = null, ee = null;
|
|
1749
|
+
const K = A(!1), Y = A(50), te = A(50), g = C(() => r.value ? Te(r.value.language) : ""), T = C(() => r.value ? `<svg viewBox="0 0 24 24" fill="currentColor">${Ie(r.value.language)}</svg>` : ""), n = C(() => r.value ? h(r.value) : null);
|
|
1750
|
+
C(() => !r.value || !y.artifacts.length ? -1 : y.artifacts.findIndex((v) => v.id === r.value.id));
|
|
1751
|
+
const z = C(() => r.value ? rt(r.value.language || "plaintext") : "plaintext"), o = C(() => y.artifacts.filter((v) => !v.isInline)), H = C(() => r.value ? o.value.findIndex((v) => v.id === r.value.id) : -1), ie = C(() => {
|
|
1752
|
+
var v;
|
|
1753
|
+
return ((v = L.config) == null ? void 0 : v.branding) !== !1;
|
|
1754
|
+
}), pe = C(() => r.value ? Y.value : Math.min(Y.value, 30));
|
|
1755
|
+
function Ce(v) {
|
|
1756
|
+
return `<svg viewBox="0 0 24 24" fill="currentColor">${Ie(v)}</svg>`;
|
|
1757
|
+
}
|
|
1758
|
+
function b() {
|
|
1759
|
+
X.value = !1, L.state.clearActiveArtifact();
|
|
1760
|
+
}
|
|
1761
|
+
function R() {
|
|
1762
|
+
var v;
|
|
1763
|
+
if (q.value && ((v = r.value) != null && v.code)) {
|
|
1764
|
+
const s = r.value.code.split(`
|
|
1765
|
+
`);
|
|
1766
|
+
q.value.innerHTML = s.map((x, W) => `<div>${W + 1}</div>`).join("");
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
function N() {
|
|
1770
|
+
V.value && ct() && (window.Prism.highlightElement(V.value), he(() => {
|
|
1771
|
+
ne();
|
|
1772
|
+
}));
|
|
1773
|
+
}
|
|
1774
|
+
function ne() {
|
|
1775
|
+
var s;
|
|
1776
|
+
const v = (s = V.value) == null ? void 0 : s.closest("pre");
|
|
1777
|
+
if (v && se.value && q.value) {
|
|
1778
|
+
const W = window.getComputedStyle(v).backgroundColor;
|
|
1779
|
+
W && W !== "rgba(0, 0, 0, 0)" && W !== "transparent" && (se.value.style.backgroundColor = W, q.value.style.backgroundColor = W);
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
function P() {
|
|
1783
|
+
he(() => {
|
|
1784
|
+
R(), K.value || N();
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
function oe() {
|
|
1788
|
+
clearTimeout(ee), D.value = !1, S.value && r.value && (L.bridge.setIframe(S.value), L.bridge.loadArtifact(r.value));
|
|
1789
|
+
}
|
|
1790
|
+
function c() {
|
|
1791
|
+
clearTimeout(ee), D.value = !1;
|
|
1792
|
+
}
|
|
1793
|
+
function O() {
|
|
1794
|
+
clearTimeout(ee), ee = setTimeout(() => {
|
|
1795
|
+
D.value = !1;
|
|
1796
|
+
}, 1e4);
|
|
1797
|
+
}
|
|
1798
|
+
async function G() {
|
|
1799
|
+
if (r.value)
|
|
1800
|
+
try {
|
|
1801
|
+
await navigator.clipboard.writeText(r.value.code), B.value = !0, setTimeout(() => {
|
|
1802
|
+
B.value = !1;
|
|
1803
|
+
}, 2e3);
|
|
1804
|
+
} catch (v) {
|
|
1805
|
+
console.error("Failed to copy:", v);
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
function le() {
|
|
1809
|
+
if (!r.value) return;
|
|
1810
|
+
const { code: v, language: s, title: x } = r.value, W = qe(s), me = `${x.toLowerCase().replace(/\s+/g, "-")}.${W}`, xe = new Blob([v], { type: "text/plain" }), ve = URL.createObjectURL(xe), re = document.createElement("a");
|
|
1811
|
+
re.href = ve, re.download = me, document.body.appendChild(re), re.click(), document.body.removeChild(re), URL.revokeObjectURL(ve);
|
|
1812
|
+
}
|
|
1813
|
+
async function ke() {
|
|
1814
|
+
if (!(Q.value || o.value.length === 0)) {
|
|
1815
|
+
Q.value = !0;
|
|
1816
|
+
try {
|
|
1817
|
+
const v = new dt(), s = /* @__PURE__ */ new Map();
|
|
1818
|
+
for (const re of o.value) {
|
|
1819
|
+
if (!re.code) continue;
|
|
1820
|
+
const Be = qe(re.language);
|
|
1821
|
+
let Ee = (re.title || "untitled").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-_]/g, ""), ze = `${Ee}.${Be}`;
|
|
1822
|
+
const Se = s.get(ze) || 0;
|
|
1823
|
+
Se > 0 && (ze = `${Ee}-${Se}.${Be}`), s.set(`${Ee}.${Be}`, Se + 1), v.file(ze, re.code);
|
|
1824
|
+
}
|
|
1825
|
+
const x = await v.generateAsync({ type: "blob" }), me = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, xe = URL.createObjectURL(x), ve = document.createElement("a");
|
|
1826
|
+
ve.href = xe, ve.download = me, document.body.appendChild(ve), ve.click(), document.body.removeChild(ve), URL.revokeObjectURL(xe);
|
|
1827
|
+
} catch (v) {
|
|
1828
|
+
console.error("Failed to create ZIP:", v);
|
|
1829
|
+
} finally {
|
|
1830
|
+
Q.value = !1;
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
function Ze() {
|
|
1835
|
+
n.value && window.open(n.value, "_blank");
|
|
1836
|
+
}
|
|
1837
|
+
function Ke() {
|
|
1838
|
+
q.value && se.value && (q.value.style.transform = `translateY(-${se.value.scrollTop}px)`);
|
|
1839
|
+
}
|
|
1840
|
+
function Ye() {
|
|
1841
|
+
Z.value = !Z.value;
|
|
1842
|
+
}
|
|
1843
|
+
function Ve(v) {
|
|
1844
|
+
X.value = !0, w(v), Z.value = !1;
|
|
1845
|
+
}
|
|
1846
|
+
function Ge() {
|
|
1847
|
+
const v = H.value - 1;
|
|
1848
|
+
v >= 0 && w(o.value[v]);
|
|
1849
|
+
}
|
|
1850
|
+
function Qe() {
|
|
1851
|
+
const v = H.value + 1;
|
|
1852
|
+
v < o.value.length && w(o.value[v]);
|
|
1853
|
+
}
|
|
1854
|
+
function Re(v) {
|
|
1855
|
+
const s = document.querySelector(".artifactuse-panel__nav");
|
|
1856
|
+
s && !s.contains(v.target) && (Z.value = !1);
|
|
1857
|
+
}
|
|
1858
|
+
let _e = null;
|
|
1859
|
+
function et(v) {
|
|
1860
|
+
_e = {
|
|
1861
|
+
startX: v.clientX,
|
|
1862
|
+
startWidth: Y.value
|
|
1863
|
+
}, document.addEventListener("mousemove", Oe), document.addEventListener("mouseup", Pe), document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((x) => x.style.pointerEvents = "none");
|
|
1864
|
+
}
|
|
1865
|
+
function Oe(v) {
|
|
1866
|
+
if (!_e) return;
|
|
1867
|
+
const s = window.innerWidth, W = (_e.startX - v.clientX) / s * 100, me = _e.startWidth + W;
|
|
1868
|
+
Y.value = Math.min(Math.max(me, 25), 75), f("resize", { width: Y.value });
|
|
1869
|
+
}
|
|
1870
|
+
function Pe() {
|
|
1871
|
+
const v = _e !== null;
|
|
1872
|
+
_e = null, document.removeEventListener("mousemove", Oe), document.removeEventListener("mouseup", Pe), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((x) => x.style.pointerEvents = ""), v && f("resize", { width: Y.value });
|
|
1873
|
+
}
|
|
1874
|
+
let we = null;
|
|
1875
|
+
function tt(v) {
|
|
1876
|
+
if (!U.value) return;
|
|
1877
|
+
const s = U.value.getBoundingClientRect();
|
|
1878
|
+
we = {
|
|
1879
|
+
startX: v.clientX,
|
|
1880
|
+
startPosition: te.value,
|
|
1881
|
+
contentLeft: s.left,
|
|
1882
|
+
contentWidth: s.width
|
|
1883
|
+
}, document.addEventListener("mousemove", De), document.addEventListener("mouseup", Ae), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((W) => W.style.pointerEvents = "none");
|
|
1884
|
+
}
|
|
1885
|
+
function De(v) {
|
|
1886
|
+
if (!we) return;
|
|
1887
|
+
const x = (v.clientX - we.contentLeft) / we.contentWidth * 100;
|
|
1888
|
+
te.value = Math.min(Math.max(x, 20), 80);
|
|
1889
|
+
}
|
|
1890
|
+
function Ae() {
|
|
1891
|
+
we = null, document.removeEventListener("mousemove", De), document.removeEventListener("mouseup", Ae), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((s) => s.style.pointerEvents = "");
|
|
1892
|
+
}
|
|
1893
|
+
return ue(r, (v, s) => {
|
|
1894
|
+
v && ((!s || v.id !== s.id) && (D.value = !0, O()), !s || v.code !== s.code ? (K.value = !0, clearTimeout(d), d = setTimeout(() => {
|
|
1895
|
+
R();
|
|
1896
|
+
}, 100), clearTimeout(m), m = setTimeout(() => {
|
|
1897
|
+
K.value = !1, he(() => {
|
|
1898
|
+
N(), S.value && v.isPreviewable && (D.value = !0, O(), L.bridge.loadArtifact(v));
|
|
1899
|
+
});
|
|
1900
|
+
}, 500)) : (S.value && v.isPreviewable && (D.value = !0, O(), he(() => {
|
|
1901
|
+
L.bridge.loadArtifact(v);
|
|
1902
|
+
})), P()));
|
|
1903
|
+
}, { deep: !0 }), ue(() => y.viewMode, (v) => {
|
|
1904
|
+
(v === "code" || v === "split") && P();
|
|
1905
|
+
}), ue(() => y.isPanelOpen, (v) => {
|
|
1906
|
+
v && (y.viewMode === "code" || y.viewMode === "split") && P();
|
|
1907
|
+
}), ge(() => {
|
|
1908
|
+
L.on("ai:request", (v) => f("ai-request", v)), L.on("save:request", (v) => f("save", v)), L.on("export:complete", (v) => f("export", v)), document.addEventListener("click", Re), y.isPanelOpen && r.value && P();
|
|
1909
|
+
}), Fe(() => {
|
|
1910
|
+
Pe(), Ae(), document.removeEventListener("click", Re), clearTimeout(d), clearTimeout(m), clearTimeout(ee);
|
|
1911
|
+
}), (v, s) => (t(), a(I, null, [
|
|
1912
|
+
be(Me, { name: "artifactuse-panel" }, {
|
|
1913
|
+
default: Le(() => [
|
|
1914
|
+
k(y).isPanelOpen ? (t(), a("div", {
|
|
1915
|
+
key: 0,
|
|
1916
|
+
class: j(["artifactuse-panel", {
|
|
1917
|
+
"artifactuse-panel--fullscreen": k(y).isFullscreen,
|
|
1918
|
+
"artifactuse-panel--list": !k(r) && k(E),
|
|
1919
|
+
"artifactuse-panel--empty": !k(E)
|
|
1920
|
+
}]),
|
|
1921
|
+
style: $e(k(y).isFullscreen ? void 0 : { width: `${pe.value}%` })
|
|
1922
|
+
}, [
|
|
1923
|
+
k(y).isFullscreen ? p("", !0) : (t(), a("div", {
|
|
1924
|
+
key: 0,
|
|
1925
|
+
class: "artifactuse-panel__resize-handle",
|
|
1926
|
+
onMousedown: fe(et, ["prevent"])
|
|
1927
|
+
}, [...s[9] || (s[9] = [
|
|
1928
|
+
e("div", { class: "artifactuse-panel__resize-handle-line" }, null, -1)
|
|
1929
|
+
])], 32)),
|
|
1930
|
+
k(E) ? k(r) ? (t(), a(I, { key: 3 }, [
|
|
1931
|
+
e("header", Ji, [
|
|
1932
|
+
X.value ? (t(), a("button", {
|
|
1933
|
+
key: 0,
|
|
1934
|
+
class: "artifactuse-panel__back",
|
|
1935
|
+
title: "Back to list",
|
|
1936
|
+
onClick: b
|
|
1937
|
+
}, [...s[21] || (s[21] = [
|
|
1938
|
+
e("svg", {
|
|
1939
|
+
viewBox: "0 0 24 24",
|
|
1940
|
+
fill: "none",
|
|
1941
|
+
stroke: "currentColor",
|
|
1942
|
+
"stroke-width": "2"
|
|
1943
|
+
}, [
|
|
1944
|
+
e("polyline", { points: "15 18 9 12 15 6" })
|
|
1945
|
+
], -1)
|
|
1946
|
+
])])) : p("", !0),
|
|
1947
|
+
e("div", Xi, [
|
|
1948
|
+
e("span", {
|
|
1949
|
+
class: "artifactuse-panel__icon",
|
|
1950
|
+
innerHTML: T.value
|
|
1951
|
+
}, null, 8, Wi),
|
|
1952
|
+
e("div", Zi, [
|
|
1953
|
+
e("span", Ki, i(k(r).title || "Untitled"), 1),
|
|
1954
|
+
e("span", Yi, [
|
|
1955
|
+
J(i(g.value) + " ", 1),
|
|
1956
|
+
k(r).lineCount ? (t(), a(I, { key: 0 }, [
|
|
1957
|
+
J(" • " + i(k(r).lineCount) + " lines ", 1)
|
|
1958
|
+
], 64)) : p("", !0)
|
|
1959
|
+
])
|
|
1960
|
+
])
|
|
1961
|
+
]),
|
|
1962
|
+
e("div", Gi, [
|
|
1963
|
+
e("button", {
|
|
1964
|
+
class: j(["artifactuse-panel__tab", { "artifactuse-panel__tab--active": k(y).viewMode === "preview" }]),
|
|
1965
|
+
disabled: !k(r).isPreviewable,
|
|
1966
|
+
title: "Preview",
|
|
1967
|
+
onClick: s[2] || (s[2] = (x) => k(l)("preview"))
|
|
1968
|
+
}, [...s[22] || (s[22] = [
|
|
1969
|
+
e("svg", {
|
|
1970
|
+
viewBox: "0 0 24 24",
|
|
1971
|
+
fill: "none",
|
|
1972
|
+
stroke: "currentColor",
|
|
1973
|
+
"stroke-width": "2"
|
|
1974
|
+
}, [
|
|
1975
|
+
e("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
1976
|
+
e("circle", {
|
|
1977
|
+
cx: "12",
|
|
1978
|
+
cy: "12",
|
|
1979
|
+
r: "3"
|
|
1980
|
+
})
|
|
1981
|
+
], -1)
|
|
1982
|
+
])], 10, Qi),
|
|
1983
|
+
e("button", {
|
|
1984
|
+
class: j(["artifactuse-panel__tab", { "artifactuse-panel__tab--active": k(y).viewMode === "code" }]),
|
|
1985
|
+
title: "Code",
|
|
1986
|
+
onClick: s[3] || (s[3] = (x) => k(l)("code"))
|
|
1987
|
+
}, [...s[23] || (s[23] = [
|
|
1988
|
+
e("svg", {
|
|
1989
|
+
viewBox: "0 0 24 24",
|
|
1990
|
+
fill: "none",
|
|
1991
|
+
stroke: "currentColor",
|
|
1992
|
+
"stroke-width": "2"
|
|
1993
|
+
}, [
|
|
1994
|
+
e("polyline", { points: "16 18 22 12 16 6" }),
|
|
1995
|
+
e("polyline", { points: "8 6 2 12 8 18" })
|
|
1996
|
+
], -1)
|
|
1997
|
+
])], 2),
|
|
1998
|
+
e("button", {
|
|
1999
|
+
class: j(["artifactuse-panel__tab", { "artifactuse-panel__tab--active": k(y).viewMode === "split" }]),
|
|
2000
|
+
disabled: !k(r).isPreviewable,
|
|
2001
|
+
title: "Split view",
|
|
2002
|
+
onClick: s[4] || (s[4] = (x) => k(l)("split"))
|
|
2003
|
+
}, [...s[24] || (s[24] = [
|
|
2004
|
+
e("svg", {
|
|
2005
|
+
viewBox: "0 0 24 24",
|
|
2006
|
+
fill: "none",
|
|
2007
|
+
stroke: "currentColor",
|
|
2008
|
+
"stroke-width": "2"
|
|
2009
|
+
}, [
|
|
2010
|
+
e("rect", {
|
|
2011
|
+
x: "3",
|
|
2012
|
+
y: "3",
|
|
2013
|
+
width: "18",
|
|
2014
|
+
height: "18",
|
|
2015
|
+
rx: "2",
|
|
2016
|
+
ry: "2"
|
|
2017
|
+
}),
|
|
2018
|
+
e("line", {
|
|
2019
|
+
x1: "12",
|
|
2020
|
+
y1: "3",
|
|
2021
|
+
x2: "12",
|
|
2022
|
+
y2: "21"
|
|
2023
|
+
})
|
|
2024
|
+
], -1)
|
|
2025
|
+
])], 10, el)
|
|
2026
|
+
]),
|
|
2027
|
+
e("div", tl, [
|
|
2028
|
+
e("button", {
|
|
2029
|
+
class: "artifactuse-panel__action",
|
|
2030
|
+
title: k(y).isFullscreen ? "Exit fullscreen" : "Fullscreen",
|
|
2031
|
+
onClick: s[5] || (s[5] = (...x) => k(_) && k(_)(...x))
|
|
2032
|
+
}, [
|
|
2033
|
+
k(y).isFullscreen ? (t(), a("svg", il, [...s[26] || (s[26] = [
|
|
2034
|
+
e("polyline", { points: "4 14 10 14 10 20" }, null, -1),
|
|
2035
|
+
e("polyline", { points: "20 10 14 10 14 4" }, null, -1),
|
|
2036
|
+
e("line", {
|
|
2037
|
+
x1: "14",
|
|
2038
|
+
y1: "10",
|
|
2039
|
+
x2: "21",
|
|
2040
|
+
y2: "3"
|
|
2041
|
+
}, null, -1),
|
|
2042
|
+
e("line", {
|
|
2043
|
+
x1: "3",
|
|
2044
|
+
y1: "21",
|
|
2045
|
+
x2: "10",
|
|
2046
|
+
y2: "14"
|
|
2047
|
+
}, null, -1)
|
|
2048
|
+
])])) : (t(), a("svg", sl, [...s[25] || (s[25] = [
|
|
2049
|
+
e("polyline", { points: "15 3 21 3 21 9" }, null, -1),
|
|
2050
|
+
e("polyline", { points: "9 21 3 21 3 15" }, null, -1),
|
|
2051
|
+
e("line", {
|
|
2052
|
+
x1: "21",
|
|
2053
|
+
y1: "3",
|
|
2054
|
+
x2: "14",
|
|
2055
|
+
y2: "10"
|
|
2056
|
+
}, null, -1),
|
|
2057
|
+
e("line", {
|
|
2058
|
+
x1: "3",
|
|
2059
|
+
y1: "21",
|
|
2060
|
+
x2: "10",
|
|
2061
|
+
y2: "14"
|
|
2062
|
+
}, null, -1)
|
|
2063
|
+
])]))
|
|
2064
|
+
], 8, al),
|
|
2065
|
+
e("button", {
|
|
2066
|
+
class: "artifactuse-panel__action artifactuse-panel__action--close",
|
|
2067
|
+
title: "Close panel",
|
|
2068
|
+
onClick: s[6] || (s[6] = (...x) => k($) && k($)(...x))
|
|
2069
|
+
}, [...s[27] || (s[27] = [
|
|
2070
|
+
e("svg", {
|
|
2071
|
+
viewBox: "0 0 24 24",
|
|
2072
|
+
fill: "none",
|
|
2073
|
+
stroke: "currentColor",
|
|
2074
|
+
"stroke-width": "2"
|
|
2075
|
+
}, [
|
|
2076
|
+
e("line", {
|
|
2077
|
+
x1: "18",
|
|
2078
|
+
y1: "6",
|
|
2079
|
+
x2: "6",
|
|
2080
|
+
y2: "18"
|
|
2081
|
+
}),
|
|
2082
|
+
e("line", {
|
|
2083
|
+
x1: "6",
|
|
2084
|
+
y1: "6",
|
|
2085
|
+
x2: "18",
|
|
2086
|
+
y2: "18"
|
|
2087
|
+
})
|
|
2088
|
+
], -1)
|
|
2089
|
+
])])
|
|
2090
|
+
])
|
|
2091
|
+
]),
|
|
2092
|
+
e("div", {
|
|
2093
|
+
ref_key: "contentRef",
|
|
2094
|
+
ref: U,
|
|
2095
|
+
class: j(["artifactuse-panel__content", `artifactuse-panel__content--${k(y).viewMode}`])
|
|
2096
|
+
}, [
|
|
2097
|
+
k(y).viewMode === "preview" || k(y).viewMode === "split" ? (t(), a("div", {
|
|
2098
|
+
key: 0,
|
|
2099
|
+
class: "artifactuse-panel__preview",
|
|
2100
|
+
style: $e(k(y).viewMode === "split" ? { width: `${te.value}%` } : void 0)
|
|
2101
|
+
}, [
|
|
2102
|
+
D.value && n.value ? (t(), a("div", ll, [...s[28] || (s[28] = [
|
|
2103
|
+
e("div", { class: "artifactuse-panel__spinner" }, null, -1)
|
|
2104
|
+
])])) : p("", !0),
|
|
2105
|
+
n.value ? (t(), a("iframe", {
|
|
2106
|
+
key: 1,
|
|
2107
|
+
ref_key: "iframeRef",
|
|
2108
|
+
ref: S,
|
|
2109
|
+
src: n.value,
|
|
2110
|
+
class: j(["artifactuse-panel__iframe", { "artifactuse-panel__iframe--loading": D.value }]),
|
|
2111
|
+
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-modals",
|
|
2112
|
+
onLoad: oe,
|
|
2113
|
+
onError: c
|
|
2114
|
+
}, null, 42, nl)) : (t(), a("div", ol, [
|
|
2115
|
+
s[29] || (s[29] = e("svg", {
|
|
2116
|
+
viewBox: "0 0 24 24",
|
|
2117
|
+
fill: "none",
|
|
2118
|
+
stroke: "currentColor",
|
|
2119
|
+
"stroke-width": "1.5"
|
|
2120
|
+
}, [
|
|
2121
|
+
e("path", { d: "M9 17H7A5 5 0 0 1 7 7h2" }),
|
|
2122
|
+
e("path", { d: "M15 7h2a5 5 0 1 1 0 10h-2" }),
|
|
2123
|
+
e("line", {
|
|
2124
|
+
x1: "8",
|
|
2125
|
+
y1: "12",
|
|
2126
|
+
x2: "16",
|
|
2127
|
+
y2: "12"
|
|
2128
|
+
})
|
|
2129
|
+
], -1)),
|
|
2130
|
+
e("p", null, "Preview not available for " + i(g.value), 1)
|
|
2131
|
+
]))
|
|
2132
|
+
], 4)) : p("", !0),
|
|
2133
|
+
k(y).viewMode === "code" || k(y).viewMode === "split" ? (t(), a("div", {
|
|
2134
|
+
key: 1,
|
|
2135
|
+
class: "artifactuse-panel__code",
|
|
2136
|
+
style: $e(k(y).viewMode === "split" ? { width: `${100 - te.value}%` } : void 0)
|
|
2137
|
+
}, [
|
|
2138
|
+
k(y).viewMode === "split" ? (t(), a("div", {
|
|
2139
|
+
key: 0,
|
|
2140
|
+
class: "artifactuse-panel__split-handle",
|
|
2141
|
+
onMousedown: fe(tt, ["prevent"])
|
|
2142
|
+
}, [...s[30] || (s[30] = [
|
|
2143
|
+
e("div", { class: "artifactuse-panel__split-handle-line" }, null, -1)
|
|
2144
|
+
])], 32)) : p("", !0),
|
|
2145
|
+
e("div", {
|
|
2146
|
+
class: "artifactuse-panel__code-scroll",
|
|
2147
|
+
ref_key: "codeScrollRef",
|
|
2148
|
+
ref: se,
|
|
2149
|
+
onScroll: Ke
|
|
2150
|
+
}, [
|
|
2151
|
+
e("div", {
|
|
2152
|
+
class: "artifactuse-panel__line-numbers",
|
|
2153
|
+
ref_key: "lineNumbersRef",
|
|
2154
|
+
ref: q
|
|
2155
|
+
}, null, 512),
|
|
2156
|
+
e("pre", rl, [
|
|
2157
|
+
e("code", {
|
|
2158
|
+
ref_key: "codeRef",
|
|
2159
|
+
ref: V,
|
|
2160
|
+
class: j(`language-${z.value}`),
|
|
2161
|
+
textContent: i(k(r).code)
|
|
2162
|
+
}, null, 10, cl)
|
|
2163
|
+
])
|
|
2164
|
+
], 544)
|
|
2165
|
+
], 4)) : p("", !0)
|
|
2166
|
+
], 2),
|
|
2167
|
+
e("footer", ul, [
|
|
2168
|
+
e("div", dl, [
|
|
2169
|
+
ie.value ? (t(), a("a", vl, [...s[31] || (s[31] = [
|
|
2170
|
+
e("svg", {
|
|
2171
|
+
width: "16",
|
|
2172
|
+
height: "16",
|
|
2173
|
+
viewBox: "0 0 42 42",
|
|
2174
|
+
fill: "none",
|
|
2175
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2176
|
+
}, [
|
|
2177
|
+
e("path", {
|
|
2178
|
+
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",
|
|
2179
|
+
fill: "#5F51C8"
|
|
2180
|
+
}),
|
|
2181
|
+
e("path", {
|
|
2182
|
+
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",
|
|
2183
|
+
fill: "#695AE0"
|
|
2184
|
+
})
|
|
2185
|
+
], -1),
|
|
2186
|
+
e("span", null, "Artifactuse", -1)
|
|
2187
|
+
])])) : p("", !0),
|
|
2188
|
+
k(r).size ? (t(), a("span", fl, i(k(je)(k(r).size)), 1)) : p("", !0)
|
|
2189
|
+
]),
|
|
2190
|
+
e("div", pl, [
|
|
2191
|
+
e("button", {
|
|
2192
|
+
class: j(["artifactuse-panel__footer-action", { "artifactuse-panel__footer-action--success": B.value }]),
|
|
2193
|
+
title: B.value ? "Copied!" : "Copy code",
|
|
2194
|
+
onClick: G
|
|
2195
|
+
}, [
|
|
2196
|
+
B.value ? (t(), a("svg", hl, [...s[33] || (s[33] = [
|
|
2197
|
+
e("polyline", { points: "20 6 9 17 4 12" }, null, -1)
|
|
2198
|
+
])])) : (t(), a("svg", _l, [...s[32] || (s[32] = [
|
|
2199
|
+
e("rect", {
|
|
2200
|
+
x: "9",
|
|
2201
|
+
y: "9",
|
|
2202
|
+
width: "13",
|
|
2203
|
+
height: "13",
|
|
2204
|
+
rx: "2",
|
|
2205
|
+
ry: "2"
|
|
2206
|
+
}, null, -1),
|
|
2207
|
+
e("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
|
|
2208
|
+
])]))
|
|
2209
|
+
], 10, ml),
|
|
2210
|
+
e("button", {
|
|
2211
|
+
class: "artifactuse-panel__footer-action",
|
|
2212
|
+
title: "Download file",
|
|
2213
|
+
onClick: le
|
|
2214
|
+
}, [...s[34] || (s[34] = [
|
|
2215
|
+
e("svg", {
|
|
2216
|
+
viewBox: "0 0 24 24",
|
|
2217
|
+
fill: "none",
|
|
2218
|
+
stroke: "currentColor",
|
|
2219
|
+
"stroke-width": "2"
|
|
2220
|
+
}, [
|
|
2221
|
+
e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
2222
|
+
e("polyline", { points: "7 10 12 15 17 10" }),
|
|
2223
|
+
e("line", {
|
|
2224
|
+
x1: "12",
|
|
2225
|
+
y1: "15",
|
|
2226
|
+
x2: "12",
|
|
2227
|
+
y2: "3"
|
|
2228
|
+
})
|
|
2229
|
+
], -1)
|
|
2230
|
+
])]),
|
|
2231
|
+
n.value ? (t(), a("button", {
|
|
2232
|
+
key: 0,
|
|
2233
|
+
class: "artifactuse-panel__footer-action",
|
|
2234
|
+
title: "Open in new tab",
|
|
2235
|
+
onClick: Ze
|
|
2236
|
+
}, [...s[35] || (s[35] = [
|
|
2237
|
+
e("svg", {
|
|
2238
|
+
viewBox: "0 0 24 24",
|
|
2239
|
+
fill: "none",
|
|
2240
|
+
stroke: "currentColor",
|
|
2241
|
+
"stroke-width": "2"
|
|
2242
|
+
}, [
|
|
2243
|
+
e("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
2244
|
+
e("polyline", { points: "15 3 21 3 21 9" }),
|
|
2245
|
+
e("line", {
|
|
2246
|
+
x1: "10",
|
|
2247
|
+
y1: "14",
|
|
2248
|
+
x2: "21",
|
|
2249
|
+
y2: "3"
|
|
2250
|
+
})
|
|
2251
|
+
], -1)
|
|
2252
|
+
])])) : p("", !0),
|
|
2253
|
+
o.value.length > 1 ? (t(), a("div", yl, [
|
|
2254
|
+
e("button", {
|
|
2255
|
+
class: "artifactuse-panel__nav-btn",
|
|
2256
|
+
disabled: H.value <= 0,
|
|
2257
|
+
title: "Previous artifact",
|
|
2258
|
+
onClick: Ge
|
|
2259
|
+
}, [...s[36] || (s[36] = [
|
|
2260
|
+
e("svg", {
|
|
2261
|
+
viewBox: "0 0 24 24",
|
|
2262
|
+
fill: "none",
|
|
2263
|
+
stroke: "currentColor",
|
|
2264
|
+
"stroke-width": "2"
|
|
2265
|
+
}, [
|
|
2266
|
+
e("polyline", { points: "15 18 9 12 15 6" })
|
|
2267
|
+
], -1)
|
|
2268
|
+
])], 8, gl),
|
|
2269
|
+
e("button", {
|
|
2270
|
+
class: "artifactuse-panel__nav-trigger",
|
|
2271
|
+
title: "View all artifacts",
|
|
2272
|
+
onClick: Ye
|
|
2273
|
+
}, [
|
|
2274
|
+
e("span", null, i(H.value + 1) + " / " + i(o.value.length), 1),
|
|
2275
|
+
s[37] || (s[37] = e("svg", {
|
|
2276
|
+
viewBox: "0 0 24 24",
|
|
2277
|
+
fill: "none",
|
|
2278
|
+
stroke: "currentColor",
|
|
2279
|
+
"stroke-width": "2"
|
|
2280
|
+
}, [
|
|
2281
|
+
e("polyline", { points: "6 9 12 15 18 9" })
|
|
2282
|
+
], -1))
|
|
2283
|
+
]),
|
|
2284
|
+
e("button", {
|
|
2285
|
+
class: "artifactuse-panel__nav-btn",
|
|
2286
|
+
disabled: H.value >= o.value.length - 1,
|
|
2287
|
+
title: "Next artifact",
|
|
2288
|
+
onClick: Qe
|
|
2289
|
+
}, [...s[38] || (s[38] = [
|
|
2290
|
+
e("svg", {
|
|
2291
|
+
viewBox: "0 0 24 24",
|
|
2292
|
+
fill: "none",
|
|
2293
|
+
stroke: "currentColor",
|
|
2294
|
+
"stroke-width": "2"
|
|
2295
|
+
}, [
|
|
2296
|
+
e("polyline", { points: "9 18 15 12 9 6" })
|
|
2297
|
+
], -1)
|
|
2298
|
+
])], 8, kl),
|
|
2299
|
+
be(Me, { name: "artifactuse-popup" }, {
|
|
2300
|
+
default: Le(() => [
|
|
2301
|
+
Z.value ? (t(), a("div", wl, [
|
|
2302
|
+
e("div", bl, [
|
|
2303
|
+
s[40] || (s[40] = e("span", null, "Artifacts", -1)),
|
|
2304
|
+
e("button", {
|
|
2305
|
+
class: "artifactuse-panel__artifact-list-close",
|
|
2306
|
+
onClick: s[7] || (s[7] = (x) => Z.value = !1)
|
|
2307
|
+
}, [...s[39] || (s[39] = [
|
|
2308
|
+
e("svg", {
|
|
2309
|
+
viewBox: "0 0 24 24",
|
|
2310
|
+
fill: "none",
|
|
2311
|
+
stroke: "currentColor",
|
|
2312
|
+
"stroke-width": "2"
|
|
2313
|
+
}, [
|
|
2314
|
+
e("line", {
|
|
2315
|
+
x1: "18",
|
|
2316
|
+
y1: "6",
|
|
2317
|
+
x2: "6",
|
|
2318
|
+
y2: "18"
|
|
2319
|
+
}),
|
|
2320
|
+
e("line", {
|
|
2321
|
+
x1: "6",
|
|
2322
|
+
y1: "6",
|
|
2323
|
+
x2: "18",
|
|
2324
|
+
y2: "18"
|
|
2325
|
+
})
|
|
2326
|
+
], -1)
|
|
2327
|
+
])])
|
|
2328
|
+
]),
|
|
2329
|
+
e("div", Cl, [
|
|
2330
|
+
(t(!0), a(I, null, ce(o.value, (x, W) => (t(), a("button", {
|
|
2331
|
+
key: x.id,
|
|
2332
|
+
class: j(["artifactuse-panel__artifact-item", { "artifactuse-panel__artifact-item--active": x.id === k(r).id }]),
|
|
2333
|
+
onClick: (me) => Ve(x)
|
|
2334
|
+
}, [
|
|
2335
|
+
e("span", {
|
|
2336
|
+
class: "artifactuse-panel__artifact-item-icon",
|
|
2337
|
+
innerHTML: Ce(x.language)
|
|
2338
|
+
}, null, 8, $l),
|
|
2339
|
+
e("div", Ml, [
|
|
2340
|
+
e("span", Ll, i(x.title || "Untitled"), 1),
|
|
2341
|
+
e("span", Tl, [
|
|
2342
|
+
J(i(k(Te)(x.language)) + " ", 1),
|
|
2343
|
+
x.lineCount ? (t(), a(I, { key: 0 }, [
|
|
2344
|
+
J(" • " + i(x.lineCount) + " lines ", 1)
|
|
2345
|
+
], 64)) : p("", !0)
|
|
2346
|
+
])
|
|
2347
|
+
]),
|
|
2348
|
+
e("span", Hl, i(W + 1), 1)
|
|
2349
|
+
], 10, xl))), 128))
|
|
2350
|
+
])
|
|
2351
|
+
])) : p("", !0)
|
|
2352
|
+
]),
|
|
2353
|
+
_: 1
|
|
2354
|
+
})
|
|
2355
|
+
])) : p("", !0)
|
|
2356
|
+
])
|
|
2357
|
+
])
|
|
2358
|
+
], 64)) : (t(), a(I, { key: 2 }, [
|
|
2359
|
+
e("header", Hi, [
|
|
2360
|
+
e("div", Pi, [
|
|
2361
|
+
s[15] || (s[15] = e("span", { class: "artifactuse-panel__icon" }, [
|
|
2362
|
+
e("svg", {
|
|
2363
|
+
viewBox: "0 0 24 24",
|
|
2364
|
+
fill: "none",
|
|
2365
|
+
stroke: "currentColor",
|
|
2366
|
+
"stroke-width": "2"
|
|
2367
|
+
}, [
|
|
2368
|
+
e("polyline", { points: "16 18 22 12 16 6" }),
|
|
2369
|
+
e("polyline", { points: "8 6 2 12 8 18" })
|
|
2370
|
+
])
|
|
2371
|
+
], -1)),
|
|
2372
|
+
e("div", Ai, [
|
|
2373
|
+
s[14] || (s[14] = e("span", { class: "artifactuse-panel__name" }, "Artifacts", -1)),
|
|
2374
|
+
e("span", Bi, i(o.value.length) + " available", 1)
|
|
2375
|
+
])
|
|
2376
|
+
]),
|
|
2377
|
+
e("div", Ei, [
|
|
2378
|
+
e("button", {
|
|
2379
|
+
class: j(["artifactuse-panel__action", { "artifactuse-panel__action--loading": Q.value }]),
|
|
2380
|
+
disabled: Q.value,
|
|
2381
|
+
title: "Download all as ZIP",
|
|
2382
|
+
onClick: ke
|
|
2383
|
+
}, [
|
|
2384
|
+
Q.value ? (t(), a("svg", Ii, [...s[17] || (s[17] = [
|
|
2385
|
+
e("circle", {
|
|
2386
|
+
cx: "12",
|
|
2387
|
+
cy: "12",
|
|
2388
|
+
r: "10",
|
|
2389
|
+
"stroke-dasharray": "32",
|
|
2390
|
+
"stroke-dashoffset": "32"
|
|
2391
|
+
}, null, -1)
|
|
2392
|
+
])])) : (t(), a("svg", Si, [...s[16] || (s[16] = [
|
|
2393
|
+
e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }, null, -1),
|
|
2394
|
+
e("polyline", { points: "7 10 12 15 17 10" }, null, -1),
|
|
2395
|
+
e("line", {
|
|
2396
|
+
x1: "12",
|
|
2397
|
+
y1: "15",
|
|
2398
|
+
x2: "12",
|
|
2399
|
+
y2: "3"
|
|
2400
|
+
}, null, -1)
|
|
2401
|
+
])]))
|
|
2402
|
+
], 10, zi),
|
|
2403
|
+
e("button", {
|
|
2404
|
+
class: "artifactuse-panel__action artifactuse-panel__action--close",
|
|
2405
|
+
title: "Close panel",
|
|
2406
|
+
onClick: s[1] || (s[1] = (...x) => k($) && k($)(...x))
|
|
2407
|
+
}, [...s[18] || (s[18] = [
|
|
2408
|
+
e("svg", {
|
|
2409
|
+
viewBox: "0 0 24 24",
|
|
2410
|
+
fill: "none",
|
|
2411
|
+
stroke: "currentColor",
|
|
2412
|
+
"stroke-width": "2"
|
|
2413
|
+
}, [
|
|
2414
|
+
e("line", {
|
|
2415
|
+
x1: "18",
|
|
2416
|
+
y1: "6",
|
|
2417
|
+
x2: "6",
|
|
2418
|
+
y2: "18"
|
|
2419
|
+
}),
|
|
2420
|
+
e("line", {
|
|
2421
|
+
x1: "6",
|
|
2422
|
+
y1: "6",
|
|
2423
|
+
x2: "18",
|
|
2424
|
+
y2: "18"
|
|
2425
|
+
})
|
|
2426
|
+
], -1)
|
|
2427
|
+
])])
|
|
2428
|
+
])
|
|
2429
|
+
]),
|
|
2430
|
+
e("div", qi, [
|
|
2431
|
+
e("div", Fi, [
|
|
2432
|
+
(t(!0), a(I, null, ce(o.value, (x, W) => (t(), a("button", {
|
|
2433
|
+
key: x.id,
|
|
2434
|
+
class: "artifactuse-panel__list-item",
|
|
2435
|
+
onClick: (me) => Ve(x)
|
|
2436
|
+
}, [
|
|
2437
|
+
e("span", {
|
|
2438
|
+
class: "artifactuse-panel__list-item-icon",
|
|
2439
|
+
innerHTML: Ce(x.language)
|
|
2440
|
+
}, null, 8, Ri),
|
|
2441
|
+
e("div", Oi, [
|
|
2442
|
+
e("span", Di, i(x.title || "Untitled"), 1),
|
|
2443
|
+
e("span", Ui, [
|
|
2444
|
+
J(i(k(Te)(x.language)) + " ", 1),
|
|
2445
|
+
x.lineCount ? (t(), a(I, { key: 0 }, [
|
|
2446
|
+
J(" • " + i(x.lineCount) + " lines ", 1)
|
|
2447
|
+
], 64)) : p("", !0)
|
|
2448
|
+
])
|
|
2449
|
+
]),
|
|
2450
|
+
s[19] || (s[19] = e("span", { class: "artifactuse-panel__list-item-arrow" }, [
|
|
2451
|
+
e("svg", {
|
|
2452
|
+
viewBox: "0 0 24 24",
|
|
2453
|
+
fill: "none",
|
|
2454
|
+
stroke: "currentColor",
|
|
2455
|
+
"stroke-width": "2"
|
|
2456
|
+
}, [
|
|
2457
|
+
e("polyline", { points: "9 18 15 12 9 6" })
|
|
2458
|
+
])
|
|
2459
|
+
], -1))
|
|
2460
|
+
], 8, Vi))), 128))
|
|
2461
|
+
])
|
|
2462
|
+
]),
|
|
2463
|
+
e("footer", Ni, [
|
|
2464
|
+
ie.value ? (t(), a("a", ji, [...s[20] || (s[20] = [
|
|
2465
|
+
e("svg", {
|
|
2466
|
+
width: "16",
|
|
2467
|
+
height: "16",
|
|
2468
|
+
viewBox: "0 0 42 42",
|
|
2469
|
+
fill: "none",
|
|
2470
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2471
|
+
}, [
|
|
2472
|
+
e("path", {
|
|
2473
|
+
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",
|
|
2474
|
+
fill: "#5F51C8"
|
|
2475
|
+
}),
|
|
2476
|
+
e("path", {
|
|
2477
|
+
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",
|
|
2478
|
+
fill: "#695AE0"
|
|
2479
|
+
})
|
|
2480
|
+
], -1),
|
|
2481
|
+
e("span", null, "Artifactuse", -1)
|
|
2482
|
+
])])) : p("", !0)
|
|
2483
|
+
])
|
|
2484
|
+
], 64)) : (t(), a(I, { key: 1 }, [
|
|
2485
|
+
e("header", $i, [
|
|
2486
|
+
s[11] || (s[11] = e("div", { class: "artifactuse-panel__title" }, [
|
|
2487
|
+
e("span", { class: "artifactuse-panel__icon" }, [
|
|
2488
|
+
e("svg", {
|
|
2489
|
+
viewBox: "0 0 24 24",
|
|
2490
|
+
fill: "none",
|
|
2491
|
+
stroke: "currentColor",
|
|
2492
|
+
"stroke-width": "2"
|
|
2493
|
+
}, [
|
|
2494
|
+
e("polyline", { points: "16 18 22 12 16 6" }),
|
|
2495
|
+
e("polyline", { points: "8 6 2 12 8 18" })
|
|
2496
|
+
])
|
|
2497
|
+
]),
|
|
2498
|
+
e("div", { class: "artifactuse-panel__title-content" }, [
|
|
2499
|
+
e("span", { class: "artifactuse-panel__name" }, "Artifacts")
|
|
2500
|
+
])
|
|
2501
|
+
], -1)),
|
|
2502
|
+
e("div", Mi, [
|
|
2503
|
+
e("button", {
|
|
2504
|
+
class: "artifactuse-panel__action artifactuse-panel__action--close",
|
|
2505
|
+
title: "Close panel",
|
|
2506
|
+
onClick: s[0] || (s[0] = (...x) => k($) && k($)(...x))
|
|
2507
|
+
}, [...s[10] || (s[10] = [
|
|
2508
|
+
e("svg", {
|
|
2509
|
+
viewBox: "0 0 24 24",
|
|
2510
|
+
fill: "none",
|
|
2511
|
+
stroke: "currentColor",
|
|
2512
|
+
"stroke-width": "2"
|
|
2513
|
+
}, [
|
|
2514
|
+
e("line", {
|
|
2515
|
+
x1: "18",
|
|
2516
|
+
y1: "6",
|
|
2517
|
+
x2: "6",
|
|
2518
|
+
y2: "18"
|
|
2519
|
+
}),
|
|
2520
|
+
e("line", {
|
|
2521
|
+
x1: "6",
|
|
2522
|
+
y1: "6",
|
|
2523
|
+
x2: "18",
|
|
2524
|
+
y2: "18"
|
|
2525
|
+
})
|
|
2526
|
+
], -1)
|
|
2527
|
+
])])
|
|
2528
|
+
])
|
|
2529
|
+
]),
|
|
2530
|
+
s[13] || (s[13] = e("div", { class: "artifactuse-panel__empty" }, [
|
|
2531
|
+
e("div", { class: "artifactuse-panel__empty-icon" }, [
|
|
2532
|
+
e("svg", {
|
|
2533
|
+
viewBox: "0 0 24 24",
|
|
2534
|
+
fill: "none",
|
|
2535
|
+
stroke: "currentColor",
|
|
2536
|
+
"stroke-width": "1.5"
|
|
2537
|
+
}, [
|
|
2538
|
+
e("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" }),
|
|
2539
|
+
e("polyline", { points: "14 2 14 8 20 8" })
|
|
2540
|
+
])
|
|
2541
|
+
]),
|
|
2542
|
+
e("h3", { class: "artifactuse-panel__empty-title" }, "No artifacts yet"),
|
|
2543
|
+
e("p", { class: "artifactuse-panel__empty-text" }, " Code blocks, forms, and other interactive content will appear here as the AI generates them. ")
|
|
2544
|
+
], -1)),
|
|
2545
|
+
e("footer", Li, [
|
|
2546
|
+
ie.value ? (t(), a("a", Ti, [...s[12] || (s[12] = [
|
|
2547
|
+
e("svg", {
|
|
2548
|
+
width: "16",
|
|
2549
|
+
height: "16",
|
|
2550
|
+
viewBox: "0 0 42 42",
|
|
2551
|
+
fill: "none",
|
|
2552
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2553
|
+
}, [
|
|
2554
|
+
e("path", {
|
|
2555
|
+
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",
|
|
2556
|
+
fill: "#5F51C8"
|
|
2557
|
+
}),
|
|
2558
|
+
e("path", {
|
|
2559
|
+
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",
|
|
2560
|
+
fill: "#695AE0"
|
|
2561
|
+
})
|
|
2562
|
+
], -1),
|
|
2563
|
+
e("span", null, "Artifactuse", -1)
|
|
2564
|
+
])])) : p("", !0)
|
|
2565
|
+
])
|
|
2566
|
+
], 64))
|
|
2567
|
+
], 6)) : p("", !0)
|
|
2568
|
+
]),
|
|
2569
|
+
_: 1
|
|
2570
|
+
}),
|
|
2571
|
+
(t(), ye(Ue, { to: "body" }, [
|
|
2572
|
+
be(Me, { name: "artifactuse-backdrop" }, {
|
|
2573
|
+
default: Le(() => [
|
|
2574
|
+
k(y).isPanelOpen && k(y).isFullscreen ? (t(), a("div", {
|
|
2575
|
+
key: 0,
|
|
2576
|
+
class: "artifactuse-panel__backdrop",
|
|
2577
|
+
onClick: s[8] || (s[8] = (...x) => k($) && k($)(...x))
|
|
2578
|
+
})) : p("", !0)
|
|
2579
|
+
]),
|
|
2580
|
+
_: 1
|
|
2581
|
+
})
|
|
2582
|
+
]))
|
|
2583
|
+
], 64));
|
|
2584
|
+
}
|
|
2585
|
+
}, Pl = ["title"], Al = {
|
|
2586
|
+
key: 0,
|
|
2587
|
+
class: "artifactuse-panel-toggle-badge"
|
|
2588
|
+
}, Fl = {
|
|
2589
|
+
__name: "ArtifactusePanelToggle",
|
|
2590
|
+
setup(M) {
|
|
2591
|
+
const { state: u, artifactCount: f, hasArtifacts: y, togglePanel: r } = He();
|
|
2592
|
+
return (F, E) => (t(), a("button", {
|
|
2593
|
+
class: j(["artifactuse-panel-toggle", {
|
|
2594
|
+
"artifactuse-panel-toggle--active": k(u).isPanelOpen,
|
|
2595
|
+
"artifactuse-panel-toggle--has-artifacts": k(y)
|
|
2596
|
+
}]),
|
|
2597
|
+
onClick: E[0] || (E[0] = (...$) => k(r) && k(r)(...$)),
|
|
2598
|
+
title: k(u).isPanelOpen ? "Close artifacts panel" : "Open artifacts panel"
|
|
2599
|
+
}, [
|
|
2600
|
+
E[1] || (E[1] = e("svg", {
|
|
2601
|
+
viewBox: "0 0 24 24",
|
|
2602
|
+
fill: "none",
|
|
2603
|
+
stroke: "currentColor",
|
|
2604
|
+
"stroke-width": "2",
|
|
2605
|
+
"stroke-linecap": "round",
|
|
2606
|
+
"stroke-linejoin": "round"
|
|
2607
|
+
}, [
|
|
2608
|
+
e("polyline", { points: "16 18 22 12 16 6" }),
|
|
2609
|
+
e("polyline", { points: "8 6 2 12 8 18" })
|
|
2610
|
+
], -1)),
|
|
2611
|
+
k(f) > 0 ? (t(), a("span", Al, i(k(f) > 99 ? "99+" : k(f)), 1)) : p("", !0)
|
|
2612
|
+
], 10, Pl));
|
|
2613
|
+
}
|
|
2614
|
+
}, Xe = Symbol("artifactuse");
|
|
2615
|
+
function We(M = {}) {
|
|
2616
|
+
var l;
|
|
2617
|
+
const u = Je(M), f = Ne({
|
|
2618
|
+
artifacts: [],
|
|
2619
|
+
activeArtifactId: null,
|
|
2620
|
+
isPanelOpen: !1,
|
|
2621
|
+
viewMode: "preview",
|
|
2622
|
+
isFullscreen: !1
|
|
2623
|
+
});
|
|
2624
|
+
u.state.subscribe((h) => {
|
|
2625
|
+
f.artifacts = h.artifacts, f.activeArtifactId = h.activeArtifactId, f.isPanelOpen = h.isPanelOpen, f.viewMode = h.viewMode, f.isFullscreen = h.isFullscreen;
|
|
2626
|
+
});
|
|
2627
|
+
const y = C(() => f.activeArtifactId && f.artifacts.find((h) => h.id === f.activeArtifactId) || null), r = C(() => f.artifacts.length), F = C(() => f.artifacts.length > 0), E = C(() => u.getPanelTypes()), $ = C(() => y.value ? u.getPanelUrl(y.value) : null);
|
|
2628
|
+
if (u.applyTheme(), M.theme === "auto" || !M.theme) {
|
|
2629
|
+
const h = ((l = u.bridge) == null ? void 0 : l.theme) || u.theme;
|
|
2630
|
+
h != null && h.watchSystemTheme && h.watchSystemTheme(() => {
|
|
2631
|
+
u.applyTheme();
|
|
2632
|
+
});
|
|
2633
|
+
}
|
|
2634
|
+
const _ = {
|
|
2635
|
+
instance: u,
|
|
2636
|
+
state: f,
|
|
2637
|
+
activeArtifact: y,
|
|
2638
|
+
artifactCount: r,
|
|
2639
|
+
hasArtifacts: F,
|
|
2640
|
+
// Panel computed
|
|
2641
|
+
panelTypes: E,
|
|
2642
|
+
activePanelUrl: $,
|
|
2643
|
+
// Methods
|
|
2644
|
+
processMessage: u.processMessage,
|
|
2645
|
+
initializeContent: u.initializeContent,
|
|
2646
|
+
openArtifact: u.openArtifact,
|
|
2647
|
+
closePanel: u.closePanel,
|
|
2648
|
+
togglePanel: u.togglePanel,
|
|
2649
|
+
toggleFullscreen: u.toggleFullscreen,
|
|
2650
|
+
setViewMode: u.setViewMode,
|
|
2651
|
+
getPanelUrl: u.getPanelUrl,
|
|
2652
|
+
sendToPanel: u.sendToPanel,
|
|
2653
|
+
// Panel management
|
|
2654
|
+
hasPanel: u.hasPanel,
|
|
2655
|
+
registerPanel: u.registerPanel,
|
|
2656
|
+
unregisterPanel: u.unregisterPanel,
|
|
2657
|
+
getPanelTypes: u.getPanelTypes,
|
|
2658
|
+
// Events
|
|
2659
|
+
on: u.on,
|
|
2660
|
+
off: u.off,
|
|
2661
|
+
// Theme - wrap setTheme to also apply
|
|
2662
|
+
applyTheme: u.applyTheme,
|
|
2663
|
+
setTheme: (h) => {
|
|
2664
|
+
u.setTheme(h), u.applyTheme();
|
|
2665
|
+
},
|
|
2666
|
+
getTheme: u.getTheme
|
|
2667
|
+
};
|
|
2668
|
+
return nt(Xe, _), _;
|
|
2669
|
+
}
|
|
2670
|
+
function He() {
|
|
2671
|
+
const M = ot(Xe);
|
|
2672
|
+
return M || (console.warn("useArtifactuse() called without provideArtifactuse(). Creating standalone instance."), We());
|
|
2673
|
+
}
|
|
2674
|
+
function Bl(M = {}) {
|
|
2675
|
+
const u = Je(M), f = Ne({
|
|
2676
|
+
artifacts: [],
|
|
2677
|
+
activeArtifactId: null,
|
|
2678
|
+
isPanelOpen: !1,
|
|
2679
|
+
viewMode: "preview",
|
|
2680
|
+
isFullscreen: !1
|
|
2681
|
+
});
|
|
2682
|
+
let y;
|
|
2683
|
+
ge(() => {
|
|
2684
|
+
y = u.state.subscribe((l) => {
|
|
2685
|
+
f.artifacts = l.artifacts, f.activeArtifactId = l.activeArtifactId, f.isPanelOpen = l.isPanelOpen, f.viewMode = l.viewMode, f.isFullscreen = l.isFullscreen;
|
|
2686
|
+
}), u.applyTheme();
|
|
2687
|
+
}), Fe(() => {
|
|
2688
|
+
y && y(), u.destroy();
|
|
2689
|
+
});
|
|
2690
|
+
const r = C(() => f.activeArtifactId && f.artifacts.find((l) => l.id === f.activeArtifactId) || null), F = C(() => f.artifacts.length), E = C(() => f.artifacts.length > 0), $ = C(() => u.getPanelTypes()), _ = C(() => r.value ? u.getPanelUrl(r.value) : null);
|
|
2691
|
+
return {
|
|
2692
|
+
instance: u,
|
|
2693
|
+
state: f,
|
|
2694
|
+
activeArtifact: r,
|
|
2695
|
+
artifactCount: F,
|
|
2696
|
+
hasArtifacts: E,
|
|
2697
|
+
// Panel computed
|
|
2698
|
+
panelTypes: $,
|
|
2699
|
+
activePanelUrl: _,
|
|
2700
|
+
// Methods
|
|
2701
|
+
processMessage: u.processMessage,
|
|
2702
|
+
initializeContent: u.initializeContent,
|
|
2703
|
+
openArtifact: u.openArtifact,
|
|
2704
|
+
closePanel: u.closePanel,
|
|
2705
|
+
togglePanel: u.togglePanel,
|
|
2706
|
+
toggleFullscreen: u.toggleFullscreen,
|
|
2707
|
+
setViewMode: u.setViewMode,
|
|
2708
|
+
getPanelUrl: u.getPanelUrl,
|
|
2709
|
+
sendToPanel: u.sendToPanel,
|
|
2710
|
+
// Panel management
|
|
2711
|
+
hasPanel: u.hasPanel,
|
|
2712
|
+
registerPanel: u.registerPanel,
|
|
2713
|
+
unregisterPanel: u.unregisterPanel,
|
|
2714
|
+
getPanelTypes: u.getPanelTypes,
|
|
2715
|
+
// Events
|
|
2716
|
+
on: u.on,
|
|
2717
|
+
off: u.off,
|
|
2718
|
+
// Theme - wrap setTheme to also apply
|
|
2719
|
+
applyTheme: u.applyTheme,
|
|
2720
|
+
setTheme: (l) => {
|
|
2721
|
+
u.setTheme(l), u.applyTheme();
|
|
2722
|
+
},
|
|
2723
|
+
getTheme: u.getTheme
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2726
|
+
const Vl = {
|
|
2727
|
+
provideArtifactuse: We,
|
|
2728
|
+
useArtifactuse: He,
|
|
2729
|
+
createArtifactuseComposable: Bl,
|
|
2730
|
+
DEFAULT_PANELS: ut
|
|
2731
|
+
};
|
|
2732
|
+
export {
|
|
2733
|
+
Il as ArtifactuseAgentMessage,
|
|
2734
|
+
Ct as ArtifactuseCard,
|
|
2735
|
+
va as ArtifactuseInlineForm,
|
|
2736
|
+
ql as ArtifactusePanel,
|
|
2737
|
+
Fl as ArtifactusePanelToggle,
|
|
2738
|
+
mi as ArtifactuseSocialPreview,
|
|
2739
|
+
Ci as ArtifactuseViewer,
|
|
2740
|
+
ut as DEFAULT_PANELS,
|
|
2741
|
+
Bl as createArtifactuseComposable,
|
|
2742
|
+
Vl as default,
|
|
2743
|
+
We as provideArtifactuse,
|
|
2744
|
+
He as useArtifactuse
|
|
2745
|
+
};
|