@alfadocs/ui-kit-debug 1.41.0 → 1.42.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 (117) hide show
  1. package/dist/_chunks/{calendar-workspace-UllCER2k.js → calendar-workspace-qlxrxCqm.js} +1980 -1967
  2. package/dist/_chunks/calendar-workspace-qlxrxCqm.js.map +1 -0
  3. package/dist/_chunks/{help-me-write-templates-GB70jnV9.js → help-me-write-templates-B-m7zgJa.js} +242 -231
  4. package/dist/_chunks/help-me-write-templates-B-m7zgJa.js.map +1 -0
  5. package/dist/_chunks/{notes-panel-_diLt8Cj.js → notes-panel-CRAovkjx.js} +84 -68
  6. package/dist/_chunks/notes-panel-CRAovkjx.js.map +1 -0
  7. package/dist/_chunks/{rich-text-editor-D7AKKAQ2.js → rich-text-editor-DUMeifwc.js} +1195 -1138
  8. package/dist/_chunks/rich-text-editor-DUMeifwc.js.map +1 -0
  9. package/dist/agent-catalog.json +1 -1
  10. package/dist/components/notes-panel/index.js +1 -1
  11. package/dist/components/notes-panel/notes-panel.d.ts +32 -0
  12. package/dist/components/notes-panel/notes-panel.d.ts.map +1 -1
  13. package/dist/components/rich-text-editor/index.js +1 -1
  14. package/dist/components/rich-text-editor/rich-text-editor.d.ts.map +1 -1
  15. package/dist/i18n/locales/ar.d.ts +1 -0
  16. package/dist/i18n/locales/ar.d.ts.map +1 -1
  17. package/dist/i18n/locales/ar.js +2 -1
  18. package/dist/i18n/locales/ar.js.map +1 -1
  19. package/dist/i18n/locales/de.d.ts +1 -0
  20. package/dist/i18n/locales/de.d.ts.map +1 -1
  21. package/dist/i18n/locales/de.js +2 -1
  22. package/dist/i18n/locales/de.js.map +1 -1
  23. package/dist/i18n/locales/el.d.ts +1 -0
  24. package/dist/i18n/locales/el.d.ts.map +1 -1
  25. package/dist/i18n/locales/el.js +2 -1
  26. package/dist/i18n/locales/el.js.map +1 -1
  27. package/dist/i18n/locales/en.d.ts +1 -0
  28. package/dist/i18n/locales/en.d.ts.map +1 -1
  29. package/dist/i18n/locales/en.js +2 -1
  30. package/dist/i18n/locales/en.js.map +1 -1
  31. package/dist/i18n/locales/es.d.ts +1 -0
  32. package/dist/i18n/locales/es.d.ts.map +1 -1
  33. package/dist/i18n/locales/es.js +2 -1
  34. package/dist/i18n/locales/es.js.map +1 -1
  35. package/dist/i18n/locales/fr.d.ts +1 -0
  36. package/dist/i18n/locales/fr.d.ts.map +1 -1
  37. package/dist/i18n/locales/fr.js +2 -1
  38. package/dist/i18n/locales/fr.js.map +1 -1
  39. package/dist/i18n/locales/hi.d.ts +1 -0
  40. package/dist/i18n/locales/hi.d.ts.map +1 -1
  41. package/dist/i18n/locales/hi.js +2 -1
  42. package/dist/i18n/locales/hi.js.map +1 -1
  43. package/dist/i18n/locales/it.d.ts +1 -0
  44. package/dist/i18n/locales/it.d.ts.map +1 -1
  45. package/dist/i18n/locales/it.js +2 -1
  46. package/dist/i18n/locales/it.js.map +1 -1
  47. package/dist/i18n/locales/ja.d.ts +1 -0
  48. package/dist/i18n/locales/ja.d.ts.map +1 -1
  49. package/dist/i18n/locales/ja.js +2 -1
  50. package/dist/i18n/locales/ja.js.map +1 -1
  51. package/dist/i18n/locales/nl.d.ts +1 -0
  52. package/dist/i18n/locales/nl.d.ts.map +1 -1
  53. package/dist/i18n/locales/nl.js +2 -1
  54. package/dist/i18n/locales/nl.js.map +1 -1
  55. package/dist/i18n/locales/pl.d.ts +1 -0
  56. package/dist/i18n/locales/pl.d.ts.map +1 -1
  57. package/dist/i18n/locales/pl.js +2 -1
  58. package/dist/i18n/locales/pl.js.map +1 -1
  59. package/dist/i18n/locales/pt.d.ts +1 -0
  60. package/dist/i18n/locales/pt.d.ts.map +1 -1
  61. package/dist/i18n/locales/pt.js +2 -1
  62. package/dist/i18n/locales/pt.js.map +1 -1
  63. package/dist/i18n/locales/ro.d.ts +1 -0
  64. package/dist/i18n/locales/ro.d.ts.map +1 -1
  65. package/dist/i18n/locales/ro.js +2 -1
  66. package/dist/i18n/locales/ro.js.map +1 -1
  67. package/dist/i18n/locales/ru.d.ts +1 -0
  68. package/dist/i18n/locales/ru.d.ts.map +1 -1
  69. package/dist/i18n/locales/ru.js +2 -1
  70. package/dist/i18n/locales/ru.js.map +1 -1
  71. package/dist/i18n/locales/sq.d.ts +1 -0
  72. package/dist/i18n/locales/sq.d.ts.map +1 -1
  73. package/dist/i18n/locales/sq.js +2 -1
  74. package/dist/i18n/locales/sq.js.map +1 -1
  75. package/dist/i18n/locales/sv.d.ts +1 -0
  76. package/dist/i18n/locales/sv.d.ts.map +1 -1
  77. package/dist/i18n/locales/sv.js +2 -1
  78. package/dist/i18n/locales/sv.js.map +1 -1
  79. package/dist/i18n/locales/tr.d.ts +1 -0
  80. package/dist/i18n/locales/tr.d.ts.map +1 -1
  81. package/dist/i18n/locales/tr.js +2 -1
  82. package/dist/i18n/locales/tr.js.map +1 -1
  83. package/dist/i18n/locales/zh.d.ts +1 -0
  84. package/dist/i18n/locales/zh.d.ts.map +1 -1
  85. package/dist/i18n/locales/zh.js +2 -1
  86. package/dist/i18n/locales/zh.js.map +1 -1
  87. package/dist/index.js +4 -4
  88. package/dist/locales/ar.json +2 -1
  89. package/dist/locales/de.json +2 -1
  90. package/dist/locales/el.json +2 -1
  91. package/dist/locales/en.json +2 -1
  92. package/dist/locales/es.json +2 -1
  93. package/dist/locales/fr.json +2 -1
  94. package/dist/locales/hi.json +2 -1
  95. package/dist/locales/it.json +2 -1
  96. package/dist/locales/ja.json +2 -1
  97. package/dist/locales/nl.json +2 -1
  98. package/dist/locales/pl.json +2 -1
  99. package/dist/locales/pt.json +2 -1
  100. package/dist/locales/ro.json +2 -1
  101. package/dist/locales/ru.json +2 -1
  102. package/dist/locales/sq.json +2 -1
  103. package/dist/locales/sv.json +2 -1
  104. package/dist/locales/tr.json +2 -1
  105. package/dist/locales/zh.json +2 -1
  106. package/dist/patterns/calendar/calendar.journey.d.ts +11 -0
  107. package/dist/patterns/calendar/calendar.journey.d.ts.map +1 -1
  108. package/dist/patterns/calendar/calendar.sheets.d.ts +20 -0
  109. package/dist/patterns/calendar/calendar.sheets.d.ts.map +1 -1
  110. package/dist/patterns/calendar/index.js +1 -1
  111. package/dist/patterns/help-me-write-templates/help-me-write-templates.d.ts.map +1 -1
  112. package/dist/patterns/help-me-write-templates/index.js +1 -1
  113. package/package.json +1 -1
  114. package/dist/_chunks/calendar-workspace-UllCER2k.js.map +0 -1
  115. package/dist/_chunks/help-me-write-templates-GB70jnV9.js.map +0 -1
  116. package/dist/_chunks/notes-panel-_diLt8Cj.js.map +0 -1
  117. package/dist/_chunks/rich-text-editor-D7AKKAQ2.js.map +0 -1
