artifactuse 0.1.12 → 0.1.13

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,31 +1,31 @@
1
1
  import e, { useState as C, useMemo as $, useCallback as d, useRef as W, useEffect as q, createContext as Ke, useContext as Ye } from "react";
2
- import { g as xe, f as Oe, a as ze, b as Re, n as Ge, i as Qe, D as Je, c as et } from "../index-BhIYi_WM.js";
2
+ import { g as Ce, f as Oe, a as ze, b as Re, n as Ge, i as Qe, D as Je, c as et } from "../index-BhIYi_WM.js";
3
3
  import { J as tt } from "../jszip.min-CdmYyw5L.js";
4
4
  import { createPortal as at } from "react-dom";
5
5
  function rt({
6
6
  artifact: t,
7
7
  isActive: a = !1,
8
- onOpen: s,
9
- onCopy: l,
8
+ onOpen: l,
9
+ onCopy: s,
10
10
  onDownload: n,
11
11
  className: r = ""
12
12
  }) {
13
- const [p, u] = C(!1), y = $(() => xe(t.language), [t.language]), c = $(() => {
14
- var w;
15
- return Oe(t.size || ((w = t.code) == null ? void 0 : w.length) || 0);
16
- }, [t.size, t.code]), b = $(() => ze(t.language), [t.language]), P = d((w) => {
17
- w.stopPropagation(), s && s(t);
18
- }, [t, s]), x = d(async (w) => {
19
- w.stopPropagation();
13
+ const [p, u] = C(!1), y = $(() => Ce(t.language), [t.language]), c = $(() => {
14
+ var b;
15
+ return Oe(t.size || ((b = t.code) == null ? void 0 : b.length) || 0);
16
+ }, [t.size, t.code]), w = $(() => ze(t.language), [t.language]), P = d((b) => {
17
+ b.stopPropagation(), l && l(t);
18
+ }, [t, l]), x = d(async (b) => {
19
+ b.stopPropagation();
20
20
  try {
21
- await navigator.clipboard.writeText(t.code), u(!0), l && l(t), setTimeout(() => {
21
+ await navigator.clipboard.writeText(t.code), u(!0), s && s(t), setTimeout(() => {
22
22
  u(!1);
23
23
  }, 2e3);
24
24
  } catch {
25
25
  const E = document.createElement("textarea");
26
26
  E.value = t.code, E.style.position = "fixed", E.style.opacity = "0", document.body.appendChild(E), E.select();
27
27
  try {
28
- document.execCommand("copy"), u(!0), l && l(t), setTimeout(() => {
28
+ document.execCommand("copy"), u(!0), s && s(t), setTimeout(() => {
29
29
  u(!1);
30
30
  }, 2e3);
31
31
  } catch (I) {
@@ -33,9 +33,9 @@ function rt({
33
33
  }
34
34
  document.body.removeChild(E);
35
35
  }
36
- }, [t, l]), N = d((w) => {
36
+ }, [t, s]), N = d((b) => {
37
37
  var L;
38
- w.stopPropagation();
38
+ b.stopPropagation();
39
39
  const f = new Blob([t.code], { type: "text/plain" }), E = URL.createObjectURL(f), I = document.createElement("a"), D = Re(t.language), z = ((L = t.title) == null ? void 0 : L.replace(/[^a-z0-9]/gi, "_").toLowerCase()) || "code";
40
40
  I.href = E, I.download = `${z}.${D}`, document.body.appendChild(I), I.click(), document.body.removeChild(I), URL.revokeObjectURL(E), n && n(t);
41
41
  }, [t, n]), v = [
@@ -50,7 +50,7 @@ function rt({
50
50
  fill: "none",
51
51
  stroke: "currentColor",
52
52
  strokeWidth: "1.5",
53
- dangerouslySetInnerHTML: { __html: b }
53
+ dangerouslySetInnerHTML: { __html: w }
54
54
  }
55
55
  )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__content" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__title" }, t.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-card__meta" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-card__type" }, 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",
@@ -80,10 +80,10 @@ function nt(t) {
80
80
  if (!isNaN(r) && !isNaN(p) && !isNaN(u)) return `${r}, ${p}, ${u}`;
81
81
  }
82
82
  }
83
- const s = a.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
84
- if (s) return `${s[1]}, ${s[2]}, ${s[3]}`;
85
- const l = a.split(/[\s,]+/).map(Number).filter((n) => !isNaN(n));
86
- return l.length >= 3 ? `${l[0]}, ${l[1]}, ${l[2]}` : null;
83
+ const l = a.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
84
+ if (l) return `${l[1]}, ${l[2]}, ${l[3]}`;
85
+ const s = a.split(/[\s,]+/).map(Number).filter((n) => !isNaN(n));
86
+ return s.length >= 3 ? `${s[0]}, ${s[1]}, ${s[2]}` : null;
87
87
  }
88
88
  function Ue(t) {
89
89
  return t ? t.map((a) => typeof a == "string" ? { label: a, value: a } : a) : [];
@@ -94,8 +94,8 @@ function st(t) {
94
94
  function lt({
95
95
  artifact: t,
96
96
  onSubmit: a,
97
- onCancel: s,
98
- onReset: l,
97
+ onCancel: l,
98
+ onReset: s,
99
99
  onButtonClick: n,
100
100
  className: r = "",
101
101
  theme: p = "dark",
@@ -103,14 +103,14 @@ function lt({
103
103
  initialState: y = "active"
104
104
  // 'active' | 'submitted' | 'cancelled' | 'inactive'
105
105
  }) {
106
- var ce, te, ie;
107
- const c = W(null), [b, P] = C(y), x = b !== "active", N = b === "active" ? "" : `artifactuse-form--${b}`, v = $(() => {
106
+ var ie, te, oe;
107
+ const c = W(null), [w, P] = C(y), x = w !== "active", N = w === "active" ? "" : `artifactuse-form--${w}`, v = $(() => {
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]), w = t.id || v.id || `form-${Date.now()}`, f = ((ce = v.data) == null ? void 0 : ce.fields) || [], E = v.title || "Form", I = $(() => f.some((i) => i.type === "buttons"), [f]), D = $(() => v.variant === "buttons" ? f : [], [v.variant, f]), [z, L] = C(() => {
113
+ }, [t.code]), b = t.id || v.id || `form-${Date.now()}`, f = ((ie = v.data) == null ? void 0 : ie.fields) || [], E = v.title || "Form", I = $(() => f.some((i) => i.type === "buttons"), [f]), D = $(() => v.variant === "buttons" ? f : [], [v.variant, f]), [z, L] = C(() => {
114
114
  var k;
115
115
  const i = {};
116
116
  return f.forEach((g) => {
@@ -133,7 +133,7 @@ function lt({
133
133
  }, [p, u]);
134
134
  const ee = d((i) => {
135
135
  P(i);
136
- }, []), de = d((i, k) => {
136
+ }, []), fe = d((i, k) => {
137
137
  L((g) => ({ ...g, [i]: k })), K((g) => {
138
138
  const _ = { ...g };
139
139
  return delete _[i], _;
@@ -177,24 +177,24 @@ function lt({
177
177
  f.forEach((g) => {
178
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
179
  }), (k = v.data) != null && k.defaults && Object.assign(i, v.data.defaults), L(i), K({});
180
- }, [f, (ie = v.data) == null ? void 0 : ie.defaults]), re = d((i) => {
180
+ }, [f, (oe = v.data) == null ? void 0 : oe.defaults]), re = d((i) => {
181
181
  i == null || i.preventDefault(), ae() && (le(!0), a == null || a({
182
- formId: w,
182
+ formId: b,
183
183
  action: "submit",
184
184
  values: { ...z },
185
185
  timestamp: Date.now()
186
186
  }), setTimeout(() => {
187
187
  le(!1), ee("submitted");
188
188
  }, 300));
189
- }, [w, z, a, ae, ee]), j = d((i) => {
189
+ }, [b, z, a, ae, ee]), j = d((i) => {
190
190
  const k = i.action || "custom";
191
191
  switch (k) {
192
192
  case "submit":
193
193
  re();
194
194
  break;
195
195
  case "cancel":
196
- s == null || s({
197
- formId: w,
196
+ l == null || l({
197
+ formId: b,
198
198
  action: "cancel",
199
199
  buttonName: i.name || "cancel",
200
200
  timestamp: Date.now()
@@ -203,8 +203,8 @@ function lt({
203
203
  }, 150);
204
204
  break;
205
205
  case "reset":
206
- X(), l == null || l({
207
- formId: w,
206
+ X(), s == null || s({
207
+ formId: b,
208
208
  action: "reset",
209
209
  buttonName: i.name || "reset",
210
210
  timestamp: Date.now()
@@ -213,7 +213,7 @@ function lt({
213
213
  case "custom":
214
214
  default:
215
215
  n == null || n({
216
- formId: w,
216
+ formId: b,
217
217
  action: k,
218
218
  buttonName: i.name || i.label,
219
219
  buttonLabel: i.label,
@@ -224,7 +224,7 @@ function lt({
224
224
  }, 150);
225
225
  break;
226
226
  }
227
- }, [w, z, re, s, l, n, X, ee]);
227
+ }, [b, z, re, l, s, n, X, ee]);
228
228
  return x ? /* @__PURE__ */ e.createElement(
229
229
  "div",
230
230
  {
@@ -232,7 +232,7 @@ function lt({
232
232
  className: `artifactuse-inline-form artifactuse-form-${v.variant || "fields"} ${N} ${r}`,
233
233
  "data-artifactuse-theme": p
234
234
  },
235
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed-icon" }, b === "submitted" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("polyline", { points: "20 6 9 17 4 12" })), b === "cancelled" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })), b === "inactive" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("line", { x1: "5", y1: "12", x2: "19", y2: "12" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-collapsed-title" }, E))
235
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-collapsed-icon" }, w === "submitted" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("polyline", { points: "20 6 9 17 4 12" })), w === "cancelled" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), /* @__PURE__ */ e.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })), w === "inactive" && /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("line", { x1: "5", y1: "12", x2: "19", y2: "12" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-form-collapsed-title" }, E))
236
236
  ) : v.variant === "buttons" ? /* @__PURE__ */ e.createElement(
237
237
  "div",
238
238
  {
@@ -266,11 +266,11 @@ function lt({
266
266
  {
267
267
  key: i.name || k,
268
268
  field: i,
269
- formId: w,
269
+ formId: b,
270
270
  value: z[i.name],
271
271
  error: J[i.name],
272
272
  isSubmitting: U,
273
- onChange: (g) => de(i.name, g),
273
+ onChange: (g) => fe(i.name, g),
274
274
  onButtonAction: j
275
275
  }
276
276
  ))), !I && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons artifactuse-form-buttons-default" }, /* @__PURE__ */ e.createElement(
@@ -293,13 +293,13 @@ function lt({
293
293
  )))
294
294
  );
295
295
  }
296
- function ct({ field: t, formId: a, value: s, error: l, isSubmitting: n, onChange: r, onButtonAction: p }) {
296
+ function ct({ field: t, formId: a, value: l, error: s, isSubmitting: n, onChange: r, onButtonAction: p }) {
297
297
  const u = `${a}-${t.name}`;
298
298
  if (t.type === "buttons")
299
- return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, (t.fields || []).map((c, b) => /* @__PURE__ */ e.createElement(
299
+ return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-buttons" }, (t.fields || []).map((c, w) => /* @__PURE__ */ e.createElement(
300
300
  "button",
301
301
  {
302
- key: c.name || c.label || b,
302
+ key: c.name || c.label || w,
303
303
  type: c.action === "submit" ? "submit" : "button",
304
304
  className: `artifactuse-form-btn artifactuse-form-btn-${c.variant || "secondary"}`,
305
305
  onClick: c.action !== "submit" ? () => p(c) : void 0,
@@ -319,12 +319,12 @@ function ct({ field: t, formId: a, value: s, error: l, isSubmitting: n, onChange
319
319
  type: "checkbox",
320
320
  id: u,
321
321
  name: t.name,
322
- checked: s || !1,
322
+ checked: l || !1,
323
323
  disabled: t.disabled,
324
324
  className: "artifactuse-checkbox",
325
325
  onChange: (c) => r(c.target.checked)
326
326
  }
327
- ), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-checkbox-text" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*"))), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), l && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, l));
327
+ ), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-checkbox-text" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*"))), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), s && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, s));
328
328
  if (t.type === "radio")
329
329
  return /* @__PURE__ */ e.createElement("div", { className: "artifactuse-form-field" }, t.label && /* @__PURE__ */ e.createElement("label", { className: "artifactuse-label" }, t.label, t.required && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-required" }, "*")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-radio-group" }, Ue(t.options).map((c) => /* @__PURE__ */ e.createElement("label", { key: c.value, className: "artifactuse-radio-label" }, /* @__PURE__ */ e.createElement(
330
330
  "input",
@@ -332,19 +332,19 @@ function ct({ field: t, formId: a, value: s, error: l, isSubmitting: n, onChange
332
332
  type: "radio",
333
333
  name: t.name,
334
334
  value: c.value,
335
- checked: s === c.value,
335
+ checked: l === c.value,
336
336
  disabled: c.disabled || t.disabled,
337
337
  className: "artifactuse-radio",
338
338
  onChange: () => r(c.value)
339
339
  }
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));
340
+ ), /* @__PURE__ */ e.createElement("span", null, c.label)))), t.helpText && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-help-text" }, t.helpText), s && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, s));
341
341
  const y = () => st(t.type) ? /* @__PURE__ */ e.createElement(
342
342
  "input",
343
343
  {
344
344
  type: t.type,
345
345
  id: u,
346
346
  name: t.name,
347
- value: s || "",
347
+ value: l || "",
348
348
  placeholder: t.placeholder,
349
349
  disabled: t.disabled,
350
350
  required: t.required,
@@ -356,7 +356,7 @@ function ct({ field: t, formId: a, value: s, error: l, isSubmitting: n, onChange
356
356
  {
357
357
  id: u,
358
358
  name: t.name,
359
- value: s || "",
359
+ value: l || "",
360
360
  placeholder: t.placeholder,
361
361
  disabled: t.disabled,
362
362
  required: t.required,
@@ -369,7 +369,7 @@ function ct({ field: t, formId: a, value: s, error: l, isSubmitting: n, onChange
369
369
  {
370
370
  id: u,
371
371
  name: t.name,
372
- value: s || "",
372
+ value: l || "",
373
373
  disabled: t.disabled,
374
374
  required: t.required,
375
375
  className: "artifactuse-select",
@@ -383,13 +383,13 @@ function ct({ field: t, formId: a, value: s, error: l, isSubmitting: n, onChange
383
383
  type: "text",
384
384
  id: u,
385
385
  name: t.name,
386
- value: s || "",
386
+ value: l || "",
387
387
  disabled: t.disabled,
388
388
  className: "artifactuse-input",
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" }, "*")), y(), 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), s && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-error-text" }, s));
393
393
  }
394
394
  const V = '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>', it = {
395
395
  twitter: 280,
@@ -407,59 +407,59 @@ const V = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0
407
407
  threads: "Threads",
408
408
  tiktok: "TikTok",
409
409
  youtube: "YouTube"
410
- }, Ce = ({ type: t = "blue" }) => /* @__PURE__ */ e.createElement("svg", { className: `artifactuse-social-verified artifactuse-social-verified-${t}`, viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ e.createElement("path", { d: "M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.34 2.19c-1.39-.46-2.9-.2-3.91.81s-1.27 2.52-.81 3.91C2.63 9.33 1.75 10.57 1.75 12s.88 2.67 2.19 3.34c-.46 1.39-.2 2.9.81 3.91s2.52 1.27 3.91.81c.66 1.31 1.91 2.19 3.34 2.19s2.67-.88 3.34-2.19c1.39.46 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z" })), F = (t) => t ? t >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : t >= 1e3 ? `${(t / 1e3).toFixed(1)}K` : t.toString() : "0", Ve = (t) => {
410
+ }, Le = ({ type: t = "blue" }) => /* @__PURE__ */ e.createElement("svg", { className: `artifactuse-social-verified artifactuse-social-verified-${t}`, viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ e.createElement("path", { d: "M22.25 12c0-1.43-.88-2.67-2.19-3.34.46-1.39.2-2.9-.81-3.91s-2.52-1.27-3.91-.81c-.66-1.31-1.91-2.19-3.34-2.19s-2.67.88-3.34 2.19c-1.39-.46-2.9-.2-3.91.81s-1.27 2.52-.81 3.91C2.63 9.33 1.75 10.57 1.75 12s.88 2.67 2.19 3.34c-.46 1.39-.2 2.9.81 3.91s2.52 1.27 3.91.81c.66 1.31 1.91 2.19 3.34 2.19s2.67-.88 3.34-2.19c1.39.46 2.9.2 3.91-.81s1.27-2.52.81-3.91c1.31-.67 2.19-1.91 2.19-3.34zm-11.71 4.2L6.8 12.46l1.41-1.42 2.26 2.26 4.8-5.23 1.47 1.36-6.2 6.77z" })), F = (t) => t ? t >= 1e6 ? `${(t / 1e6).toFixed(1)}M` : t >= 1e3 ? `${(t / 1e3).toFixed(1)}K` : t.toString() : "0", Ve = (t) => {
411
411
  try {
412
412
  return new URL(t).hostname.replace("www.", "");
413
413
  } catch {
414
414
  return t;
415
415
  }
416
- }, me = (t) => {
416
+ }, ue = (t) => {
417
417
  if (!t) return "";
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
- }, je = ({ author: t, content: a, engagement: s, meta: l }) => {
420
+ }, je = ({ author: t, content: a, engagement: l, meta: s }) => {
421
421
  var p, u, y;
422
- const n = a.media || [], r = s.likes || s.retweets || s.replies || s.views;
423
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (c) => c.target.src = V }), /* @__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(Ce, { 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: me(a.text) } }), n.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social-media-grid ${n.length === 1 ? "artifactuse-social-media-single" : ""}`, "data-count": n.length }, n.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 && !n.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) => {
422
+ const n = a.media || [], r = l.likes || l.retweets || l.replies || l.views;
423
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (c) => c.target.src = V }), /* @__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(Le, { 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" }, "· ", s.timestamp || "Just now")))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ue(a.text) } }), n.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: `artifactuse-social-media-grid ${n.length === 1 ? "artifactuse-social-media-single" : ""}`, "data-count": n.length }, n.slice(0, 4).map((c, w) => /* @__PURE__ */ e.createElement("img", { key: w, src: c.url, alt: c.alt || "", onError: (P) => P.target.style.display = "none" })))), a.link && !n.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, w) => {
424
424
  var P, x;
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" }, F(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) || V, 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, F(s.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, F(s.retweets || 0), " reposts"), /* @__PURE__ */ e.createElement("span", null, F(s.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, F(s.views || 0), " views")));
427
- }, mt = ({ author: t, content: a, engagement: s, meta: l }) => {
428
- const n = s.likes || s.comments || s.shares || s.reposts;
429
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = V }), /* @__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: me(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))))), n && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, F(s.likes || 0), " reactions"), /* @__PURE__ */ e.createElement("span", null, F(s.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, F(s.shares || s.reposts || 0), " reposts")));
430
- }, ut = ({ author: t, content: a, engagement: s, meta: l }) => {
425
+ return /* @__PURE__ */ e.createElement("div", { key: w, className: "artifactuse-social-poll-option" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-bar", style: { width: `${((P = a.poll.votes) == null ? void 0 : P[w]) || 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[w]) || 0, "%")));
426
+ }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-poll-meta" }, F(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) || V, 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, F(l.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, F(l.retweets || 0), " reposts"), /* @__PURE__ */ e.createElement("span", null, F(l.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, F(l.views || 0), " views")));
427
+ }, mt = ({ author: t, content: a, engagement: l, meta: s }) => {
428
+ const n = l.likes || l.comments || l.shares || l.reposts;
429
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = V }), /* @__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" }, s.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))))), n && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, F(l.likes || 0), " reactions"), /* @__PURE__ */ e.createElement("span", null, F(l.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, F(l.shares || l.reposts || 0), " reposts")));
430
+ }, ut = ({ author: t, content: a, engagement: l, meta: s }) => {
431
431
  const n = a.media || [];
432
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = V }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Ce, { type: "blue" })), l.location && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-location" }, l.location))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, n[0] ? /* @__PURE__ */ e.createElement("img", { src: n[0].url, alt: n[0].alt || "", onError: (r) => r.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-placeholder" })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-likes" }, F(s.likes || 0), " likes"), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-caption" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-author" }, t.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-text", dangerouslySetInnerHTML: { __html: me(a.text) } })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, l.timestamp || "JUST NOW"));
433
- }, dt = ({ author: t, content: a, engagement: s, meta: l }) => {
432
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = V }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Le, { type: "blue" })), s.location && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-location" }, s.location))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, n[0] ? /* @__PURE__ */ e.createElement("img", { src: n[0].url, alt: n[0].alt || "", onError: (r) => r.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-placeholder" })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-likes" }, F(l.likes || 0), " likes"), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-caption" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-author" }, t.name), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-caption-text", dangerouslySetInnerHTML: { __html: ue(a.text) } })), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-timestamp" }, s.timestamp || "JUST NOW"));
433
+ }, dt = ({ author: t, content: a, engagement: l, meta: s }) => {
434
434
  const n = a.media || [], r = $(() => {
435
- const u = s.reactions || {};
436
- return Object.values(u).reduce((y, c) => y + (c || 0), 0) || s.likes || 0;
437
- }, [s]), p = s.likes || s.comments || s.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 || V, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = V }), /* @__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: me(a.text) } }), n.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-grid", "data-count": n.length }, n.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 && !n.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, "👍❤️ ", F(r)), /* @__PURE__ */ e.createElement("span", null, F(s.comments || 0), " comments · ", F(s.shares || 0), " shares")));
439
- }, ft = ({ author: t, content: a, engagement: s, meta: l }) => {
440
- const n = s.likes || s.replies || s.reposts;
441
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = V }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Ce, { 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: me(a.text) } })), n && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, F(s.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, F(s.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, F(s.reposts || 0), " reposts")));
442
- }, pt = ({ author: t, content: a, engagement: s, meta: l }) => {
443
- const n = a.media || [], r = s.likes || s.comments || s.shares;
444
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, n[0] ? /* @__PURE__ */ e.createElement("img", { src: n[0].url, alt: "Video thumbnail", onError: (p) => p.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), a.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, a.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (p) => p.target.src = V }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-name" }, "@", t.name), t.verified && /* @__PURE__ */ e.createElement(Ce, { type: "blue" })), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: me(a.text) } }), a.sound && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-sound" }, "🎵 ", a.sound)), r && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, F(s.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, F(s.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, F(s.shares || 0), " shares")));
445
- }, Et = ({ author: t, content: a, engagement: s, meta: l }) => {
435
+ const u = l.reactions || {};
436
+ return Object.values(u).reduce((y, c) => y + (c || 0), 0) || l.likes || 0;
437
+ }, [l]), p = l.likes || l.comments || l.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 || V, alt: t.name, className: "artifactuse-social-avatar", onError: (u) => u.target.src = V }), /* @__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" }, s.timestamp || "Just now", " · 🌐"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ue(a.text) } }), n.length > 0 && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-media-grid", "data-count": n.length }, n.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 && !n.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, "👍❤️ ", F(r)), /* @__PURE__ */ e.createElement("span", null, F(l.comments || 0), " comments · ", F(l.shares || 0), " shares")));
439
+ }, ft = ({ author: t, content: a, engagement: l, meta: s }) => {
440
+ const n = l.likes || l.replies || l.reposts;
441
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = V }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-author-name" }, t.name, t.verified && /* @__PURE__ */ e.createElement(Le, { type: "blue" }))), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-timestamp" }, s.timestamp || "Just now")), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-content" }, /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ue(a.text) } })), n && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, F(l.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, F(l.replies || 0), " replies"), /* @__PURE__ */ e.createElement("span", null, F(l.reposts || 0), " reposts")));
442
+ }, pt = ({ author: t, content: a, engagement: l, meta: s }) => {
443
+ const n = a.media || [], r = l.likes || l.comments || l.shares;
444
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, n[0] ? /* @__PURE__ */ e.createElement("img", { src: n[0].url, alt: "Video thumbnail", onError: (p) => p.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), a.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, a.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-header" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (p) => p.target.src = V }), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-social-author-name" }, "@", t.name), t.verified && /* @__PURE__ */ e.createElement(Le, { type: "blue" })), /* @__PURE__ */ e.createElement("p", { className: "artifactuse-social-text", dangerouslySetInnerHTML: { __html: ue(a.text) } }), a.sound && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-sound" }, "🎵 ", a.sound)), r && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-engagement" }, /* @__PURE__ */ e.createElement("span", null, F(l.likes || 0), " likes"), /* @__PURE__ */ e.createElement("span", null, F(l.comments || 0), " comments"), /* @__PURE__ */ e.createElement("span", null, F(l.shares || 0), " shares")));
445
+ }, Et = ({ author: t, content: a, engagement: l, meta: s }) => {
446
446
  const n = a.media || [];
447
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, n[0] ? /* @__PURE__ */ e.createElement("img", { src: n[0].url, alt: "Video thumbnail", onError: (r) => r.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), a.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, a.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = V }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-details" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-title" }, a.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-channel" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-meta" }, F(s.views || 0), " views · ", l.timestamp || "Just now"))));
447
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail" }, n[0] ? /* @__PURE__ */ e.createElement("img", { src: n[0].url, alt: "Video thumbnail", onError: (r) => r.target.style.display = "none" }) : /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-thumbnail-placeholder" }), a.duration && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-duration" }, a.duration)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-info" }, /* @__PURE__ */ e.createElement("img", { src: t.avatar || V, alt: t.name, className: "artifactuse-social-avatar", onError: (r) => r.target.src = V }), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-details" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-title" }, a.title), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-channel" }, t.name), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-meta" }, F(l.views || 0), " views · ", s.timestamp || "Just now"))));
448
448
  };
