@prolibu-suite/cobalt-core 0.11.12 → 0.11.13

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 (439) hide show
  1. package/custom-elements.json +36 -109
  2. package/dist/cjs/co-accordion.cjs.entry.js +5 -5
  3. package/dist/cjs/co-action-bar.cjs.entry.js +1 -1
  4. package/dist/cjs/co-app-shell.cjs.entry.js +1 -1
  5. package/dist/cjs/co-audio-player.cjs.entry.js +1 -1
  6. package/dist/cjs/co-autocomplete.cjs.entry.js +2 -2
  7. package/dist/cjs/co-avatar-group.cjs.entry.js +1 -1
  8. package/dist/cjs/co-avatar.cjs.entry.js +1 -1
  9. package/dist/cjs/co-badge.cjs.entry.js +1 -1
  10. package/dist/cjs/co-bottom-sheet.cjs.entry.js +1 -1
  11. package/dist/cjs/co-breadcrumb-item.cjs.entry.js +1 -1
  12. package/dist/cjs/co-breadcrumb.cjs.entry.js +1 -1
  13. package/dist/cjs/co-button-group.cjs.entry.js +1 -1
  14. package/dist/cjs/co-button.cjs.entry.js +1 -1
  15. package/dist/cjs/co-calendar-month_2.cjs.entry.js +2 -2
  16. package/dist/cjs/co-calendar_3.cjs.entry.js +2 -2
  17. package/dist/cjs/co-card.cjs.entry.js +1 -1
  18. package/dist/cjs/co-carousel-item.cjs.entry.js +1 -1
  19. package/dist/cjs/co-carousel.cjs.entry.js +2 -2
  20. package/dist/cjs/co-checkbox-group.cjs.entry.js +2 -2
  21. package/dist/cjs/co-checkbox.cjs.entry.js +2 -2
  22. package/dist/cjs/co-chip_2.cjs.entry.js +6 -6
  23. package/dist/cjs/co-color-area.cjs.entry.js +1 -1
  24. package/dist/cjs/co-color-picker.cjs.entry.js +3 -3
  25. package/dist/cjs/co-color-slider.cjs.entry.js +1 -1
  26. package/dist/cjs/co-column-picker.cjs.entry.js +2 -2
  27. package/dist/cjs/co-combobox.cjs.entry.js +2 -2
  28. package/dist/cjs/co-command-search.cjs.entry.js +2 -2
  29. package/dist/cjs/co-data-table-pagination.cjs.entry.js +2 -2
  30. package/dist/cjs/co-data-table.cjs.entry.js +2 -2
  31. package/dist/cjs/co-date-picker.cjs.entry.js +2 -2
  32. package/dist/cjs/co-date-range-picker.cjs.entry.js +2 -2
  33. package/dist/cjs/co-date-range.cjs.entry.js +1 -1
  34. package/dist/cjs/co-date-time-picker.cjs.entry.js +2 -2
  35. package/dist/cjs/co-document-editor.cjs.entry.js +2 -2
  36. package/dist/cjs/co-drive-card.cjs.entry.js +1 -1
  37. package/dist/cjs/co-drop-zone.cjs.entry.js +1 -1
  38. package/dist/cjs/co-emoji-picker.cjs.entry.js +2 -2
  39. package/dist/cjs/co-empty-state.cjs.entry.js +2 -2
  40. package/dist/cjs/co-event-calendar.cjs.entry.js +1 -1
  41. package/dist/cjs/co-event-popover.cjs.entry.js +1 -1
  42. package/dist/cjs/co-fab.cjs.entry.js +1 -1
  43. package/dist/cjs/co-file-field.cjs.entry.js +3 -3
  44. package/dist/cjs/co-file-type-tile.cjs.entry.js +1 -1
  45. package/dist/cjs/co-gradient-bar.cjs.entry.js +1 -1
  46. package/dist/cjs/co-helper-text.cjs.entry.js +1 -1
  47. package/dist/cjs/co-icon-button.cjs.entry.js +2 -2
  48. package/dist/cjs/co-icon.cjs.entry.js +1 -1
  49. package/dist/cjs/co-input.cjs.entry.js +2 -2
  50. package/dist/cjs/co-json-field.cjs.entry.js +2 -2
  51. package/dist/cjs/co-kbd_2.cjs.entry.js +1 -1
  52. package/dist/cjs/co-lightbox.cjs.entry.js +1 -1
  53. package/dist/cjs/co-list-footer.cjs.entry.js +1 -1
  54. package/dist/cjs/co-list-item.cjs.entry.js +2 -2
  55. package/dist/cjs/co-loader.cjs.entry.js +1 -1
  56. package/dist/cjs/co-media-thumb.cjs.entry.js +1 -1
  57. package/dist/cjs/co-menu-divider.cjs.entry.js +1 -1
  58. package/dist/cjs/co-menu-item.cjs.entry.js +7 -40
  59. package/dist/cjs/co-menu.cjs.entry.js +2 -2
  60. package/dist/cjs/co-modal.cjs.entry.js +2 -2
  61. package/dist/cjs/co-navbar.cjs.entry.js +1 -1
  62. package/dist/cjs/co-number-field.cjs.entry.js +2 -2
  63. package/dist/cjs/co-overlay.cjs.entry.js +1 -1
  64. package/dist/cjs/co-page-header.cjs.entry.js +1 -1
  65. package/dist/cjs/co-phone-field.cjs.entry.js +4 -4
  66. package/dist/cjs/co-popover.cjs.entry.js +1 -1
  67. package/dist/cjs/co-progress-bar.cjs.entry.js +1 -1
  68. package/dist/cjs/co-progress-circle.cjs.entry.js +2 -2
  69. package/dist/cjs/co-provider-logo_2.cjs.entry.js +2 -2
  70. package/dist/cjs/co-radio-group.cjs.entry.js +1 -1
  71. package/dist/cjs/co-radio.cjs.entry.js +2 -2
  72. package/dist/cjs/co-rating.cjs.entry.js +2 -2
  73. package/dist/cjs/co-ref-field.cjs.entry.js +3 -3
  74. package/dist/cjs/co-rich-text-editor.cjs.entry.js +2 -2
  75. package/dist/cjs/co-rich-text-toolbar.cjs.entry.js +1 -1
  76. package/dist/cjs/co-rich-text-viewer.cjs.entry.js +1 -1
  77. package/dist/cjs/co-row.cjs.entry.js +1 -1
  78. package/dist/cjs/co-segmented-bar.cjs.entry.js +1 -1
  79. package/dist/cjs/co-select.cjs.entry.js +27 -14
  80. package/dist/cjs/co-separator.cjs.entry.js +1 -1
  81. package/dist/cjs/co-sidebar-nav.cjs.entry.js +1 -1
  82. package/dist/cjs/co-sidebar.cjs.entry.js +1 -1
  83. package/dist/cjs/co-slider.cjs.entry.js +2 -2
  84. package/dist/cjs/co-swatch-grid.cjs.entry.js +1 -1
  85. package/dist/cjs/co-switch.cjs.entry.js +3 -3
  86. package/dist/cjs/co-tab-group.cjs.entry.js +2 -2
  87. package/dist/cjs/co-tab.cjs.entry.js +2 -2
  88. package/dist/cjs/co-tags-field.cjs.entry.js +4 -4
  89. package/dist/cjs/co-textarea.cjs.entry.js +2 -2
  90. package/dist/cjs/co-tile.cjs.entry.js +1 -1
  91. package/dist/cjs/co-time-field.cjs.entry.js +1 -1
  92. package/dist/cjs/co-toast.cjs.entry.js +1 -1
  93. package/dist/cjs/co-toggle-button-group.cjs.entry.js +1 -1
  94. package/dist/cjs/co-toggle-button.cjs.entry.js +2 -2
  95. package/dist/cjs/co-transfer-list.cjs.entry.js +2 -2
  96. package/dist/cjs/co-tree-item.cjs.entry.js +2 -2
  97. package/dist/cjs/co-video.cjs.entry.js +2 -2
  98. package/dist/cjs/cobalt.cjs.js +2 -2
  99. package/dist/cjs/{fieldChip-D-x9bJ-W.js → fieldChip-DbYMfylq.js} +1 -1
  100. package/dist/cjs/{index-CuskTAyj.js → index-bHoidDwv.js} +1 -1
  101. package/dist/cjs/loader.cjs.js +2 -2
  102. package/dist/cjs/{requiredMark-ooEZAZbC.js → requiredMark-21yHvvZS.js} +1 -1
  103. package/dist/cobalt/cobalt.css +1 -1
  104. package/dist/cobalt/cobalt.esm.js +1 -1
  105. package/dist/cobalt/{p-6d12e825.entry.js → p-019eed8e.entry.js} +1 -1
  106. package/dist/cobalt/p-01b54d81.entry.js +1 -0
  107. package/dist/cobalt/{p-b3994c94.entry.js → p-02133c95.entry.js} +1 -1
  108. package/dist/cobalt/{p-d0129851.entry.js → p-04e3e1f6.entry.js} +1 -1
  109. package/dist/cobalt/{p-fa4a59e8.entry.js → p-0bbaaf4f.entry.js} +1 -1
  110. package/dist/cobalt/p-0e13b7d0.entry.js +1 -0
  111. package/dist/cobalt/{p-8b2432b2.entry.js → p-0f3a3232.entry.js} +1 -1
  112. package/dist/cobalt/{p-6a270d5d.entry.js → p-12fc5119.entry.js} +1 -1
  113. package/dist/cobalt/{p-134331e6.entry.js → p-15d995b4.entry.js} +1 -1
  114. package/dist/cobalt/{p-f3975988.entry.js → p-19f0f534.entry.js} +1 -1
  115. package/dist/cobalt/{p-4ee87962.entry.js → p-1c9253a2.entry.js} +1 -1
  116. package/dist/cobalt/p-21b4a830.entry.js +1 -0
  117. package/dist/cobalt/p-256ca457.entry.js +1 -0
  118. package/dist/cobalt/{p-8bf0975d.entry.js → p-299c2425.entry.js} +1 -1
  119. package/dist/cobalt/{p-ac1565df.entry.js → p-2ff8f591.entry.js} +1 -1
  120. package/dist/cobalt/{p-038cc50a.entry.js → p-33840969.entry.js} +1 -1
  121. package/dist/cobalt/{p-24456175.entry.js → p-353ff9ed.entry.js} +1 -1
  122. package/dist/cobalt/{p-3842ac1a.entry.js → p-37f9ec35.entry.js} +1 -1
  123. package/dist/cobalt/{p-9c00499b.entry.js → p-3878f174.entry.js} +1 -1
  124. package/dist/cobalt/{p-741c14af.entry.js → p-3890d22f.entry.js} +1 -1
  125. package/dist/cobalt/{p-19544796.entry.js → p-3b5024ce.entry.js} +1 -1
  126. package/dist/cobalt/{p-a6516907.entry.js → p-3b7e90c8.entry.js} +1 -1
  127. package/dist/cobalt/{p-ac963082.entry.js → p-3bff827a.entry.js} +1 -1
  128. package/dist/cobalt/{p-15e29500.entry.js → p-3e532a11.entry.js} +1 -1
  129. package/dist/cobalt/{p-ec11b337.entry.js → p-3e864e7d.entry.js} +1 -1
  130. package/dist/cobalt/{p-af8cc16e.entry.js → p-438cc876.entry.js} +1 -1
  131. package/dist/cobalt/{p-c4bbb701.entry.js → p-4a7fd0b4.entry.js} +1 -1
  132. package/dist/cobalt/{p-4e1ba090.entry.js → p-4ae6fe0e.entry.js} +1 -1
  133. package/dist/cobalt/{p-c5978c46.entry.js → p-4cdfcd9c.entry.js} +1 -1
  134. package/dist/cobalt/{p-67fac886.entry.js → p-4e81e580.entry.js} +1 -1
  135. package/dist/cobalt/{p-ae66e746.entry.js → p-50ab6b9b.entry.js} +1 -1
  136. package/dist/cobalt/{p-be860577.entry.js → p-53a251ca.entry.js} +1 -1
  137. package/dist/cobalt/{p-45460f75.entry.js → p-59a71695.entry.js} +1 -1
  138. package/dist/cobalt/{p-0d163b25.entry.js → p-5a32b9a2.entry.js} +1 -1
  139. package/dist/cobalt/{p-66a07095.entry.js → p-5d41b58b.entry.js} +1 -1
  140. package/dist/cobalt/{p-9a307b64.entry.js → p-5e14f676.entry.js} +1 -1
  141. package/dist/cobalt/{p-bf8212cf.entry.js → p-5e39cf70.entry.js} +1 -1
  142. package/dist/cobalt/{p-5aaaa257.entry.js → p-600d0cab.entry.js} +1 -1
  143. package/dist/cobalt/{p-e120435e.entry.js → p-63f888a1.entry.js} +1 -1
  144. package/dist/cobalt/{p-7be0f85b.entry.js → p-6eca1c7c.entry.js} +1 -1
  145. package/dist/cobalt/{p-1cc15af6.entry.js → p-71ee36a8.entry.js} +1 -1
  146. package/dist/cobalt/{p-669ad1c6.entry.js → p-74804c79.entry.js} +1 -1
  147. package/dist/cobalt/{p-7550fc02.entry.js → p-76ea3f34.entry.js} +1 -1
  148. package/dist/cobalt/{p-76244cca.entry.js → p-7737354e.entry.js} +1 -1
  149. package/dist/cobalt/p-7e444408.entry.js +1 -0
  150. package/dist/cobalt/{p-f9937237.entry.js → p-7e678cbd.entry.js} +1 -1
  151. package/dist/cobalt/p-7e72720a.entry.js +1 -0
  152. package/dist/cobalt/{p-ce9a3708.entry.js → p-82bcd062.entry.js} +1 -1
  153. package/dist/cobalt/{p-5b098a4c.entry.js → p-83691cfb.entry.js} +1 -1
  154. package/dist/cobalt/p-84ad0227.entry.js +1 -0
  155. package/dist/cobalt/{p-6bb9964f.entry.js → p-89328cd8.entry.js} +1 -1
  156. package/dist/cobalt/{p-c71b736c.entry.js → p-8a26f3cc.entry.js} +1 -1
  157. package/dist/cobalt/{p-e0b542ad.entry.js → p-8e7ad2fe.entry.js} +1 -1
  158. package/dist/cobalt/{p-6fe227e0.entry.js → p-9125252a.entry.js} +1 -1
  159. package/dist/cobalt/p-947b8e35.entry.js +1 -0
  160. package/dist/cobalt/{p-0ea06cee.entry.js → p-94b871fb.entry.js} +1 -1
  161. package/dist/cobalt/{p-6c35584c.entry.js → p-9af26af0.entry.js} +1 -1
  162. package/dist/cobalt/{p-88edf7d0.entry.js → p-9ce57385.entry.js} +1 -1
  163. package/dist/cobalt/p-CSLjZ3WO.js +1 -0
  164. package/dist/cobalt/p-CYN5B3IQ.js +1 -0
  165. package/dist/cobalt/{p-YRicbXh3.js → p-DJkaRtbb.js} +2 -2
  166. package/dist/cobalt/{p-1288867e.entry.js → p-a18c01eb.entry.js} +1 -1
  167. package/dist/cobalt/{p-1ef7bbbc.entry.js → p-a27013e6.entry.js} +1 -1
  168. package/dist/cobalt/{p-a9242183.entry.js → p-a33a277a.entry.js} +1 -1
  169. package/dist/cobalt/{p-811f1dd7.entry.js → p-a4154bcf.entry.js} +1 -1
  170. package/dist/cobalt/{p-e71f6186.entry.js → p-a4264bde.entry.js} +1 -1
  171. package/dist/cobalt/{p-eca12c29.entry.js → p-a6c9a0c5.entry.js} +1 -1
  172. package/dist/cobalt/{p-20651254.entry.js → p-b402665a.entry.js} +1 -1
  173. package/dist/cobalt/{p-71f9fa68.entry.js → p-b6463d35.entry.js} +1 -1
  174. package/dist/cobalt/{p-a671facd.entry.js → p-b723aa47.entry.js} +1 -1
  175. package/dist/cobalt/{p-05f0feca.entry.js → p-bbf3d859.entry.js} +1 -1
  176. package/dist/cobalt/{p-79b62ce3.entry.js → p-be520bd5.entry.js} +1 -1
  177. package/dist/cobalt/p-bee52042.entry.js +1 -0
  178. package/dist/cobalt/{p-09ff5302.entry.js → p-c004fde5.entry.js} +1 -1
  179. package/dist/cobalt/{p-ebcdc0b2.entry.js → p-c026968c.entry.js} +1 -1
  180. package/dist/cobalt/{p-be9f69e4.entry.js → p-c220362c.entry.js} +1 -1
  181. package/dist/cobalt/{p-894f59ce.entry.js → p-c23630ab.entry.js} +1 -1
  182. package/dist/cobalt/p-c93be2d5.entry.js +1 -0
  183. package/dist/cobalt/{p-c01454be.entry.js → p-cb1013e6.entry.js} +1 -1
  184. package/dist/cobalt/{p-0d2deeaa.entry.js → p-cea21e08.entry.js} +1 -1
  185. package/dist/cobalt/{p-d525aec4.entry.js → p-d1595580.entry.js} +1 -1
  186. package/dist/cobalt/{p-2d76fafb.entry.js → p-d1e83525.entry.js} +1 -1
  187. package/dist/cobalt/{p-0bd8e079.entry.js → p-d26dc681.entry.js} +1 -1
  188. package/dist/cobalt/{p-052289b3.entry.js → p-d375c84e.entry.js} +1 -1
  189. package/dist/cobalt/{p-5009ad0a.entry.js → p-d7775109.entry.js} +1 -1
  190. package/dist/cobalt/{p-011fd3ca.entry.js → p-d9b4594b.entry.js} +1 -1
  191. package/dist/cobalt/{p-2f44a37b.entry.js → p-dabcbba7.entry.js} +1 -1
  192. package/dist/cobalt/{p-a679c368.entry.js → p-e4646a0e.entry.js} +1 -1
  193. package/dist/cobalt/{p-66375026.entry.js → p-e5350eeb.entry.js} +1 -1
  194. package/dist/cobalt/{p-c0f579d9.entry.js → p-eab59be5.entry.js} +1 -1
  195. package/dist/cobalt/{p-63c588e1.entry.js → p-efb3cbb0.entry.js} +1 -1
  196. package/dist/cobalt/{p-5d17b6e9.entry.js → p-f1da1df1.entry.js} +1 -1
  197. package/dist/cobalt/{p-fd15353a.entry.js → p-f23f52ed.entry.js} +1 -1
  198. package/dist/cobalt/{p-63e5d7fe.entry.js → p-f562bd96.entry.js} +1 -1
  199. package/dist/cobalt/{p-5e04cecc.entry.js → p-f6f273f7.entry.js} +1 -1
  200. package/dist/cobalt/{p-65e0176c.entry.js → p-fb6671e0.entry.js} +1 -1
  201. package/dist/cobalt/p-fb731600.entry.js +1 -0
  202. package/dist/cobalt/{p-16eb0771.entry.js → p-feec49a4.entry.js} +1 -1
  203. package/dist/cobalt/{p-ea2cc20e.entry.js → p-ff218d09.entry.js} +1 -1
  204. package/dist/collection/components/co-accordion/co-accordion.css +1 -1
  205. package/dist/collection/components/co-accordion/co-accordion.js +3 -3
  206. package/dist/collection/components/co-autocomplete/co-autocomplete.js +1 -1
  207. package/dist/collection/components/co-avatar-group/co-avatar-group.js +1 -1
  208. package/dist/collection/components/co-calendar-month/co-calendar-month.css +4 -9
  209. package/dist/collection/components/co-carousel/co-carousel.css +5 -7
  210. package/dist/collection/components/co-checkbox/co-checkbox.css +17 -12
  211. package/dist/collection/components/co-checkbox-group/co-checkbox-group.css +2 -4
  212. package/dist/collection/components/co-checkbox-group/co-checkbox-group.js +1 -1
  213. package/dist/collection/components/co-chip/co-chip.css +1 -14
  214. package/dist/collection/components/co-color-area/co-color-area.js +2 -2
  215. package/dist/collection/components/co-color-picker/co-color-picker.css +4 -4
  216. package/dist/collection/components/co-color-slider/co-color-slider.js +1 -1
  217. package/dist/collection/components/co-column-picker/co-column-picker.css +2 -12
  218. package/dist/collection/components/co-combobox/co-combobox.js +1 -1
  219. package/dist/collection/components/co-command-search/co-command-search.css +1 -1
  220. package/dist/collection/components/co-command-search/co-command-search.js +1 -1
  221. package/dist/collection/components/co-data-table/co-data-table.css +10 -20
  222. package/dist/collection/components/co-data-table/co-data-table.js +1 -1
  223. package/dist/collection/components/co-data-table-pagination/co-data-table-pagination.css +3 -11
  224. package/dist/collection/components/co-date-range-picker/co-date-range-picker.js +2 -2
  225. package/dist/collection/components/co-document-editor/co-document-editor.css +7 -10
  226. package/dist/collection/components/co-document-editor/co-document-editor.js +5 -5
  227. package/dist/collection/components/co-emoji-picker/co-emoji-picker.css +3 -3
  228. package/dist/collection/components/co-empty-state/co-empty-state.css +4 -7
  229. package/dist/collection/components/co-file-field/co-file-field.css +1 -3
  230. package/dist/collection/components/co-icon-button/co-icon-button.css +1 -1
  231. package/dist/collection/components/co-list-item/co-list-item.css +0 -6
  232. package/dist/collection/components/co-menu/co-menu.css +2 -4
  233. package/dist/collection/components/co-menu-item/co-menu-item.css +5 -14
  234. package/dist/collection/components/co-menu-item/co-menu-item.js +7 -80
  235. package/dist/collection/components/co-option-list/co-option-list.css +4 -12
  236. package/dist/collection/components/co-option-list/co-option-list.js +3 -3
  237. package/dist/collection/components/co-phone-field/co-phone-field.css +3 -12
  238. package/dist/collection/components/co-phone-field/co-phone-field.js +1 -1
  239. package/dist/collection/components/co-popover/co-popover.js +1 -1
  240. package/dist/collection/components/co-progress-circle/co-progress-circle.css +1 -3
  241. package/dist/collection/components/co-radio/co-radio.css +1 -10
  242. package/dist/collection/components/co-radio-group/co-radio-group.js +1 -1
  243. package/dist/collection/components/co-rating/co-rating.css +1 -3
  244. package/dist/collection/components/co-ref-field/co-ref-field.js +4 -4
  245. package/dist/collection/components/co-segmented-bar/co-segmented-bar.js +1 -1
  246. package/dist/collection/components/co-select/co-select.css +47 -1
  247. package/dist/collection/components/co-select/co-select.js +26 -13
  248. package/dist/collection/components/co-sidebar-nav/co-sidebar-nav.js +1 -1
  249. package/dist/collection/components/co-skeleton/co-skeleton.css +3 -6
  250. package/dist/collection/components/co-slider/co-slider.css +1 -21
  251. package/dist/collection/components/co-switch/co-switch.css +4 -10
  252. package/dist/collection/components/co-tab/co-tab.css +8 -14
  253. package/dist/collection/components/co-tab-group/co-tab-group.css +9 -15
  254. package/dist/collection/components/co-tags-field/co-tags-field.css +2 -3
  255. package/dist/collection/components/co-toast/co-toast.js +2 -2
  256. package/dist/collection/components/co-toggle-button/co-toggle-button.css +4 -10
  257. package/dist/collection/components/co-transfer-list/co-transfer-list.css +2 -4
  258. package/dist/collection/components/co-transfer-list/co-transfer-list.js +1 -1
  259. package/dist/collection/components/co-tree-item/co-tree-item.css +1 -1
  260. package/dist/collection/components/co-tree-item/co-tree-item.js +2 -2
  261. package/dist/collection/components/co-video/co-video.css +3 -5
  262. package/dist/collection/utils/dragMove.js +1 -1
  263. package/dist/components/co-accordion.js +1 -1
  264. package/dist/components/co-action-bar.js +1 -1
  265. package/dist/components/co-autocomplete.js +1 -1
  266. package/dist/components/co-calendar-month.js +1 -1
  267. package/dist/components/co-calendar-timegrid.js +1 -1
  268. package/dist/components/co-carousel.js +1 -1
  269. package/dist/components/co-checkbox-group.js +1 -1
  270. package/dist/components/co-checkbox.js +1 -1
  271. package/dist/components/co-chip.js +1 -1
  272. package/dist/components/co-color-picker.js +1 -1
  273. package/dist/components/co-column-picker.js +1 -1
  274. package/dist/components/co-combobox.js +1 -1
  275. package/dist/components/co-command-search.js +1 -1
  276. package/dist/components/co-data-table-pagination.js +1 -1
  277. package/dist/components/co-data-table.js +1 -1
  278. package/dist/components/co-document-editor.js +1 -1
  279. package/dist/components/co-emoji-picker.js +1 -1
  280. package/dist/components/co-empty-state.js +1 -1
  281. package/dist/components/co-event-calendar.js +1 -1
  282. package/dist/components/co-file-field.js +1 -1
  283. package/dist/components/co-icon-button.js +1 -1
  284. package/dist/components/co-lightbox.js +1 -1
  285. package/dist/components/co-list-item.js +1 -1
  286. package/dist/components/co-menu-item.js +1 -1
  287. package/dist/components/co-menu.js +1 -1
  288. package/dist/components/co-modal.js +1 -1
  289. package/dist/components/co-option-list.js +1 -1
  290. package/dist/components/co-phone-field.js +1 -1
  291. package/dist/components/co-progress-circle.js +1 -1
  292. package/dist/components/co-radio.js +1 -1
  293. package/dist/components/co-rating.js +1 -1
  294. package/dist/components/co-ref-field.js +1 -1
  295. package/dist/components/co-select.js +1 -1
  296. package/dist/components/co-skeleton.js +1 -1
  297. package/dist/components/co-slider.js +1 -1
  298. package/dist/components/co-switch.js +1 -1
  299. package/dist/components/co-tab-group.js +1 -1
  300. package/dist/components/co-tab.js +1 -1
  301. package/dist/components/co-tags-field.js +1 -1
  302. package/dist/components/co-toggle-button.js +1 -1
  303. package/dist/components/co-transfer-list.js +1 -1
  304. package/dist/components/co-tree-item.js +1 -1
  305. package/dist/components/co-video.js +1 -1
  306. package/dist/components/index.js +1 -1
  307. package/dist/components/p-B70R6xWE.js +1 -0
  308. package/dist/components/p-BGNXvnDr.js +1 -0
  309. package/dist/components/{p-y-UE-CLu.js → p-BMyWdiVO.js} +1 -1
  310. package/dist/components/p-BSt2t5Fy.js +1 -0
  311. package/dist/components/p-BfDYq7JS.js +1 -0
  312. package/dist/components/{p-4nVctQq9.js → p-COCcx0DN.js} +1 -1
  313. package/dist/components/p-CwRoHnzq.js +1 -0
  314. package/dist/components/{p-Ct4MpUdn.js → p-DMW9TJ7Z.js} +1 -1
  315. package/dist/components/{p-CxXO0llX.js → p-R1W48hzW.js} +1 -1
  316. package/dist/components/{p-C1WNmtGN.js → p-rfvTj6cP.js} +1 -1
  317. package/dist/esm/co-accordion.entry.js +5 -5
  318. package/dist/esm/co-action-bar.entry.js +1 -1
  319. package/dist/esm/co-app-shell.entry.js +1 -1
  320. package/dist/esm/co-audio-player.entry.js +1 -1
  321. package/dist/esm/co-autocomplete.entry.js +2 -2
  322. package/dist/esm/co-avatar-group.entry.js +1 -1
  323. package/dist/esm/co-avatar.entry.js +1 -1
  324. package/dist/esm/co-badge.entry.js +1 -1
  325. package/dist/esm/co-bottom-sheet.entry.js +1 -1
  326. package/dist/esm/co-breadcrumb-item.entry.js +1 -1
  327. package/dist/esm/co-breadcrumb.entry.js +1 -1
  328. package/dist/esm/co-button-group.entry.js +1 -1
  329. package/dist/esm/co-button.entry.js +1 -1
  330. package/dist/esm/co-calendar-month_2.entry.js +2 -2
  331. package/dist/esm/co-calendar_3.entry.js +2 -2
  332. package/dist/esm/co-card.entry.js +1 -1
  333. package/dist/esm/co-carousel-item.entry.js +1 -1
  334. package/dist/esm/co-carousel.entry.js +2 -2
  335. package/dist/esm/co-checkbox-group.entry.js +2 -2
  336. package/dist/esm/co-checkbox.entry.js +2 -2
  337. package/dist/esm/co-chip_2.entry.js +6 -6
  338. package/dist/esm/co-color-area.entry.js +1 -1
  339. package/dist/esm/co-color-picker.entry.js +3 -3
  340. package/dist/esm/co-color-slider.entry.js +1 -1
  341. package/dist/esm/co-column-picker.entry.js +2 -2
  342. package/dist/esm/co-combobox.entry.js +2 -2
  343. package/dist/esm/co-command-search.entry.js +2 -2
  344. package/dist/esm/co-data-table-pagination.entry.js +2 -2
  345. package/dist/esm/co-data-table.entry.js +2 -2
  346. package/dist/esm/co-date-picker.entry.js +2 -2
  347. package/dist/esm/co-date-range-picker.entry.js +2 -2
  348. package/dist/esm/co-date-range.entry.js +1 -1
  349. package/dist/esm/co-date-time-picker.entry.js +2 -2
  350. package/dist/esm/co-document-editor.entry.js +2 -2
  351. package/dist/esm/co-drive-card.entry.js +1 -1
  352. package/dist/esm/co-drop-zone.entry.js +1 -1
  353. package/dist/esm/co-emoji-picker.entry.js +2 -2
  354. package/dist/esm/co-empty-state.entry.js +2 -2
  355. package/dist/esm/co-event-calendar.entry.js +1 -1
  356. package/dist/esm/co-event-popover.entry.js +1 -1
  357. package/dist/esm/co-fab.entry.js +1 -1
  358. package/dist/esm/co-file-field.entry.js +3 -3
  359. package/dist/esm/co-file-type-tile.entry.js +1 -1
  360. package/dist/esm/co-gradient-bar.entry.js +1 -1
  361. package/dist/esm/co-helper-text.entry.js +1 -1
  362. package/dist/esm/co-icon-button.entry.js +2 -2
  363. package/dist/esm/co-icon.entry.js +1 -1
  364. package/dist/esm/co-input.entry.js +2 -2
  365. package/dist/esm/co-json-field.entry.js +2 -2
  366. package/dist/esm/co-kbd_2.entry.js +1 -1
  367. package/dist/esm/co-lightbox.entry.js +1 -1
  368. package/dist/esm/co-list-footer.entry.js +1 -1
  369. package/dist/esm/co-list-item.entry.js +2 -2
  370. package/dist/esm/co-loader.entry.js +1 -1
  371. package/dist/esm/co-media-thumb.entry.js +1 -1
  372. package/dist/esm/co-menu-divider.entry.js +1 -1
  373. package/dist/esm/co-menu-item.entry.js +7 -40
  374. package/dist/esm/co-menu.entry.js +2 -2
  375. package/dist/esm/co-modal.entry.js +2 -2
  376. package/dist/esm/co-navbar.entry.js +1 -1
  377. package/dist/esm/co-number-field.entry.js +2 -2
  378. package/dist/esm/co-overlay.entry.js +1 -1
  379. package/dist/esm/co-page-header.entry.js +1 -1
  380. package/dist/esm/co-phone-field.entry.js +4 -4
  381. package/dist/esm/co-popover.entry.js +1 -1
  382. package/dist/esm/co-progress-bar.entry.js +1 -1
  383. package/dist/esm/co-progress-circle.entry.js +2 -2
  384. package/dist/esm/co-provider-logo_2.entry.js +2 -2
  385. package/dist/esm/co-radio-group.entry.js +1 -1
  386. package/dist/esm/co-radio.entry.js +2 -2
  387. package/dist/esm/co-rating.entry.js +2 -2
  388. package/dist/esm/co-ref-field.entry.js +3 -3
  389. package/dist/esm/co-rich-text-editor.entry.js +2 -2
  390. package/dist/esm/co-rich-text-toolbar.entry.js +1 -1
  391. package/dist/esm/co-rich-text-viewer.entry.js +1 -1
  392. package/dist/esm/co-row.entry.js +1 -1
  393. package/dist/esm/co-segmented-bar.entry.js +1 -1
  394. package/dist/esm/co-select.entry.js +27 -14
  395. package/dist/esm/co-separator.entry.js +1 -1
  396. package/dist/esm/co-sidebar-nav.entry.js +1 -1
  397. package/dist/esm/co-sidebar.entry.js +1 -1
  398. package/dist/esm/co-slider.entry.js +2 -2
  399. package/dist/esm/co-swatch-grid.entry.js +1 -1
  400. package/dist/esm/co-switch.entry.js +3 -3
  401. package/dist/esm/co-tab-group.entry.js +2 -2
  402. package/dist/esm/co-tab.entry.js +2 -2
  403. package/dist/esm/co-tags-field.entry.js +4 -4
  404. package/dist/esm/co-textarea.entry.js +2 -2
  405. package/dist/esm/co-tile.entry.js +1 -1
  406. package/dist/esm/co-time-field.entry.js +1 -1
  407. package/dist/esm/co-toast.entry.js +1 -1
  408. package/dist/esm/co-toggle-button-group.entry.js +1 -1
  409. package/dist/esm/co-toggle-button.entry.js +2 -2
  410. package/dist/esm/co-transfer-list.entry.js +2 -2
  411. package/dist/esm/co-tree-item.entry.js +2 -2
  412. package/dist/esm/co-video.entry.js +2 -2
  413. package/dist/esm/cobalt.js +3 -3
  414. package/dist/esm/{fieldChip-DFpKjAN_.js → fieldChip-B0N8z5W-.js} +1 -1
  415. package/dist/esm/{index-YRicbXh3.js → index-DJkaRtbb.js} +1 -1
  416. package/dist/esm/loader.js +3 -3
  417. package/dist/esm/{requiredMark-BNC0WBDk.js → requiredMark-D5C5NzOE.js} +1 -1
  418. package/dist/types/components/co-menu-item/co-menu-item.d.ts +4 -30
  419. package/dist/types/components/co-select/co-select.d.ts +14 -4
  420. package/dist/types/components.d.ts +6 -28
  421. package/package.json +4 -4
  422. package/dist/cobalt/p-05f90173.entry.js +0 -1
  423. package/dist/cobalt/p-1318c5b9.entry.js +0 -1
  424. package/dist/cobalt/p-1361f386.entry.js +0 -1
  425. package/dist/cobalt/p-388f5a71.entry.js +0 -1
  426. package/dist/cobalt/p-5259c731.entry.js +0 -1
  427. package/dist/cobalt/p-71a289f9.entry.js +0 -1
  428. package/dist/cobalt/p-90823b79.entry.js +0 -1
  429. package/dist/cobalt/p-9a3e631e.entry.js +0 -1
  430. package/dist/cobalt/p-C_xES1w3.js +0 -1
  431. package/dist/cobalt/p-d127a7c4.entry.js +0 -1
  432. package/dist/cobalt/p-d1293695.entry.js +0 -1
  433. package/dist/cobalt/p-ddf6083f.entry.js +0 -1
  434. package/dist/cobalt/p-pl89alJ1.js +0 -1
  435. package/dist/components/p-BDk4ffI3.js +0 -1
  436. package/dist/components/p-BXDvRVSp.js +0 -1
  437. package/dist/components/p-CV7I0t8n.js +0 -1
  438. package/dist/components/p-CpwIdVV5.js +0 -1
  439. package/dist/components/p-DpnlSVX3.js +0 -1
