bromcom-ui 2.8.1-rc.1 → 2.8.1-rc.3

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 (220) hide show
  1. package/dist/bromcom-ui/bromcom-ui.css +1 -1
  2. package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
  3. package/dist/bromcom-ui/{p-70909443.entry.js → p-05852df3.entry.js} +1 -1
  4. package/dist/bromcom-ui/{p-02116d36.entry.js → p-1b1f82cf.entry.js} +1 -1
  5. package/dist/bromcom-ui/{p-63bff12e.entry.js → p-1c1f02a8.entry.js} +1 -1
  6. package/dist/bromcom-ui/{p-216c6fd5.entry.js → p-1d591e1e.entry.js} +1 -1
  7. package/dist/bromcom-ui/p-1eabd5dc.js +10 -0
  8. package/dist/bromcom-ui/{p-b40bb51f.entry.js → p-23b6f1b6.entry.js} +1 -1
  9. package/dist/bromcom-ui/{p-a3109200.entry.js → p-25e6e25d.entry.js} +1 -1
  10. package/dist/bromcom-ui/{p-426b7889.entry.js → p-2c93afb8.entry.js} +1 -1
  11. package/dist/bromcom-ui/{p-a6b9ac13.entry.js → p-2d1124ca.entry.js} +1 -1
  12. package/dist/bromcom-ui/{p-495b54be.entry.js → p-50b59f5f.entry.js} +1 -1
  13. package/dist/bromcom-ui/p-5358bb45.entry.js +5 -0
  14. package/dist/bromcom-ui/p-53658089.entry.js +13 -0
  15. package/dist/bromcom-ui/{p-7a89e7ae.entry.js → p-538a13af.entry.js} +1 -1
  16. package/dist/bromcom-ui/{p-48e2d5e5.js → p-594fbc80.js} +1 -1
  17. package/dist/bromcom-ui/p-59efe1da.js +5 -0
  18. package/dist/bromcom-ui/{p-e0855669.entry.js → p-5bb7e3b7.entry.js} +1 -1
  19. package/dist/bromcom-ui/{p-ea763cf4.entry.js → p-5bf4d697.entry.js} +1 -1
  20. package/dist/bromcom-ui/{p-c3da137b.entry.js → p-5c718986.entry.js} +1 -1
  21. package/dist/bromcom-ui/{p-bda1709b.entry.js → p-5e72a278.entry.js} +1 -1
  22. package/dist/bromcom-ui/{p-57c71c1f.entry.js → p-63608aaa.entry.js} +1 -1
  23. package/dist/bromcom-ui/{p-67ff8aa3.entry.js → p-6b988756.entry.js} +1 -1
  24. package/dist/bromcom-ui/{p-18a5c6ab.entry.js → p-6db0f8dd.entry.js} +1 -1
  25. package/dist/bromcom-ui/p-6eefda1d.entry.js +5 -0
  26. package/dist/bromcom-ui/{p-7ad7c6d7.entry.js → p-6f5bd54d.entry.js} +1 -1
  27. package/dist/bromcom-ui/{p-4bbdd324.entry.js → p-702a285b.entry.js} +1 -1
  28. package/dist/bromcom-ui/{p-cab8c1e0.entry.js → p-70b210af.entry.js} +1 -1
  29. package/dist/bromcom-ui/{p-6755089b.js → p-75a2820f.js} +1 -1
  30. package/dist/bromcom-ui/{p-3f9d992a.entry.js → p-76182c8b.entry.js} +1 -1
  31. package/dist/bromcom-ui/{p-b2d87a12.entry.js → p-78527fcd.entry.js} +1 -1
  32. package/dist/bromcom-ui/{p-b9ba70c3.entry.js → p-7baef152.entry.js} +1 -1
  33. package/dist/bromcom-ui/{p-5098fca3.entry.js → p-8aa4fee3.entry.js} +1 -1
  34. package/dist/bromcom-ui/{p-940cbe01.js → p-8e7a489e.js} +1 -1
  35. package/dist/bromcom-ui/{p-e6afe8b6.entry.js → p-962fee18.entry.js} +1 -1
  36. package/dist/bromcom-ui/{p-bf523f14.entry.js → p-97e22a22.entry.js} +1 -1
  37. package/dist/bromcom-ui/{p-ffec0a2b.js → p-9bc739ac.js} +1 -1
  38. package/dist/bromcom-ui/{p-748cefe3.entry.js → p-9c2f39ab.entry.js} +1 -1
  39. package/dist/bromcom-ui/{p-3ee818a8.entry.js → p-9d00bf3c.entry.js} +1 -1
  40. package/dist/bromcom-ui/{p-81f1dd1f.js → p-aea6f62f.js} +1 -1
  41. package/dist/bromcom-ui/{p-6fc52a85.entry.js → p-af81e5fa.entry.js} +1 -1
  42. package/dist/bromcom-ui/{p-406785b9.entry.js → p-b1b64c8b.entry.js} +1 -1
  43. package/dist/bromcom-ui/{p-a58c6ceb.entry.js → p-b29766b2.entry.js} +1 -1
  44. package/dist/bromcom-ui/{p-5b2b1352.entry.js → p-b4b06540.entry.js} +1 -1
  45. package/dist/bromcom-ui/{p-95351a23.entry.js → p-b685ca73.entry.js} +1 -1
  46. package/dist/bromcom-ui/{p-481f4962.entry.js → p-b7919ac8.entry.js} +1 -1
  47. package/dist/bromcom-ui/{p-6d8f018f.entry.js → p-bae55354.entry.js} +1 -1
  48. package/dist/bromcom-ui/{p-6de2deb5.entry.js → p-bbd80e20.entry.js} +1 -1
  49. package/dist/bromcom-ui/{p-0ae7d5fb.entry.js → p-c0bb9cfc.entry.js} +1 -1
  50. package/dist/bromcom-ui/{p-ffdc6086.entry.js → p-c4e92744.entry.js} +1 -1
  51. package/dist/bromcom-ui/{p-1f0ce7fa.entry.js → p-c863ba72.entry.js} +1 -1
  52. package/dist/bromcom-ui/{p-c2210caa.entry.js → p-d019f179.entry.js} +1 -1
  53. package/dist/bromcom-ui/{p-e0991d3a.entry.js → p-d497bc00.entry.js} +1 -1
  54. package/dist/bromcom-ui/{p-a8c8c9cf.entry.js → p-d9838751.entry.js} +1 -1
  55. package/dist/bromcom-ui/{p-7af21a10.entry.js → p-dd4c1650.entry.js} +1 -1
  56. package/dist/bromcom-ui/{p-773d6818.js → p-e1119ff2.js} +1 -1
  57. package/dist/bromcom-ui/{p-677153b5.entry.js → p-e1898d81.entry.js} +1 -1
  58. package/dist/bromcom-ui/p-ea6c32e1.entry.js +5 -0
  59. package/dist/bromcom-ui/{p-68868af9.entry.js → p-f1eefc73.entry.js} +1 -1
  60. package/dist/bromcom-ui/{p-44b18c6d.entry.js → p-f2699133.entry.js} +1 -1
  61. package/dist/bromcom-ui/{p-4b1cba4c.entry.js → p-f35d0fc2.entry.js} +1 -1
  62. package/dist/cjs/bcm-accordion.cjs.entry.js +1 -1
  63. package/dist/cjs/bcm-alert.cjs.entry.js +1 -1
  64. package/dist/cjs/bcm-attendance.cjs.entry.js +1 -1
  65. package/dist/cjs/bcm-avatar_2.cjs.entry.js +3 -3
  66. package/dist/cjs/bcm-breadcrumb.cjs.entry.js +1 -1
  67. package/dist/cjs/bcm-button-group.cjs.entry.js +1 -1
  68. package/dist/cjs/bcm-button_7.cjs.entry.js +4 -4
  69. package/dist/cjs/bcm-card.cjs.entry.js +1 -1
  70. package/dist/cjs/bcm-checkbox-lite_9.cjs.entry.js +1 -1
  71. package/dist/cjs/bcm-chip.cjs.entry.js +1 -1
  72. package/dist/cjs/bcm-collapse.cjs.entry.js +1 -1
  73. package/dist/cjs/bcm-color-input.cjs.entry.js +3 -3
  74. package/dist/cjs/bcm-colorful_2.cjs.entry.js +15 -544
  75. package/dist/cjs/bcm-date-picker.cjs.entry.js +1 -1
  76. package/dist/cjs/bcm-datetime-picker.cjs.entry.js +1 -1
  77. package/dist/cjs/bcm-default.cjs.entry.js +1 -1
  78. package/dist/cjs/bcm-drawer.cjs.entry.js +3 -3
  79. package/dist/cjs/bcm-dropdown.cjs.entry.js +2 -2
  80. package/dist/cjs/bcm-expansion-panel.cjs.entry.js +1 -1
  81. package/dist/cjs/bcm-form-2.cjs.entry.js +1 -1
  82. package/dist/cjs/bcm-input-custom.cjs.entry.js +1 -1
  83. package/dist/cjs/bcm-input.cjs.entry.js +4 -4
  84. package/dist/cjs/bcm-item.cjs.entry.js +1 -1
  85. package/dist/cjs/bcm-items.cjs.entry.js +1 -1
  86. package/dist/cjs/bcm-list.cjs.entry.js +140 -328
  87. package/dist/cjs/bcm-menu.cjs.entry.js +4 -4
  88. package/dist/cjs/bcm-modal-2-footer.cjs.entry.js +3 -3
  89. package/dist/cjs/bcm-modal-2-header.cjs.entry.js +3 -3
  90. package/dist/cjs/bcm-modal-2.cjs.entry.js +3 -3
  91. package/dist/cjs/bcm-modal.cjs.entry.js +1 -1
  92. package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +1 -1
  93. package/dist/cjs/bcm-popconfirm.cjs.entry.js +1 -1
  94. package/dist/cjs/bcm-popover.cjs.entry.js +3 -3
  95. package/dist/cjs/bcm-progress.cjs.entry.js +1 -1
  96. package/dist/cjs/bcm-radio-group.cjs.entry.js +3 -3
  97. package/dist/cjs/bcm-radio.cjs.entry.js +3 -3
  98. package/dist/cjs/bcm-range.cjs.entry.js +1 -1
  99. package/dist/cjs/bcm-rc-overflow_2.cjs.entry.js +2443 -0
  100. package/dist/cjs/bcm-skeleton.cjs.entry.js +1 -1
  101. package/dist/cjs/bcm-step.cjs.entry.js +2 -2
  102. package/dist/cjs/bcm-stepper.cjs.entry.js +4 -4
  103. package/dist/cjs/bcm-switch.cjs.entry.js +1 -1
  104. package/dist/cjs/bcm-tab-group.cjs.entry.js +3 -3
  105. package/dist/cjs/bcm-tab-item-header.cjs.entry.js +3 -3
  106. package/dist/cjs/bcm-tab-item.cjs.entry.js +3 -3
  107. package/dist/cjs/bcm-tag.cjs.entry.js +2 -2
  108. package/dist/cjs/bcm-textarea.cjs.entry.js +2 -2
  109. package/dist/cjs/bcm-time-picker.cjs.entry.js +1 -1
  110. package/dist/cjs/bcm-toast.cjs.entry.js +1 -1
  111. package/dist/cjs/bromcom-ui.cjs.js +1 -1
  112. package/dist/cjs/{generate-493daefd.js → generate-5564014f.js} +1 -1
  113. package/dist/cjs/index-906fb4e5.js +540 -0
  114. package/dist/cjs/{input-template-96af0058.js → input-template-b8eb3568.js} +1 -1
  115. package/dist/cjs/{json-parse-decarator-b5b0b23d.js → json-parse-decarator-c9d01873.js} +1 -1
  116. package/dist/cjs/loader.cjs.js +1 -1
  117. package/dist/cjs/{number-helper-051fe1ec.js → number-helper-57fc05a9.js} +1 -1
  118. package/dist/cjs/old-bcm-popover-box.cjs.entry.js +2 -2
  119. package/dist/cjs/old-bcm-popover.cjs.entry.js +1 -1
  120. package/dist/cjs/{stepper-states-efee4ad7.js → stepper-states-47bcb1a4.js} +1 -1
  121. package/dist/cjs/{tooltip-helper-a8734616.js → tooltip-helper-4ca7648e.js} +3 -3
  122. package/dist/cjs/{validators-50fd1ad1.js → validators-f1b75654.js} +1 -1
  123. package/dist/collection/collection-manifest.json +3 -2
  124. package/dist/collection/components/organism/list/list.css +4 -3
  125. package/dist/collection/components/organism/list/list.js +171 -176
  126. package/dist/collection/components/organism/states/bcm-list2.states.js +1 -1
  127. package/dist/collection/components/{molecules → third-parts}/colorful/colorful.css +1 -1
  128. package/dist/collection/components/third-parts/rc-overflow/rc-overflow.css +138 -0
  129. package/dist/collection/components/third-parts/rc-overflow/rc-overflow.js +194 -0
  130. package/dist/components/bcm-alert.js +1 -1
  131. package/dist/components/bcm-checkbox-group.js +1 -1
  132. package/dist/components/bcm-list.js +154 -329
  133. package/dist/components/bcm-rc-overflow.d.ts +11 -0
  134. package/dist/components/bcm-rc-overflow.js +10 -0
  135. package/dist/components/button.js +1 -1
  136. package/dist/components/colorful.js +2 -531
  137. package/dist/components/generate.js +1 -1
  138. package/dist/components/index.d.ts +2 -1
  139. package/dist/components/index.js +1 -0
  140. package/dist/components/index3.js +523 -177
  141. package/dist/components/index4.js +191 -0
  142. package/dist/components/rc-overflow.js +2238 -0
  143. package/dist/components/search.js +1 -1
  144. package/dist/components/step.js +1 -1
  145. package/dist/esm/bcm-accordion.entry.js +1 -1
  146. package/dist/esm/bcm-alert.entry.js +1 -1
  147. package/dist/esm/bcm-attendance.entry.js +1 -1
  148. package/dist/esm/bcm-avatar_2.entry.js +3 -3
  149. package/dist/esm/bcm-breadcrumb.entry.js +1 -1
  150. package/dist/esm/bcm-button-group.entry.js +1 -1
  151. package/dist/esm/bcm-button_7.entry.js +4 -4
  152. package/dist/esm/bcm-card.entry.js +1 -1
  153. package/dist/esm/bcm-checkbox-lite_9.entry.js +1 -1
  154. package/dist/esm/bcm-chip.entry.js +1 -1
  155. package/dist/esm/bcm-collapse.entry.js +1 -1
  156. package/dist/esm/bcm-color-input.entry.js +3 -3
  157. package/dist/esm/bcm-colorful_2.entry.js +5 -534
  158. package/dist/esm/bcm-date-picker.entry.js +1 -1
  159. package/dist/esm/bcm-datetime-picker.entry.js +1 -1
  160. package/dist/esm/bcm-default.entry.js +1 -1
  161. package/dist/esm/bcm-drawer.entry.js +3 -3
  162. package/dist/esm/bcm-dropdown.entry.js +2 -2
  163. package/dist/esm/bcm-expansion-panel.entry.js +1 -1
  164. package/dist/esm/bcm-form-2.entry.js +1 -1
  165. package/dist/esm/bcm-input-custom.entry.js +1 -1
  166. package/dist/esm/bcm-input.entry.js +4 -4
  167. package/dist/esm/bcm-item.entry.js +1 -1
  168. package/dist/esm/bcm-items.entry.js +1 -1
  169. package/dist/esm/bcm-list.entry.js +140 -328
  170. package/dist/esm/bcm-menu.entry.js +4 -4
  171. package/dist/esm/bcm-modal-2-footer.entry.js +3 -3
  172. package/dist/esm/bcm-modal-2-header.entry.js +3 -3
  173. package/dist/esm/bcm-modal-2.entry.js +3 -3
  174. package/dist/esm/bcm-modal.entry.js +1 -1
  175. package/dist/esm/bcm-popconfirm-box.entry.js +1 -1
  176. package/dist/esm/bcm-popconfirm.entry.js +1 -1
  177. package/dist/esm/bcm-popover.entry.js +3 -3
  178. package/dist/esm/bcm-progress.entry.js +1 -1
  179. package/dist/esm/bcm-radio-group.entry.js +3 -3
  180. package/dist/esm/bcm-radio.entry.js +3 -3
  181. package/dist/esm/bcm-range.entry.js +1 -1
  182. package/dist/esm/bcm-rc-overflow_2.entry.js +2438 -0
  183. package/dist/esm/bcm-skeleton.entry.js +1 -1
  184. package/dist/esm/bcm-step.entry.js +2 -2
  185. package/dist/esm/bcm-stepper.entry.js +4 -4
  186. package/dist/esm/bcm-switch.entry.js +1 -1
  187. package/dist/esm/bcm-tab-group.entry.js +3 -3
  188. package/dist/esm/bcm-tab-item-header.entry.js +3 -3
  189. package/dist/esm/bcm-tab-item.entry.js +3 -3
  190. package/dist/esm/bcm-tag.entry.js +2 -2
  191. package/dist/esm/bcm-textarea.entry.js +2 -2
  192. package/dist/esm/bcm-time-picker.entry.js +1 -1
  193. package/dist/esm/bcm-toast.entry.js +1 -1
  194. package/dist/esm/bromcom-ui.js +1 -1
  195. package/dist/esm/{generate-de5e04cf.js → generate-5684c743.js} +1 -1
  196. package/dist/esm/index-6310a048.js +537 -0
  197. package/dist/esm/{input-template-c5338e25.js → input-template-846cd4f3.js} +1 -1
  198. package/dist/esm/{json-parse-decarator-a417723b.js → json-parse-decarator-5cdef266.js} +1 -1
  199. package/dist/esm/loader.js +1 -1
  200. package/dist/esm/{number-helper-8de373ee.js → number-helper-3c971b4e.js} +1 -1
  201. package/dist/esm/old-bcm-popover-box.entry.js +2 -2
  202. package/dist/esm/old-bcm-popover.entry.js +1 -1
  203. package/dist/esm/{stepper-states-64ffef36.js → stepper-states-2f1dd0bd.js} +1 -1
  204. package/dist/esm/{tooltip-helper-096296d0.js → tooltip-helper-86b9b16e.js} +3 -3
  205. package/dist/esm/{validators-c8be2c83.js → validators-d6dd6432.js} +1 -1
  206. package/dist/types/components/organism/list/list.d.ts +9 -5
  207. package/dist/types/components/third-parts/rc-overflow/rc-overflow.d.ts +17 -0
  208. package/dist/types/components.d.ts +26 -0
  209. package/package.json +2 -1
  210. package/dist/bromcom-ui/p-2677dc60.entry.js +0 -10
  211. package/dist/bromcom-ui/p-6a842eb1.js +0 -5
  212. package/dist/bromcom-ui/p-a8b7d3cf.entry.js +0 -5
  213. package/dist/bromcom-ui/p-c0e58db2.entry.js +0 -5
  214. package/dist/bromcom-ui/p-efee3d33.entry.js +0 -5
  215. package/dist/cjs/bcm-search.cjs.entry.js +0 -245
  216. package/dist/collection/components/organism/list/list-tag-control.js +0 -173
  217. package/dist/esm/bcm-search.entry.js +0 -241
  218. package/dist/types/components/organism/list/list-tag-control.d.ts +0 -18
  219. /package/dist/collection/components/{molecules → third-parts}/colorful/colorful.js +0 -0
  220. /package/dist/types/components/{molecules → third-parts}/colorful/colorful.d.ts +0 -0
