@templatical/editor 0.49.0 → 0.51.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 (378) hide show
  1. package/README.md +4 -2
  2. package/dist/AiAltTextPopover-BZQ95GXL.js +106 -0
  3. package/dist/AiAltTextReview-DoBEudnE.js +206 -0
  4. package/dist/AiChatPanel-Bs6sES3b.js +550 -0
  5. package/dist/AiHeaderMenu-BEaTazx4.js +36 -0
  6. package/dist/AiPanels-CfN7A-ZA.js +33 -0
  7. package/dist/AiRewriteMenu-C3ZfDDYy.js +276 -0
  8. package/dist/{BlockIssueBadge-BdpJwim0.js → BlockIssueBadge-CKwZ1Vgn.js} +11 -11
  9. package/dist/{BlockPreviewCanvas-D_sowkf0.js → BlockPreviewCanvas-BXNLLLYi.js} +33 -33
  10. package/dist/CloudHeaderExtras-CsJMEiyN.js +23 -0
  11. package/dist/{CloudPanels-1hwFiJ0G.js → CloudPanels-B4F5m7vy.js} +66 -85
  12. package/dist/{CollaborationNotices-BWpKzueF.js → CollaborationNotices-CNuDp7Y2.js} +19 -16
  13. package/dist/{CollaboratorBar-D87phJsw.js → CollaboratorBar-BtHPiuHq.js} +22 -22
  14. package/dist/{CommentsPanel-BUvUzO3T.js → CommentsPanel-CyCM-BvT.js} +4 -4
  15. package/dist/CommentsSidebar-Ca3DyFOX.js +500 -0
  16. package/dist/{cdn/chunks/CountdownBlock-DB4JNdqh.js → CountdownBlock-DR4Xm2-T.js} +24 -26
  17. package/dist/{CountdownToolbar-CLMIwfK7.js → CountdownToolbar-CEIMPojJ.js} +55 -55
  18. package/dist/IssuesPanel-C8nMUccy.js +360 -0
  19. package/dist/{LoadingTrack-BXOptf5g.js → LoadingTrack-B0RKQWq3.js} +2 -2
  20. package/dist/{LogicTagInsertButton-CR5E4jSG.js → LogicTagInsertButton-CqfU52CO.js} +273 -268
  21. package/dist/{cdn/chunks/MediaEditModal-DD0SZ-S3.js → MediaEditModal-DHtkZ4OU.js} +202 -186
  22. package/dist/{MediaPanels-BVXDkqtH.js → MediaPanels-CGcOB2pR.js} +4 -4
  23. package/dist/{MergeTagInput-BEw_r0PJ.js → MergeTagInput-YnEkorTZ.js} +25 -25
  24. package/dist/{MergeTagModeToggle-CJTpFmVd.js → MergeTagModeToggle-Dhb1DAcQ.js} +40 -40
  25. package/dist/MergeTagTextarea-e4lnwtqZ.js +70 -0
  26. package/dist/ParagraphEditor-B6NK0ytw.js +799 -0
  27. package/dist/{RestoreVersionDialog-BaDpy3cL.js → RestoreVersionDialog-Bq_IGOLJ.js} +21 -21
  28. package/dist/{RichTextEditorContent-CsvniFlI.js → RichTextEditorContent-AOM6fylS.js} +48 -48
  29. package/dist/{SaveBlockDialog-DzWURF_e.js → SaveBlockDialog-C8GngfQx.js} +87 -87
  30. package/dist/{cdn/chunks/SavedBlocksBrowserModal-BMtyUrUP.js → SavedBlocksBrowserModal-wnkvxpm_.js} +102 -99
  31. package/dist/{SavedBlocksPanels-B3Af8ns2.js → SavedBlocksPanels-C2s3q0pJ.js} +9 -9
  32. package/dist/{SavedBlocksPickBar-Dj11-Lqp.js → SavedBlocksPickBar-BjcTiV87.js} +13 -13
  33. package/dist/TemplateSettings-BVBWpiDU.js +237 -0
  34. package/dist/{TestEmailModal-BeRYV3eg.js → TestEmailModal-SyhO9bn3.js} +57 -57
  35. package/dist/{TestEmailPanel-B8c3fQi2.js → TestEmailPanel-BDd2Rtav.js} +4 -4
  36. package/dist/{TitleEditor-CvpNUoAp.js → TitleEditor-pxD53y_l.js} +75 -75
  37. package/dist/ToggleSwitch-D51U9cmR.js +37 -0
  38. package/dist/{Toolbar-BadDSkkF.js → Toolbar-CZSPZYbj.js} +1138 -1138
  39. package/dist/{TplModal-BZgi9Tes.js → TplModal-DCzBzicE.js} +19 -19
  40. package/dist/{VersionHistoryMenu-BRlcQ8wX.js → VersionHistoryMenu-BQeWPT85.js} +35 -35
  41. package/dist/{VersionHistoryPanels-DGkllN3a.js → VersionHistoryPanels-BBm7YbRQ.js} +5 -5
  42. package/dist/{VersionPreviewBanner-F-811aps.js → VersionPreviewBanner-DUGF0tUJ.js} +9 -9
  43. package/dist/WrapperBlock-BO619LAb.js +45 -0
  44. package/dist/aiErrors-D5UOoYOt.js +41 -0
  45. package/dist/aiImageContext-BH4Ss1h3.js +48 -0
  46. package/dist/aiRewritePreview-DLGM05Ge.js +44 -0
  47. package/dist/{blockTypeIcons-CayLluou.js → blockTypeIcons-NzaYvAI4.js} +15 -14
  48. package/dist/bundle-stats.json +8 -8
  49. package/dist/{cdn/chunks/ca-DSJwJ5ov.js → ca-C7mTzW1r.js} +130 -13
  50. package/dist/cdn/chunks/AiAltTextPopover-CQu0Q_ZX.js +107 -0
  51. package/dist/cdn/chunks/AiAltTextPopover-CQu0Q_ZX.js.map +1 -0
  52. package/dist/cdn/chunks/AiAltTextReview-CI2HbWfn.js +207 -0
  53. package/dist/cdn/chunks/AiAltTextReview-CI2HbWfn.js.map +1 -0
  54. package/dist/cdn/chunks/AiChatPanel-BYqn1bKu.js +476 -0
  55. package/dist/cdn/chunks/AiChatPanel-BYqn1bKu.js.map +1 -0
  56. package/dist/cdn/chunks/AiHeaderMenu-oldAAFyL.js +37 -0
  57. package/dist/cdn/chunks/AiHeaderMenu-oldAAFyL.js.map +1 -0
  58. package/dist/cdn/chunks/AiPanels-CIFKQv8Y.js +34 -0
  59. package/dist/cdn/chunks/AiPanels-CIFKQv8Y.js.map +1 -0
  60. package/dist/cdn/chunks/AiRewriteMenu-Bhh71zcc.js +208 -0
  61. package/dist/cdn/chunks/AiRewriteMenu-Bhh71zcc.js.map +1 -0
  62. package/dist/cdn/chunks/{BlockIssueBadge-D1VBS_6x.js → BlockIssueBadge-DAn2vsMJ.js} +13 -13
  63. package/dist/cdn/chunks/{BlockIssueBadge-D1VBS_6x.js.map → BlockIssueBadge-DAn2vsMJ.js.map} +1 -1
  64. package/dist/cdn/chunks/{BlockPreviewCanvas-m2tWRyWv.js → BlockPreviewCanvas-D0--EQkP.js} +38 -38
  65. package/dist/cdn/chunks/{BlockPreviewCanvas-m2tWRyWv.js.map → BlockPreviewCanvas-D0--EQkP.js.map} +1 -1
  66. package/dist/cdn/chunks/CloudHeaderExtras-DaUU8P8R.js +25 -0
  67. package/dist/cdn/chunks/CloudHeaderExtras-DaUU8P8R.js.map +1 -0
  68. package/dist/cdn/chunks/{CloudPanels-XufhBZYF.js → CloudPanels-C3jsxo_f.js} +52 -71
  69. package/dist/cdn/chunks/CloudPanels-C3jsxo_f.js.map +1 -0
  70. package/dist/cdn/chunks/{CollaborationNotices-CBvKEj1Q.js → CollaborationNotices-DjRI8gvs.js} +23 -20
  71. package/dist/cdn/chunks/CollaborationNotices-DjRI8gvs.js.map +1 -0
  72. package/dist/cdn/chunks/{CollaboratorBar-DWW54Bn_.js → CollaboratorBar-Dfzm6A9A.js} +20 -20
  73. package/dist/cdn/chunks/{CollaboratorBar-DWW54Bn_.js.map → CollaboratorBar-Dfzm6A9A.js.map} +1 -1
  74. package/dist/cdn/chunks/CommentsPanel-CSO79OeX.js +20 -0
  75. package/dist/cdn/chunks/{CommentsPanel-R8YLLO3v.js.map → CommentsPanel-CSO79OeX.js.map} +1 -1
  76. package/dist/cdn/chunks/CommentsSidebar-CCvplq1Z.js +470 -0
  77. package/dist/cdn/chunks/{CommentsSidebar-96NZHVq3.js.map → CommentsSidebar-CCvplq1Z.js.map} +1 -1
  78. package/dist/{CountdownBlock-DPQXWRvU.js → cdn/chunks/CountdownBlock-C6USdwk3.js} +19 -17
  79. package/dist/cdn/chunks/{CountdownBlock-DB4JNdqh.js.map → CountdownBlock-C6USdwk3.js.map} +1 -1
  80. package/dist/cdn/chunks/{CountdownToolbar-tmiTPEXm.js → CountdownToolbar-Cjud2Tos.js} +70 -70
  81. package/dist/cdn/chunks/{CountdownToolbar-tmiTPEXm.js.map → CountdownToolbar-Cjud2Tos.js.map} +1 -1
  82. package/dist/cdn/chunks/IssuesPanel-BaWHPDxZ.js +340 -0
  83. package/dist/cdn/chunks/IssuesPanel-BaWHPDxZ.js.map +1 -0
  84. package/dist/cdn/chunks/{LoadingTrack-YU44CM8X.js → LoadingTrack-BIcL4NiY.js} +2 -2
  85. package/dist/cdn/chunks/{LoadingTrack-YU44CM8X.js.map → LoadingTrack-BIcL4NiY.js.map} +1 -1
  86. package/dist/cdn/chunks/{LogicTagInsertButton-BJ2t2vxC.js → LogicTagInsertButton-CsL2JDOG.js} +367 -362
  87. package/dist/cdn/chunks/LogicTagInsertButton-CsL2JDOG.js.map +1 -0
  88. package/dist/{MediaEditModal-C_wxoUMG.js → cdn/chunks/MediaEditModal-BuHCiyMu.js} +544 -560
  89. package/dist/cdn/chunks/MediaEditModal-BuHCiyMu.js.map +1 -0
  90. package/dist/cdn/chunks/MediaPanels-DAgUf_T1.js +45 -0
  91. package/dist/cdn/chunks/{MediaPanels-CkdJ_kGp.js.map → MediaPanels-DAgUf_T1.js.map} +1 -1
  92. package/dist/cdn/chunks/{MergeTagInput-7wXX71DH.js → MergeTagInput-C8U-7LxL.js} +33 -33
  93. package/dist/cdn/chunks/{MergeTagInput-7wXX71DH.js.map → MergeTagInput-C8U-7LxL.js.map} +1 -1
  94. package/dist/cdn/chunks/{MergeTagModeToggle-r9vHH4u_.js → MergeTagModeToggle-Mm-p0A52.js} +41 -41
  95. package/dist/cdn/chunks/{MergeTagModeToggle-r9vHH4u_.js.map → MergeTagModeToggle-Mm-p0A52.js.map} +1 -1
  96. package/dist/cdn/chunks/MergeTagTextarea-DuLScsWM.js +72 -0
  97. package/dist/cdn/chunks/MergeTagTextarea-DuLScsWM.js.map +1 -0
  98. package/dist/cdn/chunks/ParagraphEditor-CqSj6Ayz.js +634 -0
  99. package/dist/cdn/chunks/ParagraphEditor-CqSj6Ayz.js.map +1 -0
  100. package/dist/cdn/chunks/{RestoreVersionDialog-C5cxBRKi.js → RestoreVersionDialog-CdA5osuA.js} +25 -25
  101. package/dist/cdn/chunks/{RestoreVersionDialog-C5cxBRKi.js.map → RestoreVersionDialog-CdA5osuA.js.map} +1 -1
  102. package/dist/cdn/chunks/{RichTextEditorContent-BfE7Bkge.js → RichTextEditorContent-Q1d2xqBT.js} +46 -46
  103. package/dist/cdn/chunks/{RichTextEditorContent-BfE7Bkge.js.map → RichTextEditorContent-Q1d2xqBT.js.map} +1 -1
  104. package/dist/cdn/chunks/{SaveBlockDialog-BKbjUnPM.js → SaveBlockDialog-CijargAy.js} +77 -77
  105. package/dist/cdn/chunks/{SaveBlockDialog-BKbjUnPM.js.map → SaveBlockDialog-CijargAy.js.map} +1 -1
  106. package/dist/cdn/chunks/SavedBlocksBrowserModal-DtOz_X5S.js +357 -0
  107. package/dist/cdn/chunks/{SavedBlocksBrowserModal-BMtyUrUP.js.map → SavedBlocksBrowserModal-DtOz_X5S.js.map} +1 -1
  108. package/dist/cdn/chunks/SavedBlocksPanels-BowyED5h.js +38 -0
  109. package/dist/cdn/chunks/{SavedBlocksPanels-s_gxi1im.js.map → SavedBlocksPanels-BowyED5h.js.map} +1 -1
  110. package/dist/cdn/chunks/{SavedBlocksPickBar-B8WHk5mI.js → SavedBlocksPickBar-BPRaJBv3.js} +18 -18
  111. package/dist/cdn/chunks/{SavedBlocksPickBar-B8WHk5mI.js.map → SavedBlocksPickBar-BPRaJBv3.js.map} +1 -1
  112. package/dist/cdn/chunks/TemplateSettings-ByZeBO34.js +209 -0
  113. package/dist/cdn/chunks/{TemplateSettings-CtrzzQWl.js.map → TemplateSettings-ByZeBO34.js.map} +1 -1
  114. package/dist/cdn/chunks/{TestEmailModal-DuZKYMWD.js → TestEmailModal-BUVTj3Ic.js} +54 -54
  115. package/dist/cdn/chunks/{TestEmailModal-DuZKYMWD.js.map → TestEmailModal-BUVTj3Ic.js.map} +1 -1
  116. package/dist/cdn/chunks/TestEmailPanel-BxutYoWg.js +35 -0
  117. package/dist/cdn/chunks/{TestEmailPanel-DERaCdpG.js.map → TestEmailPanel-BxutYoWg.js.map} +1 -1
  118. package/dist/cdn/chunks/TitleEditor-Ccv6uoTz.js +199 -0
  119. package/dist/cdn/chunks/{TitleEditor-CEgxjtUX.js.map → TitleEditor-Ccv6uoTz.js.map} +1 -1
  120. package/dist/cdn/chunks/ToggleSwitch-Ctdmj621.js +39 -0
  121. package/dist/cdn/chunks/ToggleSwitch-Ctdmj621.js.map +1 -0
  122. package/dist/cdn/chunks/{Toolbar-GFIZQHzw.js → Toolbar-DoprRgTn.js} +986 -987
  123. package/dist/cdn/chunks/{Toolbar-GFIZQHzw.js.map → Toolbar-DoprRgTn.js.map} +1 -1
  124. package/dist/cdn/chunks/{TplModal-DDrbWJcE.js → TplModal-BXQzmsJX.js} +21 -21
  125. package/dist/cdn/chunks/{TplModal-DDrbWJcE.js.map → TplModal-BXQzmsJX.js.map} +1 -1
  126. package/dist/cdn/chunks/{VersionHistoryMenu-MlxsUmuT.js → VersionHistoryMenu-BF2fNCvq.js} +41 -41
  127. package/dist/cdn/chunks/{VersionHistoryMenu-MlxsUmuT.js.map → VersionHistoryMenu-BF2fNCvq.js.map} +1 -1
  128. package/dist/cdn/chunks/VersionHistoryPanels-Dal0Uk69.js +48 -0
  129. package/dist/cdn/chunks/{VersionHistoryPanels-DVOV8QLv.js.map → VersionHistoryPanels-Dal0Uk69.js.map} +1 -1
  130. package/dist/cdn/chunks/{VersionPreviewBanner-BQwRKc6S.js → VersionPreviewBanner-BaGcn-b1.js} +12 -12
  131. package/dist/cdn/chunks/{VersionPreviewBanner-BQwRKc6S.js.map → VersionPreviewBanner-BaGcn-b1.js.map} +1 -1
  132. package/dist/cdn/chunks/WrapperBlock-DkQJtLz0.js +47 -0
  133. package/dist/cdn/chunks/{WrapperBlock-CFuP4R0c.js.map → WrapperBlock-DkQJtLz0.js.map} +1 -1
  134. package/dist/cdn/chunks/aiErrors-D5UOoYOt.js +43 -0
  135. package/dist/cdn/chunks/aiErrors-D5UOoYOt.js.map +1 -0
  136. package/dist/cdn/chunks/aiImageContext-BH4Ss1h3.js +50 -0
  137. package/dist/cdn/chunks/aiImageContext-BH4Ss1h3.js.map +1 -0
  138. package/dist/cdn/chunks/aiRewritePreview-DLGM05Ge.js +46 -0
  139. package/dist/cdn/chunks/aiRewritePreview-DLGM05Ge.js.map +1 -0
  140. package/dist/cdn/chunks/blockTypeIcons-ikZAmd6U.js +22 -0
  141. package/dist/cdn/chunks/{blockTypeIcons-BnAd8qsP.js.map → blockTypeIcons-ikZAmd6U.js.map} +1 -1
  142. package/dist/{ca-DSJwJ5ov.js → cdn/chunks/ca-C7mTzW1r.js} +132 -11
  143. package/dist/cdn/chunks/ca-C7mTzW1r.js.map +1 -0
  144. package/dist/cdn/chunks/{cloud-CI_fgDyy.js → createCloudRuntime-DpBWhrv3.js} +489 -593
  145. package/dist/cdn/chunks/createCloudRuntime-DpBWhrv3.js.map +1 -0
  146. package/dist/cdn/chunks/de-DBOTcDj2.js +22 -0
  147. package/dist/cdn/chunks/de-DBOTcDj2.js.map +1 -0
  148. package/dist/{de-CBE6O79z.js → cdn/chunks/de-DNuYQTmS.js} +132 -11
  149. package/dist/cdn/chunks/de-DNuYQTmS.js.map +1 -0
  150. package/dist/{dist-Bv_GBr2l.js → cdn/chunks/dist-Bo8Thh8v.js} +60 -58
  151. package/dist/cdn/chunks/{dist-Doy3r07H.js.map → dist-Bo8Thh8v.js.map} +1 -1
  152. package/dist/cdn/chunks/dist-S-rLGqax.js +406 -0
  153. package/dist/cdn/chunks/{dist-DdwjXLme.js.map → dist-S-rLGqax.js.map} +1 -1
  154. package/dist/cdn/chunks/{draggable-akeQH_JP.js → draggable-DZ0gwUJ6.js} +1822 -1728
  155. package/dist/cdn/chunks/draggable-DZ0gwUJ6.js.map +1 -0
  156. package/dist/cdn/chunks/{editor-modal-HJBy9kLj.js → editor-modal-CI6EfeMd.js} +884 -884
  157. package/dist/cdn/chunks/{editor-modal-HJBy9kLj.js.map → editor-modal-CI6EfeMd.js.map} +1 -1
  158. package/dist/cdn/chunks/en-CDhWRrF_.js +22 -0
  159. package/dist/cdn/chunks/en-CDhWRrF_.js.map +1 -0
  160. package/dist/{en-CDexnk0p.js → cdn/chunks/en-CW71OK66.js} +132 -11
  161. package/dist/cdn/chunks/en-CW71OK66.js.map +1 -0
  162. package/dist/cdn/chunks/en-ifvu6oPv.js +1 -0
  163. package/dist/{es-BE42B6uN.js → cdn/chunks/es-DdK7zQfi.js} +132 -11
  164. package/dist/cdn/chunks/es-DdK7zQfi.js.map +1 -0
  165. package/dist/cdn/chunks/{extensions-koOuDeZS.js → extensions-taJTZlLK.js} +59 -59
  166. package/dist/cdn/chunks/{extensions-koOuDeZS.js.map → extensions-taJTZlLK.js.map} +1 -1
  167. package/dist/{fr-DlJFPDQR.js → cdn/chunks/fr-Dz5Bgb7-.js} +132 -11
  168. package/dist/cdn/chunks/fr-Dz5Bgb7-.js.map +1 -0
  169. package/dist/cdn/chunks/{icons-CjlNV8xD.js → icons-DNX6StSs.js} +178 -145
  170. package/dist/cdn/chunks/icons-DNX6StSs.js.map +1 -0
  171. package/dist/{ja-CUT8gkNI.js → cdn/chunks/ja-Di-zJiT8.js} +132 -11
  172. package/dist/cdn/chunks/ja-Di-zJiT8.js.map +1 -0
  173. package/dist/cdn/chunks/keys-BTpmg2Tt.js +12 -0
  174. package/dist/cdn/chunks/keys-BTpmg2Tt.js.map +1 -0
  175. package/dist/{logger-BBlvSn6q.js → cdn/chunks/logger-Tj0RPskW.js} +7 -1
  176. package/dist/cdn/chunks/logger-Tj0RPskW.js.map +1 -0
  177. package/dist/{nl-bXWqqRyS.js → cdn/chunks/nl-CvVuHYFL.js} +132 -11
  178. package/dist/cdn/chunks/{nl-bXWqqRyS.js.map → nl-CvVuHYFL.js.map} +1 -1
  179. package/dist/cdn/chunks/normalizeMergeTagMarkup-DyePIGqu.js +199 -0
  180. package/dist/cdn/chunks/normalizeMergeTagMarkup-DyePIGqu.js.map +1 -0
  181. package/dist/cdn/chunks/{preRenderCustomBlocks-DqKbdTJ8.js → preRenderCustomBlocks-Dc-QLntG.js} +4 -4
  182. package/dist/cdn/chunks/{preRenderCustomBlocks-DqKbdTJ8.js.map → preRenderCustomBlocks-Dc-QLntG.js.map} +1 -1
  183. package/dist/cdn/chunks/pt-BR-CHM-ZKvE.js +22 -0
  184. package/dist/cdn/chunks/pt-BR-CHM-ZKvE.js.map +1 -0
  185. package/dist/{pt-BR-2_H4-wlb.js → cdn/chunks/pt-BR-ZhO4vgyq.js} +132 -11
  186. package/dist/cdn/chunks/pt-BR-ZhO4vgyq.js.map +1 -0
  187. package/dist/cdn/chunks/sanitizeRichTextHtml-DeISfLFr.js +62 -0
  188. package/dist/cdn/chunks/sanitizeRichTextHtml-DeISfLFr.js.map +1 -0
  189. package/dist/cdn/chunks/socialIcons-BBvsTwCV.js +2032 -0
  190. package/dist/cdn/chunks/socialIcons-BBvsTwCV.js.map +1 -0
  191. package/dist/{dist-DBG3nh3k.js → cdn/chunks/src-BNFnxfrA.js} +552 -350
  192. package/dist/cdn/chunks/src-BNFnxfrA.js.map +1 -0
  193. package/dist/cdn/chunks/src-Bs_yxk3h.js +4392 -0
  194. package/dist/cdn/chunks/src-Bs_yxk3h.js.map +1 -0
  195. package/dist/cdn/chunks/{src-B77z1iw4.js → src-K6fw_35b.js} +113 -113
  196. package/dist/cdn/chunks/{src-B77z1iw4.js.map → src-K6fw_35b.js.map} +1 -1
  197. package/dist/cdn/chunks/{tiptap-B1RfWFzB.js → tiptap-CtVrAViq.js} +43 -43
  198. package/dist/cdn/chunks/{tiptap-B1RfWFzB.js.map → tiptap-CtVrAViq.js.map} +1 -1
  199. package/dist/cdn/chunks/{useCloudI18n-kp07GQmk.js → useCloudI18n-AVXhzbhQ.js} +4 -4
  200. package/dist/cdn/chunks/{useCloudI18n-kp07GQmk.js.map → useCloudI18n-AVXhzbhQ.js.map} +1 -1
  201. package/dist/cdn/chunks/useEditorCore-CCVFi1YZ.js +2586 -0
  202. package/dist/cdn/chunks/useEditorCore-CCVFi1YZ.js.map +1 -0
  203. package/dist/cdn/chunks/useEditorRoot-CR5GjJD6.js +10 -0
  204. package/dist/cdn/chunks/{useEditorRoot-5SBqm90x.js.map → useEditorRoot-CR5GjJD6.js.map} +1 -1
  205. package/dist/cdn/chunks/{useI18n-DEqtEgOs.js → useI18n-CbVubQhM.js} +3 -3
  206. package/dist/cdn/chunks/{useI18n-DEqtEgOs.js.map → useI18n-CbVubQhM.js.map} +1 -1
  207. package/dist/cdn/chunks/{useLogicTag-X8bc5qNl.js → useLogicTag-B49Nc53Y.js} +5 -5
  208. package/dist/cdn/chunks/{useLogicTag-X8bc5qNl.js.map → useLogicTag-B49Nc53Y.js.map} +1 -1
  209. package/dist/cdn/chunks/{useMergeTag-DFoOexIQ.js → useMergeTag-B0KryMj8.js} +5 -5
  210. package/dist/cdn/chunks/{useMergeTag-DFoOexIQ.js.map → useMergeTag-B0KryMj8.js.map} +1 -1
  211. package/dist/cdn/chunks/{usePopoverPosition-Cz9-XiXR.js → usePopoverPosition-C829ps5i.js} +4 -4
  212. package/dist/cdn/chunks/{usePopoverPosition-Cz9-XiXR.js.map → usePopoverPosition-C829ps5i.js.map} +1 -1
  213. package/dist/cdn/chunks/useScrollToBlock-CAwvulog.js +51 -0
  214. package/dist/cdn/chunks/useScrollToBlock-CAwvulog.js.map +1 -0
  215. package/dist/cdn/chunks/{withCurrentFont-D-f61ghC.js → withCurrentFont-DFPXeVfG.js} +2 -2
  216. package/dist/cdn/chunks/{withCurrentFont-D-f61ghC.js.map → withCurrentFont-DFPXeVfG.js.map} +1 -1
  217. package/dist/cdn/editor.css +1 -1
  218. package/dist/cdn/editor.js +2151 -1480
  219. package/dist/cdn/editor.js.map +1 -1
  220. package/dist/{check-DQQzkmIC.js → check-yYsp5Xpk.js} +1 -1
  221. package/dist/{chevron-down-CIF4bdon.js → chevron-down-DTmD06_j.js} +1 -1
  222. package/dist/{chevron-right-Cg7Xu-ev.js → chevron-right-BSeYZOxc.js} +1 -1
  223. package/dist/{chevron-up-Csu7ISD-.js → chevron-up-BOApwrxi.js} +1 -1
  224. package/dist/{circle-alert-YUvIJAgY.js → circle-alert-BMszY8im.js} +1 -1
  225. package/dist/{clock-CnSIGKQW.js → clock-HADxnl6-.js} +1 -1
  226. package/dist/{cloud-YUYDtdHt.js → createCloudRuntime-DVQI_ReU.js} +474 -570
  227. package/dist/{createLucideIcon-BcP1sjdp.js → createLucideIcon-0lYYH3EW.js} +6 -6
  228. package/dist/de-DBOTcDj2.js +20 -0
  229. package/dist/{cdn/chunks/de-CBE6O79z.js → de-DNuYQTmS.js} +130 -13
  230. package/dist/{cdn/chunks/dist-Doy3r07H.js → dist-C7EtxNCb.js} +49 -51
  231. package/dist/{dist-CNqjHA8e.js → dist-C_dV9QAx.js} +130 -130
  232. package/dist/{cdn/chunks/dist-DdwjXLme.js → dist-DI4_YSnG.js} +111 -110
  233. package/dist/{cdn/chunks/src-CvLTYGdO.js → dist-DtOF3bDW.js} +446 -393
  234. package/dist/{editor-modal--7_9A6j-.js → editor-modal-Bzhl-PgI.js} +832 -834
  235. package/dist/en-CDhWRrF_.js +20 -0
  236. package/dist/{cdn/chunks/en-CDexnk0p.js → en-CW71OK66.js} +130 -13
  237. package/dist/en-DwV15ltA.js +1 -0
  238. package/dist/{cdn/chunks/es-BE42B6uN.js → es-DdK7zQfi.js} +130 -13
  239. package/dist/{extensions-zwsZlWjH.js → extensions-CdyweA50.js} +57 -57
  240. package/dist/{eye-B1bua-ck.js → eye-DWkSvYpj.js} +1 -1
  241. package/dist/{cdn/chunks/fr-DlJFPDQR.js → fr-Dz5Bgb7-.js} +130 -13
  242. package/dist/image-DesWjcZ4.js +28 -0
  243. package/dist/index.d.ts +361 -24
  244. package/dist/{info-x26nGOo2.js → info-ClWJGoZy.js} +1 -1
  245. package/dist/{cdn/chunks/ja-CUT8gkNI.js → ja-Di-zJiT8.js} +130 -13
  246. package/dist/keys-Zd9KWRD1.js +10 -0
  247. package/dist/{link-CezhndyR.js → link-BqRicFTA.js} +1 -1
  248. package/dist/{list-DQqdptI0.js → list-bojQr9bn.js} +1 -1
  249. package/dist/{loader-circle-DCEeoYoi.js → loader-circle-B2B8LbUu.js} +1 -1
  250. package/dist/{cdn/chunks/logger-ByvdoAwq.js → logger-k9Nbj3Cp.js} +5 -3
  251. package/dist/{message-circle-BLGzfv_7.js → message-circle-BEuiNsyZ.js} +1 -1
  252. package/dist/{cdn/chunks/nl-bXWqqRyS.js → nl-CvVuHYFL.js} +130 -13
  253. package/dist/normalizeMergeTagMarkup-P6SUBuPv.js +197 -0
  254. package/dist/{package-D_kEQCMU.js → package-DCROB4aM.js} +1 -1
  255. package/dist/{pencil-Dct8zGLy.js → pencil-CEotCKbf.js} +1 -1
  256. package/dist/{preRenderCustomBlocks-CtKJecE-.js → preRenderCustomBlocks-D8rr61_z.js} +4 -4
  257. package/dist/pt-BR-CHM-ZKvE.js +20 -0
  258. package/dist/{cdn/chunks/pt-BR-2_H4-wlb.js → pt-BR-ZhO4vgyq.js} +130 -13
  259. package/dist/{refresh-cw-tGMRDxr8.js → refresh-cw-C6M2mHNC.js} +12 -2
  260. package/dist/{runtime-dom.esm-bundler-DYn1z2Xf.js → runtime-dom.esm-bundler-B8WCZWUm.js} +134 -134
  261. package/dist/sanitizeRichTextHtml-DeISfLFr.js +60 -0
  262. package/dist/{search-Bm2cCQpe.js → search-Cy99zPYf.js} +1 -1
  263. package/dist/{send-sVLaKZ7f.js → send-BDLJFsf3.js} +1 -1
  264. package/dist/{smartphone-B2W81p02.js → smartphone-CVvQaNA4.js} +1 -1
  265. package/dist/{cdn/chunks/socialIcons-CkZSYpoG.js → socialIcons-Dd-jRiVe.js} +688 -693
  266. package/dist/{sparkles-a1qkBZ8X.js → sparkles-Ce0Qz0ox.js} +1 -1
  267. package/dist/square-BWlolnXe.js +15 -0
  268. package/dist/style.css +1 -1
  269. package/dist/templatical-editor.js +2114 -1422
  270. package/dist/{text-align-start-CTuwQ5YW.js → text-align-start-D1V5gPTy.js} +1 -1
  271. package/dist/{trash-I3D2peFQ.js → trash-CZfiUFmw.js} +1 -1
  272. package/dist/{triangle-alert-CenxmLRE.js → triangle-alert-CFDzyFC7.js} +1 -1
  273. package/dist/upload-BJfvdIrD.js +36 -0
  274. package/dist/{useCloudI18n-CGVEZV3o.js → useCloudI18n-Dcjua65H.js} +5 -5
  275. package/dist/{useEditorCore-DRbMRe8F.js → useEditorCore-BTLeAVlM.js} +1463 -1499
  276. package/dist/{useEditorRoot-BVm2-1N8.js → useEditorRoot-DUy67lJu.js} +2 -2
  277. package/dist/{useI18n-CSh4gO5c.js → useI18n-BdoY7xDE.js} +4 -4
  278. package/dist/{useLogicTag-zcI6BWIf.js → useLogicTag-DKLZ1T9H.js} +3 -3
  279. package/dist/{useMergeTag-C-iBLlp0.js → useMergeTag-Bhdx7AKk.js} +3 -3
  280. package/dist/{usePopoverPosition-CMcsMBtK.js → usePopoverPosition-BZea45XK.js} +2 -2
  281. package/dist/useScrollToBlock-FmNMALM_.js +74 -0
  282. package/dist/{vue.runtime.esm-bundler-DV0Wx4r_.js → vue.runtime.esm-bundler-DgFJ6GPG.js} +1428 -1332
  283. package/dist/{withCurrentFont-D62njRLu.js → withCurrentFont-BATJHNve.js} +1 -1
  284. package/dist/{x-KFQ4S-Kz.js → x-CZ0Js0hA.js} +1 -1
  285. package/package.json +14 -12
  286. package/dist/AiChatSidebar-CdjTb9ej.js +0 -230
  287. package/dist/AiFeatureMenu-DKm7VYCs.js +0 -57
  288. package/dist/CloudHeaderExtras-CI8RR9hG.js +0 -55
  289. package/dist/CommentsSidebar-J65znlrH.js +0 -500
  290. package/dist/DesignReferenceSidebar-BTwCFgz8.js +0 -279
  291. package/dist/IssuesPanel-DeeVsfG7.js +0 -117
  292. package/dist/ParagraphEditor-zLV44z-R.js +0 -797
  293. package/dist/SavedBlocksBrowserModal-B8DCFW7t.js +0 -360
  294. package/dist/TemplateScoringPanel-Ba9sgvjS.js +0 -273
  295. package/dist/TemplateSettings-Cu5X9DgA.js +0 -246
  296. package/dist/ToggleSwitch-DHweVJOr.js +0 -102
  297. package/dist/WrapperBlock-DiiaxpMb.js +0 -45
  298. package/dist/cdn/chunks/AiChatSidebar-yXJ85Zcg.js +0 -205
  299. package/dist/cdn/chunks/AiChatSidebar-yXJ85Zcg.js.map +0 -1
  300. package/dist/cdn/chunks/AiFeatureMenu-4ydjrhsQ.js +0 -57
  301. package/dist/cdn/chunks/AiFeatureMenu-4ydjrhsQ.js.map +0 -1
  302. package/dist/cdn/chunks/CloudHeaderExtras-DEkRww7n.js +0 -56
  303. package/dist/cdn/chunks/CloudHeaderExtras-DEkRww7n.js.map +0 -1
  304. package/dist/cdn/chunks/CloudPanels-XufhBZYF.js.map +0 -1
  305. package/dist/cdn/chunks/CollaborationNotices-CBvKEj1Q.js.map +0 -1
  306. package/dist/cdn/chunks/CommentsPanel-R8YLLO3v.js +0 -20
  307. package/dist/cdn/chunks/CommentsSidebar-96NZHVq3.js +0 -470
  308. package/dist/cdn/chunks/DesignReferenceSidebar-D14IIu_P.js +0 -229
  309. package/dist/cdn/chunks/DesignReferenceSidebar-D14IIu_P.js.map +0 -1
  310. package/dist/cdn/chunks/IssuesPanel-BoPiCLGc.js +0 -100
  311. package/dist/cdn/chunks/IssuesPanel-BoPiCLGc.js.map +0 -1
  312. package/dist/cdn/chunks/LogicTagInsertButton-BJ2t2vxC.js.map +0 -1
  313. package/dist/cdn/chunks/MediaEditModal-DD0SZ-S3.js.map +0 -1
  314. package/dist/cdn/chunks/MediaPanels-CkdJ_kGp.js +0 -45
  315. package/dist/cdn/chunks/ParagraphEditor-CJQjRHXV.js +0 -632
  316. package/dist/cdn/chunks/ParagraphEditor-CJQjRHXV.js.map +0 -1
  317. package/dist/cdn/chunks/SavedBlocksPanels-s_gxi1im.js +0 -38
  318. package/dist/cdn/chunks/TemplateScoringPanel-BBPnHILC.js +0 -237
  319. package/dist/cdn/chunks/TemplateScoringPanel-BBPnHILC.js.map +0 -1
  320. package/dist/cdn/chunks/TemplateSettings-CtrzzQWl.js +0 -208
  321. package/dist/cdn/chunks/TestEmailPanel-DERaCdpG.js +0 -35
  322. package/dist/cdn/chunks/TitleEditor-CEgxjtUX.js +0 -199
  323. package/dist/cdn/chunks/ToggleSwitch-DGQ7iRc-.js +0 -104
  324. package/dist/cdn/chunks/ToggleSwitch-DGQ7iRc-.js.map +0 -1
  325. package/dist/cdn/chunks/VersionHistoryPanels-DVOV8QLv.js +0 -48
  326. package/dist/cdn/chunks/WrapperBlock-CFuP4R0c.js +0 -47
  327. package/dist/cdn/chunks/blockTypeIcons-BnAd8qsP.js +0 -22
  328. package/dist/cdn/chunks/ca-DSJwJ5ov.js.map +0 -1
  329. package/dist/cdn/chunks/cloud-CI_fgDyy.js.map +0 -1
  330. package/dist/cdn/chunks/createCloudRuntime-DiYCJ21w.js +0 -358
  331. package/dist/cdn/chunks/createCloudRuntime-DiYCJ21w.js.map +0 -1
  332. package/dist/cdn/chunks/de-CBE6O79z.js.map +0 -1
  333. package/dist/cdn/chunks/de-D_atmUVB.js +0 -89
  334. package/dist/cdn/chunks/de-D_atmUVB.js.map +0 -1
  335. package/dist/cdn/chunks/draggable-akeQH_JP.js.map +0 -1
  336. package/dist/cdn/chunks/en-CDexnk0p.js.map +0 -1
  337. package/dist/cdn/chunks/en-DhJLnaBx.js +0 -89
  338. package/dist/cdn/chunks/en-DhJLnaBx.js.map +0 -1
  339. package/dist/cdn/chunks/en-Ve-PWSXu.js +0 -1
  340. package/dist/cdn/chunks/es-BE42B6uN.js.map +0 -1
  341. package/dist/cdn/chunks/fr-DlJFPDQR.js.map +0 -1
  342. package/dist/cdn/chunks/icons-CjlNV8xD.js.map +0 -1
  343. package/dist/cdn/chunks/ja-CUT8gkNI.js.map +0 -1
  344. package/dist/cdn/chunks/keys-UAWhQ3zW.js +0 -12
  345. package/dist/cdn/chunks/keys-UAWhQ3zW.js.map +0 -1
  346. package/dist/cdn/chunks/logger-ByvdoAwq.js.map +0 -1
  347. package/dist/cdn/chunks/pt-BR-2_H4-wlb.js.map +0 -1
  348. package/dist/cdn/chunks/pt-BR-BphMoUTw.js +0 -89
  349. package/dist/cdn/chunks/pt-BR-BphMoUTw.js.map +0 -1
  350. package/dist/cdn/chunks/socialIcons-CkZSYpoG.js.map +0 -1
  351. package/dist/cdn/chunks/src-B1e5SSYP.js +0 -1272
  352. package/dist/cdn/chunks/src-B1e5SSYP.js.map +0 -1
  353. package/dist/cdn/chunks/src-CvLTYGdO.js.map +0 -1
  354. package/dist/cdn/chunks/timeouts-o5Y9BuqI.js +0 -6
  355. package/dist/cdn/chunks/timeouts-o5Y9BuqI.js.map +0 -1
  356. package/dist/cdn/chunks/useAliveFlag-PuXh83UK.js +0 -12
  357. package/dist/cdn/chunks/useAliveFlag-PuXh83UK.js.map +0 -1
  358. package/dist/cdn/chunks/useEditorCore-DpCFvHg_.js +0 -2623
  359. package/dist/cdn/chunks/useEditorCore-DpCFvHg_.js.map +0 -1
  360. package/dist/cdn/chunks/useEditorRoot-5SBqm90x.js +0 -10
  361. package/dist/cdn/chunks/useScrollToBlock-MNzurEZV.js +0 -21
  362. package/dist/cdn/chunks/useScrollToBlock-MNzurEZV.js.map +0 -1
  363. package/dist/copy-CUC43md_.js +0 -19
  364. package/dist/createCloudRuntime-BMDRjL0k.js +0 -356
  365. package/dist/de-D_atmUVB.js +0 -87
  366. package/dist/dist-CCqn-RqE.js +0 -407
  367. package/dist/en-BHCMzqib.js +0 -1
  368. package/dist/en-DhJLnaBx.js +0 -87
  369. package/dist/image-up-BqiO7KCO.js +0 -27
  370. package/dist/keys-BymCnLHD.js +0 -10
  371. package/dist/plus-BDd0gTEm.js +0 -14
  372. package/dist/pt-BR-BphMoUTw.js +0 -87
  373. package/dist/shield-check-YhsbXfQc.js +0 -14
  374. package/dist/socialIcons-Bwv-49EB.js +0 -2167
  375. package/dist/timeouts-o5Y9BuqI.js +0 -4
  376. package/dist/upload-uU2cK0Ce.js +0 -21
  377. package/dist/useAliveFlag-BjP0Gxza.js +0 -10
  378. package/dist/useScrollToBlock-CdCQK9QQ.js +0 -47
