@templatical/editor 0.52.1 → 0.54.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 (397) hide show
  1. package/README.md +1 -1
  2. package/dist/AiAltTextPopover-NMJqQKvD.js +106 -0
  3. package/dist/{AiAltTextReview-9ySsXOTU.js → AiAltTextReview-Ci4zHwRc.js} +68 -66
  4. package/dist/AiChatPanel-C8SeEJRP.js +561 -0
  5. package/dist/{AiPanels-DqT4PgQ0.js → AiPanels-CR6zphjP.js} +6 -6
  6. package/dist/{AiRewriteMenu-28agTycW.js → AiRewriteMenu-CIHUnPud.js} +76 -105
  7. package/dist/BlockIssueBadge-DaPTq1RE.js +33 -0
  8. package/dist/BlockPreviewCanvas-B70RSavL.js +140 -0
  9. package/dist/{CloudHeaderExtras-QI82yF54.js → CloudHeaderExtras-XpjJjn3o.js} +4 -4
  10. package/dist/{CloudPanels-BKJaLkUN.js → CloudPanels-VpSQiLLL.js} +53 -53
  11. package/dist/CollaborationNotices-Cnx0XHzZ.js +65 -0
  12. package/dist/{CollaboratorBar-CXQqN3VP.js → CollaboratorBar-BaBoNhwB.js} +24 -24
  13. package/dist/CommentsPanel-Ck3QmqiC.js +16 -0
  14. package/dist/CommentsSidebar-CHknhOar.js +526 -0
  15. package/dist/{CountdownBlock-CU2yTWtF.js → CountdownBlock-BMezkFbJ.js} +15 -15
  16. package/dist/CountdownToolbar-CM4XNEuO.js +258 -0
  17. package/dist/IssuesPanel-1wGV0wiy.js +371 -0
  18. package/dist/LanguageMenu-d2GlX67r.js +403 -0
  19. package/dist/{LoadingTrack-DM4g6j7b.js → LoadingTrack-BG8cg9xi.js} +2 -2
  20. package/dist/LocaleNotices-WzsYtBRs.js +46 -0
  21. package/dist/LogicTagInsertButton-DgTJ6Lvx.js +1096 -0
  22. package/dist/{MediaEditModal-Dy08GEwE.js → MediaEditModal-C3U9Mi31.js} +451 -451
  23. package/dist/{MediaPanels-BgEp7iCp.js → MediaPanels-CGmk9ufe.js} +4 -4
  24. package/dist/{MergeTagInput-B9dtUthD.js → MergeTagInput-B_51YcQO.js} +30 -30
  25. package/dist/{MergeTagModeToggle-DxujhYJ4.js → MergeTagModeToggle-D3Q2z317.js} +49 -49
  26. package/dist/MergeTagTextarea-DZz1L9DE.js +126 -0
  27. package/dist/ParagraphEditor-CI68PYDL.js +825 -0
  28. package/dist/{RestoreVersionDialog-C4s_JYCx.js → RestoreVersionDialog-DcuhpOIz.js} +23 -23
  29. package/dist/{RichTextEditorContent-o6HmE8GR.js → RichTextEditorContent-Dstovi0m.js} +47 -47
  30. package/dist/{SaveBlockDialog-CWLrly6l.js → SaveBlockDialog-vuwvoi-d.js} +86 -86
  31. package/dist/{cdn/chunks/SavedBlocksBrowserModal-BPYcRoGa.js → SavedBlocksBrowserModal-DUJm0dOv.js} +135 -132
  32. package/dist/{SavedBlocksPanels-BE1N9rNZ.js → SavedBlocksPanels-BiMXQ5lY.js} +9 -9
  33. package/dist/{SavedBlocksPickBar-Dwl94xhP.js → SavedBlocksPickBar-CAstZfG7.js} +15 -15
  34. package/dist/TemplateSettings-Baar78_s.js +294 -0
  35. package/dist/TestEmailModal-Bl_GHdrN.js +212 -0
  36. package/dist/{TestEmailPanel-DaFjP9QK.js → TestEmailPanel-CpTBF7B5.js} +4 -4
  37. package/dist/TitleEditor-DkbEDAZB.js +202 -0
  38. package/dist/ToggleSwitch-R3wCCYE6.js +43 -0
  39. package/dist/Toolbar-bOZ_eq7X.js +3711 -0
  40. package/dist/{TplModal-DLMssVlt.js → TplModal-wk2gLa7_.js} +17 -17
  41. package/dist/{VersionHistoryMenu-BkbYUs0Q.js → VersionHistoryMenu-BnP0EyLl.js} +39 -39
  42. package/dist/{VersionHistoryPanels-DP7HaYWv.js → VersionHistoryPanels-Cq2rFKIX.js} +5 -5
  43. package/dist/VersionPreviewBanner-BPP939cD.js +37 -0
  44. package/dist/WrapperBlock-cWT_nZgQ.js +44 -0
  45. package/dist/{blockTypeIcons-BHjlPnPf.js → blockTypeIcons-BUyPZ7Su.js} +7 -7
  46. package/dist/bundle-stats.json +8 -8
  47. package/dist/{cdn/chunks/ca-CD-Kt1qz.js → ca-DOuIxWRv.js} +114 -2
  48. package/dist/cdn/chunks/AiAltTextPopover-Cnc_kUmb.js +107 -0
  49. package/dist/cdn/chunks/AiAltTextPopover-Cnc_kUmb.js.map +1 -0
  50. package/dist/cdn/chunks/{AiAltTextReview-BGLLSKLm.js → AiAltTextReview-DPeSY-7r.js} +70 -68
  51. package/dist/cdn/chunks/AiAltTextReview-DPeSY-7r.js.map +1 -0
  52. package/dist/cdn/chunks/AiChatPanel-By8Uo1nH.js +487 -0
  53. package/dist/cdn/chunks/AiChatPanel-By8Uo1nH.js.map +1 -0
  54. package/dist/cdn/chunks/{AiPanels-0wBarZSH.js → AiPanels-BblCSkQy.js} +11 -11
  55. package/dist/cdn/chunks/{AiPanels-0wBarZSH.js.map → AiPanels-BblCSkQy.js.map} +1 -1
  56. package/dist/cdn/chunks/{AiRewriteMenu-qf-cfEpy.js → AiRewriteMenu-C4btyN4W.js} +79 -79
  57. package/dist/cdn/chunks/AiRewriteMenu-C4btyN4W.js.map +1 -0
  58. package/dist/cdn/chunks/BlockIssueBadge-D3Plo_wt.js +34 -0
  59. package/dist/cdn/chunks/BlockIssueBadge-D3Plo_wt.js.map +1 -0
  60. package/dist/cdn/chunks/BlockPreviewCanvas-CTKmBPsq.js +142 -0
  61. package/dist/cdn/chunks/{BlockPreviewCanvas-DGBh6mqe.js.map → BlockPreviewCanvas-CTKmBPsq.js.map} +1 -1
  62. package/dist/cdn/chunks/{CloudHeaderExtras-BMNK_F9p.js → CloudHeaderExtras-BtqdN777.js} +4 -4
  63. package/dist/cdn/chunks/{CloudHeaderExtras-BMNK_F9p.js.map → CloudHeaderExtras-BtqdN777.js.map} +1 -1
  64. package/dist/cdn/chunks/{CloudPanels-JMWIoVWh.js → CloudPanels-COU26R83.js} +45 -45
  65. package/dist/cdn/chunks/{CloudPanels-JMWIoVWh.js.map → CloudPanels-COU26R83.js.map} +1 -1
  66. package/dist/cdn/chunks/CollaborationNotices-DraFUhyo.js +67 -0
  67. package/dist/cdn/chunks/CollaborationNotices-DraFUhyo.js.map +1 -0
  68. package/dist/cdn/chunks/{CollaboratorBar-CXByAoUz.js → CollaboratorBar-0OEH3hrj.js} +17 -17
  69. package/dist/cdn/chunks/{CollaboratorBar-CXByAoUz.js.map → CollaboratorBar-0OEH3hrj.js.map} +1 -1
  70. package/dist/cdn/chunks/CommentsPanel-tZZswofV.js +18 -0
  71. package/dist/cdn/chunks/{CommentsPanel-DoJnKLXI.js.map → CommentsPanel-tZZswofV.js.map} +1 -1
  72. package/dist/cdn/chunks/CommentsSidebar-7Hfl3Hdj.js +496 -0
  73. package/dist/cdn/chunks/CommentsSidebar-7Hfl3Hdj.js.map +1 -0
  74. package/dist/cdn/chunks/{CountdownBlock-BqRw147R.js → CountdownBlock-CjMhMhnv.js} +22 -22
  75. package/dist/cdn/chunks/{CountdownBlock-BqRw147R.js.map → CountdownBlock-CjMhMhnv.js.map} +1 -1
  76. package/dist/cdn/chunks/CountdownToolbar-CNgsNL5-.js +260 -0
  77. package/dist/cdn/chunks/CountdownToolbar-CNgsNL5-.js.map +1 -0
  78. package/dist/cdn/chunks/{IssuesPanel-C7LfxaAY.js → IssuesPanel-Duic0mIs.js} +133 -121
  79. package/dist/cdn/chunks/IssuesPanel-Duic0mIs.js.map +1 -0
  80. package/dist/cdn/chunks/LanguageMenu-B1Aue_lf.js +359 -0
  81. package/dist/cdn/chunks/LanguageMenu-B1Aue_lf.js.map +1 -0
  82. package/dist/cdn/chunks/{LoadingTrack-CZuLTazv.js → LoadingTrack-DUYcDHOV.js} +2 -2
  83. package/dist/cdn/chunks/{LoadingTrack-CZuLTazv.js.map → LoadingTrack-DUYcDHOV.js.map} +1 -1
  84. package/dist/cdn/chunks/LocaleNotices-8J2DRWeg.js +47 -0
  85. package/dist/cdn/chunks/LocaleNotices-8J2DRWeg.js.map +1 -0
  86. package/dist/{LogicTagInsertButton-CfscnwCn.js → cdn/chunks/LogicTagInsertButton-Bhvi0nWz.js} +422 -449
  87. package/dist/cdn/chunks/LogicTagInsertButton-Bhvi0nWz.js.map +1 -0
  88. package/dist/cdn/chunks/{MediaEditModal-Cpcod6_U.js → MediaEditModal-Dz972UFx.js} +421 -421
  89. package/dist/cdn/chunks/MediaEditModal-Dz972UFx.js.map +1 -0
  90. package/dist/cdn/chunks/{MediaPanels-BIdcW_1f.js → MediaPanels-C6Hqtp1H.js} +5 -5
  91. package/dist/cdn/chunks/{MediaPanels-BIdcW_1f.js.map → MediaPanels-C6Hqtp1H.js.map} +1 -1
  92. package/dist/cdn/chunks/{MergeTagInput-BvWg8o5E.js → MergeTagInput-CrhZm-AW.js} +28 -28
  93. package/dist/cdn/chunks/{MergeTagInput-BvWg8o5E.js.map → MergeTagInput-CrhZm-AW.js.map} +1 -1
  94. package/dist/cdn/chunks/{MergeTagModeToggle-BgKEVUtV.js → MergeTagModeToggle-CWVtXLYa.js} +52 -52
  95. package/dist/cdn/chunks/MergeTagModeToggle-CWVtXLYa.js.map +1 -0
  96. package/dist/cdn/chunks/MergeTagTextarea-hTIBwX0F.js +128 -0
  97. package/dist/cdn/chunks/MergeTagTextarea-hTIBwX0F.js.map +1 -0
  98. package/dist/cdn/chunks/ParagraphEditor-B2UU1Q5I.js +660 -0
  99. package/dist/cdn/chunks/ParagraphEditor-B2UU1Q5I.js.map +1 -0
  100. package/dist/cdn/chunks/{RestoreVersionDialog-CjOdD2xj.js → RestoreVersionDialog-C1Y5Ewo_.js} +22 -22
  101. package/dist/cdn/chunks/{RestoreVersionDialog-CjOdD2xj.js.map → RestoreVersionDialog-C1Y5Ewo_.js.map} +1 -1
  102. package/dist/cdn/chunks/{RichTextEditorContent-DNjR_sNN.js → RichTextEditorContent-up4AqL7D.js} +44 -44
  103. package/dist/cdn/chunks/{RichTextEditorContent-DNjR_sNN.js.map → RichTextEditorContent-up4AqL7D.js.map} +1 -1
  104. package/dist/cdn/chunks/{SaveBlockDialog-CUhpawq0.js → SaveBlockDialog-B9lwEP_T.js} +77 -77
  105. package/dist/cdn/chunks/{SaveBlockDialog-CUhpawq0.js.map → SaveBlockDialog-B9lwEP_T.js.map} +1 -1
  106. package/dist/{SavedBlocksBrowserModal-CE8n4EBS.js → cdn/chunks/SavedBlocksBrowserModal-fAeHUyxb.js} +103 -106
  107. package/dist/cdn/chunks/{SavedBlocksBrowserModal-BPYcRoGa.js.map → SavedBlocksBrowserModal-fAeHUyxb.js.map} +1 -1
  108. package/dist/cdn/chunks/{SavedBlocksPanels-C6--Bc81.js → SavedBlocksPanels-DRDTLDyZ.js} +9 -9
  109. package/dist/cdn/chunks/{SavedBlocksPanels-C6--Bc81.js.map → SavedBlocksPanels-DRDTLDyZ.js.map} +1 -1
  110. package/dist/cdn/chunks/{SavedBlocksPickBar-DUavxpbU.js → SavedBlocksPickBar-B6b5z-o3.js} +16 -16
  111. package/dist/cdn/chunks/{SavedBlocksPickBar-DUavxpbU.js.map → SavedBlocksPickBar-B6b5z-o3.js.map} +1 -1
  112. package/dist/cdn/chunks/TemplateSettings-CWUpUKJb.js +266 -0
  113. package/dist/cdn/chunks/TemplateSettings-CWUpUKJb.js.map +1 -0
  114. package/dist/cdn/chunks/TestEmailModal-DQxnW5Q5.js +212 -0
  115. package/dist/cdn/chunks/TestEmailModal-DQxnW5Q5.js.map +1 -0
  116. package/dist/cdn/chunks/{TestEmailPanel-CcUpEpAn.js → TestEmailPanel-BcO_-16H.js} +5 -5
  117. package/dist/cdn/chunks/{TestEmailPanel-CcUpEpAn.js.map → TestEmailPanel-BcO_-16H.js.map} +1 -1
  118. package/dist/cdn/chunks/TitleEditor-pmycpmTd.js +202 -0
  119. package/dist/cdn/chunks/TitleEditor-pmycpmTd.js.map +1 -0
  120. package/dist/cdn/chunks/ToggleSwitch-BSkySwA1.js +45 -0
  121. package/dist/cdn/chunks/ToggleSwitch-BSkySwA1.js.map +1 -0
  122. package/dist/cdn/chunks/Toolbar-BlWVQRcA.js +3626 -0
  123. package/dist/cdn/chunks/Toolbar-BlWVQRcA.js.map +1 -0
  124. package/dist/cdn/chunks/{TplModal-CFPDgbwQ.js → TplModal-ClSSGX7a.js} +20 -20
  125. package/dist/cdn/chunks/{TplModal-CFPDgbwQ.js.map → TplModal-ClSSGX7a.js.map} +1 -1
  126. package/dist/cdn/chunks/{VersionHistoryMenu-BYlLRvRJ.js → VersionHistoryMenu-CZury5gU.js} +33 -33
  127. package/dist/cdn/chunks/{VersionHistoryMenu-BYlLRvRJ.js.map → VersionHistoryMenu-CZury5gU.js.map} +1 -1
  128. package/dist/cdn/chunks/{VersionHistoryPanels-C6SOVoiT.js → VersionHistoryPanels-B8GPBKMq.js} +6 -6
  129. package/dist/cdn/chunks/{VersionHistoryPanels-C6SOVoiT.js.map → VersionHistoryPanels-B8GPBKMq.js.map} +1 -1
  130. package/dist/cdn/chunks/VersionPreviewBanner-C4Ji8nu4.js +39 -0
  131. package/dist/cdn/chunks/VersionPreviewBanner-C4Ji8nu4.js.map +1 -0
  132. package/dist/cdn/chunks/WrapperBlock-BoUflYwY.js +46 -0
  133. package/dist/cdn/chunks/WrapperBlock-BoUflYwY.js.map +1 -0
  134. package/dist/cdn/chunks/{blockTypeIcons-D7FW7Ypo.js → blockTypeIcons-Cc6RJ27V.js} +5 -5
  135. package/dist/cdn/chunks/{blockTypeIcons-D7FW7Ypo.js.map → blockTypeIcons-Cc6RJ27V.js.map} +1 -1
  136. package/dist/{ca-CD-Kt1qz.js → cdn/chunks/ca-DOuIxWRv.js} +116 -0
  137. package/dist/cdn/chunks/ca-DOuIxWRv.js.map +1 -0
  138. package/dist/cdn/chunks/composables-C1KU4ZHw.js +3039 -0
  139. package/dist/cdn/chunks/composables-C1KU4ZHw.js.map +1 -0
  140. package/dist/cdn/chunks/{createCloudRuntime-Cth2JCEh.js → createCloudRuntime-C2Zs5F1O.js} +75 -73
  141. package/dist/cdn/chunks/createCloudRuntime-C2Zs5F1O.js.map +1 -0
  142. package/dist/{de-CeFJ6wbM.js → cdn/chunks/de-DaOUfYBX.js} +116 -0
  143. package/dist/cdn/chunks/de-DaOUfYBX.js.map +1 -0
  144. package/dist/cdn/chunks/{dist-8ym3y-pH.js → dist-BzXULHvI.js} +48 -48
  145. package/dist/cdn/chunks/{dist-8ym3y-pH.js.map → dist-BzXULHvI.js.map} +1 -1
  146. package/dist/cdn/chunks/{dist-BMzNabtD.js → dist-DqGgijFI.js} +114 -114
  147. package/dist/cdn/chunks/{dist-BMzNabtD.js.map → dist-DqGgijFI.js.map} +1 -1
  148. package/dist/cdn/chunks/{draggable-Du8AUMFT.js → draggable-DepKdldn.js} +1491 -1486
  149. package/dist/cdn/chunks/draggable-DepKdldn.js.map +1 -0
  150. package/dist/cdn/chunks/{editor-modal-CyCe560f.js → editor-modal-erQEOHZN.js} +781 -781
  151. package/dist/cdn/chunks/{editor-modal-CyCe560f.js.map → editor-modal-erQEOHZN.js.map} +1 -1
  152. package/dist/cdn/chunks/en-B6tLGRHq.js +1 -0
  153. package/dist/{en-D14i5nFh.js → cdn/chunks/en-C0pHHMiR.js} +116 -0
  154. package/dist/cdn/chunks/en-C0pHHMiR.js.map +1 -0
  155. package/dist/{es-zDacbMhs.js → cdn/chunks/es-CxyEKr6n.js} +116 -0
  156. package/dist/cdn/chunks/es-CxyEKr6n.js.map +1 -0
  157. package/dist/cdn/chunks/{extensions-CFF2KWy-.js → extensions-DcMKZpzh.js} +59 -59
  158. package/dist/cdn/chunks/{extensions-CFF2KWy-.js.map → extensions-DcMKZpzh.js.map} +1 -1
  159. package/dist/{fr-CSgYtjOd.js → cdn/chunks/fr-CYbamiI6.js} +116 -0
  160. package/dist/cdn/chunks/fr-CYbamiI6.js.map +1 -0
  161. package/dist/cdn/chunks/{icons-okSPsLOa.js → icons-Da9GKjPx.js} +188 -147
  162. package/dist/cdn/chunks/icons-Da9GKjPx.js.map +1 -0
  163. package/dist/{ja-B7H3ID8O.js → cdn/chunks/ja-DfaIAoGI.js} +116 -0
  164. package/dist/cdn/chunks/ja-DfaIAoGI.js.map +1 -0
  165. package/dist/cdn/chunks/keys-CoQtCqNv.js +11 -0
  166. package/dist/cdn/chunks/keys-CoQtCqNv.js.map +1 -0
  167. package/dist/cdn/chunks/languageName-DEEOhDWI.js +12 -0
  168. package/dist/cdn/chunks/languageName-DEEOhDWI.js.map +1 -0
  169. package/dist/{nl-176ySmc5.js → cdn/chunks/nl-DkrB-VKZ.js} +116 -0
  170. package/dist/cdn/chunks/nl-DkrB-VKZ.js.map +1 -0
  171. package/dist/cdn/chunks/normalizeMergeTagMarkup-cC32Ox6A.js +290 -0
  172. package/dist/cdn/chunks/normalizeMergeTagMarkup-cC32Ox6A.js.map +1 -0
  173. package/dist/cdn/chunks/noticeTones-D7BPu-Le.js +16 -0
  174. package/dist/cdn/chunks/noticeTones-D7BPu-Le.js.map +1 -0
  175. package/dist/cdn/chunks/plural-CyxrJXL1.js +17 -0
  176. package/dist/cdn/chunks/plural-CyxrJXL1.js.map +1 -0
  177. package/dist/{preRenderCustomBlocks--_xc0XK3.js → cdn/chunks/preRenderCustomBlocks-f7GEKdvw.js} +5 -3
  178. package/dist/cdn/chunks/{preRenderCustomBlocks-BcXIz7oJ.js.map → preRenderCustomBlocks-f7GEKdvw.js.map} +1 -1
  179. package/dist/{pt-BR-dDlTwX18.js → cdn/chunks/pt-BR-CY5Ye7eP.js} +116 -0
  180. package/dist/cdn/chunks/pt-BR-CY5Ye7eP.js.map +1 -0
  181. package/dist/cdn/chunks/sanitizeHtml-WTfz9lZd.js +61 -0
  182. package/dist/cdn/chunks/sanitizeHtml-WTfz9lZd.js.map +1 -0
  183. package/dist/cdn/chunks/socialIcons-DeCYorUT.js +2638 -0
  184. package/dist/cdn/chunks/socialIcons-DeCYorUT.js.map +1 -0
  185. package/dist/cdn/chunks/{src-DEd87i_U.js → src-A_cKeTM_.js} +618 -461
  186. package/dist/cdn/chunks/src-A_cKeTM_.js.map +1 -0
  187. package/dist/cdn/chunks/src-BQUv2CYU.js +2606 -0
  188. package/dist/cdn/chunks/src-BQUv2CYU.js.map +1 -0
  189. package/dist/cdn/chunks/src-BWX_xVxO.js +671 -0
  190. package/dist/cdn/chunks/src-BWX_xVxO.js.map +1 -0
  191. package/dist/{styleConstants-B8xVRiwX.js → cdn/chunks/styleConstants-CgiNKdnc.js} +7 -5
  192. package/dist/cdn/chunks/styleConstants-CgiNKdnc.js.map +1 -0
  193. package/dist/cdn/chunks/templateSettingsFields-cjlP-jdw.js.map +1 -1
  194. package/dist/cdn/chunks/{tiptap-CbiTlECY.js → tiptap-Dipw_zOQ.js} +40 -40
  195. package/dist/cdn/chunks/{tiptap-CbiTlECY.js.map → tiptap-Dipw_zOQ.js.map} +1 -1
  196. package/dist/cdn/chunks/{useCloudI18n-DY8_-ETE.js → useCloudI18n-Cc5NZqiI.js} +3 -3
  197. package/dist/cdn/chunks/{useCloudI18n-DY8_-ETE.js.map → useCloudI18n-Cc5NZqiI.js.map} +1 -1
  198. package/dist/cdn/chunks/useEditorRoot-D_LuZ_hE.js +9 -0
  199. package/dist/cdn/chunks/{useEditorRoot-vjZJwKrV.js.map → useEditorRoot-D_LuZ_hE.js.map} +1 -1
  200. package/dist/cdn/chunks/{useI18n-D8pY4LTq.js → useI18n-BnJYydPv.js} +3 -3
  201. package/dist/cdn/chunks/{useI18n-D8pY4LTq.js.map → useI18n-BnJYydPv.js.map} +1 -1
  202. package/dist/cdn/chunks/useLocalizedDisplay-aGfnO90D.js +33 -0
  203. package/dist/cdn/chunks/useLocalizedDisplay-aGfnO90D.js.map +1 -0
  204. package/dist/cdn/chunks/{useLogicTag-DBJDtpKA.js → useLogicTag-DtYe8HIq.js} +5 -5
  205. package/dist/cdn/chunks/{useLogicTag-DBJDtpKA.js.map → useLogicTag-DtYe8HIq.js.map} +1 -1
  206. package/dist/cdn/chunks/{useMergeTag-B-aG--s1.js → useMergeTag-B8ULmsnp.js} +6 -6
  207. package/dist/cdn/chunks/{useMergeTag-B-aG--s1.js.map → useMergeTag-B8ULmsnp.js.map} +1 -1
  208. package/dist/cdn/chunks/usePopoverPosition-BWAXWeBv.js +78 -0
  209. package/dist/cdn/chunks/usePopoverPosition-BWAXWeBv.js.map +1 -0
  210. package/dist/cdn/chunks/{useScrollToBlock-vjQ0fe-L.js → useScrollToBlock-Ct1AwLD-.js} +5 -5
  211. package/dist/cdn/chunks/useScrollToBlock-Ct1AwLD-.js.map +1 -0
  212. package/dist/cdn/chunks/{withCurrentFont-hZTvYBHO.js → withCurrentFont-MK8ga9q9.js} +2 -2
  213. package/dist/cdn/chunks/{withCurrentFont-hZTvYBHO.js.map → withCurrentFont-MK8ga9q9.js.map} +1 -1
  214. package/dist/cdn/editor.css +1 -1
  215. package/dist/cdn/editor.js +2189 -1495
  216. package/dist/cdn/editor.js.map +1 -1
  217. package/dist/{check-BZ8o0eet.js → check-XMnOOIEC.js} +1 -1
  218. package/dist/{chevron-down-DfAAfILv.js → chevron-down-DmamTEWQ.js} +1 -1
  219. package/dist/{chevron-right-Bk4mGdr7.js → chevron-right-BEFXOH27.js} +1 -1
  220. package/dist/{chevron-up-MhUf_azW.js → chevron-up-Dw7woXj8.js} +1 -1
  221. package/dist/{circle-alert-CShJwVFv.js → circle-alert-BTKC9vkq.js} +1 -1
  222. package/dist/{clock-CTfD6OCt.js → clock-BVT5u2uG.js} +1 -1
  223. package/dist/composables-CMIrGXJ1.js +4517 -0
  224. package/dist/{createCloudRuntime-DCgO4A1r.js → createCloudRuntime-DGV5a5Af.js} +54 -52
  225. package/dist/{createLucideIcon-CvhTA2KG.js → createLucideIcon-CgDE3xAR.js} +16 -16
  226. package/dist/{cdn/chunks/de-CeFJ6wbM.js → de-DaOUfYBX.js} +114 -2
  227. package/dist/{dist-ByCWA2Tv.js → dist-0alKVRc_.js} +101 -101
  228. package/dist/{dist-Cy8I5scI.js → dist-54VCNoC0.js} +2 -2
  229. package/dist/dist-6DU0me3E.js +4 -0
  230. package/dist/{dist-p3wymUDt.js → dist-B8dY8drK.js} +2 -2
  231. package/dist/{dist-Dd5MU2Ev.js → dist-B9a7iVye.js} +2 -2
  232. package/dist/{dist-V7W1UhVr.js → dist-BWflWcpW.js} +2 -2
  233. package/dist/{dist-D6fZec6r.js → dist-C3hu_C3w.js} +2 -2
  234. package/dist/{dist-CVy-7PHQ.js → dist-CX7skkvG.js} +48 -48
  235. package/dist/dist-CcOn7WCo.js +4 -0
  236. package/dist/dist-Cdkm20M6.js +2542 -0
  237. package/dist/{dist-BS5uKktL.js → dist-ChOb5XHW.js} +2 -2
  238. package/dist/{dist-BF5zEHop.js → dist-DZ3X-uB8.js} +2 -2
  239. package/dist/{dist-CWSG7Kj0.js → dist-D_XrUEET.js} +5 -5
  240. package/dist/{dist-txQLT2sF.js → dist-TAv500j6.js} +2 -2
  241. package/dist/{dist-D6cMdrfG.js → dist-fqSers8_.js} +55 -55
  242. package/dist/{editor-modal-zaZHcmlO.js → editor-modal-BeX6otLk.js} +953 -952
  243. package/dist/{cdn/chunks/en-D14i5nFh.js → en-C0pHHMiR.js} +114 -2
  244. package/dist/en-Do0SU6tR.js +1 -0
  245. package/dist/{cdn/chunks/es-zDacbMhs.js → es-CxyEKr6n.js} +114 -2
  246. package/dist/{extensions-fo_c-vqf.js → extensions-BJ184osp.js} +173 -173
  247. package/dist/{eye-7W4t5e0Q.js → eye-ByMgHeA_.js} +1 -1
  248. package/dist/{cdn/chunks/fr-CSgYtjOd.js → fr-CYbamiI6.js} +114 -2
  249. package/dist/{image-BDiRFzSd.js → image-Ch8tR35K.js} +1 -1
  250. package/dist/index.d.ts +182 -14
  251. package/dist/{info-Cxi3-Kh9.js → info-DzSD-Wpk.js} +1 -1
  252. package/dist/{cdn/chunks/ja-B7H3ID8O.js → ja-DfaIAoGI.js} +114 -2
  253. package/dist/keys-BCqskl51.js +9 -0
  254. package/dist/languageName-DEEOhDWI.js +10 -0
  255. package/dist/{link-ju_2Cmir.js → link-oDn9AR2w.js} +1 -1
  256. package/dist/{list-DYZJf0aZ.js → list-C5t07dp8.js} +1 -1
  257. package/dist/{loader-circle-BZRD0a4I.js → loader-circle-k6xvKgUB.js} +1 -1
  258. package/dist/{message-circle-DuEw4Zfx.js → message-circle-C23R6OJR.js} +1 -1
  259. package/dist/{cdn/chunks/nl-176ySmc5.js → nl-DkrB-VKZ.js} +114 -2
  260. package/dist/normalizeMergeTagMarkup-CUCo7B5X.js +288 -0
  261. package/dist/noticeTones-D7BPu-Le.js +14 -0
  262. package/dist/{package-CePMr2kK.js → package-C90eQ7NU.js} +1 -1
  263. package/dist/{pencil-D3aFCL7c.js → pencil-BK7GrQuA.js} +1 -1
  264. package/dist/plural-CyxrJXL1.js +15 -0
  265. package/dist/plus-Cr0Mis63.js +13 -0
  266. package/dist/{cdn/chunks/preRenderCustomBlocks-BcXIz7oJ.js → preRenderCustomBlocks-Bs3N9no-.js} +4 -6
  267. package/dist/{cdn/chunks/pt-BR-dDlTwX18.js → pt-BR-CY5Ye7eP.js} +114 -2
  268. package/dist/{refresh-cw-xnro7_Sk.js → refresh-cw-_ZLOIEvA.js} +2 -12
  269. package/dist/rotate-ccw-CB5wsHwv.js +13 -0
  270. package/dist/{runtime-dom.esm-bundler-BURR-bj5.js → runtime-dom.esm-bundler-DlHp8xgy.js} +154 -154
  271. package/dist/sanitizeHtml-2rjV0r-6.js +962 -0
  272. package/dist/{search-CDrstRBv.js → search-BmrQNox8.js} +1 -1
  273. package/dist/{send-DROkPOaX.js → send-blAsIBBg.js} +1 -1
  274. package/dist/{smartphone-Bx6u_tjn.js → smartphone-BPpWYrwV.js} +1 -1
  275. package/dist/socialIcons-TFiOkpoU.js +2705 -0
  276. package/dist/{sparkles-CdaTtvoz.js → sparkles-OqIxrNp-.js} +1 -1
  277. package/dist/{square-BbCROH_f.js → square-BP-V7iT-.js} +1 -1
  278. package/dist/style.css +1 -1
  279. package/dist/{cdn/chunks/styleConstants-B8xVRiwX.js → styleConstants-CgiNKdnc.js} +5 -7
  280. package/dist/templatical-editor.js +2438 -1752
  281. package/dist/{text-align-start-CGacJ9Vw.js → text-align-start-4mwX2o-F.js} +13 -13
  282. package/dist/{trash-DxCd7zIy.js → trash-B99WixTA.js} +1 -1
  283. package/dist/{triangle-alert-7_oaitpf.js → triangle-alert-CHMiDkHa.js} +1 -1
  284. package/dist/{upload-DuFEOi_0.js → upload-Cp8o-hrN.js} +1 -1
  285. package/dist/{useCloudI18n-DEMmUKuO.js → useCloudI18n-Dh2iydo1.js} +4 -4
  286. package/dist/useEditorRoot-DY3mgcHm.js +7 -0
  287. package/dist/{useI18n-BBrHTdu8.js → useI18n-CgtvtF4C.js} +4 -4
  288. package/dist/useLocalizedDisplay-DNNwDRxL.js +31 -0
  289. package/dist/{useLogicTag-ZPC39rfH.js → useLogicTag-BXXXQQmi.js} +4 -4
  290. package/dist/{useMergeTag-BQ4qqWpQ.js → useMergeTag-C9Okr87y.js} +5 -5
  291. package/dist/usePopoverPosition-VDQjyX_A.js +76 -0
  292. package/dist/{useScrollToBlock-BSyAV4pk.js → useScrollToBlock-B35ObCGK.js} +5 -5
  293. package/dist/{vue.runtime.esm-bundler-CnEeTfhs.js → vue.runtime.esm-bundler-BJXc_Mri.js} +1373 -1368
  294. package/dist/withCurrentFont-DJiQqZzL.js +18 -0
  295. package/dist/{x-BpfG7v9g.js → x-BIBStNMS.js} +1 -1
  296. package/package.json +21 -21
  297. package/dist/AiAltTextPopover-DawbUywc.js +0 -105
  298. package/dist/AiChatPanel-CupPhmsN.js +0 -548
  299. package/dist/BlockIssueBadge-BxpDy3u-.js +0 -33
  300. package/dist/BlockPreviewCanvas-B-4bmJ3t.js +0 -140
  301. package/dist/CollaborationNotices-CTw4JThq.js +0 -75
  302. package/dist/CommentsPanel-DwwFuh1h.js +0 -16
  303. package/dist/CommentsSidebar-9ZfiC2DO.js +0 -500
  304. package/dist/CountdownToolbar-BqoYzf_6.js +0 -197
  305. package/dist/IssuesPanel-4ykrf1ax.js +0 -359
  306. package/dist/MergeTagTextarea-CPFEjJZd.js +0 -69
  307. package/dist/ParagraphEditor-CWXfurGh.js +0 -796
  308. package/dist/TemplateSettings-CS0f1Ues.js +0 -236
  309. package/dist/TestEmailModal-DBD0X5nV.js +0 -209
  310. package/dist/TitleEditor-DSqtle77.js +0 -198
  311. package/dist/ToggleSwitch-JykPyD_8.js +0 -36
  312. package/dist/Toolbar-BZPFfKrf.js +0 -3145
  313. package/dist/VersionPreviewBanner-DECaBwLq.js +0 -37
  314. package/dist/WrapperBlock-BsJv_Fiw.js +0 -44
  315. package/dist/cdn/chunks/AiAltTextPopover-SEEjkd-I.js +0 -106
  316. package/dist/cdn/chunks/AiAltTextPopover-SEEjkd-I.js.map +0 -1
  317. package/dist/cdn/chunks/AiAltTextReview-BGLLSKLm.js.map +0 -1
  318. package/dist/cdn/chunks/AiChatPanel-DKDAaBNi.js +0 -474
  319. package/dist/cdn/chunks/AiChatPanel-DKDAaBNi.js.map +0 -1
  320. package/dist/cdn/chunks/AiRewriteMenu-qf-cfEpy.js.map +0 -1
  321. package/dist/cdn/chunks/BlockIssueBadge-jdf91-nk.js +0 -34
  322. package/dist/cdn/chunks/BlockIssueBadge-jdf91-nk.js.map +0 -1
  323. package/dist/cdn/chunks/BlockPreviewCanvas-DGBh6mqe.js +0 -142
  324. package/dist/cdn/chunks/CollaborationNotices-Bsf1rGW9.js +0 -77
  325. package/dist/cdn/chunks/CollaborationNotices-Bsf1rGW9.js.map +0 -1
  326. package/dist/cdn/chunks/CommentsPanel-DoJnKLXI.js +0 -18
  327. package/dist/cdn/chunks/CommentsSidebar-CUtgvdBC.js +0 -470
  328. package/dist/cdn/chunks/CommentsSidebar-CUtgvdBC.js.map +0 -1
  329. package/dist/cdn/chunks/CountdownToolbar-xobieKoU.js +0 -199
  330. package/dist/cdn/chunks/CountdownToolbar-xobieKoU.js.map +0 -1
  331. package/dist/cdn/chunks/IssuesPanel-C7LfxaAY.js.map +0 -1
  332. package/dist/cdn/chunks/LogicTagInsertButton-BIi05UQu.js +0 -1051
  333. package/dist/cdn/chunks/LogicTagInsertButton-BIi05UQu.js.map +0 -1
  334. package/dist/cdn/chunks/MediaEditModal-Cpcod6_U.js.map +0 -1
  335. package/dist/cdn/chunks/MergeTagModeToggle-BgKEVUtV.js.map +0 -1
  336. package/dist/cdn/chunks/MergeTagTextarea-tBz8McZf.js +0 -71
  337. package/dist/cdn/chunks/MergeTagTextarea-tBz8McZf.js.map +0 -1
  338. package/dist/cdn/chunks/ParagraphEditor-B3Rj_cWF.js +0 -631
  339. package/dist/cdn/chunks/ParagraphEditor-B3Rj_cWF.js.map +0 -1
  340. package/dist/cdn/chunks/TemplateSettings-CKtI-dof.js +0 -208
  341. package/dist/cdn/chunks/TemplateSettings-CKtI-dof.js.map +0 -1
  342. package/dist/cdn/chunks/TestEmailModal-CDQTgESD.js +0 -209
  343. package/dist/cdn/chunks/TestEmailModal-CDQTgESD.js.map +0 -1
  344. package/dist/cdn/chunks/TitleEditor-Cob7RLyK.js +0 -198
  345. package/dist/cdn/chunks/TitleEditor-Cob7RLyK.js.map +0 -1
  346. package/dist/cdn/chunks/ToggleSwitch-J7Vwhvha.js +0 -38
  347. package/dist/cdn/chunks/ToggleSwitch-J7Vwhvha.js.map +0 -1
  348. package/dist/cdn/chunks/Toolbar-CdpsvNOR.js +0 -3061
  349. package/dist/cdn/chunks/Toolbar-CdpsvNOR.js.map +0 -1
  350. package/dist/cdn/chunks/VersionPreviewBanner-Dvg0ZfAW.js +0 -39
  351. package/dist/cdn/chunks/VersionPreviewBanner-Dvg0ZfAW.js.map +0 -1
  352. package/dist/cdn/chunks/WrapperBlock-C7Md56IT.js +0 -46
  353. package/dist/cdn/chunks/WrapperBlock-C7Md56IT.js.map +0 -1
  354. package/dist/cdn/chunks/ca-CD-Kt1qz.js.map +0 -1
  355. package/dist/cdn/chunks/createCloudRuntime-Cth2JCEh.js.map +0 -1
  356. package/dist/cdn/chunks/de-CeFJ6wbM.js.map +0 -1
  357. package/dist/cdn/chunks/draggable-Du8AUMFT.js.map +0 -1
  358. package/dist/cdn/chunks/en-D14i5nFh.js.map +0 -1
  359. package/dist/cdn/chunks/en-TIqv4ag3.js +0 -1
  360. package/dist/cdn/chunks/es-zDacbMhs.js.map +0 -1
  361. package/dist/cdn/chunks/fr-CSgYtjOd.js.map +0 -1
  362. package/dist/cdn/chunks/icons-okSPsLOa.js.map +0 -1
  363. package/dist/cdn/chunks/ja-B7H3ID8O.js.map +0 -1
  364. package/dist/cdn/chunks/keys-CUj6UA38.js +0 -11
  365. package/dist/cdn/chunks/keys-CUj6UA38.js.map +0 -1
  366. package/dist/cdn/chunks/nl-176ySmc5.js.map +0 -1
  367. package/dist/cdn/chunks/normalizeMergeTagMarkup-C_KlfSW4.js +0 -198
  368. package/dist/cdn/chunks/normalizeMergeTagMarkup-C_KlfSW4.js.map +0 -1
  369. package/dist/cdn/chunks/pt-BR-dDlTwX18.js.map +0 -1
  370. package/dist/cdn/chunks/sanitizeHtml-CN85EDrO.js +0 -72
  371. package/dist/cdn/chunks/sanitizeHtml-CN85EDrO.js.map +0 -1
  372. package/dist/cdn/chunks/socialIcons-jsTDmkbb.js +0 -2008
  373. package/dist/cdn/chunks/socialIcons-jsTDmkbb.js.map +0 -1
  374. package/dist/cdn/chunks/src-C7bkofBL.js +0 -647
  375. package/dist/cdn/chunks/src-C7bkofBL.js.map +0 -1
  376. package/dist/cdn/chunks/src-DEd87i_U.js.map +0 -1
  377. package/dist/cdn/chunks/src-DwWrYnUj.js +0 -1404
  378. package/dist/cdn/chunks/src-DwWrYnUj.js.map +0 -1
  379. package/dist/cdn/chunks/styleConstants-B8xVRiwX.js.map +0 -1
  380. package/dist/cdn/chunks/useEditorCore-BrY66C2y.js +0 -2582
  381. package/dist/cdn/chunks/useEditorCore-BrY66C2y.js.map +0 -1
  382. package/dist/cdn/chunks/useEditorRoot-vjZJwKrV.js +0 -9
  383. package/dist/cdn/chunks/usePopoverPosition-DSMtmu2W.js +0 -70
  384. package/dist/cdn/chunks/usePopoverPosition-DSMtmu2W.js.map +0 -1
  385. package/dist/cdn/chunks/useScrollToBlock-vjQ0fe-L.js.map +0 -1
  386. package/dist/dist-CKi_npZM.js +0 -1344
  387. package/dist/dist-DyFArF_G.js +0 -4
  388. package/dist/dist-pA3ooG6N.js +0 -4
  389. package/dist/en-Db76vJbY.js +0 -1
  390. package/dist/keys-BgRERHzu.js +0 -9
  391. package/dist/normalizeMergeTagMarkup-CELnOlgK.js +0 -196
  392. package/dist/sanitizeHtml-BzfzpYJY.js +0 -942
  393. package/dist/socialIcons-D7MGsg0d.js +0 -2075
  394. package/dist/useEditorCore-BSo2sSID.js +0 -4059
  395. package/dist/useEditorRoot-BMcoCLBx.js +0 -7
  396. package/dist/usePopoverPosition-DV1PxL66.js +0 -68
  397. package/dist/withCurrentFont-B22FXAF5.js +0 -18
