artifactuse 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import e, { useState as C, useMemo as M, useCallback as d, useRef as W, useEffect as q, createContext as Ze, useContext as Ke } from "react";
2
- import { g as we, f as je, a as ze, b as Re, n as Ye, i as Ge, D as Oe, c as Qe } from "../index-CNXX2Rp6.js";
2
+ import { g as ke, f as je, a as ze, b as Re, n as Ye, i as Ge, D as Oe, c as Qe } from "../index-CNXX2Rp6.js";
3
3
  import { J as et } from "../jszip.min-CdmYyw5L.js";
4
4
  import { createPortal as tt } from "react-dom";
5
5
  function at({
@@ -10,13 +10,13 @@ function at({
10
10
  onDownload: s,
11
11
  className: r = ""
12
12
  }) {
13
- const [p, u] = C(!1), g = M(() => we(t.language), [t.language]), c = M(() => {
14
- var k;
15
- return je(t.size || ((k = t.code) == null ? void 0 : k.length) || 0);
16
- }, [t.size, t.code]), b = M(() => ze(t.language), [t.language]), P = d((k) => {
17
- k.stopPropagation(), n && n(t);
18
- }, [t, n]), x = d(async (k) => {
19
- k.stopPropagation();
13
+ const [p, u] = C(!1), y = M(() => ke(t.language), [t.language]), c = M(() => {
14
+ var w;
15
+ return je(t.size || ((w = t.code) == null ? void 0 : w.length) || 0);
16
+ }, [t.size, t.code]), b = M(() => ze(t.language), [t.language]), P = d((w) => {
17
+ w.stopPropagation(), n && n(t);
18
+ }, [t, n]), x = d(async (w) => {
19
+ w.stopPropagation();
20
20
  try {
21
21
  await navigator.clipboard.writeText(t.code), u(!0), l && l(t), setTimeout(() => {
22
22
  u(!1);
@@ -33,9 +33,9 @@ function at({
33
33
  }
34
34
  document.body.removeChild(v);
35
35
  }
36
- }, [t, l]), _ = d((k) => {
36
+ }, [t, l]), _ = d((w) => {
37
37
  var L;
38
- k.stopPropagation();
38
+ w.stopPropagation();
39
39
  const f = new Blob([t.code], { type: "text/plain" }), v = URL.createObjectURL(f), B = document.createElement("a"), V = Re(t.language), z = ((L = t.title) == null ? void 0 : L.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
40
40
  B.href = v, B.download = `${z}.${V}`, document.body.appendChild(B), B.click(), document.body.removeChild(B), URL.revokeObjectURL(v), s && s(t);
41
41
  }, [t, s]), E = [
@@ -52,7 +52,7 @@ function at({
52
52
  strokeWidth: "1.5",
53
53
  dangerouslySetInnerHTML: { __html: b }
54
54
  }
55
- )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__content" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__title" }, t.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__meta" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__type" }, g), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__separator" }, "•"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__size" }, c))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__actions" }, /* @__PURE__ */ e.createElement(
55
+ )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__content" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__title" }, t.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__meta" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__type" }, y), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__separator" }, "•"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__size" }, c))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__actions" }, /* @__PURE__ */ e.createElement(
56
56
  "button",
