@templatical/editor 0.39.0 → 0.39.2

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 (273) hide show
  1. package/README.md +2 -4
  2. package/dist/{AiChatSidebar-jVlXXND3.js → AiChatSidebar-pOxCZWz9.js} +14 -14
  3. package/dist/{AiFeatureMenu-C1HCntyQ.js → AiFeatureMenu-Bljk6Qjv.js} +7 -7
  4. package/dist/{BlockIssueBadge-JhNgcUmZ.js → BlockIssueBadge-D5oGxOQP.js} +5 -5
  5. package/dist/{BlockPreviewCanvas-C_rA5LJN.js → BlockPreviewCanvas-DXGjUECG.js} +27 -27
  6. package/dist/{CloudHeaderExtras-DvYyNsPB.js → CloudHeaderExtras-DaocwNmy.js} +5 -5
  7. package/dist/{CloudPanels-CDPhPVdd.js → CloudPanels-CyZAnSJY.js} +7 -7
  8. package/dist/{CollaboratorBar-Co9UPoB0.js → CollaboratorBar-C7Zca3g1.js} +4 -4
  9. package/dist/{CommentsPanel-CRcVN9Ri.js → CommentsPanel-CNOb7YCm.js} +2 -2
  10. package/dist/{CommentsSidebar-gDU977br.js → CommentsSidebar-VmwjU9va.js} +14 -14
  11. package/dist/{CountdownBlock-CEzrfe5R.js → CountdownBlock-DSvbf3qU.js} +3 -3
  12. package/dist/{CountdownToolbar-B00zhkNJ.js → CountdownToolbar-C2kfS6Oy.js} +31 -30
  13. package/dist/{DesignReferenceSidebar-DedivZZl.js → DesignReferenceSidebar-QC4gEUWp.js} +11 -11
  14. package/dist/{IssuesPanel-C-PjdmAV.js → IssuesPanel-DL2Xr14_.js} +8 -8
  15. package/dist/{LoadingTrack-BlTL4zFv.js → LoadingTrack-C2jKCU2d.js} +1 -1
  16. package/dist/LogicTagInsertButton-D8IwH-9Z.js +1071 -0
  17. package/dist/MediaEditModal-D4GEq2md.js +3545 -0
  18. package/dist/{MediaPanels-BpQNY8YX.js → MediaPanels-sapgKtxu.js} +2 -2
  19. package/dist/MergeTagInput-QI-5KG2R.js +81 -0
  20. package/dist/{MergeTagModeToggle-DGuzSAdX.js → MergeTagModeToggle-D793Bj_E.js} +14 -55
  21. package/dist/{ParagraphEditor-jMKLLTa8.js → ParagraphEditor-DkkPSexG.js} +65 -66
  22. package/dist/{RestoreVersionDialog-DG1jUdBM.js → RestoreVersionDialog-BgueZnZr.js} +5 -5
  23. package/dist/{RichTextEditorContent-JrNEg0kv.js → RichTextEditorContent-BC5UTVnb.js} +11 -11
  24. package/dist/{SaveBlockDialog-C0KC-OKs.js → SaveBlockDialog-BuTuVlLr.js} +12 -11
  25. package/dist/{SavedBlocksBrowserModal-zyOiRgWZ.js → SavedBlocksBrowserModal-Srhix8BB.js} +17 -16
  26. package/dist/{SavedBlocksPanels-epMd799w.js → SavedBlocksPanels-B2iScCS-.js} +2 -2
  27. package/dist/{SavedBlocksPickBar-CJqqQ3jd.js → SavedBlocksPickBar-cI7bDQQi.js} +4 -4
  28. package/dist/{TemplateScoringPanel-m2FOeaai.js → TemplateScoringPanel-C2Rdlyn6.js} +16 -16
  29. package/dist/TemplateSettings-C_5leDdF.js +245 -0
  30. package/dist/{TestEmailModal-D58kYkMV.js → TestEmailModal-DJ5q_u4N.js} +10 -10
  31. package/dist/{TestEmailPanel-BmFVBIQt.js → TestEmailPanel-CP24UGst.js} +2 -2
  32. package/dist/{TitleEditor-C4BGPXnf.js → TitleEditor-QBBOXtxx.js} +15 -15
  33. package/dist/ToggleSwitch-JvQ_CmI1.js +102 -0
  34. package/dist/Toolbar-COD2TW20.js +2426 -0
  35. package/dist/{TplModal-BIDJw4Kj.js → TplModal-C8xGjC1l.js} +5 -5
  36. package/dist/{VersionHistoryMenu-dt_aZQfh.js → VersionHistoryMenu-BVQityes.js} +10 -10
  37. package/dist/{VersionHistoryPanels-B_5SBRrr.js → VersionHistoryPanels-BrK6na4A.js} +2 -2
  38. package/dist/{VersionPreviewBanner-DttvOkwd.js → VersionPreviewBanner-BaMSgA1O.js} +3 -3
  39. package/dist/{blockTypeIcons-CzTizYmK.js → blockTypeIcons-CdXugKyV.js} +16 -37
  40. package/dist/bundle-stats.json +8 -8
  41. package/dist/{ca-Jx2CDwtn.js → ca-BTf1Zbqb.js} +9 -0
  42. package/dist/cdn/chunks/{AiChatSidebar-DeZl9Tk0.js → AiChatSidebar-CjSEoK4x.js} +8 -8
  43. package/dist/cdn/chunks/{AiChatSidebar-DeZl9Tk0.js.map → AiChatSidebar-CjSEoK4x.js.map} +1 -1
  44. package/dist/cdn/chunks/{AiFeatureMenu-Bv8jMu9p.js → AiFeatureMenu-l0K5TOSn.js} +6 -6
  45. package/dist/cdn/chunks/{AiFeatureMenu-Bv8jMu9p.js.map → AiFeatureMenu-l0K5TOSn.js.map} +1 -1
  46. package/dist/cdn/chunks/{BlockIssueBadge-B6PpoOPv.js → BlockIssueBadge-9hHpaXb9.js} +5 -5
  47. package/dist/cdn/chunks/{BlockIssueBadge-B6PpoOPv.js.map → BlockIssueBadge-9hHpaXb9.js.map} +1 -1
  48. package/dist/cdn/chunks/{BlockPreviewCanvas-DfEtDosD.js → BlockPreviewCanvas-lQrAdgG3.js} +30 -30
  49. package/dist/cdn/chunks/{BlockPreviewCanvas-DfEtDosD.js.map → BlockPreviewCanvas-lQrAdgG3.js.map} +1 -1
  50. package/dist/cdn/chunks/{CloudHeaderExtras-Hk98ub-C.js → CloudHeaderExtras-CXNe7Q-4.js} +5 -5
  51. package/dist/cdn/chunks/{CloudHeaderExtras-Hk98ub-C.js.map → CloudHeaderExtras-CXNe7Q-4.js.map} +1 -1
  52. package/dist/cdn/chunks/{CloudPanels-Ba3GLmvF.js → CloudPanels-bHhh9AUA.js} +6 -6
  53. package/dist/cdn/chunks/{CloudPanels-Ba3GLmvF.js.map → CloudPanels-bHhh9AUA.js.map} +1 -1
  54. package/dist/cdn/chunks/{CollaboratorBar-D2dCQ9gg.js → CollaboratorBar-DgqcaGGI.js} +5 -5
  55. package/dist/cdn/chunks/{CollaboratorBar-D2dCQ9gg.js.map → CollaboratorBar-DgqcaGGI.js.map} +1 -1
  56. package/dist/cdn/chunks/{CommentsPanel-CV2HveQk.js → CommentsPanel-Cy4TlTHC.js} +3 -3
  57. package/dist/cdn/chunks/{CommentsPanel-CV2HveQk.js.map → CommentsPanel-Cy4TlTHC.js.map} +1 -1
  58. package/dist/cdn/chunks/{CommentsSidebar-Dok_vaRc.js → CommentsSidebar-C7oAP3Mx.js} +5 -5
  59. package/dist/cdn/chunks/{CommentsSidebar-Dok_vaRc.js.map → CommentsSidebar-C7oAP3Mx.js.map} +1 -1
  60. package/dist/cdn/chunks/{CountdownBlock-DGDl3ota.js → CountdownBlock-DdC8Lg5F.js} +4 -4
  61. package/dist/cdn/chunks/{CountdownBlock-DGDl3ota.js.map → CountdownBlock-DdC8Lg5F.js.map} +1 -1
  62. package/dist/cdn/chunks/{CountdownToolbar-B9Rin64t.js → CountdownToolbar-CN9h4nlC.js} +22 -21
  63. package/dist/cdn/chunks/{CountdownToolbar-B9Rin64t.js.map → CountdownToolbar-CN9h4nlC.js.map} +1 -1
  64. package/dist/cdn/chunks/{DesignReferenceSidebar-eCuTFak2.js → DesignReferenceSidebar-Bjo0M-AY.js} +7 -7
  65. package/dist/cdn/chunks/{DesignReferenceSidebar-eCuTFak2.js.map → DesignReferenceSidebar-Bjo0M-AY.js.map} +1 -1
  66. package/dist/cdn/chunks/{IssuesPanel-CP7FEzw7.js → IssuesPanel-DdFk-Blf.js} +6 -6
  67. package/dist/cdn/chunks/{IssuesPanel-CP7FEzw7.js.map → IssuesPanel-DdFk-Blf.js.map} +1 -1
  68. package/dist/cdn/chunks/{LoadingTrack-Cm3TDKb3.js → LoadingTrack-Ba5xh5HD.js} +2 -2
  69. package/dist/cdn/chunks/{LoadingTrack-Cm3TDKb3.js.map → LoadingTrack-Ba5xh5HD.js.map} +1 -1
  70. package/dist/cdn/chunks/LogicTagInsertButton-DpyPozop.js +1035 -0
  71. package/dist/cdn/chunks/LogicTagInsertButton-DpyPozop.js.map +1 -0
  72. package/dist/cdn/chunks/MediaEditModal-BBZRcYKe.js +3529 -0
  73. package/dist/cdn/chunks/MediaEditModal-BBZRcYKe.js.map +1 -0
  74. package/dist/cdn/chunks/{MediaPanels-TYrKKHX5.js → MediaPanels-CSBCsFwT.js} +3 -3
  75. package/dist/cdn/chunks/{MediaPanels-TYrKKHX5.js.map → MediaPanels-CSBCsFwT.js.map} +1 -1
  76. package/dist/cdn/chunks/MergeTagInput-ERJr7bP_.js +83 -0
  77. package/dist/cdn/chunks/MergeTagInput-ERJr7bP_.js.map +1 -0
  78. package/dist/cdn/chunks/{MergeTagModeToggle-QGTUIWWo.js → MergeTagModeToggle-n3nvSNeQ.js} +5 -5
  79. package/dist/cdn/chunks/{MergeTagModeToggle-QGTUIWWo.js.map → MergeTagModeToggle-n3nvSNeQ.js.map} +1 -1
  80. package/dist/cdn/chunks/{ParagraphEditor-D1tsPv4v.js → ParagraphEditor-DO4RzP8l.js} +40 -40
  81. package/dist/cdn/chunks/{ParagraphEditor-D1tsPv4v.js.map → ParagraphEditor-DO4RzP8l.js.map} +1 -1
  82. package/dist/cdn/chunks/{RestoreVersionDialog-BeCxNPLS.js → RestoreVersionDialog-CzZ_sFnz.js} +5 -5
  83. package/dist/cdn/chunks/{RestoreVersionDialog-BeCxNPLS.js.map → RestoreVersionDialog-CzZ_sFnz.js.map} +1 -1
  84. package/dist/cdn/chunks/{RichTextEditorContent-BBxzACFQ.js → RichTextEditorContent-Ch5zeyZ7.js} +8 -8
  85. package/dist/cdn/chunks/{RichTextEditorContent-BBxzACFQ.js.map → RichTextEditorContent-Ch5zeyZ7.js.map} +1 -1
  86. package/dist/cdn/chunks/{SaveBlockDialog-CLgh_g7H.js → SaveBlockDialog-LgxYrXyx.js} +10 -9
  87. package/dist/cdn/chunks/{SaveBlockDialog-CLgh_g7H.js.map → SaveBlockDialog-LgxYrXyx.js.map} +1 -1
  88. package/dist/cdn/chunks/{SavedBlocksBrowserModal-B4TcUJJe.js → SavedBlocksBrowserModal-CdeSsTpb.js} +9 -9
  89. package/dist/cdn/chunks/{SavedBlocksBrowserModal-B4TcUJJe.js.map → SavedBlocksBrowserModal-CdeSsTpb.js.map} +1 -1
  90. package/dist/cdn/chunks/{SavedBlocksPanels-CaBsHoRC.js → SavedBlocksPanels-B5hakNJj.js} +3 -3
  91. package/dist/cdn/chunks/{SavedBlocksPanels-CaBsHoRC.js.map → SavedBlocksPanels-B5hakNJj.js.map} +1 -1
  92. package/dist/cdn/chunks/{SavedBlocksPickBar-iG35XCDx.js → SavedBlocksPickBar-Cl6PLwwV.js} +5 -5
  93. package/dist/cdn/chunks/{SavedBlocksPickBar-iG35XCDx.js.map → SavedBlocksPickBar-Cl6PLwwV.js.map} +1 -1
  94. package/dist/cdn/chunks/{TemplateScoringPanel-DuQJBykq.js → TemplateScoringPanel--JxR6CsQ.js} +6 -6
  95. package/dist/cdn/chunks/{TemplateScoringPanel-DuQJBykq.js.map → TemplateScoringPanel--JxR6CsQ.js.map} +1 -1
  96. package/dist/cdn/chunks/TemplateSettings-DjXiiiNr.js +207 -0
  97. package/dist/cdn/chunks/TemplateSettings-DjXiiiNr.js.map +1 -0
  98. package/dist/cdn/chunks/{TestEmailModal-D6Woss3r.js → TestEmailModal-BAuDxJtD.js} +9 -9
  99. package/dist/cdn/chunks/{TestEmailModal-D6Woss3r.js.map → TestEmailModal-BAuDxJtD.js.map} +1 -1
  100. package/dist/cdn/chunks/{TestEmailPanel-CWQFB7J3.js → TestEmailPanel-GUGZisLp.js} +3 -3
  101. package/dist/cdn/chunks/{TestEmailPanel-CWQFB7J3.js.map → TestEmailPanel-GUGZisLp.js.map} +1 -1
  102. package/dist/cdn/chunks/{TitleEditor-CbY1tgSl.js → TitleEditor-uKu33Nwr.js} +12 -12
  103. package/dist/cdn/chunks/{TitleEditor-CbY1tgSl.js.map → TitleEditor-uKu33Nwr.js.map} +1 -1
  104. package/dist/cdn/chunks/ToggleSwitch-CDy8OfcB.js +104 -0
  105. package/dist/cdn/chunks/ToggleSwitch-CDy8OfcB.js.map +1 -0
  106. package/dist/cdn/chunks/Toolbar-dxDYwN5E.js +2385 -0
  107. package/dist/cdn/chunks/Toolbar-dxDYwN5E.js.map +1 -0
  108. package/dist/cdn/chunks/{TplModal-CGpp-d_r.js → TplModal-DuwS2ifK.js} +5 -5
  109. package/dist/cdn/chunks/{TplModal-CGpp-d_r.js.map → TplModal-DuwS2ifK.js.map} +1 -1
  110. package/dist/cdn/chunks/{VersionHistoryMenu-ByVJXDbK.js → VersionHistoryMenu-Dij1pTEb.js} +6 -6
  111. package/dist/cdn/chunks/{VersionHistoryMenu-ByVJXDbK.js.map → VersionHistoryMenu-Dij1pTEb.js.map} +1 -1
  112. package/dist/cdn/chunks/{VersionHistoryPanels-CQJ5OggF.js → VersionHistoryPanels-GeR6MStB.js} +3 -3
  113. package/dist/cdn/chunks/{VersionHistoryPanels-CQJ5OggF.js.map → VersionHistoryPanels-GeR6MStB.js.map} +1 -1
  114. package/dist/cdn/chunks/{VersionPreviewBanner-G4lLbfr8.js → VersionPreviewBanner-Df3FVlig.js} +4 -4
  115. package/dist/cdn/chunks/{VersionPreviewBanner-G4lLbfr8.js.map → VersionPreviewBanner-Df3FVlig.js.map} +1 -1
  116. package/dist/cdn/chunks/{blockTypeIcons-CQY-vxdM.js → blockTypeIcons-raBjStuv.js} +2 -2
  117. package/dist/cdn/chunks/{blockTypeIcons-CQY-vxdM.js.map → blockTypeIcons-raBjStuv.js.map} +1 -1
  118. package/dist/cdn/chunks/{ca-Jx2CDwtn.js → ca-BTf1Zbqb.js} +10 -1
  119. package/dist/cdn/chunks/{ca-Jx2CDwtn.js.map → ca-BTf1Zbqb.js.map} +1 -1
  120. package/dist/cdn/chunks/{cloud-BLgCKP7Z.js → cloud-eaXyxZ8l.js} +2 -2
  121. package/dist/cdn/chunks/{cloud-BLgCKP7Z.js.map → cloud-eaXyxZ8l.js.map} +1 -1
  122. package/dist/cdn/chunks/{createCloudRuntime-ClvtMBF1.js → createCloudRuntime-D5bXzcTe.js} +6 -6
  123. package/dist/cdn/chunks/{createCloudRuntime-ClvtMBF1.js.map → createCloudRuntime-D5bXzcTe.js.map} +1 -1
  124. package/dist/{de-Ck0pBGHu.js → cdn/chunks/de-xzrh9PA3.js} +11 -0
  125. package/dist/cdn/chunks/{de-Ck0pBGHu.js.map → de-xzrh9PA3.js.map} +1 -1
  126. package/dist/cdn/chunks/{dist-BW6Y49zE.js → dist-BRZhN8qJ.js} +4 -4
  127. package/dist/cdn/chunks/dist-BRZhN8qJ.js.map +1 -0
  128. package/dist/cdn/chunks/{dist-CAFTQ6Y2.js → dist-CXB2_kBa.js} +27 -22
  129. package/dist/cdn/chunks/dist-CXB2_kBa.js.map +1 -0
  130. package/dist/cdn/chunks/{draggable-kbOhCgnk.js → draggable-IB4x6w2O.js} +1477 -1470
  131. package/dist/cdn/chunks/draggable-IB4x6w2O.js.map +1 -0
  132. package/dist/cdn/chunks/editor-modal-C-yBlj2C.js +2700 -0
  133. package/dist/cdn/chunks/editor-modal-C-yBlj2C.js.map +1 -0
  134. package/dist/cdn/chunks/en-DYtFUE2l.js +2 -0
  135. package/dist/cdn/chunks/{es-lagTvUfX.js → es-BT4LSpE2.js} +10 -1
  136. package/dist/cdn/chunks/{es-lagTvUfX.js.map → es-BT4LSpE2.js.map} +1 -1
  137. package/dist/cdn/chunks/{extensions-D2YIhF7u.js → extensions-Bhu8UEE5.js} +105 -45
  138. package/dist/cdn/chunks/extensions-Bhu8UEE5.js.map +1 -0
  139. package/dist/cdn/chunks/{fr-C4hVl5Lk.js → fr-CI7OJoql.js} +10 -1
  140. package/dist/cdn/chunks/{fr-C4hVl5Lk.js.map → fr-CI7OJoql.js.map} +1 -1
  141. package/dist/cdn/chunks/{icons-DdrAicM2.js → icons-BKkJ-5xF.js} +43 -43
  142. package/dist/cdn/chunks/{icons-DdrAicM2.js.map → icons-BKkJ-5xF.js.map} +1 -1
  143. package/dist/cdn/chunks/{keys-DXYJTLZF.js → keys-dJbD1QPs.js} +2 -2
  144. package/dist/cdn/chunks/{keys-DXYJTLZF.js.map → keys-dJbD1QPs.js.map} +1 -1
  145. package/dist/{nl-CReD7Apd.js → cdn/chunks/nl-D8y5OWGB.js} +11 -0
  146. package/dist/cdn/chunks/{nl-CReD7Apd.js.map → nl-D8y5OWGB.js.map} +1 -1
  147. package/dist/cdn/chunks/{pt-BR-BRA0-vGP.js → pt-BR-DMCbUBvJ.js} +10 -1
  148. package/dist/cdn/chunks/{pt-BR-BRA0-vGP.js.map → pt-BR-DMCbUBvJ.js.map} +1 -1
  149. package/dist/cdn/chunks/socialIcons-9VrG8X3m.js +1054 -0
  150. package/dist/cdn/chunks/socialIcons-9VrG8X3m.js.map +1 -0
  151. package/dist/cdn/chunks/{src-fn7uy1FD.js → src-O5Sp_qJ7.js} +3 -3
  152. package/dist/cdn/chunks/{src-fn7uy1FD.js.map → src-O5Sp_qJ7.js.map} +1 -1
  153. package/dist/cdn/chunks/templateSettingsFields-YCFVBVYh.js +36 -0
  154. package/dist/cdn/chunks/templateSettingsFields-YCFVBVYh.js.map +1 -0
  155. package/dist/cdn/chunks/{tiptap-Epe8m3Vo.js → tiptap-DhLuKyDc.js} +2776 -2773
  156. package/dist/cdn/chunks/tiptap-DhLuKyDc.js.map +1 -0
  157. package/dist/cdn/chunks/{useAliveFlag-CT9gjvO_.js → useAliveFlag-DAlQLbM2.js} +2 -2
  158. package/dist/cdn/chunks/{useAliveFlag-CT9gjvO_.js.map → useAliveFlag-DAlQLbM2.js.map} +1 -1
  159. package/dist/cdn/chunks/{useCloudI18n-OezCj0cx.js → useCloudI18n-C09JcFS0.js} +3 -3
  160. package/dist/cdn/chunks/{useCloudI18n-OezCj0cx.js.map → useCloudI18n-C09JcFS0.js.map} +1 -1
  161. package/dist/cdn/chunks/useEditorCore-BHmIp1hW.js +2592 -0
  162. package/dist/cdn/chunks/useEditorCore-BHmIp1hW.js.map +1 -0
  163. package/dist/cdn/chunks/useEditorRoot-DFx2fXJP.js +10 -0
  164. package/dist/cdn/chunks/{useEditorRoot-ByHPMqYT.js.map → useEditorRoot-DFx2fXJP.js.map} +1 -1
  165. package/dist/cdn/chunks/{useI18n-BhE7ndNr.js → useI18n-DTZ9sIcv.js} +3 -3
  166. package/dist/cdn/chunks/{useI18n-BhE7ndNr.js.map → useI18n-DTZ9sIcv.js.map} +1 -1
  167. package/dist/cdn/chunks/useLogicTag-E2V0Xdcb.js +38 -0
  168. package/dist/cdn/chunks/useLogicTag-E2V0Xdcb.js.map +1 -0
  169. package/dist/cdn/chunks/{useMergeTag-DE2mpy1w.js → useMergeTag-BE8oDoha.js} +3 -3
  170. package/dist/cdn/chunks/{useMergeTag-DE2mpy1w.js.map → useMergeTag-BE8oDoha.js.map} +1 -1
  171. package/dist/cdn/chunks/{usePopoverPosition-BPL891uG.js → usePopoverPosition-gB9q-ql7.js} +3 -3
  172. package/dist/cdn/chunks/{usePopoverPosition-BPL891uG.js.map → usePopoverPosition-gB9q-ql7.js.map} +1 -1
  173. package/dist/cdn/chunks/{useScrollToBlock-DwF4pVur.js → useScrollToBlock-CtTXwmiU.js} +3 -3
  174. package/dist/cdn/chunks/{useScrollToBlock-DwF4pVur.js.map → useScrollToBlock-CtTXwmiU.js.map} +1 -1
  175. package/dist/cdn/editor.css +1 -1
  176. package/dist/cdn/editor.js +809 -3337
  177. package/dist/cdn/editor.js.map +1 -1
  178. package/dist/{check-9xX6RVHz.js → check-eqb2JhqU.js} +1 -1
  179. package/dist/{chevron-down-J5hFJ6TL.js → chevron-down-Dkr-7Ywl.js} +1 -1
  180. package/dist/{chevron-right-BJuo5PQ-.js → chevron-right-Bge4XF_B.js} +1 -1
  181. package/dist/{chevron-up-Qfi5k52_.js → chevron-up-CQAyl0kC.js} +1 -1
  182. package/dist/{circle-alert-BiArYmkB.js → circle-alert-CYgTHKWr.js} +1 -1
  183. package/dist/{clock-BkYJZ7Y0.js → clock-BgSJZJP5.js} +1 -1
  184. package/dist/{cloud-DdidMW6f.js → cloud-C9xWZXhg.js} +1 -1
  185. package/dist/{copy-BRLUNHwF.js → copy-mw6PVnOJ.js} +1 -1
  186. package/dist/{createCloudRuntime-CNFXaTNQ.js → createCloudRuntime-BGd5--Bq.js} +5 -5
  187. package/dist/{createLucideIcon-CDDkF1Tm.js → createLucideIcon-BxY5yz5u.js} +6 -6
  188. package/dist/{cdn/chunks/de-Ck0pBGHu.js → de-xzrh9PA3.js} +9 -2
  189. package/dist/{dist-D8i1ixHK.js → dist-8VFzbeu9.js} +3 -3
  190. package/dist/{dist-DBirAJIs.js → dist-BDuPwOyn.js} +26 -21
  191. package/dist/{dist-CtF9STPS.js → dist-BJM3eFyT.js} +1 -1
  192. package/dist/{dist-DkcA6epL.js → dist-BdHF7nyq.js} +3 -3
  193. package/dist/{dist-ByT5fgKq.js → dist-Bl4rxpX9.js} +1 -1
  194. package/dist/{dist-BVqAYoRB.js → dist-BmsLcnrO.js} +4 -4
  195. package/dist/{dist-CtMXAH7a.js → dist-BxVnMgXZ.js} +1 -1
  196. package/dist/{dist-DC-3T0ED.js → dist-CQSVro7b.js} +1 -1
  197. package/dist/{dist-f7HXo6j6.js → dist-DQbOebGW.js} +1 -1
  198. package/dist/{dist-DL9334yz.js → dist-DerFNpDY.js} +3 -3
  199. package/dist/{dist-D08oVYhr.js → dist-Djmzp6wi.js} +1 -1
  200. package/dist/{dist-D7WY8VPq.js → dist-DyrEOKEJ.js} +1 -1
  201. package/dist/{dist-DzdeVn-W.js → dist-EDkj3Ub1.js} +1 -1
  202. package/dist/{dist-C1tsW_99.js → dist-wyXxj3R1.js} +1 -1
  203. package/dist/editor-modal-oD1qNz_P.js +2773 -0
  204. package/dist/en-CM5fTFSo.js +2 -0
  205. package/dist/{es-lagTvUfX.js → es-BT4LSpE2.js} +9 -0
  206. package/dist/extensions-DRN-elXT.js +1645 -0
  207. package/dist/{eye-DwhBOaV8.js → eye-DphkRtAD.js} +1 -1
  208. package/dist/{fr-C4hVl5Lk.js → fr-CI7OJoql.js} +9 -0
  209. package/dist/{image-up-CiyQNZBt.js → image-up-Qi2BXD7T.js} +1 -1
  210. package/dist/{info-D6A1qEiF.js → info-VSyAs02q.js} +1 -1
  211. package/dist/{keys-DD1rl72F.js → keys-BdoSgsz9.js} +1 -1
  212. package/dist/{link-tKGmYWsB.js → link-CNuozGqD.js} +1 -1
  213. package/dist/{list-DjZQRpeI.js → list-BA0I5Wmu.js} +1 -1
  214. package/dist/{loader-circle-D9ZL3Sv0.js → loader-circle-z5eeqasv.js} +1 -1
  215. package/dist/{message-circle-KTHxCcpB.js → message-circle-BsQ9hEup.js} +1 -1
  216. package/dist/{cdn/chunks/nl-CReD7Apd.js → nl-D8y5OWGB.js} +9 -2
  217. package/dist/package-OkXfuRoO.js +25 -0
  218. package/dist/{pencil-Bq-nbQ7F.js → pencil-DFVFA7Dj.js} +1 -1
  219. package/dist/{plus-CRMnR4IG.js → plus-D8bkVjZ7.js} +1 -1
  220. package/dist/{pt-BR-BRA0-vGP.js → pt-BR-DMCbUBvJ.js} +9 -0
  221. package/dist/{refresh-cw-D7bYS5tm.js → refresh-cw-DPB7YFuz.js} +1 -1
  222. package/dist/{runtime-dom.esm-bundler-PnoZU512.js → runtime-dom.esm-bundler-BGbPz4-g.js} +2 -2
  223. package/dist/{search-DUo0YwPz.js → search-C-dCgqIa.js} +1 -1
  224. package/dist/{send-DaVMQphu.js → send-Cm2fy2zm.js} +1 -1
  225. package/dist/{shield-check-DxaaurL9.js → shield-check-COgBYFDF.js} +1 -1
  226. package/dist/smartphone-v0u_MOEV.js +46 -0
  227. package/dist/socialIcons-DkGcpEwC.js +1130 -0
  228. package/dist/{sparkles-D6T6k30e.js → sparkles-Ds0RF8Iu.js} +1 -1
  229. package/dist/style.css +1 -1
  230. package/dist/templateSettingsFields-YCFVBVYh.js +34 -0
  231. package/dist/templatical-editor.js +895 -3498
  232. package/dist/{text-align-start-vreFpmCX.js → text-align-start-DiavaIm6.js} +1 -1
  233. package/dist/{trash-DBv8MGY6.js → trash-DnOkfu2V.js} +1 -1
  234. package/dist/{triangle-alert-CmNS2LLv.js → triangle-alert-DGLAyXnh.js} +1 -1
  235. package/dist/{upload-DDB9Fs0P.js → upload-BBDme2cy.js} +1 -1
  236. package/dist/{useAliveFlag-oyByIcjy.js → useAliveFlag-BkKyhkwZ.js} +1 -1
  237. package/dist/{useCloudI18n-C1wuXik6.js → useCloudI18n-D1iedlP3.js} +2 -2
  238. package/dist/{useEditorCore-jfwgLThK.js → useEditorCore-C5APBjjV.js} +1140 -2325
  239. package/dist/{useEditorRoot-eVv4doqZ.js → useEditorRoot-BOxn5EfP.js} +2 -2
  240. package/dist/{useI18n-VOtdfENx.js → useI18n-Ds_-druD.js} +2 -2
  241. package/dist/useLogicTag-DoHfc08B.js +36 -0
  242. package/dist/{useMergeTag-CQM9pFca.js → useMergeTag-DXyum3kG.js} +2 -2
  243. package/dist/{usePopoverPosition-gZjRywai.js → usePopoverPosition-Du-Ah8E9.js} +2 -2
  244. package/dist/{useScrollToBlock-C0Ehnyl4.js → useScrollToBlock-DXQYPCnJ.js} +3 -3
  245. package/dist/{vue.runtime.esm-bundler-DShF3P6k.js → vue.runtime.esm-bundler-CyqhBwpY.js} +1133 -1126
  246. package/dist/{x-B7sgO_z8.js → x-3BHV3Q6K.js} +1 -1
  247. package/package.json +14 -14
  248. package/dist/ColorPicker-BTtN94te.js +0 -501
  249. package/dist/FieldRow-C8nOknr_.js +0 -128
  250. package/dist/MergeTagInput-Cw1RoMly.js +0 -509
  251. package/dist/MergeTagSuggestion-BXO3UIXW.js +0 -1329
  252. package/dist/cdn/chunks/ColorPicker-BaonTCAQ.js +0 -502
  253. package/dist/cdn/chunks/ColorPicker-BaonTCAQ.js.map +0 -1
  254. package/dist/cdn/chunks/FieldRow-D9OJhYeb.js +0 -130
  255. package/dist/cdn/chunks/FieldRow-D9OJhYeb.js.map +0 -1
  256. package/dist/cdn/chunks/MergeTagInput-CSIThqkz.js +0 -470
  257. package/dist/cdn/chunks/MergeTagInput-CSIThqkz.js.map +0 -1
  258. package/dist/cdn/chunks/MergeTagSuggestion-CY6WK8Eb.js +0 -215
  259. package/dist/cdn/chunks/MergeTagSuggestion-CY6WK8Eb.js.map +0 -1
  260. package/dist/cdn/chunks/dist-BW6Y49zE.js.map +0 -1
  261. package/dist/cdn/chunks/dist-CAFTQ6Y2.js.map +0 -1
  262. package/dist/cdn/chunks/draggable-kbOhCgnk.js.map +0 -1
  263. package/dist/cdn/chunks/editor-modal-B6IdQWlf.js +0 -5908
  264. package/dist/cdn/chunks/editor-modal-B6IdQWlf.js.map +0 -1
  265. package/dist/cdn/chunks/en-DjunooBz.js +0 -2
  266. package/dist/cdn/chunks/extensions-D2YIhF7u.js.map +0 -1
  267. package/dist/cdn/chunks/tiptap-Epe8m3Vo.js.map +0 -1
  268. package/dist/cdn/chunks/useEditorCore-06PtcUi1.js +0 -3698
  269. package/dist/cdn/chunks/useEditorCore-06PtcUi1.js.map +0 -1
  270. package/dist/cdn/chunks/useEditorRoot-ByHPMqYT.js +0 -10
  271. package/dist/editor-modal-uAEB6xKz.js +0 -5998
  272. package/dist/en-CQWkDCpm.js +0 -2
  273. package/dist/extensions-CcGj7OfS.js +0 -470