@@ -1,41 +1,41 @@
1
- import { jsxs as i, jsx as e, Fragment as R } from "react/jsx-runtime";
2
- import { useState as v, useEffect as q, useId as ne, useRef as re, useCallback as A, useMemo as ye } from "react";
3
- import { useTranslation as G } from "react-i18next";
4
- import { A as B } from "./alert-CiQ5Pa3Q.js";
5
- import { B as he } from "./badge-BudgzTe_.js";
6
- import { B as h } from "./button-CaUe1uyd.js";
7
- import { I as F } from "./icon-button-CehAeZoP.js";
8
- import { D as b } from "./dialog-BJiLqhx6.js";
9
- import { D as S } from "./dropdown-menu-DU-Hrf33.js";
1
+ import { jsxs as i, jsx as e, Fragment as E } from "react/jsx-runtime";
2
+ import { useState as h, useEffect as U, useId as ie, useRef as te, useCallback as O, useMemo as Ne } from "react";
3
+ import { useTranslation as V } from "react-i18next";
4
+ import { A as R } from "./alert-CiQ5Pa3Q.js";
5
+ import { B as fe } from "./badge-BudgzTe_.js";
6
+ import { B as g } from "./button-CaUe1uyd.js";
7
+ import { I as H } from "./icon-button-CehAeZoP.js";
8
+ import { D as f } from "./dialog-BJiLqhx6.js";
9
+ import { D as z } from "./dropdown-menu-DU-Hrf33.js";
10
10
  import { E as we } from "./editor-overlay-DwNKaI22.js";
11
11
  import { E as ke } from "./empty-state-BUN_UAWf.js";
12
- import { F as K } from "./form-field-CahJzTxp.js";
13
- import { P as Ie } from "./progress-CK8otcQ-.js";
14
- import { S as ie } from "./spinner-hbwuKwMf.js";
15
- import { S as De } from "./switch-OILsBLWo.js";
16
- import { T as fe } from "./text-area-Bt3p7Pt0.js";
17
- import { T as le } from "./text-input-CUvCb6ST.js";
12
+ import { F as Q } from "./form-field-CahJzTxp.js";
13
+ import { P as De } from "./progress-CK8otcQ-.js";
14
+ import { S as le } from "./spinner-hbwuKwMf.js";
15
+ import { S as Ie } from "./switch-OILsBLWo.js";
16
+ import { T as ge } from "./text-area-Bt3p7Pt0.js";
17
+ import { T as oe } from "./text-input-CUvCb6ST.js";
18
18
  import { SafeHtml as Se } from "../safe-html/index.js";
19
19
  import { T as ze } from "./trending-up-C_luYBzS.js";
20
- import { A as Re } from "./astroid-BN4f5VXU.js";
21
- import { A as Ee } from "./arrow-left-BfaGqVam.js";
20
+ import { A as Ee } from "./astroid-BN4f5VXU.js";
21
+ import { A as Re } from "./arrow-left-BfaGqVam.js";
22
22
  import { P as $e } from "./pencil-B1sKKyuT.js";
23
23
  import { T as Ae } from "./trash-2-uumy3fy1.js";
24
- import { P as ge } from "./plus-DzMQ_c6b.js";
25
- import { X as oe } from "./x-B5YnXwCz.js";
24
+ import { P as be } from "./plus-DzMQ_c6b.js";
25
+ import { X as de } from "./x-B5YnXwCz.js";
26
26
  import { R as Be } from "./rotate-ccw-BBQnIVTr.js";
27
27
  import { S as Oe } from "./square-DASBRZ0U.js";
28
- import { M as Le } from "./mic-CUklMZGF.js";
29
- import { C as Fe } from "./chevron-down-DWE7GSq9.js";
30
- import { W as de } from "./wand-sparkles-DAjKyhz7.js";
28
+ import { M as Fe } from "./mic-CUklMZGF.js";
29
+ import { C as Le } from "./chevron-down-DWE7GSq9.js";
30
+ import { W as ce } from "./wand-sparkles-DAjKyhz7.js";
31
31
  import { S as _e } from "./settings-d25ju_6L.js";
32
32
  import { S as He } from "./send-C5kDJ-Mz.js";
33
- class ce extends Error {
33
+ class me extends Error {
34
34
  constructor(c = "AI credits exhausted") {
35
35
  super(c), this.name = "AiCreditsExhaustedError";
36
36
  }
37
37
  }
38
- const j = "ds:!size-[var(--min-target-size)]", Pe = "ds:!h-[var(--min-target-size)] ds:shrink-0", je = `${j} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`, qe = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", U = "ds:m-0 ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", me = "type-eyebrow ds:m-0 ds:text-[color:var(--muted-foreground)]", Q = [
38
+ const q = "ds:!size-[var(--min-target-size)]", Pe = "ds:!h-[var(--min-target-size)] ds:shrink-0", je = `${q} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`, qe = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", G = "ds:m-0 ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", pe = "type-eyebrow ds:m-0 ds:text-[color:var(--muted-foreground)]", ee = [
39
39
  "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
40
40
  "ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
41
41
  "ds:p-[var(--spacing-sm)] ds:[max-block-size:14rem] ds:overflow-y-auto",
@@ -44,13 +44,13 @@ const j = "ds:!size-[var(--min-target-size)]", Pe = "ds:!h-[var(--min-target-siz
44
44
  "ds:[&_h3]:font-medium ds:[&_h3]:[margin-block-start:var(--spacing-xs)]",
45
45
  "ds:[&_p]:[margin-block-end:var(--spacing-xs)]",
46
46
  "ds:[&>:first-child]:[margin-block-start:0]"
47
- ].join(" "), pe = "ds:[block-size:14rem]";
48
- function be(r) {
47
+ ].join(" "), ue = "ds:[block-size:14rem]";
48
+ function ve(r) {
49
49
  return [...r].sort(
50
50
  (c, o) => Number(o.isDefault) - Number(c.isDefault)
51
51
  );
52
52
  }