@@ -1 +1 @@
1
- import{r as e,c as i,h as o,a as t}from"./p-YRicbXh3.js";import{R as r}from"./p-pl89alJ1.js";import{g as a,f as s}from"./p-z0tbse7d.js";function n(e){if(null==e||isNaN(e))return"";if(e<1024)return`${e} B`;const i=e=>e.toFixed(2).replace(/\.?0+$/,"");return e<1048576?`${i(e/1024)} KB`:`${i(e/1048576)} MB`}const c=new Set(["png","jpg","jpeg","gif","webp","svg","avif","bmp"]),l=new Set(["mp4","mov","webm","m4v","ogv"]);function d(e){const i=(e||"").split("?")[0],o=i.lastIndexOf(".");return o>=0?i.slice(o+1).toLowerCase():""}function f(e){return d(e.name)||d(e.url)}function h(e){return c.has(f(e))}function p(e){return l.has(f(e))}function u(e){return"done"===e.status&&!!e.url&&p(e)}const v=new Set(["png","jpg","jpeg","webp"]);function _(e){return p(e)||h(e)?e.url||e.thumbnail:e.thumbnail||e.url}const g={image:c,video:l},b=class{constructor(o){e(this,o),this.coFilesSelected=i(this,"coFilesSelected",3),this.coRemove=i(this,"coRemove",3),this.coClear=i(this,"coClear",3),this.coReorder=i(this,"coReorder",3),this.coCopy=i(this,"coCopy",3),this.coAnnotate=i(this,"coAnnotate",3),this.coPreviewOpen=i(this,"coPreviewOpen",3),this.disabled=!1,this.readonly=!1,this.required=!1,this.multiple=!1,this.maxFiles=100,this.status="default",this.layout="vertical",this.reorderable=!0,this.annotatable=!1,this.files="[]",this.dragOver=!1,this.localError="",this.copiedKey="",this.armedKey="",this.dragKey="",this.overKey="",this.failedPreviews=new Set,this.tempSeq=0,this.lastFilesStr="",this.lastParsed=[],this.handleDragOver=e=>{this.disabled||this.readonly||this.dragKey||(e.preventDefault(),this.dragOver=!0)},this.handleDragLeave=e=>{const i=e.relatedTarget;i&&e.currentTarget instanceof Node&&e.currentTarget.contains(i)||(this.dragOver=!1)},this.handleDrop=e=>{var i;e.preventDefault(),this.dragOver=!1,this.dragKey||(null===(i=e.dataTransfer)||void 0===i?void 0:i.files)&&this.handleFiles(e.dataTransfer.files)},this.handleBrowse=e=>{var i;this.disabled||this.readonly||e&&this.fromActionsSlot(e)||null===(i=this.inputEl)||void 0===i||i.click()},this.handleInputChange=e=>{const i=e.target;i.files&&this.handleFiles(i.files),i.value=""},this.disarmDrag=()=>{this.armedKey&&!this.dragKey&&(this.armedKey="")},this.handleRowDragEnd=()=>{this.resetDragState()}}componentWillLoad(){this.failedPreviews||(this.failedPreviews=new Set)}connectedCallback(){window.addEventListener("mouseup",this.disarmDrag)}disconnectedCallback(){window.removeEventListener("mouseup",this.disarmDrag),clearTimeout(this.copiedTimer),this.closeLightbox()}get parsedFiles(){const e=this.files;if("string"!=typeof e||!e.trim())return[];if(e===this.lastFilesStr)return this.lastParsed;let i=[];try{const o=JSON.parse(e);Array.isArray(o)&&(i=o)}catch(e){}return this.lastFilesStr=e,this.lastParsed=i,i}get strings(){return a(this.locale)}get acceptList(){const e=this.accept;if(!e)return[];let i=[];try{const o=JSON.parse(e);Array.isArray(o)&&(i=o.map(String))}catch(o){i=e.split(",")}return i.map((e=>e.trim().toLowerCase().replace(/^\./,""))).filter((e=>e&&"*"!==e))}get isInvalid(){return"error"===this.status||!!this.localError}get inputAccept(){const e=this.acceptList;if(e.length)return e.map((e=>e.includes("/")?e:`.${e}`)).join(",")}extOf(e){const i=e.lastIndexOf(".");return i>=0?e.slice(i+1).toLowerCase():""}validate(e){return function(e,i){if(!e.length)return!0;const o=d(i.name),t=(i.type||"").toLowerCase();return e.some((e=>{var i;if(!e.includes("/"))return e===o;if(!e.endsWith("/*"))return t===e;const r=e.slice(0,-2);return t?t.startsWith(`${r}/`):!!(null===(i=g[r])||void 0===i?void 0:i.has(o))}))}(this.acceptList,e)?this.maxBytes&&e.size>this.maxBytes?s(this.strings.errTooLarge,{x:n(e.size)}):null:s(this.strings.errInvalidFormat,{x:this.extOf(e.name)})}onDownloadClick(e,i){if(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||!i.url)return;e.preventDefault();const o=i.url;(async function(e,i,o={}){const{fetchImpl:t=globalThis.fetch,doc:r=globalThis.document,urlApi:a=URL}=o;try{const o=await t(e);if(!o.ok)return!1;const s=a.createObjectURL(await o.blob()),n=r.createElement("a");return n.href=s,n.download=i||"download",n.rel="noopener noreferrer",r.body.appendChild(n),n.click(),setTimeout((()=>{n.remove(),a.revokeObjectURL(s)}),2e3),!0}catch(e){return!1}})(o,i.name).then((e=>{e||window.open(o,"_blank","noopener,noreferrer")}))}handleFiles(e){if(this.disabled||this.readonly)return;this.localError="";const i=Array.from(e);if(!i.length)return;const o=this.multiple?i:i.slice(0,1);if(this.multiple){const e=this.maxFiles-this.parsedFiles.length;if(e<=0)return void(this.localError=s(this.strings.errMaxFiles,{n:this.maxFiles}));o.length>e&&(o.length=e)}const t=[],r=[];for(const e of o){const i=this.validate(e);i?this.localError=i:(t.push(e),r.push(`tmp-${Date.now()}-${this.tempSeq++}`))}t.length&&this.coFilesSelected.emit({files:t,tempIds:r})}fromActionsSlot(e){return e.composedPath().some((e=>{var i,o;return"actions"===(null===(o=(i=e).getAttribute)||void 0===o?void 0:o.call(i,"slot"))}))}keyFor(e){var i;return e.id||e.tempId||`${e.name}:${null!==(i=e.size)&&void 0!==i?i:""}`}handleCopy(e){var i;const o=e.url||"";if(!o)return;const t=this.keyFor(e);this.coCopy.emit({id:t,url:o}),(null===(i=navigator.clipboard)||void 0===i?void 0:i.writeText)&&navigator.clipboard.writeText(o).then((()=>{this.copiedKey=t,clearTimeout(this.copiedTimer),this.copiedTimer=setTimeout((()=>this.copiedKey=""),1500)})).catch((()=>{}))}previewItems(){return this.parsedFiles.filter((e=>{return(function(e){return"done"===e.status&&!u(e)&&!(!e.thumbnail&&!e.url)&&(!!e.thumbnail||h(e))}(i=e)||u(i))&&(u(e)||!this.failedPreviews.has(this.keyFor(e)));var i}))}handlePreviewOpen(e){const i=e.url||e.thumbnail;if(!i)return;this.coPreviewOpen.emit({id:this.keyFor(e),url:i});const o=this.previewItems(),t=o.map((e=>u(e)?{src:_(e),thumbnail:e.thumbnail,alt:e.name,kind:"video",poster:e.thumbnail}:{src:_(e),thumbnail:e.thumbnail,alt:e.name,original:e.url})),r=Math.max(0,o.findIndex((i=>this.keyFor(i)===this.keyFor(e))));this.closeLightbox();const a=document.createElement("co-lightbox");a.images=JSON.stringify(t),a.startIndex=r,this.locale&&(a.locale=this.locale),a.addEventListener("coClose",(()=>this.closeLightbox())),document.body.appendChild(a),this.lightboxEl=a,requestAnimationFrame((()=>{a.open=!0}))}closeLightbox(){const e=this.lightboxEl;this.lightboxEl=void 0,e&&(e.open=!1,setTimeout((()=>e.remove()),220))}handlePreviewError(e){this.failedPreviews=new Set([...this.failedPreviews,this.keyFor(e)])}handleRowDragStart(e,i){this.armedKey===i?(this.dragKey=i,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",i))):e.preventDefault()}handleRowDragOver(e,i){this.dragKey&&this.dragKey!==i&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),this.overKey=i)}handleRowDrop(e,i){e.preventDefault(),e.stopPropagation();const o=this.parsedFiles.map((e=>this.keyFor(e))),t=o.indexOf(this.dragKey),r=o.indexOf(i);this.resetDragState(),t<0||r<0||t===r||(o.splice(r,0,...o.splice(t,1)),this.coReorder.emit(o))}resetDragState(){this.armedKey="",this.dragKey="",this.overKey=""}capacityHint(e){const i=this.maxBytes?n(this.maxBytes):"";return this.multiple&&this.maxBytes?s(e.helperBoth,{n:this.maxFiles,x:i}):this.multiple?s(e.helperFiles,{n:this.maxFiles}):this.maxBytes?s(e.helperBytes,{x:i}):""}render(){const e=this.strings,i=this.parsedFiles,t=this.localError||this.helperText,a=!(this.readonly||(this.multiple?this.multiple&&i.length>=this.maxFiles:0!==i.length)),s="default"!==this.status?`co-file-field--${this.status}`:"",c=this.previewItems(),l=this.reorderable&&this.multiple&&!this.disabled&&!this.readonly&&i.length>1,d=this.capacityHint(e);return o("div",{key:"ce032373afbb21b082696b4d532655c3d599800c",class:{"co-file-field":!0,"co-file-field--disabled":this.disabled,"co-file-field--invalid":this.isInvalid,[s]:!!s},part:"wrapper"},this.label&&o("div",{key:"7650af04090b50b39e9dde6879156b51fd0a1b11",class:"co-file-field__labels"},o("label",{key:"5f305d56f5dcbe3b8d267e22471f4c6536792510",class:"co-file-field__label",part:"label"},this.label,o(r,{key:"46896eae83028b9117c32b2ab9ac21443a58c608",required:this.required}))),a&&o("div",{key:"c2767c1c6f8e0e928f328db2e985f747f34b13af",class:{"co-file-field__dropzone":!0,"co-file-field__dropzone--drag":this.dragOver},part:"dropzone",role:"button",tabIndex:this.disabled?-1:0,onClick:this.handleBrowse,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||this.fromActionsSlot(e)||(e.preventDefault(),this.handleBrowse())},onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop},o("button",{key:"f9b2ef43730b009a6ca322ea6cae833f86a52ff0",class:"co-file-field__upload-btn",part:"upload-button",type:"button",tabIndex:-1},o("co-icon",{key:"ffa7d7fdb830fc789ffd4ada624c450c70109701",name:"file-arrow-up",size:18}),o("span",{key:"c9c54dd9432f8c74894a0054ecdf0c59aede974a"},this.uploadButtonText||e.uploadButton)),o("span",{key:"74f8884d62b79960e0080794404f24e45d229284",class:"co-file-field__dropzone-text"},this.dropText||e.dropHint),d&&o("span",{key:"4c6bdd2de90754b50135e9212510884d1495b8d4",class:"co-file-field__dropzone-hint"},d),o("div",{key:"42bd92119fed5b9be39e7db5c351990faafc7135",class:"co-file-field__actions",part:"actions"},o("slot",{key:"fa2a649c222125ba63fa74028dba417c50f7b3f6",name:"actions"})),o("input",{key:"982021a63eb6bec0b19ca917382a6efd37938ab3",ref:e=>this.inputEl=e,class:"co-file-field__input",type:"file",multiple:this.multiple,accept:this.inputAccept,disabled:this.disabled,onChange:this.handleInputChange,"aria-hidden":"true",tabIndex:-1})),i.length>0&&o("div",{key:"95bd1f51b0a361dec2ca0b272212ef64d438db0a",class:"co-file-field__uploaded"},this.multiple&&o("div",{key:"479851cd44dbdc9ad99e9b26764f558845966c53",class:"co-file-field__uploaded-title",part:"uploaded-title"},`${this.uploadedTitle||e.uploadedTitle} (${i.length})`),c.length>0&&o("div",{key:"8be03edd2b1b8b7628d6e34fa82751045589b416",class:"co-file-field__previews",part:"previews"},c.map((i=>{const t=this.keyFor(i),r=u(i),a=this.failedPreviews.has(t)?"":i.thumbnail;return o("button",{class:{"co-file-field__preview":!0,"co-file-field__preview--video":r},part:"preview",type:"button",key:`prev-${t}`,title:i.name,"aria-label":`${r?e.playVideo:e.openPreview}: ${i.name}`,onClick:()=>this.handlePreviewOpen(i)},(!r||!!a)&&o("img",{src:r?a:i.thumbnail||i.url,alt:i.name,loading:"lazy",onError:()=>this.handlePreviewError(i)}),r&&o("span",{class:"co-file-field__preview-play","aria-hidden":"true"},o("span",{class:"co-file-field__preview-play-badge"},o("co-icon",{name:"play",size:20,weight:"fill"})),!a&&o("span",{class:"co-file-field__preview-ext"},f(i).toUpperCase())))}))),o("ul",{key:"1fa661f14a8644a2703204d1faac79e5599c5e77",class:"co-file-field__list",part:"list"},i.map((i=>{const t=this.keyFor(i),r=l&&"done"===i.status;return o("li",{class:{"co-file-field__row":!0,[`co-file-field__row--${i.status}`]:!0,"co-file-field__row--dragging":this.dragKey===t,"co-file-field__row--drop-target":this.overKey===t},part:"row",key:t,draggable:this.armedKey===t,onDragStart:e=>this.handleRowDragStart(e,t),onDragOver:e=>this.handleRowDragOver(e,t),onDrop:e=>this.handleRowDrop(e,t),onDragEnd:this.handleRowDragEnd},r?o("co-tooltip",{content:e.dragToReorder},o("span",{class:"co-file-field__drag-handle",part:"drag-handle",onMouseDown:()=>this.armedKey=t},o("co-icon",{name:"list",size:18}))):o("co-icon",{name:"error"===i.status?"warning-circle":"uploading"===i.status?"spinner-gap":"file",size:18,class:{"co-file-field__row-icon":!0,"co-file-field__row-icon--spin":"uploading"===i.status}}),o("div",{class:"co-file-field__row-body"},o("span",{class:"co-file-field__row-name",title:i.name},function(e,i=35){return!e||e.length<=i?e:`...${e.slice(-i)}`}(i.name)),"uploading"===i.status&&o("div",{class:"co-file-field__progress"},o("div",{class:"co-file-field__progress-bar",style:"number"==typeof i.progress?{width:`${i.progress}%`}:void 0})),"error"===i.status&&i.error&&o("span",{class:"co-file-field__row-error"},i.error)),null!=i.size&&o("span",{class:"co-file-field__row-size"},n(i.size)),this.annotatable&&!this.disabled&&!this.readonly&&function(e){return!("done"!==e.status||!e.url)&&v.has(f(e))}(i)&&o("co-tooltip",{content:e.annotateImage},o("button",{class:"co-file-field__action",type:"button",tabIndex:-1,"aria-label":`${e.annotateImage}: ${i.name}`,onClick:()=>this.coAnnotate.emit({id:t,url:i.url,name:i.name})},o("co-icon",{name:"pencil-simple-line",size:18}))),"done"===i.status&&!!i.url&&o("co-tooltip",{content:e.downloadFile},o("a",{class:"co-file-field__action",href:i.url,target:"_blank",rel:"noopener noreferrer",download:i.name,tabIndex:-1,"aria-label":e.downloadFile,onClick:e=>this.onDownloadClick(e,i)},o("co-icon",{name:"download",size:18}))),"done"===i.status&&!!i.url&&o("co-tooltip",{content:this.copiedKey===t?e.copied:e.copyUrl},o("button",{class:{"co-file-field__action":!0,"co-file-field__action--copied":this.copiedKey===t},type:"button",tabIndex:-1,"aria-label":e.copyUrl,onClick:()=>this.handleCopy(i)},o("co-icon",{name:this.copiedKey===t?"check":"copy",size:18}))),!this.disabled&&!this.readonly&&o("co-tooltip",{content:e.removeFile},o("button",{class:"co-file-field__action",type:"button",tabIndex:-1,"aria-label":e.removeFile,onClick:()=>this.coRemove.emit(t)},o("co-icon",{name:"trash",size:18}))))})))),t&&o("div",{key:"7562fdf435667ae305e677830cae06a3374ef67b",class:{"co-file-field__helper":!0,"co-file-field__helper--error":this.isInvalid},part:"helper"},this.isInvalid&&o("co-icon",{key:"ac43b079725a8b015f2ba1a8b8f22783f60e556e",name:"warning-circle",size:14,class:"co-file-field__helper-icon"}),o("span",{key:"cd256498ce501e5b59ae1a5850f8f8ddccb98580",class:"co-file-field__helper-text"},t)))}get el(){return t(this)}};b.style=":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}.co-file-field{display:flex;flex-direction:column;gap:var(--co-spacing-sm2)}.co-file-field__labels{display:flex;align-items:center;justify-content:space-between;padding:0 var(--co-spacing-xs)}.co-file-field__label{color:var(--co-semantic-text-secondary);font-size:var(--co-font-size-14);font-weight:400;line-height:1;white-space:nowrap;cursor:default}.co-field-required{margin-left:2px;color:var(--co-semantic-text-error, 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)')}.co-file-field__dropzone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--co-spacing-md);padding:var(--co-spacing-4xl) var(--co-spacing-2xl);background:color-mix(in srgb, var(--co-semantic-surface-hover) 55%, transparent);border:1px dashed var(--co-semantic-border-field);border-radius:var(--co-border-radius-sm);cursor:pointer;text-align:center;transition:border-color var(--co-motion-duration-fast) var(--co-motion-ease-out), background var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-file-field__dropzone:hover{border-color:var(--co-semantic-border-strong)}.co-file-field__dropzone--drag{border-color:var(--co-semantic-border-focus);background:var(--co-semantic-surface-hover)}.co-file-field__upload-btn{display:inline-flex;align-items:center;gap:var(--co-spacing-sm2);padding:var(--co-spacing-md) var(--co-spacing-xl);margin-bottom:var(--co-spacing-xs);background:var(--co-semantic-surface-secondary);color:var(--co-semantic-text-default);border:none;border-radius:var(--co-border-radius-full);box-shadow:var(--co-shadow-lg);font-family:inherit;font-size:var(--co-font-size-16);font-weight:400;letter-spacing:var(--co-font-letter-spacing-body);line-height:1;cursor:pointer;transition:box-shadow var(--co-motion-duration-fast) var(--co-motion-ease-out), transform var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-file-field__upload-btn:hover{box-shadow:var(--co-shadow-xl, var(--co-shadow-lg));transform:translateY(-1px)}.co-file-field__upload-btn co-icon{display:inline-flex;flex-shrink:0}.co-file-field__dropzone-text{color:var(--co-semantic-text-default);font-size:var(--co-font-size-18);line-height:1.25}.co-file-field__dropzone-hint{color:var(--co-semantic-text-secondary);font-size:var(--co-font-size-14);line-height:1.25}.co-file-field__actions{display:contents}.co-file-field__input{display:none}.co-file-field__uploaded{display:flex;flex-direction:column;gap:var(--co-spacing-lg);margin-top:var(--co-spacing-sm2)}.co-file-field__uploaded-title{color:var(--co-semantic-text-default);font-size:var(--co-font-size-22);font-weight:500;letter-spacing:-0.03em;line-height:1.25}.co-file-field__previews{display:grid;grid-template-columns:repeat(auto-fill, minmax(150px, 180px));gap:var(--co-spacing-md)}.co-file-field__preview{padding:0;border:none;border-radius:var(--co-border-radius-sm);overflow:hidden;aspect-ratio:3 / 2;background:var(--co-semantic-surface-hover);cursor:pointer}.co-file-field__preview img{display:block;width:100%;height:100%;object-fit:cover;transition:transform var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-file-field__preview:hover img{transform:scale(1.02)}.co-file-field__preview--video{position:relative;background:var(--co-color-base-negro)}.co-file-field__preview-play{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--co-spacing-sm2);color:var(--co-color-base-blanco);pointer-events:none}.co-file-field__preview-play-badge{display:flex;width:40px;height:40px;align-items:center;justify-content:center;border-radius:var(--co-border-radius-full);background:var(--co-color-opacity-negro-80);box-shadow:inset 0 0 0 1px var(--co-color-opacity-blanco-25);transition:transform var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-file-field__preview--video:hover .co-file-field__preview-play-badge{transform:scale(1.08)}.co-file-field__preview-play-badge co-icon{transform:translateX(1px)}.co-file-field__preview-ext{font-family:var(--co-font-family-primary);font-size:var(--co-font-size-12);font-weight:var(--co-font-weight-medium);letter-spacing:var(--co-font-letter-spacing-overline);color:var(--co-color-opacity-blanco-80)}.co-file-field__list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--co-spacing-sm2)}.co-file-field__row{display:flex;align-items:center;gap:var(--co-spacing-lg);padding:var(--co-spacing-xl);background:var(--co-semantic-surface-hover);border:1px solid transparent;border-radius:var(--co-border-radius-sm)}.co-file-field__row--error{border-color:var(--co-semantic-border-error, var(--co-semantic-status-error))}.co-file-field__row--dragging{opacity:0.5}.co-file-field__row--drop-target{border-color:var(--co-semantic-border-focus);background:var(--co-semantic-surface-hover)}.co-file-field__drag-handle{flex-shrink:0;display:flex;align-items:center;color:var(--co-semantic-text-secondary);cursor:grab}.co-file-field__drag-handle:active{cursor:grabbing}.co-file-field__row-icon{flex-shrink:0;color:var(--co-semantic-text-secondary);display:flex;align-items:center}.co-file-field__row--error .co-file-field__row-icon{color:var(--co-semantic-text-error, var(--co-semantic-status-error))}.co-file-field__row-icon--spin{animation:co-file-spin 0.8s linear infinite}@keyframes co-file-spin{to{transform:rotate(360deg)}}.co-file-field__row-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:var(--co-spacing-xs)}.co-file-field__row-name{color:var(--co-semantic-text-default);font-size:var(--co-font-size-14);line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-file-field__row-error{color:var(--co-semantic-text-error, var(--co-semantic-status-error));font-size:var(--co-font-size-12)}.co-file-field__row-size{flex-shrink:0;color:var(--co-semantic-text-default);font-size:var(--co-font-size-14);line-height:1;white-space:nowrap}.co-file-field__progress{position:relative;height:4px;border-radius:var(--co-border-radius-full);background:var(--co-semantic-surface-hover);overflow:hidden}.co-file-field__progress-bar{position:absolute;inset:0;width:40%;border-radius:var(--co-border-radius-full);background:var(--co-semantic-status-info);transition:width var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-file-field__progress-bar:not([style]){animation:co-file-indeterminate 1.2s ease-in-out infinite}@keyframes co-file-indeterminate{0%{left:-40%}100%{left:100%}}.co-file-field__action{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;cursor:pointer;text-decoration:none;color:var(--co-semantic-text-secondary);transition:color var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-file-field__action:hover{color:var(--co-semantic-text-default)}.co-file-field__action--copied,.co-file-field__action--copied:hover{color:var(--co-color-primary-verde)}.co-file-field__helper{display:flex;align-items:center;gap:var(--co-spacing-xs);padding:0 var(--co-spacing-xs)}.co-file-field__helper-icon{flex-shrink:0;color:var(--co-semantic-text-muted);display:flex;align-items:center}.co-file-field__helper-text{color:var(--co-semantic-text-muted);font-size:var(--co-font-size-14);line-height:1}.co-file-field--disabled{opacity:0.6;pointer-events:none}.co-file-field--invalid .co-file-field__dropzone,.co-file-field--error .co-file-field__dropzone{border-color:var(--co-semantic-border-error, var(--co-semantic-status-error))}.co-file-field__helper--error .co-file-field__helper-icon,.co-file-field__helper--error .co-file-field__helper-text{color:var(--co-semantic-text-error, var(--co-semantic-status-error))}:host([layout='horizontal']) .co-file-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-file-field__labels{grid-column:1;grid-row:1;padding-top:var(--co-spacing-sm2);min-width:0}:host([layout='horizontal']) .co-file-field__label{white-space:normal}:host([layout='horizontal']) .co-file-field>:not(.co-file-field__labels){grid-column:2;min-width:0}@supports not (background: color-mix(in srgb, red, transparent)){.co-file-field__dropzone{background:var(--co-semantic-surface-hover)}}";export{b as co_file_field}
1
+ import{r as e,c as i,h as o,a as t}from"./p-DJkaRtbb.js";import{R as r}from"./p-CYN5B3IQ.js";import{g as a,f as s}from"./p-z0tbse7d.js";function n(e){if(null==e||isNaN(e))return"";if(e<1024)return`${e} B`;const i=e=>e.toFixed(2).replace(/\.?0+$/,"");return e<1048576?`${i(e/1024)} KB`:`${i(e/1048576)} MB`}const c=new Set(["png","jpg","jpeg","gif","webp","svg","avif","bmp"]),l=new Set(["mp4","mov","webm","m4v","ogv"]);function d(e){const i=(e||"").split("?")[0],o=i.lastIndexOf(".");return o>=0?i.slice(o+1).toLowerCase():""}function f(e){return d(e.name)||d(e.url)}function h(e){return c.has(f(e))}function p(e){return l.has(f(e))}function u(e){return"done"===e.status&&!!e.url&&p(e)}const v=new Set(["png","jpg","jpeg","webp"]);function _(e){return p(e)||h(e)?e.url||e.thumbnail:e.thumbnail||e.url}const b={image:c,video:l},g=class{constructor(o){e(this,o),this.coFilesSelected=i(this,"coFilesSelected",3),this.coRemove=i(this,"coRemove",3),this.coClear=i(this,"coClear",3),this.coReorder=i(this,"coReorder",3),this.coCopy=i(this,"coCopy",3),this.coAnnotate=i(this,"coAnnotate",3),this.coPreviewOpen=i(this,"coPreviewOpen",3),this.disabled=!1,this.readonly=!1,this.required=!1,this.multiple=!1,this.maxFiles=100,this.status="default",this.layout="vertical",this.reorderable=!0,this.annotatable=!1,this.files="[]",this.dragOver=!1,this.localError="",this.copiedKey="",this.armedKey="",this.dragKey="",this.overKey="",this.failedPreviews=new Set,this.tempSeq=0,this.lastFilesStr="",this.lastParsed=[],this.handleDragOver=e=>{this.disabled||this.readonly||this.dragKey||(e.preventDefault(),this.dragOver=!0)},this.handleDragLeave=e=>{const i=e.relatedTarget;i&&e.currentTarget instanceof Node&&e.currentTarget.contains(i)||(this.dragOver=!1)},this.handleDrop=e=>{var i;e.preventDefault(),this.dragOver=!1,this.dragKey||(null===(i=e.dataTransfer)||void 0===i?void 0:i.files)&&this.handleFiles(e.dataTransfer.files)},this.handleBrowse=e=>{var i;this.disabled||this.readonly||e&&this.fromActionsSlot(e)||null===(i=this.inputEl)||void 0===i||i.click()},this.handleInputChange=e=>{const i=e.target;i.files&&this.handleFiles(i.files),i.value=""},this.disarmDrag=()=>{this.armedKey&&!this.dragKey&&(this.armedKey="")},this.handleRowDragEnd=()=>{this.resetDragState()}}componentWillLoad(){this.failedPreviews||(this.failedPreviews=new Set)}connectedCallback(){window.addEventListener("mouseup",this.disarmDrag)}disconnectedCallback(){window.removeEventListener("mouseup",this.disarmDrag),clearTimeout(this.copiedTimer),this.closeLightbox()}get parsedFiles(){const e=this.files;if("string"!=typeof e||!e.trim())return[];if(e===this.lastFilesStr)return this.lastParsed;let i=[];try{const o=JSON.parse(e);Array.isArray(o)&&(i=o)}catch(e){}return this.lastFilesStr=e,this.lastParsed=i,i}get strings(){return a(this.locale)}get acceptList(){const e=this.accept;if(!e)return[];let i=[];try{const o=JSON.parse(e);Array.isArray(o)&&(i=o.map(String))}catch(o){i=e.split(",")}return i.map((e=>e.trim().toLowerCase().replace(/^\./,""))).filter((e=>e&&"*"!==e))}get isInvalid(){return"error"===this.status||!!this.localError}get inputAccept(){const e=this.acceptList;if(e.length)return e.map((e=>e.includes("/")?e:`.${e}`)).join(",")}extOf(e){const i=e.lastIndexOf(".");return i>=0?e.slice(i+1).toLowerCase():""}validate(e){return function(e,i){if(!e.length)return!0;const o=d(i.name),t=(i.type||"").toLowerCase();return e.some((e=>{var i;if(!e.includes("/"))return e===o;if(!e.endsWith("/*"))return t===e;const r=e.slice(0,-2);return t?t.startsWith(`${r}/`):!!(null===(i=b[r])||void 0===i?void 0:i.has(o))}))}(this.acceptList,e)?this.maxBytes&&e.size>this.maxBytes?s(this.strings.errTooLarge,{x:n(e.size)}):null:s(this.strings.errInvalidFormat,{x:this.extOf(e.name)})}onDownloadClick(e,i){if(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||!i.url)return;e.preventDefault();const o=i.url;(async function(e,i,o={}){const{fetchImpl:t=globalThis.fetch,doc:r=globalThis.document,urlApi:a=URL}=o;try{const o=await t(e);if(!o.ok)return!1;const s=a.createObjectURL(await o.blob()),n=r.createElement("a");return n.href=s,n.download=i||"download",n.rel="noopener noreferrer",r.body.appendChild(n),n.click(),setTimeout((()=>{n.remove(),a.revokeObjectURL(s)}),2e3),!0}catch(e){return!1}})(o,i.name).then((e=>{e||window.open(o,"_blank","noopener,noreferrer")}))}handleFiles(e){if(this.disabled||this.readonly)return;this.localError="";const i=Array.from(e);if(!i.length)return;const o=this.multiple?i:i.slice(0,1);if(this.multiple){const e=this.maxFiles-this.parsedFiles.length;if(e<=0)return void(this.localError=s(this.strings.errMaxFiles,{n:this.maxFiles}));o.length>e&&(o.length=e)}const t=[],r=[];for(const e of o){const i=this.validate(e);i?this.localError=i:(t.push(e),r.push(`tmp-${Date.now()}-${this.tempSeq++}`))}t.length&&this.coFilesSelected.emit({files:t,tempIds:r})}fromActionsSlot(e){return e.composedPath().some((e=>{var i,o;return"actions"===(null===(o=(i=e).getAttribute)||void 0===o?void 0:o.call(i,"slot"))}))}keyFor(e){var i;return e.id||e.tempId||`${e.name}:${null!==(i=e.size)&&void 0!==i?i:""}`}handleCopy(e){var i;const o=e.url||"";if(!o)return;const t=this.keyFor(e);this.coCopy.emit({id:t,url:o}),(null===(i=navigator.clipboard)||void 0===i?void 0:i.writeText)&&navigator.clipboard.writeText(o).then((()=>{this.copiedKey=t,clearTimeout(this.copiedTimer),this.copiedTimer=setTimeout((()=>this.copiedKey=""),1500)})).catch((()=>{}))}previewItems(){return this.parsedFiles.filter((e=>{return(function(e){return"done"===e.status&&!u(e)&&!(!e.thumbnail&&!e.url)&&(!!e.thumbnail||h(e))}(i=e)||u(i))&&(u(e)||!this.failedPreviews.has(this.keyFor(e)));var i}))}handlePreviewOpen(e){const i=e.url||e.thumbnail;if(!i)return;this.coPreviewOpen.emit({id:this.keyFor(e),url:i});const o=this.previewItems(),t=o.map((e=>u(e)?{src:_(e),thumbnail:e.thumbnail,alt:e.name,kind:"video",poster:e.thumbnail}:{src:_(e),thumbnail:e.thumbnail,alt:e.name,original:e.url})),r=Math.max(0,o.findIndex((i=>this.keyFor(i)===this.keyFor(e))));this.closeLightbox();const a=document.createElement("co-lightbox");a.images=JSON.stringify(t),a.startIndex=r,this.locale&&(a.locale=this.locale),a.addEventListener("coClose",(()=>this.closeLightbox())),document.body.appendChild(a),this.lightboxEl=a,requestAnimationFrame((()=>{a.open=!0}))}closeLightbox(){const e=this.lightboxEl;this.lightboxEl=void 0,e&&(e.open=!1,setTimeout((()=>e.remove()),220))}handlePreviewError(e){this.failedPreviews=new Set([...this.failedPreviews,this.keyFor(e)])}handleRowDragStart(e,i){this.armedKey===i?(this.dragKey=i,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",i))):e.preventDefault()}handleRowDragOver(e,i){this.dragKey&&this.dragKey!==i&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),this.overKey=i)}handleRowDrop(e,i){e.preventDefault(),e.stopPropagation();const o=this.parsedFiles.map((e=>this.keyFor(e))),t=o.indexOf(this.dragKey),r=o.indexOf(i);this.resetDragState(),t<0||r<0||t===r||(o.splice(r,0,...o.splice(t,1)),this.coReorder.emit(o))}resetDragState(){this.armedKey="",this.dragKey="",this.overKey=""}capacityHint(e){const i=this.maxBytes?n(this.maxBytes):"";return this.multiple&&this.maxBytes?s(e.helperBoth,{n:this.maxFiles,x:i}):this.multiple?s(e.helperFiles,{n:this.maxFiles}):this.maxBytes?s(e.helperBytes,{x:i}):""}render(){const e=this.strings,i=this.parsedFiles,t=this.localError||this.helperText,a=!(this.readonly||(this.multiple?this.multiple&&i.length>=this.maxFiles:0!==i.length)),s="default"!==this.status?`co-file-field--${this.status}`:"",c=this.previewItems(),l=this.reorderable&&this.multiple&&!this.disabled&&!this.readonly&&i.length>1,d=this.capacityHint(e);return o("div",{key:"ce032373afbb21b082696b4d532655c3d599800c",class:{"co-file-field":!0,"co-file-field--disabled":this.disabled,"co-file-field--invalid":this.isInvalid,[s]:!!s},part:"wrapper"},this.label&&o("div",{key:"7650af04090b50b39e9dde6879156b51fd0a1b11",class:"co-file-field__labels"},o("label",{key:"5f305d56f5dcbe3b8d267e22471f4c6536792510",class:"co-file-field__label",part:"label"},this.label,o(r,{key:"46896eae83028b9117c32b2ab9ac21443a58c608",required:this.required}))),a&&o("div",{key:"c2767c1c6f8e0e928f328db2e985f747f34b13af",class:{"co-file-field__dropzone":!0,"co-file-field__dropzone--drag":this.dragOver},part:"dropzone",role:"button",tabIndex:this.disabled?-1:0,onClick:this.handleBrowse,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||this.fromActionsSlot(e)||(e.preventDefault(),this.handleBrowse())},onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop},o("button",{key:"f9b2ef43730b009a6ca322ea6cae833f86a52ff0",class:"co-file-field__upload-btn",part:"upload-button",type:"button",tabIndex:-1},o("co-icon",{key:"ffa7d7fdb830fc789ffd4ada624c450c70109701",name:"file-arrow-up",size:18}),o("span",{key:"c9c54dd9432f8c74894a0054ecdf0c59aede974a"},this.uploadButtonText||e.uploadButton)),o("span",{key:"74f8884d62b79960e0080794404f24e45d229284",class:"co-file-field__dropzone-text"},this.dropText||e.dropHint),d&&o("span",{key:"4c6bdd2de90754b50135e9212510884d1495b8d4",class:"co-file-field__dropzone-hint"},d),o("div",{key:"42bd92119fed5b9be39e7db5c351990faafc7135",class:"co-file-field__actions",part:"actions"},o("slot",{key:"fa2a649c222125ba63fa74028dba417c50f7b3f6",name:"actions"})),o("input",{key:"982021a63eb6bec0b19ca917382a6efd37938ab3",ref:e=>this.inputEl=e,class:"co-file-field__input",type:"file",multiple:this.multiple,accept:this.inputAccept,disabled:this.disabled,onChange:this.handleInputChange,"aria-hidden":"true",tabIndex:-1})),i.length>0&&o("div",{key:"95bd1f51b0a361dec2ca0b272212ef64d438db0a",class:"co-file-field__uploaded"},this.multiple&&o("div",{key:"479851cd44dbdc9ad99e9b26764f558845966c53",class:"co-file-field__uploaded-title",part:"uploaded-title"},`${this.uploadedTitle||e.uploadedTitle} (${i.length})`),c.length>0&&o("div",{key:"8be03edd2b1b8b7628d6e34fa82751045589b416",class:"co-file-field__previews",part:"previews"},c.map((i=>{const t=this.keyFor(i),r=u(i),a=this.failedPreviews.has(t)?"":i.thumbnail;return o("button",{class:{"co-file-field__preview":!0,"co-file-field__preview--video":r},part:"preview",type:"button",key:`prev-${t}`,title:i.name,"aria-label":`${r?e.playVideo:e.openPreview}: ${i.name}`,onClick:()=>this.handlePreviewOpen(i)},(!r||!!a)&&o("img",{src:r?a:i.thumbnail||i.url,alt:i.name,loading:"lazy",onError:()=>this.handlePreviewError(i)}),r&&o("span",{class:"co-file-field__preview-play","aria-hidden":"true"},o("span",{class:"co-file-field__preview-play-badge"},o("co-icon",{name:"play",size:20,weight:"fill"})),!a&&o("span",{class:"co-file-field__preview-ext"},f(i).toUpperCase())))}))),o("ul",{key:"1fa661f14a8644a2703204d1faac79e5599c5e77",class:"co-file-field__list",part:"list"},i.map((i=>{const t=this.keyFor(i),r=l&&"done"===i.status;return o("li",{class:{"co-file-field__row":!0,[`co-file-field__row--${i.status}`]:!0,"co-file-field__row--dragging":this.dragKey===t,"co-file-field__row--drop-target":this.overKey===t},part:"row",key:t,draggable:this.armedKey===t,onDragStart:e=>this.handleRowDragStart(e,t),onDragOver:e=>this.handleRowDragOver(e,t),onDrop:e=>this.handleRowDrop(e,t),onDragEnd:this.handleRowDragEnd},r?o("co-tooltip",{content:e.dragToReorder},o("span",{class:"co-file-field__drag-handle",part:"drag-handle",onMouseDown:()=>this.armedKey=t},o("co-icon",{name:"list",size:18}))):o("co-icon",{name:"error"===i.status?"warning-circle":"uploading"===i.status?"spinner-gap":"file",size:18,class:{"co-file-field__row-icon":!0,"co-file-field__row-icon--spin":"uploading"===i.status}}),o("div",{class:"co-file-field__row-body"},o("span",{class:"co-file-field__row-name",title:i.name},function(e,i=35){return!e||e.length<=i?e:`...${e.slice(-i)}`}(i.name)),"uploading"===i.status&&o("div",{class:"co-file-field__progress"},o("div",{class:"co-file-field__progress-bar",style:"number"==typeof i.progress?{width:`${i.progress}%`}:void 0})),"error"===i.status&&i.error&&o("span",{class:"co-file-field__row-error"},i.error)),null!=i.size&&o("span",{class:"co-file-field__row-size"},n(i.size)),this.annotatable&&!this.disabled&&!this.readonly&&function(e){return!("done"!==e.status||!e.url)&&v.has(f(e))}(i)&&o("co-tooltip",{content:e.annotateImage},o("button",{class:"co-file-field__action",type:"button",tabIndex:-1,"aria-label":`${e.annotateImage}: ${i.name}`,onClick:()=>this.coAnnotate.emit({id:t,url:i.url,name:i.name})},o("co-icon",{name:"pencil-simple-line",size:18}))),"done"===i.status&&!!i.url&&o("co-tooltip",{content:e.downloadFile},o("a",{class:"co-file-field__action",href:i.url,target:"_blank",rel:"noopener noreferrer",download:i.name,tabIndex:-1,"aria-label":e.downloadFile,onClick:e=>this.onDownloadClick(e,i)},o("co-icon",{name:"download",size:18}))),"done"===i.status&&!!i.url&&o("co-tooltip",{content:this.copiedKey===t?e.copied:e.copyUrl},o("button",{class:{"co-file-field__action":!0,"co-file-field__action--copied":this.copiedKey===t},type:"button",tabIndex:-1,"aria-label":e.copyUrl,onClick:()=>this.handleCopy(i)},o("co-icon",{name:this.copiedKey===t?"check":"copy",size:18}))),!this.disabled&&!this.readonly&&o("co-tooltip",{content:e.removeFile},o("button",{class:"co-file-field__action",type:"button",tabIndex:-1,"aria-label":e.removeFile,onClick:()=>this.coRemove.emit(t)},o("co-icon",{name:"trash",size:18}))))})))),t&&o("div",{key:"7562fdf435667ae305e677830cae06a3374ef67b",class:{"co-file-field__helper":!0,"co-file-field__helper--error":this.isInvalid},part:"helper"},this.isInvalid&&o("co-icon",{key:"ac43b079725a8b015f2ba1a8b8f22783f60e556e",name:"warning-circle",size:14,class:"co-file-field__helper-icon"}),o("span",{key:"cd256498ce501e5b59ae1a5850f8f8ddccb98580",class:"co-file-field__helper-text"},t)))}get el(){return t(this)}};g.style=":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}.co-file-field{display:flex;flex-direction:column;gap:var(--co-spacing-sm2)}.co-file-field__labels{display:flex;align-items:center;justify-content:space-between;padding:0 var(--co-spacing-xs)}.co-file-field__label{color:var(--co-semantic-text-secondary);font-size:var(--co-font-size-14);font-weight:400;line-height:1;white-space:nowrap;cursor:default}.co-field-required{margin-left:2px;color:var(--co-semantic-text-error, 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)')}.co-file-field__dropzone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--co-spacing-md);padding:var(--co-spacing-4xl) var(--co-spacing-2xl);background:color-mix(in srgb, var(--co-semantic-surface-hover) 55%, transparent);border:1px dashed var(--co-semantic-border-field);border-radius:var(--co-border-radius-sm);cursor:pointer;text-align:center;transition:border-color var(--co-motion-duration-fast) var(--co-motion-ease-out), background var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-file-field__dropzone:hover{border-color:var(--co-semantic-border-focus)}.co-file-field__dropzone--drag{border-color:var(--co-semantic-border-focus);background:var(--co-semantic-surface-hover)}.co-file-field__upload-btn{display:inline-flex;align-items:center;gap:var(--co-spacing-sm2);padding:var(--co-spacing-md) var(--co-spacing-xl);margin-bottom:var(--co-spacing-xs);background:var(--co-semantic-surface-secondary);color:var(--co-semantic-text-default);border:none;border-radius:var(--co-border-radius-full);box-shadow:var(--co-shadow-lg);font-family:inherit;font-size:var(--co-font-size-16);font-weight:400;letter-spacing:var(--co-font-letter-spacing-body);line-height:1;cursor:pointer;transition:box-shadow var(--co-motion-duration-fast) var(--co-motion-ease-out), transform var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-file-field__upload-btn:hover{box-shadow:var(--co-shadow-xl, var(--co-shadow-lg));transform:translateY(-1px)}.co-file-field__upload-btn co-icon{display:inline-flex;flex-shrink:0}.co-file-field__dropzone-text{color:var(--co-semantic-text-default);font-size:var(--co-font-size-18);line-height:1.25}.co-file-field__dropzone-hint{color:var(--co-semantic-text-secondary);font-size:var(--co-font-size-14);line-height:1.25}.co-file-field__actions{display:contents}.co-file-field__input{display:none}.co-file-field__uploaded{display:flex;flex-direction:column;gap:var(--co-spacing-lg);margin-top:var(--co-spacing-sm2)}.co-file-field__uploaded-title{color:var(--co-semantic-text-default);font-size:var(--co-font-size-22);font-weight:500;letter-spacing:-0.03em;line-height:1.25}.co-file-field__previews{display:grid;grid-template-columns:repeat(auto-fill, minmax(150px, 180px));gap:var(--co-spacing-md)}.co-file-field__preview{padding:0;border:none;border-radius:var(--co-border-radius-sm);overflow:hidden;aspect-ratio:3 / 2;background:var(--co-semantic-surface-hover);cursor:pointer}.co-file-field__preview img{display:block;width:100%;height:100%;object-fit:cover;transition:transform var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-file-field__preview:hover img{transform:scale(1.02)}.co-file-field__preview--video{position:relative;background:var(--co-color-base-negro)}.co-file-field__preview-play{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--co-spacing-sm2);color:var(--co-color-base-blanco);pointer-events:none}.co-file-field__preview-play-badge{display:flex;width:40px;height:40px;align-items:center;justify-content:center;border-radius:var(--co-border-radius-full);background:var(--co-color-opacity-negro-80);box-shadow:inset 0 0 0 1px var(--co-color-opacity-blanco-25);transition:transform var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-file-field__preview--video:hover .co-file-field__preview-play-badge{transform:scale(1.08)}.co-file-field__preview-play-badge co-icon{transform:translateX(1px)}.co-file-field__preview-ext{font-family:var(--co-font-family-primary);font-size:var(--co-font-size-12);font-weight:var(--co-font-weight-medium);letter-spacing:var(--co-font-letter-spacing-overline);color:var(--co-color-opacity-blanco-80)}.co-file-field__list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--co-spacing-sm2)}.co-file-field__row{display:flex;align-items:center;gap:var(--co-spacing-lg);padding:var(--co-spacing-xl);background:var(--co-semantic-surface-hover);border:1px solid transparent;border-radius:var(--co-border-radius-sm)}.co-file-field__row--error{border-color:var(--co-semantic-border-error, var(--co-semantic-status-error))}.co-file-field__row--dragging{opacity:0.5}.co-file-field__row--drop-target{border-color:var(--co-semantic-border-focus);background:var(--co-semantic-surface-hover)}.co-file-field__drag-handle{flex-shrink:0;display:flex;align-items:center;color:var(--co-semantic-text-secondary);cursor:grab}.co-file-field__drag-handle:active{cursor:grabbing}.co-file-field__row-icon{flex-shrink:0;color:var(--co-semantic-text-secondary);display:flex;align-items:center}.co-file-field__row--error .co-file-field__row-icon{color:var(--co-semantic-text-error, var(--co-semantic-status-error))}.co-file-field__row-icon--spin{animation:co-file-spin 0.8s linear infinite}@keyframes co-file-spin{to{transform:rotate(360deg)}}.co-file-field__row-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:var(--co-spacing-xs)}.co-file-field__row-name{color:var(--co-semantic-text-default);font-size:var(--co-font-size-14);line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-file-field__row-error{color:var(--co-semantic-text-error, var(--co-semantic-status-error));font-size:var(--co-font-size-12)}.co-file-field__row-size{flex-shrink:0;color:var(--co-semantic-text-default);font-size:var(--co-font-size-14);line-height:1;white-space:nowrap}.co-file-field__progress{position:relative;height:4px;border-radius:var(--co-border-radius-full);background:var(--co-semantic-surface-hover);overflow:hidden}.co-file-field__progress-bar{position:absolute;inset:0;width:40%;border-radius:var(--co-border-radius-full);background:var(--co-semantic-status-info);transition:width var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-file-field__progress-bar:not([style]){animation:co-file-indeterminate 1.2s ease-in-out infinite}@keyframes co-file-indeterminate{0%{left:-40%}100%{left:100%}}.co-file-field__action{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;cursor:pointer;text-decoration:none;color:var(--co-semantic-text-secondary);transition:color var(--co-motion-duration-fast) var(--co-motion-ease-out)}.co-file-field__action:hover{color:var(--co-semantic-text-default)}.co-file-field__action--copied,.co-file-field__action--copied:hover{color:var(--co-color-primary-verde)}.co-file-field__helper{display:flex;align-items:center;gap:var(--co-spacing-xs);padding:0 var(--co-spacing-xs)}.co-file-field__helper-icon{flex-shrink:0;color:var(--co-semantic-text-muted);display:flex;align-items:center}.co-file-field__helper-text{color:var(--co-semantic-text-muted);font-size:var(--co-font-size-14);line-height:1}.co-file-field--disabled{opacity:0.6;pointer-events:none}.co-file-field--invalid .co-file-field__dropzone,.co-file-field--error .co-file-field__dropzone{border-color:var(--co-semantic-border-error, var(--co-semantic-status-error))}.co-file-field__helper--error .co-file-field__helper-icon,.co-file-field__helper--error .co-file-field__helper-text{color:var(--co-semantic-text-error, var(--co-semantic-status-error))}:host([layout='horizontal']) .co-file-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-file-field__labels{grid-column:1;grid-row:1;padding-top:var(--co-spacing-sm2);min-width:0}:host([layout='horizontal']) .co-file-field__label{white-space:normal}:host([layout='horizontal']) .co-file-field>:not(.co-file-field__labels){grid-column:2;min-width:0}@supports not (background: color-mix(in srgb, red, transparent)){.co-file-field__dropzone{background:var(--co-semantic-surface-hover)}}";export{g as co_file_field}
@@ -1 +1 @@
1
- import{r as t,c as i,h as n,a as o}from"./p-YRicbXh3.js";import{a as e}from"./p-Ch1jfwZ2.js";import{i as r}from"./p-Dp1JT0dm.js";const s=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","iframe","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])','[tabindex]:not([tabindex="-1"])'].join(",");function a(t){if(t.shadowRoot)return Array.from(t.shadowRoot.children);if("SLOT"===t.tagName){const i=t.assignedElements({flatten:!0});return i.length?i:Array.from(t.children)}return Array.from(t.children)}function c(t){var i,n;if(!(null===(i=t.matches)||void 0===i?void 0:i.call(t,s))||t.hasAttribute("disabled"))return!1;const o=t.getAttribute("tabindex");return!(null!==o&&Number(o)<0||null===t.offsetParent&&0===t.getClientRects().length||!1===(null===(n=t.checkVisibility)||void 0===n?void 0:n.call(t,{visibilityProperty:!0})))}function h(t,i){const n=t=>{return"true"!==(o=t).getAttribute("aria-hidden")&&!o.hasAttribute("inert")&&(!!i(t)||a(t).some(n));var o};a(t).some(n)}function l(t,i){let n=null;return h(t,(t=>!!i(t)&&(n=t,!0))),n}function u(t){const i=[];return h(t,(t=>(c(t)&&i.push(t),!1))),i}function d(t,i){return t.length>0&&t[t.length-1]===i}let f=0,p="";const v=[];let y=0;const b="co-overlay--refront";function m(t){"function"==typeof requestAnimationFrame?requestAnimationFrame(t):t()}const g=class{constructor(n){t(this,n),this.coClose=i(this,"coClose",7),this.coAfterClose=i(this,"coAfterClose",3),this.coAfterOpen=i(this,"coAfterOpen",3),this.open=!1,this.trapFocus=!1,this.closeOnEscape=!1,this.hasLock=!1,this.trapId="co-overlay-trap-"+ ++y,this.trapping=!1,this.pressDownTarget=null,this.pressUpTarget=null,this.handlePointerDown=t=>{var i;this.pressDownTarget=null!==(i=t.composedPath()[0])&&void 0!==i?i:null,this.pressUpTarget=null},this.handlePointerUp=t=>{var i;this.pressUpTarget=null!==(i=t.composedPath()[0])&&void 0!==i?i:null},this.handleClick=t=>{var i;const n=null!==(i=t.composedPath()[0])&&void 0!==i?i:null,o=n===this.overlayEl&&function(t,i,n){return null!==t&&t===i&&i===n}(this.pressDownTarget,this.pressUpTarget,n);this.pressDownTarget=null,this.pressUpTarget=null,o&&this.coClose.emit()},this.handleTransitionEnd=t=>{if(t.target!==this.overlayEl)return;const i=e(t.propertyName,this.open,"opacity");"after-open"===i?this.coAfterOpen.emit():"after-close"===i&&this.coAfterClose.emit()}}onOpenChange(t){t?this.acquireLock():this.releaseLock(),this.syncPopover(),this.syncTrap()}onTrapFocusChange(){this.syncTrap()}componentDidLoad(){this.open&&this.acquireLock(),this.syncPopover(),this.syncTrap()}disconnectedCallback(){this.releaseLock(),this.releaseTrap()}async bringToFront(){const t=this.overlayEl;if(!this.open||!t||"function"!=typeof t.showPopover)return;if(!r(t))return;const i=this.deepActiveElement();t.classList.add(b);try{t.hidePopover(),t.showPopover()}catch(t){}i&&i.isConnected&&this.deepActiveElement()!==i&&i.focus({preventScroll:!0}),m((()=>t.classList.remove(b)))}acquireLock(){this.hasLock||(this.hasLock=!0,"undefined"!=typeof document&&(0===f&&(p=document.body.style.overflow,document.body.style.overflow="hidden"),f++))}releaseLock(){this.hasLock&&(this.hasLock=!1,"undefined"!=typeof document&&0!==f&&(f--,0===f&&(document.body.style.overflow=p)))}syncPopover(){const t=this.overlayEl;if(t&&"function"==typeof t.showPopover)try{const i=r(t);this.open&&!i?t.showPopover():!this.open&&i&&t.hidePopover()}catch(t){}}syncTrap(){this.open&&this.trapFocus?this.engageTrap():this.releaseTrap()}engageTrap(){this.trapping||(this.trapping=!0,v.push(this.trapId),this.captureAndFocus())}releaseTrap(){if(!this.trapping)return;this.trapping=!1;const t=v.indexOf(this.trapId);t>=0&&v.splice(t,1),this.restoreFocus()}captureAndFocus(){this.returnFocusEl=this.deepActiveElement(),m((()=>{var t;if(!this.open||!this.trapping||!d(v,this.trapId))return;const i=function(t){const i=l(t,(t=>t.hasAttribute("autofocus")));if(i){if(c(i))return i;const t=i.shadowRoot?u(i)[0]:void 0;if(t)return t}return l(t,c)}(this.el);i?i.focus():null===(t=this.overlayEl)||void 0===t||t.focus()}))}restoreFocus(){const t=this.returnFocusEl;this.returnFocusEl=null,t&&t.isConnected&&"function"==typeof t.focus&&t.focus({preventScroll:!0})}deepActiveElement(){if("undefined"==typeof document)return null;let t=document.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}handleKeydown(t){this.open&&(this.closeOnEscape&&"Escape"===t.key?this.coClose.emit():this.trapping&&"Tab"===t.key&&d(v,this.trapId)&&this.trapTab(t))}trapTab(t){var i;if(t.defaultPrevented)return;const n=u(this.el);if(0===n.length)return t.preventDefault(),void(null===(i=this.overlayEl)||void 0===i||i.focus());const o=n.indexOf(this.deepActiveElement()),e=function(t,i,n){return t<=0?-1:n?i<=0?t-1:i-1:-1===i||i>=t-1?0:i+1}(n.length,o,t.shiftKey);e<0||(t.preventDefault(),n[e].focus())}render(){return n("div",{key:"419d44027ef0e270aa9bddccc83bf3e93e1e78db",class:{"co-overlay":!0,"co-overlay--open":this.open},part:"overlay",popover:"manual",tabindex:this.trapFocus?-1:void 0,ref:t=>this.overlayEl=t,onPointerDown:this.handlePointerDown,onPointerUp:this.handlePointerUp,onClick:this.handleClick,onTransitionEnd:this.handleTransitionEnd},n("slot",{key:"34ffc7586b41bced7d7f56b6189f654c1c5e1a7f"}))}get el(){return o(this)}static get watchers(){return{open:[{onOpenChange:0}],trapFocus:[{onTrapFocusChange:0}]}}};g.style=":host{display:contents}.co-overlay{position:fixed;inset:0;z-index:1000;margin:0;border:0;padding:0;width:auto;height:auto;max-width:none;max-height:none;overflow:visible;color:inherit;display:flex;align-items:center;justify-content:center;background:var(--co-overlay-bg, rgba(0, 0, 0, 0.4));-webkit-backdrop-filter:blur(var(--co-overlay-blur, 2px));backdrop-filter:blur(var(--co-overlay-blur, 2px));opacity:0;pointer-events:none;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-in)}.co-overlay--open{opacity:1;pointer-events:auto;transition:opacity var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-overlay--refront{transition:none !important}";export{g as co_overlay}
1
+ import{r as t,c as i,h as n,a as o}from"./p-DJkaRtbb.js";import{a as e}from"./p-Ch1jfwZ2.js";import{i as r}from"./p-Dp1JT0dm.js";const s=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","iframe","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])','[tabindex]:not([tabindex="-1"])'].join(",");function a(t){if(t.shadowRoot)return Array.from(t.shadowRoot.children);if("SLOT"===t.tagName){const i=t.assignedElements({flatten:!0});return i.length?i:Array.from(t.children)}return Array.from(t.children)}function c(t){var i,n;if(!(null===(i=t.matches)||void 0===i?void 0:i.call(t,s))||t.hasAttribute("disabled"))return!1;const o=t.getAttribute("tabindex");return!(null!==o&&Number(o)<0||null===t.offsetParent&&0===t.getClientRects().length||!1===(null===(n=t.checkVisibility)||void 0===n?void 0:n.call(t,{visibilityProperty:!0})))}function h(t,i){const n=t=>{return"true"!==(o=t).getAttribute("aria-hidden")&&!o.hasAttribute("inert")&&(!!i(t)||a(t).some(n));var o};a(t).some(n)}function l(t,i){let n=null;return h(t,(t=>!!i(t)&&(n=t,!0))),n}function u(t){const i=[];return h(t,(t=>(c(t)&&i.push(t),!1))),i}function d(t,i){return t.length>0&&t[t.length-1]===i}let f=0,p="";const v=[];let y=0;const b="co-overlay--refront";function m(t){"function"==typeof requestAnimationFrame?requestAnimationFrame(t):t()}const g=class{constructor(n){t(this,n),this.coClose=i(this,"coClose",7),this.coAfterClose=i(this,"coAfterClose",3),this.coAfterOpen=i(this,"coAfterOpen",3),this.open=!1,this.trapFocus=!1,this.closeOnEscape=!1,this.hasLock=!1,this.trapId="co-overlay-trap-"+ ++y,this.trapping=!1,this.pressDownTarget=null,this.pressUpTarget=null,this.handlePointerDown=t=>{var i;this.pressDownTarget=null!==(i=t.composedPath()[0])&&void 0!==i?i:null,this.pressUpTarget=null},this.handlePointerUp=t=>{var i;this.pressUpTarget=null!==(i=t.composedPath()[0])&&void 0!==i?i:null},this.handleClick=t=>{var i;const n=null!==(i=t.composedPath()[0])&&void 0!==i?i:null,o=n===this.overlayEl&&function(t,i,n){return null!==t&&t===i&&i===n}(this.pressDownTarget,this.pressUpTarget,n);this.pressDownTarget=null,this.pressUpTarget=null,o&&this.coClose.emit()},this.handleTransitionEnd=t=>{if(t.target!==this.overlayEl)return;const i=e(t.propertyName,this.open,"opacity");"after-open"===i?this.coAfterOpen.emit():"after-close"===i&&this.coAfterClose.emit()}}onOpenChange(t){t?this.acquireLock():this.releaseLock(),this.syncPopover(),this.syncTrap()}onTrapFocusChange(){this.syncTrap()}componentDidLoad(){this.open&&this.acquireLock(),this.syncPopover(),this.syncTrap()}disconnectedCallback(){this.releaseLock(),this.releaseTrap()}async bringToFront(){const t=this.overlayEl;if(!this.open||!t||"function"!=typeof t.showPopover)return;if(!r(t))return;const i=this.deepActiveElement();t.classList.add(b);try{t.hidePopover(),t.showPopover()}catch(t){}i&&i.isConnected&&this.deepActiveElement()!==i&&i.focus({preventScroll:!0}),m((()=>t.classList.remove(b)))}acquireLock(){this.hasLock||(this.hasLock=!0,"undefined"!=typeof document&&(0===f&&(p=document.body.style.overflow,document.body.style.overflow="hidden"),f++))}releaseLock(){this.hasLock&&(this.hasLock=!1,"undefined"!=typeof document&&0!==f&&(f--,0===f&&(document.body.style.overflow=p)))}syncPopover(){const t=this.overlayEl;if(t&&"function"==typeof t.showPopover)try{const i=r(t);this.open&&!i?t.showPopover():!this.open&&i&&t.hidePopover()}catch(t){}}syncTrap(){this.open&&this.trapFocus?this.engageTrap():this.releaseTrap()}engageTrap(){this.trapping||(this.trapping=!0,v.push(this.trapId),this.captureAndFocus())}releaseTrap(){if(!this.trapping)return;this.trapping=!1;const t=v.indexOf(this.trapId);t>=0&&v.splice(t,1),this.restoreFocus()}captureAndFocus(){this.returnFocusEl=this.deepActiveElement(),m((()=>{var t;if(!this.open||!this.trapping||!d(v,this.trapId))return;const i=function(t){const i=l(t,(t=>t.hasAttribute("autofocus")));if(i){if(c(i))return i;const t=i.shadowRoot?u(i)[0]:void 0;if(t)return t}return l(t,c)}(this.el);i?i.focus():null===(t=this.overlayEl)||void 0===t||t.focus()}))}restoreFocus(){const t=this.returnFocusEl;this.returnFocusEl=null,t&&t.isConnected&&"function"==typeof t.focus&&t.focus({preventScroll:!0})}deepActiveElement(){if("undefined"==typeof document)return null;let t=document.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}handleKeydown(t){this.open&&(this.closeOnEscape&&"Escape"===t.key?this.coClose.emit():this.trapping&&"Tab"===t.key&&d(v,this.trapId)&&this.trapTab(t))}trapTab(t){var i;if(t.defaultPrevented)return;const n=u(this.el);if(0===n.length)return t.preventDefault(),void(null===(i=this.overlayEl)||void 0===i||i.focus());const o=n.indexOf(this.deepActiveElement()),e=function(t,i,n){return t<=0?-1:n?i<=0?t-1:i-1:-1===i||i>=t-1?0:i+1}(n.length,o,t.shiftKey);e<0||(t.preventDefault(),n[e].focus())}render(){return n("div",{key:"419d44027ef0e270aa9bddccc83bf3e93e1e78db",class:{"co-overlay":!0,"co-overlay--open":this.open},part:"overlay",popover:"manual",tabindex:this.trapFocus?-1:void 0,ref:t=>this.overlayEl=t,onPointerDown:this.handlePointerDown,onPointerUp:this.handlePointerUp,onClick:this.handleClick,onTransitionEnd:this.handleTransitionEnd},n("slot",{key:"34ffc7586b41bced7d7f56b6189f654c1c5e1a7f"}))}get el(){return o(this)}static get watchers(){return{open:[{onOpenChange:0}],trapFocus:[{onTrapFocusChange:0}]}}};g.style=":host{display:contents}.co-overlay{position:fixed;inset:0;z-index:1000;margin:0;border:0;padding:0;width:auto;height:auto;max-width:none;max-height:none;overflow:visible;color:inherit;display:flex;align-items:center;justify-content:center;background:var(--co-overlay-bg, rgba(0, 0, 0, 0.4));-webkit-backdrop-filter:blur(var(--co-overlay-blur, 2px));backdrop-filter:blur(var(--co-overlay-blur, 2px));opacity:0;pointer-events:none;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-in)}.co-overlay--open{opacity:1;pointer-events:auto;transition:opacity var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-overlay--refront{transition:none !important}";export{g as co_overlay}
@@ -1 +1 @@
1
- import{r as i,c as t,h as r,a as o}from"./p-YRicbXh3.js";import{i as a,p as e,g as n,o as s,h as d,s as c}from"./p-CP7MznKV.js";import{l}from"./p-jYd9gu_c.js";import"./p-BzxEh7sq.js";import"./p-COJdaKBU.js";const h={es:{barLabel:"Degradado",stopLabel:"Parada {i} de {n}, {p}%"},en:{barLabel:"Gradient",stopLabel:"Stop {i} of {n}, {p}%"},pt:{barLabel:"Degradê",stopLabel:"Parada {i} de {n}, {p}%"}},b=class{constructor(r){i(this,r),this.coStopMove=t(this,"coStopMove",7),this.coStopsChange=t(this,"coStopsChange",7),this.coStopSelect=t(this,"coStopSelect",7),this.coStopAdd=t(this,"coStopAdd",7),this.stops=[],this.disabled=!1,this.dragIndex=-1,this.dragPosition=0,this.pointerId=-1,this.grabOffset=0,this.dragMoved=!1,this.handleTrackClick=i=>{var t;if(this.disabled)return;const r=i.target;if(null===(t=null==r?void 0:r.closest)||void 0===t?void 0:t.call(r,".co-gradient-bar__handle"))return;const o=this.positionAt(i.clientX);this.coStopAdd.emit({position:o,color:a(this.stopList,o)})},this.handleHandlePointerDown=(i,t)=>{var r,o,a,e,n,s;if(this.disabled)return;if(this.dragIndex>=0)return;if(void 0!==t.button&&0!==t.button)return;t.preventDefault();const d=t.currentTarget;if(null===(r=null==d?void 0:d.focus)||void 0===r||r.call(d),this.selected=i,this.coStopSelect.emit(i),null==d?void 0:d.setPointerCapture)try{d.setPointerCapture(t.pointerId)}catch(i){}const c=null!==(a=null===(o=this.stopList[i])||void 0===o?void 0:o.position)&&void 0!==a?a:0,l=null===(e=this.trackEl)||void 0===e?void 0:e.getBoundingClientRect(),h=(null!==(n=null==l?void 0:l.left)&&void 0!==n?n:0)+(null!==(s=null==l?void 0:l.width)&&void 0!==s?s:0)*c/100;this.grabOffset=l&&l.width>0?t.clientX-h:0,this.pointerId=t.pointerId,this.dragIndex=i,this.dragPosition=c,this.dragMoved=!1,this.bindWindow()},this.handleWindowPointerMove=i=>{if(i.pointerId!==this.pointerId||this.dragIndex<0)return;const t=this.positionAt(i.clientX-this.grabOffset);t!==this.dragPosition&&(this.dragPosition=t,this.dragMoved=!0,this.coStopMove.emit({index:this.dragIndex,position:t}))},this.handleWindowPointerUp=i=>{i.pointerId===this.pointerId&&this.endDrag()},this.handleHandleKeyDown=(i,t)=>{var r,o;if(this.disabled)return;const a=null!==(o=null===(r=this.stopList[i])||void 0===r?void 0:r.position)&&void 0!==o?o:0;let e;if("ArrowRight"===t.key||"ArrowLeft"===t.key)e=c(a,("ArrowRight"===t.key?1:-1)*(t.shiftKey?10:1));else if("Home"===t.key)e=0;else{if("End"!==t.key)return;e=100}t.preventDefault(),e!==a&&this.coStopsChange.emit(this.withPosition(i,e))}}disconnectedCallback(){this.unbindWindow()}positionAt(i){var t,r,o;const a=null===(t=this.trackEl)||void 0===t?void 0:t.getBoundingClientRect();return e(i,null!==(r=null==a?void 0:a.left)&&void 0!==r?r:0,null!==(o=null==a?void 0:a.width)&&void 0!==o?o:0)}get stopList(){var i;return null!==(i=this.stops)&&void 0!==i?i:[]}withPosition(i,t){return this.stopList.map(((r,o)=>o===i?Object.assign(Object.assign({},r),{position:t}):r))}liveStops(){return this.dragIndex>=0?this.withPosition(this.dragIndex,this.dragPosition):this.stopList}endDrag(){this.unbindWindow();const i=this.dragIndex,t=this.dragPosition,r=this.dragMoved;this.pointerId=-1,this.dragIndex=-1,this.dragMoved=!1,i>=0&&r&&this.coStopsChange.emit(this.withPosition(i,t))}bindWindow(){window.addEventListener("pointermove",this.handleWindowPointerMove),window.addEventListener("pointerup",this.handleWindowPointerUp),window.addEventListener("pointercancel",this.handleWindowPointerUp)}unbindWindow(){window.removeEventListener("pointermove",this.handleWindowPointerMove),window.removeEventListener("pointerup",this.handleWindowPointerUp),window.removeEventListener("pointercancel",this.handleWindowPointerUp)}render(){const i=h[l(this.locale)],t=this.liveStops(),o=t.length,a=null!=this.selected&&this.selected>=0&&this.selected<o;return r("div",{key:"cef89872e93311d220f59805754f472a118dfce0",class:{"co-gradient-bar":!0,"co-gradient-bar--disabled":this.disabled,"co-gradient-bar--dragging":this.dragIndex>=0,"co-gradient-bar--transparent":d(t)},role:"group","aria-label":this.label||i.barLabel,"aria-disabled":this.disabled?"true":void 0},r("div",{key:"bdcf7544119daba7392bd8b3f14924f81ab88f7f",class:"co-gradient-bar__track",part:"track",ref:i=>this.trackEl=i,onClick:this.handleTrackClick},r("div",{key:"ac58517f315ca19e37a6e590950397935e643be0",class:"co-gradient-bar__fill",style:{background:n(t)}}),t.map(((t,e)=>{const n=e===this.selected,d=a?n:0===e;return r("div",{key:e,class:{"co-gradient-bar__handle":!0,"co-gradient-bar__handle--selected":n},part:"handle",role:"slider","aria-label":i.stopLabel.replace("{i}",String(e+1)).replace("{n}",String(o)).replace("{p}",String(t.position)),"aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":String(t.position),"aria-disabled":this.disabled?"true":void 0,tabIndex:this.disabled||!d?-1:0,style:{left:`${t.position}%`,"--co-gradient-bar-stop-color":t.color,"--co-gradient-bar-stop-opaque":s(t.color)},onPointerDown:i=>this.handleHandlePointerDown(e,i),onKeyDown:i=>this.handleHandleKeyDown(e,i)})}))))}get el(){return o(this)}};b.style=":host{display:block;width:100%}:host([hidden]){display:none}.co-gradient-bar{position:relative;padding:9px 8px 0;box-sizing:border-box}.co-gradient-bar__track{position:relative;height:24px;border-radius:6px;cursor:copy;touch-action:none;user-select:none;-webkit-user-select:none}.co-gradient-bar--transparent .co-gradient-bar__track{background:conic-gradient(var(--co-color-gray-200) 25%, #ffffff 0 50%, var(--co-color-gray-200) 0 75%, #ffffff 0) 0 0 / 12px 12px}.co-gradient-bar__fill{position:absolute;inset:0;border-radius:6px;pointer-events:none}.co-gradient-bar__track::after{content:'';position:absolute;inset:0;border-radius:6px;box-shadow:inset 0 0 0 1px var(--co-semantic-border-hairline);pointer-events:none}.co-gradient-bar__handle{position:absolute;top:0;left:0;width:16px;height:16px;box-sizing:border-box;transform:translate(-50%, -50%);border-radius:3px;border:2px solid var(--co-color-opacity-negro-16);background:linear-gradient(to right, var(--co-gradient-bar-stop-opaque, var(--co-gradient-bar-stop-color)) 50%, transparent 50%), linear-gradient(var(--co-gradient-bar-stop-color), var(--co-gradient-bar-stop-color)), conic-gradient(var(--co-color-gray-200) 25%, #ffffff 0 50%, var(--co-color-gray-200) 0 75%, #ffffff 0) 0 0 / 6px 6px;box-shadow:0 0 0 1px var(--co-gradient-bar-handle-halo, transparent), var(--co-gradient-bar-handle-shadow, var(--co-shadow-sm2));cursor:grab;outline:none;touch-action:none;z-index:1}.co-gradient-bar__handle::after{content:'';position:absolute;left:50%;top:calc(100% + 2px);width:6px;height:2px;transform:translateX(-50%);border-radius:1px;background:var(--co-color-opacity-negro-16)}.co-gradient-bar__handle--selected{border-color:var(--co-semantic-accent);z-index:2}.co-gradient-bar__handle--selected::after{background:var(--co-semantic-accent)}.co-gradient-bar__handle:focus-visible{box-shadow:0 0 0 1px var(--co-gradient-bar-handle-halo, transparent), 0 0 0 2px var(--co-semantic-border-focus), var(--co-gradient-bar-handle-shadow, var(--co-shadow-sm2))}.co-gradient-bar--dragging .co-gradient-bar__handle{cursor:grabbing}.co-gradient-bar--disabled{opacity:0.4}.co-gradient-bar--disabled .co-gradient-bar__track,.co-gradient-bar--disabled .co-gradient-bar__handle{cursor:not-allowed}";export{b as co_gradient_bar}
1
+ import{r as t,c as i,h as r,a as o}from"./p-DJkaRtbb.js";import{i as a,p as e,g as n,o as s,h as d,s as c}from"./p-CP7MznKV.js";import{l}from"./p-jYd9gu_c.js";import"./p-BzxEh7sq.js";import"./p-COJdaKBU.js";const h={es:{barLabel:"Degradado",stopLabel:"Parada {i} de {n}, {p}%"},en:{barLabel:"Gradient",stopLabel:"Stop {i} of {n}, {p}%"},pt:{barLabel:"Degradê",stopLabel:"Parada {i} de {n}, {p}%"}},b=class{constructor(r){t(this,r),this.coStopMove=i(this,"coStopMove",7),this.coStopsChange=i(this,"coStopsChange",7),this.coStopSelect=i(this,"coStopSelect",7),this.coStopAdd=i(this,"coStopAdd",7),this.stops=[],this.disabled=!1,this.dragIndex=-1,this.dragPosition=0,this.pointerId=-1,this.grabOffset=0,this.dragMoved=!1,this.handleTrackClick=t=>{var i;if(this.disabled)return;const r=t.target;if(null===(i=null==r?void 0:r.closest)||void 0===i?void 0:i.call(r,".co-gradient-bar__handle"))return;const o=this.positionAt(t.clientX);this.coStopAdd.emit({position:o,color:a(this.stopList,o)})},this.handleHandlePointerDown=(t,i)=>{var r,o,a,e,n,s;if(this.disabled)return;if(this.dragIndex>=0)return;if(void 0!==i.button&&0!==i.button)return;i.preventDefault();const d=i.currentTarget;if(null===(r=null==d?void 0:d.focus)||void 0===r||r.call(d),this.selected=t,this.coStopSelect.emit(t),null==d?void 0:d.setPointerCapture)try{d.setPointerCapture(i.pointerId)}catch(t){}const c=null!==(a=null===(o=this.stopList[t])||void 0===o?void 0:o.position)&&void 0!==a?a:0,l=null===(e=this.trackEl)||void 0===e?void 0:e.getBoundingClientRect(),h=(null!==(n=null==l?void 0:l.left)&&void 0!==n?n:0)+(null!==(s=null==l?void 0:l.width)&&void 0!==s?s:0)*c/100;this.grabOffset=l&&l.width>0?i.clientX-h:0,this.pointerId=i.pointerId,this.dragIndex=t,this.dragPosition=c,this.dragMoved=!1,this.bindWindow()},this.handleWindowPointerMove=t=>{if(t.pointerId!==this.pointerId||this.dragIndex<0)return;const i=this.positionAt(t.clientX-this.grabOffset);i!==this.dragPosition&&(this.dragPosition=i,this.dragMoved=!0,this.coStopMove.emit({index:this.dragIndex,position:i}))},this.handleWindowPointerUp=t=>{t.pointerId===this.pointerId&&this.endDrag()},this.handleHandleKeyDown=(t,i)=>{var r,o;if(this.disabled)return;const a=null!==(o=null===(r=this.stopList[t])||void 0===r?void 0:r.position)&&void 0!==o?o:0;let e;if("ArrowRight"===i.key||"ArrowLeft"===i.key)e=c(a,("ArrowRight"===i.key?1:-1)*(i.shiftKey?10:1));else if("Home"===i.key)e=0;else{if("End"!==i.key)return;e=100}i.preventDefault(),e!==a&&this.coStopsChange.emit(this.withPosition(t,e))}}disconnectedCallback(){this.unbindWindow()}positionAt(t){var i,r,o;const a=null===(i=this.trackEl)||void 0===i?void 0:i.getBoundingClientRect();return e(t,null!==(r=null==a?void 0:a.left)&&void 0!==r?r:0,null!==(o=null==a?void 0:a.width)&&void 0!==o?o:0)}get stopList(){var t;return null!==(t=this.stops)&&void 0!==t?t:[]}withPosition(t,i){return this.stopList.map(((r,o)=>o===t?Object.assign(Object.assign({},r),{position:i}):r))}liveStops(){return this.dragIndex>=0?this.withPosition(this.dragIndex,this.dragPosition):this.stopList}endDrag(){this.unbindWindow();const t=this.dragIndex,i=this.dragPosition,r=this.dragMoved;this.pointerId=-1,this.dragIndex=-1,this.dragMoved=!1,t>=0&&r&&this.coStopsChange.emit(this.withPosition(t,i))}bindWindow(){window.addEventListener("pointermove",this.handleWindowPointerMove),window.addEventListener("pointerup",this.handleWindowPointerUp),window.addEventListener("pointercancel",this.handleWindowPointerUp)}unbindWindow(){window.removeEventListener("pointermove",this.handleWindowPointerMove),window.removeEventListener("pointerup",this.handleWindowPointerUp),window.removeEventListener("pointercancel",this.handleWindowPointerUp)}render(){const t=h[l(this.locale)],i=this.liveStops(),o=i.length,a=null!=this.selected&&this.selected>=0&&this.selected<o;return r("div",{key:"cef89872e93311d220f59805754f472a118dfce0",class:{"co-gradient-bar":!0,"co-gradient-bar--disabled":this.disabled,"co-gradient-bar--dragging":this.dragIndex>=0,"co-gradient-bar--transparent":d(i)},role:"group","aria-label":this.label||t.barLabel,"aria-disabled":this.disabled?"true":void 0},r("div",{key:"bdcf7544119daba7392bd8b3f14924f81ab88f7f",class:"co-gradient-bar__track",part:"track",ref:t=>this.trackEl=t,onClick:this.handleTrackClick},r("div",{key:"ac58517f315ca19e37a6e590950397935e643be0",class:"co-gradient-bar__fill",style:{background:n(i)}}),i.map(((i,e)=>{const n=e===this.selected,d=a?n:0===e;return r("div",{key:e,class:{"co-gradient-bar__handle":!0,"co-gradient-bar__handle--selected":n},part:"handle",role:"slider","aria-label":t.stopLabel.replace("{i}",String(e+1)).replace("{n}",String(o)).replace("{p}",String(i.position)),"aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":String(i.position),"aria-disabled":this.disabled?"true":void 0,tabIndex:this.disabled||!d?-1:0,style:{left:`${i.position}%`,"--co-gradient-bar-stop-color":i.color,"--co-gradient-bar-stop-opaque":s(i.color)},onPointerDown:t=>this.handleHandlePointerDown(e,t),onKeyDown:t=>this.handleHandleKeyDown(e,t)})}))))}get el(){return o(this)}};b.style=":host{display:block;width:100%}:host([hidden]){display:none}.co-gradient-bar{position:relative;padding:9px 8px 0;box-sizing:border-box}.co-gradient-bar__track{position:relative;height:24px;border-radius:6px;cursor:copy;touch-action:none;user-select:none;-webkit-user-select:none}.co-gradient-bar--transparent .co-gradient-bar__track{background:conic-gradient(var(--co-color-gray-200) 25%, #ffffff 0 50%, var(--co-color-gray-200) 0 75%, #ffffff 0) 0 0 / 12px 12px}.co-gradient-bar__fill{position:absolute;inset:0;border-radius:6px;pointer-events:none}.co-gradient-bar__track::after{content:'';position:absolute;inset:0;border-radius:6px;box-shadow:inset 0 0 0 1px var(--co-semantic-border-hairline);pointer-events:none}.co-gradient-bar__handle{position:absolute;top:0;left:0;width:16px;height:16px;box-sizing:border-box;transform:translate(-50%, -50%);border-radius:3px;border:2px solid var(--co-color-opacity-negro-16);background:linear-gradient(to right, var(--co-gradient-bar-stop-opaque, var(--co-gradient-bar-stop-color)) 50%, transparent 50%), linear-gradient(var(--co-gradient-bar-stop-color), var(--co-gradient-bar-stop-color)), conic-gradient(var(--co-color-gray-200) 25%, #ffffff 0 50%, var(--co-color-gray-200) 0 75%, #ffffff 0) 0 0 / 6px 6px;box-shadow:0 0 0 1px var(--co-gradient-bar-handle-halo, transparent), var(--co-gradient-bar-handle-shadow, var(--co-shadow-sm2));cursor:grab;outline:none;touch-action:none;z-index:1}.co-gradient-bar__handle::after{content:'';position:absolute;left:50%;top:calc(100% + 2px);width:6px;height:2px;transform:translateX(-50%);border-radius:1px;background:var(--co-color-opacity-negro-16)}.co-gradient-bar__handle--selected{border-color:var(--co-semantic-accent);z-index:2}.co-gradient-bar__handle--selected::after{background:var(--co-semantic-accent)}.co-gradient-bar__handle:focus-visible{box-shadow:0 0 0 1px var(--co-gradient-bar-handle-halo, transparent), 0 0 0 2px var(--co-semantic-border-focus), var(--co-gradient-bar-handle-shadow, var(--co-shadow-sm2))}.co-gradient-bar--dragging .co-gradient-bar__handle{cursor:grabbing}.co-gradient-bar--disabled{opacity:0.4}.co-gradient-bar--disabled .co-gradient-bar__track,.co-gradient-bar--disabled .co-gradient-bar__handle{cursor:not-allowed}";export{b as co_gradient_bar}
@@ -1 +1 @@
1
- import{r as t,c as o,h as i,a as s}from"./p-YRicbXh3.js";import{s as e}from"./p-CBX_oabB.js";function h(t,o=48){return t<=0?0:o*(1-1/(t/o+1))}const a=class{constructor(i){t(this,i),this.coClose=o(this,"coClose",3),this.coOpen=o(this,"coOpen",3),this.coAfterOpen=o(this,"coAfterOpen",3),this.coAfterClose=o(this,"coAfterClose",3),this.open=!1,this.heading="",this.maxHeight="85dvh",this.dismissible=!0,this.closeOnOverlay=!0,this.closeOnEscape=!0,this.showHandle=!0,this.hasFooter=!1,this.hasHeaderSlot=!1,this.tracker=function(t=100,o=8){let i=[];return{add(s,e){i.push({t:s,y:e}),i.length>o&&i.shift(),i=i.filter((o=>s-o.t<=t))},velocity(){if(i.length<2)return 0;const t=i[0],o=i[i.length-1],s=o.t-t.t;return s<8?0:(o.y-t.y)/s},reset(){i=[]}}}(),this.armed=!1,this.engaged=!1,this.fromBody=!1,this.startY=0,this.startX=0,this.startScrollTop=0,this.sheetHeight=0,this.dismissPending=!1,this.pendingAfter=null,this.handleBackdropClick=()=>{this.closeOnOverlay&&this.coClose.emit()},this.handleFooterSlotChange=t=>{this.hasFooter=e(t)},this.handleHeaderSlotChange=t=>{this.hasHeaderSlot=e(t)},this.handleTransitionEnd=t=>{"transform"===t.propertyName&&t.target===this.sheetEl&&("open"===this.pendingAfter&&this.open&&this.coAfterOpen.emit(),"close"!==this.pendingAfter||this.open||this.coAfterClose.emit(),this.pendingAfter=null)},this.handleGripPointerDown=t=>{this.arm(t,!1)},this.handleBodyPointerDown=t=>{this.arm(t,!0)},this.handlePointerMove=t=>{if(!this.armed||!t.isPrimary)return;const o=t.clientY-this.startY,i=t.clientX-this.startX;if(!this.engaged){const s=this.fromBody?8:4;if(Math.abs(o)<s)return;if(this.fromBody){const t=!!this.bodyEl&&this.bodyEl.scrollHeight>this.bodyEl.clientHeight;if(this.startScrollTop>0||Math.abs(o)<=Math.abs(i)||o<0&&t)return void this.disarm()}this.engage(t,t.currentTarget)}const s=t.clientY-this.startY;let e;if(e=s>=0?this.dismissible?s:h(s):-h(-s),this.sheetEl&&(this.sheetEl.style.transform=`translate3d(0, ${e}px, 0)`),this.backdropEl&&this.sheetHeight>0){const t=Math.min(Math.max(e/this.sheetHeight,0),1);this.backdropEl.style.opacity=String(1-t)}this.tracker.add(t.timeStamp,t.clientY)},this.handlePointerUp=t=>{if(!this.armed)return;const o=this.engaged,i=o?Math.max(t.clientY-this.startY,0):0,s=this.tracker.velocity();if(this.disarm(),!o)return;const e=function({offset:t,height:o,velocity:i,dismissible:s}){return s?i>=.5&&t>=24?"dismiss":i<=-.15?"restore":o>0&&t>=.45*o?"dismiss":"restore":"restore"}({offset:i,height:this.sheetHeight,velocity:s,dismissible:this.dismissible});"dismiss"===e?(this.dismissPending=!0,this.sheetEl&&(this.sheetEl.style.transform=`translate3d(0, ${this.sheetHeight}px, 0)`),this.backdropEl&&(this.backdropEl.style.opacity="0"),this.coClose.emit(),this.dismissFallback=setTimeout((()=>{this.open&&this.dismissPending&&(this.dismissPending=!1,this.clearInlineStyles())}),500)):this.clearInlineStyles()},this.handlePointerCancel=()=>{this.armed&&(this.disarm(),this.clearInlineStyles())},this.touchBlocker=t=>{(this.engaged||this.armed&&this.startScrollTop<=0&&t.touches[0].clientY-this.startY>0)&&t.preventDefault()}}onOpenChange(t,o){t!==o&&(this.pendingAfter=t?"open":"close",t?(this.coOpen.emit(),this.clearInlineStyles()):(this.dismissPending=!1,this.dismissFallback&&clearTimeout(this.dismissFallback),requestAnimationFrame((()=>this.clearInlineStyles()))))}handleKey(t){this.open&&this.closeOnEscape&&"Escape"===t.key&&this.coClose.emit()}disconnectedCallback(){this.detachTouchBlocker(),this.dismissFallback&&clearTimeout(this.dismissFallback)}clearInlineStyles(){this.sheetEl&&(this.sheetEl.style.transform=""),this.backdropEl&&(this.backdropEl.style.opacity="")}arm(t,o){this.open&&!this.dismissPending&&t.isPrimary&&(this.armed=!0,this.engaged=!1,this.fromBody=o,this.startY=t.clientY,this.startX=t.clientX,this.startScrollTop=o&&this.bodyEl?this.bodyEl.scrollTop:0,o&&this.attachTouchBlocker())}engage(t,o){var i,s;this.engaged=!0,this.startY=t.clientY,this.sheetHeight=(null===(i=this.sheetEl)||void 0===i?void 0:i.getBoundingClientRect().height)||0,null===(s=this.sheetEl)||void 0===s||s.classList.add("co-bottom-sheet--dragging");try{null==o||o.setPointerCapture(t.pointerId)}catch(t){}this.tracker.reset(),this.tracker.add(t.timeStamp,t.clientY)}disarm(){var t;this.armed=!1,this.engaged=!1,null===(t=this.sheetEl)||void 0===t||t.classList.remove("co-bottom-sheet--dragging"),this.detachTouchBlocker()}attachTouchBlocker(){var t;null===(t=this.bodyEl)||void 0===t||t.addEventListener("touchmove",this.touchBlocker,{passive:!1})}detachTouchBlocker(){var t;null===(t=this.bodyEl)||void 0===t||t.removeEventListener("touchmove",this.touchBlocker)}render(){return i("div",{key:"43f05669ad96312f6bd2ee1c1d4698538f029e2c",class:{"co-bottom-sheet-root":!0,"co-bottom-sheet-root--open":this.open}},i("div",{key:"86040a5efd513a6c06bbe551f82bcdc619817ea3",class:"co-bottom-sheet__backdrop",part:"backdrop",onClick:this.handleBackdropClick,ref:t=>this.backdropEl=t}),i("section",{key:"46155a318f952b9be717a47497f1f513d3cf970f",class:{"co-bottom-sheet":!0,"co-bottom-sheet--open":this.open},part:"sheet",role:"dialog","aria-modal":"true","aria-labelledby":this.hasHeaderSlot?"co-bottom-sheet-header":this.heading?"co-bottom-sheet-heading":void 0,style:{"--co-bottom-sheet-max-height":this.maxHeight},onTransitionEnd:this.handleTransitionEnd,ref:t=>this.sheetEl=t},i("div",{key:"8b4a140b235f9803f71fb8717763651557ec6ca6",class:"co-bottom-sheet__grip",onPointerDown:this.handleGripPointerDown,onPointerMove:this.handlePointerMove,onPointerUp:this.handlePointerUp,onPointerCancel:this.handlePointerCancel},this.showHandle&&i("div",{key:"0c61ae9e1faf72485cf5b8c529041f740831d3a1",class:"co-bottom-sheet__handle",part:"handle","aria-hidden":"true"}),i("header",{key:"cd7116cd2b12c66e6cde63753dab12eaab31d04c",class:{"co-bottom-sheet__header":!0,"co-bottom-sheet__header--show":this.hasHeaderSlot||!!this.heading},part:"header",id:"co-bottom-sheet-header"},i("slot",{key:"8343901cfdb86eef24e3bbc7e7a9d270eeed6ed0",name:"header",onSlotchange:this.handleHeaderSlotChange},this.heading&&i("h2",{key:"31874876e8fb9db7cf7ae57f3f704a569d4fb797",class:"co-bottom-sheet__heading",id:"co-bottom-sheet-heading"},this.heading)))),i("div",{key:"126a26708b6d4b70c8bb74f6a4cd7fe43f74e725",class:"co-bottom-sheet__body",part:"body",onPointerDown:this.handleBodyPointerDown,onPointerMove:this.handlePointerMove,onPointerUp:this.handlePointerUp,onPointerCancel:this.handlePointerCancel,ref:t=>this.bodyEl=t},i("slot",{key:"c8f5034ea3de0265d05203befc31e961f8340694"})),i("footer",{key:"a2d40f9d6056df561388fa213995595a84044cd1",class:{"co-bottom-sheet__footer":!0,"co-bottom-sheet__footer--show":this.hasFooter},part:"footer"},i("slot",{key:"0d97eb87bc4de74db631629a478bd01ce5a473a6",name:"footer",onSlotchange:this.handleFooterSlotChange}))))}get el(){return s(this)}static get watchers(){return{open:[{onOpenChange:0}]}}};a.style=":host{display:contents}.co-bottom-sheet__backdrop{position:fixed;inset:0;z-index:1000;background:rgba(0, 0, 0, 0.4);-webkit-backdrop-filter:blur(var(--co-overlay-blur, 2px));backdrop-filter:blur(var(--co-overlay-blur, 2px));opacity:0;pointer-events:none;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-in)}.co-bottom-sheet-root--open .co-bottom-sheet__backdrop{opacity:1;pointer-events:auto;transition:opacity var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-bottom-sheet{position:fixed;left:0;right:0;bottom:0;z-index:1001;display:flex;flex-direction:column;height:auto;max-height:var(--co-bottom-sheet-max-height, 85dvh);background:var(--co-semantic-surface-page);font-family:var(--co-font-family-primary);border-radius:var(--co-border-radius-xl) var(--co-border-radius-xl) 0 0;box-shadow:0 -4px 24px rgba(0, 0, 0, 0.12);transform:translateY(100%);transition:transform var(--co-motion-duration-slow) var(--co-motion-ease-in-out);will-change:transform;overflow:hidden;visibility:hidden}.co-bottom-sheet--open{transform:translateY(0);visibility:visible}.co-bottom-sheet:not(.co-bottom-sheet--open){transition:transform var(--co-motion-duration-slow) var(--co-motion-ease-in-out), visibility 0s linear var(--co-motion-duration-slow)}.co-bottom-sheet--dragging,.co-bottom-sheet-root:has(.co-bottom-sheet--dragging) .co-bottom-sheet__backdrop{transition:none !important}.co-bottom-sheet__grip{flex-shrink:0;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;cursor:grab}.co-bottom-sheet--dragging .co-bottom-sheet__grip{cursor:grabbing}.co-bottom-sheet__handle{width:40px;height:4px;margin:var(--co-spacing-sm) auto var(--co-spacing-xs);border-radius:var(--co-border-radius-full);background:var(--co-semantic-border-default)}.co-bottom-sheet__header{padding:0 var(--co-spacing-xl)}.co-bottom-sheet__header--show{padding-bottom:var(--co-spacing-sm)}.co-bottom-sheet__heading{margin:0;font-size:var(--co-font-size-16);font-weight:700;color:var(--co-semantic-text-default)}.co-bottom-sheet__body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior-y:contain;touch-action:pan-y}.co-bottom-sheet__footer{flex-shrink:0;display:none}.co-bottom-sheet__footer--show{display:block;border-top:1px solid var(--co-semantic-border-default);padding:var(--co-spacing-md) var(--co-spacing-xl) calc(var(--co-spacing-lg) + env(safe-area-inset-bottom, 0px));background:var(--co-semantic-surface-page)}";export{a as co_bottom_sheet}
1
+ import{r as t,c as o,h as i,a as s}from"./p-DJkaRtbb.js";import{s as e}from"./p-CBX_oabB.js";function h(t,o=48){return t<=0?0:o*(1-1/(t/o+1))}const a=class{constructor(i){t(this,i),this.coClose=o(this,"coClose",3),this.coOpen=o(this,"coOpen",3),this.coAfterOpen=o(this,"coAfterOpen",3),this.coAfterClose=o(this,"coAfterClose",3),this.open=!1,this.heading="",this.maxHeight="85dvh",this.dismissible=!0,this.closeOnOverlay=!0,this.closeOnEscape=!0,this.showHandle=!0,this.hasFooter=!1,this.hasHeaderSlot=!1,this.tracker=function(t=100,o=8){let i=[];return{add(s,e){i.push({t:s,y:e}),i.length>o&&i.shift(),i=i.filter((o=>s-o.t<=t))},velocity(){if(i.length<2)return 0;const t=i[0],o=i[i.length-1],s=o.t-t.t;return s<8?0:(o.y-t.y)/s},reset(){i=[]}}}(),this.armed=!1,this.engaged=!1,this.fromBody=!1,this.startY=0,this.startX=0,this.startScrollTop=0,this.sheetHeight=0,this.dismissPending=!1,this.pendingAfter=null,this.handleBackdropClick=()=>{this.closeOnOverlay&&this.coClose.emit()},this.handleFooterSlotChange=t=>{this.hasFooter=e(t)},this.handleHeaderSlotChange=t=>{this.hasHeaderSlot=e(t)},this.handleTransitionEnd=t=>{"transform"===t.propertyName&&t.target===this.sheetEl&&("open"===this.pendingAfter&&this.open&&this.coAfterOpen.emit(),"close"!==this.pendingAfter||this.open||this.coAfterClose.emit(),this.pendingAfter=null)},this.handleGripPointerDown=t=>{this.arm(t,!1)},this.handleBodyPointerDown=t=>{this.arm(t,!0)},this.handlePointerMove=t=>{if(!this.armed||!t.isPrimary)return;const o=t.clientY-this.startY,i=t.clientX-this.startX;if(!this.engaged){const s=this.fromBody?8:4;if(Math.abs(o)<s)return;if(this.fromBody){const t=!!this.bodyEl&&this.bodyEl.scrollHeight>this.bodyEl.clientHeight;if(this.startScrollTop>0||Math.abs(o)<=Math.abs(i)||o<0&&t)return void this.disarm()}this.engage(t,t.currentTarget)}const s=t.clientY-this.startY;let e;if(e=s>=0?this.dismissible?s:h(s):-h(-s),this.sheetEl&&(this.sheetEl.style.transform=`translate3d(0, ${e}px, 0)`),this.backdropEl&&this.sheetHeight>0){const t=Math.min(Math.max(e/this.sheetHeight,0),1);this.backdropEl.style.opacity=String(1-t)}this.tracker.add(t.timeStamp,t.clientY)},this.handlePointerUp=t=>{if(!this.armed)return;const o=this.engaged,i=o?Math.max(t.clientY-this.startY,0):0,s=this.tracker.velocity();if(this.disarm(),!o)return;const e=function({offset:t,height:o,velocity:i,dismissible:s}){return s?i>=.5&&t>=24?"dismiss":i<=-.15?"restore":o>0&&t>=.45*o?"dismiss":"restore":"restore"}({offset:i,height:this.sheetHeight,velocity:s,dismissible:this.dismissible});"dismiss"===e?(this.dismissPending=!0,this.sheetEl&&(this.sheetEl.style.transform=`translate3d(0, ${this.sheetHeight}px, 0)`),this.backdropEl&&(this.backdropEl.style.opacity="0"),this.coClose.emit(),this.dismissFallback=setTimeout((()=>{this.open&&this.dismissPending&&(this.dismissPending=!1,this.clearInlineStyles())}),500)):this.clearInlineStyles()},this.handlePointerCancel=()=>{this.armed&&(this.disarm(),this.clearInlineStyles())},this.touchBlocker=t=>{(this.engaged||this.armed&&this.startScrollTop<=0&&t.touches[0].clientY-this.startY>0)&&t.preventDefault()}}onOpenChange(t,o){t!==o&&(this.pendingAfter=t?"open":"close",t?(this.coOpen.emit(),this.clearInlineStyles()):(this.dismissPending=!1,this.dismissFallback&&clearTimeout(this.dismissFallback),requestAnimationFrame((()=>this.clearInlineStyles()))))}handleKey(t){this.open&&this.closeOnEscape&&"Escape"===t.key&&this.coClose.emit()}disconnectedCallback(){this.detachTouchBlocker(),this.dismissFallback&&clearTimeout(this.dismissFallback)}clearInlineStyles(){this.sheetEl&&(this.sheetEl.style.transform=""),this.backdropEl&&(this.backdropEl.style.opacity="")}arm(t,o){this.open&&!this.dismissPending&&t.isPrimary&&(this.armed=!0,this.engaged=!1,this.fromBody=o,this.startY=t.clientY,this.startX=t.clientX,this.startScrollTop=o&&this.bodyEl?this.bodyEl.scrollTop:0,o&&this.attachTouchBlocker())}engage(t,o){var i,s;this.engaged=!0,this.startY=t.clientY,this.sheetHeight=(null===(i=this.sheetEl)||void 0===i?void 0:i.getBoundingClientRect().height)||0,null===(s=this.sheetEl)||void 0===s||s.classList.add("co-bottom-sheet--dragging");try{null==o||o.setPointerCapture(t.pointerId)}catch(t){}this.tracker.reset(),this.tracker.add(t.timeStamp,t.clientY)}disarm(){var t;this.armed=!1,this.engaged=!1,null===(t=this.sheetEl)||void 0===t||t.classList.remove("co-bottom-sheet--dragging"),this.detachTouchBlocker()}attachTouchBlocker(){var t;null===(t=this.bodyEl)||void 0===t||t.addEventListener("touchmove",this.touchBlocker,{passive:!1})}detachTouchBlocker(){var t;null===(t=this.bodyEl)||void 0===t||t.removeEventListener("touchmove",this.touchBlocker)}render(){return i("div",{key:"43f05669ad96312f6bd2ee1c1d4698538f029e2c",class:{"co-bottom-sheet-root":!0,"co-bottom-sheet-root--open":this.open}},i("div",{key:"86040a5efd513a6c06bbe551f82bcdc619817ea3",class:"co-bottom-sheet__backdrop",part:"backdrop",onClick:this.handleBackdropClick,ref:t=>this.backdropEl=t}),i("section",{key:"46155a318f952b9be717a47497f1f513d3cf970f",class:{"co-bottom-sheet":!0,"co-bottom-sheet--open":this.open},part:"sheet",role:"dialog","aria-modal":"true","aria-labelledby":this.hasHeaderSlot?"co-bottom-sheet-header":this.heading?"co-bottom-sheet-heading":void 0,style:{"--co-bottom-sheet-max-height":this.maxHeight},onTransitionEnd:this.handleTransitionEnd,ref:t=>this.sheetEl=t},i("div",{key:"8b4a140b235f9803f71fb8717763651557ec6ca6",class:"co-bottom-sheet__grip",onPointerDown:this.handleGripPointerDown,onPointerMove:this.handlePointerMove,onPointerUp:this.handlePointerUp,onPointerCancel:this.handlePointerCancel},this.showHandle&&i("div",{key:"0c61ae9e1faf72485cf5b8c529041f740831d3a1",class:"co-bottom-sheet__handle",part:"handle","aria-hidden":"true"}),i("header",{key:"cd7116cd2b12c66e6cde63753dab12eaab31d04c",class:{"co-bottom-sheet__header":!0,"co-bottom-sheet__header--show":this.hasHeaderSlot||!!this.heading},part:"header",id:"co-bottom-sheet-header"},i("slot",{key:"8343901cfdb86eef24e3bbc7e7a9d270eeed6ed0",name:"header",onSlotchange:this.handleHeaderSlotChange},this.heading&&i("h2",{key:"31874876e8fb9db7cf7ae57f3f704a569d4fb797",class:"co-bottom-sheet__heading",id:"co-bottom-sheet-heading"},this.heading)))),i("div",{key:"126a26708b6d4b70c8bb74f6a4cd7fe43f74e725",class:"co-bottom-sheet__body",part:"body",onPointerDown:this.handleBodyPointerDown,onPointerMove:this.handlePointerMove,onPointerUp:this.handlePointerUp,onPointerCancel:this.handlePointerCancel,ref:t=>this.bodyEl=t},i("slot",{key:"c8f5034ea3de0265d05203befc31e961f8340694"})),i("footer",{key:"a2d40f9d6056df561388fa213995595a84044cd1",class:{"co-bottom-sheet__footer":!0,"co-bottom-sheet__footer--show":this.hasFooter},part:"footer"},i("slot",{key:"0d97eb87bc4de74db631629a478bd01ce5a473a6",name:"footer",onSlotchange:this.handleFooterSlotChange}))))}get el(){return s(this)}static get watchers(){return{open:[{onOpenChange:0}]}}};a.style=":host{display:contents}.co-bottom-sheet__backdrop{position:fixed;inset:0;z-index:1000;background:rgba(0, 0, 0, 0.4);-webkit-backdrop-filter:blur(var(--co-overlay-blur, 2px));backdrop-filter:blur(var(--co-overlay-blur, 2px));opacity:0;pointer-events:none;transition:opacity var(--co-motion-duration-fast) var(--co-motion-ease-in)}.co-bottom-sheet-root--open .co-bottom-sheet__backdrop{opacity:1;pointer-events:auto;transition:opacity var(--co-motion-duration-base) var(--co-motion-ease-out)}.co-bottom-sheet{position:fixed;left:0;right:0;bottom:0;z-index:1001;display:flex;flex-direction:column;height:auto;max-height:var(--co-bottom-sheet-max-height, 85dvh);background:var(--co-semantic-surface-page);font-family:var(--co-font-family-primary);border-radius:var(--co-border-radius-xl) var(--co-border-radius-xl) 0 0;box-shadow:0 -4px 24px rgba(0, 0, 0, 0.12);transform:translateY(100%);transition:transform var(--co-motion-duration-slow) var(--co-motion-ease-in-out);will-change:transform;overflow:hidden;visibility:hidden}.co-bottom-sheet--open{transform:translateY(0);visibility:visible}.co-bottom-sheet:not(.co-bottom-sheet--open){transition:transform var(--co-motion-duration-slow) var(--co-motion-ease-in-out), visibility 0s linear var(--co-motion-duration-slow)}.co-bottom-sheet--dragging,.co-bottom-sheet-root:has(.co-bottom-sheet--dragging) .co-bottom-sheet__backdrop{transition:none !important}.co-bottom-sheet__grip{flex-shrink:0;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;cursor:grab}.co-bottom-sheet--dragging .co-bottom-sheet__grip{cursor:grabbing}.co-bottom-sheet__handle{width:40px;height:4px;margin:var(--co-spacing-sm) auto var(--co-spacing-xs);border-radius:var(--co-border-radius-full);background:var(--co-semantic-border-default)}.co-bottom-sheet__header{padding:0 var(--co-spacing-xl)}.co-bottom-sheet__header--show{padding-bottom:var(--co-spacing-sm)}.co-bottom-sheet__heading{margin:0;font-size:var(--co-font-size-16);font-weight:700;color:var(--co-semantic-text-default)}.co-bottom-sheet__body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior-y:contain;touch-action:pan-y}.co-bottom-sheet__footer{flex-shrink:0;display:none}.co-bottom-sheet__footer--show{display:block;border-top:1px solid var(--co-semantic-border-default);padding:var(--co-spacing-md) var(--co-spacing-xl) calc(var(--co-spacing-lg) + env(safe-area-inset-bottom, 0px));background:var(--co-semantic-surface-page)}";export{a as co_bottom_sheet}
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as e,a as o}from"./p-DJkaRtbb.js";import{l as s,I as a}from"./p-BzxEh7sq.js";import{d as n,c as r,a as c,p as l,h,g as d,j as u}from"./p-BU7SQCje.js";import{b as v,z as g,a as p,w as f,t as b,c as _}from"./p-1EK-COrb.js";function m(t,i,e){return Math.min(e,Math.max(i,t))}function x(t,i){return i<=0?t:Math.round(t/i)*i}function y(t,i,e){const o=e-i;return o<=0?0:m(t,i,e)===t?(t-i)/o:Math.min(1,Math.max(0,(t-i)/o))}function w(t,i,e){const o=[...t].sort(((t,o)=>i(t)-i(o)||e(t)-e(o))),s=[];let a=[],n=[],r=-1/0;const c=()=>{const t=n.length;for(const i of a)s[i].columnCount=t;a=[],n=[],r=-1/0};for(const t of o){const o=i(t),l=e(t);a.length&&o>=r&&c();let h=-1;for(let t=0;t<n.length;t++)if(n[t]<=o){h=t;break}-1===h?(h=n.length,n.push(l)):n[h]=l,s.push({event:t,columnIndex:h,columnCount:1}),a.push(s.length-1),r=Math.max(r,l)}return c(),s}function k(t,i,e){const o=v(t),s=v(i);if(s<=o)return[];const a=[];let r=g(o,e),c=M(r,e);for(let t=0;t<366&&c<s;t++){const t=n(r,1),i=M(t,e),l=Math.max(o,c),h=Math.min(s,i);a.push({dateKey:r,startMinutes:l===c?0:p(l,e),endMinutes:h===i?1440:p(h,e),isStart:l===o,isEnd:h===s}),r=t,c=i}return a}const D=new Map;function M(t,i){const e=`${i}|${t}`;let o=D.get(e);if(void 0===o){const[s,a,n]=t.split("-").map(Number);o=f({year:s,month:a,day:n,hour:0,minute:0,second:0},i),D.size>1e3&&D.clear(),D.set(e,o)}return o}function z(t,i,e={}){const o=e.maxLanes??1/0,s=[],a={};let c=0;const l=t.map((t=>function(t,i){if(t.allDay){const i=t.start.slice(0,10),e=n(t.end.slice(0,10),-1);return r(e,i)<0?{event:t,firstDay:i,lastDay:i}:{event:t,firstDay:i,lastDay:e}}const e=i?g(t.startMs,i):t.start.slice(0,10);return{event:t,firstDay:e,lastDay:e}}(t,e.timeZone))).filter((t=>null!==t));if(i.forEach(((t,i)=>{if(!t.length)return;const e=t[0],o=t[t.length-1],a=new Map(t.map(((t,i)=>[t,i]))),n=l.filter((t=>r(t.firstDay,o)<=0&&r(e,t.lastDay)<=0)).map((i=>{const s=r(i.firstDay,e)>=0?i.firstDay:e,n=r(i.lastDay,o)<=0?i.lastDay:o;return{span:i,startCol:a.get(s)??0,endCol:a.get(n)??t.length-1}})).sort(((t,i)=>t.startCol-i.startCol||i.endCol-i.startCol-(t.endCol-t.startCol)||t.span.event.startMs-i.span.event.startMs||(t.span.event.id<i.span.event.id?-1:1))),h=[];for(const t of n){let a=0;for(;h.some((i=>i.lane===a&&!(t.endCol<i.startCol||t.startCol>i.endCol)));)a++;h.push({lane:a,startCol:t.startCol,endCol:t.endCol}),c=Math.max(c,a+1),s.push({eventId:t.span.event.id,weekIndex:i,lane:a,startCol:t.startCol,endCol:t.endCol,isStart:r(t.span.firstDay,e)>=0,isEnd:r(t.span.lastDay,o)<=0,continuesBefore:r(t.span.firstDay,e)<0,continuesAfter:r(t.span.lastDay,o)>0})}})),Number.isFinite(o))for(const t of s)if(t.lane>=o)for(let e=t.startCol;e<=t.endCol;e++){const o=i[t.weekIndex][e];a[o]=(a[o]??0)+1}return{segments:s,overflow:a,laneCount:c}}const C=new Map;function $(t,i){const e=function(t,i){const e=(null!=i?i:"").trim();if(!e.startsWith("var(")||!t)return e;const o=`${null!==(n=null===(a=null===(s=document.documentElement)||void 0===s?void 0:s.dataset)||void 0===a?void 0:a.theme)&&void 0!==n?n:""}|${e}`;var s,a,n;const r=C.get(o);if(void 0!==r)return r;const c=e.slice(4,e.lastIndexOf(")")),[l,...h]=c.split(","),d=getComputedStyle(t).getPropertyValue(l.trim()).trim()||h.join(",").trim();return C.set(o,d),d}(t,i).replace("#","").trim();if(3!==e.length&&6!==e.length)return"";const o=3===e.length?e.split("").map((t=>t+t)).join(""):e,n=parseInt(o.slice(0,2),16),r=parseInt(o.slice(2,4),16),c=parseInt(o.slice(4,6),16);return[n,r,c].some((t=>Number.isNaN(t)))?"":s({r:n,g:r,b:c})>a?"var(--co-cal-event-text-dark)":"var(--co-cal-event-text-light)"}const I=class{constructor(e){t(this,e),this.coDaySelect=i(this,"coDaySelect",1),this.coEventClick=i(this,"coEventClick",1),this.coEventDrop=i(this,"coEventDrop",1),this.coMoreClick=i(this,"coMoreClick",1),this.coEventDblClick=i(this,"coEventDblClick",1),this.events=[],this.locale="es-CO",this.firstDayOfWeek=1,this.editable=!0,this.selectable=!0,this.maxLanes=3,this.loading=!1,this.dragOverDate=null,this.dragId=null,this.nowMs=0,this.onPointerUp=()=>this.finishDrag(),this.onPointerMove=t=>this.trackDrag(t),this.dragArmedId=null,this.dragStartPointer=null,this.suppressNextClick=!1,this.selectedDate=null,this.handleKeyDown=t=>{const i=this.focused;let e=!0;switch(t.key){case"ArrowLeft":this.moveFocus(n(i,-1));break;case"ArrowRight":this.moveFocus(n(i,1));break;case"ArrowUp":this.moveFocus(n(i,-7));break;case"ArrowDown":this.moveFocus(n(i,7));break;case"Enter":case" ":this.selectDay(i);break;default:e=!1}e&&(t.preventDefault(),t.stopPropagation())}}componentWillLoad(){this.focused=this.defaultFocus(),this.nowMs=Date.now()}componentDidLoad(){this.nowTimer=window.setInterval((()=>this.nowMs=Date.now()),6e4)}connectedCallback(){window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointermove",this.onPointerMove)}disconnectedCallback(){window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointermove",this.onPointerMove),this.nowTimer&&window.clearInterval(this.nowTimer)}defaultFocus(){const t=`${S(this.year)}-${A(this.month)}-01`,i=c(),e=l(i);return e.year===this.year&&e.month===this.month?i:t}eventById(t){var i,e;return null!==(e=null===(i=this._layoutCache)||void 0===i?void 0:i.byId.get(t))&&void 0!==e?e:this.events.find((i=>i.id===t))}isDayInteractable(t){return!h(t,{min:this.minDate,max:this.maxDate})}selectDay(t,i){this.selectable&&this.isDayInteractable(t)&&(this.selectedDate=t,this.coDaySelect.emit({date:t,rect:i}))}async clearSelection(){this.selectedDate=null}onEventsChange(){this.selectedDate=null}activateEvent(t,i){this.coEventClick.emit({id:t,rect:i})}moveFocus(t){this.focused=t,requestAnimationFrame((()=>this.focusCell()))}focusCell(){var t,i;null===(i=null===(t=this.el.shadowRoot)||void 0===t?void 0:t.querySelector(`[data-date="${this.focused}"]`))||void 0===i||i.focus()}setInteracting(t){var i;null===(i=this.rootEl)||void 0===i||i.classList.toggle("cal-month--interacting",t)}startDrag(t,i){const e=this.eventById(i);e&&this.editable&&!1!==e.editable&&!1!==e.startEditable&&(t.stopPropagation(),this.dragArmedId=i,this.dragStartPointer={x:t.clientX,y:t.clientY})}trackDrag(t){if(!this.dragArmedId||this.dragId)return;const i=this.dragStartPointer;i&&(Math.hypot(t.clientX-i.x,t.clientY-i.y)<5||(this.dragId=this.dragArmedId,this.dragArmedId=null,this.dragOverDate=null,this.setInteracting(!0)))}finishDrag(){if(this.dragArmedId&&!this.dragId)return this.dragArmedId=null,void(this.dragStartPointer=null);const t=this.dragId,i=this.dragOverDate;if(this.dragId=null,this.dragOverDate=null,this.dragStartPointer=null,this.setInteracting(!1),!t||!i)return;const e=this.eventById(t);if(!e)return;const o=function(t,i){const[e,o,s]=t.split("-").map(Number),[a,n,r]=i.split("-").map(Number);return Math.round((Date.UTC(a,n-1,r)-Date.UTC(e,o-1,s))/864e5)}(e.allDay?e.start.slice(0,10):g(e.startMs,this.timeZone),i);if(0===o)return;if(!this.isDayInteractable(i))return;this.suppressNextClick=!0,setTimeout((()=>{this.suppressNextClick=!1}),0);const s=function(t,i,e){return t.allDay?{start:n(t.start.slice(0,10),i),end:n(t.end.slice(0,10),i)}:{start:b(F(t.startMs,i,e)),end:b(F(t.endMs,i,e))}}(e,o,this.timeZone);this.coEventDrop.emit({id:t,start:s.start,end:s.end,oldStart:e.start,oldEnd:e.end,allDay:e.allDay})}getLayouts(){var t;const i=this._layoutCache;if(i&&i.events===this.events&&i.year===this.year&&i.month===this.month&&i.firstDayOfWeek===this.firstDayOfWeek&&i.timeZone===this.timeZone&&i.maxLanes===this.maxLanes)return i;const e=d(this.year,this.month,this.firstDayOfWeek).map((t=>t.map((t=>t.value)))),o=z(this.events,e,{maxLanes:this.maxLanes,timeZone:this.timeZone}),s=new Map;for(const i of o.segments){if(i.lane>=this.maxLanes)continue;const e=null!==(t=s.get(i.weekIndex))&&void 0!==t?t:[];e.push(i),s.set(i.weekIndex,e)}const a=new Map(this.events.map((t=>[t.id,t])));return this._layoutCache={events:this.events,year:this.year,month:this.month,firstDayOfWeek:this.firstDayOfWeek,timeZone:this.timeZone,maxLanes:this.maxLanes,matrix:e,layout:o,segByWeek:s,byId:a},this._layoutCache}renderChip(t,i){var o;const s=this.eventById(t.eventId);if(!s)return null;const a=i.length,n=t.startCol/a*100,r=(t.endCol-t.startCol+1)/a*100,c=s.endMs<=this.nowMs,l=!0===(null===(o=s.extendedProps)||void 0===o?void 0:o.isExternal),h=!this.editable||!1===s.editable,d=s.allDay||!t.isStart?"":function(t,i){const e=`${i}|${t}`,o=N.get(e);if(void 0!==o)return o;let s=L.get(i);s||(s=new Intl.DateTimeFormat(i,{hour:"numeric",minute:"2-digit"}),L.set(i,s));const a=Math.floor(t/60),n=s.format(new Date(2e3,0,1,a,t%60));return N.size>2e3&&N.clear(),N.set(e,n),n}(p(s.startMs,this.timeZone),this.locale),u={left:`${n}%`,width:`${r}%`,top:`calc(var(--co-cal-daynum-h) + ${t.lane} * var(--co-cal-lane-h))`};if(s.backgroundColor){u["--co-cal-event-bg"]=s.backgroundColor;const t=$(this.rootEl,s.backgroundColor);t&&(u["--co-cal-event-text"]=t)}return s.borderColor&&(u["--co-cal-event-border"]=s.borderColor),e("button",{type:"button",key:`${t.eventId}-${t.weekIndex}`,class:{"cal-chip":!0,"cal-chip--all-day":s.allDay,"cal-chip--past":c,"cal-chip--external":l,"cal-chip--locked":h,"cal-chip--dragging":this.dragId===s.id,"cal-chip--continues-before":t.continuesBefore,"cal-chip--continues-after":t.continuesAfter,"cal-chip--tentative":"tentative"===s.responseState,"cal-chip--cancelled":"cancelled"===s.responseState||"declined"===s.responseState},style:u,title:s.title,"aria-label":s.title,onClick:t=>{t.stopPropagation(),this.suppressNextClick?this.suppressNextClick=!1:this.activateEvent(s.id,t.currentTarget.getBoundingClientRect())},onDblClick:t=>{t.stopPropagation(),this.coEventDblClick.emit({id:s.id,rect:t.currentTarget.getBoundingClientRect()})},onPointerDown:t=>this.startDrag(t,s.id)},!s.allDay&&e("span",{class:"cal-chip__dot","aria-hidden":"true"}),d&&e("span",{class:"cal-chip__time"},d),e("span",{class:"cal-chip__title"},s.title||"—"),l&&(B(s)?e("co-provider-logo",{provider:B(s),size:11,plated:!0,class:"cal-chip__ext"}):e("co-icon",{name:"link",size:11,class:"cal-chip__ext"})))}render(){const{matrix:t,layout:i,segByWeek:o}=this.getLayouts(),s=u(this.locale,this.firstDayOfWeek,"short"),a=u(this.locale,this.firstDayOfWeek,"long"),n=c();return e("div",{key:"0f8757ab9f44282d7f909c59d046b4d35d2453cd",class:"cal-month",part:"grid",role:"grid",onKeyDown:this.handleKeyDown,ref:t=>this.rootEl=t},e("div",{key:"3f79d24dac7f06064d877743a5ea8bd0c8a050b9",class:"cal-month__dow",role:"row"},s.map(((t,i)=>e("span",{class:"cal-month__dow-cell",role:"columnheader","aria-label":a[i]},t)))),t.map(((t,s)=>{var a;return e("div",{class:"cal-month__week",role:"row"},e("div",{class:"cal-month__days"},t.map((t=>{const i=l(t),o=i.month===this.month,s=0===r(t,n),a=0===r(t,this.focused),c=this.isDayInteractable(t);return e("div",{role:"gridcell","data-date":t,tabIndex:a?0:-1,"aria-current":s?"date":void 0,"aria-disabled":c?void 0:"true",class:{"cal-month__day":!0,"cal-month__day--outside":!o,"cal-month__day--today":s,"cal-month__day--disabled":!c,"cal-month__day--drag-over":null!==this.dragId&&this.dragOverDate===t,"cal-month__day--selected":this.selectedDate===t},onClick:i=>this.selectDay(t,i.currentTarget.getBoundingClientRect()),onPointerEnter:()=>{this.dragId&&(this.dragOverDate=t)}},e("span",{class:"cal-month__daynum"},i.day))}))),e("div",{class:"cal-month__events"},this.loading&&E[s%E.length].map((([i,o,s])=>e("div",{class:"cal-month__chip-skeleton","aria-hidden":"true",style:{left:i/t.length*100+"%",width:o/t.length*100+"%",top:`calc(var(--co-cal-daynum-h) + ${s} * var(--co-cal-lane-h))`}},e("co-skeleton",{variant:"rect",width:"100%",height:"100%"})))),!this.loading&&(null!==(a=o.get(s))&&void 0!==a?a:[]).map((i=>this.renderChip(i,t))),!this.loading&&t.map(((o,s)=>{var a;const n=null!==(a=i.overflow[o])&&void 0!==a?a:0;return n<=0?null:e("button",{type:"button",class:"cal-month__more",style:{left:s/t.length*100+"%",width:1/t.length*100+"%",top:`calc(var(--co-cal-daynum-h) + ${this.maxLanes} * var(--co-cal-lane-h))`},onClick:t=>{t.stopPropagation(),this.coMoreClick.emit({date:o})}},"+",n)}))))})))}get el(){return o(this)}static get watchers(){return{events:[{onEventsChange:0}]}}},E=[[[0,2,0],[3,1,0],[5,1,1]],[[1,1,0],[2,3,1]],[[0,1,0],[2,1,0],[4,2,1],[6,1,0]],[[1,2,0],[4,1,1]],[[2,1,0],[3,2,1],[6,1,0]],[[0,3,0],[5,1,1]]];function A(t){return String(t).padStart(2,"0")}function S(t){return String(t).padStart(4,"0")}function F(t,i,e){const o=_(t,e),s=n(`${S(o.year)}-${A(o.month)}-${A(o.day)}`,i),[a,r,c]=s.split("-").map(Number);return f({year:a,month:r,day:c,hour:o.hour,minute:o.minute,second:o.second},e)}const N=new Map,L=new Map;function B(t){var i,e;const o=String(null!==(e=null===(i=t.extendedProps)||void 0===i?void 0:i.provider)&&void 0!==e?e:"").toLowerCase();return o.includes("google")?"google":o.includes("microsoft")||o.includes("outlook")?"microsoft":""}I.style=":host{display:block;font-family:var(--co-font-family-primary);--co-cal-daynum-h:24px;--co-cal-lane-h:22px;--co-cal-min-week-h:92px;--co-cal-gap:2px;--co-cal-surface:var(--co-semantic-surface-page);--co-cal-border:var(--co-semantic-border-default);--co-cal-text:var(--co-semantic-text-default);--co-cal-text-muted:var(--co-semantic-text-muted);--co-cal-hover:var(--co-semantic-surface-hover);--co-cal-today-ring:var(--co-color-primary-azul);--co-cal-event-radius:6px;--co-cal-elevation-hover:var(--co-shadow-lg);--co-cal-event-bg:var(--co-color-primary-azul);--co-cal-event-border:transparent;--co-cal-event-text:var(--co-color-base-blanco, #fff);--co-cal-event-text-light:var(--co-color-base-blanco, #fff);--co-cal-event-text-dark:var(--co-color-base-negro, #1f1c1b)}.cal-month{display:flex;flex-direction:column;height:100%;border-radius:var(--co-border-radius-xs);overflow:hidden;background:var(--co-cal-surface)}.cal-month__dow{display:grid;grid-template-columns:repeat(7, 1fr);border-bottom:1px solid var(--co-cal-border)}.cal-month__dow-cell{padding:var(--co-spacing-xs) var(--co-spacing-sm);font-size:var(--co-font-size-10, 10px);font-weight:600;text-transform:uppercase;letter-spacing:0.04em;color:var(--co-cal-text-muted);text-align:right}.cal-month__week{position:relative;min-height:var(--co-cal-min-week-h);flex:1 0 auto}.cal-month__week:not(:last-child){border-bottom:1px solid var(--co-cal-border)}.cal-month__days{display:grid;grid-template-columns:repeat(7, 1fr);height:100%;position:absolute;inset:0}.cal-month__day{border-right:1px solid var(--co-cal-border);padding:var(--co-spacing-xxs);cursor:pointer;transition:background var(--co-motion-duration-fast) var(--co-motion-ease-out)}.cal-month__day:last-child{border-right:0}.cal-month__day:hover{background:var(--co-cal-hover)}.cal-month__day:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:-2px}.cal-month__day--outside .cal-month__daynum{color:var(--co-cal-text-muted)}.cal-month__day--disabled{cursor:not-allowed;background:color-mix(in srgb, var(--co-cal-border) 20%, transparent)}.cal-month__day--drag-over{background:color-mix(in srgb, var(--co-cal-today-ring) 14%, transparent);box-shadow:inset 0 0 0 2px var(--co-cal-today-ring)}.cal-month__day--selected{background:color-mix(in srgb, var(--co-cal-today-ring) 10%, transparent)}.cal-month__daynum{display:inline-flex;align-items:center;justify-content:center;min-width:22px;height:22px;margin-left:auto;float:right;font-size:var(--co-font-size-12, 12px);color:var(--co-cal-text);border-radius:var(--co-border-radius-full)}.cal-month__day--today .cal-month__daynum{background:var(--co-cal-today-ring);color:var(--co-color-base-blanco, #fff);font-weight:600}.cal-month__events{position:absolute;inset:0;pointer-events:none;}.cal-chip,.cal-month__more{position:absolute;height:calc(var(--co-cal-lane-h) - 3px);box-sizing:border-box;pointer-events:auto;display:flex;align-items:center;gap:var(--co-spacing-xxs);margin:0 3px;padding:0 var(--co-spacing-xs);border:1px solid var(--co-cal-event-border);border-radius:var(--co-cal-event-radius);font-family:inherit;font-size:var(--co-font-size-12, 12px);line-height:1;text-align:left;cursor:pointer;overflow:hidden;white-space:nowrap}.cal-chip{background:var(--co-cal-event-bg);color:var(--co-cal-event-text);user-select:none;-webkit-user-select:none;touch-action:none}.cal-month__chip-skeleton{position:absolute;height:calc(var(--co-cal-lane-h) - 3px);box-sizing:border-box;margin:0 3px;border-radius:var(--co-cal-event-radius);overflow:hidden;pointer-events:none}.cal-month__chip-skeleton co-skeleton{display:block;block-size:100%}.cal-chip--all-day:hover{filter:brightness(0.95);box-shadow:var(--co-cal-elevation-hover)}.cal-chip:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:1px}.cal-chip--all-day{font-weight:500}.cal-chip__dot{flex:0 0 auto;width:7px;height:7px;border-radius:var(--co-border-radius-full);background:var(--co-cal-event-bg)}.cal-chip:not(.cal-chip--all-day){background:transparent;color:var(--co-cal-text);border-color:transparent}.cal-chip:not(.cal-chip--all-day):hover{background:var(--co-cal-hover);filter:none}.cal-chip__time{flex:0 0 auto;color:var(--co-cal-text-muted);font-variant-numeric:tabular-nums}.cal-chip__title{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}.cal-chip__ext{flex:0 0 auto;margin-inline-start:auto;opacity:0.8}.cal-chip--past{opacity:0.55}.cal-chip--locked{cursor:default}.cal-chip--external{border-style:dashed}.cal-chip--dragging{opacity:0.4}.cal-month--interacting .cal-chip{pointer-events:none}.cal-chip--all-day.cal-chip--tentative{background-image:repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.5) 0 4px, transparent 4px 8px)}.cal-chip--cancelled{opacity:0.6}.cal-chip--cancelled .cal-chip__title{text-decoration:line-through}.cal-chip--continues-before{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:0}.cal-chip--continues-after{border-top-right-radius:0;border-bottom-right-radius:0;margin-right:0}.cal-month__more{background:transparent;color:var(--co-cal-text-muted);border-color:transparent;font-weight:600;font-size:var(--co-font-size-11, 11px)}.cal-month__more:hover{background:var(--co-cal-hover);color:var(--co-cal-text)}";const T=class{constructor(e){t(this,e),this.coRangeSelect=i(this,"coRangeSelect",1),this.coEventClick=i(this,"coEventClick",1),this.coEventDrop=i(this,"coEventDrop",1),this.coEventDblClick=i(this,"coEventDblClick",1),this.events=[],this.dates=[],this.locale="es-CO",this.editable=!0,this.selectable=!0,this.slotMinutes=15,this.snapMinutes=15,this.defaultDurationMinutes=60,this.scrollTime="07:00",this.nowIndicator=!0,this.loading=!1,this.allDaySlot=!0,this.minTime="00:00",this.maxTime="24:00",this.nowMinutes=0,this.nowDay="",this.focusDate="",this.focusMin=0,this.selDate=null,this.selStartMin=0,this.selEndMin=0,this.selecting=!1,this.pendingSel=null,this.selRaf=0,this.pendingDrag=null,this.dragRaf=0,this.onWindowPointerUp=()=>this.finishSelection(),this.dragId=null,this.dragMode=null,this.dragGrabOffsetMin=0,this.dragDurationMin=0,this.dragDate=null,this.dragStartMin=0,this.dragEndMin=0,this.origStartMin=0,this.origEndMin=0,this.origDate=null,this.suppressNextClick=!1,this.dragArmedId=null,this.dragStartPointer=null,this.onWindowPointerMove=t=>this.trackDrag(t),this.onWindowPointerUpDrag=()=>this.finishDrag(),this.colRects=[],this.gridRect=null,this.onDragViewportChange=()=>this.captureDragRects(),this.startSelection=(t,i,e)=>{if(!this.selectable||!this.isDayInteractable(i))return;if(t.target.closest(".tg__event, .tg__allday-bar"))return;t.preventDefault();const o=this.minutesFromPointer(t.clientY,e);this.selecting=!0,this.selDate=i,this.selStartMin=o,this.selEndMin=o,this.setInteracting(!0)},this.extendSelection=(t,i)=>{this.selecting&&(this.pendingSel={y:t.clientY,colEl:i},this.selRaf||(this.selRaf=requestAnimationFrame((()=>{this.selRaf=0;const t=this.pendingSel;if(this.pendingSel=null,!t||!this.selecting)return;const i=this.minutesFromPointer(t.y,t.colEl);i!==this.selEndMin&&(this.selEndMin=i)}))))},this.startMove=(t,i)=>{const e=this.eventById(i);if(!e||e.allDay||!this.editable||!1===e.editable||!1===e.startEditable)return;t.stopPropagation();const o=g(e.startMs,this.timeZone);if(this.captureDragRects(),!this.gridRect||!this.colRects.some((t=>t.d===o)))return;const s=this.minutesFromCachedY(t.clientY),a=p(e.startMs,this.timeZone);this.dragArmedId=i,this.dragMode="move",this.dragDate=o,this.dragGrabOffsetMin=s-a,this.dragDurationMin=Math.round((e.endMs-e.startMs)/6e4),this.dragStartMin=a,this.dragEndMin=a+this.dragDurationMin,this.origStartMin=a,this.origEndMin=a+this.dragDurationMin,this.origDate=o,this.dragStartPointer={x:t.clientX,y:t.clientY}},this.startResize=(t,i)=>{const e=this.eventById(i);if(!e||e.allDay||!this.editable||!1===e.editable||!1===e.durationEditable)return;t.stopPropagation();const o=g(e.startMs,this.timeZone);this.captureDragRects(),this.gridRect&&this.colRects.some((t=>t.d===o))&&(this.dragArmedId=i,this.dragMode="resize",this.dragDate=o,this.dragStartMin=p(e.startMs,this.timeZone),this.dragEndMin=p(e.endMs,this.timeZone),this.origStartMin=this.dragStartMin,this.origEndMin=this.dragEndMin,this.origDate=o,this.dragStartPointer={x:t.clientX,y:t.clientY})},this.handleKeyDown=t=>{const i=this.slotMinutes;let e=!0;switch(t.key){case"ArrowUp":this.focusMin=m(this.focusMin-i,this.minM,this.maxM-i);break;case"ArrowDown":this.focusMin=m(this.focusMin+i,this.minM,this.maxM-i);break;case"ArrowLeft":this.focusDate=this.shiftFocusDate(-1);break;case"ArrowRight":this.focusDate=this.shiftFocusDate(1);break;case"Enter":case" ":{if(!this.isDayInteractable(this.focusDate))break;const t=this.toInstant(this.focusDate,this.focusMin),i=this.toInstant(this.focusDate,Math.min(this.focusMin+this.defaultDurationMinutes,this.maxM));new Date(t).getTime()>=Date.now()&&this.coRangeSelect.emit({start:t,end:i});break}default:e=!1}e&&(t.preventDefault(),t.stopPropagation())}}componentWillLoad(){this.refreshNow(),this.focusDate=this.dates&&this.dates[0]||c(),this.focusMin=j(this.scrollTime,420)}componentDidLoad(){this.scrollToInitial(),this.nowTimer=window.setInterval((()=>this.refreshNow()),6e4),window.addEventListener("pointerup",this.onWindowPointerUp),window.addEventListener("pointermove",this.onWindowPointerMove),window.addEventListener("pointerup",this.onWindowPointerUpDrag)}disconnectedCallback(){this.nowTimer&&window.clearInterval(this.nowTimer),this.selRaf&&cancelAnimationFrame(this.selRaf),this.dragRaf&&cancelAnimationFrame(this.dragRaf),window.removeEventListener("pointerup",this.onWindowPointerUp),window.removeEventListener("pointermove",this.onWindowPointerMove),window.removeEventListener("pointerup",this.onWindowPointerUpDrag),this.bindDragViewportListeners(!1),this.hideGhost(),this.colRects=[],this.gridRect=null}async clearSelection(){this.selDate=null}onEventsChange(){this.selecting||(this.selDate=null)}refreshNow(){const t=Date.now();this.nowDay=g(t,this.timeZone),this.nowMinutes=p(t,this.timeZone)}get minM(){return j(this.minTime,0)}get maxM(){return j(this.maxTime,1440)}scrollToInitial(){var t,i,e;const o=null!==(t=this.scrollEl)&&void 0!==t?t:null===(i=this.el.shadowRoot)||void 0===i?void 0:i.querySelector(".tg__scroll"),s=null===(e=this.el.shadowRoot)||void 0===e?void 0:e.querySelector(".tg__body");if(!o||!s)return;const a=y(j(this.scrollTime,420),this.minM,this.maxM);o.scrollTop=a*s.offsetHeight}visibleDates(){return this.dates.length?this.dates:[c()]}get slotM(){return this.slotMinutes>0?this.slotMinutes:15}slotCount(){return Math.max(1,Math.ceil((this.maxM-this.minM)/this.slotM))}hourList(){const t=[];for(let i=60*Math.ceil(this.minM/60);i<this.maxM;i+=60)t.push(i);return t}minutesFromPointer(t,i){const e=i.getBoundingClientRect();return this.minutesAtFraction((t-e.top)/e.height)}minutesFromCachedY(t){const i=this.gridRect;return i&&i.height?this.minutesAtFraction((t-i.top)/i.height):this.minM}minutesAtFraction(t){return m(x(this.minM+t*(this.maxM-this.minM),this.snapMinutes),this.minM,this.maxM)}captureDragRects(){const t=this.el.shadowRoot,i=null==t?void 0:t.querySelector(".tg__cols"),e=null==t?void 0:t.querySelectorAll(".tg__col");if(!i||!e||!e.length)return this.colRects=[],void(this.gridRect=null);const o=i.getBoundingClientRect();this.gridRect={top:o.top,height:o.height},this.colRects=Array.from(e).map((t=>{var i;const e=t.getBoundingClientRect();return{d:null!==(i=t.dataset.colDate)&&void 0!==i?i:"",left:e.left,right:e.right}}))}bindDragViewportListeners(t){const i=this.scrollEl;t?(null==i||i.addEventListener("scroll",this.onDragViewportChange,{passive:!0}),window.addEventListener("resize",this.onDragViewportChange)):(null==i||i.removeEventListener("scroll",this.onDragViewportChange),window.removeEventListener("resize",this.onDragViewportChange))}setInteracting(t){var i;null===(i=this.rootEl)||void 0===i||i.classList.toggle("tg--interacting",t)}toInstant(t,i){const[e,o,s]=t.split("-").map(Number),a=f({year:e,month:o,day:s,hour:Math.floor(i/60),minute:i%60,second:0},this.timeZone);return b(a)}isDayInteractable(t){return!(this.minDate&&t<this.minDate||this.maxDate&&t>this.maxDate)}finishSelection(){if(!this.selecting)return;this.selRaf&&(cancelAnimationFrame(this.selRaf),this.selRaf=0);const t=this.pendingSel;if(this.pendingSel=null,t){const i=this.minutesFromPointer(t.y,t.colEl);i!==this.selEndMin&&(this.selEndMin=i)}this.selecting=!1,this.setInteracting(!1);const i=this.selDate;let e=Math.min(this.selStartMin,this.selEndMin),o=Math.max(this.selStartMin,this.selEndMin);o-e<this.snapMinutes&&(o=e+this.defaultDurationMinutes),o=Math.min(o,this.maxM);const s=i?this.selectionRect(i,e,o):void 0;if(!i)return;const a=this.toInstant(i,e),n=this.toInstant(i,o);new Date(a).getTime()<Date.now()?this.selDate=null:(this.selStartMin=e,this.selEndMin=o,this.coRangeSelect.emit({start:a,end:n,rect:s}))}selectionRect(t,i,e){var o;const s=null===(o=this.el.shadowRoot)||void 0===o?void 0:o.querySelector(`[data-col-date="${t}"]`);if(!s)return;const a=s.getBoundingClientRect();try{const t=y(i,this.minM,this.maxM),o=y(e,this.minM,this.maxM);return{top:a.top+t*a.height,left:a.left,width:a.width,height:(o-t)*a.height}}catch(t){return a}}eventById(t){return this.events.find((i=>i.id===t))}dateKeyAtX(t){for(const i of this.colRects)if(t>=i.left&&t<i.right)return i.d||null;return null}beginDragInteraction(){this.setInteracting(!0),this.bindDragViewportListeners(!0),this.paintGhost()}paintGhost(){const t=this.ghostEl;if(!t)return;const i=this.colRects.length,e=this.dragDate?this.colRects.findIndex((t=>t.d===this.dragDate)):-1;if(!i||e<0)return void(t.style.display="none");const o=this.maxM-this.minM||1,s=(this.dragStartMin-this.minM)/o,a=(this.dragEndMin-this.dragStartMin)/o;t.style.display="block",t.style.left=e/i*100+"%",t.style.width=`calc(${100/i}% - 2px)`,t.style.top=100*s+"%",t.style.height=100*a+"%"}hideGhost(){this.ghostEl&&(this.ghostEl.style.display="none")}trackDrag(t){if(this.dragArmedId&&!this.dragId){const i=this.dragStartPointer;if(!i)return;if(Math.hypot(t.clientX-i.x,t.clientY-i.y)<5)return;this.dragId=this.dragArmedId,this.dragArmedId=null,this.beginDragInteraction()}this.dragId&&this.dragMode&&this.dragDate&&(this.pendingDrag={x:t.clientX,y:t.clientY},this.dragRaf||(this.dragRaf=requestAnimationFrame((()=>{this.dragRaf=0;const t=this.pendingDrag;this.pendingDrag=null,t&&this.dragId&&this.dragMode&&this.dragDate&&this.applyDrag(t.x,t.y)}))))}applyDrag(t,i){var e;if(!this.dragId||!this.dragMode||!this.dragDate)return;if(!this.gridRect)return;const o=this.minutesFromCachedY(i);if("move"===this.dragMode){const i=null!==(e=this.dateKeyAtX(t))&&void 0!==e?e:this.dragDate;let s=o-this.dragGrabOffsetMin;s=m(x(s,this.snapMinutes),this.minM,this.maxM-this.dragDurationMin),this.dragDate=i,this.dragStartMin=s,this.dragEndMin=s+this.dragDurationMin}else this.dragEndMin=Math.max(this.dragStartMin+this.slotMinutes,o);this.paintGhost()}finishDrag(){if(this.dragArmedId&&!this.dragId)return this.dragArmedId=null,this.dragStartPointer=null,this.dragMode=null,this.dragDate=null,void(this.origDate=null);if(!this.dragId)return;this.dragRaf&&(cancelAnimationFrame(this.dragRaf),this.dragRaf=0);const t=this.pendingDrag;this.pendingDrag=null,t&&this.dragMode&&this.dragDate&&this.applyDrag(t.x,t.y),this.setInteracting(!1),this.bindDragViewportListeners(!1),this.hideGhost(),this.colRects=[],this.gridRect=null;const i=this.dragId,e=this.dragMode,o=this.dragDate,s=this.dragStartMin,a=this.dragEndMin,n=this.origStartMin,r=this.origEndMin,c=this.origDate;if(this.dragId=null,this.dragMode=null,this.dragDate=null,this.origDate=null,this.dragStartPointer=null,!i||!e||!o)return;const l=this.eventById(i);if(!l)return;if(!("move"===e?s!==n||o!==c:a!==r))return;const h="move"===e?this.toInstant(o,s):l.start,d=this.toInstant(o,a);new Date("move"===e?h:d).getTime()<Date.now()||this.isDayInteractable(o)&&(this.suppressNextClick=!0,setTimeout((()=>{this.suppressNextClick=!1}),0),this.coEventDrop.emit({id:i,start:h,end:d,oldStart:l.start,oldEnd:l.end,allDay:!1}))}shiftFocusDate(t){const i=this.dates.indexOf(this.focusDate)+t;return i<0||i>=this.dates.length?this.focusDate:this.dates[i]}renderSelectionGhost(){const t=Math.min(this.selStartMin,this.selEndMin),i=Math.max(this.selStartMin,this.selEndMin),o=y(t,this.minM,this.maxM),s=y(Math.max(i,t+this.snapMinutes),this.minM,this.maxM);return e("div",{class:"tg__selection",style:{top:100*o+"%",height:100*(s-o)+"%"}})}renderEventBox(t){var i;const o=t.event,s=o.endMs<=Date.now(),a=!0===(null===(i=o.extendedProps)||void 0===i?void 0:i.isExternal),n=!this.editable||!1===o.editable,r=100/t.columnCount,c={top:100*t.topFraction+"%",height:100*t.heightFraction+"%",left:t.columnIndex*r+"%",width:`calc(${r}% - 2px)`};if(o.backgroundColor){c["--co-cal-event-bg"]=o.backgroundColor;const t=$(this.rootEl,o.backgroundColor);t&&(c["--co-cal-event-text"]=t)}return e("button",{type:"button",key:`${o.id}-${t.dateKey}`,"data-event-id":o.id,"data-date":t.dateKey,class:{tg__event:!0,"tg__event--past":s,"tg__event--external":a,"tg__event--locked":n,"tg__event--dragging":this.dragId===o.id,"tg__event--tentative":"tentative"===o.responseState,"tg__event--cancelled":"cancelled"===o.responseState||"declined"===o.responseState},style:c,title:o.title,"aria-label":o.title,onClick:t=>{t.stopPropagation(),this.suppressNextClick?this.suppressNextClick=!1:this.coEventClick.emit({id:o.id,rect:t.currentTarget.getBoundingClientRect()})},onDblClick:t=>{t.stopPropagation(),this.coEventDblClick.emit({id:o.id,rect:t.currentTarget.getBoundingClientRect()})},onPointerDown:t=>{n||this.startMove(t,o.id)}},t.isStart&&e("span",{class:"tg__event-time"},function(t,i){const e=`${i}|${t}`,o=Z.get(e);if(void 0!==o)return o;let s=K.get(i);s||(s=new Intl.DateTimeFormat(i,{hour:"numeric",minute:"2-digit"}),K.set(i,s));const a=Math.floor(t/60),n=s.format(new Date(2e3,0,1,a,t%60));return Z.size>2e3&&Z.clear(),Z.set(e,n),n}(t.startMinutes,this.locale)),e("span",{class:"tg__event-title"},o.title||"—"),a&&(W(o)?e("co-provider-logo",{provider:W(o),size:11,plated:!0,class:"tg__event-ext"}):e("co-icon",{name:"link",size:11,class:"tg__event-ext"})),t.isEnd&&!n&&!1!==o.durationEditable&&e("span",{class:"tg__event-resize",onPointerDown:t=>this.startResize(t,o.id)}))}renderAllDayBar(t,i,o){const s=o.get(t.eventId);if(!s)return null;const a={left:t.startCol/i*100+"%",width:(t.endCol-t.startCol+1)/i*100+"%",top:22*t.lane+"px"};if(s.backgroundColor){a["--co-cal-event-bg"]=s.backgroundColor;const t=$(this.rootEl,s.backgroundColor);t&&(a["--co-cal-event-text"]=t)}return e("button",{type:"button",key:s.id,"data-event-id":s.id,class:{"tg__allday-bar":!0,"tg__allday-bar--continues-before":t.continuesBefore,"tg__allday-bar--continues-after":t.continuesAfter,"tg__allday-bar--tentative":"tentative"===s.responseState,"tg__allday-bar--cancelled":"cancelled"===s.responseState||"declined"===s.responseState},style:a,title:s.title,onClick:t=>{t.stopPropagation(),this.coEventClick.emit({id:s.id,rect:t.currentTarget.getBoundingClientRect()})},onDblClick:t=>{t.stopPropagation(),this.coEventDblClick.emit({id:s.id,rect:t.currentTarget.getBoundingClientRect()})}},s.title||"—")}getLayouts(t){const i=t.join(","),e=this.layoutCache;if(e&&e.events===this.events&&e.datesKey===i&&e.tz===this.timeZone&&e.minM===this.minM&&e.maxM===this.maxM)return e;const o=function(t,i,e){const o=e.minMinutes??0,s=e.maxMinutes??1440,a=new Set(i),n={},r={},c={};for(const t of i)n[t]=[],r[t]=[],c[t]=[];for(const n of t)if(n.allDay){const t=n.start.slice(0,10),e=n.end.slice(0,10);for(const o of i)o>=t&&o<e&&r[o].push(n)}else for(const t of k(n.start,n.end,e.timeZone)){if(!a.has(t.dateKey))continue;const i=m(t.startMinutes,o,s),e=m(t.endMinutes,o,s);e<=i||c[t.dateKey].push({event:n,startMinutes:i,endMinutes:e,isStart:t.isStart&&i===t.startMinutes,isEnd:t.isEnd&&e===t.endMinutes})}for(const t of i){const i=w(c[t],(t=>t.startMinutes),(t=>t.endMinutes));n[t]=i.map((i=>{const e=y(i.event.startMinutes,o,s),a=y(i.event.endMinutes,o,s);return{event:i.event.event,dateKey:t,startMinutes:i.event.startMinutes,endMinutes:i.event.endMinutes,topFraction:e,heightFraction:a-e,columnIndex:i.columnIndex,columnCount:i.columnCount,isStart:i.event.isStart,isEnd:i.event.isEnd}}))}return{timed:n,allDay:r}}(this.events,t,{timeZone:this.timeZone,minMinutes:this.minM,maxMinutes:this.maxM}),s=function(t,i,e={}){const o=z(t.filter((t=>t.allDay)),[i],e);return{segments:o.segments.map((t=>({eventId:t.eventId,lane:t.lane,startCol:t.startCol,endCol:t.endCol,isStart:t.isStart,isEnd:t.isEnd,continuesBefore:t.continuesBefore,continuesAfter:t.continuesAfter}))),overflow:o.overflow,laneCount:o.laneCount}}(this.events,t,{timeZone:this.timeZone}),a=new Map(this.events.map((t=>[t.id,t])));return this.layoutCache={events:this.events,datesKey:i,tz:this.timeZone,minM:this.minM,maxM:this.maxM,layout:o,allDay:s,byId:a},this.layoutCache}render(){const t=this.visibleDates(),{layout:i,allDay:o,byId:s}=this.getLayouts(t),a=u(this.locale,0,"short"),n=`repeat(${t.length}, 1fr)`,h=c(),d=`calc(${this.slotCount()} * var(--co-cal-slot-h))`,v={"--co-cal-hour-h":`calc(${60/this.slotM} * var(--co-cal-slot-h))`,"--co-cal-hour-offset":`calc(${(60-this.minM%60)%60/this.slotM} * var(--co-cal-slot-h))`};return e("div",{key:"55c583abdd12ac65d8188a8f9d4f0448e4fcf5b7",class:"tg",tabIndex:0,onKeyDown:this.handleKeyDown,ref:t=>this.rootEl=t},e("div",{key:"33fa43418fdff096918441e6a2fdbf1d647980ec",class:"tg__head"},e("div",{key:"2c4134daefc3cb99aa4965787c11318be9f27d40",class:"tg__head-spacer"}),e("div",{key:"0b6c10bbfb8b91723d62f05f1387d8c0513d7b09",class:"tg__head-days",style:{gridTemplateColumns:n}},t.map((t=>{const i=l(t),o=function(t){const[i,e,o]=t.split("-").map(Number);return new Date(Date.UTC(i,e-1,o)).getUTCDay()}(t);return e("div",{class:{"tg__head-day":!0,"tg__head-day--today":0===r(t,h)}},e("span",{class:"tg__head-dow"},a[o]),e("span",{class:"tg__head-num"},i.day))})))),this.allDaySlot&&e("div",{key:"ac00b1d478138334f6b265e7e7861dc910ea778e",class:"tg__allday"},e("div",{key:"52ea789daff3b284863e90fe2356b3f1f5ed8e75",class:"tg__allday-axis"},function(t,i){if(!t)return"";const e=`${t}|${null!=i?i:""}`,o=O.get(e);if(void 0!==o)return o;const s=function(t,i){var e,o;try{const s=new Date(`${null!=i?i:"2026-01-01"}T12:00:00Z`),a=null!==(o=null===(e=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"shortOffset"}).formatToParts(s).find((t=>"timeZoneName"===t.type)))||void 0===e?void 0:e.value)&&void 0!==o?o:"",n=a.match(/GMT([+-])(\d{1,2})(?::(\d{2}))?/);if(!n)return a;const r=n[2].padStart(2,"0");return n[3]?`GMT${n[1]}${r}:${n[3]}`:`GMT${n[1]}${r}`}catch(t){return""}}(t,i);return O.size>2e3&&O.clear(),O.set(e,s),s}(this.timeZone,t[0])),e("div",{key:"24e0a67773437bad42a3fb183cf55f53f2e04d0f",class:"tg__allday-lane",style:{height:22*Math.max(1,o.laneCount)+4+"px"}},o.segments.map((i=>this.renderAllDayBar(i,t.length,s))))),e("div",{key:"19ee69ba01bcd63d015acebba5001390324b1c93",class:"tg__scroll",ref:t=>this.scrollEl=t},e("div",{key:"644e0cae08a22795bfdaa802227c176e733dd418",class:"tg__body"},e("div",{key:"56a20d546083e0a0695c01a0910c80fdcaf56589",class:"tg__axis",style:{height:d}},this.hourList().map((t=>e("span",{class:"tg__axis-hour",style:{top:100*y(t,this.minM,this.maxM)+"%"}},function(t,i){const e=`${i}|${t}`,o=P.get(e);if(void 0!==o)return o;let s=G.get(i);s||(s=new Intl.DateTimeFormat(i,{hour:"numeric",hour12:!0}),G.set(i,s));const a=Math.floor(t/60),n=s.format(new Date(2e3,0,1,a,0));return P.size>2e3&&P.clear(),P.set(e,n),n}(t,this.locale))))),e("div",{key:"391004de33499561a0fdc75e3eabf401fb4e5561",class:"tg__cols",style:Object.assign({gridTemplateColumns:n,height:d},v)},t.map(((t,o)=>{var s;const a=0===r(t,h);return e("div",{class:{tg__col:!0,"tg__col--today":a},"data-col-date":t,onPointerDown:i=>this.startSelection(i,t,i.currentTarget),onPointerMove:t=>this.extendSelection(t,t.currentTarget)},this.loading?R[o%R.length].map((([t,i])=>e("div",{class:"tg__event-skeleton","aria-hidden":"true",style:{top:`${t}%`,height:`${i}%`}},e("co-skeleton",{variant:"rect",width:"100%",height:"100%"})))):(null!==(s=i.timed[t])&&void 0!==s?s:[]).map((t=>this.renderEventBox(t))),this.selDate===t&&this.renderSelectionGhost(),this.focusDate===t&&e("div",{class:"tg__focus",style:{top:100*y(this.focusMin,this.minM,this.maxM)+"%",height:100*(y(this.focusMin+this.slotMinutes,this.minM,this.maxM)-y(this.focusMin,this.minM,this.maxM))+"%"}}),this.nowIndicator&&this.nowDay===t&&this.nowMinutes>=this.minM&&this.nowMinutes<this.maxM&&e("div",{class:"tg__now",style:{top:100*y(this.nowMinutes,this.minM,this.maxM)+"%"}}))})),e("div",{class:"tg__drag-ghost",key:"tg-drag-ghost",ref:t=>this.ghostEl=t})))))}get el(){return o(this)}static get watchers(){return{events:[{onEventsChange:0}]}}};function j(t,i){const e=/^(\d{1,2}):(\d{2})$/.exec(t);return e?60*Number(e[1])+Number(e[2]):i}const Z=new Map,K=new Map,P=new Map,G=new Map,O=new Map,R=[[[26,8],[42,12]],[[30,14]],[[24,6],[38,9],[56,7]],[[34,11],[52,6]],[[28,9]],[[40,13],[60,8]],[[32,7],[46,10]]];function W(t){var i,e;const o=String(null!==(e=null===(i=t.extendedProps)||void 0===i?void 0:i.provider)&&void 0!==e?e:"").toLowerCase();return o.includes("google")?"google":o.includes("microsoft")||o.includes("outlook")?"microsoft":""}T.style=":host{display:flex;flex-direction:column;min-block-size:0;font-family:var(--co-font-family-primary);--co-cal-slot-h:12px;--co-cal-axis-w:56px;--co-cal-surface:var(--co-semantic-surface-page);--co-cal-border:var(--co-semantic-border-default);--co-cal-grid-line:color-mix(in srgb, var(--co-cal-border) 60%, transparent);--co-cal-text:var(--co-semantic-text-default);--co-cal-text-muted:var(--co-semantic-text-muted);--co-cal-hover:var(--co-semantic-surface-hover);--co-cal-today-ring:var(--co-color-primary-azul);--co-cal-now-color:var(--co-color-status-error, #AA2E1B);--co-cal-allday-h:28px;--co-cal-event-radius:6px;--co-cal-elevation-hover:var(--co-shadow-lg);--co-cal-event-bg:var(--co-color-primary-azul);--co-cal-event-border:transparent;--co-cal-event-text:var(--co-color-base-blanco, #fff);--co-cal-event-text-light:var(--co-color-base-blanco, #fff);--co-cal-event-text-dark:var(--co-color-base-negro, #1f1c1b)}.tg{display:flex;flex-direction:column;min-block-size:0;border-radius:var(--co-border-radius-xs);overflow:hidden;background:var(--co-cal-surface)}.tg__head{display:grid;grid-template-columns:var(--co-cal-axis-w) 1fr;border-bottom:1px solid var(--co-cal-border)}.tg__head-spacer{border-right:1px solid var(--co-cal-border)}.tg__head-days{display:grid}.tg__head-day{display:flex;flex-direction:column;align-items:center;gap:2px;padding:var(--co-spacing-xs)}.tg__head-dow{font-size:var(--co-font-size-11, 11px);text-transform:uppercase;letter-spacing:0.04em;color:var(--co-cal-text-muted)}.tg__head-num{font-size:var(--co-font-size-20, 20px);color:var(--co-cal-text);min-width:34px;height:34px;line-height:34px;text-align:center;border-radius:var(--co-border-radius-full)}.tg__head-day--today .tg__head-dow{color:var(--co-cal-today-ring)}.tg__head-day--today .tg__head-num{background:var(--co-cal-today-ring);color:var(--co-color-base-blanco, #fff);font-weight:500}.tg__allday{display:grid;grid-template-columns:var(--co-cal-axis-w) 1fr;min-height:var(--co-cal-allday-h);border-bottom:1px solid var(--co-cal-border)}.tg__allday-axis{border-right:1px solid var(--co-cal-border);font-size:var(--co-font-size-10, 10px);color:var(--co-cal-text-muted);padding:var(--co-spacing-xxs)}.tg__allday-lane{position:relative;min-height:var(--co-cal-allday-h);padding:2px 0}.tg__allday-bar{position:absolute;height:20px;box-sizing:border-box;padding:0 var(--co-spacing-xs);border:0;border-radius:var(--co-cal-event-radius);background:var(--co-cal-event-bg);color:var(--co-cal-event-text);font:500 var(--co-font-size-11, 11px)/20px var(--co-font-family-primary);text-align:left;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:pointer}.tg__allday-bar:hover{box-shadow:var(--co-cal-elevation-hover);z-index:2}.tg__allday-bar--continues-before{border-top-left-radius:0;border-bottom-left-radius:0}.tg__allday-bar--continues-after{border-top-right-radius:0;border-bottom-right-radius:0}.tg__allday-bar--tentative{background-image:repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.5) 0 4px, transparent 4px 8px)}.tg__allday-bar--cancelled{opacity:0.6;text-decoration:line-through}.tg__allday-bar:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:1px}.tg__scroll{flex:1 1 auto;min-block-size:0;overflow-y:auto}.tg__body{display:grid;grid-template-columns:var(--co-cal-axis-w) 1fr;position:relative}.tg__axis{border-right:1px solid var(--co-cal-border);position:relative}.tg__axis-hour{position:absolute;right:var(--co-spacing-xs);transform:translateY(-50%);font-size:var(--co-font-size-11, 11px);color:var(--co-cal-text-muted);white-space:nowrap}.tg__cols{display:grid;grid-auto-rows:100%;position:relative}.tg__col{position:relative;border-right:1px solid var(--co-cal-border);background-image:linear-gradient( to bottom, var(--co-cal-border) 0, var(--co-cal-border) 1px, transparent 1px );background-size:100% var(--co-cal-hour-h, calc(4 * var(--co-cal-slot-h)));background-position:0 var(--co-cal-hour-offset, 0px);background-repeat:repeat-y}.tg__col:last-child{border-right:0}.tg--interacting .tg__event{pointer-events:none}.tg--interacting .tg__col{contain:layout}.tg__event{position:absolute;user-select:none;-webkit-user-select:none;touch-action:none;box-sizing:border-box;border-radius:var(--co-cal-event-radius);background:var(--co-cal-event-bg);color:var(--co-cal-event-text);border:1px solid var(--co-cal-event-border);padding:2px var(--co-spacing-xs);font-size:var(--co-font-size-11, 11px);line-height:1.15;overflow:hidden;cursor:pointer;text-align:left}.tg__event-skeleton{position:absolute;inset-inline:0 2px;box-sizing:border-box;border-radius:var(--co-cal-event-radius);overflow:hidden;pointer-events:none}.tg__event-skeleton co-skeleton{display:block;block-size:100%}.tg__event:hover{box-shadow:var(--co-cal-elevation-hover);z-index:5}.tg__event--dragging:hover{box-shadow:none}.tg__event:focus-visible{outline:2px solid var(--co-semantic-border-focus);outline-offset:1px}.tg__event-time{display:block;font-variant-numeric:tabular-nums;opacity:0.85}.tg__event-title{display:block;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tg__event-ext{position:absolute;top:3px;right:3px;opacity:0.9}.tg__event--past{opacity:0.55}.tg__event--external{border-style:dashed}.tg__event--locked{cursor:default}.tg__event--dragging{opacity:0.5}.tg__event--tentative{background-image:repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.5) 0 4px, transparent 4px 8px)}.tg__event--cancelled{opacity:0.6}.tg__event--cancelled .tg__event-title{text-decoration:line-through}.tg__event-resize{position:absolute;left:0;right:0;bottom:0;height:6px;cursor:ns-resize}.tg__selection{position:absolute;left:0;right:0;box-sizing:border-box;z-index:2;background:color-mix(in srgb, var(--co-cal-today-ring) 22%, transparent);border:1px solid var(--co-cal-today-ring);border-radius:var(--co-border-radius-xxs);pointer-events:none}.tg__drag-ghost{position:absolute;display:none;box-sizing:border-box;z-index:4;pointer-events:none;background:color-mix(in srgb, var(--co-cal-today-ring) 22%, transparent);border:1px solid var(--co-cal-today-ring);border-radius:var(--co-border-radius-xxs);will-change:transform}.tg__focus{position:absolute;left:0;right:0;z-index:1;pointer-events:none;box-sizing:border-box;outline:2px solid var(--co-semantic-border-focus);outline-offset:-2px;border-radius:var(--co-border-radius-xxs)}.tg__now{position:absolute;left:0;right:0;height:0;z-index:3;pointer-events:none}.tg__now::before{content:'';position:absolute;left:-4px;top:-4px;width:8px;height:8px;border-radius:50%;background:var(--co-cal-now-color)}.tg__now::after{content:'';position:absolute;left:0;right:0;top:0;border-top:2px solid var(--co-cal-now-color)}";export{I as co_calendar_month,T as co_calendar_timegrid}
@@ -1 +1 @@
1
- import{r as a,h as o}from"./p-YRicbXh3.js";const r=class{constructor(o){a(this,o),this.variant="default",this.size="md",this.rounded=!1}render(){return o("div",{key:"3573a493f29f3a1b4b4d95b23f221e842b41cea6",class:{"co-navbar":!0,[`co-navbar--${this.variant}`]:!0,[`co-navbar--${this.size}`]:!0,"co-navbar--rounded":this.rounded},part:"navbar",role:"toolbar"},o("slot",{key:"e4f46072826161cf3e8525e0dced7f0050b42d1b"}))}};r.style=":host{display:block}.co-navbar{display:flex;align-items:center;justify-content:space-between;width:100%;font-family:var(--co-font-family-primary);box-sizing:border-box;background:var(--co-navbar-bg);color:var(--co-navbar-color)}.co-navbar--default{--co-navbar-bg:transparent}.co-navbar--filled{--co-navbar-bg:var(--co-semantic-surface-primary, #1f1c1b);--co-navbar-color:var(--co-semantic-on-primary, #fff)}.co-navbar--bordered{--co-navbar-bg:var(--co-semantic-surface-page, #fff);--co-navbar-color:inherit;border-bottom:1px solid var(--co-semantic-border-subtle, rgba(31,28,27,0.08))}.co-navbar--dark{--co-navbar-bg:var(--co-theme-navbar-bg, var(--co-color-base-negro, #1F1C1B));--co-navbar-color:var(--co-theme-on-navbar, #fff);--co-icon-button-bg:var(--co-theme-on-navbar-surface, var(--co-color-opacity-blanco-16, rgba(255,255,255,0.16)));--co-icon-button-color:var(--co-theme-on-navbar, #fff);--co-icon-button-border:transparent}.co-navbar--rounded{border-radius:var(--co-border-radius-sm, 12px);overflow:hidden}.co-navbar--sm{min-height:40px;padding:0 var(--co-navbar-padding-x, var(--co-spacing-md, 12px));gap:var(--co-spacing-sm2, 8px);font-size:var(--co-font-size-12, 12px)}.co-navbar--md{min-height:48px;padding:0 var(--co-navbar-padding-x, var(--co-spacing-lg, 16px));gap:var(--co-spacing-md, 12px);font-size:var(--co-font-size-14, 14px)}.co-navbar--lg{min-height:56px;padding:0 var(--co-navbar-padding-x-end, var(--co-spacing-2xl, 24px)) 0 var(--co-navbar-padding-x-start, var(--co-spacing-md, 12px));gap:var(--co-spacing-sm2, 8px);font-size:var(--co-font-size-14, 14px)}::slotted([slot-spacer]),::slotted(.co-spacer){flex:1}";export{r as co_navbar}
1
+ import{r as a,h as o}from"./p-DJkaRtbb.js";const r=class{constructor(o){a(this,o),this.variant="default",this.size="md",this.rounded=!1}render(){return o("div",{key:"3573a493f29f3a1b4b4d95b23f221e842b41cea6",class:{"co-navbar":!0,[`co-navbar--${this.variant}`]:!0,[`co-navbar--${this.size}`]:!0,"co-navbar--rounded":this.rounded},part:"navbar",role:"toolbar"},o("slot",{key:"e4f46072826161cf3e8525e0dced7f0050b42d1b"}))}};r.style=":host{display:block}.co-navbar{display:flex;align-items:center;justify-content:space-between;width:100%;font-family:var(--co-font-family-primary);box-sizing:border-box;background:var(--co-navbar-bg);color:var(--co-navbar-color)}.co-navbar--default{--co-navbar-bg:transparent}.co-navbar--filled{--co-navbar-bg:var(--co-semantic-surface-primary, #1f1c1b);--co-navbar-color:var(--co-semantic-on-primary, #fff)}.co-navbar--bordered{--co-navbar-bg:var(--co-semantic-surface-page, #fff);--co-navbar-color:inherit;border-bottom:1px solid var(--co-semantic-border-subtle, rgba(31,28,27,0.08))}.co-navbar--dark{--co-navbar-bg:var(--co-theme-navbar-bg, var(--co-color-base-negro, #1F1C1B));--co-navbar-color:var(--co-theme-on-navbar, #fff);--co-icon-button-bg:var(--co-theme-on-navbar-surface, var(--co-color-opacity-blanco-16, rgba(255,255,255,0.16)));--co-icon-button-color:var(--co-theme-on-navbar, #fff);--co-icon-button-border:transparent}.co-navbar--rounded{border-radius:var(--co-border-radius-sm, 12px);overflow:hidden}.co-navbar--sm{min-height:40px;padding:0 var(--co-navbar-padding-x, var(--co-spacing-md, 12px));gap:var(--co-spacing-sm2, 8px);font-size:var(--co-font-size-12, 12px)}.co-navbar--md{min-height:48px;padding:0 var(--co-navbar-padding-x, var(--co-spacing-lg, 16px));gap:var(--co-spacing-md, 12px);font-size:var(--co-font-size-14, 14px)}.co-navbar--lg{min-height:56px;padding:0 var(--co-navbar-padding-x-end, var(--co-spacing-2xl, 24px)) 0 var(--co-navbar-padding-x-start, var(--co-spacing-md, 12px));gap:var(--co-spacing-sm2, 8px);font-size:var(--co-font-size-14, 14px)}::slotted([slot-spacer]),::slotted(.co-spacer){flex:1}";export{r as co_navbar}
@@ -1 +1 @@
1
- import{r as t,c as i,f as o,h as e,H as s,a as r}from"./p-YRicbXh3.js";import{g as a}from"./p-EtYK1iGx.js";import{b as c,s as n}from"./p-BmdKHBZP.js";import{B as d,F as h,E as l,w as u,r as g,Q as p,s as b,q as m,x as v,z as f,W as _,I as x,P as y,G as w}from"./p-CqQobidl.js";import"./p-B2QLgWrz.js";const k={top:38,right:38,bottom:38,left:38},z=new Set(["letter","a4","legal"]);function C(t){if("string"==typeof t){if(z.has(t))return t;try{return C(JSON.parse(t))}catch(t){return"letter"}}if(t&&"object"==typeof t){const{width:i,height:o}=t;if(Number(i)>0&&Number(o)>0)return{width:Number(i),height:Number(o)}}return"letter"}const $=/@(import|charset|namespace)[^;]*;/gi;function S(t,i){return t?H(t.replace(/\/\*[\s\S]*?\*\//g,"").replace($,""),i).trim():""}function P(t,i){let o=0,e=null;for(let s=i;s<t.length;s+=1){const i=t[s];if(e)i===e&&"\\"!==t[s-1]&&(e=null);else if('"'===i||"'"===i)e=i;else if("{"===i)o+=1;else if("}"===i&&(o-=1,0===o))return s}return-1}function M(t,i){const o=t.trim();if(!o)return"";const e=`:where(${i})`;if("*"===o)return`${e}, ${e} *, ${e} :is(pre, code)`;const s=o.replace(/^(?:(?:html|body|:root)(?=$|[\s>+~.#:[])\s*)+/i,"").trim();return s?`${e} ${s}`:e}function H(t,i){let o="",e=0;for(;e<t.length;){const s=t.indexOf("{",e);if(-1===s)break;const r=P(t,s);if(-1===r)break;const a=t.slice(e,s).trim(),c=t.slice(s+1,r);if(e=r+1,!a)continue;if(a.startsWith("@")){const t=a.slice(1).split(/[\s(]/)[0].toLowerCase();"media"===t||"supports"===t?o+=`${a}{${H(c,i)}}`:t.endsWith("keyframes")&&(o+=`${a}{${c}}`);continue}const n=a.split(",").map((t=>M(t,i))).filter(Boolean);n.length&&(o+=`${n.join(", ")}{${c}}`)}return o}function N(t){return Number.isFinite(t)?Math.round(1e3*Math.min(3,Math.max(.25,t)))/1e3:1}function j(t,i,o){return o>0?(t-i)/o:0}function E(t,i,o,e){return t+i*o-e}const O={inline:"image-square","wrap-left":"text-align-left","wrap-right":"text-align-right",break:"rows"},I={width:124,height:34};function B(t,i,o=I,e=4){const s=t.top+t.height+e,r=t.top-e-o.height;let a=s,c="below";i.height>0&&s+o.height>i.height&&(r>=0?(a=r,c="above"):(a=Math.max(0,Math.min(t.top+t.height-e-o.height,i.height-o.height)),c="inside"));let n=t.left;return i.width>0&&(n=Math.max(0,Math.min(n,i.width-o.width))),{top:a,left:n,placement:c}}function L(t,i){let o=0,e=t;for(;e&&e!==i;)o+=e.offsetLeft,e=e.offsetParent;return o}const F={width:255,height:34};let G=0;const R=class{constructor(o){t(this,o),this.coChange=i(this,"coChange",3),this.coFieldsChange=i(this,"coFieldsChange",3),this.coHeaderChange=i(this,"coHeaderChange",3),this.coPagesChange=i(this,"coPagesChange",3),this.coAction=i(this,"coAction",3),this.coReady=i(this,"coReady",3),this.value=null,this.headerHtml="",this.showPageNumber=!1,this.pageSize="letter",this.headerHeight=45,this.pageStyles="",this.readonly=!1,this.locale="en",this.ready=!1,this.pageCount=1,this.zoomMode="fit",this.scale=1,this.stageHeight=0,this.headerEditing=!1,this.draftShowPageNumber=!1,this.imageBar=null,this.signatureBar=null,this.currentHeaderHtml="",this.currentShowPageNumber=!1,this.headerDoc=null,this.instanceId=String(++G),this.applyingExternal=!1,this.lastAppliedValue=null,this.userDirty=!1,this.lastFieldsKey="",this.pendingImageSrcs=new Set,this.changeThrottle=function(t,i){let o=null;return{run(){o||(o=setTimeout((()=>{o=null,i()}),250))},flush(){o&&(clearTimeout(o),o=null,i())},cancel(){o&&clearTimeout(o),o=null},get pending(){return null!==o}}}(0,(()=>this.emitPendingChange())),this.updateImageBar=()=>{const t=this.editor,i=null==t?void 0:t.state.selection,o=null==i?void 0:i.node;if(!t||this.readonly||!o||"image"!==o.type.name)return void(this.imageBar&&(this.imageBar=null));const e=t.view.nodeDOM(i.from),s=this.el.querySelector(".co-doc-editor__sheet");if(!e||!s)return void(this.imageBar&&(this.imageBar=null));const r=w(e,s),a=B({top:r.top,height:r.height,left:L(e,s)},{width:s.offsetWidth,height:s.offsetHeight}),c=d({wrapperStyle:o.attrs.wrapperStyle,containerStyle:o.attrs.containerStyle}),n=this.imageBar;n&&n.mode===c&&n.top===a.top&&n.left===a.left||(this.imageBar={mode:c,top:a.top,left:a.left})},this.updateSignatureBar=()=>{const t=this.editor,i=null==t?void 0:t.state.selection,o=null==i?void 0:i.node;if(!t||this.readonly||!o||"signatureSlot"!==o.type.name)return void(this.signatureBar&&(this.signatureBar=null));const e=t.view.nodeDOM(i.from),s=this.el.querySelector(".co-doc-editor__sheet");if(!e||!s)return void(this.signatureBar&&(this.signatureBar=null));const r=[];t.state.doc.descendants(((t,o)=>{"signatureSlot"===t.type.name&&o!==i.from&&r.push(t.attrs.slot)}));const{min:a,max:c}=function(t){let i=0;for(const o of t)o>i&&(i=o);return{min:1,max:i+1}}(r),n=w(e,s),d=B({top:n.top,height:n.height,left:L(e,s)},{width:s.offsetWidth,height:s.offsetHeight},F),h=o.attrs.slot,l=this.signatureBar;l&&l.slot===h&&l.min===a&&l.max===c&&l.top===d.top&&l.left===d.left||(this.signatureBar={slot:h,min:a,max:c,top:d.top,left:d.left})},this.onBodyImageLoad=t=>{const i=t.target,o=this.editor;if(!o||!i||"IMG"!==i.tagName)return;const e=i.getAttribute("src")||"";if(!this.pendingImageSrcs.has(e))return;let s=-1;o.state.doc.descendants(((t,i)=>!(s>=0||("image"!==t.type.name||t.attrs.width||t.attrs.src!==e||(s=i),0))));const r=s>=0?o.state.doc.nodeAt(s):null;if(!r)return;const a=this.marginsPx,c=function(t,i){const o=t>0?t:0,e=i>0?i:0,s=o&&e?Math.min(o,e):o||e;return s?Math.max(1,Math.round(s)):null}(i.naturalWidth,this.pageSizePx.width-a.left-a.right);if(!c)return;let n=!1;o.state.doc.descendants(((t,i)=>(i===s||"image"!==t.type.name||t.attrs.width||t.attrs.src!==e||(n=!0),!n))),n||this.pendingImageSrcs.delete(e);const d=o.state.selection.node&&o.state.selection.from===s;o.view.dispatch(o.state.tr.setNodeMarkup(s,void 0,Object.assign(Object.assign({},r.attrs),{width:c}))),d&&o.commands.setNodeSelection(s)},this.onEditorBlur=()=>{this.changeThrottle.flush()},this.onHostKeydown=t=>{"Escape"===t.key&&this.changeThrottle.flush()},this.onTransaction=({transaction:t})=>{t.docChanged&&(this.applyingExternal||!!t.getMeta(h)||(this.userDirty=!0,this.trackInsertedImages(t)),this.changeThrottle.run())},this.handleToolbarAction=t=>{t.stopPropagation();const{action:i,payload:o}=t.detail||{};o&&!0===o.extra?this.coAction.emit({action:i,payload:{extra:!0}}):"documentHeader"===i&&this.startHeaderEdit()},this.startHeaderEdit=()=>{this.readonly||this.headerEditing||!this.editor||(this.draftShowPageNumber=this.currentShowPageNumber,this.headerEditing=!0,this.refreshPagination())},this.onHeaderTransaction=({transaction:t})=>{t.docChanged&&this.changeThrottle.run()},this.onHeaderImageLoad=t=>{const i=t.target,o=this.headerEditor;if(!o||!i||"IMG"!==i.tagName)return;const e=l({w:i.naturalWidth,h:i.naturalHeight});if(!e)return;let s=-1;try{const t=o.view.posAtDOM(i,0),e=o.state.doc.nodeAt(t);e&&"image"===e.type.name&&(s=t)}catch(t){}if(s<0){const t=i.getAttribute("src");o.state.doc.descendants(((i,o)=>!(s>=0||("image"!==i.type.name||i.attrs.width||i.attrs.src!==t||(s=o),0))))}const r=s>=0?o.state.doc.nodeAt(s):null;r&&!r.attrs.width&&o.view.dispatch(o.state.tr.setNodeMarkup(s,void 0,Object.assign(Object.assign({},r.attrs),{width:e})))},this.onDocumentPointer=t=>{const i=t.composedPath();this.headerBandEl&&i.includes(this.headerBandEl)||this.toolbarEl&&i.includes(this.toolbarEl)||this.commitHeader()},this.onHeaderKeydown=t=>{var i;if("Escape"!==t.key||t.isComposing)return;const o=this.toolbarEl;o&&t.currentTarget===o&&(null===(i=o.shadowRoot)||void 0===i?void 0:i.querySelector('[aria-expanded="true"]'))||(t.preventDefault(),t.stopPropagation(),this.cancelHeader(!0))},this.commitHeader=(t=!1)=>{var i;const o=this.headerEditor;if(!o)return;const e=t&&this.focusIsInBandOrLost(),s=o.isEmpty?"":u(o.state.doc,"print-header",this.resolvedFeatures),r=this.draftShowPageNumber;this.teardownHeaderEditor(),this.currentHeaderHtml=s,this.currentShowPageNumber=r,this.headerDoc=s?g(s,"print-header",this.resolvedFeatures):null,this.headerEditing=!1,this.refreshPagination(),this.coHeaderChange.emit({html:s,showPageNumber:r}),this.emitFieldsIfChanged(),e&&(null===(i=this.editor)||void 0===i||i.commands.focus())},this.cancelHeader=(t=!1)=>{var i;this.headerEditing&&(this.teardownHeaderEditor(),this.headerEditing=!1,this.refreshPagination(),this.emitFieldsIfChanged(),t&&(null===(i=this.editor)||void 0===i||i.commands.focus()))},this.renderedScale=1,this.onCanvasWheel=t=>{var i,o;(t.ctrlKey||t.metaKey)&&(t.preventDefault(),this.zoomTo((i=this.scale,o=1===t.deltaMode?16*t.deltaY:t.deltaY,Number.isFinite(o)?N(i*Math.exp(.01*-o)):i),t.clientX,t.clientY))},this.gestureBase=1,this.onGestureStart=t=>{t.preventDefault(),this.gestureBase=this.scale},this.onGestureChange=t=>{var i,o,e,s;t.preventDefault();const r=null===(i=this.canvasEl)||void 0===i?void 0:i.getBoundingClientRect(),a=null!==(o=t.clientX)&&void 0!==o?o:r?r.left+r.width/2:0,c=null!==(e=t.clientY)&&void 0!==e?e:r?r.top+r.height/2:0;this.zoomTo(N(this.gestureBase*(null!==(s=t.scale)&&void 0!==s?s:1)),a,c)}}get s(){return a(this.locale)}get resolvedFeatures(){var t;return null!==(t=c(this.features))&&void 0!==t?t:{}}get parsedExtraItems(){const t=c(this.extraItems);return Array.isArray(t)?t:[]}get pageSizePx(){return p(C(this.pageSize))}get marginsPx(){return function(t){let i=t;if("string"==typeof t)try{i=JSON.parse(t)}catch(t){return Object.assign({},k)}if(!i||"object"!=typeof i)return Object.assign({},k);const o=i,e=t=>Number.isFinite(Number(o[t]))&&void 0!==o[t]?Number(o[t]):k[t];return{top:e("top"),right:e("right"),bottom:e("bottom"),left:e("left")}}(this.margins)}get hasHeader(){return!!this.currentHeaderHtml||this.headerEditing}get sanitizedHeaderHtml(){return b(this.currentHeaderHtml,"print-header")}get pageScope(){return`.co-doc-editor__sheet[data-co-doc="${this.instanceId}"]`}get activeEditor(){var t;return null!==(t=this.headerEditor)&&void 0!==t?t:this.editor}get documentHeaderEnabled(){return!this.readonly&&!this.headerEditing}buildCustomExtensions(){return[m.configure({page:this.pageSizePx,margins:this.marginsPx,header:{height:this.hasHeader?this.headerHeight:0},footer:{height:0},renderHeader:(t,i)=>this.buildHeaderClone(t,i),onPagesChange:t=>{this.pageCount=t,this.coPagesChange.emit(t)}})]}collectAllFields(){if(!this.editor)return[];const t=v(this.editor.state.doc),i=this.headerEditor?this.headerEditor.state.doc:this.headerDoc;return i&&v(i,t),t}connectedCallback(){this.el.addEventListener("keydown",this.onHostKeydown,!0)}componentWillLoad(){this.ready=!1,this.pageCount=1,this.zoomMode="fit",this.scale=1,this.stageHeight=0,this.headerEditing=!1,this.draftShowPageNumber=!1,this.imageBar=null,this.signatureBar=null}componentDidLoad(){var t,i,o;this.contentEl&&(this.syncHeaderFromProps(),this.editor=f({preset:"print",element:this.contentEl,content:this.value?this.parseBody(this.value):null,editable:!this.readonly,features:this.resolvedFeatures,labels:{signature:t=>`${this.s.signature} ${t}`,fieldName:this.s.fieldNamePlaceholder},customExtensions:this.buildCustomExtensions(),imageUpload:this.imageUpload}),this.lastAppliedValue=this.value,this.wireEditor(this.editor),this.applyPageStyles(),"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver((()=>this.updateScale())),this.canvasEl&&this.resizeObserver.observe(this.canvasEl),this.stageEl&&this.resizeObserver.observe(this.stageEl)),null===(t=this.canvasEl)||void 0===t||t.addEventListener("wheel",this.onCanvasWheel,{passive:!1}),null===(i=this.canvasEl)||void 0===i||i.addEventListener("gesturestart",this.onGestureStart),null===(o=this.canvasEl)||void 0===o||o.addEventListener("gesturechange",this.onGestureChange),this.updateScale(),this.syncToolbar(),this.ready=!0,this.emitFieldsIfChanged(),this.coReady.emit())}componentDidRender(){this.applyPendingAnchor(),this.headerEditing&&!this.headerEditor&&this.headerMountEl&&this.mountHeaderEditor(),this.syncToolbar()}disconnectedCallback(){var t,i,o,e;this.el.removeEventListener("keydown",this.onHostKeydown,!0),this.changeThrottle.cancel(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),this.resizeObserver=void 0,null===(i=this.canvasEl)||void 0===i||i.removeEventListener("wheel",this.onCanvasWheel),null===(o=this.canvasEl)||void 0===o||o.removeEventListener("gesturestart",this.onGestureStart),null===(e=this.canvasEl)||void 0===e||e.removeEventListener("gesturechange",this.onGestureChange),this.toolbarEl&&(this.toolbarEl.editor=void 0),this.teardownHeaderEditor(!1),this.headerEditing=!1,this.editor&&(this.editor.off("transaction",this.onTransaction),this.editor.off("blur",this.onEditorBlur),this.editor.off("transaction",this.updateImageBar),this.editor.off("transaction",this.updateSignatureBar),this.editor.view.dom.removeEventListener("load",this.onBodyImageLoad,!0),this.editor.destroy()),this.editor=void 0,this.pendingImageSrcs.clear(),this.imageBar=null,this.signatureBar=null}onValueChange(t){t!==this.lastAppliedValue&&(this.editor&&t&&t===u(this.editor.state.doc,"print",this.resolvedFeatures)?this.lastAppliedValue=t:this.applyBody(t))}onReadonlyChange(){var t;null===(t=this.editor)||void 0===t||t.setEditable(!this.readonly),this.readonly&&this.headerEditing&&this.cancelHeader(),this.updateImageBar(),this.updateSignatureBar()}onPageGeometryChange(){this.refreshPagination(),this.updateScale()}onHeaderPropsChange(){this.headerEditing||(this.syncHeaderFromProps(),this.refreshPagination(),this.emitFieldsIfChanged())}onPageStylesChange(){this.applyPageStyles()}onLabelChange(){this.editor&&this.editor.view.dom.setAttribute("aria-label",this.label||this.s.documentEditor)}onLocaleChange(){this.currentShowPageNumber&&this.refreshPagination()}async getPrintHtml(){return this.editor?u(this.editor.state.doc,"print",this.resolvedFeatures):""}async getHeaderHtml(){return this.currentHeaderHtml}async getJSON(){return this.editor?this.editor.getJSON():null}async flushChange(){this.changeThrottle.flush()}async isEmpty(){return!this.editor||this.editor.isEmpty}async setContent(t){this.applyBody(t)}async setFieldValues(t){var i,e;if(null===(i=this.editor)||void 0===i||i.commands.setFieldValues(t),null===(e=this.headerEditor)||void 0===e||e.commands.setFieldValues(t),!this.currentHeaderHtml)return;const s=_(this.currentHeaderHtml,t,"print-header",this.resolvedFeatures);s!==this.currentHeaderHtml&&(this.currentHeaderHtml=s,this.headerDoc=g(s,"print-header",this.resolvedFeatures),this.headerEditing||(this.refreshPagination(),o(this)))}async insertField(t,i){var o;null===(o=this.editor)||void 0===o||o.chain().focus().insertField(t,i).run()}async insertSignatureSlot(){var t;null===(t=this.editor)||void 0===t||t.chain().focus().insertSignatureSlot().run()}async focusEditor(){var t;null===(t=this.editor)||void 0===t||t.commands.focus()}async getEditorInstance(){var t;return null!==(t=this.editor)&&void 0!==t?t:null}wireEditor(t){const i=t.view.dom;i.classList.add("tiptap"),i.setAttribute("aria-label",this.label||this.s.documentEditor),i.setAttribute("aria-multiline","true"),t.on("transaction",this.onTransaction),t.on("transaction",this.updateImageBar),t.on("transaction",this.updateSignatureBar),t.on("blur",this.onEditorBlur),i.addEventListener("load",this.onBodyImageLoad,!0)}imageModeLabel(t){const i=this.s;return{inline:i.imageLayoutInline,"wrap-left":i.imageLayoutWrapLeft,"wrap-right":i.imageLayoutWrapRight,break:i.imageLayoutBreak}[t]}setImageMode(t){var i;null===(i=this.editor)||void 0===i||i.commands.setImageLayoutMode(t),this.updateImageBar()}duplicateSignature(){var t;null===(t=this.editor)||void 0===t||t.commands.duplicateSignatureSlot(),this.updateSignatureBar()}stepSigner(t){var i;const o=this.signatureBar;if(!o)return;const e=o.slot+t;e<o.min||e>o.max||(null===(i=this.editor)||void 0===i||i.commands.setSignatureSlot(e),this.updateSignatureBar())}trackInsertedImages(t){var i,o,e;if(t.getMeta("history$"))return;const s=[];for(const r of t.steps)null===(e=null===(o=null===(i=r.slice)||void 0===i?void 0:i.content)||void 0===o?void 0:o.descendants)||void 0===e||e.call(o,(t=>{"image"===t.type.name&&!t.attrs.width&&t.attrs.src&&s.push(t.attrs.src)}));if(!s.length)return;const r=new Set;t.before.descendants((t=>{"image"!==t.type.name||t.attrs.width||r.add(t.attrs.src)})),s.forEach((t=>{r.has(t)||this.pendingImageSrcs.add(t)}))}parseBody(t){const i=t.trim();if(i.startsWith("{"))try{return JSON.parse(i)}catch(t){}return g(t,"print",this.resolvedFeatures)}applyBody(t){if(this.editor){this.pendingImageSrcs.clear(),this.applyingExternal=!0;try{t?this.editor.commands.setContent(this.parseBody(t),{emitUpdate:!1}):this.editor.commands.clearContent(!1)}finally{this.applyingExternal=!1,this.lastAppliedValue=t}}}emitPendingChange(){this.editor&&(this.emitFieldsIfChanged(),this.userDirty&&(this.userDirty=!1,this.coChange.emit()))}emitFieldsIfChanged(){const t=this.collectAllFields(),i=JSON.stringify(t);i!==this.lastFieldsKey&&(this.lastFieldsKey=i,this.coFieldsChange.emit(t))}syncToolbar(){n(this.toolbarEl,this.activeEditor,this.imageUpload)}syncHeaderFromProps(){var t;this.currentHeaderHtml=this.headerHtml||"",this.currentShowPageNumber=!0===(t=this.showPageNumber)||"true"===t,this.headerDoc=this.currentHeaderHtml?g(this.currentHeaderHtml,"print-header",this.resolvedFeatures):null}mountHeaderEditor(){var t,i;const o=f({preset:"print-header",element:this.headerMountEl,content:this.currentHeaderHtml?g(this.currentHeaderHtml,"print-header",this.resolvedFeatures):null,editable:!0,features:{fields:this.resolvedFeatures.fields},labels:{fieldName:this.s.fieldNamePlaceholder},imageUpload:this.imageUpload});this.headerEditor=o;const e=o.view.dom;e.classList.add("tiptap"),e.setAttribute("aria-label",this.s.documentHeader),o.on("transaction",this.onHeaderTransaction),e.addEventListener("load",this.onHeaderImageLoad,!0),document.addEventListener("mousedown",this.onDocumentPointer,!0),null===(t=this.headerBandEl)||void 0===t||t.addEventListener("keydown",this.onHeaderKeydown,!0),null===(i=this.toolbarEl)||void 0===i||i.addEventListener("keydown",this.onHeaderKeydown,!0),o.commands.focus("end"),this.syncToolbar()}teardownHeaderEditor(t=!0){var i,o;document.removeEventListener("mousedown",this.onDocumentPointer,!0),null===(i=this.headerBandEl)||void 0===i||i.removeEventListener("keydown",this.onHeaderKeydown,!0),null===(o=this.toolbarEl)||void 0===o||o.removeEventListener("keydown",this.onHeaderKeydown,!0);const e=this.headerEditor;this.headerEditor=void 0,t?this.syncToolbar():this.toolbarEl&&e&&this.toolbarEl.editor===e&&(this.toolbarEl.editor=void 0),e&&(e.off("transaction",this.onHeaderTransaction),e.view.dom.removeEventListener("load",this.onHeaderImageLoad,!0),e.destroy())}focusIsInBandOrLost(){const t=document.activeElement;return!t||t===document.body||!(!this.headerBandEl||!this.headerBandEl.contains(t))}refreshPagination(){var t;null===(t=this.editor)||void 0===t||t.commands.setPaginationOptions({page:this.pageSizePx,margins:this.marginsPx,header:{height:this.hasHeader?this.headerHeight:0}})}applyPageStyles(){this.styleEl&&(this.styleEl.textContent=S(this.pageStyles,this.pageScope))}buildHeaderClone(t,i){if(!this.currentHeaderHtml)return null;const o=document.createElement("div");o.className="co-doc-editor__header-static",o.style.height=`${this.headerHeight}px`;const e=document.createElement("div");if(e.className="co-doc-editor__header-html",e.innerHTML=this.sanitizedHeaderHtml,o.appendChild(e),this.currentShowPageNumber){const e=document.createElement("span");e.className="co-doc-editor__page-number",e.textContent=`${this.s.page} ${t} / ${i}`,o.appendChild(e)}return o}updateScale(){var t,i,o,e;if("custom"!==this.zoomMode){const o="actual"===this.zoomMode?1:function(t,i){if(!(t>0&&i>0))return 1;const o=Math.min(1,Math.max(.25,t/i));return Math.round(1e3*o)/1e3}((null!==(i=null===(t=this.canvasEl)||void 0===t?void 0:t.clientWidth)&&void 0!==i?i:0)-32,this.pageSizePx.width);o!==this.scale&&(this.scale=o)}const s=null!==(e=null===(o=this.stageEl)||void 0===o?void 0:o.offsetHeight)&&void 0!==e?e:0;s!==this.stageHeight&&(this.stageHeight=s)}zoomTo(t,i,o){if(this.canvasEl&&this.stageEl&&t!==this.scale){if(this.pendingAnchor)this.pendingAnchor.cx=i,this.pendingAnchor.cy=o;else{const t=this.stageEl.getBoundingClientRect();this.pendingAnchor={px:j(i,t.left,this.renderedScale),py:j(o,t.top,this.renderedScale),cx:i,cy:o}}this.zoomMode="custom",this.scale=t}}applyPendingAnchor(){const t=this.pendingAnchor,i=this.canvasEl;if(this.renderedScale=this.scale,!t||!i||!this.stageEl)return;this.pendingAnchor=void 0;const o=this.stageEl.getBoundingClientRect();i.scrollLeft+=E(o.left,t.px,this.scale,t.cx),i.scrollTop+=E(o.top,t.py,this.scale,t.cy)}setZoom(t){this.zoomMode=t,this.updateScale()}renderHeaderBand(){const t=this.s;return e("div",{key:"header-band",class:{"co-doc-editor__header-band":!0,"co-doc-editor__header-band--editing":this.headerEditing},part:"header-band",hidden:!this.hasHeader,ref:t=>this.headerBandEl=t,onDblClick:()=>this.startHeaderEdit()},this.headerEditing?e("div",{key:"header-editing",class:"co-doc-editor__header-editing"},e("div",{class:"co-doc-editor__header-editor",ref:t=>this.headerMountEl=t}),e("div",{class:"co-doc-editor__header-tools"},e("co-switch",{checked:this.draftShowPageNumber,label:t.pageNumber,disabled:!1,required:!1,status:"default",onCoChange:t=>{t.stopPropagation(),this.draftShowPageNumber=!!t.detail}}),e("co-tooltip",{content:t.confirmHeader},e("co-icon-button",{icon:"check",variant:"ghost",size:"xs",boxSize:28,iconSize:16,label:t.confirmHeader,onClick:()=>this.commitHeader(!0)})))):e("div",{key:"header-static",class:"co-doc-editor__header-static"},e("div",{class:"co-doc-editor__header-html",innerHTML:this.sanitizedHeaderHtml}),this.currentShowPageNumber&&e("span",{class:"co-doc-editor__page-number"},`${t.page} 1 / ${this.pageCount}`)))}renderOverlays(){return this.readonly||this.headerEditing?null:[this.renderImageBar(),this.renderSignatureBar()]}renderSignatureBar(){const t=this.signatureBar;if(!t)return null;const i=this.s,o=(t,i,o,s,r)=>e("co-tooltip",{key:t,content:i},e("button",{type:"button",class:"co-doc-editor__sig-step","data-dir":t,"aria-label":i,disabled:r,onClick:()=>this.stepSigner(s)},e("co-icon",{name:o,size:16,"aria-hidden":"true"})));return e("div",{key:"signature-bar",class:"co-doc-editor__sig-bar",role:"toolbar","aria-label":i.signatureToolsLabel,style:{top:`${t.top}px`,left:`${t.left}px`},onMouseDown:t=>t.preventDefault()},e("button",{key:"duplicate",type:"button",class:"co-doc-editor__sig-duplicate",onClick:()=>this.duplicateSignature()},e("co-icon",{name:"copy",size:16,"aria-hidden":"true"}),e("span",{class:"co-doc-editor__sig-duplicate-text"},i.signatureDuplicate)),e("span",{key:"sep",class:"co-doc-editor__sig-sep","aria-hidden":"true"}),o("prev",i.signaturePrevSigner,"caret-left",-1,t.slot<=t.min),e("span",{key:"label",class:"co-doc-editor__sig-label","aria-live":"polite"},`${i.signature} ${t.slot}`),o("next",i.signatureNextSigner,"caret-right",1,t.slot>=t.max))}renderImageBar(){const t=this.imageBar;return t?e("div",{key:"image-bar",class:"co-doc-editor__image-bar",role:"toolbar","aria-label":this.s.imageLayoutLabel,style:{top:`${t.top}px`,left:`${t.left}px`},onMouseDown:t=>t.preventDefault()},x.map((i=>{const o=this.imageModeLabel(i),s=t.mode===i;return e("co-tooltip",{key:i,content:o},e("button",{type:"button",class:{"co-doc-editor__image-mode":!0,"co-doc-editor__image-mode--active":s},"data-mode":i,"aria-label":o,"aria-pressed":String(s),onClick:()=>this.setImageMode(i)},e("co-icon",{name:O[i],size:16,"aria-hidden":"true"})))}))):null}render(){const t=this.s,i=this.pageSizePx,o=this.marginsPx,r={"--co-doc-page-w":`${i.width}px`,"--co-doc-page-h":`${i.height}px`,"--co-doc-margin-top":`${o.top}px`,"--co-doc-margin-right":`${o.right}px`,"--co-doc-margin-bottom":`${o.bottom}px`,"--co-doc-margin-left":`${o.left}px`,"--co-doc-header-h":`${this.hasHeader?this.headerHeight:0}px`,"--co-doc-pages":String(this.pageCount),"--co-doc-gap":`${y}px`},a={width:i.width*this.scale+"px",height:this.stageHeight?this.stageHeight*this.scale+"px":"auto"},c=(t,i)=>e("button",{key:"3364440e585cbfdfdc33580aa28001f7563f6fa6",type:"button",class:{"co-doc-editor__zoom-btn":!0,"co-doc-editor__zoom-btn--active":this.zoomMode===t},"aria-pressed":String(this.zoomMode===t),onClick:()=>this.setZoom(t)},i);return e(s,{key:"2cc578822013cc07eeeebd0949cbbd2bb09acbc1"},e("div",{key:"5aebe4e657d01b03c5fdf719b87c1c4a08f121a6",class:{"co-doc-editor":!0,"co-doc-editor--readonly":this.readonly,"co-doc-editor--loading":!this.ready},part:"wrapper"},e("div",{key:"93f7d60fffd9e9e902ac25d9fa8a971e96b39ec5",class:"co-doc-editor__bar",part:"bar"},!this.readonly&&e("co-rich-text-toolbar",{key:"df82ee73a50e8283244afb38532803a13b4d6db9",class:"co-doc-editor__toolbar",part:"toolbar",variant:"document",position:"top",disabled:!1,locale:this.locale,attachmentsEnabled:!1,documentHeaderEnabled:this.documentHeaderEnabled,extraItems:this.parsedExtraItems,onCoAction:this.handleToolbarAction,ref:t=>this.toolbarEl=t}),e("div",{key:"a49cc3a01fc203b3bcf3e158ce186fefd607577e",class:"co-doc-editor__zoom",role:"group","aria-label":t.zoom},"custom"===this.zoomMode&&e("span",{key:"47f0c8d5c6bd3c0e51d75ad70103644def66b333",class:"co-doc-editor__zoom-level"},`${Math.round(100*this.scale)} %`),c("fit",t.zoomFit),c("actual",t.zoomActual))),e("div",{key:"d28e02e78c8171b0366f7b3ec74e60cfd9f3d21b",class:"co-doc-editor__body"},e("div",{key:"450bbf0712838a9213a08288148f5365a1d6766b",class:"co-doc-editor__canvas",part:"canvas",ref:t=>this.canvasEl=t},e("div",{key:"3585da3d1f7b0311cb036246f20340b2eb34e45d",class:"co-doc-editor__zoom-frame",style:a},e("div",{key:"ce70286c7205f29115d4e9049c3d43775657abfb",class:"co-doc-editor__stage",style:{transform:`scale(${this.scale})`},ref:t=>this.stageEl=t},e("div",{key:"81c7e68d4d8593b21be0f14045965b1e7230657e",class:"co-doc-editor__sheet",part:"sheet","data-co-doc":this.instanceId,style:r},e("style",{key:"page-styles","data-co-doc-page-styles":"",ref:t=>this.styleEl=t}),e("div",{key:"paper",class:"co-doc-editor__paper","data-theme":"light"},this.renderHeaderBand(),e("div",{key:"content",class:"co-doc-editor__content",ref:t=>this.contentEl=t}),this.renderOverlays()))))),e("slot",{key:"3808aa0d8bae35da687e9757ca39ffced996a795",name:"aside"}))))}get el(){return r(this)}static get watchers(){return{value:[{onValueChange:0}],readonly:[{onReadonlyChange:0}],pageSize:[{onPageGeometryChange:0}],margins:[{onPageGeometryChange:0}],headerHeight:[{onPageGeometryChange:0}],headerHtml:[{onHeaderPropsChange:0}],showPageNumber:[{onHeaderPropsChange:0}],pageStyles:[{onPageStylesChange:0}],label:[{onLabelChange:0}],locale:[{onLabelChange:0},{onLocaleChange:0}]}}};R.style="co-document-editor{display:block;height:100%;min-height:0}.co-doc-editor{--co-doc-canvas:var(--co-semantic-surface-muted);--co-doc-sheet-shadow:0 1px 3px var(--co-color-opacity-negro-16), 0 0 0 1px var(--co-color-opacity-negro-8);display:flex;flex-direction:column;height:100%;min-height:0;background:var(--co-doc-canvas);color:var(--co-semantic-text-default);font-family:var(--co-font-family-primary)}.co-doc-editor__bar{display:flex;align-items:center;gap:var(--co-spacing-sm2);min-width:0;padding-inline:var(--co-spacing-md);background:var(--co-semantic-surface-page);border-bottom:1px solid var(--co-semantic-border-subtle)}.co-doc-editor__toolbar{flex:1 1 auto;min-width:0}.co-doc-editor__body{flex:1 1 auto;display:flex;min-height:0}.co-doc-editor__body>[slot='aside']{flex:0 0 var(--co-doc-aside-width, 320px);width:var(--co-doc-aside-width, 320px);min-width:0;min-height:0;box-sizing:border-box;border-left:1px solid var(--co-semantic-border-subtle)}.co-doc-editor__canvas{flex:1 1 auto;min-width:0;overflow:auto;box-sizing:border-box;padding:var(--co-spacing-2xl) var(--co-spacing-lg)}.co-doc-editor__content .ProseMirror{position:relative;outline:none}.co-doc-editor--loading .co-doc-editor__content{visibility:hidden}.co-doc-field{--co-doc-field-bg:var(--co-color-primary-amarillo);background:var(--co-doc-field-bg);box-shadow:0 0 0 2px var(--co-doc-field-bg);border-radius:var(--co-border-radius-xxs);color:var(--co-color-base-negro);cursor:pointer}.co-doc-field--empty{--co-doc-field-bg:color-mix(in srgb, var(--co-color-primary-amarillo) 55%, var(--co-color-base-blanco))}.co-doc-field--required.co-doc-field--empty{box-shadow:0 0 0 2px var(--co-doc-field-bg), inset 0 -2px 0 var(--co-color-status-error)}.co-doc-field__input{width:14ch;border:0;outline:1px solid var(--co-semantic-border-field);background:var(--co-color-base-blanco);font:inherit}.co-doc-signature{display:inline-flex;align-items:center;justify-content:center;vertical-align:top;box-sizing:border-box;outline:1px dashed var(--co-color-primary-azul);outline-offset:-1px;background:color-mix(in srgb, var(--co-color-primary-azul) 6%, transparent);color:var(--co-semantic-text-link, var(--co-color-primary-azul));font-size:var(--co-font-size-12);user-select:none;cursor:grab}.co-doc-signature:active{cursor:grabbing}.co-doc-signature.ProseMirror-selectednode{outline-style:solid;background:color-mix(in srgb, var(--co-color-primary-azul) 14%, transparent)}.co-doc-hb{background:color-mix(in srgb, var(--co-color-primary-azul) 12%, transparent);border-radius:var(--co-border-radius-xxs)}.co-doc-editor__zoom{display:inline-flex;flex-shrink:0;align-items:center;gap:var(--co-spacing-xxs);margin-inline-start:auto}.co-doc-editor__zoom-level{min-width:5ch;padding-inline:var(--co-spacing-xs);font-size:var(--co-font-size-13);font-variant-numeric:tabular-nums;text-align:end;color:var(--co-semantic-text-secondary)}.co-doc-editor__zoom-btn{padding:var(--co-spacing-xs) var(--co-spacing-sm2);border:0;border-radius:var(--co-border-radius-xs);background:transparent;color:var(--co-semantic-text-secondary);font:inherit;font-size:var(--co-font-size-13);white-space:nowrap;cursor:pointer}.co-doc-editor__zoom-btn:hover{background:var(--co-semantic-surface-hover)}.co-doc-editor__zoom-btn--active{background:var(--co-semantic-surface-hover);color:var(--co-semantic-text-default)}.co-doc-editor__zoom-btn:focus-visible{outline:1px solid var(--co-semantic-border-focus);box-shadow:0 0 0 2px var(--co-semantic-border-focus-ring)}.co-doc-editor__zoom-frame{margin-inline:auto}.co-doc-editor__stage{width:var(--co-doc-page-w);transform-origin:top left}.co-doc-editor__sheet{--co-semantic-surface-page:var(--co-color-base-blanco);--co-semantic-surface-hover:var(--co-color-opacity-negro-8);--co-semantic-text-default:var(--co-color-base-negro);--co-semantic-text-secondary:var(--co-color-gray-600);--co-semantic-text-muted:var(--co-color-gray-500);--co-semantic-border-default:var(--co-color-opacity-negro-16);--co-semantic-border-subtle:var(--co-color-opacity-negro-8);--co-semantic-border-field:var(--co-color-gray-500);--co-semantic-border-focus:var(--co-color-base-negro);--co-semantic-border-focus-ring:var(--co-color-opacity-negro-16);--co-semantic-text-link:var(--co-color-primary-azul);position:relative;width:var(--co-doc-page-w);min-height:calc(var(--co-doc-pages, 1) * var(--co-doc-page-h) + (var(--co-doc-pages, 1) - 1) * var(--co-doc-gap));box-sizing:border-box;padding-top:calc(var(--co-doc-margin-top) + var(--co-doc-header-h, 0px));padding-right:var(--co-doc-margin-right);padding-bottom:var(--co-doc-margin-bottom);padding-left:var(--co-doc-margin-left);overflow:clip;background:var(--co-color-base-blanco);color:var(--co-color-base-negro);color-scheme:light;box-shadow:var(--co-doc-sheet-shadow)}.co-doc-editor__paper{display:contents;color:var(--co-semantic-text-default)}.co-doc-editor .co-doc-editor__sheet .co-doc-editor__content .ProseMirror.tiptap{padding:0 !important;min-height:1em}.co-doc-editor__header-band{position:absolute;top:var(--co-doc-margin-top);left:var(--co-doc-margin-left);right:var(--co-doc-margin-right);height:var(--co-doc-header-h);box-sizing:border-box}.co-doc-editor__header-band[hidden]{display:none}.co-doc-editor__header-band:hover{outline:1px dashed var(--co-color-opacity-negro-25)}.co-doc-editor__header-static{display:flex;align-items:center;justify-content:space-between;height:100%;overflow:hidden;font-size:var(--co-font-size-12);line-height:1.5;user-select:none}.co-doc-editor__header-html{flex:1 1 auto;min-width:0;max-height:100%;overflow:hidden}.co-doc-editor__page-number{flex-shrink:0;margin-inline-start:var(--co-spacing-sm2);white-space:nowrap;color:var(--co-color-gray-600)}.co-doc-page-gap,.co-doc-page-gap__foot,.co-doc-page-gap__between,.co-doc-page-gap__head{margin:0 !important;padding:0 !important;border-width:0 !important;box-sizing:border-box !important}.co-doc-editor__sheet .co-doc-page-gap{position:relative;margin-left:calc(-1 * var(--co-doc-margin-left)) !important;margin-right:calc(-1 * var(--co-doc-margin-right)) !important;user-select:none}.co-doc-page-gap__between{background:var(--co-doc-canvas);border-image:linear-gradient(var(--co-doc-canvas), var(--co-doc-canvas)) fill 0 / 0 / 0 100vmax;box-shadow:inset 0 1px 0 var(--co-color-opacity-negro-8), inset 0 4px 3px -3px var(--co-color-opacity-negro-16), inset 0 -1px 0 var(--co-color-opacity-negro-8)}:is(ul,ol)>.co-doc-page-gap{list-style:none}.co-doc-editor__sheet .co-doc-page-gap__head{padding-top:var(--co-doc-margin-top) !important;padding-left:var(--co-doc-margin-left) !important;padding-right:var(--co-doc-margin-right) !important}.co-doc-page-gap-row>td{padding:0 !important;border:0 !important;background:transparent !important}.co-doc-editor__header-band--editing,.co-doc-editor__header-band--editing:hover{outline:1px solid var(--co-semantic-border-focus);outline-offset:2px}.co-doc-editor__header-editing{display:flex;align-items:center;gap:var(--co-spacing-sm2);height:100%}.co-doc-editor__header-editor{flex:1 1 auto;min-width:0;max-height:100%;overflow:hidden;font-size:var(--co-font-size-12);line-height:1.5}.co-doc-editor__header-editor .ProseMirror{outline:none}.co-doc-editor__header-tools{position:absolute;right:0;bottom:100%;display:flex;align-items:center;gap:var(--co-spacing-xs);padding:var(--co-spacing-xxs) var(--co-spacing-xs);box-sizing:border-box;background:var(--co-semantic-surface-page);border:1px solid var(--co-semantic-border-default);border-radius:var(--co-border-radius-xs)}.co-doc-editor__image-bar{position:absolute;z-index:2;display:flex;gap:var(--co-spacing-xxs);padding:var(--co-spacing-xxs);box-sizing:border-box;background:var(--co-semantic-surface-page);border:1px solid var(--co-semantic-border-default);border-radius:var(--co-border-radius-xs);user-select:none}.co-doc-editor__image-bar co-tooltip{display:inline-flex}.co-doc-editor__image-mode{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:0;border-radius:var(--co-border-radius-xxs);background:transparent;color:var(--co-semantic-text-default);cursor:pointer}.co-doc-editor__image-mode:hover,.co-doc-editor__image-mode--active{background:var(--co-semantic-surface-hover)}.co-doc-editor__image-mode--active{box-shadow:inset 0 0 0 1px var(--co-semantic-border-strong)}.co-doc-editor__image-mode:focus-visible{outline:1px solid var(--co-semantic-border-focus);box-shadow:0 0 0 2px var(--co-semantic-border-focus-ring)}.co-doc-editor__image-mode--active:focus-visible{box-shadow:inset 0 0 0 1px var(--co-semantic-border-strong), 0 0 0 2px var(--co-semantic-border-focus-ring)}.co-doc-editor__sig-bar{position:absolute;z-index:2;display:flex;align-items:center;gap:var(--co-spacing-xxs);padding:var(--co-spacing-xxs);box-sizing:border-box;background:var(--co-semantic-surface-page);border:1px solid var(--co-semantic-border-default);border-radius:var(--co-border-radius-xs);color:var(--co-semantic-text-default);font-family:var(--co-font-family-primary);font-size:var(--co-font-size-12);user-select:none}.co-doc-editor__sig-bar co-tooltip{display:inline-flex}.co-doc-editor__sig-duplicate,.co-doc-editor__sig-step{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;box-sizing:border-box;border:0;border-radius:var(--co-border-radius-xxs);background:transparent;color:inherit;font:inherit;cursor:pointer}.co-doc-editor__sig-duplicate{width:96px;height:28px;gap:var(--co-spacing-xs);padding:0 var(--co-spacing-sm)}.co-doc-editor__sig-duplicate co-icon{flex-shrink:0}.co-doc-editor__sig-duplicate-text{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-doc-editor__sig-step{width:28px;height:28px;padding:0}.co-doc-editor__sig-duplicate:hover,.co-doc-editor__sig-step:hover:not(:disabled){background:var(--co-semantic-surface-hover)}.co-doc-editor__sig-step:disabled{color:var(--co-semantic-text-muted);cursor:default}.co-doc-editor__sig-duplicate:focus-visible,.co-doc-editor__sig-step:focus-visible{outline:1px solid var(--co-semantic-border-focus);box-shadow:0 0 0 2px var(--co-semantic-border-focus-ring)}.co-doc-editor__sig-sep{width:1px;align-self:stretch;background:var(--co-semantic-border-default)}.co-doc-editor__sig-label{width:88px;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}";export{R as co_document_editor}
1
+ import{r as t,c as i,f as o,h as e,H as s,a as r}from"./p-DJkaRtbb.js";import{g as a}from"./p-EtYK1iGx.js";import{b as c,s as n}from"./p-BmdKHBZP.js";import{B as d,F as h,E as l,w as u,r as g,Q as p,s as b,q as m,x as v,z as f,W as _,I as x,P as y,G as w}from"./p-CqQobidl.js";import"./p-B2QLgWrz.js";const k={top:38,right:38,bottom:38,left:38},z=new Set(["letter","a4","legal"]);function C(t){if("string"==typeof t){if(z.has(t))return t;try{return C(JSON.parse(t))}catch(t){return"letter"}}if(t&&"object"==typeof t){const{width:i,height:o}=t;if(Number(i)>0&&Number(o)>0)return{width:Number(i),height:Number(o)}}return"letter"}const $=/@(import|charset|namespace)[^;]*;/gi;function S(t,i){return t?H(t.replace(/\/\*[\s\S]*?\*\//g,"").replace($,""),i).trim():""}function P(t,i){let o=0,e=null;for(let s=i;s<t.length;s+=1){const i=t[s];if(e)i===e&&"\\"!==t[s-1]&&(e=null);else if('"'===i||"'"===i)e=i;else if("{"===i)o+=1;else if("}"===i&&(o-=1,0===o))return s}return-1}function M(t,i){const o=t.trim();if(!o)return"";const e=`:where(${i})`;if("*"===o)return`${e}, ${e} *, ${e} :is(pre, code)`;const s=o.replace(/^(?:(?:html|body|:root)(?=$|[\s>+~.#:[])\s*)+/i,"").trim();return s?`${e} ${s}`:e}function H(t,i){let o="",e=0;for(;e<t.length;){const s=t.indexOf("{",e);if(-1===s)break;const r=P(t,s);if(-1===r)break;const a=t.slice(e,s).trim(),c=t.slice(s+1,r);if(e=r+1,!a)continue;if(a.startsWith("@")){const t=a.slice(1).split(/[\s(]/)[0].toLowerCase();"media"===t||"supports"===t?o+=`${a}{${H(c,i)}}`:t.endsWith("keyframes")&&(o+=`${a}{${c}}`);continue}const n=a.split(",").map((t=>M(t,i))).filter(Boolean);n.length&&(o+=`${n.join(", ")}{${c}}`)}return o}function N(t){return Number.isFinite(t)?Math.round(1e3*Math.min(3,Math.max(.25,t)))/1e3:1}function j(t,i,o){return o>0?(t-i)/o:0}function E(t,i,o,e){return t+i*o-e}const O={inline:"image-square","wrap-left":"text-align-left","wrap-right":"text-align-right",break:"rows"},I={width:124,height:34};function B(t,i,o=I,e=4){const s=t.top+t.height+e,r=t.top-e-o.height;let a=s,c="below";i.height>0&&s+o.height>i.height&&(r>=0?(a=r,c="above"):(a=Math.max(0,Math.min(t.top+t.height-e-o.height,i.height-o.height)),c="inside"));let n=t.left;return i.width>0&&(n=Math.max(0,Math.min(n,i.width-o.width))),{top:a,left:n,placement:c}}function L(t,i){let o=0,e=t;for(;e&&e!==i;)o+=e.offsetLeft,e=e.offsetParent;return o}const F={width:255,height:34};let G=0;const R=class{constructor(o){t(this,o),this.coChange=i(this,"coChange",3),this.coFieldsChange=i(this,"coFieldsChange",3),this.coHeaderChange=i(this,"coHeaderChange",3),this.coPagesChange=i(this,"coPagesChange",3),this.coAction=i(this,"coAction",3),this.coReady=i(this,"coReady",3),this.value=null,this.headerHtml="",this.showPageNumber=!1,this.pageSize="letter",this.headerHeight=45,this.pageStyles="",this.readonly=!1,this.locale="en",this.ready=!1,this.pageCount=1,this.zoomMode="fit",this.scale=1,this.stageHeight=0,this.headerEditing=!1,this.draftShowPageNumber=!1,this.imageBar=null,this.signatureBar=null,this.currentHeaderHtml="",this.currentShowPageNumber=!1,this.headerDoc=null,this.instanceId=String(++G),this.applyingExternal=!1,this.lastAppliedValue=null,this.userDirty=!1,this.lastFieldsKey="",this.pendingImageSrcs=new Set,this.changeThrottle=function(t,i){let o=null;return{run(){o||(o=setTimeout((()=>{o=null,i()}),250))},flush(){o&&(clearTimeout(o),o=null,i())},cancel(){o&&clearTimeout(o),o=null},get pending(){return null!==o}}}(0,(()=>this.emitPendingChange())),this.updateImageBar=()=>{const t=this.editor,i=null==t?void 0:t.state.selection,o=null==i?void 0:i.node;if(!t||this.readonly||!o||"image"!==o.type.name)return void(this.imageBar&&(this.imageBar=null));const e=t.view.nodeDOM(i.from),s=this.el.querySelector(".co-doc-editor__sheet");if(!e||!s)return void(this.imageBar&&(this.imageBar=null));const r=w(e,s),a=B({top:r.top,height:r.height,left:L(e,s)},{width:s.offsetWidth,height:s.offsetHeight}),c=d({wrapperStyle:o.attrs.wrapperStyle,containerStyle:o.attrs.containerStyle}),n=this.imageBar;n&&n.mode===c&&n.top===a.top&&n.left===a.left||(this.imageBar={mode:c,top:a.top,left:a.left})},this.updateSignatureBar=()=>{const t=this.editor,i=null==t?void 0:t.state.selection,o=null==i?void 0:i.node;if(!t||this.readonly||!o||"signatureSlot"!==o.type.name)return void(this.signatureBar&&(this.signatureBar=null));const e=t.view.nodeDOM(i.from),s=this.el.querySelector(".co-doc-editor__sheet");if(!e||!s)return void(this.signatureBar&&(this.signatureBar=null));const r=[];t.state.doc.descendants(((t,o)=>{"signatureSlot"===t.type.name&&o!==i.from&&r.push(t.attrs.slot)}));const{min:a,max:c}=function(t){let i=0;for(const o of t)o>i&&(i=o);return{min:1,max:i+1}}(r),n=w(e,s),d=B({top:n.top,height:n.height,left:L(e,s)},{width:s.offsetWidth,height:s.offsetHeight},F),h=o.attrs.slot,l=this.signatureBar;l&&l.slot===h&&l.min===a&&l.max===c&&l.top===d.top&&l.left===d.left||(this.signatureBar={slot:h,min:a,max:c,top:d.top,left:d.left})},this.onBodyImageLoad=t=>{const i=t.target,o=this.editor;if(!o||!i||"IMG"!==i.tagName)return;const e=i.getAttribute("src")||"";if(!this.pendingImageSrcs.has(e))return;let s=-1;o.state.doc.descendants(((t,i)=>!(s>=0||("image"!==t.type.name||t.attrs.width||t.attrs.src!==e||(s=i),0))));const r=s>=0?o.state.doc.nodeAt(s):null;if(!r)return;const a=this.marginsPx,c=function(t,i){const o=t>0?t:0,e=i>0?i:0,s=o&&e?Math.min(o,e):o||e;return s?Math.max(1,Math.round(s)):null}(i.naturalWidth,this.pageSizePx.width-a.left-a.right);if(!c)return;let n=!1;o.state.doc.descendants(((t,i)=>(i===s||"image"!==t.type.name||t.attrs.width||t.attrs.src!==e||(n=!0),!n))),n||this.pendingImageSrcs.delete(e);const d=o.state.selection.node&&o.state.selection.from===s;o.view.dispatch(o.state.tr.setNodeMarkup(s,void 0,Object.assign(Object.assign({},r.attrs),{width:c}))),d&&o.commands.setNodeSelection(s)},this.onEditorBlur=()=>{this.changeThrottle.flush()},this.onHostKeydown=t=>{"Escape"===t.key&&this.changeThrottle.flush()},this.onTransaction=({transaction:t})=>{t.docChanged&&(this.applyingExternal||!!t.getMeta(h)||(this.userDirty=!0,this.trackInsertedImages(t)),this.changeThrottle.run())},this.handleToolbarAction=t=>{t.stopPropagation();const{action:i,payload:o}=t.detail||{};o&&!0===o.extra?this.coAction.emit({action:i,payload:{extra:!0}}):"documentHeader"===i&&this.startHeaderEdit()},this.startHeaderEdit=()=>{this.readonly||this.headerEditing||!this.editor||(this.draftShowPageNumber=this.currentShowPageNumber,this.headerEditing=!0,this.refreshPagination())},this.onHeaderTransaction=({transaction:t})=>{t.docChanged&&this.changeThrottle.run()},this.onHeaderImageLoad=t=>{const i=t.target,o=this.headerEditor;if(!o||!i||"IMG"!==i.tagName)return;const e=l({w:i.naturalWidth,h:i.naturalHeight});if(!e)return;let s=-1;try{const t=o.view.posAtDOM(i,0),e=o.state.doc.nodeAt(t);e&&"image"===e.type.name&&(s=t)}catch(t){}if(s<0){const t=i.getAttribute("src");o.state.doc.descendants(((i,o)=>!(s>=0||("image"!==i.type.name||i.attrs.width||i.attrs.src!==t||(s=o),0))))}const r=s>=0?o.state.doc.nodeAt(s):null;r&&!r.attrs.width&&o.view.dispatch(o.state.tr.setNodeMarkup(s,void 0,Object.assign(Object.assign({},r.attrs),{width:e})))},this.onDocumentPointer=t=>{const i=t.composedPath();this.headerBandEl&&i.includes(this.headerBandEl)||this.toolbarEl&&i.includes(this.toolbarEl)||this.commitHeader()},this.onHeaderKeydown=t=>{var i;if("Escape"!==t.key||t.isComposing)return;const o=this.toolbarEl;o&&t.currentTarget===o&&(null===(i=o.shadowRoot)||void 0===i?void 0:i.querySelector('[aria-expanded="true"]'))||(t.preventDefault(),t.stopPropagation(),this.cancelHeader(!0))},this.commitHeader=(t=!1)=>{var i;const o=this.headerEditor;if(!o)return;const e=t&&this.focusIsInBandOrLost(),s=o.isEmpty?"":u(o.state.doc,"print-header",this.resolvedFeatures),r=this.draftShowPageNumber;this.teardownHeaderEditor(),this.currentHeaderHtml=s,this.currentShowPageNumber=r,this.headerDoc=s?g(s,"print-header",this.resolvedFeatures):null,this.headerEditing=!1,this.refreshPagination(),this.coHeaderChange.emit({html:s,showPageNumber:r}),this.emitFieldsIfChanged(),e&&(null===(i=this.editor)||void 0===i||i.commands.focus())},this.cancelHeader=(t=!1)=>{var i;this.headerEditing&&(this.teardownHeaderEditor(),this.headerEditing=!1,this.refreshPagination(),this.emitFieldsIfChanged(),t&&(null===(i=this.editor)||void 0===i||i.commands.focus()))},this.renderedScale=1,this.onCanvasWheel=t=>{var i,o;(t.ctrlKey||t.metaKey)&&(t.preventDefault(),this.zoomTo((i=this.scale,o=1===t.deltaMode?16*t.deltaY:t.deltaY,Number.isFinite(o)?N(i*Math.exp(.01*-o)):i),t.clientX,t.clientY))},this.gestureBase=1,this.onGestureStart=t=>{t.preventDefault(),this.gestureBase=this.scale},this.onGestureChange=t=>{var i,o,e,s;t.preventDefault();const r=null===(i=this.canvasEl)||void 0===i?void 0:i.getBoundingClientRect(),a=null!==(o=t.clientX)&&void 0!==o?o:r?r.left+r.width/2:0,c=null!==(e=t.clientY)&&void 0!==e?e:r?r.top+r.height/2:0;this.zoomTo(N(this.gestureBase*(null!==(s=t.scale)&&void 0!==s?s:1)),a,c)}}get s(){return a(this.locale)}get resolvedFeatures(){var t;return null!==(t=c(this.features))&&void 0!==t?t:{}}get parsedExtraItems(){const t=c(this.extraItems);return Array.isArray(t)?t:[]}get pageSizePx(){return p(C(this.pageSize))}get marginsPx(){return function(t){let i=t;if("string"==typeof t)try{i=JSON.parse(t)}catch(t){return Object.assign({},k)}if(!i||"object"!=typeof i)return Object.assign({},k);const o=i,e=t=>Number.isFinite(Number(o[t]))&&void 0!==o[t]?Number(o[t]):k[t];return{top:e("top"),right:e("right"),bottom:e("bottom"),left:e("left")}}(this.margins)}get hasHeader(){return!!this.currentHeaderHtml||this.headerEditing}get sanitizedHeaderHtml(){return b(this.currentHeaderHtml,"print-header")}get pageScope(){return`.co-doc-editor__sheet[data-co-doc="${this.instanceId}"]`}get activeEditor(){var t;return null!==(t=this.headerEditor)&&void 0!==t?t:this.editor}get documentHeaderEnabled(){return!this.readonly&&!this.headerEditing}buildCustomExtensions(){return[m.configure({page:this.pageSizePx,margins:this.marginsPx,header:{height:this.hasHeader?this.headerHeight:0},footer:{height:0},renderHeader:(t,i)=>this.buildHeaderClone(t,i),onPagesChange:t=>{this.pageCount=t,this.coPagesChange.emit(t)}})]}collectAllFields(){if(!this.editor)return[];const t=v(this.editor.state.doc),i=this.headerEditor?this.headerEditor.state.doc:this.headerDoc;return i&&v(i,t),t}connectedCallback(){this.el.addEventListener("keydown",this.onHostKeydown,!0)}componentWillLoad(){this.ready=!1,this.pageCount=1,this.zoomMode="fit",this.scale=1,this.stageHeight=0,this.headerEditing=!1,this.draftShowPageNumber=!1,this.imageBar=null,this.signatureBar=null}componentDidLoad(){var t,i,o;this.contentEl&&(this.syncHeaderFromProps(),this.editor=f({preset:"print",element:this.contentEl,content:this.value?this.parseBody(this.value):null,editable:!this.readonly,features:this.resolvedFeatures,labels:{signature:t=>`${this.s.signature} ${t}`,fieldName:this.s.fieldNamePlaceholder},customExtensions:this.buildCustomExtensions(),imageUpload:this.imageUpload}),this.lastAppliedValue=this.value,this.wireEditor(this.editor),this.applyPageStyles(),"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver((()=>this.updateScale())),this.canvasEl&&this.resizeObserver.observe(this.canvasEl),this.stageEl&&this.resizeObserver.observe(this.stageEl)),null===(t=this.canvasEl)||void 0===t||t.addEventListener("wheel",this.onCanvasWheel,{passive:!1}),null===(i=this.canvasEl)||void 0===i||i.addEventListener("gesturestart",this.onGestureStart),null===(o=this.canvasEl)||void 0===o||o.addEventListener("gesturechange",this.onGestureChange),this.updateScale(),this.syncToolbar(),this.ready=!0,this.emitFieldsIfChanged(),this.coReady.emit())}componentDidRender(){this.applyPendingAnchor(),this.headerEditing&&!this.headerEditor&&this.headerMountEl&&this.mountHeaderEditor(),this.syncToolbar()}disconnectedCallback(){var t,i,o,e;this.el.removeEventListener("keydown",this.onHostKeydown,!0),this.changeThrottle.cancel(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),this.resizeObserver=void 0,null===(i=this.canvasEl)||void 0===i||i.removeEventListener("wheel",this.onCanvasWheel),null===(o=this.canvasEl)||void 0===o||o.removeEventListener("gesturestart",this.onGestureStart),null===(e=this.canvasEl)||void 0===e||e.removeEventListener("gesturechange",this.onGestureChange),this.toolbarEl&&(this.toolbarEl.editor=void 0),this.teardownHeaderEditor(!1),this.headerEditing=!1,this.editor&&(this.editor.off("transaction",this.onTransaction),this.editor.off("blur",this.onEditorBlur),this.editor.off("transaction",this.updateImageBar),this.editor.off("transaction",this.updateSignatureBar),this.editor.view.dom.removeEventListener("load",this.onBodyImageLoad,!0),this.editor.destroy()),this.editor=void 0,this.pendingImageSrcs.clear(),this.imageBar=null,this.signatureBar=null}onValueChange(t){t!==this.lastAppliedValue&&(this.editor&&t&&t===u(this.editor.state.doc,"print",this.resolvedFeatures)?this.lastAppliedValue=t:this.applyBody(t))}onReadonlyChange(){var t;null===(t=this.editor)||void 0===t||t.setEditable(!this.readonly),this.readonly&&this.headerEditing&&this.cancelHeader(),this.updateImageBar(),this.updateSignatureBar()}onPageGeometryChange(){this.refreshPagination(),this.updateScale()}onHeaderPropsChange(){this.headerEditing||(this.syncHeaderFromProps(),this.refreshPagination(),this.emitFieldsIfChanged())}onPageStylesChange(){this.applyPageStyles()}onLabelChange(){this.editor&&this.editor.view.dom.setAttribute("aria-label",this.label||this.s.documentEditor)}onLocaleChange(){this.currentShowPageNumber&&this.refreshPagination()}async getPrintHtml(){return this.editor?u(this.editor.state.doc,"print",this.resolvedFeatures):""}async getHeaderHtml(){return this.currentHeaderHtml}async getJSON(){return this.editor?this.editor.getJSON():null}async flushChange(){this.changeThrottle.flush()}async isEmpty(){return!this.editor||this.editor.isEmpty}async setContent(t){this.applyBody(t)}async setFieldValues(t){var i,e;if(null===(i=this.editor)||void 0===i||i.commands.setFieldValues(t),null===(e=this.headerEditor)||void 0===e||e.commands.setFieldValues(t),!this.currentHeaderHtml)return;const s=_(this.currentHeaderHtml,t,"print-header",this.resolvedFeatures);s!==this.currentHeaderHtml&&(this.currentHeaderHtml=s,this.headerDoc=g(s,"print-header",this.resolvedFeatures),this.headerEditing||(this.refreshPagination(),o(this)))}async insertField(t,i){var o;null===(o=this.editor)||void 0===o||o.chain().focus().insertField(t,i).run()}async insertSignatureSlot(){var t;null===(t=this.editor)||void 0===t||t.chain().focus().insertSignatureSlot().run()}async focusEditor(){var t;null===(t=this.editor)||void 0===t||t.commands.focus()}async getEditorInstance(){var t;return null!==(t=this.editor)&&void 0!==t?t:null}wireEditor(t){const i=t.view.dom;i.classList.add("tiptap"),i.setAttribute("aria-label",this.label||this.s.documentEditor),i.setAttribute("aria-multiline","true"),t.on("transaction",this.onTransaction),t.on("transaction",this.updateImageBar),t.on("transaction",this.updateSignatureBar),t.on("blur",this.onEditorBlur),i.addEventListener("load",this.onBodyImageLoad,!0)}imageModeLabel(t){const i=this.s;return{inline:i.imageLayoutInline,"wrap-left":i.imageLayoutWrapLeft,"wrap-right":i.imageLayoutWrapRight,break:i.imageLayoutBreak}[t]}setImageMode(t){var i;null===(i=this.editor)||void 0===i||i.commands.setImageLayoutMode(t),this.updateImageBar()}duplicateSignature(){var t;null===(t=this.editor)||void 0===t||t.commands.duplicateSignatureSlot(),this.updateSignatureBar()}stepSigner(t){var i;const o=this.signatureBar;if(!o)return;const e=o.slot+t;e<o.min||e>o.max||(null===(i=this.editor)||void 0===i||i.commands.setSignatureSlot(e),this.updateSignatureBar())}trackInsertedImages(t){var i,o,e;if(t.getMeta("history$"))return;const s=[];for(const r of t.steps)null===(e=null===(o=null===(i=r.slice)||void 0===i?void 0:i.content)||void 0===o?void 0:o.descendants)||void 0===e||e.call(o,(t=>{"image"===t.type.name&&!t.attrs.width&&t.attrs.src&&s.push(t.attrs.src)}));if(!s.length)return;const r=new Set;t.before.descendants((t=>{"image"!==t.type.name||t.attrs.width||r.add(t.attrs.src)})),s.forEach((t=>{r.has(t)||this.pendingImageSrcs.add(t)}))}parseBody(t){const i=t.trim();if(i.startsWith("{"))try{return JSON.parse(i)}catch(t){}return g(t,"print",this.resolvedFeatures)}applyBody(t){if(this.editor){this.pendingImageSrcs.clear(),this.applyingExternal=!0;try{t?this.editor.commands.setContent(this.parseBody(t),{emitUpdate:!1}):this.editor.commands.clearContent(!1)}finally{this.applyingExternal=!1,this.lastAppliedValue=t}}}emitPendingChange(){this.editor&&(this.emitFieldsIfChanged(),this.userDirty&&(this.userDirty=!1,this.coChange.emit()))}emitFieldsIfChanged(){const t=this.collectAllFields(),i=JSON.stringify(t);i!==this.lastFieldsKey&&(this.lastFieldsKey=i,this.coFieldsChange.emit(t))}syncToolbar(){n(this.toolbarEl,this.activeEditor,this.imageUpload)}syncHeaderFromProps(){var t;this.currentHeaderHtml=this.headerHtml||"",this.currentShowPageNumber=!0===(t=this.showPageNumber)||"true"===t,this.headerDoc=this.currentHeaderHtml?g(this.currentHeaderHtml,"print-header",this.resolvedFeatures):null}mountHeaderEditor(){var t,i;const o=f({preset:"print-header",element:this.headerMountEl,content:this.currentHeaderHtml?g(this.currentHeaderHtml,"print-header",this.resolvedFeatures):null,editable:!0,features:{fields:this.resolvedFeatures.fields},labels:{fieldName:this.s.fieldNamePlaceholder},imageUpload:this.imageUpload});this.headerEditor=o;const e=o.view.dom;e.classList.add("tiptap"),e.setAttribute("aria-label",this.s.documentHeader),o.on("transaction",this.onHeaderTransaction),e.addEventListener("load",this.onHeaderImageLoad,!0),document.addEventListener("mousedown",this.onDocumentPointer,!0),null===(t=this.headerBandEl)||void 0===t||t.addEventListener("keydown",this.onHeaderKeydown,!0),null===(i=this.toolbarEl)||void 0===i||i.addEventListener("keydown",this.onHeaderKeydown,!0),o.commands.focus("end"),this.syncToolbar()}teardownHeaderEditor(t=!0){var i,o;document.removeEventListener("mousedown",this.onDocumentPointer,!0),null===(i=this.headerBandEl)||void 0===i||i.removeEventListener("keydown",this.onHeaderKeydown,!0),null===(o=this.toolbarEl)||void 0===o||o.removeEventListener("keydown",this.onHeaderKeydown,!0);const e=this.headerEditor;this.headerEditor=void 0,t?this.syncToolbar():this.toolbarEl&&e&&this.toolbarEl.editor===e&&(this.toolbarEl.editor=void 0),e&&(e.off("transaction",this.onHeaderTransaction),e.view.dom.removeEventListener("load",this.onHeaderImageLoad,!0),e.destroy())}focusIsInBandOrLost(){const t=document.activeElement;return!t||t===document.body||!(!this.headerBandEl||!this.headerBandEl.contains(t))}refreshPagination(){var t;null===(t=this.editor)||void 0===t||t.commands.setPaginationOptions({page:this.pageSizePx,margins:this.marginsPx,header:{height:this.hasHeader?this.headerHeight:0}})}applyPageStyles(){this.styleEl&&(this.styleEl.textContent=S(this.pageStyles,this.pageScope))}buildHeaderClone(t,i){if(!this.currentHeaderHtml)return null;const o=document.createElement("div");o.className="co-doc-editor__header-static",o.style.height=`${this.headerHeight}px`;const e=document.createElement("div");if(e.className="co-doc-editor__header-html",e.innerHTML=this.sanitizedHeaderHtml,o.appendChild(e),this.currentShowPageNumber){const e=document.createElement("span");e.className="co-doc-editor__page-number",e.textContent=`${this.s.page} ${t} / ${i}`,o.appendChild(e)}return o}updateScale(){var t,i,o,e;if("custom"!==this.zoomMode){const o="actual"===this.zoomMode?1:function(t,i){if(!(t>0&&i>0))return 1;const o=Math.min(1,Math.max(.25,t/i));return Math.round(1e3*o)/1e3}((null!==(i=null===(t=this.canvasEl)||void 0===t?void 0:t.clientWidth)&&void 0!==i?i:0)-32,this.pageSizePx.width);o!==this.scale&&(this.scale=o)}const s=null!==(e=null===(o=this.stageEl)||void 0===o?void 0:o.offsetHeight)&&void 0!==e?e:0;s!==this.stageHeight&&(this.stageHeight=s)}zoomTo(t,i,o){if(this.canvasEl&&this.stageEl&&t!==this.scale){if(this.pendingAnchor)this.pendingAnchor.cx=i,this.pendingAnchor.cy=o;else{const t=this.stageEl.getBoundingClientRect();this.pendingAnchor={px:j(i,t.left,this.renderedScale),py:j(o,t.top,this.renderedScale),cx:i,cy:o}}this.zoomMode="custom",this.scale=t}}applyPendingAnchor(){const t=this.pendingAnchor,i=this.canvasEl;if(this.renderedScale=this.scale,!t||!i||!this.stageEl)return;this.pendingAnchor=void 0;const o=this.stageEl.getBoundingClientRect();i.scrollLeft+=E(o.left,t.px,this.scale,t.cx),i.scrollTop+=E(o.top,t.py,this.scale,t.cy)}setZoom(t){this.zoomMode=t,this.updateScale()}renderHeaderBand(){const t=this.s;return e("div",{key:"header-band",class:{"co-doc-editor__header-band":!0,"co-doc-editor__header-band--editing":this.headerEditing},part:"header-band",hidden:!this.hasHeader,ref:t=>this.headerBandEl=t,onDblClick:()=>this.startHeaderEdit()},this.headerEditing?e("div",{key:"header-editing",class:"co-doc-editor__header-editing"},e("div",{class:"co-doc-editor__header-editor",ref:t=>this.headerMountEl=t}),e("div",{class:"co-doc-editor__header-tools"},e("co-switch",{checked:this.draftShowPageNumber,label:t.pageNumber,disabled:!1,required:!1,status:"default",onCoChange:t=>{t.stopPropagation(),this.draftShowPageNumber=!!t.detail}}),e("co-tooltip",{content:t.confirmHeader},e("co-icon-button",{icon:"check",variant:"ghost",size:"xs",boxSize:28,iconSize:16,label:t.confirmHeader,onClick:()=>this.commitHeader(!0)})))):e("div",{key:"header-static",class:"co-doc-editor__header-static"},e("div",{class:"co-doc-editor__header-html",innerHTML:this.sanitizedHeaderHtml}),this.currentShowPageNumber&&e("span",{class:"co-doc-editor__page-number"},`${t.page} 1 / ${this.pageCount}`)))}renderOverlays(){return this.readonly||this.headerEditing?null:[this.renderImageBar(),this.renderSignatureBar()]}renderSignatureBar(){const t=this.signatureBar;if(!t)return null;const i=this.s,o=(t,i,o,s,r)=>e("co-tooltip",{key:t,content:i},e("button",{type:"button",class:"co-doc-editor__sig-step","data-dir":t,"aria-label":i,disabled:r,onClick:()=>this.stepSigner(s)},e("co-icon",{name:o,size:16,"aria-hidden":"true"})));return e("div",{key:"signature-bar",class:"co-doc-editor__sig-bar",role:"toolbar","aria-label":i.signatureToolsLabel,style:{top:`${t.top}px`,left:`${t.left}px`},onMouseDown:t=>t.preventDefault()},e("button",{key:"duplicate",type:"button",class:"co-doc-editor__sig-duplicate",onClick:()=>this.duplicateSignature()},e("co-icon",{name:"copy",size:16,"aria-hidden":"true"}),e("span",{class:"co-doc-editor__sig-duplicate-text"},i.signatureDuplicate)),e("span",{key:"sep",class:"co-doc-editor__sig-sep","aria-hidden":"true"}),o("prev",i.signaturePrevSigner,"caret-left",-1,t.slot<=t.min),e("span",{key:"label",class:"co-doc-editor__sig-label","aria-live":"polite"},`${i.signature} ${t.slot}`),o("next",i.signatureNextSigner,"caret-right",1,t.slot>=t.max))}renderImageBar(){const t=this.imageBar;return t?e("div",{key:"image-bar",class:"co-doc-editor__image-bar",role:"toolbar","aria-label":this.s.imageLayoutLabel,style:{top:`${t.top}px`,left:`${t.left}px`},onMouseDown:t=>t.preventDefault()},x.map((i=>{const o=this.imageModeLabel(i),s=t.mode===i;return e("co-tooltip",{key:i,content:o},e("button",{type:"button",class:{"co-doc-editor__image-mode":!0,"co-doc-editor__image-mode--active":s},"data-mode":i,"aria-label":o,"aria-pressed":String(s),onClick:()=>this.setImageMode(i)},e("co-icon",{name:O[i],size:16,"aria-hidden":"true"})))}))):null}render(){const t=this.s,i=this.pageSizePx,o=this.marginsPx,r={"--co-doc-page-w":`${i.width}px`,"--co-doc-page-h":`${i.height}px`,"--co-doc-margin-top":`${o.top}px`,"--co-doc-margin-right":`${o.right}px`,"--co-doc-margin-bottom":`${o.bottom}px`,"--co-doc-margin-left":`${o.left}px`,"--co-doc-header-h":`${this.hasHeader?this.headerHeight:0}px`,"--co-doc-pages":String(this.pageCount),"--co-doc-gap":`${y}px`},a={width:i.width*this.scale+"px",height:this.stageHeight?this.stageHeight*this.scale+"px":"auto"},c=(t,i)=>e("button",{key:"3364440e585cbfdfdc33580aa28001f7563f6fa6",type:"button",class:{"co-doc-editor__zoom-btn":!0,"co-doc-editor__zoom-btn--active":this.zoomMode===t},"aria-pressed":String(this.zoomMode===t),onClick:()=>this.setZoom(t)},i);return e(s,{key:"2cc578822013cc07eeeebd0949cbbd2bb09acbc1"},e("div",{key:"5aebe4e657d01b03c5fdf719b87c1c4a08f121a6",class:{"co-doc-editor":!0,"co-doc-editor--readonly":this.readonly,"co-doc-editor--loading":!this.ready},part:"wrapper"},e("div",{key:"93f7d60fffd9e9e902ac25d9fa8a971e96b39ec5",class:"co-doc-editor__bar",part:"bar"},!this.readonly&&e("co-rich-text-toolbar",{key:"df82ee73a50e8283244afb38532803a13b4d6db9",class:"co-doc-editor__toolbar",part:"toolbar",variant:"document",position:"top",disabled:!1,locale:this.locale,attachmentsEnabled:!1,documentHeaderEnabled:this.documentHeaderEnabled,extraItems:this.parsedExtraItems,onCoAction:this.handleToolbarAction,ref:t=>this.toolbarEl=t}),e("div",{key:"a49cc3a01fc203b3bcf3e158ce186fefd607577e",class:"co-doc-editor__zoom",role:"group","aria-label":t.zoom},"custom"===this.zoomMode&&e("span",{key:"47f0c8d5c6bd3c0e51d75ad70103644def66b333",class:"co-doc-editor__zoom-level"},`${Math.round(100*this.scale)} %`),c("fit",t.zoomFit),c("actual",t.zoomActual))),e("div",{key:"d28e02e78c8171b0366f7b3ec74e60cfd9f3d21b",class:"co-doc-editor__body"},e("div",{key:"450bbf0712838a9213a08288148f5365a1d6766b",class:"co-doc-editor__canvas",part:"canvas",ref:t=>this.canvasEl=t},e("div",{key:"3585da3d1f7b0311cb036246f20340b2eb34e45d",class:"co-doc-editor__zoom-frame",style:a},e("div",{key:"ce70286c7205f29115d4e9049c3d43775657abfb",class:"co-doc-editor__stage",style:{transform:`scale(${this.scale})`},ref:t=>this.stageEl=t},e("div",{key:"81c7e68d4d8593b21be0f14045965b1e7230657e",class:"co-doc-editor__sheet",part:"sheet","data-co-doc":this.instanceId,style:r},e("style",{key:"page-styles","data-co-doc-page-styles":"",ref:t=>this.styleEl=t}),e("div",{key:"paper",class:"co-doc-editor__paper","data-theme":"light"},this.renderHeaderBand(),e("div",{key:"content",class:"co-doc-editor__content",ref:t=>this.contentEl=t}),this.renderOverlays()))))),e("slot",{key:"3808aa0d8bae35da687e9757ca39ffced996a795",name:"aside"}))))}get el(){return r(this)}static get watchers(){return{value:[{onValueChange:0}],readonly:[{onReadonlyChange:0}],pageSize:[{onPageGeometryChange:0}],margins:[{onPageGeometryChange:0}],headerHeight:[{onPageGeometryChange:0}],headerHtml:[{onHeaderPropsChange:0}],showPageNumber:[{onHeaderPropsChange:0}],pageStyles:[{onPageStylesChange:0}],label:[{onLabelChange:0}],locale:[{onLabelChange:0},{onLocaleChange:0}]}}};R.style="co-document-editor{display:block;height:100%;min-height:0}.co-doc-editor{--co-doc-canvas:var(--co-semantic-surface-muted);--co-doc-sheet-shadow:0 1px 3px var(--co-color-opacity-negro-16), 0 0 0 1px var(--co-color-opacity-negro-8);display:flex;flex-direction:column;height:100%;min-height:0;background:var(--co-doc-canvas);color:var(--co-semantic-text-default);font-family:var(--co-font-family-primary)}.co-doc-editor__bar{display:flex;align-items:center;gap:var(--co-spacing-sm2);min-width:0;padding-inline:var(--co-spacing-md);background:var(--co-semantic-surface-page);border-bottom:1px solid var(--co-semantic-border-subtle)}.co-doc-editor__toolbar{flex:1 1 auto;min-width:0}.co-doc-editor__body{flex:1 1 auto;display:flex;min-height:0}.co-doc-editor__body>[slot='aside']{flex:0 0 var(--co-doc-aside-width, 320px);width:var(--co-doc-aside-width, 320px);min-width:0;min-height:0;box-sizing:border-box;border-left:1px solid var(--co-semantic-border-subtle)}.co-doc-editor__canvas{flex:1 1 auto;min-width:0;overflow:auto;box-sizing:border-box;padding:var(--co-spacing-2xl) var(--co-spacing-lg)}.co-doc-editor__content .ProseMirror{position:relative;outline:none}.co-doc-editor--loading .co-doc-editor__content{visibility:hidden}.co-doc-field{--co-doc-field-bg:var(--co-color-primary-amarillo);background:var(--co-doc-field-bg);box-shadow:0 0 0 2px var(--co-doc-field-bg);border-radius:var(--co-border-radius-xxs);color:var(--co-color-base-negro);cursor:pointer}.co-doc-field--empty{--co-doc-field-bg:color-mix(in srgb, var(--co-color-primary-amarillo) 55%, var(--co-color-base-blanco))}.co-doc-field--required.co-doc-field--empty{box-shadow:0 0 0 2px var(--co-doc-field-bg), inset 0 -2px 0 var(--co-color-status-error)}.co-doc-field__input{width:14ch;border:0;outline:1px solid var(--co-semantic-border-focus);background:var(--co-color-base-blanco);font:inherit}.co-doc-signature{display:inline-flex;align-items:center;justify-content:center;vertical-align:top;box-sizing:border-box;outline:1px dashed var(--co-color-primary-azul);outline-offset:-1px;background:color-mix(in srgb, var(--co-color-primary-azul) 6%, transparent);color:var(--co-semantic-text-link, var(--co-color-primary-azul));font-size:var(--co-font-size-12);user-select:none;cursor:grab}.co-doc-signature:active{cursor:grabbing}.co-doc-signature.ProseMirror-selectednode{outline-style:solid;background:color-mix(in srgb, var(--co-color-primary-azul) 14%, transparent)}.co-doc-hb{background:color-mix(in srgb, var(--co-color-primary-azul) 12%, transparent);border-radius:var(--co-border-radius-xxs)}.co-doc-editor__zoom{display:inline-flex;flex-shrink:0;align-items:center;gap:var(--co-spacing-xxs);margin-inline-start:auto}.co-doc-editor__zoom-level{min-width:5ch;padding-inline:var(--co-spacing-xs);font-size:var(--co-font-size-13);font-variant-numeric:tabular-nums;text-align:end;color:var(--co-semantic-text-secondary)}.co-doc-editor__zoom-btn{padding:var(--co-spacing-xs) var(--co-spacing-sm2);border:0;border-radius:var(--co-border-radius-xs);background:transparent;color:var(--co-semantic-text-secondary);font:inherit;font-size:var(--co-font-size-13);white-space:nowrap;cursor:pointer}.co-doc-editor__zoom-btn:hover{background:var(--co-semantic-surface-hover)}.co-doc-editor__zoom-btn--active{background:var(--co-semantic-surface-hover);color:var(--co-semantic-text-default)}.co-doc-editor__zoom-btn:focus-visible{outline:1px solid var(--co-semantic-border-focus);box-shadow:0 0 0 2px var(--co-semantic-border-focus-ring)}.co-doc-editor__zoom-frame{margin-inline:auto}.co-doc-editor__stage{width:var(--co-doc-page-w);transform-origin:top left}.co-doc-editor__sheet{--co-semantic-surface-page:var(--co-color-base-blanco);--co-semantic-surface-hover:var(--co-color-opacity-negro-8);--co-semantic-text-default:var(--co-color-base-negro);--co-semantic-text-secondary:var(--co-color-gray-600);--co-semantic-text-muted:var(--co-color-gray-500);--co-semantic-border-default:var(--co-color-opacity-negro-16);--co-semantic-border-subtle:var(--co-color-opacity-negro-8);--co-semantic-border-field:var(--co-color-opacity-negro-25);--co-semantic-border-focus:var(--co-color-opacity-negro-50);--co-semantic-border-focus-ring:var(--co-color-opacity-negro-8);--co-semantic-text-link:var(--co-color-primary-azul);position:relative;width:var(--co-doc-page-w);min-height:calc(var(--co-doc-pages, 1) * var(--co-doc-page-h) + (var(--co-doc-pages, 1) - 1) * var(--co-doc-gap));box-sizing:border-box;padding-top:calc(var(--co-doc-margin-top) + var(--co-doc-header-h, 0px));padding-right:var(--co-doc-margin-right);padding-bottom:var(--co-doc-margin-bottom);padding-left:var(--co-doc-margin-left);overflow:clip;background:var(--co-color-base-blanco);color:var(--co-color-base-negro);color-scheme:light;box-shadow:var(--co-doc-sheet-shadow)}.co-doc-editor__paper{display:contents;color:var(--co-semantic-text-default)}.co-doc-editor .co-doc-editor__sheet .co-doc-editor__content .ProseMirror.tiptap{padding:0 !important;min-height:1em}.co-doc-editor__header-band{position:absolute;top:var(--co-doc-margin-top);left:var(--co-doc-margin-left);right:var(--co-doc-margin-right);height:var(--co-doc-header-h);box-sizing:border-box}.co-doc-editor__header-band[hidden]{display:none}.co-doc-editor__header-band:hover{outline:1px dashed var(--co-color-opacity-negro-25)}.co-doc-editor__header-static{display:flex;align-items:center;justify-content:space-between;height:100%;overflow:hidden;font-size:var(--co-font-size-12);line-height:1.5;user-select:none}.co-doc-editor__header-html{flex:1 1 auto;min-width:0;max-height:100%;overflow:hidden}.co-doc-editor__page-number{flex-shrink:0;margin-inline-start:var(--co-spacing-sm2);white-space:nowrap;color:var(--co-color-gray-600)}.co-doc-page-gap,.co-doc-page-gap__foot,.co-doc-page-gap__between,.co-doc-page-gap__head{margin:0 !important;padding:0 !important;border-width:0 !important;box-sizing:border-box !important}.co-doc-editor__sheet .co-doc-page-gap{position:relative;margin-left:calc(-1 * var(--co-doc-margin-left)) !important;margin-right:calc(-1 * var(--co-doc-margin-right)) !important;user-select:none}.co-doc-page-gap__between{background:var(--co-doc-canvas);border-image:linear-gradient(var(--co-doc-canvas), var(--co-doc-canvas)) fill 0 / 0 / 0 100vmax;box-shadow:inset 0 1px 0 var(--co-color-opacity-negro-8), inset 0 4px 3px -3px var(--co-color-opacity-negro-16), inset 0 -1px 0 var(--co-color-opacity-negro-8)}:is(ul,ol)>.co-doc-page-gap{list-style:none}.co-doc-editor__sheet .co-doc-page-gap__head{padding-top:var(--co-doc-margin-top) !important;padding-left:var(--co-doc-margin-left) !important;padding-right:var(--co-doc-margin-right) !important}.co-doc-page-gap-row>td{padding:0 !important;border:0 !important;background:transparent !important}.co-doc-editor__header-band--editing,.co-doc-editor__header-band--editing:hover{outline:1px solid var(--co-semantic-border-focus);outline-offset:2px}.co-doc-editor__header-editing{display:flex;align-items:center;gap:var(--co-spacing-sm2);height:100%}.co-doc-editor__header-editor{flex:1 1 auto;min-width:0;max-height:100%;overflow:hidden;font-size:var(--co-font-size-12);line-height:1.5}.co-doc-editor__header-editor .ProseMirror{outline:none}.co-doc-editor__header-tools{position:absolute;right:0;bottom:100%;display:flex;align-items:center;gap:var(--co-spacing-xs);padding:var(--co-spacing-xxs) var(--co-spacing-xs);box-sizing:border-box;background:var(--co-semantic-surface-page);border:1px solid var(--co-semantic-border-default);border-radius:var(--co-border-radius-xs)}.co-doc-editor__image-bar{position:absolute;z-index:2;display:flex;gap:var(--co-spacing-xxs);padding:var(--co-spacing-xxs);box-sizing:border-box;background:var(--co-semantic-surface-page);border:1px solid var(--co-semantic-border-default);border-radius:var(--co-border-radius-xs);user-select:none}.co-doc-editor__image-bar co-tooltip{display:inline-flex}.co-doc-editor__image-mode{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:0;border-radius:var(--co-border-radius-xxs);background:transparent;color:var(--co-semantic-text-default);cursor:pointer}.co-doc-editor__image-mode:hover,.co-doc-editor__image-mode--active{background:var(--co-semantic-surface-hover)}.co-doc-editor__image-mode--active{box-shadow:inset 0 0 0 1px var(--co-semantic-border-focus)}.co-doc-editor__image-mode:focus-visible{outline:1px solid var(--co-semantic-border-focus);box-shadow:0 0 0 2px var(--co-semantic-border-focus-ring)}.co-doc-editor__image-mode--active:focus-visible{box-shadow:inset 0 0 0 1px var(--co-semantic-border-focus), 0 0 0 2px var(--co-semantic-border-focus-ring)}.co-doc-editor__sig-bar{position:absolute;z-index:2;display:flex;align-items:center;gap:var(--co-spacing-xxs);padding:var(--co-spacing-xxs);box-sizing:border-box;background:var(--co-semantic-surface-page);border:1px solid var(--co-semantic-border-default);border-radius:var(--co-border-radius-xs);color:var(--co-semantic-text-default);font-family:var(--co-font-family-primary);font-size:var(--co-font-size-12);user-select:none}.co-doc-editor__sig-bar co-tooltip{display:inline-flex}.co-doc-editor__sig-duplicate,.co-doc-editor__sig-step{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;box-sizing:border-box;border:0;border-radius:var(--co-border-radius-xxs);background:transparent;color:inherit;font:inherit;cursor:pointer}.co-doc-editor__sig-duplicate{width:96px;height:28px;gap:var(--co-spacing-xs);padding:0 var(--co-spacing-sm)}.co-doc-editor__sig-duplicate co-icon{flex-shrink:0}.co-doc-editor__sig-duplicate-text{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-doc-editor__sig-step{width:28px;height:28px;padding:0}.co-doc-editor__sig-duplicate:hover,.co-doc-editor__sig-step:hover:not(:disabled){background:var(--co-semantic-surface-hover)}.co-doc-editor__sig-step:disabled{color:var(--co-semantic-text-muted);cursor:default}.co-doc-editor__sig-duplicate:focus-visible,.co-doc-editor__sig-step:focus-visible{outline:1px solid var(--co-semantic-border-focus);box-shadow:0 0 0 2px var(--co-semantic-border-focus-ring)}.co-doc-editor__sig-sep{width:1px;align-self:stretch;background:var(--co-semantic-border-default)}.co-doc-editor__sig-label{width:88px;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}";export{R as co_document_editor}