@limetech/lime-crm-building-blocks 1.116.0 → 1.116.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (480) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/{_Map-60aae0ed.js → _Map-BlpAtLvq.js} +12 -24
  3. package/dist/cjs/{_MapCache-8b125fbb.js → _MapCache-De1Fwe0H.js} +5 -7
  4. package/dist/cjs/{_Uint8Array-95263550.js → _Uint8Array-C_lvn5HO.js} +6 -14
  5. package/dist/cjs/{_baseIsEqual-f2d60d3e.js → _baseIsEqual-BtwicGmu.js} +4 -4
  6. package/dist/cjs/{_defineProperty-40a6ad5d.js → _defineProperty-eImBwVFM.js} +2 -4
  7. package/dist/cjs/{_getTag-8809c5c6.js → _getTag-CdUodI28.js} +18 -39
  8. package/dist/cjs/{get-932b213e.js → get-BRGtX379.js} +6 -14
  9. package/dist/cjs/{index-519b904a.js → index-C_OnxXhP.js} +541 -322
  10. package/dist/cjs/index.esm-DhBVH875.js +838 -0
  11. package/dist/cjs/{isSymbol-5b36aeee.js → isSymbol-D8S28StA.js} +1 -1
  12. package/dist/cjs/lime-crm-building-blocks.cjs.js +7 -7
  13. package/dist/cjs/{lime-query-validation-c118b96d.js → lime-query-validation-CWlZPm8m.js} +8 -8
  14. package/dist/cjs/limebb-alert-dialog.cjs.entry.js +5 -8
  15. package/dist/cjs/limebb-browser.cjs.entry.js +11 -14
  16. package/dist/cjs/limebb-chat-icon-list_3.cjs.entry.js +15 -20
  17. package/dist/cjs/limebb-chat-list.cjs.entry.js +11 -12
  18. package/dist/cjs/limebb-component-config.cjs.entry.js +17 -16
  19. package/dist/cjs/limebb-component-picker.cjs.entry.js +9 -12
  20. package/dist/cjs/limebb-composer-toolbar.cjs.entry.js +9 -12
  21. package/dist/cjs/limebb-currency-picker.cjs.entry.js +1907 -1790
  22. package/dist/cjs/limebb-dashboard-widget.cjs.entry.js +4 -7
  23. package/dist/cjs/limebb-data-cells.cjs.entry.js +5 -8
  24. package/dist/cjs/limebb-date-picker.cjs.entry.js +7 -9
  25. package/dist/cjs/limebb-date-range.cjs.entry.js +6 -9
  26. package/dist/cjs/limebb-document-chips.cjs.entry.js +10 -11
  27. package/dist/cjs/limebb-document-item.cjs.entry.js +6 -9
  28. package/dist/cjs/limebb-document-picker.cjs.entry.js +6 -9
  29. package/dist/cjs/limebb-empty-state.cjs.entry.js +3 -6
  30. package/dist/cjs/limebb-feed-item-thumbnail-file-info.cjs.entry.js +4 -7
  31. package/dist/cjs/limebb-feed-timeline-item.cjs.entry.js +8 -11
  32. package/dist/cjs/limebb-feed.cjs.entry.js +430 -168
  33. package/dist/cjs/limebb-icon-picker.cjs.entry.js +4 -6
  34. package/dist/cjs/limebb-info-tile-currency-format.cjs.entry.js +2 -4
  35. package/dist/cjs/limebb-info-tile-date-format.cjs.entry.js +4 -7
  36. package/dist/cjs/limebb-info-tile-decimal-format.cjs.entry.js +2 -4
  37. package/dist/cjs/limebb-info-tile-format.cjs.entry.js +5 -8
  38. package/dist/cjs/limebb-info-tile-relative-date-format.cjs.entry.js +2 -4
  39. package/dist/cjs/limebb-info-tile-unit-format.cjs.entry.js +2 -4
  40. package/dist/cjs/limebb-info-tile.cjs.entry.js +27 -24
  41. package/dist/cjs/limebb-kanban-group.cjs.entry.js +8 -11
  42. package/dist/cjs/limebb-kanban-item.cjs.entry.js +8 -11
  43. package/dist/cjs/limebb-kanban.cjs.entry.js +5 -8
  44. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +9 -12
  45. package/dist/cjs/limebb-lime-query-filter-builder_3.cjs.entry.js +27 -29
  46. package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +26 -30
  47. package/dist/cjs/limebb-lime-query-filter-group_3.cjs.entry.js +25 -30
  48. package/dist/cjs/limebb-lime-query-order-by-item.cjs.entry.js +6 -9
  49. package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +9 -12
  50. package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +8 -12
  51. package/dist/cjs/limebb-limeobject-file-viewer.cjs.entry.js +9 -12
  52. package/dist/cjs/limebb-live-docs-info.cjs.entry.js +5 -8
  53. package/dist/cjs/limebb-loader.cjs.entry.js +12 -10
  54. package/dist/cjs/limebb-locale-picker.cjs.entry.js +29 -49
  55. package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +5 -8
  56. package/dist/cjs/limebb-mention.cjs.entry.js +6 -9
  57. package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +10 -14
  58. package/dist/cjs/limebb-notification-item.cjs.entry.js +9 -12
  59. package/dist/cjs/limebb-notification-list.cjs.entry.js +10 -11
  60. package/dist/cjs/limebb-object-chip.cjs.entry.js +16 -15
  61. package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +9 -10
  62. package/dist/cjs/limebb-property-selector.cjs.entry.js +9 -12
  63. package/dist/cjs/limebb-text-editor-picker.cjs.entry.js +9 -10
  64. package/dist/cjs/limebb-text-editor.cjs.entry.js +53 -307
  65. package/dist/cjs/limebb-trend-indicator.cjs.entry.js +8 -9
  66. package/dist/cjs/{limetype-3c1c53b6.js → limetype-6tkuY6nm.js} +2 -2
  67. package/dist/cjs/loader.cjs.js +3 -5
  68. package/dist/collection/collection-manifest.json +3 -2
  69. package/dist/collection/components/alert-dialog/alert-dialog.css +133 -1
  70. package/dist/collection/components/alert-dialog/alert-dialog.js +11 -10
  71. package/dist/collection/components/browser/browser.js +14 -9
  72. package/dist/collection/components/chat-list/chat-icon-list/chat-icon-list.css +9 -11
  73. package/dist/collection/components/chat-list/chat-icon-list/chat-icon-list.js +3 -2
  74. package/dist/collection/components/chat-list/chat-item/chat-item.css +9 -0
  75. package/dist/collection/components/chat-list/chat-item/chat-item.js +11 -8
  76. package/dist/collection/components/chat-list/chat-list.css +9 -0
  77. package/dist/collection/components/chat-list/chat-list.js +15 -12
  78. package/dist/collection/components/chat-list/typing-indicator/typing-indicator.js +1 -1
  79. package/dist/collection/components/component-command-picker/component-config/component-config.js +23 -19
  80. package/dist/collection/components/component-command-picker/component-picker/component-picker.js +21 -18
  81. package/dist/collection/components/composer-toolbar/composer-toolbar.js +14 -10
  82. package/dist/collection/components/currency-picker/currency-picker.js +15 -13
  83. package/dist/collection/components/dashboard-widget/dashboard-widget.js +11 -10
  84. package/dist/collection/components/data-cells/data-cells.css +9 -0
  85. package/dist/collection/components/data-cells/data-cells.js +8 -5
  86. package/dist/collection/components/date-picker/date-picker.js +20 -17
  87. package/dist/collection/components/date-range/date-range.js +19 -15
  88. package/dist/collection/components/document-chips/document-chips.js +5 -4
  89. package/dist/collection/components/document-picker/document-item/document-item.js +13 -8
  90. package/dist/collection/components/document-picker/document-picker.css +9 -0
  91. package/dist/collection/components/document-picker/document-picker.js +18 -13
  92. package/dist/collection/components/empty-state/empty-state.js +6 -5
  93. package/dist/collection/components/feed/feed-item/feed-timeline-item.css +41 -11
  94. package/dist/collection/components/feed/feed-item/feed-timeline-item.js +12 -9
  95. package/dist/collection/components/feed/feed-item-thumbnail-file-info/feed-item-thumbnail-file-info.css +9 -0
  96. package/dist/collection/components/feed/feed-item-thumbnail-file-info/feed-item-thumbnail-file-info.js +3 -3
  97. package/dist/collection/components/feed/feed.js +21 -18
  98. package/dist/collection/components/icon-picker/icon-picker.js +15 -15
  99. package/dist/collection/components/info-tile/format/config/info-tile-currency-format.js +8 -4
  100. package/dist/collection/components/info-tile/format/config/info-tile-date-format.js +4 -2
  101. package/dist/collection/components/info-tile/format/config/info-tile-decimal-format.js +4 -2
  102. package/dist/collection/components/info-tile/format/config/info-tile-format.js +11 -7
  103. package/dist/collection/components/info-tile/format/config/info-tile-relative-date-format.js +4 -2
  104. package/dist/collection/components/info-tile/format/config/info-tile-unit-format.js +4 -2
  105. package/dist/collection/components/info-tile/info-tile.js +29 -23
  106. package/dist/collection/components/kanban/kanban-group/kanban-group.css +25 -9
  107. package/dist/collection/components/kanban/kanban-group/kanban-group.js +19 -16
  108. package/dist/collection/components/kanban/kanban-item/kanban-item.css +9 -0
  109. package/dist/collection/components/kanban/kanban-item/kanban-item.js +9 -5
  110. package/dist/collection/components/kanban/kanban.js +10 -5
  111. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-builder.js +12 -8
  112. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +11 -9
  113. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-expression.css +9 -0
  114. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-expression.js +14 -10
  115. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.css +9 -0
  116. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +14 -10
  117. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.css +9 -0
  118. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +15 -11
  119. package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.js +17 -14
  120. package/dist/collection/components/lime-query-builder/lime-query-builder.js +13 -9
  121. package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +13 -9
  122. package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +22 -19
  123. package/dist/collection/components/lime-query-builder/order-by/order-by-editor.js +12 -8
  124. package/dist/collection/components/lime-query-builder/order-by/order-by-item.js +12 -8
  125. package/dist/collection/components/lime-query-builder/property-selector/property-selector.js +12 -10
  126. package/dist/collection/components/lime-query-builder/response-format/response-format-editor.js +11 -7
  127. package/dist/collection/components/lime-query-builder/response-format/response-format-item.css +17 -1
  128. package/dist/collection/components/lime-query-builder/response-format/response-format-item.js +11 -7
  129. package/dist/collection/components/limeobject/file-viewer/file-viewer.js +8 -5
  130. package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
  131. package/dist/collection/components/loader/loader.js +4 -2
  132. package/dist/collection/components/locale-picker/locale-picker.js +23 -19
  133. package/dist/collection/components/mention/mention.js +4 -4
  134. package/dist/collection/components/navigation-button/navigation-button.css +24 -1
  135. package/dist/collection/components/navigation-button/navigation-button.js +10 -9
  136. package/dist/collection/components/notification-list/notification-item/notification-item.css +9 -0
  137. package/dist/collection/components/notification-list/notification-item/notification-item.js +9 -5
  138. package/dist/collection/components/notification-list/notification-list.css +9 -0
  139. package/dist/collection/components/notification-list/notification-list.js +12 -8
  140. package/dist/collection/components/object-chip/object-chip.js +7 -6
  141. package/dist/collection/components/percentage-visualizer/percentage-visualizer.css +9 -0
  142. package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +21 -19
  143. package/dist/collection/components/summary-popover/summary-popover.js +28 -21
  144. package/dist/collection/components/text-editor/mention-group-counter.js +8 -7
  145. package/dist/collection/components/text-editor/text-editor-picker.js +10 -7
  146. package/dist/collection/components/text-editor/text-editor.js +37 -29
  147. package/dist/collection/components/trend-indicator/trend-indicator.css +9 -0
  148. package/dist/collection/components/trend-indicator/trend-indicator.js +19 -17
  149. package/dist/components/_Map.js +1 -342
  150. package/dist/components/_MapCache.js +1 -433
  151. package/dist/components/_Uint8Array.js +1 -349
  152. package/dist/components/_baseIsEqual.js +1 -494
  153. package/dist/components/_defineProperty.js +1 -13
  154. package/dist/components/_getTag.js +1 -421
  155. package/dist/components/chat-icon-list.js +1 -55
  156. package/dist/components/chat-item.js +1 -184
  157. package/dist/components/currency-picker.js +1 -1917
  158. package/dist/components/date-picker.js +1 -151
  159. package/dist/components/document-item.js +1 -212
  160. package/dist/components/dom.js +1 -26
  161. package/dist/components/empty-state.js +1 -61
  162. package/dist/components/extension-mapping.js +1 -55
  163. package/dist/components/feed-item-thumbnail-file-info.js +1 -33
  164. package/dist/components/feed-timeline-item.js +1 -453
  165. package/dist/components/get.js +1 -308
  166. package/dist/components/highlight-item.handler.js +1 -36
  167. package/dist/components/index.d.ts +2 -0
  168. package/dist/components/index.esm.js +1 -963
  169. package/dist/components/index.js +1 -1
  170. package/dist/components/isSymbol.js +1 -28
  171. package/dist/components/kanban-group.js +1 -148
  172. package/dist/components/kanban-item.js +1 -182
  173. package/dist/components/keycodes.js +1 -7
  174. package/dist/components/lime-query-filter-builder.js +1 -132
  175. package/dist/components/lime-query-filter-comparison.js +1 -180
  176. package/dist/components/lime-query-filter-expression.js +1 -420
  177. package/dist/components/lime-query-validation.js +1 -617
  178. package/dist/components/lime-query-value-input.js +1 -387
  179. package/dist/components/limebb-alert-dialog.js +1 -71
  180. package/dist/components/limebb-browser.js +1 -116
  181. package/dist/components/limebb-chat-icon-list.js +1 -6
  182. package/dist/components/limebb-chat-item.js +1 -6
  183. package/dist/components/limebb-chat-list.js +1 -302
  184. package/dist/components/limebb-component-config.js +1 -176
  185. package/dist/components/limebb-component-picker.js +1 -180
  186. package/dist/components/limebb-composer-toolbar.js +1 -136
  187. package/dist/components/limebb-currency-picker.js +1 -6
  188. package/dist/components/limebb-dashboard-widget.js +1 -48
  189. package/dist/components/limebb-data-cells.js +1 -169
  190. package/dist/components/limebb-date-picker.js +1 -6
  191. package/dist/components/limebb-date-range.js +1 -83
  192. package/dist/components/limebb-document-chips.js +1 -437
  193. package/dist/components/limebb-document-item.js +1 -6
  194. package/dist/components/limebb-document-picker.js +1 -111
  195. package/dist/components/limebb-empty-state.js +1 -6
  196. package/dist/components/limebb-feed-item-thumbnail-file-info.js +1 -6
  197. package/dist/components/limebb-feed-timeline-item.js +1 -6
  198. package/dist/components/limebb-feed.js +1 -398
  199. package/dist/components/limebb-icon-picker.js +1 -53026
  200. package/dist/components/limebb-info-tile-currency-format.js +1 -116
  201. package/dist/components/limebb-info-tile-date-format.js +1 -272
  202. package/dist/components/limebb-info-tile-decimal-format.js +1 -95
  203. package/dist/components/limebb-info-tile-format.js +1 -144
  204. package/dist/components/limebb-info-tile-relative-date-format.js +1 -72
  205. package/dist/components/limebb-info-tile-unit-format.js +1 -183
  206. package/dist/components/limebb-info-tile.js +1 -626
  207. package/dist/components/limebb-kanban-group.js +1 -6
  208. package/dist/components/limebb-kanban-item.js +1 -6
  209. package/dist/components/limebb-kanban.js +1 -79
  210. package/dist/components/limebb-lime-query-builder.js +1 -424
  211. package/dist/components/limebb-lime-query-filter-builder.js +1 -6
  212. package/dist/components/limebb-lime-query-filter-comparison.js +1 -6
  213. package/dist/components/limebb-lime-query-filter-expression.js +1 -6
  214. package/dist/components/limebb-lime-query-filter-group.js +1 -6
  215. package/dist/components/limebb-lime-query-filter-not.js +1 -6
  216. package/dist/components/limebb-lime-query-order-by-editor.js +1 -6
  217. package/dist/components/limebb-lime-query-order-by-item.js +1 -6
  218. package/dist/components/limebb-lime-query-response-format-builder.js +1 -310
  219. package/dist/components/limebb-lime-query-response-format-editor.js +1 -6
  220. package/dist/components/limebb-lime-query-response-format-item.js +1 -6
  221. package/dist/components/limebb-lime-query-value-input.js +1 -6
  222. package/dist/components/limebb-limeobject-file-viewer.js +1 -175
  223. package/dist/components/limebb-limetype-field.js +1 -6
  224. package/dist/components/limebb-live-docs-info.js +1 -6
  225. package/dist/components/limebb-loader.js +1 -78
  226. package/dist/components/limebb-locale-picker.js +1 -1165
  227. package/dist/components/limebb-mention-group-counter.js +1 -48
  228. package/dist/components/limebb-mention.js +1 -79
  229. package/dist/components/limebb-navigation-button.js +1 -6
  230. package/dist/components/limebb-notification-item.js +1 -6
  231. package/dist/components/limebb-notification-list.js +1 -253
  232. package/dist/components/limebb-object-chip.js +1 -253
  233. package/dist/components/limebb-percentage-visualizer.js +1 -6
  234. package/dist/components/limebb-property-selector.js +1 -6
  235. package/dist/components/limebb-summary-popover.js +1 -6
  236. package/dist/components/limebb-text-editor-picker.js +1 -6
  237. package/dist/components/limebb-text-editor.js +1 -1902
  238. package/dist/components/limebb-trend-indicator.js +1 -175
  239. package/dist/components/limebb-typing-indicator.js +1 -6
  240. package/dist/components/limetype-field.js +1 -216
  241. package/dist/components/limetype.js +1 -85
  242. package/dist/components/live-docs-info.js +1 -34
  243. package/dist/components/navigation-button.js +1 -74
  244. package/dist/components/negate.js +1 -40
  245. package/dist/components/non-null.js +1 -10
  246. package/dist/components/notification-item.js +1 -168
  247. package/dist/components/order-by-editor.js +1 -139
  248. package/dist/components/order-by-item.js +1 -73
  249. package/dist/components/percentage-class.js +1 -64
  250. package/dist/components/percentage-visualizer.js +1 -219
  251. package/dist/components/property-selector.js +1 -372
  252. package/dist/components/random-string.js +1 -22
  253. package/dist/components/response-format-editor.js +1 -331
  254. package/dist/components/response-format-item.js +1 -126
  255. package/dist/components/summary-popover.js +1 -159
  256. package/dist/components/text-editor-picker.js +1 -128
  257. package/dist/components/typing-indicator.js +1 -31
  258. package/dist/esm/{_Map-aede53b6.js → _Map-ByjZfyP_.js} +8 -20
  259. package/dist/esm/{_MapCache-af496e9d.js → _MapCache-C_kVhYUl.js} +5 -7
  260. package/dist/esm/{_Uint8Array-d6ebd526.js → _Uint8Array-DVXPnoWk.js} +6 -10
  261. package/dist/esm/{_baseIsEqual-077b6bb3.js → _baseIsEqual-DB13O4pD.js} +4 -4
  262. package/dist/esm/{_defineProperty-e6a185c3.js → _defineProperty-DSmG08hO.js} +2 -4
  263. package/dist/esm/{_getTag-d02a95fa.js → _getTag-DZlkp9mJ.js} +12 -32
  264. package/dist/esm/{get-3e42932b.js → get-Bo260bSC.js} +6 -14
  265. package/dist/esm/{index-d86e55c0.js → index-BIwHMk6j.js} +539 -300
  266. package/dist/esm/index.esm-BjlE4usG.js +823 -0
  267. package/dist/esm/{isSymbol-1c5f65cc.js → isSymbol-Ci8cASb6.js} +1 -1
  268. package/dist/esm/lime-crm-building-blocks.js +6 -5
  269. package/dist/esm/{lime-query-validation-01797a51.js → lime-query-validation-S9h8L6bg.js} +8 -8
  270. package/dist/esm/limebb-alert-dialog.entry.js +5 -6
  271. package/dist/esm/limebb-browser.entry.js +11 -12
  272. package/dist/esm/limebb-chat-icon-list_3.entry.js +15 -18
  273. package/dist/esm/limebb-chat-list.entry.js +11 -10
  274. package/dist/esm/limebb-component-config.entry.js +17 -14
  275. package/dist/esm/limebb-component-picker.entry.js +9 -10
  276. package/dist/esm/limebb-composer-toolbar.entry.js +9 -10
  277. package/dist/esm/limebb-currency-picker.entry.js +1908 -1789
  278. package/dist/esm/limebb-dashboard-widget.entry.js +4 -5
  279. package/dist/esm/limebb-data-cells.entry.js +5 -6
  280. package/dist/esm/limebb-date-picker.entry.js +7 -7
  281. package/dist/esm/limebb-date-range.entry.js +6 -7
  282. package/dist/esm/limebb-document-chips.entry.js +10 -9
  283. package/dist/esm/limebb-document-item.entry.js +6 -7
  284. package/dist/esm/limebb-document-picker.entry.js +6 -7
  285. package/dist/esm/limebb-empty-state.entry.js +3 -4
  286. package/dist/esm/limebb-feed-item-thumbnail-file-info.entry.js +4 -5
  287. package/dist/esm/limebb-feed-timeline-item.entry.js +8 -9
  288. package/dist/esm/limebb-feed.entry.js +430 -166
  289. package/dist/esm/limebb-icon-picker.entry.js +4 -4
  290. package/dist/esm/limebb-info-tile-currency-format.entry.js +2 -2
  291. package/dist/esm/limebb-info-tile-date-format.entry.js +4 -5
  292. package/dist/esm/limebb-info-tile-decimal-format.entry.js +2 -2
  293. package/dist/esm/limebb-info-tile-format.entry.js +5 -6
  294. package/dist/esm/limebb-info-tile-relative-date-format.entry.js +2 -2
  295. package/dist/esm/limebb-info-tile-unit-format.entry.js +2 -2
  296. package/dist/esm/limebb-info-tile.entry.js +27 -22
  297. package/dist/esm/limebb-kanban-group.entry.js +8 -9
  298. package/dist/esm/limebb-kanban-item.entry.js +8 -9
  299. package/dist/esm/limebb-kanban.entry.js +5 -6
  300. package/dist/esm/limebb-lime-query-builder.entry.js +9 -10
  301. package/dist/esm/limebb-lime-query-filter-builder_3.entry.js +27 -27
  302. package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +26 -28
  303. package/dist/esm/limebb-lime-query-filter-group_3.entry.js +25 -28
  304. package/dist/esm/limebb-lime-query-order-by-item.entry.js +6 -7
  305. package/dist/esm/limebb-lime-query-response-format-builder.entry.js +9 -10
  306. package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +8 -10
  307. package/dist/esm/limebb-limeobject-file-viewer.entry.js +9 -10
  308. package/dist/esm/limebb-live-docs-info.entry.js +5 -6
  309. package/dist/esm/limebb-loader.entry.js +12 -8
  310. package/dist/esm/limebb-locale-picker.entry.js +29 -47
  311. package/dist/esm/limebb-mention-group-counter.entry.js +5 -6
  312. package/dist/esm/limebb-mention.entry.js +6 -7
  313. package/dist/esm/limebb-navigation-button_2.entry.js +10 -12
  314. package/dist/esm/limebb-notification-item.entry.js +9 -10
  315. package/dist/esm/limebb-notification-list.entry.js +10 -9
  316. package/dist/esm/limebb-object-chip.entry.js +16 -13
  317. package/dist/esm/limebb-percentage-visualizer.entry.js +9 -8
  318. package/dist/esm/limebb-property-selector.entry.js +9 -10
  319. package/dist/esm/limebb-text-editor-picker.entry.js +9 -8
  320. package/dist/esm/limebb-text-editor.entry.js +53 -305
  321. package/dist/esm/limebb-trend-indicator.entry.js +8 -7
  322. package/dist/esm/{limetype-12fbba0f.js → limetype-B3nph1qc.js} +3 -3
  323. package/dist/esm/loader.js +4 -4
  324. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  325. package/dist/lime-crm-building-blocks/{p-eb4aa158.entry.js → p-0afc0db2.entry.js} +1 -1
  326. package/dist/lime-crm-building-blocks/p-12aadae6.entry.js +1 -0
  327. package/dist/lime-crm-building-blocks/p-1428aa13.entry.js +1 -0
  328. package/dist/lime-crm-building-blocks/p-152edb10.entry.js +1 -0
  329. package/dist/lime-crm-building-blocks/p-1a61674f.entry.js +1 -0
  330. package/dist/lime-crm-building-blocks/p-1f02a411.entry.js +1 -0
  331. package/dist/lime-crm-building-blocks/p-21ec697f.entry.js +1 -0
  332. package/dist/lime-crm-building-blocks/p-3252e153.entry.js +1 -0
  333. package/dist/lime-crm-building-blocks/p-3263f8d5.entry.js +1 -0
  334. package/dist/lime-crm-building-blocks/p-32f8477f.entry.js +1 -0
  335. package/dist/lime-crm-building-blocks/p-35a51259.entry.js +1 -0
  336. package/dist/lime-crm-building-blocks/p-38201f65.entry.js +1 -0
  337. package/dist/lime-crm-building-blocks/p-3ef87b11.entry.js +1 -0
  338. package/dist/lime-crm-building-blocks/p-43e22f6d.entry.js +1 -0
  339. package/dist/lime-crm-building-blocks/{p-e79f16ca.entry.js → p-4446f170.entry.js} +1 -1
  340. package/dist/lime-crm-building-blocks/p-4625a9c5.entry.js +1 -0
  341. package/dist/lime-crm-building-blocks/{p-77e7d7da.entry.js → p-49afe71b.entry.js} +1 -1
  342. package/dist/lime-crm-building-blocks/p-4ddd75bc.entry.js +1 -0
  343. package/dist/lime-crm-building-blocks/p-528f3635.entry.js +1 -0
  344. package/dist/lime-crm-building-blocks/p-52fb2a66.entry.js +1 -0
  345. package/dist/lime-crm-building-blocks/p-60e22f51.entry.js +1 -0
  346. package/dist/lime-crm-building-blocks/p-62437a1d.entry.js +1 -0
  347. package/dist/lime-crm-building-blocks/p-626421bf.entry.js +1 -0
  348. package/dist/lime-crm-building-blocks/p-685dd8a1.entry.js +1 -0
  349. package/dist/lime-crm-building-blocks/{p-5277ceca.entry.js → p-6cb2d9dd.entry.js} +1 -1
  350. package/dist/lime-crm-building-blocks/p-6fdee70a.entry.js +1 -0
  351. package/dist/lime-crm-building-blocks/p-71191041.entry.js +1 -0
  352. package/dist/lime-crm-building-blocks/{p-f7122d8e.entry.js → p-740ae712.entry.js} +1 -1
  353. package/dist/lime-crm-building-blocks/p-8477cb5d.entry.js +1 -0
  354. package/dist/lime-crm-building-blocks/{p-50aad872.entry.js → p-8e2cc2e8.entry.js} +1 -1
  355. package/dist/lime-crm-building-blocks/p-9ae55a96.entry.js +1 -0
  356. package/dist/lime-crm-building-blocks/p-B8RiYkLS.js +1 -0
  357. package/dist/lime-crm-building-blocks/p-BIwHMk6j.js +2 -0
  358. package/dist/lime-crm-building-blocks/p-BJ8HvfgI.js +1 -0
  359. package/dist/lime-crm-building-blocks/p-ByjZfyP_.js +1 -0
  360. package/dist/lime-crm-building-blocks/{p-0a266c26.js → p-CMfAKLlA.js} +1 -1
  361. package/dist/lime-crm-building-blocks/p-CQ-z_HTt.js +1 -0
  362. package/dist/lime-crm-building-blocks/p-CcGMZOP-.js +1 -0
  363. package/dist/lime-crm-building-blocks/p-Dm_AIMQj.js +1 -0
  364. package/dist/lime-crm-building-blocks/p-V3xfp9dg.js +1 -0
  365. package/dist/lime-crm-building-blocks/p-aaeecca6.entry.js +1 -0
  366. package/dist/lime-crm-building-blocks/p-ac59093c.entry.js +1 -0
  367. package/dist/lime-crm-building-blocks/p-acbc40f5.entry.js +1 -0
  368. package/dist/lime-crm-building-blocks/p-b2383e7f.entry.js +1 -0
  369. package/dist/lime-crm-building-blocks/p-b36ad4e8.entry.js +1 -0
  370. package/dist/lime-crm-building-blocks/{p-6fb504cb.entry.js → p-b3ee6683.entry.js} +1 -1
  371. package/dist/lime-crm-building-blocks/p-ba42e434.entry.js +1 -0
  372. package/dist/lime-crm-building-blocks/p-bac3d599.entry.js +1 -0
  373. package/dist/lime-crm-building-blocks/p-be8dc8ae.entry.js +1 -0
  374. package/dist/lime-crm-building-blocks/{p-0707d5b0.entry.js → p-c3b13800.entry.js} +1 -1
  375. package/dist/lime-crm-building-blocks/{p-b3ad9f5e.entry.js → p-c6bbcbee.entry.js} +1 -1
  376. package/dist/lime-crm-building-blocks/p-cff9bccd.entry.js +1 -0
  377. package/dist/lime-crm-building-blocks/p-d2a01f51.entry.js +1 -0
  378. package/dist/lime-crm-building-blocks/p-dabb227b.entry.js +1 -0
  379. package/dist/lime-crm-building-blocks/p-e2e9adff.entry.js +1 -0
  380. package/dist/lime-crm-building-blocks/p-ebe6040f.entry.js +1 -0
  381. package/dist/lime-crm-building-blocks/p-eec0a0c8.entry.js +1 -0
  382. package/dist/lime-crm-building-blocks/p-f23ea0e7.entry.js +1 -0
  383. package/dist/lime-crm-building-blocks/{p-0190354e.entry.js → p-fa41a9e6.entry.js} +1 -1
  384. package/dist/lime-crm-building-blocks/p-fcedbc77.entry.js +1 -0
  385. package/dist/lime-crm-building-blocks/p-fdf269f7.entry.js +1 -0
  386. package/dist/lime-crm-building-blocks/p-mljVfXwO.js +1 -0
  387. package/dist/lime-crm-building-blocks/p-wbuFLk-j.js +1 -0
  388. package/dist/lime-crm-building-blocks/p-yc--7_7T.js +1 -0
  389. package/dist/types/components.d.ts +608 -114
  390. package/dist/types/stencil-public-runtime.d.ts +192 -12
  391. package/package.json +10 -10
  392. package/dist/cjs/index.esm-e01e9bd4.js +0 -977
  393. package/dist/esm/index.esm-11a8b9e2.js +0 -963
  394. package/dist/lime-crm-building-blocks/p-121877f3.entry.js +0 -1
  395. package/dist/lime-crm-building-blocks/p-123190c3.js +0 -1
  396. package/dist/lime-crm-building-blocks/p-1317cdfa.entry.js +0 -1
  397. package/dist/lime-crm-building-blocks/p-199799ff.js +0 -1
  398. package/dist/lime-crm-building-blocks/p-1a89328d.entry.js +0 -1
  399. package/dist/lime-crm-building-blocks/p-1b361f60.entry.js +0 -1
  400. package/dist/lime-crm-building-blocks/p-2612f2f6.entry.js +0 -1
  401. package/dist/lime-crm-building-blocks/p-2babfa69.entry.js +0 -1
  402. package/dist/lime-crm-building-blocks/p-2d5e5ab5.entry.js +0 -1
  403. package/dist/lime-crm-building-blocks/p-331fced5.entry.js +0 -1
  404. package/dist/lime-crm-building-blocks/p-35897ec3.js +0 -1
  405. package/dist/lime-crm-building-blocks/p-3a16d7cf.entry.js +0 -1
  406. package/dist/lime-crm-building-blocks/p-3da67f32.entry.js +0 -1
  407. package/dist/lime-crm-building-blocks/p-3dd32e10.entry.js +0 -1
  408. package/dist/lime-crm-building-blocks/p-4894ca5d.entry.js +0 -1
  409. package/dist/lime-crm-building-blocks/p-4b494de7.entry.js +0 -1
  410. package/dist/lime-crm-building-blocks/p-4ca1caf4.entry.js +0 -1
  411. package/dist/lime-crm-building-blocks/p-4eb7a47c.entry.js +0 -1
  412. package/dist/lime-crm-building-blocks/p-50abea43.entry.js +0 -1
  413. package/dist/lime-crm-building-blocks/p-520df198.entry.js +0 -1
  414. package/dist/lime-crm-building-blocks/p-52cf8641.js +0 -2
  415. package/dist/lime-crm-building-blocks/p-5322fd19.js +0 -1
  416. package/dist/lime-crm-building-blocks/p-548e0f2a.entry.js +0 -1
  417. package/dist/lime-crm-building-blocks/p-579be797.entry.js +0 -1
  418. package/dist/lime-crm-building-blocks/p-6a87a407.entry.js +0 -1
  419. package/dist/lime-crm-building-blocks/p-6ad6a88d.entry.js +0 -1
  420. package/dist/lime-crm-building-blocks/p-7365ec1c.entry.js +0 -1
  421. package/dist/lime-crm-building-blocks/p-7e6fb4af.js +0 -1
  422. package/dist/lime-crm-building-blocks/p-81583fc8.entry.js +0 -1
  423. package/dist/lime-crm-building-blocks/p-85709273.entry.js +0 -1
  424. package/dist/lime-crm-building-blocks/p-87d3f42c.entry.js +0 -1
  425. package/dist/lime-crm-building-blocks/p-8dca4e46.entry.js +0 -1
  426. package/dist/lime-crm-building-blocks/p-95b6eaf5.entry.js +0 -1
  427. package/dist/lime-crm-building-blocks/p-973146f7.entry.js +0 -1
  428. package/dist/lime-crm-building-blocks/p-9c25aa2b.entry.js +0 -1
  429. package/dist/lime-crm-building-blocks/p-a959dd49.entry.js +0 -1
  430. package/dist/lime-crm-building-blocks/p-b2763851.entry.js +0 -1
  431. package/dist/lime-crm-building-blocks/p-b31772c8.js +0 -1
  432. package/dist/lime-crm-building-blocks/p-b675d5f0.entry.js +0 -1
  433. package/dist/lime-crm-building-blocks/p-b7959ddb.entry.js +0 -1
  434. package/dist/lime-crm-building-blocks/p-d298b34e.js +0 -1
  435. package/dist/lime-crm-building-blocks/p-d47b6c3c.js +0 -1
  436. package/dist/lime-crm-building-blocks/p-d9045aaa.entry.js +0 -1
  437. package/dist/lime-crm-building-blocks/p-d994067b.entry.js +0 -1
  438. package/dist/lime-crm-building-blocks/p-da42650a.entry.js +0 -1
  439. package/dist/lime-crm-building-blocks/p-dae67f66.entry.js +0 -1
  440. package/dist/lime-crm-building-blocks/p-dce9c951.entry.js +0 -1
  441. package/dist/lime-crm-building-blocks/p-dd5af257.entry.js +0 -1
  442. package/dist/lime-crm-building-blocks/p-ea4daa32.entry.js +0 -1
  443. package/dist/lime-crm-building-blocks/p-eb56d4eb.entry.js +0 -1
  444. package/dist/lime-crm-building-blocks/p-f788a48d.js +0 -1
  445. package/dist/lime-crm-building-blocks/p-fb292b3f.entry.js +0 -1
  446. package/dist/lime-crm-building-blocks/p-fe2b91d9.js +0 -1
  447. package/loader/package.json +0 -11
  448. /package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +0 -0
  449. /package/dist/cjs/{dom-2ea30350.js → dom--t_vVnyU.js} +0 -0
  450. /package/dist/cjs/{extension-mapping-63bdafd3.js → extension-mapping-CvK-Mz3f.js} +0 -0
  451. /package/dist/cjs/{file-extension-7c2eae39.js → file-extension-DolkaRwB.js} +0 -0
  452. /package/dist/cjs/{highlight-item.handler-584ab58a.js → highlight-item.handler-BVqvzXiD.js} +0 -0
  453. /package/dist/cjs/{keycodes-88522d7f.js → keycodes-BCQoLEdB.js} +0 -0
  454. /package/dist/cjs/{negate-e0a2bf77.js → negate-Bg3SqQh6.js} +0 -0
  455. /package/dist/cjs/{non-null-3bf14aa1.js → non-null-BMnREsqJ.js} +0 -0
  456. /package/dist/cjs/{percentage-class-012e94d9.js → percentage-class-DVoYzFLR.js} +0 -0
  457. /package/dist/cjs/{property-resolution-5f798b03.js → property-resolution-Bz1zPcfq.js} +0 -0
  458. /package/dist/cjs/{random-string-aac0a74b.js → random-string-BdZGIsGg.js} +0 -0
  459. /package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
  460. /package/dist/esm/{dom-9cc051d7.js → dom-B95D7tDb.js} +0 -0
  461. /package/dist/esm/{extension-mapping-fcade195.js → extension-mapping-Bcm94u_z.js} +0 -0
  462. /package/dist/esm/{file-extension-568475d1.js → file-extension-DtnPTzDv.js} +0 -0
  463. /package/dist/esm/{highlight-item.handler-dfbf11c0.js → highlight-item.handler-BWMpG2bS.js} +0 -0
  464. /package/dist/esm/{keycodes-58a1fcc9.js → keycodes-CwMJvF_Z.js} +0 -0
  465. /package/dist/esm/{negate-55744008.js → negate-ooVD-6_a.js} +0 -0
  466. /package/dist/esm/{non-null-5a66a269.js → non-null-CkTg5UPD.js} +0 -0
  467. /package/dist/esm/{percentage-class-2766f8ef.js → percentage-class-BaQl_Elp.js} +0 -0
  468. /package/dist/esm/{property-resolution-e4e8dcf7.js → property-resolution-CQUZjrU4.js} +0 -0
  469. /package/dist/esm/{random-string-f6ef6fbf.js → random-string-C2JP2nLw.js} +0 -0
  470. /package/dist/lime-crm-building-blocks/{p-4a85590d.js → p-B95D7tDb.js} +0 -0
  471. /package/dist/lime-crm-building-blocks/{p-66352a1e.js → p-BWMpG2bS.js} +0 -0
  472. /package/dist/lime-crm-building-blocks/{p-a99197b1.js → p-BaQl_Elp.js} +0 -0
  473. /package/dist/lime-crm-building-blocks/{p-ab2a95a6.js → p-Bcm94u_z.js} +0 -0
  474. /package/dist/lime-crm-building-blocks/{p-fbda77a7.js → p-C2JP2nLw.js} +0 -0
  475. /package/dist/lime-crm-building-blocks/{p-b02c99d5.js → p-CQUZjrU4.js} +0 -0
  476. /package/dist/lime-crm-building-blocks/{p-1484e300.js → p-CkTg5UPD.js} +0 -0
  477. /package/dist/lime-crm-building-blocks/{p-463d3174.js → p-CwMJvF_Z.js} +0 -0
  478. /package/dist/lime-crm-building-blocks/{p-e1255160.js → p-DQuL1Twl.js} +0 -0
  479. /package/dist/lime-crm-building-blocks/{p-b42e9740.js → p-DtnPTzDv.js} +0 -0
  480. /package/dist/lime-crm-building-blocks/{p-7c9484b1.js → p-ooVD-6_a.js} +0 -0
