@alfadocs/ui-kit 1.50.1 → 1.52.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 (597) hide show
  1. package/dist/_chunks/{actions-cell-renderer-DMittsR3.js → actions-cell-renderer-DhmUGzRY.js} +5 -5
  2. package/dist/_chunks/{address-autocomplete-Dp5uMvKP.js → address-autocomplete-BVLoHU3E.js} +3 -3
  3. package/dist/_chunks/{address-fields-QfC-N3pw.js → address-fields-UiEXHxEX.js} +9 -9
  4. package/dist/_chunks/{agenda-card-CjjxlA9K.js → agenda-card-CakEvwnM.js} +4 -4
  5. package/dist/_chunks/{agenda-tray-BhZASyJm.js → agenda-tray-C-_iu6Fo.js} +5 -5
  6. package/dist/_chunks/{ai-credits-notice-C-kz_RrY.js → ai-credits-notice-Da0fJPXO.js} +5 -5
  7. package/dist/_chunks/{ai-permission-notice-BRZeS3mT.js → ai-permission-notice-C5q_uHBA.js} +7 -7
  8. package/dist/_chunks/{ai-prompt-input-CxvnXsAs.js → ai-prompt-input-IObcUWqB.js} +5 -5
  9. package/dist/_chunks/{alert-CiQ5Pa3Q.js → alert-BhCstf2h.js} +3 -3
  10. package/dist/_chunks/{alia-sidebar-Dx-oeOV2.js → alia-sidebar-DyQMsyiz.js} +23 -23
  11. package/dist/_chunks/{anamnesis-card-D8Si-2GV.js → anamnesis-card-D4RWzQXP.js} +5 -5
  12. package/dist/_chunks/{anamnesis-summary-card-DPyScUMM.js → anamnesis-summary-card-Bv0CZ-mk.js} +3 -3
  13. package/dist/_chunks/anamnesis-summary-rows-DaSoA80I.js +20926 -0
  14. package/dist/_chunks/{annotation-marker-CsUJGZjQ.js → annotation-marker-D-M7y4R1.js} +2 -2
  15. package/dist/_chunks/{antenatal-schedule-timeline-8fm3vPSV.js → antenatal-schedule-timeline-BZzgjfyd.js} +13 -13
  16. package/dist/_chunks/{app-frame-DIEMIC5V.js → app-frame-Cos-GSfw.js} +5 -5
  17. package/dist/_chunks/{appointment-card-BgLpE6T5.js → appointment-card-CA2ynsmN.js} +8 -8
  18. package/dist/_chunks/{appointment-peek-Dk11UOVW.js → appointment-peek-DpPzeYXm.js} +6 -6
  19. package/dist/_chunks/{appointment-timeline-wQ-PdkFV.js → appointment-timeline-BZErHbD1.js} +7 -7
  20. package/dist/_chunks/{appointment-tray-D7Gt6m8x.js → appointment-tray-DR_Zm4Gw.js} +10 -10
  21. package/dist/_chunks/{appointment-workflow-status-CS8ufF1f.js → appointment-workflow-status-DrWCNLbB.js} +2 -2
  22. package/dist/_chunks/{ar-BR1FGFP2.js → ar-pLopgMbL.js} +12 -12
  23. package/dist/_chunks/{audio-recorder-DZBtAvLH.js → audio-recorder-BafA28cX.js} +7 -7
  24. package/dist/_chunks/{audio-visualiser-l6zPd0AG.js → audio-visualiser-CK2JyQW1.js} +2 -2
  25. package/dist/_chunks/{autocomplete-DSasZUf6.js → autocomplete-IfLaXwyb.js} +3 -3
  26. package/dist/_chunks/{avatar-BVvjKNTp.js → avatar-DYtwj1-R.js} +2 -2
  27. package/dist/_chunks/{badge-BAkd6_Pj.js → badge-hnBt8o7n.js} +6 -6
  28. package/dist/_chunks/{balance-badge-cell-klaxFNL_.js → balance-badge-cell-CS-iKkLM.js} +8 -8
  29. package/dist/_chunks/{bishop-score-BMLRvXYF.js → bishop-score-BfDsm9HH.js} +6 -6
  30. package/dist/_chunks/{bmi-calculator-DUhRyyrA.js → bmi-calculator-BNtmMzQy.js} +6 -6
  31. package/dist/_chunks/{booking-Cdzd8kyY.js → booking-DP543-BT.js} +43 -42
  32. package/dist/_chunks/{breadcrumb-D3boYzD4.js → breadcrumb-xgVpPH2H.js} +4 -4
  33. package/dist/_chunks/{button-18oBsI3n.js → button-CYPx2xFq.js} +38 -36
  34. package/dist/_chunks/{button-group-BSDqso_C.js → button-group-DnSR6eN6.js} +30 -30
  35. package/dist/_chunks/{calculator-dialog-C0ixc3SU.js → calculator-dialog-BRjZMWuE.js} +2 -2
  36. package/dist/_chunks/calendar-BwF5nQuW.js +1469 -0
  37. package/dist/_chunks/{calendar-event-card-DyFSIehr.js → calendar-event-card-DXAYWH6k.js} +2 -2
  38. package/dist/_chunks/calendar-workspace-B9MKJXER.js +10608 -0
  39. package/dist/_chunks/{care-plan-card-ciBaaguw.js → care-plan-card-BanlKJZn.js} +8 -8
  40. package/dist/_chunks/{care-plan-entry-card-D7A0whiZ.js → care-plan-entry-card-ByqT84_P.js} +9 -9
  41. package/dist/_chunks/{care-plan-header-DKV1gLqv.js → care-plan-header-BwfUHMgM.js} +6 -6
  42. package/dist/_chunks/{carousel.agent-DqDGR2yH.js → carousel.agent-WKODAYVw.js} +6 -6
  43. package/dist/_chunks/{chart-VjuXDXOZ.js → chart-CuE30cfr.js} +4 -4
  44. package/dist/_chunks/{chat-container-CYYego1W.js → chat-container-CAfyTxat.js} +3 -3
  45. package/dist/_chunks/{chat-input-BVho_SqP.js → chat-input-DA10w969.js} +3 -3
  46. package/dist/_chunks/{chat-message-B4ihjNy3.js → chat-message-DoMjMa-M.js} +6 -6
  47. package/dist/_chunks/{checkbox-group-DomUzpkF.js → checkbox-group-C7czpHmJ.js} +2 -2
  48. package/dist/_chunks/{city-input-BGYc4lRV.js → city-input-CAnTVgBZ.js} +10 -10
  49. package/dist/_chunks/{clinical-note-card-B7s5BtEl.js → clinical-note-card-kvlUrmP-.js} +6 -6
  50. package/dist/_chunks/{code-block-C_eNHWaa.js → code-block-NtHjtagI.js} +6 -6
  51. package/dist/_chunks/{color-picker-Bl5f0iK1.js → color-picker-Yl99lHuF.js} +3 -3
  52. package/dist/_chunks/{combobox-B_rLwmSv.js → combobox-Iel8y3u6.js} +2 -2
  53. package/dist/_chunks/{command-palette-DhgGo7GJ.js → command-palette-D9TBzmOG.js} +4 -4
  54. package/dist/_chunks/{connection-status-Cfux3TvH.js → connection-status-Dz8o-Fui.js} +5 -5
  55. package/dist/_chunks/{contact-card-0hnFJwrz.js → contact-card-D2gXrxlL.js} +12 -12
  56. package/dist/_chunks/{contact-profile-card-Dj4NgBL-.js → contact-profile-card-B7cXr8g5.js} +5 -5
  57. package/dist/_chunks/{control-room-rail-DAO0qfOI.js → control-room-rail-B446rHSL.js} +4 -4
  58. package/dist/_chunks/{copy-field-Cm4y5Bff.js → copy-field-CiIuVbKe.js} +3 -3
  59. package/dist/_chunks/{country-select-C5jZjO8O.js → country-select-BYa4BrEi.js} +3 -3
  60. package/dist/_chunks/{cycle-calculator-B9lBRNiZ.js → cycle-calculator-D_5f9VSN.js} +10 -10
  61. package/dist/_chunks/{dashboard-grid-uX7x1ePj.js → dashboard-grid-DWNP02Ff.js} +4 -4
  62. package/dist/_chunks/data-table-DJvEwZZx.js +1989 -0
  63. package/dist/_chunks/{data-table-tabs-CzYYKp2_.js → data-table-tabs-Dc6zvoI_.js} +6 -6
  64. package/dist/_chunks/{date-picker-6tFnKFty.js → date-picker-p9yz3pxc.js} +83 -80
  65. package/dist/_chunks/{date-picker-variants-B9NLAfUK.js → date-picker-variants-B3AFKDSu.js} +706 -658
  66. package/dist/_chunks/{date-range-picker-TpmECKRh.js → date-range-picker-DIy8gNY0.js} +153 -150
  67. package/dist/_chunks/{date-time-picker-DijEae25.js → date-time-picker-C3UVzqOm.js} +86 -77
  68. package/dist/_chunks/{de-3iM4rGqo.js → de-lVkJRPnh.js} +5 -5
  69. package/dist/_chunks/{dependent-selector-58hTg5rB.js → dependent-selector-CPiolWiw.js} +4 -4
  70. package/dist/_chunks/{description-list-1A2DEbE6.js → description-list-9rchqp5q.js} +3 -3
  71. package/dist/_chunks/{dialog-BJiLqhx6.js → dialog-D52AI4nF.js} +2 -2
  72. package/dist/_chunks/{document-preview-Od2Hz4z5.js → document-preview-1CZJg6CX.js} +6 -6
  73. package/dist/_chunks/{document-scanner-p0aGlzCy.js → document-scanner-T5jHiraQ.js} +5 -5
  74. package/dist/_chunks/dropdown-menu-B5mgV1kV.js +594 -0
  75. package/dist/_chunks/{due-date-calculator-BVqJaxzd.js → due-date-calculator-iJXm6HOj.js} +11 -11
  76. package/dist/_chunks/{editable-currency-cell-renderer-D_G2Ap61.js → editable-currency-cell-renderer-DdMHme5y.js} +9 -9
  77. package/dist/_chunks/{editable-description-B4NVdjvd.js → editable-description-Cy3AZ5K2.js} +4 -4
  78. package/dist/_chunks/{editor-overlay-BDiBvQmL.js → editor-overlay-C0awV6ba.js} +3 -3
  79. package/dist/_chunks/{el-C96rGJvU.js → el-CHzxNWPj.js} +6 -6
  80. package/dist/_chunks/{email-input-Dpe63k0K.js → email-input-ebdovOmh.js} +3 -3
  81. package/dist/_chunks/{empty-state-DTBZ1ENT.js → empty-state-DActfjdn.js} +3 -3
  82. package/dist/_chunks/en-GB-CwxYmmhU.js +45 -0
  83. package/dist/_chunks/{entity-summary-CFJfBdVP.js → entity-summary-oW3_jFhU.js} +8 -8
  84. package/dist/_chunks/{error-boundary-BxTqEXqj.js → error-boundary--w5hYiQ-.js} +3 -3
  85. package/dist/_chunks/{es-Cxiqjx8r.js → es-Ck-oxbHW.js} +8 -8
  86. package/dist/_chunks/{face-scheme-fku-RShg.js → face-scheme-Dg7KcbW2.js} +11 -11
  87. package/dist/_chunks/{fetal-weight-B69yOS9W.js → fetal-weight-BoIkl2t1.js} +6 -6
  88. package/dist/_chunks/{field-array-lIXrFWS0.js → field-array-BF2nCmvt.js} +4 -4
  89. package/dist/_chunks/{file-manager-C6QQPQV5.js → file-manager-BGHShxn_.js} +21 -21
  90. package/dist/_chunks/{file-upload-B242a_Y1.js → file-upload-OMlGHz70.js} +2 -2
  91. package/dist/_chunks/{finished-terminal-B2oqXO0Y.js → finished-terminal-BguGAUdg.js} +3 -3
  92. package/dist/_chunks/{fiscal-code-input-BEF8eKIG.js → fiscal-code-input-CuuE8_dt.js} +3 -3
  93. package/dist/_chunks/{floating-action-button-pojvb9gG.js → floating-action-button-BesoUmO_.js} +6 -6
  94. package/dist/_chunks/{form-field-CahJzTxp.js → form-field-YUJl_U5l.js} +2 -2
  95. package/dist/_chunks/{format-4HNwNGrN.js → format-D-1gTdHF.js} +47 -43
  96. package/dist/_chunks/{fr-Bhr6SYKj.js → fr-fWRnDcSD.js} +13 -13
  97. package/dist/_chunks/{freemium-paywall-B6JITu4l.js → freemium-paywall-BhxKSEJD.js} +5 -5
  98. package/dist/_chunks/{gestational-age-calculator-DsGN6_HS.js → gestational-age-calculator-CjZ7v-8x.js} +13 -13
  99. package/dist/_chunks/{hcg-doubling-D2SH-e7t.js → hcg-doubling-BYMogA0e.js} +15 -15
  100. package/dist/_chunks/{header-CCjp5GvE.js → header-CzJbtTGQ.js} +5 -5
  101. package/dist/_chunks/header-settings-BqdBe4zk.js +305 -0
  102. package/dist/_chunks/{help-me-write-templates-DQtT1qs_.js → help-me-write-templates-CGCyhAVE.js} +17 -17
  103. package/dist/_chunks/{hi-BxXX26d_.js → hi-B5uX0h3V.js} +14 -14
  104. package/dist/_chunks/{hover-card-BplP5SzQ.js → hover-card-DEMPFs9M.js} +3 -3
  105. package/dist/_chunks/{iban-input-DXIA8Ln_.js → iban-input-D88HRGZo.js} +2 -2
  106. package/dist/_chunks/{icon-button-CY7GU_Se.js → icon-button-JAXAkqWC.js} +2 -2
  107. package/dist/_chunks/{icon-button-group-B_426QN_.js → icon-button-group-DHRz90jY.js} +4 -4
  108. package/dist/_chunks/{icon-picker-ZLebyB0U.js → icon-picker-C5Fhx1-3.js} +5 -5
  109. package/dist/_chunks/{image-cropper-_HiNN79d.js → image-cropper-CNBGkG7P.js} +3 -3
  110. package/dist/_chunks/{info-tip-laBxZhKu.js → info-tip-DfmEvyAF.js} +3 -3
  111. package/dist/_chunks/{insert-result-CSuPQyKL.js → insert-result-BuWQl11Z.js} +3 -3
  112. package/dist/_chunks/intl-locale-CXM-B8EP.js +16 -0
  113. package/dist/_chunks/{isSameWeek-B73MagWB.js → isSameWeek-u81Z-J7h.js} +2 -2
  114. package/dist/_chunks/{it-Xmjomvyj.js → it-DBoNIelY.js} +17 -17
  115. package/dist/_chunks/{ja-mfZvt1ZV.js → ja-Du8gfg8p.js} +6 -6
  116. package/dist/_chunks/{kbd-D855ZXIW.js → kbd-BLovyx1R.js} +2 -2
  117. package/dist/_chunks/{key-value-pair-Dcdl3Gni.js → key-value-pair-DZH8ESsc.js} +3 -3
  118. package/dist/_chunks/{kit-extensions-BTJSnM_H.js → kit-extensions-CF5mDF_Z.js} +6 -6
  119. package/dist/_chunks/{link-CPb_pZPr.js → link-BlVUIKk1.js} +2 -2
  120. package/dist/_chunks/{link-cell-renderer-CkNbUsBM.js → link-cell-renderer-DvcbSHyp.js} +12 -12
  121. package/dist/_chunks/{list-DgE1xWBM.js → list-RRN2TJ_7.js} +2 -2
  122. package/dist/_chunks/{locale-picker-DGkQmhV9.js → locale-picker-DYDppQdZ.js} +218 -213
  123. package/dist/_chunks/{map-view-Bb7ClKSF.js → map-view-CmNGS6Ok.js} +4 -4
  124. package/dist/_chunks/{marketplace-app-shell-1uKqs4gD.js → marketplace-app-shell-rd1bSSm4.js} +137 -128
  125. package/dist/_chunks/{message-card-C2zsvyj0.js → message-card-Dub3790J.js} +6 -6
  126. package/dist/_chunks/{message-tray-CMlmxdH2.js → message-tray-CTd6CsnG.js} +6 -6
  127. package/dist/_chunks/{money-BXLBIRVO.js → money-GypsuFk2.js} +2 -2
  128. package/dist/_chunks/{multi-select-N4Smh-gj.js → multi-select-Bx0_cgPI.js} +2 -2
  129. package/dist/_chunks/{muscle-scheme-Co0NIgbU.js → muscle-scheme-X2bdmsQt.js} +4 -4
  130. package/dist/_chunks/{nav-grid-gRudLsPX.js → nav-grid-BnY0Ilet.js} +2 -2
  131. package/dist/_chunks/{navigation-menu-D3VndouD.js → navigation-menu-DbaSlvdO.js} +25 -25
  132. package/dist/_chunks/{nl-DDs-KEnD.js → nl-BCBwxYi8.js} +9 -9
  133. package/dist/_chunks/{note-attachment-CGjNTrAC.js → note-attachment-CpPRIfSn.js} +4 -4
  134. package/dist/_chunks/{note-timeline-CVnKL0p6.js → note-timeline-CZUmobcn.js} +3 -3
  135. package/dist/_chunks/{notes-panel-xxpFt-I1.js → notes-panel-CPfxz-1j.js} +10 -10
  136. package/dist/_chunks/{notification-card-DDzBCi8l.js → notification-card-B39g86vM.js} +13 -13
  137. package/dist/_chunks/{notification-tray-PnH2PBlZ.js → notification-tray-WsP7c1jf.js} +6 -6
  138. package/dist/_chunks/{number-input-Cgu2TtA8.js → number-input-BLrx3utH.js} +2 -2
  139. package/dist/_chunks/{operator-hero-DyrNLoRO.js → operator-hero-BnBPxwOi.js} +10 -10
  140. package/dist/_chunks/{optical-prescription-DUufWXfZ.js → optical-prescription-x--Rpmmx.js} +6 -6
  141. package/dist/_chunks/{otp-input-DzBQ-CpE.js → otp-input-Dz8WMg4F.js} +2 -2
  142. package/dist/_chunks/{pagination-B0N2qGy_.js → pagination-CzEkpfti.js} +6 -6
  143. package/dist/_chunks/{panel-subview-CzHutkA8.js → panel-subview-DAY-ToM3.js} +2 -2
  144. package/dist/_chunks/{parse-DPqj4JtD.js → parse-DeDYl04y.js} +32 -32
  145. package/dist/_chunks/{parseISO-fOGpHKXm.js → parseISO-y3LncvfO.js} +2 -2
  146. package/dist/_chunks/{patient-details-tTlvrJSU.js → patient-details-BSAMAd3I.js} +6 -6
  147. package/dist/_chunks/{patient-field-row-DElFbpKc.js → patient-field-row-dUF2cW2G.js} +288 -268
  148. package/dist/_chunks/{patient-search-DgXdGkhK.js → patient-search-CXl0FNfN.js} +14 -14
  149. package/dist/_chunks/{patient-summary-card-DQ__6DR-.js → patient-summary-card-DF-Mxcma.js} +10 -10
  150. package/dist/_chunks/{payment-automation-upsell-ugi4np1l.js → payment-automation-upsell-DNiraNhF.js} +6 -6
  151. package/dist/_chunks/{payment-form-DqJFiplX.js → payment-form-DxsjXYHJ.js} +6 -6
  152. package/dist/_chunks/{payment-request-card-DMJB57Tv.js → payment-request-card-BFsmHLtf.js} +8 -8
  153. package/dist/_chunks/{pdf-viewer-DUKdn5iq.js → pdf-viewer-hzfM5pZf.js} +6 -6
  154. package/dist/_chunks/{periodontal-chart-DbGzKDj7.js → periodontal-chart-Bvii6uOg.js} +3 -3
  155. package/dist/_chunks/{periodontal-chart-card-DvHyP47v.js → periodontal-chart-card-DTbvFQO7.js} +4 -4
  156. package/dist/_chunks/{periodontal-diagnosis-B8WqI0eU.js → periodontal-diagnosis-BqEo0usu.js} +3 -3
  157. package/dist/_chunks/{periodontal-risk-chart-DsFRFFSz.js → periodontal-risk-chart-C1Y5f-md.js} +3 -3
  158. package/dist/_chunks/{permission-matrix-VdAXjjHU.js → permission-matrix-DHKECaNW.js} +3 -3
  159. package/dist/_chunks/{phone-input-sQj-zi59.js → phone-input-opMMHkyh.js} +2 -2
  160. package/dist/_chunks/{pl-BYYMnEWP.js → pl-HwLM6gPs.js} +7 -7
  161. package/dist/_chunks/{popover-Dvb40vPH.js → popover-CGYPYIVi.js} +3 -3
  162. package/dist/_chunks/{position-grid-CcvqHaKN.js → position-grid-D2D5_Tze.js} +2 -2
  163. package/dist/_chunks/{postal-code-input-BznBxVxf.js → postal-code-input-Dv02t5MD.js} +3 -3
  164. package/dist/_chunks/{practice-profile-hero-B-WcJYNH.js → practice-profile-hero-Bc3AyBiM.js} +4 -4
  165. package/dist/_chunks/{practice-results-EKRiqWtQ.js → practice-results-DjhcggtZ.js} +29 -29
  166. package/dist/_chunks/{pregnancy-dating-lfjjZVZH.js → pregnancy-dating-CcPxK3S3.js} +14 -14
  167. package/dist/_chunks/{pregnancy-weight-gain-WpNt-S0q.js → pregnancy-weight-gain-tGbbravi.js} +6 -6
  168. package/dist/_chunks/{privacy-lock-D6gq0GDg.js → privacy-lock-Bh4O7Y7g.js} +17 -17
  169. package/dist/_chunks/{privacy-mask-BC5lw2zB.js → privacy-mask-noG15O9q.js} +24 -24
  170. package/dist/_chunks/{product-hub-panel-CKeSCSeE.js → product-hub-panel-BmBzDba9.js} +24 -24
  171. package/dist/_chunks/{progress-CK8otcQ-.js → progress-TIAsNHQW.js} +4 -4
  172. package/dist/_chunks/{province-select-BiszMRRY.js → province-select-BZtM0RSR.js} +3 -3
  173. package/dist/_chunks/{pt-BSPnVrQ7.js → pt-BxhT5ZQH.js} +10 -10
  174. package/dist/_chunks/{public-footer.agent-BKkK3T3V.js → public-footer.agent-CVYmHY94.js} +4 -4
  175. package/dist/_chunks/{public-header.agent-B9wDmUeB.js → public-header.agent-1mcrQqIM.js} +4 -4
  176. package/dist/_chunks/{qr-code-DOJs4suh.js → qr-code-C3m9o7om.js} +2 -2
  177. package/dist/_chunks/{radiograph-panel.agent-TmyIvTOa.js → radiograph-panel.agent-BP71J_VB.js} +14 -14
  178. package/dist/_chunks/{rating-BYbUowdK.js → rating-C1Vrmpsi.js} +2 -2
  179. package/dist/_chunks/{recaptcha-widget-BC-4To9b.js → recaptcha-widget-BNAeSTCo.js} +2 -2
  180. package/dist/_chunks/{resizable-DVGcfOrk.js → resizable-BKkNmZCl.js} +2 -2
  181. package/dist/_chunks/resource-chip-DQeCJzJf.js +143 -0
  182. package/dist/_chunks/{reviews-panel-BdwFp_0c.js → reviews-panel-DDb_t7vy.js} +8 -8
  183. package/dist/_chunks/rich-text-editor-C7N4Cem6.js +4231 -0
  184. package/dist/_chunks/{ro-BbiylGmG.js → ro-Do9W55ae.js} +2 -2
  185. package/dist/_chunks/{ru-BX_qsV67.js → ru-PDBX5gdf.js} +13 -13
  186. package/dist/_chunks/{search-bar-6bHatpYJ.js → search-bar-Blq_QeSe.js} +4 -4
  187. package/dist/_chunks/{search-input-B7GmlPIE.js → search-input-DfsAu3P2.js} +4 -4
  188. package/dist/_chunks/{select-upNAltly.js → select-Br88h070.js} +2 -2
  189. package/dist/_chunks/{session-countdown-ACJyTXH2.js → session-countdown-DWUVDDox.js} +4 -4
  190. package/dist/_chunks/{sheet-D0Lh0KR2.js → sheet-BE6oi30q.js} +3 -3
  191. package/dist/_chunks/{sidebar-DbZXLl8h.js → sidebar-2GBc0ZUa.js} +7 -7
  192. package/dist/_chunks/{sign-document-CRQuAn4W.js → sign-document-Buw-zC_7.js} +4 -4
  193. package/dist/_chunks/{sign-in-with-alfadocs-button-CDyJAIzW.js → sign-in-with-alfadocs-button-Bd4VPGQh.js} +4 -4
  194. package/dist/_chunks/{signature-capture-D6ut9_IR.js → signature-capture-F6KViBF_.js} +2 -2
  195. package/dist/_chunks/{signature-field-0rFODJlW.js → signature-field-DBIGiY-J.js} +3 -3
  196. package/dist/_chunks/{signature-request-BUGeG8oD.js → signature-request-DqZkn-iB.js} +156 -156
  197. package/dist/_chunks/{signature-status-chip-Dz6sS2oA.js → signature-status-chip-DP3qRijv.js} +3 -3
  198. package/dist/_chunks/{skip-link-BaSMtPwB.js → skip-link-BOQzBUVb.js} +2 -2
  199. package/dist/_chunks/{slider-DN1CWkKB.js → slider-BRq2lL-l.js} +2 -2
  200. package/dist/_chunks/{slot-grid-4fWH3Euk.js → slot-grid-Bkg9MVXP.js} +7 -7
  201. package/dist/_chunks/{smart-date-CsPlilQA.js → smart-date-pYK6WmM_.js} +2 -2
  202. package/dist/_chunks/{social-sign-in-button-dlpPI5l7.js → social-sign-in-button-Bb2UQpsA.js} +8 -8
  203. package/dist/_chunks/{sparkline-Dx_sxK3J.js → sparkline-ZOxMBU76.js} +3 -3
  204. package/dist/_chunks/{spinner-hbwuKwMf.js → spinner-DxjSZLD-.js} +2 -2
  205. package/dist/_chunks/{sq-i9UOk4P7.js → sq-DnvsgyIh.js} +6 -6
  206. package/dist/_chunks/{stat-Bs80Z6Yv.js → stat-Ce9ymEKm.js} +3 -3
  207. package/dist/_chunks/{stepper-accordion-jMR8NaOB.js → stepper-accordion-BPNS6J6B.js} +2 -2
  208. package/dist/_chunks/{stepper-progress-Bv0njx4g.js → stepper-progress-D6H8wQiV.js} +2 -2
  209. package/dist/_chunks/{streaming-text-eRiizArc.js → streaming-text-D0IJeRBg.js} +2 -2
  210. package/dist/_chunks/subDays-XBMBTVOO.js +8 -0
  211. package/dist/_chunks/{suggestion-chip-Bk4PmYTg.js → suggestion-chip-BNRWZL51.js} +2 -2
  212. package/dist/_chunks/{sv-CpTdtmDQ.js → sv-CpFSK8xS.js} +4 -4
  213. package/dist/_chunks/{switch-OILsBLWo.js → switch-DXGD2Drz.js} +2 -2
  214. package/dist/_chunks/{tab-bar-BHFf6knq.js → tab-bar-DRKiomgj.js} +4 -4
  215. package/dist/_chunks/tabs-DLXVEDsa.js +413 -0
  216. package/dist/_chunks/{tag-B65tLWvD.js → tag-CS5cXpfx.js} +2 -2
  217. package/dist/_chunks/{task-card-jaOhnj_q.js → task-card-CngF4Zee.js} +3 -3
  218. package/dist/_chunks/{task-editor-DlvTwAfv.js → task-editor-Dz93rRXg.js} +18 -18
  219. package/dist/_chunks/{task-tray-HHyxi9ga.js → task-tray-CB6_BvH9.js} +5 -5
  220. package/dist/_chunks/{tasks-panel-DbSjq_mz.js → tasks-panel-DHAoTQtR.js} +11 -11
  221. package/dist/_chunks/{text-area-Bt3p7Pt0.js → text-area-Cjtw7mna.js} +2 -2
  222. package/dist/_chunks/{text-input-CUvCb6ST.js → text-input-CLaItY93.js} +2 -2
  223. package/dist/_chunks/{theme-toggle-LUBxlNDm.js → theme-toggle-Byg0x2vB.js} +10 -10
  224. package/dist/_chunks/{time-picker-D0RS391l.js → time-picker-BG7G3ujX.js} +2 -2
  225. package/dist/_chunks/{timeline-ChY7iZrs.js → timeline-CVLjybJ3.js} +4 -4
  226. package/dist/_chunks/{timestamp-BV2lC-wV.js → timestamp-DPLDWdxA.js} +2 -2
  227. package/dist/_chunks/{toast-CT8hjr9r.js → toast-6wbpghjF.js} +3 -3
  228. package/dist/_chunks/{token-insert-menu-klwbxVKh.js → token-insert-menu-DgtBIbNu.js} +3 -3
  229. package/dist/_chunks/{tool-rail-DEeX4PdN.js → tool-rail-CXcLzxPb.js} +4 -4
  230. package/dist/_chunks/{tooth-finding-palette-vqC-D2Ye.js → tooth-finding-palette-DNQ3G2Tz.js} +2 -2
  231. package/dist/_chunks/{tooth-scheme-BkjhkI8g.js → tooth-scheme-BLbwUVer.js} +663 -718
  232. package/dist/_chunks/{tr-DXG2QN1K.js → tr-DW4oQYHT.js} +5 -5
  233. package/dist/_chunks/{transaction-chip-CwgcJiqF.js → transaction-chip-CohY6sTA.js} +6 -6
  234. package/dist/_chunks/{transcript-panel-u2HHxZB6.js → transcript-panel-Dve7bsm7.js} +3 -3
  235. package/dist/_chunks/{treatment-receipt-C-gWZ6uv.js → treatment-receipt-DF2Slh-x.js} +5 -5
  236. package/dist/_chunks/{typing-indicator-DHeVN4ob.js → typing-indicator-BmwMQSxw.js} +9 -9
  237. package/dist/_chunks/{unit-converter-Dp_KDxE6.js → unit-converter-D8WnJbZm.js} +6 -6
  238. package/dist/_chunks/use-appointment-details-read-YsuJgYeB.js +2198 -0
  239. package/dist/_chunks/{use-edge-resize-BHesP0kg.js → use-edge-resize-DHbyQwu8.js} +15 -15
  240. package/dist/_chunks/use-locale-BExNy9Dl.js +16 -0
  241. package/dist/_chunks/{use-password-requirements-Bwtqx1qN.js → use-password-requirements-DK4hV1Ik.js} +4 -4
  242. package/dist/_chunks/{variables-menu-aJLKJ_cu.js → variables-menu-DQl8H4Gh.js} +2 -2
  243. package/dist/_chunks/{wallet-pay-button--dnR6NfJ.js → wallet-pay-button-C-GFl7RO.js} +3 -3
  244. package/dist/_chunks/{warning-stack-CEgYkI1z.js → warning-stack-CzKSeB5v.js} +5 -5
  245. package/dist/_chunks/{whatsapp-button-Ai4YAVkl.js → whatsapp-button-DV9JFmtq.js} +2 -2
  246. package/dist/_chunks/{widget-picker-CilQvcNL.js → widget-picker-b5NCHxFe.js} +28 -28
  247. package/dist/_chunks/{workflow-map-qGkQTNvS.js → workflow-map-C7fHKTXL.js} +17 -17
  248. package/dist/_chunks/{workflow-status-ClHfz4Kr.js → workflow-status-DDnsIrLt.js} +4 -4
  249. package/dist/_chunks/{zh-CN-vPkPEK6H.js → zh-CN-QGEs29fQ.js} +7 -7
  250. package/dist/agent-catalog.json +103 -38
  251. package/dist/agent-i18n/en.json +7 -4
  252. package/dist/components/_shared/date-locale.d.ts +2 -2
  253. package/dist/components/_shared/day-picker-labels.d.ts +6 -0
  254. package/dist/components/_shared/entity-card/entity-card.d.ts +1 -1
  255. package/dist/components/_shared/intl-locale.d.ts +10 -0
  256. package/dist/components/address-autocomplete/index.js +1 -1
  257. package/dist/components/address-fields/index.js +1 -1
  258. package/dist/components/agenda-card/index.js +1 -1
  259. package/dist/components/agenda-tray/index.js +1 -1
  260. package/dist/components/ai-credits-notice/index.js +1 -1
  261. package/dist/components/ai-permission-notice/index.js +1 -1
  262. package/dist/components/ai-prompt-input/index.js +1 -1
  263. package/dist/components/alert/index.js +1 -1
  264. package/dist/components/anamnesis-card/index.js +1 -1
  265. package/dist/components/anamnesis-summary-card/anamnesis-summary-card.d.ts +1 -1
  266. package/dist/components/anamnesis-summary-card/index.js +1 -1
  267. package/dist/components/annotation-marker/index.js +1 -1
  268. package/dist/components/app-frame/index.js +1 -1
  269. package/dist/components/appointment-card/index.js +2 -2
  270. package/dist/components/appointment-details-panel/appointment-details-panel.d.ts +3 -0
  271. package/dist/components/appointment-details-panel/appointment-details-panel.history.d.ts +19 -5
  272. package/dist/components/appointment-details-panel/appointment-details-panel.sections.d.ts +6 -2
  273. package/dist/components/appointment-details-panel/appointment-details-panel.types.d.ts +51 -1
  274. package/dist/components/appointment-details-panel/index.d.ts +1 -1
  275. package/dist/components/appointment-details-panel/index.js +1 -1
  276. package/dist/components/appointment-peek/index.js +1 -1
  277. package/dist/components/appointment-timeline/index.js +1 -1
  278. package/dist/components/audio-recorder/index.js +1 -1
  279. package/dist/components/audio-visualiser/index.js +1 -1
  280. package/dist/components/autocomplete/index.js +1 -1
  281. package/dist/components/avatar/index.js +1 -1
  282. package/dist/components/badge/index.js +1 -1
  283. package/dist/components/bishop-score/index.js +1 -1
  284. package/dist/components/bmi-calculator/index.js +1 -1
  285. package/dist/components/booking/index.js +1 -1
  286. package/dist/components/breadcrumb/index.js +1 -1
  287. package/dist/components/button/button.d.ts +11 -0
  288. package/dist/components/button/icon-button.d.ts +4 -0
  289. package/dist/components/button/index.js +2 -2
  290. package/dist/components/button-group/index.js +1 -1
  291. package/dist/components/calculator-dialog/index.js +1 -1
  292. package/dist/components/calendar/calendar-locale.d.ts +5 -0
  293. package/dist/components/calendar/calendar.d.ts +6 -4
  294. package/dist/components/calendar/index.js +1 -1
  295. package/dist/components/calendar-event-card/index.js +1 -1
  296. package/dist/components/care-plan-card/index.js +1 -1
  297. package/dist/components/care-plan-entry-card/index.js +1 -1
  298. package/dist/components/care-plan-header/index.js +1 -1
  299. package/dist/components/carousel/index.js +1 -1
  300. package/dist/components/chart/chart.d.ts +1 -1
  301. package/dist/components/chart/index.js +1 -1
  302. package/dist/components/chat-container/index.js +1 -1
  303. package/dist/components/chat-input/index.js +1 -1
  304. package/dist/components/chat-message/index.js +1 -1
  305. package/dist/components/checkbox-group/index.js +1 -1
  306. package/dist/components/city-input/index.js +1 -1
  307. package/dist/components/clinical-note-card/index.js +1 -1
  308. package/dist/components/color-picker/index.js +1 -1
  309. package/dist/components/combobox/index.js +1 -1
  310. package/dist/components/command-palette/index.js +1 -1
  311. package/dist/components/connection-status/index.js +1 -1
  312. package/dist/components/contact-card/index.js +1 -1
  313. package/dist/components/contact-profile-card/index.js +1 -1
  314. package/dist/components/control-room-rail/index.js +1 -1
  315. package/dist/components/copy-field/index.js +1 -1
  316. package/dist/components/country-select/index.js +1 -1
  317. package/dist/components/cycle-calculator/index.js +1 -1
  318. package/dist/components/dashboard-grid/index.js +1 -1
  319. package/dist/components/data-table/ag-grid-locale.d.ts +5 -0
  320. package/dist/components/data-table/index.js +4 -4
  321. package/dist/components/data-table-tabs/index.js +1 -1
  322. package/dist/components/date-picker/index.js +1 -1
  323. package/dist/components/date-range-picker/index.js +1 -1
  324. package/dist/components/date-time-picker/index.js +1 -1
  325. package/dist/components/dependent-selector/index.js +1 -1
  326. package/dist/components/description-list/index.js +1 -1
  327. package/dist/components/dialog/index.js +1 -1
  328. package/dist/components/document-preview/index.js +1 -1
  329. package/dist/components/document-scanner/index.js +1 -1
  330. package/dist/components/dropdown-menu/dropdown-menu.d.ts +52 -2
  331. package/dist/components/dropdown-menu/index.d.ts +1 -1
  332. package/dist/components/dropdown-menu/index.js +1 -1
  333. package/dist/components/due-date-calculator/index.js +2 -2
  334. package/dist/components/editable-description/index.js +1 -1
  335. package/dist/components/editor-overlay/index.js +1 -1
  336. package/dist/components/email-input/index.js +1 -1
  337. package/dist/components/empty-state/index.js +1 -1
  338. package/dist/components/entity-summary/index.js +1 -1
  339. package/dist/components/error-boundary/index.js +1 -1
  340. package/dist/components/face-scheme/index.js +1 -1
  341. package/dist/components/fetal-weight/index.js +1 -1
  342. package/dist/components/field-array/index.js +1 -1
  343. package/dist/components/file-manager/index.js +1 -1
  344. package/dist/components/file-upload/index.js +1 -1
  345. package/dist/components/finished-terminal/index.js +1 -1
  346. package/dist/components/fiscal-code-input/index.js +1 -1
  347. package/dist/components/floating-action-button/index.js +1 -1
  348. package/dist/components/form-field/index.js +1 -1
  349. package/dist/components/freemium-paywall/index.js +1 -1
  350. package/dist/components/gestational-age-calculator/index.js +1 -1
  351. package/dist/components/hcg-doubling/hcg.d.ts +1 -1
  352. package/dist/components/hcg-doubling/index.js +1 -1
  353. package/dist/components/header/index.js +1 -1
  354. package/dist/components/header-settings/header-settings.d.ts +3 -3
  355. package/dist/components/header-settings/index.js +1 -1
  356. package/dist/components/hover-card/index.js +1 -1
  357. package/dist/components/iban-input/index.js +1 -1
  358. package/dist/components/icon-button/index.js +1 -1
  359. package/dist/components/icon-button-group/index.js +1 -1
  360. package/dist/components/icon-picker/index.js +1 -1
  361. package/dist/components/image-cropper/index.js +1 -1
  362. package/dist/components/info-tip/index.js +1 -1
  363. package/dist/components/kbd/index.js +1 -1
  364. package/dist/components/key-value-pair/index.js +1 -1
  365. package/dist/components/link/index.js +1 -1
  366. package/dist/components/list/index.js +1 -1
  367. package/dist/components/locale-picker/index.js +1 -1
  368. package/dist/components/locale-picker/locale-picker.d.ts +7 -0
  369. package/dist/components/map-view/index.js +1 -1
  370. package/dist/components/message-card/index.js +1 -1
  371. package/dist/components/message-tray/index.js +1 -1
  372. package/dist/components/money/index.js +1 -1
  373. package/dist/components/multi-select/index.js +1 -1
  374. package/dist/components/muscle-scheme/index.js +1 -1
  375. package/dist/components/nav-grid/index.js +1 -1
  376. package/dist/components/navigation-menu/index.js +2 -2
  377. package/dist/components/note-timeline/index.js +1 -1
  378. package/dist/components/notes-panel/index.js +1 -1
  379. package/dist/components/notification-card/index.js +1 -1
  380. package/dist/components/notification-tray/index.js +1 -1
  381. package/dist/components/number-input/index.js +1 -1
  382. package/dist/components/operator-hero/index.js +1 -1
  383. package/dist/components/operator-hero/operator-hero.d.ts +1 -1
  384. package/dist/components/optical-prescription/index.js +1 -1
  385. package/dist/components/otp-input/index.js +1 -1
  386. package/dist/components/pagination/index.js +1 -1
  387. package/dist/components/panel-subview/index.js +1 -1
  388. package/dist/components/password-input/index.js +1 -1
  389. package/dist/components/patient-details/index.js +1 -1
  390. package/dist/components/patient-details/patient-details.d.ts +1 -1
  391. package/dist/components/patient-search/index.js +1 -1
  392. package/dist/components/patient-summary-card/index.js +1 -1
  393. package/dist/components/patient-summary-card/patient-summary-card.d.ts +1 -1
  394. package/dist/components/patient-table/index.js +1 -1
  395. package/dist/components/payment-card/index.js +1 -1
  396. package/dist/components/payment-form/index.js +1 -1
  397. package/dist/components/pdf-viewer/index.js +1 -1
  398. package/dist/components/periodontal-chart/index.js +1 -1
  399. package/dist/components/periodontal-chart-card/index.js +1 -1
  400. package/dist/components/periodontal-diagnosis/index.js +1 -1
  401. package/dist/components/periodontal-risk-chart/index.js +1 -1
  402. package/dist/components/permission-matrix/index.js +1 -1
  403. package/dist/components/phone-input/index.js +1 -1
  404. package/dist/components/popover/index.js +1 -1
  405. package/dist/components/position-grid/index.js +1 -1
  406. package/dist/components/postal-code-input/index.js +1 -1
  407. package/dist/components/practice-profile-hero/index.js +1 -1
  408. package/dist/components/practice-results/index.js +1 -1
  409. package/dist/components/pregnancy-dating/index.js +1 -1
  410. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  411. package/dist/components/privacy-lock/index.js +1 -1
  412. package/dist/components/product-hub-tray/index.js +1 -1
  413. package/dist/components/progress/index.js +1 -1
  414. package/dist/components/province-select/index.js +1 -1
  415. package/dist/components/public-footer/index.js +1 -1
  416. package/dist/components/public-header/index.js +1 -1
  417. package/dist/components/qr-code/index.js +1 -1
  418. package/dist/components/radiograph-panel/index.js +1 -1
  419. package/dist/components/rating/index.js +1 -1
  420. package/dist/components/recaptcha-widget/index.js +1 -1
  421. package/dist/components/resizable/index.js +1 -1
  422. package/dist/components/resource-chip/index.d.ts +1 -1
  423. package/dist/components/resource-chip/index.js +3 -2
  424. package/dist/components/resource-chip/resource-chip.d.ts +20 -0
  425. package/dist/components/reviews-panel/index.js +1 -1
  426. package/dist/components/rich-text-editor/index.js +2 -2
  427. package/dist/components/rich-text-editor/redactor-locale.d.ts +4 -0
  428. package/dist/components/rich-text-editor/rich-text-editor.d.ts +8 -3
  429. package/dist/components/search-bar/index.js +1 -1
  430. package/dist/components/search-input/index.js +1 -1
  431. package/dist/components/select/index.js +1 -1
  432. package/dist/components/session-countdown/index.js +1 -1
  433. package/dist/components/sheet/index.js +1 -1
  434. package/dist/components/sidebar/index.js +1 -1
  435. package/dist/components/sign-document/index.js +1 -1
  436. package/dist/components/sign-in-with-alfadocs-button/index.js +1 -1
  437. package/dist/components/signature-capture/index.js +1 -1
  438. package/dist/components/signature-field/index.js +1 -1
  439. package/dist/components/signature-status-chip/index.js +1 -1
  440. package/dist/components/skeleton-scheme/index.js +3 -3
  441. package/dist/components/skip-link/index.js +1 -1
  442. package/dist/components/skip-link/skip-link.d.ts +1 -1
  443. package/dist/components/slider/index.js +1 -1
  444. package/dist/components/slot-grid/index.js +1 -1
  445. package/dist/components/smart-date/index.js +1 -1
  446. package/dist/components/smart-date/smart-date.d.ts +1 -1
  447. package/dist/components/social-sign-in-button/index.js +1 -1
  448. package/dist/components/sparkline/index.js +1 -1
  449. package/dist/components/spinner/index.js +1 -1
  450. package/dist/components/stat/index.js +1 -1
  451. package/dist/components/stepper-accordion/index.js +1 -1
  452. package/dist/components/stepper-progress/index.js +1 -1
  453. package/dist/components/streaming-text/index.js +1 -1
  454. package/dist/components/suggestion-chip/index.js +1 -1
  455. package/dist/components/switch/index.js +1 -1
  456. package/dist/components/tab-bar/index.js +1 -1
  457. package/dist/components/tabs/index.js +1 -1
  458. package/dist/components/tag/index.js +1 -1
  459. package/dist/components/task-card/index.js +1 -1
  460. package/dist/components/task-editor/index.js +1 -1
  461. package/dist/components/task-tray/index.js +1 -1
  462. package/dist/components/tasks-panel/index.js +1 -1
  463. package/dist/components/text-area/index.js +1 -1
  464. package/dist/components/text-input/index.js +1 -1
  465. package/dist/components/theme-toggle/index.js +1 -1
  466. package/dist/components/time-picker/index.js +1 -1
  467. package/dist/components/timeline/index.js +1 -1
  468. package/dist/components/timestamp/index.js +1 -1
  469. package/dist/components/toast/index.js +1 -1
  470. package/dist/components/token-insert-menu/index.js +1 -1
  471. package/dist/components/tool-rail/index.js +1 -1
  472. package/dist/components/tooth-finding-palette/index.js +1 -1
  473. package/dist/components/tooth-scheme/index.js +1 -1
  474. package/dist/components/tooth-scheme/tooth-scheme.d.ts +2 -2
  475. package/dist/components/transaction-chip/index.js +1 -1
  476. package/dist/components/transcript-panel/index.js +1 -1
  477. package/dist/components/treatment-receipt/index.js +1 -1
  478. package/dist/components/typing-indicator/index.js +1 -1
  479. package/dist/components/unit-converter/index.js +1 -1
  480. package/dist/components/variables-menu/index.js +1 -1
  481. package/dist/components/wallet-pay-button/index.js +1 -1
  482. package/dist/components/warning-stack/index.js +1 -1
  483. package/dist/components/whatsapp-button/index.js +1 -1
  484. package/dist/components/widget-picker/index.js +1 -1
  485. package/dist/components/workflow/index.js +1 -1
  486. package/dist/components/workflow/workflow-card.d.ts +1 -1
  487. package/dist/components/workflow-status/index.js +2 -2
  488. package/dist/hooks/index.js +2 -2
  489. package/dist/hooks/use-locale.d.ts +2 -16
  490. package/dist/i18n/config.d.ts +17 -13
  491. package/dist/i18n/config.js +127 -62
  492. package/dist/i18n/locale-meta.d.ts +1 -1
  493. package/dist/i18n/locales/ar.d.ts +915 -660
  494. package/dist/i18n/locales/ar.js +916 -665
  495. package/dist/i18n/locales/de.d.ts +722 -479
  496. package/dist/i18n/locales/de.js +723 -484
  497. package/dist/i18n/locales/el.d.ts +965 -722
  498. package/dist/i18n/locales/el.js +965 -726
  499. package/dist/i18n/locales/en.d.ts +308 -65
  500. package/dist/i18n/locales/en.js +309 -70
  501. package/dist/i18n/locales/es.d.ts +787 -541
  502. package/dist/i18n/locales/es.js +788 -546
  503. package/dist/i18n/locales/fr.d.ts +730 -484
  504. package/dist/i18n/locales/fr.js +731 -489
  505. package/dist/i18n/locales/hi.d.ts +875 -632
  506. package/dist/i18n/locales/hi.js +876 -637
  507. package/dist/i18n/locales/it.d.ts +937 -691
  508. package/dist/i18n/locales/it.js +943 -696
  509. package/dist/i18n/locales/ja.d.ts +698 -455
  510. package/dist/i18n/locales/ja.js +699 -460
  511. package/dist/i18n/locales/nl.d.ts +723 -480
  512. package/dist/i18n/locales/nl.js +724 -485
  513. package/dist/i18n/locales/pl.d.ts +1019 -770
  514. package/dist/i18n/locales/pl.js +1019 -774
  515. package/dist/i18n/locales/pt.d.ts +811 -562
  516. package/dist/i18n/locales/pt.js +812 -567
  517. package/dist/i18n/locales/ro.d.ts +1060 -814
  518. package/dist/i18n/locales/ro.js +1061 -819
  519. package/dist/i18n/locales/ru.d.ts +1037 -788
  520. package/dist/i18n/locales/ru.js +1032 -787
  521. package/dist/i18n/locales/sq.d.ts +1288 -1045
  522. package/dist/i18n/locales/sq.js +1288 -1049
  523. package/dist/i18n/locales/sv.d.ts +809 -566
  524. package/dist/i18n/locales/sv.js +810 -571
  525. package/dist/i18n/locales/tr.d.ts +768 -525
  526. package/dist/i18n/locales/tr.js +769 -530
  527. package/dist/i18n/locales/zh.d.ts +756 -513
  528. package/dist/i18n/locales/zh.js +757 -518
  529. package/dist/i18n/registerUiBundle.d.ts +3 -2
  530. package/dist/i18n/resources.d.ts +2 -7
  531. package/dist/i18n/supported-locales.d.ts +8 -0
  532. package/dist/index.js +552 -551
  533. package/dist/locales/ar.json +920 -665
  534. package/dist/locales/de.json +727 -484
  535. package/dist/locales/el.json +970 -727
  536. package/dist/locales/en.json +313 -70
  537. package/dist/locales/es.json +792 -546
  538. package/dist/locales/fr.json +735 -489
  539. package/dist/locales/hi.json +880 -637
  540. package/dist/locales/it.json +942 -696
  541. package/dist/locales/ja.json +703 -460
  542. package/dist/locales/nl.json +728 -485
  543. package/dist/locales/pl.json +1024 -775
  544. package/dist/locales/pt.json +816 -567
  545. package/dist/locales/ro.json +1065 -819
  546. package/dist/locales/ru.json +1042 -793
  547. package/dist/locales/sq.json +1293 -1050
  548. package/dist/locales/sv.json +814 -571
  549. package/dist/locales/tr.json +773 -530
  550. package/dist/locales/zh.json +761 -518
  551. package/dist/patterns/alia-assistant/index.js +1 -1
  552. package/dist/patterns/anamnesis/anamnesis-format.d.ts +1 -1
  553. package/dist/patterns/anamnesis/anamnesis-i18n.d.ts +3 -2
  554. package/dist/patterns/anamnesis/index.js +1 -1
  555. package/dist/patterns/anamnesis/locales/ar.d.ts +776 -0
  556. package/dist/patterns/anamnesis/locales/de.d.ts +740 -0
  557. package/dist/patterns/anamnesis/locales/el.d.ts +740 -0
  558. package/dist/patterns/anamnesis/locales/en.d.ts +740 -0
  559. package/dist/patterns/anamnesis/locales/es.d.ts +749 -0
  560. package/dist/patterns/anamnesis/locales/fr.d.ts +749 -0
  561. package/dist/patterns/anamnesis/locales/hi.d.ts +740 -0
  562. package/dist/patterns/anamnesis/locales/it.d.ts +749 -0
  563. package/dist/patterns/anamnesis/locales/ja.d.ts +740 -0
  564. package/dist/patterns/anamnesis/locales/nl.d.ts +740 -0
  565. package/dist/patterns/anamnesis/locales/pl.d.ts +758 -0
  566. package/dist/patterns/anamnesis/locales/pt.d.ts +758 -0
  567. package/dist/patterns/anamnesis/locales/ro.d.ts +749 -0
  568. package/dist/patterns/anamnesis/locales/ru.d.ts +758 -0
  569. package/dist/patterns/anamnesis/locales/sq.d.ts +740 -0
  570. package/dist/patterns/anamnesis/locales/sv.d.ts +740 -0
  571. package/dist/patterns/anamnesis/locales/tr.d.ts +740 -0
  572. package/dist/patterns/anamnesis/locales/zh.d.ts +740 -0
  573. package/dist/patterns/calendar/calendar-appointment-details.d.ts +4 -1
  574. package/dist/patterns/calendar/calendar-workspace.d.ts +5 -0
  575. package/dist/patterns/calendar/calendar.sheets.d.ts +4 -1
  576. package/dist/patterns/calendar/calendar.surface.d.ts +4 -1
  577. package/dist/patterns/calendar/calendar.types.d.ts +3 -1
  578. package/dist/patterns/calendar/index.d.ts +1 -1
  579. package/dist/patterns/calendar/index.js +1 -1
  580. package/dist/patterns/help-me-write-templates/index.js +1 -1
  581. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  582. package/dist/patterns/payment-automation-upsell/index.js +1 -1
  583. package/dist/patterns/signature-request/index.js +1 -1
  584. package/dist/tokens.css +6 -2
  585. package/package.json +12 -2
  586. package/dist/_chunks/anamnesis-summary-rows-CZirLRuv.js +0 -9416
  587. package/dist/_chunks/calendar-E6Yu4lzC.js +0 -1381
  588. package/dist/_chunks/calendar-workspace-DjbGFjg1.js +0 -10584
  589. package/dist/_chunks/data-table-CrI3_bjH.js +0 -1824
  590. package/dist/_chunks/dropdown-menu-C8PaW3lR.js +0 -369
  591. package/dist/_chunks/header-settings-ZXa6hXuu.js +0 -335
  592. package/dist/_chunks/resource-chip-DYTG0IQQ.js +0 -83
  593. package/dist/_chunks/rich-text-editor-y6ML0KeV.js +0 -4154
  594. package/dist/_chunks/subDays-HPvBuvq3.js +0 -8
  595. package/dist/_chunks/tabs-CFsuMQ5H.js +0 -409
  596. package/dist/_chunks/use-appointment-details-read-5-hV-2xA.js +0 -2045
  597. package/dist/_chunks/use-locale-BkCIHujH.js +0 -20
