@deepagents/react-input 7.9.0 → 7.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/browser.d.ts.map +1 -1
  2. package/dist/browser.js +743 -757
  3. package/dist/browser.js.map +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/lib/Composer.d.ts +4 -4
  6. package/dist/lib/Composer.d.ts.map +1 -1
  7. package/dist/lib/ComposerAttachments.d.ts +1 -1
  8. package/dist/lib/ComposerAttachments.d.ts.map +1 -1
  9. package/dist/lib/ComposerContext.d.ts +3 -3
  10. package/dist/lib/ComposerContext.d.ts.map +1 -1
  11. package/dist/lib/ComposerCore.d.ts +3 -8
  12. package/dist/lib/ComposerCore.d.ts.map +1 -1
  13. package/dist/lib/ComposerDraft.d.ts +1 -1
  14. package/dist/lib/ComposerDraft.d.ts.map +1 -1
  15. package/dist/lib/ComposerRegistry.d.ts +5 -5
  16. package/dist/lib/ComposerRegistry.d.ts.map +1 -1
  17. package/dist/lib/ComposerSlashCommands.d.ts +1 -1
  18. package/dist/lib/ComposerSlashCommands.d.ts.map +1 -1
  19. package/dist/lib/ComposerSuggestions.d.ts +1 -1
  20. package/dist/lib/ComposerSuggestions.d.ts.map +1 -1
  21. package/dist/lib/ComposerTokenText.d.ts +1 -1
  22. package/dist/lib/ComposerTokenText.d.ts.map +1 -1
  23. package/dist/lib/ComposerTriggers.d.ts.map +1 -1
  24. package/dist/lib/ComposerTypes.d.ts +1 -1
  25. package/dist/lib/ComposerTypes.d.ts.map +1 -1
  26. package/dist/lib/ComposerVisibility.d.ts +1 -1
  27. package/dist/lib/ComposerVisibility.d.ts.map +1 -1
  28. package/dist/lib/PersistedPromptText.d.ts.map +1 -1
  29. package/dist/lib/dictation/ComposerDictationContext.d.ts +2 -2
  30. package/dist/lib/dictation/ComposerDictationContext.d.ts.map +1 -1
  31. package/dist/lib/dictation/ComposerDictationParts.d.ts +2 -2
  32. package/dist/lib/dictation/ComposerDictationParts.d.ts.map +1 -1
  33. package/dist/lib/dictation/DictationError.d.ts.map +1 -1
  34. package/dist/lib/dictation/MicrophonePermission.d.ts.map +1 -1
  35. package/dist/lib/dictation/Recording.d.ts.map +1 -1
  36. package/dist/lib/dictation/useDictationController.d.ts +1 -1
  37. package/dist/lib/dictation/useDictationController.d.ts.map +1 -1
  38. package/dist/lib/persisted-prompt-selection.d.ts.map +1 -1
  39. package/dist/lib/tiptap/ComposerTiptapDomain.d.ts +6 -9
  40. package/dist/lib/tiptap/ComposerTiptapDomain.d.ts.map +1 -1
  41. package/dist/persisted-prompt.d.ts.map +1 -1
  42. package/package.json +7 -5
package/dist/browser.js CHANGED
@@ -4,24 +4,23 @@ import { Button as a } from "@base-ui/react/button";
4
4
  import { EditorContent as o, useEditor as s } from "@tiptap/react";
5
5
  import { useClock as c } from "@zukhruf/ui";
6
6
  import { cn as l } from "cn";
7
- import { Children as u, Fragment as d, createContext as f, isValidElement as p, startTransition as m, use as h, useActionState as g, useEffect as _, useMemo as v, useRef as y, useState as b, useSyncExternalStore as x } from "react";
8
- import { Package as S, X as ee } from "lucide-react";
9
- import { Fragment as te, jsx as C, jsxs as w } from "react/jsx-runtime";
10
- import { escapeRegExp as T } from "lodash-es";
7
+ import { Children as u, Fragment as d, createContext as f, isValidElement as p, startTransition as m, use as h, useActionState as g, useEffect as _, useEffectEvent as v, useMemo as y, useRef as b, useState as x, useSyncExternalStore as ee } from "react";
8
+ import { Package as S, X as te } from "lucide-react";
9
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
11
10
  import { Extension as E, Mark as D, Node as O, mergeAttributes as k } from "@tiptap/core";
12
- import ne from "@tiptap/extension-link";
13
- import { Slice as re } from "@tiptap/pm/model";
14
- import { Plugin as A, TextSelection as j } from "@tiptap/pm/state";
15
- import M from "@tiptap/starter-kit";
11
+ import A from "@tiptap/extension-link";
12
+ import { Slice as ne } from "@tiptap/pm/model";
13
+ import { Plugin as re, TextSelection as j } from "@tiptap/pm/state";
14
+ import ie from "@tiptap/starter-kit";
16
15
  //#region src/lib/ComposerContext.ts