@@ -1,3698 +0,0 @@
1
- import { A as e, B as t, E as n, F as r, H as i, I as a, K as o, N as s, P as c, Q as l, R as u, S as d, U as f, W as p, X as m, Y as h, Z as g, at as _, b as v, c as y, ct as b, et as x, f as S, g as C, h as w, it as T, j as E, k as D, l as O, lt as k, m as A, ot as j, p as M, q as N, rt as P, s as F, t as I, u as L, ut as R, w as z, x as B, y as V } from "./draggable-kbOhCgnk.js";
2
- import { A as H, B as ee, C as te, D as ne, E as re, F as ie, H as ae, I as oe, L as U, M as se, N as ce, O as le, P as ue, R as de, S as fe, T as pe, V as me, W as he, _ as ge, a as _e, b as ve, d as ye, f as be, g as xe, h as Se, i as Ce, it as we, j as Te, k as Ee, l as De, m as Oe, n as ke, nt as Ae, o as je, p as Me, r as Ne, rt as Pe, s as Fe, t as W, u as Ie, w as Le, z as Re } from "./src-Dwgq7hf4.js";
3
- import { _ as ze, h as Be, v as Ve, y as He } from "./dist-BW6Y49zE.js";
4
- import { a as G, c as Ue, i as We, r as Ge } from "./dist-CAFTQ6Y2.js";
5
- import { A as Ke, B as qe, C as Je, D as K, E as Ye, F as Xe, G as Ze, I as Qe, J as $e, K as et, L as tt, M as nt, N as rt, O as it, P as at, R as ot, S as st, T as ct, V as lt, W as ut, X as q, Y as dt, Z as ft, _ as pt, a as mt, b as ht, c as gt, d as _t, f as vt, g as J, h as yt, j as bt, k as xt, l as St, m as Ct, n as wt, o as Tt, p as Et, q as Dt, r as Ot, s as kt, v as At, w as jt, x as Mt, y as Nt, z as Pt } from "./keys-DXYJTLZF.js";
6
- import "./timeouts-DHPZQ0G3.js";
7
- import { t as Y } from "./useI18n-BhE7ndNr.js";
8
- import { t as X } from "./logger-ByvdoAwq.js";
9
- import { a as Ft, i as It, o as Lt, r as Z, t as Rt } from "./usePopoverPosition-BPL891uG.js";
10
- import { A as zt, Bt, Et as Vt, H as Ht, Ot as Ut, Tt as Wt, X as Gt, d as Kt, ft as qt, ht as Jt, it as Yt, o as Xt, s as Zt, tt as Qt, u as $t, v as en, vt as tn, zt as nn } from "./icons-DdrAicM2.js";
11
- import { t as rn } from "./LoadingTrack-Cm3TDKb3.js";
12
- import { t as an } from "./_plugin-vue_export-helper-B3ysoDQm.js";
13
- import { t as on } from "./useEditorRoot-ByHPMqYT.js";
14
- import "./useCloudI18n-OezCj0cx.js";
15
- import { t as sn } from "./useMergeTag-DE2mpy1w.js";
16
- import { t as cn } from "./useAliveFlag-CT9gjvO_.js";
17
- //#region ../core/src/error-reporting.ts
18
- function ln(e) {
19
- return e instanceof Error ? e : Error(String(e), { cause: e });
20
- }
21
- function un(e, t) {
22
- try {
23
- t();
24
- } catch (t) {
25
- e?.(ln(t));
26
- }
27
- }
28
- //#endregion
29
- //#region ../core/src/editor.ts
30
- function dn(e) {
31
- return e === "1" ? 1 : e === "3" ? 3 : 2;
32
- }
33
- function fn(e) {
34
- let t = m({
35
- template: null,
36
- content: e.content ?? Re(e.defaultFontFamily, e.templateDefaults),
37
- selectedBlockId: null,
38
- viewport: "desktop",
39
- darkMode: !1,
40
- previewMode: !1,
41
- isDirty: !1,
42
- isSaving: !1,
43
- isLoading: !1,
44
- uiTheme: "auto"
45
- }), n = 0;
46
- function r() {
47
- t.isDirty = !0, n++;
48
- }
49
- let i = p({
50
- get: () => t.content,
51
- set: (e) => {
52
- t.content = e, r();
53
- }
54
- }), a = p(() => t.selectedBlockId ? o(t.content.blocks, t.selectedBlockId) : null);
55
- function o(e, t) {
56
- for (let n of e) {
57
- if (n.id === t) return n;
58
- if (n.type === "section") for (let e of n.children) {
59
- let n = o(e, t);
60
- if (n) return n;
61
- }
62
- }
63
- return null;
64
- }
65
- function s(e, t) {
66
- if (t.add(e.id), e.type === "section") for (let n of e.children) for (let e of n) s(e, t);
67
- }
68
- function c(e, t, n = { blocks: e }) {
69
- for (let r = 0; r < e.length; r++) {
70
- let i = e[r];
71
- if (i.id === t) return n;
72
- if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
73
- let n = c(i.children[e], t, {
74
- blocks: i.children[e],
75
- sectionId: i.id,
76
- columnIndex: e
77
- });
78
- if (n) return n;
79
- }
80
- }
81
- return null;
82
- }
83
- function l(t) {
84
- return e.lockedBlocks?.value.has(t) ?? !1;
85
- }
86
- function u(e) {
87
- let n = c(t.content.blocks, e);
88
- if (!n) return null;
89
- let r = n.blocks.findIndex((t) => t.id === e);
90
- return r === -1 ? null : {
91
- targetSectionId: n.sectionId,
92
- columnIndex: n.columnIndex,
93
- index: r
94
- };
95
- }
96
- function d(e, n = !0) {
97
- t.content = e, n && r();
98
- }
99
- function f(e) {
100
- e && l(e) || (t.selectedBlockId = e);
101
- }
102
- function h(e) {
103
- t.viewport = e;
104
- }
105
- function _(e) {
106
- t.darkMode = e;
107
- }
108
- function v(e) {
109
- t.uiTheme = e;
110
- }
111
- function y(e) {
112
- t.previewMode = e, e && (t.selectedBlockId = null);
113
- }
114
- function b(e, n) {
115
- if (l(e)) return;
116
- let i = o(t.content.blocks, e);
117
- i && (Object.assign(i, n), r());
118
- }
119
- function x(e) {
120
- t.content.settings = {
121
- ...t.content.settings,
122
- ...e
123
- }, r();
124
- }
125
- function S(e, n, i = 0, a) {
126
- if (!(n && e.type === "section")) {
127
- if (n) {
128
- if (l(n)) return;
129
- let r = o(t.content.blocks, n);
130
- if (r && r.type === "section") {
131
- if (i < 0 || i >= dn(r.columns)) return;
132
- r.children[i] = r.children[i] || [];
133
- let t = r.children[i];
134
- a !== void 0 && a < t.length ? t.splice(a, 0, e) : t.push(e);
135
- }
136
- } else a !== void 0 && a < t.content.blocks.length ? t.content.blocks.splice(a, 0, e) : t.content.blocks.push(e);
137
- r();
138
- }
139
- }
140
- function C(e) {
141
- if (l(e)) return;
142
- let n = c(t.content.blocks, e);
143
- if (n) {
144
- let i = n.blocks.findIndex((t) => t.id === e);
145
- if (i !== -1) {
146
- let [e] = n.blocks.splice(i, 1);
147
- if (t.selectedBlockId) {
148
- let n = /* @__PURE__ */ new Set();
149
- s(e, n), n.has(t.selectedBlockId) && (t.selectedBlockId = null);
150
- }
151
- r();
152
- }
153
- }
154
- }
155
- function w(e, n, i, a = 0) {
156
- if (l(e) || i && l(i)) return;
157
- let s = c(t.content.blocks, e);
158
- if (!s) return;
159
- let u = s.blocks.findIndex((t) => t.id === e);
160
- if (u === -1 || i && s.blocks[u].type === "section") return;
161
- let d;
162
- if (i) {
163
- let e = o(t.content.blocks, i);
164
- if (!e || e.type !== "section" || a < 0 || a >= dn(e.columns)) return;
165
- e.children[a] = e.children[a] || [], d = e.children[a];
166
- } else d = t.content.blocks;
167
- let [f] = s.blocks.splice(u, 1);
168
- d.splice(n, 0, f), r();
169
- }
170
- function T() {
171
- r();
172
- }
173
- function E(e, t) {
174
- throw new W(`[Templatical] Templates: ${e} ${t}`);
175
- }
176
- function D(t) {
177
- un(e.onError, t);
178
- }
179
- function O(t) {
180
- let { templates: n } = e;
181
- return n || E(t, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
182
- }
183
- function k(e) {
184
- t.template && (t.template = {
185
- ...t.template,
186
- name: e
187
- }, r());
188
- }
189
- async function A(r) {
190
- let i = O("create()"), { create: a } = i;
191
- typeof a != "function" && E("create()", "is disabled by the provider — its `create` is `false`.");
192
- let o;
193
- t.isLoading = !0;
194
- try {
195
- r?.content && (t.content = r.content);
196
- let e = n;
197
- o = await a(r?.name === void 0 ? { content: t.content } : {
198
- name: r.name,
199
- content: t.content
200
- }), t.template = o, n === e && (t.isDirty = !1);
201
- } catch (t) {
202
- throw e.onError?.(t), t;
203
- } finally {
204
- t.isLoading = !1;
205
- }
206
- return D(() => i.onCreated?.(o)), o;
207
- }
208
- async function j(n) {
209
- let r = O("load()"), i;
210
- t.isLoading = !0;
211
- try {
212
- i = await r.load(n), t.template = i, t.content = i.content, t.isDirty = !1;
213
- } catch (t) {
214
- throw e.onError?.(t), t;
215
- } finally {
216
- t.isLoading = !1;
217
- }
218
- return D(() => r.onLoaded?.(i)), i;
219
- }
220
- async function M(r = "api") {
221
- let i = O("save()"), { save: a } = i;
222
- typeof a != "function" && E("save()", "is disabled by the provider — its `save` is `false`.");
223
- let o = t.template;
224
- o || E("save()", "has no template loaded. Call create() or load() first.");
225
- let s = o.name === void 0 ? { content: t.content } : {
226
- name: o.name,
227
- content: t.content
228
- }, c;
229
- t.isSaving = !0;
230
- try {
231
- let e = n;
232
- if (c = await a(o.id, s), t.template?.id === o.id) {
233
- let e = t.template.name;
234
- t.template = e === o.name ? c : {
235
- ...c,
236
- name: e
237
- };
238
- }
239
- n === e && (t.isDirty = !1);
240
- } catch (t) {
241
- throw e.onError?.(t), t;
242
- } finally {
243
- t.isSaving = !1;
244
- }
245
- return D(() => i.onSaved?.(c, { trigger: r })), c;
246
- }
247
- function N() {
248
- return t.template?.id !== void 0;
249
- }
250
- return {
251
- state: g(t),
252
- content: i,
253
- selectedBlock: a,
254
- isBlockLocked: l,
255
- setContent: d,
256
- selectBlock: f,
257
- setViewport: h,
258
- setDarkMode: _,
259
- setUiTheme: v,
260
- setPreviewMode: y,
261
- updateBlock: b,
262
- updateSettings: x,
263
- addBlock: S,
264
- removeBlock: C,
265
- moveBlock: w,
266
- markDirty: T,
267
- findBlockLocation: u,
268
- setName: k,
269
- create: A,
270
- load: j,
271
- save: M,
272
- hasTemplate: N
273
- };
274
- }
275
- //#endregion
276
- //#region ../core/src/history.ts
277
- var pn = 50, mn = 300, hn = 1500;
278
- function gn(e) {
279
- let { content: t, setContent: n, isRemoteOperation: r, maxSize: i = pn } = e, a = l([]), o = l([]), s = l(!1), c = null, u = null, d = p(() => a.value.length > 0), f = p(() => o.value.length > 0);
280
- function m() {
281
- return ve(t.value);
282
- }
283
- function h(e) {
284
- a.value.push(e), a.value.length > i && a.value.splice(0, a.value.length - i);
285
- }
286
- function g() {
287
- u &&= (clearTimeout(u.timeoutId), null);
288
- }
289
- function _() {
290
- r?.() || (g(), h(m()), o.value = []);
291
- }
292
- function v(e) {
293
- if (!r?.()) {
294
- if (u && u.blockId === e) {
295
- clearTimeout(u.timeoutId), u.timeoutId = setTimeout(() => {
296
- u = null;
297
- }, mn);
298
- return;
299
- }
300
- g(), h(m()), o.value = [], u = {
301
- blockId: e,
302
- timeoutId: setTimeout(() => {
303
- u = null;
304
- }, mn)
305
- };
306
- }
307
- }
308
- function y() {
309
- s.value = !0, c && clearTimeout(c), c = setTimeout(() => {
310
- s.value = !1, c = null;
311
- }, hn);
312
- }
313
- function b() {
314
- if (a.value.length === 0) return;
315
- g();
316
- let e = a.value.pop();
317
- o.value.push(m()), n(e, !0), y();
318
- }
319
- function x() {
320
- if (o.value.length === 0) return;
321
- g();
322
- let e = o.value.pop();
323
- a.value.push(m()), n(e, !0), y();
324
- }
325
- function S() {
326
- a.value = [], o.value = [], g();
327
- }
328
- function C() {
329
- S(), c &&= (clearTimeout(c), null);
330
- }
331
- return {
332
- canUndo: d,
333
- canRedo: f,
334
- isNavigating: s,
335
- undo: b,
336
- redo: x,
337
- record: _,
338
- recordDebounced: v,
339
- clear: S,
340
- destroy: C
341
- };
342
- }
343
- //#endregion
344
- //#region ../core/src/block-actions.ts
345
- function _n(e) {
346
- e.type === "table" ? e.rows = e.rows.map((e) => ({
347
- ...e,
348
- id: U(),
349
- cells: e.cells.map((e) => ({
350
- ...e,
351
- id: U()
352
- }))
353
- })) : e.type === "social" ? e.icons = e.icons.map((e) => ({
354
- ...e,
355
- id: U()
356
- })) : e.type === "menu" && (e.items = e.items.map((e) => ({
357
- ...e,
358
- id: U()
359
- })));
360
- }
361
- function vn(e) {
362
- let { addBlock: t, removeBlock: n, updateBlock: r, selectBlock: i, findBlockLocation: a } = e;
363
- function o(n, r, a) {
364
- let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s = fe(n, o);
365
- return t(s, r, a), i(s.id), s;
366
- }
367
- function s(e, n, r) {
368
- let o = JSON.parse(JSON.stringify(e));
369
- if (o.id = U(), _n(o), o.type === "section" && (o.children = o.children.map((e) => e.map((e) => {
370
- let t = JSON.parse(JSON.stringify(e));
371
- return t.id = U(), _n(t), t;
372
- }))), n !== void 0 || r !== void 0) t(o, n, r);
373
- else {
374
- let i = a?.(e.id) ?? null;
375
- i ? t(o, i.targetSectionId, i.columnIndex, i.index + 1) : t(o, n, r);
376
- }
377
- return i(o.id), o;
378
- }
379
- function c(e) {
380
- n(e);
381
- }
382
- function l(e, t, n) {
383
- r(e, { [t]: n });
384
- }
385
- return {
386
- createAndAddBlock: o,
387
- duplicateBlock: s,
388
- deleteBlock: c,
389
- updateBlockProperty: l
390
- };
391
- }
392
- //#endregion
393
- //#region ../core/src/auto-save.ts
394
- var yn = 2e3;
395
- function bn(e) {
396
- let { content: t, isDirty: n, onChange: r, debounce: i = yn, enabled: a = !0 } = e, o = null, s = !1;
397
- function c() {
398
- return typeof a == "function" ? a() : a;
399
- }
400
- function l() {
401
- s = !0, d();
402
- }
403
- function u() {
404
- s = !1;
405
- }
406
- function d() {
407
- o &&= (clearTimeout(o), null);
408
- }
409
- function f() {
410
- d(), n() && r(JSON.parse(JSON.stringify(t.value)));
411
- }
412
- function p() {
413
- c() && !s && (d(), o = setTimeout(() => {
414
- o = null, c() && !s && n() && r(JSON.parse(JSON.stringify(t.value)));
415
- }, i));
416
- }
417
- let m = j(t, () => {
418
- p();
419
- }, { deep: !0 });
420
- function h() {
421
- m(), d();
422
- }
423
- return {
424
- flush: f,
425
- cancel: d,
426
- pause: l,
427
- resume: u,
428
- destroy: h
429
- };
430
- }
431
- //#endregion
432
- //#region ../core/src/condition-preview.ts
433
- function xn(e) {
434
- let t = m(/* @__PURE__ */ new Set()), n = p(() => t.size > 0);
435
- function r(e) {
436
- return t.has(e);
437
- }
438
- function i(n) {
439
- t.has(n) ? t.delete(n) : (t.add(n), e.state.selectedBlockId === n && e.selectBlock(null));
440
- }
441
- function a() {
442
- t.clear();
443
- }
444
- return {
445
- isHidden: r,
446
- toggleBlock: i,
447
- reset: a,
448
- hasHiddenBlocks: n
449
- };
450
- }
451
- //#endregion
452
- //#region ../core/src/data-source-fetch.ts
453
- function Sn(e) {
454
- let t = l(!1), n = l(!1), r = p(() => !!e.definition.value?.dataSource), i = p(() => r.value && !e.block.value.dataSourceFetched);
455
- async function a() {
456
- let r = e.definition.value;
457
- if (r?.dataSource) {
458
- t.value = !0, n.value = !1;
459
- try {
460
- let t = await r.dataSource.onFetch({
461
- fieldValues: { ...e.block.value.fieldValues },
462
- blockId: e.block.value.id
463
- });
464
- if (t == null) return;
465
- let n = { ...e.block.value.fieldValues };
466
- for (let e of Object.keys(n)) e in t && (n[e] = t[e]);
467
- e.onUpdate(n, !0);
468
- } catch (e) {
469
- console.warn("[Templatical] Data source fetch error:", e), n.value = !0;
470
- } finally {
471
- t.value = !1;
472
- }
473
- }
474
- }
475
- return {
476
- isFetching: t,
477
- fetchError: n,
478
- fetch: a,
479
- hasDataSource: r,
480
- needsFetch: i
481
- };
482
- }
483
- //#endregion
484
- //#region ../core/src/history-interceptor.ts
485
- function Cn(e, t) {
486
- let n = e.addBlock, r = e.removeBlock, i = e.moveBlock, a = e.updateBlock, o = e.updateSettings;
487
- e.addBlock = (r, i, a, o) => {
488
- i && e.isBlockLocked(i) || (t.record(), n(r, i, a, o));
489
- }, e.removeBlock = (n) => {
490
- e.isBlockLocked(n) || (t.record(), r(n));
491
- }, e.moveBlock = (n, r, a, o) => {
492
- e.isBlockLocked(n) || a && e.isBlockLocked(a) || (t.record(), i(n, r, a, o));
493
- }, e.updateBlock = (n, r) => {
494
- e.isBlockLocked(n) || (t.recordDebounced(n), a(n, r));
495
- }, e.updateSettings = (e) => {
496
- t.record(), o(e);
497
- };
498
- }
499
- //#endregion
500
- //#region ../core/src/saved-blocks.ts
501
- function wn(e) {
502
- let { provider: t } = e, n = l([]), r = l(!1), i = S(() => {
503
- let e = /* @__PURE__ */ new Set();
504
- for (let t of n.value) {
505
- let n = t.category?.trim();
506
- n && e.add(n);
507
- }
508
- return [...e].sort((e, t) => e.localeCompare(t));
509
- }), a = S(() => typeof t.create == "function"), o = S(() => typeof t.update == "function"), s = S(() => typeof t.delete == "function");
510
- function c(e) {
511
- return o.value && e.canUpdate !== !1;
512
- }
513
- function u(e) {
514
- return s.value && e.canDelete !== !1;
515
- }
516
- function d(e, t) {
517
- throw new W(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
518
- }
519
- function f(t) {
520
- un(e.onError, t);
521
- }
522
- async function p(i) {
523
- r.value = !0;
524
- try {
525
- n.value = await t.list(i);
526
- } catch (t) {
527
- throw e.onError?.(t), t;
528
- } finally {
529
- r.value = !1;
530
- }
531
- }
532
- async function m(r, i, a) {
533
- let { create: o } = t;
534
- typeof o != "function" && d("create", "disabled by the provider");
535
- try {
536
- let e = await o(a ? {
537
- name: r,
538
- content: i,
539
- category: a
540
- } : {
541
- name: r,
542
- content: i
543
- });
544
- return n.value = [e, ...n.value], f(() => t.onCreated?.(e)), e;
545
- } catch (t) {
546
- throw e.onError?.(t), t;
547
- }
548
- }
549
- async function h(r, i) {
550
- let { update: a } = t;
551
- typeof a != "function" && d("update", "disabled by the provider");
552
- let o = n.value.find((e) => e.id === r);
553
- o && o.canUpdate === !1 && d("update", `not permitted for entry "${r}"`);
554
- try {
555
- let e = await a(r, i);
556
- return n.value = n.value.map((t) => t.id === r ? e : t), f(() => t.onUpdated?.(e)), e;
557
- } catch (t) {
558
- throw e.onError?.(t), t;
559
- }
560
- }
561
- async function g(r) {
562
- let { delete: i } = t;
563
- typeof i != "function" && d("delete", "disabled by the provider");
564
- let a = n.value.find((e) => e.id === r) ?? null;
565
- a && a.canDelete === !1 && d("delete", `not permitted for entry "${r}"`);
566
- try {
567
- await i(r), n.value = n.value.filter((e) => e.id !== r), a && f(() => t.onDeleted?.(a));
568
- } catch (t) {
569
- throw e.onError?.(t), t;
570
- }
571
- }
572
- return {
573
- savedBlocks: n,
574
- isLoading: r,
575
- categories: i,
576
- canCreate: a,
577
- canUpdate: o,
578
- canDelete: s,
579
- canUpdateBlock: c,
580
- canDeleteBlock: u,
581
- load: p,
582
- create: m,
583
- update: h,
584
- remove: g
585
- };
586
- }
587
- //#endregion
588
- //#region ../core/src/saved-blocks-local.ts
589
- var Tn = "templatical:saved-blocks";
590
- function En(e = {}) {
591
- let t = e.key ?? Tn;
592
- function n() {
593
- if (typeof localStorage > "u") throw Error("[Templatical] createLocalStorageSavedBlocksProvider requires a browser environment with localStorage. Supply your own SavedBlocksProvider for server-side or non-browser use.");
594
- return localStorage;
595
- }
596
- function r() {
597
- let e = n().getItem(t);
598
- if (!e) return [];
599
- try {
600
- let t = JSON.parse(e);
601
- return Array.isArray(t) ? t : [];
602
- } catch {
603
- return [];
604
- }
605
- }
606
- function i(e) {
607
- n().setItem(t, JSON.stringify(e));
608
- }
609
- return {
610
- async list(e) {
611
- let t = r(), n = e?.search?.trim().toLowerCase(), i = e?.category?.trim();
612
- return t.filter((e) => !(n && !e.name.toLowerCase().includes(n) || i && e.category !== i));
613
- },
614
- async create(e) {
615
- let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
616
- id: U(),
617
- name: e.name,
618
- content: e.content,
619
- ...e.category ? { category: e.category } : {},
620
- createdAt: t,
621
- updatedAt: t
622
- };
623
- return i([n, ...r()]), n;
624
- },
625
- async update(e, t) {
626
- let n = r(), a = n.findIndex((t) => t.id === e);
627
- if (a === -1) throw Error(`[Templatical] Saved block not found: ${e}`);
628
- let o = {
629
- ...n[a],
630
- ...t,
631
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
632
- }, s = [...n];
633
- return s[a] = o, i(s), o;
634
- },
635
- async delete(e) {
636
- let t = r();
637
- if (!t.some((t) => t.id === e)) throw Error(`[Templatical] Saved block not found: ${e}`);
638
- i(t.filter((t) => t.id !== e));
639
- }
640
- };
641
- }
642
- //#endregion
643
- //#region ../core/src/media-local.ts
644
- var Dn = "templatical:media", On = 50;
645
- function kn(e = {}) {
646
- let t = e.key ?? Dn;
647
- function n() {
648
- if (typeof localStorage > "u") throw Error("[Templatical] createLocalStorageMediaProvider requires a browser environment with localStorage. Supply your own MediaProvider for server-side or non-browser use.");
649
- return localStorage;
650
- }
651
- function r() {
652
- let e = n().getItem(t);
653
- if (!e) return [];
654
- try {
655
- let t = JSON.parse(e);
656
- return Array.isArray(t) ? t : [];
657
- } catch {
658
- return [];
659
- }
660
- }
661
- function i(e) {
662
- n().setItem(t, JSON.stringify(e));
663
- }
664
- function a(e) {
665
- return typeof FileReader > "u" ? Promise.reject(/* @__PURE__ */ Error("[Templatical] createLocalStorageMediaProvider requires a browser environment with FileReader.")) : new Promise((t, n) => {
666
- let r = new FileReader();
667
- r.onload = () => {
668
- if (typeof r.result != "string") {
669
- n(/* @__PURE__ */ Error("[Templatical] Failed to read file as a data URL."));
670
- return;
671
- }
672
- t(r.result);
673
- }, r.onerror = () => {
674
- n(r.error ?? /* @__PURE__ */ Error("[Templatical] Failed to read file as a data URL."));
675
- }, r.readAsDataURL(e);
676
- });
677
- }
678
- return {
679
- async list(e) {
680
- let t = r(), n = e?.search?.trim().toLowerCase(), i = n ? t.filter((e) => {
681
- let t = e.filename?.toLowerCase() ?? "", r = e.alt?.toLowerCase() ?? "";
682
- return t.includes(n) || r.includes(n);
683
- }) : t, a = e?.cursor ? Number.parseInt(e.cursor, 10) : 0, o = Number.isFinite(a) && a > 0 ? a : 0, s = i.slice(o, o + On), c = { items: s }, l = o + s.length;
684
- return l < i.length && (c.nextCursor = String(l)), c;
685
- },
686
- async create(e) {
687
- let t = await a(e.file), n = (/* @__PURE__ */ new Date()).toISOString(), o = {
688
- id: U(),
689
- url: t,
690
- filename: e.filename || e.file.name,
691
- createdAt: n,
692
- updatedAt: n,
693
- size: e.file.size
694
- };
695
- return e.alt !== void 0 && (o.alt = e.alt), e.file.type && (o.mimeType = e.file.type), e.folderId !== void 0 && (o.folderId = e.folderId), i([o, ...r()]), o;
696
- },
697
- async update(e, t) {
698
- let n = r(), a = n.findIndex((t) => t.id === e);
699
- if (a === -1) throw Error(`[Templatical] Media asset not found: ${e}`);
700
- let o = n[a], s = {
701
- ...o,
702
- ...t,
703
- id: o.id,
704
- url: o.url,
705
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
706
- }, c = [...n];
707
- return c[a] = s, i(c), s;
708
- },
709
- async delete(e) {
710
- let t = r();
711
- for (let n of e) if (!t.some((e) => e.id === n)) throw Error(`[Templatical] Media asset not found: ${n}`);
712
- let n = new Set(e);
713
- i(t.filter((e) => !n.has(e.id)));
714
- },
715
- folders: !1,
716
- replace: !1,
717
- importFromUrl: !1,
718
- checkUsage: !1,
719
- frequentlyUsed: !1,
720
- storage: !1
721
- };
722
- }
723
- //#endregion
724
- //#region ../core/src/version-history.ts
725
- function An(e) {
726
- let { provider: t, getTemplateId: n } = e, r = l([]), i = l(!1), a = l(void 0), o = l(!1), s = /* @__PURE__ */ new Map(), c = S(() => typeof t.create == "function"), u = S(() => typeof t.restore == "function");
727
- function d(e) {
728
- let t = n();
729
- if (!t) throw new W(`[Templatical] Version history: ${e} needs a template. Call create() or load() first.`);
730
- return t;
731
- }
732
- function f(e) {
733
- throw new W(`[Templatical] Version history: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
734
- }
735
- function p(t) {
736
- un(e.onError, t);
737
- }
738
- async function m(n) {
739
- let o = d("list");
740
- i.value = !0;
741
- try {
742
- let e = await t.list(o, n);
743
- r.value = e.versions, a.value = e.nextCursor;
744
- } catch (t) {
745
- throw e.onError?.(t), t;
746
- } finally {
747
- i.value = !1;
748
- }
749
- }
750
- function h(e) {
751
- return e.content ?? s.get(e.id) ?? null;
752
- }
753
- async function g(n) {
754
- let r = h(n);
755
- if (r) return r;
756
- let i = d("get");
757
- try {
758
- let e = await t.get(i, n.id);
759
- return s.set(n.id, e), e;
760
- } catch (t) {
761
- throw e.onError?.(t), t;
762
- }
763
- }
764
- async function _(n, i) {
765
- let { create: a } = t;
766
- typeof a != "function" && f("create");
767
- let o = d("create");
768
- try {
769
- let e = await a(o, n, i);
770
- return r.value = [e, ...r.value], p(() => t.onCreated?.(e)), e;
771
- } catch (t) {
772
- throw e.onError?.(t), t;
773
- }
774
- }
775
- async function v(n) {
776
- let { restore: r } = t;
777
- typeof r != "function" && f("restore");
778
- let i = d("restore"), a;
779
- o.value = !0;
780
- try {
781
- a = await r(i, n);
782
- } catch (t) {
783
- throw e.onError?.(t), t;
784
- } finally {
785
- o.value = !1;
786
- }
787
- return p(() => t.onRestored?.(a)), a;
788
- }
789
- return {
790
- nextCursor: a,
791
- versions: r,
792
- isLoading: i,
793
- isRestoring: o,
794
- canCreate: c,
795
- canRestore: u,
796
- load: m,
797
- peekContent: h,
798
- resolveContent: g,
799
- create: _,
800
- restore: v
801
- };
802
- }
803
- //#endregion
804
- //#region ../core/src/comments.ts
805
- function jn(e) {
806
- let { provider: t, getTemplateId: n, getUser: r } = e, i = l([]), a = l(!1), o = l(!1), s = S(() => typeof t.create == "function"), c = S(() => typeof t.update == "function"), u = S(() => typeof t.delete == "function"), d = S(() => typeof t.setResolved == "function"), f = S(() => i.value.reduce((e, t) => e + 1 + (t.replies?.length ?? 0), 0)), p = S(() => i.value.filter((e) => !e.resolvedAt).length), m = S(() => {
807
- let e = /* @__PURE__ */ new Map();
808
- for (let t of i.value) t.blockId && e.set(t.blockId, (e.get(t.blockId) ?? 0) + 1 + (t.replies?.length ?? 0));
809
- return e;
810
- });
811
- function h(e) {
812
- let t = n();
813
- if (!t) throw new W(`[Templatical] Comments: ${e} needs a template. Call create() or load() first.`);
814
- return t;
815
- }
816
- function g(e) {
817
- let t = r();
818
- if (!t) throw new W(`[Templatical] Comments: ${e} needs to know who is commenting. Pass init({ user: { id, name } }) — an unattributed comment is not written.`);
819
- return t;
820
- }
821
- function _(e) {
822
- throw new W(`[Templatical] Comments: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
823
- }
824
- function v(e) {
825
- for (let t of i.value) {
826
- if (t.id === e) return t;
827
- for (let n of t.replies ?? []) if (n.id === e) return n;
828
- }
829
- return null;
830
- }
831
- function y(e) {
832
- let t = r();
833
- return t !== null && e.author.id === t.id;
834
- }
835
- function b(t) {
836
- let n = ln(t);
837
- throw e.onError?.(n), n;
838
- }
839
- function x(t) {
840
- un(e.onError, t);
841
- }
842
- function C(e, t, n) {
843
- return [
844
- ...e.slice(0, t),
845
- n,
846
- ...e.slice(t + 1)
847
- ];
848
- }
849
- function w(e, t) {
850
- return e !== void 0 && JSON.stringify(e) === JSON.stringify(t);
851
- }
852
- function T(e) {
853
- if (e.parentId) {
854
- let t = !1, n = i.value.map((n) => {
855
- if (n.id !== e.parentId) return n;
856
- let r = n.replies ?? [], i = r.findIndex((t) => t.id === e.id);
857
- return i !== -1 && w(r[i], e) ? n : (t = !0, {
858
- ...n,
859
- replies: i === -1 ? [...r, e] : C(r, i, e)
860
- });
861
- });
862
- return t && (i.value = n), t;
863
- }
864
- let t = i.value.findIndex((t) => t.id === e.id);
865
- if (t === -1) return i.value = [...i.value, e], !0;
866
- let n = {
867
- ...e,
868
- replies: e.replies ?? i.value[t].replies
869
- };
870
- return !w(i.value[t], n) && (i.value = C(i.value, t, n), !0);
871
- }
872
- function E(e, t) {
873
- let n = v(e), r = t ?? n?.parentId ?? null;
874
- return r ? i.value = i.value.map((t) => t.id === r ? {
875
- ...t,
876
- replies: (t.replies ?? []).filter((t) => t.id !== e)
877
- } : t) : i.value = i.value.filter((t) => t.id !== e), n;
878
- }
879
- async function D(e) {
880
- let n = h("list");
881
- a.value = !0;
882
- try {
883
- i.value = await t.list(n, e);
884
- } catch (e) {
885
- b(e);
886
- } finally {
887
- a.value = !1;
888
- }
889
- }
890
- async function O(e) {
891
- let { create: n } = t;
892
- typeof n != "function" && _("create");
893
- let r = h("create");
894
- g("create"), o.value = !0;
895
- try {
896
- let i = await n(r, e);
897
- return T(i), x(() => t.onCreated?.(i, { origin: "local" })), i;
898
- } catch (e) {
899
- b(e);
900
- } finally {
901
- o.value = !1;
902
- }
903
- }
904
- async function k(e, n) {
905
- let { update: r } = t;
906
- typeof r != "function" && _("update");
907
- let i = h("update");
908
- g("update"), o.value = !0;
909
- try {
910
- let a = await r(i, e, n);
911
- return T(a), x(() => t.onUpdated?.(a, { origin: "local" })), a;
912
- } catch (e) {
913
- b(e);
914
- } finally {
915
- o.value = !1;
916
- }
917
- }
918
- async function A(e) {
919
- let { delete: n } = t;
920
- typeof n != "function" && _("delete");
921
- let r = h("delete");
922
- g("delete");
923
- let i = v(e);
924
- o.value = !0;
925
- try {
926
- await n(r, e), E(e), i && x(() => t.onDeleted?.(i, { origin: "local" }));
927
- } catch (e) {
928
- b(e);
929
- } finally {
930
- o.value = !1;
931
- }
932
- }
933
- async function j(e, n) {
934
- let { setResolved: r } = t;
935
- typeof r != "function" && _("setResolved");
936
- let i = h("setResolved");
937
- g("setResolved"), o.value = !0;
938
- try {
939
- let a = await r(i, e, n);
940
- return T(a), x(() => (a.resolvedAt ? t.onResolved : t.onUnresolved)?.(a, { origin: "local" })), a;
941
- } catch (e) {
942
- b(e);
943
- } finally {
944
- o.value = !1;
945
- }
946
- }
947
- function M(e) {
948
- T(e) && x(() => t.onCreated?.(e, { origin: "remote" }));
949
- }
950
- function N(e) {
951
- T(e) && x(() => (e.resolvedAt ? t.onResolved : t.onUpdated)?.(e, { origin: "remote" }));
952
- }
953
- function P(e, n) {
954
- let r = E(e, n);
955
- r && x(() => t.onDeleted?.(r, { origin: "remote" }));
956
- }
957
- return {
958
- comments: i,
959
- isLoading: a,
960
- isSubmitting: o,
961
- canCreate: s,
962
- canUpdate: c,
963
- canDelete: u,
964
- canResolve: d,
965
- totalCount: f,
966
- unresolvedCount: p,
967
- commentCountByBlock: m,
968
- load: D,
969
- create: O,
970
- update: k,
971
- remove: A,
972
- setResolved: j,
973
- find: v,
974
- isOwn: y,
975
- applyRemoteCreate: M,
976
- applyRemoteUpdate: N,
977
- applyRemoteDelete: P
978
- };
979
- }
980
- function Mn(e) {
981
- let { comments: n, provider: r, getTemplateId: i } = e, { subscribe: a } = r;
982
- if (typeof a != "function") return;
983
- let o = null;
984
- function s() {
985
- o?.(), o = null;
986
- }
987
- t(() => i(), (e) => {
988
- s(), e && (o = a(e, (e) => {
989
- switch (e.type) {
990
- case "created":
991
- n.applyRemoteCreate(e.comment);
992
- break;
993
- case "updated":
994
- n.applyRemoteUpdate(e.comment);
995
- break;
996
- case "deleted": n.applyRemoteDelete(e.commentId, e.parentId);
997
- }
998
- }));
999
- }, { immediate: !0 }), h(s);
1000
- }
1001
- //#endregion
1002
- //#region src/utils/activeEditorTracker.ts
1003
- var Nn = /* @__PURE__ */ new Set(), Q = 0, Pn = 0;
1004
- function Fn() {
1005
- let e = ++Pn;
1006
- return Nn.add(e), Q === 0 && (Q = e), {
1007
- id: e,
1008
- isActive: () => Nn.size <= 1 || Q === e,
1009
- claim: () => {
1010
- Q = e;
1011
- },
1012
- dispose: () => {
1013
- if (Nn.delete(e), Q === e) {
1014
- let e = Array.from(Nn);
1015
- Q = e[e.length - 1] ?? 0;
1016
- }
1017
- }
1018
- };
1019
- }
1020
- //#endregion
1021
- //#region src/composables/usePreviewResolution.ts
1022
- var In = 500;
1023
- function Ln(e) {
1024
- let n = typeof e.resolvePreview == "function", r = l(null), i = l(!1), a = l(!1), o = 0, s = null;
1025
- function c() {
1026
- s !== null && (clearTimeout(s), s = null);
1027
- }
1028
- async function u() {
1029
- let t = e.resolvePreview;
1030
- if (!t) return;
1031
- let n = ++o;
1032
- i.value = !0;
1033
- let s = {
1034
- content: ve(e.getContent()),
1035
- ...e.getRecipient?.() === void 0 ? {} : { recipient: e.getRecipient() }
1036
- };
1037
- try {
1038
- let e = await t(s);
1039
- if (n !== o) return;
1040
- if (!ke(e)) {
1041
- a.value = !0;
1042
- return;
1043
- }
1044
- r.value = e, a.value = !1;
1045
- } catch {
1046
- if (n !== o) return;
1047
- a.value = !0;
1048
- } finally {
1049
- n === o && (i.value = !1);
1050
- }
1051
- }
1052
- function d() {
1053
- if (n) {
1054
- if (c(), r.value === null) {
1055
- u();
1056
- return;
1057
- }
1058
- s = setTimeout(() => {
1059
- s = null, u();
1060
- }, In);
1061
- }
1062
- }
1063
- return t(() => [e.isActive(), e.getRecipient?.()], ([e]) => {
1064
- if (!e) {
1065
- c(), o++, i.value = !1, r.value = null, a.value = !1;
1066
- return;
1067
- }
1068
- d();
1069
- }, { immediate: !0 }), h(() => {
1070
- c(), o++;
1071
- }), {
1072
- isConfigured: n,
1073
- content: S(() => r.value ?? e.getContent()),
1074
- isResolving: i,
1075
- isInitialResolve: S(() => i.value && r.value === null),
1076
- hasFailed: a,
1077
- supersedesSamples: S(() => n)
1078
- };
1079
- }
1080
- //#endregion
1081
- //#region src/composables/useImageUrlResolver.ts
1082
- function Rn(e) {
1083
- let t = m(/* @__PURE__ */ new Map()), n = /* @__PURE__ */ new Set();
1084
- function r(e) {
1085
- return t.get(e);
1086
- }
1087
- function i(e) {
1088
- return t.has(e) || n.has(e);
1089
- }
1090
- function a(r) {
1091
- if (i(r)) return;
1092
- let a;
1093
- try {
1094
- a = e(r);
1095
- } catch {
1096
- t.set(r, null);
1097
- return;
1098
- }
1099
- if (a === null || typeof a == "string") {
1100
- t.set(r, a);
1101
- return;
1102
- }
1103
- n.add(r), Promise.resolve(a).then((e) => {
1104
- t.set(r, typeof e == "string" ? e : null);
1105
- }, () => {
1106
- t.set(r, null);
1107
- }).finally(() => n.delete(r));
1108
- }
1109
- return {
1110
- get: r,
1111
- has: i,
1112
- lookup: a
1113
- };
1114
- }
1115
- function zn(e) {
1116
- let r = n(Mt, null), i = S(e);
1117
- if (!r) return i;
1118
- let a;
1119
- function s() {
1120
- a !== void 0 && (clearTimeout(a), a = void 0);
1121
- }
1122
- o() && h(s);
1123
- let c = !0;
1124
- return t(i, (e) => {
1125
- s();
1126
- let t = c;
1127
- if (c = !1, e && !r.has(e)) {
1128
- if (t) {
1129
- r.lookup(e);
1130
- return;
1131
- }
1132
- a = setTimeout(() => {
1133
- a = void 0, r.lookup(e);
1134
- }, 300);
1135
- }
1136
- }, { immediate: !0 }), S(() => {
1137
- let e = i.value;
1138
- if (!e) return e;
1139
- let t = r.get(e);
1140
- return typeof t == "string" && t.length > 0 ? t : e;
1141
- });
1142
- }
1143
- //#endregion
1144
- //#region src/composables/useMergeTagPicker.ts
1145
- function Bn() {
1146
- let e = l(!1), t = l([]), n = l(null), r = null;
1147
- function i(i, a) {
1148
- if (r) {
1149
- let e = r;
1150
- r = null, e(null);
1151
- }
1152
- return t.value = i, n.value = a?.current ?? null, e.value = !0, new Promise((e) => {
1153
- r = e;
1154
- });
1155
- }
1156
- function a(i) {
1157
- let a = r;
1158
- r = null, e.value = !1, t.value = [], n.value = null, a && a(i);
1159
- }
1160
- return o() && h(() => {
1161
- if (r) {
1162
- let e = r;
1163
- r = null, e(null);
1164
- }
1165
- e.value = !1, t.value = [], n.value = null;
1166
- }), {
1167
- isOpen: e,
1168
- tags: t,
1169
- current: n,
1170
- open: i,
1171
- resolve: a
1172
- };
1173
- }
1174
- //#endregion
1175
- //#region src/composables/useLogicTagPicker.ts
1176
- function Vn() {
1177
- let e = l(!1), t = l([]), n = l([]), r = null;
1178
- function i(i, a) {
1179
- if (r) {
1180
- let e = r;
1181
- r = null, e(null);
1182
- }
1183
- return t.value = i, n.value = a, e.value = !0, new Promise((e) => {
1184
- r = e;
1185
- });
1186
- }
1187
- function a(i) {
1188
- let a = r;
1189
- r = null, e.value = !1, t.value = [], n.value = [], a && a(i);
1190
- }
1191
- return o() && h(() => {
1192
- if (r) {
1193
- let e = r;
1194
- r = null, e(null);
1195
- }
1196
- e.value = !1, t.value = [], n.value = [];
1197
- }), {
1198
- isOpen: e,
1199
- tags: t,
1200
- pairs: n,
1201
- open: i,
1202
- resolve: a
1203
- };
1204
- }
1205
- //#endregion
1206
- //#region src/composables/useTemplateLint.ts
1207
- function Hn(e) {
1208
- return e ? e.disabled === !0 || e.accessibility === !1 && e.structure === !1 && e.links === !1 : !1;
1209
- }
1210
- function Un(e) {
1211
- let n = l([]), r = l(!1), i = l(!1), a = x(null), o = Hn(e.options), s = null, c = !1;
1212
- o || u();
1213
- async function u() {
1214
- try {
1215
- let t = await import("./src-CaNsA_WX.js");
1216
- if (c) return;
1217
- a.value = { lintTemplate: t.lintTemplate }, r.value = !0, d(), s = He(e.content, d, {
1218
- debounce: e.debounce ?? 500,
1219
- deep: !0
1220
- });
1221
- } catch {
1222
- if (c) return;
1223
- i.value = !0;
1224
- }
1225
- }
1226
- function d() {
1227
- a.value && (n.value = a.value.lintTemplate(e.content.value, e.options));
1228
- }
1229
- let f = t(() => e.options, () => {
1230
- a.value && d();
1231
- }, { deep: !0 });
1232
- function p(t) {
1233
- t.fix && t.fix.apply({
1234
- updateBlock: e.updateBlock,
1235
- updateSettings: e.updateSettings,
1236
- removeBlock: e.removeBlock
1237
- });
1238
- }
1239
- function m() {
1240
- c = !0, s?.(), f();
1241
- }
1242
- return {
1243
- issues: n,
1244
- ready: r,
1245
- unavailable: i,
1246
- applyFix: p,
1247
- destroy: m
1248
- };
1249
- }
1250
- //#endregion
1251
- //#region src/utils/blockTypeLabels.ts
1252
- function Wn(e, t) {
1253
- return t.blocks[e] ?? e;
1254
- }
1255
- function Gn(e, t, n = []) {
1256
- if (e.type !== "custom") return Wn(e.type, t);
1257
- let { customType: r } = e;
1258
- return n.find((e) => e.type === r)?.name ?? r;
1259
- }
1260
- //#endregion
1261
- //#region src/composables/useKeyboardReorder.ts
1262
- function Kn(e, t, n = []) {
1263
- let r = l(null), i = l(""), a = null;
1264
- function o(t) {
1265
- let n = e.content.value.blocks, r = n.findIndex((e) => e.id === t);
1266
- if (r !== -1) return {
1267
- index: r,
1268
- total: n.length
1269
- };
1270
- for (let e of n) {
1271
- if (e.type !== "section") continue;
1272
- let n = e;
1273
- for (let e = 0; e < n.children.length; e++) {
1274
- let r = n.children[e], i = r.findIndex((e) => e.id === t);
1275
- if (i !== -1) return {
1276
- index: i,
1277
- total: r.length,
1278
- sectionId: n.id,
1279
- columnIndex: e
1280
- };
1281
- }
1282
- }
1283
- return null;
1284
- }
1285
- function s(r) {
1286
- let i = o(r);
1287
- if (!i) return "";
1288
- let a = (i.sectionId ? c(i.sectionId, i.columnIndex ?? 0) : e.content.value.blocks)?.[i.index];
1289
- return a ? Gn(a, t.t, n) : "";
1290
- }
1291
- function c(t, n) {
1292
- return e.content.value.blocks.find((e) => e.id === t && e.type === "section")?.children[n] ?? null;
1293
- }
1294
- function u(e) {
1295
- i.value = "", queueMicrotask(() => {
1296
- i.value = e;
1297
- });
1298
- }
1299
- function d(e) {
1300
- return r.value === e;
1301
- }
1302
- function f(e) {
1303
- let n = o(e);
1304
- n && (r.value = e, a = n, u(t.format(t.t.blockActions.lifted, {
1305
- block: s(e),
1306
- position: String(n.index + 1),
1307
- total: String(n.total)
1308
- })));
1309
- }
1310
- function p(n, r) {
1311
- let i = o(n);
1312
- if (!i) return;
1313
- let a = i.index + r;
1314
- a < 0 || a >= i.total || (e.moveBlock(n, a, i.sectionId, i.columnIndex), u(t.format(t.t.blockActions.moved, {
1315
- block: s(n),
1316
- position: String(a + 1),
1317
- total: String(i.total)
1318
- })));
1319
- }
1320
- function m(e) {
1321
- p(e, -1);
1322
- }
1323
- function h(e) {
1324
- p(e, 1);
1325
- }
1326
- function g(e) {
1327
- let n = o(e);
1328
- n && u(t.format(t.t.blockActions.dropped, {
1329
- block: s(e),
1330
- position: String(n.index + 1),
1331
- total: String(n.total)
1332
- })), r.value = null, a = null;
1333
- }
1334
- function _() {
1335
- let n = r.value;
1336
- if (n && a) {
1337
- let r = o(n);
1338
- r && (r && (r.sectionId !== a.sectionId || r.columnIndex !== a.columnIndex) || r && r.index !== a.index) && e.moveBlock(n, a.index, a.sectionId, a.columnIndex), u(t.format(t.t.blockActions.cancelled, {
1339
- block: s(n),
1340
- position: String(a.index + 1)
1341
- }));
1342
- }
1343
- r.value = null, a = null;
1344
- }
1345
- return {
1346
- liftedBlockId: r,
1347
- announcement: i,
1348
- isLifted: d,
1349
- lift: f,
1350
- cancel: _,
1351
- moveUp: m,
1352
- moveDown: h,
1353
- drop: g
1354
- };
1355
- }
1356
- //#endregion
1357
- //#region src/composables/useUiTheme.ts
1358
- function qn(e) {
1359
- let t = Ue("(prefers-color-scheme: dark)");
1360
- return { resolvedTheme: S(() => e.value === "auto" ? t.value ? "dark" : "light" : e.value) };
1361
- }
1362
- //#endregion
1363
- //#region src/composables/useThemeStyles.ts
1364
- var Jn = {
1365
- bg: "--tpl-bg",
1366
- bgElevated: "--tpl-bg-elevated",
1367
- bgHover: "--tpl-bg-hover",
1368
- bgActive: "--tpl-bg-active",
1369
- border: "--tpl-border",
1370
- borderLight: "--tpl-border-light",
1371
- text: "--tpl-text",
1372
- textMuted: "--tpl-text-muted",
1373
- textDim: "--tpl-text-dim",
1374
- primary: "--tpl-primary",
1375
- primaryHover: "--tpl-primary-hover",
1376
- primaryLight: "--tpl-primary-light",
1377
- secondary: "--tpl-secondary",
1378
- secondaryHover: "--tpl-secondary-hover",
1379
- secondaryLight: "--tpl-secondary-light",
1380
- success: "--tpl-success",
1381
- successLight: "--tpl-success-light",
1382
- warning: "--tpl-warning",
1383
- warningLight: "--tpl-warning-light",
1384
- danger: "--tpl-danger",
1385
- dangerLight: "--tpl-danger-light",
1386
- canvasBg: "--tpl-canvas-bg"
1387
- };
1388
- function Yn({ themeOverrides: e, resolvedTheme: t, extraStyles: n }) {
1389
- return { themeStyles: S(() => {
1390
- let r = {}, i = e.value, a = t.value === "dark" ? i.dark : i;
1391
- if (a) for (let [e, t] of Object.entries(Jn)) {
1392
- let n = a[e];
1393
- n && (r[t] = n);
1394
- }
1395
- return n && Object.assign(r, n()), r;
1396
- }) };
1397
- }
1398
- //#endregion
1399
- //#region src/composables/useBlockRegistry.ts
1400
- function Xn() {
1401
- let e = x(/* @__PURE__ */ new Map());
1402
- function t(t, n) {
1403
- e.value.set(t, n), T(e);
1404
- }
1405
- function n(t, n) {
1406
- let r = `custom:${t.type}`;
1407
- e.value.set(r, {
1408
- component: n,
1409
- createBlock: () => pe(t),
1410
- definition: t
1411
- }), T(e);
1412
- }
1413
- function r(t) {
1414
- if (t.type === "custom") {
1415
- let n = `custom:${t.customType}`;
1416
- return e.value.get(n)?.component;
1417
- }
1418
- return e.value.get(t.type)?.component;
1419
- }
1420
- function i(t) {
1421
- return e.value.get(t)?.createBlock();
1422
- }
1423
- function a(t) {
1424
- let n = `custom:${t}`;
1425
- return e.value.get(n)?.definition;
1426
- }
1427
- function o(e) {
1428
- return `<div style="color: var(--tpl-text-muted); padding: 16px; text-align: center; border: 1px dashed var(--tpl-border); border-radius: var(--tpl-radius-sm); font-family: var(--tpl-font-family); font-size: 14px;">${e}</div>`;
1429
- }
1430
- async function s(e) {
1431
- let t = a(e.customType);
1432
- if (!t) return o("Block definition not found");
1433
- try {
1434
- let { Liquid: n } = await import("./liquid.browser-BypTT2oc.js");
1435
- return await new n({
1436
- strictVariables: !1,
1437
- strictFilters: !1
1438
- }).parseAndRender(t.template, e.fieldValues);
1439
- } catch (t) {
1440
- return X.error(`Failed to render custom block "${e.customType}":`, t), o(`Render error: ${e.customType}`);
1441
- }
1442
- }
1443
- function c(t) {
1444
- return e.value.has(t);
1445
- }
1446
- return {
1447
- registerBuiltIn: t,
1448
- registerCustom: n,
1449
- getComponent: r,
1450
- createBlock: i,
1451
- getDefinition: a,
1452
- renderCustomBlock: s,
1453
- isRegistered: c
1454
- };
1455
- }
1456
- //#endregion
1457
- //#region src/composables/useCustomBlockStylesheets.ts
1458
- function Zn(e, t) {
1459
- return S(() => {
1460
- let n = Qn(e.value.blocks);
1461
- if (n.size === 0) return [];
1462
- let r = /* @__PURE__ */ new Set(), i = [];
1463
- for (let e of n) {
1464
- let n = t.getDefinition(e)?.stylesheet;
1465
- if (!n) continue;
1466
- let a = n.trim();
1467
- a === "" || r.has(a) || (r.add(a), i.push(a));
1468
- }
1469
- return i;
1470
- });
1471
- }
1472
- function Qn(e) {
1473
- let t = /* @__PURE__ */ new Set();
1474
- return $n(e, t), t;
1475
- }
1476
- function $n(e, t) {
1477
- for (let n of e) {
1478
- if (he(n)) {
1479
- t.add(n.customType);
1480
- continue;
1481
- }
1482
- if (n.type === "section") {
1483
- let e = n.children;
1484
- if (!e) continue;
1485
- for (let n of e) $n(n, t);
1486
- }
1487
- }
1488
- }
1489
- //#endregion
1490
- //#region src/utils/registerBuiltInBlocks.ts
1491
- var er = [
1492
- {
1493
- type: "section",
1494
- createBlock: Te
1495
- },
1496
- {
1497
- type: "title",
1498
- createBlock: ie
1499
- },
1500
- {
1501
- type: "paragraph",
1502
- createBlock: H
1503
- },
1504
- {
1505
- type: "image",
1506
- createBlock: le
1507
- },
1508
- {
1509
- type: "button",
1510
- createBlock: te
1511
- },
1512
- {
1513
- type: "divider",
1514
- createBlock: re
1515
- },
1516
- {
1517
- type: "video",
1518
- createBlock: oe
1519
- },
1520
- {
1521
- type: "social",
1522
- createBlock: se
1523
- },
1524
- {
1525
- type: "menu",
1526
- createBlock: Ee
1527
- },
1528
- {
1529
- type: "table",
1530
- createBlock: ue
1531
- },
1532
- {
1533
- type: "spacer",
1534
- createBlock: ce
1535
- },
1536
- {
1537
- type: "html",
1538
- createBlock: ne
1539
- },
1540
- {
1541
- type: "countdown",
1542
- createBlock: Le
1543
- }
1544
- ];
1545
- function tr(e, t) {
1546
- for (let n of er) {
1547
- let r = t[n.type];
1548
- r && e.registerBuiltIn(n.type, {
1549
- component: r,
1550
- createBlock: n.createBlock
1551
- });
1552
- }
1553
- }
1554
- //#endregion
1555
- //#region src/utils/resolveHtmlBlockPreview.ts
1556
- function nr(e) {
1557
- return typeof e == "boolean" ? e : e?.enabled ?? !1;
1558
- }
1559
- //#endregion
1560
- //#region src/utils/templateSettingsFields.ts
1561
- var rr = {
1562
- width: "layout",
1563
- backgroundColor: "appearance",
1564
- textColor: "appearance",
1565
- linkColor: "appearance",
1566
- linkUnderline: "appearance",
1567
- fontFamily: "appearance",
1568
- locale: "language",
1569
- direction: "language",
1570
- preheaderText: "preheader"
1571
- }, ir = Object.keys(rr);
1572
- function ar(e) {
1573
- return Object.prototype.hasOwnProperty.call(rr, e);
1574
- }
1575
- function or(e) {
1576
- let t = e?.fields;
1577
- if (t === void 0 || t === !0) return {
1578
- fields: new Set(ir),
1579
- unknown: []
1580
- };
1581
- if (t === !1) return {
1582
- fields: /* @__PURE__ */ new Set(),
1583
- unknown: []
1584
- };
1585
- let n = /* @__PURE__ */ new Set(), r = [];
1586
- for (let e of t) ar(e) ? n.add(e) : r.push(String(e));
1587
- return {
1588
- fields: n,
1589
- unknown: r
1590
- };
1591
- }
1592
- //#endregion
1593
- //#region src/utils/collectOffPaletteDefaults.ts
1594
- function sr(e) {
1595
- return typeof e == "object" && !!e && !Array.isArray(e);
1596
- }
1597
- function cr(e, t, n) {
1598
- let r = new Set(e.map((e) => Z(e))), i = [], a = (e, t) => {
1599
- for (let [n, o] of Object.entries(e)) typeof o == "string" ? o !== "" && /color$/i.test(n) && !r.has(Z(o)) && i.push(`${t}.${n}: ${o}`) : sr(o) && a(o, `${t}.${n}`);
1600
- }, o = t;
1601
- for (let [e, t] of Object.entries(ee)) {
1602
- let n = o?.[e];
1603
- a({
1604
- ...t,
1605
- ...sr(n) ? n : {}
1606
- }, e);
1607
- }
1608
- return a({
1609
- ...me,
1610
- ...n ?? {}
1611
- }, "template"), i;
1612
- }
1613
- //#endregion
1614
- //#region src/utils/localizedBlockDefaults.ts
1615
- function lr(e) {
1616
- return {
1617
- title: { content: `<p>${e.blockDefaults.title}</p>` },
1618
- paragraph: { content: `<p>${e.blockDefaults.paragraph}</p>` },
1619
- button: { text: e.blockDefaults.button }
1620
- };
1621
- }
1622
- //#endregion
1623
- //#region src/i18n/index.ts
1624
- var ur = /* #__PURE__ */ Object.assign({
1625
- "./locales/ca.ts": () => import("./ca-YlPDhElv.js"),
1626
- "./locales/de.ts": () => import("./de-CONjnzrF.js"),
1627
- "./locales/en.ts": () => import("./en-BAMooiOF.js"),
1628
- "./locales/es.ts": () => import("./es-I47lHs2m.js"),
1629
- "./locales/fr.ts": () => import("./fr-B8MIKjT4.js"),
1630
- "./locales/nl.ts": () => import("./nl-CBLxcb-0.js"),
1631
- "./locales/pt-BR.ts": () => import("./pt-BR-CMSRfX7t.js")
1632
- }), dr = /* #__PURE__ */ Object.assign({
1633
- "./locales/cloud/de.ts": () => import("./de-BytZwgn6.js"),
1634
- "./locales/cloud/en.ts": () => import("./en-DyOSV0lY.js"),
1635
- "./locales/cloud/pt-BR.ts": () => import("./pt-BR-C1WLSGDh.js")
1636
- });
1637
- function fr(e) {
1638
- return Object.keys(e).map((e) => e.match(/\/([^/]+)\.ts$/)?.[1]).filter((e) => !!e);
1639
- }
1640
- var pr = fr(ur), mr = fr(dr);
1641
- function hr(e) {
1642
- return e.trim().replace(/_/g, "-").toLowerCase();
1643
- }
1644
- function gr(e, t) {
1645
- let n = hr(e);
1646
- return t.find((e) => hr(e) === n);
1647
- }
1648
- function _r(e) {
1649
- return hr(e).split("-")[0];
1650
- }
1651
- function vr(e, t) {
1652
- return gr(e, t) ?? gr(_r(e), t);
1653
- }
1654
- function yr(e, t) {
1655
- return vr(e, t) ?? "en";
1656
- }
1657
- async function br(e) {
1658
- let t = ur[`./locales/${yr(e, pr)}.ts`];
1659
- return (await t()).default;
1660
- }
1661
- async function xr(e) {
1662
- let t = dr[`./locales/cloud/${yr(e, mr)}.ts`];
1663
- return (await t()).default;
1664
- }
1665
- function Sr(e) {
1666
- return vr(e, pr) !== void 0;
1667
- }
1668
- function Cr(e) {
1669
- return vr(e, mr) !== void 0;
1670
- }
1671
- function wr() {
1672
- return [...pr];
1673
- }
1674
- function Tr() {
1675
- return [...mr];
1676
- }
1677
- //#endregion
1678
- //#region src/i18n/contentDefaults.ts
1679
- var $ = {
1680
- en: {
1681
- video: "Video",
1682
- days: "Days",
1683
- hours: "Hours",
1684
- minutes: "Minutes",
1685
- seconds: "Seconds",
1686
- expired: "This offer has expired"
1687
- },
1688
- de: {
1689
- video: "Video",
1690
- days: "Tage",
1691
- hours: "Stunden",
1692
- minutes: "Minuten",
1693
- seconds: "Sekunden",
1694
- expired: "Dieses Angebot ist abgelaufen"
1695
- },
1696
- es: {
1697
- video: "Vídeo",
1698
- days: "Días",
1699
- hours: "Horas",
1700
- minutes: "Minutos",
1701
- seconds: "Segundos",
1702
- expired: "Esta oferta ha expirado"
1703
- },
1704
- fr: {
1705
- video: "Vidéo",
1706
- days: "Jours",
1707
- hours: "Heures",
1708
- minutes: "Minutes",
1709
- seconds: "Secondes",
1710
- expired: "Cette offre a expiré"
1711
- },
1712
- nl: {
1713
- video: "Video",
1714
- days: "Dagen",
1715
- hours: "Uren",
1716
- minutes: "Minuten",
1717
- seconds: "Seconden",
1718
- expired: "Deze aanbieding is verlopen"
1719
- },
1720
- "pt-BR": {
1721
- video: "Vídeo",
1722
- days: "Dias",
1723
- hours: "Horas",
1724
- minutes: "Minutos",
1725
- seconds: "Segundos",
1726
- expired: "Esta oferta expirou"
1727
- },
1728
- ca: {
1729
- video: "Vídeo",
1730
- days: "Dies",
1731
- hours: "Hores",
1732
- minutes: "Minuts",
1733
- seconds: "Segons",
1734
- expired: "Aquesta oferta ha caducat"
1735
- }
1736
- }, Er = new Map(Object.keys($).map((e) => [e.toLowerCase(), e]));
1737
- function Dr(e) {
1738
- if (!e) return $.en;
1739
- let t = e.trim().replace(/_/g, "-").toLowerCase(), n = Er.get(t);
1740
- if (n) return $[n];
1741
- let r = Er.get(_r(t));
1742
- return r ? $[r] : $.en;
1743
- }
1744
- function Or(e) {
1745
- let t = Dr(e);
1746
- return {
1747
- video: { alt: t.video },
1748
- countdown: {
1749
- labelDays: t.days,
1750
- labelHours: t.hours,
1751
- labelMinutes: t.minutes,
1752
- labelSeconds: t.seconds,
1753
- expiredMessage: t.expired
1754
- }
1755
- };
1756
- }
1757
- //#endregion
1758
- //#region src/utils/resolveFieldColors.ts
1759
- function kr(e, t) {
1760
- let n = Lt({ presets: e.presets }, Ft), r = n.presets.length === 0;
1761
- return {
1762
- presets: r ? t.presets : n.presets,
1763
- allowCustom: t.allowCustom === !1 ? !1 : e.allowCustom ?? t.allowCustom,
1764
- invalidPresets: n.invalidPresets,
1765
- emptyPresets: e.presets !== void 0 && e.presets.length === 0,
1766
- presetsInherited: r,
1767
- allowCustomIgnored: e.allowCustom === !0 && t.allowCustom === !1
1768
- };
1769
- }
1770
- //#endregion
1771
- //#region src/utils/collectColorFieldIssues.ts
1772
- function Ar(e, t) {
1773
- let n = [], r = (r, i) => {
1774
- let a = kr(r, t), o = `custom block "${e.type}" field "${i}"`, s = (t) => `${e.type}:${i}:${t}`;
1775
- if (a.invalidPresets.length > 0 && n.push({
1776
- id: s("invalid-presets"),
1777
- message: `${o}: presets skipped invalid entries: ${a.invalidPresets.join(", ")} — presets must be hex colors (#rgb or #rrggbb).` + (a.presetsInherited ? " No valid entries are left, so the field inherits colors.presets." : "")
1778
- }), a.emptyPresets && n.push({
1779
- id: s("empty-presets"),
1780
- message: `${o}: presets is empty — a field palette can only narrow the editor's, so an empty list is ignored and the field inherits colors.presets.`
1781
- }), a.allowCustomIgnored && n.push({
1782
- id: s("allow-custom-ignored"),
1783
- message: `${o}: allowCustom: true is ignored because colors.allowCustom is false — a field can narrow the editor-wide palette, never unlock it.`
1784
- }), !a.allowCustom && a.presets.length > 0) {
1785
- let e = r.default ?? "", t = new Set(a.presets.map((e) => Z(e)));
1786
- e !== "" && !t.has(Z(e)) && n.push({
1787
- id: s("off-palette-default"),
1788
- message: `${o} locks custom colours, but its default ${e} falls outside the field's presets: ${a.presets.join(", ")}. New blocks start on a colour the picker can't reselect — set the default from the same palette.`
1789
- });
1790
- }
1791
- };
1792
- for (let t of e.fields) if (t.type === "color") r(t, t.key);
1793
- else if (t.type === "repeatable") for (let e of t.fields) e.type === "color" && r(e, `${t.key}[].${e.key}`);
1794
- return n;
1795
- }
1796
- //#endregion
1797
- //#region src/utils/keyboardShortcuts.ts
1798
- function jr(e) {
1799
- for (let t of e.composedPath()) {
1800
- if (!(t instanceof HTMLElement)) continue;
1801
- if (t.isContentEditable) return !0;
1802
- let e = t.tagName;
1803
- if (e === "INPUT" || e === "TEXTAREA" || e === "SELECT") return !0;
1804
- }
1805
- return !1;
1806
- }
1807
- function Mr(e, t) {
1808
- let n = e.metaKey || e.ctrlKey;
1809
- if (n && e.key.toLowerCase() === "s") {
1810
- e.preventDefault(), t.onSave?.();
1811
- return;
1812
- }
1813
- if (n && e.key.toLowerCase() === "z") {
1814
- if (jr(e)) return;
1815
- e.preventDefault(), e.shiftKey ? t.history.redo() : (t.onBeforeUndo?.(), t.history.undo());
1816
- return;
1817
- }
1818
- if (t.isPicking?.() && !jr(e)) {
1819
- if (e.key === "Escape") {
1820
- e.preventDefault(), t.onCancelPick?.();
1821
- return;
1822
- }
1823
- if (e.key === "Enter") {
1824
- e.preventDefault(), t.onConfirmPick?.();
1825
- return;
1826
- }
1827
- if (e.key === "Delete" || e.key === "Backspace") {
1828
- e.preventDefault();
1829
- return;
1830
- }
1831
- }
1832
- if (e.key === "Escape") {
1833
- t.selectBlock(null);
1834
- return;
1835
- }
1836
- (e.key === "Delete" || e.key === "Backspace") && t.getSelectedBlockId() && !jr(e) && (e.preventDefault(), t.history.record(), t.removeBlock(t.getSelectedBlockId()));
1837
- }
1838
- //#endregion
1839
- //#region src/utils/mergeTagLabelSegments.ts
1840
- function Nr(e, t, n, r = !1) {
1841
- if (!e) return [];
1842
- let i = RegExp(`(${n.value.source}|${n.logic.source})`, "g"), a = [], o = 0, s;
1843
- for (; (s = i.exec(e)) !== null;) {
1844
- s.index > o && a.push({
1845
- type: "text",
1846
- value: e.slice(o, s.index)
1847
- });
1848
- let i = s[0];
1849
- if (be(i, n)) {
1850
- let e = r ? Fe(i, t) : void 0;
1851
- a.push(e === void 0 ? {
1852
- type: "tag",
1853
- value: je(i, t)
1854
- } : {
1855
- type: "text",
1856
- value: e
1857
- });
1858
- } else ye(i, n) ? a.push({
1859
- type: "tag",
1860
- value: _e(i, n)
1861
- }) : a.push({
1862
- type: "text",
1863
- value: i
1864
- });
1865
- o = s.index + i.length;
1866
- }
1867
- return o < e.length && a.push({
1868
- type: "text",
1869
- value: e.slice(o)
1870
- }), a;
1871
- }
1872
- //#endregion
1873
- //#region src/components/MergeTagPreviewText.vue
1874
- var Pr = d({
1875
- name: "MergeTagPreviewText",
1876
- props: { text: {
1877
- type: String,
1878
- required: !0
1879
- } },
1880
- setup(e) {
1881
- let t = n(K, at), r = n(rt, Ne.liquid), i = n(q, null), a = S(() => Nr(e.text, t.value, r, i?.value ?? !1));
1882
- return () => a.value.map((e, t) => e.type === "tag" ? z("span", {
1883
- key: t,
1884
- class: "tpl-merge-tag-label"
1885
- }, e.value) : e.value);
1886
- }
1887
- }), Fr = ["href"], Ir = /* @__PURE__ */ d({
1888
- __name: "ButtonBlock",
1889
- props: {
1890
- block: {},
1891
- viewport: {}
1892
- },
1893
- setup(e) {
1894
- let t = e, n = S(() => {
1895
- let e = {
1896
- display: "inline-block",
1897
- padding: `${t.block.buttonPadding.top}px ${t.block.buttonPadding.right}px ${t.block.buttonPadding.bottom}px ${t.block.buttonPadding.left}px`,
1898
- backgroundColor: t.block.backgroundColor,
1899
- color: t.block.textColor,
1900
- fontSize: `${t.block.fontSize}px`,
1901
- fontWeight: "bold",
1902
- textDecoration: "none",
1903
- borderRadius: `${t.block.borderRadius}px`,
1904
- textAlign: "center"
1905
- };
1906
- return t.block.fontFamily && (e.fontFamily = t.block.fontFamily), t.block.width === "full" ? (e.display = "block", e.width = "100%", e.boxSizing = "border-box") : typeof t.block.width == "number" && (e.width = `${t.block.width}px`, e.boxSizing = "border-box"), e;
1907
- }), r = S(() => ({ textAlign: t.block.align ?? "center" }));
1908
- return (t, i) => (s(), C("div", { style: k(r.value) }, [M("a", {
1909
- href: e.block.url || "#",
1910
- style: k(n.value),
1911
- class: "tpl:cursor-default",
1912
- onClick: i[0] ||= O(() => {}, ["prevent"])
1913
- }, [v(Pr, { text: e.block.text }, null, 8, ["text"])], 12, Fr)], 4));
1914
- }
1915
- }), Lr = ["innerHTML"], Rr = [
1916
- "src",
1917
- "width",
1918
- "height"
1919
- ], zr = /* @__PURE__ */ d({
1920
- __name: "CustomBlockIcon",
1921
- props: {
1922
- icon: {},
1923
- size: {}
1924
- },
1925
- setup(e) {
1926
- let t = e, n = S(() => t.size ?? 20), r = S(() => t.icon && (t.icon.trimStart().startsWith("<svg") || t.icon.trimStart().startsWith("<SVG"))), i = S(() => t.icon && !r.value && (t.icon.startsWith("http") || t.icon.startsWith("/")));
1927
- return (t, a) => r.value ? (s(), C("span", {
1928
- key: 0,
1929
- class: "tpl:inline-flex tpl:items-center tpl:justify-center",
1930
- style: k({
1931
- width: `${n.value}px`,
1932
- height: `${n.value}px`
1933
- }),
1934
- innerHTML: e.icon
1935
- }, null, 12, Lr)) : i.value ? (s(), C("img", {
1936
- key: 1,
1937
- src: e.icon,
1938
- width: n.value,
1939
- height: n.value,
1940
- class: "tpl:inline-block",
1941
- alt: ""
1942
- }, null, 8, Rr)) : (s(), A(_(nn), {
1943
- key: 2,
1944
- size: n.value,
1945
- "stroke-width": 1.5
1946
- }, null, 8, ["size"]));
1947
- }
1948
- }), Br = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
1949
- function Vr(e, n) {
1950
- let r = on(), i = null, a = null, o = null;
1951
- function s() {
1952
- return e.value ? Array.from(e.value.querySelectorAll(Br)).filter((e) => e.offsetParent !== null) : [];
1953
- }
1954
- function c(e) {
1955
- if (e.key !== "Tab") return;
1956
- let t = s();
1957
- if (t.length === 0) return;
1958
- let n = t[0], i = t[t.length - 1];
1959
- e.shiftKey ? r.activeElement === n && (e.preventDefault(), i.focus()) : r.activeElement === i && (e.preventDefault(), n.focus());
1960
- }
1961
- function l() {
1962
- let t = a !== null || o !== null;
1963
- t && u({ restoreFocus: !1 }), t || (i = r.activeElement), o = requestAnimationFrame(() => {
1964
- o = null;
1965
- let t = s();
1966
- t.length > 0 && (e.value?.querySelector("[autofocus], input:not([disabled])") ?? t[0]).focus();
1967
- }), a = G(e, "keydown", c);
1968
- }
1969
- function u(e = {}) {
1970
- let t = e.restoreFocus !== !1;
1971
- o !== null && (typeof cancelAnimationFrame < "u" && cancelAnimationFrame(o), o = null), a?.(), a = null, t && i && i.focus && (i.focus(), i = null);
1972
- }
1973
- let d = t([n, e], ([e, t]) => {
1974
- e && t ? l() : u();
1975
- }, { flush: "post" });
1976
- h(() => {
1977
- d(), u();
1978
- });
1979
- }
1980
- //#endregion
1981
- //#region src/composables/useEmoji.ts
1982
- function Hr() {
1983
- let [e, n] = Ve(!1), r = x([]), i = !1;
1984
- h(() => {
1985
- i = !0;
1986
- }), t(e, async (e) => {
1987
- if (e && r.value.length === 0) {
1988
- let { emojiCategories: e } = await import("./emojiData-6m0DBh7O.js");
1989
- if (i) return;
1990
- r.value = e;
1991
- }
1992
- });
1993
- function a() {
1994
- n();
1995
- }
1996
- function o() {
1997
- e.value = !1;
1998
- }
1999
- return {
2000
- categories: r,
2001
- isOpen: e,
2002
- toggle: a,
2003
- close: o
2004
- };
2005
- }
2006
- //#endregion
2007
- //#region src/composables/useFonts.ts
2008
- var Ur = [
2009
- {
2010
- value: "Arial",
2011
- label: "Arial"
2012
- },
2013
- {
2014
- value: "Helvetica",
2015
- label: "Helvetica"
2016
- },
2017
- {
2018
- value: "Georgia",
2019
- label: "Georgia"
2020
- },
2021
- {
2022
- value: "Times New Roman",
2023
- label: "Times New Roman"
2024
- },
2025
- {
2026
- value: "Verdana",
2027
- label: "Verdana"
2028
- },
2029
- {
2030
- value: "Trebuchet MS",
2031
- label: "Trebuchet MS"
2032
- },
2033
- {
2034
- value: "Courier New",
2035
- label: "Courier New"
2036
- }
2037
- ], Wr = {
2038
- arial: "Arial, sans-serif",
2039
- helvetica: "Helvetica, sans-serif",
2040
- georgia: "Georgia, serif",
2041
- "times new roman": "'Times New Roman', serif",
2042
- verdana: "Verdana, sans-serif",
2043
- "trebuchet ms": "'Trebuchet MS', sans-serif",
2044
- "courier new": "'Courier New', monospace"
2045
- }, Gr = "Arial, sans-serif";
2046
- function Kr(e) {
2047
- if (e === void 0 || e === !0) return [...Ur];
2048
- if (e === !1) return [];
2049
- let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
2050
- for (let i of e) {
2051
- let e = i.toLowerCase(), a = Ur.find((t) => t.value.toLowerCase() === e);
2052
- if (!a) {
2053
- r.has(e) || (r.add(e), X.warn(`config.fonts.builtIns: "${i}" is not a built-in font — skipping it. Built-in fonts are: ${Ur.map((e) => e.value).join(", ")}.`));
2054
- continue;
2055
- }
2056
- n.has(a.value) || (n.add(a.value), t.push(a));
2057
- }
2058
- return t;
2059
- }
2060
- function qr(e) {
2061
- let t = l(e?.customFonts ?? []), n = l(!1), r = Kr(e?.builtIns), i = S(() => e?.defaultFallback ?? Gr), a = S(() => {
2062
- let e = [...r], n = t.value.map((e) => ({
2063
- value: e.name,
2064
- label: e.name,
2065
- isCustom: !0
2066
- })), i = [...e, ...n];
2067
- return i.sort((e, t) => e.label.localeCompare(t.label)), i;
2068
- });
2069
- function s(e) {
2070
- return a.value.some((t) => t.label.toLowerCase() === e.toLowerCase() || t.value.toLowerCase().startsWith(e.toLowerCase()));
2071
- }
2072
- let c = e?.defaultFont ?? Gr.split(",")[0].trim();
2073
- s(c) || X.warn(`config.fonts: new templates seed "${c}", which the font picker doesn't offer — authors can't reselect it. Either add it to fonts.builtIns, or set fonts.defaultFont to an offered font.`);
2074
- function u() {
2075
- if (e?.defaultFont && s(e.defaultFont)) {
2076
- let t = a.value.find((t) => t.label.toLowerCase() === e.defaultFont.toLowerCase() || t.value.toLowerCase().startsWith(e.defaultFont.toLowerCase()));
2077
- if (t) return t.value;
2078
- }
2079
- return Gr;
2080
- }
2081
- let d = S(() => u());
2082
- function f(e) {
2083
- if (!e) return i.value;
2084
- let n = t.value.find((t) => t.name.toLowerCase() === e.toLowerCase());
2085
- return n ? `'${n.name}', ${n.fallback ?? i.value}` : Wr[e.toLowerCase()] || (e.includes(",") ? e : `${e}, ${i.value}`);
2086
- }
2087
- let p = [], m = !1;
2088
- async function g() {
2089
- if (t.value.length === 0) {
2090
- m || (n.value = !0);
2091
- return;
2092
- }
2093
- let e = t.value.map(async (e) => {
2094
- try {
2095
- if (document.querySelector(`link[data-custom-font="${CSS.escape(e.name)}"]`)) return;
2096
- let t = document.createElement("link");
2097
- t.rel = "stylesheet", t.href = e.url, t.setAttribute("data-custom-font", e.name), p.push(t), await new Promise((n, r) => {
2098
- t.onload = () => n(), t.onerror = () => r(/* @__PURE__ */ Error(`Failed to load font: ${e.name}`)), document.head.appendChild(t);
2099
- });
2100
- } catch (t) {
2101
- X.warn(`Failed to load custom font "${e.name}":`, t);
2102
- }
2103
- });
2104
- await Promise.allSettled(e), !m && (n.value = !0);
2105
- }
2106
- function _() {
2107
- for (let e of p) e.remove();
2108
- p.length = 0;
2109
- }
2110
- return o() && h(() => {
2111
- m = !0, _();
2112
- }), {
2113
- fonts: a,
2114
- defaultFont: d,
2115
- defaultFallback: i,
2116
- customFonts: t,
2117
- isLoaded: n,
2118
- loadCustomFonts: g,
2119
- cleanupFontLinks: _,
2120
- getFontWithFallback: f,
2121
- getDefaultFont: u
2122
- };
2123
- }
2124
- //#endregion
2125
- //#region src/composables/useLogicTag.ts
2126
- function Jr() {
2127
- let e = n(jt, []), t = n(Je, []), r = n(rt, Ne.liquid), i = n(Xe, null), a = n(ct, null), o = n(Ye, null) ?? l(!1), s = !!i || e.length > 0 || t.length > 0, c = e.length > 0 || t.length > 0;
2128
- async function u() {
2129
- if (i) {
2130
- o.value = !0;
2131
- try {
2132
- return await i();
2133
- } finally {
2134
- o.value = !1;
2135
- }
2136
- }
2137
- if (a && c) {
2138
- o.value = !0;
2139
- try {
2140
- return await a.open(e, t);
2141
- } finally {
2142
- o.value = !1;
2143
- }
2144
- }
2145
- return null;
2146
- }
2147
- return {
2148
- logicTags: e,
2149
- logicPairs: t,
2150
- syntax: r,
2151
- canInsertLogicTag: s,
2152
- isRequesting: o,
2153
- requestLogicTag: u
2154
- };
2155
- }
2156
- //#endregion
2157
- //#region src/utils/mergeTagNodeSpec.ts
2158
- function Yr(e, t, n) {
2159
- return ye(e, n) ? {
2160
- type: "logicMergeTagNode",
2161
- attrs: {
2162
- value: e,
2163
- keyword: _e(e, n)
2164
- }
2165
- } : {
2166
- type: "mergeTagNode",
2167
- attrs: {
2168
- label: t,
2169
- value: e
2170
- }
2171
- };
2172
- }
2173
- //#endregion
2174
- //#region src/utils/insertLogicTag.ts
2175
- function Xr(e) {
2176
- return "before" in e && "after" in e;
2177
- }
2178
- function Zr(e, t, n) {
2179
- if (!Xr(t)) {
2180
- e.chain().focus().insertContent(Yr(t.value, t.label, n)).run();
2181
- return;
2182
- }
2183
- let r = Yr(t.before, t.label, n), i = Yr(t.after, t.label, n), { from: a, to: o } = e.state.selection;
2184
- if (a !== o) {
2185
- e.chain().focus().insertContentAt(o, i).insertContentAt(a, r).run();
2186
- return;
2187
- }
2188
- e.chain().focus().insertContentAt(a, [r, i]).setTextSelection(a + 1).run();
2189
- }
2190
- //#endregion
2191
- //#region src/utils/linkColorExtension.ts
2192
- function Qr(e) {
2193
- if (!e) return null;
2194
- let t = e.trim();
2195
- return /^#[0-9a-f]{3,8}$/i.test(t) || /^(rgb|rgba|hsl|hsla)\(\s*[0-9.,%/\s]+\)$/i.test(t) || /^[a-z]+$/i.test(t) ? t : null;
2196
- }
2197
- function $r(e) {
2198
- return e.extend({ addAttributes() {
2199
- return {
2200
- ...this.parent?.(),
2201
- color: {
2202
- default: null,
2203
- parseHTML: (e) => Qr(It(e.style.color)),
2204
- renderHTML: (e) => {
2205
- let t = Qr(e.color);
2206
- return t ? { style: `color: ${t}` } : {};
2207
- }
2208
- }
2209
- };
2210
- } });
2211
- }
2212
- //#endregion
2213
- //#region src/composables/useRichTextLinkDialog.ts
2214
- function ei(e, t = Ne.liquid) {
2215
- let n = l(!1), r = l(""), i = l(""), a = l(null);
2216
- Vr(a, n);
2217
- function o() {
2218
- let t = e.value?.getAttributes("link") ?? {};
2219
- r.value = t.href || "", i.value = t.color || "", n.value = !0;
2220
- }
2221
- function s() {
2222
- if (r.value) {
2223
- let t = d(r.value);
2224
- if (t !== null) {
2225
- let n = Qr(i.value), r = e.value?.chain().focus().extendMarkRange("link").setLink({ href: t }).updateAttributes("link", { color: n });
2226
- n && typeof e.value?.commands.unsetColor == "function" && r?.unsetColor(), r?.run();
2227
- }
2228
- }
2229
- p();
2230
- }
2231
- let c = /* @__PURE__ */ new Set([
2232
- "http",
2233
- "https",
2234
- "mailto",
2235
- "tel",
2236
- "ftp",
2237
- "ftps",
2238
- "sms",
2239
- "xmpp",
2240
- "cid"
2241
- ]);
2242
- function u(e) {
2243
- return RegExp(`^(?:${t.value.source})`).test(e);
2244
- }
2245
- function d(e) {
2246
- let t = e.trim();
2247
- if (!t) return null;
2248
- if (t.startsWith("#")) return t;
2249
- let n = /^([a-z][a-z0-9+.-]*):/i.exec(t);
2250
- return n ? c.has(n[1].toLowerCase()) ? t : null : u(t) ? t : `https://${t}`;
2251
- }
2252
- function f() {
2253
- e.value?.chain().focus().extendMarkRange("link").unsetLink().run(), p();
2254
- }
2255
- function p() {
2256
- n.value = !1, r.value = "", i.value = "";
2257
- }
2258
- function m(e) {
2259
- e.key === "Enter" ? (e.preventDefault(), s()) : e.key === "Escape" && p();
2260
- }
2261
- return {
2262
- showLinkDialog: n,
2263
- linkUrl: r,
2264
- linkColor: i,
2265
- linkDialogRef: a,
2266
- openLinkDialog: o,
2267
- insertLink: s,
2268
- removeLink: f,
2269
- closeLinkDialog: p,
2270
- handleLinkKeydown: m
2271
- };
2272
- }
2273
- //#endregion
2274
- //#region src/composables/useRichTextEditor.ts
2275
- function ti(r) {
2276
- let i = n(J, null), { mergeTags: a, canRequestMergeTag: o, isRequesting: s, requestMergeTag: c, syntax: u, autocomplete: d } = sn(), { canInsertLogicTag: f, isRequesting: p, requestLogicTag: m } = Jr(), h = n(Dt, null), g = (N(h) ? h.value : h)?.mergeTag?.suggestionEmpty ?? "No matching merge tags", _ = De(u), v = x(null), y = () => de(i?.content?.value?.settings ?? { locale: "en" });
2277
- t(y, (e) => {
2278
- let t = v.value?.view.dom;
2279
- t && t.setAttribute("dir", e);
2280
- });
2281
- let { showLinkDialog: b, linkUrl: S, linkColor: C, linkDialogRef: w, openLinkDialog: T, insertLink: E, removeLink: D, closeLinkDialog: O, handleLinkKeydown: k } = ei(v, u), { start: A, stop: j } = ze(() => v.value?.commands.focus("end"), 0, { immediate: !1 }), M = x(null), P = l(!0), F = l(null), I = !1;
2282
- async function L() {
2283
- F.value = null, P.value = !0;
2284
- try {
2285
- let { TiptapEditor: e, EC: t, extensions: n } = await r.loadExtensions({
2286
- mergeTags: a,
2287
- syntax: u,
2288
- triggerChar: _,
2289
- autocompleteEnabled: d,
2290
- suggestionEmptyText: g
2291
- });
2292
- if (I) return;
2293
- M.value = t;
2294
- let o = /* @__PURE__ */ new Map();
2295
- n.forEach((e, t) => o.set(e.name, t));
2296
- let s = new e({
2297
- extensions: n.filter((e, t) => o.get(e.name) === t),
2298
- content: r.blockContent(),
2299
- editable: !0,
2300
- editorProps: { attributes: { dir: y() } },
2301
- onUpdate: ({ editor: e }) => {
2302
- I || i && i.updateBlock(r.blockId(), { content: e.getHTML() });
2303
- }
2304
- });
2305
- if (I) {
2306
- s.destroy();
2307
- return;
2308
- }
2309
- v.value = s, P.value = !1, A();
2310
- } catch (e) {
2311
- if (I) return;
2312
- X.error(`[${r.editorName ?? "RichTextEditor"}] Failed to initialize TipTap editor:`, e), F.value = e instanceof Error ? e.message : "Failed to load editor", P.value = !1;
2313
- }
2314
- }
2315
- function R() {
2316
- v.value?.destroy(), v.value = null, L();
2317
- }
2318
- L();
2319
- let z = t(() => r.blockContent(), (e) => {
2320
- v.value && v.value.getHTML() !== e && v.value.commands.setContent(e, { emitUpdate: !1 });
2321
- });
2322
- function B(e) {
2323
- if (s.value || p.value) return;
2324
- let t = e.composedPath(), n = t.find((e) => e instanceof HTMLElement);
2325
- if (!n) return;
2326
- r.onClickOutsideSideEffect?.(n);
2327
- let i = t.some((e) => e instanceof HTMLElement && e.classList.contains("tpl-color-popover"));
2328
- n.closest(".tpl-text-editor-wrapper") || n.closest(".tpl-text-toolbar") || n.closest(".tpl-link-dialog") || i || r.onDone();
2329
- }
2330
- G(document, "mousedown", B), e(() => {
2331
- I = !0, z(), j(), v.value?.destroy();
2332
- });
2333
- async function V() {
2334
- let e = await c();
2335
- I || (e && v.value ? v.value.chain().focus().insertMergeTag({
2336
- label: e.label,
2337
- value: e.value
2338
- }).run() : v.value?.commands.focus());
2339
- }
2340
- async function H() {
2341
- let e = await m();
2342
- I || (e && v.value ? Zr(v.value, e, u) : v.value?.commands.focus());
2343
- }
2344
- return {
2345
- editor: v,
2346
- EditorContent: M,
2347
- isLoading: P,
2348
- initError: F,
2349
- retry: R,
2350
- showLinkDialog: b,
2351
- linkUrl: S,
2352
- linkColor: C,
2353
- linkDialogRef: w,
2354
- mergeTags: a,
2355
- canRequestMergeTag: o,
2356
- isRequestingMergeTag: s,
2357
- syntax: u,
2358
- canInsertLogicTag: f,
2359
- isRequestingLogicTag: p,
2360
- openLinkDialog: T,
2361
- insertLink: E,
2362
- removeLink: D,
2363
- closeLinkDialog: O,
2364
- handleLinkKeydown: k,
2365
- handleAddMergeTag: V,
2366
- handleAddLogicTag: H
2367
- };
2368
- }
2369
- //#endregion
2370
- //#region src/composables/useSmallScreenNotice.ts
2371
- var ni = "(max-width: 767px)";
2372
- function ri(e) {
2373
- let t = Ue(ni);
2374
- return {
2375
- isSmallScreen: t,
2376
- showNotice: S(() => (P(e) ?? !0) && t.value)
2377
- };
2378
- }
2379
- //#endregion
2380
- //#region src/components/blocks/CustomBlock.vue?vue&type=script&setup=true&lang.ts
2381
- var ii = { class: "tpl:w-full" }, ai = {
2382
- key: 0,
2383
- class: "tpl:flex tpl:min-h-[80px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:border-[var(--tpl-warning)] tpl:bg-[var(--tpl-warning-light)]"
2384
- }, oi = { class: "tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, si = {
2385
- key: 1,
2386
- class: "tpl:flex tpl:min-h-[80px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:border-[var(--tpl-danger)] tpl:bg-[var(--tpl-danger-light)]"
2387
- }, ci = { class: "tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, li = {
2388
- key: 2,
2389
- class: "tpl:relative"
2390
- }, ui = ["innerHTML"], di = {
2391
- key: 0,
2392
- class: "tpl:absolute tpl:inset-0 tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-3 tpl:rounded tpl:backdrop-blur-[2px]",
2393
- style: { "background-color": "color-mix(in srgb, var(--tpl-bg) 80%, transparent)" }
2394
- }, fi = /* @__PURE__ */ d({
2395
- __name: "CustomBlock",
2396
- props: {
2397
- block: {},
2398
- viewport: {}
2399
- },
2400
- emits: ["fetchData"],
2401
- setup(e, { emit: r }) {
2402
- let i = e, a = r, { t: o } = Y(), c = n(kt, null), u = l(""), d = l(!1), f = S(() => c?.getDefinition(i.block.customType)), p = S(() => !!f.value), { isFetching: m, fetch: h, needsFetch: g, hasDataSource: y } = Sn({
2403
- definition: f,
2404
- block: S(() => i.block),
2405
- onUpdate: (e, t) => {
2406
- a("fetchData", {
2407
- fieldValues: e,
2408
- dataSourceFetched: t
2409
- });
2410
- }
2411
- }), b = n(K, at), x = n(q, null), T = S(() => {
2412
- if (!x?.value) return i.block;
2413
- let e = {};
2414
- for (let [t, n] of Object.entries(i.block.fieldValues)) e[t] = typeof n == "string" ? ge(n, b.value) : n;
2415
- return {
2416
- ...i.block,
2417
- fieldValues: e
2418
- };
2419
- });
2420
- async function D() {
2421
- if (c) {
2422
- d.value = !1;
2423
- try {
2424
- let e = await c.renderCustomBlock(T.value);
2425
- e.includes("Template render error:") && (d.value = !0), u.value = e;
2426
- } catch {
2427
- d.value = !0, u.value = "";
2428
- }
2429
- }
2430
- }
2431
- let k = Be(D, 150);
2432
- return E(() => {
2433
- D();
2434
- }), t(() => i.block.fieldValues, () => {
2435
- k();
2436
- }, { deep: !0 }), t(() => x?.value, () => {
2437
- k();
2438
- }), (e, t) => (s(), C("div", ii, [p.value ? d.value ? (s(), C("div", si, [v(_($t), {
2439
- size: 24,
2440
- class: "tpl:text-[var(--tpl-danger)]"
2441
- }), M("span", ci, R(_(o).customBlocks.renderError), 1)])) : (s(), C("div", li, [M("div", { innerHTML: u.value }, null, 8, ui), _(y) && _(g) ? (s(), C("div", di, [_(m) ? (s(), A(rn, {
2442
- key: 1,
2443
- class: "tpl:w-48"
2444
- })) : (s(), C("button", {
2445
- key: 0,
2446
- type: "button",
2447
- class: "tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-2 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:px-4 tpl:py-2 tpl:text-sm tpl:font-semibold tpl:shadow-[var(--tpl-shadow)] tpl:transition-all tpl:hover:border-[var(--tpl-primary)] tpl:hover:shadow-[var(--tpl-shadow-md)] tpl:bg-[var(--tpl-primary-light)] tpl:text-[var(--tpl-primary-hover)]",
2448
- onClick: t[0] ||= O((...e) => _(h) && _(h)(...e), ["stop"])
2449
- }, [f.value?.icon ? (s(), A(zr, {
2450
- key: 0,
2451
- icon: f.value.icon,
2452
- size: 16
2453
- }, null, 8, ["icon"])) : w("", !0), V(" " + R(f.value?.dataSource?.label || _(o).customBlocks.dataSource.fetchButton), 1)]))])) : w("", !0)])) : (s(), C("div", ai, [v(_(Ht), {
2454
- size: 24,
2455
- class: "tpl:text-[var(--tpl-warning)]"
2456
- }), M("span", oi, R(_(o).customBlocks.definitionNotFound), 1)]))]));
2457
- }
2458
- }), pi = { class: "tpl:w-full" }, mi = /* @__PURE__ */ d({
2459
- __name: "DividerBlock",
2460
- props: {
2461
- block: {},
2462
- viewport: {}
2463
- },
2464
- setup(e) {
2465
- let t = e, n = S(() => ({
2466
- borderTop: `${t.block.thickness}px ${t.block.lineStyle} ${t.block.color}`,
2467
- width: t.block.width === "full" ? "100%" : `${t.block.width}px`,
2468
- margin: t.block.width === "full" ? "0" : "0 auto"
2469
- }));
2470
- return (e, t) => (s(), C("div", pi, [M("hr", {
2471
- class: "tpl:m-0 tpl:border-none",
2472
- style: k(n.value)
2473
- }, null, 4)]));
2474
- }
2475
- }), hi = { class: "tpl:w-full" }, gi = ["srcdoc", "title"], _i = {
2476
- key: 1,
2477
- class: "tpl:flex tpl:min-h-[80px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-hover)]"
2478
- }, vi = {
2479
- key: 0,
2480
- class: "tpl:text-sm tpl:text-[var(--tpl-text-muted)]"
2481
- }, yi = {
2482
- key: 1,
2483
- class: "tpl:text-sm tpl:text-[var(--tpl-text-dim)]"
2484
- }, bi = /* @__PURE__ */ d({
2485
- __name: "HtmlBlock",
2486
- props: {
2487
- block: {},
2488
- viewport: {}
2489
- },
2490
- setup(r) {
2491
- let i = r, { t: a } = Y(), o = n(ht, !1), c = S(() => i.block.content.trim().length > 0), u = S(() => o && c.value), d = n(K, at), f = n(q, null), p = S(() => f?.value ? ge(i.block.content, d.value) : i.block.content), m = l(null), h = l(60), g = null;
2492
- function y() {
2493
- let e = m.value?.contentDocument;
2494
- e && (h.value = Math.max(e.body?.scrollHeight ?? 0, e.documentElement?.scrollHeight ?? 0));
2495
- }
2496
- function b() {
2497
- g?.disconnect(), g = null, y();
2498
- let e = m.value?.contentDocument?.documentElement;
2499
- e && typeof ResizeObserver < "u" && (g = new ResizeObserver(() => y()), g.observe(e));
2500
- }
2501
- return t(u, (e) => {
2502
- e || (g?.disconnect(), g = null);
2503
- }), e(() => {
2504
- g?.disconnect(), g = null;
2505
- }), (e, t) => (s(), C("div", hi, [u.value ? (s(), C("iframe", {
2506
- key: 0,
2507
- ref_key: "iframeRef",
2508
- ref: m,
2509
- srcdoc: p.value,
2510
- sandbox: "allow-same-origin",
2511
- title: _(a).html.preview,
2512
- class: "tpl:block tpl:w-full tpl:border-0",
2513
- style: k({ height: `${h.value}px` }),
2514
- onLoad: b
2515
- }, null, 44, gi)) : (s(), C("div", _i, [v(_(Ut), {
2516
- size: 24,
2517
- class: "tpl:text-[var(--tpl-text-dim)]"
2518
- }), c.value ? (s(), C("span", vi, R(_(a).html.preview), 1)) : (s(), C("span", yi, R(_(a).html.empty), 1))]))]));
2519
- }
2520
- }), xi = "image/";
2521
- function Si(e) {
2522
- let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || P(r), { isOverDropZone: a } = Ge(t, {
2523
- preventDefaultForUnhandled: !0,
2524
- onDrop: (e) => {
2525
- if (!i()) return;
2526
- let t = (e ?? []).filter((e) => e.type.startsWith(xi));
2527
- t.length > 0 && n([t[0]]);
2528
- }
2529
- });
2530
- return { isOver: S(() => i() && a.value) };
2531
- }
2532
- //#endregion
2533
- //#region src/components/blocks/ImageBlock.vue?vue&type=script&setup=true&lang.ts
2534
- var Ci = ["data-drop-enabled"], wi = {
2535
- key: 0,
2536
- class: "tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-xs tpl:font-medium tpl:border-[var(--tpl-primary)] tpl:text-[var(--tpl-primary)]",
2537
- style: { "background-color": "color-mix(in srgb, var(--tpl-bg) 85%, transparent)" }
2538
- }, Ti = ["href"], Ei = ["src", "alt"], Di = ["src", "alt"], Oi = {
2539
- class: "tpl:max-w-full tpl:truncate tpl:px-3 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-primary)]",
2540
- style: { opacity: "0.7" }
2541
- }, ki = ["href"], Ai = ["src", "alt"], ji = ["src", "alt"], Mi = {
2542
- key: 4,
2543
- class: "tpl:flex tpl:min-h-[100px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-sm tpl:border-[var(--tpl-border-light)] tpl:bg-[var(--tpl-bg-hover)] tpl:text-[var(--tpl-text-dim)]"
2544
- }, Ni = ["aria-label"], Pi = { key: 1 }, Fi = /* @__PURE__ */ d({
2545
- __name: "ImageBlock",
2546
- props: {
2547
- block: {},
2548
- viewport: {}
2549
- },
2550
- emits: ["update"],
2551
- setup(e, { emit: t }) {
2552
- let r = e, i = t, { t: a } = Y(), { syntax: o } = sn(), c = n(Qe, null), u = n(gt, null), d = S(() => !!c), f = cn();
2553
- async function p() {
2554
- let e = await c?.({ accept: ["images"] });
2555
- if (f.alive && e) {
2556
- let t = { src: e.url };
2557
- e.alt && (t.alt = e.alt), i("update", t);
2558
- }
2559
- }
2560
- let m = l(), h = l(!1), g = S(() => (u?.value ?? !!c) && !h.value && !E.value);
2561
- async function y(e) {
2562
- if (c) {
2563
- h.value = !0;
2564
- try {
2565
- let t = await c({
2566
- accept: ["images"],
2567
- files: e
2568
- });
2569
- if (!f.alive) return;
2570
- if (t) {
2571
- let e = { src: t.url };
2572
- t.alt && (e.alt = t.alt), i("update", e);
2573
- }
2574
- } finally {
2575
- f.alive && (h.value = !1);
2576
- }
2577
- }
2578
- }
2579
- let { isOver: b } = Si({
2580
- target: m,
2581
- enabled: g,
2582
- onFiles: y
2583
- }), x = S(() => ({ textAlign: r.block.align })), T = S(() => {
2584
- let e = r.block.align;
2585
- return {
2586
- maxWidth: "100%",
2587
- width: r.block.width === "full" ? "100%" : `${r.block.width}px`,
2588
- height: r.block.height ? `${r.block.height}px` : void 0,
2589
- borderRadius: r.block.borderRadius && r.block.borderRadius > 0 ? `${r.block.borderRadius}px` : void 0,
2590
- display: "block",
2591
- marginLeft: e === "center" || e === "right" ? "auto" : void 0,
2592
- marginRight: e === "center" ? "auto" : void 0
2593
- };
2594
- }), E = S(() => Ce(r.block.src, o)), D = zn(() => E.value ? void 0 : r.block.src), A = zn(() => E.value ? r.block.placeholderUrl : void 0);
2595
- return (t, n) => (s(), C("div", {
2596
- ref_key: "dropZoneRef",
2597
- ref: m,
2598
- "data-testid": "image-drop-zone",
2599
- "data-drop-enabled": g.value,
2600
- class: "tpl:relative tpl:w-full",
2601
- style: k(x.value)
2602
- }, [g.value && (_(b) || h.value) ? (s(), C("div", wi, [h.value ? (s(), C(L, { key: 0 }, [v(_(Yt), {
2603
- class: "tpl-spinner",
2604
- size: 20,
2605
- "stroke-width": 2
2606
- }), V(" " + R(_(a).image.uploading), 1)], 64)) : (s(), C(L, { key: 1 }, [v(_(Zt), {
2607
- size: 20,
2608
- "stroke-width": 1.5
2609
- }), V(" " + R(_(a).image.dropToUpload), 1)], 64))])) : w("", !0), e.block.src && E.value && e.block.placeholderUrl ? (s(), C(L, { key: 1 }, [e.block.linkUrl ? (s(), C("a", {
2610
- key: 0,
2611
- href: e.block.linkUrl,
2612
- target: "_blank",
2613
- rel: "noopener noreferrer",
2614
- onClick: n[0] ||= O(() => {}, ["prevent"])
2615
- }, [M("img", {
2616
- class: "tpl:border-0",
2617
- loading: "lazy",
2618
- src: _(A),
2619
- alt: e.block.alt || _(a).image.altTextPlaceholder,
2620
- style: k(T.value)
2621
- }, null, 12, Ei)], 8, Ti)) : (s(), C("img", {
2622
- key: 1,
2623
- class: "tpl:border-0",
2624
- src: _(A),
2625
- alt: e.block.alt,
2626
- style: k(T.value)
2627
- }, null, 12, Di))], 64)) : e.block.src && E.value ? (s(), C("div", {
2628
- key: 2,
2629
- class: "tpl:!flex tpl:min-h-[120px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-center tpl:bg-[var(--tpl-bg-elevated)]",
2630
- style: k([{ "border-color": "color-mix(in srgb, var(--tpl-primary) 40%, transparent)" }, T.value])
2631
- }, [v(_(qt), {
2632
- size: 32,
2633
- "stroke-width": 1.5,
2634
- class: "tpl:text-[var(--tpl-primary)]",
2635
- style: { opacity: "0.5" }
2636
- }), M("span", Oi, [v(Pr, { text: e.block.src }, null, 8, ["text"])])], 4)) : e.block.src ? (s(), C(L, { key: 3 }, [e.block.linkUrl ? (s(), C("a", {
2637
- key: 0,
2638
- href: e.block.linkUrl,
2639
- target: "_blank",
2640
- rel: "noopener noreferrer",
2641
- onClick: n[1] ||= O(() => {}, ["prevent"])
2642
- }, [M("img", {
2643
- class: "tpl:border-0",
2644
- loading: "lazy",
2645
- src: _(D),
2646
- alt: e.block.alt || _(a).image.altTextPlaceholder,
2647
- style: k(T.value)
2648
- }, null, 12, Ai)], 8, ki)) : (s(), C("img", {
2649
- key: 1,
2650
- class: "tpl:border-0",
2651
- src: _(D),
2652
- alt: e.block.alt,
2653
- style: k(T.value)
2654
- }, null, 12, ji))], 64)) : (s(), C("div", Mi, [d.value ? (s(), C("button", {
2655
- key: 0,
2656
- "aria-label": _(a).image.browseMedia,
2657
- class: "tpl:flex tpl:items-center tpl:gap-1.5 tpl:rounded-md tpl:border tpl:px-3 tpl:py-2 tpl:text-xs tpl:font-medium tpl:transition-all tpl:cursor-pointer tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-primary)] tpl:bg-[var(--tpl-bg)]",
2658
- onClick: O(p, ["stop"])
2659
- }, [v(_(qt), {
2660
- size: 14,
2661
- "stroke-width": 1.5
2662
- }), V(" " + R(_(a).image.browseMedia), 1)], 8, Ni)) : (s(), C("span", Pi, R(_(a).image.clickToAdd), 1))]))], 12, Ci));
2663
- }
2664
- }), Ii = { class: "tpl:w-full" }, Li = ["href"], Ri = {
2665
- key: 1,
2666
- class: "tpl:flex tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:text-sm tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text-dim)]"
2667
- }, zi = /* @__PURE__ */ d({
2668
- __name: "MenuBlock",
2669
- props: {
2670
- block: {},
2671
- viewport: {}
2672
- },
2673
- setup(e) {
2674
- let t = e, { t: n } = Y(), i = S(() => ({
2675
- display: "flex",
2676
- flexWrap: "wrap",
2677
- gap: `0 ${t.block.spacing}px`,
2678
- justifyContent: t.block.textAlign === "left" ? "flex-start" : t.block.textAlign === "right" ? "flex-end" : "center",
2679
- fontSize: `${t.block.fontSize}px`,
2680
- fontFamily: t.block.fontFamily || "inherit",
2681
- alignItems: "center"
2682
- })), a = S(() => t.block.items.length > 0);
2683
- function o(e) {
2684
- return e || t.block.linkColor || t.block.color;
2685
- }
2686
- return (t, c) => (s(), C("div", Ii, [a.value ? (s(), C("div", {
2687
- key: 0,
2688
- style: k(i.value)
2689
- }, [(s(!0), C(L, null, r(e.block.items, (t, n) => (s(), C(L, { key: t.id }, [M("a", {
2690
- href: t.url || "#",
2691
- class: "tpl:cursor-default tpl:no-underline",
2692
- style: k({
2693
- color: o(t.color),
2694
- fontWeight: t.bold ? "bold" : "normal",
2695
- textDecoration: t.underline ? "underline" : "none"
2696
- }),
2697
- onClick: c[0] ||= O(() => {}, ["prevent"])
2698
- }, [v(Pr, { text: t.text || "..." }, null, 8, ["text"])], 12, Li), n < e.block.items.length - 1 ? (s(), C("span", {
2699
- key: 0,
2700
- style: k({
2701
- color: e.block.separatorColor,
2702
- padding: `0 ${e.block.spacing}px`
2703
- })
2704
- }, R(e.block.separator), 5)) : w("", !0)], 64))), 128))], 4)) : (s(), C("div", Ri, [v(_(Gt), { size: 16 }), M("span", null, R(_(n).menu.addLinks), 1)]))]));
2705
- }
2706
- }), Bi = /* @__PURE__ */ new Set([
2707
- "http",
2708
- "https",
2709
- "mailto",
2710
- "tel",
2711
- "ftp",
2712
- "ftps",
2713
- "sms",
2714
- "xmpp",
2715
- "cid"
2716
- ]), Vi = /* @__PURE__ */ new Set([
2717
- "SCRIPT",
2718
- "STYLE",
2719
- "IFRAME",
2720
- "OBJECT",
2721
- "EMBED",
2722
- "LINK",
2723
- "META",
2724
- "BASE",
2725
- "FORM"
2726
- ]), Hi = /* @__PURE__ */ new Set([
2727
- "href",
2728
- "xlink:href",
2729
- "formaction",
2730
- "action",
2731
- "ping",
2732
- "background",
2733
- "poster"
2734
- ]);
2735
- function Ui(e, t) {
2736
- let n = e.replace(/[\t\n\r]/g, "").replace(/^[\u0000-\u0020]+/, "").trimEnd();
2737
- if (!n || n.startsWith("#")) return !0;
2738
- let r = /^([a-z][a-z0-9+.-]*):/i.exec(n);
2739
- if (!r) return !0;
2740
- let i = r[1].toLowerCase();
2741
- return Bi.has(i) ? !0 : t && i === "data" ? /^data:image\/(png|jpe?g|gif|webp|svg\+xml);/i.test(n) : !1;
2742
- }
2743
- function Wi(e) {
2744
- if (Vi.has(e.tagName)) {
2745
- e.remove();
2746
- return;
2747
- }
2748
- let t = [];
2749
- for (let n = 0; n < e.attributes.length; n++) t.push(e.attributes[n].name);
2750
- for (let n of t) {
2751
- let t = n.toLowerCase();
2752
- if (t.startsWith("on")) {
2753
- e.removeAttribute(n);
2754
- continue;
2755
- }
2756
- if (Hi.has(t)) {
2757
- Ui(e.getAttribute(n) ?? "", !1) || e.removeAttribute(n);
2758
- continue;
2759
- }
2760
- if (t === "src") {
2761
- Ui(e.getAttribute(n) ?? "", !0) || e.removeAttribute(n);
2762
- continue;
2763
- }
2764
- t === "srcdoc" && e.removeAttribute(n);
2765
- }
2766
- let n = Array.from(e.children);
2767
- for (let e of n) Wi(e);
2768
- }
2769
- function Gi(e) {
2770
- if (typeof DOMParser > "u") return e;
2771
- let t = new DOMParser().parseFromString(`<!doctype html><body>${e}</body>`, "text/html").body, n = Array.from(t.children);
2772
- for (let e of n) Wi(e);
2773
- return t.innerHTML;
2774
- }
2775
- //#endregion
2776
- //#region src/composables/useEditableTextBlock.ts
2777
- function Ki(e) {
2778
- let t = n(K, at), r = n(q, null), { syntax: i } = sn(), a = S(() => r?.value ? xe(e(), t.value) : Oe(e(), t.value)), o = S(() => Gi(Me(a.value, i))), s = l(!1), c = l(null), { top: u, left: d } = We(c), { toLocal: f } = Rt(), p = S(() => f({
2779
- top: u.value - 8,
2780
- left: d.value
2781
- }));
2782
- function m() {
2783
- s.value = !0;
2784
- }
2785
- function h() {
2786
- s.value = !1;
2787
- }
2788
- return {
2789
- isEditing: s,
2790
- blockRef: c,
2791
- toolbarPosition: p,
2792
- resolvedContent: o,
2793
- handleDoubleClick: m,
2794
- handleEditorDone: h
2795
- };
2796
- }
2797
- //#endregion
2798
- //#region src/components/blocks/ParagraphBlock.vue?vue&type=script&setup=true&lang.ts
2799
- var qi = ["innerHTML"], Ji = /* @__PURE__ */ d({
2800
- __name: "ParagraphBlock",
2801
- props: {
2802
- block: {},
2803
- viewport: {}
2804
- },
2805
- setup(e) {
2806
- let t = e, n = B(() => import("./ParagraphEditor-D1tsPv4v.js")), { isEditing: r, blockRef: i, toolbarPosition: a, resolvedContent: o, handleDoubleClick: c, handleEditorDone: l } = Ki(() => t.block.content);
2807
- return (t, u) => (s(), C("div", {
2808
- ref_key: "blockRef",
2809
- ref: i,
2810
- class: "tpl:min-h-[1em] tpl:w-full",
2811
- onDblclick: u[0] ||= (...e) => _(c) && _(c)(...e)
2812
- }, [_(r) ? (s(), A(_(n), {
2813
- key: 0,
2814
- block: e.block,
2815
- "toolbar-position": _(a),
2816
- onDone: _(l)
2817
- }, null, 8, [
2818
- "block",
2819
- "toolbar-position",
2820
- "onDone"
2821
- ])) : (s(), C("div", {
2822
- key: 1,
2823
- class: "tpl-text-content tpl:outline-none",
2824
- innerHTML: _(o)
2825
- }, null, 8, qi))], 544));
2826
- }
2827
- });
2828
- //#endregion
2829
- //#region src/utils/blockComponentResolver.ts
2830
- function Yi(e) {
2831
- let t = { fontFamily: e.fontFamily };
2832
- return e.textColor && (t.color = e.textColor), e.linkColor && (t["--tpl-doc-link-color"] = e.linkColor), e.linkUnderline && (t["--tpl-doc-link-underline"] = "underline"), t;
2833
- }
2834
- function Xi(e, t, n) {
2835
- if (t) {
2836
- let n = t.getComponent(e);
2837
- if (n) return n;
2838
- }
2839
- return n[e.type] ?? null;
2840
- }
2841
- function Zi(e) {
2842
- let { padding: t, backgroundColor: n } = e.styles, r = {
2843
- padding: `${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`,
2844
- backgroundColor: n || "transparent"
2845
- };
2846
- return (e.type === "paragraph" || e.type === "title") && (r["--tpl-doc-paragraph-spacing"] = `${e.type === "paragraph" ? e.paragraphSpacing ?? we.paragraphGap : we.paragraphGap}px`), e.type === "section" && e.borderRadius && e.borderRadius > 0 && (r.borderRadius = `${e.borderRadius}px`), r;
2847
- }
2848
- function Qi(e) {
2849
- if (e.type !== "section" || !e.wrapper) return null;
2850
- let t = e.wrapper, n = {};
2851
- return t.backgroundColor && (n.backgroundColor = t.backgroundColor), t.padding && (n.padding = `${t.padding.top}px ${t.padding.right}px ${t.padding.bottom}px ${t.padding.left}px`), t.borderRadius && t.borderRadius > 0 && (n.borderRadius = `${t.borderRadius}px`), n;
2852
- }
2853
- //#endregion
2854
- //#region src/components/blocks/BlockWrapper.vue?vue&type=script&setup=true&lang.ts
2855
- var $i = [
2856
- "data-block-id",
2857
- "data-block-type",
2858
- "data-tpl-picked"
2859
- ], ea = ["aria-label"], ta = [
2860
- "aria-label",
2861
- "aria-pressed",
2862
- "title"
2863
- ], na = ["aria-label", "title"], ra = ["aria-label", "title"], ia = ["aria-label", "title"], aa = {
2864
- key: 1,
2865
- class: "tpl-block-hidden-overlay tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:z-[5] tpl:flex tpl:items-center tpl:justify-center tpl:rounded-sm"
2866
- }, oa = { class: "tpl:flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-2 tpl:py-1 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-chrome-bg-elevated)] tpl:text-[var(--tpl-chrome-text-muted)] tpl:shadow-[var(--tpl-shadow-sm)]" }, sa = {
2867
- key: 2,
2868
- class: "tpl:absolute tpl:-left-1 tpl:top-1/2 tpl:z-[5] tpl:-translate-x-full tpl:-translate-y-1/2"
2869
- }, ca = ["aria-label", "title"], la = {
2870
- key: 3,
2871
- class: "tpl:absolute tpl:-right-1 tpl:-top-1 tpl:z-[5] tpl:translate-x-full"
2872
- }, ua = ["aria-label"], da = /*#__PURE__*/ an(/* @__PURE__ */ d({
2873
- __name: "BlockWrapper",
2874
- props: {
2875
- block: {},
2876
- isSelected: { type: Boolean },
2877
- viewport: {},
2878
- previewMode: { type: Boolean },
2879
- nested: { type: Boolean },
2880
- picked: { type: Boolean }
2881
- },
2882
- emits: ["select"],
2883
- setup(e, { emit: t }) {
2884
- let r = B(() => import("./BlockIssueBadge-B6PpoOPv.js")), i = e, o = t, { t: c, format: u } = Y(), d = n(st, null), f = l(null), p = S(() => d?.liftedBlockId.value === i.block.id), m = S(() => p.value ? u(c.blockActions.dragLifted, { block: i.block.type }) : c.blockActions.drag);
2885
- async function h() {
2886
- await D(), f.value?.focus();
2887
- }
2888
- function g(e) {
2889
- if (d) {
2890
- if (e.key === " " || e.key === "Enter") {
2891
- e.preventDefault(), e.stopPropagation(), p.value ? d.drop(i.block.id) : d.lift(i.block.id);
2892
- return;
2893
- }
2894
- if (p.value) {
2895
- if (e.key === "Escape") {
2896
- e.preventDefault(), e.stopPropagation(), d.cancel(), h();
2897
- return;
2898
- }
2899
- if (e.key === "ArrowUp") {
2900
- e.preventDefault(), e.stopPropagation(), d.moveUp(i.block.id), h();
2901
- return;
2902
- }
2903
- e.key === "ArrowDown" && (e.preventDefault(), e.stopPropagation(), d.moveDown(i.block.id), h());
2904
- }
2905
- }
2906
- }
2907
- let y = S(() => !i.viewport || !i.block.visibility ? !1 : i.block.visibility[i.viewport] === !1), x = S(() => i.previewMode === !0 && y.value), T = S(() => i.viewport ? {
2908
- desktop: c.viewport.desktop,
2909
- mobile: c.viewport.mobile
2910
- }[i.viewport] ?? i.viewport : ""), E = S(() => !!i.block.displayCondition), A = n(mt, null), j = n(vt, null), N = n(St, {}), P = S(() => N.savedBlocks?.isPicking.value === !0), F = S(() => !i.nested && N.savedBlocks?.isAvailable.value === !0 && N.savedBlocks?.canCreate.value === !0), I = S(() => i.isSelected && !P.value), L = S(() => N.comments?.getBlockCount(i.block.id) ?? 0), z = S(() => Zi(i.block)), H = S(() => Qi(i.block));
2911
- function ee(e) {
2912
- i.previewMode || (e.target?.closest("a") && e.preventDefault(), e.stopPropagation(), o("select"));
2913
- }
2914
- function te() {
2915
- A?.deleteBlock(i.block.id);
2916
- }
2917
- function ne() {
2918
- A?.duplicateBlock(i.block);
2919
- }
2920
- function re() {
2921
- N.savedBlocks?.startPicking(i.block.id);
2922
- }
2923
- function ie() {
2924
- j?.toggleBlock(i.block.id);
2925
- }
2926
- return (t, n) => x.value ? w("", !0) : (s(), C("div", {
2927
- key: 0,
2928
- class: b(["tpl-block tpl:group tpl:relative tpl:cursor-pointer tpl:rounded-sm tpl:transition-shadow", {
2929
- "tpl-block--selected": e.isSelected,
2930
- "tpl-block--picked": e.picked,
2931
- "tpl-block--idle": !e.isSelected && !e.picked,
2932
- "tpl-block--lifted": p.value
2933
- }]),
2934
- "data-block-id": e.block.id,
2935
- "data-block-type": e.block.type,
2936
- "data-tpl-picked": e.picked || void 0,
2937
- onClick: ee
2938
- }, [
2939
- v(_(r), { "block-id": e.block.id }, null, 8, ["block-id"]),
2940
- I.value ? (s(), C("div", {
2941
- key: 0,
2942
- role: "toolbar",
2943
- "aria-label": _(c).blockActions.drag,
2944
- class: "tpl-block-actions tpl-fade-in tpl:absolute tpl:-right-2 tpl:top-1/2 tpl:z-10 tpl:flex tpl:-translate-y-1/2 tpl:translate-x-full tpl:gap-0.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:p-1 tpl:bg-[var(--tpl-chrome-bg-elevated)] tpl:shadow-[var(--tpl-shadow-md)] tpl:border tpl:border-[var(--tpl-border)]"
2945
- }, [
2946
- M("button", {
2947
- ref_key: "dragButtonRef",
2948
- ref: f,
2949
- class: "tpl-block-btn tpl-block-action-btn tpl:flex tpl:size-7 tpl:cursor-grab tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors tpl:active:cursor-grabbing",
2950
- "aria-label": m.value,
2951
- "aria-pressed": p.value,
2952
- "aria-keyshortcuts": "Space Enter ArrowUp ArrowDown Escape",
2953
- title: _(c).blockActions.drag,
2954
- onKeydown: g
2955
- }, [v(_(Jt), {
2956
- size: 14,
2957
- "stroke-width": 1.5
2958
- })], 40, ta),
2959
- M("button", {
2960
- class: "tpl-block-action-btn tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors",
2961
- "aria-label": _(c).blockActions.duplicate,
2962
- title: _(c).blockActions.duplicate,
2963
- onClick: O(ne, ["stop"])
2964
- }, [v(_(Vt), {
2965
- size: 14,
2966
- "stroke-width": 1.5
2967
- })], 8, na),
2968
- F.value ? (s(), C("button", {
2969
- key: 0,
2970
- class: "tpl-block-action-btn tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors",
2971
- "aria-label": _(c).blockActions.saveAsBlock,
2972
- title: _(c).blockActions.saveAsBlock,
2973
- onClick: O(re, ["stop"])
2974
- }, [v(_(Bt), {
2975
- size: 14,
2976
- "stroke-width": 1.5
2977
- })], 8, ra)) : w("", !0),
2978
- M("button", {
2979
- class: "tpl-block-action-btn tpl-block-delete-btn tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors",
2980
- "aria-label": _(c).blockActions.delete,
2981
- title: _(c).blockActions.delete,
2982
- onClick: O(te, ["stop"])
2983
- }, [v(_(Kt), {
2984
- size: 14,
2985
- "stroke-width": 1.5
2986
- })], 8, ia)
2987
- ], 8, ea)) : w("", !0),
2988
- y.value ? (s(), C("div", aa, [M("span", oa, [v(_(Wt), {
2989
- size: 12,
2990
- "stroke-width": 1.5
2991
- }), V(" " + R(_(u)(_(c).blockActions.hiddenOnViewport, { viewport: T.value })), 1)])])) : w("", !0),
2992
- E.value && !y.value ? (s(), C("div", sa, [M("button", {
2993
- "data-testid": "condition-toggle",
2994
- class: "tpl-condition-toggle tpl:flex tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:p-1 tpl:transition-colors tpl:bg-[var(--tpl-chrome-bg-elevated)] tpl:text-[var(--tpl-primary)] tpl:border tpl:border-[var(--tpl-border)]",
2995
- "aria-label": _(c).blockActions.conditionToggle,
2996
- title: e.block.displayCondition?.label,
2997
- onClick: O(ie, ["stop"])
2998
- }, [v(_(tn), {
2999
- size: 12,
3000
- "stroke-width": 2
3001
- })], 8, ca)])) : w("", !0),
3002
- L.value > 0 && !y.value ? (s(), C("div", la, [M("button", {
3003
- class: "tpl-comment-indicator tpl:flex tpl:min-h-6 tpl:min-w-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-0.5 tpl:rounded-full tpl:border-none tpl:px-2 tpl:py-0.5 tpl:text-[10px] tpl:font-semibold tpl:transition-colors tpl:bg-[var(--tpl-chrome-primary-light)] tpl:text-[var(--tpl-primary)]",
3004
- "aria-label": _(u)(_(c).blockActions.comments, { count: String(L.value) }),
3005
- onClick: n[0] ||= O((t) => _(N).comments?.openForBlock(e.block.id), ["stop"])
3006
- }, [v(_(Qt), {
3007
- size: 12,
3008
- "stroke-width": 2.5
3009
- }), V(" " + R(L.value), 1)], 8, ua)])) : w("", !0),
3010
- H.value ? (s(), C("div", {
3011
- key: 4,
3012
- class: "tpl-section-wrapper",
3013
- style: k(H.value)
3014
- }, [M("div", {
3015
- class: "tpl-block-content",
3016
- style: k(z.value)
3017
- }, [a(t.$slots, "default", {}, void 0, !0)], 4)], 4)) : (s(), C("div", {
3018
- key: 5,
3019
- class: "tpl-block-content",
3020
- style: k(z.value)
3021
- }, [a(t.$slots, "default", {}, void 0, !0)], 4))
3022
- ], 10, $i));
3023
- }
3024
- }), [["__scopeId", "data-v-2c239048"]]);
3025
- //#endregion
3026
- //#region src/utils/unwrapParagraph.ts
3027
- function fa(e) {
3028
- let t = e.match(/^\s*<p\b[^>]*>([\s\S]*)<\/p>\s*$/);
3029
- return !t || /<\/p>\s*<p\b/i.test(t[1]) ? e : t[1];
3030
- }
3031
- //#endregion
3032
- //#region src/components/blocks/TitleBlock.vue
3033
- var pa = /* @__PURE__ */ d({
3034
- __name: "TitleBlock",
3035
- props: {
3036
- block: {},
3037
- viewport: {}
3038
- },
3039
- setup(e) {
3040
- let t = e, n = B(() => import("./TitleEditor-CbY1tgSl.js")), { isEditing: r, blockRef: i, toolbarPosition: a, resolvedContent: o, handleDoubleClick: c, handleEditorDone: l } = Ki(() => t.block.content), d = S(() => {
3041
- let e = {
3042
- fontSize: `${Pe[t.block.level]}px`,
3043
- textAlign: t.block.textAlign
3044
- };
3045
- return t.block.color && (e.color = t.block.color), t.block.fontFamily && (e.fontFamily = t.block.fontFamily), e;
3046
- }), f = S(() => `h${t.block.level}`), p = S(() => fa(o.value));
3047
- return (t, o) => (s(), C("div", {
3048
- ref_key: "blockRef",
3049
- ref: i,
3050
- class: "tpl:min-h-[1em] tpl:w-full",
3051
- style: k(d.value),
3052
- onDblclick: o[0] ||= (...e) => _(c) && _(c)(...e)
3053
- }, [_(r) ? (s(), A(_(n), {
3054
- key: 0,
3055
- block: e.block,
3056
- "toolbar-position": _(a),
3057
- onDone: _(l)
3058
- }, null, 8, [
3059
- "block",
3060
- "toolbar-position",
3061
- "onDone"
3062
- ])) : (s(), A(u(f.value), {
3063
- key: 1,
3064
- class: "tpl-text-content tpl:m-0 tpl:font-[inherit] tpl:text-[length:inherit] tpl:leading-tight tpl:outline-none",
3065
- style: { color: "inherit" },
3066
- innerHTML: p.value
3067
- }, null, 8, ["innerHTML"]))], 36));
3068
- }
3069
- });
3070
- //#endregion
3071
- //#region src/utils/sectionColumnDrop.ts
3072
- function ma(e) {
3073
- return e.dataset.blockType !== "section" && e.dataset.paletteType !== "section";
3074
- }
3075
- //#endregion
3076
- //#region src/components/blocks/SectionBlock.vue?vue&type=script&setup=true&lang.ts
3077
- var ha = { class: "tpl:w-full" }, ga = {
3078
- key: 0,
3079
- "data-testid": "section-drop-hint",
3080
- class: "tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:flex tpl:items-center tpl:justify-center tpl:text-xs tpl:text-[var(--tpl-chrome-text-dim)]"
3081
- }, _a = /* @__PURE__ */ d({
3082
- __name: "SectionBlock",
3083
- props: {
3084
- block: {},
3085
- viewport: {}
3086
- },
3087
- setup(e) {
3088
- let t = {
3089
- title: pa,
3090
- paragraph: Ji,
3091
- image: Fi,
3092
- button: Ir,
3093
- divider: mi,
3094
- custom: fi
3095
- }, a = e, { t: o } = Y(), c = ft(J, "SectionBlock"), l = n(vt, null), d = n(kt, null), p = n(St, {}), m = n(Ot, null);
3096
- function h(e) {
3097
- let t = p.savedBlocks;
3098
- if (t?.isPicking.value) {
3099
- t.togglePick(a.block.id);
3100
- return;
3101
- }
3102
- c.selectBlock(e);
3103
- }
3104
- let g = S(() => {
3105
- switch (a.block.columns) {
3106
- case "2": return ["50%", "50%"];
3107
- case "3": return [
3108
- "33.33%",
3109
- "33.33%",
3110
- "33.33%"
3111
- ];
3112
- case "1-2": return ["33.33%", "66.67%"];
3113
- case "2-1": return ["66.67%", "33.33%"];
3114
- default: return ["100%"];
3115
- }
3116
- }), y = S(() => {
3117
- let e = g.value.length, t = [...a.block.children];
3118
- for (; t.length < e;) t.push([]);
3119
- return t.slice(0, e);
3120
- }), x = S(() => a.viewport === "mobile" && a.block.stackOnMobile !== !1);
3121
- function T(e) {
3122
- return y.value[e] || [];
3123
- }
3124
- function E(e, t) {
3125
- let n = t.map((e) => JSON.parse(JSON.stringify(e))), r = [...a.block.children];
3126
- for (; r.length <= e;) r.push([]);
3127
- r[e] = n, c.updateBlock(a.block.id, { children: r });
3128
- }
3129
- function D(e) {
3130
- return Xi(e, d, t);
3131
- }
3132
- function O(e, t) {
3133
- e.type === "custom" && c.updateBlock(e.id, {
3134
- fieldValues: t.fieldValues,
3135
- dataSourceFetched: t.dataSourceFetched
3136
- });
3137
- }
3138
- return (t, n) => (s(), C("div", ha, [M("div", { class: b(["tpl:flex tpl:gap-0", { "tpl:flex-col": x.value }]) }, [(s(!0), C(L, null, r(y.value, (t, n) => (s(), C("div", {
3139
- key: n,
3140
- class: b(["tpl:relative tpl:min-h-[60px] tpl:rounded", T(n).length === 0 ? "tpl:border tpl:border-dashed tpl:border-[var(--tpl-border)]" : ""]),
3141
- style: k({ width: x.value ? "100%" : g.value[n] })
3142
- }, [v(_(I), {
3143
- "model-value": T(n),
3144
- group: {
3145
- name: "blocks",
3146
- pull: !0,
3147
- put: (e, t, n) => _(ma)(n)
3148
- },
3149
- animation: 150,
3150
- "ghost-class": "tpl-ghost",
3151
- "drag-class": "tpl-dragging",
3152
- handle: ".tpl-block-btn",
3153
- "invert-swap": !0,
3154
- "inverted-swap-threshold": .65,
3155
- "empty-insert-threshold": 20,
3156
- "force-fallback": !0,
3157
- class: "tpl:min-h-[60px]",
3158
- "onUpdate:modelValue": (e) => E(n, e)
3159
- }, {
3160
- default: i(() => [(s(!0), C(L, null, r(T(n), (t) => f((s(), C("div", { key: t.id }, [v(da, {
3161
- block: t,
3162
- "is-selected": _(c).state.selectedBlockId === t.id,
3163
- viewport: e.viewport,
3164
- "preview-mode": _(c).state.previewMode,
3165
- nested: "",
3166
- onSelect: (e) => h(t.id)
3167
- }, {
3168
- default: i(() => [(s(), A(u(D(t)), {
3169
- block: t,
3170
- viewport: e.viewport,
3171
- onFetchData: (e) => O(t, e),
3172
- onUpdate: (e) => _(c).updateBlock(t.id, e)
3173
- }, null, 40, [
3174
- "block",
3175
- "viewport",
3176
- "onFetchData",
3177
- "onUpdate"
3178
- ]))]),
3179
- _: 2
3180
- }, 1032, [
3181
- "block",
3182
- "is-selected",
3183
- "viewport",
3184
- "preview-mode",
3185
- "onSelect"
3186
- ])])), [[F, _(m) === !1 || !_(l)?.isHidden(t.id)]])), 128))]),
3187
- _: 2
3188
- }, 1032, [
3189
- "model-value",
3190
- "group",
3191
- "onUpdate:modelValue"
3192
- ]), T(n).length === 0 ? (s(), C("div", ga, [M("span", null, R(_(o).section.dropHere), 1)])) : w("", !0)], 6))), 128))], 2)]));
3193
- }
3194
- }), va = Ae, ya = {
3195
- small: 24,
3196
- medium: 32,
3197
- large: 48
3198
- }, ba = [
3199
- "facebook",
3200
- "twitter",
3201
- "instagram",
3202
- "linkedin",
3203
- "youtube",
3204
- "tiktok",
3205
- "pinterest",
3206
- "email",
3207
- "website",
3208
- "whatsapp",
3209
- "telegram",
3210
- "discord",
3211
- "snapchat",
3212
- "reddit",
3213
- "github",
3214
- "dribbble",
3215
- "behance"
3216
- ], xa = [
3217
- "width",
3218
- "height",
3219
- "fill"
3220
- ], Sa = ["d"], Ca = /* @__PURE__ */ d({
3221
- __name: "SocialIconSvg",
3222
- props: {
3223
- platform: {},
3224
- iconStyle: {},
3225
- iconSize: {}
3226
- },
3227
- setup(e) {
3228
- let t = e, n = S(() => va[t.platform]), r = S(() => ya[t.iconSize]), i = S(() => {
3229
- let e = {
3230
- display: "inline-flex",
3231
- alignItems: "center",
3232
- justifyContent: "center",
3233
- width: `${r.value}px`,
3234
- height: `${r.value}px`
3235
- };
3236
- switch (t.iconStyle) {
3237
- case "solid": return {
3238
- ...e,
3239
- backgroundColor: n.value.color,
3240
- borderRadius: "4px"
3241
- };
3242
- case "outlined": return {
3243
- ...e,
3244
- backgroundColor: "transparent",
3245
- border: `2px solid ${n.value.color}`,
3246
- borderRadius: "4px"
3247
- };
3248
- case "rounded": return {
3249
- ...e,
3250
- backgroundColor: n.value.color,
3251
- borderRadius: "8px"
3252
- };
3253
- case "square": return {
3254
- ...e,
3255
- backgroundColor: n.value.color,
3256
- borderRadius: "0"
3257
- };
3258
- case "circle": return {
3259
- ...e,
3260
- backgroundColor: n.value.color,
3261
- borderRadius: "50%"
3262
- };
3263
- default: return e;
3264
- }
3265
- }), a = S(() => Math.floor(r.value * .6)), o = S(() => t.iconStyle === "outlined" ? n.value.color : "#ffffff");
3266
- return (e, t) => (s(), C("span", { style: k(i.value) }, [(s(), C("svg", {
3267
- width: a.value,
3268
- height: a.value,
3269
- viewBox: "0 0 24 24",
3270
- fill: o.value,
3271
- xmlns: "http://www.w3.org/2000/svg"
3272
- }, [M("path", { d: n.value.path }, null, 8, Sa)], 8, xa))], 4));
3273
- }
3274
- }), wa = { class: "tpl:w-full" }, Ta = ["href"], Ea = {
3275
- key: 1,
3276
- class: "tpl:flex tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:text-sm tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text-dim)]"
3277
- }, Da = /* @__PURE__ */ d({
3278
- __name: "SocialIconsBlock",
3279
- props: {
3280
- block: {},
3281
- viewport: {}
3282
- },
3283
- setup(e) {
3284
- let t = e, { t: n } = Y(), i = S(() => ({
3285
- display: "flex",
3286
- flexWrap: "wrap",
3287
- gap: `${t.block.spacing}px`,
3288
- justifyContent: t.block.align === "left" ? "flex-start" : t.block.align === "right" ? "flex-end" : "center"
3289
- })), a = S(() => t.block.icons.length > 0);
3290
- return (t, o) => (s(), C("div", wa, [a.value ? (s(), C("div", {
3291
- key: 0,
3292
- style: k(i.value)
3293
- }, [(s(!0), C(L, null, r(e.block.icons, (t) => (s(), C("a", {
3294
- key: t.id,
3295
- href: t.url || "#",
3296
- class: "tpl:cursor-default",
3297
- onClick: o[0] ||= O(() => {}, ["prevent"])
3298
- }, [v(Ca, {
3299
- platform: t.platform,
3300
- "icon-style": e.block.iconStyle,
3301
- "icon-size": e.block.iconSize
3302
- }, null, 8, [
3303
- "platform",
3304
- "icon-style",
3305
- "icon-size"
3306
- ])], 8, Ta))), 128))], 4)) : (s(), C("div", Ea, [v(_(zt), { size: 16 }), M("span", null, R(_(n).social.addIcons), 1)]))]));
3307
- }
3308
- }), Oa = { class: "tpl:w-full" }, ka = {
3309
- key: 0,
3310
- class: "tpl:absolute tpl:rounded tpl:px-2 tpl:py-0.5 tpl:text-[10px] tpl:font-medium",
3311
- style: {
3312
- "background-color": "var(--tpl-bg-hover)",
3313
- color: "var(--tpl-text-dim)"
3314
- }
3315
- }, Aa = /* @__PURE__ */ d({
3316
- __name: "SpacerBlock",
3317
- props: {
3318
- block: {},
3319
- viewport: {}
3320
- },
3321
- setup(e) {
3322
- let t = e, n = ft(J, "SpacerBlock"), r = S(() => ({
3323
- height: `${t.block.height}px`,
3324
- minHeight: `${t.block.height}px`,
3325
- ...n.state.previewMode ? {} : { borderColor: "var(--tpl-border)" }
3326
- }));
3327
- return (t, i) => (s(), C("div", Oa, [M("div", {
3328
- style: k(r.value),
3329
- class: b(["tpl:relative tpl:flex tpl:items-center tpl:justify-center", { "tpl:border-y tpl:border-dashed": !_(n).state.previewMode }])
3330
- }, [_(n).state.previewMode ? w("", !0) : (s(), C("span", ka, R(e.block.height) + "px ", 1))], 6)]));
3331
- }
3332
- }), ja = { class: "tpl:w-full" }, Ma = { key: 0 }, Na = [
3333
- "aria-label",
3334
- "data-placeholder",
3335
- "onBlur"
3336
- ], Pa = [
3337
- "aria-label",
3338
- "data-placeholder",
3339
- "onBlur"
3340
- ], Fa = {
3341
- key: 1,
3342
- class: "tpl:flex tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:text-sm tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text-dim)]"
3343
- }, Ia = /*#__PURE__*/ an(/* @__PURE__ */ d({
3344
- __name: "TableBlock",
3345
- props: {
3346
- block: {},
3347
- viewport: {}
3348
- },
3349
- setup(e) {
3350
- let t = {
3351
- mounted(e, t) {
3352
- e.textContent = t.value ?? "";
3353
- },
3354
- updated(e, t) {
3355
- t.value !== t.oldValue && e.getRootNode().activeElement !== e && (e.textContent = t.value ?? "");
3356
- }
3357
- }, n = e, { t: i } = Y(), a = ft(J, "TableBlock"), o = S(() => n.block.rows.length > 0), c = S(() => {
3358
- let e = {
3359
- width: "100%",
3360
- borderCollapse: "collapse",
3361
- fontSize: `${n.block.fontSize}px`,
3362
- textAlign: n.block.textAlign,
3363
- fontFamily: n.block.fontFamily || "inherit"
3364
- };
3365
- return n.block.color && (e.color = n.block.color), e;
3366
- }), l = S(() => ({
3367
- border: `${n.block.borderWidth}px solid ${n.block.borderColor}`,
3368
- padding: `${n.block.cellPadding}px`,
3369
- textAlign: n.block.textAlign
3370
- })), u = S(() => ({
3371
- ...l.value,
3372
- fontWeight: "bold",
3373
- backgroundColor: n.block.headerBackgroundColor || "transparent"
3374
- })), d = S(() => n.block.hasHeaderRow && n.block.rows.length > 0 ? n.block.rows[0] : null), p = S(() => n.block.hasHeaderRow ? n.block.rows.slice(1) : n.block.rows);
3375
- function m() {
3376
- a.selectBlock(n.block.id);
3377
- }
3378
- function h(e, t, r) {
3379
- let i = r.target.innerText.trim(), o = n.block.rows.map((n) => n.id === e ? {
3380
- ...n,
3381
- cells: n.cells.map((e) => e.id === t ? {
3382
- ...e,
3383
- content: i
3384
- } : e)
3385
- } : n);
3386
- a.updateBlock(n.block.id, { rows: o });
3387
- }
3388
- return (e, n) => (s(), C("div", ja, [o.value ? (s(), C("table", {
3389
- key: 0,
3390
- style: k(c.value),
3391
- class: "tpl-table-editable"
3392
- }, [d.value ? (s(), C("thead", Ma, [M("tr", null, [(s(!0), C(L, null, r(d.value.cells, (e) => f((s(), C("th", {
3393
- key: e.id,
3394
- style: k(u.value),
3395
- "aria-label": _(i).table.cellPlaceholder,
3396
- contenteditable: "true",
3397
- "data-placeholder": _(i).table.cellPlaceholder,
3398
- onBlur: (t) => h(d.value.id, e.id, t),
3399
- onKeydown: n[0] ||= y(O((e) => e.target.blur(), ["prevent"]), ["enter"]),
3400
- onClick: O(m, ["stop"])
3401
- }, null, 44, Na)), [[t, e.content]])), 128))])])) : w("", !0), M("tbody", null, [(s(!0), C(L, null, r(p.value, (e) => (s(), C("tr", { key: e.id }, [(s(!0), C(L, null, r(e.cells, (r) => f((s(), C("td", {
3402
- key: r.id,
3403
- style: k(l.value),
3404
- "aria-label": _(i).table.cellPlaceholder,
3405
- contenteditable: "true",
3406
- "data-placeholder": _(i).table.cellPlaceholder,
3407
- onBlur: (t) => h(e.id, r.id, t),
3408
- onKeydown: n[1] ||= y(O((e) => e.target.blur(), ["prevent"]), ["enter"]),
3409
- onClick: O(m, ["stop"])
3410
- }, null, 44, Pa)), [[t, r.content]])), 128))]))), 128))])], 4)) : (s(), C("div", Fa, [v(_(en), { size: 16 }), M("span", null, R(_(i).table.empty), 1)]))]));
3411
- }
3412
- }), [["__scopeId", "data-v-963ac422"]]), La = /* @__PURE__ */ d({
3413
- __name: "VideoPlayButton",
3414
- props: { hoverEffect: {
3415
- type: Boolean,
3416
- default: !1
3417
- } },
3418
- setup(e) {
3419
- return (t, n) => (s(), C("div", { class: b(["tpl:absolute tpl:inset-0 tpl:flex tpl:items-center tpl:justify-center tpl:bg-black/30", e.hoverEffect && "tpl:transition-opacity tpl:group-hover:bg-black/40"]) }, [...n[0] ||= [M("div", { class: "tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[color-mix(in_srgb,var(--tpl-bg)_90%,transparent)] tpl:shadow-[var(--tpl-shadow-lg)]" }, [M("svg", {
3420
- class: "tpl:ml-1 tpl:text-[var(--tpl-danger)]",
3421
- width: "28",
3422
- height: "28",
3423
- viewBox: "0 0 24 24",
3424
- fill: "currentColor"
3425
- }, [M("polygon", { points: "5,3 19,12 5,21" })])], -1)]], 2));
3426
- }
3427
- });
3428
- //#endregion
3429
- //#region src/utils/videoThumbnail.ts
3430
- function Ra(e) {
3431
- if (!e) return {
3432
- platform: "unknown",
3433
- videoId: null,
3434
- thumbnailUrl: null
3435
- };
3436
- for (let t of [/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/i, /youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/i]) {
3437
- let n = e.match(t);
3438
- if (n) {
3439
- let e = n[1];
3440
- return {
3441
- platform: "youtube",
3442
- videoId: e,
3443
- thumbnailUrl: `https://img.youtube.com/vi/${e}/maxresdefault.jpg`
3444
- };
3445
- }
3446
- }
3447
- let t = e.match(/vimeo\.com\/(?:video\/)?(\d+)/i);
3448
- if (t) {
3449
- let e = t[1];
3450
- return {
3451
- platform: "vimeo",
3452
- videoId: e,
3453
- thumbnailUrl: `https://vumbnail.com/${e}.jpg`
3454
- };
3455
- }
3456
- return {
3457
- platform: "unknown",
3458
- videoId: null,
3459
- thumbnailUrl: null
3460
- };
3461
- }
3462
- function za(e, t) {
3463
- return t || Ra(e).thumbnailUrl;
3464
- }
3465
- //#endregion
3466
- //#region src/components/blocks/VideoBlock.vue?vue&type=script&setup=true&lang.ts
3467
- var Ba = ["src", "alt"], Va = {
3468
- class: "tpl:max-w-full tpl:truncate tpl:px-3 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-primary)]",
3469
- style: { opacity: "0.7" }
3470
- }, Ha = ["href"], Ua = ["src", "alt"], Wa = ["src", "alt"], Ga = {
3471
- key: 3,
3472
- class: "tpl:flex tpl:min-h-[150px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-sm tpl:border-[var(--tpl-border-light)] tpl:bg-[var(--tpl-bg-hover)] tpl:text-[var(--tpl-text-dim)]"
3473
- }, Ka = /* @__PURE__ */ d({
3474
- __name: "VideoBlock",
3475
- props: {
3476
- block: {},
3477
- viewport: {}
3478
- },
3479
- setup(e) {
3480
- let t = e, { t: n } = Y(), { syntax: r } = sn(), i = S(() => Ce(t.block.url, r) || Ce(t.block.thumbnailUrl, r)), a = zn(() => i.value ? void 0 : t.block.thumbnailUrl || void 0), o = zn(() => i.value ? t.block.placeholderUrl : void 0), c = S(() => i.value ? null : t.block.thumbnailUrl ? a.value ?? null : za(t.block.url)), l = S(() => ({ textAlign: t.block.align })), u = S(() => {
3481
- let e = t.block.align;
3482
- return {
3483
- maxWidth: "100%",
3484
- width: t.block.width === "full" ? "100%" : `${t.block.width}px`,
3485
- height: t.block.height ? `${t.block.height}px` : void 0,
3486
- display: "block",
3487
- marginLeft: e === "center" || e === "right" ? "auto" : void 0,
3488
- marginRight: e === "center" ? "auto" : void 0
3489
- };
3490
- }), d = S(() => ({ height: t.block.height ? `${t.block.height}px` : void 0 })), f = S(() => Ce(t.block.url, r) ? t.block.url : t.block.thumbnailUrl);
3491
- return (t, r) => (s(), C("div", {
3492
- class: "tpl:w-full",
3493
- style: k(l.value)
3494
- }, [i.value && e.block.placeholderUrl ? (s(), C("div", {
3495
- key: 0,
3496
- class: "tpl:relative tpl:inline-block",
3497
- style: k(u.value)
3498
- }, [M("img", {
3499
- class: "tpl:w-full tpl:border-0",
3500
- src: _(o),
3501
- alt: e.block.alt,
3502
- style: k(d.value)
3503
- }, null, 12, Ba), v(La)], 4)) : i.value ? (s(), C("div", {
3504
- key: 1,
3505
- class: "tpl:relative tpl:!flex tpl:min-h-[150px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-center tpl:bg-[var(--tpl-bg-elevated)]",
3506
- style: k([{ "border-color": "color-mix(in srgb, var(--tpl-primary) 40%, transparent)" }, u.value])
3507
- }, [v(_(Xt), {
3508
- size: 36,
3509
- "stroke-width": 1.5,
3510
- class: "tpl:text-[var(--tpl-primary)]",
3511
- style: { opacity: "0.5" }
3512
- }), M("span", Va, [v(Pr, { text: f.value }, null, 8, ["text"])])], 4)) : c.value ? (s(), C(L, { key: 2 }, [e.block.url ? (s(), C("a", {
3513
- key: 0,
3514
- href: e.block.url,
3515
- target: "_blank",
3516
- rel: "noopener noreferrer",
3517
- class: "tpl:group tpl:relative tpl:inline-block",
3518
- style: k(u.value),
3519
- onClick: r[0] ||= O(() => {}, ["prevent"])
3520
- }, [M("img", {
3521
- class: "tpl:w-full tpl:border-0",
3522
- src: c.value,
3523
- alt: e.block.alt,
3524
- style: k(d.value)
3525
- }, null, 12, Ua), v(La, { "hover-effect": "" })], 12, Ha)) : (s(), C("div", {
3526
- key: 1,
3527
- class: "tpl:relative tpl:inline-block",
3528
- style: k(u.value)
3529
- }, [M("img", {
3530
- class: "tpl:w-full tpl:border-0",
3531
- src: c.value,
3532
- alt: e.block.alt,
3533
- style: k(d.value)
3534
- }, null, 12, Wa), v(La)], 4))], 64)) : (s(), C("div", Ga, [v(_(Xt), {
3535
- size: 40,
3536
- "stroke-width": 1.5,
3537
- class: "tpl:text-[var(--tpl-border-light)]"
3538
- }), M("span", null, R(_(n).video.addVideo), 1)]))], 4));
3539
- }
3540
- }), qa = {
3541
- section: _a,
3542
- title: pa,
3543
- paragraph: Ji,
3544
- image: Fi,
3545
- button: Ir,
3546
- divider: mi,
3547
- video: Ka,
3548
- social: Da,
3549
- menu: zi,
3550
- table: Ia,
3551
- spacer: Aa,
3552
- html: bi,
3553
- countdown: B(() => import("./CountdownBlock-DGDl3ota.js"))
3554
- };
3555
- function Ja(e) {
3556
- let { editor: n, config: r, translations: i, fontsManager: a } = e, { t: s, format: u } = Y(i), d = S(() => ae(ae(ae(lr(i), Or(n.content.value.settings?.locale)), de(n.content.value.settings) === "rtl" ? {
3557
- title: { textAlign: "right" },
3558
- table: { textAlign: "right" }
3559
- } : {}), r.blockDefaults ?? {}));
3560
- n.setUiTheme(r.uiTheme ?? "auto");
3561
- let { resolvedTheme: f } = qn(S(() => n.state.uiTheme)), p = l(r.theme ?? {}), { themeStyles: m } = Yn({
3562
- themeOverrides: p,
3563
- resolvedTheme: f,
3564
- extraStyles: () => ({
3565
- "--tpl-drop-text": `"${i.canvas.dropHere}"`,
3566
- ...e.themeExtraStyles?.()
3567
- })
3568
- }), g = gn({
3569
- content: n.content,
3570
- setContent: (e, t) => n.setContent(e, t),
3571
- ...e.historyOptions
3572
- });
3573
- Cn(n, g);
3574
- let _ = vn({
3575
- addBlock: n.addBlock,
3576
- removeBlock: n.removeBlock,
3577
- updateBlock: n.updateBlock,
3578
- selectBlock: n.selectBlock,
3579
- findBlockLocation: n.findBlockLocation,
3580
- blockDefaults: () => d.value
3581
- }), v = xn(n), y = e.autoSaveOptions !== null && e.autoSaveOptions !== void 0 ? bn({
3582
- content: n.content,
3583
- isDirty: () => n.state.isDirty,
3584
- ...e.autoSaveOptions
3585
- }) : null, b = null;
3586
- y && (b = t(g.isNavigating, (e) => {
3587
- e ? y.pause() : y.resume();
3588
- }));
3589
- let C = Kn(n, {
3590
- t: s,
3591
- format: u
3592
- }, r.customBlocks ?? []), w = Lt(r.colors);
3593
- if (w.allowCustomIgnored && X.warn("config.colors.allowCustom: false is ignored without presets — keeping the color wheel and hex input so a color can still be chosen."), w.invalidPresets.length > 0 && X.warn(`config.colors.presets skipped invalid entries: ${w.invalidPresets.join(", ")} — presets must be hex colors (#rgb or #rrggbb).`), w.allowCustom === !1) {
3594
- let e = cr(w.presets, r.blockDefaults, r.templateDefaults);
3595
- e.length > 0 && X.warn(`config.colors locks custom colours, but these block/template default colours fall outside colors.presets: ${e.join(", ")}. New blocks start on a colour the palette can't reselect — set blockDefaults / templateDefaults from the same palette.`);
3596
- }
3597
- let T = or(r.templateSettings);
3598
- for (let e of T.unknown) X.warn(`config.templateSettings.fields: "${e}" is not a template setting (expected one of ${ir.join(", ")}) — skipping it.`);
3599
- let E = Xn();
3600
- tr(E, qa);
3601
- let D = /* @__PURE__ */ new Set();
3602
- function O(e) {
3603
- for (let t of e) {
3604
- E.registerCustom(t, fi);
3605
- for (let e of Ar(t, w)) D.has(e.id) || (D.add(e.id), X.warn(e.message));
3606
- }
3607
- }
3608
- r.customBlocks?.length && O(r.customBlocks);
3609
- let k = Fn();
3610
- if (o() && h(k.dispose), e.containerEl) {
3611
- let t = e.containerEl;
3612
- G(document, "pointerdown", (e) => {
3613
- let n = t.value;
3614
- n && (e.composedPath?.() ?? []).includes(n) && k.claim();
3615
- }, { capture: !0 });
3616
- }
3617
- function A() {
3618
- let t = e.capabilities?.templates;
3619
- if (t) {
3620
- t.save();
3621
- return;
3622
- }
3623
- y?.flush();
3624
- }
3625
- function j(t) {
3626
- k.isActive() && Mr(t, {
3627
- history: g,
3628
- selectBlock: (e) => n.selectBlock(e),
3629
- getSelectedBlockId: () => n.state.selectedBlockId,
3630
- removeBlock: (e) => n.removeBlock(e),
3631
- onSave: A,
3632
- onBeforeUndo: e.keyboardOptions?.onBeforeUndo,
3633
- isPicking: () => e.capabilities?.savedBlocks?.isPicking.value === !0,
3634
- onConfirmPick: () => e.capabilities?.savedBlocks?.confirmPicking(),
3635
- onCancelPick: () => e.capabilities?.savedBlocks?.cancelPicking()
3636
- });
3637
- }
3638
- G(document, "keydown", j);
3639
- let M = l(null);
3640
- c(pt, e.editorRoot ?? document), c(Pt, M), c(Dt, i), c(J, n), c(Nt, g), c(mt, _), c(vt, v), c(At, a), c(et, m), c(dt, f), c(Tt, d), c($e, r.locale), c(kt, E), c(Et, r.customBlocks ?? []), c(ot, r.paletteBlocks), c(ht, nr(r.htmlBlockPreview)), c(_t, w), c(Ze, T.fields), c(Ct, Zn(n.content, E));
3641
- let N = Se(r.mergeTags?.syntax), P = x(r.mergeTags?.tags ?? []);
3642
- function F(e) {
3643
- if (!Array.isArray(e)) {
3644
- X.warn(`setMergeTags() expects an array of merge tags, received ${typeof e} — ignoring.`);
3645
- return;
3646
- }
3647
- P.value = e;
3648
- }
3649
- c(K, P), c(rt, N), c(tt, r.mergeTags?.onRequest ?? null), c(it, r.mergeTags?.autocomplete !== !1), c(nt, r.mergeTags?.showRawValue !== !1);
3650
- let I = l(Ie(r.mergeTags?.tags ?? []));
3651
- c(bt, I);
3652
- let L = Ln({
3653
- resolvePreview: r.resolvePreview,
3654
- getContent: () => n.content.value,
3655
- isActive: () => n.state.previewMode
3656
- });
3657
- c(qe, L), c(lt, r.resolvePreview);
3658
- let R = S(() => !(n.state.previewMode && L.isConfigured));
3659
- c(Ot, R);
3660
- let z = Bn();
3661
- c(xt, z), c(Ke, l(!1)), c(Ye, l(!1)), c(jt, r.logicTags?.tags ?? []), c(Je, r.logicTags?.pairs ?? []), c(Xe, r.logicTags?.onRequest ?? null), c(ct, Vn()), c(Qe, r.onRequestMedia ?? null), c(gt, r.canDropMedia ?? null), c(Mt, r.resolveImageUrl ? Rn(r.resolveImageUrl) : null), c(yt, r.displayConditions?.conditions ?? []), c(wt, r.displayConditions?.allowCustom ?? !1), c(St, e.capabilities ?? {}), c(st, C);
3662
- let B = Hn(r.lint) ? null : Un({
3663
- content: n.content,
3664
- options: r.lint ?? {},
3665
- updateBlock: n.updateBlock,
3666
- updateSettings: n.updateSettings,
3667
- removeBlock: n.removeBlock
3668
- });
3669
- c(ut, B);
3670
- function V() {
3671
- b?.(), B?.destroy(), y?.destroy(), g.destroy();
3672
- }
3673
- return {
3674
- t: s,
3675
- format: u,
3676
- history: g,
3677
- blockActions: _,
3678
- conditionPreview: v,
3679
- autoSave: y,
3680
- resolvedTheme: f,
3681
- themeStyles: m,
3682
- themeOverrides: p,
3683
- registry: E,
3684
- keyboardReorder: C,
3685
- templateLint: B,
3686
- popoverRoot: M,
3687
- mergeTagSampleMode: I,
3688
- previewResolution: L,
3689
- appliesConditionFilter: R,
3690
- registerCustomBlocks: O,
3691
- setMergeTags: F,
3692
- destroy: V
3693
- };
3694
- }
3695
- //#endregion
3696
- export { _r as A, Wn as B, Jr as C, zr as D, Vr as E, xr as F, kn as G, Mn as H, br as I, Sn as J, En as K, ir as L, wr as M, Cr as N, Ir as O, Sr as P, rr as R, $r as S, Hr as T, jn as U, Ln as V, An as W, fn as X, yn as Y, bi as _, Da as a, ri as b, pa as c, Yi as d, Xi as f, Si as g, Fi as h, Aa as i, Tr as j, kr as k, da as l, zi as m, Ka as n, ba as o, Ji as p, wn as q, Ia as r, _a as s, Ja as t, Zi as u, mi as v, qr as w, ti as x, fi as y, Gn as z };
3697
-
3698
- //# sourceMappingURL=useEditorCore-06PtcUi1.js.map