@prolibu-suite/cobalt-core 0.10.0 → 0.10.1

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 (284) hide show
  1. package/custom-elements.json +395 -29
  2. package/dist/cjs/co-accordion.cjs.entry.js +4 -4
  3. package/dist/cjs/co-action-bar.cjs.entry.js +1 -1
  4. package/dist/cjs/co-audio-player.cjs.entry.js +82 -12
  5. package/dist/cjs/co-avatar.cjs.entry.js +72 -0
  6. package/dist/cjs/co-button.cjs.entry.js +1 -1
  7. package/dist/cjs/co-checkbox.cjs.entry.js +3 -3
  8. package/dist/cjs/co-chip_2.cjs.entry.js +62 -10
  9. package/dist/cjs/co-color-picker.cjs.entry.js +40 -10
  10. package/dist/cjs/co-data-table.cjs.entry.js +82 -4
  11. package/dist/cjs/co-input.cjs.entry.js +6 -2
  12. package/dist/cjs/co-menu-item.cjs.entry.js +1 -1
  13. package/dist/cjs/co-modal.cjs.entry.js +7 -3
  14. package/dist/cjs/co-navbar.cjs.entry.js +2 -2
  15. package/dist/cjs/co-number-field.cjs.entry.js +3 -3
  16. package/dist/cjs/co-overlay.cjs.entry.js +1 -1
  17. package/dist/cjs/co-page-header.cjs.entry.js +1 -1
  18. package/dist/cjs/co-phone-field.cjs.entry.js +1 -1
  19. package/dist/cjs/co-progress-bar.cjs.entry.js +2 -2
  20. package/dist/cjs/co-progress-circle.cjs.entry.js +2 -2
  21. package/dist/cjs/co-provider-logo_2.cjs.entry.js +1 -1
  22. package/dist/cjs/co-radio.cjs.entry.js +3 -3
  23. package/dist/cjs/co-rating.cjs.entry.js +3 -3
  24. package/dist/cjs/co-ref-field.cjs.entry.js +100 -9
  25. package/dist/cjs/co-rich-text-editor.cjs.entry.js +3 -3
  26. package/dist/cjs/co-row.cjs.entry.js +2 -2
  27. package/dist/cjs/co-select.cjs.entry.js +4 -4
  28. package/dist/cjs/co-separator.cjs.entry.js +1 -1
  29. package/dist/cjs/co-sidebar.cjs.entry.js +2 -2
  30. package/dist/cjs/co-slider.cjs.entry.js +2 -2
  31. package/dist/cjs/co-switch.cjs.entry.js +3 -3
  32. package/dist/cjs/co-tab-group.cjs.entry.js +2 -2
  33. package/dist/cjs/co-tab.cjs.entry.js +2 -2
  34. package/dist/cjs/co-tags-field.cjs.entry.js +5 -5
  35. package/dist/cjs/co-textarea.cjs.entry.js +4 -4
  36. package/dist/cjs/co-time-field.cjs.entry.js +1 -1
  37. package/dist/cjs/co-toggle-button-group.cjs.entry.js +3 -3
  38. package/dist/cjs/co-toggle-button.cjs.entry.js +3 -3
  39. package/dist/cjs/{co-avatar_2.cjs.entry.js → co-tooltip.cjs.entry.js} +2 -70
  40. package/dist/cjs/co-video.cjs.entry.js +2 -2
  41. package/dist/cjs/cobalt.cjs.js +1 -1
  42. package/dist/cjs/index-MDAnKsze.js +12 -8
  43. package/dist/cjs/loader.cjs.js +1 -1
  44. package/dist/cobalt/cobalt.esm.js +1 -1
  45. package/dist/cobalt/{p-82266f11.entry.js → p-000a15b8.entry.js} +1 -1
  46. package/dist/cobalt/{p-fe7e8813.entry.js → p-148d4aa6.entry.js} +1 -1
  47. package/dist/cobalt/p-16f8cee6.entry.js +1 -0
  48. package/dist/cobalt/p-239c5c5f.entry.js +1 -0
  49. package/dist/cobalt/{p-4d897896.entry.js → p-28764b8e.entry.js} +1 -1
  50. package/dist/cobalt/{p-73c6d735.entry.js → p-2a30c143.entry.js} +1 -1
  51. package/dist/cobalt/{p-85501c6a.entry.js → p-2f0f3bb1.entry.js} +1 -1
  52. package/dist/cobalt/{p-e01f9b9a.entry.js → p-2fba312b.entry.js} +1 -1
  53. package/dist/cobalt/p-354d5089.entry.js +1 -0
  54. package/dist/cobalt/{p-5298c030.entry.js → p-383a998e.entry.js} +1 -1
  55. package/dist/cobalt/{p-325b91b6.entry.js → p-3c4f7026.entry.js} +1 -1
  56. package/dist/cobalt/p-416795f5.entry.js +1 -0
  57. package/dist/cobalt/{p-54c987d7.entry.js → p-5a3e4c81.entry.js} +1 -1
  58. package/dist/cobalt/p-5adf117c.entry.js +1 -0
  59. package/dist/cobalt/{p-83a9a05a.entry.js → p-5ca394b1.entry.js} +1 -1
  60. package/dist/cobalt/{p-1a589c8e.entry.js → p-5e4973a6.entry.js} +1 -1
  61. package/dist/cobalt/{p-b565104d.entry.js → p-6c82a892.entry.js} +1 -1
  62. package/dist/cobalt/{p-83ea631d.entry.js → p-789c4b3e.entry.js} +1 -1
  63. package/dist/cobalt/{p-ea20f048.entry.js → p-7e8e6907.entry.js} +1 -1
  64. package/dist/cobalt/{p-10b82207.entry.js → p-8471abe2.entry.js} +1 -1
  65. package/dist/cobalt/p-8f2199ff.entry.js +1 -0
  66. package/dist/cobalt/p-9246e09c.entry.js +1 -0
  67. package/dist/cobalt/{p-eb063cc0.entry.js → p-93fe45fd.entry.js} +1 -1
  68. package/dist/cobalt/{p-ad33c40e.entry.js → p-95cfcb34.entry.js} +1 -1
  69. package/dist/cobalt/{p-bd683db3.entry.js → p-9cf738ed.entry.js} +1 -1
  70. package/dist/cobalt/p-a2462d7a.entry.js +1 -0
  71. package/dist/cobalt/p-a325ea0c.entry.js +1 -0
  72. package/dist/cobalt/{p-e8a4e6b0.entry.js → p-b5bba7fe.entry.js} +1 -1
  73. package/dist/cobalt/{p-6bf6bc3e.entry.js → p-b821d9de.entry.js} +1 -1
  74. package/dist/cobalt/{p-92b092db.entry.js → p-be34e447.entry.js} +1 -1
  75. package/dist/cobalt/p-c7d7d7f7.entry.js +1 -0
  76. package/dist/cobalt/{p-aae86f96.entry.js → p-d0b2c418.entry.js} +1 -1
  77. package/dist/cobalt/{p-50bcc76f.entry.js → p-d3344187.entry.js} +1 -1
  78. package/dist/cobalt/p-d375014b.entry.js +1 -0
  79. package/dist/cobalt/p-d9d9e8ae.entry.js +1 -0
  80. package/dist/cobalt/p-e371ec7a.entry.js +1 -0
  81. package/dist/cobalt/p-eadfd661.entry.js +1 -0
  82. package/dist/cobalt/p-ef301976.entry.js +1 -0
  83. package/dist/cobalt/{p-f68dd124.entry.js → p-fb2d1144.entry.js} +1 -1
  84. package/dist/collection/components/co-accordion/co-accordion.css +2 -2
  85. package/dist/collection/components/co-accordion/co-accordion.js +4 -4
  86. package/dist/collection/components/co-action-bar/co-action-bar.css +9 -2
  87. package/dist/collection/components/co-audio-player/co-audio-player.js +138 -12
  88. package/dist/collection/components/co-autocomplete/co-autocomplete.js +1 -1
  89. package/dist/collection/components/co-avatar-group/co-avatar-group.js +1 -1
  90. package/dist/collection/components/co-button/co-button.css +6 -3
  91. package/dist/collection/components/co-checkbox/co-checkbox.js +22 -3
  92. package/dist/collection/components/co-checkbox-group/co-checkbox-group.js +1 -1
  93. package/dist/collection/components/co-color-picker/co-color-picker.js +40 -10
  94. package/dist/collection/components/co-combobox/co-combobox.js +1 -1
  95. package/dist/collection/components/co-command-search/co-command-search.js +1 -1
  96. package/dist/collection/components/co-data-table/co-data-table.css +63 -2
  97. package/dist/collection/components/co-data-table/co-data-table.js +59 -4
  98. package/dist/collection/components/co-data-table/headerTruncationLogic.js +34 -0
  99. package/dist/collection/components/co-date-range-picker/co-date-range-picker.js +2 -2
  100. package/dist/collection/components/co-input/co-input.js +17 -5
  101. package/dist/collection/components/co-menu-item/co-menu-item.css +9 -0
  102. package/dist/collection/components/co-modal/co-modal.css +6 -0
  103. package/dist/collection/components/co-modal/co-modal.js +33 -2
  104. package/dist/collection/components/co-navbar/co-navbar.js +2 -2
  105. package/dist/collection/components/co-number-field/co-number-field.js +3 -3
  106. package/dist/collection/components/co-option-list/co-option-list.js +32 -3
  107. package/dist/collection/components/co-option-list/optionListLogic.js +31 -8
  108. package/dist/collection/components/co-overlay/co-overlay.js +1 -1
  109. package/dist/collection/components/co-page-header/co-page-header.js +1 -1
  110. package/dist/collection/components/co-phone-field/co-phone-field.js +1 -1
  111. package/dist/collection/components/co-popover/co-popover.js +1 -1
  112. package/dist/collection/components/co-progress-bar/co-progress-bar.js +2 -2
  113. package/dist/collection/components/co-progress-circle/co-progress-circle.js +2 -2
  114. package/dist/collection/components/co-radio/co-radio.js +3 -3
  115. package/dist/collection/components/co-radio-group/co-radio-group.js +1 -1
  116. package/dist/collection/components/co-rating/co-rating.js +3 -3
  117. package/dist/collection/components/co-ref-field/co-ref-field.css +40 -0
  118. package/dist/collection/components/co-ref-field/co-ref-field.js +207 -11
  119. package/dist/collection/components/co-rich-text-editor/co-rich-text-editor.js +3 -3
  120. package/dist/collection/components/co-row/co-row.js +2 -2
  121. package/dist/collection/components/co-segmented-bar/co-segmented-bar.js +1 -1
  122. package/dist/collection/components/co-select/co-select.js +24 -5
  123. package/dist/collection/components/co-separator/co-separator.js +1 -1
  124. package/dist/collection/components/co-sidebar/co-sidebar.js +2 -2
  125. package/dist/collection/components/co-sidebar-nav/co-sidebar-nav.js +1 -1
  126. package/dist/collection/components/co-skeleton/co-skeleton.js +1 -1
  127. package/dist/collection/components/co-slider/co-slider.js +2 -2
  128. package/dist/collection/components/co-switch/co-switch.js +3 -3
  129. package/dist/collection/components/co-tab/co-tab.js +2 -2
  130. package/dist/collection/components/co-tab-group/co-tab-group.js +2 -2
  131. package/dist/collection/components/co-tags-field/co-tags-field.js +5 -5
  132. package/dist/collection/components/co-textarea/co-textarea.js +4 -4
  133. package/dist/collection/components/co-time-field/co-time-field.js +1 -1
  134. package/dist/collection/components/co-toast/co-toast.js +2 -2
  135. package/dist/collection/components/co-toggle-button/co-toggle-button.css +6 -5
  136. package/dist/collection/components/co-toggle-button/co-toggle-button.js +2 -2
  137. package/dist/collection/components/co-toggle-button-group/co-toggle-button-group.css +9 -5
  138. package/dist/collection/components/co-toggle-button-group/co-toggle-button-group.js +2 -2
  139. package/dist/collection/components/co-tooltip/co-tooltip.js +2 -2
  140. package/dist/collection/components/co-transfer-list/co-transfer-list.js +1 -1
  141. package/dist/collection/components/co-video/co-video.js +2 -2
  142. package/dist/components/co-accordion.js +1 -1
  143. package/dist/components/co-action-bar.js +1 -1
  144. package/dist/components/co-audio-player.js +1 -1
  145. package/dist/components/co-autocomplete.js +1 -1
  146. package/dist/components/co-avatar-group.js +1 -1
  147. package/dist/components/co-avatar.js +1 -1
  148. package/dist/components/co-button.js +1 -1
  149. package/dist/components/co-calendar-month.js +1 -1
  150. package/dist/components/co-calendar-timegrid.js +1 -1
  151. package/dist/components/co-checkbox.js +1 -1
  152. package/dist/components/co-color-picker.js +1 -1
  153. package/dist/components/co-column-picker.js +1 -1
  154. package/dist/components/co-combobox.js +1 -1
  155. package/dist/components/co-command-search.js +1 -1
  156. package/dist/components/co-data-table.js +1 -1
  157. package/dist/components/co-date-picker.js +1 -1
  158. package/dist/components/co-date-range-picker.js +1 -1
  159. package/dist/components/co-date-range.js +1 -1
  160. package/dist/components/co-date-time-picker.js +1 -1
  161. package/dist/components/co-drawer.js +1 -1
  162. package/dist/components/co-event-calendar.js +1 -1
  163. package/dist/components/co-file-field.js +1 -1
  164. package/dist/components/co-input.js +1 -1
  165. package/dist/components/co-lightbox.js +1 -1
  166. package/dist/components/co-list-item.js +1 -1
  167. package/dist/components/co-menu-item.js +1 -1
  168. package/dist/components/co-modal.js +1 -1
  169. package/dist/components/co-navbar.js +1 -1
  170. package/dist/components/co-number-field.js +1 -1
  171. package/dist/components/co-option-list.js +1 -1
  172. package/dist/components/co-overlay.js +1 -1
  173. package/dist/components/co-page-header.js +1 -1
  174. package/dist/components/co-phone-field.js +1 -1
  175. package/dist/components/co-progress-bar.js +1 -1
  176. package/dist/components/co-progress-circle.js +1 -1
  177. package/dist/components/co-radio.js +1 -1
  178. package/dist/components/co-rating.js +1 -1
  179. package/dist/components/co-ref-field.js +1 -1
  180. package/dist/components/co-rich-text-editor.js +1 -1
  181. package/dist/components/co-row.js +1 -1
  182. package/dist/components/co-select.js +1 -1
  183. package/dist/components/co-separator.js +1 -1
  184. package/dist/components/co-sidebar-nav.js +1 -1
  185. package/dist/components/co-sidebar.js +1 -1
  186. package/dist/components/co-skeleton.js +1 -1
  187. package/dist/components/co-slider.js +1 -1
  188. package/dist/components/co-switch.js +1 -1
  189. package/dist/components/co-tab-group.js +1 -1
  190. package/dist/components/co-tab.js +1 -1
  191. package/dist/components/co-tags-field.js +1 -1
  192. package/dist/components/co-textarea.js +1 -1
  193. package/dist/components/co-time-field.js +1 -1
  194. package/dist/components/co-toggle-button-group.js +1 -1
  195. package/dist/components/co-toggle-button.js +1 -1
  196. package/dist/components/co-tooltip.js +1 -1
  197. package/dist/components/co-video.js +1 -1
  198. package/dist/components/p-7TncUlLN.js +1 -0
  199. package/dist/components/{p-BxP8OBw6.js → p-B9xitpGU.js} +1 -1
  200. package/dist/components/{p-x4grh-eZ.js → p-CBTGN490.js} +1 -1
  201. package/dist/components/{p-CXPRaTuo.js → p-CLsAo0-A.js} +1 -1
  202. package/dist/components/{p-B1QFLcY9.js → p-D2ldYZo1.js} +1 -1
  203. package/dist/components/{p-Bv6U5y3d.js → p-D3mVYO-G.js} +1 -1
  204. package/dist/components/{p-DkDTmHCg.js → p-DDV_bRcU.js} +1 -1
  205. package/dist/components/{p-Be_kyNRE.js → p-DSnJWzQw.js} +1 -1
  206. package/dist/components/{p-BBP5__CY.js → p-DTi2O4O8.js} +1 -1
  207. package/dist/components/p-De7w9k6_.js +1 -0
  208. package/dist/components/{p-Cl3AdEQJ.js → p-DoHLTC0n.js} +1 -1
  209. package/dist/components/{p-CnX3L8aF.js → p-DxtNejr2.js} +1 -1
  210. package/dist/components/p-wjt4IAGZ.js +1 -0
  211. package/dist/components/{p-DIo66nBr.js → p-zuhal3IZ.js} +1 -1
  212. package/dist/esm/co-accordion.entry.js +4 -4
  213. package/dist/esm/co-action-bar.entry.js +1 -1
  214. package/dist/esm/co-audio-player.entry.js +82 -12
  215. package/dist/esm/co-avatar.entry.js +70 -0
  216. package/dist/esm/co-button.entry.js +1 -1
  217. package/dist/esm/co-checkbox.entry.js +3 -3
  218. package/dist/esm/co-chip_2.entry.js +62 -10
  219. package/dist/esm/co-color-picker.entry.js +40 -10
  220. package/dist/esm/co-data-table.entry.js +82 -4
  221. package/dist/esm/co-input.entry.js +6 -2
  222. package/dist/esm/co-menu-item.entry.js +1 -1
  223. package/dist/esm/co-modal.entry.js +7 -3
  224. package/dist/esm/co-navbar.entry.js +2 -2
  225. package/dist/esm/co-number-field.entry.js +3 -3
  226. package/dist/esm/co-overlay.entry.js +1 -1
  227. package/dist/esm/co-page-header.entry.js +1 -1
  228. package/dist/esm/co-phone-field.entry.js +1 -1
  229. package/dist/esm/co-progress-bar.entry.js +2 -2
  230. package/dist/esm/co-progress-circle.entry.js +2 -2
  231. package/dist/esm/co-provider-logo_2.entry.js +1 -1
  232. package/dist/esm/co-radio.entry.js +3 -3
  233. package/dist/esm/co-rating.entry.js +3 -3
  234. package/dist/esm/co-ref-field.entry.js +100 -9
  235. package/dist/esm/co-rich-text-editor.entry.js +3 -3
  236. package/dist/esm/co-row.entry.js +2 -2
  237. package/dist/esm/co-select.entry.js +4 -4
  238. package/dist/esm/co-separator.entry.js +1 -1
  239. package/dist/esm/co-sidebar.entry.js +2 -2
  240. package/dist/esm/co-slider.entry.js +2 -2
  241. package/dist/esm/co-switch.entry.js +3 -3
  242. package/dist/esm/co-tab-group.entry.js +2 -2
  243. package/dist/esm/co-tab.entry.js +2 -2
  244. package/dist/esm/co-tags-field.entry.js +5 -5
  245. package/dist/esm/co-textarea.entry.js +4 -4
  246. package/dist/esm/co-time-field.entry.js +1 -1
  247. package/dist/esm/co-toggle-button-group.entry.js +3 -3
  248. package/dist/esm/co-toggle-button.entry.js +3 -3
  249. package/dist/esm/{co-avatar_2.entry.js → co-tooltip.entry.js} +3 -70
  250. package/dist/esm/co-video.entry.js +2 -2
  251. package/dist/esm/cobalt.js +1 -1
  252. package/dist/esm/index-DH5lfRNj.js +12 -8
  253. package/dist/esm/loader.js +1 -1
  254. package/dist/types/components/co-accordion/co-accordion.d.ts +6 -0
  255. package/dist/types/components/co-audio-player/co-audio-player.d.ts +25 -0
  256. package/dist/types/components/co-checkbox/co-checkbox.d.ts +4 -0
  257. package/dist/types/components/co-color-picker/co-color-picker.d.ts +4 -2
  258. package/dist/types/components/co-data-table/co-data-table.d.ts +15 -0
  259. package/dist/types/components/co-data-table/headerTruncationLogic.d.ts +24 -0
  260. package/dist/types/components/co-input/co-input.d.ts +5 -1
  261. package/dist/types/components/co-modal/co-modal.d.ts +10 -0
  262. package/dist/types/components/co-option-list/co-option-list.d.ts +13 -0
  263. package/dist/types/components/co-option-list/optionListLogic.d.ts +23 -6
  264. package/dist/types/components/co-ref-field/co-ref-field.d.ts +38 -0
  265. package/dist/types/components/co-select/co-select.d.ts +6 -0
  266. package/dist/types/components.d.ts +79 -3
  267. package/package.json +2 -2
  268. package/dist/cobalt/p-15d59169.entry.js +0 -1
  269. package/dist/cobalt/p-1788aab5.entry.js +0 -1
  270. package/dist/cobalt/p-20a39218.entry.js +0 -1
  271. package/dist/cobalt/p-3cc3ff93.entry.js +0 -1
  272. package/dist/cobalt/p-4908f33f.entry.js +0 -1
  273. package/dist/cobalt/p-63825d7f.entry.js +0 -1
  274. package/dist/cobalt/p-6f700f0d.entry.js +0 -1
  275. package/dist/cobalt/p-88195a63.entry.js +0 -1
  276. package/dist/cobalt/p-8fa5dc4a.entry.js +0 -1
  277. package/dist/cobalt/p-b1e8d69e.entry.js +0 -1
  278. package/dist/cobalt/p-b48917c9.entry.js +0 -1
  279. package/dist/cobalt/p-c32c176a.entry.js +0 -1
  280. package/dist/cobalt/p-e48f4e45.entry.js +0 -1
  281. package/dist/cobalt/p-ef5ca521.entry.js +0 -1
  282. package/dist/components/p-9ceBPSd1.js +0 -1
  283. package/dist/components/p-B2IsXte7.js +0 -1
  284. package/dist/components/p-BsTO1uUA.js +0 -1