53
- function ue(r, c) {
53
+ function he(r, c) {
54
54
  return c ? r ? /\s$/.test(r) ? `${r}${c}` : `${r} ${c}` : c : r;
55
55
  }
56
56
  function Ue(r) {
@@ -60,7 +60,7 @@ function Ge({
60
60
  credits: r,
61
61
  onBack: c
62
62
  }) {
63
- const { t: o, i18n: p } = G(), u = r == null ? void 0 : r.limit, f = (r == null ? void 0 : r.remaining) ?? 0, t = u !== void 0 ? o("helpMeWriteTemplates.credits.remaining", { remaining: f, limit: u }) : void 0, n = r != null && r.resetsOn ? new Intl.DateTimeFormat(p.language, {
63
+ const { t: o, i18n: p } = V(), u = r == null ? void 0 : r.limit, b = (r == null ? void 0 : r.remaining) ?? 0, t = u !== void 0 ? o("helpMeWriteTemplates.credits.remaining", { remaining: b, limit: u }) : void 0, n = r != null && r.resetsOn ? new Intl.DateTimeFormat(p.language, {
64
64
  day: "numeric",
65
65
  month: "long"
66
66
  }).format(r.resetsOn) : void 0;
@@ -70,9 +70,9 @@ function Ge({
70
70
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
71
71
  "data-component": "ai-credits-exhausted-notice",
72
72
  children: [
73
- /* @__PURE__ */ i(B, { variant: "promo", icon: /* @__PURE__ */ e(Re, { "aria-hidden": "true" }), children: [
74
- /* @__PURE__ */ e(B.Title, { as: "h2", children: o("helpMeWriteTemplates.credits.title") }),
75
- /* @__PURE__ */ e(B.Description, { children: r != null && r.onBuyCredits ? n ? o("helpMeWriteTemplates.credits.bodyResets", { date: n }) : o("helpMeWriteTemplates.credits.body") : n ? o("helpMeWriteTemplates.credits.bodyWaitResets", {
73
+ /* @__PURE__ */ i(R, { variant: "promo", icon: /* @__PURE__ */ e(Ee, { "aria-hidden": "true" }), children: [
74
+ /* @__PURE__ */ e(R.Title, { as: "h2", children: o("helpMeWriteTemplates.credits.title") }),
75
+ /* @__PURE__ */ e(R.Description, { children: r != null && r.onBuyCredits ? n ? o("helpMeWriteTemplates.credits.bodyResets", { date: n }) : o("helpMeWriteTemplates.credits.body") : n ? o("helpMeWriteTemplates.credits.bodyWaitResets", {
76
76
  date: n
77
77
  }) : o("helpMeWriteTemplates.credits.bodyWait") }),
78
78
  u !== void 0 && t ? /* @__PURE__ */ i("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)] ds:[margin-block-start:var(--spacing-sm)]", children: [
@@ -81,9 +81,9 @@ function Ge({
81
81
  /* @__PURE__ */ e("span", { className: "type-label ds:ms-auto ds:tabular-nums", children: t })
82
82
  ] }),
83
83
  /* @__PURE__ */ e(
84
- Ie,
84
+ De,
85
85
  {
86
- value: Math.max(0, u - f),
86
+ value: Math.max(0, u - b),
87
87
  max: u,
88
88
  size: "sm",
89
89
  ariaLabel: o("helpMeWriteTemplates.credits.meterLabel"),
@@ -91,9 +91,9 @@ function Ge({
91
91
  }
92
92
  )
93
93
  ] }) : null,
94
- r != null && r.onBuyCredits || r != null && r.onSeeCosts ? /* @__PURE__ */ i(B.Action, { children: [
94
+ r != null && r.onBuyCredits || r != null && r.onSeeCosts ? /* @__PURE__ */ i(R.Action, { children: [
95
95
  r.onBuyCredits ? /* @__PURE__ */ e(
96
- h,
96
+ g,
97
97
  {
98
98
  intent: "tonal",
99
99
  size: "sm",
@@ -102,12 +102,12 @@ function Ge({
102
102
  children: o("helpMeWriteTemplates.credits.cta")
103
103
  }
104
104
  ) : null,
105
- r.onSeeCosts ? /* @__PURE__ */ e(h, { intent: "link", size: "sm", onClick: r.onSeeCosts, children: o("helpMeWriteTemplates.credits.secondary") }) : null
105
+ r.onSeeCosts ? /* @__PURE__ */ e(g, { intent: "link", size: "sm", onClick: r.onSeeCosts, children: o("helpMeWriteTemplates.credits.secondary") }) : null
106
106
  ] }) : null
107
107
  ] }),
108
108
  /* @__PURE__ */ i("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
109
- c ? /* @__PURE__ */ e(h, { intent: "ghost", startIcon: /* @__PURE__ */ e(Ee, {}), onClick: c, children: o("helpMeWriteTemplates.credits.back") }) : null,
110
- /* @__PURE__ */ e("p", { className: U, children: o("helpMeWriteTemplates.credits.kept") })
109
+ c ? /* @__PURE__ */ e(g, { intent: "ghost", startIcon: /* @__PURE__ */ e(Re, {}), onClick: c, children: o("helpMeWriteTemplates.credits.back") }) : null,
110
+ /* @__PURE__ */ e("p", { className: G, children: o("helpMeWriteTemplates.credits.kept") })
111
111
  ] })
112
112
  ]
113
113
  }
@@ -119,104 +119,104 @@ function Ve({
119
119
  onGenerate: o,
120
120
  onManageTemplates: p,
121
121
  onApplied: u,
122
- credits: f,
122
+ credits: b,
123
123
  enableDictation: t = !0,
124
124
  suspendClose: n = !1
125
125
  }) {
126
- const { t: a } = G(), { open: N } = r, T = ne(), I = ne(), [C, x] = v(""), [w, M] = v(null), [y, O] = v(!1), [V, E] = v(!1), [s, k] = v(null), [g, ve] = v({
126
+ const { t: a } = V(), { open: N } = r, M = ie(), S = ie(), [C, x] = h(""), [I, v] = h(null), [y, F] = h(!1), [L, $] = h(!1), [w, _] = h(null), [k, X] = h({
127
127
  kind: "document",
128
128
  words: 0,
129
129
  text: ""
130
- }), _ = re(null), z = w !== null, L = t ? r.onDictate : void 0, [D, te] = v(!1), [Te, X] = v(""), [Me, Y] = v(""), $ = re(null), H = A(() => {
130
+ }), A = te(null), s = I !== null, D = t ? r.onDictate : void 0, [T, se] = h(!1), [Te, Y] = h(""), [Me, Z] = h(""), B = te(null), P = O(() => {
131
131
  var l;
132
- return (l = $.current) == null ? void 0 : l.abort();
133
- }, []), We = A(() => {
134
- if (D) {
135
- H();
132
+ return (l = B.current) == null ? void 0 : l.abort();
133
+ }, []), We = O(() => {
134
+ if (T) {
135
+ P();
136
136
  return;
137
137
  }
138
- if (!L) return;
138
+ if (!D) return;
139
139
  const l = new AbortController();
140
- $.current = l, te(!0), Y(a("helpMeWriteTemplates.bar.listening")), L({
140
+ B.current = l, se(!0), Z(a("helpMeWriteTemplates.bar.listening")), D({
141
141
  signal: l.signal,
142
142
  onPartialTranscript: (d) => {
143
- l.signal.aborted || X(d);
143
+ l.signal.aborted || Y(d);
144
144
  },
145
145
  onFinalTranscript: (d) => {
146
146
  if (l.signal.aborted) return;
147
- X("");
147
+ Y("");
148
148
  const W = d.trim();
149
- W && (x((m) => ue(m, W)), Y(W));
149
+ W && (x((m) => he(m, W)), Z(W));
150
150
  }
151
151
  }).catch((d) => {
152
- d instanceof ce && E(!0);
152
+ d instanceof me && $(!0);
153
153
  }).finally(() => {
154
- X(""), $.current === l && ($.current = null, te(!1), Y(""));
154
+ Y(""), B.current === l && (B.current = null, se(!1), Z(""));
155
155
  });
156
- }, [D, L, H, a]);
157
- q(() => {
156
+ }, [T, D, P, a]);
157
+ U(() => {
158
158
  var l, d;
159
159
  if (N) {
160
- x(""), M(null), O(!1), E(r.creditsExhausted), k(null);
160
+ x(""), v(null), F(!1), $(r.creditsExhausted), _(null);
161
161
  const W = r.selectionText.trim(), m = W || r.getText();
162
- ve({
162
+ X({
163
163
  kind: W ? "selection" : "document",
164
164
  words: m.split(/\s+/).filter(Boolean).length,
165
165
  text: m
166
166
  });
167
167
  } else
168
- (l = _.current) == null || l.abort(), (d = $.current) == null || d.abort();
169
- }, [N]), q(
168
+ (l = A.current) == null || l.abort(), (d = B.current) == null || d.abort();
169
+ }, [N]), U(
170
170
  () => () => {
171
171
  var l, d;
172
- (l = _.current) == null || l.abort(), (d = $.current) == null || d.abort();
172
+ (l = A.current) == null || l.abort(), (d = B.current) == null || d.abort();
173
173
  },
174
174
  []
175
175
  );
176
- const Z = A(
176
+ const J = O(
177
177
  (l) => {
178
178
  var W;
179
- if (z || (l ? g.words === 0 : !C.trim())) return;
180
- H(), (W = _.current) == null || W.abort();
179
+ if (s || (l ? k.words === 0 : !C.trim())) return;
180
+ P(), (W = A.current) == null || W.abort();
181
181
  const d = new AbortController();
182
- _.current = d, O(!1), M(l), o({
182
+ A.current = d, F(!1), v(l), o({
183
183
  template: l,
184
184
  prompt: C.trim(),
185
- sourceText: l ? g.text : "",
185
+ sourceText: l ? k.text : "",
186
186
  signal: d.signal
187
187
  }).then((m) => {
188
- d.signal.aborted || (k({ draft: m, template: l }), M(null));
188
+ d.signal.aborted || (_({ draft: m, template: l }), v(null));
189
189
  }).catch((m) => {
190
- d.signal.aborted || Ue(m) || (m instanceof ce ? E(!0) : O(!0), M(null));
190
+ d.signal.aborted || Ue(m) || (m instanceof me ? $(!0) : F(!0), v(null));
191
191
  });
192
192
  },
193
- [z, g, C, o, H]
194
- ), { onClose: se } = r, Ce = A(() => {
195
- n || se();
196
- }, [n, se]), J = (l) => {
197
- if (!s) return;
198
- const { draft: d, template: W } = s, m = r.getHTML(), ae = g.kind === "selection";
199
- l === "insert" ? r.insertAtSelection(d) : l === "replace" ? ae ? r.insertAtSelection(d) : r.setContent(d) : ae ? r.insertAfterSelection(d) : r.setContent(`${m}${d}`), r.onClose();
200
- const { setContent: Ne } = r;
193
+ [s, k, C, o, P]
194
+ ), { onClose: ae } = r, Ce = O(() => {
195
+ n || ae();
196
+ }, [n, ae]), K = (l) => {
197
+ if (!w) return;
198
+ const { draft: d, template: W } = w, m = r.getHTML(), ne = k.kind === "selection";
199
+ l === "insert" ? r.insertAtSelection(d) : l === "replace" ? ne ? r.insertAtSelection(d) : r.setContent(d) : ne ? r.insertAfterSelection(d) : r.setContent(`${m}${d}`), r.onClose();
200
+ const { setContent: ye } = r;
201
201
  u == null || u({
202
202
  mode: l,
203
203
  template: W,
204
204
  previousHtml: m,
205
- undo: () => Ne(m)
205
+ undo: () => ye(m)
206
206
  });
207
- }, xe = g.words === 0 ? a("helpMeWriteTemplates.bar.sourceEmpty") : g.kind === "selection" ? a("helpMeWriteTemplates.bar.sourceSelection") : a("helpMeWriteTemplates.bar.sourceDocument");
208
- let P;
209
- if (V)
210
- P = /* @__PURE__ */ e(
207
+ }, xe = k.words === 0 ? a("helpMeWriteTemplates.bar.sourceEmpty") : k.kind === "selection" ? a("helpMeWriteTemplates.bar.sourceSelection") : a("helpMeWriteTemplates.bar.sourceDocument");
208
+ let j;
209
+ if (L)
210
+ j = /* @__PURE__ */ e(
211
211
  Ge,
212
212
  {
213
- credits: f,
214
- onBack: () => E(!1)
213
+ credits: b,
214
+ onBack: () => $(!1)
215
215
  }
216
216
  );
217
- else if (s) {
218
- const l = !!s.template;
219
- P = /* @__PURE__ */ i(R, { children: [
217
+ else if (w) {
218
+ const l = !!w.template;
219
+ j = /* @__PURE__ */ i(E, { children: [
220
220
  /* @__PURE__ */ i(
221
221
  "div",
222
222
  {
@@ -225,16 +225,16 @@ function Ve({
225
225
  l ? /* @__PURE__ */ i(
226
226
  "section",
227
227
  {
228
- "aria-labelledby": `${T}-before`,
228
+ "aria-labelledby": `${M}-before`,
229
229
  className: "ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-2xs)]",
230
230
  children: [
231
- /* @__PURE__ */ e("h2", { id: `${T}-before`, className: me, children: g.kind === "selection" ? a("helpMeWriteTemplates.bar.beforeSelection") : a("helpMeWriteTemplates.bar.beforeDocument") }),
231
+ /* @__PURE__ */ e("h2", { id: `${M}-before`, className: pe, children: k.kind === "selection" ? a("helpMeWriteTemplates.bar.beforeSelection") : a("helpMeWriteTemplates.bar.beforeDocument") }),
232
232
  /* @__PURE__ */ e(
233
233
  "p",
234
234
  {
235
- className: `${Q} ${pe} ds:text-[color:var(--muted-foreground)]`,
235
+ className: `${ee} ${ue} ds:text-[color:var(--muted-foreground)]`,
236
236
  tabIndex: 0,
237
- children: g.text
237
+ children: k.text
238
238
  }
239
239
  )
240
240
  ]
@@ -243,16 +243,16 @@ function Ve({
243
243
  /* @__PURE__ */ i(
244
244
  "section",
245
245
  {
246
- "aria-labelledby": `${T}-after`,
246
+ "aria-labelledby": `${M}-after`,
247
247
  className: "ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-2xs)]",
248
248
  children: [
249
- /* @__PURE__ */ e("h2", { id: `${T}-after`, className: me, children: s.template ? `${a("helpMeWriteTemplates.bar.after")} · ${s.template.name}` : a("helpMeWriteTemplates.bar.after") }),
249
+ /* @__PURE__ */ e("h2", { id: `${M}-after`, className: pe, children: w.template ? `${a("helpMeWriteTemplates.bar.after")} · ${w.template.name}` : a("helpMeWriteTemplates.bar.after") }),
250
250
  /* @__PURE__ */ e(
251
251
  Se,
252
252
  {
253
- html: s.draft,
253
+ html: w.draft,
254
254
  profile: "rich-text",
255
- className: l ? `${Q} ${pe}` : Q,
255
+ className: l ? `${ee} ${ue}` : ee,
256
256
  tabIndex: 0
257
257
  }
258
258
  )
@@ -263,42 +263,42 @@ function Ve({
263
263
  }
264
264
  ),
265
265
  /* @__PURE__ */ i("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
266
- /* @__PURE__ */ e(h, { intent: "ghost", startIcon: /* @__PURE__ */ e(oe, {}), onClick: r.onClose, children: a("helpMeWriteTemplates.bar.discard") }),
266
+ /* @__PURE__ */ e(g, { intent: "ghost", startIcon: /* @__PURE__ */ e(de, {}), onClick: r.onClose, children: a("helpMeWriteTemplates.bar.discard") }),
267
267
  /* @__PURE__ */ e(
268
- h,
268
+ g,
269
269
  {
270
270
  intent: "ghost",
271
271
  startIcon: /* @__PURE__ */ e(Be, {}),
272
272
  onClick: () => {
273
- k(null), Z(s.template);
273
+ _(null), J(w.template);
274
274
  },
275
275
  children: a("helpMeWriteTemplates.bar.retry")
276
276
  }
277
277
  ),
278
278
  /* @__PURE__ */ e("span", { className: "ds:flex-1", "aria-hidden": "true" }),
279
- l ? /* @__PURE__ */ i(R, { children: [
280
- /* @__PURE__ */ e(h, { intent: "outline", onClick: () => J("below"), children: a("helpMeWriteTemplates.bar.insertBelow") }),
281
- /* @__PURE__ */ e(h, { intent: "primary", onClick: () => J("replace"), children: a("helpMeWriteTemplates.bar.replace") })
282
- ] }) : /* @__PURE__ */ e(h, { intent: "primary", onClick: () => J("insert"), children: a("helpMeWriteTemplates.bar.insert") })
279
+ l ? /* @__PURE__ */ i(E, { children: [
280
+ /* @__PURE__ */ e(g, { intent: "outline", onClick: () => K("below"), children: a("helpMeWriteTemplates.bar.insertBelow") }),
281
+ /* @__PURE__ */ e(g, { intent: "primary", onClick: () => K("replace"), children: a("helpMeWriteTemplates.bar.replace") })
282
+ ] }) : /* @__PURE__ */ e(g, { intent: "primary", onClick: () => K("insert"), children: a("helpMeWriteTemplates.bar.insert") })
283
283
  ] })
284
284
  ] });
285
285
  } else {
286
- const l = be(c), d = D ? ue(C, Te) : C, W = c.length > 0 || p;
287
- P = /* @__PURE__ */ i(R, { children: [
286
+ const l = ve(c), d = T ? he(C, Te) : C, W = c.length > 0 || p;
287
+ j = /* @__PURE__ */ i(E, { children: [
288
288
  /* @__PURE__ */ i("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
289
289
  /* @__PURE__ */ e(
290
- F,
290
+ H,
291
291
  {
292
292
  size: "md",
293
293
  intent: "outline",
294
- className: j,
295
- icon: /* @__PURE__ */ e(oe, {}),
294
+ className: q,
295
+ icon: /* @__PURE__ */ e(de, {}),
296
296
  "aria-label": a("helpMeWriteTemplates.bar.close"),
297
297
  onClick: r.onClose
298
298
  }
299
299
  ),
300
300
  /* @__PURE__ */ e("div", { className: "ds:min-w-0 ds:flex-1", children: /* @__PURE__ */ e(
301
- fe,
301
+ ge,
302
302
  {
303
303
  size: "md",
304
304
  value: d,
@@ -308,68 +308,68 @@ function Ve({
308
308
  autoResize: !0,
309
309
  minRows: 1,
310
310
  maxRows: 3,
311
- readOnly: z || D,
311
+ readOnly: s || T,
312
312
  tone: y ? "error" : "default",
313
- "aria-describedby": y ? I : void 0
313
+ "aria-describedby": y ? S : void 0
314
314
  }
315
315
  ) }),
316
- L ? /* @__PURE__ */ e(
317
- F,
316
+ D ? /* @__PURE__ */ e(
317
+ H,
318
318
  {
319
319
  size: "md",
320
320
  intent: "outline",
321
- className: D ? `${j} ${qe}` : j,
322
- icon: D ? /* @__PURE__ */ e(Oe, { className: "ds:fill-current" }) : /* @__PURE__ */ e(Le, {}),
323
- "aria-pressed": D,
324
- "aria-label": a(D ? "helpMeWriteTemplates.bar.dictateStop" : "helpMeWriteTemplates.bar.dictateStart"),
325
- disabled: z,
321
+ className: T ? `${q} ${qe}` : q,
322
+ icon: T ? /* @__PURE__ */ e(Oe, { className: "ds:fill-current" }) : /* @__PURE__ */ e(Fe, {}),
323
+ "aria-pressed": T,
324
+ "aria-label": a(T ? "helpMeWriteTemplates.bar.dictateStop" : "helpMeWriteTemplates.bar.dictateStart"),
325
+ disabled: s,
326
326
  onClick: We
327
327
  }
328
328
  ) : null,
329
- W ? /* @__PURE__ */ i(S.Root, { children: [
330
- /* @__PURE__ */ e(S.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
331
- h,
329
+ W ? /* @__PURE__ */ i(z.Root, { children: [
330
+ /* @__PURE__ */ e(z.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
331
+ g,
332
332
  {
333
333
  intent: "outline",
334
334
  size: "md",
335
335
  className: Pe,
336
- startIcon: w ? /* @__PURE__ */ e(ie, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(de, { "aria-hidden": "true" }),
337
- endIcon: /* @__PURE__ */ e(Fe, { "aria-hidden": "true" }),
336
+ startIcon: I ? /* @__PURE__ */ e(le, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(ce, { "aria-hidden": "true" }),
337
+ endIcon: /* @__PURE__ */ e(Le, { "aria-hidden": "true" }),
338
338
  "aria-haspopup": "menu",
339
- "aria-busy": w ? !0 : void 0,
340
- disabled: z,
341
- "aria-describedby": T,
339
+ "aria-busy": I ? !0 : void 0,
340
+ disabled: s,
341
+ "aria-describedby": M,
342
342
  children: a("helpMeWriteTemplates.bar.templatesMenu")
343
343
  }
344
344
  ) }),
345
- /* @__PURE__ */ i(S.Content, { side: "top", align: "end", sideOffset: 8, children: [
346
- /* @__PURE__ */ e(S.Label, { children: a("helpMeWriteTemplates.bar.templatesGroup") }),
345
+ /* @__PURE__ */ i(z.Content, { side: "top", align: "end", sideOffset: 8, children: [
346
+ /* @__PURE__ */ e(z.Label, { children: a("helpMeWriteTemplates.bar.templatesGroup") }),
347
347
  l.map((m) => /* @__PURE__ */ e(
348
- S.Item,
348
+ z.Item,
349
349
  {
350
- startIcon: /* @__PURE__ */ e(de, {}),
350
+ startIcon: /* @__PURE__ */ e(ce, {}),
351
351
  description: m.description || void 0,
352
- disabled: z || g.words === 0,
353
- onSelect: () => Z(m),
352
+ disabled: s || k.words === 0,
353
+ onSelect: () => J(m),
354
354
  children: /* @__PURE__ */ i("span", { className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
355
355
  m.name,
356
- m.isDefault ? /* @__PURE__ */ e(he, { variant: "brand", size: "sm", children: a("helpMeWriteTemplates.bar.defaultBadge") }) : null
356
+ m.isDefault ? /* @__PURE__ */ e(fe, { variant: "brand", size: "sm", children: a("helpMeWriteTemplates.bar.defaultBadge") }) : null
357
357
  ] })
358
358
  },
359
359
  m.id
360
360
  )),
361
361
  p && c.length === 0 ? /* @__PURE__ */ e(
362
- S.Item,
362
+ z.Item,
363
363
  {
364
- startIcon: /* @__PURE__ */ e(ge, {}),
364
+ startIcon: /* @__PURE__ */ e(be, {}),
365
365
  onSelect: () => p("create"),
366
366
  children: a("helpMeWriteTemplates.bar.createFirst")
367
367
  }
368
368
  ) : null,
369
- p && c.length > 0 ? /* @__PURE__ */ i(R, { children: [
370
- /* @__PURE__ */ e(S.Separator, {}),
369
+ p && c.length > 0 ? /* @__PURE__ */ i(E, { children: [
370
+ /* @__PURE__ */ e(z.Separator, {}),
371
371
  /* @__PURE__ */ e(
372
- S.Item,
372
+ z.Item,
373
373
  {
374
374
  startIcon: /* @__PURE__ */ e(_e, {}),
375
375
  onSelect: () => p("list"),
@@ -380,22 +380,22 @@ function Ve({
380
380
  ] })
381
381
  ] }) : null,
382
382
  /* @__PURE__ */ e(
383
- F,
383
+ H,
384
384
  {
385
385
  size: "md",
386
386
  intent: "primary",
387
387
  className: je,
388
- icon: w === void 0 ? /* @__PURE__ */ e(ie, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(He, {}),
389
- disabled: z || !C.trim(),
390
- "aria-busy": w === void 0 || void 0,
388
+ icon: I === void 0 ? /* @__PURE__ */ e(le, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ e(He, {}),
389
+ disabled: s || !C.trim(),
390
+ "aria-busy": I === void 0 || void 0,
391
391
  "aria-label": a("helpMeWriteTemplates.bar.write"),
392
- onClick: () => Z(void 0)
392
+ onClick: () => J(void 0)
393
393
  }
394
394
  )
395
395
  ] }),
396
- L ? /* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Me }) : null,
397
- y ? /* @__PURE__ */ e("p", { id: I, role: "alert", className: U, children: a("helpMeWriteTemplates.bar.error") }) : null,
398
- /* @__PURE__ */ i("p", { id: T, className: U, children: [
396
+ D ? /* @__PURE__ */ e("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Me }) : null,
397
+ y ? /* @__PURE__ */ e("p", { id: S, role: "alert", className: G, children: a("helpMeWriteTemplates.bar.error") }) : null,
398
+ /* @__PURE__ */ i("p", { id: M, className: G, children: [
399
399
  xe,
400
400
  " ",
401
401
  r.privacyNotice
@@ -408,11 +408,11 @@ function Ve({
408
408
  open: N,
409
409
  onClose: Ce,
410
410
  ariaLabel: a("editor.ai.helpMeWrite"),
411
- children: /* @__PURE__ */ e("div", { className: "ds:contents", "data-component": "help-me-write-templates-bar", children: P })
411
+ children: /* @__PURE__ */ e("div", { className: "ds:contents", "data-component": "help-me-write-templates-bar", children: j })
412
412
  }
413
413
  );
414
414
  }
415
- const ee = {
415
+ const re = {
416
416
  name: "",
417
417
  description: "",
418
418
  prompt: "",
@@ -425,58 +425,69 @@ function Xe({
425
425
  initialMode: o = "list",
426
426
  templates: p,
427
427
  onSaveTemplate: u,
428
- onDeleteTemplate: f
428
+ onDeleteTemplate: b
429
429
  }) {
430
- const { t } = G(), [n, a] = v(null), [N, T] = v(!1), [I, C] = v(!1), [x, w] = v(null);
431
- q(() => {
430
+ const { t } = V(), [n, a] = h(null), [N, M] = h(!1), [S, C] = h(!1), [x, I] = h(null), [v, y] = h(!1), [F, L] = h(!1), $ = async () => {
431
+ if (!(!x || v)) {
432
+ y(!0), L(!1);
433
+ try {
434
+ await (b == null ? void 0 : b(x.id)), I(null);
435
+ } catch {
436
+ L(!0);
437
+ } finally {
438
+ y(!1);
439
+ }
440
+ }
441
+ };
442
+ U(() => {
432
443
  r && (C(!1), a(
433
- o === "create" ? { ...ee, isDefault: p.length === 0 } : null
444
+ o === "create" ? { ...re, isDefault: p.length === 0 } : null
434
445
  ));
435
446
  }, [r]);
436
- const M = (s, k) => p.some(
437
- (g) => g.id !== k && g.name.toLowerCase() === s.toLowerCase()
438
- ), y = (() => {
447
+ const w = (s, D) => p.some(
448
+ (T) => T.id !== D && T.name.toLowerCase() === s.toLowerCase()
449
+ ), _ = (() => {
439
450
  if (!(n != null && n.submitted)) return;
440
451
  const s = n.name.trim();
441
- return s ? M(s, n.id) ? t("helpMeWriteTemplates.manager.nameTaken") : void 0 : t("helpMeWriteTemplates.manager.nameRequired");
442
- })(), O = n != null && n.submitted && !n.prompt.trim() ? t("helpMeWriteTemplates.manager.promptRequired") : void 0, V = async () => {
452
+ return s ? w(s, n.id) ? t("helpMeWriteTemplates.manager.nameTaken") : void 0 : t("helpMeWriteTemplates.manager.nameRequired");
453
+ })(), k = n != null && n.submitted && !n.prompt.trim() ? t("helpMeWriteTemplates.manager.promptRequired") : void 0, X = async () => {
443
454
  if (!n || N) return;
444
455
  const s = { ...n, submitted: !0 };
445
456
  a(s);
446
- const k = s.name.trim(), g = s.prompt.trim();
447
- if (!(!k || !g || M(k, s.id))) {
448
- T(!0), C(!1);
457
+ const D = s.name.trim(), T = s.prompt.trim();
458
+ if (!(!D || !T || w(D, s.id))) {
459
+ M(!0), C(!1);
449
460
  try {
450
461
  await u({
451
462
  id: s.id,
452
- name: k,
463
+ name: D,
453
464
  description: s.description.trim() || void 0,
454
- prompt: g,
465
+ prompt: T,
455
466
  isDefault: s.isDefault
456
467
  }), a(null);
457
468
  } catch {
458
469
  C(!0);
459
470
  } finally {
460
- T(!1);
471
+ M(!1);
461
472
  }
462
473
  }
463
- }, E = n ? n.id ? t("helpMeWriteTemplates.manager.formEdit") : t("helpMeWriteTemplates.manager.formNew") : t("helpMeWriteTemplates.manager.title");
464
- return /* @__PURE__ */ i(R, { children: [
465
- /* @__PURE__ */ e(b, { open: r, onOpenChange: c, children: /* @__PURE__ */ e(b.Content, { size: "lg", children: /* @__PURE__ */ i("div", { className: "ds:contents", "data-component": "ai-template-manager", children: [
466
- /* @__PURE__ */ i(b.Header, { children: [
467
- /* @__PURE__ */ e(b.Title, { children: E }),
468
- /* @__PURE__ */ e(b.Description, { children: t("helpMeWriteTemplates.manager.description") })
474
+ }, A = n ? n.id ? t("helpMeWriteTemplates.manager.formEdit") : t("helpMeWriteTemplates.manager.formNew") : t("helpMeWriteTemplates.manager.title");
475
+ return /* @__PURE__ */ i(E, { children: [
476
+ /* @__PURE__ */ e(f, { open: r, onOpenChange: c, children: /* @__PURE__ */ e(f.Content, { size: "lg", children: /* @__PURE__ */ i("div", { className: "ds:contents", "data-component": "ai-template-manager", children: [
477
+ /* @__PURE__ */ i(f.Header, { children: [
478
+ /* @__PURE__ */ e(f.Title, { children: A }),
479
+ /* @__PURE__ */ e(f.Description, { children: t("helpMeWriteTemplates.manager.description") })
469
480
  ] }),
470
- /* @__PURE__ */ e(b.Body, { children: n ? /* @__PURE__ */ i("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
471
- I ? /* @__PURE__ */ e(B, { variant: "error", children: t("helpMeWriteTemplates.manager.saveError") }) : null,
481
+ /* @__PURE__ */ e(f.Body, { children: n ? /* @__PURE__ */ i("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
482
+ S ? /* @__PURE__ */ e(R, { variant: "error", children: t("helpMeWriteTemplates.manager.saveError") }) : null,
472
483
  /* @__PURE__ */ e(
473
- K,
484
+ Q,
474
485
  {
475
486
  label: t("helpMeWriteTemplates.manager.name"),
476
- error: y,
487
+ error: _,
477
488
  required: !0,
478
489
  children: /* @__PURE__ */ e(
479
- le,
490
+ oe,
480
491
  {
481
492
  value: n.name,
482
493
  maxLength: 100,
@@ -489,13 +500,13 @@ function Xe({
489
500
  }
490
501
  ),
491
502
  /* @__PURE__ */ e(
492
- K,
503
+ Q,
493
504
  {
494
505
  label: t("helpMeWriteTemplates.manager.descLabel"),
495
506
  description: t("helpMeWriteTemplates.manager.descHint"),
496
507
  optional: !0,
497
508
  children: /* @__PURE__ */ e(
498
- le,
509
+ oe,
499
510
  {
500
511
  value: n.description,
501
512
  maxLength: 120,
@@ -505,16 +516,16 @@ function Xe({
505
516
  }
506
517
  ),
507
518
  /* @__PURE__ */ e(
508
- K,
519
+ Q,
509
520
  {
510
521
  label: t("helpMeWriteTemplates.manager.prompt"),
511
522
  description: t(
512
523
  "helpMeWriteTemplates.manager.promptDescription"
513
524
  ),
514
- error: O,
525
+ error: k,
515
526
  required: !0,
516
527
  children: /* @__PURE__ */ e(
517
- fe,
528
+ ge,
518
529
  {
519
530
  value: n.prompt,
520
531
  maxLength: 4e3,
@@ -527,7 +538,7 @@ function Xe({
527
538
  }
528
539
  ),
529
540
  /* @__PURE__ */ e(
530
- De,
541
+ Ie,
531
542
  {
532
543
  label: t("helpMeWriteTemplates.manager.isDefault"),
533
544
  checked: n.isDefault,
@@ -545,7 +556,7 @@ function Xe({
545
556
  ),
546
557
  primaryAction: {
547
558
  label: t("helpMeWriteTemplates.manager.new"),
548
- onClick: () => a({ ...ee, isDefault: !0 })
559
+ onClick: () => a({ ...re, isDefault: !0 })
549
560
  }
550
561
  }
551
562
  ) : /* @__PURE__ */ e(
@@ -553,7 +564,7 @@ function Xe({
553
564
  {
554
565
  "aria-label": t("helpMeWriteTemplates.manager.listLabel"),
555
566
  className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-0",
556
- children: be(p).map((s) => /* @__PURE__ */ i(
567
+ children: ve(p).map((s) => /* @__PURE__ */ i(
557
568
  "li",
558
569
  {
559
570
  className: "ds:flex ds:items-start ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)] ds:p-[var(--spacing-sm)]",
@@ -561,12 +572,12 @@ function Xe({
561
572
  /* @__PURE__ */ i("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
562
573
  /* @__PURE__ */ i("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", children: [
563
574
  /* @__PURE__ */ e("span", { className: "type-title-item ds:text-[color:var(--foreground)]", children: s.name }),
564
- s.isDefault ? /* @__PURE__ */ e(he, { variant: "brand", size: "sm", children: t("helpMeWriteTemplates.bar.defaultBadge") }) : null
575
+ s.isDefault ? /* @__PURE__ */ e(fe, { variant: "brand", size: "sm", children: t("helpMeWriteTemplates.bar.defaultBadge") }) : null
565
576
  ] }),
566
- /* @__PURE__ */ e("p", { className: `${U} ds:line-clamp-2`, children: s.description || s.prompt })
577
+ /* @__PURE__ */ e("p", { className: `${G} ds:line-clamp-2`, children: s.description || s.prompt })
567
578
  ] }),
568
579
  /* @__PURE__ */ e(
569
- F,
580
+ H,
570
581
  {
571
582
  size: "sm",
572
583
  intent: "ghost",
@@ -584,8 +595,8 @@ function Xe({
584
595
  })
585
596
  }
586
597
  ),
587
- f ? /* @__PURE__ */ e(
588
- F,
598
+ b ? /* @__PURE__ */ e(
599
+ H,
589
600
  {
590
601
  size: "sm",
591
602
  intent: "ghost",
@@ -593,7 +604,7 @@ function Xe({
593
604
  "aria-label": t("helpMeWriteTemplates.manager.delete", {
594
605
  name: s.name
595
606
  }),
596
- onClick: () => w(s)
607
+ onClick: () => I(s)
597
608
  }
598
609
  ) : null
599
610
  ]
@@ -602,53 +613,53 @@ function Xe({
602
613
  ))
603
614
  }
604
615
  ) }),
605
- /* @__PURE__ */ e(b.Footer, { children: n ? /* @__PURE__ */ i(R, { children: [
606
- /* @__PURE__ */ e(h, { intent: "secondary", onClick: () => a(null), children: t("helpMeWriteTemplates.manager.cancel") }),
616
+ /* @__PURE__ */ e(f.Footer, { children: n ? /* @__PURE__ */ i(E, { children: [
617
+ /* @__PURE__ */ e(g, { intent: "secondary", onClick: () => a(null), children: t("helpMeWriteTemplates.manager.cancel") }),
607
618
  /* @__PURE__ */ e(
608
- h,
619
+ g,
609
620
  {
610
621
  intent: "primary",
611
622
  loading: N,
612
- onClick: () => void V(),
623
+ onClick: () => void X(),
613
624
  children: t("helpMeWriteTemplates.manager.save")
614
625
  }
615
626
  )
616
- ] }) : /* @__PURE__ */ i(R, { children: [
627
+ ] }) : /* @__PURE__ */ i(E, { children: [
617
628
  p.length > 0 ? /* @__PURE__ */ e(
618
- h,
629
+ g,
619
630
  {
620
631
  intent: "outline",
621
- startIcon: /* @__PURE__ */ e(ge, {}),
622
- onClick: () => a({ ...ee }),
632
+ startIcon: /* @__PURE__ */ e(be, {}),
633
+ onClick: () => a({ ...re }),
623
634
  children: t("helpMeWriteTemplates.manager.new")
624
635
  }
625
636
  ) : null,
626
- /* @__PURE__ */ e(b.Close, { asChild: !0, children: /* @__PURE__ */ e(h, { intent: "primary", children: t("helpMeWriteTemplates.manager.done") }) })
637
+ /* @__PURE__ */ e(f.Close, { asChild: !0, children: /* @__PURE__ */ e(g, { intent: "primary", children: t("helpMeWriteTemplates.manager.done") }) })
627
638
  ] }) })
628
639
  ] }) }) }),
629
640
  /* @__PURE__ */ e(
630
- b,
641
+ f,
631
642
  {
632
643
  open: x != null,
633
644
  onOpenChange: (s) => {
634
- s || w(null);
645
+ !s && !v && (I(null), L(!1));
635
646
  },
636
- children: /* @__PURE__ */ i(b.Content, { size: "sm", variant: "alert", children: [
637
- /* @__PURE__ */ i(b.Header, { children: [
638
- /* @__PURE__ */ e(b.Title, { children: t("helpMeWriteTemplates.manager.deleteTitle", {
647
+ children: /* @__PURE__ */ i(f.Content, { size: "sm", variant: "alert", children: [
648
+ /* @__PURE__ */ i(f.Header, { children: [
649
+ /* @__PURE__ */ e(f.Title, { children: t("helpMeWriteTemplates.manager.deleteTitle", {
639
650
  name: (x == null ? void 0 : x.name) ?? ""
640
651
  }) }),
641
- /* @__PURE__ */ e(b.Description, { children: t("helpMeWriteTemplates.manager.deleteDescription") })
652
+ /* @__PURE__ */ e(f.Description, { children: t("helpMeWriteTemplates.manager.deleteDescription") })
642
653
  ] }),
643
- /* @__PURE__ */ i(b.Footer, { children: [
644
- /* @__PURE__ */ e(b.Close, { asChild: !0, children: /* @__PURE__ */ e(h, { intent: "secondary", children: t("helpMeWriteTemplates.manager.cancel") }) }),
654
+ F ? /* @__PURE__ */ e(f.Body, { children: /* @__PURE__ */ e(R, { variant: "error", children: t("helpMeWriteTemplates.manager.deleteError") }) }) : null,
655
+ /* @__PURE__ */ i(f.Footer, { children: [
656
+ /* @__PURE__ */ e(f.Close, { asChild: !0, children: /* @__PURE__ */ e(g, { intent: "secondary", disabled: v, children: t("helpMeWriteTemplates.manager.cancel") }) }),
645
657
  /* @__PURE__ */ e(
646
- h,
658
+ g,
647
659
  {
648
660
  intent: "destructive",
649
- onClick: () => {
650
- x && (f == null || f(x.id)), w(null);
651
- },
661
+ loading: v,
662
+ onClick: () => void $(),
652
663
  children: t("helpMeWriteTemplates.manager.deleteConfirm")
653
664
  }
654
665
  )
@@ -663,14 +674,14 @@ function Ye({
663
674
  onUndo: c,
664
675
  onDismiss: o
665
676
  }) {
666
- const { t: p } = G(), u = re(null);
667
- if (q(() => {
677
+ const { t: p } = V(), u = te(null);
678
+ if (U(() => {
668
679
  var t;
669
680
  r && ((t = u.current) == null || t.focus());
670
681
  }, [r]), !(r != null && r.template)) return null;
671
- const f = r.template.name;
682
+ const b = r.template.name;
672
683
  return /* @__PURE__ */ e(
673
- B,
684
+ R,
674
685
  {
675
686
  variant: "success",
676
687
  dismissible: !0,
@@ -679,37 +690,37 @@ function Ye({
679
690
  },
680
691
  "data-component": "help-me-write-undo-notice",
681
692
  children: /* @__PURE__ */ i("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
682
- /* @__PURE__ */ e("span", { children: r.mode === "below" ? p("helpMeWriteTemplates.undo.addedBelow", { name: f }) : p("helpMeWriteTemplates.undo.replaced", { name: f }) }),
683
- /* @__PURE__ */ e(h, { ref: u, intent: "outline", size: "sm", onClick: c, children: p("helpMeWriteTemplates.undo.undo") })
693
+ /* @__PURE__ */ e("span", { children: r.mode === "below" ? p("helpMeWriteTemplates.undo.addedBelow", { name: b }) : p("helpMeWriteTemplates.undo.replaced", { name: b }) }),
694
+ /* @__PURE__ */ e(g, { ref: u, intent: "outline", size: "sm", onClick: c, children: p("helpMeWriteTemplates.undo.undo") })
684
695
  ] })
685
696
  }
686
697
  );
687
698
  }
688
- function Ir({
699
+ function Dr({
689
700
  templates: r,
690
701
  onGenerate: c,
691
702
  onSaveTemplate: o,
692
703
  onDeleteTemplate: p,
693
704
  credits: u,
694
- enableDictation: f,
705
+ enableDictation: b,
695
706
  onApplied: t
696
707
  }) {
697
- const [n, a] = v({ open: !1, mode: "list" }), [N, T] = v(null), I = A(
698
- (M = "list") => a({ open: !0, mode: M }),
708
+ const [n, a] = h({ open: !1, mode: "list" }), [N, M] = h(null), S = O(
709
+ (v = "list") => a({ open: !0, mode: v }),
699
710
  []
700
- ), C = A(
701
- (M) => /* @__PURE__ */ e(
711
+ ), C = O(
712
+ (v) => /* @__PURE__ */ e(
702
713
  Ve,
703
714
  {
704
- context: M,
715
+ context: v,
705
716
  templates: r,
706
717
  onGenerate: c,
707
- onManageTemplates: o ? I : void 0,
718
+ onManageTemplates: o ? S : void 0,
708
719
  credits: u,
709
- enableDictation: f,
720
+ enableDictation: b,
710
721
  suspendClose: n.open,
711
722
  onApplied: (y) => {
712
- T(y.template ? y : null), t == null || t(y);
723
+ M(y.template ? y : null), t == null || t(y);
713
724
  }
714
725
  }
715
726
  ),
@@ -717,19 +728,19 @@ function Ir({
717
728
  r,
718
729
  c,
719
730
  o,
720
- I,
731
+ S,
721
732
  u,
722
- f,
733
+ b,
723
734
  n.open,
724
735
  t
725
736
  ]
726
- ), x = ye(
737
+ ), x = Ne(
727
738
  () => o ? /* @__PURE__ */ e(
728
739
  Xe,
729
740
  {
730
741
  open: n.open,
731
742
  initialMode: n.mode,
732
- onOpenChange: (M) => a((y) => ({ ...y, open: M })),
743
+ onOpenChange: (v) => a((y) => ({ ...y, open: v })),
733
744
  templates: r,
734
745
  onSaveTemplate: o,
735
746
  onDeleteTemplate: p
@@ -745,20 +756,20 @@ function Ir({
745
756
  {
746
757
  applied: N,
747
758
  onUndo: () => {
748
- N == null || N.undo(), T(null);
759
+ N == null || N.undo(), M(null);
749
760
  },
750
- onDismiss: () => T(null)
761
+ onDismiss: () => M(null)
751
762
  }
752
763
  ),
753
- openManager: I
764
+ openManager: S
754
765
  };
755
766
  }
756
767
  export {
757
- ce as A,
768
+ me as A,
758
769
  Ve as H,
759
770
  Ge as a,
760
771
  Xe as b,
761
772
  Ye as c,
762
- Ir as u
773
+ Dr as u
763
774
  };
764
- //# sourceMappingURL=help-me-write-templates-GB70jnV9.js.map
775
+ //# sourceMappingURL=help-me-write-templates-B-m7zgJa.js.map