57
57
  {
58
58
  className: "artifactuse-card__action",
@@ -100,31 +100,31 @@ function nt({
100
100
  className: r = "",
101
101
  theme: p = "dark",
102
102
  accent: u = null,
103
- initialState: g = "active"
103
+ initialState: y = "active"
104
104
  // 'active' | 'submitted' | 'cancelled' | 'inactive'
105
105
  }) {
106
106
  var ie, ee, oe;
107
- const c = W(null), [b, P] = C(g), x = b !== "active", _ = b === "active" ? "" : `artifactuse-form--${b}`, E = M(() => {
107
+ const c = W(null), [b, P] = C(y), x = b !== "active", _ = b === "active" ? "" : `artifactuse-form--${b}`, E = M(() => {
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]), k = t.id || E.id || `form-${Date.now()}`, f = ((ie = E.data) == null ? void 0 : ie.fields) || [], v = E.title || "Form", B = M(() => f.some((i) => i.type === "buttons"), [f]), V = M(() => E.variant === "buttons" ? f : [], [E.variant, f]), [z, L] = C(() => {
114
- var w;
113
+ }, [t.code]), w = t.id || E.id || `form-${Date.now()}`, f = ((ie = E.data) == null ? void 0 : ie.fields) || [], v = E.title || "Form", B = M(() => f.some((i) => i.type === "buttons"), [f]), V = M(() => E.variant === "buttons" ? f : [], [E.variant, f]), [z, L] = C(() => {
114
+ var k;
115
115
  const i = {};
116
- return f.forEach((y) => {
117
- ["buttons", "divider", "heading"].includes(y.type) || (y.defaultValue !== void 0 ? i[y.name] = y.defaultValue : y.type === "checkbox" ? i[y.name] = !1 : i[y.name] = "");
118
- }), (w = E.data) != null && w.defaults && Object.assign(i, E.data.defaults), i;
116
+ return f.forEach((g) => {
117
+ ["buttons", "divider", "heading"].includes(g.type) || (g.defaultValue !== void 0 ? i[g.name] = g.defaultValue : g.type === "checkbox" ? i[g.name] = !1 : i[g.name] = "");
118
+ }), (k = E.data) != null && k.defaults && Object.assign(i, E.data.defaults), i;
119
119
  }), [J, K] = C({}), [D, ne] = C(!1);
120
120
  q(() => {
121
- P(g);
122
- }, [g]), q(() => {
123
- var w;
121
+ P(y);
122
+ }, [y]), q(() => {
123
+ var k;
124
124
  const i = {};
125
- f.forEach((y) => {
126
- ["buttons", "divider", "heading"].includes(y.type) || (y.defaultValue !== void 0 ? i[y.name] = y.defaultValue : y.type === "checkbox" ? i[y.name] = !1 : i[y.name] = "");
127
- }), (w = E.data) != null && w.defaults && Object.assign(i, E.data.defaults), L(i), K({});
125
+ f.forEach((g) => {
126
+ ["buttons", "divider", "heading"].includes(g.type) || (g.defaultValue !== void 0 ? i[g.name] = g.defaultValue : g.type === "checkbox" ? i[g.name] = !1 : i[g.name] = "");
127
+ }), (k = E.data) != null && k.defaults && Object.assign(i, E.data.defaults), L(i), K({});
128
128
  }, [t.code]), q(() => {
129
129
  if (c.current && (c.current.setAttribute("data-artifactuse-theme", p), u)) {
130
130
  const i = rt(u);
@@ -133,13 +133,13 @@ function nt({
133
133
  }, [p, u]);
134
134
  const le = d((i) => {
135
135
  P(i);
136
- }, []), fe = d((i, w) => {
137
- L((y) => ({ ...y, [i]: w })), K((y) => {
138
- const N = { ...y };
136
+ }, []), fe = d((i, k) => {
137
+ L((g) => ({ ...g, [i]: k })), K((g) => {
138
+ const N = { ...g };
139
139
  return delete N[i], N;
140
140
  });
141
141
  }, []), te = d(() => {
142
- var y;
142
+ var g;
143
143
  const i = {};
144
144
  f.forEach((N) => {
145
145
  if (["buttons", "divider", "heading"].includes(N.type)) return;
@@ -165,36 +165,36 @@ function nt({
165
165
  return;
166
166
  }
167
167
  });
168
- const w = (y = E.data) == null ? void 0 : y.validation;
169
- return w && Object.entries(w).forEach(([N, T]) => {
168
+ const k = (g = E.data) == null ? void 0 : g.validation;
169
+ return k && Object.entries(k).forEach(([N, T]) => {
170
170
  if (i[N]) return;
171
171
  const Y = z[N];
172
172
  T.pattern && Y && (new RegExp(T.pattern).test(Y) || (i[N] = T.message || `${N} is invalid`));
173
173
  }), K(i), Object.keys(i).length === 0;
174
174
  }, [f, z, (ee = E.data) == null ? void 0 : ee.validation]), X = d(() => {
175
- var w;
175
+ var k;
176
176
  const i = {};
177
- f.forEach((y) => {
178
- ["buttons", "divider", "heading"].includes(y.type) || (y.defaultValue !== void 0 ? i[y.name] = y.defaultValue : y.type === "checkbox" ? i[y.name] = !1 : i[y.name] = "");
179
- }), (w = E.data) != null && w.defaults && Object.assign(i, E.data.defaults), L(i), K({});
177
+ f.forEach((g) => {
178
+ ["buttons", "divider", "heading"].includes(g.type) || (g.defaultValue !== void 0 ? i[g.name] = g.defaultValue : g.type === "checkbox" ? i[g.name] = !1 : i[g.name] = "");
179
+ }), (k = E.data) != null && k.defaults && Object.assign(i, E.data.defaults), L(i), K({});
180
180
  }, [f, (oe = E.data) == null ? void 0 : oe.defaults]), ae = d((i) => {
181
181
  i == null || i.preventDefault(), te() && (ne(!0), a == null || a({
182
- formId: k,
182
+ formId: w,
183
183
  action: "submit",
184
184
  values: { ...z },
185
185
  timestamp: Date.now()
186
186
  }), setTimeout(() => {
187
187
  ne(!1), le("submitted");
188
188
  }, 300));
189
- }, [k, z, a, te, le]), U = d((i) => {
190
- const w = i.action || "custom";
191
- switch (w) {
189
+ }, [w, z, a, te, le]), U = d((i) => {
190
+ const k = i.action || "custom";
191
+ switch (k) {
192
192
  case "submit":
193
193
  ae();
194
194
  break;
195
195
  case "cancel":
196
196
  n == null || n({
197
- formId: k,
197
+ formId: w,
198
198
  action: "cancel",
199
199
  buttonName: i.name || "cancel",
200
200
  timestamp: Date.now()
@@ -204,7 +204,7 @@ function nt({
204
204
  break;
205
205
  case "reset":
206
206
  X(), l == null || l({
207
- formId: k,
207
+ formId: w,
208
208
  action: "reset",
209
209
  buttonName: i.name || "reset",
210
210
  timestamp: Date.now()
@@ -213,8 +213,8 @@ function nt({
213
213
  case "custom":
214
214
  default:
215
215
  s == null || s({
216
- formId: k,
217
- action: w,
216
+ formId: w,
217
+ action: k,
218
218
  buttonName: i.name || i.label,
219
219
  buttonLabel: i.label,
220
220
  values: { ...z },
@@ -224,7 +224,7 @@ function nt({
224
224
  }, 150);
225
225
  break;
226
226
  }
227
- }, [k, z, ae, n, l, s, X, le]);
227
+ }, [w, z, ae, n, l, s, X, le]);
228
228
  return x ? /* @__PURE__ */ e.createElement(
229
229
  "div",
230
230
  {
@@ -241,10 +241,10 @@ function nt({
241
241
  "data-artifactuse-theme": p
242
242
  },
243
243
  (E.title || E.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, E.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, E.title), E.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, E.description)),
244
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, V.map((i, w) => /* @__PURE__ */ e.createElement(
244
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, V.map((i, k) => /* @__PURE__ */ e.createElement(
245
245
  "button",
246
246
  {
247
- key: i.name || i.label || w,
247
+ key: i.name || i.label || k,
248
248
  type: "button",
249
249
  className: `artifactuse-form-btn artifactuse-form-btn-${i.variant || "secondary"}`,
250
250
  onClick: () => U(i),
@@ -261,16 +261,16 @@ function nt({
261
261
  "data-artifactuse-theme": p
262
262
  },
263
263
  (E.title || E.description) && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-header" }, E.title && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-title" }, E.title), E.description && /* @__PURE__ */ e.createElement("p", { className: "artifactuse-form-description" }, E.description)),
264
- /* @__PURE__ */ e.createElement("form", { onSubmit: ae, className: "artifactuse-form" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-fields" }, f.map((i, w) => /* @__PURE__ */ e.createElement(
264
+ /* @__PURE__ */ e.createElement("form", { onSubmit: ae, className: "artifactuse-form" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-fields" }, f.map((i, k) => /* @__PURE__ */ e.createElement(
265
265
  lt,
266
266
  {
267
- key: i.name || w,
267
+ key: i.name || k,
268
268
  field: i,
269
- formId: k,
269
+ formId: w,
270
270
  value: z[i.name],
271
271
  error: J[i.name],
272
272
  isSubmitting: D,
273
- onChange: (y) => fe(i.name, y),
273
+ onChange: (g) => fe(i.name, g),
274
274
  onButtonAction: U
275
275
  }
276
276
  ))), !B && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons artifactuse-form-buttons-default" }, /* @__PURE__ */ e.createElement(
@@ -338,7 +338,7 @@ function lt({ field: t, formId: a, value: n, error: l, isSubmitting: s, onChange
338
338
  onChange: () => r(c.value)
339
339
  }
340
340
  ), /* @__PURE__ */ e.createElement("span", null, c.label)))), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), l && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, l));
341
- const g = () => st(t.type) ? /* @__PURE__ */ e.createElement(
341
+ const y = () => st(t.type) ? /* @__PURE__ */ e.createElement(
342
342
  "input",
343
343
  {
344
344
  type: t.type,
@@ -389,7 +389,7 @@ function lt({ field: t, formId: a, value: n, error: l, isSubmitting: s, onChange
389
389
  onChange: (c) => r(c.target.value)
390
390
  }
391
391
  );
392
- return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, /* @__PURE__ */ e.createElement("label", { htmlFor: u, className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), g(), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), l && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, l));
392
+ return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, /* @__PURE__ */ e.createElement("label", { htmlFor: u, className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), y(), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), l && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, l));
393
393
  }
394
394
  const R = '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>', ct = {
395
395
  twitter: 280,
@@ -418,12 +418,12 @@ const R = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0
418
418
  let a = t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
419
419
  return a = a.replace(/\n/g, "<br>"), a = a.replace(/#(\w+)/g, '<span class="artifactuse-social-hashtag">#$1</span>'), a = a.replace(/@(\w+)/g, '<span class="artifactuse-social-mention">@$1</span>'), a;
420
420
  }, Ue = ({ author: t, content: a, engagement: n, meta: l }) => {
421
- var p, u, g;
421
+ var p, u, y;
422
422
  const s = a.media || [], r = n.likes || n.retweets || n.replies || n.views;
423
423
  return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || R, alt: t.name, className: "artifactuse-social-avatar", onError: (c) => c.target.src = R }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, /* @__PURE__ */ e.createElement("span", null, t.name), t.verified && /* @__PURE__ */ e.createElement(xe, { type: t.verifiedType || "blue" })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-meta" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-handle" }, t.handle), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-timestamp" }, "· ", l.timestamp || "Just now")))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ue(a.text) } }), s.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social-media-grid ${s.length === 1 ? "artifactuse-social-media-single" : ""}`, "data-count": s.length }, s.slice(0, 4).map((c, b) => /* @__PURE__ */ e.createElement("img", { key: b, src: c.url, alt: c.alt || "", onError: (P) => P.target.style.display = "none" })))), a.link && !s.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, a.link.image && /* @__PURE__ */ e.createElement("img", { src: a.link.image, alt: a.link.title, className: "artifactuse-social-link-image", onError: (c) => c.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, a.link.domain || Ve(a.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, a.link.title), a.link.description && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-description" }, a.link.description))), a.poll && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll" }, a.poll.options.map((c, b) => {
424
424
  var P, x;
425
425
  return /* @__PURE__ */ e.createElement("div", { key: b, className: "artifactuse-social-poll-option" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-bar", style: { width: `${((P = a.poll.votes) == null ? void 0 : P[b]) || 0}%` } }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-label" }, /* @__PURE__ */ e.createElement("span", null, c), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-poll-percent" }, ((x = a.poll.votes) == null ? void 0 : x[b]) || 0, "%")));
426
- }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" }, I(a.poll.totalVotes || 0), " votes · ", a.poll.duration || "Poll ended")), a.quote && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote-header" }, /* @__PURE__ */ e.createElement("img", { src: ((p = a.quote.author) == null ? void 0 : p.avatar) || R, className: "artifactuse-social-quote-avatar", alt: "" }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-author" }, (u = a.quote.author) == null ? void 0 : u.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-handle" }, (g = a.quote.author) == null ? void 0 : g.handle)), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-quote-text" }, a.quote.text))), r && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, I(n.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, I(n.retweets || 0), " reposts"), /* @__PURE__ */ e.createElement("span", null, I(n.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, I(n.views || 0), " views")));
426
+ }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" }, I(a.poll.totalVotes || 0), " votes · ", a.poll.duration || "Poll ended")), a.quote && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-quote-header" }, /* @__PURE__ */ e.createElement("img", { src: ((p = a.quote.author) == null ? void 0 : p.avatar) || R, className: "artifactuse-social-quote-avatar", alt: "" }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-author" }, (u = a.quote.author) == null ? void 0 : u.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-quote-handle" }, (y = a.quote.author) == null ? void 0 : y.handle)), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-quote-text" }, a.quote.text))), r && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, I(n.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, I(n.retweets || 0), " reposts"), /* @__PURE__ */ e.createElement("span", null, I(n.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, I(n.views || 0), " views")));
427
427
  }, ot = ({ author: t, content: a, engagement: n, meta: l }) => {
428
428
  const s = n.likes || n.comments || n.shares || n.reposts;
429
429
  return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || R, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = R }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.connection && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-connection" }, "· ", t.connection)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-headline" }, t.headline), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, l.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ue(a.text) } }), a.link && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, a.link.image && /* @__PURE__ */ e.createElement("img", { src: a.link.image, alt: a.link.title, className: "artifactuse-social-link-image", onError: (r) => r.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, a.link.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, a.link.domain || Ve(a.link.url))))), s && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, I(n.likes || 0), " reactions"), /* @__PURE__ */ e.createElement("span", null, I(n.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, I(n.shares || n.reposts || 0), " reposts")));