@@ -1,11 +1,14 @@
1
- import { R as e, Z as t, s as n } from "./vue.runtime.esm-bundler-DV0Wx4r_.js";
2
- import { f as r } from "./dist-DBG3nh3k.js";
1
+ import { M as e, Q as t, c as n, z as r } from "./vue.runtime.esm-bundler-DgFJ6GPG.js";
2
+ import { p as i } from "./dist-DtOF3bDW.js";
3
+ import { i as a, u as o } from "./keys-Zd9KWRD1.js";
4
+ import { t as s } from "./logger-k9Nbj3Cp.js";
5
+ import { t as c } from "./preRenderCustomBlocks-D8rr61_z.js";
3
6
  //#region ../core/dist/cloud/index.js
4
- function i(e) {
5
- let t = e instanceof r ? e.statusCode : void 0;
7
+ function l(e) {
8
+ let t = e instanceof i ? e.statusCode : void 0;
6
9
  return t !== void 0 && t >= 400 && t < 500;
7
10
  }
8
- var a = class e {
11
+ var u = class e {
9
12
  static DEFAULT_BASE_URL = "https://templatical.com";
10
13
  accessToken = null;
11
14
  expiresAt = null;
@@ -78,9 +81,9 @@ var a = class e {
78
81
  credentials: this.requestOptions.credentials ?? "include"
79
82
  };
80
83
  e === "POST" && this.requestOptions.body && (t["Content-Type"] = "application/json", n.body = JSON.stringify(this.requestOptions.body));
81
- let i = await fetch(this.url, n);
82
- if (!i.ok) throw new r(`Token refresh failed: ${i.status}`, i.status);
83
- let a = await i.json();
84
+ let r = await fetch(this.url, n);
85
+ if (!r.ok) throw new i(`Token refresh failed: ${r.status}`, r.status);
86
+ let a = await r.json();
84
87
  if (!a.token || !a.expiresAt || !a.projectId || !a.tenant) throw Error("Invalid token response: missing token, expiresAt, projectId, or tenant");
85
88
  return this.accessToken = a.token, this.expiresAt = /* @__PURE__ */ new Date(a.expiresAt * 1e3), this._projectId = a.projectId, this._tenantSlug = a.tenant, this._testEmailConfig = a.testEmail?.allowedEmails && a.testEmail?.signature ? {
86
89
  allowedEmails: a.testEmail.allowedEmails,
@@ -106,54 +109,47 @@ var a = class e {
106
109
  return a.status === 401 && (a = await i(await this.refreshToken())), a;
107
110
  }
108
111
  };
109
- function o(e, t) {
112
+ function d(e, t) {
110
113
  return e.replace(/\{(\w+)\}/g, (e, n) => encodeURIComponent(t[n] ?? ""));
111
114
  }
112
- var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{template}`, l = `${c}/ai`, u = `${s}/media`, d = `${u}/folders`, f = `${s}/saved-modules`, p = {
115
+ var f = "/api/v1/projects/{project}/tenants/{tenant}", p = `${f}/templates/{template}`, m = `${f}/media`, h = `${m}/folders`, g = `${f}/saved-modules`, _ = {
113
116
  health: "/api/v1/health",
114
- "projects.config": `${s}/config`,
115
- "broadcasting.auth": `${s}/broadcasting/auth`,
116
- "templates.store": `${s}/templates`,
117
- "templates.show": `${c}`,
118
- "templates.update": `${c}`,
119
- "templates.destroy": `${c}`,
120
- "templates.export": `${c}/export`,
121
- "templates.importFromBeefree": `${s}/templates/import/from-beefree`,
122
- "templates.sendTestEmail": `${c}/send-test-email`,
123
- "versions.index": `${c}/versions`,
124
- "versions.store": `${c}/versions`,
125
- "versions.show": `${c}/versions/{version}`,
126
- "versions.restore": `${c}/versions/{version}/restore`,
127
- "comments.index": `${c}/comments`,
128
- "comments.store": `${c}/comments`,
129
- "comments.update": `${c}/comments/{comment}`,
130
- "comments.destroy": `${c}/comments/{comment}`,
131
- "comments.resolve": `${c}/comments/{comment}/resolve`,
132
- "ai.generate": `${l}/generate`,
133
- "ai.conversationMessages": `${l}/conversation-messages`,
134
- "ai.suggestions": `${l}/suggestions`,
135
- "ai.rewriteText": `${l}/rewrite-text`,
136
- "ai.score": `${l}/score`,
137
- "ai.fixFinding": `${l}/fix-finding`,
138
- "ai.generateFromDesign": `${l}/generate-from-design`,
139
- "media.upload": `${u}/upload`,
140
- "media.browse": `${u}/browse`,
141
- "media.delete": `${u}/delete`,
142
- "media.move": `${u}/move`,
143
- "media.update": `${u}/{media}`,
144
- "media.replace": `${u}/{media}/replace`,
145
- "media.checkUsage": `${u}/check-usage`,
146
- "media.frequentlyUsed": `${u}/frequently-used`,
147
- "media.importFromUrl": `${u}/import-from-url`,
148
- "folders.index": `${d}`,
149
- "folders.store": `${d}`,
150
- "folders.update": `${d}/{mediaFolder}`,
151
- "folders.destroy": `${d}/{mediaFolder}`,
152
- "savedModules.index": `${f}`,
153
- "savedModules.store": `${f}`,
154
- "savedModules.update": `${f}/{savedModule}`,
155
- "savedModules.destroy": `${f}/{savedModule}`
156
- }, m = class {
117
+ "projects.config": `${f}/config`,
118
+ "broadcasting.auth": `${f}/broadcasting/auth`,
119
+ "templates.store": `${f}/templates`,
120
+ "templates.show": `${p}`,
121
+ "templates.update": `${p}`,
122
+ "templates.destroy": `${p}`,
123
+ "templates.export": `${p}/export`,
124
+ "templates.importFromBeefree": `${f}/templates/import/from-beefree`,
125
+ "templates.sendTestEmail": `${p}/send-test-email`,
126
+ "versions.index": `${p}/versions`,
127
+ "versions.store": `${p}/versions`,
128
+ "versions.show": `${p}/versions/{version}`,
129
+ "versions.restore": `${p}/versions/{version}/restore`,
130
+ "comments.index": `${p}/comments`,
131
+ "comments.store": `${p}/comments`,
132
+ "comments.update": `${p}/comments/{comment}`,
133
+ "comments.destroy": `${p}/comments/{comment}`,
134
+ "comments.resolve": `${p}/comments/{comment}/resolve`,
135
+ "media.upload": `${m}/upload`,
136
+ "media.browse": `${m}/browse`,
137
+ "media.delete": `${m}/delete`,
138
+ "media.move": `${m}/move`,
139
+ "media.update": `${m}/{media}`,
140
+ "media.replace": `${m}/{media}/replace`,
141
+ "media.checkUsage": `${m}/check-usage`,
142
+ "media.frequentlyUsed": `${m}/frequently-used`,
143
+ "media.importFromUrl": `${m}/import-from-url`,
144
+ "folders.index": `${h}`,
145
+ "folders.store": `${h}`,
146
+ "folders.update": `${h}/{mediaFolder}`,
147
+ "folders.destroy": `${h}/{mediaFolder}`,
148
+ "savedModules.index": `${g}`,
149
+ "savedModules.store": `${g}`,
150
+ "savedModules.update": `${g}/{savedModule}`,
151
+ "savedModules.destroy": `${g}/{savedModule}`
152
+ }, v = class {
157
153
  authManager;
158
154
  constructor(e) {
159
155
  this.authManager = e;
@@ -181,7 +177,7 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
181
177
  });
182
178
  if (!n.ok) {
183
179
  let e = await n.json().catch(() => ({ message: `HTTP error ${n.status}` })), t = this.extractFirstValidationError(e);
184
- throw new r(t, n.status);
180
+ throw new i(t, n.status);
185
181
  }
186
182
  if (n.status !== 204) return (await n.json()).data;
187
183
  }
@@ -193,7 +189,7 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
193
189
  return e.message;
194
190
  }
195
191
  async createTemplate(e, t) {
196
- return this.request(o(p["templates.store"], this.baseParams), {
192
+ return this.request(d(_["templates.store"], this.baseParams), {
197
193
  method: "POST",
198
194
  body: JSON.stringify(t === void 0 ? { content: e } : {
199
195
  content: e,
@@ -202,13 +198,13 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
202
198
  });
203
199
  }
204
200
  async getTemplate(e) {
205
- return this.request(o(p["templates.show"], {
201
+ return this.request(d(_["templates.show"], {
206
202
  ...this.baseParams,
207
203
  template: e
208
204
  }));
209
205
  }
210
206
  async updateTemplate(e, t) {
211
- return this.request(o(p["templates.update"], {
207
+ return this.request(d(_["templates.update"], {
212
208
  ...this.baseParams,
213
209
  template: e
214
210
  }), {
@@ -217,7 +213,7 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
217
213
  });
218
214
  }
219
215
  async createVersion(e, t, n) {
220
- return this.request(o(p["versions.store"], {
216
+ return this.request(d(_["versions.store"], {
221
217
  ...this.baseParams,
222
218
  template: e
223
219
  }), {
@@ -229,26 +225,26 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
229
225
  });
230
226
  }
231
227
  async deleteTemplate(e) {
232
- return this.request(o(p["templates.destroy"], {
228
+ return this.request(d(_["templates.destroy"], {
233
229
  ...this.baseParams,
234
230
  template: e
235
231
  }), { method: "DELETE" });
236
232
  }
237
233
  async getVersions(e) {
238
- return this.request(o(p["versions.index"], {
234
+ return this.request(d(_["versions.index"], {
239
235
  ...this.baseParams,
240
236
  template: e
241
237
  }));
242
238
  }
243
239
  async getVersion(e, t) {
244
- return this.request(o(p["versions.show"], {
240
+ return this.request(d(_["versions.show"], {
245
241
  ...this.baseParams,
246
242
  template: e,
247
243
  version: t
248
244
  }));
249
245
  }
250
246
  async restoreVersion(e, t) {
251
- return this.request(o(p["versions.restore"], {
247
+ return this.request(d(_["versions.restore"], {
252
248
  ...this.baseParams,
253
249
  template: e,
254
250
  version: t
@@ -259,7 +255,7 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
259
255
  custom_fonts: t.customFonts,
260
256
  default_fallback: t.defaultFallback
261
257
  }) : void 0;
262
- return this.request(o(p["templates.export"], {
258
+ return this.request(d(_["templates.export"], {
263
259
  ...this.baseParams,
264
260
  template: e
265
261
  }), {
@@ -268,7 +264,7 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
268
264
  });
269
265
  }
270
266
  async sendTestEmail(e, t) {
271
- await this.request(o(p["templates.sendTestEmail"], {
267
+ await this.request(d(_["templates.sendTestEmail"], {
272
268
  ...this.baseParams,
273
269
  template: e
274
270
  }), {
@@ -277,11 +273,11 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
277
273
  });
278
274
  }
279
275
  commentsUrl(e, t) {
280
- return t ? o(p["comments.update"], {
276
+ return t ? d(_["comments.update"], {
281
277
  ...this.baseParams,
282
278
  template: e,
283
279
  comment: t
284
- }) : o(p["comments.index"], {
280
+ }) : d(_["comments.index"], {
285
281
  ...this.baseParams,
286
282
  template: e
287
283
  });
@@ -311,7 +307,7 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
311
307
  });
312
308
  }
313
309
  async resolveComment(e, t, n, r) {
314
- return this.request(o(p["comments.resolve"], {
310
+ return this.request(d(_["comments.resolve"], {
315
311
  ...this.baseParams,
316
312
  template: e,
317
313
  comment: t
@@ -322,22 +318,22 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
322
318
  });
323
319
  }
324
320
  async fetchConfig() {
325
- return this.request(o(p["projects.config"], this.baseParams));
321
+ return this.request(d(_["projects.config"], this.baseParams));
326
322
  }
327
323
  async listModules(e, t) {
328
- let n = o(p["savedModules.index"], this.baseParams), r = new URLSearchParams();
324
+ let n = d(_["savedModules.index"], this.baseParams), r = new URLSearchParams();
329
325
  e && r.set("search", e), t && r.set("category", t);
330
326
  let i = r.size > 0 ? `?${r}` : "";
331
327
  return this.request(`${n}${i}`);
332
328
  }
333
329
  async createModule(e) {
334
- return this.request(o(p["savedModules.store"], this.baseParams), {
330
+ return this.request(d(_["savedModules.store"], this.baseParams), {
335
331
  method: "POST",
336
332
  body: JSON.stringify(e)
337
333
  });
338
334
  }
339
335
  async updateModule(e, t) {
340
- return this.request(o(p["savedModules.update"], {
336
+ return this.request(d(_["savedModules.update"], {
341
337
  ...this.baseParams,
342
338
  savedModule: e
343
339
  }), {
@@ -346,12 +342,12 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
346
342
  });
347
343
  }
348
344
  async deleteModule(e) {
349
- return this.request(o(p["savedModules.destroy"], {
345
+ return this.request(d(_["savedModules.destroy"], {
350
346
  ...this.baseParams,
351
347
  savedModule: e
352
348
  }), { method: "DELETE" });
353
349
  }
354
- }, h = class {
350
+ }, y = class {
355
351
  authManager;
356
352
  constructor(e) {
357
353
  this.authManager = e;
@@ -386,7 +382,7 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
386
382
  async browseMedia(e) {
387
383
  let t = new URLSearchParams();
388
384
  e.folderId && t.set("folderId", e.folderId), e.search && t.set("search", e.search), e.category && t.set("category", e.category), e.sort && t.set("sort", e.sort), e.cursor && t.set("cursor", e.cursor);
389
- let n = t.toString(), r = `${o(p["media.browse"], this.baseParams)}${n ? `?${n}` : ""}`, i = await this.authManager.authenticatedFetch(r, { headers: { Accept: "application/json" } });
385
+ let n = t.toString(), r = `${d(_["media.browse"], this.baseParams)}${n ? `?${n}` : ""}`, i = await this.authManager.authenticatedFetch(r, { headers: { Accept: "application/json" } });
390
386
  if (!i.ok) {
391
387
  let e = await i.json().catch(() => ({ message: `HTTP error ${i.status}` }));
392
388
  throw Error(e.message, { cause: e });
@@ -396,7 +392,7 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
396
392
  async uploadMedia(e, t) {
397
393
  let n = new FormData();
398
394
  n.append("file", e), t && n.append("folderId", t);
399
- let r = o(p["media.upload"], this.baseParams), i = await this.authManager.authenticatedFetch(r, {
395
+ let r = d(_["media.upload"], this.baseParams), i = await this.authManager.authenticatedFetch(r, {
400
396
  method: "POST",
401
397
  headers: { Accept: "application/json" },
402
398
  body: n
@@ -409,7 +405,7 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
409
405
  }
410
406
  async updateMedia(e, t, n) {
411
407
  let r = {};
412
- return t !== void 0 && (r.filename = t), n !== void 0 && (r.alt = n), this.request(o(p["media.update"], {
408
+ return t !== void 0 && (r.filename = t), n !== void 0 && (r.alt = n), this.request(d(_["media.update"], {
413
409
  ...this.baseParams,
414
410
  media: e
415
411
  }), {
@@ -418,13 +414,13 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
418
414
  });
419
415
  }
420
416
  async deleteMedia(e) {
421
- return this.request(o(p["media.delete"], this.baseParams), {
417
+ return this.request(d(_["media.delete"], this.baseParams), {
422
418
  method: "POST",
423
419
  body: JSON.stringify({ ids: e })
424
420
  });
425
421
  }
426
422
  async moveMedia(e, t) {
427
- return this.request(o(p["media.move"], this.baseParams), {
423
+ return this.request(d(_["media.move"], this.baseParams), {
428
424
  method: "POST",
429
425
  body: JSON.stringify({
430
426
  ids: e,
@@ -433,10 +429,10 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
433
429
  });
434
430
  }
435
431
  async getMediaFolders() {
436
- return this.request(o(p["folders.index"], this.baseParams));
432
+ return this.request(d(_["folders.index"], this.baseParams));
437
433
  }
438
434
  async createMediaFolder(e, t) {
439
- return this.request(o(p["folders.store"], this.baseParams), {
435
+ return this.request(d(_["folders.store"], this.baseParams), {
440
436
  method: "POST",
441
437
  body: JSON.stringify({
442
438
  name: e,
@@ -445,7 +441,7 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
445
441
  });
446
442
  }
447
443
  async renameMediaFolder(e, t) {
448
- return this.request(o(p["folders.update"], {
444
+ return this.request(d(_["folders.update"], {
449
445
  ...this.baseParams,
450
446
  mediaFolder: e
451
447
  }), {
@@ -454,13 +450,13 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
454
450
  });
455
451
  }
456
452
  async deleteMediaFolder(e) {
457
- return this.request(o(p["folders.destroy"], {
453
+ return this.request(d(_["folders.destroy"], {
458
454
  ...this.baseParams,
459
455
  mediaFolder: e
460
456
  }), { method: "DELETE" });
461
457
  }
462
458
  async checkMediaUsage(e) {
463
- let t = await this.authManager.authenticatedFetch(o(p["media.checkUsage"], this.baseParams), {
459
+ let t = await this.authManager.authenticatedFetch(d(_["media.checkUsage"], this.baseParams), {
464
460
  method: "POST",
465
461
  headers: {
466
462
  "Content-Type": "application/json",
@@ -475,10 +471,10 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
475
471
  return t.json();
476
472
  }
477
473
  async getFrequentlyUsed() {
478
- return this.request(o(p["media.frequentlyUsed"], this.baseParams));
474
+ return this.request(d(_["media.frequentlyUsed"], this.baseParams));
479
475
  }
480
476
  async importFromUrl(e, t) {
481
- return this.request(o(p["media.importFromUrl"], this.baseParams), {
477
+ return this.request(d(_["media.importFromUrl"], this.baseParams), {
482
478
  method: "POST",
483
479
  body: JSON.stringify({
484
480
  url: e,
@@ -489,7 +485,7 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
489
485
  async replaceMedia(e, t) {
490
486
  let n = new FormData();
491
487
  n.append("file", t);
492
- let r = o(p["media.replace"], {
488
+ let r = d(_["media.replace"], {
493
489
  ...this.baseParams,
494
490
  media: e
495
491
  }), i = await this.authManager.authenticatedFetch(r, {
@@ -504,14 +500,14 @@ var s = "/api/v1/projects/{project}/tenants/{tenant}", c = `${s}/templates/{temp
504
500
  return (await i.json()).data;
505
501
  }
506
502
  };
507
- function g(e) {
503
+ function b(e) {
508
504
  return {
509
505
  host: e.host,
510
506
  port: e.port,
511
507
  appKey: e.appKey
512
508
  };
513
509
  }
514
- var _ = class {
510
+ var x = class {
515
511
  pusher = null;
516
512
  authManager;
517
513
  config;
@@ -527,7 +523,7 @@ var _ = class {
527
523
  } catch {
528
524
  throw Error("[Templatical] Cloud features require the optional peer dependency 'pusher-js'. Please install it.");
529
525
  }
530
- let { host: t, port: n, appKey: r } = this.config, i = this.authManager.resolveUrl(o(p["broadcasting.auth"], {
526
+ let { host: t, port: n, appKey: r } = this.config, i = this.authManager.resolveUrl(d(_["broadcasting.auth"], {
531
527
  project: this.authManager.projectId,
532
528
  tenant: this.authManager.tenantSlug
533
529
  }));
@@ -575,415 +571,8 @@ var _ = class {
575
571
  get isConnected() {
576
572
  return this.pusher?.connection.state === "connected";
577
573
  }
578
- }, v = 0;
579
- function y() {
580
- return `msg_${Date.now()}_${++v}`;
581
- }
582
- function b(e) {
583
- let { authManager: n, getTemplateId: r, onApply: i, onError: a } = e, s = t([]), c = t(!1), l = t(!1), u = t(null), d = t(null), f = t(null), m = t(null), h = t(null), g = t(null), _ = t(!1), v = t([]), b = t(!1);
584
- function x(e, t) {
585
- let n = s.value.findIndex((t) => t.id === e);
586
- if (n === -1) return;
587
- let r = {
588
- ...s.value[n],
589
- ...t
590
- };
591
- s.value = [
592
- ...s.value.slice(0, n),
593
- r,
594
- ...s.value.slice(n + 1)
595
- ];
596
- }
597
- async function S() {
598
- let e = r();
599
- if (e) {
600
- l.value = !0;
601
- try {
602
- let t = o(p["ai.conversationMessages"], {
603
- project: n.projectId,
604
- tenant: n.tenantSlug,
605
- template: e
606
- }), r = await n.authenticatedFetch(t, {
607
- method: "GET",
608
- headers: { Accept: "application/json" }
609
- });
610
- if (!r.ok) return;
611
- let i = await r.json();
612
- i.conversationId && (f.value = i.conversationId), Array.isArray(i.data) && i.data.length > 0 && (s.value = i.data.map((e) => ({
613
- id: e.id,
614
- role: e.role,
615
- content: e.content,
616
- timestamp: new Date(e.createdAt).getTime()
617
- })));
618
- } catch {} finally {
619
- l.value = !1;
620
- }
621
- }
622
- }
623
- async function C(e, t) {
624
- let i = r();
625
- if (i) {
626
- b.value = !0;
627
- try {
628
- let r = o(p["ai.suggestions"], {
629
- project: n.projectId,
630
- tenant: n.tenantSlug,
631
- template: i
632
- }), a = await n.authenticatedFetch(r, {
633
- method: "POST",
634
- headers: {
635
- "Content-Type": "application/json",
636
- Accept: "text/event-stream"
637
- },
638
- body: JSON.stringify({
639
- currentContent: e,
640
- mergeTags: t.map((e) => ({
641
- label: e.label,
642
- value: e.value
643
- }))
644
- })
645
- });
646
- if (!a.ok) return;
647
- let s = a.body?.getReader();
648
- if (!s) return;
649
- let c = new TextDecoder(), l = "";
650
- for (;;) {
651
- let { done: e, value: t } = await s.read();
652
- if (e) break;
653
- l += c.decode(t, { stream: !0 });
654
- let n = l.split("\n");
655
- l = n.pop() ?? "";
656
- for (let e of n) {
657
- if (!e.startsWith("data: ")) continue;
658
- let t;
659
- try {
660
- t = JSON.parse(e.slice(6));
661
- } catch {
662
- continue;
663
- }
664
- t.type === "done" && Array.isArray(t.suggestions) && (v.value = t.suggestions.slice(0, 3));
665
- }
666
- }
667
- } catch {} finally {
668
- b.value = !1;
669
- }
670
- }
671
- }
672
- async function w(e, t, l) {
673
- let b = r();
674
- if (!b) throw Error("Template must be saved before using AI generation");
675
- c.value = !0, u.value = null, d.value = null, v.value = [];
676
- let S = y();
677
- s.value = [...s.value, {
678
- id: S,
679
- role: "user",
680
- content: e,
681
- timestamp: Date.now()
682
- }];
683
- let C = y();
684
- s.value = [...s.value, {
685
- id: C,
686
- role: "assistant",
687
- content: "",
688
- timestamp: Date.now()
689
- }];
690
- try {
691
- let r = o(p["ai.generate"], {
692
- project: n.projectId,
693
- tenant: n.tenantSlug,
694
- template: b
695
- }), a = await n.authenticatedFetch(r, {
696
- method: "POST",
697
- headers: {
698
- "Content-Type": "application/json",
699
- Accept: "text/event-stream"
700
- },
701
- body: JSON.stringify({
702
- prompt: e,
703
- currentContent: t,
704
- mergeTags: l.map((e) => ({
705
- label: e.label,
706
- value: e.value
707
- })),
708
- conversationId: f.value
709
- })
710
- });
711
- if (!a.ok) {
712
- let e = await a.json().catch(() => null);
713
- throw a.status === 403 ? Error("aiGenerationNotAvailable") : Error(e?.message || "Failed to generate template");
714
- }
715
- let c = a.body?.getReader();
716
- if (!c) throw Error("Failed to read stream");
717
- let d = new TextDecoder(), v = "", y = null;
718
- try {
719
- for (;;) {
720
- let { done: e, value: n } = await c.read();
721
- if (e) break;
722
- v += d.decode(n, { stream: !0 });
723
- let r = v.split("\n");
724
- v = r.pop() ?? "";
725
- for (let e of r) {
726
- if (!e.startsWith("data: ")) continue;
727
- let n = e.slice(6), r;
728
- try {
729
- r = JSON.parse(n);
730
- } catch {
731
- continue;
732
- }
733
- if (r.type === "text") x(C, { content: (s.value.find((e) => e.id === C)?.content ?? "") + r.text });
734
- else if (r.type === "error") throw Error(r.message || "Failed to generate template");
735
- else r.type === "done" && (r.conversationId && (f.value = r.conversationId), x(C, { content: r.text }), y = r.content ?? null, y ? (h.value = t, g.value = y, m.value = C, _.value = !1, i?.(y)) : u.value = "ai_apply_failed");
736
- }
737
- }
738
- } finally {
739
- c.cancel().catch(() => {});
740
- }
741
- return y;
742
- } catch (t) {
743
- let n = t instanceof Error ? t : Error("Failed to generate template", { cause: t });
744
- return u.value = n.message, d.value = e, a?.(n), s.value = s.value.filter((e) => e.id !== S && e.id !== C), null;
745
- } finally {
746
- c.value = !1;
747
- }
748
- }
749
- function T() {
750
- _.value ? (g.value && i?.(g.value), _.value = !1) : (h.value && i?.(h.value), _.value = !0);
751
- }
752
- function E() {
753
- s.value = [], f.value = null, u.value = null, m.value = null, h.value = null, g.value = null, _.value = !1;
754
- }
755
- return {
756
- messages: s,
757
- isGenerating: c,
758
- isLoadingHistory: l,
759
- isLastChangeReverted: _,
760
- lastApplyMessageId: m,
761
- error: u,
762
- failedPrompt: d,
763
- suggestions: v,
764
- isLoadingSuggestions: b,
765
- sendPrompt: w,
766
- toggleLastRevert: T,
767
- loadConversation: S,
768
- loadSuggestions: C,
769
- clearChat: E
770
- };
771
- }
772
- function x(e) {
773
- function t(t) {
774
- return e !== !1 && e?.[t] !== !1;
775
- }
776
- return {
777
- isFeatureEnabled: t,
778
- hasAnyMenuFeature: n(() => t("chat") || t("scoring") || t("designToTemplate"))
779
- };
780
- }
781
- function S(e) {
782
- let { authManager: n, getTemplateId: r } = e, i = t(!1), a = t(null), s = t(null), c = t(null), l = t(""), u = t(null);
783
- async function d(e, t) {
784
- let c = r();
785
- if (!c) return null;
786
- i.value = !0, s.value = null, a.value = null;
787
- try {
788
- let r = o(p["ai.score"], {
789
- project: n.projectId,
790
- tenant: n.tenantSlug,
791
- template: c
792
- }), i = await n.authenticatedFetch(r, {
793
- method: "POST",
794
- headers: {
795
- "Content-Type": "application/json",
796
- Accept: "text/event-stream"
797
- },
798
- body: JSON.stringify({
799
- currentContent: e,
800
- mergeTags: t.map((e) => ({
801
- label: e.label,
802
- value: e.value
803
- }))
804
- })
805
- });
806
- if (!i.ok) {
807
- if (i.status === 403) throw Error("aiGenerationNotAvailable");
808
- let e = await i.json().catch(() => null);
809
- throw Error(e?.message || "Failed to score template");
810
- }
811
- let s = i.body?.getReader();
812
- if (!s) throw Error("Failed to read stream");
813
- let l = new TextDecoder(), u = "", d = null;
814
- for (;;) {
815
- let { done: e, value: t } = await s.read();
816
- if (e) break;
817
- u += l.decode(t, { stream: !0 });
818
- let n = u.split("\n");
819
- u = n.pop() ?? "";
820
- for (let e of n) {
821
- if (!e.startsWith("data: ")) continue;
822
- let t;
823
- try {
824
- t = JSON.parse(e.slice(6));
825
- } catch {
826
- continue;
827
- }
828
- if (t.type === "error") throw Error(t.message || "Failed to score template");
829
- t.type === "done" && (d = t.result ?? null);
830
- }
831
- }
832
- if (d) for (let [e, t] of Object.entries(d.categories)) for (let n of t.findings) n.category = e;
833
- return a.value = d, d;
834
- } catch (e) {
835
- return s.value = e instanceof Error ? e.message : "Failed to score template", null;
836
- } finally {
837
- i.value = !1;
838
- }
839
- }
840
- async function f(e, t, i) {
841
- let a = r();
842
- if (!a) return null;
843
- c.value = t.id, l.value = "", u.value = null;
844
- try {
845
- let r = o(p["ai.fixFinding"], {
846
- project: n.projectId,
847
- tenant: n.tenantSlug,
848
- template: a
849
- }), s = await n.authenticatedFetch(r, {
850
- method: "POST",
851
- headers: {
852
- "Content-Type": "application/json",
853
- Accept: "text/event-stream"
854
- },
855
- body: JSON.stringify({
856
- content: e,
857
- finding: {
858
- id: t.id,
859
- message: t.message,
860
- suggestion: t.suggestion,
861
- category: t.category
862
- },
863
- mergeTags: i.map((e) => ({
864
- label: e.label,
865
- value: e.value
866
- }))
867
- })
868
- });
869
- if (!s.ok) {
870
- if (s.status === 403) throw Error("aiGenerationNotAvailable");
871
- let e = await s.json().catch(() => null);
872
- throw Error(e?.message || "Failed to fix finding");
873
- }
874
- let c = s.body?.getReader();
875
- if (!c) throw Error("Failed to read stream");
876
- let u = new TextDecoder(), d = "", f = null;
877
- for (;;) {
878
- let { done: e, value: t } = await c.read();
879
- if (e) break;
880
- d += u.decode(t, { stream: !0 });
881
- let n = d.split("\n");
882
- d = n.pop() ?? "";
883
- for (let e of n) {
884
- if (!e.startsWith("data: ")) continue;
885
- let t;
886
- try {
887
- t = JSON.parse(e.slice(6));
888
- } catch {
889
- continue;
890
- }
891
- if (t.type === "text") l.value += t.text;
892
- else if (t.type === "error") throw Error(t.message || "Failed to fix finding");
893
- else t.type === "done" && (f = t.content ?? null);
894
- }
895
- }
896
- return f;
897
- } catch (e) {
898
- return u.value = e instanceof Error ? e.message : "Failed to fix finding", null;
899
- } finally {
900
- c.value = null;
901
- }
902
- }
903
- function m(e, t) {
904
- if (!a.value) return;
905
- let n = a.value.categories[e];
906
- n && (n.findings = n.findings.filter((e) => e.id !== t));
907
- }
908
- function h() {
909
- i.value = !1, a.value = null, s.value = null, c.value = null, l.value = "", u.value = null;
910
- }
911
- return {
912
- isScoring: i,
913
- scoringResult: a,
914
- error: s,
915
- fixingFindingId: c,
916
- fixStreamingText: l,
917
- fixError: u,
918
- score: d,
919
- fixFinding: f,
920
- removeFinding: m,
921
- reset: h
922
- };
923
- }
574
+ }, S = "comment-broadcast";
924
575
  function C(e) {
925
- let { authManager: n, getTemplateId: r, onApply: i, onError: a } = e, s = t(!1), c = t(null);
926
- async function l(e) {
927
- let t = r();
928
- if (!t) throw Error("Template must be saved before using design reference");
929
- s.value = !0, c.value = null;
930
- try {
931
- let r = new FormData();
932
- e.prompt && r.append("prompt", e.prompt), e.imageUpload && r.append("image_upload", e.imageUpload), e.pdfUpload && r.append("pdf_upload", e.pdfUpload);
933
- let a = o(p["ai.generateFromDesign"], {
934
- project: n.projectId,
935
- tenant: n.tenantSlug,
936
- template: t
937
- }), s = await n.authenticatedFetch(a, {
938
- method: "POST",
939
- headers: { Accept: "text/event-stream" },
940
- body: r
941
- });
942
- if (!s.ok) {
943
- let e = await s.json().catch(() => null);
944
- throw s.status === 403 ? Error("aiGenerationNotAvailable") : Error(e?.message || "Failed to generate template from design");
945
- }
946
- let c = s.body?.getReader();
947
- if (!c) throw Error("Failed to read stream");
948
- let l = new TextDecoder(), u = "", d = null;
949
- for (;;) {
950
- let { done: e, value: t } = await c.read();
951
- if (e) break;
952
- u += l.decode(t, { stream: !0 });
953
- let n = u.split("\n");
954
- u = n.pop() ?? "";
955
- for (let e of n) {
956
- if (!e.startsWith("data: ")) continue;
957
- let t = e.slice(6), n;
958
- try {
959
- n = JSON.parse(t);
960
- } catch {
961
- continue;
962
- }
963
- if (n.type === "error") throw Error(n.message || "Failed to generate template from design");
964
- n.type === "done" && (d = n.content ?? null, d && i?.(d));
965
- }
966
- }
967
- return d;
968
- } catch (e) {
969
- let t = e instanceof Error ? e : Error("Failed to generate template from design", { cause: e });
970
- return c.value = t.message, a?.(t), null;
971
- } finally {
972
- s.value = !1;
973
- }
974
- }
975
- function u() {
976
- s.value = !1, c.value = null;
977
- }
978
- return {
979
- isGenerating: s,
980
- error: c,
981
- generate: l,
982
- reset: u
983
- };
984
- }
985
- var w = "comment-broadcast";
986
- function T(e) {
987
576
  let t = {
988
577
  id: e.id,
989
578
  body: e.body,
@@ -993,12 +582,12 @@ function T(e) {
993
582
  parentId: e.parentId,
994
583
  resolvedAt: e.resolvedAt
995
584
  };
996
- return e.updatedAt !== e.createdAt && (t.updatedAt = e.updatedAt), e.resolvedBy && (t.resolvedBy = e.resolvedBy), e.replies?.length && (t.replies = e.replies.map(T)), t;
585
+ return e.updatedAt !== e.createdAt && (t.updatedAt = e.updatedAt), e.resolvedBy && (t.resolvedBy = e.resolvedBy), e.replies?.length && (t.replies = e.replies.map(C)), t;
997
586
  }
998
- function E(t) {
999
- let { authManager: n, channel: r, getSocketId: i } = t, a = new m(n);
587
+ function ee(e) {
588
+ let { authManager: t, channel: n, getSocketId: i } = e, a = new v(t);
1000
589
  function o() {
1001
- let e = n.userConfig;
590
+ let e = t.userConfig;
1002
591
  if (!e) throw Error("[Templatical] Cloud comments need a signed user in the auth token. The project's token endpoint must include a `user` claim.");
1003
592
  return {
1004
593
  userId: e.id,
@@ -1012,10 +601,10 @@ function E(t) {
1012
601
  }
1013
602
  return {
1014
603
  async list(e) {
1015
- return (await a.getComments(e)).map(T);
604
+ return (await a.getComments(e)).map(C);
1016
605
  },
1017
606
  async create(e, t) {
1018
- return T(await a.createComment(e, {
607
+ return C(await a.createComment(e, {
1019
608
  body: t.body,
1020
609
  blockId: t.blockId,
1021
610
  parentId: t.parentId,
@@ -1024,7 +613,7 @@ function E(t) {
1024
613
  },
1025
614
  async update(e, t, n) {
1026
615
  if (n.body === void 0) throw Error("[Templatical] Cloud comments: update() needs a `body` in the patch.");
1027
- return T(await a.updateComment(e, t, {
616
+ return C(await a.updateComment(e, t, {
1028
617
  body: n.body,
1029
618
  ...o()
1030
619
  }, s()));
@@ -1033,47 +622,47 @@ function E(t) {
1033
622
  await a.deleteComment(e, t, o(), s());
1034
623
  },
1035
624
  async setResolved(e, t, n) {
1036
- return T(await a.resolveComment(e, t, o(), s()));
625
+ return C(await a.resolveComment(e, t, o(), s()));
1037
626
  },
1038
- subscribe(t, n) {
627
+ subscribe(e, t) {
1039
628
  function i(e) {
1040
- let t = T(e.comment);
629
+ let n = C(e.comment);
1041
630
  switch (e.action) {
1042
631
  case "commentCreated":
1043
- n({
632
+ t({
1044
633
  type: "created",
1045
- comment: t
634
+ comment: n
1046
635
  });
1047
636
  break;
1048
637
  case "commentDeleted":
1049
- n({
638
+ t({
1050
639
  type: "deleted",
1051
- commentId: t.id,
1052
- parentId: t.parentId
640
+ commentId: n.id,
641
+ parentId: n.parentId
1053
642
  });
1054
643
  break;
1055
644
  case "commentUpdated":
1056
645
  case "commentResolved":
1057
- case "commentUnresolved": n({
646
+ case "commentUnresolved": t({
1058
647
  type: "updated",
1059
- comment: t
648
+ comment: n
1060
649
  });
1061
650
  }
1062
651
  }
1063
- let a = e(r, (e, t) => {
1064
- t?.unbind(w, i), e?.bind(w, i);
652
+ let a = r(n, (e, t) => {
653
+ t?.unbind(S, i), e?.bind(S, i);
1065
654
  }, { immediate: !0 });
1066
655
  return () => {
1067
- a(), r.value?.unbind(w, i);
656
+ a(), n.value?.unbind(S, i);
1068
657
  };
1069
658
  }
1070
659
  };
1071
660
  }
1072
- function D(e) {
661
+ function te(e) {
1073
662
  let { authManager: n, onError: r } = e, i = t(null), a = t(!1), o = null, s = null;
1074
663
  async function c(e, t) {
1075
664
  if (o) return;
1076
- o = new _({
665
+ o = new x({
1077
666
  authManager: n,
1078
667
  config: t,
1079
668
  onError: r
@@ -1099,8 +688,8 @@ function D(e) {
1099
688
  getSocketId: u
1100
689
  };
1101
690
  }
1102
- function O(e) {
1103
- let t = new m(e);
691
+ function ne(e) {
692
+ let t = new v(e);
1104
693
  return {
1105
694
  list(e) {
1106
695
  return t.listModules(e?.search, e?.category);
@@ -1116,7 +705,7 @@ function O(e) {
1116
705
  }
1117
706
  };
1118
707
  }
1119
- function k(e) {
708
+ function w(e) {
1120
709
  let t = {
1121
710
  id: e.id,
1122
711
  url: e.url,
@@ -1130,27 +719,27 @@ function k(e) {
1130
719
  };
1131
720
  return e.width != null && (t.width = e.width), e.height != null && (t.height = e.height), e.thumbnailUrl != null && (t.thumbnailUrl = e.thumbnailUrl), t;
1132
721
  }
1133
- function A(e, t = null) {
722
+ function T(e, t = null) {
1134
723
  return {
1135
724
  id: e.id,
1136
725
  name: e.name,
1137
726
  parentId: e.parentId === void 0 ? t : e.parentId
1138
727
  };
1139
728
  }
1140
- function j(e, t = null) {
729
+ function E(e, t = null) {
1141
730
  let n = [];
1142
- for (let r of e) n.push(A(r, t)), r.children?.length && n.push(...j(r.children, r.id));
731
+ for (let r of e) n.push(T(r, t)), r.children?.length && n.push(...E(r.children, r.id));
1143
732
  return n;
1144
733
  }
1145
- function M(e) {
734
+ function D(e) {
1146
735
  let t = e?.media?.categories;
1147
736
  if (!t) return;
1148
737
  let n = {};
1149
738
  for (let [e, r] of Object.entries(t)) n[e] = r.mimeTypes;
1150
739
  return n;
1151
740
  }
1152
- function N(e, t) {
1153
- let n = new h(e);
741
+ function O(e, t) {
742
+ let n = new y(e);
1154
743
  return {
1155
744
  async list(e) {
1156
745
  let t = await n.browseMedia({
@@ -1158,40 +747,40 @@ function N(e, t) {
1158
747
  cursor: e?.cursor,
1159
748
  folderId: e?.folderId,
1160
749
  category: e?.category
1161
- }), r = { items: t.data.map(k) };
750
+ }), r = { items: t.data.map(w) };
1162
751
  return t.meta.nextCursor && (r.nextCursor = t.meta.nextCursor), r;
1163
752
  },
1164
753
  async create(e) {
1165
- return k(await n.uploadMedia(e.file, e.folderId));
754
+ return w(await n.uploadMedia(e.file, e.folderId));
1166
755
  },
1167
756
  async update(e, t) {
1168
- return k(await n.updateMedia(e, t.filename, t.alt));
757
+ return w(await n.updateMedia(e, t.filename, t.alt));
1169
758
  },
1170
759
  delete(e) {
1171
760
  return n.deleteMedia(e);
1172
761
  },
1173
762
  folders: {
1174
763
  async list() {
1175
- return j(await n.getMediaFolders());
764
+ return E(await n.getMediaFolders());
1176
765
  },
1177
766
  async create(e) {
1178
- return A(await n.createMediaFolder(e.name, e.parentId));
767
+ return T(await n.createMediaFolder(e.name, e.parentId));
1179
768
  },
1180
769
  async update(e, t) {
1181
- return A(await n.renameMediaFolder(e, t.name));
770
+ return T(await n.renameMediaFolder(e, t.name));
1182
771
  },
1183
772
  delete(e) {
1184
773
  return n.deleteMediaFolder(e);
1185
774
  },
1186
775
  async move(e, t) {
1187
- return (await n.moveMedia(e, t)).map(k);
776
+ return (await n.moveMedia(e, t)).map(w);
1188
777
  }
1189
778
  },
1190
779
  async replace(e, t) {
1191
- return k(await n.replaceMedia(e, t));
780
+ return w(await n.replaceMedia(e, t));
1192
781
  },
1193
782
  async importFromUrl(e, t) {
1194
- return k(await n.importFromUrl(e, t));
783
+ return w(await n.importFromUrl(e, t));
1195
784
  },
1196
785
  async checkUsage(e) {
1197
786
  let t = await n.checkMediaUsage(e), r = {};
@@ -1202,7 +791,7 @@ function N(e, t) {
1202
791
  return r;
1203
792
  },
1204
793
  async frequentlyUsed() {
1205
- return (await n.getFrequentlyUsed()).map(k);
794
+ return (await n.getFrequentlyUsed()).map(w);
1206
795
  },
1207
796
  async storage() {
1208
797
  return t?.()?.storage ?? null;
@@ -1211,16 +800,16 @@ function N(e, t) {
1211
800
  return t?.()?.media?.maxFileSize;
1212
801
  },
1213
802
  get mimeTypes() {
1214
- return M(t?.() ?? null);
803
+ return D(t?.() ?? null);
1215
804
  }
1216
805
  };
1217
806
  }
1218
- var P = 6e4;
1219
- function F(e) {
1220
- let t = new m(e), n = 0;
807
+ var k = 6e4;
808
+ function re(e) {
809
+ let t = new v(e), n = 0;
1221
810
  function r(e, r) {
1222
811
  let i = Date.now();
1223
- i - n < P || (n = i, t.createVersion(e, r).catch((e) => {
812
+ i - n < k || (n = i, t.createVersion(e, r).catch((e) => {
1224
813
  console.warn("[Templatical] Automatic version not recorded — the save itself succeeded:", e);
1225
814
  }));
1226
815
  }
@@ -1237,14 +826,14 @@ function F(e) {
1237
826
  }
1238
827
  };
1239
828
  }
1240
- function I(e) {
829
+ function ie(e) {
1241
830
  return {
1242
831
  customFonts: e?.customFonts ?? [],
1243
832
  defaultFallback: e?.defaultFallback ?? "Arial, sans-serif"
1244
833
  };
1245
834
  }
1246
- function L(e) {
1247
- let t = new m(e.authManager);
835
+ function A(e) {
836
+ let t = new v(e.authManager);
1248
837
  async function n(e, n) {
1249
838
  let r = await t.exportTemplate(e, n);
1250
839
  return {
@@ -1260,8 +849,8 @@ function L(e) {
1260
849
  getMjmlSource: r
1261
850
  };
1262
851
  }
1263
- function R(e) {
1264
- let t = L({ authManager: e.authManager });
852
+ function j(e) {
853
+ let t = A({ authManager: e.authManager });
1265
854
  function n(e) {
1266
855
  return {
1267
856
  customFonts: e.fonts?.customFonts ?? [],
@@ -1283,7 +872,7 @@ function R(e) {
1283
872
  }
1284
873
  };
1285
874
  }
1286
- function z(e) {
875
+ function M(e) {
1287
876
  return {
1288
877
  id: e.id,
1289
878
  createdAt: e.createdAt,
@@ -1291,26 +880,26 @@ function z(e) {
1291
880
  content: e.content
1292
881
  };
1293
882
  }
1294
- function B(e) {
1295
- let t = new m(e);
883
+ function ae(e) {
884
+ let t = new v(e);
1296
885
  return {
1297
886
  async list(e) {
1298
- return { versions: (await t.getVersions(e)).map(z) };
887
+ return { versions: (await t.getVersions(e)).map(M) };
1299
888
  },
1300
889
  async get(e, n) {
1301
890
  return (await t.getVersion(e, n)).content;
1302
891
  },
1303
892
  async create(e, n, r) {
1304
- return z(await t.createVersion(e, n, r?.label));
893
+ return M(await t.createVersion(e, n, r?.label));
1305
894
  },
1306
895
  restore(e, n) {
1307
896
  return t.restoreVersion(e, n);
1308
897
  }
1309
898
  };
1310
899
  }
1311
- function V(r) {
1312
- let { authManager: i, isAuthReady: a } = r, o = t(null);
1313
- a && e(a, (e) => {
900
+ function oe(e) {
901
+ let { authManager: i, isAuthReady: a } = e, o = t(null);
902
+ a && r(a, (e) => {
1314
903
  e && (o.value = i.testEmailConfig);
1315
904
  }, { immediate: !0 });
1316
905
  let s = n(() => o.value !== null), c = n(() => o.value?.allowedEmails ?? []);
@@ -1323,8 +912,8 @@ function V(r) {
1323
912
  getSignature: l
1324
913
  };
1325
914
  }
1326
- function H(e) {
1327
- let t = new m(e.authManager);
915
+ function se(e) {
916
+ let t = new v(e.authManager);
1328
917
  return {
1329
918
  get allowedRecipients() {
1330
919
  return e.allowedEmails.value;
@@ -1345,8 +934,8 @@ function H(e) {
1345
934
  }
1346
935
  };
1347
936
  }
1348
- function U(e) {
1349
- let { authManager: r, onError: i } = e, a = t(null), o = t(!1), s = new m(r), c = n(() => a.value?.features ?? null);
937
+ function ce(e) {
938
+ let { authManager: r, onError: i } = e, a = t(null), o = t(!1), s = new v(r), c = n(() => a.value?.features ?? null);
1350
939
  function l(e) {
1351
940
  return a.value?.features[e] ?? !1;
1352
941
  }
@@ -1370,14 +959,14 @@ function U(e) {
1370
959
  fetchConfig: u
1371
960
  };
1372
961
  }
1373
- var W = 5e3;
1374
- function G(e) {
1375
- return e.authManager ? e.authManager.resolveUrl(p.health) : `${(e.baseUrl ?? "https://templatical.com").replace(/\/$/, "")}${p.health}`;
962
+ var N = 5e3;
963
+ function P(e) {
964
+ return e.authManager ? e.authManager.resolveUrl(_.health) : `${(e.baseUrl ?? "https://templatical.com").replace(/\/$/, "")}${_.health}`;
1376
965
  }
1377
- async function K(e, t) {
966
+ async function F(e, t) {
1378
967
  let n = performance.now();
1379
968
  try {
1380
- let r = t ? await t.authenticatedFetch(p.health, {
969
+ let r = t ? await t.authenticatedFetch(_.health, {
1381
970
  method: "GET",
1382
971
  headers: { Accept: "application/json" }
1383
972
  }) : await fetch(e, {
@@ -1426,7 +1015,7 @@ async function K(e, t) {
1426
1015
  };
1427
1016
  }
1428
1017
  }
1429
- async function q(e) {
1018
+ async function I(e) {
1430
1019
  if (!e?.host || !e?.appKey) return {
1431
1020
  ok: !1,
1432
1021
  error: "WebSocket configuration not available"
@@ -1442,7 +1031,7 @@ async function q(e) {
1442
1031
  ok: !1,
1443
1032
  error: "WebSocket connection timed out"
1444
1033
  });
1445
- }, W);
1034
+ }, N);
1446
1035
  try {
1447
1036
  n = new WebSocket(t);
1448
1037
  } catch (t) {
@@ -1462,8 +1051,8 @@ async function q(e) {
1462
1051
  };
1463
1052
  });
1464
1053
  }
1465
- async function J(e = {}) {
1466
- let t = await K(G(e), e.authManager), n = await q(t.wsConfig);
1054
+ async function L(e = {}) {
1055
+ let t = await F(P(e), e.authManager), n = await I(t.wsConfig);
1467
1056
  return {
1468
1057
  api: t.api,
1469
1058
  websocket: n,
@@ -1472,4 +1061,319 @@ async function J(e = {}) {
1472
1061
  };
1473
1062
  }
1474
1063
  //#endregion
1475
- export { U as _, O as a, D as b, B as c, I as d, g as f, L as g, C as h, R as i, i as l, x as m, E as n, F as o, b as p, N as r, H as s, a as t, J as u, S as v, V as y };
1064
+ //#region src/cloud/composables/useCloudFeatureFlags.ts
1065
+ function R(e) {
1066
+ let { planConfigInstance: t, getTemplateId: r } = e;
1067
+ return {
1068
+ canSendTestEmail: n(() => t.hasFeature("testEmail")),
1069
+ hasTemplateSaved: n(() => r() !== null),
1070
+ templateLimit: n(() => t.config.value?.limits.maxTemplates ?? null),
1071
+ templateCount: n(() => t.config.value?.templateCount ?? 0)
1072
+ };
1073
+ }
1074
+ //#endregion
1075
+ //#region src/cloud/composables/useCloudPanelState.ts
1076
+ function z() {
1077
+ let e = t(null);
1078
+ return {
1079
+ activePanel: e,
1080
+ commentsOpen: n({
1081
+ get: () => e.value === "comments",
1082
+ set: (t) => e.value = t ? "comments" : null
1083
+ }),
1084
+ rightPanelOpen: n(() => e.value !== null)
1085
+ };
1086
+ }
1087
+ //#endregion
1088
+ //#region src/cloud/composables/useCloudSaveGate.ts
1089
+ function B(e) {
1090
+ let r = t(!1), i = null, a = n(() => e.planConfig.value?.accessibility?.blockOnError === !0), o = n(() => a.value ? e.issues.value.filter((e) => e.severity === "error") : []), s = n(() => o.value.length > 0);
1091
+ async function c(e) {
1092
+ return s.value ? (i = e, r.value = !0, !1) : (await e(), !0);
1093
+ }
1094
+ async function l(e) {
1095
+ return !s.value && (await e(), !0);
1096
+ }
1097
+ async function u() {
1098
+ let e = i;
1099
+ i = null, r.value = !1, e && await e();
1100
+ }
1101
+ function d() {
1102
+ i = null, r.value = !1;
1103
+ }
1104
+ return {
1105
+ shouldBlock: s,
1106
+ blockingIssues: o,
1107
+ modalOpen: r,
1108
+ tryRunSave: c,
1109
+ runUnlessBlocked: l,
1110
+ confirmAndSave: u,
1111
+ cancel: d
1112
+ };
1113
+ }
1114
+ //#endregion
1115
+ //#region src/cloud/collectSavedBlockIds.ts
1116
+ function V(e) {
1117
+ let t = /* @__PURE__ */ new Set();
1118
+ return H(e?.content?.blocks, t), t;
1119
+ }
1120
+ function H(e, t) {
1121
+ if (e) {
1122
+ for (let n of e) if (t.add(n.id), n.children) {
1123
+ if (n.type === "section") for (let e of n.children) H(e, t);
1124
+ else n.type === "wrapper" && H(n.children, t);
1125
+ }
1126
+ }
1127
+ }
1128
+ //#endregion
1129
+ //#region src/cloud/createCloudRuntime.ts
1130
+ function U(e) {
1131
+ if (!e) return {};
1132
+ let { onSaved: t, onCreated: n, onLoaded: r } = e;
1133
+ return {
1134
+ ...typeof t == "function" ? { onSaved: t } : {},
1135
+ ...typeof n == "function" ? { onCreated: n } : {},
1136
+ ...typeof r == "function" ? { onLoaded: r } : {}
1137
+ };
1138
+ }
1139
+ function W(e) {
1140
+ if (!e) return {};
1141
+ let { onCreated: t, onUpdated: n, onDeleted: r, onResolved: i, onUnresolved: a } = e;
1142
+ return {
1143
+ ...typeof t == "function" ? { onCreated: t } : {},
1144
+ ...typeof n == "function" ? { onUpdated: n } : {},
1145
+ ...typeof r == "function" ? { onDeleted: r } : {},
1146
+ ...typeof i == "function" ? { onResolved: i } : {},
1147
+ ...typeof a == "function" ? { onUnresolved: a } : {}
1148
+ };
1149
+ }
1150
+ function le(e) {
1151
+ if (typeof e != "object" || !e) return {};
1152
+ let { onCreated: t, onUpdated: n, onDeleted: r } = e;
1153
+ return {
1154
+ ...typeof t == "function" ? { onCreated: t } : {},
1155
+ ...typeof n == "function" ? { onUpdated: n } : {},
1156
+ ...typeof r == "function" ? { onDeleted: r } : {}
1157
+ };
1158
+ }
1159
+ function ue(e) {
1160
+ if (typeof e != "object" || !e) return {};
1161
+ let { onSent: t, defaultRecipient: n } = e;
1162
+ return {
1163
+ ...typeof t == "function" ? { onSent: t } : {},
1164
+ ...typeof n == "string" ? { defaultRecipient: n } : {}
1165
+ };
1166
+ }
1167
+ function de(e) {
1168
+ if (typeof e != "object" || !e) return {};
1169
+ let { onCreated: t, onUpdated: n, onDeleted: r } = e;
1170
+ return {
1171
+ ...typeof t == "function" ? { onCreated: t } : {},
1172
+ ...typeof n == "function" ? { onUpdated: n } : {},
1173
+ ...typeof r == "function" ? { onDeleted: r } : {}
1174
+ };
1175
+ }
1176
+ function fe(e) {
1177
+ if (!e) return {};
1178
+ let { onCreated: t, onRestored: n } = e;
1179
+ return {
1180
+ ...typeof t == "function" ? { onCreated: t } : {},
1181
+ ...typeof n == "function" ? { onRestored: n } : {}
1182
+ };
1183
+ }
1184
+ function G(e) {
1185
+ return e.length < 2 ? e.join("") : e.length === 2 ? e.join(" and ") : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`;
1186
+ }
1187
+ async function K(n) {
1188
+ let { config: i, cloudTranslations: d } = n, f = null, p = null, m = null, h = null, g = t(null), _ = t(null);
1189
+ function v() {
1190
+ if (!f) throw Error("[Templatical] The Cloud editor is not mounted yet.");
1191
+ return f;
1192
+ }
1193
+ function y() {
1194
+ return f?.state.template?.id ?? null;
1195
+ }
1196
+ let x = new u({
1197
+ ...i.auth,
1198
+ onError: (e) => {
1199
+ l(e) && (g.value = e), i.onError?.(e);
1200
+ }
1201
+ }), S = ce({
1202
+ authManager: x,
1203
+ onError: i.onError
1204
+ });
1205
+ await x.initialize();
1206
+ let C = await L({ authManager: x });
1207
+ if (!C.api.ok) throw Error("Health check failed: API is not reachable");
1208
+ if (!C.auth.ok) throw Error(`Health check failed: authentication error${C.auth.error ? ` - ${C.auth.error}` : ""}`);
1209
+ C.websocket.ok || s.warn("WebSocket health check failed:", C.websocket.error ?? "unknown error", "-- real-time features will be disabled."), await S.fetchConfig(), g.value = null;
1210
+ let w = i.templates, T = [
1211
+ "load",
1212
+ "create",
1213
+ "save"
1214
+ ].filter((e) => w?.[e] !== void 0);
1215
+ T.length > 0 && s.warn(`initCloud ignores ${G(T.map((e) => `templates.${e}`))} — the template id is the join key for version history, comments and the server-side export, so an id Cloud never issued would break them. Your event handlers were kept. Use init() to bring your own storage.`);
1216
+ let E = i.versionHistory, D = [
1217
+ "list",
1218
+ "get",
1219
+ "create",
1220
+ "restore"
1221
+ ].filter((e) => E?.[e] !== void 0);
1222
+ D.length > 0 && s.warn(`initCloud ignores ${G(D.map((e) => `versionHistory.${e}`))} — a version is keyed to a template id Cloud issued, so Cloud owns its history. Your event handlers were kept. Use init() to bring your own storage.`);
1223
+ let k = i.comments, M = [
1224
+ "list",
1225
+ "create",
1226
+ "update",
1227
+ "delete",
1228
+ "setResolved",
1229
+ "subscribe"
1230
+ ].filter((e) => k?.[e] !== void 0);
1231
+ M.length > 0 && s.warn(`initCloud ignores ${G(M.map((e) => `comments.${e}`))} — a comment is keyed to a template id Cloud issued, and its author is signed by the auth token, so Cloud owns the conversation. Your event handlers were kept. Use init() to bring your own storage.`), i.render && s.warn("initCloud does not accept a `render` provider — Cloud renders server-side for test email, sends and exports, so a supplied renderer would change only what you preview and export, never what Cloud delivers. The supplied provider is ignored. For your own MJML, call renderToMjml(editor.getContent()) from @templatical/renderer."), i.ai !== void 0 && s.warn("initCloud does not take an `ai` key yet — Cloud's AI arrives as its own provider in a later release. The key is ignored. To bring your own AI backend, use init({ ai }).");
1232
+ function N(e) {
1233
+ let t = S.config.value?.websocket;
1234
+ m && t && m.connect(e.id, b(t));
1235
+ }
1236
+ let P = re(x), F = P.create, I = P.save, H = {
1237
+ ...U(i.templates),
1238
+ load: async (e) => {
1239
+ let t = await P.load(e);
1240
+ return N(t), t;
1241
+ },
1242
+ create: typeof F == "function" ? async (e) => {
1243
+ let t = await F(e);
1244
+ return N(t), t;
1245
+ } : !1,
1246
+ save: typeof I == "function" ? async (e, t) => {
1247
+ if (p && f) {
1248
+ let e = p.registry;
1249
+ await c(f.content.value, {
1250
+ renderCustomBlock: e.renderCustomBlock,
1251
+ getCustomBlockStylesheet: (t) => e.getDefinition(t)?.stylesheet
1252
+ });
1253
+ }
1254
+ return I(e, t);
1255
+ } : !1
1256
+ }, K = j({
1257
+ authManager: x,
1258
+ getTemplateId: y,
1259
+ save: () => v().save()
1260
+ }), pe = {
1261
+ ...fe(i.versionHistory),
1262
+ ...ae(x)
1263
+ }, me = {
1264
+ ...W(i.comments),
1265
+ ...ee({
1266
+ authManager: x,
1267
+ channel: _,
1268
+ getSocketId: () => m?.getSocketId() ?? null
1269
+ })
1270
+ }, he = x.userConfig ? {
1271
+ id: x.userConfig.id,
1272
+ name: x.userConfig.name
1273
+ } : void 0, q = typeof i.savedBlocks?.list == "function" ? i.savedBlocks : null;
1274
+ if (q === null && typeof i.savedBlocks == "object" && i.savedBlocks !== null) {
1275
+ let e = i.savedBlocks, t = [
1276
+ "list",
1277
+ "create",
1278
+ "update",
1279
+ "delete"
1280
+ ].filter((t) => e[t] !== void 0);
1281
+ t.length > 0 && s.warn(`initCloud ignores ${G(t.map((e) => `savedBlocks.${e}`))} — a provider needs a working list to replace Cloud's store, and this value has none, so it configures Cloud's own store instead. Your event handlers were kept. Use init() to bring your own storage.`);
1282
+ }
1283
+ let J = i.savedBlocks === !1 ? void 0 : q ?? {
1284
+ ...le(i.savedBlocks),
1285
+ ...ne(x)
1286
+ }, Y = oe({
1287
+ authManager: x,
1288
+ isAuthReady: t(!0)
1289
+ }), ge = A({ authManager: x }), X = typeof i.testEmail?.send == "function" ? i.testEmail : null;
1290
+ if (X === null && typeof i.testEmail == "object" && i.testEmail !== null) {
1291
+ let e = i.testEmail, t = [
1292
+ "send",
1293
+ "includeMjml",
1294
+ "allowedRecipients"
1295
+ ].filter((t) => e[t] !== void 0);
1296
+ t.length > 0 && s.warn(`initCloud ignores ${G(t.map((e) => `testEmail.${e}`))} — a provider needs a working send to replace Cloud's sender outright, and Cloud renders server-side with the signed allowlist from your project's JWT either way, so none of these apply here. Your event handlers were kept.`);
1297
+ }
1298
+ let _e = X ?? Object.assign(se({
1299
+ authManager: x,
1300
+ getTemplateId: y,
1301
+ save: () => v().save(),
1302
+ exportHtml: (e) => ge.exportHtml(e, ie(i.fonts)),
1303
+ allowedEmails: Y.allowedEmails,
1304
+ getSignature: Y.getSignature,
1305
+ onBeforeTestEmail: i.onBeforeTestEmail
1306
+ }), ue(i.testEmail)), Z = typeof i.media?.list == "function" ? i.media : null;
1307
+ if (Z === null && typeof i.media == "object" && i.media !== null) {
1308
+ let e = i.media, t = [
1309
+ "list",
1310
+ "create",
1311
+ "update",
1312
+ "delete"
1313
+ ].filter((t) => e[t] !== void 0);
1314
+ t.length > 0 && s.warn(`initCloud ignores ${G(t.map((e) => `media.${e}`))} — a provider needs a working list to replace Cloud's store, and this value has none, so it configures Cloud's own store instead. Your event handlers were kept. Use init() to bring your own storage.`);
1315
+ let n = ["maxFileSize", "mimeTypes"].filter((t) => e[t] !== void 0);
1316
+ n.length > 0 && s.warn(`initCloud ignores ${G(n.map((e) => `media.${e}`))} — Cloud's plan owns those limits whenever Cloud's store is in play. Your event handlers were kept.`);
1317
+ }
1318
+ let Q = i.media === !1 ? void 0 : Z ?? Object.assign(O(x, () => S.config.value), de(i.media)), $ = R({
1319
+ planConfigInstance: S,
1320
+ getTemplateId: y
1321
+ });
1322
+ function ve(t) {
1323
+ f = t.editor, e(o, d), e(a, x);
1324
+ let n = te({
1325
+ authManager: x,
1326
+ onError: i.onError
1327
+ });
1328
+ return m = n, r(n.channel, (e) => {
1329
+ _.value = e;
1330
+ }, { immediate: !0 }), {
1331
+ websocket: n,
1332
+ panelState: z(),
1333
+ featureFlags: $
1334
+ };
1335
+ }
1336
+ function ye(e) {
1337
+ let { core: n, capabilities: r } = e;
1338
+ return p = n, h = B({
1339
+ issues: n.templateLint ? n.templateLint.issues : t([]),
1340
+ planConfig: S.config
1341
+ }), r.plan = S, i.customBlocks?.length && n.registerCustomBlocks(i.customBlocks), i.theme && (n.themeOverrides.value = i.theme), {
1342
+ saveGate: h,
1343
+ sessionError: g,
1344
+ retry: async () => {
1345
+ try {
1346
+ await x.initialize(), g.value = null;
1347
+ } catch (e) {
1348
+ g.value = e instanceof Error ? e : /* @__PURE__ */ Error("Authentication failed");
1349
+ }
1350
+ }
1351
+ };
1352
+ }
1353
+ return {
1354
+ runtime: {
1355
+ isSavedBlocksAvailable: q ? () => !0 : () => i.savedBlocks !== !1 && S.hasFeature("savedModules"),
1356
+ isTestEmailAvailable: X ? () => !0 : () => Y.isEnabled.value && $.canSendTestEmail.value && $.hasTemplateSaved.value,
1357
+ isCommentsAvailable: () => i.comments !== !1 && S.hasFeature("commenting") && $.hasTemplateSaved.value,
1358
+ isBlockSaved: (e) => V(f?.state.template ?? null).has(e),
1359
+ getSaveGate: () => h,
1360
+ attach: ve,
1361
+ ready: ye,
1362
+ destroy() {
1363
+ m?.disconnect(), i.onUnmount?.();
1364
+ }
1365
+ },
1366
+ providers: {
1367
+ templates: H,
1368
+ render: K,
1369
+ versionHistory: pe,
1370
+ ...J ? { savedBlocks: J } : {},
1371
+ testEmail: _e,
1372
+ comments: me,
1373
+ ...Q ? { media: Q } : {}
1374
+ },
1375
+ user: he
1376
+ };
1377
+ }
1378
+ //#endregion
1379
+ export { K as bootstrapCloud };