17
- var ie = f(null);
18
- function N(e) {
19
- let t = h(ie);
16
+ var ae = f(null);
17
+ function M(e) {
18
+ let t = h(ae);
20
19
  if (!t) throw Error(`${e} must be used inside Composer.Root.`);
21
20
  return t;
22
21
  }
23
- function P(e) {
24
- let t = i(9), n = N(e === void 0 ? "useComposer" : e), r;
22
+ function N(e) {
23
+ let t = i(9), n = M(e === void 0 ? "useComposer" : e), r;
25
24
  t[0] !== n.activePopup || t[1] !== n.disabled || t[2] !== n.meta || t[3] !== n.suggestions ? (r = {
26
25
  ...n.meta,
27
26
  disabled: n.disabled,
@@ -37,10 +36,10 @@ function P(e) {
37
36
  }
38
37
  //#endregion
39
38
  //#region src/lib/ComposerAttachments.tsx
40
- function F(e) {
39
+ function P(e) {
41
40
  let t = i(23), n, r;
42
41
  t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
43
- let { state: a, attachedImages: o } = N("Composer.Attachments"), s = a.imageAttachments, c, u, d, f, p, m;
42
+ let { state: a, attachedImages: o } = M("Composer.Attachments"), s = a.imageAttachments, c, u, d, f, p, m;
44
43
  if (t[3] !== o || t[4] !== n || t[5] !== r || t[6] !== a.imageAttachments) {
45
44
  m = Symbol.for("react.early_return_sentinel");
46
45
  bb0: {
@@ -51,13 +50,13 @@ function F(e) {
51
50
  m = null;
52
51
  break bb0;
53
52
  }
54
- c = "list", u = "Attached files", t[15] === n ? d = t[16] : (d = l("flex flex-wrap gap-2", n), t[15] = n, t[16] = d), f = r, p = i.map(I);
53
+ c = "list", u = "Attached files", t[15] === n ? d = t[16] : (d = l("flex flex-wrap gap-2", n), t[15] = n, t[16] = d), f = r, p = i.map(F);
55
54
  }
56
55
  t[3] = o, t[4] = n, t[5] = r, t[6] = a.imageAttachments, t[7] = c, t[8] = u, t[9] = d, t[10] = f, t[11] = p, t[12] = m;
57
56
  } else c = t[7], u = t[8], d = t[9], f = t[10], p = t[11], m = t[12];
58
57
  if (m !== Symbol.for("react.early_return_sentinel")) return m;
59
58
  let h;
60
- return t[17] !== c || t[18] !== u || t[19] !== d || t[20] !== f || t[21] !== p ? (h = /* @__PURE__ */ C("div", {
59
+ return t[17] !== c || t[18] !== u || t[19] !== d || t[20] !== f || t[21] !== p ? (h = /* @__PURE__ */ w("div", {
61
60
  role: c,
62
61
  "aria-label": u,
63
62
  className: d,
@@ -65,35 +64,35 @@ function F(e) {
65
64
  children: p
66
65
  }), t[17] = c, t[18] = u, t[19] = d, t[20] = f, t[21] = p, t[22] = h) : h = t[22], h;
67
66
  }
68
- function I(e) {
69
- return /* @__PURE__ */ C(L, { attachment: e }, e.id);
67
+ function F(e) {
68
+ return /* @__PURE__ */ w(I, { attachment: e }, e.id);
70
69
  }
71
- function L(e) {
72
- let t = i(18), { attachment: n } = e, { id: r, placeholder: o, media: s } = n, { attachedImages: c, disabled: l, actions: u } = N("Composer.Attachments"), d;
70
+ function I(e) {
71
+ let t = i(18), { attachment: n } = e, { id: r, placeholder: o, media: s } = n, { attachedImages: c, disabled: l, actions: u } = M("Composer.Attachments"), d;
73
72
  t[0] !== c || t[1] !== r ? (d = c.get(r), t[0] = c, t[1] = r, t[2] = d) : d = t[2];
74
73
  let f = d;
75
74
  if (!f) return null;
76
75
  let p;
77
- t[3] !== f || t[4] !== s || t[5] !== o ? (p = s === "video" ? /* @__PURE__ */ C(B, {
76
+ t[3] !== f || t[4] !== s || t[5] !== o ? (p = s === "video" ? /* @__PURE__ */ w(z, {
78
77
  placeholder: o,
79
78
  file: f
80
- }) : s === "audio" ? /* @__PURE__ */ C(H, {
79
+ }) : s === "audio" ? /* @__PURE__ */ w(V, {
81
80
  placeholder: o,
82
81
  file: f,
83
82
  glyph: "♪"
84
- }) : /* @__PURE__ */ C(z, {
83
+ }) : /* @__PURE__ */ w(R, {
85
84
  placeholder: o,
86
85
  file: f
87
86
  }), t[3] = f, t[4] = s, t[5] = o, t[6] = p) : p = t[6];
88
87
  let m = `Remove ${o}`, h;
89
88
  t[7] !== u || t[8] !== r ? (h = () => u.removeImageAttachment(r), t[7] = u, t[8] = r, t[9] = h) : h = t[9];
90
89
  let g;
91
- t[10] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ C(ee, {
90
+ t[10] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ w(te, {
92
91
  "aria-hidden": !0,
93
92
  className: "size-3"
94
93
  }), t[10] = g) : g = t[10];
95
94
  let _;
96
- t[11] !== l || t[12] !== m || t[13] !== h ? (_ = /* @__PURE__ */ C(a, {
95
+ t[11] !== l || t[12] !== m || t[13] !== h ? (_ = /* @__PURE__ */ w(a, {
97
96
  type: "button",
98
97
  "aria-label": m,
99
98
  disabled: l,
@@ -102,26 +101,26 @@ function L(e) {
102
101
  children: g
103
102
  }), t[11] = l, t[12] = m, t[13] = h, t[14] = _) : _ = t[14];
104
103
  let v;
105
- return t[15] !== p || t[16] !== _ ? (v = /* @__PURE__ */ w("div", {
104
+ return t[15] !== p || t[16] !== _ ? (v = /* @__PURE__ */ T("div", {
106
105
  role: "listitem",
107
106
  className: "relative",
108
107
  children: [p, _]
109
108
  }), t[15] = p, t[16] = _, t[17] = v) : v = t[17], v;
110
109
  }
111
- function R(e) {
112
- let t = i(3), [n, r] = b(null), a, o;
110
+ function L(e) {
111
+ let t = i(3), [n, r] = x(null), a, o;
113
112
  return t[0] === e ? (a = t[1], o = t[2]) : (a = () => {
114
113
  let t = URL.createObjectURL(e);
115
114
  return r(t), () => URL.revokeObjectURL(t);
116
115
  }, o = [e], t[0] = e, t[1] = a, t[2] = o), _(a, o), n;
117
116
  }
118
- function z(e) {
119
- let t = i(5), { placeholder: n, file: r } = e, a = R(r), [o, s] = b(null), c;
120
- return t[0] !== o || t[1] !== r || t[2] !== a || t[3] !== n ? (c = a === null ? null : a === o ? /* @__PURE__ */ C(H, {
117
+ function R(e) {
118
+ let t = i(5), { placeholder: n, file: r } = e, a = L(r), [o, s] = x(null), c;
119
+ return t[0] !== o || t[1] !== r || t[2] !== a || t[3] !== n ? (c = a === null ? null : a === o ? /* @__PURE__ */ w(V, {
121
120
  placeholder: n,
122
121
  file: r,
123
122
  glyph: "🖼"
124
- }) : /* @__PURE__ */ C("img", {
123
+ }) : /* @__PURE__ */ w("img", {
125
124
  src: a,
126
125
  alt: n,
127
126
  title: r.name,
@@ -129,11 +128,11 @@ function z(e) {
129
128
  onError: () => s(a)
130
129
  }), t[0] = o, t[1] = r, t[2] = a, t[3] = n, t[4] = c) : c = t[4], c;
131
130
  }
132
- function B(e) {
133
- let t = i(11), { placeholder: n, file: r } = e, a = R(r), [o, s] = b(null), c = a ?? void 0, l;
131
+ function z(e) {
132
+ let t = i(11), { placeholder: n, file: r } = e, a = L(r), [o, s] = x(null), c = a ?? void 0, l;
134
133
  t[0] === Symbol.for("react.memo_cache_sentinel") ? (l = (e) => s(e.currentTarget.duration), t[0] = l) : l = t[0];
135
134
  let u;
136
- t[1] === c ? u = t[2] : (u = /* @__PURE__ */ C("video", {
135
+ t[1] === c ? u = t[2] : (u = /* @__PURE__ */ w("video", {
137
136
  src: c,
138
137
  muted: !0,
139
138
  playsInline: !0,
@@ -142,18 +141,18 @@ function B(e) {
142
141
  onLoadedMetadata: l
143
142
  }), t[1] = c, t[2] = u);
144
143
  let d;
145
- t[3] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ C("span", {
144
+ t[3] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ w("span", {
146
145
  "aria-hidden": !0,
147
146
  className: "pointer-events-none absolute inset-0 flex items-center justify-center text-lg text-white drop-shadow",
148
147
  children: "▶"
149
148
  }), t[3] = d) : d = t[3];
150
149
  let f;
151
- t[4] === o ? f = t[5] : (f = o !== null && Number.isFinite(o) ? /* @__PURE__ */ C("span", {
150
+ t[4] === o ? f = t[5] : (f = o !== null && Number.isFinite(o) ? /* @__PURE__ */ w("span", {
152
151
  className: "absolute right-0.5 bottom-0.5 rounded bg-black/70 px-1 text-[10px] leading-4 text-white",
153
- children: V(o)
152
+ children: B(o)
154
153
  }) : null, t[4] = o, t[5] = f);
155
154
  let p;
156
- return t[6] !== r.name || t[7] !== n || t[8] !== u || t[9] !== f ? (p = /* @__PURE__ */ w("div", {
155
+ return t[6] !== r.name || t[7] !== n || t[8] !== u || t[9] !== f ? (p = /* @__PURE__ */ T("div", {
157
156
  role: "img",
158
157
  "aria-label": n,
159
158
  title: r.name,
@@ -165,28 +164,28 @@ function B(e) {
165
164
  ]
166
165
  }), t[6] = r.name, t[7] = n, t[8] = u, t[9] = f, t[10] = p) : p = t[10], p;
167
166
  }
168
- function V(e) {
167
+ function B(e) {
169
168
  let t = Math.round(e);
170
169
  return `${Math.floor(t / 60)}:${String(t % 60).padStart(2, "0")}`;
171
170
  }
172
- function H(e) {
171
+ function V(e) {
173
172
  let t = i(12), { placeholder: n, file: r, glyph: a } = e, o;
174
- t[0] === a ? o = t[1] : (o = /* @__PURE__ */ w("span", {
173
+ t[0] === a ? o = t[1] : (o = /* @__PURE__ */ T("span", {
175
174
  "aria-hidden": !0,
176
175
  children: [a, " "]
177
176
  }), t[0] = a, t[1] = o);
178
177
  let s = r.name || n, c;
179
- t[2] !== o || t[3] !== s ? (c = /* @__PURE__ */ w("span", {
178
+ t[2] !== o || t[3] !== s ? (c = /* @__PURE__ */ T("span", {
180
179
  className: "text-foreground truncate",
181
180
  children: [o, s]
182
181
  }), t[2] = o, t[3] = s, t[4] = c) : c = t[4];
183
182
  let l = r.type || "file", u;
184
- t[5] === l ? u = t[6] : (u = /* @__PURE__ */ C("span", {
183
+ t[5] === l ? u = t[6] : (u = /* @__PURE__ */ w("span", {
185
184
  className: "truncate",
186
185
  children: l
187
186
  }), t[5] = l, t[6] = u);
188
187
  let d;
189
- return t[7] !== r.name || t[8] !== n || t[9] !== c || t[10] !== u ? (d = /* @__PURE__ */ w("div", {
188
+ return t[7] !== r.name || t[8] !== n || t[9] !== c || t[10] !== u ? (d = /* @__PURE__ */ T("div", {
190
189
  role: "img",
191
190
  "aria-label": n,
192
191
  title: r.name,
@@ -196,15 +195,15 @@ function H(e) {
196
195
  }
197
196
  //#endregion
198
197
  //#region src/lib/ComposerVisibility.ts
199
- function U(e, t) {
198
+ function H(e, t) {
200
199
  return e === "hidden" ? !1 : e === "before-interaction" ? !t : e !== "after-interaction" || t;
201
200
  }
202
201
  //#endregion
203
202
  //#region src/lib/ComposerSlashCommands.ts
204
- function W(e, t, n) {
205
- let r = K(e), i = t.filter((e) => ae(e) && U(e.visibility, n));
203
+ function oe(e, t, n) {
204
+ let r = W(e), i = t.filter((e) => G(e) && H(e.visibility, n));
206
205
  return r ? i.map((e, t) => {
207
- let n = se(r, e);
206
+ let n = ce(r, e);
208
207
  return n === null ? null : {
209
208
  command: e,
210
209
  rank: n,
@@ -212,52 +211,52 @@ function W(e, t, n) {
212
211
  };
213
212
  }).filter((e) => !!e).sort((e, t) => e.rank - t.rank || e.index - t.index).map((e) => e.command).slice(0, 10) : i.slice(0, 10);
214
213
  }
215
- function G(e, t) {
214
+ function U(e, t) {
216
215
  let n = e.toLowerCase();
217
- return t.find((e) => ae(e) && (e.value.toLowerCase() === n || oe(e).some((e) => e === n)));
216
+ return t.find((e) => G(e) && (e.value.toLowerCase() === n || se(e).some((e) => e === n)));
218
217
  }
219
- function K(e) {
218
+ function W(e) {
220
219
  return e.slice(1).toLowerCase();
221
220
  }
222
- function ae(e) {
221
+ function G(e) {
223
222
  return e.availability !== "disabled";
224
223
  }
225
- function oe(e) {
224
+ function se(e) {
226
225
  return (e.aliases ?? []).map((e) => e.toLowerCase());
227
226
  }
228
- function se(e, t) {
229
- let n = t.value.toLowerCase(), r = oe(t), i = [t.label.toLowerCase(), ...(t.searchTerms ?? []).map((e) => e.toLowerCase())];
227
+ function ce(e, t) {
228
+ let n = t.value.toLowerCase(), r = se(t), i = [t.label.toLowerCase(), ...(t.searchTerms ?? []).map((e) => e.toLowerCase())];
230
229
  return n === e ? 0 : r.some((t) => t === e) ? 1 : n.startsWith(e) ? 2 : r.some((t) => t.startsWith(e)) ? 3 : i.some((t) => t.startsWith(e)) ? 4 : null;
231
230
  }
232
231
  //#endregion
233
232
  //#region src/lib/ComposerTriggers.ts
234
- function q(e) {
235
- return e.map(T).join("|");
233
+ function le(e) {
234
+ return e.map(RegExp.escape).join("|");
236
235
  }
237
- function ce(e) {
238
- return `(?:${q(e)})[A-Za-z0-9_:-]+`;
236
+ function ue(e) {
237
+ return `(?:${le(e)})[A-Za-z0-9_:-]+`;
239
238
  }
240
- function J(e) {
241
- return `(?:${q(e)})[^\\s]+`;
239
+ function de(e) {
240
+ return `(?:${le(e)})[^\\s]+`;
242
241
  }
243
- function le(e, t) {
242
+ function fe(e, t) {
244
243
  let n = [];
245
- return t.length > 0 && n.push(J(t)), e.length > 0 && n.push(ce(e)), n.length > 0 ? new RegExp(n.join("|"), "g") : null;
244
+ return t.length > 0 && n.push(de(t)), e.length > 0 && n.push(ue(e)), n.length > 0 ? new RegExp(n.join("|"), "g") : null;
246
245
  }
247
- function ue(e, t) {
246
+ function pe(e, t) {
248
247
  return t.some((t) => e.startsWith(t));
249
248
  }
250
- function Y(e) {
249
+ function K(e) {
251
250
  return `${e.trigger}${e.value}`;
252
251
  }
253
252
  //#endregion
254
253
  //#region src/lib/ComposerCore.ts
255
- function de({ initialDraft: e, text: t = "", slashCommands: n = [], mentionCandidates: r = [], commandTriggers: i = [], remoteImageUrls: a = [], isTaskRunning: o = !1, queueSubmissions: s = !1 } = {}) {
254
+ function q({ initialDraft: e, text: t = "", slashCommands: n = [], mentionCandidates: r = [], commandTriggers: i = [], remoteImageUrls: a = [], isTaskRunning: o = !1, queueSubmissions: s = !1 } = {}) {
256
255
  let c = e?.text ?? t, l = r.flatMap((e) => {
257
- let t = Me("mention", Y(e), c, { detail: e.detail });
256
+ let t = Pe("mention", K(e), c, { detail: e.detail });
258
257
  return t ? [t] : [];
259
258
  }), u = l.flatMap((e) => {
260
- let t = r.find((t) => Y(t) === e.label);
259
+ let t = r.find((t) => K(t) === e.label);
261
260
  return t ? [{
262
261
  id: e.id,
263
262
  trigger: t.trigger,
@@ -266,13 +265,13 @@ function de({ initialDraft: e, text: t = "", slashCommands: n = [], mentionCandi
266
265
  persistsAs: t.persistsAs
267
266
  }] : [];
268
267
  }), d = e?.remoteImages ?? (e?.remoteImageUrls ?? a).map((e, t) => ({
269
- id: ct("remote-image", e, t),
268
+ id: $("remote-image", e, t),
270
269
  url: e
271
270
  }));
272
271
  return {
273
272
  text: c,
274
273
  cursor: c.length,
275
- elements: Q(e?.elements ?? [...ge(c, n, i), ...l]),
274
+ elements: X(e?.elements ?? [...ve(c, n, i), ...l]),
276
275
  mentionBindings: e?.mentionBindings ?? u,
277
276
  imageAttachments: [],
278
277
  remoteImages: d,
@@ -288,47 +287,47 @@ function de({ initialDraft: e, text: t = "", slashCommands: n = [], mentionCandi
288
287
  killBuffer: ""
289
288
  };
290
289
  }
291
- function fe(e) {
290
+ function me(e) {
292
291
  return e.text.length === 0 && e.imageAttachments.length === 0 && e.remoteImages.length === 0 && e.pendingPastes.length === 0;
293
292
  }
294
- function pe(e, t, n) {
295
- return he(e, t, n);
293
+ function he(e, t, n) {
294
+ return J(e, t, n);
296
295
  }
297
- function me(e, t) {
296
+ function ge(e, t) {
298
297
  if (!t || t < 1) return null;
299
- let n = ze(e.prompt);
298
+ let n = Z(e.prompt);
300
299
  return n <= t ? null : `Prompt is too long after expanding pasted content (${n} chars; max ${t} chars).`;
301
300
  }
302
- function X(e, t, n) {
303
- let r = Ee(e.elements, e.text);
304
- r = [...r.filter((e) => e.kind !== "slash-command"), ...ge(e.text, t, n)];
301
+ function _e(e, t, n) {
302
+ let r = Oe(e.elements, e.text);
303
+ r = [...r.filter((e) => e.kind !== "slash-command"), ...ve(e.text, t, n)];
305
304
  let i = e.mentionBindings.filter((e) => r.some((t) => t.id === e.id)), a = e.imageAttachments.filter((e) => r.some((t) => t.kind === "image" && t.label === e.placeholder)), o = e.pendingPastes.filter((e) => r.some((t) => t.kind === "paste" && t.label === e.placeholder));
306
305
  return {
307
306
  ...e,
308
- elements: Q(r),
307
+ elements: X(r),
309
308
  mentionBindings: i,
310
- imageAttachments: Le(a, e.remoteImages.length),
309
+ imageAttachments: ze(a, e.remoteImages.length),
311
310
  pendingPastes: o
312
311
  };
313
312
  }
314
- function he(e, t, n) {
315
- let r = e.text.trim(), i = Se(e.text, r, e.elements), a = be(e.text, e.elements, e.pendingPastes), o = a.text, s = o.trim(), c = Se(o, s, a.elements), l = e.imageAttachments.filter((t) => e.text.includes(t.placeholder)), u = Ce(r, i), d = $({
313
+ function J(e, t, n) {
314
+ let r = e.text.trim(), i = we(e.text, r, e.elements), a = Se(e.text, e.elements, e.pendingPastes), o = a.text, s = o.trim(), c = we(o, s, a.elements), l = e.imageAttachments.filter((t) => e.text.includes(t.placeholder)), u = Te(r, i), d = Ke({
316
315
  text: u.text,
317
316
  elements: u.elements,
318
317
  mentionBindings: e.mentionBindings
319
- }), f = $({
318
+ }), f = Ke({
320
319
  text: s,
321
320
  elements: c,
322
321
  mentionBindings: e.mentionBindings
323
322
  });
324
323
  if (!s && l.length === 0 && e.remoteImages.length === 0) return null;
325
- let p = ue(o, n) ? Z(s, c, t, n) : null, m = p?.prompt === void 0 ? null : p.args ? `${p.prompt}\n\n${$({
324
+ let p = pe(o, n) ? ye(s, c, t, n) : null, m = p?.prompt === void 0 ? null : p.args ? `${p.prompt}\n\n${Ke({
326
325
  text: p.args,
327
326
  elements: p.argsElements,
328
327
  mentionBindings: e.mentionBindings
329
328
  })}` : p.prompt, h = p?.prompt === void 0 ? null : p.args ? (() => {
330
- let t = Ce(p.args, p.argsElements);
331
- return `${p.prompt}\n\n${$({
329
+ let t = Te(p.args, p.argsElements);
330
+ return `${p.prompt}\n\n${Ke({
332
331
  text: t.text,
333
332
  elements: t.elements,
334
333
  mentionBindings: e.mentionBindings
@@ -377,16 +376,16 @@ function he(e, t, n) {
377
376
  mentionBindings: e.mentionBindings
378
377
  };
379
378
  }
380
- function ge(e, t, n) {
379
+ function ve(e, t, n) {
381
380
  let r = [];
382
381
  if (n.length === 0) return r;
383
- let i = e.matchAll(RegExp(`(^|\\s)((?:${q(n)})([A-Za-z0-9_:-]+))(?=\\s|$)`, "g"));
382
+ let i = e.matchAll(RegExp(`(^|\\s)((?:${le(n)})([A-Za-z0-9_:-]+))(?=\\s|$)`, "g"));
384
383
  for (let e of i) {
385
- let n = G(e[3], t);
384
+ let n = U(e[3], t);
386
385
  if (!n) continue;
387
386
  let i = e[2], a = e.index + e[1].length;
388
387
  r.push({
389
- id: ct("slash-command", i, a),
388
+ id: $("slash-command", i, a),
390
389
  kind: "slash-command",
391
390
  label: i,
392
391
  range: {
@@ -398,10 +397,10 @@ function ge(e, t, n) {
398
397
  }
399
398
  return r;
400
399
  }
401
- function Z(e, t, n, r) {
402
- let i = e.match(RegExp(`^(?:${q(r)})([A-Za-z0-9_:-]+)(?:\\s+([\\s\\S]+))?$`));
400
+ function ye(e, t, n, r) {
401
+ let i = e.match(RegExp(`^(?:${le(r)})([A-Za-z0-9_:-]+)(?:\\s+([\\s\\S]+))?$`));
403
402
  if (!i) return null;
404
- let a = G(i[1], n);
403
+ let a = U(i[1], n);
405
404
  if (!a) return null;
406
405
  let o = i[2] ?? "";
407
406
  if (!o.trim()) return {
@@ -414,15 +413,15 @@ function Z(e, t, n, r) {
414
413
  command: a.value,
415
414
  prompt: a.expandsTo,
416
415
  args: u,
417
- argsElements: xe(t, l, l + u.length)
416
+ argsElements: Ce(t, l, l + u.length)
418
417
  };
419
418
  }
420
- function _e(e, t, n) {
419
+ function be(e, t, n) {
421
420
  if (n.length === 0) return null;
422
- let r = e.match(RegExp(`^(?:${q(n)})([A-Za-z0-9_:-]+)(?:\\s+[\\s\\S]*)?$`));
423
- return !r || G(r[1], t) || ye(r[1]) ? null : r[1];
421
+ let r = e.match(RegExp(`^(?:${le(n)})([A-Za-z0-9_:-]+)(?:\\s+[\\s\\S]*)?$`));
422
+ return !r || U(r[1], t) || xe(r[1]) ? null : r[1];
424
423
  }
425
- var ve = /* @__PURE__ */ new Set([
424
+ var Y = /* @__PURE__ */ new Set([
426
425
  "Applications",
427
426
  "Library",
428
427
  "System",
@@ -441,10 +440,10 @@ var ve = /* @__PURE__ */ new Set([
441
440
  "var",
442
441
  "workspace"
443
442
  ]);
444
- function ye(e) {
445
- return ve.has(e);
443
+ function xe(e) {
444
+ return Y.has(e);
446
445
  }
447
- function be(e, t, n) {
446
+ function Se(e, t, n) {
448
447
  if (n.length === 0 || t.length === 0) return {
449
448
  text: e,
450
449
  elements: t
@@ -455,7 +454,7 @@ function be(e, t, n) {
455
454
  t.push(e.content), r.set(e.placeholder, t);
456
455
  }
457
456
  let i = "", a = [], o = 0;
458
- for (let n of Q(t)) {
457
+ for (let n of X(t)) {
459
458
  let t = Math.min(n.range.start, e.length), s = Math.min(n.range.end, e.length);
460
459
  if (t > s) continue;
461
460
  t > o && (i += e.slice(o, t));
@@ -478,7 +477,7 @@ function be(e, t, n) {
478
477
  elements: a
479
478
  };
480
479
  }
481
- function xe(e, t, n) {
480
+ function Ce(e, t, n) {
482
481
  return e.filter((e) => e.range.end > t && e.range.start < n).map((e) => ({
483
482
  ...e,
484
483
  range: {
@@ -487,7 +486,7 @@ function xe(e, t, n) {
487
486
  }
488
487
  })).filter((e) => e.range.start < e.range.end);
489
488
  }
490
- function Se(e, t, n) {
489
+ function we(e, t, n) {
491
490
  let r = e.indexOf(t);
492
491
  return r <= 0 ? n : n.filter((e) => e.range.end > r).map((e) => ({
493
492
  ...e,
@@ -497,13 +496,13 @@ function Se(e, t, n) {
497
496
  }
498
497
  }));
499
498
  }
500
- function Ce(e, t) {
501
- let n = Q(t.filter((e) => e.kind === "image"));
502
- for (let t of n.toReversed()) e = Te(e, t.range, "");
499
+ function Te(e, t) {
500
+ let n = X(t.filter((e) => e.kind === "image"));
501
+ for (let t of n.toReversed()) e = De(e, t.range, "");
503
502
  let r = (e) => n.reduce((t, n) => t + Math.max(0, Math.min(e, n.range.end) - n.range.start), 0);
504
503
  return {
505
504
  text: e,
506
- elements: Q(t.filter((e) => e.kind !== "image")).map((e) => ({
505
+ elements: X(t.filter((e) => e.kind !== "image")).map((e) => ({
507
506
  ...e,
508
507
  range: {
509
508
  start: e.range.start - r(e.range.start),
@@ -512,25 +511,25 @@ function Ce(e, t) {
512
511
  }))
513
512
  };
514
513
  }
515
- function we(e, t, n, r) {
514
+ function Ee(e, t, n, r) {
516
515
  return e < r && t > n;
517
516
  }
518
- function Te(e, t, n) {
517
+ function De(e, t, n) {
519
518
  return e.slice(0, t.start) + n + e.slice(t.end);
520
519
  }
521
- function Ee(e, t) {
520
+ function Oe(e, t) {
522
521
  let n = /* @__PURE__ */ new Map();
523
- return Q(e).map((e) => {
524
- let r = De(t, e.label);
522
+ return X(e).map((e) => {
523
+ let r = ke(t, e.label);
525
524
  if (r.length === 0) return null;
526
- let i = `${e.kind}:${e.label}`, a = n.get(i) ?? [], o = Oe(r, e, a) ?? ke(r, e, a) ?? Ae(r, e);
525
+ let i = `${e.kind}:${e.label}`, a = n.get(i) ?? [], o = Ae(r, e, a) ?? je(r, e, a) ?? Me(r, e);
527
526
  return n.set(i, [...a, o]), {
528
527
  ...e,
529
528
  range: o
530
529
  };
531
530
  }).filter((e) => !!e);
532
531
  }
533
- function De(e, t) {
532
+ function ke(e, t) {
534
533
  if (!t) return [];
535
534
  let n = [], r = e.indexOf(t);
536
535
  for (; r !== -1;) n.push({
@@ -539,22 +538,22 @@ function De(e, t) {
539
538
  }), r = e.indexOf(t, r + t.length);
540
539
  return n;
541
540
  }
542
- function Oe(e, t, n) {
543
- return e.find((e) => e.start === t.range.start && e.end === t.range.end && !je(e, n));
541
+ function Ae(e, t, n) {
542
+ return e.find((e) => e.start === t.range.start && e.end === t.range.end && !Ne(e, n));
544
543
  }
545
- function ke(e, t, n) {
546
- return Ae(e.filter((e) => !je(e, n)), t);
544
+ function je(e, t, n) {
545
+ return Me(e.filter((e) => !Ne(e, n)), t);
547
546
  }
548
- function Ae(e, t) {
547
+ function Me(e, t) {
549
548
  return [...e].sort((e, n) => Math.abs(e.start - t.range.start) - Math.abs(n.start - t.range.start) || e.start - n.start)[0];
550
549
  }
551
- function je(e, t) {
552
- return t.some((t) => e.start === t.start && e.end === t.end && we(e.start, e.end, t.start, t.end));
550
+ function Ne(e, t) {
551
+ return t.some((t) => e.start === t.start && e.end === t.end && Ee(e.start, e.end, t.start, t.end));
553
552
  }
554
- function Me(e, t, n, r = {}) {
553
+ function Pe(e, t, n, r = {}) {
555
554
  let i = n.indexOf(t);
556
555
  return i === -1 ? null : {
557
- id: ct(e, t, i),
556
+ id: $(e, t, i),
558
557
  kind: e,
559
558
  label: t,
560
559
  range: {
@@ -564,95 +563,95 @@ function Me(e, t, n, r = {}) {
564
563
  detail: r.detail
565
564
  };
566
565
  }
567
- function Q(e) {
566
+ function X(e) {
568
567
  return [...e].sort((e, t) => e.range.start - t.range.start);
569
568
  }
570
- var Ne = {
569
+ var Fe = {
571
570
  image: "Image",
572
571
  video: "Video",
573
572
  audio: "Audio"
574
573
  };
575
- function Pe(e) {
574
+ function Ie(e) {
576
575
  let t = e.type.split("/")[0];
577
576
  return t === "image" || t === "video" || t === "audio" ? t : null;
578
577
  }
579
- function Fe(e) {
578
+ function Le(e) {
580
579
  return e === "video" || e === "audio" ? e : "image";
581
580
  }
582
- function Ie(e, t) {
583
- return `[${Ne[e]} #${t}]`;
581
+ function Re(e, t) {
582
+ return `[${Fe[e]} #${t}]`;
584
583
  }
585
- function Le(e, t) {
584
+ function ze(e, t) {
586
585
  return e.map((e, n) => ({
587
586
  ...e,
588
- placeholder: Ie(e.media, t + n + 1)
587
+ placeholder: Re(e.media, t + n + 1)
589
588
  }));
590
589
  }
591
- function Re(e, t) {
590
+ function Be(e, t) {
592
591
  if (!t) return null;
593
592
  let n = e.remoteImages.findIndex((e) => e.id === t);
594
593
  return n === -1 ? null : n;
595
594
  }
596
- function ze(e) {
595
+ function Z(e) {
597
596
  return Array.from(e).length;
598
597
  }
599
- function Be(e) {
600
- let t = Ce(e.text, e.elements);
598
+ function Ve(e) {
599
+ let t = Te(e.text, e.elements);
601
600
  return {
602
601
  text: t.text,
603
- elements: et(t.elements),
604
- mentionBindings: tt(e.mentionBindings),
602
+ elements: tt(t.elements),
603
+ mentionBindings: nt(e.mentionBindings),
605
604
  remoteImages: e.remoteImages.map((e) => ({ ...e })),
606
- pendingPastes: nt(e.pendingPastes)
605
+ pendingPastes: rt(e.pendingPastes)
607
606
  };
608
607
  }
609
- function Ve(e, t) {
608
+ function He(e, t) {
610
609
  return {
611
610
  persistedPrompt: t,
612
611
  remoteImages: e.remoteImages.map((e) => ({ ...e })),
613
- pendingPastes: nt(e.pendingPastes)
612
+ pendingPastes: rt(e.pendingPastes)
614
613
  };
615
614
  }
616
- function He(e, t) {
617
- let n = Ve(e, t);
615
+ function Ue(e, t) {
616
+ let n = He(e, t);
618
617
  return !n.persistedPrompt.trim() && n.remoteImages.length === 0 && n.pendingPastes.length === 0 ? e.history : [n, ...e.history].slice(0, 8);
619
618
  }
620
- function Ue({ text: e, slashCommands: t = [], commandTriggers: n = [], mentionCandidates: r = [] }) {
621
- let i = Ke(e, r), a = Ze(i.text, i.elements, i.protectedRanges, t, r);
622
- return Be(X(de({
619
+ function We({ text: e, slashCommands: t = [], commandTriggers: n = [], mentionCandidates: r = [] }) {
620
+ let i = Q(e, r), a = Qe(i.text, i.elements, i.protectedRanges, t, r);
621
+ return Ve(_e(q({
623
622
  initialDraft: {
624
623
  text: i.text,
625
- elements: Q([...i.elements, ...a.elements]),
624
+ elements: X([...i.elements, ...a.elements]),
626
625
  mentionBindings: [...i.mentionBindings, ...a.mentionBindings]
627
626
  },
628
627
  slashCommands: t
629
628
  }), t, n));
630
629
  }
631
- function We({ source: e, slashCommands: t = [], mentionCandidates: n = [] }) {
632
- let r = Ue({
630
+ function Ge({ source: e, slashCommands: t = [], mentionCandidates: n = [] }) {
631
+ let r = We({
633
632
  text: e.persistedPrompt,
634
633
  slashCommands: t,
635
634
  mentionCandidates: n
636
635
  }), i = [...e.pendingPastes.flatMap((e) => {
637
- let t = Me("paste", e.placeholder, r.text ?? "", { detail: `${ze(e.content)} chars` });
636
+ let t = Pe("paste", e.placeholder, r.text ?? "", { detail: `${Z(e.content)} chars` });
638
637
  return t ? [t] : [];
639
638
  })];
640
639
  return {
641
640
  ...r,
642
- elements: Q([...r.elements ?? [], ...i]),
641
+ elements: X([...r.elements ?? [], ...i]),
643
642
  remoteImages: e.remoteImages.map((e) => ({ ...e })),
644
- pendingPastes: nt(e.pendingPastes)
643
+ pendingPastes: rt(e.pendingPastes)
645
644
  };
646
645
  }
647
- function $(e) {
648
- let t = e.text ?? "", n = Q(e.elements ?? []).map((t) => $e(t, e)).filter((e) => !!e).sort((e, t) => t.range.start - e.range.start);
649
- for (let e of n) t = Te(t, e.range, e.text);
646
+ function Ke(e) {
647
+ let t = e.text ?? "", n = X(e.elements ?? []).map((t) => et(t, e)).filter((e) => !!e).sort((e, t) => t.range.start - e.range.start);
648
+ for (let e of n) t = De(t, e.range, e.text);
650
649
  return t;
651
650
  }
652
- function Ge(e) {
651
+ function qe(e) {
653
652
  return e.startsWith("composer-text-link://") ? decodeURIComponent(e.replace(/^composer-text-link:\/\//, "")) : e;
654
653
  }
655
- function Ke(e, t) {
654
+ function Q(e, t) {
656
655
  let n = [], i = [], a = [], o = "";
657
656
  for (let s of r(e)) {
658
657
  if (s.kind === "inline-code" || s.kind === "code-block") {
@@ -667,9 +666,9 @@ function Ke(e, t) {
667
666
  o += s.source;
668
667
  continue;
669
668
  }
670
- let e = s.label, r = s.href, c = Ge(r), l = qe(e, t), u = l ? Y(l) : e, d = o.length;
669
+ let e = s.label, r = s.href, c = qe(r), l = Je(e, t), u = l ? K(l) : e, d = o.length;
671
670
  if (o += u, l) {
672
- let e = ct("mention", u, d);
671
+ let e = $("mention", u, d);
673
672
  n.push({
674
673
  id: e,
675
674
  kind: "mention",
@@ -687,7 +686,7 @@ function Ke(e, t) {
687
686
  persistsAs: l.persistsAs
688
687
  });
689
688
  } else n.push({
690
- id: ct("link", u, d),
689
+ id: $("link", u, d),
691
690
  kind: "link",
692
691
  label: u,
693
692
  range: {
@@ -704,30 +703,30 @@ function Ke(e, t) {
704
703
  protectedRanges: a
705
704
  };
706
705
  }
707
- function qe(e, t) {
708
- return t.find((t) => Y(t) === e) ?? null;
706
+ function Je(e, t) {
707
+ return t.find((t) => K(t) === e) ?? null;
709
708
  }
710
- function Je(e) {
709
+ function Ye(e) {
711
710
  return [...new Set(e.map((e) => e.trigger).filter(Boolean))].sort((e, t) => t.length - e.length);
712
711
  }
713
- function Ye(e) {
714
- let t = Je(e);
715
- return t.length === 0 ? null : RegExp(`(?:${t.map(T).join("|")})[A-Za-z0-9_:-]+`, "g");
712
+ function Xe(e) {
713
+ let t = Ye(e);
714
+ return t.length === 0 ? null : RegExp(`(?:${le(t)})[A-Za-z0-9_:-]+`, "g");
716
715
  }
717
- function Xe(e, t) {
718
- return Je(t).find((t) => e.startsWith(t))?.length ?? 0;
716
+ function Ze(e, t) {
717
+ return Ye(t).find((t) => e.startsWith(t))?.length ?? 0;
719
718
  }
720
- function Ze(e, t, n, r, i) {
719
+ function Qe(e, t, n, r, i) {
721
720
  let a = [], o = [], s = [], c = (r, i) => {
722
721
  let a = r + i.length;
723
- return (r === 0 || /\s/.test(e[r - 1] ?? "")) && !Qe(r, i, t) && !s.some((e) => r < e.end && a > e.start) && !n.some((e) => r < e.end && a > e.start);
724
- }, l = [...i].sort((e, t) => Y(t).length - Y(e).length);
722
+ return (r === 0 || /\s/.test(e[r - 1] ?? "")) && !$e(r, i, t) && !s.some((e) => r < e.end && a > e.start) && !n.some((e) => r < e.end && a > e.start);
723
+ }, l = [...i].sort((e, t) => K(t).length - K(e).length);
725
724
  for (let t of l) {
726
- let n = Y(t);
725
+ let n = K(t);
727
726
  if (n) for (let r = e.indexOf(n); r !== -1; r = e.indexOf(n, r + n.length)) {
728
727
  let i = r + n.length;
729
728
  if (/[\w-]/.test(e[i] ?? "") || !c(r, n)) continue;
730
- let l = ct("mention", n, r);
729
+ let l = $("mention", n, r);
731
730
  s.push({
732
731
  start: r,
733
732
  end: i
@@ -749,16 +748,16 @@ function Ze(e, t, n, r, i) {
749
748
  });
750
749
  }
751
750
  }
752
- let u = Ye(r);
751
+ let u = Xe(r);
753
752
  for (let t of u ? e.matchAll(u) : []) {
754
753
  let e = t.index ?? 0, n = t[0];
755
754
  if (!c(e, n)) continue;
756
- let i = G(n.slice(Xe(n, r)), r);
755
+ let i = U(n.slice(Ze(n, r)), r);
757
756
  i && (s.push({
758
757
  start: e,
759
758
  end: e + n.length
760
759
  }), a.push({
761
- id: ct("slash-command", n, e),
760
+ id: $("slash-command", n, e),
762
761
  kind: "slash-command",
763
762
  label: n,
764
763
  range: {
@@ -773,11 +772,11 @@ function Ze(e, t, n, r, i) {
773
772
  mentionBindings: o
774
773
  };
775
774
  }
776
- function Qe(e, t, n) {
775
+ function $e(e, t, n) {
777
776
  let r = e + t.length;
778
777
  return n.some((t) => e < t.range.end && r > t.range.start);
779
778
  }
780
- function $e(e, n) {
779
+ function et(e, n) {
781
780
  if (e.kind === "mention") {
782
781
  let t = (n.mentionBindings ?? []).find((t) => t.id === e.id || `${t.trigger}${t.value}` === e.label);
783
782
  return t ? {
@@ -790,7 +789,7 @@ function $e(e, n) {
790
789
  text: t(e.label, e.detail)
791
790
  } : null;
792
791
  }
793
- function et(e) {
792
+ function tt(e) {
794
793
  return e.map((e) => {
795
794
  let t = {
796
795
  ...e,
@@ -802,13 +801,13 @@ function et(e) {
802
801
  } : t;
803
802
  });
804
803
  }
805
- function tt(e) {
804
+ function nt(e) {
806
805
  return e.map((e) => ({ ...e }));
807
806
  }
808
- function nt(e) {
807
+ function rt(e) {
809
808
  return e.map((e) => ({ ...e }));
810
809
  }
811
- function rt(e, t, n, r = 1) {
810
+ function it(e, t, n, r = 1) {
812
811
  if (t.length === 0) return null;
813
812
  let i = t.toLowerCase(), a = e.map((e, t) => ({
814
813
  index: t,
@@ -817,12 +816,12 @@ function rt(e, t, n, r = 1) {
817
816
  if (a.length === 0) return null;
818
817
  if (n === null) return a[0];
819
818
  let o = a.findIndex((e) => e.index === n);
820
- return o === -1 ? a[0] : a[st(o + r, a.length)];
819
+ return o === -1 ? a[0] : a[ct(o + r, a.length)];
821
820
  }
822
- function it(e, t, n) {
821
+ function at(e, t, n) {
823
822
  return n === -1 ? t === 0 || !e.slice(0, t).includes("\n") : t === e.length || !e.slice(t).includes("\n");
824
823
  }
825
- function at(e, t) {
824
+ function ot(e, t) {
826
825
  let n = lt(e, t);
827
826
  for (; n > 0 && gt(ft(e, n));) n = ut(e, n);
828
827
  if (n === 0) return 0;
@@ -831,7 +830,7 @@ function at(e, t) {
831
830
  for (; n > 0 && yt(ft(e, n)) === r;) n = ut(e, n);
832
831
  return n;
833
832
  }
834
- function ot(e, t) {
833
+ function st(e, t) {
835
834
  let n = lt(e, t);
836
835
  for (; n < e.length && gt(pt(e, n));) n = dt(e, n);
837
836
  if (n >= e.length) return e.length;
@@ -840,10 +839,10 @@ function ot(e, t) {
840
839
  for (; n < e.length && yt(pt(e, n)) === r;) n = dt(e, n);
841
840
  return n;
842
841
  }
843
- function st(e, t) {
842
+ function ct(e, t) {
844
843
  return (e % t + t) % t;
845
844
  }
846
- function ct(e, t, n) {
845
+ function $(e, t, n) {
847
846
  return `${e}:${n}:${t}`;
848
847
  }
849
848
  function lt(e, t) {
@@ -1025,18 +1024,18 @@ function Lt(e, t) {
1025
1024
  //#endregion
1026
1025
  //#region src/lib/ComposerSuggestions.ts
1027
1026
  function Rt(e, t, n, r) {
1028
- return [...W(e.query, t.filter((t) => t.trigger === e.trigger), r), ...zt(e.query, n.filter((t) => t.trigger === e.trigger), r)];
1027
+ return [...oe(e.query, t.filter((t) => t.trigger === e.trigger), r), ...zt(e.query, n.filter((t) => t.trigger === e.trigger), r)];
1029
1028
  }
1030
1029
  function zt(e, t, n) {
1031
1030
  let r = e.slice(1).toLowerCase();
1032
- return t.filter((e) => U(e.visibility, n) && (e.label.toLowerCase().includes(r) || Y(e).slice(1).toLowerCase().includes(r))).slice(0, 10);
1031
+ return t.filter((e) => H(e.visibility, n) && (e.label.toLowerCase().includes(r) || K(e).slice(1).toLowerCase().includes(r))).slice(0, 10);
1033
1032
  }
1034
1033
  //#endregion
1035
1034
  //#region src/lib/dictation/ComposerDictationContext.ts
1036
1035
  var Bt = f(null);
1037
1036
  function Vt(e) {
1038
1037
  let t = e === void 0 ? "useComposerDictation" : e;
1039
- N(t);
1038
+ M(t);
1040
1039
  let n = h(Bt);
1041
1040
  if (!n) throw Error(`${t} needs the dictation prop of Composer.Root.`);
1042
1041
  return n;
@@ -1049,10 +1048,10 @@ function Ht(e, t) {
1049
1048
  function Ut(e) {
1050
1049
  let t = i(15), n, r, o;
1051
1050
  t[0] === e ? (n = t[1], r = t[2], o = t[3]) : ({render: o, disabled: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = o);
1052
- let { disabled: s } = N("Composer.Dictate"), { state: c, start: l, stop: u } = Vt("Composer.Dictate"), d = c.status === "recording", f = (c.status === "idle" || c.status === "failed") && n !== !0 && !s, p = c.status, m = c.status === "finishing" ? c.end : void 0, h = !d && !f, g = d ? u : l, _;
1051
+ let { disabled: s } = M("Composer.Dictate"), { state: c, start: l, stop: u } = Vt("Composer.Dictate"), d = c.status === "recording", f = (c.status === "idle" || c.status === "failed") && n !== !0 && !s, p = c.status, m = c.status === "finishing" ? c.end : void 0, h = !d && !f, g = d ? u : l, _;
1053
1052
  t[4] !== o || t[5] !== c ? (_ = Ht(o, c), t[4] = o, t[5] = c, t[6] = _) : _ = t[6];
1054
1053
  let v;
1055
- return t[7] !== r || t[8] !== d || t[9] !== c.status || t[10] !== m || t[11] !== h || t[12] !== g || t[13] !== _ ? (v = /* @__PURE__ */ C(a, {
1054
+ return t[7] !== r || t[8] !== d || t[9] !== c.status || t[10] !== m || t[11] !== h || t[12] !== g || t[13] !== _ ? (v = /* @__PURE__ */ w(a, {
1056
1055
  ...r,
1057
1056
  "data-status": p,
1058
1057
  "data-end": m,
@@ -1068,7 +1067,7 @@ function Wt(e) {
1068
1067
  let { state: s, cancel: c } = Vt("Composer.CancelDictation"), l = s.status === "starting" || s.status === "recording" || s.status === "finishing", u = s.status, d = !l || n === !0, f;
1069
1068
  t[4] !== o || t[5] !== s ? (f = Ht(o, s), t[4] = o, t[5] = s, t[6] = f) : f = t[6];
1070
1069
  let p;
1071
- return t[7] !== c || t[8] !== r || t[9] !== s.status || t[10] !== d || t[11] !== f ? (p = /* @__PURE__ */ C(a, {
1070
+ return t[7] !== c || t[8] !== r || t[9] !== s.status || t[10] !== d || t[11] !== f ? (p = /* @__PURE__ */ w(a, {
1072
1071
  ...r,
1073
1072
  "data-status": u,
1074
1073
  disabled: d,
@@ -1189,13 +1188,13 @@ var Gt = class extends Error {
1189
1188
  }
1190
1189
  }, Yt = () => () => void 0, Xt = { status: "ended" }, Zt = () => Xt, Qt = () => "unknown";
1191
1190
  function $t(e) {
1192
- let t = i(47), { dictation: n, disabled: r, insertTranscript: a, submitDraft: o } = e, s = "MediaRecorder" in globalThis && "mediaDevices" in navigator, c = n !== void 0, [l] = b(en), u = x(c && s ? l.subscribe : Yt, l.getSnapshot, Qt), [d, f] = b(null), p = x(d ? d.subscribe : Yt, d ? d.getSnapshot : Zt, Zt), [h, v] = b(0), [S, ee] = b("insert"), te = y("insert"), C = y(null), w;
1191
+ let t = i(47), { dictation: n, disabled: r, insertTranscript: a, submitDraft: o } = e, s = "MediaRecorder" in globalThis && "mediaDevices" in navigator, c = n !== void 0, [l] = x(en), u = ee(c && s ? l.subscribe : Yt, l.getSnapshot, Qt), [d, f] = x(null), p = ee(d ? d.subscribe : Yt, d ? d.getSnapshot : Zt, Zt), [h, v] = x(0), [y, S] = x("insert"), te = b("insert"), C = b(null), w;
1193
1192
  t[0] !== n || t[1] !== a || t[2] !== o ? (w = {
1194
1193
  dictation: n,
1195
1194
  insertTranscript: a,
1196
1195
  submitDraft: o
1197
1196
  }, t[0] = n, t[1] = a, t[2] = o, t[3] = w) : w = t[3];
1198
- let T = y(w), E;
1197
+ let T = b(w), E;
1199
1198
  t[4] !== n || t[5] !== a || t[6] !== o ? (E = () => {
1200
1199
  T.current = {
1201
1200
  dictation: n,
@@ -1231,21 +1230,21 @@ function $t(e) {
1231
1230
  attempt: 0,
1232
1231
  failure: null
1233
1232
  }, t[8] = D, t[9] = O) : (D = t[8], O = t[9]);
1234
- let [k, ne, re] = g(D, O), A, j;
1235
- t[10] !== r || t[11] !== c || t[12] !== d ? (A = () => {
1233
+ let [k, A, ne] = g(D, O), re, j;
1234
+ t[10] !== r || t[11] !== c || t[12] !== d ? (re = () => {
1236
1235
  (r || !c) && (d?.cancel(), C.current?.abort());
1237
1236
  }, j = [
1238
1237
  r,
1239
1238
  c,
1240
1239
  d
1241
- ], t[10] = r, t[11] = c, t[12] = d, t[13] = A, t[14] = j) : (A = t[13], j = t[14]), _(A, j);
1242
- let M, ie;
1243
- if (t[15] === d ? (M = t[16], ie = t[17]) : (M = () => () => {
1240
+ ], t[10] = r, t[11] = c, t[12] = d, t[13] = re, t[14] = j) : (re = t[13], j = t[14]), _(re, j);
1241
+ let ie, ae;
1242
+ if (t[15] === d ? (ie = t[16], ae = t[17]) : (ie = () => () => {
1244
1243
  d?.cancel(), C.current?.abort();
1245
- }, ie = [d], t[15] = d, t[16] = M, t[17] = ie), _(M, ie), !n) return null;
1246
- let N, P;
1247
- if (t[18] !== h || t[19] !== S || t[20] !== k || t[21] !== u || t[22] !== p || t[23] !== re) {
1248
- P = e(), N = P.status === "starting" || P.status === "recording" || P.status === "finishing";
1244
+ }, ae = [d], t[15] = d, t[16] = ie, t[17] = ae), _(ie, ae), !n) return null;
1245
+ let M, N;
1246
+ if (t[18] !== h || t[19] !== y || t[20] !== k || t[21] !== u || t[22] !== p || t[23] !== ne) {
1247
+ N = e(), M = N.status === "starting" || N.status === "recording" || N.status === "finishing";
1249
1248
  function e() {
1250
1249
  if (!s) return {
1251
1250
  status: "unavailable",
@@ -1256,14 +1255,14 @@ function $t(e) {
1256
1255
  case "recording": return { status: "recording" };
1257
1256
  case "stopping": return {
1258
1257
  status: "finishing",
1259
- end: S
1258
+ end: y
1260
1259
  };
1261
1260
  case "ended":
1262
1261
  case "failed":
1263
1262
  }
1264
- return re ? {
1263
+ return ne ? {
1265
1264
  status: "finishing",
1266
- end: S
1265
+ end: y
1267
1266
  } : u === "denied" ? {
1268
1267
  status: "unavailable",
1269
1268
  reason: "blocked"
@@ -1275,56 +1274,56 @@ function $t(e) {
1275
1274
  error: k.failure
1276
1275
  } : { status: "idle" };
1277
1276
  }
1278
- t[18] = h, t[19] = S, t[20] = k, t[21] = u, t[22] = p, t[23] = re, t[24] = N, t[25] = P;
1279
- } else N = t[24], P = t[25];
1280
- let F;
1281
- t[26] === Symbol.for("react.memo_cache_sentinel") ? (F = function(e) {
1282
- te.current = e, ee(e);
1283
- }, t[26] = F) : F = t[26];
1284
- let I = F, L;
1285
- t[27] !== N || t[28] !== h || t[29] !== r || t[30] !== P ? (L = function() {
1286
- if (r || N || P.status === "unavailable") return;
1277
+ t[18] = h, t[19] = y, t[20] = k, t[21] = u, t[22] = p, t[23] = ne, t[24] = M, t[25] = N;
1278
+ } else M = t[24], N = t[25];
1279
+ let P;
1280
+ t[26] === Symbol.for("react.memo_cache_sentinel") ? (P = function(e) {
1281
+ te.current = e, S(e);
1282
+ }, t[26] = P) : P = t[26];
1283
+ let F = P, I;
1284
+ t[27] !== M || t[28] !== h || t[29] !== r || t[30] !== N ? (I = function() {
1285
+ if (r || M || N.status === "unavailable") return;
1287
1286
  let e = h + 1;
1288
- v(e), I("insert"), f(Jt.start((t) => {
1287
+ v(e), F("insert"), f(Jt.start((t) => {
1289
1288
  let n = T.current.dictation;
1290
1289
  n && m(() => {
1291
- ne({
1290
+ A({
1292
1291
  clip: t,
1293
1292
  attempt: e,
1294
1293
  transcribe: n.transcribe
1295
1294
  });
1296
1295
  });
1297
1296
  }));
1298
- }, t[27] = N, t[28] = h, t[29] = r, t[30] = P, t[31] = L) : L = t[31];
1299
- let R = L, z;
1300
- t[32] === d ? z = t[33] : (z = function() {
1297
+ }, t[27] = M, t[28] = h, t[29] = r, t[30] = N, t[31] = I) : I = t[31];
1298
+ let L = I, R;
1299
+ t[32] === d ? R = t[33] : (R = function() {
1301
1300
  d?.stop();
1302
- }, t[32] = d, t[33] = z);
1303
- let B = z, V;
1304
- t[34] === d ? V = t[35] : (V = function() {
1301
+ }, t[32] = d, t[33] = R);
1302
+ let z = R, B;
1303
+ t[34] === d ? B = t[35] : (B = function() {
1305
1304
  d?.cancel(), C.current?.abort();
1306
- }, t[34] = d, t[35] = V);
1307
- let H = V, U;
1308
- t[36] !== d || t[37] !== P ? (U = function() {
1309
- switch (P.status) {
1305
+ }, t[34] = d, t[35] = B);
1306
+ let V = B, H;
1307
+ t[36] !== d || t[37] !== N ? (H = function() {
1308
+ switch (N.status) {
1310
1309
  case "starting": return d?.cancel(), !1;
1311
- case "recording": return I("send"), d?.stop(), !0;
1312
- case "finishing": return I("send"), !0;
1310
+ case "recording": return F("send"), d?.stop(), !0;
1311
+ case "finishing": return F("send"), !0;
1313
1312
  default: return !1;
1314
1313
  }
1315
- }, t[36] = d, t[37] = P, t[38] = U) : U = t[38];
1316
- let W = U, G;
1317
- t[39] !== H || t[40] !== R || t[41] !== P || t[42] !== B ? (G = {
1318
- state: P,
1319
- start: R,
1320
- stop: B,
1321
- cancel: H
1322
- }, t[39] = H, t[40] = R, t[41] = P, t[42] = B, t[43] = G) : G = t[43];
1323
- let K;
1324
- return t[44] !== W || t[45] !== G ? (K = {
1325
- api: G,
1326
- endWithSend: W
1327
- }, t[44] = W, t[45] = G, t[46] = K) : K = t[46], K;
1314
+ }, t[36] = d, t[37] = N, t[38] = H) : H = t[38];
1315
+ let oe = H, U;
1316
+ t[39] !== V || t[40] !== L || t[41] !== N || t[42] !== z ? (U = {
1317
+ state: N,
1318
+ start: L,
1319
+ stop: z,
1320
+ cancel: V
1321
+ }, t[39] = V, t[40] = L, t[41] = N, t[42] = z, t[43] = U) : U = t[43];
1322
+ let W;
1323
+ return t[44] !== oe || t[45] !== U ? (W = {
1324
+ api: U,
1325
+ endWithSend: oe
1326
+ }, t[44] = oe, t[45] = U, t[46] = W) : W = t[46], W;
1328
1327
  }
1329
1328
  function en() {
1330
1329
  return new Kt();
@@ -1333,8 +1332,8 @@ function en() {
1333
1332
  //#region src/lib/tiptap/ComposerTiptapDomain.ts
1334
1333
  function tn(e) {
1335
1334
  return [
1336
- M.configure({ link: !1 }),
1337
- ne.configure({
1335
+ ie.configure({ link: !1 }),
1336
+ A.configure({
1338
1337
  autolink: !0,
1339
1338
  linkOnPaste: !1,
1340
1339
  openOnClick: !1,
@@ -1469,23 +1468,23 @@ function cn(e) {
1469
1468
  return E.create({
1470
1469
  name: "composerClipboard",
1471
1470
  addProseMirrorPlugins() {
1472
- return [new A({ props: {
1471
+ return [new re({ props: {
1473
1472
  handlePaste(t, n) {
1474
1473
  let r = n.clipboardData;
1475
1474
  if (!r) return !1;
1476
- let i = Array.from(r.files).find((e) => Pe(e) !== null);
1475
+ let i = Array.from(r.files).find((e) => Ie(e) !== null);
1477
1476
  if (i) return n.preventDefault(), Ln(t, e.getRemoteImageCount(), i, e.attachImageFile), !0;
1478
- let a = Array.from(r.files).find((e) => Pe(e) === null);
1477
+ let a = Array.from(r.files).find((e) => Ie(e) === null);
1479
1478
  if (a) return n.preventDefault(), Rn(t, a.name || "pasted-file", e.getMentionTrigger()), !0;
1480
- let o = pr(yr(r.getData("text/uri-list")) || br(r.getData("DownloadURL")) || r.getData("text/plain") || r.getData("text")), s = o.trim();
1479
+ let o = fr(_r(r.getData("text/uri-list")) || vr(r.getData("DownloadURL")) || r.getData("text/plain") || r.getData("text")), s = o.trim();
1481
1480
  if (!o) return !1;
1482
1481
  let c = An(t);
1483
- if (c && xr(s)) {
1482
+ if (c && yr(s)) {
1484
1483
  n.preventDefault();
1485
- let e = Sr(s), r = t.state.schema.marks.link;
1484
+ let e = br(s), r = t.state.schema.marks.link;
1486
1485
  return r ? Mn(t, c, e, r) : !1;
1487
1486
  }
1488
- return hr(s) && !s.includes("\n") ? (n.preventDefault(), Rn(t, s, e.getMentionTrigger()), !0) : xr(s) && !s.includes("\n") ? (n.preventDefault(), Fn(t, s, Sr(s))) : c && o && !o.includes("\n") && mr(o) <= nn ? (n.preventDefault(), In(t, o, c), !0) : mr(o) > nn ? (n.preventDefault(), kn(t, o), !0) : !1;
1487
+ return pr(s) && !s.includes("\n") ? (n.preventDefault(), Rn(t, s, e.getMentionTrigger()), !0) : yr(s) && !s.includes("\n") ? (n.preventDefault(), Fn(t, s, br(s))) : c && o && !o.includes("\n") && Z(o) <= nn ? (n.preventDefault(), In(t, o, c), !0) : Z(o) > nn ? (n.preventDefault(), kn(t, o), !0) : !1;
1489
1488
  },
1490
1489
  handleDrop(t, n) {
1491
1490
  let r = n.dataTransfer;
@@ -1496,15 +1495,15 @@ function cn(e) {
1496
1495
  });
1497
1496
  }
1498
1497
  function ln(e, t, n, r, i) {
1499
- let a = Array.from(t.files).find((e) => Pe(e) !== null);
1498
+ let a = Array.from(t.files).find((e) => Ie(e) !== null);
1500
1499
  if (a) return Ln(e, n, a, i), !0;
1501
- let o = Array.from(t.files).find((e) => Pe(e) === null);
1500
+ let o = Array.from(t.files).find((e) => Ie(e) === null);
1502
1501
  if (o) return Rn(e, o.name || "dropped-file", r), !0;
1503
- let s = pr(yr(t.getData("text/uri-list")) || br(t.getData("DownloadURL")) || t.getData("text/plain")).trim();
1504
- return s ? hr(s) && !s.includes("\n") ? (Rn(e, s, r), !0) : xr(s) && !s.includes("\n") ? (Fn(e, s, Sr(s)), !0) : !1 : !1;
1502
+ let s = fr(_r(t.getData("text/uri-list")) || vr(t.getData("DownloadURL")) || t.getData("text/plain")).trim();
1503
+ return s ? pr(s) && !s.includes("\n") ? (Rn(e, s, r), !0) : yr(s) && !s.includes("\n") ? (Fn(e, s, br(s)), !0) : !1 : !1;
1505
1504
  }
1506
1505
  function un({ state: e, text: t, slashCommands: n, mentionCandidates: r, triggers: i }) {
1507
- return e ? dn(de({
1506
+ return e ? dn(q({
1508
1507
  initialDraft: e,
1509
1508
  slashCommands: n,
1510
1509
  commandTriggers: i.commandTriggers,
@@ -1514,13 +1513,13 @@ function un({ state: e, text: t, slashCommands: n, mentionCandidates: r, trigger
1514
1513
  function dn(e, t, n, r) {
1515
1514
  if (e.elements.length === 0) return fn(e.text, t, n, r);
1516
1515
  let i = [], a = 0;
1517
- for (let o of dr(e.elements)) {
1516
+ for (let o of X(e.elements)) {
1518
1517
  o.range.start > a && i.push(...pn(e.text.slice(a, o.range.start), t, n, r.commandTriggers, r.mentionTriggers));
1519
1518
  let s = e.mentionBindings.find((e) => e.id === o.id || `${e.trigger}${e.value}` === o.label), c = e.pendingPastes.find((e) => e.placeholder === o.label);
1520
1519
  o.kind === "mention" && s ? i.push(Cn(wn(s, o, n))) : o.kind === "paste" && c ? i.push(Tn({
1521
1520
  kind: "paste",
1522
1521
  label: c.placeholder,
1523
- detail: o.detail ?? `${mr(c.content)} chars`,
1522
+ detail: o.detail ?? `${Z(c.content)} chars`,
1524
1523
  content: c.content
1525
1524
  })) : o.kind === "rich-link" ? i.push(Tn({
1526
1525
  kind: "rich-link",
@@ -1533,13 +1532,13 @@ function dn(e, t, n, r) {
1533
1532
  return a < e.text.length && i.push(...pn(e.text.slice(a), t, n, r.commandTriggers, r.mentionTriggers)), yn(i);
1534
1533
  }
1535
1534
  function fn(e, t, n, r) {
1536
- let i = Ue({
1535
+ let i = We({
1537
1536
  text: e,
1538
1537
  slashCommands: t,
1539
1538
  commandTriggers: r.commandTriggers,
1540
1539
  mentionCandidates: n
1541
1540
  });
1542
- return (i.elements?.length ?? 0) > 0 ? dn(de({
1541
+ return (i.elements?.length ?? 0) > 0 ? dn(q({
1543
1542
  initialDraft: i,
1544
1543
  slashCommands: t,
1545
1544
  commandTriggers: r.commandTriggers,
@@ -1556,17 +1555,17 @@ function pn(e, t, n, i, a) {
1556
1555
  return r(e).flatMap((e) => e.kind === "inline-code" || e.kind === "code-block" || e.kind === "link" || e.kind === "skill-link" ? [xn(e.source)] : mn(e.source, t, n, i, a));
1557
1556
  }
1558
1557
  function mn(e, t, n, r, i) {
1559
- let a = [], o = le(r, i);
1558
+ let a = [], o = fe(r, i);
1560
1559
  if (!o) return [xn(e)];
1561
1560
  let s = 0;
1562
1561
  for (let r of e.matchAll(o)) {
1563
1562
  let o = r.index ?? 0, c = r[0];
1564
1563
  if (o === 0 || /\s/.test(e[o - 1] ?? "")) {
1565
- if (o > s && a.push(xn(e.slice(s, o))), ue(c, i)) {
1566
- let e = n.find((e) => Y(e) === c);
1564
+ if (o > s && a.push(xn(e.slice(s, o))), pe(c, i)) {
1565
+ let e = n.find((e) => K(e) === c);
1567
1566
  a.push(e ? Cn(e) : xn(c));
1568
1567
  } else {
1569
- let e = G(c.replace(/^\//, ""), t);
1568
+ let e = U(c.replace(/^\//, ""), t);
1570
1569
  a.push(e ? xn(c, [{
1571
1570
  type: "composerSlashCommand",
1572
1571
  attrs: {
@@ -1589,7 +1588,7 @@ function hn(e, t, n, r, i, a) {
1589
1588
  pendingPastes: []
1590
1589
  };
1591
1590
  gn(e, o, n);
1592
- let s = de({
1591
+ let s = q({
1593
1592
  text: o.text,
1594
1593
  slashCommands: n,
1595
1594
  isTaskRunning: r,
@@ -1598,7 +1597,7 @@ function hn(e, t, n, r, i, a) {
1598
1597
  return {
1599
1598
  ...s,
1600
1599
  cursor: a,
1601
- elements: fr([...s.elements, ...o.elements]),
1600
+ elements: dr([...s.elements, ...o.elements]),
1602
1601
  mentionBindings: o.mentionBindings,
1603
1602
  imageAttachments: o.imageAttachments,
1604
1603
  remoteImages: t,
@@ -1624,7 +1623,7 @@ function gn(e, t, n) {
1624
1623
  let r = e.text ?? "", i = t.text.length;
1625
1624
  t.text += r;
1626
1625
  for (let a of e.marks ?? []) if (a.type === "link" && a.attrs?.href && t.elements.push({
1627
- id: wr("link", r, i),
1626
+ id: $("link", r, i),
1628
1627
  kind: "link",
1629
1628
  label: r,
1630
1629
  range: {
@@ -1633,10 +1632,10 @@ function gn(e, t, n) {
1633
1632
  },
1634
1633
  detail: String(a.attrs.href)
1635
1634
  }), a.type === "composerSlashCommand") {
1636
- let e = G(r.replace(/^\//, ""), n);
1635
+ let e = U(r.replace(/^\//, ""), n);
1637
1636
  if (!e) continue;
1638
1637
  t.elements.push({
1639
- id: wr("slash-command", r, i),
1638
+ id: $("slash-command", r, i),
1640
1639
  kind: "slash-command",
1641
1640
  label: r,
1642
1641
  range: {
@@ -1649,7 +1648,7 @@ function gn(e, t, n) {
1649
1648
  return;
1650
1649
  }
1651
1650
  if (e.type === "composerMention") {
1652
- let n = String(e.attrs?.label ?? "") || `${String(e.attrs?.trigger ?? "")}${String(e.attrs?.value ?? "")}`, r = t.text.length, i = String(e.attrs?.id ?? wr("mention", n, r));
1651
+ let n = String(e.attrs?.label ?? "") || `${String(e.attrs?.trigger ?? "")}${String(e.attrs?.value ?? "")}`, r = t.text.length, i = String(e.attrs?.id ?? $("mention", n, r));
1653
1652
  t.text += n, t.elements.push({
1654
1653
  id: i,
1655
1654
  kind: "mention",
@@ -1673,7 +1672,7 @@ function gn(e, t, n) {
1673
1672
  if (e.type === "composerAtom") {
1674
1673
  let n = String(e.attrs?.label ?? ""), r = vn(e.attrs?.kind), i = t.text.length, a = String(e.attrs?.attachmentId ?? "");
1675
1674
  if (r === "image" && !a) return;
1676
- let o = r === "image" ? a : wr(r, n, i);
1675
+ let o = r === "image" ? a : $(r, n, i);
1677
1676
  t.text += n;
1678
1677
  let s = r === "rich-link" ? _n(e.attrs?.metadata) : void 0;
1679
1678
  t.elements.push({
@@ -1689,7 +1688,7 @@ function gn(e, t, n) {
1689
1688
  }), r === "image" && t.imageAttachments.push({
1690
1689
  id: o,
1691
1690
  placeholder: n,
1692
- media: Fe(e.attrs?.media)
1691
+ media: Le(e.attrs?.media)
1693
1692
  }), r === "paste" && t.pendingPastes.push({
1694
1693
  id: o,
1695
1694
  placeholder: n,
@@ -1762,7 +1761,7 @@ function Cn(e) {
1762
1761
  id: e.id,
1763
1762
  trigger: e.trigger,
1764
1763
  value: e.value,
1765
- label: Y(e),
1764
+ label: K(e),
1766
1765
  detail: e.detail,
1767
1766
  payload: e.payload,
1768
1767
  persistsAs: e.persistsAs
@@ -1771,7 +1770,7 @@ function Cn(e) {
1771
1770
  }
1772
1771
  function wn(e, t, n) {
1773
1772
  let r = `${e.trigger}${e.value}`;
1774
- return n.find((e) => Y(e) === t.label || Y(e) === r) || {
1773
+ return n.find((e) => K(e) === t.label || K(e) === r) || {
1775
1774
  id: e.id,
1776
1775
  trigger: e.trigger,
1777
1776
  value: e.value,
@@ -1821,7 +1820,7 @@ function Dn(e, t) {
1821
1820
  };
1822
1821
  }
1823
1822
  function On(e, t, n) {
1824
- let r = `(?:${q(n)})`, i = e.search(RegExp(`(?:^|\\s|\\ufffc)(${r}[^\\s\\ufffc]*)$`));
1823
+ let r = `(?:${le(n)})`, i = e.search(RegExp(`(?:^|\\s|\\ufffc)(${r}[^\\s\\ufffc]*)$`));
1825
1824
  if (i === -1) return null;
1826
1825
  let a = /[\s\ufffc]/.test(e[i] ?? "") ? i + 1 : i, o = t.match(/^[^\s\ufffc]*/)?.[0] ?? "";
1827
1826
  return {
@@ -1831,10 +1830,10 @@ function On(e, t, n) {
1831
1830
  };
1832
1831
  }
1833
1832
  function kn(e, t) {
1834
- let n = Un(e.state.doc.toJSON(), mr(t)), r = e.state.schema.nodes.composerAtom?.create({
1833
+ let n = Un(e.state.doc.toJSON(), Z(t)), r = e.state.schema.nodes.composerAtom?.create({
1835
1834
  kind: "paste",
1836
1835
  label: n,
1837
- detail: `${mr(t)} chars`,
1836
+ detail: `${Z(t)} chars`,
1838
1837
  content: t
1839
1838
  });
1840
1839
  r && e.dispatch(e.state.tr.replaceSelectionWith(r).scrollIntoView());
@@ -1910,21 +1909,21 @@ function In(e, t, n) {
1910
1909
  function Ln(e, t, n, r) {
1911
1910
  let i = r(n);
1912
1911
  if (i === null) return;
1913
- let a = t + Wn(e.state.doc.toJSON(), "image") + 1, o = Pe(n) ?? "image", s = e.state.schema.nodeFromJSON(En(i, Ie(o, a), o));
1912
+ let a = t + Wn(e.state.doc.toJSON(), "image") + 1, o = Ie(n) ?? "image", s = e.state.schema.nodeFromJSON(En(i, Re(o, a), o));
1914
1913
  if (!s) return;
1915
1914
  let c = e.state.tr.replaceSelectionWith(s);
1916
1915
  c = c.insertText(" ", c.selection.from), e.dispatch(c.scrollIntoView());
1917
1916
  }
1918
1917
  function Rn(e, t, n) {
1919
- let r = gr(t), i = _r(r), a = `${n}${i}`, o = e.state.schema.nodes.composerMention?.create({
1920
- id: wr("mention", a, e.state.selection.from),
1918
+ let r = mr(t), i = hr(r), a = `${n}${i}`, o = e.state.schema.nodes.composerMention?.create({
1919
+ id: $("mention", a, e.state.selection.from),
1921
1920
  trigger: n,
1922
1921
  value: i,
1923
1922
  label: a,
1924
- detail: vr(r) ? "directory" : "file",
1923
+ detail: gr(r) ? "directory" : "file",
1925
1924
  payload: {
1926
1925
  path: r,
1927
- type: vr(r) ? "directory" : "file"
1926
+ type: gr(r) ? "directory" : "file"
1928
1927
  }
1929
1928
  });
1930
1929
  if (!o) return;
@@ -1937,7 +1936,7 @@ function zn(e, t) {
1937
1936
  ...e,
1938
1937
  attrs: {
1939
1938
  ...e.attrs,
1940
- label: Ie(Fe(e.attrs?.media), t + n)
1939
+ label: Re(Le(e.attrs?.media), t + n)
1941
1940
  }
1942
1941
  }));
1943
1942
  }
@@ -1986,7 +1985,7 @@ function qn(e) {
1986
1985
  function Jn(e) {
1987
1986
  let { selection: t } = e.state;
1988
1987
  if (!t.empty) return tr(e, t.from, t.to);
1989
- let n = t.$from.parent.textBetween(0, t.$from.parentOffset, void 0, nr), r = at(n, n.length);
1988
+ let n = t.$from.parent.textBetween(0, t.$from.parentOffset, void 0, nr), r = ot(n, n.length);
1990
1989
  return tr(e, $n(t.$from.parent, t.$from.start(), r), t.from);
1991
1990
  }
1992
1991
  function Yn(e) {
@@ -1994,7 +1993,7 @@ function Yn(e) {
1994
1993
  e.view.dispatch(r), e.view.focus();
1995
1994
  }
1996
1995
  function Xn(e, t) {
1997
- let { selection: n } = e.state, r = t === -1 ? n.from : n.to, i = e.state.doc.resolve(r), a = i.parent.textBetween(0, i.parent.content.size, void 0, nr), o = i.parent.textBetween(0, i.parentOffset, void 0, nr).length, s = t === -1 ? at(a, o) : ot(a, o), c = $n(i.parent, i.start(), s), l = e.state.tr.setSelection(j.create(e.state.doc, c)).scrollIntoView();
1996
+ let { selection: n } = e.state, r = t === -1 ? n.from : n.to, i = e.state.doc.resolve(r), a = i.parent.textBetween(0, i.parent.content.size, void 0, nr), o = i.parent.textBetween(0, i.parentOffset, void 0, nr).length, s = t === -1 ? ot(a, o) : st(a, o), c = $n(i.parent, i.start(), s), l = e.state.tr.setSelection(j.create(e.state.doc, c)).scrollIntoView();
1998
1997
  e.view.dispatch(l), e.view.focus();
1999
1998
  }
2000
1999
  function Zn(e, t) {
@@ -2048,7 +2047,7 @@ function rr(e, t) {
2048
2047
  e.chain().focus().insertContent(t).run();
2049
2048
  return;
2050
2049
  }
2051
- let r = re.fromJSON(e.state.schema, t.slice);
2050
+ let r = ne.fromJSON(e.state.schema, t.slice);
2052
2051
  e.view.dispatch(e.state.tr.replaceSelection(r).scrollIntoView()), e.view.focus();
2053
2052
  }
2054
2053
  function ir(e, t) {
@@ -2076,7 +2075,7 @@ function sr(e) {
2076
2075
  return e.state.selection.empty && or(e) === 0;
2077
2076
  }
2078
2077
  function cr(e, t) {
2079
- return ue(e.persistedPrompt, t) ? "ParseSlash" : e.action;
2078
+ return pe(e.persistedPrompt, t) ? "ParseSlash" : e.action;
2080
2079
  }
2081
2080
  function lr(e) {
2082
2081
  return e.key === "ArrowUp" || (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "p";
@@ -2085,46 +2084,41 @@ function ur(e) {
2085
2084
  return e.key === "ArrowDown" || (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "n";
2086
2085
  }
2087
2086
  function dr(e) {
2088
- return [...e].sort((e, t) => e.range.start - t.range.start);
2089
- }
2090
- function fr(e) {
2091
2087
  let t = /* @__PURE__ */ new Map();
2092
2088
  for (let n of e) t.set(`${n.kind}:${n.range.start}:${n.range.end}:${n.label}`, n);
2093
- return dr([...t.values()]);
2089
+ return X([...t.values()]);
2094
2090
  }
2095
- function pr(e) {
2091
+ function fr(e) {
2096
2092
  return e.replace(/\r\n?/g, "\n");
2097
2093
  }
2098
- function mr(e) {
2099
- return Array.from(e).length;
2100
- }
2101
- function hr(e) {
2094
+ function pr(e) {
2102
2095
  return e.startsWith("file://") || e.startsWith("/") || e.startsWith("./") || e.startsWith("../") || /^[A-Za-z]:[\\/]/.test(e);
2103
2096
  }
2104
- function gr(e) {
2097
+ function mr(e) {
2105
2098
  let t = e.trim();
2106
2099
  if (!t.startsWith("file://")) return t;
2100
+ let n = URL.parse(t);
2101
+ if (!n) return t;
2107
2102
  try {
2108
- return decodeURI(new URL(t).pathname);
2103
+ return decodeURIComponent(n.pathname);
2109
2104
  } catch {
2110
- return t;
2105
+ return n.pathname;
2111
2106
  }
2112
2107
  }
2113
- function _r(e) {
2114
- let t = e.replace(/[\\/]+$/, "").split(/[\\/]/).filter(Boolean).pop();
2115
- return t ? decodeURIComponent(t) : e;
2108
+ function hr(e) {
2109
+ return e.replace(/[\\/]+$/, "").split(/[\\/]/).filter(Boolean).pop() ?? e;
2116
2110
  }
2117
- function vr(e) {
2111
+ function gr(e) {
2118
2112
  return /[\\/]$/.test(e);
2119
2113
  }
2120
- function yr(e) {
2114
+ function _r(e) {
2121
2115
  return e.split(/\r?\n/).map((e) => e.trim()).find((e) => e && !e.startsWith("#")) ?? "";
2122
2116
  }
2123
- function br(e) {
2124
- let t = yr(e);
2117
+ function vr(e) {
2118
+ let t = _r(e);
2125
2119
  return t ? t.match(/^[\w.+-]+\/[\w.+-]+:[^:\n]+:(.+)$/)?.[1]?.trim() ?? t : "";
2126
2120
  }
2127
- function xr(e) {
2121
+ function yr(e) {
2128
2122
  try {
2129
2123
  let t = new URL(e);
2130
2124
  return t.protocol === "http:" || t.protocol === "https:";
@@ -2132,69 +2126,65 @@ function xr(e) {
2132
2126
  return !1;
2133
2127
  }
2134
2128
  }
2135
- function Sr(e) {
2136
- return Ge(e.trim());
2137
- }
2138
- function Cr(e, t) {
2139
- return (e % t + t) % t;
2140
- }
2141
- function wr(e, t, n) {
2142
- return `${e}:${n}:${t}`;
2129
+ function br(e) {
2130
+ return qe(e.trim());
2143
2131
  }
2144
2132
  //#endregion
2145
2133
  //#region src/lib/Composer.tsx
2146
- function Tr(e) {
2134
+ function xr(e) {
2147
2135
  let t = i(3), n = e.draftKey ?? "", r;
2148
- return t[0] !== e || t[1] !== n ? (r = /* @__PURE__ */ C(Dr, { ...e }, n), t[0] = e, t[1] = n, t[2] = r) : r = t[2], r;
2136
+ return t[0] !== e || t[1] !== n ? (r = /* @__PURE__ */ w(Cr, { ...e }, n), t[0] = e, t[1] = n, t[2] = r) : r = t[2], r;
2149
2137
  }
2150
- function Er(e) {
2138
+ function Sr(e) {
2151
2139
  return typeof e == "object" && !!e && "then" in e && typeof e.then == "function";
2152
2140
  }
2153
- function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r = !1, queueSubmissions: i = !1, hasInteracted: a = !1, maxExpandedTextChars: o, editorAriaLabel: u = "Rich prompt composer", className: d, children: f, dictation: p, validateSubmission: m, onSubmit: h, onStateChange: g }) {
2154
- let x = c(), S = Mt(f), ee = y({
2141
+ function Cr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r = !1, queueSubmissions: i = !1, hasInteracted: a = !1, maxExpandedTextChars: o, editorAriaLabel: u = "Rich prompt composer", className: d, children: f, dictation: p, validateSubmission: m, onSubmit: h, onStateChange: g }) {
2142
+ let ee = c(), S = Mt(f), te = b({
2155
2143
  signature: Nt(S),
2156
2144
  slashCommands: S.slashCommands,
2157
2145
  mentionCandidates: S.mentionCandidates,
2158
2146
  commandTriggers: S.commandTriggers,
2159
2147
  mentionTriggers: S.mentionTriggers
2160
- }), te = Nt(S);
2161
- te !== ee.current.signature && (ee.current = {
2162
- signature: te,
2148
+ }), C = Nt(S);
2149
+ C !== te.current.signature && (te.current = {
2150
+ signature: C,
2163
2151
  slashCommands: S.slashCommands,
2164
2152
  mentionCandidates: S.mentionCandidates,
2165
2153
  commandTriggers: S.commandTriggers,
2166
2154
  mentionTriggers: S.mentionTriggers
2167
2155
  });
2168
- let { slashCommands: T, mentionCandidates: E, commandTriggers: D, mentionTriggers: O } = ee.current, k = v(() => ({
2169
- commandTriggers: D,
2170
- mentionTriggers: O
2171
- }), [D, O]), ne = y(O);
2172
- ne.current = O;
2173
- let [re] = b(() => {
2156
+ let { slashCommands: E, mentionCandidates: D, commandTriggers: O, mentionTriggers: k } = te.current, A = y(() => ({
2157
+ commandTriggers: O,
2158
+ mentionTriggers: k
2159
+ }), [O, k]), ne = b(k);
2160
+ ne.current = k;
2161
+ let [re] = x(() => {
2174
2162
  if (e) return e;
2175
2163
  if (t === void 0) return;
2176
2164
  let n = xt(t);
2177
- return n ? We({
2165
+ return n ? Ge({
2178
2166
  source: n,
2179
- slashCommands: T,
2180
- mentionCandidates: E
2167
+ slashCommands: E,
2168
+ mentionCandidates: D
2181
2169
  }) : void 0;
2182
- }), A = y(re?.remoteImages ?? []), j = y(un({
2170
+ }), j = b(re?.remoteImages ?? []), ie = b(un({
2183
2171
  state: re,
2184
- slashCommands: T,
2185
- mentionCandidates: E,
2186
- triggers: k
2187
- })), M = y(0), N = y(!0);
2172
+ slashCommands: E,
2173
+ mentionCandidates: D,
2174
+ triggers: A
2175
+ })), M = b(0), N = b(!0);
2188
2176
  _(() => (N.current = !0, () => {
2189
2177
  N.current = !1;
2190
2178
  }), []);
2191
- let [P, F] = b(A.current), [I, L] = b(null), [R, z] = b(() => hn(j.current, A.current, T, r, i, 0)), B = y(R), V = y(P), H = y(I), U = y(null), W = y(null), G = y(void 0), K = y(null), ae = y(null), oe = y(null), se = y(g), q = y(m), ce = y(h), J = y(/* @__PURE__ */ new Map()), le = y(() => null), ue = y(() => void 0), Y = y(() => void 0), de = y(() => !1), X = s({
2192
- extensions: v(() => tn({
2179
+ let [P, F] = x(j.current), [I, L] = x(null), [R, z] = x(() => hn(ie.current, j.current, E, r, i, 0)), B = b(R), V = b(P), H = b(I), oe = b(null), U = b(null), W = b(void 0), G = b(null), se = b(null), ce = b(null), le = v((e, t) => {
2180
+ g?.(e, t);
2181
+ }), ue = b(m), de = b(h), fe = b(/* @__PURE__ */ new Map()), pe = b(() => null), K = b(() => void 0), q = b(() => void 0), _e = b(() => !1), J = s({
2182
+ extensions: y(() => tn({
2193
2183
  getMentionTrigger: () => ne.current[0] ?? "@",
2194
2184
  getRemoteImageCount: () => V.current.length,
2195
- attachImageFile: (e) => le.current(e)
2185
+ attachImageFile: (e) => pe.current(e)
2196
2186
  }), []),
2197
- content: j.current,
2187
+ content: ie.current,
2198
2188
  editable: !n,
2199
2189
  editorProps: {
2200
2190
  attributes: {
@@ -2206,25 +2196,25 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2206
2196
  spellcheck: "false"
2207
2197
  },
2208
2198
  handleKeyDown(e, t) {
2209
- return de.current(t);
2199
+ return _e.current(t);
2210
2200
  }
2211
2201
  },
2212
2202
  immediatelyRender: !1,
2213
2203
  onUpdate({ editor: e }) {
2214
- ue.current(e), Y.current(e);
2204
+ K.current(e), q.current(e);
2215
2205
  },
2216
2206
  onSelectionUpdate({ editor: e }) {
2217
- ue.current(e), Y.current(e);
2207
+ K.current(e), q.current(e);
2218
2208
  }
2219
- }), he = v(() => I ? Rt(I, T, E, a) : [], [
2209
+ }), ve = y(() => I ? Rt(I, E, D, a) : [], [
2220
2210
  I,
2221
2211
  a,
2222
- E,
2223
- T
2224
- ]), ge = v(() => pe(R, T, D), [
2225
2212
  D,
2213
+ E
2214
+ ]), ye = y(() => he(R, E, O), [
2215
+ O,
2226
2216
  R,
2227
- T
2217
+ E
2228
2218
  ]);
2229
2219
  _(() => {
2230
2220
  B.current = R;
@@ -2233,39 +2223,35 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2233
2223
  }, [P]), _(() => {
2234
2224
  H.current = I;
2235
2225
  }, [I]), _(() => {
2236
- R.shortcutsOpen && (I || R.reverseSearch !== null || !fe(R)) && z((e) => e.shortcutsOpen ? {
2226
+ R.shortcutsOpen && (I || R.reverseSearch !== null || !me(R)) && z((e) => e.shortcutsOpen ? {
2237
2227
  ...e,
2238
2228
  shortcutsOpen: !1
2239
2229
  } : e);
2240
2230
  }, [I, R]), _(() => {
2241
- se.current = g;
2242
- }, [g]), _(() => {
2243
- q.current = m;
2231
+ ue.current = m;
2244
2232
  }, [m]), _(() => {
2245
- ce.current = h;
2233
+ de.current = h;
2246
2234
  }, [h]), _(() => {
2247
- X && (X.setEditable(!n), X.view.dom.setAttribute("aria-disabled", n ? "true" : "false"), n && L(null));
2248
- }, [n, X]), _(() => {
2249
- X?.view.dom.setAttribute("aria-label", u);
2250
- }, [X, u]), _(() => {
2251
- se.current?.(R, ge), t !== void 0 && (ge ? St(t, Ve(R, ge.persistedPrompt)) : M.current === 0 && St(t, null));
2235
+ J && (J.setEditable(!n), n && L(null));
2236
+ }, [n, J]), _(() => {
2237
+ le(R, ye), t !== void 0 && (ye ? St(t, He(R, ye.persistedPrompt)) : M.current === 0 && St(t, null));
2252
2238
  }, [
2253
2239
  R,
2254
2240
  t,
2255
- ge
2241
+ ye
2256
2242
  ]), _(() => {
2257
2243
  z((e) => e.isTaskRunning === r && e.queueSubmissions === i ? e : {
2258
2244
  ...e,
2259
2245
  isTaskRunning: r,
2260
2246
  queueSubmissions: i
2261
2247
  });
2262
- }, [r, i]), ue.current = (e) => {
2248
+ }, [r, i]), K.current = (e) => {
2263
2249
  if (n) return;
2264
- let t = hn(e.getJSON(), V.current, T, r, i, or(e)), a = W.current, o = G.current;
2265
- W.current = null, G.current = void 0, z((e) => {
2266
- let n = o === void 0 ? K.current : o;
2267
- K.current = n;
2268
- let r = e.shortcutsOpen && fe(t);
2250
+ let t = hn(e.getJSON(), V.current, E, r, i, or(e)), a = U.current, o = W.current;
2251
+ U.current = null, W.current = void 0, z((e) => {
2252
+ let n = o === void 0 ? G.current : o;
2253
+ G.current = n;
2254
+ let r = e.shortcutsOpen && me(t);
2269
2255
  return {
2270
2256
  ...t,
2271
2257
  error: e.error,
@@ -2277,22 +2263,22 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2277
2263
  selectedRemoteImageId: a
2278
2264
  };
2279
2265
  });
2280
- }, Y.current = (e) => {
2266
+ }, q.current = (e) => {
2281
2267
  if (n) {
2282
2268
  L(null);
2283
2269
  return;
2284
2270
  }
2285
- let t = Dn(e, k);
2271
+ let t = Dn(e, A);
2286
2272
  if (!t) {
2287
2273
  L(null);
2288
2274
  return;
2289
2275
  }
2290
- if (D.includes(t.trigger)) {
2276
+ if (O.includes(t.trigger)) {
2291
2277
  let e = {
2292
2278
  trigger: t.trigger,
2293
2279
  query: t.query,
2294
2280
  selectedIndex: 0
2295
- }, n = Rt(e, T, E, a);
2281
+ }, n = Rt(e, E, D, a);
2296
2282
  L((t) => n.length === 0 ? null : {
2297
2283
  ...e,
2298
2284
  selectedIndex: t?.trigger === e.trigger ? Math.min(t.selectedIndex, n.length - 1) : 0
@@ -2304,19 +2290,19 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2304
2290
  trigger: n,
2305
2291
  query: t.query,
2306
2292
  selectedIndex: e?.trigger === n ? e.selectedIndex : 0
2307
- }, i = Rt(r, T, E, a);
2293
+ }, i = Rt(r, E, D, a);
2308
2294
  return {
2309
2295
  ...r,
2310
2296
  selectedIndex: e?.trigger === n ? Math.min(e.selectedIndex, Math.max(i.length - 1, 0)) : 0
2311
2297
  };
2312
2298
  });
2313
2299
  };
2314
- function Z(e) {
2315
- X?.commands.setContent(e), X && (ue.current(X), Y.current(X));
2300
+ function Y(e) {
2301
+ J?.commands.setContent(e), J && (K.current(J), q.current(J));
2316
2302
  }
2317
- function ve(e) {
2318
- if (n || !X) return;
2319
- let t = Dn(X, k), r = [{
2303
+ function xe(e) {
2304
+ if (n || !J) return;
2305
+ let t = Dn(J, A), r = [{
2320
2306
  type: "text",
2321
2307
  text: `${e.trigger}${e.value}`,
2322
2308
  marks: [{
@@ -2330,21 +2316,21 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2330
2316
  type: "text",
2331
2317
  text: " "
2332
2318
  }];
2333
- t && t.trigger === e.trigger ? X.chain().focus().deleteRange({
2319
+ t && t.trigger === e.trigger ? J.chain().focus().deleteRange({
2334
2320
  from: t.from,
2335
2321
  to: t.to
2336
- }).insertContent(r).run() : X.chain().focus().insertContent(r).run(), L(null);
2322
+ }).insertContent(r).run() : J.chain().focus().insertContent(r).run(), L(null);
2337
2323
  }
2338
- function ye({ index: e = H.current?.selectedIndex ?? 0 } = {}) {
2324
+ function Se({ index: e = H.current?.selectedIndex ?? 0 } = {}) {
2339
2325
  let t = H.current;
2340
- if (n || !X || !t) return;
2341
- let r = Rt(t, T, E, a), i = r[e] ?? r[0];
2326
+ if (n || !J || !t) return;
2327
+ let r = Rt(t, E, D, a), i = r[e] ?? r[0];
2342
2328
  if (!i) return;
2343
2329
  if (!i.atomic) {
2344
- ve(i);
2330
+ xe(i);
2345
2331
  return;
2346
2332
  }
2347
- let o = Dn(X, k), s = o?.trigger === t.trigger, c = X.chain().focus();
2333
+ let o = Dn(J, A), s = o?.trigger === t.trigger, c = J.chain().focus();
2348
2334
  s && o && c.deleteRange({
2349
2335
  from: o.from,
2350
2336
  to: o.to
@@ -2353,145 +2339,145 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2353
2339
  text: " "
2354
2340
  }]).run(), L(null);
2355
2341
  }
2356
- function be() {
2357
- if (n || !X) return;
2358
- X.commands.focus();
2359
- let e = D[0];
2342
+ function Ce() {
2343
+ if (n || !J) return;
2344
+ J.commands.focus();
2345
+ let e = O[0];
2360
2346
  e && L((t) => t?.trigger === e ? null : {
2361
2347
  trigger: e,
2362
2348
  query: "",
2363
2349
  selectedIndex: 0
2364
2350
  });
2365
2351
  }
2366
- function xe(e) {
2367
- return fe(e) && e.reverseSearch === null && H.current === null;
2352
+ function we(e) {
2353
+ return me(e) && e.reverseSearch === null && H.current === null;
2368
2354
  }
2369
- function Se() {
2370
- n || z((e) => xe(e) && !e.shortcutsOpen ? {
2355
+ function Te() {
2356
+ n || z((e) => we(e) && !e.shortcutsOpen ? {
2371
2357
  ...e,
2372
2358
  shortcutsOpen: !0,
2373
2359
  selectedRemoteImageId: null,
2374
2360
  error: null
2375
2361
  } : e);
2376
2362
  }
2377
- function Ce() {
2363
+ function Ee() {
2378
2364
  z((e) => e.shortcutsOpen ? {
2379
2365
  ...e,
2380
2366
  shortcutsOpen: !1
2381
2367
  } : e);
2382
2368
  }
2383
- function we() {
2369
+ function De() {
2384
2370
  n || z((e) => e.shortcutsOpen ? {
2385
2371
  ...e,
2386
2372
  shortcutsOpen: !1
2387
- } : xe(e) ? {
2373
+ } : we(e) ? {
2388
2374
  ...e,
2389
2375
  shortcutsOpen: !0,
2390
2376
  selectedRemoteImageId: null,
2391
2377
  error: null
2392
2378
  } : e);
2393
2379
  }
2394
- function Te(e) {
2395
- n || !X || !e || X.chain().focus().insertContent(e).run();
2380
+ function Oe(e) {
2381
+ n || !J || !e || J.chain().focus().insertContent(e).run();
2396
2382
  }
2397
- function Ee(e) {
2398
- if (Pe(e) === null) return z((t) => ({
2383
+ function ke(e) {
2384
+ if (Ie(e) === null) return z((t) => ({
2399
2385
  ...t,
2400
2386
  error: `Only image, video, or audio files can be attached: ${e.name || "unnamed file"}`,
2401
2387
  shortcutsOpen: !1
2402
2388
  })), L(null), null;
2403
2389
  let t = crypto.randomUUID();
2404
- return J.current.set(t, e), t;
2390
+ return fe.current.set(t, e), t;
2405
2391
  }
2406
- function De(e, t) {
2407
- let n = Ee(t);
2392
+ function Ae(e, t) {
2393
+ let n = ke(t);
2408
2394
  if (n === null) return;
2409
- let r = $(), i = r.remoteImages.length + r.imageAttachments.length + 1, a = Pe(t) ?? "image";
2410
- e.chain().focus().insertContent([En(n, Ie(a, i), a), {
2395
+ let r = Q(), i = r.remoteImages.length + r.imageAttachments.length + 1, a = Ie(t) ?? "image";
2396
+ e.chain().focus().insertContent([En(n, Re(a, i), a), {
2411
2397
  type: "text",
2412
2398
  text: " "
2413
2399
  }]).run();
2414
2400
  }
2415
- function Oe(e) {
2416
- if (!(n || !X)) for (let t of e) De(X, t);
2401
+ function je(e) {
2402
+ if (!(n || !J)) for (let t of e) Ae(J, t);
2417
2403
  }
2418
- function ke(e) {
2419
- n || !X || (J.current.delete(e), Z(zn(Vn(X.getJSON(), e), V.current.length)));
2404
+ function Me(e) {
2405
+ n || !J || (fe.current.delete(e), Y(zn(Vn(J.getJSON(), e), V.current.length)));
2420
2406
  }
2421
- function Ae(e) {
2422
- if (n || !X) return;
2407
+ function Ne(e) {
2408
+ if (n || !J) return;
2423
2409
  let t = [...V.current, {
2424
- id: wr("remote-image", e, x.Date.now()),
2410
+ id: $("remote-image", e, ee.Date.now()),
2425
2411
  url: e
2426
2412
  }];
2427
- V.current = t, F(t), Z(zn(X.getJSON(), t.length));
2413
+ V.current = t, F(t), Y(zn(J.getJSON(), t.length));
2428
2414
  }
2429
- function je(e) {
2430
- return n || !X ? !1 : ln(X.view, e, V.current.length, O[0] ?? "@", Ee);
2415
+ function Pe(e) {
2416
+ return n || !J ? !1 : ln(J.view, e, V.current.length, k[0] ?? "@", ke);
2431
2417
  }
2432
- function Me(e) {
2418
+ function X(e) {
2433
2419
  if (n) return;
2434
2420
  let t = V.current[e] ?? B.current.remoteImages[e];
2435
- t && (W.current = t.id, z((e) => ({
2421
+ t && (U.current = t.id, z((e) => ({
2436
2422
  ...e,
2437
2423
  selectedRemoteImageId: t.id,
2438
2424
  shortcutsOpen: !1
2439
2425
  })));
2440
2426
  }
2441
- function Q() {
2442
- n || (W.current = null, z((e) => e.selectedRemoteImageId ? {
2427
+ function Fe() {
2428
+ n || (U.current = null, z((e) => e.selectedRemoteImageId ? {
2443
2429
  ...e,
2444
2430
  selectedRemoteImageId: null,
2445
2431
  shortcutsOpen: !1
2446
2432
  } : e));
2447
2433
  }
2448
- function Ne(e) {
2449
- return B.current.selectedRemoteImageId ? e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Escape" || (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "a" ? (Q(), L(null), !0) : e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey ? (Q(), !0) : !1 : !1;
2434
+ function Le(e) {
2435
+ return B.current.selectedRemoteImageId ? e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Escape" || (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "a" ? (Fe(), L(null), !0) : e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey ? (Fe(), !0) : !1 : !1;
2450
2436
  }
2451
- function Fe(e) {
2437
+ function ze(e) {
2452
2438
  if (n) return e.preventDefault(), !0;
2453
- if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "a") return e.preventDefault(), Q(), L(null), X?.commands.selectAll(), !0;
2454
- let t = $(), r = B.current.selectedRemoteImageId;
2439
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "a") return e.preventDefault(), Fe(), L(null), J?.commands.selectAll(), !0;
2440
+ let t = Q(), r = B.current.selectedRemoteImageId;
2455
2441
  if (!H.current && e.key === "ArrowUp") {
2456
- let n = Re({
2442
+ let n = Be({
2457
2443
  ...t,
2458
2444
  selectedRemoteImageId: r
2459
2445
  }, r);
2460
- if (n !== null) return e.preventDefault(), Me(Math.max(0, n - 1)), !0;
2461
- if ((X && sr(X) || t.cursor === 0) && t.remoteImages.length > 0) return e.preventDefault(), Me(t.remoteImages.length - 1), !0;
2446
+ if (n !== null) return e.preventDefault(), X(Math.max(0, n - 1)), !0;
2447
+ if ((J && sr(J) || t.cursor === 0) && t.remoteImages.length > 0) return e.preventDefault(), X(t.remoteImages.length - 1), !0;
2462
2448
  }
2463
2449
  if (!H.current && r && e.key === "ArrowDown") {
2464
2450
  e.preventDefault();
2465
- let n = Re({
2451
+ let n = Be({
2466
2452
  ...t,
2467
2453
  selectedRemoteImageId: r
2468
2454
  }, r);
2469
- return n !== null && n + 1 < t.remoteImages.length ? Me(n + 1) : Q(), !0;
2455
+ return n !== null && n + 1 < t.remoteImages.length ? X(n + 1) : Fe(), !0;
2470
2456
  }
2471
- return !H.current && r && (e.key === "Backspace" || e.key === "Delete") ? (e.preventDefault(), Le(r), !0) : (Ne(e), !1);
2457
+ return !H.current && r && (e.key === "Backspace" || e.key === "Delete") ? (e.preventDefault(), We(r), !0) : (Le(e), !1);
2472
2458
  }
2473
- function Le(e) {
2474
- if (n || !X) return;
2475
- let t = $(), r = t.remoteImages.findIndex((t) => t.id === e), i = t.remoteImages.filter((t) => t.id !== e), a = r === -1 ? null : i[r] ?? i[r - 1] ?? null;
2476
- W.current = a?.id ?? null, V.current = i, F(i), Z(zn(X.getJSON(), i.length)), z((e) => ({
2459
+ function We(e) {
2460
+ if (n || !J) return;
2461
+ let t = Q(), r = t.remoteImages.findIndex((t) => t.id === e), i = t.remoteImages.filter((t) => t.id !== e), a = r === -1 ? null : i[r] ?? i[r - 1] ?? null;
2462
+ U.current = a?.id ?? null, V.current = i, F(i), Y(zn(J.getJSON(), i.length)), z((e) => ({
2477
2463
  ...e,
2478
2464
  remoteImages: i,
2479
2465
  selectedRemoteImageId: a?.id ?? null,
2480
2466
  shortcutsOpen: !1
2481
2467
  }));
2482
2468
  }
2483
- function ze(e) {
2484
- if (n || !X) return;
2485
- let t = Un(X.getJSON(), mr(e));
2486
- X.chain().focus().insertContent(Tn({
2469
+ function Ke(e) {
2470
+ if (n || !J) return;
2471
+ let t = Un(J.getJSON(), Z(e));
2472
+ J.chain().focus().insertContent(Tn({
2487
2473
  kind: "paste",
2488
2474
  label: t,
2489
- detail: `${mr(e)} chars`,
2475
+ detail: `${Z(e)} chars`,
2490
2476
  content: e
2491
2477
  })).run();
2492
2478
  }
2493
- function Ue(e, t = e, r) {
2494
- n || X?.chain().focus().insertContent(Tn({
2479
+ function qe(e, t = e, r) {
2480
+ n || J?.chain().focus().insertContent(Tn({
2495
2481
  kind: "rich-link",
2496
2482
  label: t,
2497
2483
  detail: e,
@@ -2499,36 +2485,36 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2499
2485
  metadata: r
2500
2486
  })).run();
2501
2487
  }
2502
- function $() {
2503
- return X ? {
2504
- ...hn(X.getJSON(), V.current, T, r, i, or(X)),
2488
+ function Q() {
2489
+ return J ? {
2490
+ ...hn(J.getJSON(), V.current, E, r, i, or(J)),
2505
2491
  error: B.current.error,
2506
2492
  history: B.current.history,
2507
- historyCursor: K.current ?? B.current.historyCursor,
2493
+ historyCursor: G.current ?? B.current.historyCursor,
2508
2494
  killBuffer: B.current.killBuffer,
2509
2495
  reverseSearch: B.current.reverseSearch,
2510
2496
  shortcutsOpen: B.current.shortcutsOpen,
2511
2497
  selectedRemoteImageId: B.current.selectedRemoteImageId
2512
2498
  } : B.current;
2513
2499
  }
2514
- function Ge(e) {
2515
- let t = q.current?.(e);
2500
+ function Je(e) {
2501
+ let t = ue.current?.(e);
2516
2502
  return t ? (z((e) => ({
2517
2503
  ...e,
2518
2504
  error: t,
2519
2505
  shortcutsOpen: !1
2520
2506
  })), L(null), !0) : !1;
2521
2507
  }
2522
- function Ke(e) {
2523
- let t = $(), n = t.text.slice(0, t.cursor);
2524
- Te(n && !/\s$/.test(n) ? ` ${e}` : e);
2508
+ function Ye(e) {
2509
+ let t = Q(), n = t.text.slice(0, t.cursor);
2510
+ Oe(n && !/\s$/.test(n) ? ` ${e}` : e);
2525
2511
  }
2526
- function qe() {
2527
- ut?.endWithSend() || Je();
2512
+ function Xe() {
2513
+ mt?.endWithSend() || Ze();
2528
2514
  }
2529
- function Je() {
2515
+ function Ze() {
2530
2516
  if (n) return;
2531
- let e = $(), r = X?.getJSON() ?? bn(), i = e.isTaskRunning || e.queueSubmissions, a = i ? null : _e(e.text, T, D);
2517
+ let e = Q(), r = J?.getJSON() ?? bn(), i = e.isTaskRunning || e.queueSubmissions, a = i ? null : be(e.text, E, O);
2532
2518
  if (a) {
2533
2519
  z((e) => ({
2534
2520
  ...e,
@@ -2537,7 +2523,7 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2537
2523
  })), L(null);
2538
2524
  return;
2539
2525
  }
2540
- let s = pe(e, T, D), c = s ?? {
2526
+ let s = he(e, E, O), c = s ?? {
2541
2527
  mode: "submitted",
2542
2528
  prompt: "",
2543
2529
  persistedPrompt: "",
@@ -2549,7 +2535,7 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2549
2535
  elements: [],
2550
2536
  payloadElements: [],
2551
2537
  mentionBindings: []
2552
- }, l = me(c, o);
2538
+ }, l = ge(c, o);
2553
2539
  if (l) {
2554
2540
  z((e) => ({
2555
2541
  ...e,
@@ -2560,7 +2546,7 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2560
2546
  }
2561
2547
  let u = /* @__PURE__ */ new Map(), d = [];
2562
2548
  for (let t of e.imageAttachments) {
2563
- let e = J.current.get(t.id);
2549
+ let e = fe.current.get(t.id);
2564
2550
  if (!e) {
2565
2551
  z((e) => ({
2566
2552
  ...e,
@@ -2581,31 +2567,31 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2581
2567
  ...c.items.filter((e) => e.type !== "remote_image")
2582
2568
  ], p = {
2583
2569
  id: crypto.randomUUID(),
2584
- at: new Date(x.Date.now()).toLocaleTimeString(),
2570
+ at: new Date(ee.Date.now()).toLocaleTimeString(),
2585
2571
  mode: i ? "queued" : c.mode,
2586
2572
  prompt: c.prompt,
2587
2573
  persistedPrompt: c.persistedPrompt,
2588
- action: i ? cr(c, D) : c.action,
2574
+ action: i ? cr(c, O) : c.action,
2589
2575
  command: c.command,
2590
2576
  args: c.args,
2591
2577
  items: f
2592
2578
  };
2593
- if (Ge(p)) return;
2594
- for (let e of u.keys()) J.current.delete(e);
2595
- let m = Ve(e, c.persistedPrompt), h = ce.current?.(p, { editableSource: m });
2596
- Er(h) && (M.current += 1, h.then(() => {
2579
+ if (Je(p)) return;
2580
+ for (let e of u.keys()) fe.current.delete(e);
2581
+ let m = He(e, c.persistedPrompt), h = de.current?.(p, { editableSource: m });
2582
+ Sr(h) && (M.current += 1, h.then(() => {
2597
2583
  t !== void 0 && St(t, null);
2598
2584
  }).catch((e) => {
2599
- for (let [e, t] of u) J.current.set(e, t);
2600
- t !== void 0 && St(t, m), N.current && (Z(r), X?.commands.focus("end"), z((t) => ({
2585
+ for (let [e, t] of u) fe.current.set(e, t);
2586
+ t !== void 0 && St(t, m), N.current && (Y(r), J?.commands.focus("end"), z((t) => ({
2601
2587
  ...t,
2602
2588
  error: e instanceof Error ? e.message : "Could not send prompt"
2603
2589
  })));
2604
2590
  }).finally(() => {
2605
2591
  --M.current;
2606
2592
  }));
2607
- let g = s ? He(e, c.historyPrompt) : e.history;
2608
- K.current = null, V.current = [], F([]), L(null), Z(bn()), z((e) => ({
2593
+ let g = s ? Ue(e, c.historyPrompt) : e.history;
2594
+ G.current = null, V.current = [], F([]), L(null), Y(bn()), z((e) => ({
2609
2595
  ...e,
2610
2596
  text: "",
2611
2597
  cursor: 0,
@@ -2621,10 +2607,10 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2621
2607
  historyCursor: null
2622
2608
  }));
2623
2609
  }
2624
- function Ye() {
2610
+ function Qe() {
2625
2611
  if (n) return;
2626
2612
  let e = B.current.history, t = B.current.killBuffer;
2627
- K.current = null, oe.current = null, J.current.clear(), V.current = A.current, F(A.current), L(null), Z(j.current), X?.commands.focus("end"), z((n) => ({
2613
+ G.current = null, ce.current = null, fe.current.clear(), V.current = j.current, F(j.current), L(null), Y(ie.current), J?.commands.focus("end"), z((n) => ({
2628
2614
  ...n,
2629
2615
  history: e,
2630
2616
  historyCursor: null,
@@ -2635,61 +2621,61 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2635
2621
  shortcutsOpen: !1
2636
2622
  }));
2637
2623
  }
2638
- function Xe(e) {
2639
- if (n || !X || B.current.history.length === 0) return;
2640
- let t = B.current, r = K.current ?? t.historyCursor;
2641
- if (e > 0 && r === 0 && ae.current) {
2642
- Qe(ae.current, null), ae.current = null;
2624
+ function $e(e) {
2625
+ if (n || !J || B.current.history.length === 0) return;
2626
+ let t = B.current, r = G.current ?? t.historyCursor;
2627
+ if (e > 0 && r === 0 && se.current) {
2628
+ tt(se.current, null), se.current = null;
2643
2629
  return;
2644
2630
  }
2645
- let i = r === null ? e < 0 ? 0 : t.history.length - 1 : Cr(r + e, t.history.length);
2646
- r === null && (ae.current = Be($()));
2631
+ let i = r === null ? e < 0 ? 0 : t.history.length - 1 : ct(r + e, t.history.length);
2632
+ r === null && (se.current = Ve(Q()));
2647
2633
  let a = t.history[i];
2648
- Ze(a, i);
2634
+ et(a, i);
2649
2635
  }
2650
- function Ze(e, t) {
2651
- Qe(We({
2636
+ function et(e, t) {
2637
+ tt(Ge({
2652
2638
  source: e,
2653
- slashCommands: T,
2654
- mentionCandidates: E
2639
+ slashCommands: E,
2640
+ mentionCandidates: D
2655
2641
  }), t);
2656
2642
  }
2657
- function Qe(e, t) {
2643
+ function tt(e, t) {
2658
2644
  let n = e.remoteImages ?? [];
2659
2645
  V.current = n, B.current = {
2660
2646
  ...B.current,
2661
2647
  historyCursor: t,
2662
2648
  shortcutsOpen: !1
2663
- }, K.current = t, G.current = t, F(n), Z(un({
2649
+ }, G.current = t, W.current = t, F(n), Y(un({
2664
2650
  state: e,
2665
- slashCommands: T,
2666
- mentionCandidates: E,
2667
- triggers: k
2668
- })), X?.commands.focus("end"), z((e) => ({
2651
+ slashCommands: E,
2652
+ mentionCandidates: D,
2653
+ triggers: A
2654
+ })), J?.commands.focus("end"), z((e) => ({
2669
2655
  ...e,
2670
2656
  historyCursor: t,
2671
2657
  shortcutsOpen: !1
2672
2658
  }));
2673
2659
  }
2674
- function $e() {
2675
- n || (L(null), K.current = null, oe.current = $(), z((e) => ({
2660
+ function nt() {
2661
+ n || (L(null), G.current = null, ce.current = Q(), z((e) => ({
2676
2662
  ...e,
2677
2663
  reverseSearch: "",
2678
2664
  historyCursor: null,
2679
2665
  shortcutsOpen: !1
2680
2666
  })));
2681
2667
  }
2682
- function et(e) {
2668
+ function rt(e) {
2683
2669
  if (n) {
2684
2670
  e.preventDefault();
2685
2671
  return;
2686
2672
  }
2687
2673
  if (e.preventDefault(), e.key === "Escape") {
2688
- ot(null), oe.current = null;
2674
+ ut(null), ce.current = null;
2689
2675
  return;
2690
2676
  }
2691
2677
  if (e.key === "Enter") {
2692
- oe.current = null, z((e) => ({
2678
+ ce.current = null, z((e) => ({
2693
2679
  ...e,
2694
2680
  reverseSearch: null,
2695
2681
  shortcutsOpen: !1
@@ -2697,46 +2683,46 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2697
2683
  return;
2698
2684
  }
2699
2685
  if (e.key === "Backspace") {
2700
- tt((e) => e.slice(0, -1));
2686
+ ot((e) => e.slice(0, -1));
2701
2687
  return;
2702
2688
  }
2703
2689
  if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "r") {
2704
- nt(1);
2690
+ st(1);
2705
2691
  return;
2706
2692
  }
2707
2693
  if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "s") {
2708
- nt(-1);
2694
+ st(-1);
2709
2695
  return;
2710
2696
  }
2711
- e.key.length === 1 && !e.metaKey && !e.altKey && !e.ctrlKey && tt((t) => `${t}${e.key}`);
2697
+ e.key.length === 1 && !e.metaKey && !e.altKey && !e.ctrlKey && ot((t) => `${t}${e.key}`);
2712
2698
  }
2713
- function tt(e) {
2699
+ function ot(e) {
2714
2700
  if (n) return;
2715
- let t = B.current, r = e(t.reverseSearch ?? ""), i = rt(t.history, r, null);
2716
- if (!X || !i) {
2717
- ot(r);
2701
+ let t = B.current, r = e(t.reverseSearch ?? ""), i = it(t.history, r, null);
2702
+ if (!J || !i) {
2703
+ ut(r);
2718
2704
  return;
2719
2705
  }
2720
- at(i.entry, i.index, r);
2706
+ lt(i.entry, i.index, r);
2721
2707
  }
2722
- function nt(e) {
2723
- if (n || !X) return;
2724
- let t = B.current, r = t.reverseSearch ?? "", i = rt(t.history, r, t.historyCursor, e);
2725
- i && at(i.entry, i.index, r);
2708
+ function st(e) {
2709
+ if (n || !J) return;
2710
+ let t = B.current, r = t.reverseSearch ?? "", i = it(t.history, r, t.historyCursor, e);
2711
+ i && lt(i.entry, i.index, r);
2726
2712
  }
2727
- function at(e, t, n) {
2728
- let r = X;
2713
+ function lt(e, t, n) {
2714
+ let r = J;
2729
2715
  if (!r) return;
2730
- let i = We({
2716
+ let i = Ge({
2731
2717
  source: e,
2732
- slashCommands: T,
2733
- mentionCandidates: E
2718
+ slashCommands: E,
2719
+ mentionCandidates: D
2734
2720
  }), a = i.remoteImages ?? [];
2735
- V.current = a, F(a), Z(un({
2721
+ V.current = a, F(a), Y(un({
2736
2722
  state: i,
2737
- slashCommands: T,
2738
- mentionCandidates: E,
2739
- triggers: k
2723
+ slashCommands: E,
2724
+ mentionCandidates: D,
2725
+ triggers: A
2740
2726
  })), r.commands.focus("end"), z((e) => ({
2741
2727
  ...e,
2742
2728
  historyCursor: t,
@@ -2745,10 +2731,10 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2745
2731
  shortcutsOpen: !1
2746
2732
  }));
2747
2733
  }
2748
- function ot(e) {
2734
+ function ut(e) {
2749
2735
  if (n) return;
2750
- let t = oe.current;
2751
- if (!t || !X) {
2736
+ let t = ce.current;
2737
+ if (!t || !J) {
2752
2738
  z((t) => ({
2753
2739
  ...t,
2754
2740
  reverseSearch: e,
@@ -2765,52 +2751,52 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2765
2751
  selectedRemoteImageId: null,
2766
2752
  shortcutsOpen: !1
2767
2753
  };
2768
- K.current = null, V.current = r.remoteImages, F(r.remoteImages), Z(un({
2754
+ G.current = null, V.current = r.remoteImages, F(r.remoteImages), Y(un({
2769
2755
  state: r,
2770
- slashCommands: T,
2771
- mentionCandidates: E,
2772
- triggers: k
2773
- })), X.commands.focus("end"), z(r);
2756
+ slashCommands: E,
2757
+ mentionCandidates: D,
2758
+ triggers: A
2759
+ })), J.commands.focus("end"), z(r);
2774
2760
  }
2775
- de.current = n ? (e) => (e.preventDefault(), !0) : Fe, le.current = Ee;
2776
- function st(e) {
2761
+ _e.current = n ? (e) => (e.preventDefault(), !0) : ze, pe.current = ke;
2762
+ function dt(e) {
2777
2763
  if (!(e.target instanceof Element) || !e.target.closest("[data-slot=\"composer-editor\"]")) return;
2778
2764
  if (n) {
2779
2765
  e.preventDefault();
2780
2766
  return;
2781
2767
  }
2782
- if (!X || Fe(e)) return;
2768
+ if (!J || ze(e)) return;
2783
2769
  if (B.current.reverseSearch !== null) {
2784
- et(e);
2770
+ rt(e);
2785
2771
  return;
2786
2772
  }
2787
2773
  if (B.current.shortcutsOpen && e.key === "Escape") {
2788
- e.preventDefault(), Ce();
2774
+ e.preventDefault(), Ee();
2789
2775
  return;
2790
2776
  }
2791
- if (e.key === "?" && !e.metaKey && !e.ctrlKey && !e.altKey && xe($())) {
2792
- e.preventDefault(), we();
2777
+ if (e.key === "?" && !e.metaKey && !e.ctrlKey && !e.altKey && we(Q())) {
2778
+ e.preventDefault(), De();
2793
2779
  return;
2794
2780
  }
2795
- if (Xr(e)) {
2796
- e.preventDefault(), X.chain().focus().setHardBreak().run(), K.current = null, L(null);
2781
+ if (Kr(e)) {
2782
+ e.preventDefault(), J.chain().focus().setHardBreak().run(), G.current = null, L(null);
2797
2783
  return;
2798
2784
  }
2799
2785
  if (H.current) {
2800
2786
  if (lr(e) || ur(e)) {
2801
- e.preventDefault(), lt(lr(e) ? -1 : 1);
2787
+ e.preventDefault(), pt(lr(e) ? -1 : 1);
2802
2788
  return;
2803
2789
  }
2804
2790
  if (e.key === "Tab") {
2805
- e.preventDefault(), ye();
2791
+ e.preventDefault(), Se();
2806
2792
  return;
2807
2793
  }
2808
2794
  if (e.key === "Enter" && !e.shiftKey) {
2809
- if (e.preventDefault(), he.length === 0) {
2810
- L(null), qe();
2795
+ if (e.preventDefault(), ve.length === 0) {
2796
+ L(null), Xe();
2811
2797
  return;
2812
2798
  }
2813
- ye();
2799
+ Se();
2814
2800
  return;
2815
2801
  }
2816
2802
  if (e.key === "Escape") {
@@ -2818,218 +2804,218 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
2818
2804
  return;
2819
2805
  }
2820
2806
  }
2821
- if (Zr(e)) {
2822
- let t = Jn(X);
2823
- t && (e.preventDefault(), U.current = t, z((e) => ({
2807
+ if (qr(e)) {
2808
+ let t = Jn(J);
2809
+ t && (e.preventDefault(), oe.current = t, z((e) => ({
2824
2810
  ...e,
2825
2811
  killBuffer: t.text
2826
- }))), K.current = null;
2812
+ }))), G.current = null;
2827
2813
  return;
2828
2814
  }
2829
- let t = Qr(e);
2815
+ let t = Jr(e);
2830
2816
  if (t !== null) {
2831
- e.preventDefault(), Xn(X, t), K.current = null;
2817
+ e.preventDefault(), Xn(J, t), G.current = null;
2832
2818
  return;
2833
2819
  }
2834
2820
  if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "e") {
2835
- e.preventDefault(), Yn(X), K.current = null;
2821
+ e.preventDefault(), Yn(J), G.current = null;
2836
2822
  return;
2837
2823
  }
2838
2824
  if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
2839
- let t = Kn(X);
2840
- t && (e.preventDefault(), U.current = t, z((e) => ({
2825
+ let t = Kn(J);
2826
+ t && (e.preventDefault(), oe.current = t, z((e) => ({
2841
2827
  ...e,
2842
2828
  killBuffer: t.text
2843
2829
  })));
2844
2830
  return;
2845
2831
  }
2846
2832
  if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "u") {
2847
- let t = qn(X);
2848
- t && (e.preventDefault(), U.current = t, z((e) => ({
2833
+ let t = qn(J);
2834
+ t && (e.preventDefault(), oe.current = t, z((e) => ({
2849
2835
  ...e,
2850
2836
  killBuffer: t.text
2851
2837
  })));
2852
2838
  return;
2853
2839
  }
2854
2840
  if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "y" && B.current.killBuffer) {
2855
- e.preventDefault(), rr(X, U.current ?? B.current.killBuffer);
2841
+ e.preventDefault(), rr(J, oe.current ?? B.current.killBuffer);
2856
2842
  return;
2857
2843
  }
2858
2844
  if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "r") {
2859
- e.preventDefault(), $e();
2845
+ e.preventDefault(), nt();
2860
2846
  return;
2861
2847
  }
2862
- if ((e.key === "Backspace" || e.key === "Delete") && ei(X)) {
2863
- e.preventDefault(), K.current = null, L(null);
2848
+ if ((e.key === "Backspace" || e.key === "Delete") && Xr(J)) {
2849
+ e.preventDefault(), G.current = null, L(null);
2864
2850
  return;
2865
2851
  }
2866
- if ((e.key === "Backspace" || e.key === "Delete") && ir(X, e.key)) {
2867
- e.preventDefault(), K.current = null;
2852
+ if ((e.key === "Backspace" || e.key === "Delete") && ir(J, e.key)) {
2853
+ e.preventDefault(), G.current = null;
2868
2854
  return;
2869
2855
  }
2870
- if ((e.key === "Backspace" || e.key === "Delete" || e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) && (K.current = null), e.key === "Enter" && !e.shiftKey && !e.altKey) {
2871
- e.preventDefault(), qe();
2856
+ if ((e.key === "Backspace" || e.key === "Delete" || e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) && (G.current = null), e.key === "Enter" && !e.shiftKey && !e.altKey) {
2857
+ e.preventDefault(), Xe();
2872
2858
  return;
2873
2859
  }
2874
- let r = $r(e);
2860
+ let r = Yr(e);
2875
2861
  if (r !== null && !H.current) {
2876
- let t = $();
2877
- if (e.key === "ArrowUp" && (sr(X) || t.cursor === 0) && t.remoteImages.length > 0) {
2878
- e.preventDefault(), Me(t.remoteImages.length - 1);
2862
+ let t = Q();
2863
+ if (e.key === "ArrowUp" && (sr(J) || t.cursor === 0) && t.remoteImages.length > 0) {
2864
+ e.preventDefault(), X(t.remoteImages.length - 1);
2879
2865
  return;
2880
2866
  }
2881
- it(t.text, t.cursor, r) && (e.preventDefault(), Xe(r));
2867
+ at(t.text, t.cursor, r) && (e.preventDefault(), $e(r));
2882
2868
  }
2883
2869
  }
2884
- function ct(e) {
2870
+ function ft(e) {
2885
2871
  if (n) {
2886
2872
  e.preventDefault();
2887
2873
  return;
2888
2874
  }
2889
- e.target instanceof Element && e.target.closest("[data-slot=\"composer-editor\"]") && Q();
2875
+ e.target instanceof Element && e.target.closest("[data-slot=\"composer-editor\"]") && Fe();
2890
2876
  }
2891
- function lt(e) {
2877
+ function pt(e) {
2892
2878
  n || L((t) => {
2893
2879
  if (!t) return t;
2894
- let n = Rt(t, T, E, a).length;
2880
+ let n = Rt(t, E, D, a).length;
2895
2881
  return n === 0 ? t : {
2896
2882
  ...t,
2897
- selectedIndex: Cr(t.selectedIndex + e, n)
2883
+ selectedIndex: ct(t.selectedIndex + e, n)
2898
2884
  };
2899
2885
  });
2900
2886
  }
2901
- let ut = $t({
2887
+ let mt = $t({
2902
2888
  dictation: p,
2903
2889
  disabled: n,
2904
- insertTranscript: Ke,
2905
- submitDraft: Je
2890
+ insertTranscript: Ye,
2891
+ submitDraft: Ze
2906
2892
  });
2907
- return /* @__PURE__ */ C(ie, {
2893
+ return /* @__PURE__ */ w(ae, {
2908
2894
  value: {
2909
2895
  state: R,
2910
2896
  disabled: n,
2911
- commandTriggers: D,
2897
+ commandTriggers: O,
2912
2898
  activePopup: I,
2913
- suggestions: he,
2914
- attachedImages: J.current,
2899
+ suggestions: ve,
2900
+ attachedImages: fe.current,
2915
2901
  actions: {
2916
- acceptSuggestion: ye,
2917
- toggleSlashMenu: be,
2918
- insertText: Te,
2919
- attachImageFiles: Oe,
2920
- removeImageAttachment: ke,
2921
- addRemoteImage: Ae,
2922
- handleDrop: je,
2923
- insertPaste: ze,
2924
- insertRichLink: Ue,
2925
- openShortcuts: Se,
2926
- closeShortcuts: Ce,
2927
- toggleShortcuts: we,
2928
- submit: qe,
2929
- reset: Ye
2902
+ acceptSuggestion: Se,
2903
+ toggleSlashMenu: Ce,
2904
+ insertText: Oe,
2905
+ attachImageFiles: je,
2906
+ removeImageAttachment: Me,
2907
+ addRemoteImage: Ne,
2908
+ handleDrop: Pe,
2909
+ insertPaste: Ke,
2910
+ insertRichLink: qe,
2911
+ openShortcuts: Te,
2912
+ closeShortcuts: Ee,
2913
+ toggleShortcuts: De,
2914
+ submit: Xe,
2915
+ reset: Qe
2930
2916
  },
2931
- meta: { editor: X }
2917
+ meta: { editor: J }
2932
2918
  },
2933
- children: /* @__PURE__ */ C(Bt, {
2934
- value: ut?.api ?? null,
2935
- children: /* @__PURE__ */ C("section", {
2919
+ children: /* @__PURE__ */ w(Bt, {
2920
+ value: mt?.api ?? null,
2921
+ children: /* @__PURE__ */ w("section", {
2936
2922
  "data-slot": "composer",
2937
2923
  className: l("border-border bg-card relative border font-[inherit]", d),
2938
- children: /* @__PURE__ */ w("div", {
2939
- onKeyDownCapture: st,
2940
- onMouseDownCapture: ct,
2941
- children: [f, S.hasLayoutChildren ? null : /* @__PURE__ */ C(Or, {})]
2924
+ children: /* @__PURE__ */ T("div", {
2925
+ onKeyDownCapture: dt,
2926
+ onMouseDownCapture: ft,
2927
+ children: [f, S.hasLayoutChildren ? null : /* @__PURE__ */ w(wr, {})]
2942
2928
  })
2943
2929
  })
2944
2930
  })
2945
2931
  });
2946
2932
  }
2947
- function Or() {
2933
+ function wr() {
2948
2934
  let e = i(2), t;
2949
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ C(Pr, {}), e[0] = t) : t = e[0];
2935
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ w(Ar, {}), e[0] = t) : t = e[0];
2950
2936
  let n;
2951
- return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ w(te, { children: [
2937
+ return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ T(C, { children: [
2952
2938
  t,
2953
- /* @__PURE__ */ w(kr, { children: [
2954
- /* @__PURE__ */ C(jr, {}),
2955
- /* @__PURE__ */ C(F, {}),
2956
- /* @__PURE__ */ C(Mr, {}),
2957
- /* @__PURE__ */ C(Nr, {})
2939
+ /* @__PURE__ */ T(Tr, { children: [
2940
+ /* @__PURE__ */ w(Dr, {}),
2941
+ /* @__PURE__ */ w(P, {}),
2942
+ /* @__PURE__ */ w(Or, {}),
2943
+ /* @__PURE__ */ w(kr, {})
2958
2944
  ] }),
2959
- /* @__PURE__ */ C(Rr, {}),
2960
- /* @__PURE__ */ C(Vr, {})
2945
+ /* @__PURE__ */ w(Pr, {}),
2946
+ /* @__PURE__ */ w(Lr, {})
2961
2947
  ] }), e[1] = n) : n = e[1], n;
2962
2948
  }
2963
- function kr(e) {
2949
+ function Tr(e) {
2964
2950
  let t = i(8), n, r;
2965
2951
  t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
2966
2952
  let a;
2967
2953
  t[3] === n ? a = t[4] : (a = l("space-y-2", n), t[3] = n, t[4] = a);
2968
2954
  let o;
2969
- return t[5] !== r || t[6] !== a ? (o = /* @__PURE__ */ C("div", {
2955
+ return t[5] !== r || t[6] !== a ? (o = /* @__PURE__ */ w("div", {
2970
2956
  className: a,
2971
2957
  ...r
2972
2958
  }), t[5] = r, t[6] = a, t[7] = o) : o = t[7], o;
2973
2959
  }
2974
- function Ar(e) {
2960
+ function Er(e) {
2975
2961
  let t = i(8), n, r;
2976
2962
  t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
2977
2963
  let a;
2978
2964
  t[3] === n ? a = t[4] : (a = l("flex flex-wrap items-center gap-1.5", n), t[3] = n, t[4] = a);
2979
2965
  let o;
2980
- return t[5] !== r || t[6] !== a ? (o = /* @__PURE__ */ C("div", {
2966
+ return t[5] !== r || t[6] !== a ? (o = /* @__PURE__ */ w("div", {
2981
2967
  className: a,
2982
2968
  ...r
2983
2969
  }), t[5] = r, t[6] = a, t[7] = o) : o = t[7], o;
2984
2970
  }
2985
- function jr(e) {
2971
+ function Dr(e) {
2986
2972
  let t = i(14), n, r;
2987
2973
  t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
2988
- let { state: a } = N("Composer.RemoteImages");
2974
+ let { state: a } = M("Composer.RemoteImages");
2989
2975
  if (a.remoteImages.length === 0) return null;
2990
2976
  let o;
2991
2977
  t[3] === n ? o = t[4] : (o = l("border-border space-y-1 border-b pb-2 text-sm", n), t[3] = n, t[4] = o);
2992
2978
  let s;
2993
2979
  if (t[5] !== a.remoteImages || t[6] !== a.selectedRemoteImageId) {
2994
2980
  let e;
2995
- t[8] === a.selectedRemoteImageId ? e = t[9] : (e = (e, t) => /* @__PURE__ */ w("div", {
2981
+ t[8] === a.selectedRemoteImageId ? e = t[9] : (e = (e, t) => /* @__PURE__ */ T("div", {
2996
2982
  className: l("flex h-6 items-center gap-2 rounded-sm px-2", a.selectedRemoteImageId === e.id ? "bg-primary text-primary-foreground" : "text-sky-500"),
2997
- children: [/* @__PURE__ */ w("span", {
2983
+ children: [/* @__PURE__ */ T("span", {
2998
2984
  className: "shrink-0",
2999
2985
  children: [
3000
2986
  "[Image #",
3001
2987
  t + 1,
3002
2988
  "]"
3003
2989
  ]
3004
- }), /* @__PURE__ */ C("span", {
2990
+ }), /* @__PURE__ */ w("span", {
3005
2991
  className: "truncate text-xs opacity-70",
3006
2992
  children: e.url
3007
2993
  })]
3008
2994
  }, e.id), t[8] = a.selectedRemoteImageId, t[9] = e), s = a.remoteImages.map(e), t[5] = a.remoteImages, t[6] = a.selectedRemoteImageId, t[7] = s;
3009
2995
  } else s = t[7];
3010
2996
  let c;
3011
- return t[10] !== r || t[11] !== o || t[12] !== s ? (c = /* @__PURE__ */ C("div", {
2997
+ return t[10] !== r || t[11] !== o || t[12] !== s ? (c = /* @__PURE__ */ w("div", {
3012
2998
  className: o,
3013
2999
  ...r,
3014
3000
  children: s
3015
3001
  }), t[10] = r, t[11] = o, t[12] = s, t[13] = c) : c = t[13], c;
3016
3002
  }
3017
- function Mr(e) {
3003
+ function Or(e) {
3018
3004
  let t = i(21), n, r, a, s;
3019
3005
  t[0] === e ? (n = t[1], r = t[2], a = t[3], s = t[4]) : ({className: n, onDrop: r, placeholder: s, ...a} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = a, t[4] = s);
3020
- let c = s === void 0 ? "Type a message or / for commands" : s, { state: l, disabled: u, meta: d, actions: f } = N("Composer.Editor"), p = u ? "" : void 0, m;
3006
+ let c = s === void 0 ? "Type a message or / for commands" : s, { state: l, disabled: u, meta: d, actions: f } = M("Composer.Editor"), p = u ? "" : void 0, m;
3021
3007
  t[5] !== f || t[6] !== r ? (m = (e) => {
3022
3008
  r?.(e), !e.defaultPrevented && f.handleDrop(e.dataTransfer) && e.preventDefault();
3023
3009
  }, t[5] = f, t[6] = r, t[7] = m) : m = t[7];
3024
3010
  let h;
3025
- t[8] !== c || t[9] !== l.text.length ? (h = l.text.length === 0 ? /* @__PURE__ */ C("div", {
3011
+ t[8] !== c || t[9] !== l.text.length ? (h = l.text.length === 0 ? /* @__PURE__ */ w("div", {
3026
3012
  "data-slot": "composer-placeholder",
3027
3013
  children: c
3028
3014
  }) : null, t[8] = c, t[9] = l.text.length, t[10] = h) : h = t[10];
3029
3015
  let g;
3030
- t[11] === d.editor ? g = t[12] : (g = /* @__PURE__ */ C(o, { editor: d.editor }), t[11] = d.editor, t[12] = g);
3016
+ t[11] === d.editor ? g = t[12] : (g = /* @__PURE__ */ w(o, { editor: d.editor }), t[11] = d.editor, t[12] = g);
3031
3017
  let _;
3032
- return t[13] !== n || t[14] !== u || t[15] !== a || t[16] !== p || t[17] !== m || t[18] !== h || t[19] !== g ? (_ = /* @__PURE__ */ w("div", {
3018
+ return t[13] !== n || t[14] !== u || t[15] !== a || t[16] !== p || t[17] !== m || t[18] !== h || t[19] !== g ? (_ = /* @__PURE__ */ T("div", {
3033
3019
  "data-slot": "composer-frame",
3034
3020
  className: n,
3035
3021
  "aria-disabled": u,
@@ -3039,66 +3025,66 @@ function Mr(e) {
3039
3025
  children: [h, g]
3040
3026
  }), t[13] = n, t[14] = u, t[15] = a, t[16] = p, t[17] = m, t[18] = h, t[19] = g, t[20] = _) : _ = t[20], _;
3041
3027
  }
3042
- function Nr(e) {
3028
+ function kr(e) {
3043
3029
  let t = i(9), n, r;
3044
3030
  t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
3045
- let { state: a } = N("Composer.Error");
3031
+ let { state: a } = M("Composer.Error");
3046
3032
  if (!a.error) return null;
3047
3033
  let o;
3048
3034
  t[3] === n ? o = t[4] : (o = l("border-primary/30 bg-primary/10 text-primary rounded-md border px-3 py-2 text-xs", n), t[3] = n, t[4] = o);
3049
3035
  let s;
3050
- return t[5] !== r || t[6] !== a.error || t[7] !== o ? (s = /* @__PURE__ */ C("div", {
3036
+ return t[5] !== r || t[6] !== a.error || t[7] !== o ? (s = /* @__PURE__ */ w("div", {
3051
3037
  role: "alert",
3052
3038
  className: o,
3053
3039
  ...r,
3054
3040
  children: a.error
3055
3041
  }), t[5] = r, t[6] = a.error, t[7] = o, t[8] = s) : s = t[8], s;
3056
3042
  }
3057
- function Pr(e) {
3043
+ function Ar(e) {
3058
3044
  let t = i(25), n, r;
3059
3045
  t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
3060
- let { activePopup: a, suggestions: o, actions: s } = N("Composer.Popup"), { acceptSuggestion: c } = s;
3046
+ let { activePopup: a, suggestions: o, actions: s } = M("Composer.Popup"), { acceptSuggestion: c } = s;
3061
3047
  if (!a) return null;
3062
3048
  let u;
3063
- t[3] === o ? u = t[4] : (u = o.some(Fr), t[3] = o, t[4] = u);
3049
+ t[3] === o ? u = t[4] : (u = o.some(jr), t[3] = o, t[4] = u);
3064
3050
  let d = u, f;
3065
3051
  t[5] === n ? f = t[6] : (f = l("border-border bg-popover absolute inset-x-0 bottom-[calc(100%+0.5rem)] z-10 rounded-xl border shadow-lg", n), t[5] = n, t[6] = f);
3066
3052
  let p;
3067
3053
  if (t[7] !== c || t[8] !== a || t[9] !== o || t[10] !== d) {
3068
3054
  let e;
3069
- t[12] !== c || t[13] !== a || t[14] !== d ? (e = (e, t) => /* @__PURE__ */ C(Ir, {
3055
+ t[12] !== c || t[13] !== a || t[14] !== d ? (e = (e, t) => /* @__PURE__ */ w(Mr, {
3070
3056
  selected: t === a.selectedIndex,
3071
3057
  icon: d ? e.icon : null,
3072
- token: Y(e),
3058
+ token: K(e),
3073
3059
  takesArgs: e.supportsArgs === !0,
3074
3060
  description: e.detail,
3075
3061
  onMouseDown: () => c({ index: t })
3076
3062
  }, `item:${e.id}`), t[12] = c, t[13] = a, t[14] = d, t[15] = e) : e = t[15], p = o.map(e), t[7] = c, t[8] = a, t[9] = o, t[10] = d, t[11] = p;
3077
3063
  } else p = t[11];
3078
3064
  let m;
3079
- t[16] === o.length ? m = t[17] : (m = o.length === 0 ? /* @__PURE__ */ C("div", {
3065
+ t[16] === o.length ? m = t[17] : (m = o.length === 0 ? /* @__PURE__ */ w("div", {
3080
3066
  className: "text-muted-foreground px-2 py-1 text-[13px] leading-4",
3081
3067
  children: "no matches"
3082
3068
  }) : null, t[16] = o.length, t[17] = m);
3083
3069
  let h;
3084
- t[18] !== p || t[19] !== m ? (h = /* @__PURE__ */ w("div", {
3070
+ t[18] !== p || t[19] !== m ? (h = /* @__PURE__ */ T("div", {
3085
3071
  className: "flex max-h-72 flex-col gap-1 overflow-y-auto p-1",
3086
3072
  role: "listbox",
3087
3073
  "aria-label": "Suggestions",
3088
3074
  children: [p, m]
3089
3075
  }), t[18] = p, t[19] = m, t[20] = h) : h = t[20];
3090
3076
  let g;
3091
- return t[21] !== r || t[22] !== f || t[23] !== h ? (g = /* @__PURE__ */ C("div", {
3077
+ return t[21] !== r || t[22] !== f || t[23] !== h ? (g = /* @__PURE__ */ w("div", {
3092
3078
  className: f,
3093
3079
  ...r,
3094
3080
  children: h
3095
3081
  }), t[21] = r, t[22] = f, t[23] = h, t[24] = g) : g = t[24], g;
3096
3082
  }
3097
- function Fr(e) {
3083
+ function jr(e) {
3098
3084
  return e.icon;
3099
3085
  }
3100
- function Ir(e) {
3101
- let t = i(23), { selected: n, icon: r, token: a, takesArgs: o, description: s, onMouseDown: c } = e, u = y(null), d, f;
3086
+ function Mr(e) {
3087
+ let t = i(23), { selected: n, icon: r, token: a, takesArgs: o, description: s, onMouseDown: c } = e, u = b(null), d, f;
3102
3088
  t[0] === n ? (d = t[1], f = t[2]) : (d = () => {
3103
3089
  n && u.current?.scrollIntoView({ block: "nearest" });
3104
3090
  }, f = [n], t[0] = n, t[1] = d, t[2] = f), _(d, f);
@@ -3109,27 +3095,27 @@ function Ir(e) {
3109
3095
  e.preventDefault(), c();
3110
3096
  }, t[5] = c, t[6] = h);
3111
3097
  let g;
3112
- t[7] === r ? g = t[8] : (g = r === null ? null : /* @__PURE__ */ C("span", {
3098
+ t[7] === r ? g = t[8] : (g = r === null ? null : /* @__PURE__ */ w("span", {
3113
3099
  className: "flex size-4 shrink-0 items-center justify-center",
3114
3100
  children: r
3115
3101
  }), t[7] = r, t[8] = g);
3116
3102
  let v;
3117
- t[9] === a ? v = t[10] : (v = /* @__PURE__ */ C("span", {
3103
+ t[9] === a ? v = t[10] : (v = /* @__PURE__ */ w("span", {
3118
3104
  className: "truncate",
3119
3105
  children: a
3120
3106
  }), t[9] = a, t[10] = v);
3121
- let b;
3122
- t[11] === o ? b = t[12] : (b = o ? /* @__PURE__ */ C("span", {
3107
+ let y;
3108
+ t[11] === o ? y = t[12] : (y = o ? /* @__PURE__ */ w("span", {
3123
3109
  className: "text-muted-foreground shrink-0",
3124
3110
  children: "args"
3125
- }) : null, t[11] = o, t[12] = b);
3111
+ }) : null, t[11] = o, t[12] = y);
3126
3112
  let x;
3127
- t[13] === s ? x = t[14] : (x = /* @__PURE__ */ C("span", {
3113
+ t[13] === s ? x = t[14] : (x = /* @__PURE__ */ w("span", {
3128
3114
  className: "text-muted-foreground truncate",
3129
3115
  children: s
3130
3116
  }), t[13] = s, t[14] = x);
3131
- let S;
3132
- return t[15] !== n || t[16] !== m || t[17] !== h || t[18] !== g || t[19] !== v || t[20] !== b || t[21] !== x ? (S = /* @__PURE__ */ w("button", {
3117
+ let ee;
3118
+ return t[15] !== n || t[16] !== m || t[17] !== h || t[18] !== g || t[19] !== v || t[20] !== y || t[21] !== x ? (ee = /* @__PURE__ */ T("button", {
3133
3119
  ref: u,
3134
3120
  type: "button",
3135
3121
  role: "option",
@@ -3139,12 +3125,12 @@ function Ir(e) {
3139
3125
  children: [
3140
3126
  g,
3141
3127
  v,
3142
- b,
3128
+ y,
3143
3129
  x
3144
3130
  ]
3145
- }), t[15] = n, t[16] = m, t[17] = h, t[18] = g, t[19] = v, t[20] = b, t[21] = x, t[22] = S) : S = t[22], S;
3131
+ }), t[15] = n, t[16] = m, t[17] = h, t[18] = g, t[19] = v, t[20] = y, t[21] = x, t[22] = ee) : ee = t[22], ee;
3146
3132
  }
3147
- var Lr = [
3133
+ var Nr = [
3148
3134
  {
3149
3135
  title: "Send",
3150
3136
  items: [
@@ -3172,22 +3158,22 @@ var Lr = [
3172
3158
  ]
3173
3159
  }
3174
3160
  ];
3175
- function Rr(e) {
3161
+ function Pr(e) {
3176
3162
  let t = i(13), n, r;
3177
3163
  t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
3178
- let { state: a, actions: o } = N("Composer.Shortcuts"), { closeShortcuts: s } = o;
3179
- if (!a.shortcutsOpen || !fe(a)) return null;
3164
+ let { state: a, actions: o } = M("Composer.Shortcuts"), { closeShortcuts: s } = o;
3165
+ if (!a.shortcutsOpen || !me(a)) return null;
3180
3166
  let c;
3181
3167
  t[3] === n ? c = t[4] : (c = l("border-border bg-popover border-t px-3 py-3 text-xs", n), t[3] = n, t[4] = c);
3182
3168
  let u;
3183
- t[5] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ C("div", {
3169
+ t[5] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ w("div", {
3184
3170
  className: "text-foreground font-medium",
3185
3171
  children: "Keyboard shortcuts"
3186
3172
  }), t[5] = u) : u = t[5];
3187
3173
  let d;
3188
- t[6] === s ? d = t[7] : (d = /* @__PURE__ */ w("div", {
3174
+ t[6] === s ? d = t[7] : (d = /* @__PURE__ */ T("div", {
3189
3175
  className: "mb-3 flex items-center justify-between gap-3",
3190
- children: [u, /* @__PURE__ */ C("button", {
3176
+ children: [u, /* @__PURE__ */ w("button", {
3191
3177
  type: "button",
3192
3178
  className: "text-muted-foreground hover:bg-muted hover:text-foreground rounded-sm px-2 py-1",
3193
3179
  onClick: s,
@@ -3195,12 +3181,12 @@ function Rr(e) {
3195
3181
  })]
3196
3182
  }), t[6] = s, t[7] = d);
3197
3183
  let f;
3198
- t[8] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ C("div", {
3184
+ t[8] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ w("div", {
3199
3185
  className: "grid gap-3 sm:grid-cols-3",
3200
- children: Lr.map(zr)
3186
+ children: Nr.map(Fr)
3201
3187
  }), t[8] = f) : f = t[8];
3202
3188
  let p;
3203
- return t[9] !== r || t[10] !== c || t[11] !== d ? (p = /* @__PURE__ */ w("div", {
3189
+ return t[9] !== r || t[10] !== c || t[11] !== d ? (p = /* @__PURE__ */ T("div", {
3204
3190
  role: "dialog",
3205
3191
  "aria-label": "Keyboard shortcuts",
3206
3192
  className: c,
@@ -3208,52 +3194,52 @@ function Rr(e) {
3208
3194
  children: [d, f]
3209
3195
  }), t[9] = r, t[10] = c, t[11] = d, t[12] = p) : p = t[12], p;
3210
3196
  }
3211
- function zr(e) {
3212
- return /* @__PURE__ */ w("div", {
3197
+ function Fr(e) {
3198
+ return /* @__PURE__ */ T("div", {
3213
3199
  className: "space-y-2",
3214
- children: [/* @__PURE__ */ C("div", {
3200
+ children: [/* @__PURE__ */ w("div", {
3215
3201
  className: "text-muted-foreground text-[11px]",
3216
3202
  children: e.title
3217
- }), /* @__PURE__ */ C("div", {
3203
+ }), /* @__PURE__ */ w("div", {
3218
3204
  className: "space-y-1",
3219
- children: e.items.map(Br)
3205
+ children: e.items.map(Ir)
3220
3206
  })]
3221
3207
  }, e.title);
3222
3208
  }
3223
- function Br(e) {
3209
+ function Ir(e) {
3224
3210
  let [t, n] = e;
3225
- return /* @__PURE__ */ w("div", {
3211
+ return /* @__PURE__ */ T("div", {
3226
3212
  className: "flex items-center justify-between gap-2",
3227
- children: [/* @__PURE__ */ C("kbd", {
3213
+ children: [/* @__PURE__ */ w("kbd", {
3228
3214
  className: "border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]",
3229
3215
  children: t
3230
- }), /* @__PURE__ */ C("span", {
3216
+ }), /* @__PURE__ */ w("span", {
3231
3217
  className: "text-muted-foreground text-right",
3232
3218
  children: n
3233
3219
  })]
3234
3220
  }, `${t}-${n}`);
3235
3221
  }
3236
- function Vr(e) {
3237
- let t = i(30), n, r;
3222
+ function Lr(e) {
3223
+ let t = i(29), n, r;
3238
3224
  t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
3239
- let { activePopup: a, state: o, commandTriggers: s } = N("Composer.Footer");
3225
+ let { activePopup: a, state: o } = M("Composer.Footer");
3240
3226
  if (o.reverseSearch !== null) {
3241
3227
  let e;
3242
3228
  t[3] === n ? e = t[4] : (e = l("border-border text-muted-foreground flex items-center gap-2 border-t px-3 py-2 text-[11px]", n), t[3] = n, t[4] = e);
3243
3229
  let i, a;
3244
- t[5] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ C("kbd", {
3230
+ t[5] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ w("kbd", {
3245
3231
  className: "border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]",
3246
3232
  children: "Ctrl R"
3247
- }), a = /* @__PURE__ */ C("span", { children: "reverse-i-search:" }), t[5] = i, t[6] = a) : (i = t[5], a = t[6]);
3233
+ }), a = /* @__PURE__ */ w("span", { children: "reverse-i-search:" }), t[5] = i, t[6] = a) : (i = t[5], a = t[6]);
3248
3234
  let s = o.reverseSearch || "_", c;
3249
- t[7] === s ? c = t[8] : (c = /* @__PURE__ */ C("span", {
3235
+ t[7] === s ? c = t[8] : (c = /* @__PURE__ */ w("span", {
3250
3236
  className: "text-foreground",
3251
3237
  children: s
3252
3238
  }), t[7] = s, t[8] = c);
3253
3239
  let u, d, f, p;
3254
- t[9] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ C("span", { children: "Ctrl R previous" }), d = /* @__PURE__ */ C("span", { children: "Ctrl S next" }), f = /* @__PURE__ */ C("span", { children: "Enter accept" }), p = /* @__PURE__ */ C("span", { children: "Esc cancel" }), t[9] = u, t[10] = d, t[11] = f, t[12] = p) : (u = t[9], d = t[10], f = t[11], p = t[12]);
3240
+ t[9] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ w("span", { children: "Ctrl R previous" }), d = /* @__PURE__ */ w("span", { children: "Ctrl S next" }), f = /* @__PURE__ */ w("span", { children: "Enter accept" }), p = /* @__PURE__ */ w("span", { children: "Esc cancel" }), t[9] = u, t[10] = d, t[11] = f, t[12] = p) : (u = t[9], d = t[10], f = t[11], p = t[12]);
3255
3241
  let m;
3256
- return t[13] !== r || t[14] !== e || t[15] !== c ? (m = /* @__PURE__ */ w("div", {
3242
+ return t[13] !== r || t[14] !== e || t[15] !== c ? (m = /* @__PURE__ */ T("div", {
3257
3243
  className: e,
3258
3244
  ...r,
3259
3245
  children: [
@@ -3267,8 +3253,8 @@ function Vr(e) {
3267
3253
  ]
3268
3254
  }), t[13] = r, t[14] = e, t[15] = c, t[16] = m) : m = t[16], m;
3269
3255
  }
3270
- let c;
3271
- t[17] !== a || t[18] !== s || t[19] !== o.isTaskRunning || t[20] !== o.queueSubmissions ? (c = a !== null && s.includes(a.trigger) || a ? [
3256
+ let s;
3257
+ t[17] !== a || t[18] !== o.isTaskRunning || t[19] !== o.queueSubmissions ? (s = a ? [
3272
3258
  ["Enter", "insert"],
3273
3259
  ["Tab", "insert"],
3274
3260
  ["Esc", "dismiss"]
@@ -3284,35 +3270,35 @@ function Vr(e) {
3284
3270
  ["Ctrl W", "word kill"],
3285
3271
  ["Alt B/F", "word move"],
3286
3272
  ["Ctrl Y", "yank"]
3287
- ], t[17] = a, t[18] = s, t[19] = o.isTaskRunning, t[20] = o.queueSubmissions, t[21] = c) : c = t[21];
3288
- let u = c, d;
3289
- t[22] === n ? d = t[23] : (d = l("border-border text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-1 border-t px-3 py-2 text-[11px]", n), t[22] = n, t[23] = d);
3273
+ ], t[17] = a, t[18] = o.isTaskRunning, t[19] = o.queueSubmissions, t[20] = s) : s = t[20];
3274
+ let c = s, u;
3275
+ t[21] === n ? u = t[22] : (u = l("border-border text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-1 border-t px-3 py-2 text-[11px]", n), t[21] = n, t[22] = u);
3276
+ let d;
3277
+ t[23] === c ? d = t[24] : (d = c.map(Rr), t[23] = c, t[24] = d);
3290
3278
  let f;
3291
- t[24] === u ? f = t[25] : (f = u.map(Hr), t[24] = u, t[25] = f);
3292
- let p;
3293
- return t[26] !== r || t[27] !== d || t[28] !== f ? (p = /* @__PURE__ */ C("div", {
3294
- className: d,
3279
+ return t[25] !== r || t[26] !== u || t[27] !== d ? (f = /* @__PURE__ */ w("div", {
3280
+ className: u,
3295
3281
  ...r,
3296
- children: f
3297
- }), t[26] = r, t[27] = d, t[28] = f, t[29] = p) : p = t[29], p;
3282
+ children: d
3283
+ }), t[25] = r, t[26] = u, t[27] = d, t[28] = f) : f = t[28], f;
3298
3284
  }
3299
- function Hr(e) {
3285
+ function Rr(e) {
3300
3286
  let [t, n] = e;
3301
- return /* @__PURE__ */ w("span", {
3287
+ return /* @__PURE__ */ T("span", {
3302
3288
  className: "inline-flex items-center gap-1",
3303
- children: [/* @__PURE__ */ C("kbd", {
3289
+ children: [/* @__PURE__ */ w("kbd", {
3304
3290
  className: "border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]",
3305
3291
  children: t
3306
3292
  }), n]
3307
3293
  }, `${t}-${n}`);
3308
3294
  }
3309
- function Ur(e) {
3295
+ function zr(e) {
3310
3296
  let t = i(19), n, r, a, o;
3311
3297
  t[0] === e ? (n = t[1], r = t[2], a = t[3], o = t[4]) : ({accept: a, multiple: o, disabled: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = a, t[4] = o);
3312
- let s = a === void 0 ? "image/*,video/*,audio/*" : a, c = o === void 0 || o, { actions: l, disabled: u } = N("Composer.AttachFiles"), d = y(null), f;
3298
+ let s = a === void 0 ? "image/*,video/*,audio/*" : a, c = o === void 0 || o, { actions: l, disabled: u } = M("Composer.AttachFiles"), d = b(null), f;
3313
3299
  t[5] === Symbol.for("react.memo_cache_sentinel") ? (f = () => d.current?.click(), t[5] = f) : f = t[5];
3314
3300
  let p;
3315
- t[6] !== n || t[7] !== r ? (p = /* @__PURE__ */ C(Yr, {
3301
+ t[6] !== n || t[7] !== r ? (p = /* @__PURE__ */ w(Gr, {
3316
3302
  action: f,
3317
3303
  disabled: n,
3318
3304
  ...r
@@ -3323,7 +3309,7 @@ function Ur(e) {
3323
3309
  t.files && l.attachImageFiles(t.files), t.value = "";
3324
3310
  }, t[9] = l, t[10] = h);
3325
3311
  let g;
3326
- t[11] !== s || t[12] !== c || t[13] !== m || t[14] !== h ? (g = /* @__PURE__ */ C("input", {
3312
+ t[11] !== s || t[12] !== c || t[13] !== m || t[14] !== h ? (g = /* @__PURE__ */ w("input", {
3327
3313
  ref: d,
3328
3314
  type: "file",
3329
3315
  accept: s,
@@ -3334,82 +3320,82 @@ function Ur(e) {
3334
3320
  onChange: h
3335
3321
  }), t[11] = s, t[12] = c, t[13] = m, t[14] = h, t[15] = g) : g = t[15];
3336
3322
  let _;
3337
- return t[16] !== p || t[17] !== g ? (_ = /* @__PURE__ */ w(te, { children: [p, g] }), t[16] = p, t[17] = g, t[18] = _) : _ = t[18], _;
3323
+ return t[16] !== p || t[17] !== g ? (_ = /* @__PURE__ */ T(C, { children: [p, g] }), t[16] = p, t[17] = g, t[18] = _) : _ = t[18], _;
3338
3324
  }
3339
- function Wr(e) {
3325
+ function Br(e) {
3340
3326
  let t = i(9), n, r;
3341
3327
  t[0] === e ? (n = t[1], r = t[2]) : ({url: r, ...n} = e, t[0] = e, t[1] = n, t[2] = r);
3342
- let { actions: a } = N("Composer.AddRemoteImage"), o;
3328
+ let { actions: a } = M("Composer.AddRemoteImage"), o;
3343
3329
  t[3] !== a || t[4] !== r ? (o = () => a.addRemoteImage(r), t[3] = a, t[4] = r, t[5] = o) : o = t[5];
3344
3330
  let s;
3345
- return t[6] !== n || t[7] !== o ? (s = /* @__PURE__ */ C(Yr, {
3331
+ return t[6] !== n || t[7] !== o ? (s = /* @__PURE__ */ w(Gr, {
3346
3332
  action: o,
3347
3333
  ...n
3348
3334
  }), t[6] = n, t[7] = o, t[8] = s) : s = t[8], s;
3349
3335
  }
3350
- function Gr(e) {
3336
+ function Vr(e) {
3351
3337
  let t = i(9), n, r;
3352
3338
  t[0] === e ? (n = t[1], r = t[2]) : ({content: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
3353
- let { actions: a } = N("Composer.InsertPaste"), o;
3339
+ let { actions: a } = M("Composer.InsertPaste"), o;
3354
3340
  t[3] !== a || t[4] !== n ? (o = () => a.insertPaste(n), t[3] = a, t[4] = n, t[5] = o) : o = t[5];
3355
3341
  let s;
3356
- return t[6] !== r || t[7] !== o ? (s = /* @__PURE__ */ C(Yr, {
3342
+ return t[6] !== r || t[7] !== o ? (s = /* @__PURE__ */ w(Gr, {
3357
3343
  action: o,
3358
3344
  ...r
3359
3345
  }), t[6] = r, t[7] = o, t[8] = s) : s = t[8], s;
3360
3346
  }
3361
- function Kr(e) {
3347
+ function Hr(e) {
3362
3348
  let t = i(13), n, r, a, o;
3363
3349
  t[0] === e ? (n = t[1], r = t[2], a = t[3], o = t[4]) : ({href: n, label: r, metadata: a, ...o} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = a, t[4] = o);
3364
- let { actions: s } = N("Composer.InsertRichLink"), c;
3350
+ let { actions: s } = M("Composer.InsertRichLink"), c;
3365
3351
  t[5] !== s || t[6] !== n || t[7] !== r || t[8] !== a ? (c = () => s.insertRichLink(n, r, a), t[5] = s, t[6] = n, t[7] = r, t[8] = a, t[9] = c) : c = t[9];
3366
3352
  let l;
3367
- return t[10] !== o || t[11] !== c ? (l = /* @__PURE__ */ C(Yr, {
3353
+ return t[10] !== o || t[11] !== c ? (l = /* @__PURE__ */ w(Gr, {
3368
3354
  action: c,
3369
3355
  ...o
3370
3356
  }), t[10] = o, t[11] = c, t[12] = l) : l = t[12], l;
3371
3357
  }
3372
- function qr(e) {
3373
- let t = i(3), { actions: n } = N("Composer.Submit"), r;
3374
- return t[0] !== n.submit || t[1] !== e ? (r = /* @__PURE__ */ C(Yr, {
3358
+ function Ur(e) {
3359
+ let t = i(3), { actions: n } = M("Composer.Submit"), r;
3360
+ return t[0] !== n.submit || t[1] !== e ? (r = /* @__PURE__ */ w(Gr, {
3375
3361
  action: n.submit,
3376
3362
  ...e
3377
3363
  }), t[0] = n.submit, t[1] = e, t[2] = r) : r = t[2], r;
3378
3364
  }
3379
- function Jr(e) {
3380
- let t = i(3), { actions: n } = N("Composer.Reset"), r;
3381
- return t[0] !== n.reset || t[1] !== e ? (r = /* @__PURE__ */ C(Yr, {
3365
+ function Wr(e) {
3366
+ let t = i(3), { actions: n } = M("Composer.Reset"), r;
3367
+ return t[0] !== n.reset || t[1] !== e ? (r = /* @__PURE__ */ w(Gr, {
3382
3368
  action: n.reset,
3383
3369
  ...e
3384
3370
  }), t[0] = n.reset, t[1] = e, t[2] = r) : r = t[2], r;
3385
3371
  }
3386
- function Yr(e) {
3372
+ function Gr(e) {
3387
3373
  let t = i(12), n, r, o, s;
3388
3374
  t[0] === e ? (n = t[1], r = t[2], o = t[3], s = t[4]) : ({action: n, onClick: o, disabled: r, ...s} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = o, t[4] = s);
3389
- let { disabled: c } = N("Composer.ActionTrigger"), l = c || r, u;
3375
+ let { disabled: c } = M("Composer.ActionTrigger"), l = c || r, u;
3390
3376
  t[5] !== n || t[6] !== o ? (u = (e) => {
3391
3377
  o?.(e), e.defaultPrevented || n();
3392
3378
  }, t[5] = n, t[6] = o, t[7] = u) : u = t[7];
3393
3379
  let d;
3394
- return t[8] !== s || t[9] !== l || t[10] !== u ? (d = /* @__PURE__ */ C(a, {
3380
+ return t[8] !== s || t[9] !== l || t[10] !== u ? (d = /* @__PURE__ */ w(a, {
3395
3381
  ...s,
3396
3382
  disabled: l,
3397
3383
  onClick: u
3398
3384
  }), t[8] = s, t[9] = l, t[10] = u, t[11] = d) : d = t[11], d;
3399
3385
  }
3400
- function Xr(e) {
3386
+ function Kr(e) {
3401
3387
  if (e.metaKey) return !1;
3402
3388
  if (e.key === "Enter") return e.altKey && !e.ctrlKey;
3403
3389
  let t = e.key.toLowerCase();
3404
3390
  return e.ctrlKey && !e.altKey && (t === "j" || t === "m");
3405
3391
  }
3406
- function Zr(e) {
3392
+ function qr(e) {
3407
3393
  if (e.metaKey) return !1;
3408
3394
  if (e.key === "Backspace") return e.ctrlKey || e.altKey;
3409
3395
  let t = e.key.toLowerCase();
3410
3396
  return e.ctrlKey && !e.altKey && t === "w" || e.ctrlKey && e.altKey && t === "h";
3411
3397
  }
3412
- function Qr(e) {
3398
+ function Jr(e) {
3413
3399
  if (e.metaKey || e.shiftKey) return null;
3414
3400
  if (e.key === "ArrowLeft" && (e.altKey || e.ctrlKey)) return -1;
3415
3401
  if (e.key === "ArrowRight" && (e.altKey || e.ctrlKey)) return 1;
@@ -3417,55 +3403,55 @@ function Qr(e) {
3417
3403
  let t = e.key.toLowerCase();
3418
3404
  return t === "b" ? -1 : t === "f" ? 1 : null;
3419
3405
  }
3420
- function $r(e) {
3406
+ function Yr(e) {
3421
3407
  if (e.key === "ArrowUp") return -1;
3422
3408
  if (e.key === "ArrowDown") return 1;
3423
3409
  if (e.metaKey || e.altKey || e.shiftKey || !e.ctrlKey) return null;
3424
3410
  let t = e.key.toLowerCase();
3425
3411
  return t === "p" ? -1 : t === "n" ? 1 : null;
3426
3412
  }
3427
- function ei(e) {
3413
+ function Xr(e) {
3428
3414
  let { doc: t, selection: n } = e.state;
3429
3415
  return n.empty || n.from > 1 || n.to < t.content.size - 1 ? !1 : (e.commands.setContent(bn(), { emitUpdate: !0 }), e.commands.focus("start"), e.commands.setTextSelection(1), !0);
3430
3416
  }
3431
- var ti = {
3432
- Root: Tr,
3417
+ var Zr = {
3418
+ Root: xr,
3433
3419
  Trigger: kt,
3434
3420
  Command: At,
3435
3421
  Mention: jt,
3436
- Content: kr,
3437
- Toolbar: Ar,
3438
- RemoteImages: jr,
3439
- Attachments: F,
3440
- Editor: Mr,
3441
- Error: Nr,
3442
- Popup: Pr,
3443
- Shortcuts: Rr,
3444
- Footer: Vr,
3445
- AttachFiles: Ur,
3446
- AddRemoteImage: Wr,
3447
- InsertPaste: Gr,
3448
- InsertRichLink: Kr,
3422
+ Content: Tr,
3423
+ Toolbar: Er,
3424
+ RemoteImages: Dr,
3425
+ Attachments: P,
3426
+ Editor: Or,
3427
+ Error: kr,
3428
+ Popup: Ar,
3429
+ Shortcuts: Pr,
3430
+ Footer: Lr,
3431
+ AttachFiles: zr,
3432
+ AddRemoteImage: Br,
3433
+ InsertPaste: Vr,
3434
+ InsertRichLink: Hr,
3449
3435
  Dictate: Ut,
3450
3436
  CancelDictation: Wt,
3451
- Submit: qr,
3452
- Reset: Jr
3437
+ Submit: Ur,
3438
+ Reset: Wr
3453
3439
  };
3454
3440
  //#endregion
3455
3441
  //#region src/lib/ComposerTokenText.tsx
3456
- function ni(e) {
3442
+ function Qr(e) {
3457
3443
  let t = i(5), { text: n, elements: r } = e, a;
3458
- t[0] !== r || t[1] !== n ? (a = ii(n, r).map(ri), t[0] = r, t[1] = n, t[2] = a) : a = t[2];
3444
+ t[0] !== r || t[1] !== n ? (a = ei(n, r).map($r), t[0] = r, t[1] = n, t[2] = a) : a = t[2];
3459
3445
  let o;
3460
- return t[3] === a ? o = t[4] : (o = /* @__PURE__ */ C(te, { children: a }), t[3] = a, t[4] = o), o;
3446
+ return t[3] === a ? o = t[4] : (o = /* @__PURE__ */ w(C, { children: a }), t[3] = a, t[4] = o), o;
3461
3447
  }
3462
- function ri(e) {
3463
- return e.element ? /* @__PURE__ */ C("span", {
3448
+ function $r(e) {
3449
+ return e.element ? /* @__PURE__ */ w("span", {
3464
3450
  "data-token": e.element.kind,
3465
3451
  children: e.text
3466
- }, `${e.start}-${e.end}-${e.element.id}`) : /* @__PURE__ */ C("span", { children: e.text }, `${e.start}-${e.end}`);
3452
+ }, `${e.start}-${e.end}-${e.element.id}`) : /* @__PURE__ */ w("span", { children: e.text }, `${e.start}-${e.end}`);
3467
3453
  }
3468
- function ii(e, t) {
3454
+ function ei(e, t) {
3469
3455
  let n = t.toSorted((e, t) => e.range.start - t.range.start).filter((t) => t.range.start >= 0 && t.range.end <= e.length && e.slice(t.range.start, t.range.end) === t.label), r = [], i = 0;
3470
3456
  for (let t of n) t.range.start > i && r.push({
3471
3457
  text: e.slice(i, t.range.start),
@@ -3489,7 +3475,7 @@ function ii(e, t) {
3489
3475
  }
3490
3476
  //#endregion
3491
3477
  //#region src/lib/persisted-prompt-selection.ts
3492
- function ai(e, t) {
3478
+ function ti(e, t) {
3493
3479
  if (!t || t.isCollapsed || t.rangeCount === 0) return null;
3494
3480
  let n = t.getRangeAt(0);
3495
3481
  if (!e.contains(n.commonAncestorContainer)) return null;
@@ -3502,51 +3488,51 @@ function ai(e, t) {
3502
3488
  }
3503
3489
  //#endregion
3504
3490
  //#region src/lib/PersistedPromptText.tsx
3505
- function oi(e) {
3491
+ function ni(e) {
3506
3492
  let t = i(6), { text: n } = e, a, o;
3507
3493
  if (t[0] !== n) {
3508
3494
  let e = r(n);
3509
- a = li, o = e.map(si), t[0] = n, t[1] = a, t[2] = o;
3495
+ a = ai, o = e.map(ri), t[0] = n, t[1] = a, t[2] = o;
3510
3496
  } else a = t[1], o = t[2];
3511
3497
  let s;
3512
- return t[3] !== a || t[4] !== o ? (s = /* @__PURE__ */ C("span", {
3498
+ return t[3] !== a || t[4] !== o ? (s = /* @__PURE__ */ w("span", {
3513
3499
  onCopy: a,
3514
3500
  children: o
3515
3501
  }), t[3] = a, t[4] = o, t[5] = s) : s = t[5], s;
3516
3502
  }
3517
- function si(e) {
3503
+ function ri(e) {
3518
3504
  switch (e.kind) {
3519
3505
  case "text": return e.value;
3520
- case "inline-code": return /* @__PURE__ */ C("code", {
3506
+ case "inline-code": return /* @__PURE__ */ w("code", {
3521
3507
  "data-persisted-source": e.source,
3522
3508
  className: "bg-muted rounded px-1 py-0.5 font-mono text-[0.9em]",
3523
3509
  children: e.value
3524
3510
  }, e.start);
3525
- case "code-block": return /* @__PURE__ */ C("span", {
3511
+ case "code-block": return /* @__PURE__ */ w("span", {
3526
3512
  "data-persisted-source": e.source,
3527
3513
  className: "bg-muted my-2 block overflow-x-auto rounded-md px-3 py-2",
3528
- children: /* @__PURE__ */ C("code", {
3514
+ children: /* @__PURE__ */ w("code", {
3529
3515
  className: "font-mono text-[0.9em]",
3530
3516
  children: e.value
3531
3517
  })
3532
3518
  }, e.start);
3533
- case "skill-link": return /* @__PURE__ */ C(ci, {
3519
+ case "skill-link": return /* @__PURE__ */ w(ii, {
3534
3520
  name: e.name,
3535
3521
  source: e.source,
3536
3522
  skillId: e.skillId,
3537
3523
  title: e.href
3538
3524
  }, e.start);
3539
- case "standalone-skill": return /* @__PURE__ */ C(ci, {
3525
+ case "standalone-skill": return /* @__PURE__ */ w(ii, {
3540
3526
  name: e.name,
3541
3527
  source: e.source
3542
3528
  }, e.start);
3543
- case "mention": return /* @__PURE__ */ C("span", {
3529
+ case "mention": return /* @__PURE__ */ w("span", {
3544
3530
  "data-token": "mention",
3545
3531
  "data-persisted-source": e.source,
3546
3532
  className: "bg-foreground/10 rounded-sm px-0.5 font-medium",
3547
3533
  children: e.label
3548
3534
  }, e.start);
3549
- case "link": return /^(?:https?:|mailto:)/.test(e.href) ? /* @__PURE__ */ C("a", {
3535
+ case "link": return /^(?:https?:|mailto:)/.test(e.href) ? /* @__PURE__ */ w("a", {
3550
3536
  href: e.href,
3551
3537
  "data-persisted-source": e.source,
3552
3538
  className: "text-primary underline underline-offset-2",
@@ -3556,16 +3542,16 @@ function si(e) {
3556
3542
  }, e.start) : e.source;
3557
3543
  }
3558
3544
  }
3559
- function ci(e) {
3545
+ function ii(e) {
3560
3546
  let t = i(9), { name: n, source: r, skillId: a, title: o } = e, s = a ? void 0 : n, c;
3561
- t[0] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ C(S, {
3547
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ w(S, {
3562
3548
  "aria-hidden": "true",
3563
3549
  className: "size-3.5 self-center"
3564
3550
  }), t[0] = c) : c = t[0];
3565
3551
  let l;
3566
- t[1] === n ? l = t[2] : (l = /* @__PURE__ */ C("span", { children: n }), t[1] = n, t[2] = l);
3552
+ t[1] === n ? l = t[2] : (l = /* @__PURE__ */ w("span", { children: n }), t[1] = n, t[2] = l);
3567
3553
  let u;
3568
- return t[3] !== a || t[4] !== r || t[5] !== s || t[6] !== l || t[7] !== o ? (u = /* @__PURE__ */ w("span", {
3554
+ return t[3] !== a || t[4] !== r || t[5] !== s || t[6] !== l || t[7] !== o ? (u = /* @__PURE__ */ T("span", {
3569
3555
  "data-skill-id": a,
3570
3556
  "data-skill-name": s,
3571
3557
  "data-persisted-source": r,
@@ -3574,11 +3560,11 @@ function ci(e) {
3574
3560
  children: [c, l]
3575
3561
  }), t[3] = a, t[4] = r, t[5] = s, t[6] = l, t[7] = o, t[8] = u) : u = t[8], u;
3576
3562
  }
3577
- function li(e) {
3578
- let t = ai(e.currentTarget, window.getSelection());
3563
+ function ai(e) {
3564
+ let t = ti(e.currentTarget, window.getSelection());
3579
3565
  t !== null && (e.clipboardData.setData("text/plain", t), e.preventDefault());
3580
3566
  }
3581
3567
  //#endregion
3582
- export { ti as Composer, ni as ComposerTokenText, Gt as DictationError, oi as PersistedPromptText, Ve as createComposerDraftSource, de as createComposerState, Ue as createDraftFromPersistedText, We as createDraftFromSource, Be as createDraftFromState, $ as createPersistedTextFromDraft, Ge as decodeComposerTextLinkHref, U as isVisibleInPhase, pe as prepareComposerPayload, He as pushComposerHistory, ai as reconstructPersistedPromptSelection, e as serializeMentionPromptLink, t as serializePersistedPromptLink, n as serializeSkillPromptLink, r as tokenizePersistedPrompt, P as useComposer, Vt as useComposerDictation };
3568
+ export { Zr as Composer, Qr as ComposerTokenText, Gt as DictationError, ni as PersistedPromptText, He as createComposerDraftSource, q as createComposerState, We as createDraftFromPersistedText, Ge as createDraftFromSource, Ve as createDraftFromState, Ke as createPersistedTextFromDraft, qe as decodeComposerTextLinkHref, H as isVisibleInPhase, he as prepareComposerPayload, Ue as pushComposerHistory, ti as reconstructPersistedPromptSelection, e as serializeMentionPromptLink, t as serializePersistedPromptLink, n as serializeSkillPromptLink, r as tokenizePersistedPrompt, N as useComposer, Vt as useComposerDictation };
3583
3569
 
3584
3570
  //# sourceMappingURL=browser.js.map