@@ -1,1902 +1 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { c, s as sr, b as cr, Z as Ze } from './index.esm.js';
3
- import { A as ARROW_DOWN, a as ESCAPE, b as ARROW_UP, E as ENTER, T as TAB } from './keycodes.js';
4
- import { b as arrayLikeKeys, k as keys, c as getSymbols, s as stubArray, a as arrayPush, d as baseGetAllKeys, U as Uint8Array, S as Stack, g as getAllKeys } from './_Uint8Array.js';
5
- import { d as defineProperty } from './_defineProperty.js';
6
- import { e as eq } from './_MapCache.js';
7
- import { d as isObject, r as root, S as Symbol, a as isObjectLike, i as isArray } from './_Map.js';
8
- import { d as isPrototype, i as isArrayLike, o as overArg, g as getTag, h as baseUnary, n as nodeUtil, a as isBuffer } from './_getTag.js';
9
- import { c as createRandomString } from './random-string.js';
10
- import { h as hasLabel, a as hasHasManyRelation, b as getRelationProperty } from './limetype.js';
11
- import { i as isNonNull } from './non-null.js';
12
- import { d as defineCustomElement$3 } from './empty-state.js';
13
- import { d as defineCustomElement$2 } from './text-editor-picker.js';
14
- import { i as isSymbol } from './isSymbol.js';
15
-
16
- /** Used to match a single whitespace character. */
17
- var reWhitespace = /\s/;
18
-
19
- /**
20
- * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
21
- * character of `string`.
22
- *
23
- * @private
24
- * @param {string} string The string to inspect.
25
- * @returns {number} Returns the index of the last non-whitespace character.
26
- */
27
- function trimmedEndIndex(string) {
28
- var index = string.length;
29
-
30
- while (index-- && reWhitespace.test(string.charAt(index))) {}
31
- return index;
32
- }
33
-
34
- /** Used to match leading whitespace. */
35
- var reTrimStart = /^\s+/;
36
-
37
- /**
38
- * The base implementation of `_.trim`.
39
- *
40
- * @private
41
- * @param {string} string The string to trim.
42
- * @returns {string} Returns the trimmed string.
43
- */
44
- function baseTrim(string) {
45
- return string
46
- ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
47
- : string;
48
- }
49
-
50
- /** Used as references for various `Number` constants. */
51
- var NAN = 0 / 0;
52
-
53
- /** Used to detect bad signed hexadecimal string values. */
54
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
55
-
56
- /** Used to detect binary string values. */
57
- var reIsBinary = /^0b[01]+$/i;
58
-
59
- /** Used to detect octal string values. */
60
- var reIsOctal = /^0o[0-7]+$/i;
61
-
62
- /** Built-in method references without a dependency on `root`. */
63
- var freeParseInt = parseInt;
64
-
65
- /**
66
- * Converts `value` to a number.
67
- *
68
- * @static
69
- * @memberOf _
70
- * @since 4.0.0
71
- * @category Lang
72
- * @param {*} value The value to process.
73
- * @returns {number} Returns the number.
74
- * @example
75
- *
76
- * _.toNumber(3.2);
77
- * // => 3.2
78
- *
79
- * _.toNumber(Number.MIN_VALUE);
80
- * // => 5e-324
81
- *
82
- * _.toNumber(Infinity);
83
- * // => Infinity
84
- *
85
- * _.toNumber('3.2');
86
- * // => 3.2
87
- */
88
- function toNumber(value) {
89
- if (typeof value == 'number') {
90
- return value;
91
- }
92
- if (isSymbol(value)) {
93
- return NAN;
94
- }
95
- if (isObject(value)) {
96
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
97
- value = isObject(other) ? (other + '') : other;
98
- }
99
- if (typeof value != 'string') {
100
- return value === 0 ? value : +value;
101
- }
102
- value = baseTrim(value);
103
- var isBinary = reIsBinary.test(value);
104
- return (isBinary || reIsOctal.test(value))
105
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
106
- : (reIsBadHex.test(value) ? NAN : +value);
107
- }
108
-
109
- /** Built-in value references. */
110
- var objectCreate = Object.create;
111
-
112
- /**
113
- * The base implementation of `_.create` without support for assigning
114
- * properties to the created object.
115
- *
116
- * @private
117
- * @param {Object} proto The object to inherit from.
118
- * @returns {Object} Returns the new object.
119
- */
120
- var baseCreate = (function() {
121
- function object() {}
122
- return function(proto) {
123
- if (!isObject(proto)) {
124
- return {};
125
- }
126
- if (objectCreate) {
127
- return objectCreate(proto);
128
- }
129
- object.prototype = proto;
130
- var result = new object;
131
- object.prototype = undefined;
132
- return result;
133
- };
134
- }());
135
-
136
- const baseCreate$1 = baseCreate;
137
-
138
- /**
139
- * Copies the values of `source` to `array`.
140
- *
141
- * @private
142
- * @param {Array} source The array to copy values from.
143
- * @param {Array} [array=[]] The array to copy values to.
144
- * @returns {Array} Returns `array`.
145
- */
146
- function copyArray(source, array) {
147
- var index = -1,
148
- length = source.length;
149
-
150
- array || (array = Array(length));
151
- while (++index < length) {
152
- array[index] = source[index];
153
- }
154
- return array;
155
- }
156
-
157
- /**
158
- * A specialized version of `_.forEach` for arrays without support for
159
- * iteratee shorthands.
160
- *
161
- * @private
162
- * @param {Array} [array] The array to iterate over.
163
- * @param {Function} iteratee The function invoked per iteration.
164
- * @returns {Array} Returns `array`.
165
- */
166
- function arrayEach(array, iteratee) {
167
- var index = -1,
168
- length = array == null ? 0 : array.length;
169
-
170
- while (++index < length) {
171
- if (iteratee(array[index], index, array) === false) {
172
- break;
173
- }
174
- }
175
- return array;
176
- }
177
-
178
- /**
179
- * The base implementation of `assignValue` and `assignMergeValue` without
180
- * value checks.
181
- *
182
- * @private
183
- * @param {Object} object The object to modify.
184
- * @param {string} key The key of the property to assign.
185
- * @param {*} value The value to assign.
186
- */
187
- function baseAssignValue(object, key, value) {
188
- if (key == '__proto__' && defineProperty) {
189
- defineProperty(object, key, {
190
- 'configurable': true,
191
- 'enumerable': true,
192
- 'value': value,
193
- 'writable': true
194
- });
195
- } else {
196
- object[key] = value;
197
- }
198
- }
199
-
200
- /** Used for built-in method references. */
201
- var objectProto$2 = Object.prototype;
202
-
203
- /** Used to check objects for own properties. */
204
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
205
-
206
- /**
207
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
208
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
209
- * for equality comparisons.
210
- *
211
- * @private
212
- * @param {Object} object The object to modify.
213
- * @param {string} key The key of the property to assign.
214
- * @param {*} value The value to assign.
215
- */
216
- function assignValue(object, key, value) {
217
- var objValue = object[key];
218
- if (!(hasOwnProperty$2.call(object, key) && eq(objValue, value)) ||
219
- (value === undefined && !(key in object))) {
220
- baseAssignValue(object, key, value);
221
- }
222
- }
223
-
224
- /**
225
- * Copies properties of `source` to `object`.
226
- *
227
- * @private
228
- * @param {Object} source The object to copy properties from.
229
- * @param {Array} props The property identifiers to copy.
230
- * @param {Object} [object={}] The object to copy properties to.
231
- * @param {Function} [customizer] The function to customize copied values.
232
- * @returns {Object} Returns `object`.
233
- */
234
- function copyObject(source, props, object, customizer) {
235
- var isNew = !object;
236
- object || (object = {});
237
-
238
- var index = -1,
239
- length = props.length;
240
-
241
- while (++index < length) {
242
- var key = props[index];
243
-
244
- var newValue = customizer
245
- ? customizer(object[key], source[key], key, object, source)
246
- : undefined;
247
-
248
- if (newValue === undefined) {
249
- newValue = source[key];
250
- }
251
- if (isNew) {
252
- baseAssignValue(object, key, newValue);
253
- } else {
254
- assignValue(object, key, newValue);
255
- }
256
- }
257
- return object;
258
- }
259
-
260
- /**
261
- * This function is like
262
- * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
263
- * except that it includes inherited enumerable properties.
264
- *
265
- * @private
266
- * @param {Object} object The object to query.
267
- * @returns {Array} Returns the array of property names.
268
- */
269
- function nativeKeysIn(object) {
270
- var result = [];
271
- if (object != null) {
272
- for (var key in Object(object)) {
273
- result.push(key);
274
- }
275
- }
276
- return result;
277
- }
278
-
279
- /** Used for built-in method references. */
280
- var objectProto$1 = Object.prototype;
281
-
282
- /** Used to check objects for own properties. */
283
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
284
-
285
- /**
286
- * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
287
- *
288
- * @private
289
- * @param {Object} object The object to query.
290
- * @returns {Array} Returns the array of property names.
291
- */
292
- function baseKeysIn(object) {
293
- if (!isObject(object)) {
294
- return nativeKeysIn(object);
295
- }
296
- var isProto = isPrototype(object),
297
- result = [];
298
-
299
- for (var key in object) {
300
- if (!(key == 'constructor' && (isProto || !hasOwnProperty$1.call(object, key)))) {
301
- result.push(key);
302
- }
303
- }
304
- return result;
305
- }
306
-
307
- /**
308
- * Creates an array of the own and inherited enumerable property names of `object`.
309
- *
310
- * **Note:** Non-object values are coerced to objects.
311
- *
312
- * @static
313
- * @memberOf _
314
- * @since 3.0.0
315
- * @category Object
316
- * @param {Object} object The object to query.
317
- * @returns {Array} Returns the array of property names.
318
- * @example
319
- *
320
- * function Foo() {
321
- * this.a = 1;
322
- * this.b = 2;
323
- * }
324
- *
325
- * Foo.prototype.c = 3;
326
- *
327
- * _.keysIn(new Foo);
328
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
329
- */
330
- function keysIn(object) {
331
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
332
- }
333
-
334
- /** Built-in value references. */
335
- var getPrototype = overArg(Object.getPrototypeOf, Object);
336
-
337
- const getPrototype$1 = getPrototype;
338
-
339
- /**
340
- * The base implementation of `_.assign` without support for multiple sources
341
- * or `customizer` functions.
342
- *
343
- * @private
344
- * @param {Object} object The destination object.
345
- * @param {Object} source The source object.
346
- * @returns {Object} Returns `object`.
347
- */
348
- function baseAssign(object, source) {
349
- return object && copyObject(source, keys(source), object);
350
- }
351
-
352
- /**
353
- * The base implementation of `_.assignIn` without support for multiple sources
354
- * or `customizer` functions.
355
- *
356
- * @private
357
- * @param {Object} object The destination object.
358
- * @param {Object} source The source object.
359
- * @returns {Object} Returns `object`.
360
- */
361
- function baseAssignIn(object, source) {
362
- return object && copyObject(source, keysIn(source), object);
363
- }
364
-
365
- /** Detect free variable `exports`. */
366
- var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
367
-
368
- /** Detect free variable `module`. */
369
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
370
-
371
- /** Detect the popular CommonJS extension `module.exports`. */
372
- var moduleExports = freeModule && freeModule.exports === freeExports;
373
-
374
- /** Built-in value references. */
375
- var Buffer = moduleExports ? root.Buffer : undefined,
376
- allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
377
-
378
- /**
379
- * Creates a clone of `buffer`.
380
- *
381
- * @private
382
- * @param {Buffer} buffer The buffer to clone.
383
- * @param {boolean} [isDeep] Specify a deep clone.
384
- * @returns {Buffer} Returns the cloned buffer.
385
- */
386
- function cloneBuffer(buffer, isDeep) {
387
- if (isDeep) {
388
- return buffer.slice();
389
- }
390
- var length = buffer.length,
391
- result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
392
-
393
- buffer.copy(result);
394
- return result;
395
- }
396
-
397
- /**
398
- * Copies own symbols of `source` to `object`.
399
- *
400
- * @private
401
- * @param {Object} source The object to copy symbols from.
402
- * @param {Object} [object={}] The object to copy symbols to.
403
- * @returns {Object} Returns `object`.
404
- */
405
- function copySymbols(source, object) {
406
- return copyObject(source, getSymbols(source), object);
407
- }
408
-
409
- /* Built-in method references for those with the same name as other `lodash` methods. */
410
- var nativeGetSymbols = Object.getOwnPropertySymbols;
411
-
412
- /**
413
- * Creates an array of the own and inherited enumerable symbols of `object`.
414
- *
415
- * @private
416
- * @param {Object} object The object to query.
417
- * @returns {Array} Returns the array of symbols.
418
- */
419
- var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
420
- var result = [];
421
- while (object) {
422
- arrayPush(result, getSymbols(object));
423
- object = getPrototype$1(object);
424
- }
425
- return result;
426
- };
427
-
428
- const getSymbolsIn$1 = getSymbolsIn;
429
-
430
- /**
431
- * Copies own and inherited symbols of `source` to `object`.
432
- *
433
- * @private
434
- * @param {Object} source The object to copy symbols from.
435
- * @param {Object} [object={}] The object to copy symbols to.
436
- * @returns {Object} Returns `object`.
437
- */
438
- function copySymbolsIn(source, object) {
439
- return copyObject(source, getSymbolsIn$1(source), object);
440
- }
441
-
442
- /**
443
- * Creates an array of own and inherited enumerable property names and
444
- * symbols of `object`.
445
- *
446
- * @private
447
- * @param {Object} object The object to query.
448
- * @returns {Array} Returns the array of property names and symbols.
449
- */
450
- function getAllKeysIn(object) {
451
- return baseGetAllKeys(object, keysIn, getSymbolsIn$1);
452
- }
453
-
454
- /** Used for built-in method references. */
455
- var objectProto = Object.prototype;
456
-
457
- /** Used to check objects for own properties. */
458
- var hasOwnProperty = objectProto.hasOwnProperty;
459
-
460
- /**
461
- * Initializes an array clone.
462
- *
463
- * @private
464
- * @param {Array} array The array to clone.
465
- * @returns {Array} Returns the initialized clone.
466
- */
467
- function initCloneArray(array) {
468
- var length = array.length,
469
- result = new array.constructor(length);
470
-
471
- // Add properties assigned by `RegExp#exec`.
472
- if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
473
- result.index = array.index;
474
- result.input = array.input;
475
- }
476
- return result;
477
- }
478
-
479
- /**
480
- * Creates a clone of `arrayBuffer`.
481
- *
482
- * @private
483
- * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
484
- * @returns {ArrayBuffer} Returns the cloned array buffer.
485
- */
486
- function cloneArrayBuffer(arrayBuffer) {
487
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
488
- new Uint8Array(result).set(new Uint8Array(arrayBuffer));
489
- return result;
490
- }
491
-
492
- /**
493
- * Creates a clone of `dataView`.
494
- *
495
- * @private
496
- * @param {Object} dataView The data view to clone.
497
- * @param {boolean} [isDeep] Specify a deep clone.
498
- * @returns {Object} Returns the cloned data view.
499
- */
500
- function cloneDataView(dataView, isDeep) {
501
- var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
502
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
503
- }
504
-
505
- /** Used to match `RegExp` flags from their coerced string values. */
506
- var reFlags = /\w*$/;
507
-
508
- /**
509
- * Creates a clone of `regexp`.
510
- *
511
- * @private
512
- * @param {Object} regexp The regexp to clone.
513
- * @returns {Object} Returns the cloned regexp.
514
- */
515
- function cloneRegExp(regexp) {
516
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
517
- result.lastIndex = regexp.lastIndex;
518
- return result;
519
- }
520
-
521
- /** Used to convert symbols to primitives and strings. */
522
- var symbolProto = Symbol ? Symbol.prototype : undefined,
523
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
524
-
525
- /**
526
- * Creates a clone of the `symbol` object.
527
- *
528
- * @private
529
- * @param {Object} symbol The symbol object to clone.
530
- * @returns {Object} Returns the cloned symbol object.
531
- */
532
- function cloneSymbol(symbol) {
533
- return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
534
- }
535
-
536
- /**
537
- * Creates a clone of `typedArray`.
538
- *
539
- * @private
540
- * @param {Object} typedArray The typed array to clone.
541
- * @param {boolean} [isDeep] Specify a deep clone.
542
- * @returns {Object} Returns the cloned typed array.
543
- */
544
- function cloneTypedArray(typedArray, isDeep) {
545
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
546
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
547
- }
548
-
549
- /** `Object#toString` result references. */
550
- var boolTag$1 = '[object Boolean]',
551
- dateTag$1 = '[object Date]',
552
- mapTag$2 = '[object Map]',
553
- numberTag$1 = '[object Number]',
554
- regexpTag$1 = '[object RegExp]',
555
- setTag$2 = '[object Set]',
556
- stringTag$1 = '[object String]',
557
- symbolTag$1 = '[object Symbol]';
558
-
559
- var arrayBufferTag$1 = '[object ArrayBuffer]',
560
- dataViewTag$1 = '[object DataView]',
561
- float32Tag$1 = '[object Float32Array]',
562
- float64Tag$1 = '[object Float64Array]',
563
- int8Tag$1 = '[object Int8Array]',
564
- int16Tag$1 = '[object Int16Array]',
565
- int32Tag$1 = '[object Int32Array]',
566
- uint8Tag$1 = '[object Uint8Array]',
567
- uint8ClampedTag$1 = '[object Uint8ClampedArray]',
568
- uint16Tag$1 = '[object Uint16Array]',
569
- uint32Tag$1 = '[object Uint32Array]';
570
-
571
- /**
572
- * Initializes an object clone based on its `toStringTag`.
573
- *
574
- * **Note:** This function only supports cloning values with tags of
575
- * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
576
- *
577
- * @private
578
- * @param {Object} object The object to clone.
579
- * @param {string} tag The `toStringTag` of the object to clone.
580
- * @param {boolean} [isDeep] Specify a deep clone.
581
- * @returns {Object} Returns the initialized clone.
582
- */
583
- function initCloneByTag(object, tag, isDeep) {
584
- var Ctor = object.constructor;
585
- switch (tag) {
586
- case arrayBufferTag$1:
587
- return cloneArrayBuffer(object);
588
-
589
- case boolTag$1:
590
- case dateTag$1:
591
- return new Ctor(+object);
592
-
593
- case dataViewTag$1:
594
- return cloneDataView(object, isDeep);
595
-
596
- case float32Tag$1: case float64Tag$1:
597
- case int8Tag$1: case int16Tag$1: case int32Tag$1:
598
- case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
599
- return cloneTypedArray(object, isDeep);
600
-
601
- case mapTag$2:
602
- return new Ctor;
603
-
604
- case numberTag$1:
605
- case stringTag$1:
606
- return new Ctor(object);
607
-
608
- case regexpTag$1:
609
- return cloneRegExp(object);
610
-
611
- case setTag$2:
612
- return new Ctor;
613
-
614
- case symbolTag$1:
615
- return cloneSymbol(object);
616
- }
617
- }
618
-
619
- /**
620
- * Initializes an object clone.
621
- *
622
- * @private
623
- * @param {Object} object The object to clone.
624
- * @returns {Object} Returns the initialized clone.
625
- */
626
- function initCloneObject(object) {
627
- return (typeof object.constructor == 'function' && !isPrototype(object))
628
- ? baseCreate$1(getPrototype$1(object))
629
- : {};
630
- }
631
-
632
- /** `Object#toString` result references. */
633
- var mapTag$1 = '[object Map]';
634
-
635
- /**
636
- * The base implementation of `_.isMap` without Node.js optimizations.
637
- *
638
- * @private
639
- * @param {*} value The value to check.
640
- * @returns {boolean} Returns `true` if `value` is a map, else `false`.
641
- */
642
- function baseIsMap(value) {
643
- return isObjectLike(value) && getTag(value) == mapTag$1;
644
- }
645
-
646
- /* Node.js helper references. */
647
- var nodeIsMap = nodeUtil && nodeUtil.isMap;
648
-
649
- /**
650
- * Checks if `value` is classified as a `Map` object.
651
- *
652
- * @static
653
- * @memberOf _
654
- * @since 4.3.0
655
- * @category Lang
656
- * @param {*} value The value to check.
657
- * @returns {boolean} Returns `true` if `value` is a map, else `false`.
658
- * @example
659
- *
660
- * _.isMap(new Map);
661
- * // => true
662
- *
663
- * _.isMap(new WeakMap);
664
- * // => false
665
- */
666
- var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
667
-
668
- const isMap$1 = isMap;
669
-
670
- /** `Object#toString` result references. */
671
- var setTag$1 = '[object Set]';
672
-
673
- /**
674
- * The base implementation of `_.isSet` without Node.js optimizations.
675
- *
676
- * @private
677
- * @param {*} value The value to check.
678
- * @returns {boolean} Returns `true` if `value` is a set, else `false`.
679
- */
680
- function baseIsSet(value) {
681
- return isObjectLike(value) && getTag(value) == setTag$1;
682
- }
683
-
684
- /* Node.js helper references. */
685
- var nodeIsSet = nodeUtil && nodeUtil.isSet;
686
-
687
- /**
688
- * Checks if `value` is classified as a `Set` object.
689
- *
690
- * @static
691
- * @memberOf _
692
- * @since 4.3.0
693
- * @category Lang
694
- * @param {*} value The value to check.
695
- * @returns {boolean} Returns `true` if `value` is a set, else `false`.
696
- * @example
697
- *
698
- * _.isSet(new Set);
699
- * // => true
700
- *
701
- * _.isSet(new WeakSet);
702
- * // => false
703
- */
704
- var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
705
-
706
- const isSet$1 = isSet;
707
-
708
- /** Used to compose bitmasks for cloning. */
709
- var CLONE_DEEP_FLAG$1 = 1,
710
- CLONE_FLAT_FLAG = 2,
711
- CLONE_SYMBOLS_FLAG$1 = 4;
712
-
713
- /** `Object#toString` result references. */
714
- var argsTag = '[object Arguments]',
715
- arrayTag = '[object Array]',
716
- boolTag = '[object Boolean]',
717
- dateTag = '[object Date]',
718
- errorTag = '[object Error]',
719
- funcTag = '[object Function]',
720
- genTag = '[object GeneratorFunction]',
721
- mapTag = '[object Map]',
722
- numberTag = '[object Number]',
723
- objectTag = '[object Object]',
724
- regexpTag = '[object RegExp]',
725
- setTag = '[object Set]',
726
- stringTag = '[object String]',
727
- symbolTag = '[object Symbol]',
728
- weakMapTag = '[object WeakMap]';
729
-
730
- var arrayBufferTag = '[object ArrayBuffer]',
731
- dataViewTag = '[object DataView]',
732
- float32Tag = '[object Float32Array]',
733
- float64Tag = '[object Float64Array]',
734
- int8Tag = '[object Int8Array]',
735
- int16Tag = '[object Int16Array]',
736
- int32Tag = '[object Int32Array]',
737
- uint8Tag = '[object Uint8Array]',
738
- uint8ClampedTag = '[object Uint8ClampedArray]',
739
- uint16Tag = '[object Uint16Array]',
740
- uint32Tag = '[object Uint32Array]';
741
-
742
- /** Used to identify `toStringTag` values supported by `_.clone`. */
743
- var cloneableTags = {};
744
- cloneableTags[argsTag] = cloneableTags[arrayTag] =
745
- cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
746
- cloneableTags[boolTag] = cloneableTags[dateTag] =
747
- cloneableTags[float32Tag] = cloneableTags[float64Tag] =
748
- cloneableTags[int8Tag] = cloneableTags[int16Tag] =
749
- cloneableTags[int32Tag] = cloneableTags[mapTag] =
750
- cloneableTags[numberTag] = cloneableTags[objectTag] =
751
- cloneableTags[regexpTag] = cloneableTags[setTag] =
752
- cloneableTags[stringTag] = cloneableTags[symbolTag] =
753
- cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
754
- cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
755
- cloneableTags[errorTag] = cloneableTags[funcTag] =
756
- cloneableTags[weakMapTag] = false;
757
-
758
- /**
759
- * The base implementation of `_.clone` and `_.cloneDeep` which tracks
760
- * traversed objects.
761
- *
762
- * @private
763
- * @param {*} value The value to clone.
764
- * @param {boolean} bitmask The bitmask flags.
765
- * 1 - Deep clone
766
- * 2 - Flatten inherited properties
767
- * 4 - Clone symbols
768
- * @param {Function} [customizer] The function to customize cloning.
769
- * @param {string} [key] The key of `value`.
770
- * @param {Object} [object] The parent object of `value`.
771
- * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
772
- * @returns {*} Returns the cloned value.
773
- */
774
- function baseClone(value, bitmask, customizer, key, object, stack) {
775
- var result,
776
- isDeep = bitmask & CLONE_DEEP_FLAG$1,
777
- isFlat = bitmask & CLONE_FLAT_FLAG,
778
- isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
779
-
780
- if (customizer) {
781
- result = object ? customizer(value, key, object, stack) : customizer(value);
782
- }
783
- if (result !== undefined) {
784
- return result;
785
- }
786
- if (!isObject(value)) {
787
- return value;
788
- }
789
- var isArr = isArray(value);
790
- if (isArr) {
791
- result = initCloneArray(value);
792
- if (!isDeep) {
793
- return copyArray(value, result);
794
- }
795
- } else {
796
- var tag = getTag(value),
797
- isFunc = tag == funcTag || tag == genTag;
798
-
799
- if (isBuffer(value)) {
800
- return cloneBuffer(value, isDeep);
801
- }
802
- if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
803
- result = (isFlat || isFunc) ? {} : initCloneObject(value);
804
- if (!isDeep) {
805
- return isFlat
806
- ? copySymbolsIn(value, baseAssignIn(result, value))
807
- : copySymbols(value, baseAssign(result, value));
808
- }
809
- } else {
810
- if (!cloneableTags[tag]) {
811
- return object ? value : {};
812
- }
813
- result = initCloneByTag(value, tag, isDeep);
814
- }
815
- }
816
- // Check for circular references and return its corresponding clone.
817
- stack || (stack = new Stack);
818
- var stacked = stack.get(value);
819
- if (stacked) {
820
- return stacked;
821
- }
822
- stack.set(value, result);
823
-
824
- if (isSet$1(value)) {
825
- value.forEach(function(subValue) {
826
- result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
827
- });
828
- } else if (isMap$1(value)) {
829
- value.forEach(function(subValue, key) {
830
- result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
831
- });
832
- }
833
-
834
- var keysFunc = isFull
835
- ? (isFlat ? getAllKeysIn : getAllKeys)
836
- : (isFlat ? keysIn : keys);
837
-
838
- var props = isArr ? undefined : keysFunc(value);
839
- arrayEach(props || value, function(subValue, key) {
840
- if (props) {
841
- key = subValue;
842
- subValue = value[key];
843
- }
844
- // Recursively populate clone (susceptible to call stack limits).
845
- assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
846
- });
847
- return result;
848
- }
849
-
850
- /** Used to compose bitmasks for cloning. */
851
- var CLONE_DEEP_FLAG = 1,
852
- CLONE_SYMBOLS_FLAG = 4;
853
-
854
- /**
855
- * This method is like `_.clone` except that it recursively clones `value`.
856
- *
857
- * @static
858
- * @memberOf _
859
- * @since 1.0.0
860
- * @category Lang
861
- * @param {*} value The value to recursively clone.
862
- * @returns {*} Returns the deep cloned value.
863
- * @see _.clone
864
- * @example
865
- *
866
- * var objects = [{ 'a': 1 }, { 'b': 2 }];
867
- *
868
- * var deep = _.cloneDeep(objects);
869
- * console.log(deep[0] === objects[0]);
870
- * // => false
871
- */
872
- function cloneDeep(value) {
873
- return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
874
- }
875
-
876
- /**
877
- * Gets the timestamp of the number of milliseconds that have elapsed since
878
- * the Unix epoch (1 January 1970 00:00:00 UTC).
879
- *
880
- * @static
881
- * @memberOf _
882
- * @since 2.4.0
883
- * @category Date
884
- * @returns {number} Returns the timestamp.
885
- * @example
886
- *
887
- * _.defer(function(stamp) {
888
- * console.log(_.now() - stamp);
889
- * }, _.now());
890
- * // => Logs the number of milliseconds it took for the deferred invocation.
891
- */
892
- var now = function() {
893
- return root.Date.now();
894
- };
895
-
896
- const now$1 = now;
897
-
898
- /** Error message constants. */
899
- var FUNC_ERROR_TEXT = 'Expected a function';
900
-
901
- /* Built-in method references for those with the same name as other `lodash` methods. */
902
- var nativeMax = Math.max,
903
- nativeMin = Math.min;
904
-
905
- /**
906
- * Creates a debounced function that delays invoking `func` until after `wait`
907
- * milliseconds have elapsed since the last time the debounced function was
908
- * invoked. The debounced function comes with a `cancel` method to cancel
909
- * delayed `func` invocations and a `flush` method to immediately invoke them.
910
- * Provide `options` to indicate whether `func` should be invoked on the
911
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
912
- * with the last arguments provided to the debounced function. Subsequent
913
- * calls to the debounced function return the result of the last `func`
914
- * invocation.
915
- *
916
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
917
- * invoked on the trailing edge of the timeout only if the debounced function
918
- * is invoked more than once during the `wait` timeout.
919
- *
920
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
921
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
922
- *
923
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
924
- * for details over the differences between `_.debounce` and `_.throttle`.
925
- *
926
- * @static
927
- * @memberOf _
928
- * @since 0.1.0
929
- * @category Function
930
- * @param {Function} func The function to debounce.
931
- * @param {number} [wait=0] The number of milliseconds to delay.
932
- * @param {Object} [options={}] The options object.
933
- * @param {boolean} [options.leading=false]
934
- * Specify invoking on the leading edge of the timeout.
935
- * @param {number} [options.maxWait]
936
- * The maximum time `func` is allowed to be delayed before it's invoked.
937
- * @param {boolean} [options.trailing=true]
938
- * Specify invoking on the trailing edge of the timeout.
939
- * @returns {Function} Returns the new debounced function.
940
- * @example
941
- *
942
- * // Avoid costly calculations while the window size is in flux.
943
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
944
- *
945
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
946
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
947
- * 'leading': true,
948
- * 'trailing': false
949
- * }));
950
- *
951
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
952
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
953
- * var source = new EventSource('/stream');
954
- * jQuery(source).on('message', debounced);
955
- *
956
- * // Cancel the trailing debounced invocation.
957
- * jQuery(window).on('popstate', debounced.cancel);
958
- */
959
- function debounce(func, wait, options) {
960
- var lastArgs,
961
- lastThis,
962
- maxWait,
963
- result,
964
- timerId,
965
- lastCallTime,
966
- lastInvokeTime = 0,
967
- leading = false,
968
- maxing = false,
969
- trailing = true;
970
-
971
- if (typeof func != 'function') {
972
- throw new TypeError(FUNC_ERROR_TEXT);
973
- }
974
- wait = toNumber(wait) || 0;
975
- if (isObject(options)) {
976
- leading = !!options.leading;
977
- maxing = 'maxWait' in options;
978
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
979
- trailing = 'trailing' in options ? !!options.trailing : trailing;
980
- }
981
-
982
- function invokeFunc(time) {
983
- var args = lastArgs,
984
- thisArg = lastThis;
985
-
986
- lastArgs = lastThis = undefined;
987
- lastInvokeTime = time;
988
- result = func.apply(thisArg, args);
989
- return result;
990
- }
991
-
992
- function leadingEdge(time) {
993
- // Reset any `maxWait` timer.
994
- lastInvokeTime = time;
995
- // Start the timer for the trailing edge.
996
- timerId = setTimeout(timerExpired, wait);
997
- // Invoke the leading edge.
998
- return leading ? invokeFunc(time) : result;
999
- }
1000
-
1001
- function remainingWait(time) {
1002
- var timeSinceLastCall = time - lastCallTime,
1003
- timeSinceLastInvoke = time - lastInvokeTime,
1004
- timeWaiting = wait - timeSinceLastCall;
1005
-
1006
- return maxing
1007
- ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
1008
- : timeWaiting;
1009
- }
1010
-
1011
- function shouldInvoke(time) {
1012
- var timeSinceLastCall = time - lastCallTime,
1013
- timeSinceLastInvoke = time - lastInvokeTime;
1014
-
1015
- // Either this is the first call, activity has stopped and we're at the
1016
- // trailing edge, the system time has gone backwards and we're treating
1017
- // it as the trailing edge, or we've hit the `maxWait` limit.
1018
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
1019
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
1020
- }
1021
-
1022
- function timerExpired() {
1023
- var time = now$1();
1024
- if (shouldInvoke(time)) {
1025
- return trailingEdge(time);
1026
- }
1027
- // Restart the timer.
1028
- timerId = setTimeout(timerExpired, remainingWait(time));
1029
- }
1030
-
1031
- function trailingEdge(time) {
1032
- timerId = undefined;
1033
-
1034
- // Only invoke if we have `lastArgs` which means `func` has been
1035
- // debounced at least once.
1036
- if (trailing && lastArgs) {
1037
- return invokeFunc(time);
1038
- }
1039
- lastArgs = lastThis = undefined;
1040
- return result;
1041
- }
1042
-
1043
- function cancel() {
1044
- if (timerId !== undefined) {
1045
- clearTimeout(timerId);
1046
- }
1047
- lastInvokeTime = 0;
1048
- lastArgs = lastCallTime = lastThis = timerId = undefined;
1049
- }
1050
-
1051
- function flush() {
1052
- return timerId === undefined ? result : trailingEdge(now$1());
1053
- }
1054
-
1055
- function debounced() {
1056
- var time = now$1(),
1057
- isInvoking = shouldInvoke(time);
1058
-
1059
- lastArgs = arguments;
1060
- lastThis = this;
1061
- lastCallTime = time;
1062
-
1063
- if (isInvoking) {
1064
- if (timerId === undefined) {
1065
- return leadingEdge(lastCallTime);
1066
- }
1067
- if (maxing) {
1068
- // Handle invocations in a tight loop.
1069
- clearTimeout(timerId);
1070
- timerId = setTimeout(timerExpired, wait);
1071
- return invokeFunc(lastCallTime);
1072
- }
1073
- }
1074
- if (timerId === undefined) {
1075
- timerId = setTimeout(timerExpired, wait);
1076
- }
1077
- return result;
1078
- }
1079
- debounced.cancel = cancel;
1080
- debounced.flush = flush;
1081
- return debounced;
1082
- }
1083
-
1084
- const getItemIndex = (direction, currentItemIndex, numberOfItems) => {
1085
- const increment = direction === ARROW_DOWN ? 1 : -1;
1086
- return (currentItemIndex + increment + numberOfItems) % numberOfItems;
1087
- };
1088
- /**
1089
- *
1090
- * @param items
1091
- * @param highlightedItemIndex
1092
- */
1093
- function getUpdatedItems(items, highlightedItemIndex) {
1094
- return items.map((item, index) => {
1095
- const newItem = cloneDeep(item);
1096
- return Object.assign(Object.assign({}, newItem), { selected: index === highlightedItemIndex });
1097
- });
1098
- }
1099
-
1100
- /**
1101
- * Get the limetypes that should be available for mentions
1102
- *
1103
- * @param limetypes all limetypes
1104
- * @returns mention limetypes
1105
- */
1106
- function getMentionLimetypes(limetypes) {
1107
- return Object.values(limetypes).filter((limetype) => {
1108
- return (hasLabel(limetype, 'user') || hasHasManyRelation(limetype, 'user'));
1109
- });
1110
- }
1111
- const MAX_MENTION_SEARCH_RESULTS = 10;
1112
- class MentionsService {
1113
- get limeObjectService() {
1114
- return this.platform.get(c.LimeObjectRepository);
1115
- }
1116
- get queryService() {
1117
- return this.platform.get(c.Query);
1118
- }
1119
- get viewFactoryRegistry() {
1120
- return this.platform.get(c.ViewFactoryRegistry);
1121
- }
1122
- get translator() {
1123
- var _a;
1124
- return (_a = this.platform) === null || _a === void 0 ? void 0 : _a.get(c.Translate);
1125
- }
1126
- get triggerCharacter() {
1127
- return this._triggerCharacter;
1128
- }
1129
- get triggerHandler() {
1130
- return this._triggerHandler;
1131
- }
1132
- constructor(platform, context, searchableLimetypes) {
1133
- this.platform = platform;
1134
- this.context = context;
1135
- this.searchableLimetypes = searchableLimetypes;
1136
- this.groupCounts = {};
1137
- this._triggerCharacter = '@';
1138
- this._triggerHandler = {
1139
- searcher: (query) => this.searcher(query),
1140
- inserter: (triggerFunction, item) => this.inserter(triggerFunction, item),
1141
- emptySearchMessage: 'Start typing a name...',
1142
- noItemsFoundMessage: 'No results for your search...',
1143
- nodeDefinition: {
1144
- customElement: {
1145
- tagName: 'limebb-mention',
1146
- attributes: ['limetype', 'objectid', 'href'],
1147
- },
1148
- mapAttributes: (item) => ({
1149
- limetype: item.value.getLimetype().name,
1150
- objectid: item.value.id,
1151
- href: `object/${this.context.limetype}/${this.context.id}`,
1152
- }),
1153
- },
1154
- };
1155
- this.searcher = async (query) => {
1156
- if (!query) {
1157
- return [];
1158
- }
1159
- const { objects } = await this.limeObjectService.search(query, this.searchableLimetypes, MAX_MENTION_SEARCH_RESULTS);
1160
- return this.createSearchListItems(objects);
1161
- };
1162
- this.inserter = async (triggerFunction, item) => {
1163
- var _a;
1164
- const nodeDefinition = this.triggerHandler.nodeDefinition;
1165
- if (!nodeDefinition) {
1166
- return;
1167
- }
1168
- triggerFunction.insert({
1169
- node: {
1170
- tagName: nodeDefinition.customElement.tagName,
1171
- attributes: nodeDefinition.mapAttributes(item),
1172
- },
1173
- children: [(_a = item.value) === null || _a === void 0 ? void 0 : _a.descriptive],
1174
- });
1175
- };
1176
- }
1177
- async initialize() {
1178
- await this.loadGroupCounts();
1179
- }
1180
- async loadGroupCounts() {
1181
- const groupCountsLoads = this.searchableLimetypes
1182
- .filter((limetype) => !hasLabel(limetype, 'user') &&
1183
- hasHasManyRelation(limetype, 'user'))
1184
- .map((limetype) => this.getGroupCounts(limetype));
1185
- for (const groupCount of await Promise.all(groupCountsLoads)) {
1186
- Object.assign(this.groupCounts, groupCount);
1187
- }
1188
- }
1189
- async getGroupCounts(limetype) {
1190
- var _a;
1191
- const coworkerProperty = getRelationProperty(limetype, 'user');
1192
- const limetypeName = limetype.name;
1193
- try {
1194
- const result = await this.queryService.execute({
1195
- limetype: limetypeName,
1196
- responseFormat: {
1197
- object: {
1198
- _id: null,
1199
- [coworkerProperty.name]: {
1200
- count: {
1201
- aggregate: {
1202
- op: sr.Count,
1203
- },
1204
- },
1205
- },
1206
- },
1207
- },
1208
- });
1209
- if (!((_a = result.objects) === null || _a === void 0 ? void 0 : _a.length)) {
1210
- return { [limetypeName]: {} };
1211
- }
1212
- const groupCount = this.createGroupCount(result.objects, coworkerProperty.name);
1213
- return { [limetypeName]: groupCount };
1214
- }
1215
- catch (error) {
1216
- console.error(`Error fetching group count for limetype: ${limetype.name}`, error);
1217
- return { [limetypeName]: {} };
1218
- }
1219
- }
1220
- createGroupCount(objects, coworkerPropertyName) {
1221
- const groupCount = {};
1222
- for (const object of objects) {
1223
- const { _id: id, [coworkerPropertyName]: aggregateProperty } = object;
1224
- groupCount[id] = aggregateProperty.count;
1225
- }
1226
- return groupCount;
1227
- }
1228
- createSearchListItems(searchObjects = []) {
1229
- const items = searchObjects.map((object) => this.createSearchListItem(object));
1230
- return items.filter(isNonNull);
1231
- }
1232
- createSearchListItem(object) {
1233
- const createSearchItem = this.viewFactoryRegistry.getFactory('search');
1234
- const limeobject = this.limeObjectService.getObject(object._limetype, object._id);
1235
- if (!limeobject) {
1236
- return null;
1237
- }
1238
- const searchListItem = createSearchItem(limeobject, this.context);
1239
- const primaryComponent = this.getGroupCountComponent(limeobject);
1240
- return Object.assign(Object.assign({}, searchListItem), (primaryComponent ? { primaryComponent: primaryComponent } : {}));
1241
- }
1242
- getGroupCountComponent(limeobject) {
1243
- var _a;
1244
- const limetype = limeobject.getLimetype();
1245
- const groupCount = (_a = this.groupCounts[limetype.name]) === null || _a === void 0 ? void 0 : _a[limeobject.id];
1246
- const coworkerProperty = getRelationProperty(limetype, 'user');
1247
- if (groupCount === undefined || !coworkerProperty) {
1248
- return;
1249
- }
1250
- const coworkerLimetype = coworkerProperty.relation.getLimetype();
1251
- return {
1252
- name: 'limebb-mention-group-counter',
1253
- props: {
1254
- count: groupCount,
1255
- limetype: coworkerLimetype,
1256
- helperLabel: this.translator.get('webclient.notification-center.members-will-be-notified'),
1257
- },
1258
- };
1259
- }
1260
- }
1261
-
1262
- const CORE_API_PATH = 'api/v1';
1263
- const FILE_PATH = 'file';
1264
- const FIFTY = 50;
1265
- const THOUSAND_BYTES = 1024;
1266
- const MAX_FILE_SIZE = FIFTY * THOUSAND_BYTES * THOUSAND_BYTES; // 50 MB
1267
- class FileUpload {
1268
- constructor(file, http) {
1269
- this.file = file;
1270
- this.http = http;
1271
- this.uploadCancelled = false;
1272
- this.getUrl = (fileid) => {
1273
- return `${CORE_API_PATH}/${FILE_PATH}/${fileid !== null && fileid !== void 0 ? fileid : ''}`;
1274
- };
1275
- }
1276
- async initialize() {
1277
- this.uploadService = await this.http.createFileUpload(cr.Post, this.getUrl(), this.file);
1278
- if (this.progressCallback) {
1279
- this.uploadService.onProgress = this.progressCallback;
1280
- }
1281
- }
1282
- async upload() {
1283
- return this.uploadService.upload();
1284
- }
1285
- getFileName() {
1286
- return this.file.name;
1287
- }
1288
- cancel() {
1289
- this.uploadService.cancel();
1290
- this.uploadCancelled = true;
1291
- }
1292
- set onProgress(callback) {
1293
- this.progressCallback = callback;
1294
- if (this.uploadService) {
1295
- this.uploadService.onProgress = callback;
1296
- }
1297
- }
1298
- }
1299
-
1300
- const UPLOAD_COMPLETED = 100;
1301
- class UploadHandler {
1302
- constructor(platform) {
1303
- this.platform = platform;
1304
- }
1305
- /**
1306
- * Handles image paste events in the text editor
1307
- *
1308
- * @param imageInserter - The image inserter with the file info
1309
- * @returns Promise resolving to the uploaded file wrapper or undefined if upload fails
1310
- */
1311
- async handleImagePasted(imageInserter) {
1312
- const fileInfo = imageInserter === null || imageInserter === void 0 ? void 0 : imageInserter.fileInfo;
1313
- if (!fileInfo) {
1314
- return;
1315
- }
1316
- if (!this.validateImageSize(fileInfo)) {
1317
- return;
1318
- }
1319
- imageInserter.insertThumbnail();
1320
- const uploadedFile = await this.createFileUpload(fileInfo);
1321
- const fileUrl = uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.href;
1322
- const fileId = uploadedFile === null || uploadedFile === void 0 ? void 0 : uploadedFile.fileId;
1323
- if (fileUrl && fileId !== undefined) {
1324
- imageInserter.insertImage(fileUrl);
1325
- }
1326
- else {
1327
- imageInserter.insertFailedThumbnail();
1328
- }
1329
- return uploadedFile;
1330
- }
1331
- /**
1332
- * Extracts a file ID from a image source string.
1333
- *
1334
- * This function parses a URL to find a file ID that appears before
1335
- * '/contents/' at the end of the URL.
1336
- *
1337
- * @param src - The URL string to parse
1338
- * @returns The extracted file ID or undefined if no match is found
1339
- *
1340
- * @example
1341
- * // Returns 123
1342
- * parseFileIdFromSrc('/api/file/123/contents/');
1343
- *
1344
- * @example
1345
- * // Returns 456
1346
- * parseFileIdFromSrc('https://example.com/limepkg-email/api/v1/file/456/contents/');
1347
- *
1348
- * @example
1349
- * // Returns undefined
1350
- * parseFileIdFromSrc('/invalid/url/format/');
1351
- */
1352
- parseFileIdFromSrc(src) {
1353
- if (src) {
1354
- const regex = /\/(\d+)\/contents\/?$/;
1355
- const matches = regex.exec(src);
1356
- if (matches && matches[1]) {
1357
- return Number(matches[1]);
1358
- }
1359
- }
1360
- }
1361
- /**
1362
- * Validates that the image file size is within limits
1363
- *
1364
- * @param fileInfo - The file info to validate
1365
- * @returns True if file size is valid, false otherwise
1366
- */
1367
- validateImageSize(fileInfo) {
1368
- if (!fileInfo.fileContent) {
1369
- return false;
1370
- }
1371
- return fileInfo.fileContent.size <= MAX_FILE_SIZE;
1372
- }
1373
- /**
1374
- * Creates and uploads a file
1375
- *
1376
- * @param fileInfo - The file info to upload
1377
- * @returns Promise resolving to the uploaded file wrapper or undefined if upload fails
1378
- */
1379
- async createFileUpload(fileInfo) {
1380
- var _a;
1381
- if (!fileInfo.fileContent) {
1382
- return;
1383
- }
1384
- const imageFile = new FileUpload(fileInfo.fileContent, this.http);
1385
- await imageFile.initialize();
1386
- const imageUpload = Object.assign(Object.assign({}, fileInfo), { progress: 0, file: imageFile, state: 'added', fileId: undefined, href: undefined, id: fileInfo.id });
1387
- imageFile.onProgress = (progress) => {
1388
- if (imageUpload.progress === 0) {
1389
- imageUpload.state = 'uploading';
1390
- }
1391
- imageUpload.progress = progress;
1392
- if (progress === UPLOAD_COMPLETED) {
1393
- imageUpload.state = 'finalizing';
1394
- }
1395
- };
1396
- const response = await imageFile.upload();
1397
- imageUpload.fileId = response.id;
1398
- imageUpload.filename = response.filename;
1399
- imageUpload.extension = response.extension;
1400
- imageUpload.contentType = response.contentType;
1401
- imageUpload.size = response.size;
1402
- imageUpload.state = 'done';
1403
- imageUpload.href = (_a = response._links) === null || _a === void 0 ? void 0 : _a.contents.href;
1404
- return imageUpload;
1405
- }
1406
- get http() {
1407
- return this.platform.get(c.Http);
1408
- }
1409
- }
1410
-
1411
- const textEditorCss = ":host(limebb-text-editor){display:block;width:100%;min-width:5rem;min-height:5rem;height:100%;max-height:var(--text-editor-max-height, calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem))}";
1412
- const LimebbTextEditorStyle0 = textEditorCss;
1413
-
1414
- var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1415
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1416
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1417
- r = Reflect.decorate(decorators, target, key, desc);
1418
- else
1419
- for (var i = decorators.length - 1; i >= 0; i--)
1420
- if (d = decorators[i])
1421
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1422
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1423
- };
1424
- const DEBOUNCE_SEARCH_TIMEOUT = 300;
1425
- const LimeBBTextEditor = /*@__PURE__*/ proxyCustomElement(class LimeBBTextEditor extends HTMLElement {
1426
- watchOpen() {
1427
- this.setupHandlers();
1428
- this.setPickerMessage();
1429
- }
1430
- watchQuery() {
1431
- this.setPickerMessage();
1432
- }
1433
- constructor() {
1434
- super();
1435
- this.__registerHost();
1436
- this.__attachShadow();
1437
- this.change = createEvent(this, "change", 7);
1438
- this.metadataChange = createEvent(this, "metadataChange", 7);
1439
- /**
1440
- * Set to true to enable mentioning a coworker or groups of coworkers.
1441
- *
1442
- * Mentions already present will still be rendered with a link to the coworker or
1443
- * the group of coworkers regardless of the value of this property
1444
- */
1445
- this.allowMentioning = false;
1446
- /**
1447
- * The type of content that the editor should handle and emit, defaults to `markdown`
1448
- *
1449
- * Assumed to be set only once, so not reactive to changes
1450
- */
1451
- this.contentType = 'markdown';
1452
- /**
1453
- * Defines the language for translations.
1454
- */
1455
- this.language = 'en';
1456
- /**
1457
- * Set to `true` to disable the field.
1458
- * Use `disabled` to indicate that the field can normally be interacted
1459
- * with, but is currently disabled. This tells the user that if certain
1460
- * requirements are met, the field may become enabled again.
1461
- */
1462
- this.disabled = false;
1463
- /**
1464
- * Set to `true` to make the component read-only.
1465
- * Use `readonly` when the field is only there to present the data it holds,
1466
- * and will not become possible for the current user to edit.
1467
- * :::note
1468
- * Consider that it might be better to use `limel-markdown`
1469
- * instead of `limel-text-editor` when the goal is visualizing data.
1470
- * :::
1471
- */
1472
- this.readonly = false;
1473
- /**
1474
- * Set to `true` to indicate that the current value of the editor is
1475
- * invalid.
1476
- */
1477
- this.invalid = false;
1478
- /**
1479
- * Set to `true` to indicate that the field is required.
1480
- *
1481
- * :::important
1482
- * An empty but required field is not automatically considered invalid.
1483
- * You must make sure to check the validity of the field on your own,
1484
- * and properly handle the `invalid` state.
1485
- * :::
1486
- */
1487
- this.required = false;
1488
- /**
1489
- * Specifies the visual appearance of the editor.
1490
- *
1491
- * - `standard`: The default editor appearance with a full toolbar and
1492
- * standard layout.
1493
- * - `minimal`: A compact editor appearance, ideal for limited space
1494
- * scenarios such as mobile devices. In this mode, the toolbar is hidden
1495
- * until the editor is focused.
1496
- */
1497
- this.ui = 'standard';
1498
- /**
1499
- * Set to `true` to allow the user to vertically resize the editor.
1500
- * Set to `false` to disable the resize functionality.
1501
- */
1502
- this.allowResize = true;
1503
- this.value = '';
1504
- this.triggerMap = {};
1505
- this.customElements = [];
1506
- /**
1507
- * Enables image pasting in the editor.
1508
- * Default: `false`
1509
- *
1510
- * :::note
1511
- * This component handles the upload process.
1512
- * The consumer must process the uploaded images by listening to `metadataChange` event.
1513
- * :::
1514
- */
1515
- this.allowInlineImages = false;
1516
- this.items = [];
1517
- this.highlightedItemIndex = 0;
1518
- /**
1519
- * Open state of the picker
1520
- */
1521
- this.isPickerOpen = false;
1522
- /**
1523
- * Loading state of the picker
1524
- */
1525
- this.isSearching = false;
1526
- this.registeredTriggers = [];
1527
- this.registeredTriggerMap = this.triggerMap;
1528
- this.registeredCustomElements = this.customElements;
1529
- this.activeTrigger = undefined;
1530
- this.handleMouseClick = (event) => {
1531
- if (!this.textEditorPickerElement) {
1532
- return;
1533
- }
1534
- const clickedOnTextEditorPicker = event.target === this.textEditorPickerElement;
1535
- if (!clickedOnTextEditorPicker) {
1536
- this.resetTriggerAndPicker();
1537
- }
1538
- };
1539
- this.handleKeyPress = (event) => {
1540
- if (!this.isPickerOpen || !this.activeTrigger) {
1541
- return;
1542
- }
1543
- const capturedKeys = [ESCAPE, ARROW_UP, ARROW_DOWN, ENTER, TAB];
1544
- if (!capturedKeys.includes(event.key)) {
1545
- return;
1546
- }
1547
- event.stopPropagation();
1548
- event.preventDefault();
1549
- if (event.type === 'keyup') {
1550
- return;
1551
- }
1552
- const handlers = {
1553
- [ESCAPE]: this.handleEscapeKey,
1554
- [ENTER]: this.handleEnterOrTabKey,
1555
- [TAB]: this.handleEnterOrTabKey,
1556
- [ARROW_DOWN]: this.handleArrowKeyPress,
1557
- [ARROW_UP]: this.handleArrowKeyPress,
1558
- };
1559
- const handler = handlers[event.key];
1560
- if (handler) {
1561
- handler(event);
1562
- }
1563
- };
1564
- this.handleArrowKeyPress = (event) => {
1565
- this.highlightedItemIndex = this.findNonSeparatorIndex(event.key, this.highlightedItemIndex);
1566
- };
1567
- this.findNonSeparatorIndex = (direction, currentIndex, depth = 0) => {
1568
- // Safety check to avoid infinite recursion
1569
- if (this.items.length === 0 || depth > this.items.length) {
1570
- return currentIndex;
1571
- }
1572
- const nextIndex = getItemIndex(direction, currentIndex, this.items.length);
1573
- if (!this.isListSeparator(this.items[nextIndex])) {
1574
- return nextIndex;
1575
- }
1576
- return this.findNonSeparatorIndex(direction, nextIndex, depth + 1);
1577
- };
1578
- this.handleEscapeKey = () => {
1579
- var _a;
1580
- // We only call this when ESCAPE is pressed
1581
- (_a = this.triggerFunction) === null || _a === void 0 ? void 0 : _a.stopTrigger();
1582
- this.resetTriggerAndPicker();
1583
- };
1584
- this.handleEnterOrTabKey = (event) => {
1585
- this.handleItemSelection(event);
1586
- };
1587
- this.handleMetadataChange = (event) => {
1588
- event.stopPropagation();
1589
- const editorMetadata = event.detail;
1590
- const enhancedImages = this.getEnhancedImages(editorMetadata.images || []);
1591
- const enhancedMetadata = Object.assign(Object.assign({}, editorMetadata), { images: enhancedImages });
1592
- this.metadataChange.emit(enhancedMetadata);
1593
- };
1594
- this.handleImagePasted = (event) => {
1595
- event.stopPropagation();
1596
- if (!this.allowInlineImages) {
1597
- return;
1598
- }
1599
- this.uploadHandler.handleImagePasted(event.detail);
1600
- };
1601
- this.handleTriggerStart = (event) => {
1602
- event.stopPropagation();
1603
- this.activeTrigger = event.detail.trigger;
1604
- this.triggerFunction = event.detail.textEditor;
1605
- this.isPickerOpen = true;
1606
- };
1607
- this.handleTriggerStop = (event) => {
1608
- event.stopPropagation();
1609
- this.resetTriggerAndPicker();
1610
- };
1611
- this.handleTriggerChange = (event) => {
1612
- var _a;
1613
- event.stopImmediatePropagation();
1614
- this.editorPickerQuery = event.detail.value;
1615
- const trigger = event.detail.trigger;
1616
- const searcher = (_a = this.registeredTriggerMap[trigger]) === null || _a === void 0 ? void 0 : _a.searcher;
1617
- if (searcher) {
1618
- this.isSearching = true;
1619
- this.debouncedSearchFn(searcher, this.editorPickerQuery);
1620
- }
1621
- };
1622
- this.resetTriggerAndPicker = () => {
1623
- this.isPickerOpen = false;
1624
- this.activeTrigger = undefined;
1625
- this.triggerFunction = undefined;
1626
- this.isSearching = false;
1627
- this.highlightedItemIndex = 0;
1628
- this.items = [];
1629
- };
1630
- this.handleItemSelection = (event) => {
1631
- var _a;
1632
- let selectedItem;
1633
- if (event instanceof CustomEvent) {
1634
- selectedItem = event.detail;
1635
- }
1636
- else if (event instanceof KeyboardEvent) {
1637
- const currentItem = this.items[this.highlightedItemIndex];
1638
- if (this.isListSeparator(currentItem)) {
1639
- return;
1640
- }
1641
- selectedItem = currentItem;
1642
- }
1643
- else {
1644
- return;
1645
- }
1646
- if (!this.activeTrigger || (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.disabled)) {
1647
- return;
1648
- }
1649
- const triggerHandler = this.registeredTriggerMap[this.activeTrigger];
1650
- try {
1651
- triggerHandler.inserter(this.triggerFunction, selectedItem);
1652
- }
1653
- catch (error) {
1654
- console.error('Error inserting', error);
1655
- }
1656
- this.resetTriggerAndPicker();
1657
- (_a = this.textEditor) === null || _a === void 0 ? void 0 : _a.focus();
1658
- };
1659
- this.handleVisibilityChange = () => {
1660
- if (document.visibilityState === 'hidden') {
1661
- this.saveDraft();
1662
- }
1663
- };
1664
- this.handleBeforeUnload = () => {
1665
- this.saveDraft();
1666
- };
1667
- this.portalId = createRandomString();
1668
- this.debouncedSearchFn = debounce(async (searcher, editorPickerQuery) => {
1669
- try {
1670
- const items = await searcher(editorPickerQuery);
1671
- if (editorPickerQuery !== this.editorPickerQuery ||
1672
- !this.activeTrigger) {
1673
- return;
1674
- }
1675
- this.items = items;
1676
- }
1677
- catch (error) {
1678
- console.error('Error searching', error);
1679
- }
1680
- finally {
1681
- this.isSearching = false;
1682
- }
1683
- }, DEBOUNCE_SEARCH_TIMEOUT);
1684
- }
1685
- connectedCallback() {
1686
- var _a, _b, _c, _d;
1687
- if (this.draftIdentifier) {
1688
- const limeObjectId = (_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 'no-limeobject';
1689
- const limeTypeName = (_d = (_c = this.context) === null || _c === void 0 ? void 0 : _c.limetype) !== null && _d !== void 0 ? _d : 'no-limetype';
1690
- this.textEditorInnerId = [
1691
- 'text-editor-draft',
1692
- limeTypeName,
1693
- limeObjectId,
1694
- this.draftIdentifier,
1695
- ].join('-');
1696
- }
1697
- if (this.textEditorInnerId) {
1698
- document.addEventListener('visibilitychange', this.handleVisibilityChange);
1699
- window.addEventListener('beforeunload', this.handleBeforeUnload);
1700
- }
1701
- this.uploadHandler = new UploadHandler(this.platform);
1702
- }
1703
- componentWillLoad() {
1704
- if (this.allowMentioning) {
1705
- this.registerMentions();
1706
- }
1707
- this.registerTriggers();
1708
- this.loadDraft();
1709
- }
1710
- disconnectedCallback() {
1711
- // These can be called even if the listeners were not set up,
1712
- // so we don't need to check for that
1713
- document.removeEventListener('visibilitychange', this.handleVisibilityChange);
1714
- window.removeEventListener('beforeunload', this.handleBeforeUnload);
1715
- document.removeEventListener('mousedown', this.handleMouseClick);
1716
- this.saveDraft();
1717
- if (this.host) {
1718
- this.host.removeEventListener('keyup', this.handleKeyPress, {
1719
- capture: true,
1720
- });
1721
- this.host.removeEventListener('keydown', this.handleKeyPress, {
1722
- capture: true,
1723
- });
1724
- }
1725
- if (this.debouncedSearchFn && this.debouncedSearchFn.cancel) {
1726
- this.debouncedSearchFn.cancel();
1727
- }
1728
- }
1729
- registerMentions() {
1730
- const mentions = new MentionsService(this.platform, this.context, this.searchableLimetypes);
1731
- const nodeDefinition = mentions.triggerHandler.nodeDefinition;
1732
- if (nodeDefinition) {
1733
- this.registeredCustomElements.push(nodeDefinition.customElement);
1734
- this.registeredTriggerMap[mentions.triggerCharacter] =
1735
- mentions.triggerHandler;
1736
- mentions.initialize();
1737
- }
1738
- }
1739
- registerTriggers() {
1740
- this.registeredTriggers = Object.keys(this.registeredTriggerMap);
1741
- }
1742
- setPickerMessage() {
1743
- var _a;
1744
- if (!this.activeTrigger) {
1745
- return;
1746
- }
1747
- const triggerHandler = this.registeredTriggerMap[this.activeTrigger];
1748
- if (((_a = this.editorPickerQuery) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1749
- this.pickerMessage = triggerHandler.noItemsFoundMessage;
1750
- }
1751
- else {
1752
- this.pickerMessage = triggerHandler.emptySearchMessage;
1753
- }
1754
- }
1755
- setupHandlers() {
1756
- if (this.isPickerOpen) {
1757
- this.host.addEventListener('keyup', this.handleKeyPress, {
1758
- capture: true,
1759
- });
1760
- this.host.addEventListener('keydown', this.handleKeyPress, {
1761
- capture: true,
1762
- });
1763
- document.addEventListener('mousedown', this.handleMouseClick);
1764
- }
1765
- else {
1766
- this.host.removeEventListener('keyup', this.handleKeyPress, {
1767
- capture: true,
1768
- });
1769
- this.host.removeEventListener('keydown', this.handleKeyPress, {
1770
- capture: true,
1771
- });
1772
- document.removeEventListener('mousedown', this.handleMouseClick);
1773
- }
1774
- }
1775
- isListSeparator(item) {
1776
- return 'separator' in item && item.separator === true;
1777
- }
1778
- render() {
1779
- return [
1780
- h("limel-text-editor", { key: '817d7a91d45a3bbf2a086a038868148fd3b6a5f0', ref: (el) => (this.textEditor = el), tabindex: this.disabled ? -1 : 0, value: this.value, contentType: this.contentType, customElements: this.registeredCustomElements, "aria-disabled": this.disabled, language: this.language, triggers: this.registeredTriggers, onTriggerStart: this.handleTriggerStart, onTriggerStop: this.handleTriggerStop, onTriggerChange: this.handleTriggerChange, onImagePasted: this.handleImagePasted, onMetadataChange: this.handleMetadataChange, ui: this.ui, allowResize: this.allowResize, required: this.required, disabled: this.disabled, readonly: this.readonly, helperText: this.helperText, placeholder: this.placeholder, label: this.label, invalid: this.invalid }),
1781
- this.renderPicker(),
1782
- ];
1783
- }
1784
- renderPicker() {
1785
- if (!this.isPickerOpen) {
1786
- return;
1787
- }
1788
- return (h("limel-portal", { containerId: this.portalId, visible: this.isPickerOpen, openDirection: "top", inheritParentWidth: true, anchor: this.textEditor }, h("limebb-text-editor-picker", { ref: (el) => (this.textEditorPickerElement =
1789
- el), items: getUpdatedItems(this.items, this.highlightedItemIndex), onItemSelected: this.handleItemSelection, emptyMessage: this.pickerMessage, isSearching: this.isSearching })));
1790
- }
1791
- getEnhancedImages(images) {
1792
- return images.map((image) => {
1793
- let fileId;
1794
- if (image.state === 'success') {
1795
- fileId = this.uploadHandler.parseFileIdFromSrc(image.src);
1796
- }
1797
- return fileId ? Object.assign(Object.assign({}, image), { fileId: fileId }) : image;
1798
- });
1799
- }
1800
- loadDraft() {
1801
- if (!this.userDataService || !this.textEditorInnerId) {
1802
- return;
1803
- }
1804
- if (this.value) {
1805
- // If the text-editor is loaded with a value, don't replace it.
1806
- return;
1807
- }
1808
- const draft = this.userDataService.get(this.textEditorInnerId);
1809
- if (draft) {
1810
- this.change.emit(draft);
1811
- }
1812
- }
1813
- saveDraft() {
1814
- var _a, _b, _c, _d;
1815
- if (!this.textEditorInnerId) {
1816
- return;
1817
- }
1818
- const currentValue = (_a = this.value) === null || _a === void 0 ? void 0 : _a.trim();
1819
- const existingDraft = (_b = this.userDataService) === null || _b === void 0 ? void 0 : _b.get(this.textEditorInnerId);
1820
- // Save draft
1821
- if (currentValue && currentValue !== existingDraft) {
1822
- (_c = this.userDataService) === null || _c === void 0 ? void 0 : _c.set(this.textEditorInnerId, currentValue);
1823
- }
1824
- // Delete draft
1825
- else if (!currentValue && existingDraft) {
1826
- (_d = this.userDataService) === null || _d === void 0 ? void 0 : _d.set(this.textEditorInnerId, undefined);
1827
- }
1828
- }
1829
- get userDataService() {
1830
- return this.platform.get(c.UserDataRepository);
1831
- }
1832
- static get delegatesFocus() { return true; }
1833
- get host() { return this; }
1834
- static get watchers() { return {
1835
- "isPickerOpen": ["watchOpen"],
1836
- "editorPickerQuery": ["watchQuery"]
1837
- }; }
1838
- static get style() { return LimebbTextEditorStyle0; }
1839
- }, [17, "limebb-text-editor", {
1840
- "platform": [16],
1841
- "context": [16],
1842
- "allowMentioning": [4, "allow-mentioning"],
1843
- "contentType": [1, "content-type"],
1844
- "language": [513],
1845
- "disabled": [516],
1846
- "readonly": [516],
1847
- "helperText": [513, "helper-text"],
1848
- "placeholder": [513],
1849
- "label": [513],
1850
- "invalid": [516],
1851
- "required": [516],
1852
- "selectedContext": [16],
1853
- "ui": [513],
1854
- "allowResize": [4, "allow-resize"],
1855
- "value": [1],
1856
- "draftIdentifier": [1, "draft-identifier"],
1857
- "triggerMap": [16],
1858
- "customElements": [16],
1859
- "allowInlineImages": [4, "allow-inline-images"],
1860
- "items": [32],
1861
- "highlightedItemIndex": [32],
1862
- "editorPickerQuery": [32],
1863
- "searchableLimetypes": [32],
1864
- "isPickerOpen": [32],
1865
- "isSearching": [32]
1866
- }, undefined, {
1867
- "isPickerOpen": ["watchOpen"],
1868
- "editorPickerQuery": ["watchQuery"]
1869
- }]);
1870
- __decorate([
1871
- Ze({
1872
- map: [getMentionLimetypes],
1873
- })
1874
- ], LimeBBTextEditor.prototype, "searchableLimetypes", void 0);
1875
- function defineCustomElement$1() {
1876
- if (typeof customElements === "undefined") {
1877
- return;
1878
- }
1879
- const components = ["limebb-text-editor", "limebb-empty-state", "limebb-text-editor-picker"];
1880
- components.forEach(tagName => { switch (tagName) {
1881
- case "limebb-text-editor":
1882
- if (!customElements.get(tagName)) {
1883
- customElements.define(tagName, LimeBBTextEditor);
1884
- }
1885
- break;
1886
- case "limebb-empty-state":
1887
- if (!customElements.get(tagName)) {
1888
- defineCustomElement$3();
1889
- }
1890
- break;
1891
- case "limebb-text-editor-picker":
1892
- if (!customElements.get(tagName)) {
1893
- defineCustomElement$2();
1894
- }
1895
- break;
1896
- } });
1897
- }
1898
-
1899
- const LimebbTextEditor = LimeBBTextEditor;
1900
- const defineCustomElement = defineCustomElement$1;
1901
-
1902
- export { LimebbTextEditor, defineCustomElement };
1
+ import{proxyCustomElement as t,HTMLElement as e,createEvent as i,h as s,transformTag as r}from"@stencil/core/internal/client";import{n,Z as o,Q as a,j as h}from"./index.esm.js";import{A as c,E as u,b as l,a as d,T as f}from"./keycodes.js";import{U as m,S as b,g as v}from"./_Uint8Array.js";import{d as p}from"./_defineProperty.js";import{e as g}from"./_MapCache.js";import{o as y,d as j,g as w,f as x,n as O,a as k}from"./_getTag.js";import{d as S,S as I,i as E,a as T,r as C}from"./_Map.js";import{c as A}from"./random-string.js";import{h as M,a as P,b as F}from"./limetype.js";import{i as _}from"./non-null.js";import{d as N}from"./empty-state.js";import{d as z}from"./text-editor-picker.js";import{i as D}from"./isSymbol.js";var L=/\s/,Q=/^\s+/;var R=/^[-+]0x[0-9a-f]+$/i,U=/^0b[01]+$/i,$=/^0o[0-7]+$/i,G=parseInt;function q(t){if("number"==typeof t)return t;if(D(t))return NaN;if(S(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=S(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=function(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&L.test(t.charAt(e)););return e}(t)+1).replace(Q,""):t}(t);var i=U.test(t);return i||$.test(t)?G(t.slice(2),i?2:8):R.test(t)?NaN:+t}var W=Object.create,B=function(){function t(){}return function(e){if(!S(e))return{};if(W)return W(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}(),H=Object.prototype.hasOwnProperty;var K=y(Object.getPrototypeOf,Object);"object"==typeof exports&&exports&&!exports.nodeType&&exports&&"object"==typeof module&&module&&!module.nodeType&&module;var V=Object.prototype.hasOwnProperty;function Z(t){var e=new t.constructor(t.byteLength);return new m(e).set(new m(t)),e}var J=/\w*$/,X=I?I.prototype:void 0,Y=X?X.valueOf:void 0;var tt=O&&O.isMap,et=tt?x(tt):function(t){return E(t)&&"[object Map]"==w(t)},it=O&&O.isSet,st=it?x(it):function(t){return E(t)&&"[object Set]"==w(t)},rt="[object Arguments]",nt="[object Function]",ot="[object Object]",at={};function ht(t,e,i,s,r,n){var o;if(void 0!==o)return o;if(!S(t))return t;var a=T(t);if(a)o=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&V.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t);else{var h=w(t),c=h==nt||"[object GeneratorFunction]"==h;if(k(t))return function(t){return t.slice()}(t);if(h==ot||h==rt||c&&!r)o=c?{}:function(t){return"function"!=typeof t.constructor||j(t)?{}:B(K(t))}(t);else{if(!at[h])return r?t:{};o=function(t,e){var i=t.constructor;switch(e){case"[object ArrayBuffer]":return Z(t);case"[object Boolean]":case"[object Date]":return new i(+t);case"[object DataView]":return function(t){var e=Z(t.buffer);return new t.constructor(e,t.byteOffset,t.byteLength)}(t);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t){var e=Z(t.buffer);return new t.constructor(e,t.byteOffset,t.length)}(t);case"[object Map]":case"[object Set]":return new i;case"[object Number]":case"[object String]":return new i(t);case"[object RegExp]":return function(t){var e=new t.constructor(t.source,J.exec(t));return e.lastIndex=t.lastIndex,e}(t);case"[object Symbol]":return function(t){return Y?Object(Y.call(t)):{}}(t)}}(t,h)}}n||(n=new b);var u=n.get(t);if(u)return u;n.set(t,o),st(t)?t.forEach((function(s){o.add(ht(s,e,i,0,t,n))})):et(t)&&t.forEach((function(s,r){o.set(r,ht(s,e,i,0,t,n))}));var l=a?void 0:v(t);return function(t,e){for(var i=-1,s=null==t?0:t.length;++i<s&&!1!==e(t[i],i););}(l||t,(function(s,r){l&&(s=t[r=s]),function(t,e,i){var s=t[e];H.call(t,e)&&g(s,i)&&(void 0!==i||e in t)||function(t,e,i){"__proto__"==e&&p?p(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}(t,e,i)}(o,r,ht(s,e,i,0,t,n))})),o}at[rt]=at["[object Array]"]=at["[object ArrayBuffer]"]=at["[object DataView]"]=at["[object Boolean]"]=at["[object Date]"]=at["[object Float32Array]"]=at["[object Float64Array]"]=at["[object Int8Array]"]=at["[object Int16Array]"]=at["[object Int32Array]"]=at["[object Map]"]=at["[object Number]"]=at[ot]=at["[object RegExp]"]=at["[object Set]"]=at["[object String]"]=at["[object Symbol]"]=at["[object Uint8Array]"]=at["[object Uint8ClampedArray]"]=at["[object Uint16Array]"]=at["[object Uint32Array]"]=!0,at["[object Error]"]=at[nt]=at["[object WeakMap]"]=!1;var ct=function(){return C.Date.now()},ut=Math.max,lt=Math.min;function dt(t,e){return t.map(((t,i)=>{const s=function(t){return ht(t,5)}(t);return Object.assign(Object.assign({},s),{selected:i===e})}))}class ft{get limeObjectService(){return this.platform.get(n.LimeObjectRepository)}get queryService(){return this.platform.get(n.Query)}get viewFactoryRegistry(){return this.platform.get(n.ViewFactoryRegistry)}get translator(){var t;return null===(t=this.platform)||void 0===t?void 0:t.get(n.Translate)}get triggerCharacter(){return this._triggerCharacter}get triggerHandler(){return this._triggerHandler}constructor(t,e,i){this.platform=t,this.context=e,this.searchableLimetypes=i,this.groupCounts={},this._triggerCharacter="@",this._triggerHandler={searcher:t=>this.searcher(t),inserter:(t,e)=>this.inserter(t,e),emptySearchMessage:"Start typing a name...",noItemsFoundMessage:"No results for your search...",nodeDefinition:{customElement:{tagName:"limebb-mention",attributes:["limetype","objectid","href"]},mapAttributes:t=>({limetype:t.value.getLimetype().name,objectid:t.value.id,href:`object/${this.context.limetype}/${this.context.id}`})}},this.searcher=async t=>{if(!t)return[];const{objects:e}=await this.limeObjectService.search(t,this.searchableLimetypes,10);return this.createSearchListItems(e)},this.inserter=async(t,e)=>{var i;const s=this.triggerHandler.nodeDefinition;s&&t.insert({node:{tagName:s.customElement.tagName,attributes:s.mapAttributes(e)},children:[null===(i=e.value)||void 0===i?void 0:i.descriptive]})}}async initialize(){await this.loadGroupCounts()}async loadGroupCounts(){const t=this.searchableLimetypes.filter((t=>!P(t,"user")&&M(t,"user"))).map((t=>this.getGroupCounts(t)));for(const e of await Promise.all(t))Object.assign(this.groupCounts,e)}async getGroupCounts(t){var e;const i=F(t,"user"),s=t.name;try{const t=await this.queryService.execute({limetype:s,responseFormat:{object:{_id:null,[i.name]:{count:{aggregate:{op:o.Count}}}}}});if(!(null===(e=t.objects)||void 0===e?void 0:e.length))return{[s]:{}};const r=this.createGroupCount(t.objects,i.name);return{[s]:r}}catch(e){return console.error("Error fetching group count for limetype: "+t.name,e),{[s]:{}}}}createGroupCount(t,e){const i={};for(const s of t){const{_id:t,[e]:r}=s;i[t]=r.count}return i}createSearchListItems(t=[]){return t.map((t=>this.createSearchListItem(t))).filter(_)}createSearchListItem(t){const e=this.viewFactoryRegistry.getFactory("search"),i=this.limeObjectService.getObject(t._limetype,t._id);if(!i)return null;const s=e(i,this.context),r=this.getGroupCountComponent(i);return Object.assign(Object.assign({},s),r?{primaryComponent:r}:{})}getGroupCountComponent(t){var e;const i=t.getLimetype(),s=null===(e=this.groupCounts[i.name])||void 0===e?void 0:e[t.id],r=F(i,"user");if(void 0!==s&&r)return{name:"limebb-mention-group-counter",props:{count:s,limetype:r.relation.getLimetype(),helperLabel:this.translator.get("webclient.notification-center.members-will-be-notified")}}}}class mt{constructor(t,e){this.file=t,this.http=e,this.uploadCancelled=!1,this.getUrl=t=>"api/v1/file/"+(null!=t?t:"")}async initialize(){this.uploadService=await this.http.createFileUpload(a.Post,this.getUrl(),this.file),this.progressCallback&&(this.uploadService.onProgress=this.progressCallback)}async upload(){return this.uploadService.upload()}getFileName(){return this.file.name}cancel(){this.uploadService.cancel(),this.uploadCancelled=!0}set onProgress(t){this.progressCallback=t,this.uploadService&&(this.uploadService.onProgress=t)}}class bt{constructor(t){this.platform=t}async handleImagePasted(t){const e=null==t?void 0:t.fileInfo;if(!e)return;if(!this.validateImageSize(e))return;t.insertThumbnail();const i=await this.createFileUpload(e),s=null==i?void 0:i.href;return s&&void 0!==(null==i?void 0:i.fileId)?t.insertImage(s):t.insertFailedThumbnail(),i}parseFileIdFromSrc(t){if(t){const e=/\/(\d+)\/contents\/?$/.exec(t);if(e&&e[1])return Number(e[1])}}validateImageSize(t){return!!t.fileContent&&t.fileContent.size<=52428800}async createFileUpload(t){var e;if(!t.fileContent)return;const i=new mt(t.fileContent,this.http);await i.initialize();const s=Object.assign(Object.assign({},t),{progress:0,file:i,state:"added",fileId:void 0,href:void 0,id:t.id});i.onProgress=t=>{0===s.progress&&(s.state="uploading"),s.progress=t,100===t&&(s.state="finalizing")};const r=await i.upload();return s.fileId=r.id,s.filename=r.filename,s.extension=r.extension,s.contentType=r.contentType,s.size=r.size,s.state="done",s.href=null===(e=r._links)||void 0===e?void 0:e.contents.href,s}get http(){return this.platform.get(n.Http)}}const vt=t(class extends e{watchOpen(){this.setupHandlers(),this.setPickerMessage()}watchQuery(){this.setPickerMessage()}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.change=i(this,"change",7),this.metadataChange=i(this,"metadataChange",7),this.allowMentioning=!1,this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.required=!1,this.ui="standard",this.allowResize=!0,this.value="",this.triggerMap={},this.customElements=[],this.allowInlineImages=!1,this.items=[],this.highlightedItemIndex=0,this.isPickerOpen=!1,this.isSearching=!1,this.registeredTriggers=[],this.registeredTriggerMap=this.triggerMap,this.registeredCustomElements=this.customElements,this.activeTrigger=void 0,this.handleMouseClick=t=>{this.textEditorPickerElement&&(t.target===this.textEditorPickerElement||this.resetTriggerAndPicker())},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![u,l,c,d,f].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const e={[u]:this.handleEscapeKey,[d]:this.handleEnterOrTabKey,[f]:this.handleEnterOrTabKey,[c]:this.handleArrowKeyPress,[l]:this.handleArrowKeyPress}[t.key];e&&e(t)},this.handleArrowKeyPress=t=>{this.highlightedItemIndex=this.findNonSeparatorIndex(t.key,this.highlightedItemIndex)},this.findNonSeparatorIndex=(t,e,i=0)=>{if(0===this.items.length||i>this.items.length)return e;const s=((t,e,i)=>(e+(t===c?1:-1)+i)%i)(t,e,this.items.length);return this.isListSeparator(this.items[s])?this.findNonSeparatorIndex(t,s,i+1):s},this.handleEscapeKey=()=>{var t;null===(t=this.triggerFunction)||void 0===t||t.stopTrigger(),this.resetTriggerAndPicker()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleMetadataChange=t=>{t.stopPropagation();const e=t.detail,i=this.getEnhancedImages(e.images||[]),s=Object.assign(Object.assign({},e),{images:i});this.metadataChange.emit(s)},this.handleImagePasted=t=>{t.stopPropagation(),this.allowInlineImages&&this.uploadHandler.handleImagePasted(t.detail)},this.handleTriggerStart=t=>{t.stopPropagation(),this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor,this.isPickerOpen=!0},this.handleTriggerStop=t=>{t.stopPropagation(),this.resetTriggerAndPicker()},this.handleTriggerChange=t=>{var e;t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value;const i=null===(e=this.registeredTriggerMap[t.detail.trigger])||void 0===e?void 0:e.searcher;i&&(this.isSearching=!0,this.debouncedSearchFn(i,this.editorPickerQuery))},this.resetTriggerAndPicker=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.isSearching=!1,this.highlightedItemIndex=0,this.items=[]},this.handleItemSelection=t=>{var e;let i;if(t instanceof CustomEvent)i=t.detail;else{if(!(t instanceof KeyboardEvent))return;{const t=this.items[this.highlightedItemIndex];if(this.isListSeparator(t))return;i=t}}if(!this.activeTrigger||(null==i?void 0:i.disabled))return;const s=this.registeredTriggerMap[this.activeTrigger];try{s.inserter(this.triggerFunction,i)}catch(t){console.error("Error inserting",t)}this.resetTriggerAndPicker(),null===(e=this.textEditor)||void 0===e||e.focus()},this.handleVisibilityChange=()=>{"hidden"===document.visibilityState&&this.saveDraft()},this.handleBeforeUnload=()=>{this.saveDraft()},this.portalId=A(),this.debouncedSearchFn=function(t,e,i){var s,r,n,o,a,h,c=0,u=!1,l=!1,d=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){var i=s,n=r;return s=r=void 0,c=e,o=t.apply(n,i)}function m(t){var i=t-h;return void 0===h||i>=e||i<0||l&&t-c>=n}function b(){var t=ct();if(m(t))return v(t);a=setTimeout(b,function(t){var i=e-(t-h);return l?lt(i,n-(t-c)):i}(t))}function v(t){return a=void 0,d&&s?f(t):(s=r=void 0,o)}function p(){var t=ct(),i=m(t);if(s=arguments,r=this,h=t,i){if(void 0===a)return function(t){return c=t,a=setTimeout(b,e),u?f(t):o}(h);if(l)return clearTimeout(a),a=setTimeout(b,e),f(h)}return void 0===a&&(a=setTimeout(b,e)),o}return e=q(e)||0,S(i)&&(u=!!i.leading,n=(l="maxWait"in i)?ut(q(i.maxWait)||0,e):n,d="trailing"in i?!!i.trailing:d),p.cancel=function(){void 0!==a&&clearTimeout(a),c=0,s=h=r=a=void 0},p.flush=function(){return void 0===a?o:v(ct())},p}((async(t,e)=>{try{const i=await t(e);if(e!==this.editorPickerQuery||!this.activeTrigger)return;this.items=i}catch(t){console.error("Error searching",t)}finally{this.isSearching=!1}}),300)}connectedCallback(){var t,e,i,s;if(this.draftIdentifier){const r=null!==(e=null===(t=this.context)||void 0===t?void 0:t.id)&&void 0!==e?e:"no-limeobject",n=null!==(s=null===(i=this.context)||void 0===i?void 0:i.limetype)&&void 0!==s?s:"no-limetype";this.textEditorInnerId=["text-editor-draft",n,r,this.draftIdentifier].join("-")}this.textEditorInnerId&&(document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("beforeunload",this.handleBeforeUnload)),this.uploadHandler=new bt(this.platform)}componentWillLoad(){this.allowMentioning&&this.registerMentions(),this.registerTriggers(),this.loadDraft()}disconnectedCallback(){document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("mousedown",this.handleMouseClick),this.saveDraft(),this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0})),this.debouncedSearchFn&&this.debouncedSearchFn.cancel&&this.debouncedSearchFn.cancel()}registerMentions(){const t=new ft(this.platform,this.context,this.searchableLimetypes),e=t.triggerHandler.nodeDefinition;e&&(this.registeredCustomElements.push(e.customElement),this.registeredTriggerMap[t.triggerCharacter]=t.triggerHandler,t.initialize())}registerTriggers(){this.registeredTriggers=Object.keys(this.registeredTriggerMap)}setPickerMessage(){var t;if(!this.activeTrigger)return;const e=this.registeredTriggerMap[this.activeTrigger];this.pickerMessage=(null===(t=this.editorPickerQuery)||void 0===t?void 0:t.length)>0?e.noItemsFoundMessage:e.emptySearchMessage}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0}),document.addEventListener("mousedown",this.handleMouseClick)):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}),document.removeEventListener("mousedown",this.handleMouseClick))}isListSeparator(t){return"separator"in t&&!0===t.separator}render(){return[s("limel-text-editor",{key:"9cd16fcb065db254b472f33f31d5b28abf2ca760",ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.registeredCustomElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,onImagePasted:this.handleImagePasted,onMetadataChange:this.handleMetadataChange,ui:this.ui,allowResize:this.allowResize,required:this.required,disabled:this.disabled,readonly:this.readonly,helperText:this.helperText,placeholder:this.placeholder,label:this.label,invalid:this.invalid}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return s("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},s("limebb-text-editor-picker",{ref:t=>this.textEditorPickerElement=t,items:dt(this.items,this.highlightedItemIndex),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}))}getEnhancedImages(t){return t.map((t=>{let e;return"success"===t.state&&(e=this.uploadHandler.parseFileIdFromSrc(t.src)),e?Object.assign(Object.assign({},t),{fileId:e}):t}))}loadDraft(){if(!this.userDataService||!this.textEditorInnerId)return;if(this.value)return;const t=this.userDataService.get(this.textEditorInnerId);t&&this.change.emit(t)}saveDraft(){var t,e,i,s;if(!this.textEditorInnerId)return;const r=null===(t=this.value)||void 0===t?void 0:t.trim(),n=null===(e=this.userDataService)||void 0===e?void 0:e.get(this.textEditorInnerId);r&&r!==n?null===(i=this.userDataService)||void 0===i||i.set(this.textEditorInnerId,r):!r&&n&&(null===(s=this.userDataService)||void 0===s||s.set(this.textEditorInnerId,void 0))}get userDataService(){return this.platform.get(n.UserDataRepository)}static get delegatesFocus(){return!0}get host(){return this}static get watchers(){return{isPickerOpen:[{watchOpen:0}],editorPickerQuery:[{watchQuery:0}]}}static get style(){return":host(limebb-text-editor){display:block;width:100%;min-width:5rem;min-height:5rem;height:100%;max-height:var(--text-editor-max-height, calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem))}"}},[17,"limebb-text-editor",{platform:[16],context:[16],allowMentioning:[4,"allow-mentioning"],contentType:[1,"content-type"],language:[513],disabled:[516],readonly:[516],helperText:[513,"helper-text"],placeholder:[513],label:[513],invalid:[516],required:[516],selectedContext:[16],ui:[513],allowResize:[4,"allow-resize"],value:[1],draftIdentifier:[1,"draft-identifier"],triggerMap:[16],customElements:[16],allowInlineImages:[4,"allow-inline-images"],items:[32],highlightedItemIndex:[32],editorPickerQuery:[32],searchableLimetypes:[32],isPickerOpen:[32],isSearching:[32]},void 0,{isPickerOpen:[{watchOpen:0}],editorPickerQuery:[{watchQuery:0}]}]);!function(t,e,i,s){var r,n=arguments.length,o=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,i,o):r(e,i))||o);n>3&&o&&Object.defineProperty(e,i,o)}([h({map:[function(t){return Object.values(t).filter((t=>P(t,"user")||M(t,"user")))}]})],vt.prototype,"searchableLimetypes",void 0);const pt=vt,gt=function(){"undefined"!=typeof customElements&&["limebb-text-editor","limebb-empty-state","limebb-text-editor-picker"].forEach((t=>{switch(t){case"limebb-text-editor":customElements.get(r(t))||customElements.define(r(t),vt);break;case"limebb-empty-state":customElements.get(r(t))||N();break;case"limebb-text-editor-picker":customElements.get(r(t))||z()}}))};export{pt as LimebbTextEditor,gt as defineCustomElement}