@@ -0,0 +1,290 @@
1
+ import { $t as e, Jt as t, Mt as n, Xt as r, a as i, en as a, i as o, jt as s, m as c, r as l } from "./src-BQUv2CYU.js";
2
+ // src/utils/normalizeMergeTagMarkup.ts
3
+ function u(e) {
4
+ let t = e.flags.includes("g") ? e.flags : `${e.flags}g`;
5
+ return new RegExp(e.source, t);
6
+ }
7
+ function d(e, t, n) {
8
+ let r = [], a = (t, n, i) => {
9
+ let a = u(t), o = a.exec(e);
10
+ for (; o !== null;) {
11
+ let t = o.index, s = t + o[0].length;
12
+ o[0].length === 0 ? a.lastIndex++ : r.some((e) => t < e.end && s > e.start) || r.push({
13
+ start: t,
14
+ end: s,
15
+ attr: n,
16
+ value: o[0],
17
+ label: i(o[0])
18
+ }), o = a.exec(e);
19
+ }
20
+ };
21
+ return a(n.logic, "data-logic-merge-tag", (e) => o(e, n)), a(n.value, "data-merge-tag", (e) => i(e, t)), r.sort((e, t) => e.start - t.start);
22
+ }
23
+ function f(e) {
24
+ let t = e.createTreeWalker(e.body, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, { acceptNode(e) {
25
+ if (e.nodeType !== 1) return NodeFilter.FILTER_ACCEPT;
26
+ let t = e;
27
+ return t.hasAttribute("data-merge-tag") || t.hasAttribute("data-logic-merge-tag") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_SKIP;
28
+ } }), n = [], r = t.nextNode();
29
+ for (; r !== null;) n.push(r), r = t.nextNode();
30
+ return n;
31
+ }
32
+ function p(e, t, n) {
33
+ if (!e || !l(e, n) || typeof DOMParser > "u") return e;
34
+ let r = new DOMParser().parseFromString(`<!doctype html><body>${e}</body>`, "text/html"), i = 0;
35
+ for (let e of f(r)) {
36
+ let a = e.data, o = d(a, t, n);
37
+ if (o.length === 0) continue;
38
+ let s = r.createDocumentFragment(), c = 0;
39
+ for (let e of o) {
40
+ e.start > c && s.appendChild(r.createTextNode(a.substring(c, e.start)));
41
+ let t = r.createElement("span");
42
+ t.setAttribute(e.attr, e.value), t.textContent = e.label, s.appendChild(t), c = e.end;
43
+ }
44
+ c < a.length && s.appendChild(r.createTextNode(a.substring(c))), e.parentNode?.replaceChild(s, e), i += o.length;
45
+ }
46
+ return i === 0 ? e : r.body.innerHTML;
47
+ }
48
+ function m(e, t, n, r) {
49
+ if (e !== "title" && e !== "paragraph" && e !== "html" || typeof t?.content?.value != "string") return t;
50
+ let i = t.content, a = p(i.value, n, r);
51
+ return a === i.value ? t : {
52
+ ...t,
53
+ content: {
54
+ ...i,
55
+ value: a
56
+ }
57
+ };
58
+ }
59
+ function h(e, t, n) {
60
+ let i = e.l10n;
61
+ if (i) {
62
+ let r = !1, a = Object.fromEntries(Object.entries(i).map(([i, a]) => {
63
+ let o = m(e.type, a.text, t, n);
64
+ return o === a.text ? [i, a] : (r = !0, [i, {
65
+ ...a,
66
+ text: o
67
+ }]);
68
+ }));
69
+ r && (e = {
70
+ ...e,
71
+ l10n: a
72
+ });
73
+ }
74
+ if (e.type === "section") {
75
+ if (!Array.isArray(e.children)) return e;
76
+ let r = !1, i = e.children.map((e) => {
77
+ if (!Array.isArray(e)) return e;
78
+ let i = !1, a = e.map((e) => {
79
+ let r = h(e, t, n);
80
+ return r !== e && (i = !0), r;
81
+ });
82
+ return i ? (r = !0, a) : e;
83
+ });
84
+ return r ? {
85
+ ...e,
86
+ children: i
87
+ } : e;
88
+ }
89
+ if (e.type === "wrapper") {
90
+ if (!Array.isArray(e.children)) return e;
91
+ let r = !1, i = e.children.map((e) => {
92
+ let i = h(e, t, n);
93
+ return i !== e && (r = !0), i;
94
+ });
95
+ return r ? {
96
+ ...e,
97
+ children: i
98
+ } : e;
99
+ }
100
+ if (e.type !== "title" && e.type !== "paragraph" || typeof e.content != "string") return e;
101
+ let a = p(e.content, t, n);
102
+ if (a === e.content) return e;
103
+ let o = r(e.content), s = r(a), c = e.l10n && Object.fromEntries(Object.entries(e.l10n).map(([e, t]) => {
104
+ let n = t.text?.content;
105
+ return [e, n?.sourceHash === o ? {
106
+ ...t,
107
+ text: {
108
+ ...t.text,
109
+ content: {
110
+ ...n,
111
+ sourceHash: s
112
+ }
113
+ }
114
+ } : t];
115
+ }));
116
+ return {
117
+ ...e,
118
+ content: a,
119
+ ...c ? { l10n: c } : {}
120
+ };
121
+ }
122
+ function g(e, t, n) {
123
+ if (!e || !Array.isArray(e.blocks)) return e;
124
+ let r = !1, i = e.blocks.map((e) => {
125
+ let i = h(e, t, n);
126
+ return i !== e && (r = !0), i;
127
+ });
128
+ return r ? {
129
+ ...e,
130
+ blocks: i
131
+ } : e;
132
+ }
133
+ function _(e, t) {
134
+ return g(y(e), t?.tags ?? [], c(t?.syntax));
135
+ }
136
+ function v(e, t) {
137
+ return h(e, t?.tags ?? [], c(t?.syntax));
138
+ }
139
+ function y(e) {
140
+ return typeof e == "object" && e ? a(e) : e;
141
+ }
142
+ function b(e, t) {
143
+ return {
144
+ get state() {
145
+ return e.state;
146
+ },
147
+ get content() {
148
+ return e.content;
149
+ },
150
+ setContent: (n, r) => e.setContent(_(n, t), r)
151
+ };
152
+ }
153
+ function x(e, t) {
154
+ return {
155
+ ...e,
156
+ async load(n) {
157
+ let r = await e.load(n);
158
+ return {
159
+ ...r,
160
+ content: _(r.content, t)
161
+ };
162
+ }
163
+ };
164
+ }
165
+ function S(e, t) {
166
+ if (Array.isArray(e)) for (let n of e) {
167
+ if (!n || typeof n != "object") continue;
168
+ if (n.id === t) return n.type;
169
+ let e = n.children;
170
+ if (n.type === "section" && Array.isArray(e)) for (let n of e) {
171
+ let e = S(n, t);
172
+ if (e) return e;
173
+ }
174
+ else if (n.type === "wrapper") {
175
+ let n = S(e, t);
176
+ if (n) return n;
177
+ }
178
+ }
179
+ }
180
+ function C(e, t) {
181
+ typeof e.id == "string" && t.set(e.id, e.type);
182
+ let n = e.children;
183
+ if (!Array.isArray(n)) return;
184
+ let r = e.type === "section" ? n.flat() : n;
185
+ for (let e of r) e && typeof e == "object" && C(e, t);
186
+ }
187
+ function w(i, o, l) {
188
+ let u = l?.tags ?? [], d = c(l?.syntax), f = /* @__PURE__ */ new Map(), _ = i.some((e) => e.op === "updateBlockLocale"), v = a(o), y = a(o), b = (e, t, r) => {
189
+ try {
190
+ if (!("expect" in t)) return n(e, [t]);
191
+ let { expect: r, ...i } = t;
192
+ return n(e, [i]);
193
+ } catch (e) {
194
+ throw e instanceof s ? new s(e.code, r, e.message, e.blockId) : e;
195
+ }
196
+ }, x = (e, t) => {
197
+ let n = (e) => {
198
+ if (Array.isArray(e)) for (let r of e) {
199
+ if (!r || typeof r != "object") continue;
200
+ if (r.id === t) return r;
201
+ let e = r.children, i = n(r.type === "section" && Array.isArray(e) ? e.flat() : e);
202
+ if (i) return i;
203
+ }
204
+ };
205
+ return n(e?.blocks);
206
+ }, w = (n, i, a, o) => {
207
+ if (!n) return n;
208
+ let s = n;
209
+ for (let [c, l] of Object.entries(n)) {
210
+ if (!l) continue;
211
+ let n = o ? i?.l10n?.[o]?.text?.[c] : void 0, u = o ? a?.l10n?.[o]?.text?.[c] : void 0, d = t(i, c), f = t(a, c), p = n && u && e(l, n) ? u.sourceHash : typeof d == "string" && typeof f == "string" && l.sourceHash === r(d) ? r(f) : l.sourceHash;
212
+ p !== l.sourceHash && (s = {
213
+ ...s,
214
+ [c]: {
215
+ ...l,
216
+ sourceHash: p
217
+ }
218
+ });
219
+ }
220
+ return s;
221
+ }, T = !1, E = (e) => {
222
+ if (e.op === "addBlock") {
223
+ if (!e.block || typeof e.block != "object") return e;
224
+ C(e.block, f);
225
+ let t = h(e.block, u, d);
226
+ return t === e.block ? e : (T = !0, {
227
+ ...e,
228
+ block: t
229
+ });
230
+ }
231
+ if (e.op === "deleteBlock" && e.expect?.block) {
232
+ let t = h(e.expect.block, u, d);
233
+ return t === e.expect.block ? e : (T = !0, {
234
+ ...e,
235
+ expect: {
236
+ ...e.expect,
237
+ block: t
238
+ }
239
+ });
240
+ }
241
+ if (e.op === "updateBlockLocale") {
242
+ let t = f.get(e.blockId) ?? S(v?.blocks, e.blockId), n = x(v, e.blockId), r = x(y, e.blockId), i = m(t, w(e.text, n, r), u, d), a = m(t, w(e.expect?.text, n, r, e.locale), u, d), o = e.expect && a !== e.expect.text ? {
243
+ ...e.expect,
244
+ text: a
245
+ } : e.expect;
246
+ return i === e.text && o === e.expect ? e : (T = !0, {
247
+ ...e,
248
+ ...i ? { text: i } : {},
249
+ ...o ? { expect: o } : {}
250
+ });
251
+ }
252
+ if (e.op === "updateBlock") {
253
+ let t = f.get(e.blockId) ?? S(v?.blocks, e.blockId);
254
+ if (t !== "title" && t !== "paragraph") return e;
255
+ let n = (e) => {
256
+ if (typeof e?.content != "string") return e;
257
+ let t = p(e.content, u, d);
258
+ return t === e.content ? e : {
259
+ ...e,
260
+ content: t
261
+ };
262
+ }, r = n(e.set), i = n(e.expect);
263
+ return r === e.set && i === e.expect ? e : (T = !0, {
264
+ ...e,
265
+ ...r ? { set: r } : {},
266
+ ...i ? { expect: i } : {}
267
+ });
268
+ }
269
+ if (e.op === "setContent") {
270
+ f.clear();
271
+ let t = g(e.content, u, d);
272
+ return t === e.content ? e : (T = !0, {
273
+ ...e,
274
+ content: t
275
+ });
276
+ }
277
+ return e;
278
+ }, D = i.map((e, t) => {
279
+ let n = E(e);
280
+ if (_) {
281
+ let r = b(v, e, t), i = b(y, n, t);
282
+ v = r, y = i;
283
+ } else e.op === "setContent" && (v = e.content);
284
+ return n;
285
+ });
286
+ return T ? D : i;
287
+ }
288
+ export { b as a, w as i, _ as n, x as o, p as r, v as t };
289
+
290
+ //# sourceMappingURL=normalizeMergeTagMarkup-cC32Ox6A.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeMergeTagMarkup-cC32Ox6A.js","names":["deepEqual","readPath","applyOperations","sourceHash","getMergeTagLabel","safeClone","getLogicMergeTagKeyword","OperationError","resolveSyntax","containsMergeTag","globalRegex","flags","pattern","collectHits","hits","scan","regex","match","text","start","end","hit","label","syntax","value","mergeTags","a","b","collectNormalizableTextNodes","walker","doc","node","el","nodes","current","normalizeMergeTagsInHtml","html","replacements","fragment","cursor","span","normalizeLocaleText","blockType","entry","normalizeBlock","l10n","block","changed","next","locale","layer","children","column","columnChanged","normalized","child","content","before","after","restamped","normalizeMergeTagMarkup","blocks","normalizeContentForConfig","copyIncomingContent","normalizeBlockForConfig","withNormalizedContentWrites","editor","markDirty","withNormalizedTemplateLoads","provider","template","id","blockTypeOf","found","collectBlockTypes","into","nested","normalizeRemoteOperations","tags","added","needsLocaleState","ops","op","original","normalizedState","advance","state","_expect","unguarded","error","index","blockIn","find","restamp","entries","result","path","oldEntry","newEntry","oldBase","newBase","hash","normalizeOne","type","expectText","expect","normalizeField","fields","set","nextOriginal","nextNormalized"],"sources":["../../../src/utils/normalizeMergeTagMarkup.ts"],"sourcesContent":["import type { Ref } from \"vue\";\nimport type {\n Block,\n MergeTag,\n LocalizedText,\n MergeTagsConfig,\n Operation,\n SectionBlock,\n SyntaxPreset,\n TemplateContent,\n TemplatesProvider,\n WrapperBlock,\n} from \"@templatical/types\";\nimport {\n sourceHash,\n readPath,\n deepEqual,\n applyOperations,\n containsMergeTag,\n getLogicMergeTagKeyword,\n getMergeTagLabel,\n OperationError,\n resolveSyntax,\n safeClone,\n} from \"@templatical/types\";\n\n/**\n * Convert bare merge-tag tokens in rich-text HTML into the `<span\n * data-merge-tag>` nodes the editor understands.\n *\n * A tag reaches stored content in one of two physical shapes. Anything a user\n * types or pastes is already a node, because `MergeTagNode`'s input and paste\n * rules convert it on the spot. What stays a bare token is content that never\n * passed through that pipeline — `init({ content })`, `setContent()`, a\n * template loaded from a store, or one produced by the `@templatical/import-*`\n * converters. A bare token renders as literal text: no label, no highlight, no\n * `sample` substitution, and it cannot be selected or deleted as a unit.\n *\n * Three properties of this implementation are load-bearing:\n *\n * 1. **It walks text nodes, never markup.** A token in attribute position —\n * `<a href=\"{{unsubscribe_url}}\">` is the common one — must be left exactly\n * as it is; wrapping it injects an element into an attribute value and\n * corrupts the document. A `TreeWalker` over text nodes cannot reach an\n * attribute at all, so this holds by construction rather than by guard.\n * A regex cannot do this job. Guarding with a `(?<!data-merge-tag=\")`\n * lookbehind protects the attribute of an already-converted span and\n * nothing else, so `<a href=\"{{unsubscribe_url}}\">` becomes an anchor whose\n * href contains a `<span>`. Telling text position from attribute position\n * needs parsing; no amount of lookbehind substitutes for it.\n *\n * 2. **It is idempotent structurally.** The walk rejects the whole subtree of\n * any element already carrying `data-merge-tag` / `data-logic-merge-tag`,\n * so an existing span's inner text is unreachable no matter what it says.\n * That covers the case where a tag's label *is* its value.\n *\n * 3. **It never builds markup by concatenation.** A consumer may configure a\n * syntax whose delimiters contain `<` / `>` — Smarty-style `<% $email %>` —\n * so a template string would emit an attribute no scanner could re-read.\n * Spans are created as elements and filled via `setAttribute` /\n * `textContent`, which leaves escaping to the serializer.\n *\n * Matching is driven by `syntax`, not by the declared tag list, so a template\n * migrated from another ESP has all of its tags made atomic rather than only\n * the handful the consumer has declared so far. An undeclared token falls back\n * to showing its raw value as the label, which `getMergeTagLabel` already does.\n * This mirrors typing: the input and paste rules are registered unconditionally\n * and match on syntax alone.\n */\n\ninterface TagHit {\n start: number;\n end: number;\n attr: string;\n value: string;\n label: string;\n}\n\nfunction globalRegex(pattern: RegExp): RegExp {\n const flags = pattern.flags.includes(\"g\")\n ? pattern.flags\n : `${pattern.flags}g`;\n return new RegExp(pattern.source, flags);\n}\n\nfunction collectHits(\n text: string,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): TagHit[] {\n const hits: TagHit[] = [];\n\n const scan = (\n pattern: RegExp,\n attr: string,\n label: (match: string) => string,\n ): void => {\n const regex = globalRegex(pattern);\n let match = regex.exec(text);\n while (match !== null) {\n const start = match.index;\n const end = start + match[0].length;\n // A zero-length match would spin `exec` forever on the same index.\n if (match[0].length === 0) {\n regex.lastIndex++;\n } else if (!hits.some((hit) => start < hit.end && end > hit.start)) {\n hits.push({\n start,\n end,\n attr,\n value: match[0],\n label: label(match[0]),\n });\n }\n match = regex.exec(text);\n }\n };\n\n // Logic first, so it wins any overlap. Some syntaxes' value regex is liberal\n // enough to also match a logic tag — handlebars' `{{.+?}}` swallows\n // `{{#each items}}` — and `isMergeTagValue` resolves that same way.\n scan(syntax.logic, \"data-logic-merge-tag\", (value) =>\n getLogicMergeTagKeyword(value, syntax),\n );\n scan(syntax.value, \"data-merge-tag\", (value) =>\n getMergeTagLabel(value, mergeTags),\n );\n\n return hits.sort((a, b) => a.start - b.start);\n}\n\n/** Text nodes not already inside a merge-tag span, in document order. */\nfunction collectNormalizableTextNodes(doc: Document): Text[] {\n const walker = doc.createTreeWalker(\n doc.body,\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT,\n {\n acceptNode(node: Node): number {\n if (node.nodeType !== 1) return NodeFilter.FILTER_ACCEPT;\n const el = node as Element;\n // REJECT (not SKIP) prunes the subtree, which is what makes a second\n // pass unable to see an existing span's inner text.\n return el.hasAttribute(\"data-merge-tag\") ||\n el.hasAttribute(\"data-logic-merge-tag\")\n ? NodeFilter.FILTER_REJECT\n : NodeFilter.FILTER_SKIP;\n },\n },\n );\n\n // Collected up front: replacing a node mid-walk invalidates the walker.\n const nodes: Text[] = [];\n let current = walker.nextNode();\n while (current !== null) {\n nodes.push(current as Text);\n current = walker.nextNode();\n }\n return nodes;\n}\n\nexport function normalizeMergeTagsInHtml(\n html: string,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): string {\n if (!html) return html;\n // Cheap reject before paying for a parse. A token that exists only in an\n // attribute still gets past this, and is then caught by the zero-replacement\n // short-circuit below.\n if (!containsMergeTag(html, syntax)) return html;\n if (typeof DOMParser === \"undefined\") return html;\n\n const doc = new DOMParser().parseFromString(\n `<!doctype html><body>${html}</body>`,\n \"text/html\",\n );\n\n let replacements = 0;\n for (const node of collectNormalizableTextNodes(doc)) {\n const text = node.data;\n const hits = collectHits(text, mergeTags, syntax);\n if (hits.length === 0) continue;\n\n const fragment = doc.createDocumentFragment();\n let cursor = 0;\n for (const hit of hits) {\n if (hit.start > cursor) {\n fragment.appendChild(\n doc.createTextNode(text.substring(cursor, hit.start)),\n );\n }\n const span = doc.createElement(\"span\");\n span.setAttribute(hit.attr, hit.value);\n span.textContent = hit.label;\n fragment.appendChild(span);\n cursor = hit.end;\n }\n if (cursor < text.length) {\n fragment.appendChild(doc.createTextNode(text.substring(cursor)));\n }\n\n node.parentNode?.replaceChild(fragment, node);\n replacements += hits.length;\n }\n\n // Nothing matched in text position, so return the input verbatim rather than\n // a re-serialization of it — otherwise content with no tags at all would be\n // rewritten (`<br/>` → `<br>`, attribute quoting, entity encoding) for no\n // reason. Where a replacement does happen some churn is unavoidable, and the\n // renderer accepts both shapes.\n if (replacements === 0) return html;\n\n return doc.body.innerHTML;\n}\n\n/** Normalize localized rich content without changing source hashes or caller-owned objects. */\nfunction normalizeLocaleText<T extends LocalizedText | null>(\n blockType: string | undefined,\n text: Record<string, T> | undefined,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): Record<string, T> | undefined {\n if (\n (blockType !== \"title\" &&\n blockType !== \"paragraph\" &&\n blockType !== \"html\") ||\n typeof text?.content?.value !== \"string\"\n )\n return text;\n const entry = text.content;\n const value = normalizeMergeTagsInHtml(entry.value, mergeTags, syntax);\n return value === entry.value\n ? text\n : { ...text, content: { ...entry, value } };\n}\n\n/**\n * Localized layers normalize only content on titles, paragraphs and HTML\n * blocks. Among base fields, only title and paragraph rich text is normalized. Every other merge-tag-bearing field —\n * `ButtonBlock.text`/`url`, `ImageBlock.alt`, `HtmlBlock.content`, custom-block\n * `fieldValues`, `settings.preheaderText` — is a plain string rendered as text,\n * so a span written into one would be displayed literally on the canvas and\n * emitted into a `url=` attribute by the renderer.\n *\n * `TableCellData.content` is span-bearing to the renderer but is deliberately\n * excluded: `TableBlock.vue` hydrates a cell with `textContent` and writes\n * `innerText` back on blur, so the first focus-and-leave on a normalized cell\n * would persist the literal markup into stored content as text. The\n * editor/renderer asymmetry there is a separate, pre-existing gap.\n */\nfunction normalizeBlock(\n block: Block,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): Block {\n const l10n = block.l10n;\n if (l10n) {\n let changed = false;\n const next = Object.fromEntries(\n Object.entries(l10n).map(([locale, layer]) => {\n const text = normalizeLocaleText(\n block.type,\n layer.text,\n mergeTags,\n syntax,\n );\n if (text === layer.text) return [locale, layer];\n changed = true;\n return [locale, { ...layer, text }];\n }),\n );\n if (changed) block = { ...block, l10n: next };\n }\n if (block.type === \"section\") {\n if (!Array.isArray(block.children)) return block;\n let changed = false;\n const children = block.children.map((column) => {\n if (!Array.isArray(column)) return column;\n let columnChanged = false;\n const next = column.map((child) => {\n const normalized = normalizeBlock(child, mergeTags, syntax);\n if (normalized !== child) columnChanged = true;\n return normalized;\n });\n if (!columnChanged) return column;\n changed = true;\n return next;\n });\n return changed ? ({ ...block, children } as SectionBlock) : block;\n }\n\n if (block.type === \"wrapper\") {\n if (!Array.isArray(block.children)) return block;\n let changed = false;\n const children = block.children.map((child) => {\n const normalized = normalizeBlock(child, mergeTags, syntax);\n if (normalized !== child) changed = true;\n return normalized;\n });\n return changed ? ({ ...block, children } as WrapperBlock) : block;\n }\n\n if (block.type !== \"title\" && block.type !== \"paragraph\") return block;\n if (typeof block.content !== \"string\") return block;\n\n const content = normalizeMergeTagsInHtml(block.content, mergeTags, syntax);\n if (content === block.content) return block;\n const before = sourceHash(block.content);\n const after = sourceHash(content);\n const restamped =\n block.l10n &&\n Object.fromEntries(\n Object.entries(block.l10n).map(([locale, layer]) => {\n const entry = layer.text?.content;\n return [\n locale,\n entry?.sourceHash === before\n ? {\n ...layer,\n text: {\n ...layer.text,\n content: { ...entry, sourceHash: after },\n },\n }\n : layer,\n ];\n }),\n );\n return { ...block, content, ...(restamped ? { l10n: restamped } : {}) };\n}\n\n/**\n * Normalize every rich-text field in a template. Returns the input reference\n * unchanged when nothing matched, so a template with no bare tokens costs no\n * allocation and keeps its object identity; otherwise returns a copy, leaving\n * the caller's content untouched.\n *\n * Shape is checked rather than trusted at every level. `TemplateContent` types\n * `blocks` as required and `SectionBlock.children` as a `Block[][]`, but this\n * runs at the SDK's entry points on an object the consumer hands us — a partial\n * or hand-rolled template must come back untouched, not turn a working `init()`\n * into a `TypeError`.\n */\nexport function normalizeMergeTagMarkup(\n content: TemplateContent,\n mergeTags: MergeTag[],\n syntax: SyntaxPreset,\n): TemplateContent {\n if (!content || !Array.isArray(content.blocks)) return content;\n\n let changed = false;\n const blocks = content.blocks.map((block) => {\n const normalized = normalizeBlock(block, mergeTags, syntax);\n if (normalized !== block) changed = true;\n return normalized;\n });\n\n return changed ? { ...content, blocks } : content;\n}\n\n/**\n * `normalizeMergeTagMarkup` bound to the editor's own config shape, so the hook\n * sites don't each resolve tags and syntax themselves.\n *\n * An absent `mergeTags` still normalizes, under the liquid default. That is not\n * an oversight: `MergeTagNode`'s input and paste rules are registered\n * unconditionally with the same default, so a consumer who configured nothing\n * already gets a node the instant a user types `{{x}}`. Loading the same text\n * and leaving it inert would be the inconsistency.\n *\n * It always returns a copy. Every content-in path runs through here, and the\n * editor edits the object it holds in place, so holding the caller's own one\n * leaks each edit into it, and one that another Vue made reactive or that a\n * store froze hides edits from the editor's bundled Vue or throws on the first.\n */\nexport function normalizeContentForConfig(\n content: TemplateContent,\n mergeTags: MergeTagsConfig | undefined,\n): TemplateContent {\n return normalizeMergeTagMarkup(\n copyIncomingContent(content),\n mergeTags?.tags ?? [],\n resolveSyntax(mergeTags?.syntax),\n );\n}\n\n/** {@link normalizeContentForConfig} for a single block. */\nexport function normalizeBlockForConfig(\n block: Block,\n mergeTags: MergeTagsConfig | undefined,\n): Block {\n return normalizeBlock(\n block,\n mergeTags?.tags ?? [],\n resolveSyntax(mergeTags?.syntax),\n );\n}\n\n/**\n * A non-object passes through: `normalizeMergeTagMarkup` already hands back\n * whatever is not shaped like content, and `safeClone(undefined)` would throw.\n */\nfunction copyIncomingContent(content: TemplateContent): TemplateContent {\n return typeof content === \"object\" && content !== null\n ? safeClone(content)\n : content;\n}\n\n/**\n * Wrap a `TemplatesProvider` so content arriving from the store is normalized\n * before the editor ever sees it.\n *\n * Only `load` is wrapped. `save` sends content *out*, and what it sends is\n * already-normalized editor state; rewriting it here would change what the\n * store keeps for no benefit. `create` likewise carries content outward, and\n * the template it returns supplies identity and timestamps rather than the\n * content the editor goes on to edit.\n *\n * Wrapping the provider — rather than normalizing after `load()` resolves —\n * is what keeps Q4 true: core assigns already-normalized content to its state\n * and observes no mutation, so there is no dirty flag to suppress and no\n * autosave tick to swallow.\n */\n/**\n * The slice of the editor a content-restoring feature consumes. Structural on\n * purpose: it matches `useVersionHistoryFeature`'s own `VersionHistoryEditor`\n * without importing it, so this util keeps no dependency on a composable.\n */\ninterface ContentWritingEditor {\n state: {\n readonly template?: { id: string } | null;\n readonly isDirty: boolean;\n };\n content: Ref<TemplateContent>;\n setContent: (content: TemplateContent, markDirty?: boolean) => void;\n}\n\n/**\n * Wrap an editor so content written through `setContent` is normalized first.\n *\n * This is how version history is covered. Its content reaches the canvas by\n * three routes — `version.content` off a hydrated list, a `fetched` cache, and\n * `provider.get()` — so wrapping the *provider*, the way the `templates` path\n * does, would miss two of them. `setContent` is the one chokepoint they share.\n *\n * A version is not guaranteed to hold normalized content just because a save\n * produced it: a store carries whatever was written to it, and a backend may\n * version a template it imported rather than one the editor round-tripped.\n * Previewing such a version without this would put bare tokens back on a canvas\n * where every other tag is a chip.\n *\n * `markDirty` is forwarded untouched: every version-history write passes\n * `false`, and swallowing that would turn opening a preview into an unsaved\n * change. `setContent` is resolved per call rather than captured, so a\n * wrapper installed on the editor later still sees every write.\n */\nexport function withNormalizedContentWrites<T extends ContentWritingEditor>(\n editor: T,\n mergeTags: MergeTagsConfig | undefined,\n): ContentWritingEditor {\n return {\n get state() {\n return editor.state;\n },\n get content() {\n return editor.content;\n },\n setContent: (content: TemplateContent, markDirty?: boolean) =>\n editor.setContent(\n normalizeContentForConfig(content, mergeTags),\n markDirty,\n ),\n };\n}\n\nexport function withNormalizedTemplateLoads(\n provider: TemplatesProvider,\n mergeTags: MergeTagsConfig | undefined,\n): TemplatesProvider {\n return {\n ...provider,\n async load(id: string) {\n const template = await provider.load(id);\n return {\n ...template,\n content: normalizeContentForConfig(template.content, mergeTags),\n };\n },\n };\n}\n\n/**\n * The type of the block `id` names — at the top level, in a section's columns\n * or inside a wrapper — or `undefined` when no block has that id.\n */\nfunction blockTypeOf(blocks: unknown, id: string): string | undefined {\n if (!Array.isArray(blocks)) return undefined;\n for (const block of blocks as Block[]) {\n if (!block || typeof block !== \"object\") continue;\n if (block.id === id) return block.type;\n const children = (block as { children?: unknown }).children;\n if (block.type === \"section\" && Array.isArray(children)) {\n for (const column of children) {\n const found = blockTypeOf(column, id);\n if (found) return found;\n }\n } else if (block.type === \"wrapper\") {\n const found = blockTypeOf(children, id);\n if (found) return found;\n }\n }\n return undefined;\n}\n\n/** Every block id in `block`, a section's or a wrapper's children included, with its type. */\nfunction collectBlockTypes(block: Block, into: Map<string, string>): void {\n if (typeof block.id === \"string\") into.set(block.id, block.type);\n const children = (block as { children?: unknown }).children;\n if (!Array.isArray(children)) return;\n const nested =\n block.type === \"section\" ? (children as unknown[]).flat() : children;\n for (const child of nested) {\n if (child && typeof child === \"object\") {\n collectBlockTypes(child as Block, into);\n }\n }\n}\n\n/**\n * Normalize the merge tags in a batch another session made, before the editor\n * applies it — the collaboration counterpart of {@link withNormalizedTemplateLoads}.\n * An agent writes `{{first_name}}` as text and a headless write stores it bare;\n * both arrive as operations, and normalizing them on arrival turns each token\n * into a tag at once. Nothing is sent back for it: the canvas and the\n * controller's copy of the backend's content change together.\n *\n * The rich-text fields only, as for loads: an `addBlock`'s block (a section's\n * children included), an `updateBlock`'s `set.content` when the block it names\n * is a title or a paragraph, its `expect.content`, and a deletion’s `expect.block` — found in `content`, or among the blocks the batch\n * itself added — and a `setContent`'s content. Returns `ops` itself when\n * nothing matched, and never changes it.\n */\nexport function normalizeRemoteOperations(\n ops: readonly Operation[],\n content: TemplateContent,\n mergeTags: MergeTagsConfig | undefined,\n): Operation[] {\n const tags = mergeTags?.tags ?? [];\n const syntax = resolveSyntax(mergeTags?.syntax);\n const added = new Map<string, string>();\n // Markup-only normalization also supports partial input and layout wrappers.\n // Locale hashes require engine-valid, evolving simulation states.\n const needsLocaleState = ops.some((op) => op.op === \"updateBlockLocale\");\n let original = safeClone(content);\n let normalizedState = safeClone(content);\n const advance = (\n state: TemplateContent,\n op: Operation,\n index: number,\n ): TemplateContent => {\n try {\n if (!(\"expect\" in op)) return applyOperations(state, [op]);\n // The backend already checked guards against its raw representation.\n const { expect: _expect, ...unguarded } = op;\n return applyOperations(state, [unguarded as Operation]);\n } catch (error) {\n if (!(error instanceof OperationError)) throw error;\n throw new OperationError(error.code, index, error.message, error.blockId);\n }\n };\n const blockIn = (state: TemplateContent, id: string): Block | undefined => {\n const find = (blocks: unknown): Block | undefined => {\n if (!Array.isArray(blocks)) return undefined;\n for (const block of blocks) {\n if (!block || typeof block !== \"object\") continue;\n if (block.id === id) return block;\n const children = block.children;\n const found = find(\n block.type === \"section\" && Array.isArray(children)\n ? children.flat()\n : children,\n );\n if (found) return found;\n }\n };\n return find(state?.blocks);\n };\n const restamp = <T extends LocalizedText | null>(\n entries: Record<string, T> | undefined,\n before: Block | undefined,\n after: Block | undefined,\n locale?: string,\n ): Record<string, T> | undefined => {\n if (!entries) return entries;\n let result = entries;\n for (const [path, entry] of Object.entries(entries)) {\n if (!entry) continue;\n const oldEntry = locale\n ? before?.l10n?.[locale]?.text?.[path]\n : undefined;\n const newEntry = locale ? after?.l10n?.[locale]?.text?.[path] : undefined;\n const oldBase = readPath(before, path);\n const newBase = readPath(after, path);\n const hash =\n oldEntry && newEntry && deepEqual(entry, oldEntry)\n ? newEntry.sourceHash\n : typeof oldBase === \"string\" &&\n typeof newBase === \"string\" &&\n entry.sourceHash === sourceHash(oldBase)\n ? sourceHash(newBase)\n : entry.sourceHash;\n if (hash !== entry.sourceHash)\n result = { ...result, [path]: { ...entry, sourceHash: hash } };\n }\n return result;\n };\n let changed = false;\n\n const normalizeOne = (op: Operation): Operation => {\n if (op.op === \"addBlock\") {\n if (!op.block || typeof op.block !== \"object\") return op;\n collectBlockTypes(op.block, added);\n const block = normalizeBlock(op.block, tags, syntax);\n if (block === op.block) return op;\n changed = true;\n return { ...op, block };\n }\n if (op.op === \"deleteBlock\" && op.expect?.block) {\n const block = normalizeBlock(op.expect.block, tags, syntax);\n if (block === op.expect.block) return op;\n changed = true;\n return { ...op, expect: { ...op.expect, block } };\n }\n if (op.op === \"updateBlockLocale\") {\n const type =\n added.get(op.blockId) ?? blockTypeOf(original?.blocks, op.blockId);\n const before = blockIn(original, op.blockId);\n const after = blockIn(normalizedState, op.blockId);\n const text = normalizeLocaleText(\n type,\n restamp(op.text, before, after),\n tags,\n syntax,\n );\n const expectText = normalizeLocaleText(\n type,\n restamp(op.expect?.text, before, after, op.locale),\n tags,\n syntax,\n );\n const expect =\n op.expect && expectText !== op.expect.text\n ? { ...op.expect, text: expectText }\n : op.expect;\n if (text === op.text && expect === op.expect) return op;\n changed = true;\n return {\n ...op,\n ...(text ? { text } : {}),\n ...(expect ? { expect } : {}),\n };\n }\n if (op.op === \"updateBlock\") {\n const type =\n added.get(op.blockId) ?? blockTypeOf(original?.blocks, op.blockId);\n if (type !== \"title\" && type !== \"paragraph\") return op;\n const normalizeField = (fields: Record<string, unknown> | undefined) => {\n if (typeof fields?.content !== \"string\") return fields;\n const normalized = normalizeMergeTagsInHtml(\n fields.content,\n tags,\n syntax,\n );\n return normalized === fields.content\n ? fields\n : { ...fields, content: normalized };\n };\n const set = normalizeField(op.set);\n const expect = normalizeField(op.expect);\n if (set === op.set && expect === op.expect) return op;\n changed = true;\n return { ...op, ...(set ? { set } : {}), ...(expect ? { expect } : {}) };\n }\n if (op.op === \"setContent\") {\n added.clear();\n const normalized = normalizeMergeTagMarkup(op.content, tags, syntax);\n if (normalized === op.content) return op;\n changed = true;\n return { ...op, content: normalized };\n }\n return op;\n };\n const next = ops.map((op, index) => {\n const normalized = normalizeOne(op);\n if (needsLocaleState) {\n // Fail before returning any batch if either state cannot advance. The\n // collaboration caller reports the error and applies its existing fallback.\n const nextOriginal = advance(original, op, index);\n const nextNormalized = advance(normalizedState, normalized, index);\n original = nextOriginal;\n normalizedState = nextNormalized;\n } else if (op.op === \"setContent\") {\n // Keep type lookup current without imposing engine validation on the\n // existing markup-only path. Added blocks are tracked in `added`.\n original = op.content;\n }\n return normalized;\n });\n\n return changed ? next : (ops as Operation[]);\n}\n"],"mappings":";;AA8EA,SAASU,EAAY,GAAyB;CAC5C,IAAMC,IAAQC,EAAQ,MAAM,SAAS,GAAG,IACpCA,EAAQ,QACR,GAAGA,EAAQ,MAAM;CACrB,OAAO,IAAI,OAAOA,EAAQ,QAAQD,CAAK;AACzC;AAEA,SAASE,EACP,GACA,GACA,GACU;CACV,IAAMC,IAAiB,CAAC,GAElBC,KACJ,GACA,GACA,MACS;EACT,IAAMC,IAAQN,EAAYE,CAAO,GAC7BK,IAAQD,EAAM,KAAKE,CAAI;EAC3B,OAAOD,MAAU,OAAM;GACrB,IAAME,IAAQF,EAAM,OACdG,IAAMD,IAAQF,EAAM,E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AAIF,GAAkB;GAGpB,IAAM6B,IAAexB,EAAQF,GAAUD,GAAIQ,CAAK,GAC1CoB,IAAiBzB,EAAQD,GAAiB9B,GAAYoC,CAAK;GAEjE,AADA,IAAWmB,GACX,IAAkBC;EACpB,OAAO,AAAI5B,EAAG,OAAO,iBAGnB,IAAWA,EAAG;EAEhB,OAAO5B;CACT,CAAC;CAED,OAAOP,IAAUC,IAAQiC;AAC3B"}
@@ -0,0 +1,16 @@
1
+ // src/constants/noticeTones.ts
2
+ var e = {
3
+ warning: {
4
+ backgroundColor: "var(--tpl-warning-light)",
5
+ color: "var(--tpl-text)",
6
+ border: "1px solid var(--tpl-warning)"
7
+ },
8
+ info: {
9
+ backgroundColor: "var(--tpl-secondary-light)",
10
+ color: "var(--tpl-text)",
11
+ border: "1px solid var(--tpl-secondary)"
12
+ }
13
+ };
14
+ export { e as t };
15
+
16
+ //# sourceMappingURL=noticeTones-D7BPu-Le.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noticeTones-D7BPu-Le.js","names":["TONE_STYLES"],"sources":["../../../src/constants/noticeTones.ts"],"sourcesContent":["export const TONE_STYLES = {\n warning: {\n backgroundColor: \"var(--tpl-warning-light)\",\n color: \"var(--tpl-text)\",\n border: \"1px solid var(--tpl-warning)\",\n },\n info: {\n backgroundColor: \"var(--tpl-secondary-light)\",\n color: \"var(--tpl-text)\",\n border: \"1px solid var(--tpl-secondary)\",\n },\n} as const;\n"],"mappings":";AAAA,IAAaA,IAAc;CACzB,SAAS;EACP,iBAAiB;EACjB,OAAO;EACP,QAAQ;CACV;CACA,MAAM;EACJ,iBAAiB;EACjB,OAAO;EACP,QAAQ;CACV;AACF"}
@@ -0,0 +1,17 @@
1
+ // src/i18n/plural.ts
2
+ function e(e, t, n, r) {
3
+ let i;
4
+ try {
5
+ i = new Intl.PluralRules(n);
6
+ } catch {
7
+ i = new Intl.PluralRules("en");
8
+ }
9
+ let a = i.select(t) === "one" ? e.one : e.other, o = {
10
+ ...r,
11
+ count: t
12
+ };
13
+ return a.replace(/\{(\w+)\}/g, (e, t) => t in o ? String(o[t]) : e);
14
+ }
15
+ export { e as t };
16
+
17
+ //# sourceMappingURL=plural-CyxrJXL1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plural-CyxrJXL1.js","names":["plural","rules","uiLocale","template","count","entry","values","params","key","placeholder"],"sources":["../../../src/i18n/plural.ts"],"sourcesContent":["export type PluralString = { one: string; other: string };\n\n/** Selects `one` or `other`, falling back to English for a malformed UI locale. */\nexport function plural(\n entry: PluralString,\n count: number,\n uiLocale: string,\n params?: Record<string, string | number>,\n): string {\n let rules: Intl.PluralRules;\n try {\n rules = new Intl.PluralRules(uiLocale);\n } catch {\n rules = new Intl.PluralRules(\"en\");\n }\n const template = rules.select(count) === \"one\" ? entry.one : entry.other;\n const values = { ...params, count };\n return template.replace(/\\{(\\w+)\\}/g, (placeholder, key) =>\n key in values ? String(values[key as keyof typeof values]) : placeholder,\n );\n}\n"],"mappings":";AAGA,SAAgBA,EACd,GACA,GACA,GACA,GACQ;CACR,IAAIC;CACJ,IAAI;EACF,IAAQ,IAAI,KAAK,YAAYC,CAAQ;CACvC,QAAQ;EACN,IAAQ,IAAI,KAAK,YAAY,IAAI;CACnC;CACA,IAAMC,IAAWF,EAAM,OAAOG,CAAK,MAAM,QAAQC,EAAM,MAAMA,EAAM,OAC7DC,IAAS;EAAE,GAAGC;EAAQ;CAAM;CAClC,OAAOJ,EAAS,QAAQ,eAAe,GAAa,MAClDK,KAAOF,IAAS,OAAOA,EAAOE,EAA2B,IAAIC,CAC/D;AACF"}
@@ -1,8 +1,8 @@
1
- import { at as e, ft as t, ut as n } from "./dist-CKi_npZM.js";
1
+ import { Ot as e, ht as t, xt as n } from "./src-BQUv2CYU.js";
2
2
  // src/utils/preRenderCustomBlocks.ts
