@templatical/editor 0.47.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/README.md +1 -1
  2. package/dist/{AiChatSidebar-BPOv5Ra8.js → AiChatSidebar-CdjTb9ej.js} +14 -14
  3. package/dist/{AiFeatureMenu-H_WT4YR8.js → AiFeatureMenu-DKm7VYCs.js} +7 -7
  4. package/dist/{BlockIssueBadge-AgO5abEB.js → BlockIssueBadge-BdpJwim0.js} +5 -5
  5. package/dist/BlockPreviewCanvas-D_sowkf0.js +141 -0
  6. package/dist/CloudHeaderExtras-CI8RR9hG.js +55 -0
  7. package/dist/{CloudPanels-H_GdbOfZ.js → CloudPanels-1hwFiJ0G.js} +39 -68
  8. package/dist/CollaborationNotices-BWpKzueF.js +73 -0
  9. package/dist/CollaboratorBar-D87phJsw.js +123 -0
  10. package/dist/{CommentsPanel-CMgsG_yh.js → CommentsPanel-BUvUzO3T.js} +2 -2
  11. package/dist/{CommentsSidebar-DCh8DTP8.js → CommentsSidebar-J65znlrH.js} +14 -14
  12. package/dist/{CountdownBlock-zx39Dyby.js → CountdownBlock-DPQXWRvU.js} +4 -4
  13. package/dist/{CountdownToolbar-DVuucA3v.js → CountdownToolbar-CLMIwfK7.js} +7 -7
  14. package/dist/{DesignReferenceSidebar-DxNV4lQp.js → DesignReferenceSidebar-BTwCFgz8.js} +13 -13
  15. package/dist/{IssuesPanel-CUpW54P4.js → IssuesPanel-DeeVsfG7.js} +8 -8
  16. package/dist/{LoadingTrack-6XsqodoY.js → LoadingTrack-BXOptf5g.js} +1 -1
  17. package/dist/{LogicTagInsertButton-DDYKnqmj.js → LogicTagInsertButton-CR5E4jSG.js} +17 -17
  18. package/dist/{MediaEditModal-D_we0Scr.js → MediaEditModal-C_wxoUMG.js} +3 -3
  19. package/dist/{MediaPanels-L95BwWV1.js → MediaPanels-BVXDkqtH.js} +2 -2
  20. package/dist/{MergeTagInput-DAL998tx.js → MergeTagInput-BEw_r0PJ.js} +3 -3
  21. package/dist/{MergeTagModeToggle-CjHO26rb.js → MergeTagModeToggle-CJTpFmVd.js} +7 -7
  22. package/dist/{ParagraphEditor-CcEN1N6n.js → ParagraphEditor-zLV44z-R.js} +135 -135
  23. package/dist/{RestoreVersionDialog-B2OH5rgs.js → RestoreVersionDialog-BaDpy3cL.js} +6 -6
  24. package/dist/{RichTextEditorContent-BGeTg-QL.js → RichTextEditorContent-CsvniFlI.js} +9 -9
  25. package/dist/{SaveBlockDialog-CCVyU-7y.js → SaveBlockDialog-DzWURF_e.js} +34 -35
  26. package/dist/{SavedBlocksBrowserModal-_WmSeqIh.js → SavedBlocksBrowserModal-B8DCFW7t.js} +14 -14
  27. package/dist/{SavedBlocksPanels-DVX_ruQ7.js → SavedBlocksPanels-B3Af8ns2.js} +2 -2
  28. package/dist/{SavedBlocksPickBar-DVJC28hP.js → SavedBlocksPickBar-Dj11-Lqp.js} +5 -5
  29. package/dist/{TemplateScoringPanel-U0QFiwdI.js → TemplateScoringPanel-Ba9sgvjS.js} +16 -16
  30. package/dist/{TemplateSettings-CdhTm9JQ.js → TemplateSettings-Cu5X9DgA.js} +11 -11
  31. package/dist/{TestEmailModal-BqToA_ls.js → TestEmailModal-BeRYV3eg.js} +14 -14
  32. package/dist/{TestEmailPanel-Cn4Ptq0j.js → TestEmailPanel-B8c3fQi2.js} +2 -2
  33. package/dist/{TitleEditor-CZdqeltH.js → TitleEditor-CvpNUoAp.js} +13 -13
  34. package/dist/{ToggleSwitch-BR8Sgzib.js → ToggleSwitch-DHweVJOr.js} +2 -2
  35. package/dist/Toolbar-BadDSkkF.js +3153 -0
  36. package/dist/{TplModal-CoczSDma.js → TplModal-BZgi9Tes.js} +5 -5
  37. package/dist/{VersionHistoryMenu-DY5z5FZr.js → VersionHistoryMenu-BRlcQ8wX.js} +10 -10
  38. package/dist/{VersionHistoryPanels-DowHeDAQ.js → VersionHistoryPanels-DGkllN3a.js} +2 -2
  39. package/dist/{VersionPreviewBanner-Bo8NxBbh.js → VersionPreviewBanner-F-811aps.js} +4 -4
  40. package/dist/WrapperBlock-DiiaxpMb.js +45 -0
  41. package/dist/{blockTypeIcons-4E1U8f99.js → blockTypeIcons-CayLluou.js} +49 -19
  42. package/dist/bundle-stats.json +7 -7
  43. package/dist/{ca-DMoGGP9L.js → ca-DSJwJ5ov.js} +40 -2
  44. package/dist/cdn/chunks/{AiChatSidebar-B72rI0be.js → AiChatSidebar-yXJ85Zcg.js} +12 -12
  45. package/dist/cdn/chunks/{AiChatSidebar-B72rI0be.js.map → AiChatSidebar-yXJ85Zcg.js.map} +1 -1
  46. package/dist/cdn/chunks/{AiFeatureMenu-BqSG9iEd.js → AiFeatureMenu-4ydjrhsQ.js} +6 -6
  47. package/dist/cdn/chunks/{AiFeatureMenu-BqSG9iEd.js.map → AiFeatureMenu-4ydjrhsQ.js.map} +1 -1
  48. package/dist/cdn/chunks/{BlockIssueBadge-CS7ytN-z.js → BlockIssueBadge-D1VBS_6x.js} +5 -5
  49. package/dist/cdn/chunks/{BlockIssueBadge-CS7ytN-z.js.map → BlockIssueBadge-D1VBS_6x.js.map} +1 -1
  50. package/dist/cdn/chunks/BlockPreviewCanvas-m2tWRyWv.js +143 -0
  51. package/dist/cdn/chunks/BlockPreviewCanvas-m2tWRyWv.js.map +1 -0
  52. package/dist/cdn/chunks/{CloudHeaderExtras-DJXLTUHc.js → CloudHeaderExtras-DEkRww7n.js} +16 -20
  53. package/dist/cdn/chunks/CloudHeaderExtras-DEkRww7n.js.map +1 -0
  54. package/dist/cdn/chunks/{CloudPanels-D1fPLjG8.js → CloudPanels-XufhBZYF.js} +38 -67
  55. package/dist/cdn/chunks/CloudPanels-XufhBZYF.js.map +1 -0
  56. package/dist/cdn/chunks/CollaborationNotices-CBvKEj1Q.js +75 -0
  57. package/dist/cdn/chunks/CollaborationNotices-CBvKEj1Q.js.map +1 -0
  58. package/dist/cdn/chunks/CollaboratorBar-DWW54Bn_.js +72 -0
  59. package/dist/cdn/chunks/CollaboratorBar-DWW54Bn_.js.map +1 -0
  60. package/dist/cdn/chunks/{CommentsPanel-CmxPylNf.js → CommentsPanel-R8YLLO3v.js} +3 -3
  61. package/dist/cdn/chunks/{CommentsPanel-CmxPylNf.js.map → CommentsPanel-R8YLLO3v.js.map} +1 -1
  62. package/dist/cdn/chunks/{CommentsSidebar-CrleQTbo.js → CommentsSidebar-96NZHVq3.js} +16 -16
  63. package/dist/cdn/chunks/{CommentsSidebar-CrleQTbo.js.map → CommentsSidebar-96NZHVq3.js.map} +1 -1
  64. package/dist/cdn/chunks/{CountdownBlock-Dasj191h.js → CountdownBlock-DB4JNdqh.js} +5 -5
  65. package/dist/cdn/chunks/{CountdownBlock-Dasj191h.js.map → CountdownBlock-DB4JNdqh.js.map} +1 -1
  66. package/dist/cdn/chunks/{CountdownToolbar-DPIOtlN0.js → CountdownToolbar-tmiTPEXm.js} +8 -8
  67. package/dist/cdn/chunks/{CountdownToolbar-DPIOtlN0.js.map → CountdownToolbar-tmiTPEXm.js.map} +1 -1
  68. package/dist/cdn/chunks/{DesignReferenceSidebar-BgTNqgCy.js → DesignReferenceSidebar-D14IIu_P.js} +40 -40
  69. package/dist/cdn/chunks/{DesignReferenceSidebar-BgTNqgCy.js.map → DesignReferenceSidebar-D14IIu_P.js.map} +1 -1
  70. package/dist/cdn/chunks/{IssuesPanel-BGjLcNpQ.js → IssuesPanel-BoPiCLGc.js} +6 -6
  71. package/dist/cdn/chunks/{IssuesPanel-BGjLcNpQ.js.map → IssuesPanel-BoPiCLGc.js.map} +1 -1
  72. package/dist/cdn/chunks/{LoadingTrack-DbH97JR9.js → LoadingTrack-YU44CM8X.js} +2 -2
  73. package/dist/cdn/chunks/{LoadingTrack-DbH97JR9.js.map → LoadingTrack-YU44CM8X.js.map} +1 -1
  74. package/dist/cdn/chunks/{LogicTagInsertButton-BEsqPhMr.js → LogicTagInsertButton-BJ2t2vxC.js} +98 -98
  75. package/dist/cdn/chunks/{LogicTagInsertButton-BEsqPhMr.js.map → LogicTagInsertButton-BJ2t2vxC.js.map} +1 -1
  76. package/dist/cdn/chunks/{MediaEditModal-C1Ao0i2c.js → MediaEditModal-DD0SZ-S3.js} +3 -3
  77. package/dist/cdn/chunks/{MediaEditModal-C1Ao0i2c.js.map → MediaEditModal-DD0SZ-S3.js.map} +1 -1
  78. package/dist/cdn/chunks/{MediaPanels-1GPYiZZ0.js → MediaPanels-CkdJ_kGp.js} +3 -3
  79. package/dist/cdn/chunks/{MediaPanels-1GPYiZZ0.js.map → MediaPanels-CkdJ_kGp.js.map} +1 -1
  80. package/dist/cdn/chunks/{MergeTagInput-Dy13_OLc.js → MergeTagInput-7wXX71DH.js} +4 -4
  81. package/dist/cdn/chunks/{MergeTagInput-Dy13_OLc.js.map → MergeTagInput-7wXX71DH.js.map} +1 -1
  82. package/dist/cdn/chunks/{MergeTagModeToggle-B2CPZOeF.js → MergeTagModeToggle-r9vHH4u_.js} +6 -6
  83. package/dist/cdn/chunks/{MergeTagModeToggle-B2CPZOeF.js.map → MergeTagModeToggle-r9vHH4u_.js.map} +1 -1
  84. package/dist/cdn/chunks/{ParagraphEditor-BGLIw7kg.js → ParagraphEditor-CJQjRHXV.js} +52 -52
  85. package/dist/cdn/chunks/{ParagraphEditor-BGLIw7kg.js.map → ParagraphEditor-CJQjRHXV.js.map} +1 -1
  86. package/dist/cdn/chunks/{RestoreVersionDialog-BhykE8En.js → RestoreVersionDialog-C5cxBRKi.js} +8 -8
  87. package/dist/cdn/chunks/{RestoreVersionDialog-BhykE8En.js.map → RestoreVersionDialog-C5cxBRKi.js.map} +1 -1
  88. package/dist/cdn/chunks/{RichTextEditorContent-B-txUvPL.js → RichTextEditorContent-BfE7Bkge.js} +8 -8
  89. package/dist/cdn/chunks/{RichTextEditorContent-B-txUvPL.js.map → RichTextEditorContent-BfE7Bkge.js.map} +1 -1
  90. package/dist/cdn/chunks/{SaveBlockDialog-BHqEp7jw.js → SaveBlockDialog-BKbjUnPM.js} +25 -26
  91. package/dist/cdn/chunks/{SaveBlockDialog-BHqEp7jw.js.map → SaveBlockDialog-BKbjUnPM.js.map} +1 -1
  92. package/dist/cdn/chunks/{SavedBlocksBrowserModal-BhR6AI0f.js → SavedBlocksBrowserModal-BMtyUrUP.js} +10 -10
  93. package/dist/cdn/chunks/{SavedBlocksBrowserModal-BhR6AI0f.js.map → SavedBlocksBrowserModal-BMtyUrUP.js.map} +1 -1
  94. package/dist/cdn/chunks/{SavedBlocksPanels-YwffJtfY.js → SavedBlocksPanels-s_gxi1im.js} +3 -3
  95. package/dist/cdn/chunks/{SavedBlocksPanels-YwffJtfY.js.map → SavedBlocksPanels-s_gxi1im.js.map} +1 -1
  96. package/dist/cdn/chunks/{SavedBlocksPickBar-BtpFU7es.js → SavedBlocksPickBar-B8WHk5mI.js} +6 -6
  97. package/dist/cdn/chunks/{SavedBlocksPickBar-BtpFU7es.js.map → SavedBlocksPickBar-B8WHk5mI.js.map} +1 -1
  98. package/dist/cdn/chunks/{TemplateScoringPanel-N4ySFh5w.js → TemplateScoringPanel-BBPnHILC.js} +10 -10
  99. package/dist/cdn/chunks/{TemplateScoringPanel-N4ySFh5w.js.map → TemplateScoringPanel-BBPnHILC.js.map} +1 -1
  100. package/dist/cdn/chunks/{TemplateSettings-C7b5X34U.js → TemplateSettings-CtrzzQWl.js} +14 -14
  101. package/dist/cdn/chunks/{TemplateSettings-C7b5X34U.js.map → TemplateSettings-CtrzzQWl.js.map} +1 -1
  102. package/dist/cdn/chunks/{TestEmailModal-DHJKI5y5.js → TestEmailModal-DuZKYMWD.js} +15 -15
  103. package/dist/cdn/chunks/{TestEmailModal-DHJKI5y5.js.map → TestEmailModal-DuZKYMWD.js.map} +1 -1
  104. package/dist/cdn/chunks/{TestEmailPanel-lYtzTXpR.js → TestEmailPanel-DERaCdpG.js} +3 -3
  105. package/dist/cdn/chunks/{TestEmailPanel-lYtzTXpR.js.map → TestEmailPanel-DERaCdpG.js.map} +1 -1
  106. package/dist/cdn/chunks/{TitleEditor-5eY01ypW.js → TitleEditor-CEgxjtUX.js} +20 -20
  107. package/dist/cdn/chunks/{TitleEditor-5eY01ypW.js.map → TitleEditor-CEgxjtUX.js.map} +1 -1
  108. package/dist/cdn/chunks/{ToggleSwitch-BN8rMC2m.js → ToggleSwitch-DGQ7iRc-.js} +3 -3
  109. package/dist/cdn/chunks/{ToggleSwitch-BN8rMC2m.js.map → ToggleSwitch-DGQ7iRc-.js.map} +1 -1
  110. package/dist/cdn/chunks/Toolbar-GFIZQHzw.js +3070 -0
  111. package/dist/cdn/chunks/Toolbar-GFIZQHzw.js.map +1 -0
  112. package/dist/cdn/chunks/{TplModal-WIBiBrGy.js → TplModal-DDrbWJcE.js} +5 -5
  113. package/dist/cdn/chunks/{TplModal-WIBiBrGy.js.map → TplModal-DDrbWJcE.js.map} +1 -1
  114. package/dist/cdn/chunks/{VersionHistoryMenu-CZnlS9K5.js → VersionHistoryMenu-MlxsUmuT.js} +11 -11
  115. package/dist/cdn/chunks/{VersionHistoryMenu-CZnlS9K5.js.map → VersionHistoryMenu-MlxsUmuT.js.map} +1 -1
  116. package/dist/cdn/chunks/{VersionHistoryPanels-xjLSpR1e.js → VersionHistoryPanels-DVOV8QLv.js} +3 -3
  117. package/dist/cdn/chunks/{VersionHistoryPanels-xjLSpR1e.js.map → VersionHistoryPanels-DVOV8QLv.js.map} +1 -1
  118. package/dist/cdn/chunks/{VersionPreviewBanner-sARpn4hh.js → VersionPreviewBanner-BQwRKc6S.js} +5 -5
  119. package/dist/cdn/chunks/{VersionPreviewBanner-sARpn4hh.js.map → VersionPreviewBanner-BQwRKc6S.js.map} +1 -1
  120. package/dist/cdn/chunks/WrapperBlock-CFuP4R0c.js +47 -0
  121. package/dist/cdn/chunks/WrapperBlock-CFuP4R0c.js.map +1 -0
  122. package/dist/cdn/chunks/blockTypeIcons-BnAd8qsP.js +22 -0
  123. package/dist/cdn/chunks/blockTypeIcons-BnAd8qsP.js.map +1 -0
  124. package/dist/cdn/chunks/{ca-DMoGGP9L.js → ca-DSJwJ5ov.js} +41 -3
  125. package/dist/cdn/chunks/ca-DSJwJ5ov.js.map +1 -0
  126. package/dist/{cloud-DwjaAdwK.js → cdn/chunks/cloud-CI_fgDyy.js} +116 -293
  127. package/dist/cdn/chunks/cloud-CI_fgDyy.js.map +1 -0
  128. package/dist/cdn/chunks/{createCloudRuntime-DtIZ2Lee.js → createCloudRuntime-DiYCJ21w.js} +127 -169
  129. package/dist/cdn/chunks/createCloudRuntime-DiYCJ21w.js.map +1 -0
  130. package/dist/{de-DgAelLbM.js → cdn/chunks/de-CBE6O79z.js} +42 -2
  131. package/dist/cdn/chunks/de-CBE6O79z.js.map +1 -0
  132. package/dist/{de-mMY5yQJu.js → cdn/chunks/de-D_atmUVB.js} +2 -4
  133. package/dist/cdn/chunks/{de-mMY5yQJu.js.map → de-D_atmUVB.js.map} +1 -1
  134. package/dist/cdn/chunks/{dist-MNQYSEWU.js → dist-DdwjXLme.js} +3 -3
  135. package/dist/cdn/chunks/{dist-MNQYSEWU.js.map → dist-DdwjXLme.js.map} +1 -1
  136. package/dist/cdn/chunks/{dist-CjL6JHML.js → dist-Doy3r07H.js} +2 -2
  137. package/dist/cdn/chunks/{dist-CjL6JHML.js.map → dist-Doy3r07H.js.map} +1 -1
  138. package/dist/cdn/chunks/{draggable-DrsNwZuB.js → draggable-akeQH_JP.js} +1682 -1683
  139. package/dist/cdn/chunks/draggable-akeQH_JP.js.map +1 -0
  140. package/dist/cdn/chunks/{editor-modal-Bcwo0orC.js → editor-modal-HJBy9kLj.js} +69 -69
  141. package/dist/cdn/chunks/{editor-modal-Bcwo0orC.js.map → editor-modal-HJBy9kLj.js.map} +1 -1
  142. package/dist/cdn/chunks/{en-Dekrl7HA.js → en-CDexnk0p.js} +41 -3
  143. package/dist/cdn/chunks/en-CDexnk0p.js.map +1 -0
  144. package/dist/{en-ChVeGQBY.js → cdn/chunks/en-DhJLnaBx.js} +2 -4
  145. package/dist/cdn/chunks/en-DhJLnaBx.js.map +1 -0
  146. package/dist/cdn/chunks/en-Ve-PWSXu.js +1 -0
  147. package/dist/{es-BaZzyidV.js → cdn/chunks/es-BE42B6uN.js} +42 -2
  148. package/dist/cdn/chunks/es-BE42B6uN.js.map +1 -0
  149. package/dist/cdn/chunks/{extensions-T-t8MKDb.js → extensions-koOuDeZS.js} +23 -23
  150. package/dist/cdn/chunks/{extensions-T-t8MKDb.js.map → extensions-koOuDeZS.js.map} +1 -1
  151. package/dist/{fr-C5ucb1HK.js → cdn/chunks/fr-DlJFPDQR.js} +42 -2
  152. package/dist/cdn/chunks/fr-DlJFPDQR.js.map +1 -0
  153. package/dist/cdn/chunks/{icons-C4fX9Bwy.js → icons-CjlNV8xD.js} +121 -92
  154. package/dist/cdn/chunks/icons-CjlNV8xD.js.map +1 -0
  155. package/dist/{ja-CUgR3mV0.js → cdn/chunks/ja-CUT8gkNI.js} +42 -2
  156. package/dist/cdn/chunks/ja-CUT8gkNI.js.map +1 -0
  157. package/dist/cdn/chunks/{keys-HI-INbkz.js → keys-UAWhQ3zW.js} +2 -2
  158. package/dist/cdn/chunks/{keys-HI-INbkz.js.map → keys-UAWhQ3zW.js.map} +1 -1
  159. package/dist/{nl-qrLY7hMS.js → cdn/chunks/nl-bXWqqRyS.js} +42 -2
  160. package/dist/cdn/chunks/nl-bXWqqRyS.js.map +1 -0
  161. package/dist/cdn/chunks/{preRenderCustomBlocks-Co0oi0Jf.js → preRenderCustomBlocks-DqKbdTJ8.js} +5 -5
  162. package/dist/cdn/chunks/{preRenderCustomBlocks-Co0oi0Jf.js.map → preRenderCustomBlocks-DqKbdTJ8.js.map} +1 -1
  163. package/dist/{pt-BR-C6hMTQYi.js → cdn/chunks/pt-BR-2_H4-wlb.js} +42 -2
  164. package/dist/cdn/chunks/pt-BR-2_H4-wlb.js.map +1 -0
  165. package/dist/{pt-BR-CoCwRUi0.js → cdn/chunks/pt-BR-BphMoUTw.js} +2 -4
  166. package/dist/cdn/chunks/{pt-BR-CoCwRUi0.js.map → pt-BR-BphMoUTw.js.map} +1 -1
  167. package/dist/cdn/chunks/{pusher-C8DeiO2X.js → pusher-Cs4GGEtd.js} +2 -2
  168. package/dist/cdn/chunks/pusher-Cs4GGEtd.js.map +1 -0
  169. package/dist/cdn/chunks/{rolldown-runtime-B0aSnxlc.js → rolldown-runtime-Y_bBpyJl.js} +1 -1
  170. package/dist/cdn/chunks/socialIcons-CkZSYpoG.js +2091 -0
  171. package/dist/cdn/chunks/socialIcons-CkZSYpoG.js.map +1 -0
  172. package/dist/cdn/chunks/{src-CHlVFp7r.js → src-B1e5SSYP.js} +312 -286
  173. package/dist/cdn/chunks/src-B1e5SSYP.js.map +1 -0
  174. package/dist/cdn/chunks/src-B77z1iw4.js +649 -0
  175. package/dist/cdn/chunks/src-B77z1iw4.js.map +1 -0
  176. package/dist/cdn/chunks/{src-BnJlDuyB.js → src-CvLTYGdO.js} +555 -283
  177. package/dist/cdn/chunks/src-CvLTYGdO.js.map +1 -0
  178. package/dist/cdn/chunks/{styleConstants-D1Jz-TFU.js → styleConstants-v1dNKgJf.js} +2 -4
  179. package/dist/cdn/chunks/{styleConstants-D1Jz-TFU.js.map → styleConstants-v1dNKgJf.js.map} +1 -1
  180. package/dist/cdn/chunks/{timeouts-DHPZQ0G3.js → timeouts-o5Y9BuqI.js} +2 -2
  181. package/dist/cdn/chunks/timeouts-o5Y9BuqI.js.map +1 -0
  182. package/dist/cdn/chunks/{tiptap-BPigZk5G.js → tiptap-B1RfWFzB.js} +3 -3
  183. package/dist/cdn/chunks/tiptap-B1RfWFzB.js.map +1 -0
  184. package/dist/cdn/chunks/{useAliveFlag-DCB96vzR.js → useAliveFlag-PuXh83UK.js} +2 -2
  185. package/dist/cdn/chunks/{useAliveFlag-DCB96vzR.js.map → useAliveFlag-PuXh83UK.js.map} +1 -1
  186. package/dist/cdn/chunks/{useCloudI18n-BBF4waXO.js → useCloudI18n-kp07GQmk.js} +3 -3
  187. package/dist/cdn/chunks/{useCloudI18n-BBF4waXO.js.map → useCloudI18n-kp07GQmk.js.map} +1 -1
  188. package/dist/cdn/chunks/{useEditorCore-Bf2d1DKI.js → useEditorCore-DpCFvHg_.js} +758 -732
  189. package/dist/cdn/chunks/useEditorCore-DpCFvHg_.js.map +1 -0
  190. package/dist/cdn/chunks/useEditorRoot-5SBqm90x.js +10 -0
  191. package/dist/cdn/chunks/{useEditorRoot-CTc6O8al.js.map → useEditorRoot-5SBqm90x.js.map} +1 -1
  192. package/dist/cdn/chunks/{useI18n-DUlyyIJJ.js → useI18n-DEqtEgOs.js} +3 -3
  193. package/dist/cdn/chunks/{useI18n-DUlyyIJJ.js.map → useI18n-DEqtEgOs.js.map} +1 -1
  194. package/dist/cdn/chunks/{useLogicTag-3S63go4E.js → useLogicTag-X8bc5qNl.js} +4 -4
  195. package/dist/cdn/chunks/{useLogicTag-3S63go4E.js.map → useLogicTag-X8bc5qNl.js.map} +1 -1
  196. package/dist/cdn/chunks/{useMergeTag-BQtxUHq1.js → useMergeTag-DFoOexIQ.js} +6 -6
  197. package/dist/cdn/chunks/{useMergeTag-BQtxUHq1.js.map → useMergeTag-DFoOexIQ.js.map} +1 -1
  198. package/dist/cdn/chunks/{usePopoverPosition-IbaW6-Ao.js → usePopoverPosition-Cz9-XiXR.js} +3 -3
  199. package/dist/cdn/chunks/{usePopoverPosition-IbaW6-Ao.js.map → usePopoverPosition-Cz9-XiXR.js.map} +1 -1
  200. package/dist/cdn/chunks/{useScrollToBlock-uUa601I4.js → useScrollToBlock-MNzurEZV.js} +3 -3
  201. package/dist/cdn/chunks/{useScrollToBlock-uUa601I4.js.map → useScrollToBlock-MNzurEZV.js.map} +1 -1
  202. package/dist/cdn/chunks/{withCurrentFont-DwJd-lKc.js → withCurrentFont-D-f61ghC.js} +2 -2
  203. package/dist/cdn/chunks/{withCurrentFont-DwJd-lKc.js.map → withCurrentFont-D-f61ghC.js.map} +1 -1
  204. package/dist/cdn/editor.css +1 -1
  205. package/dist/cdn/editor.js +1328 -1069
  206. package/dist/cdn/editor.js.map +1 -1
  207. package/dist/{check-B5R4zXr7.js → check-DQQzkmIC.js} +1 -1
  208. package/dist/{chevron-down-BKyl85NV.js → chevron-down-CIF4bdon.js} +1 -1
  209. package/dist/{chevron-right-BmToZ8qX.js → chevron-right-Cg7Xu-ev.js} +1 -1
  210. package/dist/{chevron-up-DNYdOxPC.js → chevron-up-Csu7ISD-.js} +1 -1
  211. package/dist/{circle-alert-Dx9ju3YZ.js → circle-alert-YUvIJAgY.js} +1 -1
  212. package/dist/{clock-Dv9bxsSH.js → clock-CnSIGKQW.js} +1 -1
  213. package/dist/{cdn/chunks/cloud-Cd7ptfhL.js → cloud-YUYDtdHt.js} +308 -569
  214. package/dist/{copy-BsKl4dcy.js → copy-CUC43md_.js} +1 -1
  215. package/dist/{createCloudRuntime-C8gpPsSi.js → createCloudRuntime-BMDRjL0k.js} +126 -168
  216. package/dist/{createLucideIcon-DziKp5iU.js → createLucideIcon-BcP1sjdp.js} +6 -6
  217. package/dist/{cdn/chunks/de-DgAelLbM.js → de-CBE6O79z.js} +40 -4
  218. package/dist/{cdn/chunks/de-mMY5yQJu.js → de-D_atmUVB.js} +0 -6
  219. package/dist/{dist-CUWI-IvA.js → dist-Bv_GBr2l.js} +1 -1
  220. package/dist/{dist-DAAJogrx.js → dist-CCqn-RqE.js} +2 -2
  221. package/dist/{dist-DuufrR8O.js → dist-CNqjHA8e.js} +2 -2
  222. package/dist/{dist-C8koXLhl.js → dist-DBG3nh3k.js} +550 -284
  223. package/dist/{editor-modal-BwyIUnV_.js → editor-modal--7_9A6j-.js} +27 -27
  224. package/dist/en-BHCMzqib.js +1 -0
  225. package/dist/{en-Dekrl7HA.js → en-CDexnk0p.js} +40 -2
  226. package/dist/{cdn/chunks/en-ChVeGQBY.js → en-DhJLnaBx.js} +0 -6
  227. package/dist/{cdn/chunks/es-BaZzyidV.js → es-BE42B6uN.js} +40 -4
  228. package/dist/{extensions-DHyKjsNZ.js → extensions-zwsZlWjH.js} +23 -23
  229. package/dist/{eye-DQuinb9k.js → eye-B1bua-ck.js} +1 -1
  230. package/dist/{cdn/chunks/fr-C5ucb1HK.js → fr-DlJFPDQR.js} +40 -4
  231. package/dist/{image-up-yTfLjOrj.js → image-up-BqiO7KCO.js} +1 -1
  232. package/dist/index.d.ts +356 -38
  233. package/dist/{info-C7OjlS11.js → info-x26nGOo2.js} +1 -1
  234. package/dist/{cdn/chunks/ja-CUgR3mV0.js → ja-CUT8gkNI.js} +40 -4
  235. package/dist/{keys-BKFq19a2.js → keys-BymCnLHD.js} +1 -1
  236. package/dist/{link-CrUFaZ0t.js → link-CezhndyR.js} +1 -1
  237. package/dist/{list-CLgv6M-k.js → list-DQqdptI0.js} +1 -1
  238. package/dist/{loader-circle-BXM5VO0K.js → loader-circle-DCEeoYoi.js} +1 -1
  239. package/dist/{message-circle-BisdQ8H9.js → message-circle-BLGzfv_7.js} +1 -1
  240. package/dist/{cdn/chunks/nl-qrLY7hMS.js → nl-bXWqqRyS.js} +40 -4
  241. package/dist/{package-C1T4AxV1.js → package-D_kEQCMU.js} +1 -1
  242. package/dist/{pencil-oo2mwf4C.js → pencil-Dct8zGLy.js} +1 -1
  243. package/dist/{plus-BIilXopD.js → plus-BDd0gTEm.js} +1 -1
  244. package/dist/{preRenderCustomBlocks-lFX0HHiV.js → preRenderCustomBlocks-CtKJecE-.js} +1 -1
  245. package/dist/{cdn/chunks/pt-BR-C6hMTQYi.js → pt-BR-2_H4-wlb.js} +40 -4
  246. package/dist/{cdn/chunks/pt-BR-CoCwRUi0.js → pt-BR-BphMoUTw.js} +0 -6
  247. package/dist/{refresh-cw-DrLlkEVC.js → refresh-cw-tGMRDxr8.js} +1 -1
  248. package/dist/{runtime-dom.esm-bundler-lFF-QG3j.js → runtime-dom.esm-bundler-DYn1z2Xf.js} +1 -1
  249. package/dist/{search-DNu9lImk.js → search-Bm2cCQpe.js} +1 -1
  250. package/dist/{send-DDNh3LoJ.js → send-sVLaKZ7f.js} +1 -1
  251. package/dist/{shield-check-aXM3o14f.js → shield-check-YhsbXfQc.js} +1 -1
  252. package/dist/{smartphone-isccgDee.js → smartphone-B2W81p02.js} +1 -1
  253. package/dist/socialIcons-Bwv-49EB.js +2167 -0
  254. package/dist/{sparkles-CIMfFxKv.js → sparkles-a1qkBZ8X.js} +1 -1
  255. package/dist/style.css +1 -1
  256. package/dist/{styleConstants-D1Jz-TFU.js → styleConstants-v1dNKgJf.js} +1 -3
  257. package/dist/templatical-editor.js +1448 -1189
  258. package/dist/{text-align-start-C4JFeqsq.js → text-align-start-CTuwQ5YW.js} +1 -1
  259. package/dist/{timeouts-DHPZQ0G3.js → timeouts-o5Y9BuqI.js} +1 -1
  260. package/dist/{trash-8ZD9pK_c.js → trash-I3D2peFQ.js} +1 -1
  261. package/dist/{triangle-alert-pq45xEHl.js → triangle-alert-CenxmLRE.js} +1 -1
  262. package/dist/{upload-DrNFmVes.js → upload-uU2cK0Ce.js} +1 -1
  263. package/dist/{useAliveFlag-Dd06mRxe.js → useAliveFlag-BjP0Gxza.js} +1 -1
  264. package/dist/{useCloudI18n-Nwqo7pI_.js → useCloudI18n-CGVEZV3o.js} +2 -2
  265. package/dist/{useEditorCore-BcT7UI4e.js → useEditorCore-DRbMRe8F.js} +1103 -1076
  266. package/dist/{useEditorRoot-BD3piYtD.js → useEditorRoot-BVm2-1N8.js} +2 -2
  267. package/dist/{useI18n-CxVEpurs.js → useI18n-CSh4gO5c.js} +2 -2
  268. package/dist/{useLogicTag-D-dI8H6p.js → useLogicTag-zcI6BWIf.js} +3 -3
  269. package/dist/{useMergeTag-5wMeDBi-.js → useMergeTag-C-iBLlp0.js} +5 -5
  270. package/dist/{usePopoverPosition-CwnH1o5g.js → usePopoverPosition-CMcsMBtK.js} +2 -2
  271. package/dist/{useScrollToBlock-Do3suaqp.js → useScrollToBlock-CdCQK9QQ.js} +3 -3
  272. package/dist/{vue.runtime.esm-bundler-CAzmrXdD.js → vue.runtime.esm-bundler-DV0Wx4r_.js} +1079 -1080
  273. package/dist/{withCurrentFont-B4YnsG_2.js → withCurrentFont-D62njRLu.js} +1 -1
  274. package/dist/{x-CBFKGLB1.js → x-KFQ4S-Kz.js} +1 -1
  275. package/package.json +12 -12
  276. package/dist/BlockPreviewCanvas-CZDBSPoG.js +0 -136
  277. package/dist/CloudHeaderExtras-gXsTYoGG.js +0 -59
  278. package/dist/CollaboratorBar-BazGNMqN.js +0 -103
  279. package/dist/Toolbar-OGakTBEg.js +0 -2851
  280. package/dist/WrapperBlock-BOABSX9W.js +0 -46
  281. package/dist/cdn/chunks/BlockPreviewCanvas-cOTMFRcg.js +0 -138
  282. package/dist/cdn/chunks/BlockPreviewCanvas-cOTMFRcg.js.map +0 -1
  283. package/dist/cdn/chunks/CloudHeaderExtras-DJXLTUHc.js.map +0 -1
  284. package/dist/cdn/chunks/CloudPanels-D1fPLjG8.js.map +0 -1
  285. package/dist/cdn/chunks/CollaboratorBar-MeRQB1eN.js +0 -52
  286. package/dist/cdn/chunks/CollaboratorBar-MeRQB1eN.js.map +0 -1
  287. package/dist/cdn/chunks/Toolbar-Ik54UO_-.js +0 -2767
  288. package/dist/cdn/chunks/Toolbar-Ik54UO_-.js.map +0 -1
  289. package/dist/cdn/chunks/WrapperBlock-fsLe7goL.js +0 -48
  290. package/dist/cdn/chunks/WrapperBlock-fsLe7goL.js.map +0 -1
  291. package/dist/cdn/chunks/blockTypeIcons-D3g5QzdT.js +0 -21
  292. package/dist/cdn/chunks/blockTypeIcons-D3g5QzdT.js.map +0 -1
  293. package/dist/cdn/chunks/ca-DMoGGP9L.js.map +0 -1
  294. package/dist/cdn/chunks/cloud-Cd7ptfhL.js.map +0 -1
  295. package/dist/cdn/chunks/createCloudRuntime-DtIZ2Lee.js.map +0 -1
  296. package/dist/cdn/chunks/de-DgAelLbM.js.map +0 -1
  297. package/dist/cdn/chunks/draggable-DrsNwZuB.js.map +0 -1
  298. package/dist/cdn/chunks/en-BANFWZdr.js +0 -1
  299. package/dist/cdn/chunks/en-ChVeGQBY.js.map +0 -1
  300. package/dist/cdn/chunks/en-Dekrl7HA.js.map +0 -1
  301. package/dist/cdn/chunks/es-BaZzyidV.js.map +0 -1
  302. package/dist/cdn/chunks/fr-C5ucb1HK.js.map +0 -1
  303. package/dist/cdn/chunks/icons-C4fX9Bwy.js.map +0 -1
  304. package/dist/cdn/chunks/ja-CUgR3mV0.js.map +0 -1
  305. package/dist/cdn/chunks/nl-qrLY7hMS.js.map +0 -1
  306. package/dist/cdn/chunks/pt-BR-C6hMTQYi.js.map +0 -1
  307. package/dist/cdn/chunks/pusher-C8DeiO2X.js.map +0 -1
  308. package/dist/cdn/chunks/socialIcons-DACw1wA8.js +0 -1103
  309. package/dist/cdn/chunks/socialIcons-DACw1wA8.js.map +0 -1
  310. package/dist/cdn/chunks/src-BnJlDuyB.js.map +0 -1
  311. package/dist/cdn/chunks/src-Bu0qBpbf.js +0 -616
  312. package/dist/cdn/chunks/src-Bu0qBpbf.js.map +0 -1
  313. package/dist/cdn/chunks/src-CHlVFp7r.js.map +0 -1
  314. package/dist/cdn/chunks/timeouts-DHPZQ0G3.js.map +0 -1
  315. package/dist/cdn/chunks/tiptap-BPigZk5G.js.map +0 -1
  316. package/dist/cdn/chunks/useEditorCore-Bf2d1DKI.js.map +0 -1
  317. package/dist/cdn/chunks/useEditorRoot-CTc6O8al.js +0 -10
  318. package/dist/en-CC-57eC_.js +0 -1
  319. package/dist/socialIcons-BctavKBN.js +0 -1180
