@sankhyalabs/ezui 5.22.0-dev.84 → 5.22.0-dev.86

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 (187) hide show
  1. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
  2. package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-alert.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-badge.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-card-item_2.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-chip.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-combo-box.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +2 -2
  16. package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
  17. package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
  18. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-double-list.cjs.entry.js +1 -1
  20. package/dist/cjs/ez-dropdown_2.cjs.entry.js +1 -1
  21. package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-filter-input.cjs.entry.js +1 -1
  23. package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
  24. package/dist/cjs/ez-form.cjs.entry.js +1 -1
  25. package/dist/cjs/ez-grid.cjs.entry.js +15 -5
  26. package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
  27. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  28. package/dist/cjs/ez-list.cjs.entry.js +1 -1
  29. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  30. package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
  31. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  32. package/dist/cjs/ez-multi-selection-list_2.cjs.entry.js +1584 -0
  33. package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
  34. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  35. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  36. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  37. package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
  38. package/dist/cjs/ez-search.cjs.entry.js +1 -1
  39. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
  40. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  41. package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
  42. package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
  43. package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
  44. package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
  45. package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
  46. package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
  47. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  48. package/dist/cjs/ez-tooltip.cjs.entry.js +1 -1
  49. package/dist/cjs/ez-tree.cjs.entry.js +1 -1
  50. package/dist/cjs/ez-upload.cjs.entry.js +1 -1
  51. package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
  52. package/dist/cjs/ezui.cjs.js +2 -2
  53. package/dist/cjs/filter-column.cjs.entry.js +3 -46
  54. package/dist/cjs/{index-9e5554cb.js → index-a7b0c73d.js} +2 -5
  55. package/dist/cjs/loader.cjs.js +2 -2
  56. package/dist/collection/collection-manifest.json +1 -0
  57. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
  58. package/dist/collection/components/ez-grid/ez-grid.css +7 -2
  59. package/dist/collection/components/ez-grid/ez-grid.js +12 -2
  60. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +2 -45
  61. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.css +1 -0
  62. package/dist/collection/components/ez-popover-plus/ez-popover-plus.css +67 -0
  63. package/dist/collection/components/ez-popover-plus/ez-popover-plus.js +465 -0
  64. package/dist/custom-elements/index.d.ts +6 -0
  65. package/dist/custom-elements/index.js +1424 -56
  66. package/dist/esm/ez-actions-button.entry.js +1 -1
  67. package/dist/esm/ez-alert-list.entry.js +1 -1
  68. package/dist/esm/ez-alert.entry.js +1 -1
  69. package/dist/esm/ez-application.entry.js +1 -1
  70. package/dist/esm/ez-badge.entry.js +1 -1
  71. package/dist/esm/ez-breadcrumb.entry.js +1 -1
  72. package/dist/esm/ez-button.entry.js +1 -1
  73. package/dist/esm/ez-calendar.entry.js +1 -1
  74. package/dist/esm/ez-card-item_2.entry.js +1 -1
  75. package/dist/esm/ez-chart.entry.js +1 -1
  76. package/dist/esm/ez-check.entry.js +1 -1
  77. package/dist/esm/ez-chip.entry.js +1 -1
  78. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  79. package/dist/esm/ez-combo-box.entry.js +1 -1
  80. package/dist/esm/ez-custom-form-input_2.entry.js +2 -2
  81. package/dist/esm/ez-date-input.entry.js +1 -1
  82. package/dist/esm/ez-date-time-input.entry.js +1 -1
  83. package/dist/esm/ez-dialog.entry.js +1 -1
  84. package/dist/esm/ez-double-list.entry.js +1 -1
  85. package/dist/esm/ez-dropdown_2.entry.js +1 -1
  86. package/dist/esm/ez-file-item.entry.js +1 -1
  87. package/dist/esm/ez-filter-input.entry.js +1 -1
  88. package/dist/esm/ez-form-view.entry.js +1 -1
  89. package/dist/esm/ez-form.entry.js +1 -1
  90. package/dist/esm/ez-grid.entry.js +15 -5
  91. package/dist/esm/ez-guide-navigator.entry.js +1 -1
  92. package/dist/esm/ez-icon.entry.js +1 -1
  93. package/dist/esm/ez-list.entry.js +1 -1
  94. package/dist/esm/ez-loading-bar.entry.js +1 -1
  95. package/dist/esm/ez-modal-container.entry.js +1 -1
  96. package/dist/esm/ez-modal.entry.js +1 -1
  97. package/dist/esm/ez-multi-selection-list_2.entry.js +1579 -0
  98. package/dist/esm/ez-number-input.entry.js +1 -1
  99. package/dist/esm/ez-popover.entry.js +1 -1
  100. package/dist/esm/ez-popup.entry.js +1 -1
  101. package/dist/esm/ez-radio-button.entry.js +1 -1
  102. package/dist/esm/ez-scroller_2.entry.js +1 -1
  103. package/dist/esm/ez-search.entry.js +1 -1
  104. package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
  105. package/dist/esm/ez-split-button.entry.js +1 -1
  106. package/dist/esm/ez-split-item.entry.js +1 -1
  107. package/dist/esm/ez-split-panel.entry.js +1 -1
  108. package/dist/esm/ez-tabselector.entry.js +1 -1
  109. package/dist/esm/ez-text-area.entry.js +1 -1
  110. package/dist/esm/ez-text-input.entry.js +1 -1
  111. package/dist/esm/ez-time-input.entry.js +1 -1
  112. package/dist/esm/ez-toast.entry.js +1 -1
  113. package/dist/esm/ez-tooltip.entry.js +1 -1
  114. package/dist/esm/ez-tree.entry.js +1 -1
  115. package/dist/esm/ez-upload.entry.js +1 -1
  116. package/dist/esm/ez-view-stack.entry.js +1 -1
  117. package/dist/esm/ezui.js +3 -3
  118. package/dist/esm/filter-column.entry.js +3 -46
  119. package/dist/esm/{index-5a720e56.js → index-baa5e267.js} +3 -5
  120. package/dist/esm/loader.js +3 -3
  121. package/dist/ezui/ezui.esm.js +1 -1
  122. package/dist/ezui/{p-e6b38ade.entry.js → p-0306dff7.entry.js} +1 -1
  123. package/dist/ezui/{p-91ccae0c.entry.js → p-09de35a2.entry.js} +1 -1
  124. package/dist/ezui/p-0fa52b0f.entry.js +1 -0
  125. package/dist/ezui/{p-92fbaf2b.entry.js → p-0faf71c5.entry.js} +1 -1
  126. package/dist/ezui/{p-5548c9ab.entry.js → p-16e612fc.entry.js} +1 -1
  127. package/dist/ezui/{p-b2f6bc0a.entry.js → p-17be134a.entry.js} +1 -1
  128. package/dist/ezui/{p-c96fbbef.entry.js → p-17de16e5.entry.js} +1 -1
  129. package/dist/ezui/{p-24b42f3d.entry.js → p-17eabf46.entry.js} +1 -1
  130. package/dist/ezui/{p-3885e66e.entry.js → p-1ad6c61b.entry.js} +1 -1
  131. package/dist/ezui/{p-81461d2f.entry.js → p-1e7a8633.entry.js} +1 -1
  132. package/dist/ezui/{p-6b51c9cc.entry.js → p-1f50fa05.entry.js} +1 -1
  133. package/dist/ezui/{p-cf33bc48.entry.js → p-20c024f7.entry.js} +1 -1
  134. package/dist/ezui/{p-e4c7eb39.js → p-23a36bb6.js} +2 -2
  135. package/dist/ezui/{p-6d31c43c.entry.js → p-2bb2a0c4.entry.js} +1 -1
  136. package/dist/ezui/{p-ca8936df.entry.js → p-2f45506d.entry.js} +1 -1
  137. package/dist/ezui/{p-b22889ea.entry.js → p-3429080c.entry.js} +1 -1
  138. package/dist/ezui/{p-d32125d1.entry.js → p-354abfe8.entry.js} +1 -1
  139. package/dist/ezui/{p-0378416a.entry.js → p-44caad9a.entry.js} +1 -1
  140. package/dist/ezui/{p-7567ccdd.entry.js → p-555c9018.entry.js} +1 -1
  141. package/dist/ezui/{p-3791d9c8.entry.js → p-556468d9.entry.js} +1 -1
  142. package/dist/ezui/{p-9066b0b0.entry.js → p-56fe5341.entry.js} +1 -1
  143. package/dist/ezui/{p-044d46d5.entry.js → p-5b205c80.entry.js} +1 -1
  144. package/dist/ezui/{p-6fc26622.entry.js → p-5ed81457.entry.js} +1 -1
  145. package/dist/ezui/{p-f1c2c19e.entry.js → p-650e4b6d.entry.js} +1 -1
  146. package/dist/ezui/{p-03b0ed5a.entry.js → p-65f471bc.entry.js} +1 -1
  147. package/dist/ezui/{p-6d8b3298.entry.js → p-6cdd3e0a.entry.js} +1 -1
  148. package/dist/ezui/{p-fc194825.entry.js → p-6e429cff.entry.js} +1 -1
  149. package/dist/ezui/{p-11bfeca3.entry.js → p-77a4bd35.entry.js} +1 -1
  150. package/dist/ezui/{p-4f7d3e72.entry.js → p-7a171eae.entry.js} +1 -1
  151. package/dist/ezui/{p-b13a9466.entry.js → p-7d2200b2.entry.js} +2 -2
  152. package/dist/ezui/{p-2069c78a.entry.js → p-7e677b7b.entry.js} +1 -1
  153. package/dist/ezui/{p-e18d9e6a.entry.js → p-7fdd479f.entry.js} +1 -1
  154. package/dist/ezui/{p-82fa4b09.entry.js → p-8df1ca33.entry.js} +1 -1
  155. package/dist/ezui/{p-a921e3e7.entry.js → p-990b4318.entry.js} +1 -1
  156. package/dist/ezui/{p-c2b20f78.entry.js → p-9f5fa3f9.entry.js} +1 -1
  157. package/dist/ezui/{p-0cfbbe82.entry.js → p-a4cee65d.entry.js} +1 -1
  158. package/dist/ezui/{p-dfca5946.entry.js → p-a80b1287.entry.js} +1 -1
  159. package/dist/ezui/{p-043b97b5.entry.js → p-ae098837.entry.js} +1 -1
  160. package/dist/ezui/{p-f30e0590.entry.js → p-b26f6c5b.entry.js} +1 -1
  161. package/dist/ezui/p-b555cb24.entry.js +1 -0
  162. package/dist/ezui/p-bc2f844e.entry.js +1 -0
  163. package/dist/ezui/{p-92748142.entry.js → p-c0d9c4f8.entry.js} +1 -1
  164. package/dist/ezui/{p-4818b8ce.entry.js → p-c1527804.entry.js} +1 -1
  165. package/dist/ezui/{p-b9282c79.entry.js → p-cb1535f7.entry.js} +1 -1
  166. package/dist/ezui/{p-f4da7e1e.entry.js → p-cf87aacb.entry.js} +1 -1
  167. package/dist/ezui/{p-5010315a.entry.js → p-d9548bdf.entry.js} +1 -1
  168. package/dist/ezui/{p-708b196e.entry.js → p-da1b4a38.entry.js} +1 -1
  169. package/dist/ezui/p-dc8b36c3.entry.js +1 -0
  170. package/dist/ezui/{p-bef7daac.entry.js → p-e347df9c.entry.js} +1 -1
  171. package/dist/ezui/{p-9e95bfeb.entry.js → p-e6a9041d.entry.js} +1 -1
  172. package/dist/ezui/{p-68b2e579.entry.js → p-ea54d056.entry.js} +1 -1
  173. package/dist/ezui/{p-44b39e81.entry.js → p-fa6732f2.entry.js} +1 -1
  174. package/dist/ezui/{p-e3f8660b.entry.js → p-fd0a19d6.entry.js} +1 -1
  175. package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +0 -11
  176. package/dist/types/components/ez-popover-plus/ez-popover-plus.d.ts +81 -0
  177. package/dist/types/components.d.ts +94 -0
  178. package/package.json +3 -3
  179. package/react/components.d.ts +1 -0
  180. package/react/components.js +1 -0
  181. package/react/components.js.map +1 -1
  182. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +0 -186
  183. package/dist/esm/ez-multi-selection-list.entry.js +0 -182
  184. package/dist/ezui/p-3af64edd.entry.js +0 -1
  185. package/dist/ezui/p-6ec40dec.entry.js +0 -1
  186. package/dist/ezui/p-b6241ea3.entry.js +0 -1
  187. package/dist/ezui/p-d1eb4b1b.entry.js +0 -1