449
- function vt({ artifact: t, theme: a = "dark", onCopy: s }) {
450
- const [l, n] = C("Copy"), r = $(() => {
449
+ function vt({ artifact: t, theme: a = "dark", onCopy: l }) {
450
+ const [s, n] = C("Copy"), r = $(() => {
451
451
  try {
452
452
  return JSON.parse(t.code);
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: y = {}, content: c = {}, engagement: b = {}, meta: P = {} } = u, x = it[p] || 280, N = (c.text || "").length, v = N > x ? "error" : N > x * 0.9 ? "warning" : "", w = d(() => {
456
+ }, [t.code]), p = (r == null ? void 0 : r.platform) || "twitter", u = (r == null ? void 0 : r.data) || {}, { author: y = {}, content: c = {}, engagement: w = {}, meta: P = {} } = u, x = it[p] || 280, N = (c.text || "").length, v = N > x ? "error" : N > x * 0.9 ? "warning" : "", b = d(() => {
457
457
  const E = c.text || "";
458
458
  navigator.clipboard.writeText(E).then(() => {
459
- n("Copied!"), setTimeout(() => n("Copy"), 2e3), s == null || s({ platform: p, text: E });
459
+ n("Copied!"), setTimeout(() => n("Copy"), 2e3), l == null || l({ platform: p, text: E });
460
460
  });
461
- }, [c.text, p, s]), f = () => {
462
- const E = { author: y, content: c, engagement: b, meta: P };
461
+ }, [c.text, p, l]), f = () => {
462
+ const E = { author: y, content: c, engagement: w, meta: P };
463
463
  switch (p) {
464
464
  case "twitter":
465
465
  return /* @__PURE__ */ e.createElement(je, { ...E });
@@ -479,18 +479,18 @@ function vt({ artifact: t, theme: a = "dark", onCopy: s }) {
479
479
  return /* @__PURE__ */ e.createElement(je, { ...E });
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, ot[p] || p)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-right" }, /* @__PURE__ */ e.createElement("span", { className: `artifactuse-social-char-counter ${v}` }, N, "/", x), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-social-copy-btn", onClick: w }, 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, ot[p] || p)), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-social-actions-right" }, /* @__PURE__ */ e.createElement("span", { className: `artifactuse-social-char-counter ${v}` }, N, "/", x), /* @__PURE__ */ e.createElement("button", { className: "artifactuse-social-copy-btn", onClick: b }, s))));
483
483
  }
484
484
  function ht({
485
485
  isOpen: t = !1,
486
486
  type: a = "image",
487
- src: s = "",
488
- alt: l = "",
487
+ src: l = "",
488
+ alt: s = "",
489
489
  caption: n = "",
490
490
  onClose: r,
491
491
  className: p = ""
492
492
  }) {
493
- const u = W(null), [y, c] = C(!1), [b, P] = C(!1);
493
+ const u = W(null), [y, c] = C(!1), [w, 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)), () => {
@@ -508,11 +508,11 @@ function ht({
508
508
  a === "image" && c((f) => !f);
509
509
  }, [a]), v = d(() => {
510
510
  const f = document.createElement("a");
511
- f.href = s, f.download = l || "download", document.body.appendChild(f), f.click(), document.body.removeChild(f);
512
- }, [s, l]);
513
- if (!t || !b)
511
+ f.href = l, f.download = s || "download", document.body.appendChild(f), f.click(), document.body.removeChild(f);
512
+ }, [l, s]);
513
+ if (!t || !w)
514
514
  return null;
515
- const w = /* @__PURE__ */ e.createElement(
515
+ const b = /* @__PURE__ */ e.createElement(
516
516
  "div",
517
517
  {
518
518
  ref: u,
@@ -525,17 +525,17 @@ function ht({
525
525
  /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-content", onClick: (f) => f.stopPropagation() }, a === "image" && /* @__PURE__ */ e.createElement(
526
526
  "img",
527
527
  {
528
- src: s,
529
- alt: l,
528
+ src: l,
529
+ alt: s,
530
530
  className: `artifactuse-viewer-image ${y ? "artifactuse-viewer-image--zoomed" : ""}`,
531
531
  onClick: N
532
532
  }
533
533
  ), a === "pdf" && /* @__PURE__ */ e.createElement(
534
534
  "iframe",
535
535
  {
536
- src: s,
536
+ src: l,
537
537
  className: "artifactuse-viewer-pdf",
538
- title: l || "PDF Viewer"
538
+ title: s || "PDF Viewer"
539
539
  }
540
540
  ), /* @__PURE__ */ e.createElement(
541
541
  "button",
@@ -563,7 +563,7 @@ function ht({
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
  )), n && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-viewer-caption" }, n))
565
565
  );
566
- return at(w, document.body);
566
+ return at(b, document.body);
567
567
  }
568
568
  function gt(t) {
569
569
  if (!t) return null;
@@ -572,29 +572,29 @@ function gt(t) {
572
572
  return JSON.parse(a);
573
573
  } catch {
574
574
  try {
575
- const s = t.replace(/&#10;/g, `
575
+ const l = t.replace(/&#10;/g, `
576
576
  `).replace(/&#13;/g, "\r").replace(/&#9;/g, " ").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
577
- return JSON.parse(s);
578
- } catch (s) {
579
- return console.error("Failed to parse artifact data:", s), null;
577
+ return JSON.parse(l);
578
+ } catch (l) {
579
+ return console.error("Failed to parse artifact data:", l), null;
580
580
  }
581
581
  }
582
582
  }
583
583
  function yt(t) {
584
584
  const a = [];
585
585
  if (!t) return a;
586
- const s = /<div\s+class="artifactuse-placeholder[^"]*"[^>]*data-artifact-id="([^"]+)"[^>]*data-artifact-type="([^"]+)"[^>]*data-artifact=["']([^"']*)["'][^>]*><\/div>/gi;
587
- let l = 0, n;
588
- for (; (n = s.exec(t)) !== null; ) {
589
- if (n.index > l) {
590
- const u = t.slice(l, n.index);
586
+ const l = /<div\s+class="artifactuse-placeholder[^"]*"[^>]*data-artifact-id="([^"]+)"[^>]*data-artifact-type="([^"]+)"[^>]*data-artifact=["']([^"']*)["'][^>]*><\/div>/gi;
587
+ let s = 0, n;
588
+ for (; (n = l.exec(t)) !== null; ) {
589
+ if (n.index > s) {
590
+ const u = t.slice(s, n.index);
591
591
  u.trim() && a.push({ type: "html", content: u });
592
592
  }
593
593
  const r = gt(n[3]), p = n[2];
594
- r && (p === "form" && r.isInline ? a.push({ type: "form", artifact: r }) : p === "social" ? a.push({ type: "social", artifact: r }) : a.push({ type: "panel", artifact: r })), l = n.index + n[0].length;
594
+ r && (p === "form" && r.isInline ? a.push({ type: "form", artifact: r }) : p === "social" ? a.push({ type: "social", artifact: r }) : a.push({ type: "panel", artifact: r })), s = n.index + n[0].length;
595
595
  }
596
- if (l < t.length) {
597
- const r = t.slice(l);
596
+ if (s < t.length) {
597
+ const r = t.slice(s);
598
598
  r.trim() && a.push({ type: "html", content: r });
599
599
  }
600
600
  return a.length === 0 && t.trim() && a.push({ type: "html", content: t }), a;
@@ -605,8 +605,8 @@ function _t() {
605
605
  function Nt({
606
606
  content: t,
607
607
  messageId: a = _t(),
608
- inlineCards: s = !0,
609
- typing: l = !1,
608
+ inlineCards: l = !0,
609
+ typing: s = !1,
610
610
  isLastMessage: n = !1,
611
611
  // Whether this is the last/most recent message
612
612
  onArtifactDetected: r,
@@ -614,27 +614,27 @@ function Nt({
614
614
  onArtifactCopy: u,
615
615
  onArtifactDownload: y,
616
616
  onFormSubmit: c,
617
- onFormCancel: b,
617
+ onFormCancel: w,
618
618
  onFormButtonClick: P,
619
619
  onSocialCopy: x,
620
620
  onMediaOpen: N,
621
621
  className: v = ""
622
622
  }) {
623
623
  const {
624
- processMessage: w,
624
+ processMessage: b,
625
625
  openArtifact: f,
626
626
  state: E,
627
627
  getTheme: I,
628
628
  instance: D
629
- } = ue(), z = W(null), L = W(null), J = W(null), K = W(l), [U, le] = C(""), [ee, de] = C([]), [ae, X] = C(!1), [re, j] = C(!1), [ce, te] = C("image"), [ie, i] = C(""), [k, g] = C(""), [_, M] = C(""), Y = $(() => typeof I == "function" ? I() : "dark", [I]), ge = (E == null ? void 0 : E.activeArtifactId) || null, fe = $(() => yt(U), [U]), Le = $(() => ae || n ? "active" : "inactive", [ae, n]);
629
+ } = de(), z = W(null), L = W(null), J = W(null), K = W(s), [U, le] = C(""), [ee, fe] = C([]), [ae, X] = C(!1), [re, j] = C(!1), [ie, te] = C("image"), [oe, i] = C(""), [k, g] = C(""), [_, M] = C(""), Y = $(() => typeof I == "function" ? I() : "dark", [I]), ye = (E == null ? void 0 : E.activeArtifactId) || null, pe = $(() => yt(U), [U]), ce = $(() => ae || n ? "active" : "inactive", [ae, n]);
630
630
  q(() => {
631
- l && X(!0);
632
- }, [l]);
631
+ s && X(!0);
632
+ }, [s]);
633
633
  const T = d((h) => {
634
634
  te(h.type || "image"), i(h.src || ""), g(h.alt || ""), M(h.caption || ""), j(!0), N && N(h);
635
635
  }, [N]), Z = d(() => {
636
636
  j(!1), i(""), g(""), M("");
637
- }, []), oe = d(() => {
637
+ }, []), me = d(() => {
638
638
  if (!L.current) return;
639
639
  L.current.querySelectorAll('img[data-lightbox="true"]').forEach((o) => {
640
640
  o._lightboxHandler && o.removeEventListener("click", o._lightboxHandler), o._lightboxHandler = (S) => {
@@ -648,23 +648,23 @@ function Nt({
648
648
  }), L.current.querySelectorAll(".artifactuse-image-container img").forEach((o) => {
649
649
  o._lightboxHandler || (o._lightboxHandler = (S) => {
650
650
  S.preventDefault(), S.stopPropagation();
651
- const B = o.closest(".artifactuse-image-container"), R = B == null ? void 0 : B.querySelector(".artifactuse-image-caption"), ve = (R == null ? void 0 : R.textContent) || o.dataset.caption || o.alt || "";
651
+ const B = o.closest(".artifactuse-image-container"), R = B == null ? void 0 : B.querySelector(".artifactuse-image-caption"), he = (R == null ? void 0 : R.textContent) || o.dataset.caption || o.alt || "";
652
652
  T({
653
653
  type: "image",
654
654
  src: o.src,
655
655
  alt: o.alt || "",
656
- caption: ve
656
+ caption: he
657
657
  });
658
658
  }, o.addEventListener("click", o._lightboxHandler), o.style.cursor = "zoom-in");
659
659
  }), L.current.querySelectorAll(".artifactuse-gallery-item img, .artifactuse-image-gallery img").forEach((o) => {
660
660
  o._lightboxHandler || (o._lightboxHandler = (S) => {
661
661
  S.preventDefault(), S.stopPropagation();
662
- const B = o.closest(".artifactuse-gallery-item"), R = B == null ? void 0 : B.querySelector(".artifactuse-gallery-caption"), ve = (R == null ? void 0 : R.textContent) || o.dataset.caption || o.alt || "";
662
+ const B = o.closest(".artifactuse-gallery-item"), R = B == null ? void 0 : B.querySelector(".artifactuse-gallery-caption"), he = (R == null ? void 0 : R.textContent) || o.dataset.caption || o.alt || "";
663
663
  T({
664
664
  type: "image",
665
665
  src: o.src,
666
666
  alt: o.alt || "",
667
- caption: ve
667
+ caption: he
668
668
  });
669
669
  }, o.addEventListener("click", o._lightboxHandler), o.style.cursor = "zoom-in");
670
670
  }), L.current.querySelectorAll('a[href$=".pdf"], a[data-type="pdf"]').forEach((o) => {
@@ -695,7 +695,7 @@ function Nt({
695
695
  B && window.open(B, "_blank", "noopener,noreferrer");
696
696
  }, o.addEventListener("click", o._clickHandler);
697
697
  });
698
- }, [T]), ye = d(() => {
698
+ }, [T]), _e = d(() => {
699
699
  if (!L.current) return;
700
700
  L.current.querySelectorAll("img").forEach((H) => {
701
701
  H._lightboxHandler && (H.removeEventListener("click", H._lightboxHandler), delete H._lightboxHandler);
@@ -714,40 +714,40 @@ function Nt({
714
714
  } catch (h) {
715
715
  console.error("Failed to initialize content:", h);
716
716
  }
717
- oe();
717
+ me();
718
718
  }, 100);
719
- }, [D, oe]);
719
+ }, [D, me]);
720
720
  q(() => {
721
721
  if (t) {
722
- const h = w(t, a);
723
- le(h.html), de(h.artifacts), h.artifacts.length > 0 && r && r(h.artifacts), l || ne();
722
+ const h = b(t, a);
723
+ le(h.html), fe(h.artifacts), h.artifacts.length > 0 && r && r(h.artifacts), s || ne();
724
724
  }
725
- }, [t, a, w, l, ne, r]), q(() => {
726
- K.current === !0 && l === !1 && ne(), K.current = l;
727
- }, [l, ne]), q(() => (l && X(!0), l || ne(), () => {
728
- J.current && clearTimeout(J.current), ye();
725
+ }, [t, a, b, s, ne, r]), q(() => {
726
+ K.current === !0 && s === !1 && ne(), K.current = s;
727
+ }, [s, ne]), q(() => (s && X(!0), s || ne(), () => {
728
+ J.current && clearTimeout(J.current), _e();
729
729
  }), []);
730
730
  const Pe = d((h) => {
731
731
  f(h), p && p(h);
732
- }, [f, p]), _e = d((h) => {
732
+ }, [f, p]), Ne = d((h) => {
733
733
  u && u(h);
734
- }, [u]), Ne = d((h) => {
734
+ }, [u]), be = d((h) => {
735
735
  y && y(h);
736
736
  }, [y]), Te = d((h) => {
737
737
  c && c(h);
738
- }, [c]), be = d((h) => {
739
- b && b(h);
740
- }, [b]), pe = d((h) => {
738
+ }, [c]), we = d((h) => {
739
+ w && w(h);
740
+ }, [w]), Ee = d((h) => {
741
741
  P && P(h);
742
742
  }, [P]), $e = d((h) => {
743
743
  x && x(h);
744
- }, [x]), Me = (h, Ee) => {
744
+ }, [x]), Me = (h, ve) => {
745
745
  switch (h.type) {
746
746
  case "html":
747
747
  return /* @__PURE__ */ e.createElement(
748
748
  "div",
749
749
  {
750
- key: `html-${Ee}`,
750
+ key: `html-${ve}`,
751
751
  dangerouslySetInnerHTML: { __html: h.content }
752
752
  }
753
753
  );
@@ -758,10 +758,10 @@ function Nt({
758
758
  key: `form-${h.artifact.id}`,
759
759
  artifact: h.artifact,
760
760
  theme: Y,
761
- initialState: Le,
761
+ initialState: ce,
762
762
  onSubmit: Te,
763
- onCancel: be,
764
- onButtonClick: pe
763
+ onCancel: we,
764
+ onButtonClick: Ee
765
765
  }
766
766
  ) : null;
767
767
  case "social":
@@ -775,15 +775,15 @@ function Nt({
775
775
  }
776
776
  );
777
777
  case "panel":
778
- return s ? /* @__PURE__ */ e.createElement(
778
+ return l ? /* @__PURE__ */ e.createElement(
779
779
  rt,
780
780
  {
781
781
  key: `panel-${h.artifact.id}`,
782
782
  artifact: h.artifact,
783
- isActive: ge === h.artifact.id,
783
+ isActive: ye === h.artifact.id,
784
784
  onOpen: Pe,
785
- onCopy: _e,
786
- onDownload: Ne
785
+ onCopy: Ne,
786
+ onDownload: be
787
787
  }
788
788
  ) : null;
789
789
  default:
@@ -796,13 +796,13 @@ function Nt({
796
796
  ref: z,
797
797
  className: `artifactuse-agent-message ${v}`.trim()
798
798
  },
799
- /* @__PURE__ */ e.createElement("div", { ref: L, className: "artifactuse-message-content" }, fe.map(Me)),
799
+ /* @__PURE__ */ e.createElement("div", { ref: L, className: "artifactuse-message-content" }, pe.map(Me)),
800
800
  /* @__PURE__ */ e.createElement(
801
801
  ht,
802
802
  {
803
803
  isOpen: re,
804
- type: ce,
805
- src: ie,
804
+ type: ie,
805
+ src: oe,
806
806
  alt: k,
807
807
  caption: _,
808
808
  onClose: Z
@@ -840,8 +840,8 @@ Nt.propTypes = {
840
840
  function Tt({
841
841
  onAIRequest: t,
842
842
  onSave: a,
843
- onExport: s,
844
- className: l = ""
843
+ onExport: l,
844
+ className: s = ""
845
845
  }) {
846
846
  const {
847
847
  state: n,
@@ -850,36 +850,43 @@ function Tt({
850
850
  hasArtifacts: u,
851
851
  closePanel: y,
852
852
  toggleFullscreen: c,
853
- setViewMode: b,
853
+ setViewMode: w,
854
854
  getPanelUrl: P,
855
855
  openArtifact: x,
856
856
  instance: N
857
- } = ue(), v = W(null), w = W(null), f = W(null), E = W(null), I = W(null), [D, z] = C(!1), [L, J] = C(!1), [K, U] = C(!0), [le, ee] = C(!1), [de, ae] = C(!1), [X, re] = C(!1), [j, ce] = C(50), [te, ie] = C(50), i = W(null), k = W(null), g = W(null), _ = W(null), M = W(null), Y = $(() => r ? xe(r.language) : "", [r]), ge = $(() => r ? ze(r.language) : "", [r]), fe = $(() => r ? P(r) : null, [r, P]), Le = $(() => r ? Ge(r.language) : "plaintext", [r]), T = $(() => n.artifacts.filter((m) => !m.isInline), [n.artifacts]), Z = $(() => r ? T.findIndex((m) => m.id === r.id) : -1, [r, T]), oe = $(() => {
857
+ } = de(), v = W(null), b = W(null), f = W(null), E = W(null), I = W(null), [D, z] = C(!1), [L, J] = C(!1), [K, U] = C(!0), [le, ee] = C(!1), [fe, ae] = C(!1), [X, re] = C(!1), [j, ie] = C(50), [te, oe] = C(50), i = W(null), k = W(null), g = W(null), _ = W(null), M = W(null), Y = $(() => r ? Ce(r.language) : "", [r]), ye = $(() => r ? ze(r.language) : "", [r]), pe = $(() => r ? P(r) : null, [r, P]), ce = $(() => r ? Ge(r.language) : "plaintext", [r]), T = $(() => n.artifacts.filter((m) => !m.isInline), [n.artifacts]), Z = $(() => r ? T.findIndex((m) => m.id === r.id) : -1, [r, T]), me = $(() => {
858
858
  var m;
859
859
  return ((m = N == null ? void 0 : N.config) == null ? void 0 : m.branding) !== !1;
860
- }, [N]), ye = $(() => r ? j : Math.min(j, 30), [r, j]), ne = d((m) => `<svg viewBox="0 0 24 24" fill="currentColor">${ze(m)}</svg>`, []), Pe = d(() => {
860
+ }, [N]), _e = $(() => r ? j : Math.min(j, 30), [r, j]), ne = d((m) => `<svg viewBox="0 0 24 24" fill="currentColor">${ze(m)}</svg>`, []), Pe = d(() => {
861
861
  ae(!1), N.state.clearActiveArtifact();
862
- }, [N]), _e = d(() => {
862
+ }, [N]), Ne = d(() => {
863
863
  if (!E.current || !(r != null && r.code)) return;
864
864
  const m = r.code.split(`
865
865
  `).length, A = Array.from({ length: m }, (G, O) => `<div>${O + 1}</div>`).join("");
866
866
  E.current.innerHTML = A;
867
- }, [r]), Ne = d(() => {
868
- w.current && Qe() && (window.Prism.highlightElement(w.current), w.current.dataset.highlighted = "true", setTimeout(() => {
869
- Te();
870
- }, 0));
871
- }, []), Te = d(() => {
867
+ }, [r]), be = d(() => {
868
+ if (b.current && Qe() && (r != null && r.code)) {
869
+ const m = window.Prism.languages[ce];
870
+ m ? b.current.innerHTML = window.Prism.highlight(
871
+ r.code,
872
+ m,
873
+ ce
874
+ ) : b.current.textContent = r.code, b.current.dataset.highlighted = "true", setTimeout(() => {
875
+ Te();
876
+ }, 0);
877
+ }
878
+ }, [r == null ? void 0 : r.code, ce]), Te = d(() => {
872
879
  var A;
873
- const m = (A = w.current) == null ? void 0 : A.closest("pre");
880
+ const m = (A = b.current) == null ? void 0 : A.closest("pre");
874
881
  if (m && I.current && E.current) {
875
882
  const O = window.getComputedStyle(m).backgroundColor;
876
883
  O && O !== "rgba(0, 0, 0, 0)" && O !== "transparent" && (I.current.style.backgroundColor = O, E.current.style.backgroundColor = O);
877
884
  }
878
- }, []), be = d(() => {
885
+ }, []), we = d(() => {
879
886
  I.current && (I.current.style.backgroundColor = ""), E.current && (E.current.style.backgroundColor = "");
880
- }, []), pe = d(() => {
881
- _e(), Ne();
882
- }, [_e, Ne]), $e = d(() => {
887
+ }, []), Ee = d(() => {
888
+ Ne(), be();
889
+ }, [Ne, be]), $e = d(() => {
883
890
  clearTimeout(_.current), U(!1), v.current && r && (N.bridge.setIframe(v.current), N.bridge.loadArtifact(r));
884
891
  }, [r, N]), Me = d(() => {
885
892
  clearTimeout(_.current), U(!1);
@@ -887,7 +894,7 @@ function Tt({
887
894
  clearTimeout(_.current), _.current = setTimeout(() => {
888
895
  U(!1);
889
896
  }, 1e3);
890
- }, []), Ee = d(async () => {
897
+ }, []), ve = d(async () => {
891
898
  if (r)
892
899
  try {
893
900
  await navigator.clipboard.writeText(r.code), z(!0), setTimeout(() => z(!1), 2e3);
@@ -896,8 +903,8 @@ function Tt({
896
903
  }
897
904
  }, [r]), He = d(() => {
898
905
  if (!r) return;
899
- 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");
900
- Q.href = se, Q.download = he, document.body.appendChild(Q), Q.click(), document.body.removeChild(Q), URL.revokeObjectURL(se);
906
+ const { code: m, language: A, title: G } = r, O = Re(A), ge = `${G.toLowerCase().replace(/\s+/g, "-")}.${O}`, xe = new Blob([m], { type: "text/plain" }), se = URL.createObjectURL(xe), Q = document.createElement("a");
907
+ Q.href = se, Q.download = ge, document.body.appendChild(Q), Q.click(), document.body.removeChild(Q), URL.revokeObjectURL(se);
901
908
  }, [r]), Ae = d(async () => {
902
909
  if (!(X || T.length === 0)) {
903
910
  re(!0);
@@ -910,8 +917,8 @@ function Tt({
910
917
  const qe = A.get(We) || 0;
911
918
  qe > 0 && (We = `${Be}-${qe}.${Fe}`), A.set(`${Be}.${Fe}`, qe + 1), m.file(We, Q.code);
912
919
  }
913
- 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");
914
- se.href = ke, se.download = he, document.body.appendChild(se), se.click(), document.body.removeChild(se), URL.revokeObjectURL(ke);
920
+ const G = await m.generateAsync({ type: "blob" }), ge = `artifacts-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`, xe = URL.createObjectURL(G), se = document.createElement("a");
921
+ se.href = xe, se.download = ge, document.body.appendChild(se), se.click(), document.body.removeChild(se), URL.revokeObjectURL(xe);
915
922
  } catch (m) {
916
923
  console.error("Failed to create ZIP:", m);
917
924
  } finally {
@@ -933,13 +940,13 @@ function Tt({
933
940
  });
934
941
  }, [j]), B = d((m) => {
935
942
  if (!i.current) return;
936
- const A = window.innerWidth, O = (i.current.startX - m.clientX) / A * 100, he = i.current.startWidth + O;
937
- ce(Math.min(Math.max(he, 25), 75));
943
+ const A = window.innerWidth, O = (i.current.startX - m.clientX) / A * 100, ge = i.current.startWidth + O;
944
+ ie(Math.min(Math.max(ge, 25), 75));
938
945
  }, []), R = d(() => {
939
946
  i.current = null, document.removeEventListener("mousemove", B), document.removeEventListener("mouseup", R), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((m) => {
940
947
  m.style.pointerEvents = "";
941
948
  });
942
- }, [B]), ve = d((m) => {
949
+ }, [B]), he = d((m) => {
943
950
  if (!f.current) return;
944
951
  const A = f.current.getBoundingClientRect();
945
952
  k.current = {
@@ -947,33 +954,33 @@ function Tt({
947
954
  startPosition: te,
948
955
  contentLeft: A.left,
949
956
  contentWidth: A.width
950
- }, document.addEventListener("mousemove", Se), document.addEventListener("mouseup", we), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((G) => {
957
+ }, document.addEventListener("mousemove", Se), document.addEventListener("mouseup", ke), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.querySelectorAll("iframe").forEach((G) => {
951
958
  G.style.pointerEvents = "none";
952
959
  });
953
960
  }, [te]), Se = d((m) => {
954
961
  if (!k.current) return;
955
962
  const G = (m.clientX - k.current.contentLeft) / k.current.contentWidth * 100;
956
- ie(Math.min(Math.max(G, 20), 80));
957
- }, []), we = d(() => {
958
- k.current = null, document.removeEventListener("mousemove", Se), document.removeEventListener("mouseup", we), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((m) => {
963
+ oe(Math.min(Math.max(G, 20), 80));
964
+ }, []), ke = d(() => {
965
+ k.current = null, document.removeEventListener("mousemove", Se), document.removeEventListener("mouseup", ke), document.body.style.cursor = "", document.body.style.userSelect = "", document.querySelectorAll("iframe").forEach((m) => {
959
966
  m.style.pointerEvents = "";
960
967
  });
961
968
  }, [Se]);
962
969
  if (q(() => {
963
- r && (M.current && M.current.isPreviewable !== r.isPreviewable && (ee(!0), setTimeout(() => ee(!1), 150)), M.current = r, be(), U(!0), h(), pe());
964
- }, [r == null ? void 0 : r.id, be]), q(() => {
965
- (n.viewMode === "code" || n.viewMode === "split") && pe();
966
- }, [n.viewMode, pe]), q(() => (t && N.on("ai:request", t), a && N.on("save:request", a), s && N.on("export:complete", s), () => {
967
- t && N.off("ai:request", t), a && N.off("save:request", a), s && N.off("export:complete", s);
968
- }), [N, t, a, s]), q(() => () => {
969
- R(), we(), clearTimeout(g.current), clearTimeout(_.current);
970
- }, [R, we]), !n.isPanelOpen) return null;
970
+ r && (M.current && M.current.isPreviewable !== r.isPreviewable && (ee(!0), setTimeout(() => ee(!1), 150)), M.current = r, we(), U(!0), h(), Ee());
971
+ }, [r == null ? void 0 : r.id, we]), q(() => {
972
+ (n.viewMode === "code" || n.viewMode === "split") && Ee();
973
+ }, [n.viewMode, Ee]), q(() => (t && N.on("ai:request", t), a && N.on("save:request", a), l && N.on("export:complete", l), () => {
974
+ t && N.off("ai:request", t), a && N.off("save:request", a), l && N.off("export:complete", l);
975
+ }), [N, t, a, l]), q(() => () => {
976
+ R(), ke(), clearTimeout(g.current), clearTimeout(_.current);
977
+ }, [R, ke]), !n.isPanelOpen) return null;
971
978
  const Ie = [
972
979
  "artifactuse-panel",
973
980
  n.isFullscreen && "artifactuse-panel--fullscreen",
974
981
  !r && u && "artifactuse-panel--list",
975
982
  !u && "artifactuse-panel--empty",
976
- l
983
+ s
977
984
  ].filter(Boolean).join(" "), Ze = [
978
985
  "artifactuse-panel__content",
979
986
  `artifactuse-panel__content--${n.viewMode}`,
@@ -993,7 +1000,7 @@ function Tt({
993
1000
  },
994
1001
  /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle-line" })
995
1002
  ),
996
- /* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, de && /* @__PURE__ */ e.createElement(
1003
+ /* @__PURE__ */ e.createElement("header", { className: "artifactuse-panel__header" }, fe && /* @__PURE__ */ e.createElement(
997
1004
  "button",
998
1005
  {
999
1006
  className: "artifactuse-panel__back",
@@ -1005,7 +1012,7 @@ function Tt({
1005
1012
  "span",
1006
1013
  {
1007
1014
  className: "artifactuse-panel__icon",
1008
- dangerouslySetInnerHTML: { __html: `<svg viewBox="0 0 24 24" fill="currentColor">${ge}</svg>` }
1015
+ dangerouslySetInnerHTML: { __html: `<svg viewBox="0 0 24 24" fill="currentColor">${ye}</svg>` }
1009
1016
  }
1010
1017
  ), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__title-content" }, /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__name" }, r.title || "Untitled"), /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__meta" }, Y, r.lineCount && ` • ${r.lineCount} lines`))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__tabs" }, /* @__PURE__ */ e.createElement(
1011
1018
  "button",
@@ -1013,7 +1020,7 @@ function Tt({
1013
1020
  className: `artifactuse-panel__tab ${n.viewMode === "preview" ? "artifactuse-panel__tab--active" : ""}`,
1014
1021
  disabled: !r.isPreviewable,
1015
1022
  title: "Preview",
1016
- onClick: () => b("preview")
1023
+ onClick: () => w("preview")
1017
1024
  },
1018
1025
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }), /* @__PURE__ */ e.createElement("circle", { cx: "12", cy: "12", r: "3" }))
1019
1026
  ), /* @__PURE__ */ e.createElement(
@@ -1021,7 +1028,7 @@ function Tt({
1021
1028
  {
1022
1029
  className: `artifactuse-panel__tab ${n.viewMode === "code" ? "artifactuse-panel__tab--active" : ""}`,
1023
1030
  title: "Code",
1024
- onClick: () => b("code")
1031
+ onClick: () => w("code")
1025
1032
  },
1026
1033
  /* @__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" }))
1027
1034
  ), /* @__PURE__ */ e.createElement(
@@ -1030,7 +1037,7 @@ function Tt({
1030
1037
  className: `artifactuse-panel__tab ${n.viewMode === "split" ? "artifactuse-panel__tab--active" : ""}`,
1031
1038
  disabled: !r.isPreviewable,
1032
1039
  title: "Split view",
1033
- onClick: () => b("split")
1040
+ onClick: () => w("split")
1034
1041
  },
1035
1042
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }), /* @__PURE__ */ e.createElement("line", { x1: "12", y1: "3", x2: "12", y2: "21" }))
1036
1043
  )), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
@@ -1056,12 +1063,12 @@ function Tt({
1056
1063
  className: "artifactuse-panel__preview",
1057
1064
  style: n.viewMode === "split" ? { width: `${te}%` } : void 0
1058
1065
  },
1059
- K && fe && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })),
1060
- fe ? /* @__PURE__ */ e.createElement(
1066
+ K && pe && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__loading" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__spinner" })),
1067
+ pe ? /* @__PURE__ */ e.createElement(
1061
1068
  "iframe",
1062
1069
  {
1063
1070
  ref: v,
1064
- src: fe,
1071
+ src: pe,
1065
1072
  className: `artifactuse-panel__iframe ${K ? "artifactuse-panel__iframe--loading" : ""}`,
1066
1073
  sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads",
1067
1074
  onLoad: $e,
@@ -1081,20 +1088,19 @@ function Tt({
1081
1088
  "div",
1082
1089
  {
1083
1090
  className: "artifactuse-panel__split-handle",
1084
- onMouseDown: ve
1091
+ onMouseDown: he
1085
1092
  },
1086
1093
  /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__split-handle-line" })
1087
1094
  ),
1088
- /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__code-scroll", ref: I }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__line-numbers", ref: E }), /* @__PURE__ */ e.createElement("pre", { className: "artifactuse-panel__code-block" }, /* @__PURE__ */ e.createElement(
1095
+ /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__code-scroll", ref: I }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__line-numbers", ref: E }), /* @__PURE__ */ e.createElement("pre", { className: `artifactuse-panel__code-block language-${ce}` }, /* @__PURE__ */ e.createElement(
1089
1096
  "code",
1090
1097
  {
1091
- ref: w,
1092
- className: `language-${Le}`
1093
- },
1094
- r.code
1098
+ ref: b,
1099
+ className: `language-${ce}`
1100
+ }
1095
1101
  )))
1096
1102
  )),
1097
- /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-left" }, oe && /* @__PURE__ */ e.createElement(
1103
+ /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer" }, /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__footer-left" }, me && /* @__PURE__ */ e.createElement(
1098
1104
  "a",
1099
1105
  {
1100
1106
  href: "https://artifactuse.com",
@@ -1110,7 +1116,7 @@ function Tt({
1110
1116
  {
1111
1117
  className: `artifactuse-panel__footer-action ${D ? "artifactuse-panel__footer-action--success" : ""}`,
1112
1118
  title: D ? "Copied!" : "Copy code",
1113
- onClick: Ee
1119
+ onClick: ve
1114
1120
  },
1115
1121
  D ? /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("polyline", { points: "20 6 9 17 4 12" })) : /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2" }, /* @__PURE__ */ e.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), /* @__PURE__ */ e.createElement("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }))
1116
1122
  ), /* @__PURE__ */ e.createElement(
@@ -1168,10 +1174,10 @@ function Tt({
1168
1174
  dangerouslySetInnerHTML: { __html: ne(m.language) }
1169
1175
  }
1170
1176
  ),
1171
- /* @__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" }, xe(m.language), m.lineCount && ` • ${m.lineCount} lines`)),
1177
+ /* @__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" }, Ce(m.language), m.lineCount && ` • ${m.lineCount} lines`)),
1172
1178
  /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel__artifact-item-index" }, A + 1)
1173
1179
  )))))))
1174
- )) : /* @__PURE__ */ e.createElement("div", { className: Ie, style: n.isFullscreen ? void 0 : { width: `${ye}%` } }, !n.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: S }, /* @__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" }, T.length, " available"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1180
+ )) : /* @__PURE__ */ e.createElement("div", { className: Ie, style: n.isFullscreen ? void 0 : { width: `${_e}%` } }, !n.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: S }, /* @__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" }, T.length, " available"))), /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1175
1181
  "button",
1176
1182
  {
1177
1183
  className: `artifactuse-panel__action ${X ? "artifactuse-panel__action--loading" : ""}`,
@@ -1202,9 +1208,9 @@ function Tt({
1202
1208
  dangerouslySetInnerHTML: { __html: ne(m.language) }
1203
1209
  }
1204
1210
  ),
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" }, xe(m.language), m.lineCount && ` • ${m.lineCount} lines`)),
1211
+ /* @__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" }, Ce(m.language), m.lineCount && ` • ${m.lineCount} lines`)),
1206
1212
  /* @__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
- )))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, oe && /* @__PURE__ */ e.createElement(
1213
+ )))), /* @__PURE__ */ e.createElement("footer", { className: "artifactuse-panel__footer artifactuse-panel__footer--simple" }, me && /* @__PURE__ */ e.createElement(
1208
1214
  "a",
1209
1215
  {
1210
1216
  href: "https://artifactuse.com",
@@ -1214,7 +1220,7 @@ function Tt({
1214
1220
  },
1215
1221
  /* @__PURE__ */ e.createElement("svg", { width: "16", height: "16", viewBox: "0 0 42 42", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement("path", { d: "M16.6667 41.6673V10.4173C16.6667 9.86478 16.4472 9.33488 16.0565 8.94418C15.6658 8.55348 15.1359 8.33398 14.5833 8.33398H4.16667C3.0616 8.33398 2.00179 8.77297 1.22039 9.55437C0.438987 10.3358 0 11.3956 0 12.5007V37.5006C0 38.6057 0.438987 39.6655 1.22039 40.4469C2.00179 41.2283 3.0616 41.6673 4.16667 41.6673H29.1667C30.2717 41.6673 31.3315 41.2283 32.1129 40.4469C32.8943 39.6655 33.3333 38.6057 33.3333 37.5006V27.084C33.3333 26.5314 33.1138 26.0015 32.7231 25.6108C32.3324 25.2201 31.8025 25.0007 31.25 25.0007H0", fill: "#5F51C8" }), /* @__PURE__ */ e.createElement("path", { d: "M39.5833 0H27.0833C25.9327 0 25 0.93274 25 2.08333V14.5833C25 15.7339 25.9327 16.6667 27.0833 16.6667H39.5833C40.7339 16.6667 41.6667 15.7339 41.6667 14.5833V2.08333C41.6667 0.93274 40.7339 0 39.5833 0Z", fill: "#695AE0" })),
1216
1222
  /* @__PURE__ */ e.createElement("span", null, "Artifactuse")
1217
- ))) : /* @__PURE__ */ e.createElement("div", { className: Ie, style: n.isFullscreen ? void 0 : { width: `${ye}%` } }, !n.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: S }, /* @__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("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1223
+ ))) : /* @__PURE__ */ e.createElement("div", { className: Ie, style: n.isFullscreen ? void 0 : { width: `${_e}%` } }, !n.isFullscreen && /* @__PURE__ */ e.createElement("div", { className: "artifactuse-panel__resize-handle", onMouseDown: S }, /* @__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("div", { className: "artifactuse-panel__actions" }, /* @__PURE__ */ e.createElement(
1218
1224
  "button",
1219
1225
  {
1220
1226
  className: "artifactuse-panel__action artifactuse-panel__action--close",
@@ -1222,7 +1228,7 @@ function Tt({
1222
1228
  onClick: y
1223
1229
  },
1224
1230
  /* @__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
- ))), /* @__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" }, oe && /* @__PURE__ */ e.createElement(
1231
+ ))), /* @__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(
1226
1232
  "a",
1227
1233
  {
1228
1234
  href: "https://artifactuse.com",
@@ -1235,10 +1241,10 @@ function Tt({
1235
1241
  )));
1236
1242
  }
1237
1243
  function $t({ className: t = "" }) {
1238
- const { state: a, artifactCount: s, hasArtifacts: l, togglePanel: n } = ue(), r = $(() => s > 99 ? "99+" : String(s), [s]), p = [
1244
+ const { state: a, artifactCount: l, hasArtifacts: s, togglePanel: n } = de(), r = $(() => l > 99 ? "99+" : String(l), [l]), p = [
1239
1245
  "artifactuse-panel-toggle",
1240
1246
  a.isPanelOpen && "artifactuse-panel-toggle--active",
1241
- l && "artifactuse-panel-toggle--has-artifacts",
1247
+ s && "artifactuse-panel-toggle--has-artifacts",
1242
1248
  t
1243
1249
  ].filter(Boolean).join(" ");
1244
1250
  return /* @__PURE__ */ e.createElement(
@@ -1249,22 +1255,22 @@ function $t({ className: t = "" }) {
1249
1255
  title: a.isPanelOpen ? "Close artifacts panel" : "Open artifacts panel"
1250
1256
  },
1251
1257
  /* @__PURE__ */ e.createElement("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ e.createElement("polyline", { points: "16 18 22 12 16 6" }), /* @__PURE__ */ e.createElement("polyline", { points: "8 6 2 12 8 18" })),
1252
- s > 0 && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel-toggle-badge" }, r)
1258
+ l > 0 && /* @__PURE__ */ e.createElement("span", { className: "artifactuse-panel-toggle-badge" }, r)
1253
1259
  );
1254
1260
  }
1255
1261
  const Xe = Ke(null);
1256
1262
  function bt({ children: t, config: a = {} }) {
1257
- const s = W(null);
1258
- s.current || (s.current = et(a));
1259
- const l = s.current, [n, r] = C({
1263
+ const l = W(null);
1264
+ l.current || (l.current = et(a));
1265
+ const s = l.current, [n, r] = C({
1260
1266
  artifacts: [],
1261
1267
  activeArtifactId: null,
1262
1268
  isPanelOpen: !1,
1263
1269
  viewMode: "preview",
1264
1270
  isFullscreen: !1
1265
- }), [p, u] = C(() => l.getPanelTypes());
1271
+ }), [p, u] = C(() => s.getPanelTypes());
1266
1272
  q(() => {
1267
- const f = l.state.subscribe((E) => {
1273
+ const f = s.state.subscribe((E) => {
1268
1274
  r({
1269
1275
  artifacts: E.artifacts,
1270
1276
  activeArtifactId: E.activeArtifactId,
@@ -1273,84 +1279,86 @@ function bt({ children: t, config: a = {} }) {
1273
1279
  isFullscreen: E.isFullscreen
1274
1280
  });
1275
1281
  });
1276
- return l.applyTheme(), () => {
1277
- f(), l.destroy();
1282
+ return s.applyTheme(), () => {
1283
+ f(), s.destroy();
1278
1284
  };
1279
- }, [l]);
1280
- const y = $(() => n.activeArtifactId && n.artifacts.find((f) => f.id === n.activeArtifactId) || null, [n.artifacts, n.activeArtifactId]), c = n.artifacts.length, b = c > 0, P = $(() => y ? l.getPanelUrl(y) : null, [y, l]), x = d((f) => {
1281
- l.setTheme(f), l.applyTheme();
1282
- }, [l]), N = d((f, E) => {
1283
- l.registerPanel(f, E), u(l.getPanelTypes());
1284
- }, [l]), v = d((f) => {
1285
- l.unregisterPanel(f), u(l.getPanelTypes());
1286
- }, [l]), w = $(() => ({
1287
- instance: l,
1285
+ }, [s]);
1286
+ const y = $(() => n.activeArtifactId && n.artifacts.find((f) => f.id === n.activeArtifactId) || null, [n.artifacts, n.activeArtifactId]), c = n.artifacts.filter((f) => !f.isInline).length, w = c > 0, P = $(() => y ? s.getPanelUrl(y) : null, [y, s]), x = d((f) => {
1287
+ s.setTheme(f), s.applyTheme();
1288
+ }, [s]), N = d((f, E) => {
1289
+ s.registerPanel(f, E), u(s.getPanelTypes());
1290
+ }, [s]), v = d((f) => {
1291
+ s.unregisterPanel(f), u(s.getPanelTypes());
1292
+ }, [s]), b = $(() => ({
1293
+ instance: s,
1288
1294
  state: n,
1289
1295
  activeArtifact: y,
1290
1296
  artifactCount: c,
1291
- hasArtifacts: b,
1297
+ hasArtifacts: w,
1292
1298
  // Panel computed
1293
1299
  panelTypes: p,
1294
1300
  activePanelUrl: P,
1295
1301
  // Methods
1296
- processMessage: l.processMessage,
1297
- initializeContent: l.initializeContent,
1298
- openArtifact: l.openArtifact,
1299
- closePanel: l.closePanel,
1300
- togglePanel: l.togglePanel,
1301
- toggleFullscreen: l.toggleFullscreen,
1302
- setViewMode: l.setViewMode,
1303
- getPanelUrl: l.getPanelUrl,
1304
- sendToPanel: l.sendToPanel,
1302
+ processMessage: s.processMessage,
1303
+ initializeContent: s.initializeContent,
1304
+ openArtifact: s.openArtifact,
1305
+ closePanel: s.closePanel,
1306
+ togglePanel: s.togglePanel,
1307
+ toggleFullscreen: s.toggleFullscreen,
1308
+ setViewMode: s.setViewMode,
1309
+ getPanelUrl: s.getPanelUrl,
1310
+ sendToPanel: s.sendToPanel,
1305
1311
  // Panel management
1306
- hasPanel: l.hasPanel,
1312
+ hasPanel: s.hasPanel,
1307
1313
  registerPanel: N,
1308
1314
  unregisterPanel: v,
1309
- getPanelTypes: l.getPanelTypes,
1315
+ getPanelTypes: s.getPanelTypes,
1310
1316
  // Events
1311
- on: l.on,
1312
- off: l.off,
1317
+ on: s.on,
1318
+ off: s.off,
1319
+ // State management
1320
+ clearArtifacts: () => s.state.clear(),
1313
1321
  // Theme
1314
- applyTheme: l.applyTheme,
1322
+ applyTheme: s.applyTheme,
1315
1323
  setTheme: x,
1316
- getTheme: l.getTheme
1324
+ getTheme: s.getTheme
1317
1325
  }), [
1318
- l,
1326
+ s,
1319
1327
  n,
1320
1328
  y,
1321
1329
  c,
1322
- b,
1330
+ w,
1323
1331
  p,
1324
1332
  P,
1325
1333
  x,
1326
1334
  N,
1327
1335
  v
1328
1336
  ]);
1329
- return /* @__PURE__ */ e.createElement(Xe.Provider, { value: w }, t);
1337
+ return /* @__PURE__ */ e.createElement(Xe.Provider, { value: b }, t);
1330
1338
  }
1331
- function ue() {
1339
+ function de() {
1332
1340
  const t = Ye(Xe);
1333
1341
  if (!t)
1334
1342
  throw new Error("useArtifactuse must be used within an ArtifactuseProvider");
1335
1343
  return t;
1336
1344
  }
1337
1345
  function wt(t, a) {
1338
- const { on: s, off: l } = ue();
1346
+ const { on: l, off: s } = de();
1339
1347
  q(() => {
1340
- const n = s(t, a);
1348
+ const n = l(t, a);
1341
1349
  return () => {
1342
- typeof n == "function" ? n() : l(t, a);
1350
+ typeof n == "function" ? n() : s(t, a);
1343
1351
  };
1344
- }, [t, a, s, l]);
1352
+ }, [t, a, l, s]);
1345
1353
  }
1346
1354
  function kt() {
1347
1355
  const {
1348
1356
  registerPanel: t,
1349
1357
  unregisterPanel: a,
1350
- hasPanel: s,
1351
- panelTypes: l,
1358
+ hasPanel: l,
1359
+ panelTypes: s,
1352
1360
  instance: n
1353
- } = ue(), r = d((u) => s({ type: u }), [s]), p = d((u, y = {}) => {
1361
+ } = de(), r = d((u) => l({ type: u }), [l]), p = d((u, y = {}) => {
1354
1362
  var c;
1355
1363
  return ((c = n.panelResolver) == null ? void 0 : c.resolve(u, y)) || null;
1356
1364
  }, [n]);
@@ -1359,13 +1367,13 @@ function kt() {
1359
1367
  unregister: a,
1360
1368
  isRegistered: r,
1361
1369
  getPanelUrl: p,
1362
- types: l,
1370
+ types: s,
1363
1371
  defaults: Je
1364
1372
  };
1365
1373
  }
1366
1374
  const Mt = {
1367
1375
  ArtifactuseProvider: bt,
1368
- useArtifactuse: ue,
1376
+ useArtifactuse: de,
1369
1377
  useArtifactuseEvent: wt,
1370
1378
  usePanelRegistry: kt,
1371
1379
  DEFAULT_PANELS: Je
@@ -1381,7 +1389,7 @@ export {
1381
1389
  ht as ArtifactuseViewer,
1382
1390
  Je as DEFAULT_PANELS,
1383
1391
  Mt as default,
1384
- ue as useArtifactuse,
1392
+ de as useArtifactuse,
1385
1393
  wt as useArtifactuseEvent,
1386
1394
  kt as usePanelRegistry
1387
1395
  };