@@ -0,0 +1,2091 @@
1
+ import { B as e, E as t, K as n, N as r, Q as i, S as a, W as o, X as s, Y as c, Z as l, at as u, b as d, ct as f, et as p, f as m, g as h, lt as g, ot as _, rt as v, u as y, ut as b, y as x } from "./draggable-akeQH_JP.js";
2
+ import { A as S, Dt as C, E as w, Rt as T, T as E, Y as ee, _t as D, bt as O, gt as k, ht as A, k as j, mt as M, n as N, ot as P, pt as F, q as I, r as L, vt as R, w as z, xt as B, yt as te } from "./src-CvLTYGdO.js";
3
+ import { r as V } from "./dist-DdwjXLme.js";
4
+ import { L as H, P as U, c as ne, x as re } from "./keys-UAWhQ3zW.js";
5
+ import { n as W } from "./timeouts-o5Y9BuqI.js";
6
+ import { t as ie } from "./useI18n-DEqtEgOs.js";
7
+ import { o as ae, s as G } from "./usePopoverPosition-Cz9-XiXR.js";
8
+ import { at as oe, c as se } from "./icons-CjlNV8xD.js";
9
+ import { t as K } from "./useAliveFlag-PuXh83UK.js";
10
+ //#region ../core/src/error-reporting.ts
11
+ function q(e) {
12
+ return e instanceof Error ? e : Error(String(e), { cause: e });
13
+ }
14
+ function J(e, t) {
15
+ try {
16
+ t();
17
+ } catch (t) {
18
+ e?.(q(t));
19
+ }
20
+ }
21
+ //#endregion
22
+ //#region ../core/src/editor.ts
23
+ function ce(e) {
24
+ let t = e.content ?? ee(e.defaultFontFamily, e.templateDefaults);
25
+ E(t), w(t);
26
+ let n = s({
27
+ template: null,
28
+ content: t,
29
+ selectedBlockId: null,
30
+ viewport: "desktop",
31
+ darkMode: !1,
32
+ previewMode: !1,
33
+ isDirty: !1,
34
+ isSaving: !1,
35
+ isLoading: !1,
36
+ uiTheme: "auto"
37
+ }), r = 0;
38
+ function i() {
39
+ n.isDirty = !0, r++;
40
+ }
41
+ let a = o({
42
+ get: () => n.content,
43
+ set: (e) => {
44
+ n.content = e, i();
45
+ }
46
+ }), c = o(() => n.selectedBlockId ? u(n.content.blocks, n.selectedBlockId) : null);
47
+ function u(e, t) {
48
+ for (let n of e) {
49
+ if (n.id === t) return n;
50
+ if (n.type === "section") for (let e of n.children) {
51
+ let n = u(e, t);
52
+ if (n) return n;
53
+ }
54
+ }
55
+ return null;
56
+ }
57
+ function d(e, t) {
58
+ if (t.add(e.id), e.type === "section") for (let n of e.children) for (let e of n) d(e, t);
59
+ }
60
+ function f(e, t, n = { blocks: e }) {
61
+ for (let r = 0; r < e.length; r++) {
62
+ let i = e[r];
63
+ if (i.id === t) return n;
64
+ if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
65
+ let n = f(i.children[e], t, {
66
+ blocks: i.children[e],
67
+ sectionId: i.id,
68
+ columnIndex: e
69
+ });
70
+ if (n) return n;
71
+ }
72
+ }
73
+ return null;
74
+ }
75
+ function p(t) {
76
+ return e.lockedBlocks?.value.has(t) ?? !1;
77
+ }
78
+ function m(e) {
79
+ let t = f(n.content.blocks, e);
80
+ if (!t) return null;
81
+ let r = t.blocks.findIndex((t) => t.id === e);
82
+ return r === -1 ? null : {
83
+ targetSectionId: t.sectionId,
84
+ columnIndex: t.columnIndex,
85
+ index: r
86
+ };
87
+ }
88
+ function h(e, t = !0) {
89
+ E(e), w(e), n.content = e, t && i();
90
+ }
91
+ function g(e) {
92
+ e && p(e) || (n.selectedBlockId = e);
93
+ }
94
+ function _(e) {
95
+ n.viewport = e;
96
+ }
97
+ function v(e) {
98
+ n.darkMode = e;
99
+ }
100
+ function y(e) {
101
+ n.uiTheme = e;
102
+ }
103
+ function b(e) {
104
+ n.previewMode = e, e && (n.selectedBlockId = null);
105
+ }
106
+ function x(e, t) {
107
+ if (p(e)) return;
108
+ let r = u(n.content.blocks, e);
109
+ r && (Object.assign(r, t), i());
110
+ }
111
+ function S(e) {
112
+ n.content.settings = {
113
+ ...n.content.settings,
114
+ ...e
115
+ }, i();
116
+ }
117
+ function C(e, t, r = 0, a) {
118
+ let o = {
119
+ settings: n.content.settings,
120
+ blocks: [e]
121
+ };
122
+ if (E(o), w(o), !(t && e.type === "section")) {
123
+ if (t) {
124
+ if (p(t)) return;
125
+ let i = u(n.content.blocks, t);
126
+ if (i && i.type === "section") {
127
+ if (r < 0 || r >= R(i.columns)) return;
128
+ i.children[r] = i.children[r] || [];
129
+ let t = i.children[r];
130
+ a !== void 0 && a < t.length ? t.splice(a, 0, e) : t.push(e);
131
+ }
132
+ } else a !== void 0 && a < n.content.blocks.length ? n.content.blocks.splice(a, 0, e) : n.content.blocks.push(e);
133
+ i();
134
+ }
135
+ }
136
+ function T(e) {
137
+ if (p(e)) return;
138
+ let t = f(n.content.blocks, e);
139
+ if (t) {
140
+ let r = t.blocks.findIndex((t) => t.id === e);
141
+ if (r !== -1) {
142
+ let [e] = t.blocks.splice(r, 1);
143
+ if (n.selectedBlockId) {
144
+ let t = /* @__PURE__ */ new Set();
145
+ d(e, t), t.has(n.selectedBlockId) && (n.selectedBlockId = null);
146
+ }
147
+ i();
148
+ }
149
+ }
150
+ }
151
+ function D(e, t, r, a = 0) {
152
+ if (p(e) || r && p(r)) return;
153
+ let o = f(n.content.blocks, e);
154
+ if (!o) return;
155
+ let s = o.blocks.findIndex((t) => t.id === e);
156
+ if (s === -1 || r && o.blocks[s].type === "section") return;
157
+ let c;
158
+ if (r) {
159
+ let e = u(n.content.blocks, r);
160
+ if (!e || e.type !== "section" || a < 0 || a >= R(e.columns)) return;
161
+ e.children[a] = e.children[a] || [], c = e.children[a];
162
+ } else c = n.content.blocks;
163
+ let [l] = o.blocks.splice(s, 1);
164
+ c.splice(t, 0, l), i();
165
+ }
166
+ function O() {
167
+ i();
168
+ }
169
+ function k(e, t) {
170
+ throw new M(`[Templatical] Templates: ${e} ${t}`);
171
+ }
172
+ function A(t) {
173
+ J(e.onError, t);
174
+ }
175
+ function j(t) {
176
+ let { templates: n } = e;
177
+ return n || k(t, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
178
+ }
179
+ function N(e) {
180
+ n.template && (n.template = {
181
+ ...n.template,
182
+ name: e
183
+ }, i());
184
+ }
185
+ async function P(t) {
186
+ let i = j("create()"), { create: a } = i;
187
+ typeof a != "function" && k("create()", "is disabled by the provider — its `create` is `false`.");
188
+ let o;
189
+ n.isLoading = !0;
190
+ try {
191
+ t?.content && (n.content = t.content);
192
+ let e = r;
193
+ o = await a(t?.name === void 0 ? { content: n.content } : {
194
+ name: t.name,
195
+ content: n.content
196
+ }), n.template = o, r === e && (n.isDirty = !1);
197
+ } catch (t) {
198
+ throw e.onError?.(t), t;
199
+ } finally {
200
+ n.isLoading = !1;
201
+ }
202
+ return A(() => i.onCreated?.(o)), o;
203
+ }
204
+ async function F(t) {
205
+ let r = j("load()"), i;
206
+ n.isLoading = !0;
207
+ try {
208
+ i = await r.load(t), E(i.content), w(i.content), n.template = i, n.content = i.content, n.isDirty = !1;
209
+ } catch (t) {
210
+ throw e.onError?.(t), t;
211
+ } finally {
212
+ n.isLoading = !1;
213
+ }
214
+ return A(() => r.onLoaded?.(i)), i;
215
+ }
216
+ async function I(t = "api") {
217
+ let i = j("save()"), { save: a } = i;
218
+ typeof a != "function" && k("save()", "is disabled by the provider — its `save` is `false`.");
219
+ let o = n.template;
220
+ o || k("save()", "has no template loaded. Call create() or load() first.");
221
+ let s = o.name === void 0 ? { content: n.content } : {
222
+ name: o.name,
223
+ content: n.content
224
+ }, c;
225
+ n.isSaving = !0;
226
+ try {
227
+ let e = r;
228
+ if (c = await a(o.id, s), n.template?.id === o.id) {
229
+ let e = n.template.name;
230
+ n.template = e === o.name ? c : {
231
+ ...c,
232
+ name: e
233
+ };
234
+ }
235
+ r === e && (n.isDirty = !1);
236
+ } catch (t) {
237
+ throw e.onError?.(t), t;
238
+ } finally {
239
+ n.isSaving = !1;
240
+ }
241
+ return A(() => i.onSaved?.(c, { trigger: t })), c;
242
+ }
243
+ function L() {
244
+ return n.template?.id !== void 0;
245
+ }
246
+ return {
247
+ state: l(n),
248
+ content: a,
249
+ selectedBlock: c,
250
+ isBlockLocked: p,
251
+ setContent: h,
252
+ selectBlock: g,
253
+ setViewport: _,
254
+ setDarkMode: v,
255
+ setUiTheme: y,
256
+ setPreviewMode: b,
257
+ updateBlock: x,
258
+ updateSettings: S,
259
+ addBlock: C,
260
+ removeBlock: T,
261
+ moveBlock: D,
262
+ markDirty: O,
263
+ findBlockLocation: m,
264
+ setName: N,
265
+ create: P,
266
+ load: F,
267
+ save: I,
268
+ hasTemplate: L
269
+ };
270
+ }
271
+ //#endregion
272
+ //#region ../core/src/history.ts
273
+ var le = 50, Y = 300, ue = 1500;
274
+ function de(e) {
275
+ let { content: t, setContent: n, maxSize: r = le } = e, a = i([]), s = i([]), c = i(!1), l = null, u = null, d = o(() => a.value.length > 0), f = o(() => s.value.length > 0);
276
+ function p() {
277
+ return O(t.value);
278
+ }
279
+ function m(e) {
280
+ a.value.push(e), a.value.length > r && a.value.splice(0, a.value.length - r);
281
+ }
282
+ function h() {
283
+ u &&= (clearTimeout(u.timeoutId), null);
284
+ }
285
+ function g() {
286
+ h(), m(p()), s.value = [];
287
+ }
288
+ function _(e) {
289
+ u && u.blockId === e ? (clearTimeout(u.timeoutId), u.timeoutId = setTimeout(() => {
290
+ u = null;
291
+ }, Y)) : (h(), m(p()), s.value = [], u = {
292
+ blockId: e,
293
+ timeoutId: setTimeout(() => {
294
+ u = null;
295
+ }, Y)
296
+ });
297
+ }
298
+ function v() {
299
+ c.value = !0, l && clearTimeout(l), l = setTimeout(() => {
300
+ c.value = !1, l = null;
301
+ }, ue);
302
+ }
303
+ function y() {
304
+ if (a.value.length === 0) return;
305
+ h();
306
+ let e = a.value.pop();
307
+ s.value.push(p()), n(e, !0), v();
308
+ }
309
+ function b() {
310
+ if (s.value.length === 0) return;
311
+ h();
312
+ let e = s.value.pop();
313
+ a.value.push(p()), n(e, !0), v();
314
+ }
315
+ function x() {
316
+ a.value = [], s.value = [], h();
317
+ }
318
+ function S() {
319
+ x(), l &&= (clearTimeout(l), null);
320
+ }
321
+ return {
322
+ canUndo: d,
323
+ canRedo: f,
324
+ isNavigating: c,
325
+ undo: y,
326
+ redo: b,
327
+ record: g,
328
+ recordDebounced: _,
329
+ clear: x,
330
+ destroy: S
331
+ };
332
+ }
333
+ //#endregion
334
+ //#region ../core/src/block-actions.ts
335
+ function X(e) {
336
+ let { addBlock: t, removeBlock: n, updateBlock: r, selectBlock: i, findBlockLocation: a } = e;
337
+ function o(n, r, a) {
338
+ let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s = S(n, o);
339
+ return t(s, r, a), i(s.id), s;
340
+ }
341
+ function s(e, n, r) {
342
+ let o = j(e);
343
+ if (n !== void 0 || r !== void 0) t(o, n, r);
344
+ else {
345
+ let i = a?.(e.id) ?? null;
346
+ i ? t(o, i.targetSectionId, i.columnIndex, i.index + 1) : t(o, n, r);
347
+ }
348
+ return i(o.id), o;
349
+ }
350
+ function c(e) {
351
+ n(e);
352
+ }
353
+ function l(e, t, n) {
354
+ r(e, { [t]: n });
355
+ }
356
+ return {
357
+ createAndAddBlock: o,
358
+ duplicateBlock: s,
359
+ deleteBlock: c,
360
+ updateBlockProperty: l
361
+ };
362
+ }
363
+ //#endregion
364
+ //#region ../core/src/auto-save.ts
365
+ var fe = 2e3;
366
+ function pe(e) {
367
+ let { content: t, isDirty: n, onChange: r, debounce: i = fe, enabled: a = !0 } = e, o = null, s = !1;
368
+ function c() {
369
+ return typeof a == "function" ? a() : a;
370
+ }
371
+ function l() {
372
+ s = !0, d();
373
+ }
374
+ function u() {
375
+ s = !1;
376
+ }
377
+ function d() {
378
+ o &&= (clearTimeout(o), null);
379
+ }
380
+ function f() {
381
+ d(), n() && r(JSON.parse(JSON.stringify(t.value)));
382
+ }
383
+ function p() {
384
+ c() && !s && (d(), o = setTimeout(() => {
385
+ o = null, c() && !s && n() && r(JSON.parse(JSON.stringify(t.value)));
386
+ }, i));
387
+ }
388
+ let m = _(t, () => {
389
+ p();
390
+ }, { deep: !0 });
391
+ function h() {
392
+ m(), d();
393
+ }
394
+ return {
395
+ flush: f,
396
+ cancel: d,
397
+ pause: l,
398
+ resume: u,
399
+ destroy: h
400
+ };
401
+ }
402
+ //#endregion
403
+ //#region ../core/src/condition-preview.ts
404
+ function me(e) {
405
+ let t = s(/* @__PURE__ */ new Set()), n = o(() => t.size > 0);
406
+ function r(e) {
407
+ return t.has(e);
408
+ }
409
+ function i(n) {
410
+ t.has(n) ? t.delete(n) : (t.add(n), e.state.selectedBlockId === n && e.selectBlock(null));
411
+ }
412
+ function a() {
413
+ t.clear();
414
+ }
415
+ return {
416
+ isHidden: r,
417
+ toggleBlock: i,
418
+ reset: a,
419
+ hasHiddenBlocks: n
420
+ };
421
+ }
422
+ //#endregion
423
+ //#region ../core/src/data-source-fetch.ts
424
+ function he(e) {
425
+ let t = i(!1), n = i(!1), r = o(() => !!e.definition.value?.dataSource), a = o(() => r.value && !e.block.value.dataSourceFetched);
426
+ async function s() {
427
+ let r = e.definition.value;
428
+ if (r?.dataSource) {
429
+ t.value = !0, n.value = !1;
430
+ try {
431
+ let t = await r.dataSource.onFetch({
432
+ fieldValues: { ...e.block.value.fieldValues },
433
+ blockId: e.block.value.id
434
+ });
435
+ if (t == null) return;
436
+ let n = { ...e.block.value.fieldValues };
437
+ for (let e of Object.keys(n)) e in t && (n[e] = t[e]);
438
+ e.onUpdate(n, !0);
439
+ } catch (e) {
440
+ console.warn("[Templatical] Data source fetch error:", e), n.value = !0;
441
+ } finally {
442
+ t.value = !1;
443
+ }
444
+ }
445
+ }
446
+ return {
447
+ isFetching: t,
448
+ fetchError: n,
449
+ fetch: s,
450
+ hasDataSource: r,
451
+ needsFetch: a
452
+ };
453
+ }
454
+ //#endregion
455
+ //#region ../core/src/history-interceptor.ts
456
+ function ge(e, t) {
457
+ let n = e.addBlock, r = e.removeBlock, i = e.moveBlock, a = e.updateBlock, o = e.updateSettings;
458
+ e.addBlock = (r, i, a, o) => {
459
+ i && e.isBlockLocked(i) || (t.record(), n(r, i, a, o));
460
+ }, e.removeBlock = (n) => {
461
+ e.isBlockLocked(n) || (t.record(), r(n));
462
+ }, e.moveBlock = (n, r, a, o) => {
463
+ e.isBlockLocked(n) || a && e.isBlockLocked(a) || (t.record(), i(n, r, a, o));
464
+ }, e.updateBlock = (n, r) => {
465
+ e.isBlockLocked(n) || (t.recordDebounced(n), a(n, r));
466
+ }, e.updateSettings = (e) => {
467
+ t.record(), o(e);
468
+ };
469
+ }
470
+ //#endregion
471
+ //#region ../core/src/diff-content.ts
472
+ var _e = "root", ve = /* @__PURE__ */ new Set([
473
+ "id",
474
+ "type",
475
+ "children"
476
+ ]), ye = /* @__PURE__ */ new Set([
477
+ "id",
478
+ "type",
479
+ "children",
480
+ "columns"
481
+ ]), be = /* @__PURE__ */ new Set();
482
+ function xe(e) {
483
+ return e === null ? _e : JSON.stringify([e.sectionId, e.column]);
484
+ }
485
+ function Z(e) {
486
+ let t = e.children;
487
+ return e.type === "section" && Array.isArray(t) ? t : [];
488
+ }
489
+ function Se(e) {
490
+ let t = /* @__PURE__ */ new Map(), n = (e, r) => {
491
+ e.forEach((e, i) => {
492
+ t.has(e.id) || t.set(e.id, {
493
+ block: e,
494
+ key: xe(r),
495
+ index: i
496
+ }), Z(e).forEach((t, r) => {
497
+ Array.isArray(t) && n(t, {
498
+ sectionId: e.id,
499
+ column: r
500
+ });
501
+ });
502
+ });
503
+ };
504
+ return n(e, null), t;
505
+ }
506
+ function Q(e) {
507
+ let t = [], n = Array(e.length).fill(-1);
508
+ e.forEach((r, i) => {
509
+ let a = 0, o = t.length;
510
+ for (; a < o;) {
511
+ let n = a + o >> 1;
512
+ e[t[n]] < r ? a = n + 1 : o = n;
513
+ }
514
+ a > 0 && (n[i] = t[a - 1]), t[a] = i;
515
+ });
516
+ let r = /* @__PURE__ */ new Set(), i = t.length > 0 ? t[t.length - 1] : -1;
517
+ for (; i !== -1;) r.add(i), i = n[i];
518
+ return r;
519
+ }
520
+ function Ce(e, t, n) {
521
+ let r = {}, i = [];
522
+ for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 || te(e[i], t[i]) || (r[i] = O(t[i]));
523
+ for (let r of Object.keys(e)) n.has(r) || e[r] === void 0 || t[r] === void 0 && i.push(r);
524
+ return {
525
+ set: r,
526
+ unset: i
527
+ };
528
+ }
529
+ function we(e, t) {
530
+ let n = Se(e.blocks), r = Se(t.blocks), i = [], a = (e) => {
531
+ let t = r.get(e), i = n.get(e);
532
+ return t !== void 0 && i !== void 0 && t.block.type !== i.block.type;
533
+ }, o = (e) => r.has(e.id) && !a(e.id), s = (e) => Z(e).some((e) => Array.isArray(e) && e.some((e) => o(e) || !a(e.id) && s(e))), c = /* @__PURE__ */ new Set(), l = [], u = (e, t) => {
534
+ let n = "kept";
535
+ t === "dropped" ? (c.add(e.id), n = "dropped") : a(e.id) ? (i.push({
536
+ op: "deleteBlock",
537
+ blockId: e.id
538
+ }), c.add(e.id), n = "dropped") : r.has(e.id) || (t === "deferred" ? n = "deferred" : s(e) ? (l.push(e.id), n = "deferred") : (i.push({
539
+ op: "deleteBlock",
540
+ blockId: e.id
541
+ }), c.add(e.id), n = "dropped"));
542
+ for (let t of Z(e)) if (Array.isArray(t)) for (let e of t) u(e, n);
543
+ };
544
+ for (let t of e.blocks) u(t, "kept");
545
+ let d = (e) => n.has(e) && !c.has(e), f = (e) => {
546
+ let t = O(e);
547
+ return t.type === "section" && (t.children = Z(e).map((e) => Array.isArray(e) ? e.filter((e) => !d(e.id)).map((e) => O(e)) : e)), t;
548
+ }, p = (e, t, r) => {
549
+ let a = xe(e), o = [], s = [];
550
+ t.forEach((e, t) => {
551
+ let r = n.get(e.id);
552
+ d(e.id) && r !== void 0 && r.key === a && (o.push(r.index), s.push(t));
553
+ });
554
+ let c = new Set([...Q(o)].map((e) => s[e]));
555
+ t.forEach((n, a) => {
556
+ if (c.has(a) || r(n)) return;
557
+ let o = a > 0 ? t[a - 1].id : null;
558
+ i.push(d(n.id) ? {
559
+ op: "moveBlock",
560
+ blockId: n.id,
561
+ parent: e,
562
+ after: o
563
+ } : {
564
+ op: "addBlock",
565
+ block: f(n),
566
+ parent: e,
567
+ after: o
568
+ });
569
+ });
570
+ };
571
+ p(null, t.blocks, () => !1);
572
+ let m = t.blocks.filter((e) => e.type === "section"), h = /* @__PURE__ */ new Set(), g = (e) => {
573
+ for (let t of m) {
574
+ if (!d(t.id)) continue;
575
+ let r = Z(n.get(t.id).block).length, a = Z(t).length;
576
+ (e ? a > r : a < r) && (i.push({
577
+ op: "updateBlock",
578
+ blockId: t.id,
579
+ set: { columns: t.columns }
580
+ }), h.add(t.id));
581
+ }
582
+ };
583
+ g(!0);
584
+ for (let e of m) {
585
+ let t = !d(e.id);
586
+ Z(e).forEach((n, r) => {
587
+ Array.isArray(n) && p({
588
+ sectionId: e.id,
589
+ column: r
590
+ }, n, (e) => t && !d(e.id));
591
+ });
592
+ }
593
+ g(!1);
594
+ for (let e of l) i.push({
595
+ op: "deleteBlock",
596
+ blockId: e
597
+ });
598
+ for (let [e, t] of r) {
599
+ if (!d(e)) continue;
600
+ let { set: r, unset: a } = Ce(n.get(e).block, t.block, h.has(e) ? ye : ve);
601
+ (Object.keys(r).length !== 0 || a.length !== 0) && i.push({
602
+ op: "updateBlock",
603
+ blockId: e,
604
+ ...Object.keys(r).length > 0 ? { set: r } : {},
605
+ ...a.length > 0 ? { unset: a } : {}
606
+ });
607
+ }
608
+ let _ = Ce(e.settings, t.settings, be);
609
+ return (Object.keys(_.set).length > 0 || _.unset.length > 0) && i.push({
610
+ op: "updateSettings",
611
+ ...Object.keys(_.set).length > 0 ? { set: _.set } : {},
612
+ ..._.unset.length > 0 ? { unset: _.unset } : {}
613
+ }), i;
614
+ }
615
+ //#endregion
616
+ //#region ../core/src/invert-operations.ts
617
+ function Te(e) {
618
+ let t = e.children;
619
+ return e.type === "section" && Array.isArray(t) ? t : [];
620
+ }
621
+ function Ee(e, t, n = null) {
622
+ for (let r = 0; r < e.length; r++) {
623
+ let i = e[r];
624
+ if (i.id === t) return {
625
+ block: i,
626
+ parent: n,
627
+ after: r > 0 ? e[r - 1].id : null
628
+ };
629
+ let a = Te(i);
630
+ for (let e = 0; e < a.length; e++) {
631
+ if (!Array.isArray(a[e])) continue;
632
+ let n = Ee(a[e], t, {
633
+ sectionId: i.id,
634
+ column: e
635
+ });
636
+ if (n) return n;
637
+ }
638
+ }
639
+ return null;
640
+ }
641
+ function $(e, t, n) {
642
+ let r = Ee(e.blocks, t);
643
+ if (!r) throw new A("block_missing", n, `No block with id "${t}".`, t);
644
+ return r;
645
+ }
646
+ function De(e, t, n) {
647
+ let r = {}, i = [], a = {}, o = [.../* @__PURE__ */ new Set([...Object.keys(t ?? {}), ...n ?? []])];
648
+ for (let n of o) {
649
+ let o = e[n];
650
+ o === void 0 ? i.push(n) : r[n] = O(o);
651
+ let s = t && n in t ? t[n] : void 0;
652
+ a[n] = s === void 0 ? null : O(s);
653
+ }
654
+ return {
655
+ set: r,
656
+ unset: i,
657
+ expect: a
658
+ };
659
+ }
660
+ function Oe(e, t, n) {
661
+ switch (t.op) {
662
+ case "addBlock": return {
663
+ op: "deleteBlock",
664
+ blockId: t.block.id,
665
+ expect: { block: O(t.block) }
666
+ };
667
+ case "deleteBlock": {
668
+ let r = $(e, t.blockId, n);
669
+ return {
670
+ op: "addBlock",
671
+ block: O(r.block),
672
+ parent: r.parent,
673
+ after: r.after
674
+ };
675
+ }
676
+ case "moveBlock": {
677
+ let r = $(e, t.blockId, n);
678
+ return {
679
+ op: "moveBlock",
680
+ blockId: t.blockId,
681
+ parent: r.parent,
682
+ after: r.after,
683
+ expect: {
684
+ parent: t.parent,
685
+ after: t.after
686
+ }
687
+ };
688
+ }
689
+ case "updateBlock": {
690
+ let r = $(e, t.blockId, n).block, { set: i, unset: a, expect: o } = De(r, t.set, t.unset);
691
+ return {
692
+ op: "updateBlock",
693
+ blockId: t.blockId,
694
+ ...Object.keys(i).length > 0 ? { set: i } : {},
695
+ ...a.length > 0 ? { unset: a } : {},
696
+ expect: o
697
+ };
698
+ }
699
+ case "updateSettings": {
700
+ let { set: n, unset: r, expect: i } = De(e.settings, t.set, t.unset);
701
+ return {
702
+ op: "updateSettings",
703
+ ...Object.keys(n).length > 0 ? { set: n } : {},
704
+ ...r.length > 0 ? { unset: r } : {},
705
+ expect: i
706
+ };
707
+ }
708
+ case "setContent": return {
709
+ op: "setContent",
710
+ content: {
711
+ blocks: O(e.blocks),
712
+ settings: O(e.settings)
713
+ }
714
+ };
715
+ }
716
+ }
717
+ function ke(e, t) {
718
+ let n = O(e), r = [];
719
+ return t.forEach((e, t) => {
720
+ r.push(Oe(n, e, t));
721
+ try {
722
+ D(n, [e]);
723
+ } catch (e) {
724
+ throw e instanceof A ? new A(e.code, t, e.message, e.blockId) : e;
725
+ }
726
+ }), r.reverse();
727
+ }
728
+ var Ae = 1e3, je = 1e4, Me = [
729
+ 1e3,
730
+ 2e3,
731
+ 5e3,
732
+ 1e4,
733
+ 3e4
734
+ ], Ne = 50, Pe = /* @__PURE__ */ new Set([
735
+ "block_exists",
736
+ "block_missing",
737
+ "anchor_missing",
738
+ "precondition_failed",
739
+ "lock_held",
740
+ "locked_by_others",
741
+ "invalid_operation",
742
+ "lock_lost",
743
+ "content_too_large"
744
+ ]);
745
+ function Fe(e) {
746
+ let t = e?.code;
747
+ return typeof t == "string" && Pe.has(t) ? t : null;
748
+ }
749
+ function Ie(e) {
750
+ let t = e?.holder;
751
+ return typeof t == "object" && t && typeof t.sessionId == "string" ? t : void 0;
752
+ }
753
+ function Le(e) {
754
+ let t = e?.statusCode;
755
+ return typeof t != "number" || t >= 500 || t === 408 || t === 429;
756
+ }
757
+ function Re(e, t) {
758
+ return e.some((e) => {
759
+ if (e.id === t) return !0;
760
+ let n = e.children;
761
+ return e.type === "section" && Array.isArray(n) && n.some((e) => Array.isArray(e) && Re(e, t));
762
+ });
763
+ }
764
+ function ze(e) {
765
+ if (e.length === 1 && e[0].op === "updateSettings") return !0;
766
+ let t = e[0];
767
+ return t.op === "updateBlock" && e.every((e) => e.op === "updateBlock" && e.blockId === t.blockId);
768
+ }
769
+ function Be(e) {
770
+ return e.map((e) => {
771
+ if (!("expect" in e)) return e;
772
+ let { expect: t, ...n } = e;
773
+ return n;
774
+ });
775
+ }
776
+ function Ve(e) {
777
+ let { provider: t } = e, r = e.sessionId ?? crypto.randomUUID(), a = e.maxUndo ?? Ne, s = typeof t.acquireLock == "function" && typeof t.renewLock == "function" && typeof t.releaseLock == "function", l = p([]), u = p(/* @__PURE__ */ new Map()), d = i(null), f = i(0), m = i(0), h = null, g = null, v = !1, y = !1, b = !1, x = null, S = 0, C = !1, w = [], T = null, E = null, ee = Promise.resolve(), j = null, M = o(() => (g?.undo.length ?? 0) > 0), N = o(() => (g?.redo.length ?? 0) > 0);
778
+ function P(t) {
779
+ e.onError?.(t instanceof Error ? t : Error(String(t)));
780
+ }
781
+ function F(t, n = g) {
782
+ n !== g || C || e.onNotice?.(t);
783
+ }
784
+ function I() {
785
+ return {
786
+ locks: [...u.value.values()].map((e) => ({
787
+ blockId: e.blockId,
788
+ sessionId: e.holder.sessionId
789
+ })),
790
+ session: r
791
+ };
792
+ }
793
+ function L() {
794
+ m.value++;
795
+ }
796
+ function R(e, t) {
797
+ e.push(t), e.length > a && e.splice(0, e.length - a);
798
+ }
799
+ function z(e) {
800
+ if (!h || v) return;
801
+ y = !0;
802
+ try {
803
+ let t = h.content.value, n = we(t, e);
804
+ if (n.length > 0) try {
805
+ D(t, n);
806
+ } catch {
807
+ h.setContent(O(e), !1);
808
+ }
809
+ te(h.content.value, e) || h.setContent(O(e), !1);
810
+ } finally {
811
+ y = !1;
812
+ }
813
+ let t = h.state.selectedBlockId;
814
+ t && !Re(e.blocks, t) && h.selectBlock(null);
815
+ }
816
+ function B() {
817
+ y || b || (b = !0, queueMicrotask(() => {
818
+ b = !1, H(!1);
819
+ }));
820
+ }
821
+ function V() {
822
+ x &&= (clearTimeout(x), null);
823
+ }
824
+ function H(e, t = !1) {
825
+ let n = g;
826
+ if (!h || !n || v || y || h.state.isLoading && !t || h.state.template?.id !== n.templateId) return;
827
+ let r = we(n.view, h.content.value);
828
+ if (r.length === 0) V();
829
+ else {
830
+ if (!e && ze(r)) {
831
+ let e = Date.now();
832
+ if (x === null && (S = e), e - S < 1e3) {
833
+ x && clearTimeout(x), x = setTimeout(() => {
834
+ x = null, H(!0);
835
+ }, 300);
836
+ return;
837
+ }
838
+ }
839
+ V(), ne(n, r);
840
+ }
841
+ }
842
+ function U() {
843
+ H(!0);
844
+ }
845
+ function ne(e, t) {
846
+ let n = t, r;
847
+ try {
848
+ r = k(e.view, n, I());
849
+ } catch (t) {
850
+ if (!(t instanceof A)) throw t;
851
+ z(e.view);
852
+ let n = t.blockId === void 0 ? void 0 : u.value.get(t.blockId)?.holder;
853
+ F({
854
+ type: "editRefused",
855
+ code: t.code,
856
+ ...n ? { holder: n } : {}
857
+ }), t.code === "invalid_operation" && P(t);
858
+ return;
859
+ }
860
+ let i = h.content.value;
861
+ if (!te(r, i)) {
862
+ P(/* @__PURE__ */ Error("[Templatical] Collaboration: a change couldn't be expressed as block operations, so the whole content was sent.")), n = [{
863
+ op: "setContent",
864
+ content: O(i)
865
+ }];
866
+ try {
867
+ r = k(e.view, n, I());
868
+ } catch (t) {
869
+ if (!(t instanceof A)) throw t;
870
+ z(e.view), F({
871
+ type: "editRefused",
872
+ code: t.code
873
+ });
874
+ return;
875
+ }
876
+ }
877
+ let a = { ops: ke(e.view, n) };
878
+ R(e.undo, a), e.redo = [], L(), e.view = r, re(e, n, "edit", a);
879
+ }
880
+ function re(e, t, n, r) {
881
+ e.pending.push({
882
+ batchId: crypto.randomUUID(),
883
+ ops: t,
884
+ origin: n,
885
+ entry: r,
886
+ sent: !1,
887
+ revision: null
888
+ }), W(e);
889
+ }
890
+ function W(e) {
891
+ if (e.inFlight) return;
892
+ let t = e.pending.find((e) => !e.sent);
893
+ t ? (t.sent = !0, e.inFlight = t, ie(e, t, 0)) : K(e);
894
+ }
895
+ function ie(e, n, r) {
896
+ t.submit(e.templateId, {
897
+ batchId: n.batchId,
898
+ baseRevision: e.revision,
899
+ ops: n.ops
900
+ }).then(({ revision: t }) => {
901
+ e.inFlight = null, ae(e, n, t), W(e);
902
+ }, (t) => {
903
+ if (Fe(t) !== null) e.inFlight = null, se(e, n, t), W(e);
904
+ else if (Le(t)) {
905
+ q(e, t);
906
+ let i = Me[Math.min(r, Me.length - 1)];
907
+ setTimeout(() => {
908
+ C || ie(e, n, r + 1);
909
+ }, i);
910
+ } else e.inFlight = null, P(t), se(e, n, t), W(e);
911
+ });
912
+ }
913
+ function ae(e, t, n) {
914
+ t.revision === null && (t.revision = n, n <= e.revision ? (G(e, t), Y(e)) : (e.own.set(n, t), le(e)));
915
+ }
916
+ function G(e, t) {
917
+ e.pending = e.pending.filter((e) => e !== t), K(e);
918
+ }
919
+ function oe(e, t) {
920
+ if (t.entry) {
921
+ for (let n of [e.undo, e.redo]) {
922
+ let e = n.indexOf(t.entry);
923
+ e !== -1 && n.splice(e, 1);
924
+ }
925
+ L();
926
+ }
927
+ }
928
+ function se(e, t, n) {
929
+ G(e, t), oe(e, t);
930
+ let r = Fe(n) ?? "invalid_operation";
931
+ if (t.origin === "edit") {
932
+ let t = Ie(n);
933
+ F({
934
+ type: "editRefused",
935
+ code: r,
936
+ ...t ? { holder: t } : {}
937
+ }, e);
938
+ } else F({
939
+ type: "undoSkipped",
940
+ code: r
941
+ }, e);
942
+ Y(e), e === g && X();
943
+ }
944
+ function K(e) {
945
+ if (!(e.pending.length > 0 || e.waiters.length === 0)) for (let t of e.waiters.splice(0)) t.resolve();
946
+ }
947
+ function q(e, t) {
948
+ let n = t instanceof Error ? t : Error(String(t));
949
+ for (let t of e.waiters.splice(0)) t.reject(n);
950
+ }
951
+ function J(e, t) {
952
+ if (t.revision <= e.revision) return;
953
+ let n = e.pending.find((e) => e.batchId === t.batchId);
954
+ n ? ae(e, n, t.revision) : (e.remote.set(t.revision, t), le(e));
955
+ }
956
+ function ce(t, n) {
957
+ let r = n.ops;
958
+ if (e.normalizeRemoteOperations) try {
959
+ r = e.normalizeRemoteOperations(n.ops, t.confirmed);
960
+ } catch (e) {
961
+ P(e);
962
+ }
963
+ return Be(r);
964
+ }
965
+ function le(t) {
966
+ let n = [];
967
+ for (;;) {
968
+ let e = t.revision + 1, r = t.remote.get(e), i = t.own.get(e);
969
+ if (!r && !i) break;
970
+ try {
971
+ t.confirmed = k(t.confirmed, r ? ce(t, r) : i.ops);
972
+ } catch {
973
+ if (t.recovering) {
974
+ t.remote.clear(), t.own.clear(), P(/* @__PURE__ */ Error("[Templatical] Collaboration: this editor can't follow the template's changes. Reload the page."));
975
+ return;
976
+ }
977
+ fe(t);
978
+ return;
979
+ }
980
+ t.revision = e, r ? (t.remote.delete(e), n.push(r)) : (t.own.delete(e), G(t, i));
981
+ }
982
+ if (t === g && (f.value = t.revision), t.remote.size > 0 || t.own.size > 0 ? ue(t) : de(t), n.length !== 0 && (Y(t), t === g)) for (let t of n) try {
983
+ e.onRemoteChange?.({
984
+ actor: t.actor,
985
+ ops: t.ops
986
+ });
987
+ } catch (e) {
988
+ P(e);
989
+ }
990
+ }
991
+ function Y(e) {
992
+ e === g && U();
993
+ let t = e.confirmed, n = [];
994
+ for (let r of e.pending) try {
995
+ t = k(t, r.ops), n.push(r);
996
+ } catch (t) {
997
+ if (r.sent) {
998
+ n.push(r);
999
+ continue;
1000
+ }
1001
+ oe(e, r);
1002
+ let i = t instanceof A ? t.code : "invalid_operation";
1003
+ F(r.origin === "edit" ? {
1004
+ type: "editRefused",
1005
+ code: i
1006
+ } : {
1007
+ type: "undoSkipped",
1008
+ code: i
1009
+ }, e);
1010
+ }
1011
+ e.pending = n, e.view = t, K(e), e === g && z(t);
1012
+ }
1013
+ function ue(e) {
1014
+ e.gapTimer ||= setTimeout(() => {
1015
+ e.gapTimer = null, e === g && X();
1016
+ }, Ae);
1017
+ }
1018
+ function de(e) {
1019
+ e.gapTimer &&= (clearTimeout(e.gapTimer), null);
1020
+ }
1021
+ function X() {
1022
+ let e = g;
1023
+ return e ? (e.catchingUp ||= (async () => {
1024
+ try {
1025
+ let n = await t.operationsAfter(e.templateId, e.revision);
1026
+ if (e.retired) return;
1027
+ if ("resync" in n) {
1028
+ await fe(e);
1029
+ return;
1030
+ }
1031
+ for (let t of n.batches) J(e, t);
1032
+ } catch (e) {
1033
+ P(e);
1034
+ } finally {
1035
+ e.catchingUp = null;
1036
+ }
1037
+ })(), e.catchingUp) : Promise.resolve();
1038
+ }
1039
+ async function fe(t) {
1040
+ t.recovering = !0;
1041
+ try {
1042
+ let n = await e.loadTemplate(t.templateId);
1043
+ if (t.retired) return;
1044
+ let r = n.revision ?? t.revision;
1045
+ t.confirmed = O(n.content), t.revision = r, t.remote = new Map([...t.remote].filter(([e]) => e > r));
1046
+ for (let [e, n] of [...t.own]) e <= r && (t.own.delete(e), G(t, n));
1047
+ t === g && (f.value = r), Y(t), le(t);
1048
+ } catch (e) {
1049
+ P(e);
1050
+ } finally {
1051
+ t.recovering = !1;
1052
+ }
1053
+ }
1054
+ function pe(t) {
1055
+ let n = () => t === g && !t.retired;
1056
+ return {
1057
+ onBatch: (e) => {
1058
+ n() && J(t, e);
1059
+ },
1060
+ onResync: (r, i) => {
1061
+ if (!(!n() || r <= t.revision)) {
1062
+ if (i) try {
1063
+ e.onRemoteResync?.({
1064
+ revision: r,
1065
+ actor: i
1066
+ });
1067
+ } catch (e) {
1068
+ P(e);
1069
+ }
1070
+ X();
1071
+ }
1072
+ },
1073
+ onLock: (e) => {
1074
+ n() && ye(e);
1075
+ },
1076
+ onUnlock: (e, t) => {
1077
+ n() && be(e, t);
1078
+ },
1079
+ onMembers: (e) => {
1080
+ n() && Z(e);
1081
+ },
1082
+ onConnectionChange: (e) => {
1083
+ n() && _e(t, e);
1084
+ }
1085
+ };
1086
+ }
1087
+ function me(e, n) {
1088
+ t.join(e.templateId, { sessionId: r }, pe(e)).then((t) => {
1089
+ e.retired || e !== g ? n || t.leave() : (e.leave = t.leave, xe(t.locks, !n), Z(t.members), t.members.length > 0 && (d.value = "connected"), t.revision > e.revision && X(), n && Q());
1090
+ }, (e) => P(e));
1091
+ }
1092
+ function he(e) {
1093
+ let t = O(e.content), n = {
1094
+ templateId: e.id,
1095
+ confirmed: t,
1096
+ revision: e.revision ?? 0,
1097
+ pending: [],
1098
+ view: O(t),
1099
+ remote: /* @__PURE__ */ new Map(),
1100
+ own: /* @__PURE__ */ new Map(),
1101
+ inFlight: null,
1102
+ gapTimer: null,
1103
+ catchingUp: null,
1104
+ leave: null,
1105
+ retired: !1,
1106
+ recovering: !1,
1107
+ undo: [],
1108
+ redo: [],
1109
+ waiters: []
1110
+ };
1111
+ g = n, f.value = n.revision, L(), me(n, !1), h?.state.selectedBlockId && De(h.state.selectedBlockId), B();
1112
+ }
1113
+ function ge(e) {
1114
+ e.retired = !0, de(e), e.leave?.(), e.leave = null, q(e, /* @__PURE__ */ Error("[Templatical] The template was closed."));
1115
+ }
1116
+ function _e(e, t) {
1117
+ let n = d.value;
1118
+ d.value = t, t === "connected" && n !== null && n !== "connected" && me(e, !0);
1119
+ }
1120
+ function ve(e) {
1121
+ g && g.templateId === e?.id || (g &&= (V(), ge(g), null), l.value = [], u.value = /* @__PURE__ */ new Map(), d.value = null, T = null, Q(), L(), e && he(e));
1122
+ }
1123
+ function ye(e) {
1124
+ if (e.holder.sessionId === r) return;
1125
+ let t = new Map([...u.value].filter(([, t]) => t.holder.sessionId !== e.holder.sessionId));
1126
+ t.set(e.blockId, e), u.value = t, h?.state.selectedBlockId === e.blockId && (h.selectBlock(null), F({
1127
+ type: "selectionRefused",
1128
+ blockId: e.blockId,
1129
+ holder: e.holder
1130
+ }));
1131
+ }
1132
+ function be(e, t) {
1133
+ if (u.value.get(e)?.holder.sessionId !== t) return;
1134
+ let n = new Map(u.value);
1135
+ n.delete(e), u.value = n;
1136
+ }
1137
+ function xe(e, t) {
1138
+ let n = t ? new Map(u.value) : /* @__PURE__ */ new Map();
1139
+ for (let i of e) i.holder.sessionId !== r && (t && n.has(i.blockId) || n.set(i.blockId, i));
1140
+ u.value = n;
1141
+ }
1142
+ function Z(e) {
1143
+ let t = new Set(e.map((e) => e.sessionId)), n = new Set(l.value.map((e) => e.sessionId).filter((e) => !t.has(e)));
1144
+ if (l.value = e, n.size === 0) return;
1145
+ let r = new Map([...u.value].filter(([, e]) => !n.has(e.holder.sessionId)));
1146
+ r.size !== u.value.size && (u.value = r);
1147
+ }
1148
+ function Se(e) {
1149
+ ee = ee.then(e).catch(P);
1150
+ }
1151
+ function Q() {
1152
+ s && Se(async () => {
1153
+ if (E && (T === null || E.templateId !== T.templateId)) {
1154
+ let e = E;
1155
+ E = null, $(), await t.releaseLock(e.templateId, e.blockId);
1156
+ }
1157
+ let e = T;
1158
+ if (!(!e || E?.templateId === e.templateId && E.blockId === e.blockId)) try {
1159
+ await t.acquireLock(e.templateId, e.blockId), E = e, Ee(), Ce(e.blockId);
1160
+ } catch (n) {
1161
+ if (E?.templateId === e.templateId) {
1162
+ let e = E;
1163
+ E = null, $(), await t.releaseLock(e.templateId, e.blockId).catch(() => {});
1164
+ }
1165
+ if (T !== e) return;
1166
+ Te(e.blockId, n);
1167
+ }
1168
+ });
1169
+ }
1170
+ function Ce(e) {
1171
+ if (!u.value.has(e)) return;
1172
+ let t = new Map(u.value);
1173
+ t.delete(e), u.value = t;
1174
+ }
1175
+ function Te(e, t) {
1176
+ let n = Fe(t);
1177
+ if (n === "lock_held" || n === "block_missing") {
1178
+ T = null;
1179
+ let n = Ie(t);
1180
+ n ? ye({
1181
+ blockId: e,
1182
+ holder: n,
1183
+ expiresAt: ""
1184
+ }) : h?.state.selectedBlockId === e && h.selectBlock(null);
1185
+ } else P(t), setTimeout(() => {
1186
+ T?.blockId === e && Q();
1187
+ }, Me[0]);
1188
+ }
1189
+ function Ee() {
1190
+ j ||= setInterval(() => {
1191
+ Se(async () => {
1192
+ let e = E;
1193
+ if (e) try {
1194
+ await t.renewLock(e.templateId, e.blockId);
1195
+ } catch (e) {
1196
+ if (Fe(e) === "lock_lost") {
1197
+ E = null, $(), Q();
1198
+ return;
1199
+ }
1200
+ P(e);
1201
+ }
1202
+ });
1203
+ }, je);
1204
+ }
1205
+ function $() {
1206
+ j &&= (clearInterval(j), null);
1207
+ }
1208
+ function De(e) {
1209
+ U(), g && (T = e ? {
1210
+ templateId: g.templateId,
1211
+ blockId: e
1212
+ } : null, Q());
1213
+ }
1214
+ function Oe() {
1215
+ U(), E && s && (t.releaseLock(E.templateId, E.blockId).catch(() => {}), E = null, $()), g?.leave?.(), g && (g.leave = null);
1216
+ }
1217
+ function Pe(e) {
1218
+ let t = g;
1219
+ if (!t || v) return;
1220
+ U();
1221
+ let n = (e === "undo" ? t.undo : t.redo).pop();
1222
+ if (!n) return;
1223
+ L();
1224
+ let r;
1225
+ try {
1226
+ r = k(t.view, n.ops, I());
1227
+ } catch (e) {
1228
+ if (!(e instanceof A)) throw e;
1229
+ F({
1230
+ type: "undoSkipped",
1231
+ code: e.code
1232
+ });
1233
+ return;
1234
+ }
1235
+ let i = { ops: ke(t.view, n.ops) };
1236
+ R(e === "undo" ? t.redo : t.undo, i), t.view = r, z(r), h?.markDirty(), re(t, n.ops, e, i);
1237
+ }
1238
+ function Ve(e) {
1239
+ h = e, w.push(_(() => e.state.template, (e) => ve(e), { immediate: !0 }), _(() => e.content.value, B, { deep: !0 }), _(() => e.state.selectedBlockId, De), _(() => e.state.isLoading, (e) => e ? H(!0, !0) : B())), typeof window < "u" && (window.addEventListener("pagehide", Oe), window.addEventListener("blur", U)), n() && c(Ge);
1240
+ }
1241
+ function He() {
1242
+ U();
1243
+ let e = g;
1244
+ return !e || e.pending.length === 0 ? Promise.resolve() : new Promise((t, n) => e.waiters.push({
1245
+ resolve: t,
1246
+ reject: n
1247
+ }));
1248
+ }
1249
+ function Ue() {
1250
+ U(), v = !0;
1251
+ }
1252
+ function We() {
1253
+ v = !1, g && z(g.view);
1254
+ }
1255
+ function Ge() {
1256
+ if (!C) {
1257
+ U();
1258
+ for (let e of w.splice(0)) e();
1259
+ V(), Oe(), C = !0, g && ge(g), g = null, $(), typeof window < "u" && (window.removeEventListener("pagehide", Oe), window.removeEventListener("blur", U));
1260
+ }
1261
+ }
1262
+ return {
1263
+ sessionId: r,
1264
+ members: l,
1265
+ locks: u,
1266
+ connection: d,
1267
+ revision: f,
1268
+ canUndo: M,
1269
+ canRedo: N,
1270
+ attach: Ve,
1271
+ undo: () => Pe("undo"),
1272
+ redo: () => Pe("redo"),
1273
+ clearHistory: () => {
1274
+ g && (g.undo = [], g.redo = [], L());
1275
+ },
1276
+ flush: U,
1277
+ settle: He,
1278
+ suspend: Ue,
1279
+ resume: We,
1280
+ catchUp: X,
1281
+ hasConfirmedBlock: (e) => g ? Re(g.confirmed.blocks, e) : !1,
1282
+ destroy: Ge
1283
+ };
1284
+ }
1285
+ //#endregion
1286
+ //#region ../core/src/saved-blocks.ts
1287
+ function He(e) {
1288
+ let { provider: t } = e, n = i([]), r = i(!1), a = m(() => {
1289
+ let e = /* @__PURE__ */ new Set();
1290
+ for (let t of n.value) {
1291
+ let n = t.category?.trim();
1292
+ n && e.add(n);
1293
+ }
1294
+ return [...e].sort((e, t) => e.localeCompare(t));
1295
+ }), o = m(() => typeof t.create == "function"), s = m(() => typeof t.update == "function"), c = m(() => typeof t.delete == "function");
1296
+ function l(e) {
1297
+ return s.value && e.canUpdate !== !1;
1298
+ }
1299
+ function u(e) {
1300
+ return c.value && e.canDelete !== !1;
1301
+ }
1302
+ function d(e, t) {
1303
+ throw new M(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
1304
+ }
1305
+ function f(t) {
1306
+ J(e.onError, t);
1307
+ }
1308
+ async function p(i) {
1309
+ r.value = !0;
1310
+ try {
1311
+ n.value = await t.list(i);
1312
+ } catch (t) {
1313
+ throw e.onError?.(t), t;
1314
+ } finally {
1315
+ r.value = !1;
1316
+ }
1317
+ }
1318
+ async function h(r, i, a) {
1319
+ let { create: o } = t;
1320
+ typeof o != "function" && d("create", "disabled by the provider");
1321
+ try {
1322
+ let e = await o(a ? {
1323
+ name: r,
1324
+ content: i,
1325
+ category: a
1326
+ } : {
1327
+ name: r,
1328
+ content: i
1329
+ });
1330
+ return n.value = [e, ...n.value], f(() => t.onCreated?.(e)), e;
1331
+ } catch (t) {
1332
+ throw e.onError?.(t), t;
1333
+ }
1334
+ }
1335
+ async function g(r, i) {
1336
+ let { update: a } = t;
1337
+ typeof a != "function" && d("update", "disabled by the provider");
1338
+ let o = n.value.find((e) => e.id === r);
1339
+ o && o.canUpdate === !1 && d("update", `not permitted for entry "${r}"`);
1340
+ try {
1341
+ let e = await a(r, i);
1342
+ return n.value = n.value.map((t) => t.id === r ? e : t), f(() => t.onUpdated?.(e)), e;
1343
+ } catch (t) {
1344
+ throw e.onError?.(t), t;
1345
+ }
1346
+ }
1347
+ async function _(r) {
1348
+ let { delete: i } = t;
1349
+ typeof i != "function" && d("delete", "disabled by the provider");
1350
+ let a = n.value.find((e) => e.id === r) ?? null;
1351
+ a && a.canDelete === !1 && d("delete", `not permitted for entry "${r}"`);
1352
+ try {
1353
+ await i(r), n.value = n.value.filter((e) => e.id !== r), a && f(() => t.onDeleted?.(a));
1354
+ } catch (t) {
1355
+ throw e.onError?.(t), t;
1356
+ }
1357
+ }
1358
+ return {
1359
+ savedBlocks: n,
1360
+ isLoading: r,
1361
+ categories: a,
1362
+ canCreate: o,
1363
+ canUpdate: s,
1364
+ canDelete: c,
1365
+ canUpdateBlock: l,
1366
+ canDeleteBlock: u,
1367
+ load: p,
1368
+ create: h,
1369
+ update: g,
1370
+ remove: _
1371
+ };
1372
+ }
1373
+ //#endregion
1374
+ //#region ../core/src/saved-blocks-local.ts
1375
+ var Ue = "templatical:saved-blocks";
1376
+ function We(e = {}) {
1377
+ let t = e.key ?? Ue;
1378
+ function n() {
1379
+ 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.");
1380
+ return localStorage;
1381
+ }
1382
+ function r() {
1383
+ let e = n().getItem(t);
1384
+ if (!e) return [];
1385
+ try {
1386
+ let t = JSON.parse(e);
1387
+ return Array.isArray(t) ? t : [];
1388
+ } catch {
1389
+ return [];
1390
+ }
1391
+ }
1392
+ function i(e) {
1393
+ n().setItem(t, JSON.stringify(e));
1394
+ }
1395
+ return {
1396
+ async list(e) {
1397
+ let t = r(), n = e?.search?.trim().toLowerCase(), i = e?.category?.trim();
1398
+ return t.filter((e) => !(n && !e.name.toLowerCase().includes(n) || i && e.category !== i));
1399
+ },
1400
+ async create(e) {
1401
+ let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
1402
+ id: I(),
1403
+ name: e.name,
1404
+ content: e.content,
1405
+ ...e.category ? { category: e.category } : {},
1406
+ createdAt: t,
1407
+ updatedAt: t
1408
+ };
1409
+ return i([n, ...r()]), n;
1410
+ },
1411
+ async update(e, t) {
1412
+ let n = r(), a = n.findIndex((t) => t.id === e);
1413
+ if (a === -1) throw Error(`[Templatical] Saved block not found: ${e}`);
1414
+ let o = {
1415
+ ...n[a],
1416
+ ...t,
1417
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1418
+ }, s = [...n];
1419
+ return s[a] = o, i(s), o;
1420
+ },
1421
+ async delete(e) {
1422
+ let t = r();
1423
+ if (!t.some((t) => t.id === e)) throw Error(`[Templatical] Saved block not found: ${e}`);
1424
+ i(t.filter((t) => t.id !== e));
1425
+ }
1426
+ };
1427
+ }
1428
+ //#endregion
1429
+ //#region ../core/src/media-local.ts
1430
+ var Ge = "templatical:media", Ke = 50;
1431
+ function qe(e = {}) {
1432
+ let t = e.key ?? Ge;
1433
+ function n() {
1434
+ 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.");
1435
+ return localStorage;
1436
+ }
1437
+ function r() {
1438
+ let e = n().getItem(t);
1439
+ if (!e) return [];
1440
+ try {
1441
+ let t = JSON.parse(e);
1442
+ return Array.isArray(t) ? t : [];
1443
+ } catch {
1444
+ return [];
1445
+ }
1446
+ }
1447
+ function i(e) {
1448
+ n().setItem(t, JSON.stringify(e));
1449
+ }
1450
+ function a(e) {
1451
+ return typeof FileReader > "u" ? Promise.reject(/* @__PURE__ */ Error("[Templatical] createLocalStorageMediaProvider requires a browser environment with FileReader.")) : new Promise((t, n) => {
1452
+ let r = new FileReader();
1453
+ r.onload = () => {
1454
+ typeof r.result == "string" ? t(r.result) : n(/* @__PURE__ */ Error("[Templatical] Failed to read file as a data URL."));
1455
+ }, r.onerror = () => {
1456
+ n(r.error ?? /* @__PURE__ */ Error("[Templatical] Failed to read file as a data URL."));
1457
+ }, r.readAsDataURL(e);
1458
+ });
1459
+ }
1460
+ return {
1461
+ async list(e) {
1462
+ let t = r(), n = e?.search?.trim().toLowerCase(), i = n ? t.filter((e) => {
1463
+ let t = e.filename?.toLowerCase() ?? "", r = e.alt?.toLowerCase() ?? "";
1464
+ return t.includes(n) || r.includes(n);
1465
+ }) : t, a = e?.cursor ? Number.parseInt(e.cursor, 10) : 0, o = Number.isFinite(a) && a > 0 ? a : 0, s = i.slice(o, o + Ke), c = { items: s }, l = o + s.length;
1466
+ return l < i.length && (c.nextCursor = String(l)), c;
1467
+ },
1468
+ async create(e) {
1469
+ let t = await a(e.file), n = (/* @__PURE__ */ new Date()).toISOString(), o = {
1470
+ id: I(),
1471
+ url: t,
1472
+ filename: e.filename || e.file.name,
1473
+ createdAt: n,
1474
+ updatedAt: n,
1475
+ size: e.file.size
1476
+ };
1477
+ 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;
1478
+ },
1479
+ async update(e, t) {
1480
+ let n = r(), a = n.findIndex((t) => t.id === e);
1481
+ if (a === -1) throw Error(`[Templatical] Media asset not found: ${e}`);
1482
+ let o = n[a], s = {
1483
+ ...o,
1484
+ ...t,
1485
+ id: o.id,
1486
+ url: o.url,
1487
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1488
+ }, c = [...n];
1489
+ return c[a] = s, i(c), s;
1490
+ },
1491
+ async delete(e) {
1492
+ let t = r();
1493
+ for (let n of e) if (!t.some((e) => e.id === n)) throw Error(`[Templatical] Media asset not found: ${n}`);
1494
+ let n = new Set(e);
1495
+ i(t.filter((e) => !n.has(e.id)));
1496
+ },
1497
+ folders: !1,
1498
+ replace: !1,
1499
+ importFromUrl: !1,
1500
+ checkUsage: !1,
1501
+ frequentlyUsed: !1,
1502
+ storage: !1
1503
+ };
1504
+ }
1505
+ //#endregion
1506
+ //#region ../core/src/version-history.ts
1507
+ function Je(e) {
1508
+ let { provider: t, getTemplateId: n } = e, r = i([]), a = i(!1), o = i(void 0), s = i(!1), c = /* @__PURE__ */ new Map(), l = m(() => typeof t.create == "function"), u = m(() => typeof t.restore == "function");
1509
+ function d(e) {
1510
+ let t = n();
1511
+ if (!t) throw new M(`[Templatical] Version history: ${e} needs a template. Call create() or load() first.`);
1512
+ return t;
1513
+ }
1514
+ function f(e) {
1515
+ throw new M(`[Templatical] Version history: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
1516
+ }
1517
+ function p(t) {
1518
+ J(e.onError, t);
1519
+ }
1520
+ async function h(n) {
1521
+ let i = d("list");
1522
+ a.value = !0;
1523
+ try {
1524
+ let e = await t.list(i, n);
1525
+ r.value = e.versions, o.value = e.nextCursor;
1526
+ } catch (t) {
1527
+ throw e.onError?.(t), t;
1528
+ } finally {
1529
+ a.value = !1;
1530
+ }
1531
+ }
1532
+ function g(e) {
1533
+ return e.content ?? c.get(e.id) ?? null;
1534
+ }
1535
+ async function _(n) {
1536
+ let r = g(n);
1537
+ if (r) return r;
1538
+ let i = d("get");
1539
+ try {
1540
+ let e = await t.get(i, n.id);
1541
+ return c.set(n.id, e), e;
1542
+ } catch (t) {
1543
+ throw e.onError?.(t), t;
1544
+ }
1545
+ }
1546
+ async function v(n, i) {
1547
+ let { create: a } = t;
1548
+ typeof a != "function" && f("create");
1549
+ let o = d("create");
1550
+ try {
1551
+ let e = await a(o, n, i);
1552
+ return r.value = [e, ...r.value], p(() => t.onCreated?.(e)), e;
1553
+ } catch (t) {
1554
+ throw e.onError?.(t), t;
1555
+ }
1556
+ }
1557
+ async function y(n) {
1558
+ let { restore: r } = t;
1559
+ typeof r != "function" && f("restore");
1560
+ let i = d("restore"), a;
1561
+ s.value = !0;
1562
+ try {
1563
+ a = await r(i, n);
1564
+ } catch (t) {
1565
+ throw e.onError?.(t), t;
1566
+ } finally {
1567
+ s.value = !1;
1568
+ }
1569
+ return p(() => t.onRestored?.(a)), a;
1570
+ }
1571
+ return {
1572
+ nextCursor: o,
1573
+ versions: r,
1574
+ isLoading: a,
1575
+ isRestoring: s,
1576
+ canCreate: l,
1577
+ canRestore: u,
1578
+ load: h,
1579
+ peekContent: g,
1580
+ resolveContent: _,
1581
+ create: v,
1582
+ restore: y
1583
+ };
1584
+ }
1585
+ //#endregion
1586
+ //#region ../core/src/comments.ts
1587
+ function Ye(e) {
1588
+ let { provider: t, getTemplateId: n, getUser: r } = e, a = i([]), o = i(!1), s = i(!1), c = m(() => typeof t.create == "function"), l = m(() => typeof t.update == "function"), u = m(() => typeof t.delete == "function"), d = m(() => typeof t.setResolved == "function"), f = m(() => a.value.reduce((e, t) => e + 1 + (t.replies?.length ?? 0), 0)), p = m(() => a.value.filter((e) => !e.resolvedAt).length), h = m(() => {
1589
+ let e = /* @__PURE__ */ new Map();
1590
+ for (let t of a.value) t.blockId && e.set(t.blockId, (e.get(t.blockId) ?? 0) + 1 + (t.replies?.length ?? 0));
1591
+ return e;
1592
+ });
1593
+ function g(e) {
1594
+ let t = n();
1595
+ if (!t) throw new M(`[Templatical] Comments: ${e} needs a template. Call create() or load() first.`);
1596
+ return t;
1597
+ }
1598
+ function _(e) {
1599
+ let t = r();
1600
+ if (!t) throw new M(`[Templatical] Comments: ${e} needs to know who is commenting. Pass init({ user: { id, name } }) — an unattributed comment is not written.`);
1601
+ return t;
1602
+ }
1603
+ function v(e) {
1604
+ throw new M(`[Templatical] Comments: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
1605
+ }
1606
+ function y(e) {
1607
+ for (let t of a.value) {
1608
+ if (t.id === e) return t;
1609
+ for (let n of t.replies ?? []) if (n.id === e) return n;
1610
+ }
1611
+ return null;
1612
+ }
1613
+ function b(e) {
1614
+ let t = r();
1615
+ return t !== null && e.author.id === t.id;
1616
+ }
1617
+ function x(t) {
1618
+ let n = q(t);
1619
+ throw e.onError?.(n), n;
1620
+ }
1621
+ function S(t) {
1622
+ J(e.onError, t);
1623
+ }
1624
+ function C(e, t, n) {
1625
+ return [
1626
+ ...e.slice(0, t),
1627
+ n,
1628
+ ...e.slice(t + 1)
1629
+ ];
1630
+ }
1631
+ function w(e, t) {
1632
+ return e !== void 0 && JSON.stringify(e) === JSON.stringify(t);
1633
+ }
1634
+ function T(e) {
1635
+ if (e.parentId) {
1636
+ let t = !1, n = a.value.map((n) => {
1637
+ if (n.id !== e.parentId) return n;
1638
+ let r = n.replies ?? [], i = r.findIndex((t) => t.id === e.id);
1639
+ return i !== -1 && w(r[i], e) ? n : (t = !0, {
1640
+ ...n,
1641
+ replies: i === -1 ? [...r, e] : C(r, i, e)
1642
+ });
1643
+ });
1644
+ return t && (a.value = n), t;
1645
+ }
1646
+ let t = a.value.findIndex((t) => t.id === e.id);
1647
+ if (t === -1) return a.value = [...a.value, e], !0;
1648
+ let n = {
1649
+ ...e,
1650
+ replies: e.replies ?? a.value[t].replies
1651
+ };
1652
+ return !w(a.value[t], n) && (a.value = C(a.value, t, n), !0);
1653
+ }
1654
+ function E(e, t) {
1655
+ let n = y(e), r = t ?? n?.parentId ?? null;
1656
+ return r ? a.value = a.value.map((t) => t.id === r ? {
1657
+ ...t,
1658
+ replies: (t.replies ?? []).filter((t) => t.id !== e)
1659
+ } : t) : a.value = a.value.filter((t) => t.id !== e), n;
1660
+ }
1661
+ async function ee(e) {
1662
+ let n = g("list");
1663
+ o.value = !0;
1664
+ try {
1665
+ a.value = await t.list(n, e);
1666
+ } catch (e) {
1667
+ x(e);
1668
+ } finally {
1669
+ o.value = !1;
1670
+ }
1671
+ }
1672
+ async function D(e) {
1673
+ let { create: n } = t;
1674
+ typeof n != "function" && v("create");
1675
+ let r = g("create");
1676
+ _("create"), s.value = !0;
1677
+ try {
1678
+ let i = await n(r, e);
1679
+ return T(i), S(() => t.onCreated?.(i, { origin: "local" })), i;
1680
+ } catch (e) {
1681
+ x(e);
1682
+ } finally {
1683
+ s.value = !1;
1684
+ }
1685
+ }
1686
+ async function O(e, n) {
1687
+ let { update: r } = t;
1688
+ typeof r != "function" && v("update");
1689
+ let i = g("update");
1690
+ _("update"), s.value = !0;
1691
+ try {
1692
+ let a = await r(i, e, n);
1693
+ return T(a), S(() => t.onUpdated?.(a, { origin: "local" })), a;
1694
+ } catch (e) {
1695
+ x(e);
1696
+ } finally {
1697
+ s.value = !1;
1698
+ }
1699
+ }
1700
+ async function k(e) {
1701
+ let { delete: n } = t;
1702
+ typeof n != "function" && v("delete");
1703
+ let r = g("delete");
1704
+ _("delete");
1705
+ let i = y(e);
1706
+ s.value = !0;
1707
+ try {
1708
+ await n(r, e), E(e), i && S(() => t.onDeleted?.(i, { origin: "local" }));
1709
+ } catch (e) {
1710
+ x(e);
1711
+ } finally {
1712
+ s.value = !1;
1713
+ }
1714
+ }
1715
+ async function A(e, n) {
1716
+ let { setResolved: r } = t;
1717
+ typeof r != "function" && v("setResolved");
1718
+ let i = g("setResolved");
1719
+ _("setResolved"), s.value = !0;
1720
+ try {
1721
+ let a = await r(i, e, n);
1722
+ return T(a), S(() => (a.resolvedAt ? t.onResolved : t.onUnresolved)?.(a, { origin: "local" })), a;
1723
+ } catch (e) {
1724
+ x(e);
1725
+ } finally {
1726
+ s.value = !1;
1727
+ }
1728
+ }
1729
+ function j(e) {
1730
+ T(e) && S(() => t.onCreated?.(e, { origin: "remote" }));
1731
+ }
1732
+ function N(e) {
1733
+ T(e) && S(() => (e.resolvedAt ? t.onResolved : t.onUpdated)?.(e, { origin: "remote" }));
1734
+ }
1735
+ function P(e, n) {
1736
+ let r = E(e, n);
1737
+ r && S(() => t.onDeleted?.(r, { origin: "remote" }));
1738
+ }
1739
+ return {
1740
+ comments: a,
1741
+ isLoading: o,
1742
+ isSubmitting: s,
1743
+ canCreate: c,
1744
+ canUpdate: l,
1745
+ canDelete: u,
1746
+ canResolve: d,
1747
+ totalCount: f,
1748
+ unresolvedCount: p,
1749
+ commentCountByBlock: h,
1750
+ load: ee,
1751
+ create: D,
1752
+ update: O,
1753
+ remove: k,
1754
+ setResolved: A,
1755
+ find: y,
1756
+ isOwn: b,
1757
+ applyRemoteCreate: j,
1758
+ applyRemoteUpdate: N,
1759
+ applyRemoteDelete: P
1760
+ };
1761
+ }
1762
+ function Xe(t) {
1763
+ let { comments: n, provider: r, getTemplateId: i } = t, { subscribe: a } = r;
1764
+ if (typeof a != "function") return;
1765
+ let o = null;
1766
+ function s() {
1767
+ o?.(), o = null;
1768
+ }
1769
+ e(() => i(), (e) => {
1770
+ s(), e && (o = a(e, (e) => {
1771
+ switch (e.type) {
1772
+ case "created":
1773
+ n.applyRemoteCreate(e.comment);
1774
+ break;
1775
+ case "updated":
1776
+ n.applyRemoteUpdate(e.comment);
1777
+ break;
1778
+ case "deleted": n.applyRemoteDelete(e.commentId, e.parentId);
1779
+ }
1780
+ }));
1781
+ }, { immediate: !0 }), c(s);
1782
+ }
1783
+ //#endregion
1784
+ //#region src/composables/useImageUrlResolver.ts
1785
+ function Ze(e) {
1786
+ let t = s(/* @__PURE__ */ new Map()), n = /* @__PURE__ */ new Set();
1787
+ function r(e) {
1788
+ return t.get(e);
1789
+ }
1790
+ function i(e) {
1791
+ return t.has(e) || n.has(e);
1792
+ }
1793
+ function a(r) {
1794
+ if (i(r)) return;
1795
+ let a;
1796
+ try {
1797
+ a = e(r);
1798
+ } catch {
1799
+ t.set(r, null);
1800
+ return;
1801
+ }
1802
+ a === null || typeof a == "string" ? t.set(r, a) : (n.add(r), Promise.resolve(a).then((e) => {
1803
+ t.set(r, typeof e == "string" ? e : null);
1804
+ }, () => {
1805
+ t.set(r, null);
1806
+ }).finally(() => n.delete(r)));
1807
+ }
1808
+ return {
1809
+ get: r,
1810
+ has: i,
1811
+ lookup: a
1812
+ };
1813
+ }
1814
+ function Qe(r) {
1815
+ let i = t(re, null), a = m(r);
1816
+ if (!i) return a;
1817
+ let o;
1818
+ function s() {
1819
+ o !== void 0 && (clearTimeout(o), o = void 0);
1820
+ }
1821
+ n() && c(s);
1822
+ let l = !0;
1823
+ return e(a, (e) => {
1824
+ s();
1825
+ let t = l;
1826
+ l = !1, e && !i.has(e) && (t ? i.lookup(e) : o = setTimeout(() => {
1827
+ o = void 0, i.lookup(e);
1828
+ }, 300));
1829
+ }, { immediate: !0 }), m(() => {
1830
+ let e = a.value;
1831
+ if (!e) return e;
1832
+ let t = i.get(e);
1833
+ return typeof t == "string" && t.length > 0 ? t : e;
1834
+ });
1835
+ }
1836
+ function $e(e, t) {
1837
+ if (!e || !t) return t;
1838
+ let n = e.get(t);
1839
+ return typeof n == "string" && n.length > 0 ? n : t;
1840
+ }
1841
+ function et(e, t) {
1842
+ return typeof e?.url == "string" && L(e.url, t);
1843
+ }
1844
+ function tt(e, t) {
1845
+ let n = e?.url;
1846
+ if (typeof n == "string" && n.trim() !== "") return L(n, t) ? void 0 : n;
1847
+ }
1848
+ function nt(e) {
1849
+ let n = t(U, N.liquid), r = Qe(() => tt(e(), n));
1850
+ return m(() => et(e(), n) ? null : r.value);
1851
+ }
1852
+ function rt(e, t, n) {
1853
+ return et(t, n) ? null : $e(e, tt(t, n));
1854
+ }
1855
+ //#endregion
1856
+ //#region src/utils/blockTypeLabels.ts
1857
+ function it(e, t) {
1858
+ return t.blocks[e] ?? e;
1859
+ }
1860
+ function at(e, t, n = []) {
1861
+ if (e.type !== "custom") return it(e.type, t);
1862
+ let { customType: r } = e;
1863
+ return n.find((e) => e.type === r)?.name ?? r;
1864
+ }
1865
+ //#endregion
1866
+ //#region src/utils/resolveFieldColors.ts
1867
+ function ot(e, t) {
1868
+ let n = G({ presets: e.presets }, ae), r = n.presets.length === 0;
1869
+ return {
1870
+ presets: r ? t.presets : n.presets,
1871
+ allowCustom: t.allowCustom === !1 ? !1 : e.allowCustom ?? t.allowCustom,
1872
+ invalidPresets: n.invalidPresets,
1873
+ emptyPresets: e.presets !== void 0 && e.presets.length === 0,
1874
+ presetsInherited: r,
1875
+ allowCustomIgnored: e.allowCustom === !0 && t.allowCustom === !1
1876
+ };
1877
+ }
1878
+ //#endregion
1879
+ //#region src/utils/imageNaturalSize.ts
1880
+ function st(e) {
1881
+ return typeof e == "number" && Number.isFinite(e) && e > 0;
1882
+ }
1883
+ function ct(e, t) {
1884
+ return st(e) && st(t) ? {
1885
+ width: e,
1886
+ height: t
1887
+ } : null;
1888
+ }
1889
+ function lt(e) {
1890
+ return ct(e.naturalWidth, e.naturalHeight);
1891
+ }
1892
+ function ut(e) {
1893
+ return e ? {
1894
+ naturalWidth: e.width,
1895
+ naturalHeight: e.height
1896
+ } : {
1897
+ naturalWidth: void 0,
1898
+ naturalHeight: void 0
1899
+ };
1900
+ }
1901
+ function dt(e, t) {
1902
+ if (typeof Image > "u") return t(null), () => {};
1903
+ let n = new Image(), r = () => {
1904
+ n.onload = null, n.onerror = null;
1905
+ };
1906
+ return n.onload = () => {
1907
+ r(), t(ct(n.naturalWidth, n.naturalHeight));
1908
+ }, n.onerror = () => {
1909
+ r(), t(null);
1910
+ }, n.src = e, r;
1911
+ }
1912
+ function ft(e) {
1913
+ return new Promise((t) => {
1914
+ let n = setTimeout(() => {
1915
+ r(), t(null);
1916
+ }, W), r = dt(e, (e) => {
1917
+ clearTimeout(n), t(e);
1918
+ });
1919
+ });
1920
+ }
1921
+ //#endregion
1922
+ //#region src/components/MediaDropOverlay.vue
1923
+ var pt = /* @__PURE__ */ a({
1924
+ __name: "MediaDropOverlay",
1925
+ props: {
1926
+ uploading: { type: Boolean },
1927
+ size: { default: "field" }
1928
+ },
1929
+ setup(e) {
1930
+ let t = e, { t: n } = ie(), i = {
1931
+ field: {
1932
+ gap: "tpl:gap-1.5",
1933
+ icon: 18,
1934
+ veil: "90%"
1935
+ },
1936
+ canvas: {
1937
+ gap: "tpl:gap-2",
1938
+ icon: 20,
1939
+ veil: "85%"
1940
+ }
1941
+ }, a = m(() => i[t.size]);
1942
+ return (t, i) => (r(), h("div", {
1943
+ class: f(["tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-xs tpl:font-medium tpl:border-[var(--tpl-primary)] tpl:text-[var(--tpl-primary)]", a.value.gap]),
1944
+ style: g({ backgroundColor: `color-mix(in srgb, var(--tpl-bg) ${a.value.veil}, transparent)` })
1945
+ }, [e.uploading ? (r(), h(y, { key: 0 }, [d(u(oe), {
1946
+ class: "tpl-spinner",
1947
+ size: a.value.icon,
1948
+ "stroke-width": 2
1949
+ }, null, 8, ["size"]), x(" " + b(u(n).image.uploading), 1)], 64)) : (r(), h(y, { key: 1 }, [d(u(se), {
1950
+ size: a.value.icon,
1951
+ "stroke-width": 1.5
1952
+ }, null, 8, ["size"]), x(" " + b(u(n).image.dropToUpload), 1)], 64))], 6));
1953
+ }
1954
+ }), mt = "image/";
1955
+ function ht(e) {
1956
+ let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || v(r), { isOverDropZone: a } = V(t, {
1957
+ preventDefaultForUnhandled: !0,
1958
+ onDrop: (e) => {
1959
+ if (!i()) return;
1960
+ let t = (e ?? []).filter((e) => e.type.startsWith(mt));
1961
+ t.length > 0 && n([t[0]]);
1962
+ }
1963
+ });
1964
+ return { isOver: m(() => i() && a.value) };
1965
+ }
1966
+ //#endregion
1967
+ //#region src/composables/useMediaDropField.ts
1968
+ function gt(e) {
1969
+ let { target: n, blocked: r, apply: a } = e, o = t(H, null), s = t(ne, null), c = K();
1970
+ async function l() {
1971
+ let e = await o?.({ accept: ["images"] });
1972
+ c.alive && e && a(e);
1973
+ }
1974
+ let u = i(!1), d = m(() => (s?.value ?? !!o) && !u.value && !v(r));
1975
+ async function f(e) {
1976
+ if (o) {
1977
+ u.value = !0;
1978
+ try {
1979
+ let t = await o({
1980
+ accept: ["images"],
1981
+ files: e
1982
+ });
1983
+ if (!c.alive) return;
1984
+ t && a(t);
1985
+ } finally {
1986
+ c.alive && (u.value = !1);
1987
+ }
1988
+ }
1989
+ }
1990
+ let { isOver: p } = ht({
1991
+ target: n,
1992
+ enabled: d,
1993
+ onFiles: f
1994
+ }), h = m(() => d.value && p.value || u.value);
1995
+ return {
1996
+ canBrowse: !!o,
1997
+ dropEnabled: d,
1998
+ isUploading: u,
1999
+ showOverlay: h,
2000
+ openMediaBrowser: l
2001
+ };
2002
+ }
2003
+ function _t(e, t = "desktop") {
2004
+ return t === "mobile" ? 375 : e?.width ?? 600;
2005
+ }
2006
+ var vt = "width 300ms cubic-bezier(0.34, 1.56, 0.64, 1)", yt = {
2007
+ 1: [100],
2008
+ 2: [50, 50],
2009
+ 3: [
2010
+ 33.33,
2011
+ 33.33,
2012
+ 33.34
2013
+ ],
2014
+ "1-2": [33.33, 66.67],
2015
+ "2-1": [66.67, 33.33]
2016
+ };
2017
+ function bt(e, t) {
2018
+ let n = (e) => Math.trunc(e ?? 0), r = (e) => T(e) === null ? 0 : Math.trunc(e.width);
2019
+ return n(e?.left) + n(e?.right) + r(t?.left) + r(t?.right);
2020
+ }
2021
+ function xt(e, t) {
2022
+ return Math.floor(e) - bt(t);
2023
+ }
2024
+ function St(e, t) {
2025
+ let n = "border" in e ? e.border : void 0;
2026
+ return Math.floor(t) - bt(e.styles.padding, n);
2027
+ }
2028
+ function* Ct(e, t) {
2029
+ for (let n of e) F(n) ? yield* Ct(n.children, xt(t, n.styles.padding)) : yield {
2030
+ block: n,
2031
+ bandWidth: P(n) && n.wrapper ? xt(t, n.wrapper.padding) : t
2032
+ };
2033
+ }
2034
+ function wt(e, t) {
2035
+ if (!t) return e;
2036
+ try {
2037
+ return z(t, e);
2038
+ } catch {
2039
+ return e;
2040
+ }
2041
+ }
2042
+ function Tt(e, t, n) {
2043
+ let r = wt(e, n);
2044
+ for (let { block: e, bandWidth: n } of Ct(r.blocks, r.settings.width)) if (P(e)) {
2045
+ let r = C(e)?.applied ? void 0 : e.border, i = Math.floor(n) - bt(e.styles.padding, r), a = yt[e.columns] ?? [100];
2046
+ for (let n = 0; n < e.children.length; n++) {
2047
+ let r = Math.floor(i * (a[n] ?? 100) / 100), o = e.children[n].find((e) => e.id === t);
2048
+ if (o) return St(o, r);
2049
+ }
2050
+ } else if (e.id === t) return St(e, n);
2051
+ return null;
2052
+ }
2053
+ function Et(e, t, n) {
2054
+ let r = wt(e, n);
2055
+ for (let { block: e, bandWidth: n } of Ct(r.blocks, r.settings.width)) if (e.id === t) return Math.floor(n);
2056
+ return null;
2057
+ }
2058
+ function Dt(e, t, n) {
2059
+ if (!P(e)) return;
2060
+ let r = C(e);
2061
+ if (r?.applied && r.height === "image") return (t ? Et(t, e.id, n) : null) ?? _t(t?.settings);
2062
+ }
2063
+ //#endregion
2064
+ //#region src/constants/socialIcons.ts
2065
+ var Ot = B, kt = {
2066
+ small: 24,
2067
+ medium: 32,
2068
+ large: 48
2069
+ }, At = [
2070
+ "facebook",
2071
+ "twitter",
2072
+ "instagram",
2073
+ "linkedin",
2074
+ "youtube",
2075
+ "tiktok",
2076
+ "pinterest",
2077
+ "email",
2078
+ "website",
2079
+ "whatsapp",
2080
+ "telegram",
2081
+ "discord",
2082
+ "snapchat",
2083
+ "reddit",
2084
+ "github",
2085
+ "dribbble",
2086
+ "behance"
2087
+ ];
2088
+ //#endregion
2089
+ export { Ve as A, Qe as C, qe as D, Je as E, pe as F, X as I, de as L, he as M, me as N, We as O, fe as P, ce as R, nt as S, Ye as T, at as _, Dt as a, tt as b, _t as c, dt as d, ft as f, ot as g, ct as h, Tt as i, ge as j, He as k, gt as l, lt as m, Ot as n, Et as o, ut as p, At as r, vt as s, kt as t, pt as u, it as v, Xe as w, rt as x, Ze as y };
2090
+
2091
+ //# sourceMappingURL=socialIcons-CkZSYpoG.js.map