@templatical/editor 0.49.0 → 0.50.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-B77z1iw4.js → src-BcTUmgLe.js} +113 -113
  194. package/dist/cdn/chunks/{src-B77z1iw4.js.map → src-BcTUmgLe.js.map} +1 -1
  195. package/dist/cdn/chunks/src-Bs_yxk3h.js +4392 -0
  196. package/dist/cdn/chunks/src-Bs_yxk3h.js.map +1 -0
  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,12 +1,15 @@
1
1
  import { r as e } from "./rolldown-runtime-Y_bBpyJl.js";
2
- import { B as t, Q as n, f as r } from "./draggable-akeQH_JP.js";
3
- import { mt as i } from "./src-CvLTYGdO.js";
2
+ import { $ as t, F as n, V as r, p as i } from "./draggable-DZ0gwUJ6.js";
3
+ import { gt as a } from "./src-BNFnxfrA.js";
4
+ import { i as o, u as s } from "./keys-BTpmg2Tt.js";
5
+ import { t as c } from "./logger-Tj0RPskW.js";
6
+ import { t as l } from "./preRenderCustomBlocks-Dc-QLntG.js";
4
7
  //#region ../core/src/cloud/auth.ts
5
- function a(e) {
6
- let t = e instanceof i ? e.statusCode : void 0;
8
+ function u(e) {
9
+ let t = e instanceof a ? e.statusCode : void 0;
7
10
  return t !== void 0 && t >= 400 && t < 500;
8
11
  }
9
- var o = class e {
12
+ var d = class e {
10
13
  static DEFAULT_BASE_URL = "https://templatical.com";
11
14
  accessToken = null;
12
15
  expiresAt = null;
@@ -80,16 +83,16 @@ var o = class e {
80
83
  };
81
84
  e === "POST" && this.requestOptions.body && (t["Content-Type"] = "application/json", n.body = JSON.stringify(this.requestOptions.body));
82
85
  let r = await fetch(this.url, n);
83
- if (!r.ok) throw new i(`Token refresh failed: ${r.status}`, r.status);
84
- let a = await r.json();
85
- if (!a.token || !a.expiresAt || !a.projectId || !a.tenant) throw Error("Invalid token response: missing token, expiresAt, projectId, or tenant");
86
- 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 ? {
87
- allowedEmails: a.testEmail.allowedEmails,
88
- signature: a.testEmail.signature
89
- } : null, this._userConfig = a.user?.id && a.user?.name && a.user?.signature ? {
90
- id: a.user.id,
91
- name: a.user.name,
92
- signature: a.user.signature
86
+ if (!r.ok) throw new a(`Token refresh failed: ${r.status}`, r.status);
87
+ let i = await r.json();
88
+ if (!i.token || !i.expiresAt || !i.projectId || !i.tenant) throw Error("Invalid token response: missing token, expiresAt, projectId, or tenant");
89
+ return this.accessToken = i.token, this.expiresAt = /* @__PURE__ */ new Date(i.expiresAt * 1e3), this._projectId = i.projectId, this._tenantSlug = i.tenant, this._testEmailConfig = i.testEmail?.allowedEmails && i.testEmail?.signature ? {
90
+ allowedEmails: i.testEmail.allowedEmails,
91
+ signature: i.testEmail.signature
92
+ } : null, this._userConfig = i.user?.id && i.user?.name && i.user?.signature ? {
93
+ id: i.user.id,
94
+ name: i.user.name,
95
+ signature: i.user.signature
93
96
  } : null, this.accessToken;
94
97
  } catch (e) {
95
98
  let t = e instanceof Error ? e : Error("Token refresh failed", { cause: e });
@@ -109,54 +112,47 @@ var o = class e {
109
112
  };
110
113
  //#endregion
111
114
  //#region ../core/src/cloud/url-builder.ts
112
- function s(e, t) {
115
+ function f(e, t) {
113
116
  return e.replace(/\{(\w+)\}/g, (e, n) => encodeURIComponent(t[n] ?? ""));
114
117
  }
115
- var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{template}`, u = `${l}/ai`, d = `${c}/media`, f = `${d}/folders`, p = `${c}/saved-modules`, m = {
118
+ var p = "/api/v1/projects/{project}/tenants/{tenant}", m = `${p}/templates/{template}`, h = `${p}/media`, g = `${h}/folders`, _ = `${p}/saved-modules`, v = {
116
119
  health: "/api/v1/health",
117
- "projects.config": `${c}/config`,
118
- "broadcasting.auth": `${c}/broadcasting/auth`,
119
- "templates.store": `${c}/templates`,
120
- "templates.show": `${l}`,
121
- "templates.update": `${l}`,
122
- "templates.destroy": `${l}`,
123
- "templates.export": `${l}/export`,
124
- "templates.importFromBeefree": `${c}/templates/import/from-beefree`,
125
- "templates.sendTestEmail": `${l}/send-test-email`,
126
- "versions.index": `${l}/versions`,
127
- "versions.store": `${l}/versions`,
128
- "versions.show": `${l}/versions/{version}`,
129
- "versions.restore": `${l}/versions/{version}/restore`,
130
- "comments.index": `${l}/comments`,
131
- "comments.store": `${l}/comments`,
132
- "comments.update": `${l}/comments/{comment}`,
133
- "comments.destroy": `${l}/comments/{comment}`,
134
- "comments.resolve": `${l}/comments/{comment}/resolve`,
135
- "ai.generate": `${u}/generate`,
136
- "ai.conversationMessages": `${u}/conversation-messages`,
137
- "ai.suggestions": `${u}/suggestions`,
138
- "ai.rewriteText": `${u}/rewrite-text`,
139
- "ai.score": `${u}/score`,
140
- "ai.fixFinding": `${u}/fix-finding`,
141
- "ai.generateFromDesign": `${u}/generate-from-design`,
142
- "media.upload": `${d}/upload`,
143
- "media.browse": `${d}/browse`,
144
- "media.delete": `${d}/delete`,
145
- "media.move": `${d}/move`,
146
- "media.update": `${d}/{media}`,
147
- "media.replace": `${d}/{media}/replace`,
148
- "media.checkUsage": `${d}/check-usage`,
149
- "media.frequentlyUsed": `${d}/frequently-used`,
150
- "media.importFromUrl": `${d}/import-from-url`,
151
- "folders.index": `${f}`,
152
- "folders.store": `${f}`,
153
- "folders.update": `${f}/{mediaFolder}`,
154
- "folders.destroy": `${f}/{mediaFolder}`,
155
- "savedModules.index": `${p}`,
156
- "savedModules.store": `${p}`,
157
- "savedModules.update": `${p}/{savedModule}`,
158
- "savedModules.destroy": `${p}/{savedModule}`
159
- }, h = class {
120
+ "projects.config": `${p}/config`,
121
+ "broadcasting.auth": `${p}/broadcasting/auth`,
122
+ "templates.store": `${p}/templates`,
123
+ "templates.show": `${m}`,
124
+ "templates.update": `${m}`,
125
+ "templates.destroy": `${m}`,
126
+ "templates.export": `${m}/export`,
127
+ "templates.importFromBeefree": `${p}/templates/import/from-beefree`,
128
+ "templates.sendTestEmail": `${m}/send-test-email`,
129
+ "versions.index": `${m}/versions`,
130
+ "versions.store": `${m}/versions`,
131
+ "versions.show": `${m}/versions/{version}`,
132
+ "versions.restore": `${m}/versions/{version}/restore`,
133
+ "comments.index": `${m}/comments`,
134
+ "comments.store": `${m}/comments`,
135
+ "comments.update": `${m}/comments/{comment}`,
136
+ "comments.destroy": `${m}/comments/{comment}`,
137
+ "comments.resolve": `${m}/comments/{comment}/resolve`,
138
+ "media.upload": `${h}/upload`,
139
+ "media.browse": `${h}/browse`,
140
+ "media.delete": `${h}/delete`,
141
+ "media.move": `${h}/move`,
142
+ "media.update": `${h}/{media}`,
143
+ "media.replace": `${h}/{media}/replace`,
144
+ "media.checkUsage": `${h}/check-usage`,
145
+ "media.frequentlyUsed": `${h}/frequently-used`,
146
+ "media.importFromUrl": `${h}/import-from-url`,
147
+ "folders.index": `${g}`,
148
+ "folders.store": `${g}`,
149
+ "folders.update": `${g}/{mediaFolder}`,
150
+ "folders.destroy": `${g}/{mediaFolder}`,
151
+ "savedModules.index": `${_}`,
152
+ "savedModules.store": `${_}`,
153
+ "savedModules.update": `${_}/{savedModule}`,
154
+ "savedModules.destroy": `${_}/{savedModule}`
155
+ }, y = class {
160
156
  authManager;
161
157
  constructor(e) {
162
158
  this.authManager = e;
@@ -184,7 +180,7 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
184
180
  });
185
181
  if (!n.ok) {
186
182
  let e = await n.json().catch(() => ({ message: `HTTP error ${n.status}` })), t = this.extractFirstValidationError(e);
187
- throw new i(t, n.status);
183
+ throw new a(t, n.status);
188
184
  }
189
185
  if (n.status !== 204) return (await n.json()).data;
190
186
  }
@@ -196,7 +192,7 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
196
192
  return e.message;
197
193
  }
198
194
  async createTemplate(e, t) {
199
- return this.request(s(m["templates.store"], this.baseParams), {
195
+ return this.request(f(v["templates.store"], this.baseParams), {
200
196
  method: "POST",
201
197
  body: JSON.stringify(t === void 0 ? { content: e } : {
202
198
  content: e,
@@ -205,13 +201,13 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
205
201
  });
206
202
  }
207
203
  async getTemplate(e) {
208
- return this.request(s(m["templates.show"], {
204
+ return this.request(f(v["templates.show"], {
209
205
  ...this.baseParams,
210
206
  template: e
211
207
  }));
212
208
  }
213
209
  async updateTemplate(e, t) {
214
- return this.request(s(m["templates.update"], {
210
+ return this.request(f(v["templates.update"], {
215
211
  ...this.baseParams,
216
212
  template: e
217
213
  }), {
@@ -220,7 +216,7 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
220
216
  });
221
217
  }
222
218
  async createVersion(e, t, n) {
223
- return this.request(s(m["versions.store"], {
219
+ return this.request(f(v["versions.store"], {
224
220
  ...this.baseParams,
225
221
  template: e
226
222
  }), {
@@ -232,26 +228,26 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
232
228
  });
233
229
  }
234
230
  async deleteTemplate(e) {
235
- return this.request(s(m["templates.destroy"], {
231
+ return this.request(f(v["templates.destroy"], {
236
232
  ...this.baseParams,
237
233
  template: e
238
234
  }), { method: "DELETE" });
239
235
  }
240
236
  async getVersions(e) {
241
- return this.request(s(m["versions.index"], {
237
+ return this.request(f(v["versions.index"], {
242
238
  ...this.baseParams,
243
239
  template: e
244
240
  }));
245
241
  }
246
242
  async getVersion(e, t) {
247
- return this.request(s(m["versions.show"], {
243
+ return this.request(f(v["versions.show"], {
248
244
  ...this.baseParams,
249
245
  template: e,
250
246
  version: t
251
247
  }));
252
248
  }
253
249
  async restoreVersion(e, t) {
254
- return this.request(s(m["versions.restore"], {
250
+ return this.request(f(v["versions.restore"], {
255
251
  ...this.baseParams,
256
252
  template: e,
257
253
  version: t
@@ -262,7 +258,7 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
262
258
  custom_fonts: t.customFonts,
263
259
  default_fallback: t.defaultFallback
264
260
  }) : void 0;
265
- return this.request(s(m["templates.export"], {
261
+ return this.request(f(v["templates.export"], {
266
262
  ...this.baseParams,
267
263
  template: e
268
264
  }), {
@@ -271,7 +267,7 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
271
267
  });
272
268
  }
273
269
  async sendTestEmail(e, t) {
274
- await this.request(s(m["templates.sendTestEmail"], {
270
+ await this.request(f(v["templates.sendTestEmail"], {
275
271
  ...this.baseParams,
276
272
  template: e
277
273
  }), {
@@ -280,11 +276,11 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
280
276
  });
281
277
  }
282
278
  commentsUrl(e, t) {
283
- return t ? s(m["comments.update"], {
279
+ return t ? f(v["comments.update"], {
284
280
  ...this.baseParams,
285
281
  template: e,
286
282
  comment: t
287
- }) : s(m["comments.index"], {
283
+ }) : f(v["comments.index"], {
288
284
  ...this.baseParams,
289
285
  template: e
290
286
  });
@@ -314,7 +310,7 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
314
310
  });
315
311
  }
316
312
  async resolveComment(e, t, n, r) {
317
- return this.request(s(m["comments.resolve"], {
313
+ return this.request(f(v["comments.resolve"], {
318
314
  ...this.baseParams,
319
315
  template: e,
320
316
  comment: t
@@ -325,22 +321,22 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
325
321
  });
326
322
  }
327
323
  async fetchConfig() {
328
- return this.request(s(m["projects.config"], this.baseParams));
324
+ return this.request(f(v["projects.config"], this.baseParams));
329
325
  }
330
326
  async listModules(e, t) {
331
- let n = s(m["savedModules.index"], this.baseParams), r = new URLSearchParams();
327
+ let n = f(v["savedModules.index"], this.baseParams), r = new URLSearchParams();
332
328
  e && r.set("search", e), t && r.set("category", t);
333
329
  let i = r.size > 0 ? `?${r}` : "";
334
330
  return this.request(`${n}${i}`);
335
331
  }
336
332
  async createModule(e) {
337
- return this.request(s(m["savedModules.store"], this.baseParams), {
333
+ return this.request(f(v["savedModules.store"], this.baseParams), {
338
334
  method: "POST",
339
335
  body: JSON.stringify(e)
340
336
  });
341
337
  }
342
338
  async updateModule(e, t) {
343
- return this.request(s(m["savedModules.update"], {
339
+ return this.request(f(v["savedModules.update"], {
344
340
  ...this.baseParams,
345
341
  savedModule: e
346
342
  }), {
@@ -349,12 +345,12 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
349
345
  });
350
346
  }
351
347
  async deleteModule(e) {
352
- return this.request(s(m["savedModules.destroy"], {
348
+ return this.request(f(v["savedModules.destroy"], {
353
349
  ...this.baseParams,
354
350
  savedModule: e
355
351
  }), { method: "DELETE" });
356
352
  }
357
- }, g = class {
353
+ }, b = class {
358
354
  authManager;
359
355
  constructor(e) {
360
356
  this.authManager = e;
@@ -389,7 +385,7 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
389
385
  async browseMedia(e) {
390
386
  let t = new URLSearchParams();
391
387
  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);
392
- let n = t.toString(), r = `${s(m["media.browse"], this.baseParams)}${n ? `?${n}` : ""}`, i = await this.authManager.authenticatedFetch(r, { headers: { Accept: "application/json" } });
388
+ let n = t.toString(), r = `${f(v["media.browse"], this.baseParams)}${n ? `?${n}` : ""}`, i = await this.authManager.authenticatedFetch(r, { headers: { Accept: "application/json" } });
393
389
  if (!i.ok) {
394
390
  let e = await i.json().catch(() => ({ message: `HTTP error ${i.status}` }));
395
391
  throw Error(e.message, { cause: e });
@@ -399,7 +395,7 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
399
395
  async uploadMedia(e, t) {
400
396
  let n = new FormData();
401
397
  n.append("file", e), t && n.append("folderId", t);
402
- let r = s(m["media.upload"], this.baseParams), i = await this.authManager.authenticatedFetch(r, {
398
+ let r = f(v["media.upload"], this.baseParams), i = await this.authManager.authenticatedFetch(r, {
403
399
  method: "POST",
404
400
  headers: { Accept: "application/json" },
405
401
  body: n
@@ -412,7 +408,7 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
412
408
  }
413
409
  async updateMedia(e, t, n) {
414
410
  let r = {};
415
- return t !== void 0 && (r.filename = t), n !== void 0 && (r.alt = n), this.request(s(m["media.update"], {
411
+ return t !== void 0 && (r.filename = t), n !== void 0 && (r.alt = n), this.request(f(v["media.update"], {
416
412
  ...this.baseParams,
417
413
  media: e
418
414
  }), {
@@ -421,13 +417,13 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
421
417
  });
422
418
  }
423
419
  async deleteMedia(e) {
424
- return this.request(s(m["media.delete"], this.baseParams), {
420
+ return this.request(f(v["media.delete"], this.baseParams), {
425
421
  method: "POST",
426
422
  body: JSON.stringify({ ids: e })
427
423
  });
428
424
  }
429
425
  async moveMedia(e, t) {
430
- return this.request(s(m["media.move"], this.baseParams), {
426
+ return this.request(f(v["media.move"], this.baseParams), {
431
427
  method: "POST",
432
428
  body: JSON.stringify({
433
429
  ids: e,
@@ -436,10 +432,10 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
436
432
  });
437
433
  }
438
434
  async getMediaFolders() {
439
- return this.request(s(m["folders.index"], this.baseParams));
435
+ return this.request(f(v["folders.index"], this.baseParams));
440
436
  }
441
437
  async createMediaFolder(e, t) {
442
- return this.request(s(m["folders.store"], this.baseParams), {
438
+ return this.request(f(v["folders.store"], this.baseParams), {
443
439
  method: "POST",
444
440
  body: JSON.stringify({
445
441
  name: e,
@@ -448,7 +444,7 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
448
444
  });
449
445
  }
450
446
  async renameMediaFolder(e, t) {
451
- return this.request(s(m["folders.update"], {
447
+ return this.request(f(v["folders.update"], {
452
448
  ...this.baseParams,
453
449
  mediaFolder: e
454
450
  }), {
@@ -457,13 +453,13 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
457
453
  });
458
454
  }
459
455
  async deleteMediaFolder(e) {
460
- return this.request(s(m["folders.destroy"], {
456
+ return this.request(f(v["folders.destroy"], {
461
457
  ...this.baseParams,
462
458
  mediaFolder: e
463
459
  }), { method: "DELETE" });
464
460
  }
465
461
  async checkMediaUsage(e) {
466
- let t = await this.authManager.authenticatedFetch(s(m["media.checkUsage"], this.baseParams), {
462
+ let t = await this.authManager.authenticatedFetch(f(v["media.checkUsage"], this.baseParams), {
467
463
  method: "POST",
468
464
  headers: {
469
465
  "Content-Type": "application/json",
@@ -478,10 +474,10 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
478
474
  return t.json();
479
475
  }
480
476
  async getFrequentlyUsed() {
481
- return this.request(s(m["media.frequentlyUsed"], this.baseParams));
477
+ return this.request(f(v["media.frequentlyUsed"], this.baseParams));
482
478
  }
483
479
  async importFromUrl(e, t) {
484
- return this.request(s(m["media.importFromUrl"], this.baseParams), {
480
+ return this.request(f(v["media.importFromUrl"], this.baseParams), {
485
481
  method: "POST",
486
482
  body: JSON.stringify({
487
483
  url: e,
@@ -492,7 +488,7 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
492
488
  async replaceMedia(e, t) {
493
489
  let n = new FormData();
494
490
  n.append("file", t);
495
- let r = s(m["media.replace"], {
491
+ let r = f(v["media.replace"], {
496
492
  ...this.baseParams,
497
493
  media: e
498
494
  }), i = await this.authManager.authenticatedFetch(r, {
@@ -509,14 +505,14 @@ var c = "/api/v1/projects/{project}/tenants/{tenant}", l = `${c}/templates/{temp
509
505
  };
510
506
  //#endregion
511
507
  //#region ../core/src/cloud/websocket-client.ts
512
- function _(e) {
508
+ function x(e) {
513
509
  return {
514
510
  host: e.host,
515
511
  port: e.port,
516
512
  appKey: e.appKey
517
513
  };
518
514
  }
519
- var v = class {
515
+ var S = class {
520
516
  pusher = null;
521
517
  authManager;
522
518
  config;
@@ -532,7 +528,7 @@ var v = class {
532
528
  } catch {
533
529
  throw Error("[Templatical] Cloud features require the optional peer dependency 'pusher-js'. Please install it.");
534
530
  }
535
- let { host: n, port: r, appKey: i } = this.config, a = this.authManager.resolveUrl(s(m["broadcasting.auth"], {
531
+ let { host: n, port: r, appKey: i } = this.config, a = this.authManager.resolveUrl(f(v["broadcasting.auth"], {
536
532
  project: this.authManager.projectId,
537
533
  tenant: this.authManager.tenantSlug
538
534
  }));
@@ -580,423 +576,8 @@ var v = class {
580
576
  get isConnected() {
581
577
  return this.pusher?.connection.state === "connected";
582
578
  }
583
- }, y = 0;
584
- function b() {
585
- return `msg_${Date.now()}_${++y}`;
586
- }
587
- function x(e) {
588
- let { authManager: t, getTemplateId: r, onApply: i, onError: a } = e, o = n([]), c = n(!1), l = n(!1), u = n(null), d = n(null), f = n(null), p = n(null), h = n(null), g = n(null), _ = n(!1), v = n([]), y = n(!1);
589
- function x(e, t) {
590
- let n = o.value.findIndex((t) => t.id === e);
591
- if (n === -1) return;
592
- let r = {
593
- ...o.value[n],
594
- ...t
595
- };
596
- o.value = [
597
- ...o.value.slice(0, n),
598
- r,
599
- ...o.value.slice(n + 1)
600
- ];
601
- }
602
- async function S() {
603
- let e = r();
604
- if (e) {
605
- l.value = !0;
606
- try {
607
- let n = s(m["ai.conversationMessages"], {
608
- project: t.projectId,
609
- tenant: t.tenantSlug,
610
- template: e
611
- }), r = await t.authenticatedFetch(n, {
612
- method: "GET",
613
- headers: { Accept: "application/json" }
614
- });
615
- if (!r.ok) return;
616
- let i = await r.json();
617
- i.conversationId && (f.value = i.conversationId), Array.isArray(i.data) && i.data.length > 0 && (o.value = i.data.map((e) => ({
618
- id: e.id,
619
- role: e.role,
620
- content: e.content,
621
- timestamp: new Date(e.createdAt).getTime()
622
- })));
623
- } catch {} finally {
624
- l.value = !1;
625
- }
626
- }
627
- }
628
- async function C(e, n) {
629
- let i = r();
630
- if (i) {
631
- y.value = !0;
632
- try {
633
- let r = s(m["ai.suggestions"], {
634
- project: t.projectId,
635
- tenant: t.tenantSlug,
636
- template: i
637
- }), a = await t.authenticatedFetch(r, {
638
- method: "POST",
639
- headers: {
640
- "Content-Type": "application/json",
641
- Accept: "text/event-stream"
642
- },
643
- body: JSON.stringify({
644
- currentContent: e,
645
- mergeTags: n.map((e) => ({
646
- label: e.label,
647
- value: e.value
648
- }))
649
- })
650
- });
651
- if (!a.ok) return;
652
- let o = a.body?.getReader();
653
- if (!o) return;
654
- let c = new TextDecoder(), l = "";
655
- for (;;) {
656
- let { done: e, value: t } = await o.read();
657
- if (e) break;
658
- l += c.decode(t, { stream: !0 });
659
- let n = l.split("\n");
660
- l = n.pop() ?? "";
661
- for (let e of n) {
662
- if (!e.startsWith("data: ")) continue;
663
- let t;
664
- try {
665
- t = JSON.parse(e.slice(6));
666
- } catch {
667
- continue;
668
- }
669
- t.type === "done" && Array.isArray(t.suggestions) && (v.value = t.suggestions.slice(0, 3));
670
- }
671
- }
672
- } catch {} finally {
673
- y.value = !1;
674
- }
675
- }
676
- }
677
- async function w(e, n, l) {
678
- let y = r();
679
- if (!y) throw Error("Template must be saved before using AI generation");
680
- c.value = !0, u.value = null, d.value = null, v.value = [];
681
- let S = b();
682
- o.value = [...o.value, {
683
- id: S,
684
- role: "user",
685
- content: e,
686
- timestamp: Date.now()
687
- }];
688
- let C = b();
689
- o.value = [...o.value, {
690
- id: C,
691
- role: "assistant",
692
- content: "",
693
- timestamp: Date.now()
694
- }];
695
- try {
696
- let r = s(m["ai.generate"], {
697
- project: t.projectId,
698
- tenant: t.tenantSlug,
699
- template: y
700
- }), a = await t.authenticatedFetch(r, {
701
- method: "POST",
702
- headers: {
703
- "Content-Type": "application/json",
704
- Accept: "text/event-stream"
705
- },
706
- body: JSON.stringify({
707
- prompt: e,
708
- currentContent: n,
709
- mergeTags: l.map((e) => ({
710
- label: e.label,
711
- value: e.value
712
- })),
713
- conversationId: f.value
714
- })
715
- });
716
- if (!a.ok) {
717
- let e = await a.json().catch(() => null);
718
- throw Error(a.status === 403 ? "aiGenerationNotAvailable" : e?.message || "Failed to generate template");
719
- }
720
- let c = a.body?.getReader();
721
- if (!c) throw Error("Failed to read stream");
722
- let d = new TextDecoder(), v = "", b = null;
723
- try {
724
- for (;;) {
725
- let { done: e, value: t } = await c.read();
726
- if (e) break;
727
- v += d.decode(t, { stream: !0 });
728
- let r = v.split("\n");
729
- v = r.pop() ?? "";
730
- for (let e of r) {
731
- if (!e.startsWith("data: ")) continue;
732
- let t = e.slice(6), r;
733
- try {
734
- r = JSON.parse(t);
735
- } catch {
736
- continue;
737
- }
738
- if (r.type === "text") x(C, { content: (o.value.find((e) => e.id === C)?.content ?? "") + r.text });
739
- else if (r.type === "error") throw Error(r.message || "Failed to generate template");
740
- else r.type === "done" && (r.conversationId && (f.value = r.conversationId), x(C, { content: r.text }), b = r.content ?? null, b ? (h.value = n, g.value = b, p.value = C, _.value = !1, i?.(b)) : u.value = "ai_apply_failed");
741
- }
742
- }
743
- } finally {
744
- c.cancel().catch(() => {});
745
- }
746
- return b;
747
- } catch (t) {
748
- let n = t instanceof Error ? t : Error("Failed to generate template", { cause: t });
749
- return u.value = n.message, d.value = e, a?.(n), o.value = o.value.filter((e) => e.id !== S && e.id !== C), null;
750
- } finally {
751
- c.value = !1;
752
- }
753
- }
754
- function T() {
755
- _.value ? (g.value && i?.(g.value), _.value = !1) : (h.value && i?.(h.value), _.value = !0);
756
- }
757
- function E() {
758
- o.value = [], f.value = null, u.value = null, p.value = null, h.value = null, g.value = null, _.value = !1;
759
- }
760
- return {
761
- messages: o,
762
- isGenerating: c,
763
- isLoadingHistory: l,
764
- isLastChangeReverted: _,
765
- lastApplyMessageId: p,
766
- error: u,
767
- failedPrompt: d,
768
- suggestions: v,
769
- isLoadingSuggestions: y,
770
- sendPrompt: w,
771
- toggleLastRevert: T,
772
- loadConversation: S,
773
- loadSuggestions: C,
774
- clearChat: E
775
- };
776
- }
777
- //#endregion
778
- //#region ../core/src/cloud/ai-config.ts
779
- function S(e) {
780
- function t(t) {
781
- return e !== !1 && e?.[t] !== !1;
782
- }
783
- return {
784
- isFeatureEnabled: t,
785
- hasAnyMenuFeature: r(() => t("chat") || t("scoring") || t("designToTemplate"))
786
- };
787
- }
788
- //#endregion
789
- //#region ../core/src/cloud/template-scoring.ts
790
- function C(e) {
791
- let { authManager: t, getTemplateId: r } = e, i = n(!1), a = n(null), o = n(null), c = n(null), l = n(""), u = n(null);
792
- async function d(e, n) {
793
- let c = r();
794
- if (!c) return null;
795
- i.value = !0, o.value = null, a.value = null;
796
- try {
797
- let r = s(m["ai.score"], {
798
- project: t.projectId,
799
- tenant: t.tenantSlug,
800
- template: c
801
- }), i = await t.authenticatedFetch(r, {
802
- method: "POST",
803
- headers: {
804
- "Content-Type": "application/json",
805
- Accept: "text/event-stream"
806
- },
807
- body: JSON.stringify({
808
- currentContent: e,
809
- mergeTags: n.map((e) => ({
810
- label: e.label,
811
- value: e.value
812
- }))
813
- })
814
- });
815
- if (!i.ok) {
816
- if (i.status === 403) throw Error("aiGenerationNotAvailable");
817
- let e = await i.json().catch(() => null);
818
- throw Error(e?.message || "Failed to score template");
819
- }
820
- let o = i.body?.getReader();
821
- if (!o) throw Error("Failed to read stream");
822
- let l = new TextDecoder(), u = "", d = null;
823
- for (;;) {
824
- let { done: e, value: t } = await o.read();
825
- if (e) break;
826
- u += l.decode(t, { stream: !0 });
827
- let n = u.split("\n");
828
- u = n.pop() ?? "";
829
- for (let e of n) {
830
- if (!e.startsWith("data: ")) continue;
831
- let t;
832
- try {
833
- t = JSON.parse(e.slice(6));
834
- } catch {
835
- continue;
836
- }
837
- if (t.type === "error") throw Error(t.message || "Failed to score template");
838
- t.type === "done" && (d = t.result ?? null);
839
- }
840
- }
841
- if (d) for (let [e, t] of Object.entries(d.categories)) for (let n of t.findings) n.category = e;
842
- return a.value = d, d;
843
- } catch (e) {
844
- return o.value = e instanceof Error ? e.message : "Failed to score template", null;
845
- } finally {
846
- i.value = !1;
847
- }
848
- }
849
- async function f(e, n, i) {
850
- let a = r();
851
- if (!a) return null;
852
- c.value = n.id, l.value = "", u.value = null;
853
- try {
854
- let r = s(m["ai.fixFinding"], {
855
- project: t.projectId,
856
- tenant: t.tenantSlug,
857
- template: a
858
- }), o = await t.authenticatedFetch(r, {
859
- method: "POST",
860
- headers: {
861
- "Content-Type": "application/json",
862
- Accept: "text/event-stream"
863
- },
864
- body: JSON.stringify({
865
- content: e,
866
- finding: {
867
- id: n.id,
868
- message: n.message,
869
- suggestion: n.suggestion,
870
- category: n.category
871
- },
872
- mergeTags: i.map((e) => ({
873
- label: e.label,
874
- value: e.value
875
- }))
876
- })
877
- });
878
- if (!o.ok) {
879
- if (o.status === 403) throw Error("aiGenerationNotAvailable");
880
- let e = await o.json().catch(() => null);
881
- throw Error(e?.message || "Failed to fix finding");
882
- }
883
- let c = o.body?.getReader();
884
- if (!c) throw Error("Failed to read stream");
885
- let u = new TextDecoder(), d = "", f = null;
886
- for (;;) {
887
- let { done: e, value: t } = await c.read();
888
- if (e) break;
889
- d += u.decode(t, { stream: !0 });
890
- let n = d.split("\n");
891
- d = n.pop() ?? "";
892
- for (let e of n) {
893
- if (!e.startsWith("data: ")) continue;
894
- let t;
895
- try {
896
- t = JSON.parse(e.slice(6));
897
- } catch {
898
- continue;
899
- }
900
- if (t.type === "text") l.value += t.text;
901
- else if (t.type === "error") throw Error(t.message || "Failed to fix finding");
902
- else t.type === "done" && (f = t.content ?? null);
903
- }
904
- }
905
- return f;
906
- } catch (e) {
907
- return u.value = e instanceof Error ? e.message : "Failed to fix finding", null;
908
- } finally {
909
- c.value = null;
910
- }
911
- }
912
- function p(e, t) {
913
- if (!a.value) return;
914
- let n = a.value.categories[e];
915
- n && (n.findings = n.findings.filter((e) => e.id !== t));
916
- }
917
- function h() {
918
- i.value = !1, a.value = null, o.value = null, c.value = null, l.value = "", u.value = null;
919
- }
920
- return {
921
- isScoring: i,
922
- scoringResult: a,
923
- error: o,
924
- fixingFindingId: c,
925
- fixStreamingText: l,
926
- fixError: u,
927
- score: d,
928
- fixFinding: f,
929
- removeFinding: p,
930
- reset: h
931
- };
932
- }
933
- //#endregion
934
- //#region ../core/src/cloud/design-reference.ts
579
+ }, C = "comment-broadcast";
935
580
  function w(e) {
936
- let { authManager: t, getTemplateId: r, onApply: i, onError: a } = e, o = n(!1), c = n(null);
937
- async function l(e) {
938
- let n = r();
939
- if (!n) throw Error("Template must be saved before using design reference");
940
- o.value = !0, c.value = null;
941
- try {
942
- let r = new FormData();
943
- e.prompt && r.append("prompt", e.prompt), e.imageUpload && r.append("image_upload", e.imageUpload), e.pdfUpload && r.append("pdf_upload", e.pdfUpload);
944
- let a = s(m["ai.generateFromDesign"], {
945
- project: t.projectId,
946
- tenant: t.tenantSlug,
947
- template: n
948
- }), o = await t.authenticatedFetch(a, {
949
- method: "POST",
950
- headers: { Accept: "text/event-stream" },
951
- body: r
952
- });
953
- if (!o.ok) {
954
- let e = await o.json().catch(() => null);
955
- throw Error(o.status === 403 ? "aiGenerationNotAvailable" : e?.message || "Failed to generate template from design");
956
- }
957
- let c = o.body?.getReader();
958
- if (!c) throw Error("Failed to read stream");
959
- let l = new TextDecoder(), u = "", d = null;
960
- for (;;) {
961
- let { done: e, value: t } = await c.read();
962
- if (e) break;
963
- u += l.decode(t, { stream: !0 });
964
- let n = u.split("\n");
965
- u = n.pop() ?? "";
966
- for (let e of n) {
967
- if (!e.startsWith("data: ")) continue;
968
- let t = e.slice(6), n;
969
- try {
970
- n = JSON.parse(t);
971
- } catch {
972
- continue;
973
- }
974
- if (n.type === "error") throw Error(n.message || "Failed to generate template from design");
975
- n.type === "done" && (d = n.content ?? null, d && i?.(d));
976
- }
977
- }
978
- return d;
979
- } catch (e) {
980
- let t = e instanceof Error ? e : Error("Failed to generate template from design", { cause: e });
981
- return c.value = t.message, a?.(t), null;
982
- } finally {
983
- o.value = !1;
984
- }
985
- }
986
- function u() {
987
- o.value = !1, c.value = null;
988
- }
989
- return {
990
- isGenerating: o,
991
- error: c,
992
- generate: l,
993
- reset: u
994
- };
995
- }
996
- //#endregion
997
- //#region ../core/src/cloud/comments-provider.ts
998
- var T = "comment-broadcast";
999
- function E(e) {
1000
581
  let t = {
1001
582
  id: e.id,
1002
583
  body: e.body,
@@ -1006,12 +587,12 @@ function E(e) {
1006
587
  parentId: e.parentId,
1007
588
  resolvedAt: e.resolvedAt
1008
589
  };
1009
- return e.updatedAt !== e.createdAt && (t.updatedAt = e.updatedAt), e.resolvedBy && (t.resolvedBy = e.resolvedBy), e.replies?.length && (t.replies = e.replies.map(E)), t;
590
+ return e.updatedAt !== e.createdAt && (t.updatedAt = e.updatedAt), e.resolvedBy && (t.resolvedBy = e.resolvedBy), e.replies?.length && (t.replies = e.replies.map(w)), t;
1010
591
  }
1011
- function D(e) {
1012
- let { authManager: n, channel: r, getSocketId: i } = e, a = new h(n);
592
+ function ee(e) {
593
+ let { authManager: t, channel: n, getSocketId: i } = e, a = new y(t);
1013
594
  function o() {
1014
- let e = n.userConfig;
595
+ let e = t.userConfig;
1015
596
  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.");
1016
597
  return {
1017
598
  userId: e.id,
@@ -1025,10 +606,10 @@ function D(e) {
1025
606
  }
1026
607
  return {
1027
608
  async list(e) {
1028
- return (await a.getComments(e)).map(E);
609
+ return (await a.getComments(e)).map(w);
1029
610
  },
1030
611
  async create(e, t) {
1031
- return E(await a.createComment(e, {
612
+ return w(await a.createComment(e, {
1032
613
  body: t.body,
1033
614
  blockId: t.blockId,
1034
615
  parentId: t.parentId,
@@ -1037,7 +618,7 @@ function D(e) {
1037
618
  },
1038
619
  async update(e, t, n) {
1039
620
  if (n.body === void 0) throw Error("[Templatical] Cloud comments: update() needs a `body` in the patch.");
1040
- return E(await a.updateComment(e, t, {
621
+ return w(await a.updateComment(e, t, {
1041
622
  body: n.body,
1042
623
  ...o()
1043
624
  }, s()));
@@ -1046,51 +627,51 @@ function D(e) {
1046
627
  await a.deleteComment(e, t, o(), s());
1047
628
  },
1048
629
  async setResolved(e, t, n) {
1049
- return E(await a.resolveComment(e, t, o(), s()));
630
+ return w(await a.resolveComment(e, t, o(), s()));
1050
631
  },
1051
- subscribe(e, n) {
632
+ subscribe(e, t) {
1052
633
  function i(e) {
1053
- let t = E(e.comment);
634
+ let n = w(e.comment);
1054
635
  switch (e.action) {
1055
636
  case "commentCreated":
1056
- n({
637
+ t({
1057
638
  type: "created",
1058
- comment: t
639
+ comment: n
1059
640
  });
1060
641
  break;
1061
642
  case "commentDeleted":
1062
- n({
643
+ t({
1063
644
  type: "deleted",
1064
- commentId: t.id,
1065
- parentId: t.parentId
645
+ commentId: n.id,
646
+ parentId: n.parentId
1066
647
  });
1067
648
  break;
1068
649
  case "commentUpdated":
1069
650
  case "commentResolved":
1070
- case "commentUnresolved": n({
651
+ case "commentUnresolved": t({
1071
652
  type: "updated",
1072
- comment: t
653
+ comment: n
1073
654
  });
1074
655
  }
1075
656
  }
1076
- let a = t(r, (e, t) => {
1077
- t?.unbind(T, i), e?.bind(T, i);
657
+ let a = r(n, (e, t) => {
658
+ t?.unbind(C, i), e?.bind(C, i);
1078
659
  }, { immediate: !0 });
1079
660
  return () => {
1080
- a(), r.value?.unbind(T, i);
661
+ a(), n.value?.unbind(C, i);
1081
662
  };
1082
663
  }
1083
664
  };
1084
665
  }
1085
666
  //#endregion
1086
667
  //#region ../core/src/cloud/web-socket.ts
1087
- function O(e) {
1088
- let { authManager: t, onError: r } = e, i = n(null), a = n(!1), o = null, s = null;
1089
- async function c(e, n) {
668
+ function te(e) {
669
+ let { authManager: n, onError: r } = e, i = t(null), a = t(!1), o = null, s = null;
670
+ async function c(e, t) {
1090
671
  if (o) return;
1091
- o = new v({
1092
- authManager: t,
1093
- config: n,
672
+ o = new S({
673
+ authManager: n,
674
+ config: t,
1094
675
  onError: r
1095
676
  }), await o.connect(), s = `presence-template.${e}`;
1096
677
  let c = o.subscribePresence(s);
@@ -1116,8 +697,8 @@ function O(e) {
1116
697
  }
1117
698
  //#endregion
1118
699
  //#region ../core/src/cloud/saved-blocks-provider.ts
1119
- function k(e) {
1120
- let t = new h(e);
700
+ function ne(e) {
701
+ let t = new y(e);
1121
702
  return {
1122
703
  list(e) {
1123
704
  return t.listModules(e?.search, e?.category);
@@ -1135,7 +716,7 @@ function k(e) {
1135
716
  }
1136
717
  //#endregion
1137
718
  //#region ../core/src/cloud/media-provider.ts
1138
- function A(e) {
719
+ function T(e) {
1139
720
  let t = {
1140
721
  id: e.id,
1141
722
  url: e.url,
@@ -1149,27 +730,27 @@ function A(e) {
1149
730
  };
1150
731
  return e.width != null && (t.width = e.width), e.height != null && (t.height = e.height), e.thumbnailUrl != null && (t.thumbnailUrl = e.thumbnailUrl), t;
1151
732
  }
1152
- function j(e, t = null) {
733
+ function E(e, t = null) {
1153
734
  return {
1154
735
  id: e.id,
1155
736
  name: e.name,
1156
737
  parentId: e.parentId === void 0 ? t : e.parentId
1157
738
  };
1158
739
  }
1159
- function M(e, t = null) {
740
+ function D(e, t = null) {
1160
741
  let n = [];
1161
- for (let r of e) n.push(j(r, t)), r.children?.length && n.push(...M(r.children, r.id));
742
+ for (let r of e) n.push(E(r, t)), r.children?.length && n.push(...D(r.children, r.id));
1162
743
  return n;
1163
744
  }
1164
- function N(e) {
745
+ function O(e) {
1165
746
  let t = e?.media?.categories;
1166
747
  if (!t) return;
1167
748
  let n = {};
1168
749
  for (let [e, r] of Object.entries(t)) n[e] = r.mimeTypes;
1169
750
  return n;
1170
751
  }
1171
- function P(e, t) {
1172
- let n = new g(e);
752
+ function k(e, t) {
753
+ let n = new b(e);
1173
754
  return {
1174
755
  async list(e) {
1175
756
  let t = await n.browseMedia({
@@ -1177,40 +758,40 @@ function P(e, t) {
1177
758
  cursor: e?.cursor,
1178
759
  folderId: e?.folderId,
1179
760
  category: e?.category
1180
- }), r = { items: t.data.map(A) };
761
+ }), r = { items: t.data.map(T) };
1181
762
  return t.meta.nextCursor && (r.nextCursor = t.meta.nextCursor), r;
1182
763
  },
1183
764
  async create(e) {
1184
- return A(await n.uploadMedia(e.file, e.folderId));
765
+ return T(await n.uploadMedia(e.file, e.folderId));
1185
766
  },
1186
767
  async update(e, t) {
1187
- return A(await n.updateMedia(e, t.filename, t.alt));
768
+ return T(await n.updateMedia(e, t.filename, t.alt));
1188
769
  },
1189
770
  delete(e) {
1190
771
  return n.deleteMedia(e);
1191
772
  },
1192
773
  folders: {
1193
774
  async list() {
1194
- return M(await n.getMediaFolders());
775
+ return D(await n.getMediaFolders());
1195
776
  },
1196
777
  async create(e) {
1197
- return j(await n.createMediaFolder(e.name, e.parentId));
778
+ return E(await n.createMediaFolder(e.name, e.parentId));
1198
779
  },
1199
780
  async update(e, t) {
1200
- return j(await n.renameMediaFolder(e, t.name));
781
+ return E(await n.renameMediaFolder(e, t.name));
1201
782
  },
1202
783
  delete(e) {
1203
784
  return n.deleteMediaFolder(e);
1204
785
  },
1205
786
  async move(e, t) {
1206
- return (await n.moveMedia(e, t)).map(A);
787
+ return (await n.moveMedia(e, t)).map(T);
1207
788
  }
1208
789
  },
1209
790
  async replace(e, t) {
1210
- return A(await n.replaceMedia(e, t));
791
+ return T(await n.replaceMedia(e, t));
1211
792
  },
1212
793
  async importFromUrl(e, t) {
1213
- return A(await n.importFromUrl(e, t));
794
+ return T(await n.importFromUrl(e, t));
1214
795
  },
1215
796
  async checkUsage(e) {
1216
797
  let t = await n.checkMediaUsage(e), r = {};
@@ -1221,7 +802,7 @@ function P(e, t) {
1221
802
  return r;
1222
803
  },
1223
804
  async frequentlyUsed() {
1224
- return (await n.getFrequentlyUsed()).map(A);
805
+ return (await n.getFrequentlyUsed()).map(T);
1225
806
  },
1226
807
  async storage() {
1227
808
  return t?.()?.storage ?? null;
@@ -1230,18 +811,18 @@ function P(e, t) {
1230
811
  return t?.()?.media?.maxFileSize;
1231
812
  },
1232
813
  get mimeTypes() {
1233
- return N(t?.() ?? null);
814
+ return O(t?.() ?? null);
1234
815
  }
1235
816
  };
1236
817
  }
1237
818
  //#endregion
1238
819
  //#region ../core/src/cloud/templates-provider.ts
1239
- var F = 6e4;
1240
- function I(e) {
1241
- let t = new h(e), n = 0;
820
+ var A = 6e4;
821
+ function re(e) {
822
+ let t = new y(e), n = 0;
1242
823
  function r(e, r) {
1243
824
  let i = Date.now();
1244
- i - n < F || (n = i, t.createVersion(e, r).catch((e) => {
825
+ i - n < A || (n = i, t.createVersion(e, r).catch((e) => {
1245
826
  console.warn("[Templatical] Automatic version not recorded — the save itself succeeded:", e);
1246
827
  }));
1247
828
  }
@@ -1260,14 +841,14 @@ function I(e) {
1260
841
  }
1261
842
  //#endregion
1262
843
  //#region ../core/src/cloud/export.ts
1263
- function L(e) {
844
+ function ie(e) {
1264
845
  return {
1265
846
  customFonts: e?.customFonts ?? [],
1266
847
  defaultFallback: e?.defaultFallback ?? "Arial, sans-serif"
1267
848
  };
1268
849
  }
1269
- function R(e) {
1270
- let t = new h(e.authManager);
850
+ function j(e) {
851
+ let t = new y(e.authManager);
1271
852
  async function n(e, n) {
1272
853
  let r = await t.exportTemplate(e, n);
1273
854
  return {
@@ -1285,8 +866,8 @@ function R(e) {
1285
866
  }
1286
867
  //#endregion
1287
868
  //#region ../core/src/cloud/render-provider.ts
1288
- function z(e) {
1289
- let t = R({ authManager: e.authManager });
869
+ function M(e) {
870
+ let t = j({ authManager: e.authManager });
1290
871
  function n(e) {
1291
872
  return {
1292
873
  customFonts: e.fonts?.customFonts ?? [],
@@ -1310,7 +891,7 @@ function z(e) {
1310
891
  }
1311
892
  //#endregion
1312
893
  //#region ../core/src/cloud/version-history-provider.ts
1313
- function B(e) {
894
+ function N(e) {
1314
895
  return {
1315
896
  id: e.id,
1316
897
  createdAt: e.createdAt,
@@ -1318,17 +899,17 @@ function B(e) {
1318
899
  content: e.content
1319
900
  };
1320
901
  }
1321
- function V(e) {
1322
- let t = new h(e);
902
+ function ae(e) {
903
+ let t = new y(e);
1323
904
  return {
1324
905
  async list(e) {
1325
- return { versions: (await t.getVersions(e)).map(B) };
906
+ return { versions: (await t.getVersions(e)).map(N) };
1326
907
  },
1327
908
  async get(e, n) {
1328
909
  return (await t.getVersion(e, n)).content;
1329
910
  },
1330
911
  async create(e, n, r) {
1331
- return B(await t.createVersion(e, n, r?.label));
912
+ return N(await t.createVersion(e, n, r?.label));
1332
913
  },
1333
914
  restore(e, n) {
1334
915
  return t.restoreVersion(e, n);
@@ -1337,12 +918,12 @@ function V(e) {
1337
918
  }
1338
919
  //#endregion
1339
920
  //#region ../core/src/cloud/test-email.ts
1340
- function H(e) {
1341
- let { authManager: i, isAuthReady: a } = e, o = n(null);
1342
- a && t(a, (e) => {
1343
- e && (o.value = i.testEmailConfig);
921
+ function oe(e) {
922
+ let { authManager: n, isAuthReady: a } = e, o = t(null);
923
+ a && r(a, (e) => {
924
+ e && (o.value = n.testEmailConfig);
1344
925
  }, { immediate: !0 });
1345
- let s = r(() => o.value !== null), c = r(() => o.value?.allowedEmails ?? []);
926
+ let s = i(() => o.value !== null), c = i(() => o.value?.allowedEmails ?? []);
1346
927
  function l() {
1347
928
  return o.value?.signature ?? null;
1348
929
  }
@@ -1354,8 +935,8 @@ function H(e) {
1354
935
  }
1355
936
  //#endregion
1356
937
  //#region ../core/src/cloud/test-email-provider.ts
1357
- function U(e) {
1358
- let t = new h(e.authManager);
938
+ function se(e) {
939
+ let t = new y(e.authManager);
1359
940
  return {
1360
941
  get allowedRecipients() {
1361
942
  return e.allowedEmails.value;
@@ -1378,8 +959,8 @@ function U(e) {
1378
959
  }
1379
960
  //#endregion
1380
961
  //#region ../core/src/cloud/plan-config.ts
1381
- function W(e) {
1382
- let { authManager: t, onError: i } = e, a = n(null), o = n(!1), s = new h(t), c = r(() => a.value?.features ?? null);
962
+ function ce(e) {
963
+ let { authManager: n, onError: r } = e, a = t(null), o = t(!1), s = new y(n), c = i(() => a.value?.features ?? null);
1383
964
  function l(e) {
1384
965
  return a.value?.features[e] ?? !1;
1385
966
  }
@@ -1389,7 +970,7 @@ function W(e) {
1389
970
  try {
1390
971
  a.value = await s.fetchConfig();
1391
972
  } catch (e) {
1392
- i?.(e instanceof Error ? e : Error("Failed to fetch config", { cause: e }));
973
+ r?.(e instanceof Error ? e : Error("Failed to fetch config", { cause: e }));
1393
974
  } finally {
1394
975
  o.value = !1;
1395
976
  }
@@ -1405,14 +986,14 @@ function W(e) {
1405
986
  }
1406
987
  //#endregion
1407
988
  //#region ../core/src/cloud/health-check.ts
1408
- var G = 5e3;
1409
- function K(e) {
1410
- return e.authManager ? e.authManager.resolveUrl(m.health) : `${(e.baseUrl ?? "https://templatical.com").replace(/\/$/, "")}${m.health}`;
989
+ var P = 5e3;
990
+ function F(e) {
991
+ return e.authManager ? e.authManager.resolveUrl(v.health) : `${(e.baseUrl ?? "https://templatical.com").replace(/\/$/, "")}${v.health}`;
1411
992
  }
1412
- async function q(e, t) {
993
+ async function I(e, t) {
1413
994
  let n = performance.now();
1414
995
  try {
1415
- let r = t ? await t.authenticatedFetch(m.health, {
996
+ let r = t ? await t.authenticatedFetch(v.health, {
1416
997
  method: "GET",
1417
998
  headers: { Accept: "application/json" }
1418
999
  }) : await fetch(e, {
@@ -1461,7 +1042,7 @@ async function q(e, t) {
1461
1042
  };
1462
1043
  }
1463
1044
  }
1464
- async function J(e) {
1045
+ async function L(e) {
1465
1046
  if (!e?.host || !e?.appKey) return {
1466
1047
  ok: !1,
1467
1048
  error: "WebSocket configuration not available"
@@ -1477,7 +1058,7 @@ async function J(e) {
1477
1058
  ok: !1,
1478
1059
  error: "WebSocket connection timed out"
1479
1060
  });
1480
- }, G);
1061
+ }, P);
1481
1062
  try {
1482
1063
  n = new WebSocket(t);
1483
1064
  } catch (t) {
@@ -1497,8 +1078,8 @@ async function J(e) {
1497
1078
  };
1498
1079
  });
1499
1080
  }
1500
- async function Y(e = {}) {
1501
- let t = await q(K(e), e.authManager), n = await J(t.wsConfig);
1081
+ async function R(e = {}) {
1082
+ let t = await I(F(e), e.authManager), n = await L(t.wsConfig);
1502
1083
  return {
1503
1084
  api: t.api,
1504
1085
  websocket: n,
@@ -1507,6 +1088,321 @@ async function Y(e = {}) {
1507
1088
  };
1508
1089
  }
1509
1090
  //#endregion
1510
- export { x as _, V as a, a as b, R as c, k as d, O as f, S as g, C as h, H as i, I as l, w as m, W as n, z as o, D as p, U as r, L as s, Y as t, P as u, _ as v, o as y };
1091
+ //#region src/cloud/composables/useCloudFeatureFlags.ts
1092
+ function z(e) {
1093
+ let { planConfigInstance: t, getTemplateId: n } = e;
1094
+ return {
1095
+ canSendTestEmail: i(() => t.hasFeature("testEmail")),
1096
+ hasTemplateSaved: i(() => n() !== null),
1097
+ templateLimit: i(() => t.config.value?.limits.maxTemplates ?? null),
1098
+ templateCount: i(() => t.config.value?.templateCount ?? 0)
1099
+ };
1100
+ }
1101
+ //#endregion
1102
+ //#region src/cloud/composables/useCloudPanelState.ts
1103
+ function B() {
1104
+ let e = t(null);
1105
+ return {
1106
+ activePanel: e,
1107
+ commentsOpen: i({
1108
+ get: () => e.value === "comments",
1109
+ set: (t) => e.value = t ? "comments" : null
1110
+ }),
1111
+ rightPanelOpen: i(() => e.value !== null)
1112
+ };
1113
+ }
1114
+ //#endregion
1115
+ //#region src/cloud/composables/useCloudSaveGate.ts
1116
+ function V(e) {
1117
+ let n = t(!1), r = null, a = i(() => e.planConfig.value?.accessibility?.blockOnError === !0), o = i(() => a.value ? e.issues.value.filter((e) => e.severity === "error") : []), s = i(() => o.value.length > 0);
1118
+ async function c(e) {
1119
+ return s.value ? (r = e, n.value = !0, !1) : (await e(), !0);
1120
+ }
1121
+ async function l(e) {
1122
+ return !s.value && (await e(), !0);
1123
+ }
1124
+ async function u() {
1125
+ let e = r;
1126
+ r = null, n.value = !1, e && await e();
1127
+ }
1128
+ function d() {
1129
+ r = null, n.value = !1;
1130
+ }
1131
+ return {
1132
+ shouldBlock: s,
1133
+ blockingIssues: o,
1134
+ modalOpen: n,
1135
+ tryRunSave: c,
1136
+ runUnlessBlocked: l,
1137
+ confirmAndSave: u,
1138
+ cancel: d
1139
+ };
1140
+ }
1141
+ //#endregion
1142
+ //#region src/cloud/collectSavedBlockIds.ts
1143
+ function H(e) {
1144
+ let t = /* @__PURE__ */ new Set();
1145
+ return U(e?.content?.blocks, t), t;
1146
+ }
1147
+ function U(e, t) {
1148
+ if (e) {
1149
+ for (let n of e) if (t.add(n.id), n.children) {
1150
+ if (n.type === "section") for (let e of n.children) U(e, t);
1151
+ else n.type === "wrapper" && U(n.children, t);
1152
+ }
1153
+ }
1154
+ }
1155
+ //#endregion
1156
+ //#region src/cloud/createCloudRuntime.ts
1157
+ function W(e) {
1158
+ if (!e) return {};
1159
+ let { onSaved: t, onCreated: n, onLoaded: r } = e;
1160
+ return {
1161
+ ...typeof t == "function" ? { onSaved: t } : {},
1162
+ ...typeof n == "function" ? { onCreated: n } : {},
1163
+ ...typeof r == "function" ? { onLoaded: r } : {}
1164
+ };
1165
+ }
1166
+ function le(e) {
1167
+ if (!e) return {};
1168
+ let { onCreated: t, onUpdated: n, onDeleted: r, onResolved: i, onUnresolved: a } = e;
1169
+ return {
1170
+ ...typeof t == "function" ? { onCreated: t } : {},
1171
+ ...typeof n == "function" ? { onUpdated: n } : {},
1172
+ ...typeof r == "function" ? { onDeleted: r } : {},
1173
+ ...typeof i == "function" ? { onResolved: i } : {},
1174
+ ...typeof a == "function" ? { onUnresolved: a } : {}
1175
+ };
1176
+ }
1177
+ function ue(e) {
1178
+ if (typeof e != "object" || !e) return {};
1179
+ let { onCreated: t, onUpdated: n, onDeleted: r } = e;
1180
+ return {
1181
+ ...typeof t == "function" ? { onCreated: t } : {},
1182
+ ...typeof n == "function" ? { onUpdated: n } : {},
1183
+ ...typeof r == "function" ? { onDeleted: r } : {}
1184
+ };
1185
+ }
1186
+ function de(e) {
1187
+ if (typeof e != "object" || !e) return {};
1188
+ let { onSent: t, defaultRecipient: n } = e;
1189
+ return {
1190
+ ...typeof t == "function" ? { onSent: t } : {},
1191
+ ...typeof n == "string" ? { defaultRecipient: n } : {}
1192
+ };
1193
+ }
1194
+ function fe(e) {
1195
+ if (typeof e != "object" || !e) return {};
1196
+ let { onCreated: t, onUpdated: n, onDeleted: r } = e;
1197
+ return {
1198
+ ...typeof t == "function" ? { onCreated: t } : {},
1199
+ ...typeof n == "function" ? { onUpdated: n } : {},
1200
+ ...typeof r == "function" ? { onDeleted: r } : {}
1201
+ };
1202
+ }
1203
+ function pe(e) {
1204
+ if (!e) return {};
1205
+ let { onCreated: t, onRestored: n } = e;
1206
+ return {
1207
+ ...typeof t == "function" ? { onCreated: t } : {},
1208
+ ...typeof n == "function" ? { onRestored: n } : {}
1209
+ };
1210
+ }
1211
+ function G(e) {
1212
+ return e.length < 2 ? e.join("") : e.length === 2 ? e.join(" and ") : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`;
1213
+ }
1214
+ async function K(e) {
1215
+ let { config: i, cloudTranslations: a } = e, f = null, p = null, m = null, h = null, g = t(null), _ = t(null);
1216
+ function v() {
1217
+ if (!f) throw Error("[Templatical] The Cloud editor is not mounted yet.");
1218
+ return f;
1219
+ }
1220
+ function y() {
1221
+ return f?.state.template?.id ?? null;
1222
+ }
1223
+ let b = new d({
1224
+ ...i.auth,
1225
+ onError: (e) => {
1226
+ u(e) && (g.value = e), i.onError?.(e);
1227
+ }
1228
+ }), S = ce({
1229
+ authManager: b,
1230
+ onError: i.onError
1231
+ });
1232
+ await b.initialize();
1233
+ let C = await R({ authManager: b });
1234
+ if (!C.api.ok) throw Error("Health check failed: API is not reachable");
1235
+ if (!C.auth.ok) throw Error(`Health check failed: authentication error${C.auth.error ? ` - ${C.auth.error}` : ""}`);
1236
+ C.websocket.ok || c.warn("WebSocket health check failed:", C.websocket.error ?? "unknown error", "-- real-time features will be disabled."), await S.fetchConfig(), g.value = null;
1237
+ let w = i.templates, T = [
1238
+ "load",
1239
+ "create",
1240
+ "save"
1241
+ ].filter((e) => w?.[e] !== void 0);
1242
+ T.length > 0 && c.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.`);
1243
+ let E = i.versionHistory, D = [
1244
+ "list",
1245
+ "get",
1246
+ "create",
1247
+ "restore"
1248
+ ].filter((e) => E?.[e] !== void 0);
1249
+ D.length > 0 && c.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.`);
1250
+ let O = i.comments, A = [
1251
+ "list",
1252
+ "create",
1253
+ "update",
1254
+ "delete",
1255
+ "setResolved",
1256
+ "subscribe"
1257
+ ].filter((e) => O?.[e] !== void 0);
1258
+ A.length > 0 && c.warn(`initCloud ignores ${G(A.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 && c.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 && c.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 }).");
1259
+ function N(e) {
1260
+ let t = S.config.value?.websocket;
1261
+ m && t && m.connect(e.id, x(t));
1262
+ }
1263
+ let P = re(b), F = P.create, I = P.save, L = {
1264
+ ...W(i.templates),
1265
+ load: async (e) => {
1266
+ let t = await P.load(e);
1267
+ return N(t), t;
1268
+ },
1269
+ create: typeof F == "function" ? async (e) => {
1270
+ let t = await F(e);
1271
+ return N(t), t;
1272
+ } : !1,
1273
+ save: typeof I == "function" ? async (e, t) => {
1274
+ if (p && f) {
1275
+ let e = p.registry;
1276
+ await l(f.content.value, {
1277
+ renderCustomBlock: e.renderCustomBlock,
1278
+ getCustomBlockStylesheet: (t) => e.getDefinition(t)?.stylesheet
1279
+ });
1280
+ }
1281
+ return I(e, t);
1282
+ } : !1
1283
+ }, U = M({
1284
+ authManager: b,
1285
+ getTemplateId: y,
1286
+ save: () => v().save()
1287
+ }), K = {
1288
+ ...pe(i.versionHistory),
1289
+ ...ae(b)
1290
+ }, me = {
1291
+ ...le(i.comments),
1292
+ ...ee({
1293
+ authManager: b,
1294
+ channel: _,
1295
+ getSocketId: () => m?.getSocketId() ?? null
1296
+ })
1297
+ }, he = b.userConfig ? {
1298
+ id: b.userConfig.id,
1299
+ name: b.userConfig.name
1300
+ } : void 0, q = typeof i.savedBlocks?.list == "function" ? i.savedBlocks : null;
1301
+ if (q === null && typeof i.savedBlocks == "object" && i.savedBlocks !== null) {
1302
+ let e = i.savedBlocks, t = [
1303
+ "list",
1304
+ "create",
1305
+ "update",
1306
+ "delete"
1307
+ ].filter((t) => e[t] !== void 0);
1308
+ t.length > 0 && c.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.`);
1309
+ }
1310
+ let J = i.savedBlocks === !1 ? void 0 : q ?? {
1311
+ ...ue(i.savedBlocks),
1312
+ ...ne(b)
1313
+ }, Y = oe({
1314
+ authManager: b,
1315
+ isAuthReady: t(!0)
1316
+ }), ge = j({ authManager: b }), X = typeof i.testEmail?.send == "function" ? i.testEmail : null;
1317
+ if (X === null && typeof i.testEmail == "object" && i.testEmail !== null) {
1318
+ let e = i.testEmail, t = [
1319
+ "send",
1320
+ "includeMjml",
1321
+ "allowedRecipients"
1322
+ ].filter((t) => e[t] !== void 0);
1323
+ t.length > 0 && c.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.`);
1324
+ }
1325
+ let _e = X ?? Object.assign(se({
1326
+ authManager: b,
1327
+ getTemplateId: y,
1328
+ save: () => v().save(),
1329
+ exportHtml: (e) => ge.exportHtml(e, ie(i.fonts)),
1330
+ allowedEmails: Y.allowedEmails,
1331
+ getSignature: Y.getSignature,
1332
+ onBeforeTestEmail: i.onBeforeTestEmail
1333
+ }), de(i.testEmail)), Z = typeof i.media?.list == "function" ? i.media : null;
1334
+ if (Z === null && typeof i.media == "object" && i.media !== null) {
1335
+ let e = i.media, t = [
1336
+ "list",
1337
+ "create",
1338
+ "update",
1339
+ "delete"
1340
+ ].filter((t) => e[t] !== void 0);
1341
+ t.length > 0 && c.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.`);
1342
+ let n = ["maxFileSize", "mimeTypes"].filter((t) => e[t] !== void 0);
1343
+ n.length > 0 && c.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.`);
1344
+ }
1345
+ let Q = i.media === !1 ? void 0 : Z ?? Object.assign(k(b, () => S.config.value), fe(i.media)), $ = z({
1346
+ planConfigInstance: S,
1347
+ getTemplateId: y
1348
+ });
1349
+ function ve(e) {
1350
+ f = e.editor, n(s, a), n(o, b);
1351
+ let t = te({
1352
+ authManager: b,
1353
+ onError: i.onError
1354
+ });
1355
+ return m = t, r(t.channel, (e) => {
1356
+ _.value = e;
1357
+ }, { immediate: !0 }), {
1358
+ websocket: t,
1359
+ panelState: B(),
1360
+ featureFlags: $
1361
+ };
1362
+ }
1363
+ function ye(e) {
1364
+ let { core: n, capabilities: r } = e;
1365
+ return p = n, h = V({
1366
+ issues: n.templateLint ? n.templateLint.issues : t([]),
1367
+ planConfig: S.config
1368
+ }), r.plan = S, i.customBlocks?.length && n.registerCustomBlocks(i.customBlocks), i.theme && (n.themeOverrides.value = i.theme), {
1369
+ saveGate: h,
1370
+ sessionError: g,
1371
+ retry: async () => {
1372
+ try {
1373
+ await b.initialize(), g.value = null;
1374
+ } catch (e) {
1375
+ g.value = e instanceof Error ? e : /* @__PURE__ */ Error("Authentication failed");
1376
+ }
1377
+ }
1378
+ };
1379
+ }
1380
+ return {
1381
+ runtime: {
1382
+ isSavedBlocksAvailable: q ? () => !0 : () => i.savedBlocks !== !1 && S.hasFeature("savedModules"),
1383
+ isTestEmailAvailable: X ? () => !0 : () => Y.isEnabled.value && $.canSendTestEmail.value && $.hasTemplateSaved.value,
1384
+ isCommentsAvailable: () => i.comments !== !1 && S.hasFeature("commenting") && $.hasTemplateSaved.value,
1385
+ isBlockSaved: (e) => H(f?.state.template ?? null).has(e),
1386
+ getSaveGate: () => h,
1387
+ attach: ve,
1388
+ ready: ye,
1389
+ destroy() {
1390
+ m?.disconnect(), i.onUnmount?.();
1391
+ }
1392
+ },
1393
+ providers: {
1394
+ templates: L,
1395
+ render: U,
1396
+ versionHistory: K,
1397
+ ...J ? { savedBlocks: J } : {},
1398
+ testEmail: _e,
1399
+ comments: me,
1400
+ ...Q ? { media: Q } : {}
1401
+ },
1402
+ user: he
1403
+ };
1404
+ }
1405
+ //#endregion
1406
+ export { K as bootstrapCloud };
1511
1407
 
1512
- //# sourceMappingURL=cloud-CI_fgDyy.js.map
1408
+ //# sourceMappingURL=createCloudRuntime-DpBWhrv3.js.map