3
3
  async function r(r, i) {
4
4
  let a = async (r) => {
5
- if (e(r)) {
5
+ if (t(r)) {
6
6
  let e = r;
7
7
  try {
8
8
  e.renderedHtml = await i.renderCustomBlock(e);
@@ -13,8 +13,10 @@ async function r(r, i) {
13
13
  t?.trim() ? e.renderedStylesheet = t : delete e.renderedStylesheet;
14
14
  }
15
15
  if (n(r)) for (let e of r.children) for (let t of e) await a(t);
16
- else if (t(r)) for (let e of r.children) await a(e);
16
+ else if (e(r)) for (let e of r.children) await a(e);
17
17
  };
18
18
  for (let e of r.blocks) await a(e);
19
19
  }
20
20
  export { r as t };
21
+
22
+ //# sourceMappingURL=preRenderCustomBlocks-f7GEKdvw.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"preRenderCustomBlocks-BcXIz7oJ.js","names":["isSection","isCustomBlock","isWrapper","preRenderCustomBlocks","renderBlock","block","customBlock","registry","stylesheet","column","child","content"],"sources":["../../../src/utils/preRenderCustomBlocks.ts"],"sourcesContent":["import type { Block, CustomBlock, TemplateContent } from \"@templatical/types\";\nimport { isCustomBlock, isSection, isWrapper } from \"@templatical/types\";\n\n/**\n * The only things this needs from the block registry. Named as a slice rather\n * than taking `UseBlockRegistryReturn` so the render-payload builder can supply\n * the editor instance's own methods without reaching for the registry.\n */\nexport interface CustomBlockResolver {\n renderCustomBlock: (block: CustomBlock) => Promise<string>;\n getCustomBlockStylesheet: (customType: string) => string | undefined;\n}\n\n/**\n * Renders every custom block in the content tree to its HTML representation\n * and stores the result on `block.renderedHtml`, with the definition's\n * stylesheet on `block.renderedStylesheet`.\n *\n * **A contract obligation of every render, not a save-path detail.** A renderer\n * handed a custom block with neither a resolver nor `renderedHtml` omits it from\n * the output silently, and a backend has no way to resolve one: the HTML comes\n * from the consumer's liquid template plus the block's field values, and the\n * definition is registered in the browser. So this runs before a\n * `RenderProvider` sees the content, and before Cloud persists it.\n *\n * Failures per-block are swallowed (and replaced with a comment placeholder)\n * so one broken block doesn't block the save of the rest.\n */\nexport async function preRenderCustomBlocks(\n content: TemplateContent,\n registry: CustomBlockResolver,\n): Promise<void> {\n const renderBlock = async (block: Block): Promise<void> => {\n if (isCustomBlock(block)) {\n const customBlock = block as CustomBlock;\n try {\n customBlock.renderedHtml =\n await registry.renderCustomBlock(customBlock);\n } catch {\n customBlock.renderedHtml = `<!-- Custom block render error: ${customBlock.customType} -->`;\n }\n // Removed when the definition has none, so a copy written before its\n // stylesheet was deleted doesn't outlive it.\n const stylesheet = registry.getCustomBlockStylesheet(\n customBlock.customType,\n );\n if (stylesheet?.trim()) customBlock.renderedStylesheet = stylesheet;\n else delete customBlock.renderedStylesheet;\n }\n\n if (isSection(block)) {\n for (const column of block.children) {\n for (const child of column) {\n await renderBlock(child);\n }\n }\n } else if (isWrapper(block)) {\n for (const child of block.children) {\n await renderBlock(child);\n }\n }\n };\n\n for (const block of content.blocks) {\n await renderBlock(block);\n }\n}\n"],"mappings":";;AA4BA,eAAsBG,EACpB,GACA,GACe;CACf,IAAMC,IAAc,OAAO,MAAgC;EACzD,IAAIH,EAAcI,CAAK,GAAG;GACxB,IAAMC,IAAcD;GACpB,IAAI;IACF,EAAY,eACV,MAAME,EAAS,kBAAkBD,CAAW;GAChD,QAAQ;IACN,EAAY,eAAe,mCAAmCA,EAAY,WAAW;GACvF;GAGA,IAAME,IAAaD,EAAS,yBAC1BD,EAAY,UACd;GACA,AAAIE,GAAY,KAAK,IAAG,EAAY,qBAAqBA,IACpD,OAAOF,EAAY;EAC1B;EAEA,IAAIN,EAAUK,CAAK,GACjB,KAAK,IAAMI,KAAUJ,EAAM,UACzB,KAAK,IAAMK,KAASD,GAClB,MAAML,EAAYM,CAAK;OAGtB,IAAIR,EAAUG,CAAK,GACxB,KAAK,IAAMK,KAASL,EAAM,UACxB,MAAMD,EAAYM,CAAK;CAG7B;CAEA,KAAK,IAAML,KAASM,EAAQ,QAC1B,MAAMP,EAAYC,CAAK;AAE3B"}
1
+ {"version":3,"file":"preRenderCustomBlocks-f7GEKdvw.js","names":["isWrapper","isCustomBlock","isSection","preRenderCustomBlocks","renderBlock","block","customBlock","registry","stylesheet","column","child","content"],"sources":["../../../src/utils/preRenderCustomBlocks.ts"],"sourcesContent":["import type { Block, CustomBlock, TemplateContent } from \"@templatical/types\";\nimport { isCustomBlock, isSection, isWrapper } from \"@templatical/types\";\n\n/**\n * The only things this needs from the block registry. Named as a slice rather\n * than taking `UseBlockRegistryReturn` so the render-payload builder can supply\n * the editor instance's own methods without reaching for the registry.\n */\nexport interface CustomBlockResolver {\n renderCustomBlock: (block: CustomBlock) => Promise<string>;\n getCustomBlockStylesheet: (customType: string) => string | undefined;\n}\n\n/**\n * Renders every custom block in the content tree to its HTML representation\n * and stores the result on `block.renderedHtml`, with the definition's\n * stylesheet on `block.renderedStylesheet`.\n *\n * **A contract obligation of every render, not a save-path detail.** A renderer\n * handed a custom block with neither a resolver nor `renderedHtml` omits it from\n * the output silently, and a backend has no way to resolve one: the HTML comes\n * from the consumer's liquid template plus the block's field values, and the\n * definition is registered in the browser. So this runs before a\n * `RenderProvider` sees the content, and before Cloud persists it.\n *\n * Failures per-block are swallowed (and replaced with a comment placeholder)\n * so one broken block doesn't block the save of the rest.\n */\nexport async function preRenderCustomBlocks(\n content: TemplateContent,\n registry: CustomBlockResolver,\n): Promise<void> {\n const renderBlock = async (block: Block): Promise<void> => {\n if (isCustomBlock(block)) {\n const customBlock = block as CustomBlock;\n try {\n customBlock.renderedHtml =\n await registry.renderCustomBlock(customBlock);\n } catch {\n customBlock.renderedHtml = `<!-- Custom block render error: ${customBlock.customType} -->`;\n }\n // Removed when the definition has none, so a copy written before its\n // stylesheet was deleted doesn't outlive it.\n const stylesheet = registry.getCustomBlockStylesheet(\n customBlock.customType,\n );\n if (stylesheet?.trim()) customBlock.renderedStylesheet = stylesheet;\n else delete customBlock.renderedStylesheet;\n }\n\n if (isSection(block)) {\n for (const column of block.children) {\n for (const child of column) {\n await renderBlock(child);\n }\n }\n } else if (isWrapper(block)) {\n for (const child of block.children) {\n await renderBlock(child);\n }\n }\n };\n\n for (const block of content.blocks) {\n await renderBlock(block);\n }\n}\n"],"mappings":";;AA4BA,eAAsBG,EACpB,GACA,GACe;CACf,IAAMC,IAAc,OAAO,MAAgC;EACzD,IAAIH,EAAcI,CAAK,GAAG;GACxB,IAAMC,IAAcD;GACpB,IAAI;IACF,EAAY,eACV,MAAME,EAAS,kBAAkBD,CAAW;GAChD,QAAQ;IACN,EAAY,eAAe,mCAAmCA,EAAY,WAAW;GACvF;GAGA,IAAME,IAAaD,EAAS,yBAC1BD,EAAY,UACd;GACA,AAAIE,GAAY,KAAK,IAAG,EAAY,qBAAqBA,IACpD,OAAOF,EAAY;EAC1B;EAEA,IAAIJ,EAAUG,CAAK,GACjB,KAAK,IAAMI,KAAUJ,EAAM,UACzB,KAAK,IAAMK,KAASD,GAClB,MAAML,EAAYM,CAAK;OAGtB,IAAIV,EAAUK,CAAK,GACxB,KAAK,IAAMK,KAASL,EAAM,UACxB,MAAMD,EAAYM,CAAK;CAG7B;CAEA,KAAK,IAAML,KAASM,EAAQ,QAC1B,MAAMP,EAAYC,CAAK;AAE3B"}
@@ -1,5 +1,118 @@
1
1
  // src/i18n/locales/pt-BR.ts
2
2
  var e = {
3
+ localization: {
4
+ tagsDiffer: "As merge tags são diferentes",
5
+ tagsDifferExplanation: "As merge tags não correspondem ao texto em {default}.",
6
+ changed: "Alterado em {language}",
7
+ notTranslatedCount: {
8
+ one: "{count} sem tradução",
9
+ other: "{count} sem tradução"
10
+ },
11
+ missingExplanation: "Ainda não traduzido. O e-mail mostra o texto em {default}.",
12
+ staleExplanation: "O texto em {default} mudou desde a tradução.",
13
+ currentExcerpt: "Agora: “{excerpt}”",
14
+ useDefaultLanguage: "Usar {default}",
15
+ changedProperties: {
16
+ one: "{count} propriedade difere de {default}.",
17
+ other: "{count} propriedades diferem de {default}."
18
+ },
19
+ resetChanges: "Redefinir alterações",
20
+ staleLanguages: {
21
+ one: "Desatualizado em {count} idioma",
22
+ other: "Desatualizado em {count} idiomas"
23
+ },
24
+ open: "Abrir",
25
+ resetToDefault: "Redefinir para {default}",
26
+ hiddenExplanation: "Este bloco não está no e-mail em {language}.",
27
+ editingLanguage: "Editando {language}",
28
+ languageReadOnly: "Somente leitura: {language} não está habilitado",
29
+ backToDefault: "Voltar para {default}",
30
+ translateFields: {
31
+ one: "Traduzir {count} campo",
32
+ other: "Traduzir {count} campos"
33
+ },
34
+ translationConfirmation: {
35
+ one: "Traduzir o {count} campo novamente?",
36
+ other: "Traduzir todos os {count} campos novamente?"
37
+ },
38
+ translateAllFields: {
39
+ one: "Traduzir o {count} campo",
40
+ other: "Traduzir todos os {count} campos"
41
+ },
42
+ translationDescription: "Isso substitui as traduções atuais em {language}, incluindo edições manuais. Você pode desfazer esta ação.",
43
+ translatedFields: {
44
+ one: "{count} campo traduzido.",
45
+ other: "{count} campos traduzidos."
46
+ },
47
+ translationTagsChanged: {
48
+ one: "{count} mantido porque suas tags mudaram.",
49
+ other: "{count} mantidos porque suas tags mudaram."
50
+ },
51
+ translationSkippedLocked: {
52
+ one: "{count} ignorado porque alguém o está editando.",
53
+ other: "{count} ignorados porque alguém os está editando."
54
+ },
55
+ translationMissing: {
56
+ one: "{count} não retornado.",
57
+ other: "{count} não retornados."
58
+ },
59
+ translationTooLarge: {
60
+ one: "{count} campo é longo demais para traduzir.",
61
+ other: "{count} campos são longos demais para traduzir."
62
+ },
63
+ translationError: "O serviço de tradução informou: {message}",
64
+ defaultRefused: "Não foi possível definir {language} como idioma padrão: {reason}",
65
+ defaultLockedReason: "outra pessoa está editando este template",
66
+ complete: "Completo",
67
+ gapTooltip: "{missing} ausentes, {stale} desatualizados",
68
+ moreActions: "Mais ações para {language}",
69
+ makeDefaultLanguage: "Definir como idioma padrão",
70
+ makeDefault: "Definir como padrão",
71
+ makeDefaultConfirmation: "Definir {language} como idioma padrão?",
72
+ removeConfirmation: "Remover {language}?",
73
+ removeDescription: "Isso exclui o texto e as alterações em {language}. Você pode desfazer esta ação.",
74
+ defaultChanged: "{language} agora é o idioma padrão.",
75
+ missingCount: {
76
+ one: "{count} ausente",
77
+ other: "{count} ausentes"
78
+ },
79
+ staleCount: {
80
+ one: "{count} desatualizado",
81
+ other: "{count} desatualizados"
82
+ },
83
+ hiddenBeforeDefault: {
84
+ one: "Mostre primeiro o bloco oculto em {language} ({count})",
85
+ other: "Mostre primeiro os {count} blocos ocultos em {language}"
86
+ },
87
+ defaultNotEnabled: "Adicione primeiro {default} aos idiomas habilitados",
88
+ defaultGaps: {
89
+ one: "{count} campo não tem texto em {language} e mantém o texto em {default}. Traduza-o primeiro. {default} mantém uma cópia; edições posteriores em {language} a marcam como desatualizada.",
90
+ other: "{count} campos não têm texto em {language} e mantêm o texto em {default}. Traduza-os primeiro. {default} mantém uma cópia; edições posteriores em {language} a marcam como desatualizada."
91
+ },
92
+ defaultRemaining: {
93
+ one: "{count} campo ainda está em {old}.",
94
+ other: "{count} campos ainda estão em {old}."
95
+ },
96
+ translateAllAgain: "Traduzir tudo novamente…",
97
+ translate: "Traduzir",
98
+ retranslate: "Traduzir novamente",
99
+ translating: "Traduzindo {done} de {total}…",
100
+ languages: "Idiomas",
101
+ default: "Padrão",
102
+ notEnabled: "Não habilitado",
103
+ addLanguage: "Adicionar idioma",
104
+ removeLanguage: "Remover {language}",
105
+ cancel: "Cancelar",
106
+ notTranslated: "Não traduzido",
107
+ outOfDate: "Desatualizado",
108
+ keep: "Manter",
109
+ hidden: "Oculto em {language}",
110
+ show: "Mostrar",
111
+ hide: "Ocultar em {language}",
112
+ dismiss: "Fechar",
113
+ structureNotice: "As alterações de estrutura se aplicam a todos os idiomas",
114
+ aiActiveLanguage: "O chat de IA edita {language}. As alterações de estrutura se aplicam a todos os idiomas."
115
+ },
3
116
  footer: { poweredBy: "Desenvolvido por" },
4
117
  header: {
5
118
  save: "Salvar",
@@ -561,6 +674,7 @@ var e = {
561
674
  collapsePreview: "Recolher a prévia de {block}"
562
675
  },
563
676
  comments: {
677
+ filterLanguage: "Este idioma",
564
678
  button: "Comentários",
565
679
  title: "Comentários",
566
680
  close: "Fechar",
@@ -815,3 +929,5 @@ var e = {
815
929
  }
816
930
  };
817
931
  export { e as default };
932
+
933
+ //# sourceMappingURL=pt-BR-CY5Ye7eP.js.map