@@ -0,0 +1,2438 @@
1
+ /*!
2
+ * Built with Stencil
3
+ * Copyright (c) Bromcom.
4
+ */
5
+ import { r as registerInstance, c as createEvent, g as getElement, h as h$1, H as Host } from './index-39133086.js';
6
+ import './color-helper-e8ce23d7.js';
7
+ import './datetime-helper-df25808a.js';
8
+ import { G as Generate, s as snq } from './generate-5684c743.js';
9
+ import './number-helper-3c971b4e.js';
10
+ import { S as StringHelper } from './string-helper-6bd24967.js';
11
+ import './validators-d6dd6432.js';
12
+ import './element-dragger-89bb52fd.js';
13
+ import { B as Bcm } from './bcm-9f50af9c.js';
14
+ import { r as react, a as reactDom } from './index-6310a048.js';
15
+ import { c as classnames } from './index-ed9652af.js';
16
+ import { c as createCommonjsModule } from './_commonjsHelpers-3016b722.js';
17
+ import { I as InputTemplate } from './input-template-846cd4f3.js';
18
+ import { d as delay } from './utils-57652744.js';
19
+ import { c as createStore } from './index-93e36fdb.js';
20
+ import './colors-1d7854ea.js';
21
+ import './colors-44c95e7e.js';
22
+ import './types-6f06fa1a.js';
23
+
24
+ function _extends$1() {
25
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
26
+ for (var i = 1; i < arguments.length; i++) {
27
+ var source = arguments[i];
28
+ for (var key in source) {
29
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
30
+ target[key] = source[key];
31
+ }
32
+ }
33
+ }
34
+ return target;
35
+ };
36
+ return _extends$1.apply(this, arguments);
37
+ }
38
+
39
+ function _typeof$2(obj) {
40
+ "@babel/helpers - typeof";
41
+
42
+ return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
43
+ return typeof obj;
44
+ } : function (obj) {
45
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
46
+ }, _typeof$2(obj);
47
+ }
48
+
49
+ function _toPrimitive$1(input, hint) {
50
+ if (_typeof$2(input) !== "object" || input === null) return input;
51
+ var prim = input[Symbol.toPrimitive];
52
+ if (prim !== undefined) {
53
+ var res = prim.call(input, hint || "default");
54
+ if (_typeof$2(res) !== "object") return res;
55
+ throw new TypeError("@@toPrimitive must return a primitive value.");
56
+ }
57
+ return (hint === "string" ? String : Number)(input);
58
+ }
59
+
60
+ function _toPropertyKey$1(arg) {
61
+ var key = _toPrimitive$1(arg, "string");
62
+ return _typeof$2(key) === "symbol" ? key : String(key);
63
+ }
64
+
65
+ function _defineProperty$1(obj, key, value) {
66
+ key = _toPropertyKey$1(key);
67
+ if (key in obj) {
68
+ Object.defineProperty(obj, key, {
69
+ value: value,
70
+ enumerable: true,
71
+ configurable: true,
72
+ writable: true
73
+ });
74
+ } else {
75
+ obj[key] = value;
76
+ }
77
+ return obj;
78
+ }
79
+
80
+ function ownKeys$1(object, enumerableOnly) {
81
+ var keys = Object.keys(object);
82
+ if (Object.getOwnPropertySymbols) {
83
+ var symbols = Object.getOwnPropertySymbols(object);
84
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
85
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
86
+ })), keys.push.apply(keys, symbols);
87
+ }
88
+ return keys;
89
+ }
90
+ function _objectSpread2$1(target) {
91
+ for (var i = 1; i < arguments.length; i++) {
92
+ var source = null != arguments[i] ? arguments[i] : {};
93
+ i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
94
+ _defineProperty$1(target, key, source[key]);
95
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
96
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
97
+ });
98
+ }
99
+ return target;
100
+ }
101
+
102
+ function _arrayWithHoles(arr) {
103
+ if (Array.isArray(arr)) return arr;
104
+ }
105
+
106
+ function _iterableToArrayLimit(arr, i) {
107
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
108
+ if (null != _i) {
109
+ var _s,
110
+ _e,
111
+ _x,
112
+ _r,
113
+ _arr = [],
114
+ _n = !0,
115
+ _d = !1;
116
+ try {
117
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
118
+ if (Object(_i) !== _i) return;
119
+ _n = !1;
120
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
121
+ } catch (err) {
122
+ _d = !0, _e = err;
123
+ } finally {
124
+ try {
125
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
126
+ } finally {
127
+ if (_d) throw _e;
128
+ }
129
+ }
130
+ return _arr;
131
+ }
132
+ }
133
+
134
+ function _arrayLikeToArray(arr, len) {
135
+ if (len == null || len > arr.length) len = arr.length;
136
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
137
+ return arr2;
138
+ }
139
+
140
+ function _unsupportedIterableToArray(o, minLen) {
141
+ if (!o) return;
142
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
143
+ var n = Object.prototype.toString.call(o).slice(8, -1);
144
+ if (n === "Object" && o.constructor) n = o.constructor.name;
145
+ if (n === "Map" || n === "Set") return Array.from(o);
146
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
147
+ }
148
+
149
+ function _nonIterableRest() {
150
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
151
+ }
152
+
153
+ function _slicedToArray(arr, i) {
154
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
155
+ }
156
+
157
+ function _objectWithoutPropertiesLoose(source, excluded) {
158
+ if (source == null) return {};
159
+ var target = {};
160
+ var sourceKeys = Object.keys(source);
161
+ var key, i;
162
+ for (i = 0; i < sourceKeys.length; i++) {
163
+ key = sourceKeys[i];
164
+ if (excluded.indexOf(key) >= 0) continue;
165
+ target[key] = source[key];
166
+ }
167
+ return target;
168
+ }
169
+
170
+ function _objectWithoutProperties(source, excluded) {
171
+ if (source == null) return {};
172
+ var target = _objectWithoutPropertiesLoose(source, excluded);
173
+ var key, i;
174
+ if (Object.getOwnPropertySymbols) {
175
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
176
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
177
+ key = sourceSymbolKeys[i];
178
+ if (excluded.indexOf(key) >= 0) continue;
179
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
180
+ target[key] = source[key];
181
+ }
182
+ }
183
+ return target;
184
+ }
185
+
186
+ function _extends() {
187
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
188
+ for (var i = 1; i < arguments.length; i++) {
189
+ var source = arguments[i];
190
+ for (var key in source) {
191
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
192
+ target[key] = source[key];
193
+ }
194
+ }
195
+ }
196
+ return target;
197
+ };
198
+ return _extends.apply(this, arguments);
199
+ }
200
+
201
+ /** @license React v16.13.1
202
+ * react-is.production.min.js
203
+ *
204
+ * Copyright (c) Facebook, Inc. and its affiliates.
205
+ *
206
+ * This source code is licensed under the MIT license found in the
207
+ * LICENSE file in the root directory of this source tree.
208
+ */
209
+ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
210
+ Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
211
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element$1=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
212
+ var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
213
+ var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
214
+ var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
215
+
216
+ var reactIs_production_min = {
217
+ AsyncMode: AsyncMode,
218
+ ConcurrentMode: ConcurrentMode,
219
+ ContextConsumer: ContextConsumer,
220
+ ContextProvider: ContextProvider,
221
+ Element: Element$1,
222
+ ForwardRef: ForwardRef,
223
+ Fragment: Fragment,
224
+ Lazy: Lazy,
225
+ Memo: Memo,
226
+ Portal: Portal,
227
+ Profiler: Profiler,
228
+ StrictMode: StrictMode,
229
+ Suspense: Suspense,
230
+ isAsyncMode: isAsyncMode,
231
+ isConcurrentMode: isConcurrentMode,
232
+ isContextConsumer: isContextConsumer,
233
+ isContextProvider: isContextProvider,
234
+ isElement: isElement,
235
+ isForwardRef: isForwardRef,
236
+ isFragment: isFragment,
237
+ isLazy: isLazy,
238
+ isMemo: isMemo,
239
+ isPortal: isPortal,
240
+ isProfiler: isProfiler,
241
+ isStrictMode: isStrictMode,
242
+ isSuspense: isSuspense,
243
+ isValidElementType: isValidElementType,
244
+ typeOf: typeOf
245
+ };
246
+
247
+ createCommonjsModule(function (module, exports) {
248
+ });
249
+
250
+ var reactIs = createCommonjsModule(function (module) {
251
+
252
+ {
253
+ module.exports = reactIs_production_min;
254
+ }
255
+ });
256
+
257
+ function toArray(children) {
258
+ var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
259
+ var ret = [];
260
+ react.Children.forEach(children, function (child) {
261
+ if ((child === undefined || child === null) && !option.keepEmpty) {
262
+ return;
263
+ }
264
+ if (Array.isArray(child)) {
265
+ ret = ret.concat(toArray(child));
266
+ } else if (reactIs.isFragment(child) && child.props) {
267
+ ret = ret.concat(toArray(child.props.children, option));
268
+ } else {
269
+ ret.push(child);
270
+ }
271
+ });
272
+ return ret;
273
+ }
274
+
275
+ function _typeof$1(obj) {
276
+ "@babel/helpers - typeof";
277
+
278
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
279
+ return typeof obj;
280
+ } : function (obj) {
281
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
282
+ }, _typeof$1(obj);
283
+ }
284
+
285
+ function _toPrimitive(input, hint) {
286
+ if (_typeof$1(input) !== "object" || input === null) return input;
287
+ var prim = input[Symbol.toPrimitive];
288
+ if (prim !== undefined) {
289
+ var res = prim.call(input, hint || "default");
290
+ if (_typeof$1(res) !== "object") return res;
291
+ throw new TypeError("@@toPrimitive must return a primitive value.");
292
+ }
293
+ return (hint === "string" ? String : Number)(input);
294
+ }
295
+
296
+ function _toPropertyKey(arg) {
297
+ var key = _toPrimitive(arg, "string");
298
+ return _typeof$1(key) === "symbol" ? key : String(key);
299
+ }
300
+
301
+ function _defineProperty(obj, key, value) {
302
+ key = _toPropertyKey(key);
303
+ if (key in obj) {
304
+ Object.defineProperty(obj, key, {
305
+ value: value,
306
+ enumerable: true,
307
+ configurable: true,
308
+ writable: true
309
+ });
310
+ } else {
311
+ obj[key] = value;
312
+ }
313
+ return obj;
314
+ }
315
+
316
+ function ownKeys(object, enumerableOnly) {
317
+ var keys = Object.keys(object);
318
+ if (Object.getOwnPropertySymbols) {
319
+ var symbols = Object.getOwnPropertySymbols(object);
320
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
321
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
322
+ })), keys.push.apply(keys, symbols);
323
+ }
324
+ return keys;
325
+ }
326
+ function _objectSpread2(target) {
327
+ for (var i = 1; i < arguments.length; i++) {
328
+ var source = null != arguments[i] ? arguments[i] : {};
329
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
330
+ _defineProperty(target, key, source[key]);
331
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
332
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
333
+ });
334
+ }
335
+ return target;
336
+ }
337
+
338
+ function _typeof(obj) {
339
+ "@babel/helpers - typeof";
340
+
341
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
342
+ return typeof obj;
343
+ } : function (obj) {
344
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
345
+ }, _typeof(obj);
346
+ }
347
+
348
+ function fillRef(ref, node) {
349
+ if (typeof ref === 'function') {
350
+ ref(node);
351
+ } else if (_typeof(ref) === 'object' && ref && 'current' in ref) {
352
+ ref.current = node;
353
+ }
354
+ }
355
+
356
+ /**
357
+ * Merge refs into one ref function to support ref passing.
358
+ */
359
+ function composeRef() {
360
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
361
+ refs[_key] = arguments[_key];
362
+ }
363
+ var refList = refs.filter(function (ref) {
364
+ return ref;
365
+ });
366
+ if (refList.length <= 1) {
367
+ return refList[0];
368
+ }
369
+ return function (node) {
370
+ refs.forEach(function (ref) {
371
+ fillRef(ref, node);
372
+ });
373
+ };
374
+ }
375
+ function supportRef(nodeOrComponent) {
376
+ var _type$prototype, _nodeOrComponent$prot;
377
+ var type = reactIs.isMemo(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;
378
+
379
+ // Function component node
380
+ if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render)) {
381
+ return false;
382
+ }
383
+
384
+ // Class component
385
+ if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render)) {
386
+ return false;
387
+ }
388
+ return true;
389
+ }
390
+ /* eslint-enable */
391
+
392
+ function isDOM(node) {
393
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element
394
+ // Since XULElement is also subclass of Element, we only need HTMLElement and SVGElement
395
+ return node instanceof HTMLElement || node instanceof SVGElement;
396
+ }
397
+
398
+ /**
399
+ * Return if a node is a DOM node. Else will return by `findDOMNode`
400
+ */
401
+ function findDOMNode(node) {
402
+ if (isDOM(node)) {
403
+ return node;
404
+ }
405
+ if (node instanceof react.Component) {
406
+ return reactDom.findDOMNode(node);
407
+ }
408
+ return null;
409
+ }
410
+
411
+ /**
412
+ * A collection of shims that provide minimal functionality of the ES6 collections.
413
+ *
414
+ * These implementations are not meant to be used outside of the ResizeObserver
415
+ * modules as they cover only a limited range of use cases.
416
+ */
417
+ /* eslint-disable require-jsdoc, valid-jsdoc */
418
+ var MapShim = (function () {
419
+ if (typeof Map !== 'undefined') {
420
+ return Map;
421
+ }
422
+ /**
423
+ * Returns index in provided array that matches the specified key.
424
+ *
425
+ * @param {Array<Array>} arr
426
+ * @param {*} key
427
+ * @returns {number}
428
+ */
429
+ function getIndex(arr, key) {
430
+ var result = -1;
431
+ arr.some(function (entry, index) {
432
+ if (entry[0] === key) {
433
+ result = index;
434
+ return true;
435
+ }
436
+ return false;
437
+ });
438
+ return result;
439
+ }
440
+ return /** @class */ (function () {
441
+ function class_1() {
442
+ this.__entries__ = [];
443
+ }
444
+ Object.defineProperty(class_1.prototype, "size", {
445
+ /**
446
+ * @returns {boolean}
447
+ */
448
+ get: function () {
449
+ return this.__entries__.length;
450
+ },
451
+ enumerable: true,
452
+ configurable: true
453
+ });
454
+ /**
455
+ * @param {*} key
456
+ * @returns {*}
457
+ */
458
+ class_1.prototype.get = function (key) {
459
+ var index = getIndex(this.__entries__, key);
460
+ var entry = this.__entries__[index];
461
+ return entry && entry[1];
462
+ };
463
+ /**
464
+ * @param {*} key
465
+ * @param {*} value
466
+ * @returns {void}
467
+ */
468
+ class_1.prototype.set = function (key, value) {
469
+ var index = getIndex(this.__entries__, key);
470
+ if (~index) {
471
+ this.__entries__[index][1] = value;
472
+ }
473
+ else {
474
+ this.__entries__.push([key, value]);
475
+ }
476
+ };
477
+ /**
478
+ * @param {*} key
479
+ * @returns {void}
480
+ */
481
+ class_1.prototype.delete = function (key) {
482
+ var entries = this.__entries__;
483
+ var index = getIndex(entries, key);
484
+ if (~index) {
485
+ entries.splice(index, 1);
486
+ }
487
+ };
488
+ /**
489
+ * @param {*} key
490
+ * @returns {void}
491
+ */
492
+ class_1.prototype.has = function (key) {
493
+ return !!~getIndex(this.__entries__, key);
494
+ };
495
+ /**
496
+ * @returns {void}
497
+ */
498
+ class_1.prototype.clear = function () {
499
+ this.__entries__.splice(0);
500
+ };
501
+ /**
502
+ * @param {Function} callback
503
+ * @param {*} [ctx=null]
504
+ * @returns {void}
505
+ */
506
+ class_1.prototype.forEach = function (callback, ctx) {
507
+ if (ctx === void 0) { ctx = null; }
508
+ for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
509
+ var entry = _a[_i];
510
+ callback.call(ctx, entry[1], entry[0]);
511
+ }
512
+ };
513
+ return class_1;
514
+ }());
515
+ })();
516
+
517
+ /**
518
+ * Detects whether window and document objects are available in current environment.
519
+ */
520
+ var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
521
+
522
+ // Returns global object of a current environment.
523
+ var global$1 = (function () {
524
+ if (typeof global !== 'undefined' && global.Math === Math) {
525
+ return global;
526
+ }
527
+ if (typeof self !== 'undefined' && self.Math === Math) {
528
+ return self;
529
+ }
530
+ if (typeof window !== 'undefined' && window.Math === Math) {
531
+ return window;
532
+ }
533
+ // eslint-disable-next-line no-new-func
534
+ return Function('return this')();
535
+ })();
536
+
537
+ /**
538
+ * A shim for the requestAnimationFrame which falls back to the setTimeout if
539
+ * first one is not supported.
540
+ *
541
+ * @returns {number} Requests' identifier.
542
+ */
543
+ var requestAnimationFrame$1 = (function () {
544
+ if (typeof requestAnimationFrame === 'function') {
545
+ // It's required to use a bounded function because IE sometimes throws
546
+ // an "Invalid calling object" error if rAF is invoked without the global
547
+ // object on the left hand side.
548
+ return requestAnimationFrame.bind(global$1);
549
+ }
550
+ return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
551
+ })();
552
+
553
+ // Defines minimum timeout before adding a trailing call.
554
+ var trailingTimeout = 2;
555
+ /**
556
+ * Creates a wrapper function which ensures that provided callback will be
557
+ * invoked only once during the specified delay period.
558
+ *
559
+ * @param {Function} callback - Function to be invoked after the delay period.
560
+ * @param {number} delay - Delay after which to invoke callback.
561
+ * @returns {Function}
562
+ */
563
+ function throttle (callback, delay) {
564
+ var leadingCall = false, trailingCall = false, lastCallTime = 0;
565
+ /**
566
+ * Invokes the original callback function and schedules new invocation if
567
+ * the "proxy" was called during current request.
568
+ *
569
+ * @returns {void}
570
+ */
571
+ function resolvePending() {
572
+ if (leadingCall) {
573
+ leadingCall = false;
574
+ callback();
575
+ }
576
+ if (trailingCall) {
577
+ proxy();
578
+ }
579
+ }
580
+ /**
581
+ * Callback invoked after the specified delay. It will further postpone
582
+ * invocation of the original function delegating it to the
583
+ * requestAnimationFrame.
584
+ *
585
+ * @returns {void}
586
+ */
587
+ function timeoutCallback() {
588
+ requestAnimationFrame$1(resolvePending);
589
+ }
590
+ /**
591
+ * Schedules invocation of the original function.
592
+ *
593
+ * @returns {void}
594
+ */
595
+ function proxy() {
596
+ var timeStamp = Date.now();
597
+ if (leadingCall) {
598
+ // Reject immediately following calls.
599
+ if (timeStamp - lastCallTime < trailingTimeout) {
600
+ return;
601
+ }
602
+ // Schedule new call to be in invoked when the pending one is resolved.
603
+ // This is important for "transitions" which never actually start
604
+ // immediately so there is a chance that we might miss one if change
605
+ // happens amids the pending invocation.
606
+ trailingCall = true;
607
+ }
608
+ else {
609
+ leadingCall = true;
610
+ trailingCall = false;
611
+ setTimeout(timeoutCallback, delay);
612
+ }
613
+ lastCallTime = timeStamp;
614
+ }
615
+ return proxy;
616
+ }
617
+
618
+ // Minimum delay before invoking the update of observers.
619
+ var REFRESH_DELAY = 20;
620
+ // A list of substrings of CSS properties used to find transition events that
621
+ // might affect dimensions of observed elements.
622
+ var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
623
+ // Check if MutationObserver is available.
624
+ var mutationObserverSupported = typeof MutationObserver !== 'undefined';
625
+ /**
626
+ * Singleton controller class which handles updates of ResizeObserver instances.
627
+ */
628
+ var ResizeObserverController = /** @class */ (function () {
629
+ /**
630
+ * Creates a new instance of ResizeObserverController.
631
+ *
632
+ * @private
633
+ */
634
+ function ResizeObserverController() {
635
+ /**
636
+ * Indicates whether DOM listeners have been added.
637
+ *
638
+ * @private {boolean}
639
+ */
640
+ this.connected_ = false;
641
+ /**
642
+ * Tells that controller has subscribed for Mutation Events.
643
+ *
644
+ * @private {boolean}
645
+ */
646
+ this.mutationEventsAdded_ = false;
647
+ /**
648
+ * Keeps reference to the instance of MutationObserver.
649
+ *
650
+ * @private {MutationObserver}
651
+ */
652
+ this.mutationsObserver_ = null;
653
+ /**
654
+ * A list of connected observers.
655
+ *
656
+ * @private {Array<ResizeObserverSPI>}
657
+ */
658
+ this.observers_ = [];
659
+ this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
660
+ this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
661
+ }
662
+ /**
663
+ * Adds observer to observers list.
664
+ *
665
+ * @param {ResizeObserverSPI} observer - Observer to be added.
666
+ * @returns {void}
667
+ */
668
+ ResizeObserverController.prototype.addObserver = function (observer) {
669
+ if (!~this.observers_.indexOf(observer)) {
670
+ this.observers_.push(observer);
671
+ }
672
+ // Add listeners if they haven't been added yet.
673
+ if (!this.connected_) {
674
+ this.connect_();
675
+ }
676
+ };
677
+ /**
678
+ * Removes observer from observers list.
679
+ *
680
+ * @param {ResizeObserverSPI} observer - Observer to be removed.
681
+ * @returns {void}
682
+ */
683
+ ResizeObserverController.prototype.removeObserver = function (observer) {
684
+ var observers = this.observers_;
685
+ var index = observers.indexOf(observer);
686
+ // Remove observer if it's present in registry.
687
+ if (~index) {
688
+ observers.splice(index, 1);
689
+ }
690
+ // Remove listeners if controller has no connected observers.
691
+ if (!observers.length && this.connected_) {
692
+ this.disconnect_();
693
+ }
694
+ };
695
+ /**
696
+ * Invokes the update of observers. It will continue running updates insofar
697
+ * it detects changes.
698
+ *
699
+ * @returns {void}
700
+ */
701
+ ResizeObserverController.prototype.refresh = function () {
702
+ var changesDetected = this.updateObservers_();
703
+ // Continue running updates if changes have been detected as there might
704
+ // be future ones caused by CSS transitions.
705
+ if (changesDetected) {
706
+ this.refresh();
707
+ }
708
+ };
709
+ /**
710
+ * Updates every observer from observers list and notifies them of queued
711
+ * entries.
712
+ *
713
+ * @private
714
+ * @returns {boolean} Returns "true" if any observer has detected changes in
715
+ * dimensions of it's elements.
716
+ */
717
+ ResizeObserverController.prototype.updateObservers_ = function () {
718
+ // Collect observers that have active observations.
719
+ var activeObservers = this.observers_.filter(function (observer) {
720
+ return observer.gatherActive(), observer.hasActive();
721
+ });
722
+ // Deliver notifications in a separate cycle in order to avoid any
723
+ // collisions between observers, e.g. when multiple instances of
724
+ // ResizeObserver are tracking the same element and the callback of one
725
+ // of them changes content dimensions of the observed target. Sometimes
726
+ // this may result in notifications being blocked for the rest of observers.
727
+ activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
728
+ return activeObservers.length > 0;
729
+ };
730
+ /**
731
+ * Initializes DOM listeners.
732
+ *
733
+ * @private
734
+ * @returns {void}
735
+ */
736
+ ResizeObserverController.prototype.connect_ = function () {
737
+ // Do nothing if running in a non-browser environment or if listeners
738
+ // have been already added.
739
+ if (!isBrowser || this.connected_) {
740
+ return;
741
+ }
742
+ // Subscription to the "Transitionend" event is used as a workaround for
743
+ // delayed transitions. This way it's possible to capture at least the
744
+ // final state of an element.
745
+ document.addEventListener('transitionend', this.onTransitionEnd_);
746
+ window.addEventListener('resize', this.refresh);
747
+ if (mutationObserverSupported) {
748
+ this.mutationsObserver_ = new MutationObserver(this.refresh);
749
+ this.mutationsObserver_.observe(document, {
750
+ attributes: true,
751
+ childList: true,
752
+ characterData: true,
753
+ subtree: true
754
+ });
755
+ }
756
+ else {
757
+ document.addEventListener('DOMSubtreeModified', this.refresh);
758
+ this.mutationEventsAdded_ = true;
759
+ }
760
+ this.connected_ = true;
761
+ };
762
+ /**
763
+ * Removes DOM listeners.
764
+ *
765
+ * @private
766
+ * @returns {void}
767
+ */
768
+ ResizeObserverController.prototype.disconnect_ = function () {
769
+ // Do nothing if running in a non-browser environment or if listeners
770
+ // have been already removed.
771
+ if (!isBrowser || !this.connected_) {
772
+ return;
773
+ }
774
+ document.removeEventListener('transitionend', this.onTransitionEnd_);
775
+ window.removeEventListener('resize', this.refresh);
776
+ if (this.mutationsObserver_) {
777
+ this.mutationsObserver_.disconnect();
778
+ }
779
+ if (this.mutationEventsAdded_) {
780
+ document.removeEventListener('DOMSubtreeModified', this.refresh);
781
+ }
782
+ this.mutationsObserver_ = null;
783
+ this.mutationEventsAdded_ = false;
784
+ this.connected_ = false;
785
+ };
786
+ /**
787
+ * "Transitionend" event handler.
788
+ *
789
+ * @private
790
+ * @param {TransitionEvent} event
791
+ * @returns {void}
792
+ */
793
+ ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {
794
+ var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;
795
+ // Detect whether transition may affect dimensions of an element.
796
+ var isReflowProperty = transitionKeys.some(function (key) {
797
+ return !!~propertyName.indexOf(key);
798
+ });
799
+ if (isReflowProperty) {
800
+ this.refresh();
801
+ }
802
+ };
803
+ /**
804
+ * Returns instance of the ResizeObserverController.
805
+ *
806
+ * @returns {ResizeObserverController}
807
+ */
808
+ ResizeObserverController.getInstance = function () {
809
+ if (!this.instance_) {
810
+ this.instance_ = new ResizeObserverController();
811
+ }
812
+ return this.instance_;
813
+ };
814
+ /**
815
+ * Holds reference to the controller's instance.
816
+ *
817
+ * @private {ResizeObserverController}
818
+ */
819
+ ResizeObserverController.instance_ = null;
820
+ return ResizeObserverController;
821
+ }());
822
+
823
+ /**
824
+ * Defines non-writable/enumerable properties of the provided target object.
825
+ *
826
+ * @param {Object} target - Object for which to define properties.
827
+ * @param {Object} props - Properties to be defined.
828
+ * @returns {Object} Target object.
829
+ */
830
+ var defineConfigurable = (function (target, props) {
831
+ for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
832
+ var key = _a[_i];
833
+ Object.defineProperty(target, key, {
834
+ value: props[key],
835
+ enumerable: false,
836
+ writable: false,
837
+ configurable: true
838
+ });
839
+ }
840
+ return target;
841
+ });
842
+
843
+ /**
844
+ * Returns the global object associated with provided element.
845
+ *
846
+ * @param {Object} target
847
+ * @returns {Object}
848
+ */
849
+ var getWindowOf = (function (target) {
850
+ // Assume that the element is an instance of Node, which means that it
851
+ // has the "ownerDocument" property from which we can retrieve a
852
+ // corresponding global object.
853
+ var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
854
+ // Return the local global object if it's not possible extract one from
855
+ // provided element.
856
+ return ownerGlobal || global$1;
857
+ });
858
+
859
+ // Placeholder of an empty content rectangle.
860
+ var emptyRect = createRectInit(0, 0, 0, 0);
861
+ /**
862
+ * Converts provided string to a number.
863
+ *
864
+ * @param {number|string} value
865
+ * @returns {number}
866
+ */
867
+ function toFloat(value) {
868
+ return parseFloat(value) || 0;
869
+ }
870
+ /**
871
+ * Extracts borders size from provided styles.
872
+ *
873
+ * @param {CSSStyleDeclaration} styles
874
+ * @param {...string} positions - Borders positions (top, right, ...)
875
+ * @returns {number}
876
+ */
877
+ function getBordersSize(styles) {
878
+ var positions = [];
879
+ for (var _i = 1; _i < arguments.length; _i++) {
880
+ positions[_i - 1] = arguments[_i];
881
+ }
882
+ return positions.reduce(function (size, position) {
883
+ var value = styles['border-' + position + '-width'];
884
+ return size + toFloat(value);
885
+ }, 0);
886
+ }
887
+ /**
888
+ * Extracts paddings sizes from provided styles.
889
+ *
890
+ * @param {CSSStyleDeclaration} styles
891
+ * @returns {Object} Paddings box.
892
+ */
893
+ function getPaddings(styles) {
894
+ var positions = ['top', 'right', 'bottom', 'left'];
895
+ var paddings = {};
896
+ for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
897
+ var position = positions_1[_i];
898
+ var value = styles['padding-' + position];
899
+ paddings[position] = toFloat(value);
900
+ }
901
+ return paddings;
902
+ }
903
+ /**
904
+ * Calculates content rectangle of provided SVG element.
905
+ *
906
+ * @param {SVGGraphicsElement} target - Element content rectangle of which needs
907
+ * to be calculated.
908
+ * @returns {DOMRectInit}
909
+ */
910
+ function getSVGContentRect(target) {
911
+ var bbox = target.getBBox();
912
+ return createRectInit(0, 0, bbox.width, bbox.height);
913
+ }
914
+ /**
915
+ * Calculates content rectangle of provided HTMLElement.
916
+ *
917
+ * @param {HTMLElement} target - Element for which to calculate the content rectangle.
918
+ * @returns {DOMRectInit}
919
+ */
920
+ function getHTMLElementContentRect(target) {
921
+ // Client width & height properties can't be
922
+ // used exclusively as they provide rounded values.
923
+ var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
924
+ // By this condition we can catch all non-replaced inline, hidden and
925
+ // detached elements. Though elements with width & height properties less
926
+ // than 0.5 will be discarded as well.
927
+ //
928
+ // Without it we would need to implement separate methods for each of
929
+ // those cases and it's not possible to perform a precise and performance
930
+ // effective test for hidden elements. E.g. even jQuery's ':visible' filter
931
+ // gives wrong results for elements with width & height less than 0.5.
932
+ if (!clientWidth && !clientHeight) {
933
+ return emptyRect;
934
+ }
935
+ var styles = getWindowOf(target).getComputedStyle(target);
936
+ var paddings = getPaddings(styles);
937
+ var horizPad = paddings.left + paddings.right;
938
+ var vertPad = paddings.top + paddings.bottom;
939
+ // Computed styles of width & height are being used because they are the
940
+ // only dimensions available to JS that contain non-rounded values. It could
941
+ // be possible to utilize the getBoundingClientRect if only it's data wasn't
942
+ // affected by CSS transformations let alone paddings, borders and scroll bars.
943
+ var width = toFloat(styles.width), height = toFloat(styles.height);
944
+ // Width & height include paddings and borders when the 'border-box' box
945
+ // model is applied (except for IE).
946
+ if (styles.boxSizing === 'border-box') {
947
+ // Following conditions are required to handle Internet Explorer which
948
+ // doesn't include paddings and borders to computed CSS dimensions.
949
+ //
950
+ // We can say that if CSS dimensions + paddings are equal to the "client"
951
+ // properties then it's either IE, and thus we don't need to subtract
952
+ // anything, or an element merely doesn't have paddings/borders styles.
953
+ if (Math.round(width + horizPad) !== clientWidth) {
954
+ width -= getBordersSize(styles, 'left', 'right') + horizPad;
955
+ }
956
+ if (Math.round(height + vertPad) !== clientHeight) {
957
+ height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
958
+ }
959
+ }
960
+ // Following steps can't be applied to the document's root element as its
961
+ // client[Width/Height] properties represent viewport area of the window.
962
+ // Besides, it's as well not necessary as the <html> itself neither has
963
+ // rendered scroll bars nor it can be clipped.
964
+ if (!isDocumentElement(target)) {
965
+ // In some browsers (only in Firefox, actually) CSS width & height
966
+ // include scroll bars size which can be removed at this step as scroll
967
+ // bars are the only difference between rounded dimensions + paddings
968
+ // and "client" properties, though that is not always true in Chrome.
969
+ var vertScrollbar = Math.round(width + horizPad) - clientWidth;
970
+ var horizScrollbar = Math.round(height + vertPad) - clientHeight;
971
+ // Chrome has a rather weird rounding of "client" properties.
972
+ // E.g. for an element with content width of 314.2px it sometimes gives
973
+ // the client width of 315px and for the width of 314.7px it may give
974
+ // 314px. And it doesn't happen all the time. So just ignore this delta
975
+ // as a non-relevant.
976
+ if (Math.abs(vertScrollbar) !== 1) {
977
+ width -= vertScrollbar;
978
+ }
979
+ if (Math.abs(horizScrollbar) !== 1) {
980
+ height -= horizScrollbar;
981
+ }
982
+ }
983
+ return createRectInit(paddings.left, paddings.top, width, height);
984
+ }
985
+ /**
986
+ * Checks whether provided element is an instance of the SVGGraphicsElement.
987
+ *
988
+ * @param {Element} target - Element to be checked.
989
+ * @returns {boolean}
990
+ */
991
+ var isSVGGraphicsElement = (function () {
992
+ // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement
993
+ // interface.
994
+ if (typeof SVGGraphicsElement !== 'undefined') {
995
+ return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
996
+ }
997
+ // If it's so, then check that element is at least an instance of the
998
+ // SVGElement and that it has the "getBBox" method.
999
+ // eslint-disable-next-line no-extra-parens
1000
+ return function (target) { return (target instanceof getWindowOf(target).SVGElement &&
1001
+ typeof target.getBBox === 'function'); };
1002
+ })();
1003
+ /**
1004
+ * Checks whether provided element is a document element (<html>).
1005
+ *
1006
+ * @param {Element} target - Element to be checked.
1007
+ * @returns {boolean}
1008
+ */
1009
+ function isDocumentElement(target) {
1010
+ return target === getWindowOf(target).document.documentElement;
1011
+ }
1012
+ /**
1013
+ * Calculates an appropriate content rectangle for provided html or svg element.
1014
+ *
1015
+ * @param {Element} target - Element content rectangle of which needs to be calculated.
1016
+ * @returns {DOMRectInit}
1017
+ */
1018
+ function getContentRect(target) {
1019
+ if (!isBrowser) {
1020
+ return emptyRect;
1021
+ }
1022
+ if (isSVGGraphicsElement(target)) {
1023
+ return getSVGContentRect(target);
1024
+ }
1025
+ return getHTMLElementContentRect(target);
1026
+ }
1027
+ /**
1028
+ * Creates rectangle with an interface of the DOMRectReadOnly.
1029
+ * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly
1030
+ *
1031
+ * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.
1032
+ * @returns {DOMRectReadOnly}
1033
+ */
1034
+ function createReadOnlyRect(_a) {
1035
+ var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
1036
+ // If DOMRectReadOnly is available use it as a prototype for the rectangle.
1037
+ var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
1038
+ var rect = Object.create(Constr.prototype);
1039
+ // Rectangle's properties are not writable and non-enumerable.
1040
+ defineConfigurable(rect, {
1041
+ x: x, y: y, width: width, height: height,
1042
+ top: y,
1043
+ right: x + width,
1044
+ bottom: height + y,
1045
+ left: x
1046
+ });
1047
+ return rect;
1048
+ }
1049
+ /**
1050
+ * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.
1051
+ * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit
1052
+ *
1053
+ * @param {number} x - X coordinate.
1054
+ * @param {number} y - Y coordinate.
1055
+ * @param {number} width - Rectangle's width.
1056
+ * @param {number} height - Rectangle's height.
1057
+ * @returns {DOMRectInit}
1058
+ */
1059
+ function createRectInit(x, y, width, height) {
1060
+ return { x: x, y: y, width: width, height: height };
1061
+ }
1062
+
1063
+ /**
1064
+ * Class that is responsible for computations of the content rectangle of
1065
+ * provided DOM element and for keeping track of it's changes.
1066
+ */
1067
+ var ResizeObservation = /** @class */ (function () {
1068
+ /**
1069
+ * Creates an instance of ResizeObservation.
1070
+ *
1071
+ * @param {Element} target - Element to be observed.
1072
+ */
1073
+ function ResizeObservation(target) {
1074
+ /**
1075
+ * Broadcasted width of content rectangle.
1076
+ *
1077
+ * @type {number}
1078
+ */
1079
+ this.broadcastWidth = 0;
1080
+ /**
1081
+ * Broadcasted height of content rectangle.
1082
+ *
1083
+ * @type {number}
1084
+ */
1085
+ this.broadcastHeight = 0;
1086
+ /**
1087
+ * Reference to the last observed content rectangle.
1088
+ *
1089
+ * @private {DOMRectInit}
1090
+ */
1091
+ this.contentRect_ = createRectInit(0, 0, 0, 0);
1092
+ this.target = target;
1093
+ }
1094
+ /**
1095
+ * Updates content rectangle and tells whether it's width or height properties
1096
+ * have changed since the last broadcast.
1097
+ *
1098
+ * @returns {boolean}
1099
+ */
1100
+ ResizeObservation.prototype.isActive = function () {
1101
+ var rect = getContentRect(this.target);
1102
+ this.contentRect_ = rect;
1103
+ return (rect.width !== this.broadcastWidth ||
1104
+ rect.height !== this.broadcastHeight);
1105
+ };
1106
+ /**
1107
+ * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data
1108
+ * from the corresponding properties of the last observed content rectangle.
1109
+ *
1110
+ * @returns {DOMRectInit} Last observed content rectangle.
1111
+ */
1112
+ ResizeObservation.prototype.broadcastRect = function () {
1113
+ var rect = this.contentRect_;
1114
+ this.broadcastWidth = rect.width;
1115
+ this.broadcastHeight = rect.height;
1116
+ return rect;
1117
+ };
1118
+ return ResizeObservation;
1119
+ }());
1120
+
1121
+ var ResizeObserverEntry = /** @class */ (function () {
1122
+ /**
1123
+ * Creates an instance of ResizeObserverEntry.
1124
+ *
1125
+ * @param {Element} target - Element that is being observed.
1126
+ * @param {DOMRectInit} rectInit - Data of the element's content rectangle.
1127
+ */
1128
+ function ResizeObserverEntry(target, rectInit) {
1129
+ var contentRect = createReadOnlyRect(rectInit);
1130
+ // According to the specification following properties are not writable
1131
+ // and are also not enumerable in the native implementation.
1132
+ //
1133
+ // Property accessors are not being used as they'd require to define a
1134
+ // private WeakMap storage which may cause memory leaks in browsers that
1135
+ // don't support this type of collections.
1136
+ defineConfigurable(this, { target: target, contentRect: contentRect });
1137
+ }
1138
+ return ResizeObserverEntry;
1139
+ }());
1140
+
1141
+ var ResizeObserverSPI = /** @class */ (function () {
1142
+ /**
1143
+ * Creates a new instance of ResizeObserver.
1144
+ *
1145
+ * @param {ResizeObserverCallback} callback - Callback function that is invoked
1146
+ * when one of the observed elements changes it's content dimensions.
1147
+ * @param {ResizeObserverController} controller - Controller instance which
1148
+ * is responsible for the updates of observer.
1149
+ * @param {ResizeObserver} callbackCtx - Reference to the public
1150
+ * ResizeObserver instance which will be passed to callback function.
1151
+ */
1152
+ function ResizeObserverSPI(callback, controller, callbackCtx) {
1153
+ /**
1154
+ * Collection of resize observations that have detected changes in dimensions
1155
+ * of elements.
1156
+ *
1157
+ * @private {Array<ResizeObservation>}
1158
+ */
1159
+ this.activeObservations_ = [];
1160
+ /**
1161
+ * Registry of the ResizeObservation instances.
1162
+ *
1163
+ * @private {Map<Element, ResizeObservation>}
1164
+ */
1165
+ this.observations_ = new MapShim();
1166
+ if (typeof callback !== 'function') {
1167
+ throw new TypeError('The callback provided as parameter 1 is not a function.');
1168
+ }
1169
+ this.callback_ = callback;
1170
+ this.controller_ = controller;
1171
+ this.callbackCtx_ = callbackCtx;
1172
+ }
1173
+ /**
1174
+ * Starts observing provided element.
1175
+ *
1176
+ * @param {Element} target - Element to be observed.
1177
+ * @returns {void}
1178
+ */
1179
+ ResizeObserverSPI.prototype.observe = function (target) {
1180
+ if (!arguments.length) {
1181
+ throw new TypeError('1 argument required, but only 0 present.');
1182
+ }
1183
+ // Do nothing if current environment doesn't have the Element interface.
1184
+ if (typeof Element === 'undefined' || !(Element instanceof Object)) {
1185
+ return;
1186
+ }
1187
+ if (!(target instanceof getWindowOf(target).Element)) {
1188
+ throw new TypeError('parameter 1 is not of type "Element".');
1189
+ }
1190
+ var observations = this.observations_;
1191
+ // Do nothing if element is already being observed.
1192
+ if (observations.has(target)) {
1193
+ return;
1194
+ }
1195
+ observations.set(target, new ResizeObservation(target));
1196
+ this.controller_.addObserver(this);
1197
+ // Force the update of observations.
1198
+ this.controller_.refresh();
1199
+ };
1200
+ /**
1201
+ * Stops observing provided element.
1202
+ *
1203
+ * @param {Element} target - Element to stop observing.
1204
+ * @returns {void}
1205
+ */
1206
+ ResizeObserverSPI.prototype.unobserve = function (target) {
1207
+ if (!arguments.length) {
1208
+ throw new TypeError('1 argument required, but only 0 present.');
1209
+ }
1210
+ // Do nothing if current environment doesn't have the Element interface.
1211
+ if (typeof Element === 'undefined' || !(Element instanceof Object)) {
1212
+ return;
1213
+ }
1214
+ if (!(target instanceof getWindowOf(target).Element)) {
1215
+ throw new TypeError('parameter 1 is not of type "Element".');
1216
+ }
1217
+ var observations = this.observations_;
1218
+ // Do nothing if element is not being observed.
1219
+ if (!observations.has(target)) {
1220
+ return;
1221
+ }
1222
+ observations.delete(target);
1223
+ if (!observations.size) {
1224
+ this.controller_.removeObserver(this);
1225
+ }
1226
+ };
1227
+ /**
1228
+ * Stops observing all elements.
1229
+ *
1230
+ * @returns {void}
1231
+ */
1232
+ ResizeObserverSPI.prototype.disconnect = function () {
1233
+ this.clearActive();
1234
+ this.observations_.clear();
1235
+ this.controller_.removeObserver(this);
1236
+ };
1237
+ /**
1238
+ * Collects observation instances the associated element of which has changed
1239
+ * it's content rectangle.
1240
+ *
1241
+ * @returns {void}
1242
+ */
1243
+ ResizeObserverSPI.prototype.gatherActive = function () {
1244
+ var _this = this;
1245
+ this.clearActive();
1246
+ this.observations_.forEach(function (observation) {
1247
+ if (observation.isActive()) {
1248
+ _this.activeObservations_.push(observation);
1249
+ }
1250
+ });
1251
+ };
1252
+ /**
1253
+ * Invokes initial callback function with a list of ResizeObserverEntry
1254
+ * instances collected from active resize observations.
1255
+ *
1256
+ * @returns {void}
1257
+ */
1258
+ ResizeObserverSPI.prototype.broadcastActive = function () {
1259
+ // Do nothing if observer doesn't have active observations.
1260
+ if (!this.hasActive()) {
1261
+ return;
1262
+ }
1263
+ var ctx = this.callbackCtx_;
1264
+ // Create ResizeObserverEntry instance for every active observation.
1265
+ var entries = this.activeObservations_.map(function (observation) {
1266
+ return new ResizeObserverEntry(observation.target, observation.broadcastRect());
1267
+ });
1268
+ this.callback_.call(ctx, entries, ctx);
1269
+ this.clearActive();
1270
+ };
1271
+ /**
1272
+ * Clears the collection of active observations.
1273
+ *
1274
+ * @returns {void}
1275
+ */
1276
+ ResizeObserverSPI.prototype.clearActive = function () {
1277
+ this.activeObservations_.splice(0);
1278
+ };
1279
+ /**
1280
+ * Tells whether observer has active observations.
1281
+ *
1282
+ * @returns {boolean}
1283
+ */
1284
+ ResizeObserverSPI.prototype.hasActive = function () {
1285
+ return this.activeObservations_.length > 0;
1286
+ };
1287
+ return ResizeObserverSPI;
1288
+ }());
1289
+
1290
+ // Registry of internal observers. If WeakMap is not available use current shim
1291
+ // for the Map collection as it has all required methods and because WeakMap
1292
+ // can't be fully polyfilled anyway.
1293
+ var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
1294
+ /**
1295
+ * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation
1296
+ * exposing only those methods and properties that are defined in the spec.
1297
+ */
1298
+ var ResizeObserver$1 = /** @class */ (function () {
1299
+ /**
1300
+ * Creates a new instance of ResizeObserver.
1301
+ *
1302
+ * @param {ResizeObserverCallback} callback - Callback that is invoked when
1303
+ * dimensions of the observed elements change.
1304
+ */
1305
+ function ResizeObserver(callback) {
1306
+ if (!(this instanceof ResizeObserver)) {
1307
+ throw new TypeError('Cannot call a class as a function.');
1308
+ }
1309
+ if (!arguments.length) {
1310
+ throw new TypeError('1 argument required, but only 0 present.');
1311
+ }
1312
+ var controller = ResizeObserverController.getInstance();
1313
+ var observer = new ResizeObserverSPI(callback, controller, this);
1314
+ observers.set(this, observer);
1315
+ }
1316
+ return ResizeObserver;
1317
+ }());
1318
+ // Expose public methods of ResizeObserver.
1319
+ [
1320
+ 'observe',
1321
+ 'unobserve',
1322
+ 'disconnect'
1323
+ ].forEach(function (method) {
1324
+ ResizeObserver$1.prototype[method] = function () {
1325
+ var _a;
1326
+ return (_a = observers.get(this))[method].apply(_a, arguments);
1327
+ };
1328
+ });
1329
+
1330
+ var index = (function () {
1331
+ // Export existing implementation if available.
1332
+ if (typeof global$1.ResizeObserver !== 'undefined') {
1333
+ return global$1.ResizeObserver;
1334
+ }
1335
+ return ResizeObserver$1;
1336
+ })();
1337
+
1338
+ // =============================== Const ===============================
1339
+ var elementListeners = new Map();
1340
+ function onResize(entities) {
1341
+ entities.forEach(function (entity) {
1342
+ var _elementListeners$get;
1343
+ var target = entity.target;
1344
+ (_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0 ? void 0 : _elementListeners$get.forEach(function (listener) {
1345
+ return listener(target);
1346
+ });
1347
+ });
1348
+ }
1349
+ // Note: ResizeObserver polyfill not support option to measure border-box resize
1350
+ var resizeObserver = new index(onResize);
1351
+ // ============================== Observe ==============================
1352
+ function observe(element, callback) {
1353
+ if (!elementListeners.has(element)) {
1354
+ elementListeners.set(element, new Set());
1355
+ resizeObserver.observe(element);
1356
+ }
1357
+ elementListeners.get(element).add(callback);
1358
+ }
1359
+ function unobserve(element, callback) {
1360
+ if (elementListeners.has(element)) {
1361
+ elementListeners.get(element).delete(callback);
1362
+ if (!elementListeners.get(element).size) {
1363
+ resizeObserver.unobserve(element);
1364
+ elementListeners.delete(element);
1365
+ }
1366
+ }
1367
+ }
1368
+
1369
+ function _classCallCheck(instance, Constructor) {
1370
+ if (!(instance instanceof Constructor)) {
1371
+ throw new TypeError("Cannot call a class as a function");
1372
+ }
1373
+ }
1374
+
1375
+ function _defineProperties(target, props) {
1376
+ for (var i = 0; i < props.length; i++) {
1377
+ var descriptor = props[i];
1378
+ descriptor.enumerable = descriptor.enumerable || false;
1379
+ descriptor.configurable = true;
1380
+ if ("value" in descriptor) descriptor.writable = true;
1381
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
1382
+ }
1383
+ }
1384
+ function _createClass(Constructor, protoProps, staticProps) {
1385
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1386
+ if (staticProps) _defineProperties(Constructor, staticProps);
1387
+ Object.defineProperty(Constructor, "prototype", {
1388
+ writable: false
1389
+ });
1390
+ return Constructor;
1391
+ }
1392
+
1393
+ function _setPrototypeOf(o, p) {
1394
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
1395
+ o.__proto__ = p;
1396
+ return o;
1397
+ };
1398
+ return _setPrototypeOf(o, p);
1399
+ }
1400
+
1401
+ function _inherits(subClass, superClass) {
1402
+ if (typeof superClass !== "function" && superClass !== null) {
1403
+ throw new TypeError("Super expression must either be null or a function");
1404
+ }
1405
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
1406
+ constructor: {
1407
+ value: subClass,
1408
+ writable: true,
1409
+ configurable: true
1410
+ }
1411
+ });
1412
+ Object.defineProperty(subClass, "prototype", {
1413
+ writable: false
1414
+ });
1415
+ if (superClass) _setPrototypeOf(subClass, superClass);
1416
+ }
1417
+
1418
+ function _getPrototypeOf(o) {
1419
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
1420
+ return o.__proto__ || Object.getPrototypeOf(o);
1421
+ };
1422
+ return _getPrototypeOf(o);
1423
+ }
1424
+
1425
+ function _isNativeReflectConstruct() {
1426
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
1427
+ if (Reflect.construct.sham) return false;
1428
+ if (typeof Proxy === "function") return true;
1429
+ try {
1430
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
1431
+ return true;
1432
+ } catch (e) {
1433
+ return false;
1434
+ }
1435
+ }
1436
+
1437
+ function _assertThisInitialized(self) {
1438
+ if (self === void 0) {
1439
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1440
+ }
1441
+ return self;
1442
+ }
1443
+
1444
+ function _possibleConstructorReturn(self, call) {
1445
+ if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
1446
+ return call;
1447
+ } else if (call !== void 0) {
1448
+ throw new TypeError("Derived constructors may only return object or undefined");
1449
+ }
1450
+ return _assertThisInitialized(self);
1451
+ }
1452
+
1453
+ function _createSuper(Derived) {
1454
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
1455
+ return function _createSuperInternal() {
1456
+ var Super = _getPrototypeOf(Derived),
1457
+ result;
1458
+ if (hasNativeReflectConstruct) {
1459
+ var NewTarget = _getPrototypeOf(this).constructor;
1460
+ result = Reflect.construct(Super, arguments, NewTarget);
1461
+ } else {
1462
+ result = Super.apply(this, arguments);
1463
+ }
1464
+ return _possibleConstructorReturn(this, result);
1465
+ };
1466
+ }
1467
+
1468
+ /**
1469
+ * Fallback to findDOMNode if origin ref do not provide any dom element
1470
+ */
1471
+ var DomWrapper = /*#__PURE__*/function (_React$Component) {
1472
+ _inherits(DomWrapper, _React$Component);
1473
+ var _super = _createSuper(DomWrapper);
1474
+ function DomWrapper() {
1475
+ _classCallCheck(this, DomWrapper);
1476
+ return _super.apply(this, arguments);
1477
+ }
1478
+ _createClass(DomWrapper, [{
1479
+ key: "render",
1480
+ value: function render() {
1481
+ return this.props.children;
1482
+ }
1483
+ }]);
1484
+ return DomWrapper;
1485
+ }(react.Component);
1486
+
1487
+ var CollectionContext = /*#__PURE__*/react.createContext(null);
1488
+ /**
1489
+ * Collect all the resize event from children ResizeObserver
1490
+ */
1491
+ function Collection(_ref) {
1492
+ var children = _ref.children,
1493
+ onBatchResize = _ref.onBatchResize;
1494
+ var resizeIdRef = react.useRef(0);
1495
+ var resizeInfosRef = react.useRef([]);
1496
+ var onCollectionResize = react.useContext(CollectionContext);
1497
+ var onResize = react.useCallback(function (size, element, data) {
1498
+ resizeIdRef.current += 1;
1499
+ var currentId = resizeIdRef.current;
1500
+ resizeInfosRef.current.push({
1501
+ size: size,
1502
+ element: element,
1503
+ data: data
1504
+ });
1505
+ Promise.resolve().then(function () {
1506
+ if (currentId === resizeIdRef.current) {
1507
+ onBatchResize === null || onBatchResize === void 0 ? void 0 : onBatchResize(resizeInfosRef.current);
1508
+ resizeInfosRef.current = [];
1509
+ }
1510
+ });
1511
+ // Continue bubbling if parent exist
1512
+ onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(size, element, data);
1513
+ }, [onBatchResize, onCollectionResize]);
1514
+ return /*#__PURE__*/react.createElement(CollectionContext.Provider, {
1515
+ value: onResize
1516
+ }, children);
1517
+ }
1518
+
1519
+ function SingleObserver(props, ref) {
1520
+ var children = props.children,
1521
+ disabled = props.disabled;
1522
+ var elementRef = react.useRef(null);
1523
+ var wrapperRef = react.useRef(null);
1524
+ var onCollectionResize = react.useContext(CollectionContext);
1525
+ // =========================== Children ===========================
1526
+ var isRenderProps = typeof children === 'function';
1527
+ var mergedChildren = isRenderProps ? children(elementRef) : children;
1528
+ // ============================= Size =============================
1529
+ var sizeRef = react.useRef({
1530
+ width: -1,
1531
+ height: -1,
1532
+ offsetWidth: -1,
1533
+ offsetHeight: -1
1534
+ });
1535
+ // ============================= Ref ==============================
1536
+ var canRef = !isRenderProps && /*#__PURE__*/react.isValidElement(mergedChildren) && supportRef(mergedChildren);
1537
+ var originRef = canRef ? mergedChildren.ref : null;
1538
+ var mergedRef = react.useMemo(function () {
1539
+ return composeRef(originRef, elementRef);
1540
+ }, [originRef, elementRef]);
1541
+ var getDom = function getDom() {
1542
+ return findDOMNode(elementRef.current) || findDOMNode(wrapperRef.current);
1543
+ };
1544
+ react.useImperativeHandle(ref, function () {
1545
+ return getDom();
1546
+ });
1547
+ // =========================== Observe ============================
1548
+ var propsRef = react.useRef(props);
1549
+ propsRef.current = props;
1550
+ // Handler
1551
+ var onInternalResize = react.useCallback(function (target) {
1552
+ var _propsRef$current = propsRef.current,
1553
+ onResize = _propsRef$current.onResize,
1554
+ data = _propsRef$current.data;
1555
+ var _target$getBoundingCl = target.getBoundingClientRect(),
1556
+ width = _target$getBoundingCl.width,
1557
+ height = _target$getBoundingCl.height;
1558
+ var offsetWidth = target.offsetWidth,
1559
+ offsetHeight = target.offsetHeight;
1560
+ /**
1561
+ * Resize observer trigger when content size changed.
1562
+ * In most case we just care about element size,
1563
+ * let's use `boundary` instead of `contentRect` here to avoid shaking.
1564
+ */
1565
+ var fixedWidth = Math.floor(width);
1566
+ var fixedHeight = Math.floor(height);
1567
+ if (sizeRef.current.width !== fixedWidth || sizeRef.current.height !== fixedHeight || sizeRef.current.offsetWidth !== offsetWidth || sizeRef.current.offsetHeight !== offsetHeight) {
1568
+ var size = {
1569
+ width: fixedWidth,
1570
+ height: fixedHeight,
1571
+ offsetWidth: offsetWidth,
1572
+ offsetHeight: offsetHeight
1573
+ };
1574
+ sizeRef.current = size;
1575
+ // IE is strange, right?
1576
+ var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth;
1577
+ var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight;
1578
+ var sizeInfo = _objectSpread2(_objectSpread2({}, size), {}, {
1579
+ offsetWidth: mergedOffsetWidth,
1580
+ offsetHeight: mergedOffsetHeight
1581
+ });
1582
+ // Let collection know what happened
1583
+ onCollectionResize === null || onCollectionResize === void 0 ? void 0 : onCollectionResize(sizeInfo, target, data);
1584
+ if (onResize) {
1585
+ // defer the callback but not defer to next frame
1586
+ Promise.resolve().then(function () {
1587
+ onResize(sizeInfo, target);
1588
+ });
1589
+ }
1590
+ }
1591
+ }, []);
1592
+ // Dynamic observe
1593
+ react.useEffect(function () {
1594
+ var currentElement = getDom();
1595
+ if (currentElement && !disabled) {
1596
+ observe(currentElement, onInternalResize);
1597
+ }
1598
+ return function () {
1599
+ return unobserve(currentElement, onInternalResize);
1600
+ };
1601
+ }, [elementRef.current, disabled]);
1602
+ // ============================ Render ============================
1603
+ return /*#__PURE__*/react.createElement(DomWrapper, {
1604
+ ref: wrapperRef
1605
+ }, canRef ? /*#__PURE__*/react.cloneElement(mergedChildren, {
1606
+ ref: mergedRef
1607
+ }) : mergedChildren);
1608
+ }
1609
+ var RefSingleObserver = /*#__PURE__*/react.forwardRef(SingleObserver);
1610
+
1611
+ var INTERNAL_PREFIX_KEY = 'rc-observer-key';
1612
+ function ResizeObserver(props, ref) {
1613
+ var children = props.children;
1614
+ var childNodes = typeof children === 'function' ? [children] : toArray(children);
1615
+ return childNodes.map(function (child, index) {
1616
+ var key = (child === null || child === void 0 ? void 0 : child.key) || "".concat(INTERNAL_PREFIX_KEY, "-").concat(index);
1617
+ return /*#__PURE__*/react.createElement(RefSingleObserver, _extends({}, props, {
1618
+ key: key,
1619
+ ref: index === 0 ? ref : undefined
1620
+ }), child);
1621
+ });
1622
+ }
1623
+ var RefResizeObserver = /*#__PURE__*/react.forwardRef(ResizeObserver);
1624
+ RefResizeObserver.Collection = Collection;
1625
+
1626
+ function canUseDom() {
1627
+ return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
1628
+ }
1629
+
1630
+ /**
1631
+ * Wrap `React.useLayoutEffect` which will not throw warning message in test env
1632
+ */
1633
+ var useInternalLayoutEffect = canUseDom() ? react.useLayoutEffect : react.useEffect;
1634
+ var useLayoutEffect = function useLayoutEffect(callback, deps) {
1635
+ var firstMountRef = react.useRef(true);
1636
+ useInternalLayoutEffect(function () {
1637
+ return callback(firstMountRef.current);
1638
+ }, deps);
1639
+
1640
+ // We tell react that first mount has passed
1641
+ useInternalLayoutEffect(function () {
1642
+ firstMountRef.current = false;
1643
+ return function () {
1644
+ firstMountRef.current = true;
1645
+ };
1646
+ }, []);
1647
+ };
1648
+
1649
+ var _excluded$2 = ["prefixCls", "invalidate", "item", "renderItem", "responsive", "responsiveDisabled", "registerSize", "itemKey", "className", "style", "children", "display", "order", "component"];
1650
+ // Use shared variable to save bundle size
1651
+ var UNDEFINED = undefined;
1652
+ function InternalItem(props, ref) {
1653
+ var prefixCls = props.prefixCls,
1654
+ invalidate = props.invalidate,
1655
+ item = props.item,
1656
+ renderItem = props.renderItem,
1657
+ responsive = props.responsive,
1658
+ responsiveDisabled = props.responsiveDisabled,
1659
+ registerSize = props.registerSize,
1660
+ itemKey = props.itemKey,
1661
+ className = props.className,
1662
+ style = props.style,
1663
+ children = props.children,
1664
+ display = props.display,
1665
+ order = props.order,
1666
+ _props$component = props.component,
1667
+ Component = _props$component === void 0 ? 'div' : _props$component,
1668
+ restProps = _objectWithoutProperties(props, _excluded$2);
1669
+ var mergedHidden = responsive && !display;
1670
+ // ================================ Effect ================================
1671
+ function internalRegisterSize(width) {
1672
+ registerSize(itemKey, width);
1673
+ }
1674
+ react.useEffect(function () {
1675
+ return function () {
1676
+ internalRegisterSize(null);
1677
+ };
1678
+ }, []);
1679
+ // ================================ Render ================================
1680
+ var childNode = renderItem && item !== UNDEFINED ? renderItem(item) : children;
1681
+ var overflowStyle;
1682
+ if (!invalidate) {
1683
+ overflowStyle = {
1684
+ opacity: mergedHidden ? 0 : 1,
1685
+ height: mergedHidden ? 0 : UNDEFINED,
1686
+ overflowY: mergedHidden ? 'hidden' : UNDEFINED,
1687
+ order: responsive ? order : UNDEFINED,
1688
+ pointerEvents: mergedHidden ? 'none' : UNDEFINED,
1689
+ position: mergedHidden ? 'absolute' : UNDEFINED
1690
+ };
1691
+ }
1692
+ var overflowProps = {};
1693
+ if (mergedHidden) {
1694
+ overflowProps['aria-hidden'] = true;
1695
+ }
1696
+ var itemNode = /*#__PURE__*/react.createElement(Component, _extends$1({
1697
+ className: classnames(!invalidate && prefixCls, className),
1698
+ style: _objectSpread2$1(_objectSpread2$1({}, overflowStyle), style)
1699
+ }, overflowProps, restProps, {
1700
+ ref: ref
1701
+ }), childNode);
1702
+ if (responsive) {
1703
+ itemNode = /*#__PURE__*/react.createElement(RefResizeObserver, {
1704
+ onResize: function onResize(_ref) {
1705
+ var offsetWidth = _ref.offsetWidth;
1706
+ internalRegisterSize(offsetWidth);
1707
+ },
1708
+ disabled: responsiveDisabled
1709
+ }, itemNode);
1710
+ }
1711
+ return itemNode;
1712
+ }
1713
+ var Item = /*#__PURE__*/react.forwardRef(InternalItem);
1714
+ Item.displayName = 'Item';
1715
+
1716
+ function useEvent(callback) {
1717
+ var fnRef = react.useRef();
1718
+ fnRef.current = callback;
1719
+ var memoFn = react.useCallback(function () {
1720
+ var _fnRef$current;
1721
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1722
+ args[_key] = arguments[_key];
1723
+ }
1724
+ return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [fnRef].concat(args));
1725
+ }, []);
1726
+ return memoFn;
1727
+ }
1728
+
1729
+ var raf = function raf(callback) {
1730
+ return +setTimeout(callback, 16);
1731
+ };
1732
+ var caf = function caf(num) {
1733
+ return clearTimeout(num);
1734
+ };
1735
+ if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) {
1736
+ raf = function raf(callback) {
1737
+ return window.requestAnimationFrame(callback);
1738
+ };
1739
+ caf = function caf(handle) {
1740
+ return window.cancelAnimationFrame(handle);
1741
+ };
1742
+ }
1743
+ var rafUUID = 0;
1744
+ var rafIds = new Map();
1745
+ function cleanup(id) {
1746
+ rafIds.delete(id);
1747
+ }
1748
+ var wrapperRaf = function wrapperRaf(callback) {
1749
+ var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1750
+ rafUUID += 1;
1751
+ var id = rafUUID;
1752
+ function callRef(leftTimes) {
1753
+ if (leftTimes === 0) {
1754
+ // Clean up
1755
+ cleanup(id);
1756
+
1757
+ // Trigger
1758
+ callback();
1759
+ } else {
1760
+ // Next raf
1761
+ var realId = raf(function () {
1762
+ callRef(leftTimes - 1);
1763
+ });
1764
+
1765
+ // Bind real raf id
1766
+ rafIds.set(id, realId);
1767
+ }
1768
+ }
1769
+ callRef(times);
1770
+ return id;
1771
+ };
1772
+ wrapperRaf.cancel = function (id) {
1773
+ var realId = rafIds.get(id);
1774
+ cleanup(realId);
1775
+ return caf(realId);
1776
+ };
1777
+
1778
+ function channelUpdate(callback) {
1779
+ if (typeof MessageChannel === 'undefined') {
1780
+ wrapperRaf(callback);
1781
+ } else {
1782
+ var channel = new MessageChannel();
1783
+ channel.port1.onmessage = function () {
1784
+ return callback();
1785
+ };
1786
+ channel.port2.postMessage(undefined);
1787
+ }
1788
+ }
1789
+
1790
+ /**
1791
+ * Batcher for record any `useEffectState` need update.
1792
+ */
1793
+ function useBatcher() {
1794
+ // Updater Trigger
1795
+ var updateFuncRef = react.useRef(null);
1796
+ // Notify update
1797
+ var notifyEffectUpdate = function notifyEffectUpdate(callback) {
1798
+ if (!updateFuncRef.current) {
1799
+ updateFuncRef.current = [];
1800
+ channelUpdate(function () {
1801
+ reactDom.unstable_batchedUpdates(function () {
1802
+ updateFuncRef.current.forEach(function (fn) {
1803
+ fn();
1804
+ });
1805
+ updateFuncRef.current = null;
1806
+ });
1807
+ });
1808
+ }
1809
+ updateFuncRef.current.push(callback);
1810
+ };
1811
+ return notifyEffectUpdate;
1812
+ }
1813
+ /**
1814
+ * Trigger state update by `useLayoutEffect` to save perf.
1815
+ */
1816
+ function useEffectState(notifyEffectUpdate, defaultValue) {
1817
+ // Value
1818
+ var _React$useState = react.useState(defaultValue),
1819
+ _React$useState2 = _slicedToArray(_React$useState, 2),
1820
+ stateValue = _React$useState2[0],
1821
+ setStateValue = _React$useState2[1];
1822
+ // Set State
1823
+ var setEffectVal = useEvent(function (nextValue) {
1824
+ notifyEffectUpdate(function () {
1825
+ setStateValue(nextValue);
1826
+ });
1827
+ });
1828
+ return [stateValue, setEffectVal];
1829
+ }
1830
+
1831
+ var OverflowContext = /*#__PURE__*/react.createContext(null);
1832
+
1833
+ var _excluded$1 = ["component"],
1834
+ _excluded2 = ["className"],
1835
+ _excluded3 = ["className"];
1836
+ var InternalRawItem = function InternalRawItem(props, ref) {
1837
+ var context = react.useContext(OverflowContext);
1838
+ // Render directly when context not provided
1839
+ if (!context) {
1840
+ var _props$component = props.component,
1841
+ Component = _props$component === void 0 ? 'div' : _props$component,
1842
+ _restProps = _objectWithoutProperties(props, _excluded$1);
1843
+ return /*#__PURE__*/react.createElement(Component, _extends$1({}, _restProps, {
1844
+ ref: ref
1845
+ }));
1846
+ }
1847
+ var contextClassName = context.className,
1848
+ restContext = _objectWithoutProperties(context, _excluded2);
1849
+ var className = props.className,
1850
+ restProps = _objectWithoutProperties(props, _excluded3);
1851
+ // Do not pass context to sub item to avoid multiple measure
1852
+ return /*#__PURE__*/react.createElement(OverflowContext.Provider, {
1853
+ value: null
1854
+ }, /*#__PURE__*/react.createElement(Item, _extends$1({
1855
+ ref: ref,
1856
+ className: classnames(contextClassName, className)
1857
+ }, restContext, restProps)));
1858
+ };
1859
+ var RawItem = /*#__PURE__*/react.forwardRef(InternalRawItem);
1860
+ RawItem.displayName = 'RawItem';
1861
+
1862
+ var _excluded = ["prefixCls", "data", "renderItem", "renderRawItem", "itemKey", "itemWidth", "ssr", "style", "className", "maxCount", "renderRest", "renderRawRest", "suffix", "component", "itemComponent", "onVisibleChange"];
1863
+ var RESPONSIVE = 'responsive';
1864
+ var INVALIDATE = 'invalidate';
1865
+ function defaultRenderRest(omittedItems) {
1866
+ return "+ ".concat(omittedItems.length, " ...");
1867
+ }
1868
+ function Overflow(props, ref) {
1869
+ var _props$prefixCls = props.prefixCls,
1870
+ prefixCls = _props$prefixCls === void 0 ? 'rc-overflow' : _props$prefixCls,
1871
+ _props$data = props.data,
1872
+ data = _props$data === void 0 ? [] : _props$data,
1873
+ renderItem = props.renderItem,
1874
+ renderRawItem = props.renderRawItem,
1875
+ itemKey = props.itemKey,
1876
+ _props$itemWidth = props.itemWidth,
1877
+ itemWidth = _props$itemWidth === void 0 ? 10 : _props$itemWidth,
1878
+ ssr = props.ssr,
1879
+ style = props.style,
1880
+ className = props.className,
1881
+ maxCount = props.maxCount,
1882
+ renderRest = props.renderRest,
1883
+ renderRawRest = props.renderRawRest,
1884
+ suffix = props.suffix,
1885
+ _props$component = props.component,
1886
+ Component = _props$component === void 0 ? 'div' : _props$component,
1887
+ itemComponent = props.itemComponent,
1888
+ onVisibleChange = props.onVisibleChange,
1889
+ restProps = _objectWithoutProperties(props, _excluded);
1890
+ var fullySSR = ssr === 'full';
1891
+ var notifyEffectUpdate = useBatcher();
1892
+ var _useEffectState = useEffectState(notifyEffectUpdate, null),
1893
+ _useEffectState2 = _slicedToArray(_useEffectState, 2),
1894
+ containerWidth = _useEffectState2[0],
1895
+ setContainerWidth = _useEffectState2[1];
1896
+ var mergedContainerWidth = containerWidth || 0;
1897
+ var _useEffectState3 = useEffectState(notifyEffectUpdate, new Map()),
1898
+ _useEffectState4 = _slicedToArray(_useEffectState3, 2),
1899
+ itemWidths = _useEffectState4[0],
1900
+ setItemWidths = _useEffectState4[1];
1901
+ var _useEffectState5 = useEffectState(notifyEffectUpdate, 0),
1902
+ _useEffectState6 = _slicedToArray(_useEffectState5, 2),
1903
+ prevRestWidth = _useEffectState6[0],
1904
+ setPrevRestWidth = _useEffectState6[1];
1905
+ var _useEffectState7 = useEffectState(notifyEffectUpdate, 0),
1906
+ _useEffectState8 = _slicedToArray(_useEffectState7, 2),
1907
+ restWidth = _useEffectState8[0],
1908
+ setRestWidth = _useEffectState8[1];
1909
+ var _useEffectState9 = useEffectState(notifyEffectUpdate, 0),
1910
+ _useEffectState10 = _slicedToArray(_useEffectState9, 2),
1911
+ suffixWidth = _useEffectState10[0],
1912
+ setSuffixWidth = _useEffectState10[1];
1913
+ var _useState = react.useState(null),
1914
+ _useState2 = _slicedToArray(_useState, 2),
1915
+ suffixFixedStart = _useState2[0],
1916
+ setSuffixFixedStart = _useState2[1];
1917
+ var _useState3 = react.useState(null),
1918
+ _useState4 = _slicedToArray(_useState3, 2),
1919
+ displayCount = _useState4[0],
1920
+ setDisplayCount = _useState4[1];
1921
+ var mergedDisplayCount = react.useMemo(function () {
1922
+ if (displayCount === null && fullySSR) {
1923
+ return Number.MAX_SAFE_INTEGER;
1924
+ }
1925
+ return displayCount || 0;
1926
+ }, [displayCount, containerWidth]);
1927
+ var _useState5 = react.useState(false),
1928
+ _useState6 = _slicedToArray(_useState5, 2),
1929
+ restReady = _useState6[0],
1930
+ setRestReady = _useState6[1];
1931
+ var itemPrefixCls = "".concat(prefixCls, "-item");
1932
+ // Always use the max width to avoid blink
1933
+ var mergedRestWidth = Math.max(prevRestWidth, restWidth);
1934
+ // ================================= Data =================================
1935
+ var isResponsive = maxCount === RESPONSIVE;
1936
+ var shouldResponsive = data.length && isResponsive;
1937
+ var invalidate = maxCount === INVALIDATE;
1938
+ /**
1939
+ * When is `responsive`, we will always render rest node to get the real width of it for calculation
1940
+ */
1941
+ var showRest = shouldResponsive || typeof maxCount === 'number' && data.length > maxCount;
1942
+ var mergedData = react.useMemo(function () {
1943
+ var items = data;
1944
+ if (shouldResponsive) {
1945
+ if (containerWidth === null && fullySSR) {
1946
+ items = data;
1947
+ } else {
1948
+ items = data.slice(0, Math.min(data.length, mergedContainerWidth / itemWidth));
1949
+ }
1950
+ } else if (typeof maxCount === 'number') {
1951
+ items = data.slice(0, maxCount);
1952
+ }
1953
+ return items;
1954
+ }, [data, itemWidth, containerWidth, maxCount, shouldResponsive]);
1955
+ var omittedItems = react.useMemo(function () {
1956
+ if (shouldResponsive) {
1957
+ return data.slice(mergedDisplayCount + 1);
1958
+ }
1959
+ return data.slice(mergedData.length);
1960
+ }, [data, mergedData, shouldResponsive, mergedDisplayCount]);
1961
+ // ================================= Item =================================
1962
+ var getKey = react.useCallback(function (item, index) {
1963
+ var _ref;
1964
+ if (typeof itemKey === 'function') {
1965
+ return itemKey(item);
1966
+ }
1967
+ return (_ref = itemKey && (item === null || item === void 0 ? void 0 : item[itemKey])) !== null && _ref !== void 0 ? _ref : index;
1968
+ }, [itemKey]);
1969
+ var mergedRenderItem = react.useCallback(renderItem || function (item) {
1970
+ return item;
1971
+ }, [renderItem]);
1972
+ function updateDisplayCount(count, suffixFixedStartVal, notReady) {
1973
+ // React 18 will sync render even when the value is same in some case.
1974
+ // We take `mergedData` as deps which may cause dead loop if it's dynamic generate.
1975
+ // ref: https://github.com/ant-design/ant-design/issues/36559
1976
+ if (displayCount === count && (suffixFixedStartVal === undefined || suffixFixedStartVal === suffixFixedStart)) {
1977
+ return;
1978
+ }
1979
+ setDisplayCount(count);
1980
+ if (!notReady) {
1981
+ setRestReady(count < data.length - 1);
1982
+ onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(count);
1983
+ }
1984
+ if (suffixFixedStartVal !== undefined) {
1985
+ setSuffixFixedStart(suffixFixedStartVal);
1986
+ }
1987
+ }
1988
+ // ================================= Size =================================
1989
+ function onOverflowResize(_, element) {
1990
+ setContainerWidth(element.clientWidth);
1991
+ }
1992
+ function registerSize(key, width) {
1993
+ setItemWidths(function (origin) {
1994
+ var clone = new Map(origin);
1995
+ if (width === null) {
1996
+ clone.delete(key);
1997
+ } else {
1998
+ clone.set(key, width);
1999
+ }
2000
+ return clone;
2001
+ });
2002
+ }
2003
+ function registerOverflowSize(_, width) {
2004
+ setRestWidth(width);
2005
+ setPrevRestWidth(restWidth);
2006
+ }
2007
+ function registerSuffixSize(_, width) {
2008
+ setSuffixWidth(width);
2009
+ }
2010
+ // ================================ Effect ================================
2011
+ function getItemWidth(index) {
2012
+ return itemWidths.get(getKey(mergedData[index], index));
2013
+ }
2014
+ useLayoutEffect(function () {
2015
+ if (mergedContainerWidth && typeof mergedRestWidth === 'number' && mergedData) {
2016
+ var totalWidth = suffixWidth;
2017
+ var len = mergedData.length;
2018
+ var lastIndex = len - 1;
2019
+ // When data count change to 0, reset this since not loop will reach
2020
+ if (!len) {
2021
+ updateDisplayCount(0, null);
2022
+ return;
2023
+ }
2024
+ for (var i = 0; i < len; i += 1) {
2025
+ var currentItemWidth = getItemWidth(i);
2026
+ // Fully will always render
2027
+ if (fullySSR) {
2028
+ currentItemWidth = currentItemWidth || 0;
2029
+ }
2030
+ // Break since data not ready
2031
+ if (currentItemWidth === undefined) {
2032
+ updateDisplayCount(i - 1, undefined, true);
2033
+ break;
2034
+ }
2035
+ // Find best match
2036
+ totalWidth += currentItemWidth;
2037
+ if (
2038
+ // Only one means `totalWidth` is the final width
2039
+ lastIndex === 0 && totalWidth <= mergedContainerWidth ||
2040
+ // Last two width will be the final width
2041
+ i === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth) {
2042
+ // Additional check if match the end
2043
+ updateDisplayCount(lastIndex, null);
2044
+ break;
2045
+ } else if (totalWidth + mergedRestWidth > mergedContainerWidth) {
2046
+ // Can not hold all the content to show rest
2047
+ updateDisplayCount(i - 1, totalWidth - currentItemWidth - suffixWidth + restWidth);
2048
+ break;
2049
+ }
2050
+ }
2051
+ if (suffix && getItemWidth(0) + suffixWidth > mergedContainerWidth) {
2052
+ setSuffixFixedStart(null);
2053
+ }
2054
+ }
2055
+ }, [mergedContainerWidth, itemWidths, restWidth, suffixWidth, getKey, mergedData]);
2056
+ // ================================ Render ================================
2057
+ var displayRest = restReady && !!omittedItems.length;
2058
+ var suffixStyle = {};
2059
+ if (suffixFixedStart !== null && shouldResponsive) {
2060
+ suffixStyle = {
2061
+ position: 'absolute',
2062
+ left: suffixFixedStart,
2063
+ top: 0
2064
+ };
2065
+ }
2066
+ var itemSharedProps = {
2067
+ prefixCls: itemPrefixCls,
2068
+ responsive: shouldResponsive,
2069
+ component: itemComponent,
2070
+ invalidate: invalidate
2071
+ };
2072
+ // >>>>> Choice render fun by `renderRawItem`
2073
+ var internalRenderItemNode = renderRawItem ? function (item, index) {
2074
+ var key = getKey(item, index);
2075
+ return /*#__PURE__*/react.createElement(OverflowContext.Provider, {
2076
+ key: key,
2077
+ value: _objectSpread2$1(_objectSpread2$1({}, itemSharedProps), {}, {
2078
+ order: index,
2079
+ item: item,
2080
+ itemKey: key,
2081
+ registerSize: registerSize,
2082
+ display: index <= mergedDisplayCount
2083
+ })
2084
+ }, renderRawItem(item, index));
2085
+ } : function (item, index) {
2086
+ var key = getKey(item, index);
2087
+ return /*#__PURE__*/react.createElement(Item, _extends$1({}, itemSharedProps, {
2088
+ order: index,
2089
+ key: key,
2090
+ item: item,
2091
+ renderItem: mergedRenderItem,
2092
+ itemKey: key,
2093
+ registerSize: registerSize,
2094
+ display: index <= mergedDisplayCount
2095
+ }));
2096
+ };
2097
+ // >>>>> Rest node
2098
+ var restNode;
2099
+ var restContextProps = {
2100
+ order: displayRest ? mergedDisplayCount : Number.MAX_SAFE_INTEGER,
2101
+ className: "".concat(itemPrefixCls, "-rest"),
2102
+ registerSize: registerOverflowSize,
2103
+ display: displayRest
2104
+ };
2105
+ if (!renderRawRest) {
2106
+ var mergedRenderRest = renderRest || defaultRenderRest;
2107
+ restNode = /*#__PURE__*/react.createElement(Item, _extends$1({}, itemSharedProps, restContextProps), typeof mergedRenderRest === 'function' ? mergedRenderRest(omittedItems) : mergedRenderRest);
2108
+ } else if (renderRawRest) {
2109
+ restNode = /*#__PURE__*/react.createElement(OverflowContext.Provider, {
2110
+ value: _objectSpread2$1(_objectSpread2$1({}, itemSharedProps), restContextProps)
2111
+ }, renderRawRest(omittedItems));
2112
+ }
2113
+ var overflowNode = /*#__PURE__*/react.createElement(Component, _extends$1({
2114
+ className: classnames(!invalidate && prefixCls, className),
2115
+ style: style,
2116
+ ref: ref
2117
+ }, restProps), mergedData.map(internalRenderItemNode), showRest ? restNode : null, suffix && /*#__PURE__*/react.createElement(Item, _extends$1({}, itemSharedProps, {
2118
+ responsive: isResponsive,
2119
+ responsiveDisabled: !shouldResponsive,
2120
+ order: mergedDisplayCount,
2121
+ className: "".concat(itemPrefixCls, "-suffix"),
2122
+ registerSize: registerSuffixSize,
2123
+ display: true,
2124
+ style: suffixStyle
2125
+ }), suffix));
2126
+ if (isResponsive) {
2127
+ overflowNode = /*#__PURE__*/react.createElement(RefResizeObserver, {
2128
+ onResize: onOverflowResize,
2129
+ disabled: !shouldResponsive
2130
+ }, overflowNode);
2131
+ }
2132
+ return overflowNode;
2133
+ }
2134
+ var ForwardOverflow = /*#__PURE__*/react.forwardRef(Overflow);
2135
+ ForwardOverflow.displayName = 'Overflow';
2136
+ ForwardOverflow.Item = RawItem;
2137
+ ForwardOverflow.RESPONSIVE = RESPONSIVE;
2138
+ ForwardOverflow.INVALIDATE = INVALIDATE;
2139
+
2140
+ const rcOverflowCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}.rc-overflow{display:flex;flex-direction:row;flex-wrap:nowrap;width:100%}.rc-overflow-item{transition:all 0.3s ease;padding:0 2px;display:flex;align-items:center;justify-content:center}";
2141
+
2142
+ const BcmRcOverflow = class {
2143
+ constructor(hostRef) {
2144
+ registerInstance(this, hostRef);
2145
+ this.selectOtherTag = createEvent(this, "bcm-select-other-tag", 7);
2146
+ this.selectTag = createEvent(this, "bcm-select-tag", 7);
2147
+ this.deleteTag = createEvent(this, "bcm-delete-tag", 7);
2148
+ this.renderItem = item => {
2149
+ return react.createElement("bcm-tooltip", {
2150
+ placement: "bottom",
2151
+ message: item.text,
2152
+ trigger: "hover",
2153
+ }, react.createElement("div", {
2154
+ id: item.value + "-tag",
2155
+ className: "bcm-tag",
2156
+ onClick: ({ target }) => this.onClickControl(target, item, false),
2157
+ }, react.createElement("span", { className: "bcm-tag__content dismissable" },
2158
+ // .bcm-tag__content span {
2159
+ // display: block;
2160
+ // max-width: 38px;
2161
+ // white-space: nowrap;
2162
+ // overflow: hidden;
2163
+ // text-overflow: ellipsis;
2164
+ react.createElement("div", { className: "value tw-block tw-max-w-[38px] tw-overflow-hidden tw-overflow-ellipsis tw-whitespace-nowrap" }, item.text), react.createElement("span", {
2165
+ className: "right close-button",
2166
+ }, react.createElement("bcm-icon", {
2167
+ icon: "fa fa-times",
2168
+ })))));
2169
+ };
2170
+ this.renderRest = items => {
2171
+ const titles = (items === null || items === void 0 ? void 0 : items.sort((a, b) => +a.ct - +b.ct).slice(0, 15).map(item => StringHelper.textLimitter(item.text, 40, true)).toString().split(",").join("\r\n")) + (items.length > 15 ? "\r\n..." : "");
2172
+ return react.createElement("bcm-tooltip", {
2173
+ placement: "bottom",
2174
+ message: titles,
2175
+ trigger: "hover",
2176
+ }, react.createElement("div", {
2177
+ className: "bcm-tag bcm-tag--other",
2178
+ onClick: ({ target }) => this.onClickControl(target, items, true),
2179
+ }, react.createElement("span", { className: `bcm-tag__content dismissable ${this.checked ? "checkable checked" : ""}` }, react.createElement("span", { className: "value" }, `+${items === null || items === void 0 ? void 0 : items.length}`), react.createElement("span", { className: "right close-button" }, react.createElement("bcm-icon", {
2180
+ icon: "fa fa-times",
2181
+ })))));
2182
+ };
2183
+ this._id = Generate.UID();
2184
+ this.maxCount = 1;
2185
+ this.data = [];
2186
+ this.checked = false;
2187
+ }
2188
+ isClickDismiss(e) {
2189
+ return e["s-hn"] === "BCM-ICON";
2190
+ }
2191
+ onClickControl(e, item, isOtherTag = false) {
2192
+ const isClickClose = this.isClickDismiss(e);
2193
+ isClickClose && this.deleteTag.emit({ id: Array.isArray(item) ? item.map(i => i.value) : item.value }) && this.checked && (this.checked = false);
2194
+ !isOtherTag && this.selectTag.emit({ id: item.value }) && this.checked && (this.checked = false);
2195
+ if (isOtherTag && !isClickClose) {
2196
+ this.checked = !this.checked;
2197
+ this.selectOtherTag.emit({ id: item === null || item === void 0 ? void 0 : item.map(i => i.value), checked: this.checked });
2198
+ }
2199
+ }
2200
+ componentWillRender() {
2201
+ const { data, renderItem, renderRest, maxCount } = this;
2202
+ this.overflowInstance = react.createElement(ForwardOverflow, {
2203
+ data,
2204
+ renderItem,
2205
+ renderRest,
2206
+ maxCount,
2207
+ });
2208
+ reactDom.render(this.overflowInstance, this.el);
2209
+ }
2210
+ get el() { return getElement(this); }
2211
+ };
2212
+ BcmRcOverflow.style = rcOverflowCss;
2213
+
2214
+ const { state } = createStore({
2215
+ value: new Map(),
2216
+ });
2217
+ const setValue = val => {
2218
+ const { id, dataSource } = val;
2219
+ const data = {
2220
+ id: snq(() => id, Generate.UID),
2221
+ dataSource: dataSource && dataSource.length > 0 && recursive(dataSource),
2222
+ searchIsOnlyChilds: val.searchIsOnlyChilds,
2223
+ };
2224
+ state.value.set(data.id, data);
2225
+ };
2226
+ const recursive = (data, parentId) => {
2227
+ let recData = [];
2228
+ if (data) {
2229
+ recData = data.map(item => (Object.assign(Object.assign(Object.assign({}, item), { parentId: snq(() => parentId, null) }), (item.items && item.items.length > 0 && { items: snq(() => recursive(item.items, item.id), []) }))));
2230
+ }
2231
+ return recData;
2232
+ };
2233
+ const removeValue = _id => {
2234
+ state.value.delete(_id);
2235
+ };
2236
+ const getValue = id => snq(() => state.value.get(id), {});
2237
+ const getDataPagination = (id, limit = 3) => {
2238
+ let data = [];
2239
+ const value = getValue(id);
2240
+ if (value) {
2241
+ const { dataSource } = value;
2242
+ data = dataSource.slice(0, limit);
2243
+ }
2244
+ return data;
2245
+ };
2246
+ // //search treeview data by text
2247
+ // const searchData = (id, search, items?) => {
2248
+ // let dataSource
2249
+ // if (items && items.length > 0) {
2250
+ // dataSource = items
2251
+ // } else {
2252
+ // const value = getValue(id);
2253
+ // dataSource = value.dataSource;
2254
+ // }
2255
+ // let result = []
2256
+ // if (dataSource) {
2257
+ // dataSource.forEach(child => {
2258
+ // if (child.text.toLowerCase().includes(search.toLowerCase())) {
2259
+ // result.push(child)
2260
+ // }
2261
+ // result = result.concat(searchData(id, search, child.items))
2262
+ // })
2263
+ // };
2264
+ // return result
2265
+ // };
2266
+ //nested search
2267
+ const searchData = (id, searchText, items) => {
2268
+ let dataSource;
2269
+ if (items && items.length > 0) {
2270
+ dataSource = items;
2271
+ }
2272
+ else {
2273
+ const value = getValue(id);
2274
+ dataSource = value.dataSource;
2275
+ }
2276
+ let results = [];
2277
+ if (dataSource) {
2278
+ results.push(nestedSearch(id, dataSource, searchText));
2279
+ //return with their parents
2280
+ // dataSource.forEach(child => {
2281
+ // if (child.text.toLowerCase().includes(searchText.toLowerCase())) {
2282
+ // results.push(child)
2283
+ // } else if (child.items && child.items.length > 0) {
2284
+ // child.items = nestedSearch(child.items, searchText)
2285
+ // if (child.items.length > 0) {
2286
+ // results.push(child)
2287
+ // }
2288
+ // }
2289
+ // })
2290
+ }
2291
+ return {
2292
+ result: snq(() => Generate.flatArray(results[0].result), []),
2293
+ matching: snq(() => results[0].matching, []),
2294
+ parentIndex: snq(() => results[0].parentIndex, []),
2295
+ nestedResult: snq(() => results[0].nestedResult, []),
2296
+ };
2297
+ };
2298
+ const nestedSearch = (id, items, searchText) => {
2299
+ let matching = [];
2300
+ let parentIndex = [];
2301
+ let result = [];
2302
+ let nestedResult = [];
2303
+ const { searchIsOnlyChilds } = getValue(id);
2304
+ if (items && items.length > 0) {
2305
+ items.forEach(child => {
2306
+ let isChild = searchIsOnlyChilds && child.parentId !== null;
2307
+ let isMatching = StringHelper.slugify(child.text).indexOf(StringHelper.slugify(searchText)) > -1 ||
2308
+ (child.keywords && StringHelper.slugify(child.keywords).indexOf(StringHelper.slugify(searchText)) > -1);
2309
+ if (isMatching && (!searchIsOnlyChilds || (searchIsOnlyChilds && isChild))) {
2310
+ result.push(child.id);
2311
+ matching.push(child.id);
2312
+ parentIndex.push(child.id);
2313
+ nestedResult.push({ id: child.id, text: child.text, parentId: child.parentId });
2314
+ if (child.items && child.items.length > 0) {
2315
+ const found = nestedSearch(id, child.items, searchText);
2316
+ if (found.matching.length > 0) {
2317
+ found.matching.forEach(chi => {
2318
+ matching.push(chi);
2319
+ });
2320
+ }
2321
+ }
2322
+ }
2323
+ else if (child.items && child.items.length > 0) {
2324
+ const found = nestedSearch(id, child.items, searchText);
2325
+ if (found.result.length > 0) {
2326
+ found.result.forEach(chi => {
2327
+ result.push(chi);
2328
+ });
2329
+ result.push(child.id);
2330
+ parentIndex.push(child.id);
2331
+ nestedResult.push({ id: child.id, text: child.text, parentId: child.parentId, items: found.nestedResult });
2332
+ }
2333
+ if (found.matching.length > 0) {
2334
+ matching.push(...found.matching);
2335
+ }
2336
+ }
2337
+ });
2338
+ }
2339
+ return { result, matching, parentIndex, nestedResult };
2340
+ };
2341
+ const searchState = {
2342
+ setValue,
2343
+ removeValue,
2344
+ getValue,
2345
+ getDataPagination,
2346
+ searchData,
2347
+ };
2348
+
2349
+ const searchCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600&display=swap\"); .size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.input-size-large{height:40px}.input-size-medium{height:32px}.input-size-small{height:24px}.resize-none textarea{resize:none}.resize-vertical textarea{resize:vertical}.resize-auto textarea{height:auto;resize:none}.textarea-size-large{padding:4px 0 0 4px;min-height:40px}.textarea-size-large .bcm-input-element{min-height:calc((40px - 8px) + 2px)}.textarea-size-large .input-clear-button{height:calc( 40px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-medium{padding:4px 0 0 4px;min-height:32px}.textarea-size-medium .bcm-input-element{min-height:calc((32px - 8px) + 2px)}.textarea-size-medium .input-clear-button{height:calc( 32px - 16px );top:8px;padding:0;margin-right:8px}.textarea-size-small{padding:0px 0 0 4px;min-height:24px}.textarea-size-small .bcm-input-element{min-height:calc((24px - 8px) + 2px)}.textarea-size-small .input-clear-button{height:calc( 24px - 16px );top:8px;padding:0;margin-right:8px}*{box-sizing:border-box}.bcm-caption-area{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;font-size:12px;line-height:calc(12px + 8px);color:var(--bcm-new-ds-color-slate-400);display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;flex-wrap:nowrap;margin-top:2px}.bcm-caption-area__text{color:var(--bcm-new-ds-color-slate-400)}.bcm-caption-area__text.default{color:var(--bcm-new-ds-color-slate-400)}.bcm-caption-area__text.info{color:var(--bcm-new-ds-color-blue-500)}.bcm-caption-area__text.success{color:var(--bcm-new-ds-color-emerald-500)}.bcm-caption-area__text.warning{color:var(--bcm-new-ds-color-amber-500)}.bcm-caption-area__text.error{color:var(--bcm-new-ds-color-red-500)}.bcm-caption-area__size-small{font-size:10px;line-height:calc(10px + 8px);min-height:calc(10px + 8px)}.bcm-caption-area__size-medium{font-size:12px;line-height:calc(12px + 8px);min-height:calc(12px + 8px)}.bcm-caption-area__size-large{font-size:14px;line-height:calc(14px + 8px);min-height:calc(14px + 8px)}*{box-sizing:border-box}.bcm-label{display:inline-flex;align-items:flex-start;grid-gap:2px}.bcm-label__text{margin-bottom:2px;font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;display:inline-block;color:var(--bcm-new-ds-color-slate-600)}.bcm-label__size-small{font-size:10px;line-height:calc(10px + 8px);min-height:calc(10px + 8px)}.bcm-label__size-medium{font-size:12px;line-height:calc(12px + 8px);min-height:calc(12px + 8px)}.bcm-label__size-large{font-size:14px;line-height:calc(14px + 8px);min-height:calc(14px + 8px)}.bcm-input[no-margin]{margin:0}.bcm-textarea[no-margin]{margin:0}.bcm-switch[no-margin]{margin:0}.bcm-checkbox[no-margin]{margin:0}.bcm-radio-group[no-margin]{margin:0}.bcm-checkbox-group[no-margin]{margin:0}.bcm-range[no-margin]{margin:0}.bcm-form[no-margin]{margin:0}.bcm-form-group[no-margin]{margin:0}.bcm-list[no-margin]{margin:0}.bcm-colorpicker[no-margin]{margin:0}.bcm-date-picker[no-margin]{margin:0}.bcm-time-picker[no-margin]{margin:0}.bcm-datetime-picker[no-margin]{margin:0}.bcm-select[no-margin]{margin:0}.bcm-listbox[no-margin]{margin:0}*{box-sizing:border-box}.bcm-input{display:inline-flex;flex-direction:column;width:100%;max-width:256px;margin-bottom:8px}.bcm-input.full-width{max-width:100%}.bcm-input.hidden{display:none}.bcm-input__container{font-family:\"Inter\", sans-serif;font-size:14px;line-height:calc(14px + 8px);font-weight:400;display:flex;align-items:stretch;flex-direction:row;background-color:var(--bcm-new-ds-color-white);border:1px solid var(--bcm-new-ds-color-slate-300);border-radius:4px;box-sizing:border-box;cursor:text;padding:0 0 0 4px;position:relative;width:100%}.bcm-input__container.disabled{background-color:var(--bcm-new-ds-color-slate-50);cursor:not-allowed}.bcm-input__container.disabled .bcm-input-element{color:var(--bcm-new-ds-color-slate-500)}.bcm-input__container.readonly{background-color:var(--bcm-new-ds-color-slate-50);cursor:default}.bcm-input__container.readonly .bcm-input-element{color:var(--bcm-new-ds-color-slate-600)}.bcm-input__container:not(.disabled):hover .caret-container,.bcm-input__container:not(.disabled).focused .caret-container{opacity:1}.bcm-input__container:not(.disabled):hover .input-clear-button,.bcm-input__container:not(.disabled).focused .input-clear-button{opacity:1}.bcm-input__container:not(.disabled).focused{background-color:var(--bcm-new-ds-color-slate-50)}.bcm-input__container:not(.disabled):hover{border-color:var(--bcm-color-prime-blue-6)}.bcm-input__container.empty .input-clear-button{display:none}.bcm-input__container.invalid,.bcm-input__container.error{border-color:var(--bcm-new-ds-color-red-500)}.bcm-input__container .bcm-input-element{width:100%;color:var(--bcm-new-ds-color-slate-600);flex:1;border:none;background:transparent;box-shadow:unset;padding:0 4px;font-family:\"Inter\", sans-serif;cursor:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bcm-input__container .bcm-input-element::placeholder{font-family:\"Inter\", sans-serif;color:var(--bcm-new-ds-color-slate-300);user-select:none}.bcm-input__container .bcm-input-element::-webkit-search-decoration,.bcm-input__container .bcm-input-element::-webkit-search-cancel-button,.bcm-input__container .bcm-input-element::-webkit-search-results-button,.bcm-input__container .bcm-input-element::-webkit-search-results-decoration,.bcm-input__container .bcm-input-element::-webkit-calendar-picker-indicator,.bcm-input__container .bcm-input-element::-webkit-inner-spin-button,.bcm-input__container .bcm-input-element::-webkit-outer-spin-button{-webkit-appearance:none}.bcm-input__container .caret-container{width:30px;display:flex;flex-direction:column;justify-content:center;align-items:stretch;border-left:1px solid #D9D9D9;transition:0.2s opacity;user-select:none;box-sizing:border-box}.bcm-input__container .caret-container .bcm-input-caret{display:flex;align-items:center;justify-content:center;color:var(--bcm-color-grey-7);cursor:pointer;flex:1}.bcm-input__container .caret-container .bcm-input-caret bcm-icon{line-height:1}.bcm-input__container .caret-container .bcm-input-caret:hover{color:var(--bcm-color-prime-blue-6)}.bcm-input__container .caret-container .bcm-input-caret:active{background-color:var(--bcm-color-grey-3)}.bcm-input__container .caret-container .bcm-input-caret:last-child{border-top:1px solid #D9D9D9}.bcm-input__container .caret-container.disabled{background-color:var(--bcm-color-grey-3)}.bcm-input__container .caret-container.disabled .bcm-input-caret{cursor:not-allowed}.bcm-input__container .input-suffix-content{display:flex;align-items:center;justify-content:center}.bcm-input__container .input-prefix:not(:empty){padding-left:4px}.bcm-input__container .input-suffix:not(:empty){min-width:24px;padding-right:4px}.bcm-input__container .input-prefix:not(:empty),.bcm-input__container .input-suffix:not(:empty){display:flex;align-items:center;justify-content:center;cursor:default;color:#64748a}.bcm-input__container .input-prefix:not(:empty) .unit-prefix,.bcm-input__container .input-suffix:not(:empty) .unit-prefix{color:#64748a}.bcm-input__container .input-prefix-button:not(:empty),.bcm-input__container .input-suffix-button:not(:empty){cursor:pointer}.bcm-input__container .caret-container,.bcm-input__container .input-clear-button{opacity:0}.bcm-input__container--small{font-size:12px}.bcm-input__container--medium{font-size:14px}.bcm-input__container--large{font-size:16px}.bcm-input__textarea .bcm-input-element{white-space:normal}.bcm-input__textarea.clearable .bcm-input-element{padding-right:24px}.bcm-input__textarea .input-clear-button{position:absolute;top:4px;right:0}";
2350
+
2351
+ const BcmSearch = class {
2352
+ constructor(hostRef) {
2353
+ registerInstance(this, hostRef);
2354
+ this.bcmOnSearch = createEvent(this, "bcm-on-search", 7);
2355
+ this.bcmOnSearchClear = createEvent(this, "bcm-on-search-clear", 7);
2356
+ this.debounceHandler = Generate.debounceInput((event) => this.onSearchValue(event, this), 300, false, () => {
2357
+ var _a, _b;
2358
+ this.isActiveClearable = ((_b = (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.length) > 0 && this.clearable;
2359
+ });
2360
+ this._id = Generate.UID();
2361
+ this.placeholder = "Search";
2362
+ this.disabled = false;
2363
+ this.readonly = false;
2364
+ this.clearable = true;
2365
+ this.size = Bcm.Size.medium;
2366
+ this.limit = 10;
2367
+ this.searchIsOnlyChilds = false;
2368
+ this.minSearchLength = 2;
2369
+ this.data = [];
2370
+ this.tick = {};
2371
+ this.isActiveClearable = false;
2372
+ }
2373
+ async componentDidLoad() {
2374
+ await this.initState();
2375
+ }
2376
+ async dataChanged(newValue, oldValue) {
2377
+ // console.log('data changed', newValue, oldValue)
2378
+ if (newValue !== oldValue) {
2379
+ await this.initState();
2380
+ }
2381
+ }
2382
+ async initState() {
2383
+ await searchState.setValue({
2384
+ id: this._id + "-input",
2385
+ dataSource: this.data,
2386
+ searchIsOnlyChilds: this.searchIsOnlyChilds,
2387
+ });
2388
+ await this.markForCheck();
2389
+ }
2390
+ markForCheck() {
2391
+ this.tick = Generate.UID();
2392
+ }
2393
+ handleInput() {
2394
+ // console.log("aheyya")
2395
+ }
2396
+ async onBcmFocus() {
2397
+ this.inputElement.focus();
2398
+ }
2399
+ async onBcmBlur() {
2400
+ this.inputElement.blur();
2401
+ }
2402
+ async onBcmSelect() {
2403
+ this.inputElement.select();
2404
+ }
2405
+ async setValue(newValue) {
2406
+ this.inputElement.value = newValue;
2407
+ }
2408
+ handleFocus() { }
2409
+ handleBlur() { }
2410
+ handleChange() { }
2411
+ async handleClear(eventEmit = true) {
2412
+ this.inputElement.value = '';
2413
+ const { value, id } = this.inputElement;
2414
+ searchState.searchData(id, value);
2415
+ this.isActiveClearable = false;
2416
+ this.bcmOnSearch.emit({ result: null, value: null, matching: null, parentIndex: null });
2417
+ this.bcmOnSearchClear.emit(eventEmit);
2418
+ await delay(10);
2419
+ return Promise.resolve();
2420
+ }
2421
+ onSearchValue(event, instance) {
2422
+ const { value, id } = event.target;
2423
+ const searchResult = (value === null || value === void 0 ? void 0 : value.length) >= this.minSearchLength ? searchState.searchData(id, value, null) : null;
2424
+ const { bcmOnSearch, inputElement } = instance;
2425
+ bcmOnSearch.emit({ result: searchResult === null || searchResult === void 0 ? void 0 : searchResult.result, value: inputElement === null || inputElement === void 0 ? void 0 : inputElement.value, matching: searchResult === null || searchResult === void 0 ? void 0 : searchResult.matching, parentIndex: searchResult === null || searchResult === void 0 ? void 0 : searchResult.parentIndex, nestedResult: searchResult === null || searchResult === void 0 ? void 0 : searchResult.nestedResult });
2426
+ }
2427
+ render() {
2428
+ const { _id, placeholder, disabled, readonly } = this;
2429
+ return h$1(Host, { onClick: () => { this.onBcmFocus(); this.onBcmSelect(); } }, h$1(InputTemplate, { size: this.size, id: _id, type: "search", placeholder: placeholder, disabled: disabled, "full-width": true, readonly: readonly, clearable: this.isActiveClearable, handleFocus: () => this.handleFocus(), handleBlur: () => this.handleBlur(), handleChange: () => this.handleChange(), handleClear: () => this.handleClear(), handleInput: this.debounceHandler, ref: (el) => this.inputElement = el }));
2430
+ }
2431
+ get el() { return getElement(this); }
2432
+ static get watchers() { return {
2433
+ "data": ["dataChanged"]
2434
+ }; }
2435
+ };
2436
+ BcmSearch.style = searchCss;
2437
+
2438
+ export { BcmRcOverflow as bcm_rc_overflow, BcmSearch as bcm_search };