@@ -433,9 +433,9 @@ const R = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0
433
433
  }, ut = ({ author: t, content: a, engagement: n, meta: l }) => {
434
434
  const s = a.media || [], r = M(() => {
435
435
  const u = n.reactions || {};
436
- return Object.values(u).reduce((g, c) => g + (c || 0), 0) || n.likes || 0;
436
+ return Object.values(u).reduce((y, c) => y + (c || 0), 0) || n.likes || 0;
437
437
  }, [n]), p = n.likes || n.comments || n.shares || r;
438
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || R, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = R }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, l.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ue(a.text) } }), s.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-grid", "data-count": s.length }, s.slice(0, 4).map((u, g) => /* @__PURE__ */ e.createElement("img", { key: g, src: u.url, alt: u.alt || "", onError: (c) => c.target.style.display = "none" })))), a.link && !s.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, a.link.image && /* @__PURE__ */ e.createElement("img", { src: a.link.image, alt: a.link.title, className: "artifactuse-social-link-image", onError: (u) => u.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, a.link.domain || Ve(a.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, a.link.title)))), p && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, "👍❤️ ", I(r)), /* @__PURE__ */ e.createElement("span", null, I(n.comments || 0), " comments · ", I(n.shares || 0), " shares")));
438
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || R, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = R }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, l.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ue(a.text) } }), s.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-grid", "data-count": s.length }, s.slice(0, 4).map((u, y) => /* @__PURE__ */ e.createElement("img", { key: y, src: u.url, alt: u.alt || "", onError: (c) => c.target.style.display = "none" })))), a.link && !s.length && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-card" }, a.link.image && /* @__PURE__ */ e.createElement("img", { src: a.link.image, alt: a.link.title, className: "artifactuse-social-link-image", onError: (u) => u.target.style.display = "none" }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-domain" }, a.link.domain || Ve(a.link.url)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-link-title" }, a.link.title)))), p && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, "👍❤️ ", I(r)), /* @__PURE__ */ e.createElement("span", null, I(n.comments || 0), " comments · ", I(n.shares || 0), " shares")));
439
439
  }, dt = ({ author: t, content: a, engagement: n, meta: l }) => {
440
440
  const s = n.likes || n.replies || n.reposts;
441
441
  return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || R, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = R }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(xe, { type: "blue" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-timestamp" }, l.timestamp || "Just now")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ue(a.text) } })), s && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, I(n.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, I(n.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, I(n.reposts || 0), " reposts")));
@@ -453,13 +453,13 @@ function Et({ artifact: t, theme: a = "dark", onCopy: n }) {
453
453
  } catch {
454
454
  return { platform: "twitter", data: {} };
455
455
  }
456
- }, [t.code]), p = (r == null ? void 0 : r.platform) || "twitter", u = (r == null ? void 0 : r.data) || {}, { author: g = {}, content: c = {}, engagement: b = {}, meta: P = {} } = u, x = ct[p] || 280, _ = (c.text || "").length, E = _ > x ? "error" : _ > x * 0.9 ? "warning" : "", k = d(() => {
456
+ }, [t.code]), p = (r == null ? void 0 : r.platform) || "twitter", u = (r == null ? void 0 : r.data) || {}, { author: y = {}, content: c = {}, engagement: b = {}, meta: P = {} } = u, x = ct[p] || 280, _ = (c.text || "").length, E = _ > x ? "error" : _ > x * 0.9 ? "warning" : "", w = d(() => {
457
457
  const v = c.text || "";
458
458
  navigator.clipboard.writeText(v).then(() => {
459
459
  s("Copied!"), setTimeout(() => s("Copy"), 2e3), n == null || n({ platform: p, text: v });
460
460
  });
461
461
  }, [c.text, p, n]), f = () => {
462
- const v = { author: g, content: c, engagement: b, meta: P };
462
+ const v = { author: y, content: c, engagement: b, meta: P };
463
463
  switch (p) {
464
464
  case "twitter":
465
465
  return /* @__PURE__ */ e.createElement(Ue, { ...v });
@@ -479,7 +479,7 @@ function Et({ artifact: t, theme: a = "dark", onCopy: n }) {
479
479
  return /* @__PURE__ */ e.createElement(Ue, { ...v });
480
480
  }
481
481
  };
482
- return /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social artifactuse-social-${p}`, "data-artifactuse-theme": a }, f(), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-bar" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-platform-badge" }, /* @__PURE__ */ e.createElement("span", null, it[p] || p)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-right" }, /* @__PURE__ */ e.createElement("span", { className: `artifactuse-social-char-counter ${E}` }, _, "/", x), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-social-copy-btn", onClick: k }, l))));
482
+ return /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social artifactuse-social-${p}`, "data-artifactuse-theme": a }, f(), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-bar" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-platform-badge" }, /* @__PURE__ */ e.createElement("span", null, it[p] || p)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-right" }, /* @__PURE__ */ e.createElement("span", { className: `artifactuse-social-char-counter ${E}` }, _, "/", x), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-social-copy-btn", onClick: w }, l))));
483
483
  }