@@ -1 +1 @@
1
- import{p as e,H as i,c as o,h as t,t as r}from"./index.js";import{R as s}from"./p-CWneqh4n.js";import{F as a}from"./p-C4U2tbRp.js";import{i as c}from"./p-BRbgGqLw.js";import{d as l}from"./p-B1QFLcY9.js";import{d as n}from"./p-DNJAIVfI.js";import{d as f}from"./p-BH184F0X.js";import{d}from"./p-B2IsXte7.js";import{d as h}from"./p-DRP8D9ro.js";import{d as p}from"./p-DIo66nBr.js";const m=e(class e extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.coChange=o(this,"coChange",7),this.coClear=o(this,"coClear",7),this.coSearch=o(this,"coSearch",7),this.coLoadMore=o(this,"coLoadMore",7),this.coOpen=o(this,"coOpen",3),this.coClose=o(this,"coClose",3),this.coRemove=o(this,"coRemove",7),this.coFooterPrimary=o(this,"coFooterPrimary",7),this.coFooterSecondary=o(this,"coFooterSecondary",7),this.coPinToggle=o(this,"coPinToggle",7),this.coListReorder=o(this,"coListReorder",7),this.coEditSelected=o(this,"coEditSelected",7),this.required=!1,this.placeholder="Select…",this.disabled=!1,this.clearable=!0,this.editable=!1,this.editLabel="Edit",this.multiple=!1,this.status="default",this.layout="vertical",this.size="md",this.variant="default",this.value="",this.options="[]",this.selectedDisplay="[]",this.loading=!1,this.total=0,this.searchable=!0,this.searchPlaceholder="Search…",this.searchDebounce=350,this.emptyMessage="No results found",this.showFooter=!1,this.footerPrimaryLabel="Ok",this.footerSecondaryLabel="New",this.maxChips=0,this.panelTheme="auto",this.colorMode="dot",this.triggerBadgeIcon="",this.triggerBadgeLabel="",this.avatarShape="circle",this.pinnable=!1,this.listReorderable=!1,this.isOpen=!1,this.overflowCount=0,this.lastChipsKey="\0",this.pendingFocus=!1,this.handlePopoverOpen=()=>{this.isOpen=!0},this.handlePopoverClose=()=>{this.isOpen=!1},this.handleTriggerClick=e=>{this.disabled&&e.stopPropagation()},this.handleTriggerKeyDown=e=>{this.disabled||e.target===this.triggerEl&&("Enter"===e.key||" "===e.key?(e.preventDefault(),this.isOpen=!this.isOpen):"ArrowDown"!==e.key||this.isOpen||(e.preventDefault(),this.isOpen=!0))},this.handleListChange=e=>{if(!this.multiple&&null===e.value)return this.value="",this.coClear.emit(),void(this.isOpen=!1);this.handleOptionClick(e.item)},this.handleOptionClick=e=>{if(this.multiple){const i=this.parsedValue;let o;o=i.indexOf(e._id)>=0?i.filter((i=>i!==e._id)):[...i,e._id],this.value=JSON.stringify(o),this.coChange.emit({value:o,item:e})}else this.value=e._id,this.coChange.emit({value:e._id,item:e}),this.isOpen=!1},this.handleReorder=e=>{this.value=JSON.stringify(e.value),this.coChange.emit({value:e.value,item:e.item})},this.handleClear=e=>{e.stopPropagation(),this.value=this.multiple?"[]":"",this.coClear.emit()},this.handleEditClick=e=>{e.stopPropagation();const i=this.effectiveDisplayItems[0];i&&this.coEditSelected.emit(i._id)},this.handleRemoveChip=(e,i)=>{var o;i.stopPropagation();const t=null!==(o=this.effectiveDisplayItems.find((i=>i._id===e)))&&void 0!==o?o:{_id:e,label:e},r=this.parsedValue.filter((i=>i!==e));this.value=JSON.stringify(r),this.coRemove.emit(e),this.coChange.emit({value:r,item:t})},this.handleFooterPrimary=()=>{this.coFooterPrimary.emit(),this.isOpen=!1},this.handleFooterSecondary=()=>{this.coFooterSecondary.emit()}}get normalizedSize(){return"default"===this.size?"md":this.size}get parsedOptions(){try{const e="string"==typeof this.options?JSON.parse(this.options):this.options;return Array.isArray(e)?e:[]}catch(e){return[]}}get parsedSelectedDisplay(){try{const e="string"==typeof this.selectedDisplay?JSON.parse(this.selectedDisplay):this.selectedDisplay;return Array.isArray(e)?e:[]}catch(e){return[]}}get effectiveDisplayItems(){const e=this.parsedValue;if(0===e.length)return[];const i=new Map;for(const e of this.parsedSelectedDisplay)i.set(e._id,e);for(const e of this.parsedOptions)i.has(e._id)||i.set(e._id,{_id:e._id,label:e.label,description:e.description,color:e.color,avatar:e.avatar,image:e.image});return e.map((e=>i.get(e))).filter(Boolean)}get parsedValue(){if(!this.value)return[];try{const e=JSON.parse(this.value);return Array.isArray(e)?e:[this.value]}catch(e){return this.value?[this.value]:[]}}connectedCallback(){this.resizeObserver=new ResizeObserver((()=>this.calcOverflow()))}componentDidRender(){var e,i,o,t;this.chipsEl!==this.observedChipsEl&&(null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.chipsEl&&(null===(i=this.resizeObserver)||void 0===i||i.observe(this.chipsEl)),this.observedChipsEl=this.chipsEl);const r=null===(o=this.chipsEl)||void 0===o?void 0:o.querySelectorAll(".co-ref-field__chip"),s=r?Array.from(r,(e=>e.textContent)).join(""):"";s!==this.lastChipsKey&&(this.lastChipsKey=s,this.calcOverflow()),this.pendingFocus&&(null===(t=this.optionListEl)||void 0===t?void 0:t.isConnected)&&(this.pendingFocus=!1,this.optionListEl.focusSearch())}disconnectedCallback(){var e;null===(e=this.resizeObserver)||void 0===e||e.disconnect()}calcOverflow(){if(!this.multiple||this.maxChips>0||!this.chipsEl)return void(0!==this.overflowCount&&(this.overflowCount=0));const e=Array.from(this.chipsEl.querySelectorAll(".co-ref-field__chip"));if(0===e.length)return void(0!==this.overflowCount&&(this.overflowCount=0));const i=this.chipsEl.getBoundingClientRect().right;let o=0;for(let t=e.length-1;t>=0&&e[t].getBoundingClientRect().right>i+1;t--)o++;o!==this.overflowCount&&(this.overflowCount=o)}onOpenChange(e){e?(this.coOpen.emit(),this.pendingFocus=!0):(this.coClose.emit(),this.restoreTriggerFocus())}restoreTriggerFocus(){var e;const i=document.activeElement;(i===this.el||this.el.contains(i))&&(null===(e=this.triggerEl)||void 0===e||e.focus())}renderTrigger(){const i=this.effectiveDisplayItems,o=i.length>0;return t("div",{class:{"co-ref-field__trigger":!0,"co-ref-field--open":this.isOpen,"co-ref-field--disabled":this.disabled,["co-ref-field--"+this.normalizedSize]:!0,["co-ref-field--"+this.status]:"default"!==this.status,"co-ref-field--flat":"flat"===this.variant},role:"combobox","aria-expanded":this.isOpen?"true":"false","aria-haspopup":"listbox","aria-label":this.label||void 0,"aria-disabled":this.disabled?"true":void 0,"aria-controls":this.isOpen?e.LIST_ID:void 0,tabIndex:this.disabled?-1:0,ref:e=>this.triggerEl=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown},this.iconLeft&&t("span",{class:"co-ref-field__icon"},t("co-icon",{name:this.iconLeft,size:16})),t("div",{class:"co-ref-field__value"},!o&&t("span",{class:"co-ref-field__placeholder",part:"trigger-placeholder"},this.placeholder),o&&!this.multiple&&this.renderSingleValue(i[0]),o&&this.multiple&&this.renderMultipleValue(i)),o&&this.triggerBadgeIcon&&t("span",{class:"co-ref-field__trigger-badge",part:"trigger-badge",role:"img",title:this.triggerBadgeLabel||void 0,"aria-label":this.triggerBadgeLabel||void 0},t("co-icon",{name:this.triggerBadgeIcon,size:11,weight:"fill"})),o&&!this.multiple&&this.editable&&!this.disabled&&t("button",{class:"co-ref-field__edit",part:"trigger-edit",tabIndex:-1,onClick:this.handleEditClick,type:"button",title:this.editLabel||void 0,"aria-label":this.editLabel||void 0},t("co-icon",{name:"pencil-simple",size:14})),o&&this.clearable&&!this.disabled&&t("button",{class:"co-ref-field__clear",part:"trigger-clear",tabIndex:-1,onClick:this.handleClear,type:"button"},t("co-icon",{name:"x",size:14})),t("span",{class:"co-ref-field__caret",part:"trigger-chevron"},t("co-icon",{name:"caret-up-down",size:16})))}renderItemAvatar(e){return e.image||e.avatar?t("co-avatar",{class:"co-ref-field__avatar",type:e.image?"image":"text",src:e.image,text:e.avatar,color:e.color,size:"xxs",shape:this.avatarShape}):e.color?t("span",{class:"co-ref-field__color-dot",style:{backgroundColor:e.color}}):null}renderSingleValue(e){return t("div",{class:"co-ref-field__selected"},this.renderItemAvatar(e),t("span",{class:"co-ref-field__selected-label",part:"trigger-text"},e.label))}renderMultipleValue(e){const i=this.maxChips>0,o=Math.min(this.overflowCount,Math.max(0,e.length-1)),r=i?e.slice(0,this.maxChips):e,s=i?e.length-this.maxChips:o,l=e.length-(i?0:o);return t("div",{class:"co-ref-field__chips-row"},t("div",{class:"co-ref-field__chips",ref:e=>this.chipsEl=e},r.map(((e,o)=>{const r="fill"===this.colorMode&&!!e.color&&!(e.image||e.avatar);return t(a,{key:e._id,baseClass:"co-ref-field__chip",label:e.label,modifiers:{"co-ref-field__chip--avatar":!(!e.image&&!e.avatar),"co-ref-field__chip--fill":r,"co-ref-field__chip--fill-light":r&&c(e.color),"co-ref-field__chip--clipped":!i&&o>=l,["co-ref-field__chip--"+this.normalizedSize]:!0},style:r?{backgroundColor:e.color}:void 0,onRemove:i=>this.handleRemoveChip(e._id,i)},e.image||e.avatar?this.renderItemAvatar(e):e.color&&!r?t("span",{class:"co-ref-field__chip-dot",style:{backgroundColor:e.color}}):null)}))),s>0&&t("span",{class:"co-ref-field__chip-overflow"},"+",s))}renderPanel(){return t("div",{class:{"co-ref-field__panel":!0,"co-ref-field__panel--dark":"dark"===this.panelTheme,"co-ref-field__panel--light":"light"===this.panelTheme},style:this.panelWidth?{width:this.panelWidth}:void 0},t("co-option-list",{id:e.LIST_ID,ref:e=>this.optionListEl=e,items:"string"==typeof this.options?this.options:JSON.stringify(this.options),value:this.value,selectedItems:"string"==typeof this.selectedDisplay?this.selectedDisplay:JSON.stringify(this.selectedDisplay),multiple:this.multiple,selectedFirst:this.multiple,reorderable:this.multiple,pinnable:this.pinnable,listReorderable:this.listReorderable,selectedAffordance:"deselect",searchable:this.searchable,searchPlaceholder:this.searchPlaceholder,searchDebounce:this.searchDebounce,loading:this.loading,total:this.total,emptyMessage:this.emptyMessage,avatarShape:this.avatarShape,onCoSearch:e=>this.coSearch.emit(e.detail),onCoChange:e=>this.handleListChange(e.detail),onCoReorder:e=>this.handleReorder(e.detail),onCoPinToggle:e=>this.coPinToggle.emit(e.detail),onCoListReorder:e=>this.coListReorder.emit(e.detail),onCoLoadMore:()=>this.coLoadMore.emit()},t("slot",{name:"panel-footer",slot:"footer"}),this.showFooter&&t("div",{class:"co-ref-field__footer",slot:"footer"},this.footerSecondaryLabel&&t("button",{class:"co-ref-field__footer-btn co-ref-field__footer-btn--secondary",type:"button",onClick:this.handleFooterSecondary},t("co-icon",{name:"plus",size:16}),t("span",null,this.footerSecondaryLabel)),t("button",{class:"co-ref-field__footer-btn co-ref-field__footer-btn--primary",type:"button",onClick:this.handleFooterPrimary},t("co-icon",{name:"check",size:16}),t("span",null,this.footerPrimaryLabel)))))}render(){return t("div",{key:"8904995ce46d0552556775029316fa42c0d1261e",class:"co-ref-field"},(this.label||this.secondaryLabel)&&t("div",{key:"a3b1d77f18f04b0233d5cf9c5b18c484b60d06e4",class:"co-ref-field__labels"},this.label&&t("label",{key:"837c1f52807a6b258874d4984fdd3aafd48737ed",class:"co-ref-field__label"},this.labelIcon&&t("co-icon",{key:"c9e74495eac50df1f9f074f3a25b3be7bcf36d1c",class:"co-ref-field__label-icon",name:this.labelIcon,size:16}),this.label,t(s,{key:"49a4366d6fc20c7ddbad31d020a1d45ea4134554",required:this.required})),this.secondaryLabel&&t("span",{key:"4f9dd9e68d79642cfafd16a71e51747599668f9e",class:"co-ref-field__secondary-label"},this.secondaryLabel)),t("co-popover",{key:"91ad529d27a62ccbcb8acac7f23cee7ac2ca33ce",open:this.isOpen,placement:"bottom-start",matchWidth:!this.panelWidth,offset:4,onCoOpen:this.handlePopoverOpen,onCoClose:this.handlePopoverClose},t("div",{key:"809b6f7e0f64ffd7c6151c1fae340114f5887e72",slot:"trigger"},this.renderTrigger()),this.isOpen&&this.renderPanel()),this.helperText&&t("div",{key:"4089f6e3cd993ce620742d619282d12542e87057",class:"co-ref-field__helper co-ref-field__helper--"+this.status},"default"!==this.status&&t("co-icon",{key:"3d9e658ba0cc04034778911930837f1268afeedd",name:"error"===this.status?"warning-circle":"success"===this.status?"check-circle":"info",size:14}),t("span",{key:"8c26be0575794b6f8b410f1fd0b71efd715d5324"},this.helperText)))}get el(){return this}static get watchers(){return{isOpen:[{onOpenChange:0}]}}static get style(){return":host{display:block;font-family:var(--co-font-family-primary);font-size:var(--co-font-size-14);letter-spacing:var(--co-font-letter-spacing-body);line-height:1;position:relative}.co-ref-field{display:flex;flex-direction:column;gap:var(--co-spacing-sm2)}.co-ref-field__labels{display:flex;align-items:center;justify-content:space-between;padding:0 var(--co-spacing-xs);gap:var(--co-spacing-sm2)}.co-ref-field__label{display:inline-flex;align-items:center;color:var(--co-ref-field-label-color, var(--co-semantic-text-secondary));font-family:var(--co-ref-field-label-font-family, var(--co-font-family-primary));font-size:var(--co-ref-field-label-font-size, var(--co-font-size-14));font-weight:var(--co-ref-field-label-font-weight, 400);line-height:1;white-space:nowrap;cursor:default;text-transform:var(--co-ref-field-label-text-transform, none);letter-spacing:var(--co-ref-field-label-letter-spacing, var(--co-font-letter-spacing-body))}.co-ref-field__secondary-label{color:var(--co-semantic-text-muted);font-family:var(--co-font-family-mono);font-size:var(--co-font-size-12);font-weight:400;line-height:1;white-space:nowrap;text-align:right}.co-ref-field__trigger{display:flex;align-items:center;gap:var(--co-spacing-sm2);padding:var(--co-spacing-sm2) var(--co-spacing-md);background:var(--co-ref-field-trigger-bg, var(--co-semantic-surface-page));border:1px solid var(--co-ref-field-trigger-border-color, var(--co-semantic-border-field));border-radius:var(--co-border-radius-xs);min-height:40px;box-sizing:border-box;cursor:pointer;transition:border-color var(--co-motion-duration-fast) var(--co-motion-ease-out), box-shadow var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-ref-field--flat{background:transparent;border-color:transparent}.co-ref-field--s{min-height:28px;padding:var(--co-spacing-xxs) var(--co-spacing-sm);font-size:var(--co-font-size-12)}.co-ref-field--sm{min-height:32px;padding:var(--co-spacing-xs) var(--co-spacing-sm);font-size:var(--co-font-size-12)}.co-ref-field--lg{min-height:48px;padding:var(--co-spacing-sm) var(--co-spacing-lg);font-size:var(--co-font-size-16)}.co-ref-field--open{border-color:var(--co-semantic-border-focus);box-shadow:0 0 0 2px var(--co-semantic-border-focus-ring)}.co-ref-field__trigger:focus-visible{outline:none;border-color:var(--co-semantic-border-focus);box-shadow:0 0 0 2px var(--co-semantic-border-focus-ring)}.co-ref-field--disabled{background:var(--co-semantic-surface-disabled);border-color:transparent;cursor:not-allowed}.co-ref-field--error{border-color:var(--co-semantic-status-error)}.co-ref-field--success{border-color:var(--co-semantic-status-success)}.co-ref-field--warning{border-color:var(--co-color-status-review)}.co-ref-field--s .co-ref-field__selected{--co-avatar-size:20px}.co-ref-field--sm .co-ref-field__selected{--co-avatar-size:22px}.co-ref-field--md .co-ref-field__selected{--co-avatar-size:22px}.co-ref-field--lg .co-ref-field__selected{--co-avatar-size:28px}.co-ref-field__icon{flex-shrink:0;color:var(--co-semantic-text-muted);display:flex;align-items:center}.co-ref-field__label-icon{flex-shrink:0;margin-right:var(--co-spacing-xs);color:var(--co-semantic-text-secondary)}.co-ref-field__value{flex:1;min-width:0;display:flex;align-items:center}.co-ref-field__placeholder{color:var(--co-semantic-text-muted);font-size:inherit;font-weight:400;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-ref-field__caret{flex-shrink:0;color:var(--co-semantic-text-muted);display:flex;align-items:center}.co-ref-field__trigger-badge{flex-shrink:0;display:grid;place-items:center;width:18px;height:18px;border-radius:var(--co-border-radius-xxs);background:var(--co-ref-field-trigger-badge-bg, rgba(0, 0, 0, 0.22));color:var(--co-semantic-text-default)}.co-ref-field__clear{flex-shrink:0;display:flex;align-items:center;padding:0;margin:0;border:none;background:transparent;cursor:pointer;color:var(--co-semantic-text-muted);transition:color var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-ref-field__clear:hover{color:var(--co-semantic-text-default)}.co-ref-field__edit{flex-shrink:0;display:flex;align-items:center;padding:0;margin:0;border:none;background:transparent;cursor:pointer;color:var(--co-semantic-text-muted);transition:color var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-ref-field__edit:hover{color:var(--co-semantic-text-default)}.co-ref-field__selected{display:flex;align-items:center;gap:var(--co-spacing-sm);min-width:0}.co-ref-field__color-dot{width:10px;height:10px;min-width:10px;border-radius:var(--co-border-radius-full);flex-shrink:0}.co-ref-field__avatar{flex-shrink:0}.co-ref-field__selected-label{color:var(--co-semantic-text-default);font-size:inherit;font-weight:400;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-ref-field__chips-row{flex:1;min-width:0;display:flex;align-items:center;gap:var(--co-spacing-xs)}.co-ref-field__chips{flex:1;min-width:0;display:flex;flex-wrap:nowrap;overflow:hidden;gap:var(--co-spacing-xs);align-items:center}.co-ref-field__chip{display:inline-flex;align-items:center;gap:var(--co-spacing-sm);padding:0 var(--co-spacing-sm2);background:var(--co-color-gray-100);border-radius:var(--co-border-radius-full);line-height:1;max-width:min(160px, 100%);flex-shrink:0}.co-ref-field__chip--avatar{padding-left:var(--co-spacing-xxs)}.co-ref-field__chip--s{min-height:20px;--co-avatar-size:20px;font-size:var(--co-font-size-12)}.co-ref-field__chip--sm{min-height:22px;--co-avatar-size:22px;font-size:var(--co-font-size-12)}.co-ref-field__chip--md{min-height:22px;--co-avatar-size:22px;font-size:var(--co-font-size-14)}.co-ref-field__chip--lg{min-height:28px;--co-avatar-size:28px;font-size:var(--co-font-size-14)}.co-ref-field__chip--clipped{visibility:hidden}.co-ref-field__chip-dot{width:8px;height:8px;min-width:8px;border-radius:var(--co-border-radius-full);flex-shrink:0}.co-ref-field__chip--fill{color:var(--co-color-base-blanco);border-radius:var(--co-spacing-sm)}.co-ref-field__chip--fill-light{color:var(--co-color-base-negro)}.co-ref-field__chip--fill .co-ref-field__chip-label,.co-ref-field__chip--fill .co-ref-field__chip-remove{color:inherit}.co-ref-field__chip--fill .co-ref-field__chip-remove{opacity:0.72}.co-ref-field__chip--fill .co-ref-field__chip-remove:hover{color:inherit;opacity:1}.co-ref-field__chip-label{color:var(--co-semantic-text-default);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.co-ref-field__chip-remove{display:flex;align-items:center;padding:0;margin:0;border:none;background:transparent;cursor:pointer;color:var(--co-color-gray-500);transition:color var(--co-motion-duration-fast) var(--co-motion-ease-out);flex-shrink:0}.co-ref-field__chip-remove:hover{color:var(--co-semantic-text-default)}.co-ref-field__chip-overflow{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;padding:var(--co-spacing-xs) var(--co-spacing-sm);background:var(--co-color-opacity-negro-8);border-radius:var(--co-border-radius-full);font-size:var(--co-font-size-12);font-weight:600;color:var(--co-semantic-text-secondary);line-height:1}.co-ref-field__panel{display:flex;flex-direction:column;border-radius:var(--co-border-radius-sm, 12px);overflow:hidden}.co-ref-field__panel--dark{--co-semantic-surface-page:#0A0A0A;--co-semantic-surface-primary:#0A0A0A;--co-semantic-surface-hover:rgba(255, 255, 255, 0.08);--co-semantic-surface-muted:rgba(255, 255, 255, 0.12);--co-semantic-text-default:#ffffff;--co-semantic-text-secondary:rgba(255, 255, 255, 0.8);--co-semantic-text-muted:rgba(255, 255, 255, 0.5);--co-semantic-border-subtle:rgba(255, 255, 255, 0.12);--co-semantic-border-default:rgba(255, 255, 255, 0.16);background:#0A0A0A;color:#ffffff}.co-ref-field__panel--light{--co-semantic-surface-page:#ffffff;--co-semantic-surface-primary:#ffffff;--co-semantic-surface-hover:var(--co-color-gray-100, #f5f5f5);--co-semantic-surface-muted:var(--co-color-gray-200, #e5e5e5);--co-semantic-text-default:var(--co-color-gray-700, #1F1C1B);--co-semantic-text-secondary:rgba(0, 0, 0, 0.6);--co-semantic-text-muted:rgba(0, 0, 0, 0.45);--co-semantic-border-subtle:var(--co-color-gray-200, #e5e5e5);--co-semantic-border-default:var(--co-color-gray-300, #d4d4d4);background:#ffffff;color:var(--co-color-gray-700, #1F1C1B)}.co-ref-field__footer{display:flex;gap:var(--co-spacing-sm2);border-top:1px solid var(--co-semantic-border-subtle);padding:var(--co-spacing-sm2)}.co-ref-field__footer-btn{flex:1;display:flex;align-items:center;justify-content:center;gap:var(--co-spacing-sm);padding:var(--co-spacing-sm2) var(--co-spacing-md);border-radius:var(--co-border-radius-xs);font-family:var(--co-font-family-primary);font-size:var(--co-font-size-12, 12px);font-weight:500;line-height:1;letter-spacing:var(--co-font-letter-spacing-body);white-space:nowrap;cursor:pointer;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-out);box-sizing:border-box;min-height:32px}.co-ref-field__footer-btn:hover{opacity:0.85}.co-ref-field__footer-btn--secondary{background:transparent;color:var(--co-semantic-text-default);border:1px solid var(--co-semantic-border-default)}.co-ref-field__footer-btn--primary{background:var(--co-semantic-surface-primary);color:var(--co-semantic-on-primary);border:none}.co-ref-field__helper{display:flex;align-items:center;gap:var(--co-spacing-xs);padding:0 var(--co-spacing-xs);font-size:var(--co-font-size-14);font-weight:400;color:var(--co-semantic-text-muted)}.co-ref-field__helper--error{color:var(--co-semantic-status-error)}.co-ref-field__helper--success{color:var(--co-semantic-status-success)}.co-ref-field__helper--warning{color:var(--co-color-status-review)}:host([layout='horizontal']) .co-ref-field{display:grid;grid-template-columns:var(--co-field-label-width, max-content) 1fr;align-items:start;column-gap:var(--co-spacing-md);row-gap:var(--co-spacing-sm2)}:host([layout='horizontal']) .co-ref-field__labels{grid-column:1;grid-row:1;padding-top:var(--co-spacing-sm2);min-width:0}:host([layout='horizontal']) .co-ref-field__label{white-space:normal}:host([layout='horizontal']) .co-ref-field>:not(.co-ref-field__labels){grid-column:2;min-width:0}.co-field-required{margin-left:2px;color:var(--co-color-status-error)}.co-field-required__caption{margin-left:4px;color:var(--co-semantic-text-muted);font-size:var(--co-font-size-12);font-weight:400}.co-field-required__caption::before{content:var(--co-field-required-text, ' (required)')}"}},[257,"co-ref-field",{label:[1],required:[4],secondaryLabel:[1,"secondary-label"],labelIcon:[513,"label-icon"],placeholder:[1],disabled:[4],clearable:[4],editable:[4],editLabel:[1,"edit-label"],multiple:[4],status:[1],helperText:[1,"helper-text"],iconLeft:[1,"icon-left"],layout:[513],size:[513],variant:[513],value:[1025],options:[1],selectedDisplay:[1,"selected-display"],loading:[4],total:[2],searchable:[4],searchPlaceholder:[1,"search-placeholder"],searchDebounce:[2,"search-debounce"],emptyMessage:[1,"empty-message"],showFooter:[4,"show-footer"],footerPrimaryLabel:[1,"footer-primary-label"],footerSecondaryLabel:[1,"footer-secondary-label"],maxChips:[2,"max-chips"],panelTheme:[1,"panel-theme"],colorMode:[1,"color-mode"],triggerBadgeIcon:[1,"trigger-badge-icon"],triggerBadgeLabel:[1,"trigger-badge-label"],panelWidth:[1,"panel-width"],avatarShape:[1,"avatar-shape"],pinnable:[4],listReorderable:[4,"list-reorderable"],isOpen:[32],overflowCount:[32]},void 0,{isOpen:[{onOpenChange:0}]}]);function g(){"undefined"!=typeof customElements&&["co-ref-field","co-avatar","co-icon","co-loader","co-option-list","co-popover","co-tooltip"].forEach((e=>{switch(e){case"co-ref-field":customElements.get(r(e))||customElements.define(r(e),m);break;case"co-avatar":customElements.get(r(e))||l();break;case"co-icon":customElements.get(r(e))||n();break;case"co-loader":customElements.get(r(e))||f();break;case"co-option-list":customElements.get(r(e))||d();break;case"co-popover":customElements.get(r(e))||h();break;case"co-tooltip":customElements.get(r(e))||p()}}))}m.LIST_ID="co-ref-field-list",g();const v=m,u=g;export{v as CoRefField,u as defineCustomElement}
1
+ import{p as e,H as i,c as t,h as o,t as r}from"./index.js";import{R as s}from"./p-CWneqh4n.js";import{F as a}from"./p-C4U2tbRp.js";import{i as c}from"./p-BRbgGqLw.js";import{d as l}from"./p-D2ldYZo1.js";import{d as n}from"./p-DNJAIVfI.js";import{d}from"./p-BH184F0X.js";import{d as f}from"./p-wjt4IAGZ.js";import{d as h}from"./p-DRP8D9ro.js";import{d as p}from"./p-zuhal3IZ.js";const g=e(class e extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.coChange=t(this,"coChange",7),this.coClear=t(this,"coClear",7),this.coSearch=t(this,"coSearch",7),this.coLoadMore=t(this,"coLoadMore",7),this.coOpen=t(this,"coOpen",3),this.coClose=t(this,"coClose",3),this.coRemove=t(this,"coRemove",7),this.coFooterPrimary=t(this,"coFooterPrimary",7),this.coFooterSecondary=t(this,"coFooterSecondary",7),this.coPinToggle=t(this,"coPinToggle",7),this.coListReorder=t(this,"coListReorder",7),this.coEditSelected=t(this,"coEditSelected",7),this.required=!1,this.placeholder="Select…",this.disabled=!1,this.clearable=!0,this.editable=!1,this.editLabel="Edit",this.multiple=!1,this.status="default",this.layout="vertical",this.size="md",this.variant="default",this.value="",this.options="[]",this.selectedDisplay="[]",this.loading=!1,this.total=0,this.searchable=!0,this.searchPlaceholder="Search…",this.searchDebounce=350,this.emptyMessage="No results found",this.showFooter=!1,this.footerPrimaryLabel="Ok",this.footerSecondaryLabel="New",this.maxChips=0,this.panelTheme="auto",this.colorMode="dot",this.triggerBadgeIcon="",this.triggerBadgeLabel="",this.inheritedLabel="",this.inheritedBadgeLabel="",this.avatarShape="circle",this.pinnable=!1,this.listReorderable=!1,this.inheritedTruncated=!1,this.isOpen=!1,this.overflowCount=0,this.lastChipsKey="\0",this.pendingFocus=!1,this.hasPanelSlot=!1,this.handlePopoverOpen=()=>{this.isOpen=!0},this.handlePopoverClose=()=>{this.isOpen=!1},this.measureInherited=()=>{const e=this.inheritedEl,i=!!e&&e.scrollWidth>e.clientWidth+1;i!==this.inheritedTruncated&&(this.inheritedTruncated=i)},this.setInheritedEl=e=>{var i,t;const o=e||void 0;o!==this.inheritedEl&&(this.inheritedEl&&(null===(i=this.inheritedResizeObserver)||void 0===i||i.unobserve(this.inheritedEl)),this.inheritedEl=o,o?null===(t=this.inheritedResizeObserver)||void 0===t||t.observe(o):this.inheritedTruncated&&(this.inheritedTruncated=!1))},this.handleTriggerClick=e=>{this.disabled&&e.stopPropagation()},this.handleTriggerKeyDown=e=>{this.disabled||e.target===this.triggerEl&&("Enter"===e.key||" "===e.key?(e.preventDefault(),this.isOpen=!this.isOpen):"ArrowDown"!==e.key||this.isOpen||(e.preventDefault(),this.isOpen=!0))},this.handleListChange=e=>{if(!this.multiple&&null===e.value)return this.value="",this.coClear.emit(),void(this.isOpen=!1);this.handleOptionClick(e.item)},this.handleOptionClick=e=>{if(this.multiple){const i=this.parsedValue;let t;t=i.indexOf(e._id)>=0?i.filter((i=>i!==e._id)):[...i,e._id],this.value=JSON.stringify(t),this.coChange.emit({value:t,item:e})}else this.value=e._id,this.coChange.emit({value:e._id,item:e}),this.isOpen=!1},this.handleReorder=e=>{this.value=JSON.stringify(e.value),this.coChange.emit({value:e.value,item:e.item})},this.handleClear=e=>{e.stopPropagation(),this.value=this.multiple?"[]":"",this.coClear.emit()},this.handleEditClick=e=>{e.stopPropagation();const i=this.effectiveDisplayItems[0];i&&this.coEditSelected.emit(i._id)},this.handleRemoveChip=(e,i)=>{var t;i.stopPropagation();const o=null!==(t=this.effectiveDisplayItems.find((i=>i._id===e)))&&void 0!==t?t:{_id:e,label:e},r=this.parsedValue.filter((i=>i!==e));this.value=JSON.stringify(r),this.coRemove.emit(e),this.coChange.emit({value:r,item:o})},this.handleFooterPrimary=()=>{this.coFooterPrimary.emit(),this.isOpen=!1},this.handleFooterSecondary=()=>{this.coFooterSecondary.emit()}}get normalizedSize(){return"default"===this.size?"md":this.size}get parsedOptions(){try{const e="string"==typeof this.options?JSON.parse(this.options):this.options;return Array.isArray(e)?e:[]}catch(e){return[]}}get parsedSelectedDisplay(){try{const e="string"==typeof this.selectedDisplay?JSON.parse(this.selectedDisplay):this.selectedDisplay;return Array.isArray(e)?e:[]}catch(e){return[]}}get effectiveDisplayItems(){const e=this.parsedValue;if(0===e.length)return[];const i=new Map;for(const e of this.parsedSelectedDisplay)i.set(e._id,e);for(const e of this.parsedOptions)i.has(e._id)||i.set(e._id,{_id:e._id,label:e.label,description:e.description,color:e.color,avatar:e.avatar,image:e.image});return e.map((e=>i.get(e))).filter(Boolean)}get parsedValue(){if(!this.value)return[];try{const e=JSON.parse(this.value);return Array.isArray(e)?e:[this.value]}catch(e){return this.value?[this.value]:[]}}connectedCallback(){this.resizeObserver=new ResizeObserver((()=>this.calcOverflow())),this.inheritedResizeObserver=new ResizeObserver((()=>this.measureInherited())),this.inheritedEl&&this.inheritedResizeObserver.observe(this.inheritedEl)}componentDidRender(){var e,i,t,o;this.chipsEl!==this.observedChipsEl&&(null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.chipsEl&&(null===(i=this.resizeObserver)||void 0===i||i.observe(this.chipsEl)),this.observedChipsEl=this.chipsEl);const r=null===(t=this.chipsEl)||void 0===t?void 0:t.querySelectorAll(".co-ref-field__chip"),s=r?Array.from(r,(e=>e.textContent)).join(""):"";s!==this.lastChipsKey&&(this.lastChipsKey=s,this.calcOverflow()),this.pendingFocus&&(null===(o=this.optionListEl)||void 0===o?void 0:o.isConnected)&&(this.pendingFocus=!1,this.optionListEl.focusSearch())}disconnectedCallback(){var e,i;null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(i=this.inheritedResizeObserver)||void 0===i||i.disconnect()}calcOverflow(){if(!this.multiple||this.maxChips>0||!this.chipsEl)return void(0!==this.overflowCount&&(this.overflowCount=0));const e=Array.from(this.chipsEl.querySelectorAll(".co-ref-field__chip"));if(0===e.length)return void(0!==this.overflowCount&&(this.overflowCount=0));const i=this.chipsEl.getBoundingClientRect().right;let t=0;for(let o=e.length-1;o>=0&&e[o].getBoundingClientRect().right>i+1;o--)t++;t!==this.overflowCount&&(this.overflowCount=t)}onOpenChange(e){e?(this.hasPanelSlot=!!this.el.querySelector(':scope > [slot="panel"]'),this.coOpen.emit(),this.pendingFocus=!0):(this.coClose.emit(),this.restoreTriggerFocus())}onInheritedLabelChange(){requestAnimationFrame(this.measureInherited)}restoreTriggerFocus(){var e;const i=document.activeElement;(i===this.el||this.el.contains(i))&&(null===(e=this.triggerEl)||void 0===e||e.focus())}async selectOption(e){this.handleOptionClick(e)}async closePanel(){this.isOpen=!1}async openPanel(){this.disabled||(this.isOpen=!0)}renderTrigger(){const i=this.effectiveDisplayItems,t=i.length>0;return o("div",{class:{"co-ref-field__trigger":!0,"co-ref-field--open":this.isOpen,"co-ref-field--disabled":this.disabled,["co-ref-field--"+this.normalizedSize]:!0,["co-ref-field--"+this.status]:"default"!==this.status,"co-ref-field--flat":"flat"===this.variant},role:"combobox","aria-expanded":this.isOpen?"true":"false","aria-haspopup":"listbox","aria-label":this.label||void 0,"aria-disabled":this.disabled?"true":void 0,"aria-controls":this.isOpen?e.LIST_ID:void 0,tabIndex:this.disabled?-1:0,ref:e=>this.triggerEl=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown},this.iconLeft&&o("span",{class:"co-ref-field__icon"},o("co-icon",{name:this.iconLeft,size:16})),o("div",{class:"co-ref-field__value"},!t&&this.inheritedLabel&&o("co-tooltip",{block:!0,class:"co-ref-field__inherited-tip",content:this.inheritedLabel,placement:"top",disabled:!this.inheritedTruncated},o("span",{class:"co-ref-field__inherited",part:"trigger-inherited",ref:this.setInheritedEl},this.inheritedLabel)),!t&&!this.inheritedLabel&&o("span",{class:"co-ref-field__placeholder",part:"trigger-placeholder"},this.placeholder),t&&!this.multiple&&this.renderSingleValue(i[0]),t&&this.multiple&&this.renderMultipleValue(i)),!t&&this.inheritedLabel&&this.inheritedBadgeLabel&&o("span",{class:"co-ref-field__inherited-badge",part:"trigger-inherited-badge"},this.inheritedBadgeLabel),t&&this.triggerBadgeIcon&&o("span",{class:"co-ref-field__trigger-badge",part:"trigger-badge",role:"img",title:this.triggerBadgeLabel||void 0,"aria-label":this.triggerBadgeLabel||void 0},o("co-icon",{name:this.triggerBadgeIcon,size:11,weight:"fill"})),t&&!this.multiple&&this.editable&&!this.disabled&&o("button",{class:"co-ref-field__edit",part:"trigger-edit",tabIndex:-1,onClick:this.handleEditClick,type:"button",title:this.editLabel||void 0,"aria-label":this.editLabel||void 0},o("co-icon",{name:"pencil-simple",size:14})),t&&this.clearable&&!this.disabled&&o("button",{class:"co-ref-field__clear",part:"trigger-clear",tabIndex:-1,onClick:this.handleClear,type:"button"},o("co-icon",{name:"x",size:14})),o("span",{class:"co-ref-field__caret",part:"trigger-chevron"},o("co-icon",{name:"caret-up-down",size:16})))}renderItemAvatar(e){return e.image||e.avatar?o("co-avatar",{class:"co-ref-field__avatar",type:e.image?"image":"text",src:e.image,text:e.avatar,color:e.color,size:"xxs",shape:this.avatarShape}):e.color?o("span",{class:"co-ref-field__color-dot",style:{backgroundColor:e.color}}):null}renderSingleValue(e){return o("div",{class:"co-ref-field__selected"},this.renderItemAvatar(e),o("span",{class:"co-ref-field__selected-label",part:"trigger-text"},e.label))}renderMultipleValue(e){const i=this.maxChips>0,t=Math.min(this.overflowCount,Math.max(0,e.length-1)),r=i?e.slice(0,this.maxChips):e,s=i?e.length-this.maxChips:t,l=e.length-(i?0:t);return o("div",{class:"co-ref-field__chips-row"},o("div",{class:"co-ref-field__chips",ref:e=>this.chipsEl=e},r.map(((e,t)=>{const r="fill"===this.colorMode&&!!e.color&&!(e.image||e.avatar);return o(a,{key:e._id,baseClass:"co-ref-field__chip",label:e.label,modifiers:{"co-ref-field__chip--avatar":!(!e.image&&!e.avatar),"co-ref-field__chip--fill":r,"co-ref-field__chip--fill-light":r&&c(e.color),"co-ref-field__chip--clipped":!i&&t>=l,["co-ref-field__chip--"+this.normalizedSize]:!0},style:r?{backgroundColor:e.color}:void 0,onRemove:i=>this.handleRemoveChip(e._id,i)},e.image||e.avatar?this.renderItemAvatar(e):e.color&&!r?o("span",{class:"co-ref-field__chip-dot",style:{backgroundColor:e.color}}):null)}))),s>0&&o("span",{class:"co-ref-field__chip-overflow"},"+",s))}renderFooter(e){return this.showFooter?o("div",{class:"co-ref-field__footer",slot:e?"footer":void 0},this.footerSecondaryLabel&&o("button",{class:"co-ref-field__footer-btn co-ref-field__footer-btn--secondary",type:"button",onClick:this.handleFooterSecondary},o("co-icon",{name:"plus",size:16}),o("span",null,this.footerSecondaryLabel)),o("button",{class:"co-ref-field__footer-btn co-ref-field__footer-btn--primary",type:"button",onClick:this.handleFooterPrimary},o("co-icon",{name:"check",size:16}),o("span",null,this.footerPrimaryLabel))):null}renderPanel(){const i={"co-ref-field__panel":!0,"co-ref-field__panel--dark":"dark"===this.panelTheme,"co-ref-field__panel--light":"light"===this.panelTheme},t=this.panelWidth?{width:this.panelWidth}:void 0;return this.hasPanelSlot?o("div",{class:Object.assign(Object.assign({},i),{"co-ref-field__panel--custom":!0}),id:e.LIST_ID,style:t},o("slot",{name:"panel"}),this.renderFooter(!1)):o("div",{class:i,style:t},o("co-option-list",{id:e.LIST_ID,ref:e=>this.optionListEl=e,items:"string"==typeof this.options?this.options:JSON.stringify(this.options),value:this.value,selectedItems:"string"==typeof this.selectedDisplay?this.selectedDisplay:JSON.stringify(this.selectedDisplay),multiple:this.multiple,selectedFirst:this.multiple,reorderable:this.multiple,pinnable:this.pinnable,listReorderable:this.listReorderable,selectedAffordance:"deselect",searchable:this.searchable,searchPlaceholder:this.searchPlaceholder,searchDebounce:this.searchDebounce,loading:this.loading,total:this.total,emptyMessage:this.emptyMessage,avatarShape:this.avatarShape,onCoSearch:e=>this.coSearch.emit(e.detail),onCoChange:e=>this.handleListChange(e.detail),onCoReorder:e=>this.handleReorder(e.detail),onCoPinToggle:e=>this.coPinToggle.emit(e.detail),onCoListReorder:e=>this.coListReorder.emit(e.detail),onCoLoadMore:()=>this.coLoadMore.emit()},o("slot",{name:"panel-footer",slot:"footer"}),this.renderFooter(!0)))}render(){return o("div",{key:"fa7de667cc9002d1a4a042b0d200524cbcb89b78",class:"co-ref-field"},(this.label||this.secondaryLabel)&&o("div",{key:"a6ddd5b71364e4f5bdf63b04faa09bfc0a32f6bc",class:"co-ref-field__labels"},this.label&&o("label",{key:"766f803c8be77f72e52e4d3cdd7b6d7a363a146a",class:"co-ref-field__label"},this.labelIcon&&o("co-icon",{key:"a8b6c7f189af4b9f37de8c3cc96cb489fd9183e4",class:"co-ref-field__label-icon",name:this.labelIcon,size:16}),this.label,o(s,{key:"643edcb040ef9a91040e8d52f628bc0af06c36ba",required:this.required})),this.secondaryLabel&&o("span",{key:"7a107c578e003760423acc6d450f2a42a0868375",class:"co-ref-field__secondary-label"},this.secondaryLabel)),o("co-popover",{key:"9938ca629c5927156ea137adfefd1d927104312b",open:this.isOpen,placement:"bottom-start",matchWidth:!this.panelWidth,offset:4,onCoOpen:this.handlePopoverOpen,onCoClose:this.handlePopoverClose},o("div",{key:"7618ea5fb13e4944596fd728cf934b5c28bd29ab",slot:"trigger"},this.renderTrigger()),this.isOpen&&this.renderPanel()),this.helperText&&o("div",{key:"1dd9fc7659e8f8791bb4b785407b0e89b32107c8",class:"co-ref-field__helper co-ref-field__helper--"+this.status},"default"!==this.status&&o("co-icon",{key:"399674b95ebcc91581f1f1cea54451f8ee33d9da",name:"error"===this.status?"warning-circle":"success"===this.status?"check-circle":"info",size:14}),o("span",{key:"640adc4e5cd4cd742a171cac1319b75489cb7ef8"},this.helperText)))}get el(){return this}static get watchers(){return{isOpen:[{onOpenChange:0}],inheritedLabel:[{onInheritedLabelChange:0}]}}static get style(){return":host{display:block;font-family:var(--co-font-family-primary);font-size:var(--co-font-size-14);letter-spacing:var(--co-font-letter-spacing-body);line-height:1;position:relative}.co-ref-field{display:flex;flex-direction:column;gap:var(--co-spacing-sm2)}.co-ref-field__labels{display:flex;align-items:center;justify-content:space-between;padding:0 var(--co-spacing-xs);gap:var(--co-spacing-sm2)}.co-ref-field__label{display:inline-flex;align-items:center;color:var(--co-ref-field-label-color, var(--co-semantic-text-secondary));font-family:var(--co-ref-field-label-font-family, var(--co-font-family-primary));font-size:var(--co-ref-field-label-font-size, var(--co-font-size-14));font-weight:var(--co-ref-field-label-font-weight, 400);line-height:1;white-space:nowrap;cursor:default;text-transform:var(--co-ref-field-label-text-transform, none);letter-spacing:var(--co-ref-field-label-letter-spacing, var(--co-font-letter-spacing-body))}.co-ref-field__secondary-label{color:var(--co-semantic-text-muted);font-family:var(--co-font-family-mono);font-size:var(--co-font-size-12);font-weight:400;line-height:1;white-space:nowrap;text-align:right}.co-ref-field__trigger{display:flex;align-items:center;gap:var(--co-spacing-sm2);padding:var(--co-spacing-sm2) var(--co-spacing-md);background:var(--co-ref-field-trigger-bg, var(--co-semantic-surface-page));border:1px solid var(--co-ref-field-trigger-border-color, var(--co-semantic-border-field));border-radius:var(--co-border-radius-xs);min-height:40px;box-sizing:border-box;cursor:pointer;transition:border-color var(--co-motion-duration-fast) var(--co-motion-ease-out), box-shadow var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-ref-field--flat{background:transparent;border-color:transparent}.co-ref-field--s{min-height:28px;padding:var(--co-spacing-xxs) var(--co-spacing-sm);font-size:var(--co-font-size-12)}.co-ref-field--sm{min-height:32px;padding:var(--co-spacing-xs) var(--co-spacing-sm);font-size:var(--co-font-size-12)}.co-ref-field--lg{min-height:48px;padding:var(--co-spacing-sm) var(--co-spacing-lg);font-size:var(--co-font-size-16)}.co-ref-field--open{border-color:var(--co-semantic-border-focus);box-shadow:0 0 0 2px var(--co-semantic-border-focus-ring)}.co-ref-field__trigger:focus-visible{outline:none;border-color:var(--co-semantic-border-focus);box-shadow:0 0 0 2px var(--co-semantic-border-focus-ring)}.co-ref-field--disabled{background:var(--co-semantic-surface-disabled);border-color:transparent;cursor:not-allowed}.co-ref-field--error{border-color:var(--co-semantic-status-error)}.co-ref-field--success{border-color:var(--co-semantic-status-success)}.co-ref-field--warning{border-color:var(--co-color-status-review)}.co-ref-field--s .co-ref-field__selected{--co-avatar-size:20px}.co-ref-field--sm .co-ref-field__selected{--co-avatar-size:22px}.co-ref-field--md .co-ref-field__selected{--co-avatar-size:22px}.co-ref-field--lg .co-ref-field__selected{--co-avatar-size:28px}.co-ref-field__icon{flex-shrink:0;color:var(--co-semantic-text-muted);display:flex;align-items:center}.co-ref-field__label-icon{flex-shrink:0;margin-right:var(--co-spacing-xs);color:var(--co-semantic-text-secondary)}.co-ref-field__value{flex:1;min-width:0;display:flex;align-items:center}.co-ref-field__placeholder{color:var(--co-semantic-text-muted);font-size:inherit;font-weight:400;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-ref-field__inherited-tip{min-width:0;max-width:100%}.co-ref-field__inherited{display:block;color:var(--co-semantic-text-secondary);font-size:inherit;font-weight:400;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-ref-field__inherited-badge{flex-shrink:0;display:inline-flex;align-items:center;box-sizing:border-box;height:22px;padding:0 var(--co-spacing-sm2);border:1px solid var(--co-ref-field-inherited-badge-border, var(--co-semantic-border-default));border-radius:var(--co-border-radius-full);color:var(--co-ref-field-inherited-badge-color, var(--co-semantic-text-secondary));font-size:var(--co-font-size-12);font-weight:400;line-height:1;white-space:nowrap}.co-ref-field__caret{flex-shrink:0;color:var(--co-semantic-text-muted);display:flex;align-items:center}.co-ref-field__trigger-badge{flex-shrink:0;display:grid;place-items:center;width:18px;height:18px;border-radius:var(--co-border-radius-xxs);background:var(--co-ref-field-trigger-badge-bg, rgba(0, 0, 0, 0.22));color:var(--co-semantic-text-default)}.co-ref-field__clear{flex-shrink:0;display:flex;align-items:center;padding:0;margin:0;border:none;background:transparent;cursor:pointer;color:var(--co-semantic-text-muted);transition:color var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-ref-field__clear:hover{color:var(--co-semantic-text-default)}.co-ref-field__edit{flex-shrink:0;display:flex;align-items:center;padding:0;margin:0;border:none;background:transparent;cursor:pointer;color:var(--co-semantic-text-muted);transition:color var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-ref-field__edit:hover{color:var(--co-semantic-text-default)}.co-ref-field__selected{display:flex;align-items:center;gap:var(--co-spacing-sm);min-width:0}.co-ref-field__color-dot{width:10px;height:10px;min-width:10px;border-radius:var(--co-border-radius-full);flex-shrink:0}.co-ref-field__avatar{flex-shrink:0}.co-ref-field__selected-label{color:var(--co-semantic-text-default);font-size:inherit;font-weight:400;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-ref-field__chips-row{flex:1;min-width:0;display:flex;align-items:center;gap:var(--co-spacing-xs)}.co-ref-field__chips{flex:1;min-width:0;display:flex;flex-wrap:nowrap;overflow:hidden;gap:var(--co-spacing-xs);align-items:center}.co-ref-field__chip{display:inline-flex;align-items:center;gap:var(--co-spacing-sm);padding:0 var(--co-spacing-sm2);background:var(--co-color-gray-100);border-radius:var(--co-border-radius-full);line-height:1;max-width:min(160px, 100%);flex-shrink:0}.co-ref-field__chip--avatar{padding-left:var(--co-spacing-xxs)}.co-ref-field__chip--s{min-height:20px;--co-avatar-size:20px;font-size:var(--co-font-size-12)}.co-ref-field__chip--sm{min-height:22px;--co-avatar-size:22px;font-size:var(--co-font-size-12)}.co-ref-field__chip--md{min-height:22px;--co-avatar-size:22px;font-size:var(--co-font-size-14)}.co-ref-field__chip--lg{min-height:28px;--co-avatar-size:28px;font-size:var(--co-font-size-14)}.co-ref-field__chip--clipped{visibility:hidden}.co-ref-field__chip-dot{width:8px;height:8px;min-width:8px;border-radius:var(--co-border-radius-full);flex-shrink:0}.co-ref-field__chip--fill{color:var(--co-color-base-blanco);border-radius:var(--co-spacing-sm)}.co-ref-field__chip--fill-light{color:var(--co-color-base-negro)}.co-ref-field__chip--fill .co-ref-field__chip-label,.co-ref-field__chip--fill .co-ref-field__chip-remove{color:inherit}.co-ref-field__chip--fill .co-ref-field__chip-remove{opacity:0.72}.co-ref-field__chip--fill .co-ref-field__chip-remove:hover{color:inherit;opacity:1}.co-ref-field__chip-label{color:var(--co-semantic-text-default);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.co-ref-field__chip-remove{display:flex;align-items:center;padding:0;margin:0;border:none;background:transparent;cursor:pointer;color:var(--co-color-gray-500);transition:color var(--co-motion-duration-fast) var(--co-motion-ease-out);flex-shrink:0}.co-ref-field__chip-remove:hover{color:var(--co-semantic-text-default)}.co-ref-field__chip-overflow{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;padding:var(--co-spacing-xs) var(--co-spacing-sm);background:var(--co-color-opacity-negro-8);border-radius:var(--co-border-radius-full);font-size:var(--co-font-size-12);font-weight:600;color:var(--co-semantic-text-secondary);line-height:1}.co-ref-field__panel{display:flex;flex-direction:column;border-radius:var(--co-border-radius-sm, 12px);overflow:hidden}.co-ref-field__panel--dark{--co-semantic-surface-page:#0A0A0A;--co-semantic-surface-primary:#0A0A0A;--co-semantic-surface-hover:rgba(255, 255, 255, 0.08);--co-semantic-surface-muted:rgba(255, 255, 255, 0.12);--co-semantic-text-default:#ffffff;--co-semantic-text-secondary:rgba(255, 255, 255, 0.8);--co-semantic-text-muted:rgba(255, 255, 255, 0.5);--co-semantic-border-subtle:rgba(255, 255, 255, 0.12);--co-semantic-border-default:rgba(255, 255, 255, 0.16);background:#0A0A0A;color:#ffffff}.co-ref-field__panel--light{--co-semantic-surface-page:#ffffff;--co-semantic-surface-primary:#ffffff;--co-semantic-surface-hover:var(--co-color-gray-100, #f5f5f5);--co-semantic-surface-muted:var(--co-color-gray-200, #e5e5e5);--co-semantic-text-default:var(--co-color-gray-700, #1F1C1B);--co-semantic-text-secondary:rgba(0, 0, 0, 0.6);--co-semantic-text-muted:rgba(0, 0, 0, 0.45);--co-semantic-border-subtle:var(--co-color-gray-200, #e5e5e5);--co-semantic-border-default:var(--co-color-gray-300, #d4d4d4);background:#ffffff;color:var(--co-color-gray-700, #1F1C1B)}.co-ref-field__footer{display:flex;gap:var(--co-spacing-sm2);border-top:1px solid var(--co-semantic-border-subtle);padding:var(--co-spacing-sm2)}.co-ref-field__footer-btn{flex:1;display:flex;align-items:center;justify-content:center;gap:var(--co-spacing-sm);padding:var(--co-spacing-sm2) var(--co-spacing-md);border-radius:var(--co-border-radius-xs);font-family:var(--co-font-family-primary);font-size:var(--co-font-size-12, 12px);font-weight:500;line-height:1;letter-spacing:var(--co-font-letter-spacing-body);white-space:nowrap;cursor:pointer;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-out);box-sizing:border-box;min-height:32px}.co-ref-field__footer-btn:hover{opacity:0.85}.co-ref-field__footer-btn--secondary{background:transparent;color:var(--co-semantic-text-default);border:1px solid var(--co-semantic-border-default)}.co-ref-field__footer-btn--primary{background:var(--co-semantic-surface-primary);color:var(--co-semantic-on-primary);border:none}.co-ref-field__helper{display:flex;align-items:center;gap:var(--co-spacing-xs);padding:0 var(--co-spacing-xs);font-size:var(--co-font-size-14);font-weight:400;color:var(--co-semantic-text-muted)}.co-ref-field__helper--error{color:var(--co-semantic-status-error)}.co-ref-field__helper--success{color:var(--co-semantic-status-success)}.co-ref-field__helper--warning{color:var(--co-color-status-review)}:host([layout='horizontal']) .co-ref-field{display:grid;grid-template-columns:var(--co-field-label-width, max-content) 1fr;align-items:start;column-gap:var(--co-spacing-md);row-gap:var(--co-spacing-sm2)}:host([layout='horizontal']) .co-ref-field__labels{grid-column:1;grid-row:1;padding-top:var(--co-spacing-sm2);min-width:0}:host([layout='horizontal']) .co-ref-field__label{white-space:normal}:host([layout='horizontal']) .co-ref-field>:not(.co-ref-field__labels){grid-column:2;min-width:0}.co-field-required{margin-left:2px;color:var(--co-color-status-error)}.co-field-required__caption{margin-left:4px;color:var(--co-semantic-text-muted);font-size:var(--co-font-size-12);font-weight:400}.co-field-required__caption::before{content:var(--co-field-required-text, ' (required)')}"}},[257,"co-ref-field",{label:[1],required:[4],secondaryLabel:[1,"secondary-label"],labelIcon:[513,"label-icon"],placeholder:[1],disabled:[4],clearable:[4],editable:[4],editLabel:[1,"edit-label"],multiple:[4],status:[1],helperText:[1,"helper-text"],iconLeft:[1,"icon-left"],layout:[513],size:[513],variant:[513],value:[1025],options:[1],selectedDisplay:[1,"selected-display"],loading:[4],total:[2],searchable:[4],searchPlaceholder:[1,"search-placeholder"],searchDebounce:[2,"search-debounce"],emptyMessage:[1,"empty-message"],showFooter:[4,"show-footer"],footerPrimaryLabel:[1,"footer-primary-label"],footerSecondaryLabel:[1,"footer-secondary-label"],maxChips:[2,"max-chips"],panelTheme:[1,"panel-theme"],colorMode:[1,"color-mode"],triggerBadgeIcon:[1,"trigger-badge-icon"],triggerBadgeLabel:[1,"trigger-badge-label"],inheritedLabel:[1,"inherited-label"],inheritedBadgeLabel:[1,"inherited-badge-label"],panelWidth:[1,"panel-width"],avatarShape:[1,"avatar-shape"],pinnable:[4],listReorderable:[4,"list-reorderable"],inheritedTruncated:[32],isOpen:[32],overflowCount:[32],selectOption:[64],closePanel:[64],openPanel:[64]},void 0,{isOpen:[{onOpenChange:0}],inheritedLabel:[{onInheritedLabelChange:0}]}]);function m(){"undefined"!=typeof customElements&&["co-ref-field","co-avatar","co-icon","co-loader","co-option-list","co-popover","co-tooltip"].forEach((e=>{switch(e){case"co-ref-field":customElements.get(r(e))||customElements.define(r(e),g);break;case"co-avatar":customElements.get(r(e))||l();break;case"co-icon":customElements.get(r(e))||n();break;case"co-loader":customElements.get(r(e))||d();break;case"co-option-list":customElements.get(r(e))||f();break;case"co-popover":customElements.get(r(e))||h();break;case"co-tooltip":customElements.get(r(e))||p()}}))}g.LIST_ID="co-ref-field-list",m();const b=g,v=m;export{b as CoRefField,v as defineCustomElement}
@@ -1 +1 @@
1
- import{p as e,H as t,c as o,h as r,t as i}from"./index.js";import{R as n}from"./p-Bryf3-Js.js";import{g as a,d as c}from"./p-CFFDmGPS.js";import{d as s}from"./p-DNJAIVfI.js";const l=e(class e extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.coInput=o(this,"coInput",7),this.coChange=o(this,"coChange",7),this.coFocus=o(this,"coFocus",7),this.coBlur=o(this,"coBlur",7),this.coClear=o(this,"coClear",7),this.coReady=o(this,"coReady",7),this.coFontPopupShow=o(this,"coFontPopupShow",7),this.coFontPopupHide=o(this,"coFontPopupHide",7),this.coAttachmentsSelected=o(this,"coAttachmentsSelected",7),this.value=null,this.preset="task",this.placeholder="",this.status="default",this.variant="default",this.disabled=!1,this.readonly=!1,this.required=!1,this.showCharacterCount=!1,this.autofocus=!1,this.toolbar="auto",this.attachmentsEnabled=!1,this.locale="en",this.ready=!1,this.hasFocus=!1,this.charCount=0,this.bubbleDragged=!1,this.bubbleDragOffset={x:0,y:0},this.bubbleDragPos={x:0,y:0},this.bubblePositionLocked=!1,this.bubbleLockPos={x:0,y:0},this.applyingBubbleLock=!1,this._loadedAccountFonts=[],this._fontLoaderCalled=!1,this._fontLoaderLoading=!1,this.lastEmittedJson=null,this.lastEmittedHtml="",this.applyingExternal=!1,this.rt=n,this.imgLayoutVisible=!1,this.handleUpdate=e=>{if(this.refreshCharCount(),this.applyingExternal)return;const t=this.buildOutput(e);this.lastEmittedJson=t.json?JSON.stringify(t.json):null,this.lastEmittedHtml=t.html,this.coInput.emit(t),this.readonly&&this.coChange.emit(t)},this.handleFocus=()=>{this.hasFocus=!0,this.coFocus.emit()},this.handleBlur=()=>{clearTimeout(this.blurTimeout),this.blurTimeout=setTimeout((()=>{var e,t;(null===(e=this.editor)||void 0===e?void 0:e.isFocused)||(null===(t=this.bubbleEl)||void 0===t?void 0:t.contains(document.activeElement))||(this.hasFocus=!1,this.editor&&this.coChange.emit(this.buildOutput(this.editor)),this.coBlur.emit())}),100)}}async componentDidLoad(){var e,t;if(!this.contentEl)return;const o="none"!==this.resolvedToolbar&&!this.readonly&&!this.disabled;o&&(this.bubbleEl=this.createBubbleElement()),this.editor=this.rt.createEditor({preset:this.preset,element:this.contentEl,content:this.parseValue(this.value),editable:!this.disabled&&!this.readonly,placeholder:this.placeholder,maxLength:this.maxLength,features:this.parsedFeatures,customExtensions:null!==(e=this.customExtensions)&&void 0!==e?e:[],bubbleMenuElement:this.bubbleEl,imageUpload:this.imageUpload,onUpdate:e=>this.handleUpdate(e),onFocus:()=>this.handleFocus(),onBlur:()=>this.handleBlur()}),"document"===this.preset&&this.contentEl.classList.add("co-rte-content--site"),o&&this.imagesEnabled&&(this.contentEl.style.position="relative",this.imgLayoutEl=this.createImageLayoutBar(),this.contentEl.appendChild(this.imgLayoutEl)),this.editor.on("transaction",(({transaction:e})=>{this.bubbleEl&&(this.updateBubbleActiveStates(),(this.bubbleDragged||this.bubblePositionLocked)&&this.bubbleEl&&this.applyBubbleFixedPosition()),this.imagesEnabled&&e.docChanged&&this.syncImageLayouts(),this.updateImageLayoutBar()})),this.bubbleEl&&this.toolbarEl&&(this.toolbarEl.addEventListener("mousedown",(()=>{this.closeBubbleDropdowns()})),this.toolbarEl.addEventListener("coPopoverChange",(e=>{var t;const o=null===(t=e.detail)||void 0===t?void 0:t.open;this.suppressBubble(!!o)}))),this.lastEmittedJson=null!==(t=this.value)&&void 0!==t?t:null,this.ready=!0,this.refreshCharCount(),this.syncToolbar(),this.coReady.emit(),this.autofocus&&this.editor.commands.focus(),requestAnimationFrame((()=>this.syncImageLayouts()))}disconnectedCallback(){var e,t,o,r;clearTimeout(this.blurTimeout),clearTimeout(this.bubbleLockTimer),null===(e=this.bubbleStyleObserver)||void 0===e||e.disconnect(),this.bubbleDragMoveHandler&&document.removeEventListener("mousemove",this.bubbleDragMoveHandler),this.bubbleDragEndHandler&&document.removeEventListener("mouseup",this.bubbleDragEndHandler),this.bubbleOutsideClickHandler&&document.removeEventListener("click",this.bubbleOutsideClickHandler,!0),null===(t=this.editor)||void 0===t||t.destroy(),this.editor=void 0,null===(o=this.bubbleEl)||void 0===o||o.remove(),null===(r=this.imgLayoutEl)||void 0===r||r.remove()}componentDidRender(){this.syncToolbar()}onAccountFontsChange(){var e;if(this._fontDropdownRenderFn){const t=(null===(e=this._fontDropdownSearchInput)||void 0===e?void 0:e.value)||"";this._fontDropdownRenderFn(t)}}onValueChange(e){if(!this.editor||this.applyingExternal)return;const t=null!=e?e:null;if(t!==this.lastEmittedJson&&t!==this.lastEmittedHtml){this.applyingExternal=!0;try{""===t||null===t?this.editor.commands.clearContent(!1):this.editor.commands.setContent(this.parseValue(e),{emitUpdate:!1})}finally{this.applyingExternal=!1,this.lastEmittedJson=t,this.lastEmittedHtml="",this.refreshCharCount()}}}onEditableChange(){var e;null===(e=this.editor)||void 0===e||e.setEditable(!this.disabled&&!this.readonly)}async getJSON(){return this.editor&&!this.editor.isEmpty?this.editor.getJSON():null}async getHtml(){return this.editor?this.sanitizeHtml(this.editor.getHTML()):""}async getText(){var e,t;return null!==(t=null===(e=this.editor)||void 0===e?void 0:e.getText())&&void 0!==t?t:""}async clear(){this.editor&&(this.editor.commands.clearContent(!0),this.coClear.emit())}async focusEditor(){var e;null===(e=this.editor)||void 0===e||e.commands.focus()}async setContent(e){var t;null===(t=this.editor)||void 0===t||t.commands.setContent(e)}async getEditorInstance(){var e;return null!==(e=this.editor)&&void 0!==e?e:null}get imagesEnabled(){var e;const t=this.parsedFeatures;return null!==(e=null==t?void 0:t.image)&&void 0!==e?e:"document"===this.preset}get parsedFeatures(){if(this.features){if("string"==typeof this.features)try{return JSON.parse(this.features)}catch(e){return}return this.features}}parseValue(e){if(!e)return"";try{return JSON.parse(e)}catch(t){return e}}sanitizeHtml(e){return this.rt.sanitize(e,this.preset)}buildOutput(e){const t=e.isEmpty;return{json:t?null:e.getJSON(),html:t?"":this.sanitizeHtml(e.getHTML()),text:e.getText()}}lockBubblePosition(e=1e3){if(!this.bubbleEl)return;const t=this.bubbleEl.getBoundingClientRect();0!==t.width&&(this.bubbleLockPos={x:t.left,y:t.top},this.bubblePositionLocked=!0,clearTimeout(this.bubbleLockTimer),this.bubbleLockTimer=setTimeout((()=>{this.bubblePositionLocked=!1}),e))}applyBubbleFixedPosition(){if(!this.bubbleEl)return;const e=this.bubbleDragged?this.bubbleDragPos:this.bubbleLockPos;this.applyingBubbleLock=!0,this.bubbleEl.style.position="fixed",this.bubbleEl.style.top=e.y+"px",this.bubbleEl.style.left=e.x+"px",this.bubbleEl.style.transform="none",this.bubbleEl.style.visibility="visible",requestAnimationFrame((()=>{this.applyingBubbleLock=!1}))}setupBubbleStyleObserver(e){e.addEventListener("co-bubble-hide",(()=>{this.bubbleDragged=!1,this.bubblePositionLocked=!1,clearTimeout(this.bubbleLockTimer),this.closeBubbleDropdowns(),e.style.position="",e.style.top="",e.style.left="",e.style.transform=""})),e.addEventListener("co-bubble-show",(()=>{this.bubbleDragged=!1,this.bubblePositionLocked=!1})),this.bubbleStyleObserver=new MutationObserver((()=>{this.applyingBubbleLock||(this.bubblePositionLocked||this.bubbleDragged)&&this.applyBubbleFixedPosition()})),this.bubbleStyleObserver.observe(e,{attributes:!0,attributeFilter:["style"]})}suppressBubble(e){this.bubbleEl&&(this.bubbleEl.classList.toggle("co-rte-bubble--suppressed",e),e&&this.closeBubbleDropdowns())}closeBubbleDropdowns(){this.bubbleEl&&(this.bubbleEl.querySelectorAll(".co-rte-bubble__select-dropdown").forEach((e=>{e.style.display="none"})),this.bubbleEl.querySelectorAll(".co-rte-bubble__color-dropdown").forEach((e=>{e.style.display="none"})),this.bubbleEl.querySelectorAll(".co-rte-bubble__panel").forEach((e=>{e.style.display="none"})),this.bubbleEl.querySelectorAll(".co-rte-bubble__overflow-menu").forEach((e=>{e.style.display="none"})),this.bubbleLinkFormEl&&(this.bubbleLinkFormEl.style.display="none"))}refreshCharCount(){var e;const t=null===(e=this.editor)||void 0===e?void 0:e.storage;(null==t?void 0:t.characterCount)&&(this.charCount=t.characterCount.characters(),this.charCountEl&&(this.charCountEl.textContent=null!=this.maxLength?`${this.charCount} / ${this.maxLength}`:""+this.charCount))}syncToolbar(){this.toolbarEl&&this.editor&&this.toolbarEl.editor!==this.editor&&(this.toolbarEl.editor=this.editor),this.toolbarEl&&(this.toolbarEl.imageUpload=this.imageUpload)}get resolvedToolbar(){return"auto"!==this.toolbar?this.toolbar:this.rt.defaultToolbarForPreset(this.preset)}get resolvedFontFamilies(){if(!this.fontFamilies)return e.DEFAULT_FONTS;if("string"==typeof this.fontFamilies)try{return JSON.parse(this.fontFamilies)}catch(t){return e.DEFAULT_FONTS}return this.fontFamilies}get resolvedAccountFonts(){if(this.accountFonts){if("string"==typeof this.accountFonts)try{return JSON.parse(this.accountFonts)}catch(e){return[]}return this.accountFonts}return this._loadedAccountFonts}registerFontFace(t,o){if(o&&t&&!e._registeredFonts.has(t)){e._registeredFonts.add(t);try{const e=new FontFace(t,`url("${o}")`);e.load().then((()=>document.fonts.add(e))).catch((()=>{}))}catch(e){}}}async loadFontsViaCallback(){var e,t,o;if(!this._fontLoaderCalled&&this.fontLoader){this._fontLoaderCalled=!0,this._fontLoaderLoading=!0,null===(e=this._fontDropdownRenderFn)||void 0===e||e.call(this,"");try{const e=await this.fontLoader();Array.isArray(e)&&(this._loadedAccountFonts=e.map((e=>(e.url&&this.registerFontFace(e.label,e.url),{label:e.label,value:e.value}))))}catch(e){console.error("[co-rich-text-editor] fontLoader error",e)}finally{this._fontLoaderLoading=!1;const e=(null===(t=this._fontDropdownSearchInput)||void 0===t?void 0:t.value)||"";null===(o=this._fontDropdownRenderFn)||void 0===o||o.call(this,e)}}}get helperIcon(){switch(this.status){case"error":case"warning":return"warning-circle";case"success":return"check-circle";default:return"info"}}createBubbleElement(){const e=document.createElement("div");e.className="co-rte-bubble",e.style.visibility="hidden",e.style.position="absolute",e.style.top="0",e.style.left="0",e.addEventListener("mousedown",(e=>{"INPUT"!==e.target.tagName&&e.preventDefault(),this.lockBubblePosition()})),this.bubbleOutsideClickHandler=t=>{e.contains(t.target)||this.closeBubbleDropdowns()},document.addEventListener("click",this.bubbleOutsideClickHandler,!0),this.setupBubbleStyleObserver(e);const t="document"===this.preset;if(t){const t=document.createElement("div");t.className="co-rte-bubble__drag-handle",t.innerHTML='<co-icon name="dots-six-vertical" size="14"></co-icon>',t.addEventListener("mousedown",(t=>{t.preventDefault(),t.stopPropagation();const o=e.getBoundingClientRect();this.bubbleDragOffset={x:t.clientX-o.left,y:t.clientY-o.top},this.bubbleDragged||(this.bubbleDragPos={x:o.left,y:o.top}),this.bubbleDragged=!0,this.bubbleDragMoveHandler=t=>{this.bubbleDragPos.x=t.clientX-this.bubbleDragOffset.x,this.bubbleDragPos.y=t.clientY-this.bubbleDragOffset.y,e.style.position="fixed",e.style.top=this.bubbleDragPos.y+"px",e.style.left=this.bubbleDragPos.x+"px",e.style.transform="none",e.style.visibility="visible"},this.bubbleDragEndHandler=()=>{document.removeEventListener("mousemove",this.bubbleDragMoveHandler),document.removeEventListener("mouseup",this.bubbleDragEndHandler)},document.addEventListener("mousemove",this.bubbleDragMoveHandler),document.addEventListener("mouseup",this.bubbleDragEndHandler)})),e.appendChild(t)}const o=document.createElement("div");o.className="co-rte-bubble__row";let r=null,i=null,n=null,c=null,s=null,l=null;if(t){const e=this.createBubbleFontFamilySelect();o.appendChild(e),r=this.createBubbleFontSizePanel(),o.appendChild(r.wrap),i=this.createBubbleFontWeightPanel(),o.appendChild(i.wrap),o.appendChild(this.createSep());const t=this.createBubbleColorPicker("textColor",(e=>{this.editor&&this.editor.chain().focus().setColor(e).run()}));o.appendChild(t),o.appendChild(this.createSep())}const b=a(this.locale),d=[{action:"bold",icon:"text-b",label:b.bold,check:"bold"},{action:"italic",icon:"text-italic",label:b.italic,check:"italic"}];"comment"!==this.preset&&d.push({action:"underline",icon:"text-underline",label:b.underline,check:"underline"}),d.forEach((({action:e,icon:t,label:r,check:i})=>{const n=this.createBubbleBtn(t,r,e,i,(()=>{if(!this.editor)return;const t=this.editor.chain().focus();switch(e){case"bold":t.toggleBold().run();break;case"italic":t.toggleItalic().run();break;case"underline":t.toggleUnderline().run()}}));o.appendChild(n)})),o.appendChild(this.createSep()),(t||"email"===this.preset)&&([{align:"left",icon:"text-align-left",label:b.alignLeft},{align:"center",icon:"text-align-center",label:b.center},{align:"right",icon:"text-align-right",label:b.alignRight},{align:"justify",icon:"text-align-justify",label:b.justify}].forEach((({align:e,icon:t,label:r})=>{const i=document.createElement("button");i.type="button",i.className="co-rte-bubble__btn",i.title=r,i.setAttribute("aria-label",r),i.setAttribute("data-action","textAlign"),i.setAttribute("data-align",e),i.innerHTML=`<co-icon name="${t}" size="16"></co-icon>`,i.addEventListener("click",(()=>{this.editor&&this.editor.chain().focus().setTextAlign(e).run()})),o.appendChild(i)})),o.appendChild(this.createSep())),"comment"===this.preset||t||(o.appendChild(this.createBubbleBtn("list-bullets",b.bulletList,"bulletList","bulletList",(()=>{this.editor&&this.editor.chain().focus().toggleBulletList().run()}))),o.appendChild(this.createBubbleBtn("list-numbers",b.orderedList,"orderedList","orderedList",(()=>{this.editor&&this.editor.chain().focus().toggleOrderedList().run()}))),o.appendChild(this.createSep()));const u=this.createBubbleBtn("link",b.link,"link","link",(()=>{this.editor&&this.toggleBubbleLinkForm(!0)}));o.appendChild(u),t&&(o.appendChild(this.createSep()),n=this.createBubbleLineHeightPanel(),c=this.createBubbleLetterSpacingPanel(),s=this.createBubbleBgColorPanel(),l=this.createBubbleOverflowMenu({lineHeight:n,letterSpacing:c,bgColor:s}),o.appendChild(l.overflowWrap)),e.appendChild(o),t&&(r&&e.appendChild(r.panelEl),i&&e.appendChild(i.panelEl),n&&e.appendChild(n),c&&e.appendChild(c),s&&e.appendChild(s));const h=document.createElement("div");h.className="co-rte-bubble__link-form",h.style.display="none",this.bubbleLinkFormEl=h;const p=document.createElement("input");p.type="url",p.className="co-rte-bubble__link-input",p.placeholder="https://...",this.bubbleLinkInputEl=p,p.addEventListener("keydown",(e=>{"Enter"===e.key&&this.submitBubbleLinkImperative(),"Escape"===e.key&&(e.stopPropagation(),this.toggleBubbleLinkForm(!1))}));const f=document.createElement("button");f.type="button",f.className="co-rte-bubble__link-btn",f.innerHTML='<co-icon name="check" size="14"></co-icon>',f.addEventListener("click",(()=>this.submitBubbleLinkImperative()));const m=document.createElement("button");return m.type="button",m.className="co-rte-bubble__link-btn co-rte-bubble__link-unlink",m.title=b.unlinkLink,m.innerHTML='<co-icon name="link-break" size="14"></co-icon>',m.addEventListener("click",(()=>{this.editor&&(this.editor.chain().focus().unsetLink().run(),this.toggleBubbleLinkForm(!1))})),this.bubbleLinkUnlinkEl=m,h.appendChild(p),h.appendChild(f),h.appendChild(m),e.appendChild(h),e}createSep(){const e=document.createElement("span");return e.className="co-rte-bubble__sep",e}positionDropdown(e,t){const o=e.getBoundingClientRect();t.removeAttribute("data-position"),t.style.removeProperty("left"),t.style.removeProperty("transform");const r=t.offsetWidth||224,i=window.innerHeight-o.bottom;if(t.setAttribute("data-position",i>=(t.offsetHeight||320)||i>o.top?"below":"above"),t.classList.contains("co-rte-bubble__color-dropdown")){const o=(e.parentElement||e).getBoundingClientRect(),i=o.left+o.width/2-r/2,n=i+r,a=8;i<a?(t.style.left="0",t.style.transform="none"):n>window.innerWidth-a&&(t.style.left="auto",t.style.right="0",t.style.transform="none")}}positionPanelNearBubble(e){if(!this.bubbleEl)return;const t=this.bubbleEl.querySelector(".co-rte-bubble__overflow-menu"),o=t&&"none"!==t.style.display?t.getBoundingClientRect():this.bubbleEl.getBoundingClientRect(),r=e.offsetHeight||320,i=e.offsetWidth||230;let n=o.top;n+r>window.innerHeight-8&&(n=window.innerHeight-8-r),n<8&&(n=8);let a=o.left-i-4;a<8&&(a=o.right+4),a+i>window.innerWidth-8&&(a=window.innerWidth-8-i),e.style.position="fixed",e.style.top=n+"px",e.style.left=a+"px",e.style.bottom="auto",e.style.right="auto",e.style.transform="none",e.removeAttribute("data-position")}createBubbleBtn(e,t,o,r,i){const n=document.createElement("button");return n.type="button",n.className="co-rte-bubble__btn",n.title=t,n.setAttribute("aria-label",t),n.setAttribute("data-action",o),n.setAttribute("data-check",r),n.innerHTML=`<co-icon name="${e}" size="16"></co-icon>`,n.addEventListener("click",i),n}createBubbleFontFamilySelect(){const e=document.createElement("div");e.className="co-rte-bubble__select co-rte-bubble__select--font",e.setAttribute("data-select","fontFamily");const t=document.createElement("button");t.type="button",t.className="co-rte-bubble__select-trigger",t.innerHTML='<span class="co-rte-bubble__select-label">Sans-serif</span><co-icon name="caret-down" size="12"></co-icon>';const o=document.createElement("div");o.className="co-rte-bubble__select-dropdown co-rte-bubble__select-dropdown--font",o.style.display="none";const r=document.createElement("div");r.className="co-rte-bubble__font-search";const i=document.createElement("input");i.type="text",i.className="co-rte-bubble__font-search-input",i.placeholder=a(this.locale).searchFont,r.appendChild(i),o.appendChild(r);const n=document.createElement("div");n.className="co-rte-bubble__font-list",o.appendChild(n);const c=(e,r)=>{const n=document.createElement("button");return n.type="button",n.className="co-rte-bubble__select-option",n.setAttribute("data-value",r),n.textContent=e,n.style.fontFamily=r.includes(",")?r:`"${r}", sans-serif`,n.addEventListener("click",(()=>{if(!this.editor)return;this.editor.chain().focus().setFontFamily(r).run(),o.style.display="none";const n=t.querySelector(".co-rte-bubble__select-label");n&&(n.textContent=e),i.value="",this.coFontPopupHide.emit()})),n},s=e=>{n.innerHTML="";const t=e.toLowerCase(),o=this.resolvedAccountFonts,r=this.resolvedFontFamilies,i=t?o.filter((e=>e.label.toLowerCase().includes(t))):o,s=t?r.filter((e=>e.label.toLowerCase().includes(t))):r;if(!i.length&&!s.length){const e=document.createElement("div");return e.className="co-rte-bubble__font-empty",e.textContent=a(this.locale).noResults,void n.appendChild(e)}if((this.fontsLoading||this._fontLoaderLoading)&&!i.length){const e=document.createElement("div");e.className="co-rte-bubble__font-empty",e.textContent=a(this.locale).loadingFonts,n.appendChild(e)}if(i.length){const e=document.createElement("div");e.className="co-rte-bubble__font-section-header",e.textContent=a(this.locale).importedFonts,n.appendChild(e),i.forEach((({label:e,value:t})=>n.appendChild(c(e,t))))}if(s.length){const e=document.createElement("div");e.className="co-rte-bubble__font-section-header",e.textContent=a(this.locale).systemFonts,n.appendChild(e),s.forEach((({label:e,value:t})=>n.appendChild(c(e,t))))}};return i.addEventListener("input",(()=>s(i.value))),this._fontDropdownRenderFn=s,this._fontDropdownSearchInput=i,t.addEventListener("click",(()=>{const r=e.closest(".co-rte-bubble");r&&(r.querySelectorAll(".co-rte-bubble__select-dropdown").forEach((e=>{e!==o&&(e.style.display="none")})),r.querySelectorAll(".co-rte-bubble__color-dropdown").forEach((e=>{e.style.display="none"})));const n="none"!==o.style.display;o.style.display=n?"none":"block",n?this.coFontPopupHide.emit():(this.coFontPopupShow.emit(),this.loadFontsViaCallback(),this.positionDropdown(t,o),s(""),setTimeout((()=>i.focus()),0))})),e.appendChild(t),e.appendChild(o),e}createBubbleSelect(e,t,o,r){const i=document.createElement("div");i.className="co-rte-bubble__select",i.setAttribute("data-select",e);const n=document.createElement("button");n.type="button",n.className="co-rte-bubble__select-trigger",n.innerHTML=`<span class="co-rte-bubble__select-label">${o}</span><co-icon name="caret-down" size="12"></co-icon>`;const a=document.createElement("div");return a.className="co-rte-bubble__select-dropdown",a.style.display="none",t.forEach((({label:t,value:o})=>{const i=document.createElement("button");i.type="button",i.className="co-rte-bubble__select-option",i.setAttribute("data-value",o),i.textContent=t,"fontWeight"===e&&(i.style.fontWeight=o),i.addEventListener("click",(()=>{r(o),a.style.display="none";const e=n.querySelector(".co-rte-bubble__select-label");e&&(e.textContent=t)})),a.appendChild(i)})),n.addEventListener("click",(()=>{const e=i.closest(".co-rte-bubble");e&&(e.querySelectorAll(".co-rte-bubble__select-dropdown").forEach((e=>{e!==a&&(e.style.display="none")})),e.querySelectorAll(".co-rte-bubble__color-dropdown").forEach((e=>{e.style.display="none"})));const t="none"!==a.style.display;a.style.display=t?"none":"block",t||this.positionDropdown(n,a)})),i.appendChild(n),i.appendChild(a),i}createBubbleColorPicker(e,t){const o=document.createElement("div");o.className="co-rte-bubble__color",o.setAttribute("data-color",e);const r="textColor"===e?"":"highlighter",i=document.createElement("button");i.type="button",i.className="co-rte-bubble__btn";const n=a(this.locale);i.title="textColor"===e?n.textColor:n.backgroundColor,i.innerHTML="textColor"===e?'<span class="co-rte-bubble__color-indicator"><span class="co-rte-bubble__color-letter">A</span><span class="co-rte-bubble__color-bar" style="background:#000000"></span></span>':`<co-icon name="${r}" size="16"></co-icon>`;const c=document.createElement("div");c.className="co-rte-bubble__color-dropdown",c.style.display="none";const s="textColor"===e?n.textColor:n.backgroundColor,{resetDrag:l}=this.addDragHeader(c,s);c.addEventListener("mousedown",(e=>{"INPUT"!==e.target.tagName&&e.preventDefault(),this.lockBubblePosition()}));const b=document.createElement("div");b.className="co-rte-bubble__color-grid",["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#efefef","#f3f3f3","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff","#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#cfe2f3","#d9d2e9","#ead1dc"].forEach((e=>{const o=document.createElement("button");o.type="button",o.className="co-rte-bubble__color-swatch",o.style.background=e,"#ffffff"===e&&(o.style.border="1px solid #e0e0e0"),o.addEventListener("click",(()=>{t(e),c.style.display="none"})),b.appendChild(o)}));const d=document.createElement("div");d.className="co-rte-bubble__color-hex";const u=document.createElement("input");u.type="text",u.className="co-rte-bubble__color-hex-input",u.placeholder="#hex",u.maxLength=7,u.addEventListener("keydown",(e=>{if("Enter"===e.key){const e=u.value.trim();/^#[0-9a-fA-F]{3,6}$/.test(e)&&(t(e),c.style.display="none",u.value="")}}));const h=document.createElement("button");return h.type="button",h.className="co-rte-bubble__color-clear",h.innerHTML='<co-icon name="x" size="12"></co-icon> '+n.noColor,h.addEventListener("click",(()=>{this.editor&&("textColor"===e?this.editor.chain().focus().unsetColor().run():this.editor.chain().focus().unsetHighlight().run(),c.style.display="none")})),c.appendChild(b),d.appendChild(u),c.appendChild(d),c.appendChild(h),i.addEventListener("click",(()=>{const e=o.closest(".co-rte-bubble");e&&(e.querySelectorAll(".co-rte-bubble__select-dropdown").forEach((e=>{e.style.display="none"})),e.querySelectorAll(".co-rte-bubble__color-dropdown").forEach((e=>{e!==c&&(e.style.display="none")}))),"none"!==c.style.display?c.style.display="none":(l(),c.style.position="",c.style.top="",c.style.left="",c.style.bottom="",c.style.right="",c.style.transform="",c.style.display="block",this.positionDropdown(i,c))})),o.appendChild(i),o.appendChild(c),o}closeAllBubblePopups(...e){if(!this.bubbleEl)return;const t=e.filter(Boolean);this.bubbleEl.querySelectorAll(".co-rte-bubble__select-dropdown").forEach((e=>{t.includes(e)||(e.style.display="none")})),this.bubbleEl.querySelectorAll(".co-rte-bubble__color-dropdown").forEach((e=>{t.includes(e)||(e.style.display="none")})),this.bubbleEl.querySelectorAll(".co-rte-bubble__panel").forEach((e=>{t.includes(e)||(e.style.display="none")})),this.bubbleEl.querySelectorAll(".co-rte-bubble__overflow-menu").forEach((e=>{t.includes(e)||(e.style.display="none")})),this.bubbleLinkFormEl&&!t.includes(this.bubbleLinkFormEl)&&(this.bubbleLinkFormEl.style.display="none")}addDragHeader(e,t){let o=!1,r={x:0,y:0},i={x:0,y:0};const n=document.createElement("div");n.className="co-rte-bubble__panel-header";const a=document.createElement("div");a.className="co-rte-bubble__panel-drag",a.innerHTML='<co-icon name="dots-six" size="14"></co-icon>';const c=document.createElement("span");c.className="co-rte-bubble__panel-title",c.textContent=t;const s=document.createElement("button");return s.type="button",s.className="co-rte-bubble__panel-close",s.innerHTML='<co-icon name="x" size="14"></co-icon>',s.addEventListener("click",(()=>{e.style.display="none"})),n.appendChild(a),n.appendChild(c),n.appendChild(s),a.addEventListener("mousedown",(t=>{t.preventDefault(),t.stopPropagation();const n=e.getBoundingClientRect();i={x:t.clientX-n.left,y:t.clientY-n.top},o||(r={x:n.left,y:n.top}),o=!0;const a=t=>{r.x=t.clientX-i.x,r.y=t.clientY-i.y,e.style.position="fixed",e.style.top=r.y+"px",e.style.left=r.x+"px",e.style.bottom="auto",e.style.right="auto",e.style.transform="none",e.removeAttribute("data-position")},c=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",c)})),e.insertBefore(n,e.firstChild),{header:n,resetDrag:()=>{o=!1}}}createBubblePanel(e){const t=document.createElement("div");t.className="co-rte-bubble__select",t.setAttribute("data-select",e.name);const o=document.createElement("button");o.type="button",o.className="co-rte-bubble__select-trigger",o.innerHTML=`<span class="co-rte-bubble__select-label">${e.triggerLabel}</span><co-icon name="caret-down" size="12"></co-icon>`;const r=document.createElement("div");r.className="co-rte-bubble__panel",r.setAttribute("data-panel",e.name),r.style.display="none";const i=document.createElement("div");i.className="co-rte-bubble__panel-header";const n=document.createElement("div");n.className="co-rte-bubble__panel-drag",n.innerHTML='<co-icon name="dots-six" size="14"></co-icon>';const a=document.createElement("span");a.className="co-rte-bubble__panel-title",a.textContent=e.title;const c=document.createElement("button");c.type="button",c.className="co-rte-bubble__panel-close",c.innerHTML='<co-icon name="x" size="14"></co-icon>',c.addEventListener("click",(()=>{r.style.display="none"})),i.appendChild(n),i.appendChild(a),i.appendChild(c),r.appendChild(i);let s=!1,l={x:0,y:0},b={x:0,y:0};if(n.addEventListener("mousedown",(e=>{e.preventDefault(),e.stopPropagation();const t=r.getBoundingClientRect();b={x:e.clientX-t.left,y:e.clientY-t.top},s||(l={x:t.left,y:t.top}),s=!0;const o=e=>{l.x=e.clientX-b.x,l.y=e.clientY-b.y,r.style.position="fixed",r.style.top=l.y+"px",r.style.left=l.x+"px",r.style.bottom="auto",r.style.right="auto",r.style.transform="none",r.removeAttribute("data-position")},i=()=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",i)})),e.hasCustomInput){const t=document.createElement("div");t.className="co-rte-bubble__panel-input-wrap";const o=document.createElement("input");o.type=e.inputType||"text",o.className="co-rte-bubble__panel-input",o.placeholder=e.inputPlaceholder||"",o.addEventListener("mousedown",(e=>e.stopPropagation())),o.addEventListener("keydown",(t=>{if("Enter"===t.key){const t=o.value.trim();t&&e.onCustomInput&&(e.onCustomInput(t),o.value="")}"Escape"===t.key&&(t.stopPropagation(),r.style.display="none")})),t.appendChild(o),r.appendChild(t)}const d=document.createElement("div");return d.className="co-rte-bubble__panel-options",e.options.forEach((t=>{const o=document.createElement("button");o.type="button",o.className="co-rte-bubble__panel-option",o.setAttribute("data-value",t.value),e.renderOption?e.renderOption(t,o):o.textContent=t.label,o.addEventListener("click",(()=>{e.onSelect(t.value),r.style.display="none",s=!1})),d.appendChild(o)})),r.appendChild(d),r.addEventListener("mousedown",(e=>{"INPUT"!==e.target.tagName&&e.preventDefault(),this.lockBubblePosition()})),o.addEventListener("click",(()=>{this.closeAllBubblePopups(r),"none"!==r.style.display?r.style.display="none":(s=!1,r.style.position="",r.style.top="",r.style.left="",r.style.bottom="",r.style.right="",r.style.transform="",r.style.display="block",this.positionDropdown(o,r))})),t.appendChild(o),{wrap:t,panelEl:r,updateLabel:e=>{const t=o.querySelector(".co-rte-bubble__select-label");t&&(t.textContent=e)}}}createBubbleFontSizePanel(){const e=a(this.locale),t=[{label:e.title,value:"h1"},{label:e.heading1,value:"h2"},{label:e.heading2,value:"h3"},{label:"---",value:"---"},...["8px","10px","12px","14px","16px","18px","20px","24px","28px","32px","36px","48px","64px","72px"].map((e=>({label:e,value:e})))];return this.createBubblePanel({name:"fontSize",title:e.fontSize,triggerLabel:"16px",hasCustomInput:!0,inputType:"number",inputPlaceholder:e.writeSize,options:t,renderOption:(e,t)=>{if("---"===e.value)return t.className="co-rte-bubble__panel-sep",t.disabled=!0,void(t.style.pointerEvents="none");"h1"===e.value?(t.textContent=e.label,t.style.fontSize="24px",t.style.fontWeight="700",t.style.padding="6px 8px"):"h2"===e.value?(t.textContent=e.label,t.style.fontSize="18px",t.style.fontWeight="700",t.style.padding="5px 8px"):"h3"===e.value?(t.textContent=e.label,t.style.fontSize="15px",t.style.fontWeight="700",t.style.padding="4px 8px"):(t.textContent=e.label,t.style.fontSize=Math.min(parseInt(e.value),36)+"px",t.style.lineHeight="1.3")},onSelect:e=>{if(!this.editor||"---"===e)return;const t=this.editor.chain().focus();"h1"===e?t.toggleHeading({level:1}).run():"h2"===e?t.toggleHeading({level:2}).run():"h3"===e?t.toggleHeading({level:3}).run():t.setFontSize(e).run()},onCustomInput:e=>{if(!this.editor)return;const t=parseInt(e);t>0&&this.editor.chain().focus().setFontSize(t+"px").run()}})}createBubbleFontWeightPanel(){return this.createBubblePanel({name:"fontWeight",title:a(this.locale).fontWeight,triggerLabel:"Regular",hasCustomInput:!1,options:[{label:"Thin",value:"100"},{label:"Extra Light",value:"200"},{label:"Light",value:"300"},{label:"Regular",value:"400"},{label:"Medium",value:"500"},{label:"Semi Bold",value:"600"},{label:"Bold",value:"700"},{label:"Extra Bold",value:"800"},{label:"Black",value:"900"}],renderOption:(e,t)=>{t.style.fontWeight=e.value,t.innerHTML=`<span class="co-rte-bubble__panel-opt-row"><span>${e.label}</span><span class="co-rte-bubble__panel-opt-value">${e.value}</span></span>`},onSelect:e=>{this.editor&&this.editor.chain().focus().setFontWeight(e).run()}})}createBubbleLineHeightPanel(){const{panelEl:e}=this.createBubblePanel({name:"lineHeight",title:a(this.locale).lineSpacing,triggerLabel:"1.5",hasCustomInput:!0,inputPlaceholder:"1.5, 20px, 150%...",options:[{label:"0.5",value:"0.5"},{label:"1",value:"1"},{label:"1.15",value:"1.15"},{label:"1.5",value:"1.5"},{label:"1.75",value:"1.75"},{label:"2",value:"2"},{label:"2.5",value:"2.5"},{label:"3",value:"3"},{label:"---",value:"---"},{label:"16px",value:"16px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"32px",value:"32px"},{label:"---",value:"---2"},{label:"100%",value:"100%"},{label:"150%",value:"150%"},{label:"200%",value:"200%"}],renderOption:(e,t)=>{if(e.value.startsWith("---"))return t.className="co-rte-bubble__panel-sep",t.disabled=!0,void(t.style.pointerEvents="none");t.textContent=e.label},onSelect:e=>{this.editor&&!e.startsWith("---")&&this.editor.chain().focus().setLineHeight(e).run()},onCustomInput:e=>{this.editor&&this.editor.chain().focus().setLineHeight(e).run()}});return e}createBubbleLetterSpacingPanel(){const{panelEl:e}=this.createBubblePanel({name:"letterSpacing",title:a(this.locale).letterSpacing,triggerLabel:a(this.locale).normal,hasCustomInput:!0,inputPlaceholder:"Custom (em)...",options:[{label:"-0.05em",value:"-0.05em"},{label:"Normal",value:"normal"},{label:"0.05em",value:"0.05em"},{label:"0.1em",value:"0.1em"},{label:"0.2em",value:"0.2em"}],onSelect:e=>{this.editor&&("normal"===e?this.editor.chain().focus().unsetLetterSpacing().run():this.editor.chain().focus().setLetterSpacing(e).run())},onCustomInput:e=>{if(!this.editor)return;const t=e.includes("em")||e.includes("px")?e:e+"em";this.editor.chain().focus().setLetterSpacing(t).run()}});return e}createBubbleBgColorPanel(){const e=this.createBubbleColorPicker("bgColor",(e=>{this.editor&&this.editor.chain().focus().toggleHighlight({color:e}).run()})),t=e.querySelector(".co-rte-bubble__btn");return t&&(t.style.display="none"),e}createBubbleOverflowMenu(e){const t=document.createElement("div");t.className="co-rte-bubble__overflow";const o=document.createElement("button");o.type="button",o.className="co-rte-bubble__btn";const r=a(this.locale);o.title=r.moreOptions,o.setAttribute("aria-label",r.moreOptions),o.innerHTML='<co-icon name="dots-three" size="16"></co-icon>';const i=document.createElement("div");i.className="co-rte-bubble__overflow-menu",i.style.display="none";const{resetDrag:n}=this.addDragHeader(i,r.moreOptions);i.addEventListener("mousedown",(e=>{"INPUT"!==e.target.tagName&&e.preventDefault(),this.lockBubblePosition()})),[{icon:"text-strikethrough",label:r.strikethrough,action:"strike",check:"strike",type:"toggle"},{icon:"highlighter",label:r.backgroundColor,action:"bgColor",type:"panel",panel:e.bgColor},{icon:"list-bullets",label:r.bulletList,action:"bulletList",check:"bulletList",type:"toggle"},{icon:"list-numbers",label:r.orderedList,action:"orderedList",check:"orderedList",type:"toggle"},{icon:"text-superscript",label:r.superscript,action:"superscript",check:"superscript",type:"toggle"},{icon:"text-subscript",label:r.subscript,action:"subscript",check:"subscript",type:"toggle"},{icon:"line-segments",label:r.lineSpacing,action:"lineHeight",type:"panel",panel:e.lineHeight,valueAttr:"lineHeight"},{icon:"text-aa",label:r.letterSpacing,action:"letterSpacing",type:"panel",panel:e.letterSpacing,valueAttr:"letterSpacing"},{icon:"minus",label:r.horizontalRule,action:"horizontalRule",type:"toggle"},{icon:"eraser",label:r.clearFormat,action:"clearFormat",type:"toggle"}].forEach((e=>{if("lineHeight"===e.action||"horizontalRule"===e.action){const e=document.createElement("div");e.className="co-rte-bubble__overflow-sep",i.appendChild(e)}const t=document.createElement("button");t.type="button",t.className="co-rte-bubble__overflow-item",t.setAttribute("data-overflow-item",e.action),e.check&&t.setAttribute("data-check",e.check);let o="";e.valueAttr&&(o=`<span class="co-rte-bubble__overflow-value" data-overflow-value="${e.valueAttr}"></span>`),t.innerHTML=`<co-icon name="${e.icon}" size="16"></co-icon><span>${e.label}</span>${o}`,t.addEventListener("click",(()=>{if(!this.editor)return;if("panel"===e.type&&e.panel){if("bgColor"===e.action){const t=e.panel.querySelector(".co-rte-bubble__color-dropdown");if(t){const e="none"!==t.style.display;this.closeAllBubblePopups(i,e?void 0:t),t.style.display=e?"none":"block",e||this.positionPanelNearBubble(t)}}else{const t="none"!==e.panel.style.display;this.closeAllBubblePopups(i,t?void 0:e.panel),e.panel.style.display=t?"none":"block",t||this.positionPanelNearBubble(e.panel)}return}const t=this.editor.chain().focus();switch(e.action){case"strike":t.toggleStrike().run();break;case"bulletList":t.toggleBulletList().run();break;case"orderedList":t.toggleOrderedList().run();break;case"superscript":t.toggleSuperscript().run();break;case"subscript":t.toggleSubscript().run();break;case"horizontalRule":t.setHorizontalRule().run(),i.style.display="none";break;case"clearFormat":t.unsetAllMarks().clearNodes().run(),i.style.display="none"}})),i.appendChild(t)}));const c=document.createElement("div");c.className="co-rte-bubble__overflow-table-section",c.style.display="none";const s=document.createElement("div");s.className="co-rte-bubble__overflow-sep",c.appendChild(s);const l=document.createElement("div");l.className="co-rte-bubble__overflow-section-title",l.textContent=r.tableOptions,c.appendChild(l),[{action:"addColumnBefore",icon:"columns-plus-left",label:r.addColumnBefore},{action:"addColumnAfter",icon:"columns-plus-right",label:r.addColumnAfter},{action:"addRowBefore",icon:"rows-plus-top",label:r.addRowAbove},{action:"addRowAfter",icon:"rows-plus-bottom",label:r.addRowBelow},{action:"mergeCells",icon:"arrows-merge",label:r.mergeCells},{action:"splitCell",icon:"arrows-split",label:r.splitCell},{action:"toggleHeaderRow",icon:"rows",label:r.headerRow}].forEach((({action:e,icon:t,label:o})=>{const r=document.createElement("button");r.type="button",r.className="co-rte-bubble__overflow-item",r.setAttribute("data-overflow-item",e),"toggleHeaderRow"===e&&r.setAttribute("data-check","toggleHeaderRow"),r.innerHTML=`<co-icon name="${t}" size="16"></co-icon><span>${o}</span>`,r.addEventListener("click",(()=>{if(!this.editor)return;const t=this.editor.chain().focus();switch(e){case"addColumnAfter":t.addColumnAfter().run();break;case"addColumnBefore":t.addColumnBefore().run();break;case"addRowAfter":t.addRowAfter().run();break;case"addRowBefore":t.addRowBefore().run();break;case"mergeCells":t.mergeCells().run();break;case"splitCell":t.splitCell().run();break;case"toggleHeaderRow":t.toggleHeaderRow().run()}})),c.appendChild(r)}));const b=document.createElement("div");return b.className="co-rte-bubble__overflow-sep",c.appendChild(b),[{action:"deleteColumn",icon:"minus-square",label:r.deleteColumn},{action:"deleteRow",icon:"x-square",label:r.deleteRow},{action:"deleteTable",icon:"trash",label:r.deleteTable}].forEach((({action:e,icon:t,label:o})=>{const r=document.createElement("button");r.type="button",r.className="co-rte-bubble__overflow-item co-rte-bubble__overflow-item--danger",r.setAttribute("data-overflow-item",e),r.innerHTML=`<co-icon name="${t}" size="16"></co-icon><span>${o}</span>`,r.addEventListener("click",(()=>{if(!this.editor)return;const t=this.editor.chain().focus();switch(e){case"deleteColumn":t.deleteColumn().run();break;case"deleteRow":t.deleteRow().run();break;case"deleteTable":t.deleteTable().run(),i.style.display="none"}})),c.appendChild(r)})),i.appendChild(c),o.addEventListener("click",(()=>{this.closeAllBubblePopups(i),"none"!==i.style.display?i.style.display="none":(n(),i.style.position="",i.style.top="",i.style.left="",i.style.bottom="",i.style.right="",i.style.transform="",i.style.display="block",this.positionDropdown(o,i))})),t.appendChild(o),t.appendChild(i),{overflowWrap:t,overflowMenu:i}}toggleBubbleLinkForm(e){var t,o;if(this.bubbleLinkFormEl&&this.bubbleLinkInputEl&&(this.bubbleLinkFormEl.style.display=e?"flex":"none",e)){const e=(null===(t=this.editor)||void 0===t?void 0:t.isActive("link"))&&(null===(o=this.editor.getAttributes("link"))||void 0===o?void 0:o.href)||"";this.bubbleLinkInputEl.value=e,this.bubbleLinkUnlinkEl&&(this.bubbleLinkUnlinkEl.style.display=e?"flex":"none"),setTimeout((()=>{var e;return null===(e=this.bubbleLinkInputEl)||void 0===e?void 0:e.focus()}),0)}}submitBubbleLinkImperative(){if(!this.editor||!this.bubbleLinkInputEl)return;const e=this.bubbleLinkInputEl.value.trim();e?(this.editor.chain().focus().setLink({href:e}).run(),this.toggleBubbleLinkForm(!1)):this.toggleBubbleLinkForm(!1)}updateBubbleActiveStates(){if(!this.editor||!this.bubbleEl)return;this.bubbleEl.querySelectorAll(".co-rte-bubble__btn[data-check]").forEach((e=>{const t=e.getAttribute("data-check");t&&e.classList.toggle("co-rte-bubble__btn--active",this.editor.isActive(t))})),this.bubbleEl.querySelectorAll(".co-rte-bubble__btn[data-align]").forEach((e=>{const t=e.getAttribute("data-align");t&&e.classList.toggle("co-rte-bubble__btn--active",this.editor.isActive({textAlign:t}))}));const e=this.bubbleEl.querySelector('[data-select="fontFamily"] .co-rte-bubble__select-label');if(e){const t=this.editor.getAttributes("textStyle"),o=(null==t?void 0:t.fontFamily)||"";e.textContent=o?o.split(",")[0].replace(/['"]/g,"").trim():"Sans-serif"}const t=this.bubbleEl.querySelector('[data-select="fontSize"] .co-rte-bubble__select-label');if(t){const e=this.editor.getAttributes("textStyle"),o=a(this.locale);t.textContent=this.editor.isActive("heading",{level:1})?o.title:this.editor.isActive("heading",{level:2})?o.headingAbbr1:this.editor.isActive("heading",{level:3})?o.headingAbbr2:(null==e?void 0:e.fontSize)||"16px"}const o=this.bubbleEl.querySelector('[data-select="fontWeight"] .co-rte-bubble__select-label');if(o){const e=this.editor.getAttributes("textStyle");o.textContent={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi-bold",700:"Bold",800:"Extra-bold",900:"Black"}[(null==e?void 0:e.fontWeight)||"400"]||"Regular"}this.bubbleEl.querySelectorAll(".co-rte-bubble__overflow-item[data-check]").forEach((e=>{const t=e.getAttribute("data-check");t&&e.classList.toggle("co-rte-bubble__overflow-item--active",this.editor.isActive(t))}));const r=this.bubbleEl.querySelector('[data-overflow-value="lineHeight"]');if(r){const e=this.editor.getAttributes("paragraph"),t=this.editor.getAttributes("heading");r.textContent=(null==e?void 0:e.lineHeight)||(null==t?void 0:t.lineHeight)||""}const i=this.bubbleEl.querySelector('[data-overflow-value="letterSpacing"]');if(i){const e=this.editor.getAttributes("textStyle");i.textContent=(null==e?void 0:e.letterSpacing)||""}const n=this.bubbleEl.querySelector(".co-rte-bubble__color-bar");if(n){const e=this.editor.getAttributes("textStyle");n.style.background=(null==e?void 0:e.color)||"#000000"}const c=this.bubbleEl.querySelector(".co-rte-bubble__overflow-table-section");if(c){const e=this.editor.isActive("table");if(c.style.display=e?"block":"none",e){const e=c.querySelector('[data-overflow-item="toggleHeaderRow"]');if(e){const t=this.editor.view,{$anchor:o}=this.editor.state.selection;let r=o.depth,i=!1;for(;r>0;){if("table"===o.node(r).type.name){const e=t.nodeDOM(o.start(r)-1);if(e){const t=(e.querySelector("table")||e).querySelector("tr");i=!!t&&null!==t.querySelector("th")}break}r--}e.classList.toggle("co-rte-bubble__overflow-item--active",i)}}}}createImageLayoutBar(){const t=document.createElement("div");t.className="co-rte-img-layout",t.style.display="none",t.addEventListener("mousedown",(e=>{e.preventDefault(),e.stopPropagation()}));const o=a(this.locale),r={inline:o.imageLayoutInline,"wrap-left":o.imageLayoutWrapLeft,"wrap-right":o.imageLayoutWrapRight,center:o.imageLayoutCenter,"full-width":o.imageLayoutFullWidth};return["inline","wrap-left","wrap-right","center","full-width"].forEach((o=>{const i=document.createElement("button");i.type="button",i.className="co-rte-img-layout__btn",i.setAttribute("data-layout",o),i.setAttribute("data-tooltip",r[o]||o),i.setAttribute("aria-label",r[o]||o),i.innerHTML=`<co-icon name="${e.IMG_LAYOUT_ICONS[o]}" size="18"></co-icon>`,i.addEventListener("click",(()=>this.setImageLayout(o))),t.appendChild(i)})),t}setImageLayout(e){if(!this.editor||!this.contentEl)return;const{state:t}=this.editor,o=t.selection;if("NodeSelection"!==o.constructor.name)return;const r=o.node;if("image"!==(null==r?void 0:r.type.name))return;const i=o.from,n=t.tr.setNodeMarkup(i,void 0,Object.assign(Object.assign({},r.attrs),{imageLayout:e}));this.editor.view.dispatch(n),this.editor.commands.setNodeSelection(i),requestAnimationFrame((()=>{this.syncImageLayouts(),this.updateImageLayoutBar()}))}getSelectedImageInfo(){var e;if(!this.editor)return null;const{state:t}=this.editor,o=t.selection;if("NodeSelection"!==o.constructor.name)return null;const r=o.node;if("image"!==(null==r?void 0:r.type.name))return null;const i=o.from,n=this.editor.view.nodeDOM(i);return n?{node:r,pos:i,container:(null===(e=n.closest)||void 0===e?void 0:e.call(n,"[data-resize-container]"))||n}:null}syncImageLayouts(){if(!this.editor)return;const e=this.editor.view;this.editor.state.doc.descendants(((t,o)=>{var r;if("image"!==t.type.name)return!0;const i=e.nodeDOM(o),n=(null===(r=null==i?void 0:i.closest)||void 0===r?void 0:r.call(i,"[data-resize-container]"))||i;return!n||(n.dataset.imageLayout=t.attrs.imageLayout||"inline",n.style.position="",n.style.left="",n.style.top="",n.style.zIndex="",!0)}))}updateImageLayoutBarPosition(){if(!this.imgLayoutEl||!this.contentEl)return;const e=this.getSelectedImageInfo();if(!e)return;const t=e.container.getBoundingClientRect(),o=this.contentEl.getBoundingClientRect(),r=this.imgLayoutEl.offsetWidth||194;let i=t.left+t.width/2-o.left+this.contentEl.scrollLeft-r/2;i=Math.max(4,Math.min(i,o.width-r-4));const n=t.bottom-o.top+this.contentEl.scrollTop+8;this.imgLayoutEl.style.left=i+"px",this.imgLayoutEl.style.top=n+"px"}updateImageLayoutBar(){if(!this.imgLayoutEl||!this.editor)return;const e=this.getSelectedImageInfo();if(!e)return void(this.imgLayoutVisible&&(this.imgLayoutEl.style.display="none",this.imgLayoutVisible=!1));this.imgLayoutEl.style.display="flex",this.imgLayoutVisible=!0,this.updateImageLayoutBarPosition();const t=e.node.attrs.imageLayout||"inline";this.imgLayoutEl.querySelectorAll(".co-rte-img-layout__btn").forEach((e=>{e.classList.toggle("co-rte-img-layout__btn--active",e.getAttribute("data-layout")===t)}))}render(){const e="none"!==this.resolvedToolbar&&!this.readonly&&!this.disabled,t=this.showCharacterCount||null!=this.maxLength;return r("div",{key:"135188e840e6c824750f41311c8317677754a57e",class:{"co-rich-text-editor":!0,"co-rich-text-editor--focused":this.hasFocus,"co-rich-text-editor--disabled":this.disabled,"co-rich-text-editor--readonly":this.readonly,"co-rich-text-editor--loading":!this.ready,["co-rich-text-editor--"+this.status]:"default"!==this.status,"co-rich-text-editor--flat":"flat"===this.variant},part:"wrapper"},(this.label||this.secondaryLabel)&&r("div",{key:"6efe3d162583d450797bde27f772ed400f764f89",class:"co-rich-text-editor__labels"},this.label&&r("label",{key:"e7e4b81fe3c7ac101b7583ef2aa75635c9730fc9",class:"co-rich-text-editor__label",part:"label"},this.label),this.secondaryLabel&&r("span",{key:"57d843617b4faadb72997c94f89d3032da83c0ef",class:"co-rich-text-editor__secondary-label"},this.secondaryLabel)),r("div",{key:"8bdfacbab4a4b782d19cb1f3b42237387ed686c0",class:"co-rich-text-editor__frame"},e&&r("co-rich-text-toolbar",{key:"ef14095c7489e7f090cebaf227345a6ec7e8681f",class:"co-rich-text-editor__toolbar",part:"toolbar",variant:this.resolvedToolbar,disabled:this.disabled||this.readonly,locale:this.locale,attachmentsEnabled:this.attachmentsEnabled,attachmentAccept:this.attachmentAccept,onCoAttachmentsSelected:e=>{e.stopPropagation(),this.coAttachmentsSelected.emit(e.detail)},ref:e=>this.toolbarEl=e}),r("div",{key:"554599eaefefb60470801d1ef6ced9ad271b197c",class:"co-rich-text-editor__box"},r("div",{key:"85a5e5ace0ad305a58b4a18dd1f5cf102b5f480a",class:"co-rte-content",part:"content",role:"textbox","aria-multiline":"true","aria-label":this.label,"aria-required":this.required?"true":void 0,"aria-invalid":"error"===this.status?"true":void 0,ref:e=>this.contentEl=e}))),r("div",{key:"dbc4bdbafa74e8fc19b243c151e5ade688b8f463",class:"co-rich-text-editor__footer"},this.helperText&&r("div",{key:"464cbd83eef858073cd82cfc2d71772bf0a7904a",class:"co-rich-text-editor__helper co-rich-text-editor__helper--"+this.status,part:"helper"},r("co-icon",{key:"1bd007d69fac6948e30d585ad7b9f3ece0fe85ca",name:this.helperIcon,size:14}),r("span",{key:"33c618629fc830ff7cdb1bdb1b576bbbc3369435"},this.helperText)),t&&r("span",{key:"c0bfa6e67be05fe892c2f51b12392810e4d3fed0",class:"co-rich-text-editor__count",ref:e=>this.charCountEl=e},this.charCount,null!=this.maxLength?" / "+this.maxLength:"")))}get el(){return this}static get watchers(){return{accountFonts:[{onAccountFontsChange:0}],value:[{onValueChange:0}],disabled:[{onEditableChange:0}],readonly:[{onEditableChange:0}]}}static get style(){return'co-rich-text-editor{display:block;font-family:var(--co-font-family-primary);font-size:var(--co-font-size-14);letter-spacing:var(--co-font-letter-spacing-body)}.co-rich-text-editor{display:flex;flex-direction:column;gap:var(--co-spacing-sm2, 6px)}.co-rich-text-editor__labels{display:flex;align-items:center;justify-content:space-between;padding:0 var(--co-spacing-xs);gap:var(--co-spacing-sm2, 6px)}.co-rich-text-editor__label,.co-rich-text-editor__secondary-label{color:var(--co-semantic-text-secondary);font-size:var(--co-font-size-14);font-weight:400;line-height:1}.co-rich-text-editor__frame{display:flex;flex-direction:column;background:var(--co-semantic-surface-page);border:1px solid var(--co-semantic-border-field);border-radius:var(--co-border-radius-xs);transition:border-color var(--co-motion-duration-fast) var(--co-motion-ease-out), box-shadow var(--co-motion-duration-fast) var(--co-motion-ease-out);min-height:0;flex:1;position:relative;overflow:visible}.co-rich-text-editor__box{display:flex;flex-direction:column;min-height:0;flex:1;position:relative;overflow-y:auto;overflow-x:hidden}.co-rich-text-editor--flat .co-rich-text-editor__frame{background:transparent;border-color:transparent}.co-rich-text-editor--focused .co-rich-text-editor__frame{border-color:var(--co-semantic-border-focus, var(--co-color-base-negro, #1a1a1a));box-shadow:0 0 0 3px var(--co-semantic-border-focus-ring, rgba(37, 99, 235, 0.15))}.co-rich-text-editor--error .co-rich-text-editor__frame{border-color:var(--co-color-status-error)}.co-rich-text-editor--success .co-rich-text-editor__frame{border-color:var(--co-color-status-success)}.co-rich-text-editor--disabled .co-rich-text-editor__frame,.co-rich-text-editor--readonly .co-rich-text-editor__frame{opacity:0.7;cursor:not-allowed}.co-rich-text-editor--loading .co-rte-content{min-height:96px;background:linear-gradient(90deg, var(--co-semantic-surface-secondary) 0%, var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.04)) 50%, var(--co-semantic-surface-secondary) 100%);background-size:200% 100%;animation:co-rte-skeleton 1.2s ease-in-out infinite}@keyframes co-rte-skeleton{0%{background-position:200% 0}100%{background-position:-200% 0}}.co-rich-text-editor__toolbar{position:relative;flex-shrink:0;z-index:60;border-top-left-radius:calc(var(--co-border-radius-xs) - 1px);border-top-right-radius:calc(var(--co-border-radius-xs) - 1px)}.co-rte-content{min-height:96px;color:var(--co-semantic-text-default);flex:1 0 auto;display:flex;flex-direction:column}.co-rte-content .ProseMirror{outline:none;flex:1 0 auto;line-height:1.5;padding:var(--co-spacing-md);box-sizing:border-box}.co-rte-content .ProseMirror p{margin:0 0 var(--co-spacing-sm) 0}.co-rte-content .ProseMirror p:last-child{margin-bottom:0}.co-rte-content .ProseMirror>p{margin-bottom:var(--co-spacing-sm) !important}.co-rte-content .ProseMirror>p:last-child{margin-bottom:0 !important}.co-rte-content .ProseMirror [style*="text-align: justify"]{text-align-last:left}.co-rte-content .ProseMirror [style*="text-align: center"]{text-align:center}.co-rte-content .ProseMirror [style*="text-align: right"]{text-align:right}.co-rte-content .ProseMirror h1,.co-rte-content .ProseMirror h2,.co-rte-content .ProseMirror h3,.co-rte-content .ProseMirror h4{margin:var(--co-spacing-md) 0 var(--co-spacing-sm);font-weight:600;line-height:1.3}.co-rte-content .ProseMirror h1{font-size:var(--co-font-size-28, 28px)}.co-rte-content .ProseMirror h2{font-size:var(--co-font-size-20, 20px)}.co-rte-content .ProseMirror h3{font-size:var(--co-font-size-16, 16px)}.co-rte-content .ProseMirror ul,.co-rte-content .ProseMirror ol{padding-left:var(--co-spacing-xl);margin:0 0 var(--co-spacing-sm) 0}.co-rte-content .ProseMirror ul[data-type="taskList"]{list-style:none;padding-left:0;margin:0 0 var(--co-spacing-sm) 0}.co-rte-content .ProseMirror ul[data-type="taskList"] li{display:flex;align-items:flex-start;gap:var(--co-spacing-sm, 8px)}.co-rte-content .ProseMirror ul[data-type="taskList"] li>label{flex:0 0 auto;margin-top:0.15em;user-select:none}.co-rte-content .ProseMirror ul[data-type="taskList"] li>div{flex:1 1 auto;min-width:0}.co-rte-content .ProseMirror ul[data-type="taskList"] li>div>p{margin:0}.co-rte-content .ProseMirror ul[data-type="taskList"] input[type="checkbox"]{width:16px;height:16px;cursor:pointer;accent-color:var(--co-color-base-negro, #1a1a1a)}.co-rte-content .ProseMirror ul[data-type="taskList"][data-variant="strike"] li[data-checked="true"]>div{text-decoration:line-through;color:var(--co-semantic-text-muted, #999)}.co-rte-content .ProseMirror ul[data-type="taskList"][data-variant="plain"] li[data-checked="true"]>div{text-decoration:none}.co-rte-content .ProseMirror blockquote{border-left:3px solid var(--co-semantic-border-default, var(--co-semantic-border-subtle));padding-left:var(--co-spacing-md);margin:0 0 var(--co-spacing-sm) 0;color:var(--co-semantic-text-secondary)}.co-rte-content .ProseMirror a{color:var(--co-color-base-negro, #1a1a1a);text-decoration:underline;text-underline-offset:2px}.co-rte-content .ProseMirror img{max-width:100%;height:auto;border-radius:var(--co-border-radius-xs);margin:var(--co-spacing-sm) 0;cursor:default;-webkit-user-drag:none;user-select:none}.co-rte-content .ProseMirror img.ProseMirror-selectednode{outline:2px solid var(--co-color-base-negro, #1a1a1a)}.co-rte-content [data-resize-container].ProseMirror-selectednode{outline:2px solid var(--co-color-base-negro, #1a1a1a);outline-offset:0px;border-radius:0}.co-rte-content [data-resize-container]{position:relative;display:inline-block;width:fit-content;max-width:100%;margin:var(--co-spacing-sm) 0;line-height:0}.co-rte-content [data-resize-container][data-resize-state="true"]{outline:2px solid var(--co-color-base-negro, #1a1a1a);outline-offset:0px;border-radius:0}.co-rte-content [data-resize-wrapper]{position:relative;display:inline-block;line-height:0}.co-rte-content [data-resize-handle]{width:10px;height:10px;background:var(--co-color-base-negro, #1a1a1a);border:1.5px solid #fff;border-radius:50%;box-shadow:0 0 2px rgba(0, 0, 0, 0.3);z-index:5;opacity:0;pointer-events:none}.co-rte-content [data-resize-container][data-resize-state="true"] [data-resize-handle],.co-rte-content [data-resize-container].ProseMirror-selectednode [data-resize-handle]{opacity:1;pointer-events:auto}.co-rte-content [data-resize-handle="top-left"]{cursor:nw-resize}.co-rte-content [data-resize-handle="top-right"]{cursor:ne-resize}.co-rte-content [data-resize-handle="bottom-left"]{cursor:sw-resize}.co-rte-content [data-resize-handle="bottom-right"]{cursor:se-resize}.co-rte-content [data-resize-handle="top"],.co-rte-content [data-resize-handle="bottom"]{width:30px;height:6px;border-radius:3px;left:50% !important;transform:translateX(-50%)}.co-rte-content [data-resize-handle="top"]{cursor:n-resize}.co-rte-content [data-resize-handle="bottom"]{cursor:s-resize}.co-rte-content [data-resize-handle="left"],.co-rte-content [data-resize-handle="right"]{width:6px;height:30px;border-radius:3px;top:50% !important;transform:translateY(-50%)}.co-rte-content [data-resize-handle="left"]{cursor:w-resize}.co-rte-content [data-resize-handle="right"]{cursor:e-resize}.co-rte-content [data-resize-container] img{max-width:100%;display:block;border-radius:0;margin:0}.co-rte-content .ProseMirror hr{border:none;border-top:1px solid var(--co-semantic-border-default, #e0e0e0);margin:var(--co-spacing-lg) 0}.co-rte-content .ProseMirror code{font-family:var(--co-font-family-mono);font-size:0.9em;background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06));padding:0.1em 0.3em;border-radius:var(--co-border-radius-xxs)}.co-rte-content .ProseMirror pre{font-family:var(--co-font-family-mono);font-size:0.9em;background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06));padding:var(--co-spacing-md);border-radius:var(--co-border-radius-xs);overflow-x:auto;margin:var(--co-spacing-sm) 0}.co-rte-content .ProseMirror pre code{background:none;padding:0;border-radius:0}.co-rte-content .ProseMirror p.is-editor-empty:first-child::before{content:attr(data-placeholder);color:var(--co-semantic-text-muted);float:left;height:0;pointer-events:none}.co-rte-content .co-rte-variable,.co-rte-content .co-rte-mention{display:inline-block;padding:0.05em 0.4em;border-radius:var(--co-border-radius-xxs);background:var(--co-color-base-negro, #1a1a1a);color:var(--co-color-base-blanco, #fff);font-size:0.9em;white-space:nowrap}.co-rte-content .co-rte-mention{background:var(--co-color-azul-200);color:var(--co-color-azul-800)}.co-rich-text-editor__footer{display:flex;align-items:center;justify-content:space-between;gap:var(--co-spacing-sm);padding:0 var(--co-spacing-xs);min-height:0}.co-rich-text-editor__helper{display:flex;align-items:center;gap:var(--co-spacing-xs);color:var(--co-semantic-text-secondary);font-size:var(--co-font-size-12, 12px)}.co-rich-text-editor__helper--error{color:var(--co-color-status-error)}.co-rich-text-editor__helper--success{color:var(--co-color-status-success)}.co-rich-text-editor__count{margin-left:auto;color:var(--co-semantic-text-muted);font-size:var(--co-font-size-12, 12px)}.co-rte-bubble.co-rte-bubble--suppressed{display:none !important}.co-rte-bubble{position:absolute;z-index:50;display:flex;flex-direction:row;align-items:center;gap:2px;padding:var(--co-spacing-xs, 4px) var(--co-spacing-sm, 8px);background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xs, 8px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);user-select:none;white-space:nowrap;max-width:100%;box-sizing:border-box;flex-wrap:wrap}.co-rte-bubble__drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;color:var(--co-semantic-text-muted, #999);width:18px;height:28px;margin:0 2px 0 0;flex-shrink:0}.co-rte-bubble__drag-handle:hover{color:var(--co-semantic-text-secondary, #555)}.co-rte-bubble__drag-handle:active{cursor:grabbing}.co-rte-bubble__row{display:flex;align-items:center;gap:2px;flex-wrap:wrap;max-width:100%;min-width:0}.co-rte-bubble__btn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:var(--co-border-radius-xxs, 4px);background:transparent;color:var(--co-semantic-text-default, #333);cursor:pointer}.co-rte-bubble__btn:hover:not(.co-rte-bubble__btn--active){background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06))}.co-rte-bubble__btn--active{background:var(--co-color-base-negro, #1a1a1a);color:var(--co-color-base-blanco, #fff)}.co-rte-bubble__btn--active:hover{background:var(--co-color-base-negro, #333)}.co-rte-bubble__sep{display:inline-block;width:1px;height:18px;margin:0 4px;background:var(--co-semantic-border-default, rgba(0, 0, 0, 0.12));flex-shrink:0}.co-rte-bubble__select{position:relative}.co-rte-bubble__select-trigger{display:flex;align-items:center;gap:2px;height:28px;padding:0 6px;border:1px solid transparent;border-radius:var(--co-border-radius-xxs, 4px);background:transparent;color:var(--co-semantic-text-default, #333);font-family:var(--co-font-family-primary);font-size:11px;cursor:pointer;white-space:nowrap;transition:background var(--co-motion-duration-fast), border-color var(--co-motion-duration-fast)}.co-rte-bubble__select-trigger:hover{background:var(--co-semantic-surface-hover, #f5f5f5);border-color:var(--co-semantic-border-default, #e0e0e0)}.co-rte-bubble__select-label{max-width:72px;overflow:hidden;text-overflow:ellipsis}.co-rte-bubble__select--font .co-rte-bubble__select-label{max-width:110px}.co-rte-bubble__select-dropdown{position:absolute;bottom:100%;left:0;z-index:120;min-width:100px;max-height:260px;overflow-y:auto;padding:var(--co-spacing-xxs, 2px);background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xxs, 4px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);margin-bottom:4px;white-space:normal}.co-rte-bubble__select-dropdown[data-position="above"]{bottom:100%;top:auto;margin-bottom:4px;margin-top:0}.co-rte-bubble__select-dropdown[data-position="below"]{top:100%;bottom:auto;margin-top:4px;margin-bottom:0}.co-rte-bubble__select-option{display:block;width:100%;padding:4px 8px;border:none;border-radius:3px;background:transparent;color:var(--co-semantic-text-default, #333);font-family:var(--co-font-family-primary);font-size:12px;text-align:left;cursor:pointer;white-space:nowrap}.co-rte-bubble__select-option:hover{background:var(--co-semantic-surface-hover, #f5f5f5)}.co-rte-bubble__select-dropdown--font{min-width:200px;max-height:320px;overflow:hidden;overflow-y:auto;display:flex;flex-direction:column;white-space:normal}.co-rte-bubble__font-search{padding:6px 6px 4px;flex-shrink:0}.co-rte-bubble__font-search-input{width:100%;padding:4px 8px;border:1px solid var(--co-semantic-border-default, #ccc);border-radius:4px;background:var(--co-semantic-surface-secondary, #fff);color:var(--co-semantic-text-default, #333);font-family:var(--co-font-family-primary);font-size:12px;outline:none;box-sizing:border-box}.co-rte-bubble__font-search-input:focus{border-color:var(--co-color-base-negro, #1a1a1a)}.co-rte-bubble__font-list{max-height:260px;overflow-y:auto;padding:0 var(--co-spacing-xxs, 2px) var(--co-spacing-xxs, 2px)}.co-rte-bubble__font-section-header{padding:6px 8px 2px;font-size:11px;font-weight:600;color:var(--co-semantic-text-muted, #888);text-transform:uppercase;letter-spacing:0.5px}.co-rte-bubble__font-empty{padding:12px 8px;text-align:center;color:var(--co-semantic-text-muted, #888);font-size:12px}.co-rte-bubble__color{position:relative}.co-rte-bubble__color-dropdown{position:absolute;bottom:100%;left:50%;transform:translateX(-50%);z-index:120;width:224px;padding:var(--co-spacing-sm, 8px);background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xs, 8px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);margin-bottom:4px;white-space:normal;max-width:calc(100vw - 16px)}.co-rte-bubble__color-dropdown[data-position="above"]{bottom:100%;top:auto;margin-bottom:4px;margin-top:0}.co-rte-bubble__color-dropdown[data-position="below"]{top:100%;bottom:auto;margin-top:4px;margin-bottom:0}.co-rte-bubble__color-grid{display:grid;grid-template-columns:repeat(10, 1fr);gap:2px}.co-rte-bubble__color-swatch{width:20px;height:20px;padding:0;border:none;border-radius:3px;cursor:pointer;transition:transform var(--co-motion-duration-fast), box-shadow var(--co-motion-duration-fast)}.co-rte-bubble__color-swatch:hover{transform:scale(1.2);box-shadow:0 0 0 2px var(--co-color-base-negro, #1a1a1a)}.co-rte-bubble__color-hex{display:flex;align-items:center;gap:4px;margin-top:6px}.co-rte-bubble__color-hex-input{width:100%;padding:3px 6px;border:1px solid var(--co-semantic-border-default, #ccc);border-radius:3px;background:var(--co-semantic-surface-secondary, #fff);color:var(--co-semantic-text-default, #333);font-family:var(--co-font-family-mono, monospace);font-size:11px;outline:none}.co-rte-bubble__color-hex-input:focus{border-color:var(--co-color-base-negro, #1a1a1a)}.co-rte-bubble__color-clear{display:flex;align-items:center;gap:4px;width:100%;padding:3px 6px;margin-top:4px;border:none;background:transparent;color:var(--co-semantic-text-secondary, #666);font-family:var(--co-font-family-primary);font-size:11px;cursor:pointer;border-radius:3px}.co-rte-bubble__color-clear:hover{background:var(--co-semantic-surface-hover, #f5f5f5)}.co-rte-bubble__link-form{display:flex;align-items:center;gap:4px;margin-left:4px}.co-rte-bubble__link-input{width:160px;padding:3px 8px;border:1px solid var(--co-semantic-border-default, #ccc);border-radius:4px;background:var(--co-semantic-surface-secondary, #fff);color:var(--co-semantic-text-default, #333);font-family:var(--co-font-family-primary);font-size:12px;outline:none}.co-rte-bubble__link-input::placeholder{color:var(--co-semantic-text-muted, #999)}.co-rte-bubble__link-input:focus{border-color:var(--co-color-base-negro, #1a1a1a);box-shadow:0 0 0 2px rgba(0, 0, 0, 0.1)}.co-rte-bubble__link-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:4px;background:var(--co-color-base-negro, #1a1a1a);color:#fff;cursor:pointer}.co-rte-bubble__link-btn:hover{opacity:0.9}.co-rte-bubble__link-unlink{background:var(--co-semantic-status-error, #aa2e1b)}.co-rte-bubble__panel{position:absolute;z-index:140;width:230px;background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xs, 8px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);overflow:hidden;user-select:none}.co-rte-bubble__panel-header{display:flex;align-items:center;gap:4px;padding:6px 8px;border-bottom:1px solid var(--co-semantic-border-subtle, #eee)}.co-rte-bubble__panel-drag{cursor:grab;display:flex;align-items:center;justify-content:center;color:var(--co-semantic-text-muted, #999);flex-shrink:0}.co-rte-bubble__panel-drag:active{cursor:grabbing}.co-rte-bubble__panel-title{flex:1;font-size:12px;font-weight:600;color:var(--co-semantic-text-default, #333);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-rte-bubble__panel-close{display:flex;align-items:center;justify-content:center;width:22px;height:22px;border:none;border-radius:3px;background:transparent;color:var(--co-semantic-text-muted, #999);cursor:pointer;flex-shrink:0}.co-rte-bubble__panel-close:hover{background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06));color:var(--co-semantic-text-default, #333)}.co-rte-bubble__panel-input-wrap{padding:6px 8px}.co-rte-bubble__panel-input{width:100%;padding:4px 8px;border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:4px;font-size:12px;font-family:inherit;outline:none;box-sizing:border-box;background:var(--co-semantic-surface-secondary, #fff);color:var(--co-semantic-text-default, #333)}.co-rte-bubble__panel-input:focus{border-color:var(--co-color-base-negro, #1a1a1a)}.co-rte-bubble__panel-options{max-height:280px;overflow-y:auto;padding:2px 4px 4px}.co-rte-bubble__panel-option{display:block;width:100%;padding:5px 8px;border:none;border-radius:3px;background:transparent;cursor:pointer;text-align:left;font-family:inherit;color:var(--co-semantic-text-default, #333)}.co-rte-bubble__panel-option:hover{background:var(--co-semantic-surface-hover, #f5f5f5)}.co-rte-bubble__panel-sep{height:1px;background:var(--co-semantic-border-subtle, #eee);margin:4px 8px}.co-rte-bubble__panel-opt-row{display:flex;justify-content:space-between;align-items:center;width:100%}.co-rte-bubble__panel-opt-value{color:var(--co-semantic-text-muted, #999);font-size:11px;font-weight:400 !important;min-width:28px;text-align:right}.co-rte-bubble__panel[data-position="above"]{bottom:100%;top:auto;margin-bottom:4px}.co-rte-bubble__panel[data-position="below"]{top:100%;bottom:auto;margin-top:4px}.co-rte-bubble__overflow{position:relative}.co-rte-bubble__overflow-menu{position:absolute;bottom:100%;right:0;z-index:130;min-width:230px;padding:4px;background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xs, 8px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);margin-bottom:4px}.co-rte-bubble__overflow-menu[data-position="below"]{top:100%;bottom:auto;margin-top:4px;margin-bottom:0}.co-rte-bubble__overflow-item{display:flex;align-items:center;gap:8px;width:100%;padding:6px 8px;border:none;border-radius:4px;background:transparent;font-family:inherit;font-size:13px;color:var(--co-semantic-text-default, #333);cursor:pointer;text-align:left;white-space:nowrap}.co-rte-bubble__overflow-item:hover{background:var(--co-semantic-surface-hover, #f5f5f5)}.co-rte-bubble__overflow-item--active{background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06));color:var(--co-color-base-negro, #1a1a1a);font-weight:600}.co-rte-bubble__overflow-value{margin-left:auto;color:var(--co-semantic-text-muted, #999);font-size:11px}.co-rte-bubble__overflow-sep{height:1px;background:var(--co-semantic-border-subtle, #eee);margin:3px 8px}.co-rte-bubble__overflow-section-title{padding:6px 8px 2px;font-size:11px;font-weight:600;color:var(--co-semantic-text-muted, #888);letter-spacing:0.5px}.co-rte-bubble__overflow-item--danger{color:var(--co-color-status-error, #aa2e1b)}.co-rte-bubble__overflow-item--danger:hover{background:rgba(170, 46, 27, 0.06)}.co-rte-bubble__color-indicator{display:flex;flex-direction:column;align-items:center;gap:1px;line-height:1}.co-rte-bubble__color-letter{font-family:var(--co-font-family-primary);font-size:14px;font-weight:700;color:var(--co-semantic-text-default, #333);line-height:1}.co-rte-bubble__color-bar{width:14px;height:3px;border-radius:1px}.co-rte-content .callout{display:flex;gap:0.75rem;padding:1rem;border-radius:var(--co-border-radius-xs, 8px);border:2px solid;margin:1rem 0}.co-rte-content .callout--info{background:#eff6ff;border-color:#bfdbfe}.co-rte-content .callout--warning{background:#fffbeb;border-color:#fde68a}.co-rte-content .callout--success{background:#f0fdf4;border-color:#bbf7d0}.co-rte-content .callout--error{background:#fef2f2;border-color:#fecaca}.co-rte-content .callout__icon{flex-shrink:0;font-size:1.2em}.co-rte-content .callout__content{flex:1}.co-rte-content .callout__content p{margin:0}.co-rte-content table{border-collapse:collapse;table-layout:auto;width:100%;margin:1rem 0;overflow:hidden}.co-rte-content .tableWrapper{overflow-x:auto;max-width:100%}.co-rte-content td,.co-rte-content th{min-width:1em;border:1px solid var(--co-semantic-border-default, #e0e0e0);padding:0.5rem;vertical-align:top;box-sizing:border-box;position:relative}.co-rte-content th{font-weight:600;text-align:left;background-color:#e3e3e3;color:var(--co-semantic-text-default, #333)}.co-rte-content .ProseMirror table th{background-color:#e3e3e3}.co-rte-content .selectedCell{background:rgba(0, 0, 0, 0.06)}.co-rte-content .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;background-color:var(--co-color-base-negro, #1a1a1a);pointer-events:none}.co-rte-content .ProseMirror.resize-cursor,.co-rte-content .ProseMirror.resize-cursor *{cursor:col-resize}.co-rte-content iframe{border-radius:var(--co-border-radius-xs, 8px);max-width:100%;aspect-ratio:16 / 9;width:100%;height:auto;display:block;margin:0}.co-rte-content .co-rte-embed{position:relative;display:block;max-width:100%;margin:1rem 0;line-height:0}.co-rte-content .co-rte-embed::before{content:\'\';position:absolute;inset:0;z-index:1}.co-rte-content .co-rte-embed.ProseMirror-selectednode,.co-rte-content .co-rte-embed--selected{outline:2px solid var(--co-color-base-negro, #1a1a1a);outline-offset:2px;border-radius:var(--co-border-radius-xs, 8px)}.co-rte-content .co-rte-embed__handle{position:absolute;width:12px;height:12px;background:var(--co-color-base-negro, #1a1a1a);border:1.5px solid #fff;border-radius:50%;box-shadow:0 0 2px rgba(0, 0, 0, 0.3);z-index:3;opacity:0;pointer-events:none}.co-rte-content .co-rte-embed.ProseMirror-selectednode .co-rte-embed__handle,.co-rte-content .co-rte-embed--selected .co-rte-embed__handle{opacity:1;pointer-events:auto}.co-rte-content .co-rte-embed__handle--bottom-right{right:-6px;bottom:-6px;cursor:nwse-resize}.co-rte-content .co-rte-embed__handle--bottom-left{left:-6px;bottom:-6px;cursor:nesw-resize}.co-rte-content .co-rte-embed--resizing{outline:2px dashed var(--co-color-base-negro, #1a1a1a);outline-offset:2px}.co-rich-text-editor--readonly .co-rte-embed::before,.co-rich-text-editor--disabled .co-rte-embed::before{display:none}.co-rich-text-editor--readonly .co-rte-embed.ProseMirror-selectednode,.co-rich-text-editor--readonly .co-rte-embed--selected,.co-rich-text-editor--disabled .co-rte-embed.ProseMirror-selectednode,.co-rich-text-editor--disabled .co-rte-embed--selected{outline:none !important}.co-rte-img-layout{position:absolute;z-index:50;display:flex;align-items:center;gap:2px;padding:4px;background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xs, 8px);box-shadow:0 2px 12px rgba(0, 0, 0, 0.12);pointer-events:auto}.co-rte-img-layout__btn{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;padding:0;border:1px solid transparent;border-radius:var(--co-border-radius-xxs, 4px);background:transparent;color:var(--co-semantic-text-default, #333);cursor:pointer;transition:background var(--co-motion-duration-fast), border-color var(--co-motion-duration-fast)}.co-rte-img-layout__btn:hover{background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06))}.co-rte-img-layout__btn--active{background:var(--co-color-base-negro, #1a1a1a);color:var(--co-color-base-blanco, #fff)}.co-rte-img-layout__btn--active:hover{background:var(--co-color-base-negro, #333)}.co-rte-img-layout__btn[data-tooltip]{position:relative}.co-rte-img-layout__btn[data-tooltip]::after{content:attr(data-tooltip);position:absolute;bottom:calc(100% + 6px);left:50%;transform:translateX(-50%);padding:4px 8px;background:var(--co-color-base-negro, #1a1a1a);color:var(--co-color-base-blanco, #fff);font-family:var(--co-font-family-primary);font-size:11px;font-weight:500;line-height:1.3;white-space:nowrap;border-radius:4px;pointer-events:none;opacity:0;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-out);z-index:100}.co-rte-img-layout__btn[data-tooltip]:hover::after{opacity:1;transition-delay:0.3s}.co-rte-content [data-resize-container][data-image-layout="wrap-left"]{float:left;max-width:50%;margin:4px 16px 8px 0}.co-rte-content [data-resize-container][data-image-layout="wrap-right"]{float:right;max-width:50%;margin:4px 0 8px 16px}.co-rte-content [data-resize-container][data-image-layout="center"]{display:block;margin:12px auto}.co-rte-content [data-resize-container][data-image-layout="full-width"]{display:block;width:100%;margin:12px 0}.co-rte-content [data-resize-container][data-image-layout="full-width"] [data-resize-wrapper],.co-rte-content [data-resize-container][data-image-layout="full-width"] img{width:100%}@media (max-width: 768px){.co-rte-content [data-resize-container][data-image-layout="wrap-left"],.co-rte-content [data-resize-container][data-image-layout="wrap-right"]{float:none;max-width:100%;display:block;margin:12px 0}}.co-rte-content--site .ProseMirror{width:var(--co-rte-content-width, 80%);max-width:100%;margin:0 auto}@media (max-width: 768px){.co-rte-content--site .ProseMirror{width:100%}}.co-rich-text-editor--readonly [data-resize-handle],.co-rich-text-editor--disabled [data-resize-handle]{display:none !important}.co-rich-text-editor--readonly [data-resize-container].ProseMirror-selectednode,.co-rich-text-editor--disabled [data-resize-container].ProseMirror-selectednode,.co-rich-text-editor--readonly img.ProseMirror-selectednode,.co-rich-text-editor--disabled img.ProseMirror-selectednode{outline:none !important}'}},[0,"co-rich-text-editor",{value:[1025],preset:[1],placeholder:[1],label:[1],secondaryLabel:[1,"secondary-label"],helperText:[1,"helper-text"],status:[1],variant:[513],disabled:[4],readonly:[4],required:[4],maxLength:[2,"max-length"],showCharacterCount:[4,"show-character-count"],autofocus:[4],toolbar:[1],features:[1],customExtensions:[16],imageUpload:[16],attachmentsEnabled:[4,"attachments-enabled"],attachmentAccept:[1,"attachment-accept"],fontFamilies:[1,"font-families"],accountFonts:[1,"account-fonts"],fontsLoading:[4,"fonts-loading"],fontLoader:[16],locale:[1],ready:[32],hasFocus:[32],getJSON:[64],getHtml:[64],getText:[64],clear:[64],focusEditor:[64],setContent:[64],getEditorInstance:[64]},void 0,{accountFonts:[{onAccountFontsChange:0}],value:[{onValueChange:0}],disabled:[{onEditableChange:0}],readonly:[{onEditableChange:0}]}]);function b(){"undefined"!=typeof customElements&&["co-rich-text-editor","co-icon","co-rich-text-toolbar"].forEach((e=>{switch(e){case"co-rich-text-editor":customElements.get(i(e))||customElements.define(i(e),l);break;case"co-icon":customElements.get(i(e))||s();break;case"co-rich-text-toolbar":customElements.get(i(e))||c()}}))}l.DEFAULT_FONTS=[{label:"Arial",value:"Arial, sans-serif"},{label:"Calibri",value:"Calibri, sans-serif"},{label:"Cambria",value:"Cambria, serif"},{label:"Comic Sans MS",value:"'Comic Sans MS', cursive"},{label:"Courier New",value:"'Courier New', monospace"},{label:"Georgia",value:"Georgia, serif"},{label:"Geist",value:"'Geist', sans-serif"},{label:"Helvetica",value:"Helvetica, Arial, sans-serif"},{label:"Impact",value:"Impact, sans-serif"},{label:"Inter",value:"'Inter', sans-serif"},{label:"Lato",value:"'Lato', sans-serif"},{label:"Montserrat",value:"'Montserrat', sans-serif"},{label:"Open Sans",value:"'Open Sans', sans-serif"},{label:"Poppins",value:"'Poppins', sans-serif"},{label:"Roboto",value:"'Roboto', sans-serif"},{label:"Segoe UI",value:"'Segoe UI', sans-serif"},{label:"Tahoma",value:"Tahoma, sans-serif"},{label:"Times New Roman",value:"'Times New Roman', serif"},{label:"Trebuchet MS",value:"'Trebuchet MS', sans-serif"},{label:"Verdana",value:"Verdana, sans-serif"}],l._registeredFonts=new Set,l.IMG_LAYOUT_ICONS={inline:"image-square","wrap-left":"text-align-left","wrap-right":"text-align-right",center:"text-align-center","full-width":"arrows-horizontal"},b();const d=l,u=b;export{d as CoRichTextEditor,u as defineCustomElement}
1
+ import{p as e,H as t,c as o,h as r,t as i}from"./index.js";import{R as n}from"./p-Bryf3-Js.js";import{g as a,d as c}from"./p-CFFDmGPS.js";import{d as s}from"./p-DNJAIVfI.js";const l=e(class e extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.coInput=o(this,"coInput",7),this.coChange=o(this,"coChange",7),this.coFocus=o(this,"coFocus",7),this.coBlur=o(this,"coBlur",7),this.coClear=o(this,"coClear",7),this.coReady=o(this,"coReady",7),this.coFontPopupShow=o(this,"coFontPopupShow",7),this.coFontPopupHide=o(this,"coFontPopupHide",7),this.coAttachmentsSelected=o(this,"coAttachmentsSelected",7),this.value=null,this.preset="task",this.placeholder="",this.status="default",this.variant="default",this.disabled=!1,this.readonly=!1,this.required=!1,this.showCharacterCount=!1,this.autofocus=!1,this.toolbar="auto",this.attachmentsEnabled=!1,this.locale="en",this.ready=!1,this.hasFocus=!1,this.charCount=0,this.bubbleDragged=!1,this.bubbleDragOffset={x:0,y:0},this.bubbleDragPos={x:0,y:0},this.bubblePositionLocked=!1,this.bubbleLockPos={x:0,y:0},this.applyingBubbleLock=!1,this._loadedAccountFonts=[],this._fontLoaderCalled=!1,this._fontLoaderLoading=!1,this.lastEmittedJson=null,this.lastEmittedHtml="",this.applyingExternal=!1,this.rt=n,this.imgLayoutVisible=!1,this.handleUpdate=e=>{if(this.refreshCharCount(),this.applyingExternal)return;const t=this.buildOutput(e);this.lastEmittedJson=t.json?JSON.stringify(t.json):null,this.lastEmittedHtml=t.html,this.coInput.emit(t),this.readonly&&this.coChange.emit(t)},this.handleFocus=()=>{this.hasFocus=!0,this.coFocus.emit()},this.handleBlur=()=>{clearTimeout(this.blurTimeout),this.blurTimeout=setTimeout((()=>{var e,t;(null===(e=this.editor)||void 0===e?void 0:e.isFocused)||(null===(t=this.bubbleEl)||void 0===t?void 0:t.contains(document.activeElement))||(this.hasFocus=!1,this.editor&&this.coChange.emit(this.buildOutput(this.editor)),this.coBlur.emit())}),100)}}async componentDidLoad(){var e,t;if(!this.contentEl)return;const o="none"!==this.resolvedToolbar&&!this.readonly&&!this.disabled;o&&(this.bubbleEl=this.createBubbleElement()),this.editor=this.rt.createEditor({preset:this.preset,element:this.contentEl,content:this.parseValue(this.value),editable:!this.disabled&&!this.readonly,placeholder:this.placeholder,maxLength:this.maxLength,features:this.parsedFeatures,customExtensions:null!==(e=this.customExtensions)&&void 0!==e?e:[],bubbleMenuElement:this.bubbleEl,imageUpload:this.imageUpload,onUpdate:e=>this.handleUpdate(e),onFocus:()=>this.handleFocus(),onBlur:()=>this.handleBlur()}),"document"===this.preset&&this.contentEl.classList.add("co-rte-content--site"),o&&this.imagesEnabled&&(this.contentEl.style.position="relative",this.imgLayoutEl=this.createImageLayoutBar(),this.contentEl.appendChild(this.imgLayoutEl)),this.editor.on("transaction",(({transaction:e})=>{this.bubbleEl&&(this.updateBubbleActiveStates(),(this.bubbleDragged||this.bubblePositionLocked)&&this.bubbleEl&&this.applyBubbleFixedPosition()),this.imagesEnabled&&e.docChanged&&this.syncImageLayouts(),this.updateImageLayoutBar()})),this.bubbleEl&&this.toolbarEl&&(this.toolbarEl.addEventListener("mousedown",(()=>{this.closeBubbleDropdowns()})),this.toolbarEl.addEventListener("coPopoverChange",(e=>{var t;const o=null===(t=e.detail)||void 0===t?void 0:t.open;this.suppressBubble(!!o)}))),this.lastEmittedJson=null!==(t=this.value)&&void 0!==t?t:null,this.ready=!0,this.refreshCharCount(),this.syncToolbar(),this.coReady.emit(),this.autofocus&&this.editor.commands.focus(),requestAnimationFrame((()=>this.syncImageLayouts()))}disconnectedCallback(){var e,t,o,r;clearTimeout(this.blurTimeout),clearTimeout(this.bubbleLockTimer),null===(e=this.bubbleStyleObserver)||void 0===e||e.disconnect(),this.bubbleDragMoveHandler&&document.removeEventListener("mousemove",this.bubbleDragMoveHandler),this.bubbleDragEndHandler&&document.removeEventListener("mouseup",this.bubbleDragEndHandler),this.bubbleOutsideClickHandler&&document.removeEventListener("click",this.bubbleOutsideClickHandler,!0),null===(t=this.editor)||void 0===t||t.destroy(),this.editor=void 0,null===(o=this.bubbleEl)||void 0===o||o.remove(),null===(r=this.imgLayoutEl)||void 0===r||r.remove()}componentDidRender(){this.syncToolbar()}onAccountFontsChange(){var e;if(this._fontDropdownRenderFn){const t=(null===(e=this._fontDropdownSearchInput)||void 0===e?void 0:e.value)||"";this._fontDropdownRenderFn(t)}}onValueChange(e){if(!this.editor||this.applyingExternal)return;const t=null!=e?e:null;if(t!==this.lastEmittedJson&&t!==this.lastEmittedHtml){this.applyingExternal=!0;try{""===t||null===t?this.editor.commands.clearContent(!1):this.editor.commands.setContent(this.parseValue(e),{emitUpdate:!1})}finally{this.applyingExternal=!1,this.lastEmittedJson=t,this.lastEmittedHtml="",this.refreshCharCount()}}}onEditableChange(){var e;null===(e=this.editor)||void 0===e||e.setEditable(!this.disabled&&!this.readonly)}async getJSON(){return this.editor&&!this.editor.isEmpty?this.editor.getJSON():null}async getHtml(){return this.editor?this.sanitizeHtml(this.editor.getHTML()):""}async getText(){var e,t;return null!==(t=null===(e=this.editor)||void 0===e?void 0:e.getText())&&void 0!==t?t:""}async clear(){this.editor&&(this.editor.commands.clearContent(!0),this.coClear.emit())}async focusEditor(){var e;null===(e=this.editor)||void 0===e||e.commands.focus()}async setContent(e){var t;null===(t=this.editor)||void 0===t||t.commands.setContent(e)}async getEditorInstance(){var e;return null!==(e=this.editor)&&void 0!==e?e:null}get imagesEnabled(){var e;const t=this.parsedFeatures;return null!==(e=null==t?void 0:t.image)&&void 0!==e?e:"document"===this.preset}get parsedFeatures(){if(this.features){if("string"==typeof this.features)try{return JSON.parse(this.features)}catch(e){return}return this.features}}parseValue(e){if(!e)return"";try{return JSON.parse(e)}catch(t){return e}}sanitizeHtml(e){return this.rt.sanitize(e,this.preset)}buildOutput(e){const t=e.isEmpty;return{json:t?null:e.getJSON(),html:t?"":this.sanitizeHtml(e.getHTML()),text:e.getText()}}lockBubblePosition(e=1e3){if(!this.bubbleEl)return;const t=this.bubbleEl.getBoundingClientRect();0!==t.width&&(this.bubbleLockPos={x:t.left,y:t.top},this.bubblePositionLocked=!0,clearTimeout(this.bubbleLockTimer),this.bubbleLockTimer=setTimeout((()=>{this.bubblePositionLocked=!1}),e))}applyBubbleFixedPosition(){if(!this.bubbleEl)return;const e=this.bubbleDragged?this.bubbleDragPos:this.bubbleLockPos;this.applyingBubbleLock=!0,this.bubbleEl.style.position="fixed",this.bubbleEl.style.top=e.y+"px",this.bubbleEl.style.left=e.x+"px",this.bubbleEl.style.transform="none",this.bubbleEl.style.visibility="visible",requestAnimationFrame((()=>{this.applyingBubbleLock=!1}))}setupBubbleStyleObserver(e){e.addEventListener("co-bubble-hide",(()=>{this.bubbleDragged=!1,this.bubblePositionLocked=!1,clearTimeout(this.bubbleLockTimer),this.closeBubbleDropdowns(),e.style.position="",e.style.top="",e.style.left="",e.style.transform=""})),e.addEventListener("co-bubble-show",(()=>{this.bubbleDragged=!1,this.bubblePositionLocked=!1})),this.bubbleStyleObserver=new MutationObserver((()=>{this.applyingBubbleLock||(this.bubblePositionLocked||this.bubbleDragged)&&this.applyBubbleFixedPosition()})),this.bubbleStyleObserver.observe(e,{attributes:!0,attributeFilter:["style"]})}suppressBubble(e){this.bubbleEl&&(this.bubbleEl.classList.toggle("co-rte-bubble--suppressed",e),e&&this.closeBubbleDropdowns())}closeBubbleDropdowns(){this.bubbleEl&&(this.bubbleEl.querySelectorAll(".co-rte-bubble__select-dropdown").forEach((e=>{e.style.display="none"})),this.bubbleEl.querySelectorAll(".co-rte-bubble__color-dropdown").forEach((e=>{e.style.display="none"})),this.bubbleEl.querySelectorAll(".co-rte-bubble__panel").forEach((e=>{e.style.display="none"})),this.bubbleEl.querySelectorAll(".co-rte-bubble__overflow-menu").forEach((e=>{e.style.display="none"})),this.bubbleLinkFormEl&&(this.bubbleLinkFormEl.style.display="none"))}refreshCharCount(){var e;const t=null===(e=this.editor)||void 0===e?void 0:e.storage;(null==t?void 0:t.characterCount)&&(this.charCount=t.characterCount.characters(),this.charCountEl&&(this.charCountEl.textContent=null!=this.maxLength?`${this.charCount} / ${this.maxLength}`:""+this.charCount))}syncToolbar(){this.toolbarEl&&this.editor&&this.toolbarEl.editor!==this.editor&&(this.toolbarEl.editor=this.editor),this.toolbarEl&&(this.toolbarEl.imageUpload=this.imageUpload)}get resolvedToolbar(){return"auto"!==this.toolbar?this.toolbar:this.rt.defaultToolbarForPreset(this.preset)}get resolvedFontFamilies(){if(!this.fontFamilies)return e.DEFAULT_FONTS;if("string"==typeof this.fontFamilies)try{return JSON.parse(this.fontFamilies)}catch(t){return e.DEFAULT_FONTS}return this.fontFamilies}get resolvedAccountFonts(){if(this.accountFonts){if("string"==typeof this.accountFonts)try{return JSON.parse(this.accountFonts)}catch(e){return[]}return this.accountFonts}return this._loadedAccountFonts}registerFontFace(t,o){if(o&&t&&!e._registeredFonts.has(t)){e._registeredFonts.add(t);try{const e=new FontFace(t,`url("${o}")`);e.load().then((()=>document.fonts.add(e))).catch((()=>{}))}catch(e){}}}async loadFontsViaCallback(){var e,t,o;if(!this._fontLoaderCalled&&this.fontLoader){this._fontLoaderCalled=!0,this._fontLoaderLoading=!0,null===(e=this._fontDropdownRenderFn)||void 0===e||e.call(this,"");try{const e=await this.fontLoader();Array.isArray(e)&&(this._loadedAccountFonts=e.map((e=>(e.url&&this.registerFontFace(e.label,e.url),{label:e.label,value:e.value}))))}catch(e){console.error("[co-rich-text-editor] fontLoader error",e)}finally{this._fontLoaderLoading=!1;const e=(null===(t=this._fontDropdownSearchInput)||void 0===t?void 0:t.value)||"";null===(o=this._fontDropdownRenderFn)||void 0===o||o.call(this,e)}}}get helperIcon(){switch(this.status){case"error":case"warning":return"warning-circle";case"success":return"check-circle";default:return"info"}}createBubbleElement(){const e=document.createElement("div");e.className="co-rte-bubble",e.style.visibility="hidden",e.style.position="absolute",e.style.top="0",e.style.left="0",e.addEventListener("mousedown",(e=>{"INPUT"!==e.target.tagName&&e.preventDefault(),this.lockBubblePosition()})),this.bubbleOutsideClickHandler=t=>{e.contains(t.target)||this.closeBubbleDropdowns()},document.addEventListener("click",this.bubbleOutsideClickHandler,!0),this.setupBubbleStyleObserver(e);const t="document"===this.preset;if(t){const t=document.createElement("div");t.className="co-rte-bubble__drag-handle",t.innerHTML='<co-icon name="dots-six-vertical" size="14"></co-icon>',t.addEventListener("mousedown",(t=>{t.preventDefault(),t.stopPropagation();const o=e.getBoundingClientRect();this.bubbleDragOffset={x:t.clientX-o.left,y:t.clientY-o.top},this.bubbleDragged||(this.bubbleDragPos={x:o.left,y:o.top}),this.bubbleDragged=!0,this.bubbleDragMoveHandler=t=>{this.bubbleDragPos.x=t.clientX-this.bubbleDragOffset.x,this.bubbleDragPos.y=t.clientY-this.bubbleDragOffset.y,e.style.position="fixed",e.style.top=this.bubbleDragPos.y+"px",e.style.left=this.bubbleDragPos.x+"px",e.style.transform="none",e.style.visibility="visible"},this.bubbleDragEndHandler=()=>{document.removeEventListener("mousemove",this.bubbleDragMoveHandler),document.removeEventListener("mouseup",this.bubbleDragEndHandler)},document.addEventListener("mousemove",this.bubbleDragMoveHandler),document.addEventListener("mouseup",this.bubbleDragEndHandler)})),e.appendChild(t)}const o=document.createElement("div");o.className="co-rte-bubble__row";let r=null,i=null,n=null,c=null,s=null,l=null;if(t){const e=this.createBubbleFontFamilySelect();o.appendChild(e),r=this.createBubbleFontSizePanel(),o.appendChild(r.wrap),i=this.createBubbleFontWeightPanel(),o.appendChild(i.wrap),o.appendChild(this.createSep());const t=this.createBubbleColorPicker("textColor",(e=>{this.editor&&this.editor.chain().focus().setColor(e).run()}));o.appendChild(t),o.appendChild(this.createSep())}const b=a(this.locale),d=[{action:"bold",icon:"text-b",label:b.bold,check:"bold"},{action:"italic",icon:"text-italic",label:b.italic,check:"italic"}];"comment"!==this.preset&&d.push({action:"underline",icon:"text-underline",label:b.underline,check:"underline"}),d.forEach((({action:e,icon:t,label:r,check:i})=>{const n=this.createBubbleBtn(t,r,e,i,(()=>{if(!this.editor)return;const t=this.editor.chain().focus();switch(e){case"bold":t.toggleBold().run();break;case"italic":t.toggleItalic().run();break;case"underline":t.toggleUnderline().run()}}));o.appendChild(n)})),o.appendChild(this.createSep()),(t||"email"===this.preset)&&([{align:"left",icon:"text-align-left",label:b.alignLeft},{align:"center",icon:"text-align-center",label:b.center},{align:"right",icon:"text-align-right",label:b.alignRight},{align:"justify",icon:"text-align-justify",label:b.justify}].forEach((({align:e,icon:t,label:r})=>{const i=document.createElement("button");i.type="button",i.className="co-rte-bubble__btn",i.title=r,i.setAttribute("aria-label",r),i.setAttribute("data-action","textAlign"),i.setAttribute("data-align",e),i.innerHTML=`<co-icon name="${t}" size="16"></co-icon>`,i.addEventListener("click",(()=>{this.editor&&this.editor.chain().focus().setTextAlign(e).run()})),o.appendChild(i)})),o.appendChild(this.createSep())),"comment"===this.preset||t||(o.appendChild(this.createBubbleBtn("list-bullets",b.bulletList,"bulletList","bulletList",(()=>{this.editor&&this.editor.chain().focus().toggleBulletList().run()}))),o.appendChild(this.createBubbleBtn("list-numbers",b.orderedList,"orderedList","orderedList",(()=>{this.editor&&this.editor.chain().focus().toggleOrderedList().run()}))),o.appendChild(this.createSep()));const u=this.createBubbleBtn("link",b.link,"link","link",(()=>{this.editor&&this.toggleBubbleLinkForm(!0)}));o.appendChild(u),t&&(o.appendChild(this.createSep()),n=this.createBubbleLineHeightPanel(),c=this.createBubbleLetterSpacingPanel(),s=this.createBubbleBgColorPanel(),l=this.createBubbleOverflowMenu({lineHeight:n,letterSpacing:c,bgColor:s}),o.appendChild(l.overflowWrap)),e.appendChild(o),t&&(r&&e.appendChild(r.panelEl),i&&e.appendChild(i.panelEl),n&&e.appendChild(n),c&&e.appendChild(c),s&&e.appendChild(s));const h=document.createElement("div");h.className="co-rte-bubble__link-form",h.style.display="none",this.bubbleLinkFormEl=h;const p=document.createElement("input");p.type="url",p.className="co-rte-bubble__link-input",p.placeholder="https://...",this.bubbleLinkInputEl=p,p.addEventListener("keydown",(e=>{"Enter"===e.key&&this.submitBubbleLinkImperative(),"Escape"===e.key&&(e.stopPropagation(),this.toggleBubbleLinkForm(!1))}));const f=document.createElement("button");f.type="button",f.className="co-rte-bubble__link-btn",f.innerHTML='<co-icon name="check" size="14"></co-icon>',f.addEventListener("click",(()=>this.submitBubbleLinkImperative()));const m=document.createElement("button");return m.type="button",m.className="co-rte-bubble__link-btn co-rte-bubble__link-unlink",m.title=b.unlinkLink,m.innerHTML='<co-icon name="link-break" size="14"></co-icon>',m.addEventListener("click",(()=>{this.editor&&(this.editor.chain().focus().unsetLink().run(),this.toggleBubbleLinkForm(!1))})),this.bubbleLinkUnlinkEl=m,h.appendChild(p),h.appendChild(f),h.appendChild(m),e.appendChild(h),e}createSep(){const e=document.createElement("span");return e.className="co-rte-bubble__sep",e}positionDropdown(e,t){const o=e.getBoundingClientRect();t.removeAttribute("data-position"),t.style.removeProperty("left"),t.style.removeProperty("transform");const r=t.offsetWidth||224,i=window.innerHeight-o.bottom;if(t.setAttribute("data-position",i>=(t.offsetHeight||320)||i>o.top?"below":"above"),t.classList.contains("co-rte-bubble__color-dropdown")){const o=(e.parentElement||e).getBoundingClientRect(),i=o.left+o.width/2-r/2,n=i+r,a=8;i<a?(t.style.left="0",t.style.transform="none"):n>window.innerWidth-a&&(t.style.left="auto",t.style.right="0",t.style.transform="none")}}positionPanelNearBubble(e){if(!this.bubbleEl)return;const t=this.bubbleEl.querySelector(".co-rte-bubble__overflow-menu"),o=t&&"none"!==t.style.display?t.getBoundingClientRect():this.bubbleEl.getBoundingClientRect(),r=e.offsetHeight||320,i=e.offsetWidth||230;let n=o.top;n+r>window.innerHeight-8&&(n=window.innerHeight-8-r),n<8&&(n=8);let a=o.left-i-4;a<8&&(a=o.right+4),a+i>window.innerWidth-8&&(a=window.innerWidth-8-i),e.style.position="fixed",e.style.top=n+"px",e.style.left=a+"px",e.style.bottom="auto",e.style.right="auto",e.style.transform="none",e.removeAttribute("data-position")}createBubbleBtn(e,t,o,r,i){const n=document.createElement("button");return n.type="button",n.className="co-rte-bubble__btn",n.title=t,n.setAttribute("aria-label",t),n.setAttribute("data-action",o),n.setAttribute("data-check",r),n.innerHTML=`<co-icon name="${e}" size="16"></co-icon>`,n.addEventListener("click",i),n}createBubbleFontFamilySelect(){const e=document.createElement("div");e.className="co-rte-bubble__select co-rte-bubble__select--font",e.setAttribute("data-select","fontFamily");const t=document.createElement("button");t.type="button",t.className="co-rte-bubble__select-trigger",t.innerHTML='<span class="co-rte-bubble__select-label">Sans-serif</span><co-icon name="caret-down" size="12"></co-icon>';const o=document.createElement("div");o.className="co-rte-bubble__select-dropdown co-rte-bubble__select-dropdown--font",o.style.display="none";const r=document.createElement("div");r.className="co-rte-bubble__font-search";const i=document.createElement("input");i.type="text",i.className="co-rte-bubble__font-search-input",i.placeholder=a(this.locale).searchFont,r.appendChild(i),o.appendChild(r);const n=document.createElement("div");n.className="co-rte-bubble__font-list",o.appendChild(n);const c=(e,r)=>{const n=document.createElement("button");return n.type="button",n.className="co-rte-bubble__select-option",n.setAttribute("data-value",r),n.textContent=e,n.style.fontFamily=r.includes(",")?r:`"${r}", sans-serif`,n.addEventListener("click",(()=>{if(!this.editor)return;this.editor.chain().focus().setFontFamily(r).run(),o.style.display="none";const n=t.querySelector(".co-rte-bubble__select-label");n&&(n.textContent=e),i.value="",this.coFontPopupHide.emit()})),n},s=e=>{n.innerHTML="";const t=e.toLowerCase(),o=this.resolvedAccountFonts,r=this.resolvedFontFamilies,i=t?o.filter((e=>e.label.toLowerCase().includes(t))):o,s=t?r.filter((e=>e.label.toLowerCase().includes(t))):r;if(!i.length&&!s.length){const e=document.createElement("div");return e.className="co-rte-bubble__font-empty",e.textContent=a(this.locale).noResults,void n.appendChild(e)}if((this.fontsLoading||this._fontLoaderLoading)&&!i.length){const e=document.createElement("div");e.className="co-rte-bubble__font-empty",e.textContent=a(this.locale).loadingFonts,n.appendChild(e)}if(i.length){const e=document.createElement("div");e.className="co-rte-bubble__font-section-header",e.textContent=a(this.locale).importedFonts,n.appendChild(e),i.forEach((({label:e,value:t})=>n.appendChild(c(e,t))))}if(s.length){const e=document.createElement("div");e.className="co-rte-bubble__font-section-header",e.textContent=a(this.locale).systemFonts,n.appendChild(e),s.forEach((({label:e,value:t})=>n.appendChild(c(e,t))))}};return i.addEventListener("input",(()=>s(i.value))),this._fontDropdownRenderFn=s,this._fontDropdownSearchInput=i,t.addEventListener("click",(()=>{const r=e.closest(".co-rte-bubble");r&&(r.querySelectorAll(".co-rte-bubble__select-dropdown").forEach((e=>{e!==o&&(e.style.display="none")})),r.querySelectorAll(".co-rte-bubble__color-dropdown").forEach((e=>{e.style.display="none"})));const n="none"!==o.style.display;o.style.display=n?"none":"block",n?this.coFontPopupHide.emit():(this.coFontPopupShow.emit(),this.loadFontsViaCallback(),this.positionDropdown(t,o),s(""),setTimeout((()=>i.focus()),0))})),e.appendChild(t),e.appendChild(o),e}createBubbleSelect(e,t,o,r){const i=document.createElement("div");i.className="co-rte-bubble__select",i.setAttribute("data-select",e);const n=document.createElement("button");n.type="button",n.className="co-rte-bubble__select-trigger",n.innerHTML=`<span class="co-rte-bubble__select-label">${o}</span><co-icon name="caret-down" size="12"></co-icon>`;const a=document.createElement("div");return a.className="co-rte-bubble__select-dropdown",a.style.display="none",t.forEach((({label:t,value:o})=>{const i=document.createElement("button");i.type="button",i.className="co-rte-bubble__select-option",i.setAttribute("data-value",o),i.textContent=t,"fontWeight"===e&&(i.style.fontWeight=o),i.addEventListener("click",(()=>{r(o),a.style.display="none";const e=n.querySelector(".co-rte-bubble__select-label");e&&(e.textContent=t)})),a.appendChild(i)})),n.addEventListener("click",(()=>{const e=i.closest(".co-rte-bubble");e&&(e.querySelectorAll(".co-rte-bubble__select-dropdown").forEach((e=>{e!==a&&(e.style.display="none")})),e.querySelectorAll(".co-rte-bubble__color-dropdown").forEach((e=>{e.style.display="none"})));const t="none"!==a.style.display;a.style.display=t?"none":"block",t||this.positionDropdown(n,a)})),i.appendChild(n),i.appendChild(a),i}createBubbleColorPicker(e,t){const o=document.createElement("div");o.className="co-rte-bubble__color",o.setAttribute("data-color",e);const r="textColor"===e?"":"highlighter",i=document.createElement("button");i.type="button",i.className="co-rte-bubble__btn";const n=a(this.locale);i.title="textColor"===e?n.textColor:n.backgroundColor,i.innerHTML="textColor"===e?'<span class="co-rte-bubble__color-indicator"><span class="co-rte-bubble__color-letter">A</span><span class="co-rte-bubble__color-bar" style="background:#000000"></span></span>':`<co-icon name="${r}" size="16"></co-icon>`;const c=document.createElement("div");c.className="co-rte-bubble__color-dropdown",c.style.display="none";const s="textColor"===e?n.textColor:n.backgroundColor,{resetDrag:l}=this.addDragHeader(c,s);c.addEventListener("mousedown",(e=>{"INPUT"!==e.target.tagName&&e.preventDefault(),this.lockBubblePosition()}));const b=document.createElement("div");b.className="co-rte-bubble__color-grid",["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#efefef","#f3f3f3","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff","#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#cfe2f3","#d9d2e9","#ead1dc"].forEach((e=>{const o=document.createElement("button");o.type="button",o.className="co-rte-bubble__color-swatch",o.style.background=e,"#ffffff"===e&&(o.style.border="1px solid #e0e0e0"),o.addEventListener("click",(()=>{t(e),c.style.display="none"})),b.appendChild(o)}));const d=document.createElement("div");d.className="co-rte-bubble__color-hex";const u=document.createElement("input");u.type="text",u.className="co-rte-bubble__color-hex-input",u.placeholder="#hex",u.maxLength=7,u.addEventListener("keydown",(e=>{if("Enter"===e.key){const e=u.value.trim();/^#[0-9a-fA-F]{3,6}$/.test(e)&&(t(e),c.style.display="none",u.value="")}}));const h=document.createElement("button");return h.type="button",h.className="co-rte-bubble__color-clear",h.innerHTML='<co-icon name="x" size="12"></co-icon> '+n.noColor,h.addEventListener("click",(()=>{this.editor&&("textColor"===e?this.editor.chain().focus().unsetColor().run():this.editor.chain().focus().unsetHighlight().run(),c.style.display="none")})),c.appendChild(b),d.appendChild(u),c.appendChild(d),c.appendChild(h),i.addEventListener("click",(()=>{const e=o.closest(".co-rte-bubble");e&&(e.querySelectorAll(".co-rte-bubble__select-dropdown").forEach((e=>{e.style.display="none"})),e.querySelectorAll(".co-rte-bubble__color-dropdown").forEach((e=>{e!==c&&(e.style.display="none")}))),"none"!==c.style.display?c.style.display="none":(l(),c.style.position="",c.style.top="",c.style.left="",c.style.bottom="",c.style.right="",c.style.transform="",c.style.display="block",this.positionDropdown(i,c))})),o.appendChild(i),o.appendChild(c),o}closeAllBubblePopups(...e){if(!this.bubbleEl)return;const t=e.filter(Boolean);this.bubbleEl.querySelectorAll(".co-rte-bubble__select-dropdown").forEach((e=>{t.includes(e)||(e.style.display="none")})),this.bubbleEl.querySelectorAll(".co-rte-bubble__color-dropdown").forEach((e=>{t.includes(e)||(e.style.display="none")})),this.bubbleEl.querySelectorAll(".co-rte-bubble__panel").forEach((e=>{t.includes(e)||(e.style.display="none")})),this.bubbleEl.querySelectorAll(".co-rte-bubble__overflow-menu").forEach((e=>{t.includes(e)||(e.style.display="none")})),this.bubbleLinkFormEl&&!t.includes(this.bubbleLinkFormEl)&&(this.bubbleLinkFormEl.style.display="none")}addDragHeader(e,t){let o=!1,r={x:0,y:0},i={x:0,y:0};const n=document.createElement("div");n.className="co-rte-bubble__panel-header";const a=document.createElement("div");a.className="co-rte-bubble__panel-drag",a.innerHTML='<co-icon name="dots-six" size="14"></co-icon>';const c=document.createElement("span");c.className="co-rte-bubble__panel-title",c.textContent=t;const s=document.createElement("button");return s.type="button",s.className="co-rte-bubble__panel-close",s.innerHTML='<co-icon name="x" size="14"></co-icon>',s.addEventListener("click",(()=>{e.style.display="none"})),n.appendChild(a),n.appendChild(c),n.appendChild(s),a.addEventListener("mousedown",(t=>{t.preventDefault(),t.stopPropagation();const n=e.getBoundingClientRect();i={x:t.clientX-n.left,y:t.clientY-n.top},o||(r={x:n.left,y:n.top}),o=!0;const a=t=>{r.x=t.clientX-i.x,r.y=t.clientY-i.y,e.style.position="fixed",e.style.top=r.y+"px",e.style.left=r.x+"px",e.style.bottom="auto",e.style.right="auto",e.style.transform="none",e.removeAttribute("data-position")},c=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",c)})),e.insertBefore(n,e.firstChild),{header:n,resetDrag:()=>{o=!1}}}createBubblePanel(e){const t=document.createElement("div");t.className="co-rte-bubble__select",t.setAttribute("data-select",e.name);const o=document.createElement("button");o.type="button",o.className="co-rte-bubble__select-trigger",o.innerHTML=`<span class="co-rte-bubble__select-label">${e.triggerLabel}</span><co-icon name="caret-down" size="12"></co-icon>`;const r=document.createElement("div");r.className="co-rte-bubble__panel",r.setAttribute("data-panel",e.name),r.style.display="none";const i=document.createElement("div");i.className="co-rte-bubble__panel-header";const n=document.createElement("div");n.className="co-rte-bubble__panel-drag",n.innerHTML='<co-icon name="dots-six" size="14"></co-icon>';const a=document.createElement("span");a.className="co-rte-bubble__panel-title",a.textContent=e.title;const c=document.createElement("button");c.type="button",c.className="co-rte-bubble__panel-close",c.innerHTML='<co-icon name="x" size="14"></co-icon>',c.addEventListener("click",(()=>{r.style.display="none"})),i.appendChild(n),i.appendChild(a),i.appendChild(c),r.appendChild(i);let s=!1,l={x:0,y:0},b={x:0,y:0};if(n.addEventListener("mousedown",(e=>{e.preventDefault(),e.stopPropagation();const t=r.getBoundingClientRect();b={x:e.clientX-t.left,y:e.clientY-t.top},s||(l={x:t.left,y:t.top}),s=!0;const o=e=>{l.x=e.clientX-b.x,l.y=e.clientY-b.y,r.style.position="fixed",r.style.top=l.y+"px",r.style.left=l.x+"px",r.style.bottom="auto",r.style.right="auto",r.style.transform="none",r.removeAttribute("data-position")},i=()=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",i)})),e.hasCustomInput){const t=document.createElement("div");t.className="co-rte-bubble__panel-input-wrap";const o=document.createElement("input");o.type=e.inputType||"text",o.className="co-rte-bubble__panel-input",o.placeholder=e.inputPlaceholder||"",o.addEventListener("mousedown",(e=>e.stopPropagation())),o.addEventListener("keydown",(t=>{if("Enter"===t.key){const t=o.value.trim();t&&e.onCustomInput&&(e.onCustomInput(t),o.value="")}"Escape"===t.key&&(t.stopPropagation(),r.style.display="none")})),t.appendChild(o),r.appendChild(t)}const d=document.createElement("div");return d.className="co-rte-bubble__panel-options",e.options.forEach((t=>{const o=document.createElement("button");o.type="button",o.className="co-rte-bubble__panel-option",o.setAttribute("data-value",t.value),e.renderOption?e.renderOption(t,o):o.textContent=t.label,o.addEventListener("click",(()=>{e.onSelect(t.value),r.style.display="none",s=!1})),d.appendChild(o)})),r.appendChild(d),r.addEventListener("mousedown",(e=>{"INPUT"!==e.target.tagName&&e.preventDefault(),this.lockBubblePosition()})),o.addEventListener("click",(()=>{this.closeAllBubblePopups(r),"none"!==r.style.display?r.style.display="none":(s=!1,r.style.position="",r.style.top="",r.style.left="",r.style.bottom="",r.style.right="",r.style.transform="",r.style.display="block",this.positionDropdown(o,r))})),t.appendChild(o),{wrap:t,panelEl:r,updateLabel:e=>{const t=o.querySelector(".co-rte-bubble__select-label");t&&(t.textContent=e)}}}createBubbleFontSizePanel(){const e=a(this.locale),t=[{label:e.title,value:"h1"},{label:e.heading1,value:"h2"},{label:e.heading2,value:"h3"},{label:"---",value:"---"},...["8px","10px","12px","14px","16px","18px","20px","24px","28px","32px","36px","48px","64px","72px"].map((e=>({label:e,value:e})))];return this.createBubblePanel({name:"fontSize",title:e.fontSize,triggerLabel:"16px",hasCustomInput:!0,inputType:"number",inputPlaceholder:e.writeSize,options:t,renderOption:(e,t)=>{if("---"===e.value)return t.className="co-rte-bubble__panel-sep",t.disabled=!0,void(t.style.pointerEvents="none");"h1"===e.value?(t.textContent=e.label,t.style.fontSize="24px",t.style.fontWeight="700",t.style.padding="6px 8px"):"h2"===e.value?(t.textContent=e.label,t.style.fontSize="18px",t.style.fontWeight="700",t.style.padding="5px 8px"):"h3"===e.value?(t.textContent=e.label,t.style.fontSize="15px",t.style.fontWeight="700",t.style.padding="4px 8px"):(t.textContent=e.label,t.style.fontSize=Math.min(parseInt(e.value),36)+"px",t.style.lineHeight="1.3")},onSelect:e=>{if(!this.editor||"---"===e)return;const t=this.editor.chain().focus();"h1"===e?t.toggleHeading({level:1}).run():"h2"===e?t.toggleHeading({level:2}).run():"h3"===e?t.toggleHeading({level:3}).run():t.setFontSize(e).run()},onCustomInput:e=>{if(!this.editor)return;const t=parseInt(e);t>0&&this.editor.chain().focus().setFontSize(t+"px").run()}})}createBubbleFontWeightPanel(){return this.createBubblePanel({name:"fontWeight",title:a(this.locale).fontWeight,triggerLabel:"Regular",hasCustomInput:!1,options:[{label:"Thin",value:"100"},{label:"Extra Light",value:"200"},{label:"Light",value:"300"},{label:"Regular",value:"400"},{label:"Medium",value:"500"},{label:"Semi Bold",value:"600"},{label:"Bold",value:"700"},{label:"Extra Bold",value:"800"},{label:"Black",value:"900"}],renderOption:(e,t)=>{t.style.fontWeight=e.value,t.innerHTML=`<span class="co-rte-bubble__panel-opt-row"><span>${e.label}</span><span class="co-rte-bubble__panel-opt-value">${e.value}</span></span>`},onSelect:e=>{this.editor&&this.editor.chain().focus().setFontWeight(e).run()}})}createBubbleLineHeightPanel(){const{panelEl:e}=this.createBubblePanel({name:"lineHeight",title:a(this.locale).lineSpacing,triggerLabel:"1.5",hasCustomInput:!0,inputPlaceholder:"1.5, 20px, 150%...",options:[{label:"0.5",value:"0.5"},{label:"1",value:"1"},{label:"1.15",value:"1.15"},{label:"1.5",value:"1.5"},{label:"1.75",value:"1.75"},{label:"2",value:"2"},{label:"2.5",value:"2.5"},{label:"3",value:"3"},{label:"---",value:"---"},{label:"16px",value:"16px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"32px",value:"32px"},{label:"---",value:"---2"},{label:"100%",value:"100%"},{label:"150%",value:"150%"},{label:"200%",value:"200%"}],renderOption:(e,t)=>{if(e.value.startsWith("---"))return t.className="co-rte-bubble__panel-sep",t.disabled=!0,void(t.style.pointerEvents="none");t.textContent=e.label},onSelect:e=>{this.editor&&!e.startsWith("---")&&this.editor.chain().focus().setLineHeight(e).run()},onCustomInput:e=>{this.editor&&this.editor.chain().focus().setLineHeight(e).run()}});return e}createBubbleLetterSpacingPanel(){const{panelEl:e}=this.createBubblePanel({name:"letterSpacing",title:a(this.locale).letterSpacing,triggerLabel:a(this.locale).normal,hasCustomInput:!0,inputPlaceholder:"Custom (em)...",options:[{label:"-0.05em",value:"-0.05em"},{label:"Normal",value:"normal"},{label:"0.05em",value:"0.05em"},{label:"0.1em",value:"0.1em"},{label:"0.2em",value:"0.2em"}],onSelect:e=>{this.editor&&("normal"===e?this.editor.chain().focus().unsetLetterSpacing().run():this.editor.chain().focus().setLetterSpacing(e).run())},onCustomInput:e=>{if(!this.editor)return;const t=e.includes("em")||e.includes("px")?e:e+"em";this.editor.chain().focus().setLetterSpacing(t).run()}});return e}createBubbleBgColorPanel(){const e=this.createBubbleColorPicker("bgColor",(e=>{this.editor&&this.editor.chain().focus().toggleHighlight({color:e}).run()})),t=e.querySelector(".co-rte-bubble__btn");return t&&(t.style.display="none"),e}createBubbleOverflowMenu(e){const t=document.createElement("div");t.className="co-rte-bubble__overflow";const o=document.createElement("button");o.type="button",o.className="co-rte-bubble__btn";const r=a(this.locale);o.title=r.moreOptions,o.setAttribute("aria-label",r.moreOptions),o.innerHTML='<co-icon name="dots-three" size="16"></co-icon>';const i=document.createElement("div");i.className="co-rte-bubble__overflow-menu",i.style.display="none";const{resetDrag:n}=this.addDragHeader(i,r.moreOptions);i.addEventListener("mousedown",(e=>{"INPUT"!==e.target.tagName&&e.preventDefault(),this.lockBubblePosition()})),[{icon:"text-strikethrough",label:r.strikethrough,action:"strike",check:"strike",type:"toggle"},{icon:"highlighter",label:r.backgroundColor,action:"bgColor",type:"panel",panel:e.bgColor},{icon:"list-bullets",label:r.bulletList,action:"bulletList",check:"bulletList",type:"toggle"},{icon:"list-numbers",label:r.orderedList,action:"orderedList",check:"orderedList",type:"toggle"},{icon:"text-superscript",label:r.superscript,action:"superscript",check:"superscript",type:"toggle"},{icon:"text-subscript",label:r.subscript,action:"subscript",check:"subscript",type:"toggle"},{icon:"line-segments",label:r.lineSpacing,action:"lineHeight",type:"panel",panel:e.lineHeight,valueAttr:"lineHeight"},{icon:"text-aa",label:r.letterSpacing,action:"letterSpacing",type:"panel",panel:e.letterSpacing,valueAttr:"letterSpacing"},{icon:"minus",label:r.horizontalRule,action:"horizontalRule",type:"toggle"},{icon:"eraser",label:r.clearFormat,action:"clearFormat",type:"toggle"}].forEach((e=>{if("lineHeight"===e.action||"horizontalRule"===e.action){const e=document.createElement("div");e.className="co-rte-bubble__overflow-sep",i.appendChild(e)}const t=document.createElement("button");t.type="button",t.className="co-rte-bubble__overflow-item",t.setAttribute("data-overflow-item",e.action),e.check&&t.setAttribute("data-check",e.check);let o="";e.valueAttr&&(o=`<span class="co-rte-bubble__overflow-value" data-overflow-value="${e.valueAttr}"></span>`),t.innerHTML=`<co-icon name="${e.icon}" size="16"></co-icon><span>${e.label}</span>${o}`,t.addEventListener("click",(()=>{if(!this.editor)return;if("panel"===e.type&&e.panel){if("bgColor"===e.action){const t=e.panel.querySelector(".co-rte-bubble__color-dropdown");if(t){const e="none"!==t.style.display;this.closeAllBubblePopups(i,e?void 0:t),t.style.display=e?"none":"block",e||this.positionPanelNearBubble(t)}}else{const t="none"!==e.panel.style.display;this.closeAllBubblePopups(i,t?void 0:e.panel),e.panel.style.display=t?"none":"block",t||this.positionPanelNearBubble(e.panel)}return}const t=this.editor.chain().focus();switch(e.action){case"strike":t.toggleStrike().run();break;case"bulletList":t.toggleBulletList().run();break;case"orderedList":t.toggleOrderedList().run();break;case"superscript":t.toggleSuperscript().run();break;case"subscript":t.toggleSubscript().run();break;case"horizontalRule":t.setHorizontalRule().run(),i.style.display="none";break;case"clearFormat":t.unsetAllMarks().clearNodes().run(),i.style.display="none"}})),i.appendChild(t)}));const c=document.createElement("div");c.className="co-rte-bubble__overflow-table-section",c.style.display="none";const s=document.createElement("div");s.className="co-rte-bubble__overflow-sep",c.appendChild(s);const l=document.createElement("div");l.className="co-rte-bubble__overflow-section-title",l.textContent=r.tableOptions,c.appendChild(l),[{action:"addColumnBefore",icon:"columns-plus-left",label:r.addColumnBefore},{action:"addColumnAfter",icon:"columns-plus-right",label:r.addColumnAfter},{action:"addRowBefore",icon:"rows-plus-top",label:r.addRowAbove},{action:"addRowAfter",icon:"rows-plus-bottom",label:r.addRowBelow},{action:"mergeCells",icon:"arrows-merge",label:r.mergeCells},{action:"splitCell",icon:"arrows-split",label:r.splitCell},{action:"toggleHeaderRow",icon:"rows",label:r.headerRow}].forEach((({action:e,icon:t,label:o})=>{const r=document.createElement("button");r.type="button",r.className="co-rte-bubble__overflow-item",r.setAttribute("data-overflow-item",e),"toggleHeaderRow"===e&&r.setAttribute("data-check","toggleHeaderRow"),r.innerHTML=`<co-icon name="${t}" size="16"></co-icon><span>${o}</span>`,r.addEventListener("click",(()=>{if(!this.editor)return;const t=this.editor.chain().focus();switch(e){case"addColumnAfter":t.addColumnAfter().run();break;case"addColumnBefore":t.addColumnBefore().run();break;case"addRowAfter":t.addRowAfter().run();break;case"addRowBefore":t.addRowBefore().run();break;case"mergeCells":t.mergeCells().run();break;case"splitCell":t.splitCell().run();break;case"toggleHeaderRow":t.toggleHeaderRow().run()}})),c.appendChild(r)}));const b=document.createElement("div");return b.className="co-rte-bubble__overflow-sep",c.appendChild(b),[{action:"deleteColumn",icon:"minus-square",label:r.deleteColumn},{action:"deleteRow",icon:"x-square",label:r.deleteRow},{action:"deleteTable",icon:"trash",label:r.deleteTable}].forEach((({action:e,icon:t,label:o})=>{const r=document.createElement("button");r.type="button",r.className="co-rte-bubble__overflow-item co-rte-bubble__overflow-item--danger",r.setAttribute("data-overflow-item",e),r.innerHTML=`<co-icon name="${t}" size="16"></co-icon><span>${o}</span>`,r.addEventListener("click",(()=>{if(!this.editor)return;const t=this.editor.chain().focus();switch(e){case"deleteColumn":t.deleteColumn().run();break;case"deleteRow":t.deleteRow().run();break;case"deleteTable":t.deleteTable().run(),i.style.display="none"}})),c.appendChild(r)})),i.appendChild(c),o.addEventListener("click",(()=>{this.closeAllBubblePopups(i),"none"!==i.style.display?i.style.display="none":(n(),i.style.position="",i.style.top="",i.style.left="",i.style.bottom="",i.style.right="",i.style.transform="",i.style.display="block",this.positionDropdown(o,i))})),t.appendChild(o),t.appendChild(i),{overflowWrap:t,overflowMenu:i}}toggleBubbleLinkForm(e){var t,o;if(this.bubbleLinkFormEl&&this.bubbleLinkInputEl&&(this.bubbleLinkFormEl.style.display=e?"flex":"none",e)){const e=(null===(t=this.editor)||void 0===t?void 0:t.isActive("link"))&&(null===(o=this.editor.getAttributes("link"))||void 0===o?void 0:o.href)||"";this.bubbleLinkInputEl.value=e,this.bubbleLinkUnlinkEl&&(this.bubbleLinkUnlinkEl.style.display=e?"flex":"none"),setTimeout((()=>{var e;return null===(e=this.bubbleLinkInputEl)||void 0===e?void 0:e.focus()}),0)}}submitBubbleLinkImperative(){if(!this.editor||!this.bubbleLinkInputEl)return;const e=this.bubbleLinkInputEl.value.trim();e?(this.editor.chain().focus().setLink({href:e}).run(),this.toggleBubbleLinkForm(!1)):this.toggleBubbleLinkForm(!1)}updateBubbleActiveStates(){if(!this.editor||!this.bubbleEl)return;this.bubbleEl.querySelectorAll(".co-rte-bubble__btn[data-check]").forEach((e=>{const t=e.getAttribute("data-check");t&&e.classList.toggle("co-rte-bubble__btn--active",this.editor.isActive(t))})),this.bubbleEl.querySelectorAll(".co-rte-bubble__btn[data-align]").forEach((e=>{const t=e.getAttribute("data-align");t&&e.classList.toggle("co-rte-bubble__btn--active",this.editor.isActive({textAlign:t}))}));const e=this.bubbleEl.querySelector('[data-select="fontFamily"] .co-rte-bubble__select-label');if(e){const t=this.editor.getAttributes("textStyle"),o=(null==t?void 0:t.fontFamily)||"";e.textContent=o?o.split(",")[0].replace(/['"]/g,"").trim():"Sans-serif"}const t=this.bubbleEl.querySelector('[data-select="fontSize"] .co-rte-bubble__select-label');if(t){const e=this.editor.getAttributes("textStyle"),o=a(this.locale);t.textContent=this.editor.isActive("heading",{level:1})?o.title:this.editor.isActive("heading",{level:2})?o.headingAbbr1:this.editor.isActive("heading",{level:3})?o.headingAbbr2:(null==e?void 0:e.fontSize)||"16px"}const o=this.bubbleEl.querySelector('[data-select="fontWeight"] .co-rte-bubble__select-label');if(o){const e=this.editor.getAttributes("textStyle");o.textContent={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi-bold",700:"Bold",800:"Extra-bold",900:"Black"}[(null==e?void 0:e.fontWeight)||"400"]||"Regular"}this.bubbleEl.querySelectorAll(".co-rte-bubble__overflow-item[data-check]").forEach((e=>{const t=e.getAttribute("data-check");t&&e.classList.toggle("co-rte-bubble__overflow-item--active",this.editor.isActive(t))}));const r=this.bubbleEl.querySelector('[data-overflow-value="lineHeight"]');if(r){const e=this.editor.getAttributes("paragraph"),t=this.editor.getAttributes("heading");r.textContent=(null==e?void 0:e.lineHeight)||(null==t?void 0:t.lineHeight)||""}const i=this.bubbleEl.querySelector('[data-overflow-value="letterSpacing"]');if(i){const e=this.editor.getAttributes("textStyle");i.textContent=(null==e?void 0:e.letterSpacing)||""}const n=this.bubbleEl.querySelector(".co-rte-bubble__color-bar");if(n){const e=this.editor.getAttributes("textStyle");n.style.background=(null==e?void 0:e.color)||"#000000"}const c=this.bubbleEl.querySelector(".co-rte-bubble__overflow-table-section");if(c){const e=this.editor.isActive("table");if(c.style.display=e?"block":"none",e){const e=c.querySelector('[data-overflow-item="toggleHeaderRow"]');if(e){const t=this.editor.view,{$anchor:o}=this.editor.state.selection;let r=o.depth,i=!1;for(;r>0;){if("table"===o.node(r).type.name){const e=t.nodeDOM(o.start(r)-1);if(e){const t=(e.querySelector("table")||e).querySelector("tr");i=!!t&&null!==t.querySelector("th")}break}r--}e.classList.toggle("co-rte-bubble__overflow-item--active",i)}}}}createImageLayoutBar(){const t=document.createElement("div");t.className="co-rte-img-layout",t.style.display="none",t.addEventListener("mousedown",(e=>{e.preventDefault(),e.stopPropagation()}));const o=a(this.locale),r={inline:o.imageLayoutInline,"wrap-left":o.imageLayoutWrapLeft,"wrap-right":o.imageLayoutWrapRight,center:o.imageLayoutCenter,"full-width":o.imageLayoutFullWidth};return["inline","wrap-left","wrap-right","center","full-width"].forEach((o=>{const i=document.createElement("button");i.type="button",i.className="co-rte-img-layout__btn",i.setAttribute("data-layout",o),i.setAttribute("data-tooltip",r[o]||o),i.setAttribute("aria-label",r[o]||o),i.innerHTML=`<co-icon name="${e.IMG_LAYOUT_ICONS[o]}" size="18"></co-icon>`,i.addEventListener("click",(()=>this.setImageLayout(o))),t.appendChild(i)})),t}setImageLayout(e){if(!this.editor||!this.contentEl)return;const{state:t}=this.editor,o=t.selection;if("NodeSelection"!==o.constructor.name)return;const r=o.node;if("image"!==(null==r?void 0:r.type.name))return;const i=o.from,n=t.tr.setNodeMarkup(i,void 0,Object.assign(Object.assign({},r.attrs),{imageLayout:e}));this.editor.view.dispatch(n),this.editor.commands.setNodeSelection(i),requestAnimationFrame((()=>{this.syncImageLayouts(),this.updateImageLayoutBar()}))}getSelectedImageInfo(){var e;if(!this.editor)return null;const{state:t}=this.editor,o=t.selection;if("NodeSelection"!==o.constructor.name)return null;const r=o.node;if("image"!==(null==r?void 0:r.type.name))return null;const i=o.from,n=this.editor.view.nodeDOM(i);return n?{node:r,pos:i,container:(null===(e=n.closest)||void 0===e?void 0:e.call(n,"[data-resize-container]"))||n}:null}syncImageLayouts(){if(!this.editor)return;const e=this.editor.view;this.editor.state.doc.descendants(((t,o)=>{var r;if("image"!==t.type.name)return!0;const i=e.nodeDOM(o),n=(null===(r=null==i?void 0:i.closest)||void 0===r?void 0:r.call(i,"[data-resize-container]"))||i;return!n||(n.dataset.imageLayout=t.attrs.imageLayout||"inline",n.style.position="",n.style.left="",n.style.top="",n.style.zIndex="",!0)}))}updateImageLayoutBarPosition(){if(!this.imgLayoutEl||!this.contentEl)return;const e=this.getSelectedImageInfo();if(!e)return;const t=e.container.getBoundingClientRect(),o=this.contentEl.getBoundingClientRect(),r=this.imgLayoutEl.offsetWidth||194;let i=t.left+t.width/2-o.left+this.contentEl.scrollLeft-r/2;i=Math.max(4,Math.min(i,o.width-r-4));const n=t.bottom-o.top+this.contentEl.scrollTop+8;this.imgLayoutEl.style.left=i+"px",this.imgLayoutEl.style.top=n+"px"}updateImageLayoutBar(){if(!this.imgLayoutEl||!this.editor)return;const e=this.getSelectedImageInfo();if(!e)return void(this.imgLayoutVisible&&(this.imgLayoutEl.style.display="none",this.imgLayoutVisible=!1));this.imgLayoutEl.style.display="flex",this.imgLayoutVisible=!0,this.updateImageLayoutBarPosition();const t=e.node.attrs.imageLayout||"inline";this.imgLayoutEl.querySelectorAll(".co-rte-img-layout__btn").forEach((e=>{e.classList.toggle("co-rte-img-layout__btn--active",e.getAttribute("data-layout")===t)}))}render(){const e="none"!==this.resolvedToolbar&&!this.readonly&&!this.disabled,t=this.showCharacterCount||null!=this.maxLength;return r("div",{key:"3acc844eb53d8b3568d9f72e053363b674e9ba87",class:{"co-rich-text-editor":!0,"co-rich-text-editor--focused":this.hasFocus,"co-rich-text-editor--disabled":this.disabled,"co-rich-text-editor--readonly":this.readonly,"co-rich-text-editor--loading":!this.ready,["co-rich-text-editor--"+this.status]:"default"!==this.status,"co-rich-text-editor--flat":"flat"===this.variant},part:"wrapper"},(this.label||this.secondaryLabel)&&r("div",{key:"53b6f47e19e422ab1c7b3e2d452f320495199c33",class:"co-rich-text-editor__labels"},this.label&&r("label",{key:"c4c7eb0f49cbffc40cbd6cfd2a28848201623be9",class:"co-rich-text-editor__label",part:"label"},this.label),this.secondaryLabel&&r("span",{key:"13663ac237f80b637ebf8df841ba52c4aa73a0f4",class:"co-rich-text-editor__secondary-label"},this.secondaryLabel)),r("div",{key:"deb51dfabddb6ca08dc849f17f7850d635bee9e0",class:"co-rich-text-editor__frame"},e&&r("co-rich-text-toolbar",{key:"f62c2cf76ce791f0648bde14c30300c40417a22b",class:"co-rich-text-editor__toolbar",part:"toolbar",variant:this.resolvedToolbar,disabled:this.disabled||this.readonly,locale:this.locale,attachmentsEnabled:this.attachmentsEnabled,attachmentAccept:this.attachmentAccept,onCoAttachmentsSelected:e=>{e.stopPropagation(),this.coAttachmentsSelected.emit(e.detail)},ref:e=>this.toolbarEl=e}),r("div",{key:"af3c512a9ec4ed3dc62d83b8acbd13132c84f349",class:"co-rich-text-editor__box"},r("div",{key:"3cacb60bf24487d631ec3e7153313b3ed940ea8e",class:"co-rte-content",part:"content",role:"textbox","aria-multiline":"true","aria-label":this.label,"aria-required":this.required?"true":void 0,"aria-invalid":"error"===this.status?"true":void 0,ref:e=>this.contentEl=e}))),r("div",{key:"ac6511ee617587f29a55adeb5ef9840be559adcd",class:"co-rich-text-editor__footer"},this.helperText&&r("div",{key:"8ae2c198a948e553d22111bad15d5119c7ee090f",class:"co-rich-text-editor__helper co-rich-text-editor__helper--"+this.status,part:"helper"},r("co-icon",{key:"a764d0daeeaeee64fae43c2358cdad9ecfe89b13",name:this.helperIcon,size:14}),r("span",{key:"c1efcf1a97de016fa78a408306696cc0f4b29f29"},this.helperText)),t&&r("span",{key:"c68f01b407e6b2aa17582b58244b147825729138",class:"co-rich-text-editor__count",ref:e=>this.charCountEl=e},this.charCount,null!=this.maxLength?" / "+this.maxLength:"")))}get el(){return this}static get watchers(){return{accountFonts:[{onAccountFontsChange:0}],value:[{onValueChange:0}],disabled:[{onEditableChange:0}],readonly:[{onEditableChange:0}]}}static get style(){return'co-rich-text-editor{display:block;font-family:var(--co-font-family-primary);font-size:var(--co-font-size-14);letter-spacing:var(--co-font-letter-spacing-body)}.co-rich-text-editor{display:flex;flex-direction:column;gap:var(--co-spacing-sm2, 6px)}.co-rich-text-editor__labels{display:flex;align-items:center;justify-content:space-between;padding:0 var(--co-spacing-xs);gap:var(--co-spacing-sm2, 6px)}.co-rich-text-editor__label,.co-rich-text-editor__secondary-label{color:var(--co-semantic-text-secondary);font-size:var(--co-font-size-14);font-weight:400;line-height:1}.co-rich-text-editor__frame{display:flex;flex-direction:column;background:var(--co-semantic-surface-page);border:1px solid var(--co-semantic-border-field);border-radius:var(--co-border-radius-xs);transition:border-color var(--co-motion-duration-fast) var(--co-motion-ease-out), box-shadow var(--co-motion-duration-fast) var(--co-motion-ease-out);min-height:0;flex:1;position:relative;overflow:visible}.co-rich-text-editor__box{display:flex;flex-direction:column;min-height:0;flex:1;position:relative;overflow-y:auto;overflow-x:hidden}.co-rich-text-editor--flat .co-rich-text-editor__frame{background:transparent;border-color:transparent}.co-rich-text-editor--focused .co-rich-text-editor__frame{border-color:var(--co-semantic-border-focus, var(--co-color-base-negro, #1a1a1a));box-shadow:0 0 0 3px var(--co-semantic-border-focus-ring, rgba(37, 99, 235, 0.15))}.co-rich-text-editor--error .co-rich-text-editor__frame{border-color:var(--co-color-status-error)}.co-rich-text-editor--success .co-rich-text-editor__frame{border-color:var(--co-color-status-success)}.co-rich-text-editor--disabled .co-rich-text-editor__frame,.co-rich-text-editor--readonly .co-rich-text-editor__frame{opacity:0.7;cursor:not-allowed}.co-rich-text-editor--loading .co-rte-content{min-height:96px;background:linear-gradient(90deg, var(--co-semantic-surface-secondary) 0%, var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.04)) 50%, var(--co-semantic-surface-secondary) 100%);background-size:200% 100%;animation:co-rte-skeleton 1.2s ease-in-out infinite}@keyframes co-rte-skeleton{0%{background-position:200% 0}100%{background-position:-200% 0}}.co-rich-text-editor__toolbar{position:relative;flex-shrink:0;z-index:60;border-top-left-radius:calc(var(--co-border-radius-xs) - 1px);border-top-right-radius:calc(var(--co-border-radius-xs) - 1px)}.co-rte-content{min-height:96px;color:var(--co-semantic-text-default);flex:1 0 auto;display:flex;flex-direction:column}.co-rte-content .ProseMirror{outline:none;flex:1 0 auto;line-height:1.5;padding:var(--co-spacing-md);box-sizing:border-box}.co-rte-content .ProseMirror p{margin:0 0 var(--co-spacing-sm) 0}.co-rte-content .ProseMirror p:last-child{margin-bottom:0}.co-rte-content .ProseMirror>p{margin-bottom:var(--co-spacing-sm) !important}.co-rte-content .ProseMirror>p:last-child{margin-bottom:0 !important}.co-rte-content .ProseMirror [style*="text-align: justify"]{text-align-last:left}.co-rte-content .ProseMirror [style*="text-align: center"]{text-align:center}.co-rte-content .ProseMirror [style*="text-align: right"]{text-align:right}.co-rte-content .ProseMirror h1,.co-rte-content .ProseMirror h2,.co-rte-content .ProseMirror h3,.co-rte-content .ProseMirror h4{margin:var(--co-spacing-md) 0 var(--co-spacing-sm);font-weight:600;line-height:1.3}.co-rte-content .ProseMirror h1{font-size:var(--co-font-size-28, 28px)}.co-rte-content .ProseMirror h2{font-size:var(--co-font-size-20, 20px)}.co-rte-content .ProseMirror h3{font-size:var(--co-font-size-16, 16px)}.co-rte-content .ProseMirror ul,.co-rte-content .ProseMirror ol{padding-left:var(--co-spacing-xl);margin:0 0 var(--co-spacing-sm) 0}.co-rte-content .ProseMirror ul[data-type="taskList"]{list-style:none;padding-left:0;margin:0 0 var(--co-spacing-sm) 0}.co-rte-content .ProseMirror ul[data-type="taskList"] li{display:flex;align-items:flex-start;gap:var(--co-spacing-sm, 8px)}.co-rte-content .ProseMirror ul[data-type="taskList"] li>label{flex:0 0 auto;margin-top:0.15em;user-select:none}.co-rte-content .ProseMirror ul[data-type="taskList"] li>div{flex:1 1 auto;min-width:0}.co-rte-content .ProseMirror ul[data-type="taskList"] li>div>p{margin:0}.co-rte-content .ProseMirror ul[data-type="taskList"] input[type="checkbox"]{width:16px;height:16px;cursor:pointer;accent-color:var(--co-color-base-negro, #1a1a1a)}.co-rte-content .ProseMirror ul[data-type="taskList"][data-variant="strike"] li[data-checked="true"]>div{text-decoration:line-through;color:var(--co-semantic-text-muted, #999)}.co-rte-content .ProseMirror ul[data-type="taskList"][data-variant="plain"] li[data-checked="true"]>div{text-decoration:none}.co-rte-content .ProseMirror blockquote{border-left:3px solid var(--co-semantic-border-default, var(--co-semantic-border-subtle));padding-left:var(--co-spacing-md);margin:0 0 var(--co-spacing-sm) 0;color:var(--co-semantic-text-secondary)}.co-rte-content .ProseMirror a{color:var(--co-color-base-negro, #1a1a1a);text-decoration:underline;text-underline-offset:2px}.co-rte-content .ProseMirror img{max-width:100%;height:auto;border-radius:var(--co-border-radius-xs);margin:var(--co-spacing-sm) 0;cursor:default;-webkit-user-drag:none;user-select:none}.co-rte-content .ProseMirror img.ProseMirror-selectednode{outline:2px solid var(--co-color-base-negro, #1a1a1a)}.co-rte-content [data-resize-container].ProseMirror-selectednode{outline:2px solid var(--co-color-base-negro, #1a1a1a);outline-offset:0px;border-radius:0}.co-rte-content [data-resize-container]{position:relative;display:inline-block;width:fit-content;max-width:100%;margin:var(--co-spacing-sm) 0;line-height:0}.co-rte-content [data-resize-container][data-resize-state="true"]{outline:2px solid var(--co-color-base-negro, #1a1a1a);outline-offset:0px;border-radius:0}.co-rte-content [data-resize-wrapper]{position:relative;display:inline-block;line-height:0}.co-rte-content [data-resize-handle]{width:10px;height:10px;background:var(--co-color-base-negro, #1a1a1a);border:1.5px solid #fff;border-radius:50%;box-shadow:0 0 2px rgba(0, 0, 0, 0.3);z-index:5;opacity:0;pointer-events:none}.co-rte-content [data-resize-container][data-resize-state="true"] [data-resize-handle],.co-rte-content [data-resize-container].ProseMirror-selectednode [data-resize-handle]{opacity:1;pointer-events:auto}.co-rte-content [data-resize-handle="top-left"]{cursor:nw-resize}.co-rte-content [data-resize-handle="top-right"]{cursor:ne-resize}.co-rte-content [data-resize-handle="bottom-left"]{cursor:sw-resize}.co-rte-content [data-resize-handle="bottom-right"]{cursor:se-resize}.co-rte-content [data-resize-handle="top"],.co-rte-content [data-resize-handle="bottom"]{width:30px;height:6px;border-radius:3px;left:50% !important;transform:translateX(-50%)}.co-rte-content [data-resize-handle="top"]{cursor:n-resize}.co-rte-content [data-resize-handle="bottom"]{cursor:s-resize}.co-rte-content [data-resize-handle="left"],.co-rte-content [data-resize-handle="right"]{width:6px;height:30px;border-radius:3px;top:50% !important;transform:translateY(-50%)}.co-rte-content [data-resize-handle="left"]{cursor:w-resize}.co-rte-content [data-resize-handle="right"]{cursor:e-resize}.co-rte-content [data-resize-container] img{max-width:100%;display:block;border-radius:0;margin:0}.co-rte-content .ProseMirror hr{border:none;border-top:1px solid var(--co-semantic-border-default, #e0e0e0);margin:var(--co-spacing-lg) 0}.co-rte-content .ProseMirror code{font-family:var(--co-font-family-mono);font-size:0.9em;background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06));padding:0.1em 0.3em;border-radius:var(--co-border-radius-xxs)}.co-rte-content .ProseMirror pre{font-family:var(--co-font-family-mono);font-size:0.9em;background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06));padding:var(--co-spacing-md);border-radius:var(--co-border-radius-xs);overflow-x:auto;margin:var(--co-spacing-sm) 0}.co-rte-content .ProseMirror pre code{background:none;padding:0;border-radius:0}.co-rte-content .ProseMirror p.is-editor-empty:first-child::before{content:attr(data-placeholder);color:var(--co-semantic-text-muted);float:left;height:0;pointer-events:none}.co-rte-content .co-rte-variable,.co-rte-content .co-rte-mention{display:inline-block;padding:0.05em 0.4em;border-radius:var(--co-border-radius-xxs);background:var(--co-color-base-negro, #1a1a1a);color:var(--co-color-base-blanco, #fff);font-size:0.9em;white-space:nowrap}.co-rte-content .co-rte-mention{background:var(--co-color-azul-200);color:var(--co-color-azul-800)}.co-rich-text-editor__footer{display:flex;align-items:center;justify-content:space-between;gap:var(--co-spacing-sm);padding:0 var(--co-spacing-xs);min-height:0}.co-rich-text-editor__helper{display:flex;align-items:center;gap:var(--co-spacing-xs);color:var(--co-semantic-text-secondary);font-size:var(--co-font-size-12, 12px)}.co-rich-text-editor__helper--error{color:var(--co-color-status-error)}.co-rich-text-editor__helper--success{color:var(--co-color-status-success)}.co-rich-text-editor__count{margin-left:auto;color:var(--co-semantic-text-muted);font-size:var(--co-font-size-12, 12px)}.co-rte-bubble.co-rte-bubble--suppressed{display:none !important}.co-rte-bubble{position:absolute;z-index:50;display:flex;flex-direction:row;align-items:center;gap:2px;padding:var(--co-spacing-xs, 4px) var(--co-spacing-sm, 8px);background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xs, 8px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);user-select:none;white-space:nowrap;max-width:100%;box-sizing:border-box;flex-wrap:wrap}.co-rte-bubble__drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;color:var(--co-semantic-text-muted, #999);width:18px;height:28px;margin:0 2px 0 0;flex-shrink:0}.co-rte-bubble__drag-handle:hover{color:var(--co-semantic-text-secondary, #555)}.co-rte-bubble__drag-handle:active{cursor:grabbing}.co-rte-bubble__row{display:flex;align-items:center;gap:2px;flex-wrap:wrap;max-width:100%;min-width:0}.co-rte-bubble__btn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:var(--co-border-radius-xxs, 4px);background:transparent;color:var(--co-semantic-text-default, #333);cursor:pointer}.co-rte-bubble__btn:hover:not(.co-rte-bubble__btn--active){background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06))}.co-rte-bubble__btn--active{background:var(--co-color-base-negro, #1a1a1a);color:var(--co-color-base-blanco, #fff)}.co-rte-bubble__btn--active:hover{background:var(--co-color-base-negro, #333)}.co-rte-bubble__sep{display:inline-block;width:1px;height:18px;margin:0 4px;background:var(--co-semantic-border-default, rgba(0, 0, 0, 0.12));flex-shrink:0}.co-rte-bubble__select{position:relative}.co-rte-bubble__select-trigger{display:flex;align-items:center;gap:2px;height:28px;padding:0 6px;border:1px solid transparent;border-radius:var(--co-border-radius-xxs, 4px);background:transparent;color:var(--co-semantic-text-default, #333);font-family:var(--co-font-family-primary);font-size:11px;cursor:pointer;white-space:nowrap;transition:background var(--co-motion-duration-fast), border-color var(--co-motion-duration-fast)}.co-rte-bubble__select-trigger:hover{background:var(--co-semantic-surface-hover, #f5f5f5);border-color:var(--co-semantic-border-default, #e0e0e0)}.co-rte-bubble__select-label{max-width:72px;overflow:hidden;text-overflow:ellipsis}.co-rte-bubble__select--font .co-rte-bubble__select-label{max-width:110px}.co-rte-bubble__select-dropdown{position:absolute;bottom:100%;left:0;z-index:120;min-width:100px;max-height:260px;overflow-y:auto;padding:var(--co-spacing-xxs, 2px);background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xxs, 4px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);margin-bottom:4px;white-space:normal}.co-rte-bubble__select-dropdown[data-position="above"]{bottom:100%;top:auto;margin-bottom:4px;margin-top:0}.co-rte-bubble__select-dropdown[data-position="below"]{top:100%;bottom:auto;margin-top:4px;margin-bottom:0}.co-rte-bubble__select-option{display:block;width:100%;padding:4px 8px;border:none;border-radius:3px;background:transparent;color:var(--co-semantic-text-default, #333);font-family:var(--co-font-family-primary);font-size:12px;text-align:left;cursor:pointer;white-space:nowrap}.co-rte-bubble__select-option:hover{background:var(--co-semantic-surface-hover, #f5f5f5)}.co-rte-bubble__select-dropdown--font{min-width:200px;max-height:320px;overflow:hidden;overflow-y:auto;display:flex;flex-direction:column;white-space:normal}.co-rte-bubble__font-search{padding:6px 6px 4px;flex-shrink:0}.co-rte-bubble__font-search-input{width:100%;padding:4px 8px;border:1px solid var(--co-semantic-border-default, #ccc);border-radius:4px;background:var(--co-semantic-surface-secondary, #fff);color:var(--co-semantic-text-default, #333);font-family:var(--co-font-family-primary);font-size:12px;outline:none;box-sizing:border-box}.co-rte-bubble__font-search-input:focus{border-color:var(--co-color-base-negro, #1a1a1a)}.co-rte-bubble__font-list{max-height:260px;overflow-y:auto;padding:0 var(--co-spacing-xxs, 2px) var(--co-spacing-xxs, 2px)}.co-rte-bubble__font-section-header{padding:6px 8px 2px;font-size:11px;font-weight:600;color:var(--co-semantic-text-muted, #888);text-transform:uppercase;letter-spacing:0.5px}.co-rte-bubble__font-empty{padding:12px 8px;text-align:center;color:var(--co-semantic-text-muted, #888);font-size:12px}.co-rte-bubble__color{position:relative}.co-rte-bubble__color-dropdown{position:absolute;bottom:100%;left:50%;transform:translateX(-50%);z-index:120;width:224px;padding:var(--co-spacing-sm, 8px);background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xs, 8px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);margin-bottom:4px;white-space:normal;max-width:calc(100vw - 16px)}.co-rte-bubble__color-dropdown[data-position="above"]{bottom:100%;top:auto;margin-bottom:4px;margin-top:0}.co-rte-bubble__color-dropdown[data-position="below"]{top:100%;bottom:auto;margin-top:4px;margin-bottom:0}.co-rte-bubble__color-grid{display:grid;grid-template-columns:repeat(10, 1fr);gap:2px}.co-rte-bubble__color-swatch{width:20px;height:20px;padding:0;border:none;border-radius:3px;cursor:pointer;transition:transform var(--co-motion-duration-fast), box-shadow var(--co-motion-duration-fast)}.co-rte-bubble__color-swatch:hover{transform:scale(1.2);box-shadow:0 0 0 2px var(--co-color-base-negro, #1a1a1a)}.co-rte-bubble__color-hex{display:flex;align-items:center;gap:4px;margin-top:6px}.co-rte-bubble__color-hex-input{width:100%;padding:3px 6px;border:1px solid var(--co-semantic-border-default, #ccc);border-radius:3px;background:var(--co-semantic-surface-secondary, #fff);color:var(--co-semantic-text-default, #333);font-family:var(--co-font-family-mono, monospace);font-size:11px;outline:none}.co-rte-bubble__color-hex-input:focus{border-color:var(--co-color-base-negro, #1a1a1a)}.co-rte-bubble__color-clear{display:flex;align-items:center;gap:4px;width:100%;padding:3px 6px;margin-top:4px;border:none;background:transparent;color:var(--co-semantic-text-secondary, #666);font-family:var(--co-font-family-primary);font-size:11px;cursor:pointer;border-radius:3px}.co-rte-bubble__color-clear:hover{background:var(--co-semantic-surface-hover, #f5f5f5)}.co-rte-bubble__link-form{display:flex;align-items:center;gap:4px;margin-left:4px}.co-rte-bubble__link-input{width:160px;padding:3px 8px;border:1px solid var(--co-semantic-border-default, #ccc);border-radius:4px;background:var(--co-semantic-surface-secondary, #fff);color:var(--co-semantic-text-default, #333);font-family:var(--co-font-family-primary);font-size:12px;outline:none}.co-rte-bubble__link-input::placeholder{color:var(--co-semantic-text-muted, #999)}.co-rte-bubble__link-input:focus{border-color:var(--co-color-base-negro, #1a1a1a);box-shadow:0 0 0 2px rgba(0, 0, 0, 0.1)}.co-rte-bubble__link-btn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:4px;background:var(--co-color-base-negro, #1a1a1a);color:#fff;cursor:pointer}.co-rte-bubble__link-btn:hover{opacity:0.9}.co-rte-bubble__link-unlink{background:var(--co-semantic-status-error, #aa2e1b)}.co-rte-bubble__panel{position:absolute;z-index:140;width:230px;background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xs, 8px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);overflow:hidden;user-select:none}.co-rte-bubble__panel-header{display:flex;align-items:center;gap:4px;padding:6px 8px;border-bottom:1px solid var(--co-semantic-border-subtle, #eee)}.co-rte-bubble__panel-drag{cursor:grab;display:flex;align-items:center;justify-content:center;color:var(--co-semantic-text-muted, #999);flex-shrink:0}.co-rte-bubble__panel-drag:active{cursor:grabbing}.co-rte-bubble__panel-title{flex:1;font-size:12px;font-weight:600;color:var(--co-semantic-text-default, #333);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-rte-bubble__panel-close{display:flex;align-items:center;justify-content:center;width:22px;height:22px;border:none;border-radius:3px;background:transparent;color:var(--co-semantic-text-muted, #999);cursor:pointer;flex-shrink:0}.co-rte-bubble__panel-close:hover{background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06));color:var(--co-semantic-text-default, #333)}.co-rte-bubble__panel-input-wrap{padding:6px 8px}.co-rte-bubble__panel-input{width:100%;padding:4px 8px;border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:4px;font-size:12px;font-family:inherit;outline:none;box-sizing:border-box;background:var(--co-semantic-surface-secondary, #fff);color:var(--co-semantic-text-default, #333)}.co-rte-bubble__panel-input:focus{border-color:var(--co-color-base-negro, #1a1a1a)}.co-rte-bubble__panel-options{max-height:280px;overflow-y:auto;padding:2px 4px 4px}.co-rte-bubble__panel-option{display:block;width:100%;padding:5px 8px;border:none;border-radius:3px;background:transparent;cursor:pointer;text-align:left;font-family:inherit;color:var(--co-semantic-text-default, #333)}.co-rte-bubble__panel-option:hover{background:var(--co-semantic-surface-hover, #f5f5f5)}.co-rte-bubble__panel-sep{height:1px;background:var(--co-semantic-border-subtle, #eee);margin:4px 8px}.co-rte-bubble__panel-opt-row{display:flex;justify-content:space-between;align-items:center;width:100%}.co-rte-bubble__panel-opt-value{color:var(--co-semantic-text-muted, #999);font-size:11px;font-weight:400 !important;min-width:28px;text-align:right}.co-rte-bubble__panel[data-position="above"]{bottom:100%;top:auto;margin-bottom:4px}.co-rte-bubble__panel[data-position="below"]{top:100%;bottom:auto;margin-top:4px}.co-rte-bubble__overflow{position:relative}.co-rte-bubble__overflow-menu{position:absolute;bottom:100%;right:0;z-index:130;min-width:230px;padding:4px;background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xs, 8px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);margin-bottom:4px}.co-rte-bubble__overflow-menu[data-position="below"]{top:100%;bottom:auto;margin-top:4px;margin-bottom:0}.co-rte-bubble__overflow-item{display:flex;align-items:center;gap:8px;width:100%;padding:6px 8px;border:none;border-radius:4px;background:transparent;font-family:inherit;font-size:13px;color:var(--co-semantic-text-default, #333);cursor:pointer;text-align:left;white-space:nowrap}.co-rte-bubble__overflow-item:hover{background:var(--co-semantic-surface-hover, #f5f5f5)}.co-rte-bubble__overflow-item--active{background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06));color:var(--co-color-base-negro, #1a1a1a);font-weight:600}.co-rte-bubble__overflow-value{margin-left:auto;color:var(--co-semantic-text-muted, #999);font-size:11px}.co-rte-bubble__overflow-sep{height:1px;background:var(--co-semantic-border-subtle, #eee);margin:3px 8px}.co-rte-bubble__overflow-section-title{padding:6px 8px 2px;font-size:11px;font-weight:600;color:var(--co-semantic-text-muted, #888);letter-spacing:0.5px}.co-rte-bubble__overflow-item--danger{color:var(--co-color-status-error, #aa2e1b)}.co-rte-bubble__overflow-item--danger:hover{background:rgba(170, 46, 27, 0.06)}.co-rte-bubble__color-indicator{display:flex;flex-direction:column;align-items:center;gap:1px;line-height:1}.co-rte-bubble__color-letter{font-family:var(--co-font-family-primary);font-size:14px;font-weight:700;color:var(--co-semantic-text-default, #333);line-height:1}.co-rte-bubble__color-bar{width:14px;height:3px;border-radius:1px}.co-rte-content .callout{display:flex;gap:0.75rem;padding:1rem;border-radius:var(--co-border-radius-xs, 8px);border:2px solid;margin:1rem 0}.co-rte-content .callout--info{background:#eff6ff;border-color:#bfdbfe}.co-rte-content .callout--warning{background:#fffbeb;border-color:#fde68a}.co-rte-content .callout--success{background:#f0fdf4;border-color:#bbf7d0}.co-rte-content .callout--error{background:#fef2f2;border-color:#fecaca}.co-rte-content .callout__icon{flex-shrink:0;font-size:1.2em}.co-rte-content .callout__content{flex:1}.co-rte-content .callout__content p{margin:0}.co-rte-content table{border-collapse:collapse;table-layout:auto;width:100%;margin:1rem 0;overflow:hidden}.co-rte-content .tableWrapper{overflow-x:auto;max-width:100%}.co-rte-content td,.co-rte-content th{min-width:1em;border:1px solid var(--co-semantic-border-default, #e0e0e0);padding:0.5rem;vertical-align:top;box-sizing:border-box;position:relative}.co-rte-content th{font-weight:600;text-align:left;background-color:#e3e3e3;color:var(--co-semantic-text-default, #333)}.co-rte-content .ProseMirror table th{background-color:#e3e3e3}.co-rte-content .selectedCell{background:rgba(0, 0, 0, 0.06)}.co-rte-content .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;background-color:var(--co-color-base-negro, #1a1a1a);pointer-events:none}.co-rte-content .ProseMirror.resize-cursor,.co-rte-content .ProseMirror.resize-cursor *{cursor:col-resize}.co-rte-content iframe{border-radius:var(--co-border-radius-xs, 8px);max-width:100%;aspect-ratio:16 / 9;width:100%;height:auto;display:block;margin:0}.co-rte-content .co-rte-embed{position:relative;display:block;max-width:100%;margin:1rem 0;line-height:0}.co-rte-content .co-rte-embed::before{content:\'\';position:absolute;inset:0;z-index:1}.co-rte-content .co-rte-embed.ProseMirror-selectednode,.co-rte-content .co-rte-embed--selected{outline:2px solid var(--co-color-base-negro, #1a1a1a);outline-offset:2px;border-radius:var(--co-border-radius-xs, 8px)}.co-rte-content .co-rte-embed__handle{position:absolute;width:12px;height:12px;background:var(--co-color-base-negro, #1a1a1a);border:1.5px solid #fff;border-radius:50%;box-shadow:0 0 2px rgba(0, 0, 0, 0.3);z-index:3;opacity:0;pointer-events:none}.co-rte-content .co-rte-embed.ProseMirror-selectednode .co-rte-embed__handle,.co-rte-content .co-rte-embed--selected .co-rte-embed__handle{opacity:1;pointer-events:auto}.co-rte-content .co-rte-embed__handle--bottom-right{right:-6px;bottom:-6px;cursor:nwse-resize}.co-rte-content .co-rte-embed__handle--bottom-left{left:-6px;bottom:-6px;cursor:nesw-resize}.co-rte-content .co-rte-embed--resizing{outline:2px dashed var(--co-color-base-negro, #1a1a1a);outline-offset:2px}.co-rich-text-editor--readonly .co-rte-embed::before,.co-rich-text-editor--disabled .co-rte-embed::before{display:none}.co-rich-text-editor--readonly .co-rte-embed.ProseMirror-selectednode,.co-rich-text-editor--readonly .co-rte-embed--selected,.co-rich-text-editor--disabled .co-rte-embed.ProseMirror-selectednode,.co-rich-text-editor--disabled .co-rte-embed--selected{outline:none !important}.co-rte-img-layout{position:absolute;z-index:50;display:flex;align-items:center;gap:2px;padding:4px;background:var(--co-semantic-surface-secondary, #fff);border:1px solid var(--co-semantic-border-default, #e0e0e0);border-radius:var(--co-border-radius-xs, 8px);box-shadow:0 2px 12px rgba(0, 0, 0, 0.12);pointer-events:auto}.co-rte-img-layout__btn{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;padding:0;border:1px solid transparent;border-radius:var(--co-border-radius-xxs, 4px);background:transparent;color:var(--co-semantic-text-default, #333);cursor:pointer;transition:background var(--co-motion-duration-fast), border-color var(--co-motion-duration-fast)}.co-rte-img-layout__btn:hover{background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.06))}.co-rte-img-layout__btn--active{background:var(--co-color-base-negro, #1a1a1a);color:var(--co-color-base-blanco, #fff)}.co-rte-img-layout__btn--active:hover{background:var(--co-color-base-negro, #333)}.co-rte-img-layout__btn[data-tooltip]{position:relative}.co-rte-img-layout__btn[data-tooltip]::after{content:attr(data-tooltip);position:absolute;bottom:calc(100% + 6px);left:50%;transform:translateX(-50%);padding:4px 8px;background:var(--co-color-base-negro, #1a1a1a);color:var(--co-color-base-blanco, #fff);font-family:var(--co-font-family-primary);font-size:11px;font-weight:500;line-height:1.3;white-space:nowrap;border-radius:4px;pointer-events:none;opacity:0;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-out);z-index:100}.co-rte-img-layout__btn[data-tooltip]:hover::after{opacity:1;transition-delay:0.3s}.co-rte-content [data-resize-container][data-image-layout="wrap-left"]{float:left;max-width:50%;margin:4px 16px 8px 0}.co-rte-content [data-resize-container][data-image-layout="wrap-right"]{float:right;max-width:50%;margin:4px 0 8px 16px}.co-rte-content [data-resize-container][data-image-layout="center"]{display:block;margin:12px auto}.co-rte-content [data-resize-container][data-image-layout="full-width"]{display:block;width:100%;margin:12px 0}.co-rte-content [data-resize-container][data-image-layout="full-width"] [data-resize-wrapper],.co-rte-content [data-resize-container][data-image-layout="full-width"] img{width:100%}@media (max-width: 768px){.co-rte-content [data-resize-container][data-image-layout="wrap-left"],.co-rte-content [data-resize-container][data-image-layout="wrap-right"]{float:none;max-width:100%;display:block;margin:12px 0}}.co-rte-content--site .ProseMirror{width:var(--co-rte-content-width, 80%);max-width:100%;margin:0 auto}@media (max-width: 768px){.co-rte-content--site .ProseMirror{width:100%}}.co-rich-text-editor--readonly [data-resize-handle],.co-rich-text-editor--disabled [data-resize-handle]{display:none !important}.co-rich-text-editor--readonly [data-resize-container].ProseMirror-selectednode,.co-rich-text-editor--disabled [data-resize-container].ProseMirror-selectednode,.co-rich-text-editor--readonly img.ProseMirror-selectednode,.co-rich-text-editor--disabled img.ProseMirror-selectednode{outline:none !important}'}},[0,"co-rich-text-editor",{value:[1025],preset:[1],placeholder:[1],label:[1],secondaryLabel:[1,"secondary-label"],helperText:[1,"helper-text"],status:[1],variant:[513],disabled:[4],readonly:[4],required:[4],maxLength:[2,"max-length"],showCharacterCount:[4,"show-character-count"],autofocus:[4],toolbar:[1],features:[1],customExtensions:[16],imageUpload:[16],attachmentsEnabled:[4,"attachments-enabled"],attachmentAccept:[1,"attachment-accept"],fontFamilies:[1,"font-families"],accountFonts:[1,"account-fonts"],fontsLoading:[4,"fonts-loading"],fontLoader:[16],locale:[1],ready:[32],hasFocus:[32],getJSON:[64],getHtml:[64],getText:[64],clear:[64],focusEditor:[64],setContent:[64],getEditorInstance:[64]},void 0,{accountFonts:[{onAccountFontsChange:0}],value:[{onValueChange:0}],disabled:[{onEditableChange:0}],readonly:[{onEditableChange:0}]}]);function b(){"undefined"!=typeof customElements&&["co-rich-text-editor","co-icon","co-rich-text-toolbar"].forEach((e=>{switch(e){case"co-rich-text-editor":customElements.get(i(e))||customElements.define(i(e),l);break;case"co-icon":customElements.get(i(e))||s();break;case"co-rich-text-toolbar":customElements.get(i(e))||c()}}))}l.DEFAULT_FONTS=[{label:"Arial",value:"Arial, sans-serif"},{label:"Calibri",value:"Calibri, sans-serif"},{label:"Cambria",value:"Cambria, serif"},{label:"Comic Sans MS",value:"'Comic Sans MS', cursive"},{label:"Courier New",value:"'Courier New', monospace"},{label:"Georgia",value:"Georgia, serif"},{label:"Geist",value:"'Geist', sans-serif"},{label:"Helvetica",value:"Helvetica, Arial, sans-serif"},{label:"Impact",value:"Impact, sans-serif"},{label:"Inter",value:"'Inter', sans-serif"},{label:"Lato",value:"'Lato', sans-serif"},{label:"Montserrat",value:"'Montserrat', sans-serif"},{label:"Open Sans",value:"'Open Sans', sans-serif"},{label:"Poppins",value:"'Poppins', sans-serif"},{label:"Roboto",value:"'Roboto', sans-serif"},{label:"Segoe UI",value:"'Segoe UI', sans-serif"},{label:"Tahoma",value:"Tahoma, sans-serif"},{label:"Times New Roman",value:"'Times New Roman', serif"},{label:"Trebuchet MS",value:"'Trebuchet MS', sans-serif"},{label:"Verdana",value:"Verdana, sans-serif"}],l._registeredFonts=new Set,l.IMG_LAYOUT_ICONS={inline:"image-square","wrap-left":"text-align-left","wrap-right":"text-align-right",center:"text-align-center","full-width":"arrows-horizontal"},b();const d=l,u=b;export{d as CoRichTextEditor,u as defineCustomElement}
@@ -1 +1 @@
1
- import{t as o,p as e,H as r,h as c}from"./index.js";const a=e(class extends r{constructor(o){super(),!1!==o&&this.__registerHost(),this.__attachShadow(),this.position="single",this.size="sm"}render(){return c("div",{key:"cf40ecb8896089a87f527be917396d1f01057cec",class:{"co-row":!0,["co-row--"+this.position]:!0,["co-row--"+this.size]:!0},part:"row"},c("div",{key:"8d24887fb9704673fe0facfaabd792ca455bd479",class:"co-row__prefix"},c("slot",{key:"d2546cc155fe508f8f2a7eba580a99e370e82887",name:"prefix"})),c("div",{key:"5e6c33efacc0dde29f202a09c664294ad7524572",class:"co-row__content"},c("slot",{key:"5efffa62218f021f439ad12eba00cb1479ccfc58"})),c("div",{key:"42cc9c00f8ca199e4e29ac8e2f6b6b585c2b3a99",class:"co-row__suffix"},c("slot",{key:"3389e9ef5a2914629a7c2d1246d37c5fa956be33",name:"suffix"})))}static get style(){return":host{display:block}.co-row{display:flex;align-items:center;gap:var(--co-spacing-md);background:var(--co-semantic-surface-page);border:1px solid var(--co-semantic-border-subtle);font-family:var(--co-font-family-primary);box-sizing:border-box}.co-row--sm{padding:var(--co-spacing-sm2) var(--co-spacing-lg);min-height:40px;font-size:var(--co-font-size-14)}.co-row--lg{padding:var(--co-spacing-lg) var(--co-spacing-xl);min-height:76px;font-size:var(--co-font-size-16)}.co-row--single{border-radius:var(--co-border-radius-lg)}.co-row--top{border-radius:var(--co-border-radius-lg) var(--co-border-radius-lg) 0 0;border-bottom:none}.co-row--middle{border-radius:0;border-bottom:none}.co-row--bottom{border-radius:0 0 var(--co-border-radius-lg) var(--co-border-radius-lg)}.co-row__prefix,.co-row__suffix{display:flex;align-items:center;gap:var(--co-spacing-sm);flex-shrink:0;color:var(--co-semantic-text-muted)}.co-row__prefix:empty,.co-row__suffix:empty{display:none}.co-row__content{display:flex;flex-direction:column;flex:1;min-width:0;gap:var(--co-spacing-xs)}.co-row__suffix{margin-left:auto}"}},[257,"co-row",{position:[1],size:[1]}]);function s(){"undefined"!=typeof customElements&&["co-row"].forEach((e=>{"co-row"===e&&(customElements.get(o(e))||customElements.define(o(e),a))}))}s();const i=a,t=s;export{i as CoRow,t as defineCustomElement}
1
+ import{t as o,p as e,H as r,h as c}from"./index.js";const a=e(class extends r{constructor(o){super(),!1!==o&&this.__registerHost(),this.__attachShadow(),this.position="single",this.size="sm"}render(){return c("div",{key:"df05ce9c0da83cd61ce3a42e4a578ea4d038e12c",class:{"co-row":!0,["co-row--"+this.position]:!0,["co-row--"+this.size]:!0},part:"row"},c("div",{key:"fcd7514bd6071f16f8b92ace2651bf33b74a402e",class:"co-row__prefix"},c("slot",{key:"47254fffd8803454f9d8f0cccfb6e80bb7058b38",name:"prefix"})),c("div",{key:"43aaab6683919b7e9e47c0a67203edffa3db81df",class:"co-row__content"},c("slot",{key:"4fb7a8ea03f79313176ca8c5ae23f878eace9027"})),c("div",{key:"3c7bcd64ccf417e95620cec6ae87d7d9d1697bed",class:"co-row__suffix"},c("slot",{key:"af2e72debbcc68919ef3e28d03ff18cf747ccc43",name:"suffix"})))}static get style(){return":host{display:block}.co-row{display:flex;align-items:center;gap:var(--co-spacing-md);background:var(--co-semantic-surface-page);border:1px solid var(--co-semantic-border-subtle);font-family:var(--co-font-family-primary);box-sizing:border-box}.co-row--sm{padding:var(--co-spacing-sm2) var(--co-spacing-lg);min-height:40px;font-size:var(--co-font-size-14)}.co-row--lg{padding:var(--co-spacing-lg) var(--co-spacing-xl);min-height:76px;font-size:var(--co-font-size-16)}.co-row--single{border-radius:var(--co-border-radius-lg)}.co-row--top{border-radius:var(--co-border-radius-lg) var(--co-border-radius-lg) 0 0;border-bottom:none}.co-row--middle{border-radius:0;border-bottom:none}.co-row--bottom{border-radius:0 0 var(--co-border-radius-lg) var(--co-border-radius-lg)}.co-row__prefix,.co-row__suffix{display:flex;align-items:center;gap:var(--co-spacing-sm);flex-shrink:0;color:var(--co-semantic-text-muted)}.co-row__prefix:empty,.co-row__suffix:empty{display:none}.co-row__content{display:flex;flex-direction:column;flex:1;min-width:0;gap:var(--co-spacing-xs)}.co-row__suffix{margin-left:auto}"}},[257,"co-row",{position:[1],size:[1]}]);function s(){"undefined"!=typeof customElements&&["co-row"].forEach((e=>{"co-row"===e&&(customElements.get(o(e))||customElements.define(o(e),a))}))}s();const i=a,t=s;export{i as CoRow,t as defineCustomElement}