@@ -0,0 +1,1579 @@
1
+ import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host, g as getElement } from './index-baa5e267.js';
2
+ import { ArrayUtils } from '@sankhyalabs/core';
3
+
4
+ const ezMultiSelectionListCss = ".sc-ez-multi-selection-list-h{--ez-check--outter-gap:0px;--ez-multi-selection-default-height:322px;display:block;width:304px;height:var(--ez-multi-selection-default-height);min-height:fit-content;max-height:calc(100vh - 350px)}.multi-selection__input.sc-ez-multi-selection-list{margin-bottom:var(--space--2xs, 8px)}.multi-selection__content-options.sc-ez-multi-selection-list{position:relative;left:-4px}.multi-selection__select-all.sc-ez-multi-selection-list{height:var(--space--xl);margin:0 var(--space--small, 6px)}.multi-selection__list.sc-ez-multi-selection-list{max-height:calc(100vh - 435px);overflow-y:auto;overflow-x:clip}.multi-selection__list.sc-ez-multi-selection-list::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
5
+
6
+ var ViewScenarios;
7
+ (function (ViewScenarios) {
8
+ ViewScenarios["DATASOURCE_RESULTS"] = "DATASOURCE_RESULTS";
9
+ ViewScenarios["DATASOURCE_RESULTS_EMPTY"] = "DATASOURCE_RESULTS_EMPTY";
10
+ ViewScenarios["DATASOURCE_INIT"] = "DATASOURCE_INIT";
11
+ ViewScenarios["OPTIONS_EMPTY"] = "OPTIONS_EMPTY";
12
+ ViewScenarios["OPTIONS"] = "OPTIONS";
13
+ })(ViewScenarios || (ViewScenarios = {}));
14
+ const EzMuiltiSelectionList = class {
15
+ constructor(hostRef) {
16
+ registerInstance(this, hostRef);
17
+ this.changeFilteredOptions = createEvent(this, "changeFilteredOptions", 7);
18
+ this.columnName = undefined;
19
+ this.dataSource = undefined;
20
+ this.useOptions = false;
21
+ this.options = undefined;
22
+ this.isTextSearch = false;
23
+ this.filteredOptions = undefined;
24
+ this.displayOptions = undefined;
25
+ this.viewScenario = undefined;
26
+ this.displayOptionToCheckAllItems = true;
27
+ }
28
+ async clearFilteredOptions() {
29
+ this.setInitialScenario();
30
+ this.filteredOptions = [];
31
+ if (this.searchInput) {
32
+ this.searchInput.value = '';
33
+ }
34
+ if (this.filterInput) {
35
+ this.filterInput.value = '';
36
+ }
37
+ }
38
+ onChangeUseOptions() {
39
+ this.setInitialScenario();
40
+ }
41
+ onChangeOptions() {
42
+ if (this.options) {
43
+ this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.options);
44
+ }
45
+ this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
46
+ this.setInitialScenario();
47
+ }
48
+ onChangeFilteredOptions(optionsListUpdated) {
49
+ this.displayOptions = this.filteredOptions;
50
+ this.displayOptionToCheckAllItems = this.filteredOptions.length > 1;
51
+ this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
52
+ this.changeFilteredOptions.emit(optionsListUpdated);
53
+ }
54
+ componentDidRender() {
55
+ this.changeCheckAllValeuFromFilteredOptions();
56
+ }
57
+ ordenationByCheckStateAndAlphabetically(filteredOptions) {
58
+ const listWithSelectChecked = [];
59
+ const listWithNotSelectChecked = [];
60
+ let emptyElement;
61
+ filteredOptions.forEach(item => {
62
+ if (item.value == undefined || item.label === "") {
63
+ emptyElement = Object.assign(Object.assign({}, item), { label: "(Vazio)" });
64
+ }
65
+ else {
66
+ (item.check ? listWithSelectChecked.push(item) : listWithNotSelectChecked.push(item));
67
+ }
68
+ });
69
+ return (emptyElement == undefined ? [] : [emptyElement])
70
+ .concat(this.dataSource == undefined ? ArrayUtils.sortAlphabetically(listWithSelectChecked) : this.dataSource.sortItems(this.columnName, listWithSelectChecked))
71
+ .concat(this.dataSource == undefined ? ArrayUtils.sortAlphabetically(listWithNotSelectChecked) : this.dataSource.sortItems(this.columnName, listWithNotSelectChecked));
72
+ }
73
+ changeCheckAllValeuFromFilteredOptions() {
74
+ var _a, _b, _c, _d;
75
+ const selectAll = (_a = this.filteredOptions) === null || _a === void 0 ? void 0 : _a.every(item => item.check === true);
76
+ const notSelectAll = (_b = this.filteredOptions) === null || _b === void 0 ? void 0 : _b.every(item => item.check === false);
77
+ const selectIndeterminated = ((_c = this.filteredOptions) === null || _c === void 0 ? void 0 : _c.some(item => item.check === false)) && ((_d = this.filteredOptions) === null || _d === void 0 ? void 0 : _d.some(item => item.check === true)) && (!selectAll || !notSelectAll);
78
+ if (this.checkInput && selectAll) {
79
+ this.checkInput.indeterminate = false;
80
+ this.checkInput.value = true;
81
+ return;
82
+ }
83
+ if (this.checkInput && selectIndeterminated) {
84
+ this.checkInput.indeterminate = true;
85
+ this.checkInput.value = false;
86
+ return;
87
+ }
88
+ if (this.checkInput && notSelectAll) {
89
+ this.checkInput.indeterminate = false;
90
+ this.checkInput.value = false;
91
+ return;
92
+ }
93
+ }
94
+ setInitialScenario() {
95
+ if (this.useOptions) {
96
+ this.viewScenario = ViewScenarios.OPTIONS;
97
+ this.changeCheckAllValeuFromFilteredOptions();
98
+ return;
99
+ }
100
+ this.viewScenario = this.options && this.options.length > 0 ? ViewScenarios.DATASOURCE_RESULTS : ViewScenarios.DATASOURCE_INIT;
101
+ }
102
+ async searchWithDataSource(searchArgument, fieldName) {
103
+ const { argument, mode } = searchArgument;
104
+ if (mode !== 'PRELOAD' && fieldName) {
105
+ return this.dataSource.fetchData(argument, fieldName);
106
+ }
107
+ }
108
+ handleSearchOnDataSource(event) {
109
+ var _a;
110
+ const optionsToSort = (_a = this.filteredOptions) !== null && _a !== void 0 ? _a : [];
111
+ if (event.detail && !optionsToSort.some(item => item.value == event.detail.value)) {
112
+ this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([...optionsToSort, event.detail]);
113
+ }
114
+ this.viewScenario = ViewScenarios.DATASOURCE_RESULTS;
115
+ this.searchInput.value = "";
116
+ }
117
+ handleRemoveItemFromOptions(item) {
118
+ this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter(i => i.value !== item.value));
119
+ if (this.filteredOptions.length === 0) {
120
+ this.viewScenario = ViewScenarios.DATASOURCE_INIT;
121
+ }
122
+ if (this.searchInput) {
123
+ this.searchInput.value = '';
124
+ }
125
+ }
126
+ handleSearchOnOption(event) {
127
+ if (event.detail) {
128
+ this.displayOptions = ArrayUtils.applyStringFilter(event.detail, this.filteredOptions, true);
129
+ this.viewScenario = this.displayOptions.length === 0 ? ViewScenarios.OPTIONS_EMPTY : ViewScenarios.OPTIONS;
130
+ return;
131
+ }
132
+ this.displayOptions = this.filteredOptions;
133
+ this.viewScenario = ViewScenarios.OPTIONS;
134
+ }
135
+ handleChangeSelectAllItems(event) {
136
+ this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([
137
+ ...this.filteredOptions.map(item => {
138
+ item.check = !!event.detail;
139
+ return item;
140
+ }),
141
+ ]);
142
+ }
143
+ handleChangeSelectedItem(event) {
144
+ const { detail: itemCheckSelected } = event;
145
+ const itemSelected = this.filteredOptions.find(item => item.label === itemCheckSelected.label);
146
+ itemSelected.check = itemCheckSelected.check;
147
+ }
148
+ buildViewList(hasDelete) {
149
+ return (h(Fragment, null, this.displayOptionToCheckAllItems && (h("ez-check", { ref: (element) => (this.checkInput = element), label: "Selecionar todos", class: "multi-selection__select-all", onEzChange: this.handleChangeSelectAllItems.bind(this) })), h("ez-list", { class: "multi-selection__list", dataSource: this.displayOptions, listMode: "check", hoverFeedback: true, onEzCheckChange: this.handleChangeSelectedItem.bind(this), itemSlotBuilder: hasDelete ? this.buildDeleteIconSlot.bind(this) : null })));
150
+ }
151
+ buildDeleteIconSlot(item) {
152
+ return h("ez-icon", { style: { cursor: 'pointer' }, iconName: "delete", onClick: () => this.handleRemoveItemFromOptions(item) });
153
+ }
154
+ buildInitViewWithDataSource() {
155
+ return h("multi-selection-box-message", { message: "Selecione os valores a serem filtrados atrav\u00E9s do campo de busca." });
156
+ }
157
+ buildViewEmptyResults() {
158
+ return h("multi-selection-box-message", { message: "Nenhum resultado encontrado." });
159
+ }
160
+ scenarioToDisplay(view) {
161
+ const scenarios = {
162
+ [ViewScenarios.DATASOURCE_INIT]: () => this.buildInitViewWithDataSource(),
163
+ [ViewScenarios.DATASOURCE_RESULTS]: () => this.buildViewList(true),
164
+ [ViewScenarios.DATASOURCE_RESULTS_EMPTY]: () => this.buildViewEmptyResults(),
165
+ [ViewScenarios.OPTIONS_EMPTY]: () => this.buildViewEmptyResults(),
166
+ [ViewScenarios.OPTIONS]: () => this.buildViewList(false),
167
+ };
168
+ const scenarioBuilder = scenarios[view];
169
+ return scenarioBuilder ? scenarioBuilder() : undefined;
170
+ }
171
+ render() {
172
+ return (h(Host, null, h("div", { class: "multi-selection" }, this.useOptions ? (h("ez-filter-input", { ref: (element) => (this.filterInput = element), label: `Buscar..`, onEzChange: this.handleSearchOnOption.bind(this) })) : (h("ez-search", { class: "multi-selection__input", label: `Buscar...`, ref: (element) => (this.searchInput = element), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, optionLoader: (search) => this.searchWithDataSource(search, this.columnName), onEzChange: this.handleSearchOnDataSource.bind(this), isTextSearch: this.isTextSearch })), h("ez-scroll", { class: "multi-selection__content-options" }, this.scenarioToDisplay(this.viewScenario)))));
173
+ }
174
+ static get watchers() { return {
175
+ "useOptions": ["onChangeUseOptions"],
176
+ "options": ["onChangeOptions"],
177
+ "filteredOptions": ["onChangeFilteredOptions"]
178
+ }; }
179
+ };
180
+ EzMuiltiSelectionList.style = ezMultiSelectionListCss;
181
+
182
+ /**
183
+ * Custom positioning reference element.
184
+ * @see https://floating-ui.com/docs/virtual-elements
185
+ */
186
+ const min = Math.min;
187
+ const max = Math.max;
188
+ const round = Math.round;
189
+ const createCoords = v => ({
190
+ x: v,
191
+ y: v
192
+ });
193
+ const oppositeSideMap = {
194
+ left: 'right',
195
+ right: 'left',
196
+ bottom: 'top',
197
+ top: 'bottom'
198
+ };
199
+ const oppositeAlignmentMap = {
200
+ start: 'end',
201
+ end: 'start'
202
+ };
203
+ function clamp(start, value, end) {
204
+ return max(start, min(value, end));
205
+ }
206
+ function evaluate(value, param) {
207
+ return typeof value === 'function' ? value(param) : value;
208
+ }
209
+ function getSide(placement) {
210
+ return placement.split('-')[0];
211
+ }
212
+ function getAlignment(placement) {
213
+ return placement.split('-')[1];
214
+ }
215
+ function getOppositeAxis(axis) {
216
+ return axis === 'x' ? 'y' : 'x';
217
+ }
218
+ function getAxisLength(axis) {
219
+ return axis === 'y' ? 'height' : 'width';
220
+ }
221
+ function getSideAxis(placement) {
222
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
223
+ }
224
+ function getAlignmentAxis(placement) {
225
+ return getOppositeAxis(getSideAxis(placement));
226
+ }
227
+ function getAlignmentSides(placement, rects, rtl) {
228
+ if (rtl === void 0) {
229
+ rtl = false;
230
+ }
231
+ const alignment = getAlignment(placement);
232
+ const alignmentAxis = getAlignmentAxis(placement);
233
+ const length = getAxisLength(alignmentAxis);
234
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
235
+ if (rects.reference[length] > rects.floating[length]) {
236
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
237
+ }
238
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
239
+ }
240
+ function getExpandedPlacements(placement) {
241
+ const oppositePlacement = getOppositePlacement(placement);
242
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
243
+ }
244
+ function getOppositeAlignmentPlacement(placement) {
245
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
246
+ }
247
+ function getSideList(side, isStart, rtl) {
248
+ const lr = ['left', 'right'];
249
+ const rl = ['right', 'left'];
250
+ const tb = ['top', 'bottom'];
251
+ const bt = ['bottom', 'top'];
252
+ switch (side) {
253
+ case 'top':
254
+ case 'bottom':
255
+ if (rtl) return isStart ? rl : lr;
256
+ return isStart ? lr : rl;
257
+ case 'left':
258
+ case 'right':
259
+ return isStart ? tb : bt;
260
+ default:
261
+ return [];
262
+ }
263
+ }
264
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
265
+ const alignment = getAlignment(placement);
266
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
267
+ if (alignment) {
268
+ list = list.map(side => side + "-" + alignment);
269
+ if (flipAlignment) {
270
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
271
+ }
272
+ }
273
+ return list;
274
+ }
275
+ function getOppositePlacement(placement) {
276
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
277
+ }
278
+ function expandPaddingObject(padding) {
279
+ return {
280
+ top: 0,
281
+ right: 0,
282
+ bottom: 0,
283
+ left: 0,
284
+ ...padding
285
+ };
286
+ }
287
+ function getPaddingObject(padding) {
288
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
289
+ top: padding,
290
+ right: padding,
291
+ bottom: padding,
292
+ left: padding
293
+ };
294
+ }
295
+ function rectToClientRect(rect) {
296
+ const {
297
+ x,
298
+ y,
299
+ width,
300
+ height
301
+ } = rect;
302
+ return {
303
+ width,
304
+ height,
305
+ top: y,
306
+ left: x,
307
+ right: x + width,
308
+ bottom: y + height,
309
+ x,
310
+ y
311
+ };
312
+ }
313
+
314
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
315
+ let {
316
+ reference,
317
+ floating
318
+ } = _ref;
319
+ const sideAxis = getSideAxis(placement);
320
+ const alignmentAxis = getAlignmentAxis(placement);
321
+ const alignLength = getAxisLength(alignmentAxis);
322
+ const side = getSide(placement);
323
+ const isVertical = sideAxis === 'y';
324
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
325
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
326
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
327
+ let coords;
328
+ switch (side) {
329
+ case 'top':
330
+ coords = {
331
+ x: commonX,
332
+ y: reference.y - floating.height
333
+ };
334
+ break;
335
+ case 'bottom':
336
+ coords = {
337
+ x: commonX,
338
+ y: reference.y + reference.height
339
+ };
340
+ break;
341
+ case 'right':
342
+ coords = {
343
+ x: reference.x + reference.width,
344
+ y: commonY
345
+ };
346
+ break;
347
+ case 'left':
348
+ coords = {
349
+ x: reference.x - floating.width,
350
+ y: commonY
351
+ };
352
+ break;
353
+ default:
354
+ coords = {
355
+ x: reference.x,
356
+ y: reference.y
357
+ };
358
+ }
359
+ switch (getAlignment(placement)) {
360
+ case 'start':
361
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
362
+ break;
363
+ case 'end':
364
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
365
+ break;
366
+ }
367
+ return coords;
368
+ }
369
+
370
+ /**
371
+ * Computes the `x` and `y` coordinates that will place the floating element
372
+ * next to a given reference element.
373
+ *
374
+ * This export does not have any `platform` interface logic. You will need to
375
+ * write one for the platform you are using Floating UI with.
376
+ */
377
+ const computePosition$1 = async (reference, floating, config) => {
378
+ const {
379
+ placement = 'bottom',
380
+ strategy = 'absolute',
381
+ middleware = [],
382
+ platform
383
+ } = config;
384
+ const validMiddleware = middleware.filter(Boolean);
385
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
386
+ let rects = await platform.getElementRects({
387
+ reference,
388
+ floating,
389
+ strategy
390
+ });
391
+ let {
392
+ x,
393
+ y
394
+ } = computeCoordsFromPlacement(rects, placement, rtl);
395
+ let statefulPlacement = placement;
396
+ let middlewareData = {};
397
+ let resetCount = 0;
398
+ for (let i = 0; i < validMiddleware.length; i++) {
399
+ const {
400
+ name,
401
+ fn
402
+ } = validMiddleware[i];
403
+ const {
404
+ x: nextX,
405
+ y: nextY,
406
+ data,
407
+ reset
408
+ } = await fn({
409
+ x,
410
+ y,
411
+ initialPlacement: placement,
412
+ placement: statefulPlacement,
413
+ strategy,
414
+ middlewareData,
415
+ rects,
416
+ platform,
417
+ elements: {
418
+ reference,
419
+ floating
420
+ }
421
+ });
422
+ x = nextX != null ? nextX : x;
423
+ y = nextY != null ? nextY : y;
424
+ middlewareData = {
425
+ ...middlewareData,
426
+ [name]: {
427
+ ...middlewareData[name],
428
+ ...data
429
+ }
430
+ };
431
+ if (reset && resetCount <= 50) {
432
+ resetCount++;
433
+ if (typeof reset === 'object') {
434
+ if (reset.placement) {
435
+ statefulPlacement = reset.placement;
436
+ }
437
+ if (reset.rects) {
438
+ rects = reset.rects === true ? await platform.getElementRects({
439
+ reference,
440
+ floating,
441
+ strategy
442
+ }) : reset.rects;
443
+ }
444
+ ({
445
+ x,
446
+ y
447
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
448
+ }
449
+ i = -1;
450
+ }
451
+ }
452
+ return {
453
+ x,
454
+ y,
455
+ placement: statefulPlacement,
456
+ strategy,
457
+ middlewareData
458
+ };
459
+ };
460
+
461
+ /**
462
+ * Resolves with an object of overflow side offsets that determine how much the
463
+ * element is overflowing a given clipping boundary on each side.
464
+ * - positive = overflowing the boundary by that number of pixels
465
+ * - negative = how many pixels left before it will overflow
466
+ * - 0 = lies flush with the boundary
467
+ * @see https://floating-ui.com/docs/detectOverflow
468
+ */
469
+ async function detectOverflow(state, options) {
470
+ var _await$platform$isEle;
471
+ if (options === void 0) {
472
+ options = {};
473
+ }
474
+ const {
475
+ x,
476
+ y,
477
+ platform,
478
+ rects,
479
+ elements,
480
+ strategy
481
+ } = state;
482
+ const {
483
+ boundary = 'clippingAncestors',
484
+ rootBoundary = 'viewport',
485
+ elementContext = 'floating',
486
+ altBoundary = false,
487
+ padding = 0
488
+ } = evaluate(options, state);
489
+ const paddingObject = getPaddingObject(padding);
490
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
491
+ const element = elements[altBoundary ? altContext : elementContext];
492
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
493
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
494
+ boundary,
495
+ rootBoundary,
496
+ strategy
497
+ }));
498
+ const rect = elementContext === 'floating' ? {
499
+ x,
500
+ y,
501
+ width: rects.floating.width,
502
+ height: rects.floating.height
503
+ } : rects.reference;
504
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
505
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
506
+ x: 1,
507
+ y: 1
508
+ } : {
509
+ x: 1,
510
+ y: 1
511
+ };
512
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
513
+ elements,
514
+ rect,
515
+ offsetParent,
516
+ strategy
517
+ }) : rect);
518
+ return {
519
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
520
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
521
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
522
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
523
+ };
524
+ }
525
+
526
+ /**
527
+ * Optimizes the visibility of the floating element by flipping the `placement`
528
+ * in order to keep it in view when the preferred placement(s) will overflow the
529
+ * clipping boundary. Alternative to `autoPlacement`.
530
+ * @see https://floating-ui.com/docs/flip
531
+ */
532
+ const flip$1 = function (options) {
533
+ if (options === void 0) {
534
+ options = {};
535
+ }
536
+ return {
537
+ name: 'flip',
538
+ options,
539
+ async fn(state) {
540
+ var _middlewareData$arrow, _middlewareData$flip;
541
+ const {
542
+ placement,
543
+ middlewareData,
544
+ rects,
545
+ initialPlacement,
546
+ platform,
547
+ elements
548
+ } = state;
549
+ const {
550
+ mainAxis: checkMainAxis = true,
551
+ crossAxis: checkCrossAxis = true,
552
+ fallbackPlacements: specifiedFallbackPlacements,
553
+ fallbackStrategy = 'bestFit',
554
+ fallbackAxisSideDirection = 'none',
555
+ flipAlignment = true,
556
+ ...detectOverflowOptions
557
+ } = evaluate(options, state);
558
+
559
+ // If a reset by the arrow was caused due to an alignment offset being
560
+ // added, we should skip any logic now since `flip()` has already done its
561
+ // work.
562
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
563
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
564
+ return {};
565
+ }
566
+ const side = getSide(placement);
567
+ const initialSideAxis = getSideAxis(initialPlacement);
568
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
569
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
570
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
571
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
572
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
573
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
574
+ }
575
+ const placements = [initialPlacement, ...fallbackPlacements];
576
+ const overflow = await detectOverflow(state, detectOverflowOptions);
577
+ const overflows = [];
578
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
579
+ if (checkMainAxis) {
580
+ overflows.push(overflow[side]);
581
+ }
582
+ if (checkCrossAxis) {
583
+ const sides = getAlignmentSides(placement, rects, rtl);
584
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
585
+ }
586
+ overflowsData = [...overflowsData, {
587
+ placement,
588
+ overflows
589
+ }];
590
+
591
+ // One or more sides is overflowing.
592
+ if (!overflows.every(side => side <= 0)) {
593
+ var _middlewareData$flip2, _overflowsData$filter;
594
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
595
+ const nextPlacement = placements[nextIndex];
596
+ if (nextPlacement) {
597
+ // Try next placement and re-run the lifecycle.
598
+ return {
599
+ data: {
600
+ index: nextIndex,
601
+ overflows: overflowsData
602
+ },
603
+ reset: {
604
+ placement: nextPlacement
605
+ }
606
+ };
607
+ }
608
+
609
+ // First, find the candidates that fit on the mainAxis side of overflow,
610
+ // then find the placement that fits the best on the main crossAxis side.
611
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
612
+
613
+ // Otherwise fallback.
614
+ if (!resetPlacement) {
615
+ switch (fallbackStrategy) {
616
+ case 'bestFit':
617
+ {
618
+ var _overflowsData$filter2;
619
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
620
+ if (hasFallbackAxisSideDirection) {
621
+ const currentSideAxis = getSideAxis(d.placement);
622
+ return currentSideAxis === initialSideAxis ||
623
+ // Create a bias to the `y` side axis due to horizontal
624
+ // reading directions favoring greater width.
625
+ currentSideAxis === 'y';
626
+ }
627
+ return true;
628
+ }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
629
+ if (placement) {
630
+ resetPlacement = placement;
631
+ }
632
+ break;
633
+ }
634
+ case 'initialPlacement':
635
+ resetPlacement = initialPlacement;
636
+ break;
637
+ }
638
+ }
639
+ if (placement !== resetPlacement) {
640
+ return {
641
+ reset: {
642
+ placement: resetPlacement
643
+ }
644
+ };
645
+ }
646
+ }
647
+ return {};
648
+ }
649
+ };
650
+ };
651
+
652
+ /**
653
+ * Optimizes the visibility of the floating element by shifting it in order to
654
+ * keep it in view when it will overflow the clipping boundary.
655
+ * @see https://floating-ui.com/docs/shift
656
+ */
657
+ const shift$1 = function (options) {
658
+ if (options === void 0) {
659
+ options = {};
660
+ }
661
+ return {
662
+ name: 'shift',
663
+ options,
664
+ async fn(state) {
665
+ const {
666
+ x,
667
+ y,
668
+ placement
669
+ } = state;
670
+ const {
671
+ mainAxis: checkMainAxis = true,
672
+ crossAxis: checkCrossAxis = false,
673
+ limiter = {
674
+ fn: _ref => {
675
+ let {
676
+ x,
677
+ y
678
+ } = _ref;
679
+ return {
680
+ x,
681
+ y
682
+ };
683
+ }
684
+ },
685
+ ...detectOverflowOptions
686
+ } = evaluate(options, state);
687
+ const coords = {
688
+ x,
689
+ y
690
+ };
691
+ const overflow = await detectOverflow(state, detectOverflowOptions);
692
+ const crossAxis = getSideAxis(getSide(placement));
693
+ const mainAxis = getOppositeAxis(crossAxis);
694
+ let mainAxisCoord = coords[mainAxis];
695
+ let crossAxisCoord = coords[crossAxis];
696
+ if (checkMainAxis) {
697
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
698
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
699
+ const min = mainAxisCoord + overflow[minSide];
700
+ const max = mainAxisCoord - overflow[maxSide];
701
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
702
+ }
703
+ if (checkCrossAxis) {
704
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
705
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
706
+ const min = crossAxisCoord + overflow[minSide];
707
+ const max = crossAxisCoord - overflow[maxSide];
708
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
709
+ }
710
+ const limitedCoords = limiter.fn({
711
+ ...state,
712
+ [mainAxis]: mainAxisCoord,
713
+ [crossAxis]: crossAxisCoord
714
+ });
715
+ return {
716
+ ...limitedCoords,
717
+ data: {
718
+ x: limitedCoords.x - x,
719
+ y: limitedCoords.y - y,
720
+ enabled: {
721
+ [mainAxis]: checkMainAxis,
722
+ [crossAxis]: checkCrossAxis
723
+ }
724
+ }
725
+ };
726
+ }
727
+ };
728
+ };
729
+
730
+ function hasWindow() {
731
+ return typeof window !== 'undefined';
732
+ }
733
+ function getNodeName(node) {
734
+ if (isNode(node)) {
735
+ return (node.nodeName || '').toLowerCase();
736
+ }
737
+ // Mocked nodes in testing environments may not be instances of Node. By
738
+ // returning `#document` an infinite loop won't occur.
739
+ // https://github.com/floating-ui/floating-ui/issues/2317
740
+ return '#document';
741
+ }
742
+ function getWindow(node) {
743
+ var _node$ownerDocument;
744
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
745
+ }
746
+ function getDocumentElement(node) {
747
+ var _ref;
748
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
749
+ }
750
+ function isNode(value) {
751
+ if (!hasWindow()) {
752
+ return false;
753
+ }
754
+ return value instanceof Node || value instanceof getWindow(value).Node;
755
+ }
756
+ function isElement(value) {
757
+ if (!hasWindow()) {
758
+ return false;
759
+ }
760
+ return value instanceof Element || value instanceof getWindow(value).Element;
761
+ }
762
+ function isHTMLElement(value) {
763
+ if (!hasWindow()) {
764
+ return false;
765
+ }
766
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
767
+ }
768
+ function isShadowRoot(value) {
769
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
770
+ return false;
771
+ }
772
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
773
+ }
774
+ function isOverflowElement(element) {
775
+ const {
776
+ overflow,
777
+ overflowX,
778
+ overflowY,
779
+ display
780
+ } = getComputedStyle(element);
781
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
782
+ }
783
+ function isTableElement(element) {
784
+ return ['table', 'td', 'th'].includes(getNodeName(element));
785
+ }
786
+ function isTopLayer(element) {
787
+ return [':popover-open', ':modal'].some(selector => {
788
+ try {
789
+ return element.matches(selector);
790
+ } catch (e) {
791
+ return false;
792
+ }
793
+ });
794
+ }
795
+ function isContainingBlock(elementOrCss) {
796
+ const webkit = isWebKit();
797
+ const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
798
+
799
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
800
+ return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
801
+ }
802
+ function getContainingBlock(element) {
803
+ let currentNode = getParentNode(element);
804
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
805
+ if (isContainingBlock(currentNode)) {
806
+ return currentNode;
807
+ } else if (isTopLayer(currentNode)) {
808
+ return null;
809
+ }
810
+ currentNode = getParentNode(currentNode);
811
+ }
812
+ return null;
813
+ }
814
+ function isWebKit() {
815
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
816
+ return CSS.supports('-webkit-backdrop-filter', 'none');
817
+ }
818
+ function isLastTraversableNode(node) {
819
+ return ['html', 'body', '#document'].includes(getNodeName(node));
820
+ }
821
+ function getComputedStyle(element) {
822
+ return getWindow(element).getComputedStyle(element);
823
+ }
824
+ function getNodeScroll(element) {
825
+ if (isElement(element)) {
826
+ return {
827
+ scrollLeft: element.scrollLeft,
828
+ scrollTop: element.scrollTop
829
+ };
830
+ }
831
+ return {
832
+ scrollLeft: element.scrollX,
833
+ scrollTop: element.scrollY
834
+ };
835
+ }
836
+ function getParentNode(node) {
837
+ if (getNodeName(node) === 'html') {
838
+ return node;
839
+ }
840
+ const result =
841
+ // Step into the shadow DOM of the parent of a slotted node.
842
+ node.assignedSlot ||
843
+ // DOM Element detected.
844
+ node.parentNode ||
845
+ // ShadowRoot detected.
846
+ isShadowRoot(node) && node.host ||
847
+ // Fallback.
848
+ getDocumentElement(node);
849
+ return isShadowRoot(result) ? result.host : result;
850
+ }
851
+ function getNearestOverflowAncestor(node) {
852
+ const parentNode = getParentNode(node);
853
+ if (isLastTraversableNode(parentNode)) {
854
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
855
+ }
856
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
857
+ return parentNode;
858
+ }
859
+ return getNearestOverflowAncestor(parentNode);
860
+ }
861
+ function getOverflowAncestors(node, list, traverseIframes) {
862
+ var _node$ownerDocument2;
863
+ if (list === void 0) {
864
+ list = [];
865
+ }
866
+ if (traverseIframes === void 0) {
867
+ traverseIframes = true;
868
+ }
869
+ const scrollableAncestor = getNearestOverflowAncestor(node);
870
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
871
+ const win = getWindow(scrollableAncestor);
872
+ if (isBody) {
873
+ const frameElement = getFrameElement(win);
874
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
875
+ }
876
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
877
+ }
878
+ function getFrameElement(win) {
879
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
880
+ }
881
+
882
+ function getCssDimensions(element) {
883
+ const css = getComputedStyle(element);
884
+ // In testing environments, the `width` and `height` properties are empty
885
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
886
+ let width = parseFloat(css.width) || 0;
887
+ let height = parseFloat(css.height) || 0;
888
+ const hasOffset = isHTMLElement(element);
889
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
890
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
891
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
892
+ if (shouldFallback) {
893
+ width = offsetWidth;
894
+ height = offsetHeight;
895
+ }
896
+ return {
897
+ width,
898
+ height,
899
+ $: shouldFallback
900
+ };
901
+ }
902
+
903
+ function unwrapElement(element) {
904
+ return !isElement(element) ? element.contextElement : element;
905
+ }
906
+
907
+ function getScale(element) {
908
+ const domElement = unwrapElement(element);
909
+ if (!isHTMLElement(domElement)) {
910
+ return createCoords(1);
911
+ }
912
+ const rect = domElement.getBoundingClientRect();
913
+ const {
914
+ width,
915
+ height,
916
+ $
917
+ } = getCssDimensions(domElement);
918
+ let x = ($ ? round(rect.width) : rect.width) / width;
919
+ let y = ($ ? round(rect.height) : rect.height) / height;
920
+
921
+ // 0, NaN, or Infinity should always fallback to 1.
922
+
923
+ if (!x || !Number.isFinite(x)) {
924
+ x = 1;
925
+ }
926
+ if (!y || !Number.isFinite(y)) {
927
+ y = 1;
928
+ }
929
+ return {
930
+ x,
931
+ y
932
+ };
933
+ }
934
+
935
+ const noOffsets = /*#__PURE__*/createCoords(0);
936
+ function getVisualOffsets(element) {
937
+ const win = getWindow(element);
938
+ if (!isWebKit() || !win.visualViewport) {
939
+ return noOffsets;
940
+ }
941
+ return {
942
+ x: win.visualViewport.offsetLeft,
943
+ y: win.visualViewport.offsetTop
944
+ };
945
+ }
946
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
947
+ if (isFixed === void 0) {
948
+ isFixed = false;
949
+ }
950
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
951
+ return false;
952
+ }
953
+ return isFixed;
954
+ }
955
+
956
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
957
+ if (includeScale === void 0) {
958
+ includeScale = false;
959
+ }
960
+ if (isFixedStrategy === void 0) {
961
+ isFixedStrategy = false;
962
+ }
963
+ const clientRect = element.getBoundingClientRect();
964
+ const domElement = unwrapElement(element);
965
+ let scale = createCoords(1);
966
+ if (includeScale) {
967
+ if (offsetParent) {
968
+ if (isElement(offsetParent)) {
969
+ scale = getScale(offsetParent);
970
+ }
971
+ } else {
972
+ scale = getScale(element);
973
+ }
974
+ }
975
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
976
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
977
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
978
+ let width = clientRect.width / scale.x;
979
+ let height = clientRect.height / scale.y;
980
+ if (domElement) {
981
+ const win = getWindow(domElement);
982
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
983
+ let currentWin = win;
984
+ let currentIFrame = getFrameElement(currentWin);
985
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
986
+ const iframeScale = getScale(currentIFrame);
987
+ const iframeRect = currentIFrame.getBoundingClientRect();
988
+ const css = getComputedStyle(currentIFrame);
989
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
990
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
991
+ x *= iframeScale.x;
992
+ y *= iframeScale.y;
993
+ width *= iframeScale.x;
994
+ height *= iframeScale.y;
995
+ x += left;
996
+ y += top;
997
+ currentWin = getWindow(currentIFrame);
998
+ currentIFrame = getFrameElement(currentWin);
999
+ }
1000
+ }
1001
+ return rectToClientRect({
1002
+ width,
1003
+ height,
1004
+ x,
1005
+ y
1006
+ });
1007
+ }
1008
+
1009
+ // If <html> has a CSS width greater than the viewport, then this will be
1010
+ // incorrect for RTL.
1011
+ function getWindowScrollBarX(element, rect) {
1012
+ const leftScroll = getNodeScroll(element).scrollLeft;
1013
+ if (!rect) {
1014
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1015
+ }
1016
+ return rect.left + leftScroll;
1017
+ }
1018
+
1019
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
1020
+ if (ignoreScrollbarX === void 0) {
1021
+ ignoreScrollbarX = false;
1022
+ }
1023
+ const htmlRect = documentElement.getBoundingClientRect();
1024
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
1025
+ // RTL <body> scrollbar.
1026
+ getWindowScrollBarX(documentElement, htmlRect));
1027
+ const y = htmlRect.top + scroll.scrollTop;
1028
+ return {
1029
+ x,
1030
+ y
1031
+ };
1032
+ }
1033
+
1034
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1035
+ let {
1036
+ elements,
1037
+ rect,
1038
+ offsetParent,
1039
+ strategy
1040
+ } = _ref;
1041
+ const isFixed = strategy === 'fixed';
1042
+ const documentElement = getDocumentElement(offsetParent);
1043
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1044
+ if (offsetParent === documentElement || topLayer && isFixed) {
1045
+ return rect;
1046
+ }
1047
+ let scroll = {
1048
+ scrollLeft: 0,
1049
+ scrollTop: 0
1050
+ };
1051
+ let scale = createCoords(1);
1052
+ const offsets = createCoords(0);
1053
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1054
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1055
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1056
+ scroll = getNodeScroll(offsetParent);
1057
+ }
1058
+ if (isHTMLElement(offsetParent)) {
1059
+ const offsetRect = getBoundingClientRect(offsetParent);
1060
+ scale = getScale(offsetParent);
1061
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1062
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1063
+ }
1064
+ }
1065
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
1066
+ return {
1067
+ width: rect.width * scale.x,
1068
+ height: rect.height * scale.y,
1069
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1070
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1071
+ };
1072
+ }
1073
+
1074
+ function getClientRects(element) {
1075
+ return Array.from(element.getClientRects());
1076
+ }
1077
+
1078
+ // Gets the entire size of the scrollable document area, even extending outside
1079
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1080
+ function getDocumentRect(element) {
1081
+ const html = getDocumentElement(element);
1082
+ const scroll = getNodeScroll(element);
1083
+ const body = element.ownerDocument.body;
1084
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1085
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1086
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1087
+ const y = -scroll.scrollTop;
1088
+ if (getComputedStyle(body).direction === 'rtl') {
1089
+ x += max(html.clientWidth, body.clientWidth) - width;
1090
+ }
1091
+ return {
1092
+ width,
1093
+ height,
1094
+ x,
1095
+ y
1096
+ };
1097
+ }
1098
+
1099
+ function getViewportRect(element, strategy) {
1100
+ const win = getWindow(element);
1101
+ const html = getDocumentElement(element);
1102
+ const visualViewport = win.visualViewport;
1103
+ let width = html.clientWidth;
1104
+ let height = html.clientHeight;
1105
+ let x = 0;
1106
+ let y = 0;
1107
+ if (visualViewport) {
1108
+ width = visualViewport.width;
1109
+ height = visualViewport.height;
1110
+ const visualViewportBased = isWebKit();
1111
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1112
+ x = visualViewport.offsetLeft;
1113
+ y = visualViewport.offsetTop;
1114
+ }
1115
+ }
1116
+ return {
1117
+ width,
1118
+ height,
1119
+ x,
1120
+ y
1121
+ };
1122
+ }
1123
+
1124
+ // Returns the inner client rect, subtracting scrollbars if present.
1125
+ function getInnerBoundingClientRect(element, strategy) {
1126
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1127
+ const top = clientRect.top + element.clientTop;
1128
+ const left = clientRect.left + element.clientLeft;
1129
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1130
+ const width = element.clientWidth * scale.x;
1131
+ const height = element.clientHeight * scale.y;
1132
+ const x = left * scale.x;
1133
+ const y = top * scale.y;
1134
+ return {
1135
+ width,
1136
+ height,
1137
+ x,
1138
+ y
1139
+ };
1140
+ }
1141
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1142
+ let rect;
1143
+ if (clippingAncestor === 'viewport') {
1144
+ rect = getViewportRect(element, strategy);
1145
+ } else if (clippingAncestor === 'document') {
1146
+ rect = getDocumentRect(getDocumentElement(element));
1147
+ } else if (isElement(clippingAncestor)) {
1148
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1149
+ } else {
1150
+ const visualOffsets = getVisualOffsets(element);
1151
+ rect = {
1152
+ x: clippingAncestor.x - visualOffsets.x,
1153
+ y: clippingAncestor.y - visualOffsets.y,
1154
+ width: clippingAncestor.width,
1155
+ height: clippingAncestor.height
1156
+ };
1157
+ }
1158
+ return rectToClientRect(rect);
1159
+ }
1160
+ function hasFixedPositionAncestor(element, stopNode) {
1161
+ const parentNode = getParentNode(element);
1162
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1163
+ return false;
1164
+ }
1165
+ return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1166
+ }
1167
+
1168
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1169
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1170
+ // of the given element up the tree.
1171
+ function getClippingElementAncestors(element, cache) {
1172
+ const cachedResult = cache.get(element);
1173
+ if (cachedResult) {
1174
+ return cachedResult;
1175
+ }
1176
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1177
+ let currentContainingBlockComputedStyle = null;
1178
+ const elementIsFixed = getComputedStyle(element).position === 'fixed';
1179
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1180
+
1181
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1182
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1183
+ const computedStyle = getComputedStyle(currentNode);
1184
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1185
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1186
+ currentContainingBlockComputedStyle = null;
1187
+ }
1188
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1189
+ if (shouldDropCurrentNode) {
1190
+ // Drop non-containing blocks.
1191
+ result = result.filter(ancestor => ancestor !== currentNode);
1192
+ } else {
1193
+ // Record last containing block for next iteration.
1194
+ currentContainingBlockComputedStyle = computedStyle;
1195
+ }
1196
+ currentNode = getParentNode(currentNode);
1197
+ }
1198
+ cache.set(element, result);
1199
+ return result;
1200
+ }
1201
+
1202
+ // Gets the maximum area that the element is visible in due to any number of
1203
+ // clipping ancestors.
1204
+ function getClippingRect(_ref) {
1205
+ let {
1206
+ element,
1207
+ boundary,
1208
+ rootBoundary,
1209
+ strategy
1210
+ } = _ref;
1211
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1212
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1213
+ const firstClippingAncestor = clippingAncestors[0];
1214
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1215
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1216
+ accRect.top = max(rect.top, accRect.top);
1217
+ accRect.right = min(rect.right, accRect.right);
1218
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1219
+ accRect.left = max(rect.left, accRect.left);
1220
+ return accRect;
1221
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1222
+ return {
1223
+ width: clippingRect.right - clippingRect.left,
1224
+ height: clippingRect.bottom - clippingRect.top,
1225
+ x: clippingRect.left,
1226
+ y: clippingRect.top
1227
+ };
1228
+ }
1229
+
1230
+ function getDimensions(element) {
1231
+ const {
1232
+ width,
1233
+ height
1234
+ } = getCssDimensions(element);
1235
+ return {
1236
+ width,
1237
+ height
1238
+ };
1239
+ }
1240
+
1241
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1242
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1243
+ const documentElement = getDocumentElement(offsetParent);
1244
+ const isFixed = strategy === 'fixed';
1245
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1246
+ let scroll = {
1247
+ scrollLeft: 0,
1248
+ scrollTop: 0
1249
+ };
1250
+ const offsets = createCoords(0);
1251
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1252
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1253
+ scroll = getNodeScroll(offsetParent);
1254
+ }
1255
+ if (isOffsetParentAnElement) {
1256
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1257
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1258
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1259
+ } else if (documentElement) {
1260
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1261
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1262
+ offsets.x = getWindowScrollBarX(documentElement);
1263
+ }
1264
+ }
1265
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1266
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1267
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1268
+ return {
1269
+ x,
1270
+ y,
1271
+ width: rect.width,
1272
+ height: rect.height
1273
+ };
1274
+ }
1275
+
1276
+ function isStaticPositioned(element) {
1277
+ return getComputedStyle(element).position === 'static';
1278
+ }
1279
+
1280
+ function getTrueOffsetParent(element, polyfill) {
1281
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1282
+ return null;
1283
+ }
1284
+ if (polyfill) {
1285
+ return polyfill(element);
1286
+ }
1287
+ let rawOffsetParent = element.offsetParent;
1288
+
1289
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
1290
+ // while Chrome and Safari return the <body> element. The <body> element must
1291
+ // be used to perform the correct calculations even if the <html> element is
1292
+ // non-static.
1293
+ if (getDocumentElement(element) === rawOffsetParent) {
1294
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1295
+ }
1296
+ return rawOffsetParent;
1297
+ }
1298
+
1299
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1300
+ // such as table ancestors and cross browser bugs.
1301
+ function getOffsetParent(element, polyfill) {
1302
+ const win = getWindow(element);
1303
+ if (isTopLayer(element)) {
1304
+ return win;
1305
+ }
1306
+ if (!isHTMLElement(element)) {
1307
+ let svgOffsetParent = getParentNode(element);
1308
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1309
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1310
+ return svgOffsetParent;
1311
+ }
1312
+ svgOffsetParent = getParentNode(svgOffsetParent);
1313
+ }
1314
+ return win;
1315
+ }
1316
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1317
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1318
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1319
+ }
1320
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1321
+ return win;
1322
+ }
1323
+ return offsetParent || getContainingBlock(element) || win;
1324
+ }
1325
+
1326
+ const getElementRects = async function (data) {
1327
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1328
+ const getDimensionsFn = this.getDimensions;
1329
+ const floatingDimensions = await getDimensionsFn(data.floating);
1330
+ return {
1331
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1332
+ floating: {
1333
+ x: 0,
1334
+ y: 0,
1335
+ width: floatingDimensions.width,
1336
+ height: floatingDimensions.height
1337
+ }
1338
+ };
1339
+ };
1340
+
1341
+ function isRTL(element) {
1342
+ return getComputedStyle(element).direction === 'rtl';
1343
+ }
1344
+
1345
+ const platform = {
1346
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1347
+ getDocumentElement,
1348
+ getClippingRect,
1349
+ getOffsetParent,
1350
+ getElementRects,
1351
+ getClientRects,
1352
+ getDimensions,
1353
+ getScale,
1354
+ isElement,
1355
+ isRTL
1356
+ };
1357
+
1358
+ /**
1359
+ * Optimizes the visibility of the floating element by shifting it in order to
1360
+ * keep it in view when it will overflow the clipping boundary.
1361
+ * @see https://floating-ui.com/docs/shift
1362
+ */
1363
+ const shift = shift$1;
1364
+
1365
+ /**
1366
+ * Optimizes the visibility of the floating element by flipping the `placement`
1367
+ * in order to keep it in view when the preferred placement(s) will overflow the
1368
+ * clipping boundary. Alternative to `autoPlacement`.
1369
+ * @see https://floating-ui.com/docs/flip
1370
+ */
1371
+ const flip = flip$1;
1372
+
1373
+ /**
1374
+ * Computes the `x` and `y` coordinates that will place the floating element
1375
+ * next to a given reference element.
1376
+ */
1377
+ const computePosition = (reference, floating, options) => {
1378
+ // This caches the expensive `getClippingElementAncestors` function so that
1379
+ // multiple lifecycle resets re-use the same result. It only lives for a
1380
+ // single call. If other functions become expensive, we can add them as well.
1381
+ const cache = new Map();
1382
+ const mergedOptions = {
1383
+ platform,
1384
+ ...options
1385
+ };
1386
+ const platformWithCache = {
1387
+ ...mergedOptions.platform,
1388
+ _c: cache
1389
+ };
1390
+ return computePosition$1(reference, floating, {
1391
+ ...mergedOptions,
1392
+ platform: platformWithCache
1393
+ });
1394
+ };
1395
+
1396
+ const ezPopoverPlusCss = ":host{--ez-popover__box--border-radius:var(--border--radius-medium, 12px);--ez-popover__box--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-popover__box--background-color:var(--background--xlight, #fff);--ez-popover__box--z-index:var(--most-visible, 4);position:relative;display:flex;user-select:none}.popover__overlay{display:none;position:fixed;padding:0;top:0px;left:0px;width:100%;height:100vh;box-sizing:border-box;z-index:var(--more-visible--2x, 3)}.popover__overlay--light{background-color:rgba(var(--rgb-background--overlay), var(--opacity--bright))}.popover__overlay--medium{background-color:rgba(var(--rgb-background--overlay), var(--opacity--soft));backdrop-filter:blur(var(--background-blur--medium))}.popover__box{display:none;position:fixed;top:0;left:0;z-index:var(--ez-popover__box--z-index);flex-direction:column;height:fit-content;background-color:var(--ez-popover__box--background-color);border-radius:var(--ez-popover__box--border-radius);box-shadow:var(--ez-popover__box--box-shadow)}.popover__box--fit-content{width:fit-content}.popover__box--full-width{width:calc(100% - 10px)}";
1397
+
1398
+ const EzPopoverPlus = class {
1399
+ constructor(hostRef) {
1400
+ registerInstance(this, hostRef);
1401
+ this.ezVisibilityChange = createEvent(this, "ezVisibilityChange", 7);
1402
+ this.TIME_DEBOUNCE = 500;
1403
+ this.autoClose = true;
1404
+ this.boxWidth = "fit-content";
1405
+ this.opened = false;
1406
+ this.overlayType = "light";
1407
+ this.anchorElement = undefined;
1408
+ this.options = { horizontalGap: 0, verticalGap: 0, fromRight: false };
1409
+ }
1410
+ async observeOpened(newValue, oldValue) {
1411
+ if (newValue !== oldValue) {
1412
+ if (newValue) {
1413
+ this.openPopover();
1414
+ }
1415
+ else {
1416
+ this.hidePopover();
1417
+ }
1418
+ this.ezVisibilityChange.emit(newValue);
1419
+ return;
1420
+ }
1421
+ }
1422
+ /**
1423
+ * Atualiza a posição do popover.
1424
+ */
1425
+ async updatePosition(top, left) {
1426
+ this.updateOptionPosition(top, left);
1427
+ await this.updatePositionPopover();
1428
+ }
1429
+ /**
1430
+ * Exibe o ez-popover.
1431
+ */
1432
+ async show(top, left) {
1433
+ this.updateOptionPosition(top, left);
1434
+ this.opened = true;
1435
+ }
1436
+ /**
1437
+ * Ancora a exibição do popOver a um elemento HTML.
1438
+ */
1439
+ async showUnder(element, options) {
1440
+ if (options) {
1441
+ this.options = options;
1442
+ }
1443
+ this.anchorElement = element;
1444
+ this.opened = true;
1445
+ }
1446
+ /**
1447
+ * Oculta o ez-popover.
1448
+ */
1449
+ async hide() {
1450
+ this.opened = false;
1451
+ }
1452
+ /**
1453
+ * Altera as opções.
1454
+ */
1455
+ async setOptions(options) {
1456
+ Object.assign(this.options, options);
1457
+ }
1458
+ /**
1459
+ * Altera o elemento de ancoragem.
1460
+ */
1461
+ async setAnchorElement(anchor) {
1462
+ this.anchorElement = anchor;
1463
+ }
1464
+ parseSizePixel(sizePixel, defaultValue) {
1465
+ if (!sizePixel) {
1466
+ return defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0;
1467
+ }
1468
+ if (typeof sizePixel === "string") {
1469
+ return Number(sizePixel.replace("px", ""));
1470
+ }
1471
+ return sizePixel !== null && sizePixel !== void 0 ? sizePixel : 0;
1472
+ }
1473
+ updateOptionPosition(top, left) {
1474
+ Object.assign(this.options, {
1475
+ horizontalGap: this.parseSizePixel(left, this.options.horizontalGap),
1476
+ verticalGap: this.parseSizePixel(top, this.options.verticalGap),
1477
+ });
1478
+ }
1479
+ async updatePositionPopover() {
1480
+ if (!this._box || !this.opened) {
1481
+ return;
1482
+ }
1483
+ if (!this.anchorElement) {
1484
+ this.anchorElement = this._host;
1485
+ }
1486
+ if (typeof this.anchorElement === 'string') {
1487
+ this.anchorElement = document.getElementById(this.anchorElement);
1488
+ }
1489
+ await computePosition(this.anchorElement, this._box, {
1490
+ placement: this.options.fromRight ? 'bottom-end' : 'bottom-start',
1491
+ middleware: [flip(), shift({ padding: 5 })],
1492
+ strategy: 'fixed',
1493
+ }).then(({ x, y, placement }) => {
1494
+ const newTop = placement.includes("bottom") ? y + this.options.verticalGap : y - this.options.verticalGap;
1495
+ const newLeft = placement.includes("start") ? x + this.options.horizontalGap : x - this.options.horizontalGap;
1496
+ Object.assign(this._box.style, {
1497
+ top: `${newTop}px`,
1498
+ left: `${newLeft}px`,
1499
+ });
1500
+ });
1501
+ }
1502
+ hidePopover() {
1503
+ if (!this._box) {
1504
+ return;
1505
+ }
1506
+ this._box.style.display = '';
1507
+ this.hideOverlay();
1508
+ this.ezVisibilityChange.emit(false);
1509
+ }
1510
+ async openPopover() {
1511
+ if (!this._box) {
1512
+ return;
1513
+ }
1514
+ this._box.style.display = 'flex';
1515
+ this._box.style.visibility = 'hidden';
1516
+ await this.updatePositionPopover();
1517
+ this.openOverlay();
1518
+ this.ezVisibilityChange.emit(true);
1519
+ this._box.style.visibility = 'visible';
1520
+ }
1521
+ openOverlay() {
1522
+ if (!this._overlay || !this._overlayIsActive) {
1523
+ return;
1524
+ }
1525
+ this._overlay.style.display = 'block';
1526
+ }
1527
+ hideOverlay() {
1528
+ if (!this._overlay) {
1529
+ return;
1530
+ }
1531
+ this._overlay.style.display = 'none';
1532
+ }
1533
+ checkStatusOverlay() {
1534
+ if (this.overlayType !== "none") {
1535
+ return true;
1536
+ }
1537
+ if (this.overlayType === "none" && this.autoClose) {
1538
+ return true;
1539
+ }
1540
+ return false;
1541
+ }
1542
+ updatePositionDebounce() {
1543
+ if (!this.opened) {
1544
+ return;
1545
+ }
1546
+ clearTimeout(this._timeoutDebounce);
1547
+ this._timeoutDebounce = setTimeout(() => {
1548
+ this.updatePositionPopover();
1549
+ }, this.TIME_DEBOUNCE);
1550
+ }
1551
+ componentWillLoad() {
1552
+ window.addEventListener('scroll', this.updatePositionDebounce.bind(this), true);
1553
+ window.addEventListener('resize', this.updatePositionDebounce.bind(this), true);
1554
+ }
1555
+ componentDidLoad() {
1556
+ this._overlayIsActive = this.checkStatusOverlay();
1557
+ this._resizeObserver = new ResizeObserver(this.updatePositionPopover.bind(this));
1558
+ this._resizeObserver.observe(this._box);
1559
+ }
1560
+ disconnectedCallback() {
1561
+ window.removeEventListener('scroll', this.updatePositionDebounce.bind(this), true);
1562
+ window.removeEventListener('resize', this.updatePositionDebounce.bind(this), true);
1563
+ this._resizeObserver.disconnect();
1564
+ }
1565
+ render() {
1566
+ return (h(Host, null, h("div", { ref: el => this._overlay = el, onClick: () => this.hide(), class: `popover__overlay popover__overlay--${this.overlayType}` }), h("section", { ref: el => this._box = el, class: {
1567
+ "popover__box": true,
1568
+ "popover__box--fit-content": this.boxWidth === "fit-content",
1569
+ "popover__box--full-width": this.boxWidth !== "fit-content",
1570
+ } }, h("slot", null))));
1571
+ }
1572
+ get _host() { return getElement(this); }
1573
+ static get watchers() { return {
1574
+ "opened": ["observeOpened"]
1575
+ }; }
1576
+ };
1577
+ EzPopoverPlus.style = ezPopoverPlusCss;
1578
+
1579
+ export { EzMuiltiSelectionList as ez_multi_selection_list, EzPopoverPlus as ez_popover_plus };