484
484
  function vt({
485
485
  isOpen: t = !1,
@@ -490,7 +490,7 @@ function vt({
490
490
  onClose: r,
491
491
  className: p = ""
492
492
  }) {
493
- const u = W(null), [g, c] = C(!1), [b, P] = C(!1);
493
+ const u = W(null), [y, c] = C(!1), [b, P] = C(!1);
494
494
  q(() => (P(!0), () => P(!1)), []), q(() => {
495
495
  var f;
496
496
  return t ? (document.body.style.overflow = "hidden", (f = u.current) == null || f.focus()) : (document.body.style.overflow = "", c(!1)), () => {
@@ -512,7 +512,7 @@ function vt({
512
512
  }, [n, l]);
513
513
  if (!t || !b)
514
514
  return null;
515
- const k = /* @__PURE__ */ e.createElement(
515
+ const w = /* @__PURE__ */ e.createElement(
516
516
  "div",
517
517
  {
518
518
  ref: u,
@@ -527,7 +527,7 @@ function vt({
527
527
  {
528
528
  src: n,
529
529
  alt: l,
530
- className: `artifactuse-viewer-image ${g ? "artifactuse-viewer-image--zoomed" : ""}`,
530
+ className: `artifactuse-viewer-image ${y ? "artifactuse-viewer-image--zoomed" : ""}`,
531
531
  onClick: _
532
532
  }
533
533
  ), a === "pdf" && /* @__PURE__ */ e.createElement(
@@ -550,9 +550,9 @@ function vt({
550
550
  {
551
551
  className: "artifactuse-viewer-control",
552
552
  onClick: _,
553
- title: g ? "Zoom out" : "Zoom in"
553
+ title: y ? "Zoom out" : "Zoom in"
554
554
  },
555
- g ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "11", x2: "14", y2: "11" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }), /* @__PURE__ */ e.createElement("line", { x1: "11", y1: "8", x2: "11", y2: "14" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "11", x2: "14", y2: "11" }))
555
+ y ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "11", x2: "14", y2: "11" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("circle", { cx: "11", cy: "11", r: "8" }), /* @__PURE__ */ e.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }), /* @__PURE__ */ e.createElement("line", { x1: "11", y1: "8", x2: "11", y2: "14" }), /* @__PURE__ */ e.createElement("line", { x1: "8", y1: "11", x2: "14", y2: "11" }))
556
556
  ), /* @__PURE__ */ e.createElement(
557
557
  "button",
558
558
  {
@@ -563,7 +563,7 @@ function vt({
563
563
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), /* @__PURE__ */ e.createElement("polyline", { points: "7 10 12 15 17 10" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "15", x2: "12", y2: "3" }))
564
564
  )), s && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-caption" }, s))
565
565
  );
566
- return tt(k, document.body);
566
+ return tt(w, document.body);
567
567
  }
568
568
  function ht(t) {
569
569
  if (!t) return null;
@@ -612,7 +612,7 @@ function _t({
612
612
  onArtifactDetected: r,
613
613
  onArtifactOpen: p,
614
614
  onArtifactCopy: u,
615
- onArtifactDownload: g,
615
+ onArtifactDownload: y,
616
616
  onFormSubmit: c,
617
617
  onFormCancel: b,
618
618
  onFormButtonClick: P,
@@ -621,19 +621,19 @@ function _t({
621
621
  className: E = ""
622
622
  }) {
623
623
  const {
624
- processMessage: k,
624
+ processMessage: w,
625
625
  openArtifact: f,
626
626
  state: v,
627
627
  getTheme: B,
628
628
  instance: V
629
- } = de(), z = W(null), L = W(null), J = W(null), K = W(l), [D, ne] = C(""), [le, fe] = C([]), [te, X] = C(!1), [ae, U] = C(!1), [ie, ee] = C("image"), [oe, i] = C(""), [w, y] = C(""), [N, T] = C(""), Y = M(() => typeof B == "function" ? B() : "dark", [B]), ge = (v == null ? void 0 : v.activeArtifactId) || null, pe = M(() => gt(D), [D]), Ce = M(() => te || s ? "active" : "inactive", [te, s]);
629
+ } = de(), z = W(null), L = W(null), J = W(null), K = W(l), [D, ne] = C(""), [le, fe] = C([]), [te, X] = C(!1), [ae, U] = C(!1), [ie, ee] = C("image"), [oe, i] = C(""), [k, g] = C(""), [N, T] = C(""), Y = M(() => typeof B == "function" ? B() : "dark", [B]), ge = (v == null ? void 0 : v.activeArtifactId) || null, pe = M(() => gt(D), [D]), Ce = M(() => te || s ? "active" : "inactive", [te, s]);
630
630
  q(() => {
631
631
  l && X(!0);
632
632
  }, [l]);
633
633
  const $ = d((h) => {
634
- ee(h.type || "image"), i(h.src || ""), y(h.alt || ""), T(h.caption || ""), U(!0), _ && _(h);
634
+ ee(h.type || "image"), i(h.src || ""), g(h.alt || ""), T(h.caption || ""), U(!0), _ && _(h);
635
635
  }, [_]), Z = d(() => {
636
- U(!1), i(""), y(""), T("");
636
+ U(!1), i(""), g(""), T("");
637
637
  }, []), me = d(() => {
638
638
  if (!L.current) return;
639
639
  L.current.querySelectorAll('img[data-lightbox="true"]').forEach((o) => {
@@ -719,10 +719,10 @@ function _t({
719
719
  }, [V, me]);
720
720
  q(() => {
721
721
  if (t) {
722
- const h = k(t, a);
722
+ const h = w(t, a);
723
723
  ne(h.html), fe(h.artifacts), h.artifacts.length > 0 && r && r(h.artifacts), l || re();
724
724
  }
725
- }, [t, a, k, l, re, r]), q(() => {
725
+ }, [t, a, w, l, re, r]), q(() => {
726
726
  K.current === !0 && l === !1 && re(), K.current = l;
727
727
  }, [l, re]), q(() => (l && X(!0), l || re(), () => {
728
728
  J.current && clearTimeout(J.current), ye();
@@ -732,8 +732,8 @@ function _t({
732
732
  }, [f, p]), _e = d((h) => {
733
733
  u && u(h);
734
734
  }, [u]), Ne = d((h) => {
735
- g && g(h);
736
- }, [g]), Pe = d((h) => {
735
+ y && y(h);
736
+ }, [y]), Pe = d((h) => {
737
737
  c && c(h);
738
738
  }, [c]), Ee = d((h) => {
739
739
  b && b(h);
@@ -803,7 +803,7 @@ function _t({
803
803
  isOpen: ae,
804
804
  type: ie,
805
805
  src: oe,
806
- alt: w,
806
+ alt: k,
807
807
  caption: N,
808
808
  onClose: Z
809
809
  }
@@ -848,13 +848,13 @@ function Pt({
848
848
  activeArtifact: r,
849
849
  artifactCount: p,
850
850
  hasArtifacts: u,
851
- closePanel: g,
851
+ closePanel: y,
852
852
  toggleFullscreen: c,
853
853
  setViewMode: b,
854
854
  getPanelUrl: P,
855
855
  openArtifact: x,
856
856
  instance: _
857
- } = de(), E = W(null), k = W(null), f = W(null), v = W(null), B = W(null), [V, z] = C(!1), [L, J] = C(!1), [K, D] = C(!0), [ne, le] = C(!1), [fe, te] = C(!1), [X, ae] = C(!1), [U, ie] = C(50), [ee, oe] = C(50), i = W(null), w = W(null), y = W(null), N = W(null), T = W(null), Y = M(() => r ? we(r.language) : "", [r]), ge = M(() => r ? ze(r.language) : "", [r]), pe = M(() => r ? P(r) : null, [r, P]), Ce = M(() => r ? Ye(r.language) : "plaintext", [r]), $ = M(() => s.artifacts.filter((m) => !m.isInline), [s.artifacts]), Z = M(() => r ? $.findIndex((m) => m.id === r.id) : -1, [r, $]), me = M(() => {
857
+ } = de(), E = W(null), w = W(null), f = W(null), v = W(null), B = W(null), [V, z] = C(!1), [L, J] = C(!1), [K, D] = C(!0), [ne, le] = C(!1), [fe, te] = C(!1), [X, ae] = C(!1), [U, ie] = C(50), [ee, oe] = C(50), i = W(null), k = W(null), g = W(null), N = W(null), T = W(null), Y = M(() => r ? ke(r.language) : "", [r]), ge = M(() => r ? ze(r.language) : "", [r]), pe = M(() => r ? P(r) : null, [r, P]), Ce = M(() => r ? Ye(r.language) : "plaintext", [r]), $ = M(() => s.artifacts.filter((m) => !m.isInline), [s.artifacts]), Z = M(() => r ? $.findIndex((m) => m.id === r.id) : -1, [r, $]), me = M(() => {
858
858
  var m;
859
859
  return ((m = _ == null ? void 0 : _.config) == null ? void 0 : m.branding) !== !1;
860
860
  }, [_]), ye = M(() => r ? U : Math.min(U, 30), [r, U]), re = d((m) => `<svg viewBox="0 0 24 24" fill="currentColor">${ze(m)}</svg>`, []), Le = d(() => {
@@ -865,12 +865,12 @@ function Pt({
865
865
  `).length, A = Array.from({ length: m }, (G, O) => `<div>${O + 1}</div>`).join("");
866
866
  v.current.innerHTML = A;
867
867
  }, [r]), Ne = d(() => {
868
- k.current && Ge() && (window.Prism.highlightElement(k.current), setTimeout(() => {
868
+ w.current && Ge() && (window.Prism.highlightElement(w.current), setTimeout(() => {
869
869
  Pe();
870
870
  }, 0));
871
871
  }, []), Pe = d(() => {
872
872
  var A;
873
- const m = (A = k.current) == null ? void 0 : A.closest("pre");
873
+ const m = (A = w.current) == null ? void 0 : A.closest("pre");
874
874
  if (m && B.current && v.current) {
875
875
  const O = window.getComputedStyle(m).backgroundColor;
876
876
  O && O !== "rgba(0, 0, 0, 0)" && O !== "transparent" && (B.current.style.backgroundColor = O, v.current.style.backgroundColor = O);
@@ -894,7 +894,7 @@ function Pt({
894
894
  }
895
895
  }, [r]), ve = d(() => {
896
896
  if (!r) return;
897
- const { code: m, language: A, title: G } = r, O = Re(A), he = `${G.toLowerCase().replace(/\s+/g, "-")}.${O}`, ke = new Blob([m], { type: "text/plain" }), se = URL.createObjectURL(ke), Q = document.createElement("a");
897
+ const { code: m, language: A, title: G } = r, O = Re(A), he = `${G.toLowerCase().replace(/\s+/g, "-")}.${O}`, we = new Blob([m], { type: "text/plain" }), se = URL.createObjectURL(we), Q = document.createElement("a");
898
898
  Q.href = se, Q.download = he, document.body.appendChild(Q), Q.click(), document.body.removeChild(Q), URL.revokeObjectURL(se);
899
899
  }, [r]), He = d(async () => {
900
900
  if (!(X || $.length === 0)) {
@@ -908,8 +908,8 @@ function Pt({
908
908
  const qe = A.get(We) || 0;
909
909
  qe > 0 && (We = `${Be}-${qe}.${Fe}`), A.set(`${Be}.${Fe}`, qe + 1), m.file(We, Q.code);
910
910
  }
911
- const G = await m.generateAsync({ type: "blob" }), he = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, ke = URL.createObjectURL(G), se = document.createElement("a");
912
- se.href = ke, se.download = he, document.body.appendChild(se), se.click(), document.body.removeChild(se), URL.revokeObjectURL(ke);
911
+ const G = await m.generateAsync({ type: "blob" }), he = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, we = URL.createObjectURL(G), se = document.createElement("a");
912
+ se.href = we, se.download = he, document.body.appendChild(se), se.click(), document.body.removeChild(se), URL.revokeObjectURL(we);
913
913
  } catch (m) {
914
914
  console.error("Failed to create ZIP:", m);
915
915
  } finally {
@@ -940,7 +940,7 @@ function Pt({
940
940
  }, [S]), j = d((m) => {
941
941
  if (!f.current) return;
942
942
  const A = f.current.getBoundingClientRect();
943
- w.current = {
943
+ k.current = {
944
944
  startX: m.clientX,
945
945
  startPosition: ee,
946
946
  contentLeft: A.left,
@@ -949,11 +949,11 @@ function Pt({
949
949
  G.style.pointerEvents = "none";
950
950
  });
951
951
  }, [ee]), ce = d((m) => {
952
- if (!w.current) return;
953
- const G = (m.clientX - w.current.contentLeft) / w.current.contentWidth * 100;
952
+ if (!k.current) return;
953
+ const G = (m.clientX - k.current.contentLeft) / k.current.contentWidth * 100;
954
954
  oe(Math.min(Math.max(G, 20), 80));
955
955
  }, []), be = d(() => {
956
- w.current = null, document.removeEventListener("mousemove", ce), document.removeEventListener("mouseup", be), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((m) => {
956
+ k.current = null, document.removeEventListener("mousemove", ce), document.removeEventListener("mouseup", be), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((m) => {
957
957
  m.style.pointerEvents = "";
958
958
  });
959
959
  }, [ce]);
@@ -964,7 +964,7 @@ function Pt({
964
964
  }, [s.viewMode, Ee]), q(() => (t && _.on("ai:request", t), a && _.on("save:request", a), n && _.on("export:complete", n), () => {
965
965
  t && _.off("ai:request", t), a && _.off("save:request", a), n && _.off("export:complete", n);
966
966
  }), [_, t, a, n]), q(() => () => {
967
- F(), be(), clearTimeout(y.current), clearTimeout(N.current), clearTimeout(T.current);
967
+ F(), be(), clearTimeout(g.current), clearTimeout(N.current), clearTimeout(T.current);
968
968
  }, [F, be]), !s.isPanelOpen) return null;
969
969
  const Ie = [
970
970
  "artifactuse-panel",
@@ -1043,7 +1043,7 @@ function Pt({
1043
1043
  {
1044
1044
  className: "artifactuse-panel__action artifactuse-panel__action--close",
1045
1045
  title: "Close",
1046
- onClick: g
1046
+ onClick: y
1047
1047
  },
1048
1048
  /* @__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" }))
1049
1049
  ))),
@@ -1060,7 +1060,7 @@ function Pt({
1060
1060
  ref: E,
1061
1061
  src: pe,
1062
1062
  className: `artifactuse-panel__iframe ${K ? "artifactuse-panel__iframe--loading" : ""}`,
1063
- sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-modals",
1063
+ sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads",
1064
1064
  onLoad: Te,
1065
1065
  onError: $e
1066
1066
  }
@@ -1082,7 +1082,7 @@ function Pt({
1082
1082
  /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__code-scroll", ref: B }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__line-numbers", ref: v }), /* @__PURE__ */ e.createElement("pre", { className: "artifactuse-panel__code-block" }, /* @__PURE__ */ e.createElement(
1083
1083
  "code",
1084
1084
  {
1085
- ref: k,
1085
+ ref: w,
1086
1086
  className: `language-${Ce}`
1087
1087
  },
1088
1088
  r.code
@@ -1162,15 +1162,9 @@ function Pt({
1162
1162
  dangerouslySetInnerHTML: { __html: re(m.language) }
1163
1163
  }
1164
1164
  ),
1165
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-title" }, m.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-meta" }, we(m.language), m.lineCount && ` • ${m.lineCount} lines`)),
1165
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__artifact-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-title" }, m.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-meta" }, ke(m.language), m.lineCount && ` • ${m.lineCount} lines`)),
1166
1166
  /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-index" }, A + 1)
1167
1167
  )))))))
1168
- ), s.isFullscreen && /* @__PURE__ */ e.createElement(
1169
- "div",
1170
- {
1171
- className: "artifactuse-panel__backdrop",
1172
- onClick: g
1173
- }
1174
1168
  )) : /* @__PURE__ */ e.createElement("div", { className: Ie, style: s.isFullscreen ? void 0 : { width: `${ye}%` } }, !s.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: o }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle-line" })), /* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header artifactuse-panel__header--simple" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "16 18 22 12 16 6" }), /* @__PURE__ */ e.createElement("polyline", { points: "8 6 2 12 8 18" }))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, "Artifacts"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__meta" }, $.length, " available"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1175
1169
  "button",
1176
1170
  {
@@ -1185,7 +1179,7 @@ function Pt({
1185
1179
  {
1186
1180
  className: "artifactuse-panel__action artifactuse-panel__action--close",
1187
1181
  title: "Close panel",
1188
- onClick: g
1182
+ onClick: y
1189
1183
  },
1190
1184
  /* @__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" }))
1191
1185
  ))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-items" }, $.map((m, A) => /* @__PURE__ */ e.createElement(
@@ -1202,7 +1196,7 @@ function Pt({
1202
1196
  dangerouslySetInnerHTML: { __html: re(m.language) }
1203
1197
  }
1204
1198
  ),
1205
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-title" }, m.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-meta" }, we(m.language), m.lineCount && ` • ${m.lineCount} lines`)),
1199
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__list-item-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-title" }, m.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-meta" }, ke(m.language), m.lineCount && ` • ${m.lineCount} lines`)),
1206
1200
  /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__list-item-arrow" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "9 18 15 12 9 6" })))
1207
1201
  )))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, me && /* @__PURE__ */ e.createElement(
1208
1202
  "a",
@@ -1219,7 +1213,7 @@ function Pt({
1219
1213
  {
1220
1214
  className: "artifactuse-panel__action artifactuse-panel__action--close",
1221
1215
  title: "Close panel",
1222
- onClick: g
1216
+ onClick: y
1223
1217
  },
1224
1218
  /* @__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" }))
1225
1219
  ))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__empty" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__empty-icon" }, /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }, /* @__PURE__ */ e.createElement("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }), /* @__PURE__ */ e.createElement("polyline", { points: "14 2 14 8 20 8" }))), /* @__PURE__ */ e.createElement("h3", { className: "artifactuse-panel__empty-title" }, "No artifacts yet"), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-panel__empty-text" }, "Code blocks, forms, and other interactive content will appear here as the AI generates them.")), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, me && /* @__PURE__ */ e.createElement(
@@ -1277,16 +1271,16 @@ function Nt({ children: t, config: a = {} }) {
1277
1271
  f(), l.destroy();
1278
1272
  };
1279
1273
  }, [l]);
1280
- const g = M(() => s.activeArtifactId && s.artifacts.find((f) => f.id === s.activeArtifactId) || null, [s.artifacts, s.activeArtifactId]), c = s.artifacts.length, b = c > 0, P = M(() => g ? l.getPanelUrl(g) : null, [g, l]), x = d((f) => {
1274
+ const y = M(() => s.activeArtifactId && s.artifacts.find((f) => f.id === s.activeArtifactId) || null, [s.artifacts, s.activeArtifactId]), c = s.artifacts.length, b = c > 0, P = M(() => y ? l.getPanelUrl(y) : null, [y, l]), x = d((f) => {
1281
1275
  l.setTheme(f), l.applyTheme();
1282
1276
  }, [l]), _ = d((f, v) => {
1283
1277
  l.registerPanel(f, v), u(l.getPanelTypes());
1284
1278
  }, [l]), E = d((f) => {
1285
1279
  l.unregisterPanel(f), u(l.getPanelTypes());
1286
- }, [l]), k = M(() => ({
1280
+ }, [l]), w = M(() => ({
1287
1281
  instance: l,
1288
1282
  state: s,
1289
- activeArtifact: g,
1283
+ activeArtifact: y,
1290
1284
  artifactCount: c,
1291
1285
  hasArtifacts: b,
1292
1286
  // Panel computed
@@ -1317,7 +1311,7 @@ function Nt({ children: t, config: a = {} }) {
1317
1311
  }), [
1318
1312
  l,
1319
1313
  s,
1320
- g,
1314
+ y,
1321
1315
  c,
1322
1316
  b,
1323
1317
  p,
@@ -1326,7 +1320,7 @@ function Nt({ children: t, config: a = {} }) {
1326
1320
  _,
1327
1321
  E
1328
1322
  ]);
1329
- return /* @__PURE__ */ e.createElement(Je.Provider, { value: k }, t);
1323
+ return /* @__PURE__ */ e.createElement(Je.Provider, { value: w }, t);
1330
1324
  }
1331
1325
  function de() {
1332
1326
  const t = Ke(Je);
@@ -1343,16 +1337,16 @@ function bt(t, a) {
1343
1337
  };
1344
1338
  }, [t, a, n, l]);
1345
1339
  }
1346
- function kt() {
1340
+ function wt() {
1347
1341
  const {
1348
1342
  registerPanel: t,
1349
1343
  unregisterPanel: a,
1350
1344
  hasPanel: n,
1351
1345
  panelTypes: l,
1352
1346
  instance: s
1353
- } = de(), r = d((u) => n({ type: u }), [n]), p = d((u, g = {}) => {
1347
+ } = de(), r = d((u) => n({ type: u }), [n]), p = d((u, y = {}) => {
1354
1348
  var c;
1355
- return ((c = s.panelResolver) == null ? void 0 : c.resolve(u, g)) || null;
1349
+ return ((c = s.panelResolver) == null ? void 0 : c.resolve(u, y)) || null;
1356
1350
  }, [s]);
1357
1351
  return {
1358
1352
  register: t,
@@ -1367,7 +1361,7 @@ const $t = {
1367
1361
  ArtifactuseProvider: Nt,
1368
1362
  useArtifactuse: de,
1369
1363
  useArtifactuseEvent: bt,
1370
- usePanelRegistry: kt,
1364
+ usePanelRegistry: wt,
1371
1365
  DEFAULT_PANELS: Oe
1372
1366
  };
1373
1367
  export {
@@ -1383,5 +1377,5 @@ export {
1383
1377
  $t as default,
1384
1378
  de as useArtifactuse,
1385
1379
  bt as useArtifactuseEvent,
1386
- kt as usePanelRegistry
1380
+ wt as usePanelRegistry
1387
1381
  };