best-email-builder 0.14.0 → 0.16.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 (112) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/README.md +13 -6
  3. package/THIRD-PARTY-NOTICES.md +34 -0
  4. package/dist/ai-server.js +7 -3
  5. package/dist/ai-server.js.map +1 -1
  6. package/dist/ai.js +114 -108
  7. package/dist/ai.js.map +1 -1
  8. package/dist/builder.js +8 -8
  9. package/dist/{chunk-XXUYQ5BX.js → chunk-6OR6W4KJ.js} +268 -55
  10. package/dist/chunk-6OR6W4KJ.js.map +1 -0
  11. package/dist/{chunk-O2A2DPFJ.js → chunk-7H7TLQBL.js} +159 -122
  12. package/dist/chunk-7H7TLQBL.js.map +1 -0
  13. package/dist/{chunk-R3DWMSSR.js → chunk-AGA3BLRI.js} +2 -2
  14. package/dist/{chunk-SYEUC7I2.js → chunk-EFE245KW.js} +399 -19
  15. package/dist/chunk-EFE245KW.js.map +1 -0
  16. package/dist/{chunk-NEEOZR5C.js → chunk-F5H7ITED.js} +9 -9
  17. package/dist/chunk-F5H7ITED.js.map +1 -0
  18. package/dist/{chunk-2ZRGQFX6.js → chunk-HAHHRMQG.js} +2576 -885
  19. package/dist/chunk-HAHHRMQG.js.map +1 -0
  20. package/dist/{chunk-OTE7BRKU.js → chunk-MC7JUFHI.js} +4 -4
  21. package/dist/{chunk-PCSKVVSZ.js → chunk-MSHGCLCA.js} +2 -2
  22. package/dist/{chunk-VHTV32EW.js → chunk-QLUCTFJ2.js} +311 -3
  23. package/dist/chunk-QLUCTFJ2.js.map +1 -0
  24. package/dist/{chunk-7JJ4EZAZ.js → chunk-RPDQABWZ.js} +2 -2
  25. package/dist/{chunk-SAYIBNH5.js → chunk-W5AJWWHH.js} +159 -20
  26. package/dist/chunk-W5AJWWHH.js.map +1 -0
  27. package/dist/de-BNFO6VLR.js +1875 -0
  28. package/dist/de-BNFO6VLR.js.map +1 -0
  29. package/dist/en-PBUZLCBA.js +1875 -0
  30. package/dist/en-PBUZLCBA.js.map +1 -0
  31. package/dist/es-M7A73ED7.js +1875 -0
  32. package/dist/es-M7A73ED7.js.map +1 -0
  33. package/dist/fr-SUFB35ZZ.js +1875 -0
  34. package/dist/fr-SUFB35ZZ.js.map +1 -0
  35. package/dist/index.js +10 -10
  36. package/dist/library.js +5 -5
  37. package/dist/pt-OEAULFDA.js +1875 -0
  38. package/dist/pt-OEAULFDA.js.map +1 -0
  39. package/dist/ru-ZCORYHGA.js +1875 -0
  40. package/dist/ru-ZCORYHGA.js.map +1 -0
  41. package/dist/server.js +80 -19
  42. package/dist/server.js.map +1 -1
  43. package/dist/styles.css +1 -1
  44. package/dist/types/ai/errors.d.ts +19 -7
  45. package/dist/types/ai/index.d.ts +1 -0
  46. package/dist/types/ai/languagetool.d.ts +46 -0
  47. package/dist/types/ai/rewrite.d.ts +9 -7
  48. package/dist/types/ai/server.d.ts +1 -0
  49. package/dist/types/ai/subjects.d.ts +1 -0
  50. package/dist/types/blocks/shared.d.ts +12 -9
  51. package/dist/types/core/EmailEditor.d.ts +85 -12
  52. package/dist/types/core/blockBox.d.ts +12 -0
  53. package/dist/types/core/constants.d.ts +1 -1
  54. package/dist/types/core/mjmlAttributes.d.ts +37 -0
  55. package/dist/types/core/textFormat.d.ts +4 -0
  56. package/dist/types/defaultEditor.d.ts +3 -1
  57. package/dist/types/engine/NativeAdapter.d.ts +5 -2
  58. package/dist/types/engine/canvas/CanvasView.d.ts +30 -3
  59. package/dist/types/engine/canvas/canvasStyles.d.ts +1 -1
  60. package/dist/types/engine/canvas/icons.d.ts +5 -0
  61. package/dist/types/engine/canvasMjml.d.ts +4 -2
  62. package/dist/types/engine/mergeTags.d.ts +47 -0
  63. package/dist/types/engine/mjml.d.ts +7 -0
  64. package/dist/types/features/brand/brand.d.ts +4 -0
  65. package/dist/types/features/emoji/EmojiPanel.d.ts +3 -0
  66. package/dist/types/features/emoji/data/de.d.ts +2 -0
  67. package/dist/types/features/emoji/data/en.d.ts +2 -0
  68. package/dist/types/features/emoji/data/es.d.ts +2 -0
  69. package/dist/types/features/emoji/data/fr.d.ts +2 -0
  70. package/dist/types/features/emoji/data/pt.d.ts +2 -0
  71. package/dist/types/features/emoji/data/ru.d.ts +2 -0
  72. package/dist/types/features/emoji/data/zh.d.ts +2 -0
  73. package/dist/types/features/emoji/emojis.d.ts +33 -0
  74. package/dist/types/features/emoji/index.d.ts +2 -0
  75. package/dist/types/features/variables/VariableDialog.d.ts +16 -4
  76. package/dist/types/features/variables/VariablesPanel.d.ts +23 -0
  77. package/dist/types/features/variables/catalog.d.ts +45 -3
  78. package/dist/types/renderer/columnAlignment.d.ts +10 -0
  79. package/dist/types/renderer/compileEditorMjml.d.ts +2 -0
  80. package/dist/types/server/compileMjml.d.ts +5 -0
  81. package/dist/types/server/handler.d.ts +1 -1
  82. package/dist/types/server/render.d.ts +15 -4
  83. package/dist/types/server/sendTest.d.ts +2 -2
  84. package/dist/types/server/variables.d.ts +7 -2
  85. package/dist/types/storage/client.d.ts +8 -1
  86. package/dist/types/ui/BoxModel.d.ts +39 -0
  87. package/dist/types/ui/CanvasPanel.d.ts +19 -0
  88. package/dist/types/ui/PropertiesPanel.d.ts +1 -2
  89. package/dist/types/ui/SidePanel.d.ts +72 -0
  90. package/dist/types/ui/TextRibbon.d.ts +25 -0
  91. package/dist/types/ui/fields.d.ts +16 -1
  92. package/dist/types/ui/primitives/button.d.ts +1 -1
  93. package/dist/types/ui/primitives/color-picker.d.ts +19 -3
  94. package/dist/types/ui/primitives/fields.d.ts +5 -0
  95. package/dist/types/ui/primitives/overlays.d.ts +3 -1
  96. package/dist/types/ui/useEmailEditorState.d.ts +1 -0
  97. package/dist/zh-KPGU7EQG.js +1875 -0
  98. package/dist/zh-KPGU7EQG.js.map +1 -0
  99. package/package.json +2 -1
  100. package/dist/chunk-2ZRGQFX6.js.map +0 -1
  101. package/dist/chunk-NEEOZR5C.js.map +0 -1
  102. package/dist/chunk-O2A2DPFJ.js.map +0 -1
  103. package/dist/chunk-SAYIBNH5.js.map +0 -1
  104. package/dist/chunk-SYEUC7I2.js.map +0 -1
  105. package/dist/chunk-VHTV32EW.js.map +0 -1
  106. package/dist/chunk-XXUYQ5BX.js.map +0 -1
  107. package/dist/types/features/variables/VariablesBar.d.ts +0 -21
  108. package/dist/types/ui/ElementActions.d.ts +0 -13
  109. /package/dist/{chunk-R3DWMSSR.js.map → chunk-AGA3BLRI.js.map} +0 -0
  110. /package/dist/{chunk-OTE7BRKU.js.map → chunk-MC7JUFHI.js.map} +0 -0
  111. /package/dist/{chunk-PCSKVVSZ.js.map → chunk-MSHGCLCA.js.map} +0 -0
  112. /package/dist/{chunk-7JJ4EZAZ.js.map → chunk-RPDQABWZ.js.map} +0 -0
