artifactuse 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-vmcpJRYe.js → index-ABusvYh9.js} +3 -2
- package/dist/index.js +1 -1
- package/dist/react/index.js +123 -123
- package/dist/svelte/index.js +480 -480
- package/dist/vue/index.js +194 -194
- package/dist/vue2/index.js +6 -5
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import e, { useState as y, useMemo as w, useCallback as d, useRef as V, useEffect as B, createContext as na, useContext as sa } from "react";
|
|
2
|
-
import { g as Ze, f as St, a as mt, b as dt, n as la, i as Tt, c as ca, D as $t, d as ia } from "../index-
|
|
2
|
+
import { g as Ze, f as St, a as mt, b as dt, n as la, i as Tt, c as ca, D as $t, d as ia } from "../index-ABusvYh9.js";
|
|
3
3
|
import { J as oa } from "../jszip.min-CdmYyw5L.js";
|
|
4
4
|
import { createPortal as ua } from "react-dom";
|
|
5
5
|
function ma({
|
|
@@ -36,7 +36,7 @@ function ma({
|
|
|
36
36
|
}, [t, l]), W = d((x) => {
|
|
37
37
|
var F;
|
|
38
38
|
x.stopPropagation();
|
|
39
|
-
const p = new Blob([t.code], { type: "text/plain" }), s = URL.createObjectURL(p), O = document.createElement("a"), X = dt(t.language), z = ((F = t.title) == null ? void 0 : F.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
|
|
39
|
+
const p = new Blob([t.code], { type: "text/plain" }), s = URL.createObjectURL(p), O = document.createElement("a"), X = dt(t.editorLanguage || t.language), z = ((F = t.title) == null ? void 0 : F.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
|
|
40
40
|
O.href = s, O.download = `${z}.${X}`, document.body.appendChild(O), O.click(), document.body.removeChild(O), URL.revokeObjectURL(s), i && i(t);
|
|
41
41
|
}, [t, i]), _ = [
|
|
42
42
|
"artifactuse-card",
|
|
@@ -103,14 +103,14 @@ function pa({
|
|
|
103
103
|
initialState: o = "active"
|
|
104
104
|
// 'active' | 'submitted' | 'cancelled' | 'inactive'
|
|
105
105
|
}) {
|
|
106
|
-
var
|
|
106
|
+
var me, _e, de;
|
|
107
107
|
const a = V(null), [k, P] = y(o), $ = k !== "active", W = k === "active" ? "" : `artifactuse-form--${k}`, _ = w(() => {
|
|
108
108
|
try {
|
|
109
109
|
return JSON.parse(t.code);
|
|
110
110
|
} catch {
|
|
111
111
|
return { title: "Invalid Form", variant: "fields", data: { fields: [] } };
|
|
112
112
|
}
|
|
113
|
-
}, [t.code]), x = t.id || _.id || `form-${Date.now()}`, p = ((
|
|
113
|
+
}, [t.code]), x = t.id || _.id || `form-${Date.now()}`, p = ((me = _.data) == null ? void 0 : me.fields) || [], s = _.title || "Form", O = w(() => p.some((m) => m.type === "buttons"), [p]), X = w(() => _.variant === "buttons" ? p : [], [_.variant, p]), [z, F] = y(() => {
|
|
114
114
|
var S;
|
|
115
115
|
const m = {};
|
|
116
116
|
return p.forEach((b) => {
|
|
@@ -133,12 +133,12 @@ function pa({
|
|
|
133
133
|
}, [h, E]);
|
|
134
134
|
const Z = d((m) => {
|
|
135
135
|
P(m);
|
|
136
|
-
}, []),
|
|
136
|
+
}, []), he = d((m, S) => {
|
|
137
137
|
F((b) => ({ ...b, [m]: S })), q((b) => {
|
|
138
138
|
const N = { ...b };
|
|
139
139
|
return delete N[m], N;
|
|
140
140
|
});
|
|
141
|
-
}, []),
|
|
141
|
+
}, []), le = d(() => {
|
|
142
142
|
var b;
|
|
143
143
|
const m = {};
|
|
144
144
|
p.forEach((N) => {
|
|
@@ -171,14 +171,14 @@ function pa({
|
|
|
171
171
|
const L = z[N];
|
|
172
172
|
M.pattern && L && (new RegExp(M.pattern).test(L) || (m[N] = M.message || `${N} is invalid`));
|
|
173
173
|
}), q(m), Object.keys(m).length === 0;
|
|
174
|
-
}, [p, z, (
|
|
174
|
+
}, [p, z, (_e = _.data) == null ? void 0 : _e.validation]), ge = d(() => {
|
|
175
175
|
var S;
|
|
176
176
|
const m = {};
|
|
177
177
|
p.forEach((b) => {
|
|
178
178
|
["buttons", "divider", "heading"].includes(b.type) || (b.defaultValue !== void 0 ? m[b.name] = b.defaultValue : b.type === "checkbox" ? m[b.name] = !1 : m[b.name] = "");
|
|
179
179
|
}), (S = _.data) != null && S.defaults && Object.assign(m, _.data.defaults), F(m), q({});
|
|
180
|
-
}, [p, (
|
|
181
|
-
m == null || m.preventDefault(),
|
|
180
|
+
}, [p, (de = _.data) == null ? void 0 : de.defaults]), ce = d((m) => {
|
|
181
|
+
m == null || m.preventDefault(), le() && (H(!0), r == null || r({
|
|
182
182
|
formId: x,
|
|
183
183
|
action: "submit",
|
|
184
184
|
values: { ...z },
|
|
@@ -186,11 +186,11 @@ function pa({
|
|
|
186
186
|
}), setTimeout(() => {
|
|
187
187
|
H(!1), Z("submitted");
|
|
188
188
|
}, 300));
|
|
189
|
-
}, [x, z, r,
|
|
189
|
+
}, [x, z, r, le, Z]), ue = d((m) => {
|
|
190
190
|
const S = m.action || "custom";
|
|
191
191
|
switch (S) {
|
|
192
192
|
case "submit":
|
|
193
|
-
|
|
193
|
+
ce();
|
|
194
194
|
break;
|
|
195
195
|
case "cancel":
|
|
196
196
|
c == null || c({
|
|
@@ -203,7 +203,7 @@ function pa({
|
|
|
203
203
|
}, 150);
|
|
204
204
|
break;
|
|
205
205
|
case "reset":
|
|
206
|
-
|
|
206
|
+
ge(), l == null || l({
|
|
207
207
|
formId: x,
|
|
208
208
|
action: "reset",
|
|
209
209
|
buttonName: m.name || "reset",
|
|
@@ -224,7 +224,7 @@ function pa({
|
|
|
224
224
|
}, 150);
|
|
225
225
|
break;
|
|
226
226
|
}
|
|
227
|
-
}, [x, z,
|
|
227
|
+
}, [x, z, ce, c, l, i, ge, Z]);
|
|
228
228
|
return $ ? /* @__PURE__ */ e.createElement(
|
|
229
229
|
"div",
|
|
230
230
|
{
|
|
@@ -247,7 +247,7 @@ function pa({
|
|
|
247
247
|
key: m.name || m.label || S,
|
|
248
248
|
type: "button",
|
|
249
249
|
className: `artifactuse-form-btn artifactuse-form-btn-${m.variant || "secondary"}`,
|
|
250
|
-
onClick: () =>
|
|
250
|
+
onClick: () => ue(m),
|
|
251
251
|
disabled: m.disabled || D
|
|
252
252
|
},
|
|
253
253
|
m.icon && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-btn-icon", dangerouslySetInnerHTML: { __html: m.icon } }),
|
|
@@ -261,7 +261,7 @@ function pa({
|
|
|
261
261
|
"data-artifactuse-theme": h
|
|
262
262
|
},
|
|
263
263
|
(_.title || _.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, _.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, _.title), _.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, _.description)),
|
|
264
|
-
/* @__PURE__ */ e.createElement("form", { onSubmit:
|
|
264
|
+
/* @__PURE__ */ e.createElement("form", { onSubmit: ce, className: "artifactuse-form" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-fields" }, p.map((m, S) => /* @__PURE__ */ e.createElement(
|
|
265
265
|
Ea,
|
|
266
266
|
{
|
|
267
267
|
key: m.name || S,
|
|
@@ -270,15 +270,15 @@ function pa({
|
|
|
270
270
|
value: z[m.name],
|
|
271
271
|
error: te[m.name],
|
|
272
272
|
isSubmitting: D,
|
|
273
|
-
onChange: (b) =>
|
|
274
|
-
onButtonAction:
|
|
273
|
+
onChange: (b) => he(m.name, b),
|
|
274
|
+
onButtonAction: ue
|
|
275
275
|
}
|
|
276
276
|
))), !O && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons artifactuse-form-buttons-default" }, /* @__PURE__ */ e.createElement(
|
|
277
277
|
"button",
|
|
278
278
|
{
|
|
279
279
|
type: "button",
|
|
280
280
|
className: "artifactuse-form-btn artifactuse-form-btn-ghost",
|
|
281
|
-
onClick: () =>
|
|
281
|
+
onClick: () => ue({ action: "cancel", label: "Cancel" })
|
|
282
282
|
},
|
|
283
283
|
"Cancel"
|
|
284
284
|
), /* @__PURE__ */ e.createElement(
|
|
@@ -624,21 +624,21 @@ function Ma({
|
|
|
624
624
|
onMediaOpen: s,
|
|
625
625
|
className: O = ""
|
|
626
626
|
}) {
|
|
627
|
-
var
|
|
627
|
+
var Ne;
|
|
628
628
|
const {
|
|
629
629
|
processMessage: X,
|
|
630
630
|
openArtifact: z,
|
|
631
631
|
state: F,
|
|
632
632
|
getTheme: te,
|
|
633
633
|
instance: q
|
|
634
|
-
} = Me(), D = V(null), H = V(null), Z = V(null),
|
|
634
|
+
} = Me(), D = V(null), H = V(null), Z = V(null), he = V(l), [le, ge] = y(""), [ce, ue] = y([]), [me, _e] = y(!1), [de, m] = y(!1), [S, b] = y("image"), [N, M] = y(""), [L, fe] = y(""), [ke, Pe] = y(""), ye = w(() => typeof te == "function" ? te() : "dark", [te]), Ye = (F == null ? void 0 : F.activeArtifactId) || null, G = c ?? ((Ne = q == null ? void 0 : q.config) == null ? void 0 : Ne.inlineCards) ?? !0, We = w(() => La(le), [le]), Se = w(() => me || i ? "active" : "inactive", [me, i]);
|
|
635
635
|
B(() => {
|
|
636
|
-
l &&
|
|
636
|
+
l && _e(!0);
|
|
637
637
|
}, [l]);
|
|
638
638
|
const ae = d((v) => {
|
|
639
|
-
b(v.type || "image"), M(v.src || ""),
|
|
640
|
-
}, [s]),
|
|
641
|
-
m(!1), M(""),
|
|
639
|
+
b(v.type || "image"), M(v.src || ""), fe(v.alt || ""), Pe(v.caption || ""), m(!0), s && s(v);
|
|
640
|
+
}, [s]), xe = d(() => {
|
|
641
|
+
m(!1), M(""), fe(""), Pe("");
|
|
642
642
|
}, []), $e = d(() => {
|
|
643
643
|
if (!H.current) return;
|
|
644
644
|
H.current.querySelectorAll('img[data-lightbox="true"]').forEach((f) => {
|
|
@@ -711,7 +711,7 @@ function Ma({
|
|
|
711
711
|
}), H.current.querySelectorAll(".artifactuse-video-preview-wrapper, .video-preview-wrapper").forEach((C) => {
|
|
712
712
|
C._clickHandler && (C.removeEventListener("click", C._clickHandler), delete C._clickHandler);
|
|
713
713
|
});
|
|
714
|
-
}, []),
|
|
714
|
+
}, []), be = d(() => {
|
|
715
715
|
Z.current && clearTimeout(Z.current), Z.current = setTimeout(async () => {
|
|
716
716
|
if (q != null && q.initializeContent && H.current)
|
|
717
717
|
try {
|
|
@@ -730,21 +730,21 @@ function Ma({
|
|
|
730
730
|
tabs: E,
|
|
731
731
|
viewMode: o
|
|
732
732
|
});
|
|
733
|
-
|
|
733
|
+
ge(v.html), ue(v.artifacts), v.artifacts.length > 0 && a && a(v.artifacts), l || be();
|
|
734
734
|
}
|
|
735
|
-
}, [t, r, X, l,
|
|
736
|
-
|
|
737
|
-
}, [l,
|
|
735
|
+
}, [t, r, X, l, be, a]), B(() => {
|
|
736
|
+
he.current === !0 && l === !1 && be(), he.current = l;
|
|
737
|
+
}, [l, be]), B(() => (l && _e(!0), l || be(), () => {
|
|
738
738
|
Z.current && clearTimeout(Z.current), ze();
|
|
739
739
|
}), []);
|
|
740
740
|
const Ae = d((v) => {
|
|
741
741
|
const ne = v.target.closest(".artifactuse-inline-preview");
|
|
742
742
|
if (ne) {
|
|
743
743
|
if (ne.dataset.nonClickable) return;
|
|
744
|
-
const
|
|
745
|
-
if (
|
|
746
|
-
const
|
|
747
|
-
|
|
744
|
+
const ie = ne.dataset.artifactId;
|
|
745
|
+
if (ie) {
|
|
746
|
+
const Ee = F.artifacts.find((C) => C.id === ie);
|
|
747
|
+
Ee && (z(Ee), k && k(Ee));
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
750
|
}, [F, z, k]), Qe = d((v) => {
|
|
@@ -755,11 +755,11 @@ function Ma({
|
|
|
755
755
|
$ && $(v);
|
|
756
756
|
}, [$]), He = d((v) => {
|
|
757
757
|
W && W(v);
|
|
758
|
-
}, [W]),
|
|
758
|
+
}, [W]), Ce = d((v) => {
|
|
759
759
|
_ && _(v);
|
|
760
760
|
}, [_]), Ie = d((v) => {
|
|
761
761
|
x && x(v);
|
|
762
|
-
}, [x]),
|
|
762
|
+
}, [x]), pe = d((v) => {
|
|
763
763
|
p && p(v);
|
|
764
764
|
}, [p]), Ge = (v, ne) => {
|
|
765
765
|
switch (v.type) {
|
|
@@ -777,10 +777,10 @@ function Ma({
|
|
|
777
777
|
{
|
|
778
778
|
key: `form-${v.artifact.id}`,
|
|
779
779
|
artifact: v.artifact,
|
|
780
|
-
theme:
|
|
780
|
+
theme: ye,
|
|
781
781
|
initialState: Se,
|
|
782
782
|
onSubmit: He,
|
|
783
|
-
onCancel:
|
|
783
|
+
onCancel: Ce,
|
|
784
784
|
onButtonClick: Ie
|
|
785
785
|
}
|
|
786
786
|
) : null;
|
|
@@ -790,12 +790,12 @@ function Ma({
|
|
|
790
790
|
{
|
|
791
791
|
key: `social-${v.artifact.id}`,
|
|
792
792
|
artifact: v.artifact,
|
|
793
|
-
theme:
|
|
794
|
-
onCopy:
|
|
793
|
+
theme: ye,
|
|
794
|
+
onCopy: pe
|
|
795
795
|
}
|
|
796
796
|
);
|
|
797
797
|
case "panel":
|
|
798
|
-
return
|
|
798
|
+
return G ? /* @__PURE__ */ e.createElement(
|
|
799
799
|
ma,
|
|
800
800
|
{
|
|
801
801
|
key: `panel-${v.artifact.id}`,
|
|
@@ -820,12 +820,12 @@ function Ma({
|
|
|
820
820
|
/* @__PURE__ */ e.createElement(
|
|
821
821
|
xa,
|
|
822
822
|
{
|
|
823
|
-
isOpen:
|
|
823
|
+
isOpen: de,
|
|
824
824
|
type: S,
|
|
825
825
|
src: N,
|
|
826
826
|
alt: L,
|
|
827
|
-
caption:
|
|
828
|
-
onClose:
|
|
827
|
+
caption: ke,
|
|
828
|
+
onClose: xe
|
|
829
829
|
}
|
|
830
830
|
)
|
|
831
831
|
);
|
|
@@ -899,33 +899,33 @@ function Fa({
|
|
|
899
899
|
getPanelUrl: x,
|
|
900
900
|
openArtifact: p,
|
|
901
901
|
instance: s
|
|
902
|
-
} = Me(), O = V(null), X = V(null), z = V(null), F = V(null), te = V(null), q = V(null), D = V(null), [H, Z] = y(!1), [
|
|
902
|
+
} = Me(), O = V(null), X = V(null), z = V(null), F = V(null), te = V(null), q = V(null), D = V(null), [H, Z] = y(!1), [he, le] = y(!1), [ge, ce] = y(!0), [ue, me] = y(!1), [_e, de] = y(!1), [m, S] = y(!1), [b, N] = y(!1), [M, L] = y("options"), [fe, ke] = y(""), [Pe, ye] = y(null), [Ye, G] = y(""), [We, Se] = y(!1), [ae, xe] = y(!1), [$e, ze] = y([]), [be, Ae] = y(!1), [Qe, Re] = y(""), [K, He] = y([]), [Ce, Ie] = y(!1), [pe, Ge] = y(/* @__PURE__ */ new Set(["log", "warn", "error", "info"])), Ne = V(null), [v, ne] = y(
|
|
903
903
|
() => {
|
|
904
904
|
var n;
|
|
905
905
|
return Math.min(Math.max(i ?? ((n = s == null ? void 0 : s.config) == null ? void 0 : n.panelWidth) ?? 65, 25), 75);
|
|
906
906
|
}
|
|
907
|
-
), [
|
|
907
|
+
), [ie, Ee] = y(
|
|
908
908
|
() => {
|
|
909
909
|
var n;
|
|
910
910
|
return Math.min(Math.max(u ?? ((n = s == null ? void 0 : s.config) == null ? void 0 : n.splitPosition) ?? 50, 20), 80);
|
|
911
911
|
}
|
|
912
|
-
), C = V(null),
|
|
912
|
+
), C = V(null), Le = V(null);
|
|
913
913
|
B(() => {
|
|
914
914
|
i !== void 0 && ne(Math.min(Math.max(i, 25), 75));
|
|
915
915
|
}, [i]), B(() => {
|
|
916
|
-
u !== void 0 &&
|
|
916
|
+
u !== void 0 && Ee(Math.min(Math.max(u, 20), 80));
|
|
917
917
|
}, [u]);
|
|
918
|
-
const f = V(null), I = V(null), U = V(null), Q = w(() => a ? Ze(a.language) : "", [a]), Be = w(() => a ? mt(a.language) : "", [a]),
|
|
918
|
+
const f = V(null), I = V(null), U = V(null), Q = w(() => a ? Ze(a.language) : "", [a]), Be = w(() => a ? mt(a.language) : "", [a]), ve = w(() => {
|
|
919
919
|
if (!a) return null;
|
|
920
920
|
let n = x(a);
|
|
921
921
|
return n && a._refreshToken && (n += (n.includes("?") ? "&" : "?") + "_t=" + a._refreshToken), n;
|
|
922
|
-
}, [a, x]), Fe = w(() => a ? la(a.language) : "plaintext", [a]), j = w(() => o.artifacts.filter((n) => !n.isInline), [o.artifacts]),
|
|
922
|
+
}, [a, x]), Fe = w(() => a ? la(a.language) : "plaintext", [a]), j = w(() => o.artifacts.filter((n) => !n.isInline), [o.artifacts]), oe = w(() => a ? j.findIndex((n) => n.id === a.id) : -1, [a, j]), et = w(() => {
|
|
923
923
|
var n;
|
|
924
924
|
return ((n = s == null ? void 0 : s.config) == null ? void 0 : n.branding) !== !1;
|
|
925
925
|
}, [s]), Ht = w(() => {
|
|
926
926
|
var n;
|
|
927
|
-
return
|
|
928
|
-
}, [a, h, s,
|
|
927
|
+
return ve ? (a == null ? void 0 : a.externalPreview) !== void 0 ? a.externalPreview : h !== void 0 ? h : ((n = s == null ? void 0 : s.config) == null ? void 0 : n.externalPreview) ?? !1 : !1;
|
|
928
|
+
}, [a, h, s, ve]), tt = w(
|
|
929
929
|
() => K.filter((n) => n.type === "error").length,
|
|
930
930
|
[K]
|
|
931
931
|
), pt = w(
|
|
@@ -938,8 +938,8 @@ function Fa({
|
|
|
938
938
|
() => K.filter((n) => n.type === "log").length,
|
|
939
939
|
[K]
|
|
940
940
|
), It = w(
|
|
941
|
-
() => K.filter((n) =>
|
|
942
|
-
[K,
|
|
941
|
+
() => K.filter((n) => pe.has(n.type)),
|
|
942
|
+
[K, pe]
|
|
943
943
|
), Bt = (E ?? ((Ct = s == null ? void 0 : s.config) == null ? void 0 : Ct.consolePanel)) !== !1 && K.length > 0;
|
|
944
944
|
function qe(n) {
|
|
945
945
|
Ge((g) => {
|
|
@@ -955,8 +955,8 @@ function Fa({
|
|
|
955
955
|
}) : void 0, [s]), B(() => {
|
|
956
956
|
He([]), Ie(!1);
|
|
957
957
|
}, [a == null ? void 0 : a.id]), B(() => {
|
|
958
|
-
|
|
959
|
-
}, [K,
|
|
958
|
+
Ne.current && Ce && (Ne.current.scrollTop = Ne.current.scrollHeight);
|
|
959
|
+
}, [K, Ce]);
|
|
960
960
|
const Ft = w(() => {
|
|
961
961
|
var n;
|
|
962
962
|
return ((n = s == null ? void 0 : s.share) == null ? void 0 : n.enabled) !== !1;
|
|
@@ -969,7 +969,7 @@ function Fa({
|
|
|
969
969
|
}, [s]);
|
|
970
970
|
w(() => Ue ? o.openTabs.map((n) => o.artifacts.find((g) => g.id === n)).filter(Boolean) : [], [Ue, o.openTabs, o.artifacts]);
|
|
971
971
|
const gt = d((n) => `<svg viewBox="0 0 24 24" fill="currentColor">${mt(n)}</svg>`, []), Vt = d(() => {
|
|
972
|
-
|
|
972
|
+
de(!1), s.state.clearActiveArtifact();
|
|
973
973
|
}, [s]), je = d((n) => {
|
|
974
974
|
if (n.language !== "smartdiff") return null;
|
|
975
975
|
try {
|
|
@@ -977,9 +977,9 @@ function Fa({
|
|
|
977
977
|
if (g.oldCode === void 0 || g.newCode === void 0) return null;
|
|
978
978
|
const T = g.language || "plaintext", A = Tt() && window.Prism.languages[T], Y = ca(g.oldCode, g.newCode).split(`
|
|
979
979
|
`);
|
|
980
|
-
return { html: Y.map((
|
|
981
|
-
const
|
|
982
|
-
return
|
|
980
|
+
return { html: Y.map((se) => {
|
|
981
|
+
const re = se[0], ee = se.slice(1), we = A ? window.Prism.highlight(ee, A, T) : ee;
|
|
982
|
+
return re === "-" ? `<span class="token deleted">${we}</span>` : re === "+" ? `<span class="token inserted">${we}</span>` : we;
|
|
983
983
|
}).join(`
|
|
984
984
|
`), lineCount: Y.length };
|
|
985
985
|
} catch {
|
|
@@ -1033,14 +1033,14 @@ function Fa({
|
|
|
1033
1033
|
code: n
|
|
1034
1034
|
});
|
|
1035
1035
|
}, [a, s]), Rt = d(() => {
|
|
1036
|
-
|
|
1037
|
-
}, [
|
|
1038
|
-
clearTimeout(I.current),
|
|
1036
|
+
ve && window.open(ve, "_blank", "noopener,noreferrer");
|
|
1037
|
+
}, [ve]), qt = d(() => {
|
|
1038
|
+
clearTimeout(I.current), ce(!1), O.current && a && (s.bridge.setIframe(O.current), s.bridge.loadArtifact(a));
|
|
1039
1039
|
}, [a, s]), Dt = d(() => {
|
|
1040
|
-
clearTimeout(I.current),
|
|
1040
|
+
clearTimeout(I.current), ce(!1);
|
|
1041
1041
|
}, []), Ut = d(() => {
|
|
1042
1042
|
clearTimeout(I.current), I.current = setTimeout(() => {
|
|
1043
|
-
|
|
1043
|
+
ce(!1);
|
|
1044
1044
|
}, 1e3);
|
|
1045
1045
|
}, []), jt = d(async () => {
|
|
1046
1046
|
if (a)
|
|
@@ -1051,22 +1051,22 @@ function Fa({
|
|
|
1051
1051
|
}
|
|
1052
1052
|
}, [a]), Ot = d(() => {
|
|
1053
1053
|
if (!a) return;
|
|
1054
|
-
const { code: n, language: g,
|
|
1055
|
-
|
|
1054
|
+
const { code: n, language: g, editorLanguage: T, title: A } = a, Y = dt(T || g), Ve = `${A.toLowerCase().replace(/\s+/g, "-")}.${Y}`, se = new Blob([n], { type: "text/plain" }), re = URL.createObjectURL(se), ee = document.createElement("a");
|
|
1055
|
+
ee.href = re, ee.download = Ve, document.body.appendChild(ee), ee.click(), document.body.removeChild(ee), URL.revokeObjectURL(re);
|
|
1056
1056
|
}, [a]), Jt = d(async () => {
|
|
1057
1057
|
if (!(m || j.length === 0)) {
|
|
1058
1058
|
S(!0);
|
|
1059
1059
|
try {
|
|
1060
1060
|
const n = new oa(), g = /* @__PURE__ */ new Map();
|
|
1061
|
-
for (const
|
|
1062
|
-
if (!
|
|
1063
|
-
const
|
|
1064
|
-
let
|
|
1061
|
+
for (const re of j) {
|
|
1062
|
+
if (!re.code) continue;
|
|
1063
|
+
const ee = dt(re.editorLanguage || re.language);
|
|
1064
|
+
let we = (re.title || "untitled").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-_]/g, ""), ot = `${we}.${ee}`;
|
|
1065
1065
|
const ut = g.get(ot) || 0;
|
|
1066
|
-
ut > 0 && (ot = `${
|
|
1066
|
+
ut > 0 && (ot = `${we}-${ut}.${ee}`), g.set(`${we}.${ee}`, ut + 1), n.file(ot, re.code);
|
|
1067
1067
|
}
|
|
1068
|
-
const T = await n.generateAsync({ type: "blob" }), Y = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, Ve = URL.createObjectURL(T),
|
|
1069
|
-
|
|
1068
|
+
const T = await n.generateAsync({ type: "blob" }), Y = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, Ve = URL.createObjectURL(T), se = document.createElement("a");
|
|
1069
|
+
se.href = Ve, se.download = Y, document.body.appendChild(se), se.click(), document.body.removeChild(se), URL.revokeObjectURL(Ve);
|
|
1070
1070
|
} catch (n) {
|
|
1071
1071
|
console.error("Failed to create ZIP:", n);
|
|
1072
1072
|
} finally {
|
|
@@ -1078,17 +1078,17 @@ function Fa({
|
|
|
1078
1078
|
N(!1);
|
|
1079
1079
|
return;
|
|
1080
1080
|
}
|
|
1081
|
-
a && (L("options"),
|
|
1081
|
+
a && (L("options"), ke(""), ye(null), G(""), Se(!1), xe(!1), ze([]), Ae(!1), Re(""), N(!0));
|
|
1082
1082
|
}, [a, s, b]), Zt = d(() => {
|
|
1083
1083
|
N(!1);
|
|
1084
1084
|
}, []), nt = d(async () => {
|
|
1085
1085
|
if (!(!a || !(s != null && s.share))) {
|
|
1086
|
-
L("loading"),
|
|
1086
|
+
L("loading"), G("");
|
|
1087
1087
|
try {
|
|
1088
1088
|
const n = await s.share.share(a);
|
|
1089
|
-
|
|
1089
|
+
ke(n.url), ye(n.expiresAt), xe(!1), L("success");
|
|
1090
1090
|
} catch (n) {
|
|
1091
|
-
|
|
1091
|
+
G(n.message || "Failed to create share link"), L("error");
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
1094
|
}, [a, s]), kt = d(async () => {
|
|
@@ -1099,17 +1099,17 @@ function Fa({
|
|
|
1099
1099
|
try {
|
|
1100
1100
|
await s.share.openAuthPopup(), Oe();
|
|
1101
1101
|
} catch (n) {
|
|
1102
|
-
n.message === "Authentication cancelled" ? L("options") : (
|
|
1102
|
+
n.message === "Authentication cancelled" ? L("options") : (G(n.message || "Authentication failed"), L("error"));
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
1105
|
}, [De, s]), Oe = d(async () => {
|
|
1106
1106
|
if (!(!a || !(s != null && s.share))) {
|
|
1107
|
-
L("loading"),
|
|
1107
|
+
L("loading"), G("");
|
|
1108
1108
|
try {
|
|
1109
1109
|
const n = await s.share.save(a);
|
|
1110
|
-
|
|
1110
|
+
ke(n.url), ye(null), xe(!0), L("success");
|
|
1111
1111
|
} catch (n) {
|
|
1112
|
-
|
|
1112
|
+
G(n.message || "Failed to save artifact"), L("error");
|
|
1113
1113
|
}
|
|
1114
1114
|
}
|
|
1115
1115
|
}, [a, s]), Kt = d(() => {
|
|
@@ -1121,7 +1121,7 @@ function Fa({
|
|
|
1121
1121
|
try {
|
|
1122
1122
|
await s.share.openAuthPopup();
|
|
1123
1123
|
} catch (n) {
|
|
1124
|
-
n.message === "Authentication cancelled" ? L("options") : (
|
|
1124
|
+
n.message === "Authentication cancelled" ? L("options") : (G(n.message || "Authentication failed"), L("error"));
|
|
1125
1125
|
return;
|
|
1126
1126
|
}
|
|
1127
1127
|
}
|
|
@@ -1130,7 +1130,7 @@ function Fa({
|
|
|
1130
1130
|
const n = (a == null ? void 0 : a.language) || null, g = await s.share.listArtifacts(n);
|
|
1131
1131
|
ze(g.projects || []);
|
|
1132
1132
|
} catch (n) {
|
|
1133
|
-
|
|
1133
|
+
G(n.message || "Failed to load artifacts"), L("error");
|
|
1134
1134
|
} finally {
|
|
1135
1135
|
Ae(!1);
|
|
1136
1136
|
}
|
|
@@ -1140,33 +1140,33 @@ function Fa({
|
|
|
1140
1140
|
if (!a || !(s != null && s.share)) return;
|
|
1141
1141
|
const g = (T = n.project) == null ? void 0 : T.uuid;
|
|
1142
1142
|
if (g) {
|
|
1143
|
-
L("loading"),
|
|
1143
|
+
L("loading"), G("");
|
|
1144
1144
|
try {
|
|
1145
1145
|
const Y = await s.share.updateArtifact(g, a);
|
|
1146
|
-
|
|
1146
|
+
ke(Y.url || ""), ye(null), xe(!0), Re(((A = n.project) == null ? void 0 : A.name) || "Untitled"), L("success");
|
|
1147
1147
|
} catch (Y) {
|
|
1148
|
-
|
|
1148
|
+
G(Y.message || "Failed to update artifact"), L("error");
|
|
1149
1149
|
}
|
|
1150
1150
|
}
|
|
1151
1151
|
}, [a, s]), Gt = d(async () => {
|
|
1152
|
-
if (
|
|
1152
|
+
if (fe)
|
|
1153
1153
|
try {
|
|
1154
|
-
await navigator.clipboard.writeText(
|
|
1154
|
+
await navigator.clipboard.writeText(fe), Se(!0), setTimeout(() => Se(!1), 2e3);
|
|
1155
1155
|
} catch (n) {
|
|
1156
1156
|
console.error("Failed to copy link:", n);
|
|
1157
1157
|
}
|
|
1158
|
-
}, [
|
|
1158
|
+
}, [fe]);
|
|
1159
1159
|
d((n) => {
|
|
1160
1160
|
p(n);
|
|
1161
1161
|
}, [p]), d((n) => {
|
|
1162
|
-
s.closeTab(n), o.openTabs.length === 0 &&
|
|
1162
|
+
s.closeTab(n), o.openTabs.length === 0 && de(!1);
|
|
1163
1163
|
}, [s, o.openTabs]);
|
|
1164
1164
|
const ea = d(() => {
|
|
1165
|
-
|
|
1166
|
-
}, [
|
|
1167
|
-
|
|
1168
|
-
}, [
|
|
1169
|
-
|
|
1165
|
+
oe > 0 && p(j[oe - 1]);
|
|
1166
|
+
}, [oe, p, j]), ta = d(() => {
|
|
1167
|
+
oe < j.length - 1 && p(j[oe + 1]);
|
|
1168
|
+
}, [oe, p, j]), xt = d((n) => {
|
|
1169
|
+
de(!0), p(n), le(!1);
|
|
1170
1170
|
}, [p]), st = d((n) => {
|
|
1171
1171
|
C.current = {
|
|
1172
1172
|
startX: n.clientX,
|
|
@@ -1185,25 +1185,25 @@ function Fa({
|
|
|
1185
1185
|
}, [lt]), aa = d((n) => {
|
|
1186
1186
|
if (!z.current) return;
|
|
1187
1187
|
const g = z.current.getBoundingClientRect();
|
|
1188
|
-
|
|
1188
|
+
Le.current = {
|
|
1189
1189
|
startX: n.clientX,
|
|
1190
|
-
startPosition:
|
|
1190
|
+
startPosition: ie,
|
|
1191
1191
|
contentLeft: g.left,
|
|
1192
1192
|
contentWidth: g.width
|
|
1193
1193
|
}, document.addEventListener("mousemove", ct), document.addEventListener("mouseup", Xe), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((T) => {
|
|
1194
1194
|
T.style.pointerEvents = "none";
|
|
1195
1195
|
});
|
|
1196
|
-
}, [
|
|
1197
|
-
if (!
|
|
1198
|
-
const T = (n.clientX -
|
|
1199
|
-
|
|
1196
|
+
}, [ie]), ct = d((n) => {
|
|
1197
|
+
if (!Le.current) return;
|
|
1198
|
+
const T = (n.clientX - Le.current.contentLeft) / Le.current.contentWidth * 100;
|
|
1199
|
+
Ee(Math.min(Math.max(T, 20), 80));
|
|
1200
1200
|
}, []), Xe = d(() => {
|
|
1201
|
-
|
|
1201
|
+
Le.current = null, document.removeEventListener("mousemove", ct), document.removeEventListener("mouseup", Xe), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((n) => {
|
|
1202
1202
|
n.style.pointerEvents = "";
|
|
1203
1203
|
});
|
|
1204
1204
|
}, [ct]);
|
|
1205
1205
|
if (B(() => {
|
|
1206
|
-
a && (U.current && U.current.isPreviewable !== a.isPreviewable && (
|
|
1206
|
+
a && (U.current && U.current.isPreviewable !== a.isPreviewable && (me(!0), setTimeout(() => me(!1), 150)), U.current = a, bt(), ce(!0), Ut(), at());
|
|
1207
1207
|
}, [a == null ? void 0 : a.id, bt]), B(() => {
|
|
1208
1208
|
(o.viewMode === "code" || o.viewMode === "split") && at(), o.viewMode === "edit" && Nt();
|
|
1209
1209
|
}, [o.viewMode, at, Nt]), B(() => (t && s.on("ai:request", t), r && s.on("save:request", r), c && s.on("export:complete", c), () => {
|
|
@@ -1220,7 +1220,7 @@ function Fa({
|
|
|
1220
1220
|
].filter(Boolean).join(" "), ra = [
|
|
1221
1221
|
"artifactuse-panel__content",
|
|
1222
1222
|
`artifactuse-panel__content--${o.viewMode}`,
|
|
1223
|
-
|
|
1223
|
+
ue && "artifactuse-panel__content--transitioning"
|
|
1224
1224
|
].filter(Boolean).join(" ");
|
|
1225
1225
|
return !P || o.forceEmptyView ? /* @__PURE__ */ e.createElement("div", { className: it, style: o.isFullscreen ? void 0 : { width: `${ht}%` } }, !o.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: st }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle-line" })), /* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header artifactuse-panel__header--simple" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__icon" }, o.forceEmptyView ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "14 2 14 8 20 8" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "16 18 22 12 16 6" }), /* @__PURE__ */ e.createElement("polyline", { points: "8 6 2 12 8 18" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, o.forceEmptyView ? "Artifact Viewer" : "Artifacts"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
|
|
1226
1226
|
"button",
|
|
@@ -1254,7 +1254,7 @@ function Fa({
|
|
|
1254
1254
|
},
|
|
1255
1255
|
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle-line" })
|
|
1256
1256
|
),
|
|
1257
|
-
/* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, (Ue ||
|
|
1257
|
+
/* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, (Ue || _e) && /* @__PURE__ */ e.createElement(
|
|
1258
1258
|
"button",
|
|
1259
1259
|
{
|
|
1260
1260
|
className: "artifactuse-panel__back",
|
|
@@ -1335,19 +1335,19 @@ function Fa({
|
|
|
1335
1335
|
},
|
|
1336
1336
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))
|
|
1337
1337
|
))),
|
|
1338
|
-
/* @__PURE__ */ e.createElement("div", { className: ra, ref: z },
|
|
1338
|
+
/* @__PURE__ */ e.createElement("div", { className: ra, ref: z }, ue && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })), (o.viewMode === "preview" || o.viewMode === "split") && /* @__PURE__ */ e.createElement(
|
|
1339
1339
|
"div",
|
|
1340
1340
|
{
|
|
1341
1341
|
className: "artifactuse-panel__preview",
|
|
1342
|
-
style: o.viewMode === "split" ? { width: `${
|
|
1342
|
+
style: o.viewMode === "split" ? { width: `${ie}%` } : void 0
|
|
1343
1343
|
},
|
|
1344
|
-
|
|
1345
|
-
|
|
1344
|
+
ge && ve && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })),
|
|
1345
|
+
ve ? /* @__PURE__ */ e.createElement(
|
|
1346
1346
|
"iframe",
|
|
1347
1347
|
{
|
|
1348
1348
|
ref: O,
|
|
1349
|
-
src:
|
|
1350
|
-
className: `artifactuse-panel__iframe ${
|
|
1349
|
+
src: ve,
|
|
1350
|
+
className: `artifactuse-panel__iframe ${ge ? "artifactuse-panel__iframe--loading" : ""}`,
|
|
1351
1351
|
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads allow-top-navigation-by-user-activation",
|
|
1352
1352
|
allow: "camera; microphone; fullscreen; geolocation; display-capture; autoplay; clipboard-write; encrypted-media; gyroscope; accelerometer; picture-in-picture",
|
|
1353
1353
|
onLoad: qt,
|
|
@@ -1359,7 +1359,7 @@ function Fa({
|
|
|
1359
1359
|
{
|
|
1360
1360
|
className: "artifactuse-panel__code",
|
|
1361
1361
|
style: {
|
|
1362
|
-
...o.viewMode === "split" ? { width: `${100 -
|
|
1362
|
+
...o.viewMode === "split" ? { width: `${100 - ie}%` } : {},
|
|
1363
1363
|
display: o.viewMode === "code" || o.viewMode === "split" ? void 0 : "none"
|
|
1364
1364
|
}
|
|
1365
1365
|
},
|
|
@@ -1386,7 +1386,7 @@ function Fa({
|
|
|
1386
1386
|
},
|
|
1387
1387
|
/* @__PURE__ */ e.createElement("div", { ref: q, className: "artifactuse-panel__editor-container" })
|
|
1388
1388
|
)),
|
|
1389
|
-
Bt && /* @__PURE__ */ e.createElement("div", { className: `artifactuse-panel__console ${
|
|
1389
|
+
Bt && /* @__PURE__ */ e.createElement("div", { className: `artifactuse-panel__console ${Ce ? "artifactuse-panel__console--expanded" : ""}` }, /* @__PURE__ */ e.createElement(
|
|
1390
1390
|
"div",
|
|
1391
1391
|
{
|
|
1392
1392
|
className: "artifactuse-panel__console-header",
|
|
@@ -1394,7 +1394,7 @@ function Fa({
|
|
|
1394
1394
|
},
|
|
1395
1395
|
/* @__PURE__ */ e.createElement("svg", { className: "artifactuse-panel__console-chevron", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "18 15 12 9 6 15" })),
|
|
1396
1396
|
/* @__PURE__ */ e.createElement("span", null, "Console"),
|
|
1397
|
-
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__console-filters", onClick: (n) => n.stopPropagation() }, tt > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--error${
|
|
1397
|
+
/* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__console-filters", onClick: (n) => n.stopPropagation() }, tt > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--error${pe.has("error") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => qe("error") }, tt, " error", tt !== 1 ? "s" : ""), pt > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--warn${pe.has("warn") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => qe("warn") }, pt, " warn"), Et > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--info${pe.has("info") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => qe("info") }, Et, " info"), vt > 0 && /* @__PURE__ */ e.createElement("button", { className: `artifactuse-panel__console-filter artifactuse-panel__console-filter--log${pe.has("log") ? "" : " artifactuse-panel__console-filter--inactive"}`, onClick: () => qe("log") }, vt, " log")),
|
|
1398
1398
|
/* @__PURE__ */ e.createElement(
|
|
1399
1399
|
"button",
|
|
1400
1400
|
{
|
|
@@ -1405,7 +1405,7 @@ function Fa({
|
|
|
1405
1405
|
},
|
|
1406
1406
|
"Clear"
|
|
1407
1407
|
)
|
|
1408
|
-
),
|
|
1408
|
+
), Ce && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__console-entries", ref: Ne }, It.map((n, g) => /* @__PURE__ */ e.createElement("div", { key: g, className: `artifactuse-panel__console-entry artifactuse-panel__console-entry--${n.type}` }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-type" }, "[", n.type, "]"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-content" }, n.content), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__console-timestamp" }, new Date(n.timestamp).toLocaleTimeString()))))),
|
|
1409
1409
|
/* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-left" }, et && /* @__PURE__ */ e.createElement(
|
|
1410
1410
|
"a",
|
|
1411
1411
|
{
|
|
@@ -1441,7 +1441,7 @@ function Fa({
|
|
|
1441
1441
|
onClick: Xt
|
|
1442
1442
|
},
|
|
1443
1443
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "18", cy: "5", r: "3" }), /* @__PURE__ */ e.createElement("circle", { cx: "6", cy: "12", r: "3" }), /* @__PURE__ */ e.createElement("circle", { cx: "18", cy: "19", r: "3" }), /* @__PURE__ */ e.createElement("line", { x1: "8.59", y1: "13.51", x2: "15.42", y2: "17.49" }), /* @__PURE__ */ e.createElement("line", { x1: "15.41", y1: "6.51", x2: "8.59", y2: "10.49" }))
|
|
1444
|
-
), b && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__header" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__title" }, M === "success" ? Qe ? "Artifact updated!" : "Link created!" : M === "update-list" ? "Update saved artifact" : "Share Artifact"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__close", onClick: Zt }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__body" }, M === "loading" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__spinner" }), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__loading-text" }, "Creating link...")), M === "error" && /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__error" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__error-text" }, Ye)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__actions" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--secondary", onClick: () => L("options") }, "Back"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--primary", onClick: Kt }, "Retry"))), M === "options" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__options" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: nt }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ e.createElement("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Share link"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Expires in 30 days"))), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: kt }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "17 21 17 13 7 13 7 21" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 3 7 8 15 8" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Save to account"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Permanent, manageable"))), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: Yt }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "23 4 23 10 17 10" }), /* @__PURE__ */ e.createElement("polyline", { points: "1 20 1 14 7 14" }), /* @__PURE__ */ e.createElement("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Update saved"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Replace an existing artifact")))), M === "update-list" && /* @__PURE__ */ e.createElement("div", null,
|
|
1444
|
+
), b && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__header" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-share-popup__title" }, M === "success" ? Qe ? "Artifact updated!" : "Link created!" : M === "update-list" ? "Update saved artifact" : "Share Artifact"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__close", onClick: Zt }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__body" }, M === "loading" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__spinner" }), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__loading-text" }, "Creating link...")), M === "error" && /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__error" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__error-text" }, Ye)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__actions" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--secondary", onClick: () => L("options") }, "Back"), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__btn artifactuse-share-popup__btn--primary", onClick: Kt }, "Retry"))), M === "options" && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__options" }, /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: nt }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ e.createElement("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Share link"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Expires in 30 days"))), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: kt }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "17 21 17 13 7 13 7 21" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 3 7 8 15 8" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Save to account"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Permanent, manageable"))), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-share-popup__option", onClick: Yt }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "23 4 23 10 17 10" }), /* @__PURE__ */ e.createElement("polyline", { points: "1 20 1 14 7 14" }), /* @__PURE__ */ e.createElement("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__option-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-title" }, "Update saved"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__option-desc" }, "Replace an existing artifact")))), M === "update-list" && /* @__PURE__ */ e.createElement("div", null, be ? /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__spinner" }), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-share-popup__loading-text" }, "Loading artifacts...")) : $e.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__empty" }, "No saved artifacts of this type") : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-share-popup__artifact-list" }, $e.map((n) => {
|
|
1445
1445
|
var g, T, A;
|
|
1446
1446
|
return /* @__PURE__ */ e.createElement(
|
|
1447
1447
|
"button",
|
|
@@ -1458,7 +1458,7 @@ function Fa({
|
|
|
1458
1458
|
{
|
|
1459
1459
|
type: "text",
|
|
1460
1460
|
className: "artifactuse-share-popup__link",
|
|
1461
|
-
value:
|
|
1461
|
+
value: fe,
|
|
1462
1462
|
readOnly: !0,
|
|
1463
1463
|
onClick: (n) => n.target.select()
|
|
1464
1464
|
}
|
|
@@ -1473,7 +1473,7 @@ function Fa({
|
|
|
1473
1473
|
"button",
|
|
1474
1474
|
{
|
|
1475
1475
|
className: "artifactuse-panel__nav-btn",
|
|
1476
|
-
disabled:
|
|
1476
|
+
disabled: oe <= 0,
|
|
1477
1477
|
title: "Previous artifact",
|
|
1478
1478
|
onClick: ea
|
|
1479
1479
|
},
|
|
@@ -1482,24 +1482,24 @@ function Fa({
|
|
|
1482
1482
|
"button",
|
|
1483
1483
|
{
|
|
1484
1484
|
className: "artifactuse-panel__nav-trigger",
|
|
1485
|
-
onClick: () =>
|
|
1485
|
+
onClick: () => le(!he)
|
|
1486
1486
|
},
|
|
1487
|
-
/* @__PURE__ */ e.createElement("span", null,
|
|
1487
|
+
/* @__PURE__ */ e.createElement("span", null, oe + 1, " / ", j.length),
|
|
1488
1488
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "6 9 12 15 18 9" }))
|
|
1489
1489
|
), /* @__PURE__ */ e.createElement(
|
|
1490
1490
|
"button",
|
|
1491
1491
|
{
|
|
1492
1492
|
className: "artifactuse-panel__nav-btn",
|
|
1493
|
-
disabled:
|
|
1493
|
+
disabled: oe >= j.length - 1,
|
|
1494
1494
|
title: "Next artifact",
|
|
1495
1495
|
onClick: ta
|
|
1496
1496
|
},
|
|
1497
1497
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "9 18 15 12 9 6" }))
|
|
1498
|
-
),
|
|
1498
|
+
), he && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-header" }, /* @__PURE__ */ e.createElement("span", null, "All Artifacts (", j.length, ")"), /* @__PURE__ */ e.createElement(
|
|
1499
1499
|
"button",
|
|
1500
1500
|
{
|
|
1501
1501
|
className: "artifactuse-panel__artifact-list-close",
|
|
1502
|
-
onClick: () =>
|
|
1502
|
+
onClick: () => le(!1)
|
|
1503
1503
|
},
|
|
1504
1504
|
/* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }))
|
|
1505
1505
|
)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-list-items" }, j.map((n, g) => /* @__PURE__ */ e.createElement(
|