@@ -1,4154 +0,0 @@
1
- import { jsx as t, jsxs as C, Fragment as Ee } from "react/jsx-runtime";
2
- import { useId as Oe, useState as E, useRef as A, useCallback as y, useEffect as _, Fragment as ft, forwardRef as Wo, useMemo as Je, useImperativeHandle as Xo } from "react";
3
- import { c as Dn } from "./index-D2ZczOXr.js";
4
- import { useTranslation as ne } from "react-i18next";
5
- import { SafeHtml as Uo, sanitiseHtml as Zo } from "../safe-html/index.js";
6
- import { u as Qo } from "./registry-DvAUVLHh.js";
7
- import { u as Yo } from "./use-ai-sparkle-Cf4yVTLB.js";
8
- import { S as On } from "./spinner-hbwuKwMf.js";
9
- import { A as Jo } from "./ai-sparkle-D23NT8Z_.js";
10
- import { B as Te } from "./button-18oBsI3n.js";
11
- import { I as j } from "./icon-button-CY7GU_Se.js";
12
- import { A as ea } from "./ai-permission-notice-BRZeS3mT.js";
13
- import { T as ta } from "./text-area-Bt3p7Pt0.js";
14
- import { E as Rn } from "./editor-overlay-BDiBvQmL.js";
15
- import { X as Mr } from "./x-B5YnXwCz.js";
16
- import { R as na } from "./rotate-ccw-BBQnIVTr.js";
17
- import { C as ra } from "./check-DrFSN__t.js";
18
- import { S as Ct } from "./square-DASBRZ0U.js";
19
- import { M as zn } from "./mic-CUklMZGF.js";
20
- import { S as oa } from "./send-C5kDJ-Mz.js";
21
- import { D as te } from "./dropdown-menu-C8PaW3lR.js";
22
- import * as Xt from "@radix-ui/react-popover";
23
- import { V as jr } from "./variables-menu-aJLKJ_cu.js";
24
- import { a as qn } from "./tooltip-Cp-PLePW.js";
25
- import { P as ee } from "./popover-Dvb40vPH.js";
26
- import { D as ie } from "./dialog-BJiLqhx6.js";
27
- import { C as Bn } from "./color-picker-Bl5f0iK1.js";
28
- import { T as Yt } from "./text-input-CUvCb6ST.js";
29
- import { C as aa } from "./checkbox-CZkipDn7.js";
30
- import { F as ia } from "./file-upload-B242a_Y1.js";
31
- import { c as H } from "./createLucideIcon-DhHxpK9K.js";
32
- import { E as sa } from "./ellipsis-dRo9ouSU.js";
33
- import { H as la, U as ca } from "./undo-2-CYNAzclj.js";
34
- import { I as da } from "./image-B_5MNK0x.js";
35
- import { C as Gr } from "./chevron-down-DWE7GSq9.js";
36
- import { P as ua } from "./plus-DzMQ_c6b.js";
37
- import { S as ma } from "./settings-d25ju_6L.js";
38
- import { T as fa } from "./trash-2-uumy3fy1.js";
39
- import { H as _n, u as ga } from "./hover-card-BplP5SzQ.js";
40
- import { A as ha } from "./ai-credits-notice-C-kz_RrY.js";
41
- /**
42
- * @license lucide-react v1.22.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */
47
- const pa = [
48
- ["path", { d: "M4 20h16", key: "14thso" }],
49
- ["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
50
- ["path", { d: "M8 12h8", key: "1wcyev" }]
51
- ], ba = H("baseline", pa);
52
- /**
53
- * @license lucide-react v1.22.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */
58
- const va = [
59
- ["rect", { width: "13", height: "7", x: "3", y: "3", rx: "1", key: "11xb64" }],
60
- ["path", { d: "m22 15-3-3 3-3", key: "26chmm" }],
61
- ["rect", { width: "13", height: "7", x: "3", y: "14", rx: "1", key: "k6ky7n" }]
62
- ], ya = H("between-horizontal-end", va);
63
- /**
64
- * @license lucide-react v1.22.0 - ISC
65
- *
66
- * This source code is licensed under the ISC license.
67
- * See the LICENSE file in the root directory of this source tree.
68
- */
69
- const wa = [
70
- ["rect", { width: "13", height: "7", x: "8", y: "3", rx: "1", key: "pkso9a" }],
71
- ["path", { d: "m2 9 3 3-3 3", key: "1agib5" }],
72
- ["rect", { width: "13", height: "7", x: "8", y: "14", rx: "1", key: "1q5fc1" }]
73
- ], ka = H("between-horizontal-start", wa);
74
- /**
75
- * @license lucide-react v1.22.0 - ISC
76
- *
77
- * This source code is licensed under the ISC license.
78
- * See the LICENSE file in the root directory of this source tree.
79
- */
80
- const xa = [
81
- ["rect", { width: "7", height: "13", x: "3", y: "3", rx: "1", key: "1fdu0f" }],
82
- ["path", { d: "m9 22 3-3 3 3", key: "17z65a" }],
83
- ["rect", { width: "7", height: "13", x: "14", y: "3", rx: "1", key: "1squn4" }]
84
- ], Ca = H("between-vertical-end", xa);
85
- /**
86
- * @license lucide-react v1.22.0 - ISC
87
- *
88
- * This source code is licensed under the ISC license.
89
- * See the LICENSE file in the root directory of this source tree.
90
- */
91
- const Aa = [
92
- ["rect", { width: "7", height: "13", x: "3", y: "8", rx: "1", key: "1fjrkv" }],
93
- ["path", { d: "m15 2-3 3-3-3", key: "1uh6eb" }],
94
- ["rect", { width: "7", height: "13", x: "14", y: "8", rx: "1", key: "w3fjg8" }]
95
- ], Na = H("between-vertical-start", Aa);
96
- /**
97
- * @license lucide-react v1.22.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */
102
- const Ea = [
103
- [
104
- "path",
105
- {
106
- d: "M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",
107
- key: "1ah6g2"
108
- }
109
- ],
110
- ["rect", { x: "14", y: "2", width: "8", height: "8", rx: "1", key: "88lufb" }]
111
- ], Sn = H("blocks", Ea);
112
- /**
113
- * @license lucide-react v1.22.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */
118
- const Ta = [
119
- [
120
- "path",
121
- { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
122
- ]
123
- ], Ma = H("bold", Ta);
124
- /**
125
- * @license lucide-react v1.22.0 - ISC
126
- *
127
- * This source code is licensed under the ISC license.
128
- * See the LICENSE file in the root directory of this source tree.
129
- */
130
- const Ra = [
131
- [
132
- "path",
133
- { d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1", key: "ezmyqa" }
134
- ],
135
- [
136
- "path",
137
- {
138
- d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",
139
- key: "e1hn23"
140
- }
141
- ]
142
- ], za = H("braces", Ra);
143
- /**
144
- * @license lucide-react v1.22.0 - ISC
145
- *
146
- * This source code is licensed under the ISC license.
147
- * See the LICENSE file in the root directory of this source tree.
148
- */
149
- const _a = [
150
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
151
- ["path", { d: "M12 3v18", key: "108xh3" }]
152
- ], Sa = H("columns-2", _a);
153
- /**
154
- * @license lucide-react v1.22.0 - ISC
155
- *
156
- * This source code is licensed under the ISC license.
157
- * See the LICENSE file in the root directory of this source tree.
158
- */
159
- const La = [
160
- ["path", { d: "M4 12h8", key: "17cfdx" }],
161
- ["path", { d: "M4 18V6", key: "1rz3zl" }],
162
- ["path", { d: "M12 18V6", key: "zqpxq5" }],
163
- ["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
164
- ], Ha = H("heading-2", La);
165
- /**
166
- * @license lucide-react v1.22.0 - ISC
167
- *
168
- * This source code is licensed under the ISC license.
169
- * See the LICENSE file in the root directory of this source tree.
170
- */
171
- const Ia = [
172
- ["path", { d: "M4 12h8", key: "17cfdx" }],
173
- ["path", { d: "M4 18V6", key: "1rz3zl" }],
174
- ["path", { d: "M12 18V6", key: "zqpxq5" }],
175
- ["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
176
- ["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
177
- ], $a = H("heading-3", Ia);
178
- /**
179
- * @license lucide-react v1.22.0 - ISC
180
- *
181
- * This source code is licensed under the ISC license.
182
- * See the LICENSE file in the root directory of this source tree.
183
- */
184
- const Da = [
185
- ["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
186
- ["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
187
- ["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
188
- ], Oa = H("italic", Da);
189
- /**
190
- * @license lucide-react v1.22.0 - ISC
191
- *
192
- * This source code is licensed under the ISC license.
193
- * See the LICENSE file in the root directory of this source tree.
194
- */
195
- const qa = [
196
- ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
197
- ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
198
- ], Ba = H("link", qa);
199
- /**
200
- * @license lucide-react v1.22.0 - ISC
201
- *
202
- * This source code is licensed under the ISC license.
203
- * See the LICENSE file in the root directory of this source tree.
204
- */
205
- const Pa = [
206
- ["path", { d: "M11 5h10", key: "1cz7ny" }],
207
- ["path", { d: "M11 12h10", key: "1438ji" }],
208
- ["path", { d: "M11 19h10", key: "11t30w" }],
209
- ["path", { d: "M4 4h1v5", key: "10yrso" }],
210
- ["path", { d: "M4 9h2", key: "r1h2o0" }],
211
- ["path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02", key: "xtkcd5" }]
212
- ], Fa = H("list-ordered", Pa);
213
- /**
214
- * @license lucide-react v1.22.0 - ISC
215
- *
216
- * This source code is licensed under the ISC license.
217
- * See the LICENSE file in the root directory of this source tree.
218
- */
219
- const ja = [
220
- ["path", { d: "M3 5h.01", key: "18ugdj" }],
221
- ["path", { d: "M3 12h.01", key: "nlz23k" }],
222
- ["path", { d: "M3 19h.01", key: "noohij" }],
223
- ["path", { d: "M8 5h13", key: "1pao27" }],
224
- ["path", { d: "M8 12h13", key: "1za7za" }],
225
- ["path", { d: "M8 19h13", key: "m83p4d" }]
226
- ], Ga = H("list", ja);
227
- /**
228
- * @license lucide-react v1.22.0 - ISC
229
- *
230
- * This source code is licensed under the ISC license.
231
- * See the LICENSE file in the root directory of this source tree.
232
- */
233
- const Ka = [
234
- ["path", { d: "M11 7 6 2", key: "1jwth8" }],
235
- ["path", { d: "M18.992 12H2.041", key: "xw1gg" }],
236
- [
237
- "path",
238
- {
239
- d: "M21.145 18.38A3.34 3.34 0 0 1 20 16.5a3.3 3.3 0 0 1-1.145 1.88c-.575.46-.855 1.02-.855 1.595A2 2 0 0 0 20 22a2 2 0 0 0 2-2.025c0-.58-.285-1.13-.855-1.595",
240
- key: "1nkol4"
241
- }
242
- ],
243
- [
244
- "path",
245
- {
246
- d: "m8.5 4.5 2.148-2.148a1.205 1.205 0 0 1 1.704 0l7.296 7.296a1.205 1.205 0 0 1 0 1.704l-7.592 7.592a3.615 3.615 0 0 1-5.112 0l-3.888-3.888a3.615 3.615 0 0 1 0-5.112L5.67 7.33",
247
- key: "1nk1rd"
248
- }
249
- ]
250
- ], Va = H("paint-bucket", Ka);
251
- /**
252
- * @license lucide-react v1.22.0 - ISC
253
- *
254
- * This source code is licensed under the ISC license.
255
- * See the LICENSE file in the root directory of this source tree.
256
- */
257
- const Wa = [
258
- ["rect", { width: "16", height: "6", x: "2", y: "2", rx: "2", key: "jcyz7m" }],
259
- ["path", { d: "M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2", key: "1b9h7c" }],
260
- ["rect", { width: "4", height: "6", x: "8", y: "16", rx: "1", key: "d6e7yl" }]
261
- ], Xa = H("paint-roller", Wa);
262
- /**
263
- * @license lucide-react v1.22.0 - ISC
264
- *
265
- * This source code is licensed under the ISC license.
266
- * See the LICENSE file in the root directory of this source tree.
267
- */
268
- const Ua = [
269
- [
270
- "path",
271
- {
272
- d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
273
- key: "e79jfc"
274
- }
275
- ],
276
- ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
277
- ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
278
- ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
279
- ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
280
- ], Za = H("palette", Ua);
281
- /**
282
- * @license lucide-react v1.22.0 - ISC
283
- *
284
- * This source code is licensed under the ISC license.
285
- * See the LICENSE file in the root directory of this source tree.
286
- */
287
- const Qa = [
288
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
289
- ["path", { d: "M9 3v18", key: "fh3hqa" }]
290
- ], Ya = H("panel-left", Qa);
291
- /**
292
- * @license lucide-react v1.22.0 - ISC
293
- *
294
- * This source code is licensed under the ISC license.
295
- * See the LICENSE file in the root directory of this source tree.
296
- */
297
- const Ja = [
298
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
299
- ["path", { d: "M15 3v18", key: "14nvp0" }]
300
- ], ei = H("panel-right", Ja);
301
- /**
302
- * @license lucide-react v1.22.0 - ISC
303
- *
304
- * This source code is licensed under the ISC license.
305
- * See the LICENSE file in the root directory of this source tree.
306
- */
307
- const ti = [
308
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
309
- ["path", { d: "M14 9h1", key: "l0svgy" }],
310
- ["path", { d: "M19 9h2", key: "te2zfg" }],
311
- ["path", { d: "M3 9h2", key: "1h4ldw" }],
312
- ["path", { d: "M9 9h1", key: "15jzuz" }]
313
- ], ni = H("panel-top-dashed", ti);
314
- /**
315
- * @license lucide-react v1.22.0 - ISC
316
- *
317
- * This source code is licensed under the ISC license.
318
- * See the LICENSE file in the root directory of this source tree.
319
- */
320
- const ri = [
321
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
322
- ["path", { d: "M3 9h18", key: "1pudct" }]
323
- ], oi = H("panel-top", ri);
324
- /**
325
- * @license lucide-react v1.22.0 - ISC
326
- *
327
- * This source code is licensed under the ISC license.
328
- * See the LICENSE file in the root directory of this source tree.
329
- */
330
- const ai = [
331
- ["path", { d: "M10 3H8", key: "mzdi2d" }],
332
- ["path", { d: "m15.007 5.008 3.987 3.986", key: "1scubj" }],
333
- ["path", { d: "M20 15v4", key: "nmhudv" }],
334
- [
335
- "path",
336
- {
337
- d: "M21.174 6.813a2.82 2.82 0 0 0-3.986-3.987L3.842 16.175a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
338
- key: "fs0856"
339
- }
340
- ],
341
- ["path", { d: "M22 17h-4", key: "1sj068" }],
342
- ["path", { d: "M4 5v4", key: "13jjxc" }],
343
- ["path", { d: "M6 7H2", key: "8zbtv0" }],
344
- ["path", { d: "M9 2v2", key: "165o2o" }]
345
- ], Rr = H("pencil-sparkles", ai);
346
- /**
347
- * @license lucide-react v1.22.0 - ISC
348
- *
349
- * This source code is licensed under the ISC license.
350
- * See the LICENSE file in the root directory of this source tree.
351
- */
352
- const ii = [
353
- ["path", { d: "M13 4v16", key: "8vvj80" }],
354
- ["path", { d: "M17 4v16", key: "7dpous" }],
355
- ["path", { d: "M19 4H9.5a4.5 4.5 0 0 0 0 9H13", key: "sh4n9v" }]
356
- ], si = H("pilcrow", ii);
357
- /**
358
- * @license lucide-react v1.22.0 - ISC
359
- *
360
- * This source code is licensed under the ISC license.
361
- * See the LICENSE file in the root directory of this source tree.
362
- */
363
- const li = [
364
- [
365
- "path",
366
- {
367
- d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
368
- key: "rib7q0"
369
- }
370
- ],
371
- [
372
- "path",
373
- {
374
- d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
375
- key: "1ymkrd"
376
- }
377
- ]
378
- ], ci = H("quote", li);
379
- /**
380
- * @license lucide-react v1.22.0 - ISC
381
- *
382
- * This source code is licensed under the ISC license.
383
- * See the LICENSE file in the root directory of this source tree.
384
- */
385
- const di = [
386
- ["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
387
- ["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
388
- ], ui = H("redo-2", di);
389
- /**
390
- * @license lucide-react v1.22.0 - ISC
391
- *
392
- * This source code is licensed under the ISC license.
393
- * See the LICENSE file in the root directory of this source tree.
394
- */
395
- const mi = [
396
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
397
- ["path", { d: "M3 12h18", key: "1i2n21" }]
398
- ], fi = H("rows-2", mi);
399
- /**
400
- * @license lucide-react v1.22.0 - ISC
401
- *
402
- * This source code is licensed under the ISC license.
403
- * See the LICENSE file in the root directory of this source tree.
404
- */
405
- const gi = [
406
- ["path", { d: "m6 16 6-12 6 12", key: "1b4byz" }],
407
- ["path", { d: "M8 12h8", key: "1wcyev" }],
408
- ["path", { d: "m16 20 2 2 4-4", key: "13tcca" }]
409
- ], zr = H("spell-check", gi);
410
- /**
411
- * @license lucide-react v1.22.0 - ISC
412
- *
413
- * This source code is licensed under the ISC license.
414
- * See the LICENSE file in the root directory of this source tree.
415
- */
416
- const hi = [
417
- ["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
418
- ["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
419
- ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
420
- ], pi = H("strikethrough", hi);
421
- /**
422
- * @license lucide-react v1.22.0 - ISC
423
- *
424
- * This source code is licensed under the ISC license.
425
- * See the LICENSE file in the root directory of this source tree.
426
- */
427
- const bi = [
428
- ["path", { d: "M12 3v18", key: "108xh3" }],
429
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
430
- ["path", { d: "M3 9h18", key: "1pudct" }],
431
- ["path", { d: "M3 15h18", key: "5xshup" }]
432
- ], vi = H("table", bi);
433
- /**
434
- * @license lucide-react v1.22.0 - ISC
435
- *
436
- * This source code is licensed under the ISC license.
437
- * See the LICENSE file in the root directory of this source tree.
438
- */
439
- const yi = [
440
- ["path", { d: "M21 5H3", key: "1fi0y6" }],
441
- ["path", { d: "M17 12H7", key: "16if0g" }],
442
- ["path", { d: "M19 19H5", key: "vjpgq2" }]
443
- ], wi = H("text-align-center", yi);
444
- /**
445
- * @license lucide-react v1.22.0 - ISC
446
- *
447
- * This source code is licensed under the ISC license.
448
- * See the LICENSE file in the root directory of this source tree.
449
- */
450
- const ki = [
451
- ["path", { d: "M21 5H3", key: "1fi0y6" }],
452
- ["path", { d: "M21 12H9", key: "dn1m92" }],
453
- ["path", { d: "M21 19H7", key: "4cu937" }]
454
- ], xi = H("text-align-end", ki);
455
- /**
456
- * @license lucide-react v1.22.0 - ISC
457
- *
458
- * This source code is licensed under the ISC license.
459
- * See the LICENSE file in the root directory of this source tree.
460
- */
461
- const Ci = [
462
- ["path", { d: "M21 5H3", key: "1fi0y6" }],
463
- ["path", { d: "M15 12H3", key: "6jk70r" }],
464
- ["path", { d: "M17 19H3", key: "z6ezky" }]
465
- ], Ai = H("text-align-start", Ci);
466
- /**
467
- * @license lucide-react v1.22.0 - ISC
468
- *
469
- * This source code is licensed under the ISC license.
470
- * See the LICENSE file in the root directory of this source tree.
471
- */
472
- const Ni = [
473
- ["rect", { width: "18", height: "12", x: "3", y: "8", rx: "1", key: "158fvp" }],
474
- ["path", { d: "M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3", key: "s0042v" }],
475
- ["path", { d: "M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3", key: "9wmeh2" }]
476
- ], Ln = H("toy-brick", Ni);
477
- /**
478
- * @license lucide-react v1.22.0 - ISC
479
- *
480
- * This source code is licensed under the ISC license.
481
- * See the LICENSE file in the root directory of this source tree.
482
- */
483
- const Ei = [
484
- ["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
485
- ["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
486
- ], Ti = H("underline", Ei);
487
- /**
488
- * @license lucide-react v1.22.0 - ISC
489
- *
490
- * This source code is licensed under the ISC license.
491
- * See the LICENSE file in the root directory of this source tree.
492
- */
493
- const Mi = [
494
- [
495
- "path",
496
- {
497
- d: "m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",
498
- key: "ul74o6"
499
- }
500
- ],
501
- ["path", { d: "m14 7 3 3", key: "1r5n42" }],
502
- ["path", { d: "M5 6v4", key: "ilb8ba" }],
503
- ["path", { d: "M19 14v4", key: "blhpug" }],
504
- ["path", { d: "M10 2v2", key: "7u0qdc" }],
505
- ["path", { d: "M7 8H3", key: "zfb6yr" }],
506
- ["path", { d: "M21 16h-4", key: "1cnmox" }],
507
- ["path", { d: "M11 3H9", key: "1obp7u" }]
508
- ], _r = H("wand-sparkles", Mi), Ri = {
509
- id: "rich-text-editor",
510
- capabilities: ["edit_inline"],
511
- state: {
512
- html: {
513
- type: "string",
514
- descriptionKey: "ui.agent.richTextEditor.state.html",
515
- description: "Sanitised HTML representation of the editor content.",
516
- read: (o) => o.getHTML()
517
- },
518
- text: {
519
- type: "string",
520
- descriptionKey: "ui.agent.richTextEditor.state.text",
521
- description: "Plain-text content of the editor (tags stripped).",
522
- read: (o) => o.getText()
523
- },
524
- markdown: {
525
- type: "string",
526
- descriptionKey: "ui.agent.richTextEditor.state.markdown",
527
- description: "Markdown representation of the editor content. The Redactor engine has no native Markdown serialiser, so this is always empty — read `html` instead.",
528
- read: (o) => o.getMarkdown()
529
- },
530
- aiBusy: {
531
- type: "boolean",
532
- descriptionKey: "ui.agent.richTextEditor.state.aiBusy",
533
- description: "True while a one-shot AI action (a practice template, spelling or auto-format) is rewriting the note. Read `html` once it is false.",
534
- read: (o) => o.isAiBusy()
535
- }
536
- },
537
- // Image wrap/align/resize are intentionally NOT agent actions — they target
538
- // the ephemeral click-selected image the handle can't address. Agents emit
539
- // `<img class="wysiwyg-img-*" style="width:N%">` via set_content instead.
540
- actions: {
541
- set_content: {
542
- // Replaces the whole document — discards whatever the user had typed.
543
- safety: "destructive",
544
- argsType: "{ html: string }",
545
- argsSchema: {
546
- type: "object",
547
- properties: {
548
- html: {
549
- type: "string",
550
- description: "Replacement HTML (sanitised via DOMPurify)."
551
- }
552
- },
553
- required: ["html"]
554
- },
555
- idempotent: !0,
556
- descriptionKey: "ui.agent.richTextEditor.actions.setContent",
557
- description: "Replace the editor content. Loses unsaved input.",
558
- invoke: (o, i) => {
559
- o.setContent(i.html);
560
- }
561
- },
562
- insert_at_cursor: {
563
- // Reversible via the editor's own undo stack — write, not destructive.
564
- safety: "write",
565
- argsType: "{ content: string; asHtml?: boolean }",
566
- argsSchema: {
567
- type: "object",
568
- properties: {
569
- content: {
570
- type: "string",
571
- description: "Content to insert at the caret."
572
- },
573
- asHtml: {
574
- type: "boolean",
575
- description: "Treat content as HTML (sanitised). Pass false for plain text. Defaults to true."
576
- }
577
- },
578
- required: ["content"]
579
- },
580
- descriptionKey: "ui.agent.richTextEditor.actions.insertAtCursor",
581
- description: "Insert content at the caret (replacing any selection). HTML is sanitised; pass asHtml:false for plain text. Seam for merge/template variables and AI-generated drafts.",
582
- examples: [
583
- {
584
- args: { content: "{{patient.firstName}}", asHtml: !1 },
585
- note: "Insert a merge variable as plain text."
586
- }
587
- ],
588
- invoke: (o, i) => {
589
- o.insertAtCursor(i.content, { asHtml: i.asHtml });
590
- }
591
- },
592
- apply_format: {
593
- // Reversible via undo — write, not destructive.
594
- safety: "write",
595
- argsType: "{ format: 'bold' | 'italic' | 'strikethrough' | 'bulletedList' | 'numberedList' | 'heading' | 'quote' | 'paragraph' }",
596
- argsSchema: {
597
- type: "object",
598
- properties: {
599
- format: {
600
- type: "string",
601
- enum: [
602
- "bold",
603
- "italic",
604
- "strikethrough",
605
- "bulletedList",
606
- "numberedList",
607
- "heading",
608
- "quote",
609
- "paragraph"
610
- ],
611
- description: "Block or inline format to toggle/apply."
612
- }
613
- },
614
- required: ["format"]
615
- },
616
- descriptionKey: "ui.agent.richTextEditor.actions.applyFormat",
617
- description: "Toggle/apply a block or inline format on the current selection (bold, italic, strikethrough, bulleted/numbered list, heading, quote, paragraph).",
618
- examples: [{ args: { format: "bold" }, note: "Bold the selection." }],
619
- invoke: (o, i) => {
620
- o.applyFormat(i.format);
621
- }
622
- },
623
- clear: {
624
- // Empties the document — loses unsaved input.
625
- safety: "destructive",
626
- idempotent: !0,
627
- descriptionKey: "ui.agent.richTextEditor.actions.clear",
628
- description: "Empty the editor. Loses unsaved input.",
629
- invoke: (o) => {
630
- o.clear();
631
- }
632
- },
633
- focus: {
634
- safety: "read",
635
- idempotent: !0,
636
- descriptionKey: "ui.agent.richTextEditor.actions.focus",
637
- description: "Move keyboard focus to the editor surface.",
638
- invoke: (o) => {
639
- o.focus();
640
- }
641
- }
642
- },
643
- domHooks: {
644
- root: { attr: "data-component", value: "rich-text-editor" },
645
- instanceId: {
646
- attr: "data-component-id",
647
- sourceProp: "id",
648
- description: "Sourced from the id prop."
649
- }
650
- }
651
- }, zi = "ds:aria-pressed:!bg-[var(--destructive)] ds:aria-pressed:!text-[var(--destructive-foreground)]", et = "ds:!size-[var(--min-target-size)]", _i = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", Si = "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]";
652
- function Kr({ id: o }) {
653
- const { t: i } = ne();
654
- return /* @__PURE__ */ t(
655
- "p",
656
- {
657
- "data-component": "editor-request-error",
658
- id: o,
659
- role: "alert",
660
- className: Si,
661
- children: i("editor.ai.error")
662
- }
663
- );
664
- }
665
- const Sr = [
666
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
667
- "ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
668
- "ds:p-[var(--spacing-sm)] ds:[max-block-size:10rem] ds:overflow-y-auto",
669
- "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]",
670
- // The preview renders arbitrary model-generated rich text, and the
671
- // `rich-text` SafeHtml profile allows ul/ol/li. Inside a
672
- // [data-component] preflight's list reset still applies and the host
673
- // undo deliberately does not reach, so markers and indent have to be
674
- // asked for explicitly — otherwise a generated bullet list previews as
675
- // flush, marker-less lines.
676
- "ds:[&_ul]:list-disc ds:[&_ol]:list-decimal",
677
- "ds:[&_ul]:ps-[var(--spacing-md)] ds:[&_ol]:ps-[var(--spacing-md)]"
678
- ].join(" ");
679
- function Lr(o, i) {
680
- return i ? o ? /\s$/.test(o) ? `${o}${i}` : `${o} ${i}` : i : o;
681
- }
682
- function Li({
683
- open: o,
684
- onClose: i,
685
- onRequestAiDraft: c,
686
- onInsert: s,
687
- previewAsHtml: g = !0,
688
- privacyNotice: m,
689
- onDictate: f
690
- }) {
691
- const { t: d } = ne(), v = Oe(), w = Oe(), [k, L] = E(""), [T, I] = E(!1), [B, b] = E(!1), [u, h] = E(null), z = A(null), [M, q] = E(!1), [V, $] = E(""), [P, N] = E(""), X = A(null), F = y(() => {
692
- var R;
693
- (R = X.current) == null || R.abort();
694
- }, []), Z = y(() => {
695
- if (!f) return;
696
- const R = new AbortController();
697
- X.current = R, q(!0), $(""), N(d("editor.ai.listening")), f({
698
- signal: R.signal,
699
- onPartialTranscript: (K) => {
700
- R.signal.aborted || $(K);
701
- },
702
- onFinalTranscript: (K) => {
703
- if (R.signal.aborted) return;
704
- const Y = K.trim();
705
- $(""), Y && (L((se) => Lr(se, Y)), N(Y));
706
- }
707
- }).catch(() => {
708
- }).finally(() => {
709
- $(""), X.current === R && (X.current = null, q(!1), N(""));
710
- });
711
- }, [f, d]), pe = y(() => {
712
- M ? F() : Z();
713
- }, [M, Z, F]);
714
- _(() => {
715
- var R, K;
716
- o ? (L(""), I(!1), b(!1), h(null), $(""), N("")) : ((R = z.current) == null || R.abort(), z.current = null, (K = X.current) == null || K.abort());
717
- }, [o]), _(
718
- () => () => {
719
- var R, K;
720
- (R = z.current) == null || R.abort(), (K = X.current) == null || K.abort();
721
- },
722
- []
723
- );
724
- const Q = y(() => {
725
- var Y;
726
- const R = k.trim();
727
- if (!R || T) return;
728
- F(), (Y = z.current) == null || Y.abort();
729
- const K = new AbortController();
730
- z.current = K, b(!1), I(!0), c({ prompt: R, signal: K.signal }).then((se) => {
731
- K.signal.aborted || (h(se), I(!1));
732
- }).catch((se) => {
733
- K.signal.aborted || se && typeof se == "object" && "name" in se && se.name === "AbortError" || (b(!0), I(!1));
734
- });
735
- }, [k, T, c, F]), Me = y(() => {
736
- u != null && (s(u), i());
737
- }, [u, s, i]), G = u != null, re = M ? Lr(k, V) : k;
738
- return /* @__PURE__ */ t(
739
- Rn,
740
- {
741
- open: o,
742
- onClose: i,
743
- ariaLabel: d("editor.ai.dialogTitle"),
744
- children: G ? /* @__PURE__ */ C("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
745
- /* @__PURE__ */ t(
746
- j,
747
- {
748
- size: "md",
749
- intent: "outline",
750
- className: et,
751
- icon: /* @__PURE__ */ t(Mr, {}),
752
- "aria-label": d("common.close"),
753
- onClick: i
754
- }
755
- ),
756
- /* @__PURE__ */ t("div", { className: "ds:min-w-0 ds:flex-1", children: g ? /* @__PURE__ */ t(
757
- Uo,
758
- {
759
- html: u,
760
- profile: "rich-text",
761
- className: Sr,
762
- tabIndex: 0,
763
- "aria-label": d("editor.ai.dialogTitle")
764
- }
765
- ) : (
766
- // Focusable so a keyboard user can scroll a long draft preview
767
- // (mirrors the SafeHtml preview branch above). The lint rule's
768
- // tabIndex allowlist doesn't cover a scrollable, non-interactive
769
- // text region.
770
- // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
771
- /* @__PURE__ */ t("p", { className: Sr, tabIndex: 0, children: u })
772
- ) }),
773
- /* @__PURE__ */ t(
774
- j,
775
- {
776
- size: "md",
777
- intent: "outline",
778
- className: `${et} ds:rounded-full`,
779
- icon: /* @__PURE__ */ t(na, {}),
780
- "aria-label": d("editor.ai.retry"),
781
- onClick: () => h(null)
782
- }
783
- ),
784
- /* @__PURE__ */ t(
785
- j,
786
- {
787
- size: "md",
788
- intent: "primary",
789
- className: `${et} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
790
- icon: /* @__PURE__ */ t(ra, {}),
791
- "aria-label": d("common.confirm"),
792
- onClick: Me
793
- }
794
- )
795
- ] }) : /* @__PURE__ */ C(Ee, { children: [
796
- /* @__PURE__ */ C("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
797
- /* @__PURE__ */ t(
798
- j,
799
- {
800
- size: "md",
801
- intent: "outline",
802
- className: et,
803
- icon: /* @__PURE__ */ t(Mr, {}),
804
- "aria-label": d("common.close"),
805
- onClick: i
806
- }
807
- ),
808
- /* @__PURE__ */ t("div", { className: "ds:min-w-0 ds:flex-1", children: /* @__PURE__ */ t(
809
- ta,
810
- {
811
- id: v,
812
- size: "md",
813
- value: re,
814
- onChange: (R) => L(R.target.value),
815
- placeholder: d("editor.ai.promptPlaceholder"),
816
- "aria-label": d("editor.ai.promptLabel"),
817
- autoResize: !0,
818
- minRows: 1,
819
- maxRows: 3,
820
- readOnly: M,
821
- tone: B ? "error" : "default",
822
- "aria-describedby": B ? w : void 0
823
- }
824
- ) }),
825
- f ? /* @__PURE__ */ t(
826
- j,
827
- {
828
- size: "md",
829
- intent: "outline",
830
- className: M ? `${et} ${zi}` : et,
831
- icon: M ? /* @__PURE__ */ t(Ct, { className: "ds:fill-current" }) : /* @__PURE__ */ t(zn, {}),
832
- "aria-pressed": M,
833
- "aria-label": d(M ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
834
- onClick: pe
835
- }
836
- ) : null,
837
- /* @__PURE__ */ t(
838
- j,
839
- {
840
- size: "md",
841
- intent: "primary",
842
- icon: T ? /* @__PURE__ */ t(On, { size: "sm", variant: "pulse" }) : /* @__PURE__ */ t(oa, {}),
843
- className: `${et} ds:bg-[image:var(--gradient-brand)] ds:rounded-full`,
844
- disabled: T || !k.trim(),
845
- "aria-busy": T || void 0,
846
- "aria-label": d("editor.ai.generate"),
847
- onClick: Q
848
- }
849
- )
850
- ] }),
851
- f ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: P }) : null,
852
- B ? /* @__PURE__ */ t(Kr, { id: w }) : m ? /* @__PURE__ */ t("p", { className: _i, children: m }) : null
853
- ] })
854
- }
855
- );
856
- }
857
- function Vr(o, i) {
858
- return o(i, { nsSeparator: !1, defaultValue: i });
859
- }
860
- const Wr = {
861
- // Redactor's own history. AI rewrites push onto it too (see
862
- // `pushUndoState` in rich-text-editor.tsx), so Undo steps back over them.
863
- undo: {
864
- id: "undo",
865
- icon: /* @__PURE__ */ t(ca, {}),
866
- label: ["editor.undo", "Undo"],
867
- command: ["module.buffer.undo"]
868
- },
869
- redo: {
870
- id: "redo",
871
- icon: /* @__PURE__ */ t(ui, {}),
872
- label: ["editor.redo", "Redo"],
873
- command: ["module.buffer.redo"]
874
- },
875
- bold: {
876
- id: "bold",
877
- icon: /* @__PURE__ */ t(Ma, {}),
878
- label: ["editor.bold", "Bold"],
879
- command: ["module.inline.format", { tag: "b" }],
880
- toggle: "bold"
881
- },
882
- italic: {
883
- id: "italic",
884
- icon: /* @__PURE__ */ t(Oa, {}),
885
- label: ["editor.italic", "Italic"],
886
- command: ["module.inline.format", { tag: "i" }],
887
- toggle: "italic"
888
- },
889
- underline: {
890
- id: "underline",
891
- icon: /* @__PURE__ */ t(Ti, {}),
892
- label: ["editor.underline", "Underline"],
893
- command: ["module.inline.format", { tag: "u" }],
894
- toggle: "underline"
895
- },
896
- strike: {
897
- id: "strike",
898
- icon: /* @__PURE__ */ t(pi, {}),
899
- label: ["editor.strike", "Strikethrough"],
900
- command: ["module.inline.format", { tag: "del" }],
901
- toggle: "strike"
902
- },
903
- ul: {
904
- id: "ul",
905
- icon: /* @__PURE__ */ t(Ga, {}),
906
- label: ["editor.list.bullet", "Bulleted list"],
907
- command: ["module.list.toggle", "ul"],
908
- toggle: "ul"
909
- },
910
- ol: {
911
- id: "ol",
912
- icon: /* @__PURE__ */ t(Fa, {}),
913
- label: ["editor.list.ordered", "Numbered list"],
914
- command: ["module.list.toggle", "ol"],
915
- toggle: "ol"
916
- }
917
- }, Tn = [
918
- {
919
- id: "paragraph",
920
- tag: "p",
921
- icon: /* @__PURE__ */ t(si, {}),
922
- label: ["editor.paragraph", "Paragraph"]
923
- },
924
- {
925
- id: "h2",
926
- tag: "h2",
927
- icon: /* @__PURE__ */ t(Ha, {}),
928
- label: ["editor.heading2", "Heading 2"]
929
- },
930
- {
931
- id: "h3",
932
- tag: "h3",
933
- icon: /* @__PURE__ */ t($a, {}),
934
- label: ["editor.heading3", "Heading 3"]
935
- },
936
- {
937
- id: "quote",
938
- tag: "blockquote",
939
- icon: /* @__PURE__ */ t(ci, {}),
940
- label: ["editor.quote", "Quote"]
941
- }
942
- ], Hi = {
943
- minimal: ["bold", "italic", "underline", "link"],
944
- standard: [
945
- "undo",
946
- "redo",
947
- "format",
948
- "bold",
949
- "italic",
950
- "underline",
951
- "strike",
952
- "ul",
953
- "ol",
954
- "link"
955
- ],
956
- full: [
957
- "undo",
958
- "redo",
959
- "format",
960
- "bold",
961
- "italic",
962
- "underline",
963
- "strike",
964
- "ul",
965
- "ol",
966
- "link"
967
- ]
968
- }, Xr = [
969
- {
970
- id: "rowAbove",
971
- command: "plugin.table.addRowAbove",
972
- icon: /* @__PURE__ */ t(ka, {}),
973
- label: ["editor.table.rowAbove", "Add row above"]
974
- },
975
- {
976
- id: "rowBelow",
977
- command: "plugin.table.addRowBelow",
978
- icon: /* @__PURE__ */ t(ya, {}),
979
- label: ["editor.table.rowBelow", "Add row below"]
980
- },
981
- {
982
- id: "colLeft",
983
- command: "plugin.table.addColumnLeft",
984
- icon: /* @__PURE__ */ t(Na, {}),
985
- label: ["editor.table.columnLeft", "Add column left"]
986
- },
987
- {
988
- id: "colRight",
989
- command: "plugin.table.addColumnRight",
990
- icon: /* @__PURE__ */ t(Ca, {}),
991
- label: ["editor.table.columnRight", "Add column right"]
992
- },
993
- {
994
- id: "addHead",
995
- command: "plugin.table.addHead",
996
- icon: /* @__PURE__ */ t(oi, {}),
997
- label: ["editor.table.addHeader", "Add header row"]
998
- },
999
- {
1000
- id: "deleteHead",
1001
- command: "plugin.table.deleteHead",
1002
- icon: /* @__PURE__ */ t(ni, {}),
1003
- label: ["editor.table.deleteHeader", "Remove header row"]
1004
- },
1005
- {
1006
- id: "deleteRow",
1007
- command: "plugin.table.deleteRow",
1008
- icon: /* @__PURE__ */ t(fi, {}),
1009
- label: ["editor.table.deleteRow", "Delete row"]
1010
- },
1011
- {
1012
- id: "deleteColumn",
1013
- command: "plugin.table.deleteColumn",
1014
- icon: /* @__PURE__ */ t(Sa, {}),
1015
- label: ["editor.table.deleteColumn", "Delete column"]
1016
- },
1017
- {
1018
- id: "deleteTable",
1019
- command: "plugin.table.deleteTable",
1020
- icon: /* @__PURE__ */ t(fa, {}),
1021
- label: ["editor.table.deleteTable", "Delete table"]
1022
- }
1023
- ], Ut = 6, Ur = "ds:[&_[data-intent=ghost]:hover]:bg-[color-mix(in_srgb,var(--accent)_12%,transparent)] ds:[&_[data-intent=ghost]:hover]:text-[color:var(--accent)]", Ii = Dn(
1024
- [
1025
- "ds:@container/toolbar",
1026
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1027
- "ds:bg-[var(--background)] ds:p-[var(--spacing-xs)]",
1028
- "ds:shadow-[var(--shadow-md)]",
1029
- Ur
1030
- ].join(" ")
1031
- ), $i = "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]", en = "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[var(--border)] ds:[margin-inline:var(--spacing-2xs)]", At = "ds:text-[length:var(--font-size-sm)] ds:font-medium ds:text-[color:var(--foreground)]";
1032
- function Jt(o) {
1033
- return o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1034
- }
1035
- function Di({
1036
- variables: o,
1037
- recentVariableTokens: i,
1038
- insertVariable: c,
1039
- saveSelection: s
1040
- }) {
1041
- const { t: g } = ne(), [m, f] = E(!1), [d, v] = E(""), w = A(null), k = A(!1), L = o;
1042
- return /* @__PURE__ */ C(
1043
- Xt.Root,
1044
- {
1045
- open: m,
1046
- onOpenChange: (T) => {
1047
- T && s(), f(T), T && v("");
1048
- },
1049
- children: [
1050
- /* @__PURE__ */ t(Xt.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1051
- j,
1052
- {
1053
- ref: w,
1054
- size: "sm",
1055
- intent: "ghost",
1056
- icon: /* @__PURE__ */ t(za, {}),
1057
- "aria-label": g("editor.insertVariable", "Insert variable")
1058
- }
1059
- ) }),
1060
- /* @__PURE__ */ t(Xt.Portal, { children: /* @__PURE__ */ t(
1061
- Xt.Content,
1062
- {
1063
- align: "start",
1064
- sideOffset: 4,
1065
- className: "ds:z-[var(--z-popover)]",
1066
- onCloseAutoFocus: (T) => {
1067
- k.current && (T.preventDefault(), k.current = !1);
1068
- },
1069
- children: /* @__PURE__ */ t(
1070
- jr,
1071
- {
1072
- variables: L,
1073
- recentTokens: i,
1074
- query: d,
1075
- onQueryChange: v,
1076
- searchFocusable: !0,
1077
- "aria-label": g("editor.insertVariable", "Insert variable"),
1078
- onSelect: (T) => {
1079
- k.current = !0, c(T.token), f(!1);
1080
- },
1081
- onClose: () => f(!1)
1082
- }
1083
- )
1084
- }
1085
- ) })
1086
- ]
1087
- }
1088
- );
1089
- }
1090
- function Oi({
1091
- run: o,
1092
- active: i,
1093
- onTriggerDown: c
1094
- }) {
1095
- const { t: s } = ne(), g = Tn.find((m) => i.has(m.id)) ?? Tn[0];
1096
- return /* @__PURE__ */ C(te.Root, { children: [
1097
- /* @__PURE__ */ t(te.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1098
- Te,
1099
- {
1100
- size: "sm",
1101
- intent: "ghost",
1102
- startIcon: g.icon,
1103
- endIcon: /* @__PURE__ */ t(Gr, {}),
1104
- "aria-label": `${s("editor.format", "Paragraph style")}: ${s(
1105
- g.label[0],
1106
- g.label[1]
1107
- )}`,
1108
- onMouseDown: c,
1109
- children: /* @__PURE__ */ t("span", { className: "ds:hidden ds:@[448px]/toolbar:inline", children: s(g.label[0], g.label[1]) })
1110
- }
1111
- ) }),
1112
- /* @__PURE__ */ t(te.Content, { align: "start", children: Tn.map((m) => /* @__PURE__ */ t(
1113
- te.Item,
1114
- {
1115
- startIcon: m.icon,
1116
- onSelect: () => o("module.block.format", { tag: m.tag }),
1117
- children: s(m.label[0], m.label[1])
1118
- },
1119
- m.id
1120
- )) })
1121
- ] });
1122
- }
1123
- function qi({
1124
- insertHtml: o,
1125
- saveSelection: i,
1126
- restoreSelection: c,
1127
- getSelectedText: s
1128
- }) {
1129
- const { t: g } = ne(), [m, f] = E(!1), [d, v] = E(""), [w, k] = E(""), [L, T] = E(!1), I = Oe(), B = Oe(), b = () => {
1130
- v(""), k(""), T(!1);
1131
- }, u = () => {
1132
- const h = d.trim();
1133
- if (!h) return;
1134
- const z = w.trim() || h, M = L ? ' target="_blank" rel="noopener noreferrer"' : "", q = `<a href="${Jt(h)}"${M}>${Jt(z)}</a>`;
1135
- f(!1), b(), window.requestAnimationFrame(() => {
1136
- c(), o(q);
1137
- });
1138
- };
1139
- return /* @__PURE__ */ C(ie.Root, { open: m, onOpenChange: f, children: [
1140
- /* @__PURE__ */ t(ie.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1141
- j,
1142
- {
1143
- size: "sm",
1144
- intent: "ghost",
1145
- icon: /* @__PURE__ */ t(Ba, {}),
1146
- "aria-label": g("editor.link.insert", "Insert link"),
1147
- onMouseDown: () => {
1148
- i(), k(s());
1149
- }
1150
- }
1151
- ) }),
1152
- /* @__PURE__ */ C(ie.Content, { children: [
1153
- /* @__PURE__ */ t(ie.Header, { children: /* @__PURE__ */ t(ie.Title, { children: g("editor.link.insert", "Insert link") }) }),
1154
- /* @__PURE__ */ C(ie.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1155
- /* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1156
- /* @__PURE__ */ t("label", { htmlFor: I, className: At, children: g("editor.link.url", "URL") }),
1157
- /* @__PURE__ */ t(
1158
- Yt,
1159
- {
1160
- id: I,
1161
- type: "url",
1162
- value: d,
1163
- onChange: (h) => v(h.target.value),
1164
- placeholder: "https://…"
1165
- }
1166
- )
1167
- ] }),
1168
- /* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1169
- /* @__PURE__ */ t("label", { htmlFor: B, className: At, children: g("editor.link.text", "Text to display") }),
1170
- /* @__PURE__ */ t(
1171
- Yt,
1172
- {
1173
- id: B,
1174
- value: w,
1175
- onChange: (h) => k(h.target.value),
1176
- placeholder: g("editor.link.textPlaceholder", "Link text")
1177
- }
1178
- )
1179
- ] }),
1180
- /* @__PURE__ */ t(
1181
- aa,
1182
- {
1183
- checked: L,
1184
- onCheckedChange: (h) => T(h === !0),
1185
- label: g("editor.link.newTab", "Open in new tab")
1186
- }
1187
- )
1188
- ] }),
1189
- /* @__PURE__ */ C(ie.Footer, { children: [
1190
- /* @__PURE__ */ t(ie.Close, { asChild: !0, children: /* @__PURE__ */ t(Te, { intent: "secondary", children: g("common.cancel") }) }),
1191
- /* @__PURE__ */ t(Te, { onClick: u, disabled: !d.trim(), children: g("editor.link.insertAction", "Insert") })
1192
- ] })
1193
- ] })
1194
- ] });
1195
- }
1196
- function Bi({
1197
- insertHtml: o,
1198
- saveSelection: i,
1199
- restoreSelection: c,
1200
- uploadImage: s
1201
- }) {
1202
- const { t: g } = ne(), [m, f] = E(!1), [d, v] = E(""), [w, k] = E(""), L = Oe(), T = Oe(), I = (b, u) => {
1203
- const h = `<img src="${Jt(b)}" alt="${Jt(u)}" loading="lazy">`;
1204
- f(!1), v(""), k(""), window.requestAnimationFrame(() => {
1205
- c(), o(h);
1206
- });
1207
- }, B = () => {
1208
- const b = d.trim();
1209
- b && I(b, w.trim());
1210
- };
1211
- return /* @__PURE__ */ C(ie.Root, { open: m, onOpenChange: f, children: [
1212
- /* @__PURE__ */ t(ie.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1213
- j,
1214
- {
1215
- size: "sm",
1216
- intent: "ghost",
1217
- icon: /* @__PURE__ */ t(da, {}),
1218
- "aria-label": g("editor.image.insert", "Insert image"),
1219
- onMouseDown: () => i()
1220
- }
1221
- ) }),
1222
- /* @__PURE__ */ C(ie.Content, { children: [
1223
- /* @__PURE__ */ t(ie.Header, { children: /* @__PURE__ */ t(ie.Title, { children: g("editor.image.insert", "Insert image") }) }),
1224
- /* @__PURE__ */ C(ie.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1225
- s ? /* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1226
- /* @__PURE__ */ t("span", { className: At, children: g("editor.image.upload", "Upload") }),
1227
- /* @__PURE__ */ t(
1228
- ia,
1229
- {
1230
- variant: "dropzone",
1231
- accept: {
1232
- "image/*": [".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg"]
1233
- },
1234
- maxFiles: 1,
1235
- onUpload: async (b, { signal: u }) => {
1236
- const h = await s(b, u);
1237
- I(h, b.name);
1238
- }
1239
- }
1240
- ),
1241
- /* @__PURE__ */ t("span", { className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: g("editor.image.orUrl", "Or paste an image URL") })
1242
- ] }) : null,
1243
- /* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1244
- /* @__PURE__ */ t("label", { htmlFor: L, className: At, children: g("editor.image.url", "Image URL") }),
1245
- /* @__PURE__ */ t(
1246
- Yt,
1247
- {
1248
- id: L,
1249
- type: "url",
1250
- value: d,
1251
- onChange: (b) => v(b.target.value),
1252
- placeholder: "https://…"
1253
- }
1254
- )
1255
- ] }),
1256
- /* @__PURE__ */ C("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
1257
- /* @__PURE__ */ t("label", { htmlFor: T, className: At, children: g("editor.image.alt", "Alt text") }),
1258
- /* @__PURE__ */ t(
1259
- Yt,
1260
- {
1261
- id: T,
1262
- value: w,
1263
- onChange: (b) => k(b.target.value),
1264
- placeholder: g(
1265
- "editor.image.altPlaceholder",
1266
- "Describe the image"
1267
- )
1268
- }
1269
- )
1270
- ] })
1271
- ] }),
1272
- /* @__PURE__ */ C(ie.Footer, { children: [
1273
- /* @__PURE__ */ t(ie.Close, { asChild: !0, children: /* @__PURE__ */ t(Te, { intent: "secondary", children: g("common.cancel") }) }),
1274
- /* @__PURE__ */ t(Te, { onClick: B, disabled: !d.trim(), children: g("editor.image.insertAction", "Insert") })
1275
- ] })
1276
- ] })
1277
- ] });
1278
- }
1279
- function Pi({
1280
- run: o,
1281
- saveSelection: i,
1282
- restoreSelection: c
1283
- }) {
1284
- const { t: s } = ne(), [g, m] = E("#1f2a5c"), f = (v) => {
1285
- m(v), c(), o("module.inline.format", {
1286
- tag: "span",
1287
- style: { color: v },
1288
- type: "toggle"
1289
- });
1290
- }, d = () => {
1291
- c(), o("module.inline.remove", { style: "color" });
1292
- };
1293
- return /* @__PURE__ */ C(ee, { onOpenChange: (v) => v && i(), children: [
1294
- /* @__PURE__ */ t(ee.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1295
- j,
1296
- {
1297
- size: "sm",
1298
- intent: "ghost",
1299
- icon: /* @__PURE__ */ t(Za, {}),
1300
- "aria-label": s("editor.textColor", "Text colour"),
1301
- onMouseDown: (v) => {
1302
- v.preventDefault(), i();
1303
- }
1304
- }
1305
- ) }),
1306
- /* @__PURE__ */ C(ee.Content, { side: "bottom", align: "start", children: [
1307
- /* @__PURE__ */ t(ee.Heading, { children: s("editor.textColor", "Text colour") }),
1308
- /* @__PURE__ */ t("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(
1309
- Bn,
1310
- {
1311
- variant: "inline",
1312
- size: "sm",
1313
- value: g,
1314
- onChange: f
1315
- }
1316
- ) }),
1317
- /* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t(Te, { size: "sm", intent: "secondary", onClick: d, children: s("editor.color.remove", "Remove colour") }) })
1318
- ] })
1319
- ] });
1320
- }
1321
- function Fi({
1322
- run: o,
1323
- saveSelection: i,
1324
- restoreSelection: c
1325
- }) {
1326
- const { t: s } = ne(), [g, m] = E("#fff3a3"), f = (v) => {
1327
- m(v), c(), o("module.inline.format", {
1328
- tag: "span",
1329
- style: { "background-color": v },
1330
- type: "toggle"
1331
- });
1332
- }, d = () => {
1333
- c(), o("module.inline.remove", { style: "background-color" });
1334
- };
1335
- return /* @__PURE__ */ C(ee, { onOpenChange: (v) => v && i(), children: [
1336
- /* @__PURE__ */ t(ee.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1337
- j,
1338
- {
1339
- size: "sm",
1340
- intent: "ghost",
1341
- icon: /* @__PURE__ */ t(la, {}),
1342
- "aria-label": s("editor.highlightColor", "Highlight"),
1343
- onMouseDown: (v) => {
1344
- v.preventDefault(), i();
1345
- }
1346
- }
1347
- ) }),
1348
- /* @__PURE__ */ C(ee.Content, { side: "bottom", align: "start", children: [
1349
- /* @__PURE__ */ t(ee.Heading, { children: s("editor.highlightColor", "Highlight") }),
1350
- /* @__PURE__ */ t("div", { className: "ds:pt-[var(--spacing-sm)]", children: /* @__PURE__ */ t(
1351
- Bn,
1352
- {
1353
- variant: "inline",
1354
- size: "sm",
1355
- value: g,
1356
- onChange: f
1357
- }
1358
- ) }),
1359
- /* @__PURE__ */ t("div", { className: "ds:mt-[var(--spacing-sm)] ds:flex ds:items-center ds:justify-end", children: /* @__PURE__ */ t(Te, { size: "sm", intent: "secondary", onClick: d, children: s("editor.highlight.remove", "Remove highlight") }) })
1360
- ] })
1361
- ] });
1362
- }
1363
- function ji(o, i) {
1364
- const c = Array.from({ length: i }, () => "<td><br></td>").join("");
1365
- return `<table><tbody>${Array.from({ length: o }, () => `<tr>${c}</tr>`).join("")}</tbody></table>`;
1366
- }
1367
- function Gi({
1368
- run: o,
1369
- insertTable: i,
1370
- active: c
1371
- }) {
1372
- const { t: s } = ne(), [g, m] = E({ r: 0, c: 0 }), f = c.has("table");
1373
- return /* @__PURE__ */ C(ee, { onOpenChange: (d) => !d && m({ r: 0, c: 0 }), children: [
1374
- /* @__PURE__ */ t(ee.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1375
- j,
1376
- {
1377
- size: "sm",
1378
- intent: "ghost",
1379
- icon: /* @__PURE__ */ t(vi, {}),
1380
- "aria-label": s("editor.table.insert", "Insert table"),
1381
- onMouseDown: (d) => d.preventDefault()
1382
- }
1383
- ) }),
1384
- /* @__PURE__ */ t(ee.Content, { side: "bottom", align: "start", children: f ? (
1385
- // Caret is already inside a table — offer the manage ops only, never
1386
- // a nested-table insert (mirrors Redactor's native dropdown, which
1387
- // disables "insert table" while the caret is in a table).
1388
- /* @__PURE__ */ t("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: Xr.map((d) => /* @__PURE__ */ C(
1389
- "button",
1390
- {
1391
- type: "button",
1392
- onClick: () => o(d.command),
1393
- className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)] ds:rounded-[var(--radius-sm)] ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] ds:text-start ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)] ds:hover:bg-[var(--muted)]",
1394
- children: [
1395
- /* @__PURE__ */ t(
1396
- "span",
1397
- {
1398
- "aria-hidden": "true",
1399
- className: "ds:inline-flex ds:size-4 ds:shrink-0 ds:items-center ds:justify-center ds:text-[color:var(--muted-foreground)]",
1400
- children: d.icon
1401
- }
1402
- ),
1403
- s(d.label[0], d.label[1])
1404
- ]
1405
- },
1406
- d.id
1407
- )) })
1408
- ) : /* @__PURE__ */ C(Ee, { children: [
1409
- /* @__PURE__ */ t(ee.Heading, { children: s("editor.table.insert", "Insert table") }),
1410
- /* @__PURE__ */ t(
1411
- "div",
1412
- {
1413
- role: "group",
1414
- "aria-label": s("editor.table.sizePicker", "Table size"),
1415
- className: "ds:mt-[var(--spacing-sm)] ds:grid ds:w-fit ds:grid-cols-6 ds:gap-[var(--spacing-2xs)]",
1416
- onMouseLeave: () => m({ r: 0, c: 0 }),
1417
- children: Array.from({ length: Ut * Ut }, (d, v) => {
1418
- const w = Math.floor(v / Ut) + 1, k = v % Ut + 1, L = w <= g.r && k <= g.c;
1419
- return /* @__PURE__ */ t(
1420
- "button",
1421
- {
1422
- type: "button",
1423
- "aria-label": s("editor.table.sizeCell", "{{r}}×{{c}}", {
1424
- r: w,
1425
- c: k
1426
- }),
1427
- onMouseEnter: () => m({ r: w, c: k }),
1428
- onClick: () => i(ji(w, k)),
1429
- className: `ds:size-5 ds:rounded-[var(--radius-sm)] ds:border ds:border-[color:var(--border)] ${L ? "ds:bg-[var(--primary)]" : "ds:bg-[var(--muted)]"}`
1430
- },
1431
- v
1432
- );
1433
- })
1434
- }
1435
- ),
1436
- /* @__PURE__ */ t("p", { className: "ds:mt-[var(--spacing-xs)] ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--muted-foreground)]", children: g.r > 0 ? s("editor.table.sizeCell", "{{r}}×{{c}}", {
1437
- r: g.r,
1438
- c: g.c
1439
- }) : s("editor.table.sizeHint", "Pick a size") })
1440
- ] }) })
1441
- ] });
1442
- }
1443
- const Ki = Object.fromEntries(Xr.map((o) => [o.id, o])), Vi = [
1444
- "ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
1445
- "ds:[inset-block-start:var(--rte-tt-top)] ds:[inset-inline-start:var(--rte-tt-start)]",
1446
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1447
- "ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
1448
- ].join(" "), Wi = "#fde68a";
1449
- function Hr({
1450
- scope: o,
1451
- icon: i,
1452
- label: c,
1453
- onOpenChange: s,
1454
- saveTableCell: g,
1455
- applyTableBackground: m
1456
- }) {
1457
- const { t: f } = ne(), [d, v] = E(Wi);
1458
- return /* @__PURE__ */ C(
1459
- ee,
1460
- {
1461
- onOpenChange: (w) => {
1462
- s(w), w && g();
1463
- },
1464
- children: [
1465
- /* @__PURE__ */ t(ee.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
1466
- j,
1467
- {
1468
- size: "sm",
1469
- intent: "ghost",
1470
- icon: i,
1471
- tooltip: c,
1472
- onMouseDown: (w) => w.preventDefault()
1473
- }
1474
- ) }),
1475
- /* @__PURE__ */ C(ee.Content, { side: "bottom", align: "center", children: [
1476
- /* @__PURE__ */ t(
1477
- Bn,
1478
- {
1479
- variant: "inline",
1480
- size: "sm",
1481
- value: d,
1482
- onChange: (w) => {
1483
- v(w), m(o, w);
1484
- }
1485
- }
1486
- ),
1487
- /* @__PURE__ */ t(
1488
- Te,
1489
- {
1490
- size: "sm",
1491
- intent: "ghost",
1492
- className: "ds:mt-[var(--spacing-xs)] ds:w-full",
1493
- onClick: () => m(o, null),
1494
- children: f("editor.table.clearColor", "Clear colour")
1495
- }
1496
- )
1497
- ] })
1498
- ]
1499
- }
1500
- );
1501
- }
1502
- function Xi({
1503
- active: o,
1504
- run: i,
1505
- areaRef: c,
1506
- getActiveTableEl: s,
1507
- enableColor: g = !1,
1508
- saveTableCell: m,
1509
- applyTableBackground: f
1510
- }) {
1511
- const { t: d } = ne(), v = o.has("table"), [w, k] = E(null), L = A(0), [T, I] = E(!1), B = y((u) => {
1512
- L.current = Math.max(
1513
- 0,
1514
- L.current + (u ? 1 : -1)
1515
- ), I(L.current > 0);
1516
- }, []);
1517
- if (_(() => {
1518
- if (T) return;
1519
- if (!v || typeof window > "u") {
1520
- k(null);
1521
- return;
1522
- }
1523
- const u = () => {
1524
- const q = c.current, V = s();
1525
- if (!q || !V) {
1526
- k(null);
1527
- return;
1528
- }
1529
- const $ = q.getBoundingClientRect(), P = V.getBoundingClientRect(), N = getComputedStyle(q).direction === "rtl", X = Math.max(0, P.top - $.top - 44), F = N ? $.right - P.right + P.width / 2 : P.left - $.left + P.width / 2;
1530
- k({ top: X, start: Math.max(0, F), rtl: N });
1531
- };
1532
- u();
1533
- const h = new ResizeObserver(u), z = c.current, M = s();
1534
- return z && h.observe(z), M && h.observe(M), window.addEventListener("scroll", u, !0), window.addEventListener("resize", u), () => {
1535
- h.disconnect(), window.removeEventListener("scroll", u, !0), window.removeEventListener("resize", u);
1536
- };
1537
- }, [v, T, c, s]), !v && !T || !w) return null;
1538
- const b = [
1539
- ["rowAbove", "rowBelow"],
1540
- ["colLeft", "colRight"],
1541
- ["addHead"],
1542
- ...g ? ["colour"] : [],
1543
- ["deleteRow", "deleteColumn"],
1544
- ["deleteTable"]
1545
- ];
1546
- return (
1547
- // Tooltips disambiguate the icon-only ops on hover (and provide each
1548
- // button's accessible name via IconButton's `tooltip` prop). Radix Tooltip
1549
- // needs a provider ancestor, so scope one to the bar.
1550
- /* @__PURE__ */ t(qn, { children: /* @__PURE__ */ t(
1551
- "div",
1552
- {
1553
- role: "group",
1554
- "aria-label": d("editor.table.toolbar", "Table tools"),
1555
- className: `${Vi} ${w.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
1556
- style: {
1557
- "--rte-tt-top": `${w.top}px`,
1558
- "--rte-tt-start": `${w.start}px`
1559
- },
1560
- children: b.map((u, h) => /* @__PURE__ */ C(ft, { children: [
1561
- h > 0 ? /* @__PURE__ */ t("span", { "aria-hidden": "true", className: en }) : null,
1562
- u === "colour" ? /* @__PURE__ */ C(Ee, { children: [
1563
- /* @__PURE__ */ t(
1564
- Hr,
1565
- {
1566
- scope: "cell",
1567
- icon: /* @__PURE__ */ t(Va, {}),
1568
- label: d("editor.table.cellColor", "Cell colour"),
1569
- onOpenChange: B,
1570
- saveTableCell: m,
1571
- applyTableBackground: f
1572
- }
1573
- ),
1574
- /* @__PURE__ */ t(
1575
- Hr,
1576
- {
1577
- scope: "row",
1578
- icon: /* @__PURE__ */ t(Xa, {}),
1579
- label: d("editor.table.rowColor", "Row colour"),
1580
- onOpenChange: B,
1581
- saveTableCell: m,
1582
- applyTableBackground: f
1583
- }
1584
- )
1585
- ] }) : u.map((z) => {
1586
- const M = Ki[z];
1587
- return /* @__PURE__ */ t(
1588
- j,
1589
- {
1590
- size: "sm",
1591
- intent: "ghost",
1592
- icon: M.icon,
1593
- tooltip: d(M.label[0], M.label[1]),
1594
- onMouseDown: (q) => q.preventDefault(),
1595
- onClick: () => i(M.command)
1596
- },
1597
- z
1598
- );
1599
- })
1600
- ] }, u === "colour" ? "colour" : u[0]))
1601
- }
1602
- ) })
1603
- );
1604
- }
1605
- const Hn = [
1606
- "wysiwyg-img-inline",
1607
- "wysiwyg-img-wrap-left",
1608
- "wysiwyg-img-wrap-right"
1609
- ], Zr = [
1610
- "wysiwyg-img-align-left",
1611
- "wysiwyg-img-align-center",
1612
- "wysiwyg-img-align-right"
1613
- ];
1614
- function Ir(o, i) {
1615
- return i.find((c) => o.classList.contains(c)) ?? "";
1616
- }
1617
- function Ui(o) {
1618
- const i = o.closest(".redactor-in"), c = i instanceof HTMLElement ? i.clientWidth : 0, s = o.getBoundingClientRect().width;
1619
- return c <= 0 || s <= 0 ? Nt : Math.round(Math.min(Nt, s / c * 100));
1620
- }
1621
- const In = 10, Nt = 100, Zi = 5, Qi = 10, $r = (o) => Math.min(Nt, Math.max(In, Math.round(o))), Yi = [
1622
- {
1623
- id: "wysiwyg-img-inline",
1624
- icon: /* @__PURE__ */ t(ba, {}),
1625
- label: ["editor.image.inline", "Inline with text"]
1626
- },
1627
- {
1628
- id: "wysiwyg-img-wrap-left",
1629
- icon: /* @__PURE__ */ t(Ya, {}),
1630
- label: ["editor.image.wrapLeft", "Wrap left"]
1631
- },
1632
- {
1633
- id: "wysiwyg-img-wrap-right",
1634
- icon: /* @__PURE__ */ t(ei, {}),
1635
- label: ["editor.image.wrapRight", "Wrap right"]
1636
- }
1637
- ], Ji = [
1638
- {
1639
- id: "wysiwyg-img-align-left",
1640
- icon: /* @__PURE__ */ t(Ai, {}),
1641
- label: ["editor.image.alignLeft", "Align left"]
1642
- },
1643
- {
1644
- id: "wysiwyg-img-align-center",
1645
- icon: /* @__PURE__ */ t(wi, {}),
1646
- label: ["editor.image.alignCenter", "Align centre"]
1647
- },
1648
- {
1649
- id: "wysiwyg-img-align-right",
1650
- icon: /* @__PURE__ */ t(xi, {}),
1651
- label: ["editor.image.alignRight", "Align right"]
1652
- }
1653
- ], es = [
1654
- {
1655
- id: "tl",
1656
- pos: "ds:[inset-block-start:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-start:calc(var(--spacing-md)*-0.5)]",
1657
- cursor: "ds:cursor-nwse-resize",
1658
- sign: -1,
1659
- labelKey: "editor.image.resizeTopStart",
1660
- labelFallback: "Resize image, top-start corner"
1661
- },
1662
- {
1663
- id: "tr",
1664
- pos: "ds:[inset-block-start:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-end:calc(var(--spacing-md)*-0.5)]",
1665
- cursor: "ds:cursor-nesw-resize",
1666
- sign: 1,
1667
- labelKey: "editor.image.resizeTopEnd",
1668
- labelFallback: "Resize image, top-end corner"
1669
- },
1670
- {
1671
- id: "bl",
1672
- pos: "ds:[inset-block-end:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-start:calc(var(--spacing-md)*-0.5)]",
1673
- cursor: "ds:cursor-nesw-resize",
1674
- sign: -1,
1675
- labelKey: "editor.image.resizeBottomStart",
1676
- labelFallback: "Resize image, bottom-start corner"
1677
- },
1678
- {
1679
- id: "br",
1680
- pos: "ds:[inset-block-end:calc(var(--spacing-md)*-0.5)] ds:[inset-inline-end:calc(var(--spacing-md)*-0.5)]",
1681
- cursor: "ds:cursor-nwse-resize",
1682
- sign: 1,
1683
- labelKey: "editor.image.resizeBottomEnd",
1684
- labelFallback: "Resize image, bottom-end corner"
1685
- }
1686
- ], ts = [
1687
- "ds:absolute ds:z-20 ds:pointer-events-none",
1688
- "ds:[inset-block-start:var(--rte-img-top)] ds:[inset-inline-start:var(--rte-img-start)]",
1689
- "ds:[inline-size:var(--rte-img-width)] ds:[block-size:var(--rte-img-height)]",
1690
- "ds:rounded-[var(--radius-2xs)]",
1691
- "ds:[outline-style:solid] ds:[outline-width:var(--border-width-md)]",
1692
- "ds:[outline-color:var(--accent)] ds:[outline-offset:var(--focus-ring-offset)]"
1693
- ].join(" "), ns = [
1694
- "ds:absolute ds:pointer-events-auto ds:touch-none",
1695
- "ds:[inline-size:var(--spacing-md)] ds:[block-size:var(--spacing-md)]",
1696
- "ds:rounded-[var(--radius-2xs)] ds:shadow-[var(--shadow-sm)]",
1697
- "ds:bg-[var(--accent)] ds:border ds:border-[color:var(--background)]",
1698
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
1699
- "ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)]",
1700
- "ds:focus-visible:[outline-offset:var(--focus-ring-offset)]",
1701
- "ds:forced-colors:bg-[CanvasText]"
1702
- ].join(" "), rs = [
1703
- "ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
1704
- "ds:[inset-block-start:var(--rte-img-bar-top)] ds:[inset-inline-start:var(--rte-img-center)]",
1705
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1706
- "ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]"
1707
- ].join(" ");
1708
- function os({
1709
- areaRef: o,
1710
- activeImageEl: i,
1711
- applyImageClass: c,
1712
- setImageWidth: s
1713
- }) {
1714
- const { t: g } = ne(), [m, f] = E(null), d = A(null);
1715
- _(() => {
1716
- if (!i || typeof window > "u") {
1717
- f(null);
1718
- return;
1719
- }
1720
- const b = () => {
1721
- const q = o.current;
1722
- if (!q) {
1723
- f(null);
1724
- return;
1725
- }
1726
- const V = q.getBoundingClientRect(), $ = i.getBoundingClientRect(), P = getComputedStyle(q).direction === "rtl", N = $.top - V.top, X = P ? V.right - $.right : $.left - V.left, F = X + $.width / 2, Z = Math.max(0, N - 44);
1727
- f({
1728
- top: N,
1729
- start: Math.max(0, X),
1730
- width: $.width,
1731
- height: $.height,
1732
- center: Math.max(0, F),
1733
- barTop: Z,
1734
- pct: Ui(i),
1735
- rtl: P
1736
- });
1737
- };
1738
- b();
1739
- const u = new ResizeObserver(b);
1740
- u.observe(i);
1741
- const h = o.current;
1742
- h && u.observe(h);
1743
- const z = i.closest(".redactor-in");
1744
- let M = null;
1745
- return z && (M = new MutationObserver(b), M.observe(z, {
1746
- subtree: !0,
1747
- childList: !0,
1748
- characterData: !0,
1749
- attributes: !0,
1750
- attributeFilter: ["class", "style", "width", "height", "src"]
1751
- })), window.addEventListener("scroll", b, !0), window.addEventListener("resize", b), () => {
1752
- u.disconnect(), M == null || M.disconnect(), window.removeEventListener("scroll", b, !0), window.removeEventListener("resize", b);
1753
- };
1754
- }, [i, o]);
1755
- const v = y(
1756
- (b) => (u) => {
1757
- !u.isPrimary || !m || (u.preventDefault(), u.currentTarget.setPointerCapture(u.pointerId), d.current = {
1758
- pointerId: u.pointerId,
1759
- startX: u.clientX,
1760
- startPct: m.pct,
1761
- sign: b.sign * (m.rtl ? -1 : 1)
1762
- });
1763
- },
1764
- [m]
1765
- ), w = y(
1766
- (b) => {
1767
- const u = d.current;
1768
- if (!u || b.pointerId !== u.pointerId || !i) return;
1769
- const h = i.closest(".redactor-in"), z = h instanceof HTMLElement ? h.clientWidth : 0;
1770
- if (z <= 0) return;
1771
- const M = u.sign * (b.clientX - u.startX) / z * 100;
1772
- s($r(u.startPct + M));
1773
- },
1774
- [i, s]
1775
- ), k = y(
1776
- (b) => {
1777
- const u = d.current;
1778
- !u || b.pointerId !== u.pointerId || (b.currentTarget.releasePointerCapture(b.pointerId), d.current = null);
1779
- },
1780
- []
1781
- ), L = y(
1782
- (b) => {
1783
- if (!m) return;
1784
- let u = null;
1785
- const h = b.shiftKey ? Qi : Zi;
1786
- switch (b.key) {
1787
- // Up / right always grow; down / left always shrink — independent of
1788
- // which corner has focus, so the gesture reads the same everywhere.
1789
- case "ArrowRight":
1790
- case "ArrowUp":
1791
- u = m.pct + h;
1792
- break;
1793
- case "ArrowLeft":
1794
- case "ArrowDown":
1795
- u = m.pct - h;
1796
- break;
1797
- case "Home":
1798
- u = In;
1799
- break;
1800
- case "End":
1801
- u = Nt;
1802
- break;
1803
- default:
1804
- return;
1805
- }
1806
- b.preventDefault(), s($r(u));
1807
- },
1808
- [m, s]
1809
- );
1810
- if (!i || !m) return null;
1811
- const T = Ir(i, Hn), I = Ir(i, Zr), B = g("editor.image.widthAnnounce", {
1812
- width: m.pct,
1813
- defaultValue: "{{width}} percent"
1814
- });
1815
- return /* @__PURE__ */ C(Ee, { children: [
1816
- /* @__PURE__ */ t(
1817
- "div",
1818
- {
1819
- className: ts,
1820
- style: {
1821
- "--rte-img-top": `${m.top}px`,
1822
- "--rte-img-start": `${m.start}px`,
1823
- "--rte-img-width": `${m.width}px`,
1824
- "--rte-img-height": `${m.height}px`
1825
- },
1826
- children: es.map((b) => /* @__PURE__ */ t(
1827
- "div",
1828
- {
1829
- role: "slider",
1830
- tabIndex: 0,
1831
- "aria-label": g(b.labelKey, b.labelFallback),
1832
- "aria-orientation": "horizontal",
1833
- "aria-valuemin": In,
1834
- "aria-valuemax": Nt,
1835
- "aria-valuenow": m.pct,
1836
- "aria-valuetext": B,
1837
- className: `${ns} ${b.pos} ${b.cursor}`,
1838
- onPointerDown: v(b),
1839
- onPointerMove: w,
1840
- onPointerUp: k,
1841
- onPointerCancel: k,
1842
- onKeyDown: L
1843
- },
1844
- b.id
1845
- ))
1846
- }
1847
- ),
1848
- /* @__PURE__ */ t(qn, { children: /* @__PURE__ */ t(
1849
- "div",
1850
- {
1851
- role: "group",
1852
- "aria-label": g("editor.image.toolbar", "Image tools"),
1853
- className: `${rs} ${m.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
1854
- style: {
1855
- "--rte-img-bar-top": `${m.barTop}px`,
1856
- "--rte-img-center": `${m.center}px`
1857
- },
1858
- children: [Yi, Ji].map((b, u) => /* @__PURE__ */ C(ft, { children: [
1859
- u > 0 ? /* @__PURE__ */ t("span", { "aria-hidden": "true", className: en }) : null,
1860
- b.map((h) => {
1861
- const z = u === 0 ? T === h.id : I === h.id;
1862
- return /* @__PURE__ */ t(
1863
- j,
1864
- {
1865
- size: "sm",
1866
- intent: "ghost",
1867
- icon: h.icon,
1868
- "aria-pressed": z,
1869
- tooltip: g(h.label[0], h.label[1]),
1870
- onMouseDown: (M) => M.preventDefault(),
1871
- onClick: () => c(h.id)
1872
- },
1873
- h.id
1874
- );
1875
- })
1876
- ] }, u === 0 ? "flow" : "align"))
1877
- }
1878
- ) })
1879
- ] });
1880
- }
1881
- function as({
1882
- templates: o,
1883
- onPick: i,
1884
- onManage: c,
1885
- noteEmpty: s,
1886
- onOpenChange: g,
1887
- trigger: m,
1888
- side: f = "top"
1889
- }) {
1890
- const { t: d } = ne(), v = Oe();
1891
- return /* @__PURE__ */ C(te.Root, { onOpenChange: g, children: [
1892
- /* @__PURE__ */ t(te.Trigger, { asChild: !0, children: m }),
1893
- /* @__PURE__ */ C(te.Content, { side: f, align: "end", sideOffset: 8, children: [
1894
- /* @__PURE__ */ t(te.Label, { children: o.length > 0 ? d("editor.ai.templatesGroup") : d("editor.ai.noTemplates") }),
1895
- o.map((w) => /* @__PURE__ */ t(
1896
- te.Item,
1897
- {
1898
- startIcon: /* @__PURE__ */ t(Sn, {}),
1899
- description: w.description || void 0,
1900
- "aria-disabled": s || void 0,
1901
- "aria-describedby": s ? v : void 0,
1902
- className: "ds:aria-disabled:opacity-50 ds:aria-disabled:cursor-not-allowed",
1903
- onSelect: (k) => {
1904
- if (s) {
1905
- k.preventDefault();
1906
- return;
1907
- }
1908
- i(w);
1909
- },
1910
- children: w.name
1911
- },
1912
- w.id
1913
- )),
1914
- s && o.length > 0 ? /* @__PURE__ */ t(
1915
- "p",
1916
- {
1917
- id: v,
1918
- className: "ds:m-0 ds:px-[var(--spacing-sm)] ds:py-[var(--spacing-2xs)] ds:text-[length:var(--font-size-xs)] ds:text-[color:var(--muted-foreground)]",
1919
- children: d("editor.ai.templatesNoteEmpty")
1920
- }
1921
- ) : null,
1922
- c && o.length === 0 ? /* @__PURE__ */ t(
1923
- te.Item,
1924
- {
1925
- startIcon: /* @__PURE__ */ t(ua, {}),
1926
- onSelect: () => c("create"),
1927
- children: d("editor.ai.createFirstTemplate")
1928
- }
1929
- ) : null,
1930
- c && o.length > 0 ? /* @__PURE__ */ C(Ee, { children: [
1931
- /* @__PURE__ */ t(te.Separator, {}),
1932
- /* @__PURE__ */ t(
1933
- te.Item,
1934
- {
1935
- startIcon: /* @__PURE__ */ t(ma, {}),
1936
- onSelect: () => c("list"),
1937
- children: d("editor.ai.manageTemplates")
1938
- }
1939
- )
1940
- ] }) : null
1941
- ] })
1942
- ] });
1943
- }
1944
- const is = [
1945
- "ds:absolute ds:z-20 ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]",
1946
- "ds:[inset-block-start:var(--rte-sel-top)] ds:[inset-inline-start:var(--rte-sel-start)]",
1947
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
1948
- "ds:bg-[var(--popover)] ds:p-[var(--spacing-2xs)] ds:shadow-[var(--shadow-lg)]",
1949
- Ur
1950
- ].join(" "), ss = ["bold", "italic", "underline", "strike"];
1951
- function ls({
1952
- active: o,
1953
- run: i,
1954
- areaRef: c,
1955
- getEditorRoot: s,
1956
- suppressed: g = !1,
1957
- holdOpen: m = !1,
1958
- children: f
1959
- }) {
1960
- const { t: d } = ne(), v = A(null), [w, k] = E(null), L = A(m);
1961
- return _(() => {
1962
- L.current = m;
1963
- }, [m]), _(() => {
1964
- if (g || typeof window > "u") {
1965
- k(null);
1966
- return;
1967
- }
1968
- let T = !1, I = 0, B = !1, b = !1;
1969
- const u = () => {
1970
- var Y;
1971
- if (L.current || T) return;
1972
- if (b) {
1973
- k(null);
1974
- return;
1975
- }
1976
- const $ = c.current, P = s(), N = window.getSelection();
1977
- if (!$ || !P || !N || N.rangeCount === 0 || N.isCollapsed || !$.contains(document.activeElement)) {
1978
- k(null);
1979
- return;
1980
- }
1981
- const X = N.getRangeAt(0);
1982
- if (!P.contains(X.commonAncestorContainer)) {
1983
- k(null);
1984
- return;
1985
- }
1986
- if (!X.toString().trim()) {
1987
- k(null);
1988
- return;
1989
- }
1990
- const F = $.getBoundingClientRect(), Z = X.getBoundingClientRect(), pe = getComputedStyle($).direction === "rtl", Q = Z.top - F.top - 48, Me = Q >= 0 ? Q : Z.bottom - F.top + 8, G = ((Y = v.current) == null ? void 0 : Y.offsetWidth) ?? 0, re = pe ? F.right - Z.right + Z.width / 2 : Z.left - F.left + Z.width / 2, R = G / 2, K = Math.min(
1991
- Math.max(re, R),
1992
- Math.max(R, F.width - R)
1993
- );
1994
- k({ top: Me, start: K, rtl: pe }), G === 0 && !B && (B = !0, I = requestAnimationFrame(u));
1995
- }, h = () => {
1996
- cancelAnimationFrame(I), I = requestAnimationFrame(u);
1997
- }, z = ($) => {
1998
- const P = s();
1999
- P && $.target instanceof Node && P.contains($.target) && (T = !0, k(null));
2000
- }, M = () => {
2001
- T && (T = !1, h());
2002
- }, q = ($) => {
2003
- if ($.key !== "Escape") return;
2004
- const P = c.current;
2005
- !P || !P.contains(document.activeElement) || (b = !0, k(null));
2006
- }, V = () => {
2007
- b = !1, h();
2008
- };
2009
- return document.addEventListener("selectionchange", V), document.addEventListener("focusin", h), document.addEventListener("keydown", q, !0), document.addEventListener("pointerdown", z, !0), document.addEventListener("pointerup", M, !0), document.addEventListener("pointercancel", M, !0), window.addEventListener("scroll", h, !0), window.addEventListener("resize", h), h(), () => {
2010
- cancelAnimationFrame(I), document.removeEventListener("selectionchange", V), document.removeEventListener("focusin", h), document.removeEventListener("keydown", q, !0), document.removeEventListener("pointerdown", z, !0), document.removeEventListener("pointerup", M, !0), document.removeEventListener("pointercancel", M, !0), window.removeEventListener("scroll", h, !0), window.removeEventListener("resize", h);
2011
- };
2012
- }, [g, c, s]), g || !w ? null : /* @__PURE__ */ t(qn, { children: /* @__PURE__ */ C(
2013
- "div",
2014
- {
2015
- ref: v,
2016
- role: "group",
2017
- "aria-label": d("editor.ai.selectionTools"),
2018
- "data-component-part": "selection-toolbar",
2019
- className: `${is} ${w.rtl ? "ds:translate-x-1/2" : "ds:-translate-x-1/2"}`,
2020
- style: {
2021
- "--rte-sel-top": `${w.top}px`,
2022
- "--rte-sel-start": `${w.start}px`
2023
- },
2024
- children: [
2025
- ss.map((T) => {
2026
- const I = Wr[T];
2027
- return /* @__PURE__ */ t(
2028
- j,
2029
- {
2030
- size: "sm",
2031
- intent: "ghost",
2032
- icon: I.icon,
2033
- tooltip: d(I.label[0], I.label[1]),
2034
- "aria-pressed": I.toggle ? o.has(I.toggle) : void 0,
2035
- onMouseDown: (B) => B.preventDefault(),
2036
- onClick: () => i(...I.command)
2037
- },
2038
- T
2039
- );
2040
- }),
2041
- f ? /* @__PURE__ */ C(Ee, { children: [
2042
- /* @__PURE__ */ t("span", { "aria-hidden": "true", className: en }),
2043
- f
2044
- ] }) : null
2045
- ]
2046
- }
2047
- ) });
2048
- }
2049
- function cs({
2050
- run: o,
2051
- active: i,
2052
- preset: c,
2053
- insertHtml: s,
2054
- insertTable: g,
2055
- saveSelection: m,
2056
- restoreSelection: f,
2057
- getSelectedText: d,
2058
- uploadImage: v,
2059
- enableColor: w = !1,
2060
- enableImage: k = !1,
2061
- enableTable: L = !1,
2062
- showExtensions: T = !1,
2063
- extensionControl: I,
2064
- variables: B,
2065
- recentVariableTokens: b,
2066
- insertVariable: u
2067
- }) {
2068
- const { t: h } = ne(), z = (re) => re.preventDefault(), M = (re) => Hi[c].includes(re), q = (re) => {
2069
- if (!M(re)) return null;
2070
- const R = Wr[re];
2071
- return /* @__PURE__ */ t(
2072
- j,
2073
- {
2074
- size: "sm",
2075
- intent: "ghost",
2076
- icon: R.icon,
2077
- "aria-label": h(R.label[0], R.label[1]),
2078
- "aria-pressed": R.toggle ? i.has(R.toggle) : void 0,
2079
- onMouseDown: z,
2080
- onClick: () => o(...R.command)
2081
- },
2082
- R.id
2083
- );
2084
- }, V = () => /* @__PURE__ */ t("span", { "aria-hidden": "true", className: en }), $ = M("format"), P = [q("undo"), q("redo")].filter(Boolean), N = [
2085
- q("bold"),
2086
- q("italic"),
2087
- q("underline"),
2088
- q("strike"),
2089
- w ? /* @__PURE__ */ t(
2090
- Pi,
2091
- {
2092
- run: o,
2093
- saveSelection: m,
2094
- restoreSelection: f
2095
- },
2096
- "colour"
2097
- ) : null,
2098
- w ? /* @__PURE__ */ t(
2099
- Fi,
2100
- {
2101
- run: o,
2102
- saveSelection: m,
2103
- restoreSelection: f
2104
- },
2105
- "highlight"
2106
- ) : null
2107
- ].filter(Boolean), X = P.length > 0 || $ || N.length > 0, F = [q("ul"), q("ol")].filter(Boolean), Z = [
2108
- M("link") ? /* @__PURE__ */ t(
2109
- qi,
2110
- {
2111
- insertHtml: s,
2112
- saveSelection: m,
2113
- restoreSelection: f,
2114
- getSelectedText: d
2115
- },
2116
- "link"
2117
- ) : null,
2118
- k ? /* @__PURE__ */ t(
2119
- Bi,
2120
- {
2121
- insertHtml: s,
2122
- saveSelection: m,
2123
- restoreSelection: f,
2124
- uploadImage: v
2125
- },
2126
- "image"
2127
- ) : null,
2128
- L ? /* @__PURE__ */ t(
2129
- Gi,
2130
- {
2131
- run: o,
2132
- insertTable: g,
2133
- active: i
2134
- },
2135
- "table"
2136
- ) : null,
2137
- B && B.length > 0 && u ? /* @__PURE__ */ t(
2138
- Di,
2139
- {
2140
- variables: B,
2141
- recentVariableTokens: b,
2142
- insertVariable: u,
2143
- saveSelection: m
2144
- },
2145
- "variables"
2146
- ) : null
2147
- ].filter(Boolean), pe = I ? [/* @__PURE__ */ t(ft, { children: I }, "extensions")] : T ? [
2148
- /* @__PURE__ */ t(
2149
- j,
2150
- {
2151
- size: "sm",
2152
- intent: "ghost",
2153
- icon: /* @__PURE__ */ t(Ln, {}),
2154
- "aria-label": h("editor.extensions", "Editor extensions"),
2155
- disabled: !0,
2156
- onMouseDown: z
2157
- },
2158
- "extensions"
2159
- )
2160
- ] : [], Q = [F, Z, pe].filter(
2161
- (re) => re.length > 0
2162
- ), Me = Q.length > 0, G = (re) => Q.map((R, K) => /* @__PURE__ */ C(ft, { children: [
2163
- K > 0 || re ? /* @__PURE__ */ t(V, {}) : null,
2164
- R
2165
- ] }, K));
2166
- return (
2167
- // Outer element is the query container + visual chrome; the flex row is an
2168
- // inner child so `container-type` never lands on the flex parent (which
2169
- // would blockify the inline controls).
2170
- /* @__PURE__ */ t("div", { className: Ii(), "data-component": "editor-toolbar", children: /* @__PURE__ */ C(
2171
- "div",
2172
- {
2173
- role: "group",
2174
- "aria-label": h("editor.toolbarLabel"),
2175
- className: $i,
2176
- children: [
2177
- P,
2178
- P.length > 0 && ($ || N.length > 0) ? /* @__PURE__ */ t(V, {}) : null,
2179
- $ ? /* @__PURE__ */ t(Oi, { run: o, active: i, onTriggerDown: z }) : null,
2180
- $ && N.length > 0 ? /* @__PURE__ */ t(V, {}) : null,
2181
- N,
2182
- Me ? /* @__PURE__ */ C(Ee, { children: [
2183
- /* @__PURE__ */ t("div", { className: "ds:hidden ds:@[384px]/toolbar:contents", children: G(X) }),
2184
- /* @__PURE__ */ C("div", { className: "ds:contents ds:@[384px]/toolbar:hidden", children: [
2185
- X ? /* @__PURE__ */ t(V, {}) : null,
2186
- /* @__PURE__ */ C(ee, { children: [
2187
- /* @__PURE__ */ t(ee.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
2188
- j,
2189
- {
2190
- size: "sm",
2191
- intent: "ghost",
2192
- icon: /* @__PURE__ */ t(sa, {}),
2193
- "aria-label": h("editor.more", "More options"),
2194
- onMouseDown: z
2195
- }
2196
- ) }),
2197
- /* @__PURE__ */ t(ee.Content, { side: "bottom", align: "end", children: /* @__PURE__ */ t("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: G(!1) }) })
2198
- ] })
2199
- ] })
2200
- ] }) : null
2201
- ]
2202
- }
2203
- ) })
2204
- );
2205
- }
2206
- function xe(o) {
2207
- return Zo(o, "rich-text");
2208
- }
2209
- function Zt(o = "") {
2210
- const i = String(o).trim();
2211
- if (i === "" || i === "<p><br></p>" || i === "<p>&nbsp;</p>")
2212
- return "";
2213
- const c = i.replace(/<br\s*\/?>/gi, "").replace(/&nbsp;/gi, "").replace(/<[^>]+>/g, "").trim();
2214
- return c === "" && /<img\b[^>]*>/i.test(i) ? i : c === "" ? "" : i;
2215
- }
2216
- function Dr(o) {
2217
- return o.replace(
2218
- /<img(?![^>]*\sloading=)([^>]*)>/gi,
2219
- '<img loading="lazy"$1>'
2220
- );
2221
- }
2222
- const Mn = /^[A-Za-z0-9_]+$/, Qr = /\[\[([A-Za-z0-9_]+)\]\]/g, $n = "rte-variable-invalid", ds = new RegExp(
2223
- `\\s*\\b${$n}\\b`,
2224
- "g"
2225
- );
2226
- function Or(o) {
2227
- return o.includes('data-redactor-type="variable"') ? o.replace(
2228
- /<span\b[^>]*data-redactor-type="variable"[^>]*>/g,
2229
- (i) => i.replace(/\s(?:data-label|title)="[^"]*"/g, "").replace(ds, "").replace(/\sclass=""/g, "")
2230
- ) : o;
2231
- }
2232
- function us(o) {
2233
- const i = o.replace(/<[^>]*>/g, " ");
2234
- return Array.from(i.matchAll(Qr), (c) => c[1]);
2235
- }
2236
- function qr(o) {
2237
- return typeof o == "object" && o !== null && "name" in o && o.name === "AiCreditsExhaustedError";
2238
- }
2239
- function ms(o) {
2240
- return typeof o == "object" && o !== null && "name" in o && o.name === "AbortError";
2241
- }
2242
- function fs(o) {
2243
- const i = document.createElement("template");
2244
- return i.content.appendChild(o), i.innerHTML;
2245
- }
2246
- function Br(o) {
2247
- const i = document.createElement("template");
2248
- return i.innerHTML = o, (i.content.textContent ?? "").replace(/\s+/g, " ").trim();
2249
- }
2250
- function Pr(o) {
2251
- return o.replace(/<[^>]*>/g, "").replace(/&nbsp;/gi, "").replace(/[\s\u200B\uFEFF]+/g, "");
2252
- }
2253
- function gs(o) {
2254
- const i = window.getSelection();
2255
- if (!i || i.rangeCount === 0) return null;
2256
- const c = i.getRangeAt(0);
2257
- if (!o.contains(c.startContainer)) return null;
2258
- const s = document.createRange();
2259
- return s.selectNodeContents(o), s.setEnd(c.startContainer, c.startOffset), s.toString().length;
2260
- }
2261
- function hs(o, i) {
2262
- var m;
2263
- const c = window.getSelection();
2264
- if (!c) return;
2265
- const s = document.createTreeWalker(o, NodeFilter.SHOW_TEXT);
2266
- let g = 0;
2267
- for (let f = s.nextNode(); f; f = s.nextNode()) {
2268
- const d = f;
2269
- if (g + d.data.length >= i) {
2270
- const v = document.createRange(), w = (m = d.parentElement) == null ? void 0 : m.closest(
2271
- '[data-redactor-type="variable"]'
2272
- );
2273
- w ? v.setStartAfter(w) : v.setStart(d, i - g), v.collapse(!0), c.removeAllRanges(), c.addRange(v);
2274
- return;
2275
- }
2276
- g += d.data.length;
2277
- }
2278
- }
2279
- function Fr(o) {
2280
- return `<span data-redactor-type="variable">[[${o}]]</span>`;
2281
- }
2282
- function ut(o, i) {
2283
- var f;
2284
- if (i.size === 0 || !o.includes("[[") || typeof DOMParser > "u")
2285
- return o;
2286
- const c = new DOMParser().parseFromString(
2287
- `<body>${o}</body>`,
2288
- "text/html"
2289
- ), s = c.createTreeWalker(c.body, NodeFilter.SHOW_TEXT), g = [];
2290
- for (let d = s.nextNode(); d; d = s.nextNode()) {
2291
- const v = d;
2292
- (f = v.parentElement) != null && f.closest('[data-redactor-type="variable"]') || v.data.includes("[[") && g.push(v);
2293
- }
2294
- let m = !1;
2295
- for (const d of g) {
2296
- const v = c.createDocumentFragment();
2297
- let w = 0;
2298
- for (const k of d.data.matchAll(Qr)) {
2299
- const L = i.get(k[1].toLowerCase());
2300
- if (!L || k.index === void 0) continue;
2301
- v.append(d.data.slice(w, k.index));
2302
- const T = c.createElement("span");
2303
- T.setAttribute("data-redactor-type", "variable"), T.textContent = `[[${L}]]`, v.append(T), w = k.index + k[0].length;
2304
- }
2305
- w !== 0 && (v.append(d.data.slice(w)), d.replaceWith(v), m = !0);
2306
- }
2307
- return m ? c.body.innerHTML : o;
2308
- }
2309
- function ps(o) {
2310
- if (!o || typeof o != "object") return;
2311
- const i = o, c = (s) => {
2312
- if (s && typeof s == "object" && "url" in s) {
2313
- const g = s.url;
2314
- return typeof g == "string" ? g : void 0;
2315
- }
2316
- };
2317
- return typeof i.url == "string" ? i.url : c(i.file) ?? c(i.data) ?? Object.values(i).map(c).find(Boolean);
2318
- }
2319
- function bs(o) {
2320
- if (o) return o;
2321
- if (typeof window > "u") return null;
2322
- const i = window;
2323
- return i.$R ?? i.Redactor ?? null;
2324
- }
2325
- const vs = {
2326
- bold: ["module.inline.format", { tag: "b" }],
2327
- italic: ["module.inline.format", { tag: "i" }],
2328
- strikethrough: ["module.inline.format", { tag: "del" }],
2329
- bulletedList: ["module.list.toggle", "ul"],
2330
- numberedList: ["module.list.toggle", "ol"],
2331
- heading: ["module.block.format", { tag: "h2" }],
2332
- quote: ["module.block.format", { tag: "blockquote" }],
2333
- paragraph: ["module.block.format", { tag: "p" }]
2334
- }, ys = {
2335
- zh: "zh_cn",
2336
- pt: "pt_br"
2337
- };
2338
- function ws(o) {
2339
- const i = o.split("-")[0];
2340
- return ys[i] ?? i ?? "en";
2341
- }
2342
- const ks = Dn(
2343
- "redactor-theme-alfadocs ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]"
2344
- ), xs = [
2345
- "ds:absolute ds:z-30",
2346
- "ds:[inset-inline-start:var(--rte-typeahead-x)] ds:[inset-block-start:var(--rte-typeahead-y)]"
2347
- ].join(" "), Cs = Dn(
2348
- [
2349
- "ds:block ds:[inline-size:100%]",
2350
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
2351
- "ds:bg-[var(--background)] ds:text-[var(--foreground)]",
2352
- "ds:shadow-[var(--shadow-md)]",
2353
- "ds:font-[family-name:var(--font-sans)] ds:text-[length:var(--font-size-base)]",
2354
- "ds:p-[var(--spacing-md)] ds:[min-block-size:var(--rich-text-editor-min-block-size)]",
2355
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
2356
- "ds:focus-visible:outline-solid",
2357
- "ds:focus-visible:outline-[var(--ring)]",
2358
- "ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
2359
- "ds:forced-colors:focus-visible:outline-[CanvasText]"
2360
- ].join(" ")
2361
- ), Yr = [
2362
- "ds:inline-flex ds:items-center ds:justify-center",
2363
- "ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]",
2364
- "ds:text-[color:var(--primary-foreground)]",
2365
- "ds:transition-colors",
2366
- "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
2367
- "ds:focus-visible:outline-solid",
2368
- "ds:focus-visible:outline-[var(--primary-foreground)]",
2369
- "ds:focus-visible:[outline-offset:calc(var(--focus-ring-width)*-1)]"
2370
- ].join(" "), As = `${Yr} ds:hover:bg-[color-mix(in_srgb,var(--primary-foreground)_15%,transparent)]`, Ns = `${Yr} ds:bg-[var(--destructive)] ds:hover:bg-[color-mix(in_srgb,var(--destructive)_88%,var(--primary-foreground))]`;
2371
- function Es({
2372
- notice: o,
2373
- children: i
2374
- }) {
2375
- const [c, s] = E(!1);
2376
- return /* @__PURE__ */ C(_n, { open: c, onOpenChange: s, children: [
2377
- /* @__PURE__ */ t(
2378
- Ts,
2379
- {
2380
- onOpen: () => s(!0),
2381
- onPress: () => s(!1),
2382
- children: i
2383
- }
2384
- ),
2385
- /* @__PURE__ */ t(
2386
- _n.Content,
2387
- {
2388
- side: "bottom",
2389
- align: "start",
2390
- size: "sm",
2391
- collisionPadding: 8,
2392
- children: /* @__PURE__ */ t(ha, { ...o })
2393
- }
2394
- )
2395
- ] });
2396
- }
2397
- function Ts({
2398
- onOpen: o,
2399
- onPress: i,
2400
- children: c
2401
- }) {
2402
- const { cancelClose: s, closeWithDelay: g } = ga(), m = A(null), f = y(() => {
2403
- m.current && (clearTimeout(m.current), m.current = null);
2404
- }, []);
2405
- _(() => f, [f]);
2406
- const d = y(() => {
2407
- f(), s(), m.current = setTimeout(o, 300);
2408
- }, [f, s, o]), v = y(() => {
2409
- f(), g();
2410
- }, [f, g]), w = A(!1), k = y(() => {
2411
- w.current = !0, f(), i();
2412
- }, [f, i]);
2413
- _(() => {
2414
- const T = () => {
2415
- w.current = !1;
2416
- };
2417
- return document.addEventListener("keydown", T), () => document.removeEventListener("keydown", T);
2418
- }, []);
2419
- const L = y(() => {
2420
- if (w.current) {
2421
- w.current = !1;
2422
- return;
2423
- }
2424
- f(), s(), o();
2425
- }, [f, s, o]);
2426
- return (
2427
- // `ds:inline-flex` — NOT `ds:contents` — so this span has a real box
2428
- // that hugs the button and Floating UI has a real rect to measure.
2429
- // `display: contents` generates no box of its own; inside the pill's
2430
- // flex/absolute layout that collapsed to a zero-size rect at the
2431
- // editor's origin, so the card rendered top-left instead of at the
2432
- // trigger (caught in review on :6007).
2433
- /* @__PURE__ */ t(_n.Anchor, { asChild: !0, children: /* @__PURE__ */ t(
2434
- "span",
2435
- {
2436
- className: "ds:inline-flex",
2437
- onMouseEnter: d,
2438
- onMouseLeave: v,
2439
- onPointerDown: k,
2440
- onFocusCapture: L,
2441
- onBlurCapture: v,
2442
- children: c
2443
- }
2444
- ) })
2445
- );
2446
- }
2447
- function mt(o, i) {
2448
- return i ? /* @__PURE__ */ t(Es, { notice: i, children: o }) : o;
2449
- }
2450
- function Qt(o, i) {
2451
- return i ? { "aria-label": o } : { tooltip: o };
2452
- }
2453
- const Jr = ["kit", "marketplace"];
2454
- function Ms({
2455
- groupedExtensions: o,
2456
- showExtensionGroups: i,
2457
- extensionPending: c,
2458
- extensionSession: s,
2459
- extensionError: g,
2460
- openExtension: m,
2461
- closeExtension: f,
2462
- saveSelection: d,
2463
- closeSignal: v,
2464
- restoreFocusOnCloseRef: w
2465
- }) {
2466
- const { t: k } = ne(), [L, T] = E(!1), I = A(null), B = A(!1);
2467
- return _(() => {
2468
- T(!1);
2469
- }, [v]), _(() => {
2470
- B.current && !s && (B.current = !1, w.current && window.requestAnimationFrame(() => {
2471
- var b;
2472
- return (b = I.current) == null ? void 0 : b.focus();
2473
- }));
2474
- }, [s, w]), /* @__PURE__ */ C(
2475
- te.Root,
2476
- {
2477
- open: L,
2478
- onOpenChange: (b) => {
2479
- b ? (d(), T(!0)) : (T(!1), c && f());
2480
- },
2481
- children: [
2482
- /* @__PURE__ */ t(te.Trigger, { asChild: !0, children: /* @__PURE__ */ t(
2483
- j,
2484
- {
2485
- ref: I,
2486
- "data-component-part": "extensions-trigger",
2487
- size: "sm",
2488
- intent: "ghost",
2489
- icon: /* @__PURE__ */ t(Ln, {}),
2490
- "aria-label": k("editor.extensions"),
2491
- onPointerDown: () => d()
2492
- }
2493
- ) }),
2494
- /* @__PURE__ */ t(
2495
- te.Content,
2496
- {
2497
- align: "end",
2498
- onCloseAutoFocus: (b) => {
2499
- (s == null ? void 0 : s.extension.kind) === "panel" && !g && b.preventDefault();
2500
- },
2501
- children: o.map(
2502
- (b, u) => b.length > 0 ? /* @__PURE__ */ C(ft, { children: [
2503
- i ? /* @__PURE__ */ t(te.Label, { children: k(
2504
- u === 0 ? "editor.extensionsKit" : "editor.extensionsMarketplace"
2505
- ) }) : null,
2506
- b.map((h) => {
2507
- var z;
2508
- return /* @__PURE__ */ C(
2509
- te.Item,
2510
- {
2511
- "data-extension-id": h.id,
2512
- disabled: c && (s == null ? void 0 : s.extension.id) !== h.id,
2513
- "aria-busy": c && (s == null ? void 0 : s.extension.id) === h.id || void 0,
2514
- onSelect: (M) => {
2515
- h.kind === "action" && M.preventDefault(), B.current = !0, m(h);
2516
- },
2517
- children: [
2518
- c && (s == null ? void 0 : s.extension.id) === h.id ? /* @__PURE__ */ t(On, { size: "sm" }) : h.icon ?? /* @__PURE__ */ t(Ln, {}),
2519
- /* @__PURE__ */ C("span", { className: "ds:flex ds:min-w-0 ds:flex-col ds:text-start", children: [
2520
- /* @__PURE__ */ t("span", { children: Vr(k, h.label) }),
2521
- h.description ? /* @__PURE__ */ t("span", { className: "type-meta ds:text-muted-foreground", children: h.description }) : null,
2522
- ((z = h.source) == null ? void 0 : z.kind) === "marketplace" ? /* @__PURE__ */ C("span", { className: "type-meta ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-muted-foreground", children: [
2523
- h.source.appIconUrl ? /* @__PURE__ */ t(
2524
- "img",
2525
- {
2526
- src: h.source.appIconUrl,
2527
- alt: "",
2528
- className: "ds:size-[var(--spacing-md)]"
2529
- }
2530
- ) : null,
2531
- h.source.appName
2532
- ] }) : null
2533
- ] })
2534
- ]
2535
- },
2536
- h.id
2537
- );
2538
- })
2539
- ] }, Jr[u]) : null
2540
- )
2541
- }
2542
- )
2543
- ]
2544
- }
2545
- );
2546
- }
2547
- const Rs = Wo(
2548
- ({
2549
- id: o,
2550
- defaultValue: i,
2551
- value: c,
2552
- onChange: s,
2553
- toolbar: g = "standard",
2554
- placeholder: m,
2555
- readOnly: f = !1,
2556
- ariaLabel: d,
2557
- minHeight: v,
2558
- showExtensions: w,
2559
- extensions: k,
2560
- extensionContext: L,
2561
- onExtensionRun: T,
2562
- className: I,
2563
- redactor: B,
2564
- options: b,
2565
- plugins: u,
2566
- lang: h,
2567
- imageUploadUrl: z,
2568
- onUploadImage: M,
2569
- onKeyDown: q,
2570
- onRequestAiDraft: V,
2571
- aiDraftFormat: $ = "html",
2572
- aiPrivacyNotice: P,
2573
- aiConsent: N,
2574
- aiConsentHeadingLevel: X,
2575
- onDictate: F,
2576
- onProofread: Z,
2577
- onAutoFormat: pe,
2578
- aiTemplates: Q,
2579
- onAiApplied: Me,
2580
- aiSparkle: G = !0,
2581
- selectionToolbar: re,
2582
- variables: R,
2583
- recentVariableTokens: K,
2584
- onVariableInserted: Y,
2585
- validateVariable: se,
2586
- onVariableValidityChange: tn,
2587
- renderHelpMeWrite: qe,
2588
- onAiCreditsExhausted: nn,
2589
- aiCreditsNotice: Ie
2590
- }, eo) => {
2591
- var Er, Tr;
2592
- const { t: O, i18n: to } = ne(), Pn = Oe(), tt = Je(
2593
- () => `rte-${Pn.replace(/[^a-zA-Z0-9-_]/g, "")}`,
2594
- [Pn]
2595
- ), D = `#${tt}`, J = A(null), oe = A(null), rn = A(!1), Et = A(f), W = A(null), gt = A(null), [ue, Fn] = E(!1), [ht, $e] = E(!1), [be, jn] = E(null), [on, Gn] = E(!1), [an, sn] = E(!1), pt = A(null), Tt = A(T);
2596
- Tt.current = T;
2597
- const Be = A(null), [no, ro] = E(0), Kn = A(!0), ln = y((e = !0) => {
2598
- Kn.current = e, ro((n) => n + 1);
2599
- }, []), cn = y(() => {
2600
- var e, n;
2601
- (e = pt.current) == null || e.abort(), pt.current = null, (n = Be.current) == null || n.call(Be, { status: "aborted" }), jn(null), sn(!1), Gn(!1);
2602
- }, []), Re = y(
2603
- (e = !0) => {
2604
- cn(), ln(e);
2605
- },
2606
- [cn, ln]
2607
- );
2608
- _(
2609
- () => () => {
2610
- var e, n;
2611
- (e = pt.current) == null || e.abort(), (n = Be.current) == null || n.call(Be, { status: "aborted" });
2612
- },
2613
- []
2614
- );
2615
- const [oo, ao] = E(""), [io, so] = E(
2616
- "document"
2617
- ), [lo, dn] = E(!1), Pe = A(nn), un = A(qe);
2618
- _(() => {
2619
- Pe.current = nn, un.current = qe;
2620
- }, [nn, qe]);
2621
- const Mt = A(null), me = Je(
2622
- () => new Map(
2623
- (R ?? []).map((e) => e.token).filter((e) => Mn.test(e)).map((e) => [e.toLowerCase(), e])
2624
- ),
2625
- [R]
2626
- ), Vn = Je(
2627
- () => new Map(
2628
- (R ?? []).map(
2629
- (e) => [e.token.toLowerCase(), e.label]
2630
- )
2631
- ),
2632
- [R]
2633
- ), nt = A(me);
2634
- _(() => {
2635
- nt.current = me;
2636
- }, [me]);
2637
- const Wn = Je(
2638
- () => (R ?? []).filter((e) => Mn.test(e.token)),
2639
- [R]
2640
- ), mn = A(se);
2641
- _(() => {
2642
- mn.current = se;
2643
- }, [se]);
2644
- const fn = se !== void 0, gn = y(
2645
- (e) => fn && mn.current ? mn.current(e) : me.has(e.toLowerCase()),
2646
- [fn, me]
2647
- ), rt = me.size > 0 || fn, [ot, Xn] = E([]), Fe = A(tn);
2648
- _(() => {
2649
- Fe.current = tn;
2650
- }, [tn]);
2651
- const ze = A(() => {
2652
- }), [hn, co] = E(
2653
- () => /* @__PURE__ */ new Set()
2654
- ), Rt = A(null), [uo, mo] = E(
2655
- null
2656
- ), zt = y((e) => {
2657
- Rt.current = e, mo(e);
2658
- }, []), bt = A(null), _t = A(null), fe = A(s), St = A(q);
2659
- _(() => {
2660
- fe.current = s, St.current = q;
2661
- }, [s, q]);
2662
- const fo = A(
2663
- (() => {
2664
- const e = c ?? i ?? "";
2665
- return e ? xe(e) : "";
2666
- })()
2667
- ), le = y(() => {
2668
- var n;
2669
- const e = oe.current;
2670
- if (e)
2671
- try {
2672
- const r = e(D, "source.getCode");
2673
- if (typeof r == "string") return Or(r);
2674
- } catch {
2675
- }
2676
- return ((n = J.current) == null ? void 0 : n.value) ?? "";
2677
- }, [D]);
2678
- _(() => {
2679
- ze.current = () => {
2680
- var r;
2681
- if (!rt) {
2682
- Xn((a) => a.length ? [] : a);
2683
- return;
2684
- }
2685
- const e = (r = W.current) == null ? void 0 : r.querySelector(".redactor-in");
2686
- e == null || e.querySelectorAll('[data-redactor-type="variable"]').forEach((a) => {
2687
- const l = /^\[\[([A-Za-z0-9_]+)\]\]$/.exec(
2688
- a.textContent ?? ""
2689
- ), p = !l || !gn(l[1]);
2690
- a.classList.contains($n) !== p && a.classList.toggle($n, p);
2691
- const x = l ? Vn.get(l[1].toLowerCase()) ?? l[1] : a.textContent ?? "";
2692
- a.getAttribute("data-label") !== x && a.setAttribute("data-label", x);
2693
- const S = a.textContent ?? "";
2694
- a.getAttribute("title") !== S && a.setAttribute("title", S);
2695
- });
2696
- const n = Array.from(
2697
- new Set(
2698
- us(le()).filter(
2699
- (a) => !gn(a)
2700
- )
2701
- )
2702
- );
2703
- Xn(
2704
- (a) => a.length === n.length && a.every((l, p) => l === n[p]) ? a : n
2705
- );
2706
- }, ze.current();
2707
- }, [rt, gn, Vn, le]), _(() => {
2708
- var r;
2709
- const n = ((r = W.current) == null ? void 0 : r.querySelector(".redactor-in")) ?? J.current;
2710
- n && (ot.length > 0 ? (n.setAttribute("aria-invalid", "true"), n.setAttribute("aria-describedby", `${tt}-variables-error`)) : (n.removeAttribute("aria-invalid"), n.removeAttribute("aria-describedby")));
2711
- }, [ot, tt, ue]);
2712
- const pn = A(!1);
2713
- _(() => {
2714
- var e, n;
2715
- rt ? (pn.current = !0, (e = Fe.current) == null || e.call(Fe, ot)) : pn.current && (pn.current = !1, (n = Fe.current) == null || n.call(Fe, []));
2716
- }, [ot, rt]), _(() => {
2717
- se && ze.current();
2718
- }, [se]);
2719
- const ce = y(
2720
- (e, ...n) => {
2721
- const r = oe.current;
2722
- if (!r) return !1;
2723
- const a = Et.current;
2724
- if (a)
2725
- try {
2726
- r(D, "disableReadOnly");
2727
- } catch {
2728
- }
2729
- try {
2730
- return r(D, e, ...n), !0;
2731
- } catch {
2732
- return !1;
2733
- } finally {
2734
- if (a)
2735
- try {
2736
- r(D, "enableReadOnly");
2737
- } catch {
2738
- }
2739
- }
2740
- },
2741
- [D]
2742
- ), de = y(
2743
- (e, n) => {
2744
- var ge;
2745
- const r = (n == null ? void 0 : n.asHtml) ?? !0, a = r ? xe(e) : e;
2746
- if (ce(r ? "insertion.insertHtml" : "insertion.insertText", a)) return;
2747
- const p = J.current;
2748
- if (!p) return;
2749
- const x = p.selectionStart ?? p.value.length, S = p.selectionEnd ?? p.value.length;
2750
- p.value = p.value.slice(0, x) + a + p.value.slice(S);
2751
- const U = x + a.length;
2752
- try {
2753
- p.setSelectionRange(U, U);
2754
- } catch {
2755
- }
2756
- (ge = fe.current) == null || ge.call(fe, { html: xe(p.value), markdown: "" });
2757
- },
2758
- [ce]
2759
- ), ve = A(null), ye = y(() => {
2760
- var a;
2761
- const e = (a = W.current) == null ? void 0 : a.querySelector(".redactor-in"), n = typeof window < "u" ? window.getSelection() : null, r = /* @__PURE__ */ new Set();
2762
- if (e && n && n.anchorNode && e.contains(n.anchorNode) && typeof document.queryCommandState == "function") {
2763
- n.rangeCount > 0 && (ve.current = n.getRangeAt(0).cloneRange());
2764
- try {
2765
- document.queryCommandState("bold") && r.add("bold"), document.queryCommandState("italic") && r.add("italic"), document.queryCommandState("underline") && r.add("underline"), document.queryCommandState("strikeThrough") && r.add("strike"), document.queryCommandState("insertUnorderedList") && r.add("ul"), document.queryCommandState("insertOrderedList") && r.add("ol");
2766
- const l = String(
2767
- document.queryCommandValue("formatBlock") || ""
2768
- ).toLowerCase();
2769
- /^h[1-6]$/.test(l) ? (r.add("heading"), r.add(l)) : l === "blockquote" ? r.add("quote") : r.add("paragraph");
2770
- const p = n.anchorNode.nodeType === Node.TEXT_NODE ? n.anchorNode.parentElement : n.anchorNode;
2771
- p && e.contains(p) && p.closest("table") && r.add("table");
2772
- } catch {
2773
- }
2774
- }
2775
- co(
2776
- (l) => l.size === r.size && [...r].every((p) => l.has(p)) ? l : r
2777
- );
2778
- }, []), je = y(
2779
- (e, ...n) => {
2780
- ce(e, ...n), typeof window < "u" ? window.requestAnimationFrame(() => ye()) : ye();
2781
- },
2782
- [ce, ye]
2783
- );
2784
- _(() => {
2785
- const e = W.current;
2786
- if (!e) return;
2787
- const n = {
2788
- b: ["module.inline.format", { tag: "b" }],
2789
- i: ["module.inline.format", { tag: "i" }],
2790
- u: ["module.inline.format", { tag: "u" }]
2791
- }, r = (a) => {
2792
- if (!(a.metaKey || a.ctrlKey) || a.altKey || a.shiftKey || a.isComposing) return;
2793
- const l = n[a.key.toLowerCase()];
2794
- if (!l) return;
2795
- const p = e.querySelector(".redactor-in");
2796
- !p || !(a.target instanceof Node) || !p.contains(a.target) || Et.current || (a.preventDefault(), a.stopImmediatePropagation(), je(...l));
2797
- };
2798
- return e.addEventListener("keydown", r, !0), () => e.removeEventListener("keydown", r, !0);
2799
- }, [je]);
2800
- const Ge = y(
2801
- (e) => {
2802
- de(e, { asHtml: !0 }), typeof window < "u" && window.requestAnimationFrame(() => ye());
2803
- },
2804
- [de, ye]
2805
- ), [at, bn] = E(null), Lt = A(null), vn = `${tt}-variables`, Un = A(null), [yn, go] = E(void 0), Ce = y(() => {
2806
- Lt.current = null, bn(null);
2807
- }, []), Ht = y(
2808
- (e, n) => {
2809
- const r = window.getSelection();
2810
- if (!r) return;
2811
- const a = document.createRange();
2812
- a.setStart(n.node, n.start), a.setEnd(n.node, n.end), r.removeAllRanges(), r.addRange(a), Ge(Fr(e)), window.requestAnimationFrame(() => ze.current());
2813
- },
2814
- [Ge]
2815
- );
2816
- _(() => {
2817
- const e = W.current;
2818
- if (!e || !rt) return;
2819
- const n = () => {
2820
- var He;
2821
- const l = e.querySelector(".redactor-in"), p = window.getSelection();
2822
- if (!l || !p || p.rangeCount === 0 || !p.isCollapsed) {
2823
- Ce();
2824
- return;
2825
- }
2826
- const { startContainer: x, startOffset: S } = p.getRangeAt(0);
2827
- if (x.nodeType !== Node.TEXT_NODE || !l.contains(x) || (((He = x.parentElement) == null ? void 0 : He.closest(
2828
- '[data-redactor-type="variable"]'
2829
- )) ?? null) !== null) {
2830
- Ce();
2831
- return;
2832
- }
2833
- const U = x, ge = U.data.slice(0, S), Ne = /\[\[([A-Za-z0-9_]+)\]\]$/.exec(ge);
2834
- if (Ne) {
2835
- Ce(), Ht(
2836
- me.get(Ne[1].toLowerCase()) ?? Ne[1],
2837
- { node: U, start: S - Ne[0].length, end: S }
2838
- );
2839
- return;
2840
- }
2841
- const ct = /\[\[([A-Za-z0-9_ ]{0,40})$/.exec(ge), ae = gt.current;
2842
- if (!ct || !ae || (R ?? []).length === 0) {
2843
- Ce();
2844
- return;
2845
- }
2846
- const Le = {
2847
- node: U,
2848
- start: S - ct[0].length,
2849
- end: S
2850
- };
2851
- Lt.current = Le;
2852
- const dt = document.createRange();
2853
- dt.setStart(U, Le.start), dt.setEnd(U, Le.end);
2854
- const Ye = dt.getBoundingClientRect(), xt = ae.getBoundingClientRect(), En = getComputedStyle(ae).direction === "rtl";
2855
- bn({
2856
- query: ct[1],
2857
- left: En ? xt.right - Ye.right : Ye.left - xt.left,
2858
- top: Ye.bottom - xt.top + 4
2859
- });
2860
- }, r = (l) => {
2861
- var x;
2862
- if (!Lt.current || !["ArrowDown", "ArrowUp", "Home", "End", "Enter", "Escape"].includes(
2863
- l.key
2864
- ))
2865
- return;
2866
- (((x = Un.current) == null ? void 0 : x.handleKeyDown(l)) ?? !1) && (l.preventDefault(), l.stopImmediatePropagation());
2867
- }, a = () => Ce();
2868
- return e.addEventListener("input", n), e.addEventListener("keydown", r, !0), e.addEventListener("focusout", a), () => {
2869
- e.removeEventListener("input", n), e.removeEventListener("keydown", r, !0), e.removeEventListener("focusout", a);
2870
- };
2871
- }, [
2872
- rt,
2873
- me,
2874
- R,
2875
- Ht,
2876
- Ce
2877
- ]), _(() => {
2878
- var n;
2879
- const e = (n = W.current) == null ? void 0 : n.querySelector(".redactor-in");
2880
- e && (at ? (e.setAttribute("aria-expanded", "true"), e.setAttribute("aria-controls", `${vn}-list`), yn ? e.setAttribute("aria-activedescendant", yn) : e.removeAttribute("aria-activedescendant")) : (e.removeAttribute("aria-expanded"), e.removeAttribute("aria-controls"), e.removeAttribute("aria-activedescendant")));
2881
- }, [at, vn, yn]);
2882
- const ho = y(
2883
- (e) => {
2884
- const n = Lt.current;
2885
- Ce(), n && Ht(e.token, n), Y == null || Y(e.token);
2886
- },
2887
- [Ce, Ht, Y]
2888
- ), po = y(() => {
2889
- Ce();
2890
- }, [Ce]), bo = y((e) => {
2891
- bn((n) => n && { ...n, query: e });
2892
- }, []), it = y(() => {
2893
- var n;
2894
- if (typeof window < "u") {
2895
- const r = (n = W.current) == null ? void 0 : n.querySelector(".redactor-in"), a = window.getSelection();
2896
- r && a && a.rangeCount > 0 && a.anchorNode && r.contains(a.anchorNode) && (ve.current = a.getRangeAt(0).cloneRange());
2897
- }
2898
- const e = oe.current;
2899
- if (e)
2900
- try {
2901
- e(D, "selection.save");
2902
- } catch {
2903
- }
2904
- }, [D]), he = y(() => {
2905
- const e = oe.current;
2906
- if (!e) return;
2907
- const n = ve.current;
2908
- try {
2909
- e(D, "editor.focus");
2910
- } catch {
2911
- }
2912
- if (n && typeof window < "u") {
2913
- const r = window.getSelection();
2914
- if (r)
2915
- try {
2916
- r.removeAllRanges(), r.addRange(n);
2917
- return;
2918
- } catch {
2919
- }
2920
- }
2921
- try {
2922
- e(D, "selection.restore");
2923
- } catch {
2924
- }
2925
- }, [D]), vo = y(() => {
2926
- var r;
2927
- if (typeof window > "u") return "";
2928
- const e = (r = W.current) == null ? void 0 : r.querySelector(".redactor-in"), n = window.getSelection();
2929
- return !e || !n || !n.anchorNode || !e.contains(n.anchorNode) ? "" : n.toString();
2930
- }, []), yo = y(() => {
2931
- var l;
2932
- if (typeof window > "u") return null;
2933
- const e = (l = W.current) == null ? void 0 : l.querySelector(".redactor-in"), n = window.getSelection();
2934
- if (!e || !n || n.rangeCount === 0) return null;
2935
- const r = n.anchorNode, a = r && r.nodeType === Node.TEXT_NODE ? r.parentElement : r;
2936
- return !a || !e.contains(a) ? null : a.closest("table");
2937
- }, []), Zn = A(null), It = y(() => {
2938
- var l;
2939
- if (typeof window > "u") return null;
2940
- const e = (l = W.current) == null ? void 0 : l.querySelector(".redactor-in"), n = window.getSelection();
2941
- if (!e || !n || n.rangeCount === 0) return null;
2942
- const r = n.anchorNode, a = r && r.nodeType === Node.TEXT_NODE ? r.parentElement : r;
2943
- return !a || !e.contains(a) ? null : a.closest("td,th");
2944
- }, []), wo = y(() => {
2945
- Zn.current = It();
2946
- }, [It]), ko = y(
2947
- (e, n) => {
2948
- var p;
2949
- const r = Zn.current ?? It();
2950
- if (!r) return;
2951
- const a = e === "row" ? Array.from(((p = r.closest("tr")) == null ? void 0 : p.children) ?? [r]).filter(
2952
- (x) => x instanceof HTMLElement && (x.tagName === "TD" || x.tagName === "TH")
2953
- ) : [r], l = oe.current;
2954
- if (l)
2955
- try {
2956
- l(D, "module.buffer.trigger");
2957
- } catch {
2958
- }
2959
- for (const x of a)
2960
- n ? x.style.setProperty("background-color", n) : x.style.removeProperty("background-color");
2961
- if (l)
2962
- try {
2963
- l(D, "broadcast", "hardsync");
2964
- } catch {
2965
- }
2966
- typeof window < "u" && window.requestAnimationFrame(() => ye());
2967
- },
2968
- [It, D, ye]
2969
- );
2970
- _(() => {
2971
- const e = W.current;
2972
- if (typeof window > "u" || !e) return;
2973
- const n = (l) => {
2974
- const p = e.querySelector(".redactor-in"), x = l.target;
2975
- if (!p || !(x instanceof Node) || !p.contains(x))
2976
- return;
2977
- const S = x instanceof Element ? x.closest("img") : null;
2978
- zt(S && p.contains(S) ? S : null);
2979
- }, r = (l) => {
2980
- l.key === "Escape" && Rt.current && zt(null);
2981
- }, a = (l) => {
2982
- const p = l.relatedTarget;
2983
- (!(p instanceof Node) || !e.contains(p)) && zt(null);
2984
- };
2985
- return e.addEventListener("click", n), e.addEventListener("keydown", r), e.addEventListener("focusout", a), () => {
2986
- e.removeEventListener("click", n), e.removeEventListener("keydown", r), e.removeEventListener("focusout", a);
2987
- };
2988
- }, [zt]);
2989
- const xo = y(
2990
- (e) => {
2991
- const n = Rt.current;
2992
- if (!n) return;
2993
- const r = Hn.includes(
2994
- e
2995
- ) ? Hn : Zr, a = oe.current;
2996
- if (a)
2997
- try {
2998
- a(D, "module.buffer.trigger");
2999
- } catch {
3000
- }
3001
- for (const l of r) n.classList.remove(l);
3002
- if (n.classList.add(e), a)
3003
- try {
3004
- a(D, "broadcast", "hardsync");
3005
- } catch {
3006
- }
3007
- typeof window < "u" && window.requestAnimationFrame(() => ye());
3008
- },
3009
- [D, ye]
3010
- ), Co = y(
3011
- (e) => {
3012
- const n = Rt.current;
3013
- if (!n) return;
3014
- const r = oe.current;
3015
- if (r)
3016
- try {
3017
- r(D, "module.buffer.trigger");
3018
- } catch {
3019
- }
3020
- if (n.style.setProperty("width", `${e}%`), r)
3021
- try {
3022
- r(D, "broadcast", "hardsync");
3023
- } catch {
3024
- }
3025
- typeof window < "u" && window.requestAnimationFrame(() => ye());
3026
- },
3027
- [D, ye]
3028
- ), Ao = y(
3029
- (e) => {
3030
- var r;
3031
- const n = oe.current;
3032
- if (n && typeof window < "u") {
3033
- const a = (r = W.current) == null ? void 0 : r.querySelector(".redactor-in"), l = window.getSelection(), p = l == null ? void 0 : l.anchorNode, x = p && p.nodeType === Node.TEXT_NODE ? p.parentElement : p, S = x && (a != null && a.contains(x)) ? x.closest("ul,ol") : null;
3034
- if (S)
3035
- try {
3036
- n(D, "caret.setAfter", S);
3037
- } catch {
3038
- }
3039
- }
3040
- Ge(e), typeof window < "u" && window.requestAnimationFrame(() => {
3041
- var l;
3042
- const a = (l = W.current) == null ? void 0 : l.querySelector(".redactor-in");
3043
- a == null || a.querySelectorAll("table td, table th").forEach((p) => {
3044
- let x = p.lastChild;
3045
- for (; x && x.nodeType === Node.TEXT_NODE && !(x.textContent ?? "").trim(); ) {
3046
- const S = x.previousSibling;
3047
- p.removeChild(x), x = S;
3048
- }
3049
- });
3050
- });
3051
- },
3052
- [Ge, D]
3053
- ), Qn = y(
3054
- async (e, n) => {
3055
- if (M) return M(e, n);
3056
- if (!z) throw new Error("No image upload URL configured.");
3057
- const r = new FormData();
3058
- r.append("file", e);
3059
- const a = await fetch(z, {
3060
- method: "POST",
3061
- body: r,
3062
- credentials: "same-origin",
3063
- signal: n
3064
- });
3065
- if (!a.ok) throw new Error(`Image upload failed (${a.status}).`);
3066
- const l = ps(await a.json());
3067
- if (!l) throw new Error("Image upload response contained no URL.");
3068
- return l;
3069
- },
3070
- [z, M]
3071
- ), Ke = Yo({ enabled: G }), {
3072
- start: st,
3073
- land: _e,
3074
- reset: lt
3075
- } = Ke, vt = A(null), $t = A(null), [we, Yn] = E(!1), [No, Jn] = E(!1), [Eo, Dt] = E(""), Ot = y(() => {
3076
- const e = $t.current;
3077
- e != null && e.parentNode && e.parentNode.removeChild(e), $t.current = null;
3078
- }, []), er = y((e) => {
3079
- var a;
3080
- const n = (a = W.current) == null ? void 0 : a.querySelector(
3081
- ".redactor-in"
3082
- );
3083
- if (!n) return;
3084
- let r = $t.current;
3085
- if (!r || !n.contains(r)) {
3086
- r = document.createElement("span"), r.setAttribute("data-rte-interim", ""), r.setAttribute("contenteditable", "false");
3087
- const l = window.getSelection();
3088
- if (l && l.rangeCount > 0 && n.contains(l.anchorNode)) {
3089
- const p = l.getRangeAt(0);
3090
- p.collapse(!1), p.insertNode(r);
3091
- } else
3092
- n.appendChild(r);
3093
- $t.current = r;
3094
- }
3095
- r.textContent = e;
3096
- }, []), qt = y(() => {
3097
- var e;
3098
- (e = vt.current) == null || e.abort();
3099
- }, []), tr = y(() => {
3100
- var p;
3101
- if (typeof window > "u") return !1;
3102
- const e = window.getSelection(), n = (p = W.current) == null ? void 0 : p.querySelector(".redactor-in");
3103
- if (!e || e.rangeCount === 0 || !n) return !1;
3104
- const { startContainer: r, startOffset: a } = e.getRangeAt(0);
3105
- if (!n.contains(r) || r.nodeType !== Node.TEXT_NODE || a === 0)
3106
- return !1;
3107
- const l = r.data.charAt(a - 1);
3108
- return /\S/.test(l) && l !== " ";
3109
- }, []), ke = N !== void 0 && !N.granted, wn = A(null), Bt = y(() => {
3110
- if (!F || ke) return;
3111
- const e = new AbortController();
3112
- vt.current = e, Jn(!1), Yn(!0), Dt(O("editor.ai.listening")), G && st(), Ot(), F({
3113
- signal: e.signal,
3114
- // Interim text shows live in the editor (grey + caret); each final
3115
- // replaces it with committed text at the caret.
3116
- onPartialTranscript: (n) => {
3117
- e.signal.aborted || er(n);
3118
- },
3119
- onFinalTranscript: (n) => {
3120
- if (e.signal.aborted) return;
3121
- Ot();
3122
- const r = n.trim();
3123
- if (r) {
3124
- const a = wn.current;
3125
- if (a) {
3126
- wn.current = null, ve.current = a, he(), de(`${r} `, { asHtml: !1 }), G && _e(), Dt(r);
3127
- return;
3128
- }
3129
- const l = tr() ? " " : "";
3130
- de(`${l}${r} `, { asHtml: !1 }), G && _e(), Dt(r);
3131
- }
3132
- }
3133
- }).catch((n) => {
3134
- var r;
3135
- if (!(e.signal.aborted || n && typeof n == "object" && "name" in n && n.name === "AbortError")) {
3136
- if (qr(n) && ((r = Pe.current) == null || r.call(Pe), un.current)) {
3137
- dn(!0), $e(!0);
3138
- return;
3139
- }
3140
- Jn(!0);
3141
- }
3142
- }).finally(() => {
3143
- Ot(), vt.current === e && (vt.current = null, Yn(!1), Dt(""), G && !Se.current && lt());
3144
- });
3145
- }, [
3146
- F,
3147
- ke,
3148
- de,
3149
- he,
3150
- Ot,
3151
- er,
3152
- tr,
3153
- G,
3154
- st,
3155
- _e,
3156
- lt,
3157
- O
3158
- ]);
3159
- _(() => () => {
3160
- var e;
3161
- return (e = vt.current) == null ? void 0 : e.abort();
3162
- }, []);
3163
- const [Pt, yt] = E(null), Ve = A(null), Ft = A(null), [To, nr] = E(!1), Mo = ((N == null ? void 0 : N.pending) ?? !1) || To, jt = A(!1), kn = y(() => {
3164
- Ve.current = null, Ft.current = null, jt.current = !1, yt(null);
3165
- }, []), Ro = y(() => {
3166
- var n;
3167
- jt.current = !0;
3168
- const e = (n = N == null ? void 0 : N.onGrant) == null ? void 0 : n.call(N);
3169
- e && typeof e.then == "function" && (nr(!0), Promise.resolve(e).catch(() => {
3170
- }).finally(() => nr(!1)));
3171
- }, [N]), rr = A((N == null ? void 0 : N.granted) ?? !0);
3172
- _(() => {
3173
- const e = rr.current;
3174
- if (rr.current = (N == null ? void 0 : N.granted) ?? !0, !e && (N != null && N.granted) && Ve.current) {
3175
- const n = Ve.current, r = jt.current;
3176
- Ve.current = null, jt.current = !1, yt(null);
3177
- const a = Ft.current;
3178
- if (Ft.current = null, !r) return;
3179
- n === "write" ? $e(!0) : n === "action" ? a == null || a() : (he(), Bt());
3180
- }
3181
- }, [N == null ? void 0 : N.granted, he, Bt]), _(() => {
3182
- ke && ($e(!1), we && qt());
3183
- }, [ke, we, qt]);
3184
- const or = y(
3185
- (e = "document") => {
3186
- if (we) {
3187
- qt();
3188
- return;
3189
- }
3190
- it();
3191
- const n = ve.current;
3192
- if (wn.current = e === "selection" && n && !n.collapsed ? n.cloneRange() : null, ke) {
3193
- Ve.current = "dictate", yt("dictate");
3194
- return;
3195
- }
3196
- Bt();
3197
- },
3198
- [we, qt, ke, it, Bt]
3199
- ), ar = y(
3200
- (e = "document") => {
3201
- it();
3202
- const n = ve.current, r = n ? n.cloneRange() : null, a = e === "selection" && !!(r && !r.collapsed);
3203
- if (r && !a && r.collapse(!1), Mt.current = r, so(a ? "selection" : "document"), ao(a && r ? r.toString() : ""), ke) {
3204
- Ve.current = "write", yt("write");
3205
- return;
3206
- }
3207
- $e(!0);
3208
- },
3209
- [it, ke]
3210
- ), ir = Je(() => N != null && N.granted ? /* @__PURE__ */ C(Ee, { children: [
3211
- O(
3212
- "editor.ai.consentRecorded",
3213
- "AI assistance consent has been recorded."
3214
- ),
3215
- P ? /* @__PURE__ */ C(Ee, { children: [
3216
- " ",
3217
- P
3218
- ] }) : null
3219
- ] }) : P, [N, P, O]), [We, xn] = E(null), [zo, Gt] = E(!1), [sr, lr] = E(!1), [_o, Xe] = E(""), cr = A(null), Se = A(null), Kt = A(Me);
3220
- _(() => {
3221
- Kt.current = Me;
3222
- }, [Me]), _(() => {
3223
- G && (!we && We === null || Ke.state === null && st());
3224
- }, [G, we, We, Ke.state, st]);
3225
- const wt = (e) => e.preventDefault(), dr = y(
3226
- (e) => {
3227
- var r;
3228
- const n = oe.current;
3229
- if (n)
3230
- try {
3231
- const a = n(D);
3232
- (r = a == null ? void 0 : a.broadcast) == null || r.call(a, "state", !1, e);
3233
- } catch {
3234
- }
3235
- },
3236
- [D]
3237
- ), ur = A(!1), Ue = y(
3238
- (e) => {
3239
- const n = oe.current;
3240
- if (!n || ur.current === e) return;
3241
- ur.current = e;
3242
- const r = e || f;
3243
- Et.current = r;
3244
- try {
3245
- n(D, r ? "enableReadOnly" : "disableReadOnly");
3246
- } catch {
3247
- }
3248
- },
3249
- [D, f]
3250
- ), Cn = y(
3251
- (e) => {
3252
- var r;
3253
- const n = ut(
3254
- xe(e),
3255
- nt.current
3256
- );
3257
- !ce("source.setCode", n) && J.current && (J.current.value = n), (r = fe.current) == null || r.call(fe, { html: n, markdown: "" });
3258
- },
3259
- [ce]
3260
- ), Ze = y(
3261
- (e) => {
3262
- var l;
3263
- const n = (l = W.current) == null ? void 0 : l.querySelector(".redactor-in"), r = typeof window < "u" ? window.getSelection() : null;
3264
- if (e === "selection" && n && r && r.rangeCount > 0 && !r.isCollapsed) {
3265
- const p = r.getRangeAt(0);
3266
- if (n.contains(p.commonAncestorContainer)) {
3267
- const x = p.toString();
3268
- if (x.trim())
3269
- return {
3270
- scope: "selection",
3271
- range: p.cloneRange(),
3272
- html: fs(p.cloneContents()),
3273
- text: x
3274
- };
3275
- }
3276
- }
3277
- const a = le();
3278
- return { scope: "document", range: null, html: a, text: Br(a) };
3279
- },
3280
- [le]
3281
- ), An = y(
3282
- (e, n, r, a) => {
3283
- if (Se.current || !r.text.trim()) return;
3284
- const l = new AbortController();
3285
- Se.current = l, xn(e), lr(!1), cr.current = e, Xe(O("editor.ai.generating")), Gt(!1), G && st();
3286
- const p = le();
3287
- Ue(!0), Promise.resolve(
3288
- n({
3289
- html: r.html,
3290
- text: r.text,
3291
- scope: r.scope,
3292
- signal: l.signal
3293
- })
3294
- ).then((x) => {
3295
- var U;
3296
- if (l.signal.aborted) return;
3297
- Ue(!1);
3298
- const S = String(x ?? "");
3299
- if (le() !== p) {
3300
- lr(!0), Xe("");
3301
- return;
3302
- }
3303
- if (!Br(S)) {
3304
- Gt(!0), Xe("");
3305
- return;
3306
- }
3307
- if (dr(p), r.scope === "selection" && r.range) {
3308
- if (!r.range.startContainer.isConnected) {
3309
- Gt(!0), Xe("");
3310
- return;
3311
- }
3312
- ve.current = r.range, he();
3313
- const ge = ut(
3314
- xe(S),
3315
- nt.current
3316
- );
3317
- ce("insertion.insertHtml", ge) || de(S, { asHtml: !0 });
3318
- } else
3319
- Cn(S);
3320
- G && _e(), Xe(O("editor.ai.actionDone")), (U = Kt.current) == null || U.call(Kt, {
3321
- action: e,
3322
- template: a,
3323
- scope: r.scope,
3324
- previousHtml: p,
3325
- undo: () => Cn(p)
3326
- });
3327
- }).catch((x) => {
3328
- var S;
3329
- if (Ue(!1), !(l.signal.aborted || ms(x))) {
3330
- if (qr(x) && ((S = Pe.current) == null || S.call(Pe), un.current)) {
3331
- dn(!0), $e(!0);
3332
- return;
3333
- }
3334
- Gt(!0), Xe("");
3335
- }
3336
- }).finally(() => {
3337
- Se.current === l && (Se.current = null, Ue(!1), xn(null), lt());
3338
- });
3339
- },
3340
- [
3341
- G,
3342
- st,
3343
- _e,
3344
- lt,
3345
- Ue,
3346
- le,
3347
- he,
3348
- ce,
3349
- de,
3350
- Cn,
3351
- dr,
3352
- O
3353
- ]
3354
- ), kt = y(
3355
- (e, n, r, a) => {
3356
- if (ke) {
3357
- Ft.current = () => An(e, n, r, a), Ve.current = "action", yt("action");
3358
- return;
3359
- }
3360
- An(e, n, r, a);
3361
- },
3362
- [ke, An]
3363
- ), mr = y(
3364
- (e, n) => {
3365
- const r = Q == null ? void 0 : Q.onRun;
3366
- r && kt(
3367
- "template",
3368
- (a) => r({ ...a, template: e }),
3369
- n,
3370
- e
3371
- );
3372
- },
3373
- [Q, kt]
3374
- ), fr = y(() => {
3375
- var e;
3376
- (e = Se.current) == null || e.abort(), Se.current = null, Ue(!1), xn(null), Xe(""), lt();
3377
- }, [Ue, lt]), gr = A(null);
3378
- _(() => {
3379
- const e = We ?? cr.current;
3380
- if (!e) return;
3381
- const n = e === "template" ? "ai-templates" : `ai-${e}`, r = requestAnimationFrame(() => {
3382
- var l, p;
3383
- const a = document.activeElement;
3384
- a && a !== document.body && a.isConnected || (p = (l = gr.current) == null ? void 0 : l.querySelector(`[data-component-part="${n}"]`)) == null || p.focus();
3385
- });
3386
- return () => cancelAnimationFrame(r);
3387
- }, [We]), _(() => () => {
3388
- var e;
3389
- return (e = Se.current) == null ? void 0 : e.abort();
3390
- }, []), _(() => {
3391
- const e = J.current;
3392
- if (!e) return;
3393
- e.value = fo.current, ze.current();
3394
- const n = bs(B);
3395
- if (!n) {
3396
- Fn(!0);
3397
- return;
3398
- }
3399
- oe.current = n, e.value = ut(e.value, nt.current);
3400
- const r = {
3401
- lang: h ?? ws(to.language || "en"),
3402
- // The kit renders its OWN toolbar (EditorToolbar) and drives Redactor
3403
- // via the command API, so Redactor's native toolbar is suppressed.
3404
- toolbar: !1,
3405
- plugins: u ?? [],
3406
- placeholder: m ?? O("editor.placeholder"),
3407
- toolbarFixed: !1,
3408
- // Platform parity (RedactorWysiwyg.js:84): no inline shortcode expansion.
3409
- shortcodes: !1,
3410
- // The kit owns image editing: ImageFloatingToolbar provides DS-native,
3411
- // keyboard-accessible resize + wrap/align, so Redactor's own image
3412
- // popup AND its single-handle drag-resizer are both disabled to avoid a
3413
- // second, untokenised, mouse-only UI competing with ours.
3414
- imageEditable: !1,
3415
- imageResizable: !1
3416
- }, a = z ? { imageUpload: z } : {}, l = (b == null ? void 0 : b.callbacks) ?? {}, p = {
3417
- ...r,
3418
- ...a,
3419
- ...b ?? {},
3420
- // Re-pin safety-critical keys LAST so consumer `options` can't override
3421
- // the sanitising change handler or re-enable Redactor's native image UI
3422
- // (the kit's ImageFloatingToolbar replaces both — see kitDefaults above).
3423
- imageEditable: !1,
3424
- imageResizable: !1,
3425
- callbacks: {
3426
- ...l,
3427
- changed(x) {
3428
- ze.current();
3429
- const S = Zt(
3430
- Dr(Or(x))
3431
- ), U = xe(S), ge = pr.current;
3432
- if (ge && Date.now() < ge.until && Pr(U) === ge.text) {
3433
- _t.current = U;
3434
- return;
3435
- }
3436
- U !== _t.current && (_t.current = U, rn.current = !0, fe.current && (bt.current && clearTimeout(bt.current), bt.current = setTimeout(() => {
3437
- var Ne;
3438
- (Ne = fe.current) == null || Ne.call(fe, { html: U, markdown: "" });
3439
- }, 100)));
3440
- },
3441
- keydown(x) {
3442
- var S;
3443
- (S = St.current) == null || S.call(St, x);
3444
- },
3445
- observe() {
3446
- ye();
3447
- }
3448
- }
3449
- };
3450
- try {
3451
- if (n(D, p), _t.current = xe(
3452
- Zt(Dr(le()))
3453
- ), ze.current(), f)
3454
- try {
3455
- n(D, "enableReadOnly");
3456
- } catch {
3457
- }
3458
- } catch {
3459
- Fn(!0);
3460
- }
3461
- return () => {
3462
- bt.current && clearTimeout(bt.current);
3463
- try {
3464
- n(D, "destroy");
3465
- } catch {
3466
- }
3467
- oe.current = null;
3468
- };
3469
- }, []);
3470
- const hr = A(me), pr = A(
3471
- null
3472
- );
3473
- _(() => {
3474
- var r, a;
3475
- if (hr.current === me || (hr.current = me, !oe.current || me.size === 0)) return;
3476
- const e = le(), n = ut(e, me);
3477
- if (n !== e) {
3478
- const l = (r = W.current) == null ? void 0 : r.querySelector(".redactor-in"), x = l != null && l.contains(document.activeElement) && l ? gs(l) : null;
3479
- pr.current = {
3480
- text: Pr(e),
3481
- until: Date.now() + 1e3
3482
- }, ce("source.setCode", n);
3483
- const S = (a = W.current) == null ? void 0 : a.querySelector(".redactor-in");
3484
- x !== null && S && hs(S, x);
3485
- }
3486
- window.requestAnimationFrame(() => ze.current());
3487
- }, [me, le, ce]), _(() => {
3488
- if (!oe.current || c === void 0) return;
3489
- if (rn.current) {
3490
- rn.current = !1;
3491
- return;
3492
- }
3493
- const e = ut(
3494
- xe(Zt(c)),
3495
- nt.current
3496
- );
3497
- Zt(le()) !== e && ce("source.setCode", e);
3498
- }, [c, le, ce]), _(() => {
3499
- Et.current = f;
3500
- const e = oe.current;
3501
- if (e)
3502
- try {
3503
- e(D, f ? "enableReadOnly" : "disableReadOnly");
3504
- } catch {
3505
- }
3506
- }, [f, D]), _(() => {
3507
- if (!ue || c === void 0) return;
3508
- const e = J.current;
3509
- if (!e) return;
3510
- const n = xe(c);
3511
- e.value !== n && document.activeElement !== e && (e.value = n);
3512
- }, [ue, c]);
3513
- const De = Je(
3514
- () => ({
3515
- getHTML() {
3516
- return le();
3517
- },
3518
- getText() {
3519
- return le().replace(/<[^>]*>/g, " ").replace(/&nbsp;/gi, " ").replace(/\s+/g, " ").trim();
3520
- },
3521
- getMarkdown() {
3522
- return "";
3523
- },
3524
- isAiBusy() {
3525
- return Se.current !== null;
3526
- },
3527
- setContent(e) {
3528
- const n = xe(e);
3529
- ce(
3530
- "source.setCode",
3531
- ut(n, nt.current)
3532
- ) || J.current && (J.current.value = n);
3533
- },
3534
- insertAtCursor: de,
3535
- applyFormat(e) {
3536
- const n = vs[e];
3537
- n && je(...n);
3538
- },
3539
- focus() {
3540
- var n;
3541
- const e = oe.current;
3542
- if (e)
3543
- try {
3544
- e(D, "editor.focus");
3545
- return;
3546
- } catch {
3547
- }
3548
- (n = J.current) == null || n.focus();
3549
- },
3550
- clear() {
3551
- ce("source.setCode", "") || J.current && (J.current.value = "");
3552
- }
3553
- }),
3554
- [D, le, ce, de, je]
3555
- );
3556
- Xo(eo, () => De, [De]), Qo(Ri, De, o);
3557
- const So = y(
3558
- (e) => {
3559
- var n;
3560
- ze.current(), (n = fe.current) == null || n.call(fe, {
3561
- html: xe(e.target.value),
3562
- markdown: ""
3563
- });
3564
- },
3565
- []
3566
- ), Vt = d ?? O("editor.regionLabel"), Lo = m ?? O("editor.placeholder");
3567
- _(() => {
3568
- var a;
3569
- if (ue) return;
3570
- const e = (a = W.current) == null ? void 0 : a.querySelector(".redactor-in");
3571
- if (!e) return;
3572
- const n = () => {
3573
- e.getAttribute("role") !== "textbox" && e.setAttribute("role", "textbox"), e.getAttribute("aria-multiline") !== "true" && e.setAttribute("aria-multiline", "true"), e.getAttribute("aria-label") !== Vt && e.setAttribute("aria-label", Vt), e.hasAttribute("aria-labelledby") && e.removeAttribute("aria-labelledby");
3574
- };
3575
- n();
3576
- const r = new MutationObserver(n);
3577
- return r.observe(e, {
3578
- attributes: !0,
3579
- attributeFilter: ["role", "aria-labelledby"]
3580
- }), () => r.disconnect();
3581
- }, [ue, Vt]);
3582
- const Wt = We !== null, Ho = y(
3583
- (e) => {
3584
- Mn.test(e) && (ue ? de(`[[${e}]]`, { asHtml: !1 }) : (he(), Ge(Fr(e))), Y == null || Y(e));
3585
- },
3586
- [
3587
- ue,
3588
- de,
3589
- he,
3590
- Ge,
3591
- Y
3592
- ]
3593
- ), Nn = A(null), [Io, $o] = E(!1), [Do, Oo] = E(!1), qo = y(
3594
- (e, n) => {
3595
- if (Oo(e), !e) return;
3596
- const r = Ze(n);
3597
- Nn.current = r, $o(!r.text.trim());
3598
- },
3599
- [Ze]
3600
- ), Bo = y(
3601
- (e) => {
3602
- const n = Nn.current ?? Ze("document");
3603
- Nn.current = null, mr(e, n);
3604
- },
3605
- [Ze, mr]
3606
- ), br = (e, n) => {
3607
- if (!n) return null;
3608
- const r = We === e;
3609
- return {
3610
- key: e,
3611
- // While running, the segment becomes a Stop/Cancel button (progress
3612
- // shows on the scrim spinner).
3613
- icon: r ? /* @__PURE__ */ t(Ct, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : e === "proofread" ? /* @__PURE__ */ t(zr, { "aria-hidden": "true", className: "ds:size-5" }) : /* @__PURE__ */ t(_r, { "aria-hidden": "true", className: "ds:size-5" }),
3614
- label: r ? O("common.cancel") : e === "proofread" ? O("editor.ai.proofread", "Check spelling & grammar") : O("editor.ai.autoFormat", "Auto-format document"),
3615
- onClick: r ? fr : () => kt(e, n, Ze("document")),
3616
- running: r
3617
- };
3618
- }, [vr, Po] = E(() => /* @__PURE__ */ new Set()), Ae = Je(() => {
3619
- if (!Ie || vr.has(Ie.mode)) return;
3620
- if (!Ie.onDismiss) return Ie;
3621
- const e = Ie.onDismiss, n = Ie.mode;
3622
- return {
3623
- ...Ie,
3624
- onDismiss: () => {
3625
- Po((r) => new Set(r).add(n)), e();
3626
- }
3627
- };
3628
- }, [Ie, vr]), Qe = [];
3629
- if (F && Qe.push({
3630
- key: "dictate",
3631
- icon: we ? /* @__PURE__ */ t(Ct, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ t(zn, { "aria-hidden": "true", className: "ds:size-5" }),
3632
- label: O(we ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
3633
- onClick: () => or("document"),
3634
- recording: we
3635
- }), Q) {
3636
- const e = We === "template";
3637
- Qe.push({
3638
- key: "templates",
3639
- icon: e ? /* @__PURE__ */ t(Ct, { "aria-hidden": "true", className: "ds:size-5 ds:fill-current" }) : /* @__PURE__ */ t(Sn, { "aria-hidden": "true", className: "ds:size-5" }),
3640
- label: O(e ? "common.cancel" : "editor.ai.templates"),
3641
- onClick: e ? fr : void 0,
3642
- running: e,
3643
- menu: !e
3644
- });
3645
- }
3646
- const yr = br("proofread", Z);
3647
- yr && Qe.push(yr);
3648
- const wr = br("format", pe);
3649
- wr && Qe.push(wr), (V || qe) && Qe.push({
3650
- key: "write",
3651
- icon: /* @__PURE__ */ t(Rr, { "aria-hidden": "true", className: "ds:size-5" }),
3652
- label: O("editor.ai.helpMeWrite"),
3653
- onClick: () => ar("document")
3654
- });
3655
- const kr = (e, n) => Q ? /* @__PURE__ */ t(
3656
- as,
3657
- {
3658
- side: n === "document" ? "top" : "bottom",
3659
- templates: Q.templates,
3660
- onPick: Bo,
3661
- onManage: Q.onManage,
3662
- noteEmpty: Io,
3663
- onOpenChange: (r) => qo(r, n),
3664
- trigger: e
3665
- }
3666
- ) : null, xr = (k ?? []).filter(
3667
- (e) => !e.contexts || L !== void 0 && e.contexts.includes(L)
3668
- );
3669
- _(() => {
3670
- (ht || Pt !== null || f) && Re(!1);
3671
- }, [ht, Pt, f, Re]), _(() => {
3672
- be && !(k ?? []).some(
3673
- (e) => e.id === be.extension.id && (!e.contexts || L !== void 0 && e.contexts.includes(L))
3674
- ) && Re();
3675
- }, [k, L, be, Re]);
3676
- const Fo = (e) => {
3677
- var Ne, ct;
3678
- if (an) return;
3679
- cn(), $e(!1), kn();
3680
- const n = new AbortController();
3681
- pt.current = n;
3682
- const r = (Ne = ve.current) == null ? void 0 : Ne.cloneRange(), a = J.current ? [
3683
- J.current.selectionStart,
3684
- J.current.selectionEnd
3685
- ] : null, l = (r == null ? void 0 : r.toString()) ?? (a ? (((ct = J.current) == null ? void 0 : ct.value) ?? "").slice(...a) : "");
3686
- let p = !1;
3687
- const x = (ae) => {
3688
- var Le;
3689
- p || (p = !0, (Le = Tt.current) == null || Le.call(Tt, e.id, ae));
3690
- };
3691
- Be.current = x;
3692
- const S = () => {
3693
- n.signal.aborted || (x({ status: "error" }), n.abort(), sn(!1), Gn(!0), ln());
3694
- }, U = async (ae) => {
3695
- var dt;
3696
- if (n.signal.aborted) return;
3697
- let Le = ae.mode === "image" ? "" : ae.html;
3698
- if (ae.mode !== "text") {
3699
- const Ye = await ae.pngDataUri();
3700
- if (n.signal.aborted) return;
3701
- const xt = await (await fetch(Ye.dataUri, { signal: n.signal })).blob(), En = await Qn(
3702
- new File([xt], "extension-result.png", { type: "image/png" }),
3703
- n.signal
3704
- );
3705
- if (n.signal.aborted) return;
3706
- const He = document.createElement("img");
3707
- He.src = En, He.alt = ae.text, He.width = Ye.width, He.height = Ye.height, He.loading = "lazy", Le += He.outerHTML;
3708
- }
3709
- n.signal.aborted || (r && (ve.current = r.cloneRange()), a && ((dt = J.current) == null || dt.setSelectionRange(...a)), he(), de(Le, { asHtml: !0 }), x({ status: "success" }), Re());
3710
- }, ge = {
3711
- html: De.getHTML(),
3712
- text: De.getText(),
3713
- selectionText: l,
3714
- scope: l ? "selection" : "document",
3715
- signal: n.signal,
3716
- close: () => {
3717
- pt.current === n && Re();
3718
- },
3719
- insert: async (ae) => {
3720
- try {
3721
- await U(ae);
3722
- } catch {
3723
- S();
3724
- }
3725
- }
3726
- };
3727
- jn({ extension: e, context: ge }), e.kind === "action" && (sn(!0), (async () => {
3728
- try {
3729
- if (!e.run) throw new Error("Missing extension run");
3730
- const ae = await e.run(ge);
3731
- if (n.signal.aborted) return;
3732
- ae ? await U(ae) : (x({ status: "success" }), Re());
3733
- } catch {
3734
- S();
3735
- }
3736
- })());
3737
- }, Cr = Jr.map(
3738
- (e) => xr.filter(
3739
- (n) => {
3740
- var r;
3741
- return (((r = n.source) == null ? void 0 : r.kind) ?? "kit") === e;
3742
- }
3743
- )
3744
- ), jo = Cr.every(
3745
- (e) => e.length > 0
3746
- ), Go = xr.length > 0 ? /* @__PURE__ */ t(
3747
- Ms,
3748
- {
3749
- groupedExtensions: Cr,
3750
- showExtensionGroups: jo,
3751
- extensionPending: an,
3752
- extensionSession: be,
3753
- extensionError: on,
3754
- openExtension: Fo,
3755
- closeExtension: Re,
3756
- saveSelection: it,
3757
- closeSignal: no,
3758
- restoreFocusOnCloseRef: Kn
3759
- }
3760
- ) : void 0, Ar = !!(V || qe), Nr = !!(Q || Z || pe || Ar || F), Ko = !ue && !f && (re ?? Nr), Vo = y(
3761
- () => {
3762
- var e;
3763
- return ((e = W.current) == null ? void 0 : e.querySelector(".redactor-in")) ?? null;
3764
- },
3765
- []
3766
- );
3767
- return /* @__PURE__ */ C(
3768
- "div",
3769
- {
3770
- ref: W,
3771
- className: [ks(), I].filter(Boolean).join(" "),
3772
- "data-component": "rich-text-editor",
3773
- "data-component-id": o,
3774
- "data-min-height": v,
3775
- children: [
3776
- !ue && !f ? /* @__PURE__ */ t(
3777
- cs,
3778
- {
3779
- run: je,
3780
- active: hn,
3781
- preset: g,
3782
- insertHtml: Ge,
3783
- insertTable: Ao,
3784
- saveSelection: it,
3785
- restoreSelection: he,
3786
- getSelectedText: vo,
3787
- uploadImage: z || M ? Qn : void 0,
3788
- enableColor: (u == null ? void 0 : u.includes("fontcolor")) ?? !1,
3789
- enableImage: !!(z || M),
3790
- enableTable: (u == null ? void 0 : u.includes("table")) ?? !1,
3791
- showExtensions: w,
3792
- extensionControl: Go,
3793
- variables: Wn,
3794
- recentVariableTokens: K,
3795
- insertVariable: Ho
3796
- }
3797
- ) : null,
3798
- /* @__PURE__ */ C("div", { className: "ds:relative", ref: gt, children: [
3799
- /* @__PURE__ */ t(
3800
- "textarea",
3801
- {
3802
- ref: J,
3803
- id: tt,
3804
- "aria-label": Vt,
3805
- "aria-multiline": "true",
3806
- "aria-busy": Wt || void 0,
3807
- placeholder: Lo,
3808
- onChange: ue ? So : void 0,
3809
- readOnly: ue ? f : void 0,
3810
- className: ue ? Cs() : void 0
3811
- }
3812
- ),
3813
- Wt ? /* @__PURE__ */ t(
3814
- "div",
3815
- {
3816
- "aria-hidden": "true",
3817
- className: "ds:absolute ds:inset-0 ds:z-[5] ds:flex ds:items-center ds:justify-center ds:cursor-wait ds:rounded-[var(--radius-md)] ds:bg-[color-mix(in_srgb,var(--background)_40%,transparent)]",
3818
- children: /* @__PURE__ */ t(On, { size: "lg", variant: "prism" })
3819
- }
3820
- ) : null,
3821
- /* @__PURE__ */ C("div", { className: "ds:sticky ds:bottom-0 ds:z-10", children: [
3822
- Qe.length > 0 ? /* @__PURE__ */ C(
3823
- "div",
3824
- {
3825
- ref: gr,
3826
- className: "ds:absolute ds:[inset-block-end:var(--spacing-md)] ds:[inset-inline-end:var(--spacing-md)] ds:z-10",
3827
- "data-ai-sparkle": Ke.props["data-ai-sparkle"],
3828
- children: [
3829
- /* @__PURE__ */ C("div", { className: "ds:relative ds:flex ds:items-center ds:overflow-hidden ds:rounded-full ds:bg-[var(--primary)] ds:bg-[image:var(--gradient-brand)] ds:shadow-[0_8px_24px_color-mix(in_srgb,var(--primary)_35%,transparent)]", children: [
3830
- Qe.map((e, n) => {
3831
- const r = /* @__PURE__ */ t(
3832
- "button",
3833
- {
3834
- type: "button",
3835
- onClick: e.onClick,
3836
- "aria-pressed": e.recording || void 0,
3837
- "aria-busy": e.running || void 0,
3838
- "aria-haspopup": e.menu ? "menu" : void 0,
3839
- "data-component-part": `ai-${e.key}`,
3840
- disabled: Wt && !e.running || void 0,
3841
- "aria-label": e.label,
3842
- className: e.recording ? Ns : As,
3843
- children: e.icon
3844
- }
3845
- );
3846
- return /* @__PURE__ */ C(ft, { children: [
3847
- n > 0 ? /* @__PURE__ */ t(
3848
- "span",
3849
- {
3850
- "aria-hidden": "true",
3851
- className: "ds:self-stretch ds:[inline-size:var(--border-width-sm)] ds:bg-[color-mix(in_srgb,var(--primary-foreground)_35%,transparent)]"
3852
- }
3853
- ) : null,
3854
- mt(
3855
- e.menu ? kr(r, "document") : r,
3856
- Ae
3857
- )
3858
- ] }, e.key);
3859
- }),
3860
- Ke.state ? /* @__PURE__ */ t(
3861
- "span",
3862
- {
3863
- "aria-hidden": "true",
3864
- className: `ds:pointer-events-none ds:absolute ds:inset-0 ds:-translate-x-full ds:bg-[linear-gradient(90deg,transparent,color-mix(in_srgb,var(--primary-foreground)_45%,transparent),transparent)] ${Ke.props.className}`
3865
- }
3866
- ) : null
3867
- ] }),
3868
- /* @__PURE__ */ t(Jo, { state: Ke.state })
3869
- ]
3870
- }
3871
- ) : null,
3872
- /* @__PURE__ */ t(
3873
- Rn,
3874
- {
3875
- open: !!(be && (!an || on)),
3876
- onClose: Re,
3877
- title: be ? Vr(O, be.extension.label) : void 0,
3878
- children: on ? /* @__PURE__ */ t(Kr, {}) : /* @__PURE__ */ t("div", { className: "ds:overflow-y-auto ds:[max-block-size:min(60dvh,calc(var(--rich-text-editor-min-block-size)*3))]", children: (Tr = be == null ? void 0 : (Er = be.extension).render) == null ? void 0 : Tr.call(
3879
- Er,
3880
- be.context
3881
- ) })
3882
- }
3883
- ),
3884
- qe ? qe({
3885
- open: ht && !ke,
3886
- onClose: () => {
3887
- $e(!1), dn(!1);
3888
- },
3889
- selectionText: oo,
3890
- scope: io,
3891
- creditsExhausted: lo,
3892
- getHTML: De.getHTML,
3893
- getText: De.getText,
3894
- // All three write seams put AI output into the note, so
3895
- // each one is an action landing and sparkles the pill.
3896
- insertAtSelection: (e) => {
3897
- Mt.current && (ve.current = Mt.current.cloneRange()), he(), de(e, { asHtml: !0 }), G && _e();
3898
- },
3899
- insertAfterSelection: (e) => {
3900
- const n = Mt.current ?? ve.current;
3901
- if (n) {
3902
- const r = n.cloneRange();
3903
- r.collapse(!1), ve.current = r;
3904
- }
3905
- he(), de(e, { asHtml: !0 }), G && _e();
3906
- },
3907
- setContent: (e) => {
3908
- De.setContent(e), G && _e();
3909
- },
3910
- onDictate: F,
3911
- privacyNotice: ir
3912
- }) : V ? /* @__PURE__ */ t(
3913
- Li,
3914
- {
3915
- open: ht && !ke,
3916
- onClose: () => $e(!1),
3917
- onRequestAiDraft: V,
3918
- onInsert: (e) => {
3919
- he(), de(e, { asHtml: $ !== "text" }), G && _e();
3920
- },
3921
- previewAsHtml: $ !== "text",
3922
- privacyNotice: ir,
3923
- onDictate: F
3924
- }
3925
- ) : null,
3926
- N ? /* @__PURE__ */ t(
3927
- Rn,
3928
- {
3929
- open: Pt !== null,
3930
- onClose: kn,
3931
- ariaLabel: O(
3932
- "editor.ai.consentRegionLabel",
3933
- "AI assistance consent for this document"
3934
- ),
3935
- footer: /* @__PURE__ */ t(Te, { intent: "ghost", size: "sm", onClick: kn, children: O("common.close") }),
3936
- children: /* @__PURE__ */ t(
3937
- ea,
3938
- {
3939
- granted: N.granted,
3940
- grantedAt: N.grantedAt,
3941
- grantedBy: N.grantedBy,
3942
- canGrant: (N.canGrant ?? !0) && N.onGrant !== void 0,
3943
- pending: Mo,
3944
- onGrantConsent: Ro,
3945
- headingLevel: X,
3946
- "aria-label": O(
3947
- "editor.ai.consentRegionLabel",
3948
- "AI assistance consent for this document"
3949
- )
3950
- }
3951
- )
3952
- }
3953
- ) : null
3954
- ] }),
3955
- !ue && !f && ((u == null ? void 0 : u.includes("table")) ?? !1) ? /* @__PURE__ */ t(
3956
- Xi,
3957
- {
3958
- active: hn,
3959
- run: je,
3960
- areaRef: gt,
3961
- getActiveTableEl: yo,
3962
- enableColor: (u == null ? void 0 : u.includes("fontcolor")) ?? !1,
3963
- saveTableCell: wo,
3964
- applyTableBackground: ko
3965
- }
3966
- ) : null,
3967
- !ue && !f ? /* @__PURE__ */ t(
3968
- os,
3969
- {
3970
- areaRef: gt,
3971
- activeImageEl: uo,
3972
- applyImageClass: xo,
3973
- setImageWidth: Co
3974
- }
3975
- ) : null,
3976
- Ko ? /* @__PURE__ */ t(
3977
- ls,
3978
- {
3979
- active: hn,
3980
- run: je,
3981
- areaRef: gt,
3982
- getEditorRoot: Vo,
3983
- suppressed: Wt || ht || Pt !== null || be !== null,
3984
- holdOpen: Do,
3985
- children: Nr ? /* @__PURE__ */ C(Ee, { children: [
3986
- F ? mt(
3987
- /* @__PURE__ */ t(
3988
- j,
3989
- {
3990
- size: "sm",
3991
- intent: "ghost",
3992
- "data-component-part": "selection-ai-dictate",
3993
- onMouseDown: wt,
3994
- icon: we ? /* @__PURE__ */ t(Ct, {}) : /* @__PURE__ */ t(zn, {}),
3995
- "aria-pressed": we,
3996
- ...Qt(
3997
- O(we ? "editor.ai.dictateStop" : "editor.ai.dictateStart"),
3998
- !!Ae
3999
- ),
4000
- onClick: () => or("selection")
4001
- }
4002
- ),
4003
- Ae
4004
- ) : null,
4005
- Q ? mt(
4006
- kr(
4007
- /* @__PURE__ */ t(
4008
- Te,
4009
- {
4010
- size: "sm",
4011
- intent: "ghost",
4012
- "data-component-part": "selection-ai-templates",
4013
- onMouseDown: wt,
4014
- startIcon: /* @__PURE__ */ t(Sn, {}),
4015
- endIcon: /* @__PURE__ */ t(Gr, {}),
4016
- children: O("editor.ai.templates")
4017
- }
4018
- ),
4019
- "selection"
4020
- ),
4021
- Ae
4022
- ) : null,
4023
- Z ? mt(
4024
- /* @__PURE__ */ t(
4025
- j,
4026
- {
4027
- size: "sm",
4028
- intent: "ghost",
4029
- "data-component-part": "selection-ai-proofread",
4030
- onMouseDown: wt,
4031
- icon: /* @__PURE__ */ t(zr, {}),
4032
- ...Qt(
4033
- O("editor.ai.proofread"),
4034
- !!Ae
4035
- ),
4036
- onClick: () => kt(
4037
- "proofread",
4038
- Z,
4039
- Ze("selection")
4040
- )
4041
- }
4042
- ),
4043
- Ae
4044
- ) : null,
4045
- pe ? mt(
4046
- /* @__PURE__ */ t(
4047
- j,
4048
- {
4049
- size: "sm",
4050
- intent: "ghost",
4051
- "data-component-part": "selection-ai-format",
4052
- onMouseDown: wt,
4053
- icon: /* @__PURE__ */ t(_r, {}),
4054
- ...Qt(
4055
- O("editor.ai.autoFormat"),
4056
- !!Ae
4057
- ),
4058
- onClick: () => kt(
4059
- "format",
4060
- pe,
4061
- Ze("selection")
4062
- )
4063
- }
4064
- ),
4065
- Ae
4066
- ) : null,
4067
- Ar ? mt(
4068
- /* @__PURE__ */ t(
4069
- j,
4070
- {
4071
- size: "sm",
4072
- intent: "ghost",
4073
- "data-component-part": "selection-ai-write",
4074
- onMouseDown: wt,
4075
- icon: /* @__PURE__ */ t(Rr, {}),
4076
- ...Qt(
4077
- O("editor.ai.helpMeWrite"),
4078
- !!Ae
4079
- ),
4080
- onClick: () => ar("selection")
4081
- }
4082
- ),
4083
- Ae
4084
- ) : null
4085
- ] }) : null
4086
- }
4087
- ) : null,
4088
- at ? /* @__PURE__ */ t(
4089
- "div",
4090
- {
4091
- className: xs,
4092
- style: {
4093
- "--rte-typeahead-x": `${at.left}px`,
4094
- "--rte-typeahead-y": `${at.top}px`
4095
- },
4096
- children: /* @__PURE__ */ t(
4097
- jr,
4098
- {
4099
- ref: Un,
4100
- id: vn,
4101
- variables: Wn,
4102
- recentTokens: K,
4103
- query: at.query,
4104
- onQueryChange: bo,
4105
- onSelect: ho,
4106
- onClose: po,
4107
- searchFocusable: !1,
4108
- onActiveDescendantChange: go
4109
- }
4110
- )
4111
- }
4112
- ) : null
4113
- ] }),
4114
- F ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: Eo }) : null,
4115
- ot.length > 0 ? /* @__PURE__ */ t(
4116
- "p",
4117
- {
4118
- id: `${tt}-variables-error`,
4119
- role: "alert",
4120
- className: "ds:m-0 ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
4121
- children: O("editor.variableInvalid", {
4122
- tokens: ot.map((e) => `[[${e}]]`).join(", ")
4123
- })
4124
- }
4125
- ) : null,
4126
- F && No ? /* @__PURE__ */ t(
4127
- "p",
4128
- {
4129
- role: "alert",
4130
- className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
4131
- children: O("editor.ai.dictationError")
4132
- }
4133
- ) : null,
4134
- Q || Z || pe ? /* @__PURE__ */ t("p", { className: "ds:sr-only", role: "status", "aria-live": "polite", children: _o }) : null,
4135
- zo || sr ? /* @__PURE__ */ t(
4136
- "p",
4137
- {
4138
- role: "alert",
4139
- className: "ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--destructive)]",
4140
- children: O(sr ? "editor.ai.actionStale" : "editor.ai.actionError")
4141
- }
4142
- ) : null
4143
- ]
4144
- }
4145
- );
4146
- }
4147
- );
4148
- Rs.displayName = "RichTextEditor";
4149
- export {
4150
- Rs as R,
4151
- Ri as r,
4152
- ks as w
4153
- };
4154
- //# sourceMappingURL=rich-text-editor-y6ML0KeV.js.map