package/dist/builder.js CHANGED
@@ -5,20 +5,20 @@ import {
5
5
  TEMPLATE_GALLERY,
6
6
  buildGallery,
7
7
  createStarterMjml
8
- } from "./chunk-2ZRGQFX6.js";
9
- import "./chunk-NEEOZR5C.js";
10
- import "./chunk-VHTV32EW.js";
8
+ } from "./chunk-HAHHRMQG.js";
9
+ import "./chunk-F5H7ITED.js";
10
+ import "./chunk-QLUCTFJ2.js";
11
11
  import "./chunk-UFKCLU2D.js";
12
- import "./chunk-7JJ4EZAZ.js";
12
+ import "./chunk-RPDQABWZ.js";
13
13
  import {
14
14
  StorageError,
15
15
  createHttpStorage,
16
16
  createMemoryStorage
17
- } from "./chunk-O2A2DPFJ.js";
17
+ } from "./chunk-7H7TLQBL.js";
18
18
  import {
19
19
  EMAIL_BUILDER_VERSION
20
- } from "./chunk-SAYIBNH5.js";
21
- import "./chunk-R3DWMSSR.js";
20
+ } from "./chunk-W5AJWWHH.js";
21
+ import "./chunk-AGA3BLRI.js";
22
22
  import {
23
23
  CUSTOM_GROUP,
24
24
  DEFAULT_VARIABLES,
@@ -28,7 +28,7 @@ import {
28
28
  defineVariables,
29
29
  mergeVariables,
30
30
  translatorFor
31
- } from "./chunk-SYEUC7I2.js";
31
+ } from "./chunk-EFE245KW.js";
32
32
  export {
33
33
  CUSTOM_GROUP,
34
34
  DEFAULT_VARIABLES,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  validateMjml
3
- } from "./chunk-R3DWMSSR.js";
3
+ } from "./chunk-AGA3BLRI.js";
4
4
  import {
5
5
  DEFAULT_VARIABLES
6
- } from "./chunk-SYEUC7I2.js";
6
+ } from "./chunk-EFE245KW.js";
7
7
 
8
8
  // src/ai/errors.js
9
9
  var GENERATION_ERRORS = {
@@ -19,6 +19,9 @@ var GENERATION_ERRORS = {
19
19
  SUBJECTS_UNUSABLE: { status: 502, message: "No usable subject came back. Try again." },
20
20
  NOTHING_TO_PROOFREAD: { status: 400, message: "The email has no text to check yet." },
21
21
  PROOFREAD_REFUSED: { status: 422, message: "The AI declined to check this email." },
22
+ // A checker without AI (languagetool.js).
23
+ CHECKER_UNAVAILABLE: { status: 502, message: "The checker could not answer. Try again." },
24
+ CHECKER_BUSY: { status: 503, message: "The checker is busy right now. Try again in a minute." },
22
25
  // The provider's side (providers.js). Never 401 to the browser: the key is the AI's, not the user's session.
23
26
  KEY_MISSING: { status: 502, message: "Connect an AI provider first: it needs a key." },
24
27
  KEY_REFUSED: { status: 502, message: "The AI provider refused the key. Check it, or use another one." },
@@ -178,7 +181,7 @@ function cleanRewriteInput(input) {
178
181
  const context = bounded(source.context, MAX_REWRITE_CONTEXT);
179
182
  const heading = source.role === "heading";
180
183
  const instruction = bounded(source.instruction, MAX_REWRITE_INSTRUCTION);
181
- if (source.action === "write") {
184
+ if (source.action === "write" || source.action === "custom" && instruction && !wordsOf(text)) {
182
185
  if (!instruction) throw new EmailGenerationError("NOTHING_TO_REWRITE", "No topic.");
183
186
  const language = /^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(String(source.language || "")) ? String(source.language) : "";
184
187
  return { format, text, context, heading, change: writeChange(instruction, { heading, format, language, context }) };
@@ -191,17 +194,22 @@ function cleanRewriteInput(input) {
191
194
  if (!/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(language)) throw new EmailGenerationError("NOTHING_TO_REWRITE", "No target language.");
192
195
  return { format, text, context, heading, change: `Translate it into ${languageName(language)}. Keep the tone and the length.` };
193
196
  }
194
- if (source.action === "custom" && instruction) return { format, text, context, heading, change: instruction };
197
+ if (source.action === "custom" && instruction) return { format, text, context, heading, change: askedChange(instruction, { heading, format }) };
195
198
  throw new EmailGenerationError("NOTHING_TO_REWRITE", "Unknown action.");
196
199
  }
200
+ var shapeOf = (format, heading) => format === "plain" ? "a button label: a short call to action of a few words" : heading ? "a title: one short line, plain words without <p>, no full stop" : "the text of a block: a few short sentences, in one or two paragraphs";
201
+ var NEW_TEXT = "It replaces the current words entirely; only the current links and merge tags stay, placed where they fit.";
202
+ var NO_INVENTED_FACT = "Where a fact is missing (a date, a price, a name, a place), write a [placeholder in square brackets] instead of inventing it.";
197
203
  function writeChange(topic, { heading, format, language, context }) {
198
- const shape = format === "plain" ? "a button label: a short call to action of a few words" : heading ? "a title: one short line, plain words without <p>, no full stop" : "the text of a block: a few short sentences, in one or two paragraphs";
199
204
  const where = context ? "the language of the email" : `${languageName(language || "en")}, unless the topic is written in another language`;
205
+ return [`Write a new text about: ${topic}`, `It is ${shapeOf(format, heading)}. ${NEW_TEXT}`, NO_INVENTED_FACT, `Write in ${where}.`].join(" ");
206
+ }
207
+ function askedChange(request, { heading, format }) {
200
208
  return [
201
- `Write a new text about: ${topic}`,
202
- `It is ${shape}. It replaces the current words entirely; only the current links and merge tags stay, placed where they fit.`,
203
- "Where a fact is missing (a date, a price, a name, a place), write a [placeholder in square brackets] instead of inventing it.",
204
- `Write in ${where}.`
209
+ `The user asks: ${request}`,
210
+ "If this says how to change the text, change it so and keep the rest as it is.",
211
+ `If it asks for a new text, or only names what to write about, write a new one instead: ${shapeOf(format, heading)}. ${NEW_TEXT}`,
212
+ NO_INVENTED_FACT
205
213
  ].join(" ");
206
214
  }
207
215
  function buildRewritePrompt({ format, text, change, context = "" }) {
@@ -396,7 +404,7 @@ var ENTITIES = {
396
404
  iexcl: "\xA1",
397
405
  iquest: "\xBF"
398
406
  };
399
- var entity = (whole, body) => {
407
+ var decodeEntity = (whole, body) => {
400
408
  if (body[0] !== "#") return Object.hasOwn(ENTITIES, body) ? ENTITIES[
401
409
  /** @type {keyof typeof ENTITIES} */
402
410
  body
@@ -408,7 +416,7 @@ function emailWords(mjml) {
408
416
  return visibleText(String(mjml || "").replace(/<mj-head[\s\S]*?<\/mj-head>/gi, " ")).slice(0, MAX_EMAIL_WORDS);
409
417
  }
410
418
  function visibleText(markup) {
411
- return String(markup || "").replace(/<(style|script|mj-style|mj-raw)[\s\S]*?<\/\1>/gi, " ").replace(/<\/(p|div|li|h[1-6]|mj-text|mj-button|mj-navbar-link|mj-social-element)>|<br\s*\/?>/gi, "\n").replace(/<[^>]*>/g, " ").replace(/&(#\d{1,8}|#x[0-9a-f]{1,8}|[a-z]{2,8});/gi, entity).replace(/[ \t]+/g, " ").replace(/\s*\n\s*/g, "\n").trim();
419
+ return String(markup || "").replace(/<(style|script|mj-style|mj-raw)[\s\S]*?<\/\1>/gi, " ").replace(/<\/(p|div|li|h[1-6]|mj-text|mj-button|mj-navbar-link|mj-social-element)>|<br\s*\/?>/gi, "\n").replace(/<[^>]*>/g, " ").replace(/&(#\d{1,8}|#x[0-9a-f]{1,8}|[a-z]{2,8});/gi, decodeEntity).replace(/[ \t]+/g, " ").replace(/\s*\n\s*/g, "\n").trim();
412
420
  }
413
421
  function cleanSubjectsInput(input) {
414
422
  const source = input && typeof input === "object" ? input : {};
@@ -682,7 +690,6 @@ var ordered = (texts, kept) => texts.filter(({ id }) => kept.has(id)).map(({ id
682
690
  // src/ai/i18n/de.js
683
691
  var de = {
684
692
  "The AI answer could not be read. Try again.": "Die Antwort der KI konnte nicht gelesen werden. Versuchen Sie es erneut.",
685
- "Rewrite with AI": "Mit KI umschreiben",
686
693
  "Shorter": "K\xFCrzer",
687
694
  "Longer": "L\xE4nger",
688
695
  "Fix mistakes": "Fehler korrigieren",
@@ -690,9 +697,6 @@ var de = {
690
697
  "More formal": "F\xF6rmlicher",
691
698
  "Translate": "\xDCbersetzen",
692
699
  "Translate into": "\xDCbersetzen in",
693
- "Or say what to change\u2026": "Oder sagen Sie, was ge\xE4ndert werden soll\u2026",
694
- "What to change": "Was ge\xE4ndert werden soll",
695
- "Rewrite": "Umschreiben",
696
700
  "Rewriting\u2026": "Wird umgeschrieben\u2026",
697
701
  "Suggest subjects": "Betreff vorschlagen",
698
702
  "Subject ideas": "Betreffideen",
@@ -758,7 +762,7 @@ var de = {
758
762
  "The address and the key stay in this browser; the key is sent only to that address.": "Adresse und Schl\xFCssel bleiben in diesem Browser; der Schl\xFCssel wird nur an diese Adresse gesendet.",
759
763
  "Give the API address to see its models.": "Geben Sie die API-Adresse an, um ihre Modelle zu sehen.",
760
764
  "The list of models could not be loaded. Type the id of the model.": "Die Modellliste konnte nicht geladen werden. Geben Sie die ID des Modells ein.",
761
- "AI looks for spelling, grammar and punctuation mistakes in every text. Nothing changes until you apply it.": "Die KI sucht in jedem Text nach Rechtschreib-, Grammatik- und Zeichensetzungsfehlern. Nichts \xE4ndert sich, bevor Sie es \xFCbernehmen.",
765
+ "Every text is checked for spelling, grammar and punctuation mistakes. Nothing changes until you apply it.": "Jeder Text wird auf Rechtschreib-, Grammatik- und Zeichensetzungsfehler gepr\xFCft. Nichts \xE4ndert sich, bevor Sie es \xFCbernehmen.",
762
766
  "Applied": "\xDCbernommen",
763
767
  "Apply": "\xDCbernehmen",
764
768
  "Apply all ({count})": "Alle \xFCbernehmen ({count})",
@@ -774,12 +778,14 @@ var de = {
774
778
  "The AI answer could not be used. Try again.": "Die Antwort der KI ist nicht verwendbar. Versuchen Sie es erneut.",
775
779
  "The AI declined this request.": "Die KI hat diese Anfrage abgelehnt.",
776
780
  "The AI declined to check this email.": "Die KI hat es abgelehnt, diese E-Mail zu pr\xFCfen.",
781
+ "The checker could not answer. Try again.": "Der Korrekturdienst hat nicht geantwortet. Versuchen Sie es erneut.",
782
+ "The checker is busy right now. Try again in a minute.": "Der Korrekturdienst ist gerade ausgelastet. Versuchen Sie es in einer Minute erneut.",
777
783
  "The answer was too long to finish. Try with less text.": "Die Antwort war zu lang, um sie fertigzustellen. Versuchen Sie es mit weniger Text.",
778
784
  "The email could not be checked.": "Die E-Mail konnte nicht gepr\xFCft werden.",
779
785
  "The email has no text to check yet.": "Die E-Mail hat noch keinen Text zum Pr\xFCfen.",
780
786
  "The text could not be written.": "Der Text konnte nicht geschrieben werden.",
781
- "What should it say? e.g. the sale ends Sunday": "Was soll drinstehen? z. B. der Sale endet am Sonntag",
782
- "What the text is about": "Worum es im Text geht",
787
+ "What should it say, or what should change? e.g. the sale ends Sunday": "Was soll drinstehen, oder was soll sich \xE4ndern? z. B. der Sale endet am Sonntag",
788
+ "Ask the AI": "KI fragen",
783
789
  "Write": "Schreiben",
784
790
  "Write with AI": "Mit KI schreiben",
785
791
  "Writing\u2026": "Wird geschrieben\u2026"
@@ -788,7 +794,6 @@ var de = {
788
794
  // src/ai/i18n/es.js
789
795
  var es = {
790
796
  "The AI answer could not be read. Try again.": "No se pudo leer la respuesta de la IA. Int\xE9ntalo de nuevo.",
791
- "Rewrite with AI": "Reescribir con IA",
792
797
  "Shorter": "M\xE1s corto",
793
798
  "Longer": "M\xE1s largo",
794
799
  "Fix mistakes": "Corregir errores",
@@ -796,9 +801,6 @@ var es = {
796
801
  "More formal": "M\xE1s formal",
797
802
  "Translate": "Traducir",
798
803
  "Translate into": "Traducir a",
799
- "Or say what to change\u2026": "O di qu\xE9 cambiar\u2026",
800
- "What to change": "Qu\xE9 cambiar",
801
- "Rewrite": "Reescribir",
802
804
  "Rewriting\u2026": "Reescribiendo\u2026",
803
805
  "Suggest subjects": "Sugerir asuntos",
804
806
  "Subject ideas": "Ideas de asunto",
@@ -864,7 +866,7 @@ var es = {
864
866
  "The address and the key stay in this browser; the key is sent only to that address.": "La direcci\xF3n y la clave se quedan en este navegador; la clave solo se env\xEDa a esa direcci\xF3n.",
865
867
  "Give the API address to see its models.": "Indica la direcci\xF3n de la API para ver sus modelos.",
866
868
  "The list of models could not be loaded. Type the id of the model.": "No se pudo cargar la lista de modelos. Escribe el ID del modelo.",
867
- "AI looks for spelling, grammar and punctuation mistakes in every text. Nothing changes until you apply it.": "La IA busca errores de ortograf\xEDa, gram\xE1tica y puntuaci\xF3n en cada texto. Nada cambia hasta que lo apliques.",
869
+ "Every text is checked for spelling, grammar and punctuation mistakes. Nothing changes until you apply it.": "Cada texto se revisa en busca de errores de ortograf\xEDa, gram\xE1tica y puntuaci\xF3n. Nada cambia hasta que lo apliques.",
868
870
  "Applied": "Aplicada",
869
871
  "Apply": "Aplicar",
870
872
  "Apply all ({count})": "Aplicar todas ({count})",
@@ -880,12 +882,14 @@ var es = {
880
882
  "The AI answer could not be used. Try again.": "No se pudo usar la respuesta de la IA. Int\xE9ntalo de nuevo.",
881
883
  "The AI declined this request.": "La IA rechaz\xF3 esta solicitud.",
882
884
  "The AI declined to check this email.": "La IA se neg\xF3 a revisar este correo.",
885
+ "The checker could not answer. Try again.": "El corrector no ha podido responder. Int\xE9ntalo de nuevo.",
886
+ "The checker is busy right now. Try again in a minute.": "El corrector est\xE1 ocupado ahora mismo. Int\xE9ntalo dentro de un minuto.",
883
887
  "The answer was too long to finish. Try with less text.": "La respuesta era demasiado larga para terminarla. Prueba con menos texto.",
884
888
  "The email could not be checked.": "No se pudo revisar el correo.",
885
889
  "The email has no text to check yet.": "El correo a\xFAn no tiene texto que revisar.",
886
890
  "The text could not be written.": "No se pudo escribir el texto.",
887
- "What should it say? e.g. the sale ends Sunday": "\xBFQu\xE9 debe decir? p. ej., la oferta termina el domingo",
888
- "What the text is about": "De qu\xE9 trata el texto",
891
+ "What should it say, or what should change? e.g. the sale ends Sunday": "\xBFQu\xE9 debe decir o qu\xE9 cambiar? p. ej., la oferta termina el domingo",
892
+ "Ask the AI": "Preguntar a la IA",
889
893
  "Write": "Escribir",
890
894
  "Write with AI": "Escribir con IA",
891
895
  "Writing\u2026": "Escribiendo\u2026"
@@ -894,7 +898,6 @@ var es = {
894
898
  // src/ai/i18n/fr.js
895
899
  var fr = {
896
900
  "The AI answer could not be read. Try again.": "La r\xE9ponse de l'IA est illisible. R\xE9essayez.",
897
- "Rewrite with AI": "R\xE9\xE9crire avec l'IA",
898
901
  "Shorter": "Plus court",
899
902
  "Longer": "Plus long",
900
903
  "Fix mistakes": "Corriger les fautes",
@@ -902,9 +905,6 @@ var fr = {
902
905
  "More formal": "Plus formel",
903
906
  "Translate": "Traduire",
904
907
  "Translate into": "Traduire en",
905
- "Or say what to change\u2026": "Ou dites ce qu'il faut changer\u2026",
906
- "What to change": "Ce qu'il faut changer",
907
- "Rewrite": "R\xE9\xE9crire",
908
908
  "Rewriting\u2026": "R\xE9\xE9criture\u2026",
909
909
  "Suggest subjects": "Sugg\xE9rer des objets",
910
910
  "Subject ideas": "Id\xE9es d'objet",
@@ -970,7 +970,7 @@ var fr = {
970
970
  "The address and the key stay in this browser; the key is sent only to that address.": "L'adresse et la cl\xE9 restent dans ce navigateur ; la cl\xE9 n'est envoy\xE9e qu'\xE0 cette adresse.",
971
971
  "Give the API address to see its models.": "Indiquez l'adresse de l'API pour voir ses mod\xE8les.",
972
972
  "The list of models could not be loaded. Type the id of the model.": "La liste des mod\xE8les n'a pas pu \xEAtre charg\xE9e. Tapez l'identifiant du mod\xE8le.",
973
- "AI looks for spelling, grammar and punctuation mistakes in every text. Nothing changes until you apply it.": "L'IA cherche les fautes d'orthographe, de grammaire et de ponctuation dans chaque texte. Rien ne change tant que vous ne l'appliquez pas.",
973
+ "Every text is checked for spelling, grammar and punctuation mistakes. Nothing changes until you apply it.": "Chaque texte est relu : fautes d'orthographe, de grammaire et de ponctuation. Rien ne change tant que vous ne l'appliquez pas.",
974
974
  "Applied": "Appliqu\xE9e",
975
975
  "Apply": "Appliquer",
976
976
  "Apply all ({count})": "Tout appliquer ({count})",
@@ -986,12 +986,14 @@ var fr = {
986
986
  "The AI answer could not be used. Try again.": "La r\xE9ponse de l'IA n'est pas utilisable. R\xE9essayez.",
987
987
  "The AI declined this request.": "L'IA a refus\xE9 cette demande.",
988
988
  "The AI declined to check this email.": "L'IA a refus\xE9 de v\xE9rifier cet e-mail.",
989
+ "The checker could not answer. Try again.": "Le correcteur n'a pas pu r\xE9pondre. R\xE9essayez.",
990
+ "The checker is busy right now. Try again in a minute.": "Le correcteur est occup\xE9 pour le moment. R\xE9essayez dans une minute.",
989
991
  "The answer was too long to finish. Try with less text.": "La r\xE9ponse \xE9tait trop longue pour \xEAtre termin\xE9e. Essayez avec moins de texte.",
990
992
  "The email could not be checked.": "L'e-mail n'a pas pu \xEAtre v\xE9rifi\xE9.",
991
993
  "The email has no text to check yet.": "L'e-mail n'a pas encore de texte \xE0 v\xE9rifier.",
992
994
  "The text could not be written.": "Le texte n'a pas pu \xEAtre \xE9crit.",
993
- "What should it say? e.g. the sale ends Sunday": "Que doit-il dire ? ex. les soldes finissent dimanche",
994
- "What the text is about": "Le sujet du texte",
995
+ "What should it say, or what should change? e.g. the sale ends Sunday": "Que doit-il dire, ou que changer ? ex. les soldes finissent dimanche",
996
+ "Ask the AI": "Demander \xE0 l'IA",
995
997
  "Write": "\xC9crire",
996
998
  "Write with AI": "\xC9crire avec l'IA",
997
999
  "Writing\u2026": "\xC9criture\u2026"
@@ -1000,7 +1002,6 @@ var fr = {
1000
1002
  // src/ai/i18n/pt.js
1001
1003
  var pt = {
1002
1004
  "The AI answer could not be read. Try again.": "N\xE3o foi poss\xEDvel ler a resposta da IA. Tente novamente.",
1003
- "Rewrite with AI": "Reescrever com IA",
1004
1005
  "Shorter": "Mais curto",
1005
1006
  "Longer": "Mais longo",
1006
1007
  "Fix mistakes": "Corrigir erros",
@@ -1008,9 +1009,6 @@ var pt = {
1008
1009
  "More formal": "Mais formal",
1009
1010
  "Translate": "Traduzir",
1010
1011
  "Translate into": "Traduzir para",
1011
- "Or say what to change\u2026": "Ou diga o que mudar\u2026",
1012
- "What to change": "O que mudar",
1013
- "Rewrite": "Reescrever",
1014
1012
  "Rewriting\u2026": "Reescrevendo\u2026",
1015
1013
  "Suggest subjects": "Sugerir assuntos",
1016
1014
  "Subject ideas": "Ideias de assunto",
@@ -1076,7 +1074,7 @@ var pt = {
1076
1074
  "The address and the key stay in this browser; the key is sent only to that address.": "O endere\xE7o e a chave ficam neste navegador; a chave s\xF3 \xE9 enviada para esse endere\xE7o.",
1077
1075
  "Give the API address to see its models.": "Informe o endere\xE7o da API para ver os modelos dela.",
1078
1076
  "The list of models could not be loaded. Type the id of the model.": "N\xE3o foi poss\xEDvel carregar a lista de modelos. Digite o ID do modelo.",
1079
- "AI looks for spelling, grammar and punctuation mistakes in every text. Nothing changes until you apply it.": "A IA procura erros de ortografia, gram\xE1tica e pontua\xE7\xE3o em cada texto. Nada muda at\xE9 voc\xEA aplicar.",
1077
+ "Every text is checked for spelling, grammar and punctuation mistakes. Nothing changes until you apply it.": "Cada texto \xE9 verificado quanto a erros de ortografia, gram\xE1tica e pontua\xE7\xE3o. Nada muda at\xE9 voc\xEA aplicar.",
1080
1078
  "Applied": "Aplicada",
1081
1079
  "Apply": "Aplicar",
1082
1080
  "Apply all ({count})": "Aplicar todas ({count})",
@@ -1092,12 +1090,14 @@ var pt = {
1092
1090
  "The AI answer could not be used. Try again.": "N\xE3o foi poss\xEDvel usar a resposta da IA. Tente novamente.",
1093
1091
  "The AI declined this request.": "A IA recusou este pedido.",
1094
1092
  "The AI declined to check this email.": "A IA se recusou a revisar este e-mail.",
1093
+ "The checker could not answer. Try again.": "O corretor n\xE3o conseguiu responder. Tente novamente.",
1094
+ "The checker is busy right now. Try again in a minute.": "O corretor est\xE1 ocupado agora. Tente novamente daqui a um minuto.",
1095
1095
  "The answer was too long to finish. Try with less text.": "A resposta ficou longa demais para ser conclu\xEDda. Tente com menos texto.",
1096
1096
  "The email could not be checked.": "N\xE3o foi poss\xEDvel revisar o e-mail.",
1097
1097
  "The email has no text to check yet.": "O e-mail ainda n\xE3o tem texto para revisar.",
1098
1098
  "The text could not be written.": "N\xE3o foi poss\xEDvel escrever o texto.",
1099
- "What should it say? e.g. the sale ends Sunday": "O que deve dizer? ex.: a promo\xE7\xE3o termina domingo",
1100
- "What the text is about": "Sobre o que \xE9 o texto",
1099
+ "What should it say, or what should change? e.g. the sale ends Sunday": "O que deve dizer, ou o que mudar? ex.: a promo\xE7\xE3o termina domingo",
1100
+ "Ask the AI": "Perguntar \xE0 IA",
1101
1101
  "Write": "Escrever",
1102
1102
  "Write with AI": "Escrever com IA",
1103
1103
  "Writing\u2026": "Escrevendo\u2026"
@@ -1106,7 +1106,6 @@ var pt = {
1106
1106
  // src/ai/i18n/ru.js
1107
1107
  var ru = {
1108
1108
  "The AI answer could not be read. Try again.": "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u043E\u0442\u0432\u0435\u0442 \u0418\u0418. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",
1109
- "Rewrite with AI": "\u041F\u0435\u0440\u0435\u043F\u0438\u0441\u0430\u0442\u044C \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u0418\u0418",
1110
1109
  "Shorter": "\u041A\u043E\u0440\u043E\u0447\u0435",
1111
1110
  "Longer": "\u0414\u043B\u0438\u043D\u043D\u0435\u0435",
1112
1111
  "Fix mistakes": "\u0418\u0441\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043E\u0448\u0438\u0431\u043A\u0438",
@@ -1114,9 +1113,6 @@ var ru = {
1114
1113
  "More formal": "\u041E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u0435\u0435",
1115
1114
  "Translate": "\u041F\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438",
1116
1115
  "Translate into": "\u041F\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043D\u0430",
1117
- "Or say what to change\u2026": "\u0418\u043B\u0438 \u043E\u043F\u0438\u0448\u0438\u0442\u0435, \u0447\u0442\u043E \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C\u2026",
1118
- "What to change": "\u0427\u0442\u043E \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C",
1119
- "Rewrite": "\u041F\u0435\u0440\u0435\u043F\u0438\u0441\u0430\u0442\u044C",
1120
1116
  "Rewriting\u2026": "\u0418\u0418 \u043F\u0435\u0440\u0435\u043F\u0438\u0441\u044B\u0432\u0430\u0435\u0442 \u0442\u0435\u043A\u0441\u0442\u2026",
1121
1117
  "Suggest subjects": "\u041F\u0440\u0435\u0434\u043B\u043E\u0436\u0438\u0442\u044C \u0442\u0435\u043C\u044B",
1122
1118
  "Subject ideas": "\u0418\u0434\u0435\u0438 \u0434\u043B\u044F \u0442\u0435\u043C\u044B",
@@ -1182,7 +1178,7 @@ var ru = {
1182
1178
  "The address and the key stay in this browser; the key is sent only to that address.": "\u0410\u0434\u0440\u0435\u0441 \u0438 \u043A\u043B\u044E\u0447 \u0445\u0440\u0430\u043D\u044F\u0442\u0441\u044F \u0432 \u044D\u0442\u043E\u043C \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435; \u043A\u043B\u044E\u0447 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u043E \u044D\u0442\u043E\u043C\u0443 \u0430\u0434\u0440\u0435\u0441\u0443.",
1183
1179
  "Give the API address to see its models.": "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0430\u0434\u0440\u0435\u0441 API, \u0447\u0442\u043E\u0431\u044B \u0443\u0432\u0438\u0434\u0435\u0442\u044C \u0435\u0433\u043E \u043C\u043E\u0434\u0435\u043B\u0438.",
1184
1180
  "The list of models could not be loaded. Type the id of the model.": "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0441\u043F\u0438\u0441\u043E\u043A \u043C\u043E\u0434\u0435\u043B\u0435\u0439. \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u043C\u043E\u0434\u0435\u043B\u0438.",
1185
- "AI looks for spelling, grammar and punctuation mistakes in every text. Nothing changes until you apply it.": "\u0418\u0418 \u0438\u0449\u0435\u0442 \u043E\u0440\u0444\u043E\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043A\u0438\u0435, \u0433\u0440\u0430\u043C\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0435 \u0438 \u043F\u0443\u043D\u043A\u0442\u0443\u0430\u0446\u0438\u043E\u043D\u043D\u044B\u0435 \u043E\u0448\u0438\u0431\u043A\u0438 \u0432 \u043A\u0430\u0436\u0434\u043E\u043C \u0442\u0435\u043A\u0441\u0442\u0435. \u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043C\u0435\u043D\u044F\u0435\u0442\u0441\u044F, \u043F\u043E\u043A\u0430 \u0432\u044B \u043D\u0435 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u0435 \u0438\u0441\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F.",
1181
+ "Every text is checked for spelling, grammar and punctuation mistakes. Nothing changes until you apply it.": "\u041A\u0430\u0436\u0434\u044B\u0439 \u0442\u0435\u043A\u0441\u0442 \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u0435\u0442\u0441\u044F \u043D\u0430 \u043E\u0440\u0444\u043E\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043A\u0438\u0435, \u0433\u0440\u0430\u043C\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0435 \u0438 \u043F\u0443\u043D\u043A\u0442\u0443\u0430\u0446\u0438\u043E\u043D\u043D\u044B\u0435 \u043E\u0448\u0438\u0431\u043A\u0438. \u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043C\u0435\u043D\u044F\u0435\u0442\u0441\u044F, \u043F\u043E\u043A\u0430 \u0432\u044B \u043D\u0435 \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u0435 \u0438\u0441\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F.",
1186
1182
  "Applied": "\u041F\u0440\u0438\u043C\u0435\u043D\u0435\u043D\u043E",
1187
1183
  "Apply": "\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C",
1188
1184
  "Apply all ({count})": "\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C \u0432\u0441\u0435 ({count})",
@@ -1198,12 +1194,14 @@ var ru = {
1198
1194
  "The AI answer could not be used. Try again.": "\u041E\u0442\u0432\u0435\u0442 \u0418\u0418 \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",
1199
1195
  "The AI declined this request.": "\u0418\u0418 \u043E\u0442\u043A\u0430\u0437\u0430\u043B\u0441\u044F \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u044D\u0442\u043E\u0442 \u0437\u0430\u043F\u0440\u043E\u0441.",
1200
1196
  "The AI declined to check this email.": "\u0418\u0418 \u043E\u0442\u043A\u0430\u0437\u0430\u043B\u0441\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u0442\u044C \u044D\u0442\u043E \u043F\u0438\u0441\u044C\u043C\u043E.",
1197
+ "The checker could not answer. Try again.": "\u0421\u0435\u0440\u0432\u0438\u0441 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043D\u0435 \u043E\u0442\u0432\u0435\u0442\u0438\u043B. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",
1198
+ "The checker is busy right now. Try again in a minute.": "\u0421\u0435\u0440\u0432\u0438\u0441 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u0437\u0430\u043D\u044F\u0442. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 \u043C\u0438\u043D\u0443\u0442\u0443.",
1201
1199
  "The answer was too long to finish. Try with less text.": "\u041E\u0442\u0432\u0435\u0442 \u043E\u043A\u0430\u0437\u0430\u043B\u0441\u044F \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0434\u043B\u0438\u043D\u043D\u044B\u043C, \u0438 \u0418\u0418 \u043D\u0435 \u0443\u0441\u043F\u0435\u043B \u0435\u0433\u043E \u0437\u0430\u043A\u043E\u043D\u0447\u0438\u0442\u044C. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0441 \u0442\u0435\u043A\u0441\u0442\u043E\u043C \u043F\u043E\u043A\u043E\u0440\u043E\u0447\u0435.",
1202
1200
  "The email could not be checked.": "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u043F\u0438\u0441\u044C\u043C\u043E.",
1203
1201
  "The email has no text to check yet.": "\u0412 \u043F\u0438\u0441\u044C\u043C\u0435 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442 \u0442\u0435\u043A\u0441\u0442\u0430 \u0434\u043B\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438.",
1204
1202
  "The text could not be written.": "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043D\u0430\u043F\u0438\u0441\u0430\u0442\u044C \u0442\u0435\u043A\u0441\u0442.",
1205
- "What should it say? e.g. the sale ends Sunday": "\u041E \u0447\u0451\u043C \u043D\u0430\u043F\u0438\u0441\u0430\u0442\u044C? \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u0440\u0430\u0441\u043F\u0440\u043E\u0434\u0430\u0436\u0430 \u0434\u043E \u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u044F",
1206
- "What the text is about": "\u041E \u0447\u0451\u043C \u0442\u0435\u043A\u0441\u0442",
1203
+ "What should it say, or what should change? e.g. the sale ends Sunday": "\u041E \u0447\u0451\u043C \u043D\u0430\u043F\u0438\u0441\u0430\u0442\u044C \u0438\u043B\u0438 \u0447\u0442\u043E \u0438\u0437\u043C\u0435\u043D\u0438\u0442\u044C? \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440, \u0440\u0430\u0441\u043F\u0440\u043E\u0434\u0430\u0436\u0430 \u0434\u043E \u0432\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u044F",
1204
+ "Ask the AI": "\u0421\u043F\u0440\u043E\u0441\u0438\u0442\u044C \u0418\u0418",
1207
1205
  "Write": "\u041D\u0430\u043F\u0438\u0441\u0430\u0442\u044C",
1208
1206
  "Write with AI": "\u041D\u0430\u043F\u0438\u0441\u0430\u0442\u044C \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u0418\u0418",
1209
1207
  "Writing\u2026": "\u0418\u0418 \u043F\u0438\u0448\u0435\u0442\u2026"
@@ -1212,7 +1210,6 @@ var ru = {
1212
1210
  // src/ai/i18n/zh.js
1213
1211
  var zh = {
1214
1212
  "The AI answer could not be read. Try again.": "\u65E0\u6CD5\u8BFB\u53D6 AI \u7684\u56DE\u590D\uFF0C\u8BF7\u91CD\u8BD5\u3002",
1215
- "Rewrite with AI": "AI \u6539\u5199",
1216
1213
  "Shorter": "\u66F4\u7B80\u77ED",
1217
1214
  "Longer": "\u66F4\u8BE6\u7EC6",
1218
1215
  "Fix mistakes": "\u4FEE\u6B63\u9519\u8BEF",
@@ -1220,9 +1217,6 @@ var zh = {
1220
1217
  "More formal": "\u66F4\u6B63\u5F0F",
1221
1218
  "Translate": "\u7FFB\u8BD1",
1222
1219
  "Translate into": "\u7FFB\u8BD1\u4E3A",
1223
- "Or say what to change\u2026": "\u6216\u8005\u8BF4\u660E\u8981\u4FEE\u6539\u7684\u5185\u5BB9\u2026\u2026",
1224
- "What to change": "\u4FEE\u6539\u8981\u6C42",
1225
- "Rewrite": "\u6539\u5199",
1226
1220
  "Rewriting\u2026": "\u6B63\u5728\u6539\u5199\u2026\u2026",
1227
1221
  "Suggest subjects": "\u63A8\u8350\u4E3B\u9898",
1228
1222
  "Subject ideas": "\u4E3B\u9898\u5EFA\u8BAE",
@@ -1288,7 +1282,7 @@ var zh = {
1288
1282
  "The address and the key stay in this browser; the key is sent only to that address.": "\u5730\u5740\u548C\u5BC6\u94A5\u4EC5\u4FDD\u5B58\u5728\u6B64\u6D4F\u89C8\u5668\u4E2D\uFF1B\u5BC6\u94A5\u53EA\u4F1A\u53D1\u9001\u5230\u8BE5\u5730\u5740\u3002",
1289
1283
  "Give the API address to see its models.": "\u586B\u5199 API \u5730\u5740\u5373\u53EF\u67E5\u770B\u5176\u6A21\u578B\u3002",
1290
1284
  "The list of models could not be loaded. Type the id of the model.": "\u65E0\u6CD5\u52A0\u8F7D\u6A21\u578B\u5217\u8868\u3002\u8BF7\u8F93\u5165\u6A21\u578B\u7684 ID\u3002",
1291
- "AI looks for spelling, grammar and punctuation mistakes in every text. Nothing changes until you apply it.": "AI \u4F1A\u68C0\u67E5\u6BCF\u6BB5\u6587\u672C\u4E2D\u7684\u62FC\u5199\u3001\u8BED\u6CD5\u548C\u6807\u70B9\u9519\u8BEF\u3002\u5728\u60A8\u5E94\u7528\u4E4B\u524D\uFF0C\u4E0D\u4F1A\u505A\u4EFB\u4F55\u66F4\u6539\u3002",
1285
+ "Every text is checked for spelling, grammar and punctuation mistakes. Nothing changes until you apply it.": "\u5C06\u68C0\u67E5\u6BCF\u6BB5\u6587\u672C\u4E2D\u7684\u62FC\u5199\u3001\u8BED\u6CD5\u548C\u6807\u70B9\u9519\u8BEF\u3002\u5728\u60A8\u5E94\u7528\u4E4B\u524D\uFF0C\u4E0D\u4F1A\u505A\u4EFB\u4F55\u66F4\u6539\u3002",
1292
1286
  "Applied": "\u5DF2\u5E94\u7528",
1293
1287
  "Apply": "\u5E94\u7528",
1294
1288
  "Apply all ({count})": "\u5168\u90E8\u5E94\u7528\uFF08{count}\uFF09",
@@ -1304,12 +1298,14 @@ var zh = {
1304
1298
  "The AI answer could not be used. Try again.": "AI \u7684\u56DE\u7B54\u65E0\u6CD5\u4F7F\u7528\uFF0C\u8BF7\u91CD\u8BD5\u3002",
1305
1299
  "The AI declined this request.": "AI \u62D2\u7EDD\u4E86\u6B64\u8BF7\u6C42\u3002",
1306
1300
  "The AI declined to check this email.": "AI \u62D2\u7EDD\u68C0\u67E5\u8FD9\u5C01\u90AE\u4EF6\u3002",
1301
+ "The checker could not answer. Try again.": "\u6821\u5BF9\u670D\u52A1\u672A\u80FD\u54CD\u5E94\uFF0C\u8BF7\u91CD\u8BD5\u3002",
1302
+ "The checker is busy right now. Try again in a minute.": "\u6821\u5BF9\u670D\u52A1\u6B63\u5FD9\uFF0C\u8BF7\u4E00\u5206\u949F\u540E\u518D\u8BD5\u3002",
1307
1303
  "The answer was too long to finish. Try with less text.": "\u56DE\u7B54\u8FC7\u957F\uFF0C\u672A\u80FD\u5199\u5B8C\u3002\u8BF7\u51CF\u5C11\u6587\u672C\u540E\u91CD\u8BD5\u3002",
1308
1304
  "The email could not be checked.": "\u65E0\u6CD5\u68C0\u67E5\u8FD9\u5C01\u90AE\u4EF6\u3002",
1309
1305
  "The email has no text to check yet.": "\u90AE\u4EF6\u4E2D\u8FD8\u6CA1\u6709\u53EF\u68C0\u67E5\u7684\u6587\u672C\u3002",
1310
1306
  "The text could not be written.": "\u65E0\u6CD5\u5199\u51FA\u6587\u672C\u3002",
1311
- "What should it say? e.g. the sale ends Sunday": "\u8981\u5199\u4EC0\u4E48\uFF1F\u4F8B\u5982\uFF1A\u4FC3\u9500\u5468\u65E5\u7ED3\u675F",
1312
- "What the text is about": "\u6587\u672C\u7684\u4E3B\u9898",
1307
+ "What should it say, or what should change? e.g. the sale ends Sunday": "\u8981\u5199\u4EC0\u4E48\uFF0C\u6216\u8981\u6539\u4EC0\u4E48\uFF1F\u4F8B\u5982\uFF1A\u4FC3\u9500\u5468\u65E5\u7ED3\u675F",
1308
+ "Ask the AI": "\u8BE2\u95EE AI",
1313
1309
  "Write": "\u64B0\u5199",
1314
1310
  "Write with AI": "AI \u64B0\u5199",
1315
1311
  "Writing\u2026": "\u6B63\u5728\u64B0\u5199\u2026\u2026"
@@ -1801,6 +1797,221 @@ function agentEmailModel(options) {
1801
1797
  return Object.assign(emailModel, { url });
1802
1798
  }
1803
1799
 
1800
+ // src/ai/languagetool.js
1801
+ var LANGUAGETOOL_PUBLIC_API = "https://api.languagetool.org";
1802
+ var MAX_REQUEST = 12e3;
1803
+ var PREFERRED_VARIANTS = ["en-US", "de-DE", "pt-PT", "ca-ES"];
1804
+ var DISABLED_RULES = ["PUNCTUATION_PARAGRAPH_END"];
1805
+ var STYLE_ISSUES = /* @__PURE__ */ new Set(["style", "register"]);
1806
+ var LINE_KINDS = /* @__PURE__ */ new Set(["subject", "preheader", "button", "link"]);
1807
+ var BLOCK_END = /^<\/(p|div|li|ul|ol|h[1-6]|table|tr|td|blockquote)\b/i;
1808
+ var HTML_MARKUP = /\{\{[^{}]*\}\}|\[[^[\]\n]{1,80}\]|<[^>]*>|&(?:#\d{1,8}|#x[\da-f]{1,8}|[a-z][a-z\d]{1,30});|[ \t\r\n]{2,}|[\t\r\n]/gi;
1809
+ var PLAIN_MARKUP = /\{\{[^{}]*\}\}|\[[^[\]\n]{1,80}\]/g;
1810
+ function markupOf(markup) {
1811
+ if (markup[0] === "{" || markup[0] === "[") return { markup, as: "X" };
1812
+ if (markup[0] === "&") return { markup, as: /^&(nbsp|#160|#xa0);$/i.test(markup) ? "\xA0" : decodeEntity(markup, markup.slice(1, -1)) };
1813
+ if (markup[0] === "<") return { markup, as: /^<br\b/i.test(markup) ? "\n" : BLOCK_END.test(markup) ? "\n\n" : "" };
1814
+ return { markup, as: " " };
1815
+ }
1816
+ function partsOf(text, format) {
1817
+ const parts = [];
1818
+ let last = 0;
1819
+ for (const match of text.matchAll(format === "html" ? HTML_MARKUP : PLAIN_MARKUP)) {
1820
+ const at = (
1821
+ /** @type {number} */
1822
+ match.index
1823
+ );
1824
+ if (at > last) parts.push({ text: text.slice(last, at) });
1825
+ parts.push(markupOf(match[0]));
1826
+ last = at + match[0].length;
1827
+ }
1828
+ if (last < text.length) parts.push({ text: text.slice(last) });
1829
+ return parts;
1830
+ }
1831
+ function documentOf(texts) {
1832
+ const annotation = [];
1833
+ const starts = [];
1834
+ const place = [];
1835
+ const word = [];
1836
+ const owner = [];
1837
+ let read = "";
1838
+ let at = 0;
1839
+ const add = (part, text) => {
1840
+ const isWord = "text" in part;
1841
+ const seen = isWord ? part.text : part.as;
1842
+ annotation.push(isWord ? { text: part.text } : { markup: part.markup, interpretAs: part.as });
1843
+ for (let i = 0; i < seen.length; i += 1) {
1844
+ place.push(isWord ? at + i : at);
1845
+ word.push(isWord);
1846
+ owner.push(text);
1847
+ }
1848
+ read += seen;
1849
+ at += isWord ? part.text.length : part.markup.length;
1850
+ };
1851
+ texts.forEach((item, index) => {
1852
+ if (index) add({ markup: "\n\n", as: "\n\n" }, -1);
1853
+ starts.push(at);
1854
+ for (const part of partsOf(item.text, item.format)) add(part, index);
1855
+ });
1856
+ return { annotation, starts, place, word, owner, read };
1857
+ }
1858
+ function distance(a, b) {
1859
+ const rows = Array.from({ length: a.length + 1 }, (_, i) => [i, ...Array(b.length).fill(0)]);
1860
+ for (let j = 1; j <= b.length; j += 1) rows[0][j] = j;
1861
+ for (let i = 1; i <= a.length; i += 1) {
1862
+ for (let j = 1; j <= b.length; j += 1) {
1863
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
1864
+ rows[i][j] = Math.min(rows[i - 1][j] + 1, rows[i][j - 1] + 1, rows[i - 1][j - 1] + cost);
1865
+ if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) rows[i][j] = Math.min(rows[i][j], rows[i - 2][j - 2] + 1);
1866
+ }
1867
+ }
1868
+ return rows[a.length][b.length];
1869
+ }
1870
+ function suggestionFor(match, word, ignored) {
1871
+ const values = (Array.isArray(match?.replacements) ? match.replacements : []).map((item) => item?.value).filter((value) => typeof value === "string");
1872
+ if (!values.length || STYLE_ISSUES.has(match?.rule?.issueType)) return null;
1873
+ let [best] = values;
1874
+ if (match.rule?.issueType !== "misspelling") return best;
1875
+ const lower = word.toLowerCase();
1876
+ if (ignored.has(lower) || /\d/.test(word) || /^\p{Lu}[\p{Lu}\d]+$/u.test(word)) return null;
1877
+ if (best.replace(/[\s'’-]/g, "").toLowerCase() === lower.replace(/[\s'’-]/g, "") && /[\s'’-]/.test(best)) {
1878
+ const near = values.slice(1, 3).find((value) => !/\s/.test(value) && value[0]?.toLowerCase() === lower[0] && distance(value.toLowerCase(), lower) === 1);
1879
+ if (near) best = near;
1880
+ }
1881
+ if (/^\p{Lu}/u.test(word) && (best[0]?.toLowerCase() !== lower[0] || distance(best.toLowerCase(), lower) > 1)) return null;
1882
+ return best;
1883
+ }
1884
+ var escapeHtml = (text) => text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1885
+ function editOf(doc, match, ignored, texts) {
1886
+ const offset = Number(match?.offset);
1887
+ const length = Number(match?.length);
1888
+ if (!Number.isInteger(offset) || !Number.isInteger(length) || offset < 0 || length <= 0) return null;
1889
+ const { place, word, owner, read, starts } = doc;
1890
+ let first = 0;
1891
+ while (first < read.length && place[first] < offset) first += 1;
1892
+ let last = first;
1893
+ while (last < read.length && place[last] < offset + length) last += 1;
1894
+ const flagged = read.slice(first, last);
1895
+ const text = owner[first];
1896
+ if (!flagged || text === void 0 || text < 0 || owner.slice(first, last).some((o) => o !== text)) return null;
1897
+ const item = texts[text];
1898
+ if (match?.rule?.id === "UPPERCASE_SENTENCE_START" && LINE_KINDS.has(item.kind)) return null;
1899
+ const suggestion = suggestionFor(match, flagged.trim(), ignored);
1900
+ if (suggestion === null || suggestion === flagged) return null;
1901
+ let head = 0;
1902
+ while (head < flagged.length && head < suggestion.length && flagged[head] === suggestion[head]) head += 1;
1903
+ let tail = 0;
1904
+ while (tail < flagged.length - head && tail < suggestion.length - head && flagged[flagged.length - 1 - tail] === suggestion[suggestion.length - 1 - tail]) tail += 1;
1905
+ const from = first + head;
1906
+ const to = first + flagged.length - tail;
1907
+ const insert = suggestion.slice(head, suggestion.length - tail);
1908
+ for (let i = from; i < to; i += 1) {
1909
+ if (!word[i] || i > from && place[i] !== place[i - 1] + 1) return null;
1910
+ }
1911
+ const glued = (i) => i >= 0 && i < read.length && !word[i] && /[\p{L}\p{N}]/u.test(read[i]);
1912
+ if (glued(from - 1) || glued(to)) return null;
1913
+ let at;
1914
+ if (to > from) at = place[from];
1915
+ else if (from > 0 && word[from - 1]) at = place[from - 1] + 1;
1916
+ else if (from < read.length && word[from]) at = place[from];
1917
+ else return null;
1918
+ const start = at - starts[text];
1919
+ const end = start + (to - from);
1920
+ return { text, from: start, to: end, insert: item.format === "html" ? escapeHtml(insert) : insert };
1921
+ }
1922
+ function createLanguageToolProofreader(options) {
1923
+ const {
1924
+ url,
1925
+ fetch: fetchImpl = globalThis.fetch,
1926
+ headers = {},
1927
+ language = "auto",
1928
+ preferredVariants = PREFERRED_VARIANTS,
1929
+ level = "default",
1930
+ disabledRules = [],
1931
+ ignoreWords = [],
1932
+ username,
1933
+ apiKey
1934
+ } = (
1935
+ /** @type {LanguageToolOptions} */
1936
+ options || {}
1937
+ );
1938
+ if (typeof url !== "string" || !/^https?:\/\//.test(url)) {
1939
+ throw new TypeError("createLanguageToolProofreader: `url` is a LanguageTool server \u2014 your own, or LANGUAGETOOL_PUBLIC_API to try it out");
1940
+ }
1941
+ if (typeof fetchImpl !== "function") throw new TypeError("createLanguageToolProofreader: no `fetch` here \u2014 pass one");
1942
+ if (Boolean(username) !== Boolean(apiKey)) throw new TypeError("createLanguageToolProofreader: `username` and `apiKey` go together");
1943
+ const endpoint = /\/v2\/check\/?$/.test(url) ? url : `${url.replace(/\/+$/, "")}/v2/check`;
1944
+ const ignored = new Set(ignoreWords.map((word) => String(word).toLowerCase()));
1945
+ const disabled = [...DISABLED_RULES, ...disabledRules].join(",");
1946
+ const check = async (annotation, preferred, signal) => {
1947
+ const body = new URLSearchParams({ data: JSON.stringify({ annotation }), language, level, disabledRules: disabled });
1948
+ if (language === "auto") {
1949
+ body.set("preferredVariants", preferredVariants.join(","));
1950
+ body.set("preferredLanguages", preferred);
1951
+ }
1952
+ if (username && apiKey) {
1953
+ body.set("username", username);
1954
+ body.set("apiKey", apiKey);
1955
+ }
1956
+ let response;
1957
+ try {
1958
+ response = await fetchImpl(endpoint, { method: "POST", headers: { Accept: "application/json", ...headers }, body, signal });
1959
+ } catch (error) {
1960
+ if (signal?.aborted) throw error;
1961
+ throw new EmailGenerationError("CHECKER_UNAVAILABLE", `LanguageTool: ${/** @type {any} */
1962
+ error?.message || error}`);
1963
+ }
1964
+ if (response.status === 429) throw new EmailGenerationError("CHECKER_BUSY");
1965
+ if (!response.ok) {
1966
+ const detail = await response.text().catch(() => "");
1967
+ throw new EmailGenerationError("CHECKER_UNAVAILABLE", `LanguageTool: HTTP ${response.status} ${detail}`.slice(0, 300));
1968
+ }
1969
+ try {
1970
+ const data = await response.json();
1971
+ return Array.isArray(data?.matches) ? data.matches : [];
1972
+ } catch {
1973
+ throw new EmailGenerationError("CHECKER_UNAVAILABLE", "LanguageTool: the answer is not JSON");
1974
+ }
1975
+ };
1976
+ return async function proofread(input, { signal } = {}) {
1977
+ const request = cleanProofreadInput(input);
1978
+ const batches = [[]];
1979
+ let size = 0;
1980
+ for (const item of request.texts) {
1981
+ if (size && size + item.text.length > MAX_REQUEST) {
1982
+ batches.push([]);
1983
+ size = 0;
1984
+ }
1985
+ batches[batches.length - 1].push(item);
1986
+ size += item.text.length + 2;
1987
+ }
1988
+ const corrected = /* @__PURE__ */ new Map();
1989
+ for (const texts of batches) {
1990
+ signal?.throwIfAborted();
1991
+ const doc = documentOf(texts);
1992
+ const matches = await check(doc.annotation, request.language.slice(0, 2), signal);
1993
+ const edits = /* @__PURE__ */ new Map();
1994
+ for (const match of matches) {
1995
+ const edit = editOf(doc, match, ignored, texts);
1996
+ if (!edit) continue;
1997
+ const list = edits.get(edit.text) || [];
1998
+ if (list.some((other) => edit.from < other.to && other.from < edit.to || edit.from === other.from)) continue;
1999
+ list.push(edit);
2000
+ edits.set(edit.text, list);
2001
+ }
2002
+ for (const [index, list] of edits) {
2003
+ let text = texts[index].text;
2004
+ for (const edit of list.sort((a, b) => b.from - a.from)) text = text.slice(0, edit.from) + edit.insert + text.slice(edit.to);
2005
+ if (text !== texts[index].text) corrected.set(texts[index].id, text);
2006
+ }
2007
+ }
2008
+ return { fixes: request.texts.filter(({ id }) => corrected.has(id)).map(({ id }) => ({ id, text: (
2009
+ /** @type {string} */
2010
+ corrected.get(id)
2011
+ ) })) };
2012
+ };
2013
+ }
2014
+
1804
2015
  export {
1805
2016
  GENERATION_ERRORS,
1806
2017
  EmailGenerationError,
@@ -1831,6 +2042,8 @@ export {
1831
2042
  claudeProvider,
1832
2043
  AGENT_PROTOCOL,
1833
2044
  AGENT_ERROR_CODES,
1834
- agentEmailModel
2045
+ agentEmailModel,
2046
+ LANGUAGETOOL_PUBLIC_API,
2047
+ createLanguageToolProofreader
1835
2048
  };
1836
- //# sourceMappingURL=chunk-XXUYQ5BX.js.map
2049
+ //# sourceMappingURL=chunk-6OR6W4KJ.js.map