@dso-toolkit/core 72.0.0 → 72.1.0

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 (194) hide show
  1. package/dist/cjs/dso-alert.dso-badge.dso-image-overlay.dso-ozon-content.dso-panel.dso-table.entry.cjs.js.map +1 -1
  2. package/dist/cjs/dso-alert_6.cjs.entry.js +5 -5
  3. package/dist/cjs/dso-alert_6.cjs.entry.js.map +1 -1
  4. package/dist/cjs/dso-annotation-locatie.dso-document-component.entry.cjs.js.map +1 -1
  5. package/dist/cjs/dso-annotation-locatie_2.cjs.entry.js +1 -1
  6. package/dist/cjs/dso-annotation-locatie_2.cjs.entry.js.map +1 -1
  7. package/dist/cjs/dso-icon.cjs.entry.js +8 -1
  8. package/dist/cjs/dso-icon.cjs.entry.js.map +1 -1
  9. package/dist/cjs/dso-icon.entry.cjs.js.map +1 -1
  10. package/dist/cjs/dso-info_2.cjs.entry.js +1 -1
  11. package/dist/cjs/dso-label_3.cjs.entry.js +1 -1
  12. package/dist/cjs/dso-map-controls.cjs.entry.js +1 -1
  13. package/dist/cjs/dso-map-controls.cjs.entry.js.map +1 -1
  14. package/dist/cjs/dso-map-controls.entry.cjs.js.map +1 -1
  15. package/dist/cjs/dso-onboarding-tip.cjs.entry.js +1788 -0
  16. package/dist/cjs/dso-onboarding-tip.cjs.entry.js.map +1 -0
  17. package/dist/cjs/dso-onboarding-tip.entry.cjs.js.map +1 -0
  18. package/dist/cjs/dso-plekinfo-card.cjs.entry.js +1 -1
  19. package/dist/cjs/dso-progress-bar.cjs.entry.js +1 -1
  20. package/dist/cjs/dso-progress-indicator.cjs.entry.js +1 -1
  21. package/dist/cjs/dso-project-item.cjs.entry.js +1 -1
  22. package/dist/cjs/dso-responsive-element.cjs.entry.js +1 -1
  23. package/dist/cjs/dso-scrollable.cjs.entry.js +2 -2
  24. package/dist/cjs/dso-skiplink.cjs.entry.js +1 -1
  25. package/dist/cjs/dso-survey-rating.cjs.entry.js +3 -3
  26. package/dist/cjs/dso-survey-rating.cjs.entry.js.map +1 -1
  27. package/dist/cjs/dso-survey-rating.entry.cjs.js.map +1 -1
  28. package/dist/cjs/dso-tabs.cjs.entry.js +1 -1
  29. package/dist/cjs/dso-toggletip.cjs.entry.js +1 -1
  30. package/dist/cjs/dso-toolkit.cjs.js +1 -1
  31. package/dist/cjs/dso-tooltip.cjs.entry.js +1 -1
  32. package/dist/cjs/dso-tree-view.cjs.entry.js +1 -1
  33. package/dist/cjs/dso-viewer-grid.cjs.entry.js +3 -3
  34. package/dist/cjs/dso-viewer-grid.cjs.entry.js.map +1 -1
  35. package/dist/cjs/dso-viewer-grid.entry.cjs.js.map +1 -1
  36. package/dist/cjs/loader.cjs.js +1 -1
  37. package/dist/collection/collection-manifest.json +1 -0
  38. package/dist/collection/components/document-component/document-component.css +24 -24
  39. package/dist/collection/components/icon/icon.js +3 -1
  40. package/dist/collection/components/icon/icon.js.map +1 -1
  41. package/dist/collection/components/image-overlay/image-overlay.css +24 -24
  42. package/dist/collection/components/map-controls/map-controls.css +24 -24
  43. package/dist/collection/components/onboarding-tip/onboarding-tip.css +160 -0
  44. package/dist/collection/components/onboarding-tip/onboarding-tip.interfaces.js +2 -0
  45. package/dist/collection/components/onboarding-tip/onboarding-tip.interfaces.js.map +1 -0
  46. package/dist/collection/components/onboarding-tip/onboarding-tip.js +196 -0
  47. package/dist/collection/components/onboarding-tip/onboarding-tip.js.map +1 -0
  48. package/dist/collection/components/ozon-content/ozon-content.css +24 -24
  49. package/dist/collection/components/ozon-content/ozon-content.js +1 -1
  50. package/dist/collection/components/plekinfo-card/plekinfo-card.js +1 -1
  51. package/dist/collection/components/progress-bar/progress-bar.js +1 -1
  52. package/dist/collection/components/progress-indicator/progress-indicator.js +1 -1
  53. package/dist/collection/components/project-item/project-item.js +1 -1
  54. package/dist/collection/components/responsive-element/responsive-element.js +1 -1
  55. package/dist/collection/components/scrollable/scrollable.js +2 -2
  56. package/dist/collection/components/selectable/selectable.js +1 -1
  57. package/dist/collection/components/skiplink/skiplink.js +1 -1
  58. package/dist/collection/components/slide-toggle/slide-toggle.js +1 -1
  59. package/dist/collection/components/survey-rating/survey-rating.css +12 -12
  60. package/dist/collection/components/survey-rating/survey-rating.js +2 -2
  61. package/dist/collection/components/table/table.css +24 -24
  62. package/dist/collection/components/table/table.js +1 -1
  63. package/dist/collection/components/tabs/tabs.js +1 -1
  64. package/dist/collection/components/toggletip/toggletip.js +1 -1
  65. package/dist/collection/components/tooltip/tooltip.js +1 -1
  66. package/dist/collection/components/tree-view/tree-view.js +1 -1
  67. package/dist/collection/components/viewer-grid/viewer-grid.css +36 -36
  68. package/dist/collection/components/viewer-grid/viewer-grid.js +2 -2
  69. package/dist/components/document-component.js +1 -1
  70. package/dist/components/document-component.js.map +1 -1
  71. package/dist/components/dso-map-controls.js +1 -1
  72. package/dist/components/dso-map-controls.js.map +1 -1
  73. package/dist/components/dso-onboarding-tip.d.ts +11 -0
  74. package/dist/components/dso-onboarding-tip.js +1812 -0
  75. package/dist/components/dso-onboarding-tip.js.map +1 -0
  76. package/dist/components/dso-plekinfo-card.js +1 -1
  77. package/dist/components/dso-progress-bar.js +1 -1
  78. package/dist/components/dso-project-item.js +1 -1
  79. package/dist/components/dso-skiplink.js +1 -1
  80. package/dist/components/dso-survey-rating.js +3 -3
  81. package/dist/components/dso-survey-rating.js.map +1 -1
  82. package/dist/components/dso-tabs.js +1 -1
  83. package/dist/components/dso-tree-view.js +1 -1
  84. package/dist/components/dso-viewer-grid.js +3 -3
  85. package/dist/components/dso-viewer-grid.js.map +1 -1
  86. package/dist/components/icon.js +8 -1
  87. package/dist/components/icon.js.map +1 -1
  88. package/dist/components/image-overlay.js +1 -1
  89. package/dist/components/image-overlay.js.map +1 -1
  90. package/dist/components/index.d.ts +2 -0
  91. package/dist/components/index.js +1 -0
  92. package/dist/components/index.js.map +1 -1
  93. package/dist/components/ozon-content.js +2 -2
  94. package/dist/components/ozon-content.js.map +1 -1
  95. package/dist/components/progress-indicator.js +1 -1
  96. package/dist/components/responsive-element.js +1 -1
  97. package/dist/components/scrollable.js +2 -2
  98. package/dist/components/selectable.js +1 -1
  99. package/dist/components/slide-toggle.js +1 -1
  100. package/dist/components/table.js +2 -2
  101. package/dist/components/table.js.map +1 -1
  102. package/dist/components/toggletip.js +1 -1
  103. package/dist/components/tooltip.js +1 -1
  104. package/dist/dso-toolkit/dso-alert.dso-badge.dso-image-overlay.dso-ozon-content.dso-panel.dso-table.entry.esm.js.map +1 -1
  105. package/dist/dso-toolkit/dso-annotation-locatie.dso-document-component.entry.esm.js.map +1 -1
  106. package/dist/dso-toolkit/dso-icon.entry.esm.js.map +1 -1
  107. package/dist/dso-toolkit/dso-map-controls.entry.esm.js.map +1 -1
  108. package/dist/dso-toolkit/dso-onboarding-tip.entry.esm.js.map +1 -0
  109. package/dist/dso-toolkit/dso-survey-rating.entry.esm.js.map +1 -1
  110. package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
  111. package/dist/dso-toolkit/dso-viewer-grid.entry.esm.js.map +1 -1
  112. package/dist/dso-toolkit/p-09dcedd1.entry.js +2 -0
  113. package/dist/dso-toolkit/{p-7b715bdf.entry.js.map → p-09dcedd1.entry.js.map} +1 -1
  114. package/dist/dso-toolkit/{p-c13b26ad.entry.js → p-0e6d0886.entry.js} +2 -2
  115. package/dist/dso-toolkit/{p-5f820aec.entry.js → p-13cda4e5.entry.js} +2 -2
  116. package/dist/dso-toolkit/{p-a0a78026.entry.js → p-3315d028.entry.js} +2 -2
  117. package/dist/dso-toolkit/{p-4eefa210.entry.js → p-3aac8417.entry.js} +2 -2
  118. package/dist/dso-toolkit/{p-00580562.entry.js → p-53910728.entry.js} +2 -2
  119. package/dist/dso-toolkit/p-6a620f5f.entry.js +2 -0
  120. package/dist/dso-toolkit/p-6a620f5f.entry.js.map +1 -0
  121. package/dist/dso-toolkit/{p-3f85169a.entry.js → p-6c413b75.entry.js} +2 -2
  122. package/dist/dso-toolkit/{p-6dac4086.entry.js → p-70d63a6a.entry.js} +2 -2
  123. package/dist/dso-toolkit/{p-6dac4086.entry.js.map → p-70d63a6a.entry.js.map} +1 -1
  124. package/dist/dso-toolkit/{p-ac221ee6.entry.js → p-70fc8d65.entry.js} +2 -2
  125. package/dist/dso-toolkit/p-710e1719.entry.js +2 -0
  126. package/dist/dso-toolkit/p-ada03e5c.entry.js +2 -0
  127. package/dist/dso-toolkit/p-ada03e5c.entry.js.map +1 -0
  128. package/dist/dso-toolkit/p-bb88881a.entry.js +2 -0
  129. package/dist/dso-toolkit/{p-6973b064.entry.js → p-c01b6283.entry.js} +2 -2
  130. package/dist/dso-toolkit/{p-896b4e39.entry.js → p-c059397d.entry.js} +2 -2
  131. package/dist/dso-toolkit/{p-c50310e2.entry.js → p-ca14935b.entry.js} +2 -2
  132. package/dist/dso-toolkit/p-ebc43652.entry.js +2 -0
  133. package/dist/dso-toolkit/{p-26d6681e.entry.js.map → p-ebc43652.entry.js.map} +1 -1
  134. package/dist/dso-toolkit/p-ee5df97d.entry.js +2 -0
  135. package/dist/dso-toolkit/{p-43b5e74b.entry.js.map → p-ee5df97d.entry.js.map} +1 -1
  136. package/dist/dso-toolkit/p-ee93ae83.entry.js +2 -0
  137. package/dist/dso-toolkit/{p-3cb4ac7e.entry.js.map → p-ee93ae83.entry.js.map} +1 -1
  138. package/dist/dso-toolkit/{p-7f8fc024.entry.js → p-f6a81839.entry.js} +2 -2
  139. package/dist/esm/dso-alert.dso-badge.dso-image-overlay.dso-ozon-content.dso-panel.dso-table.entry.js.map +1 -1
  140. package/dist/esm/dso-alert_6.entry.js +5 -5
  141. package/dist/esm/dso-alert_6.entry.js.map +1 -1
  142. package/dist/esm/dso-annotation-locatie.dso-document-component.entry.js.map +1 -1
  143. package/dist/esm/dso-annotation-locatie_2.entry.js +1 -1
  144. package/dist/esm/dso-annotation-locatie_2.entry.js.map +1 -1
  145. package/dist/esm/dso-icon.entry.js +8 -1
  146. package/dist/esm/dso-icon.entry.js.map +1 -1
  147. package/dist/esm/dso-info_2.entry.js +1 -1
  148. package/dist/esm/dso-label_3.entry.js +1 -1
  149. package/dist/esm/dso-map-controls.entry.js +1 -1
  150. package/dist/esm/dso-map-controls.entry.js.map +1 -1
  151. package/dist/esm/dso-onboarding-tip.entry.js +1786 -0
  152. package/dist/esm/dso-onboarding-tip.entry.js.map +1 -0
  153. package/dist/esm/dso-plekinfo-card.entry.js +1 -1
  154. package/dist/esm/dso-progress-bar.entry.js +1 -1
  155. package/dist/esm/dso-progress-indicator.entry.js +1 -1
  156. package/dist/esm/dso-project-item.entry.js +1 -1
  157. package/dist/esm/dso-responsive-element.entry.js +1 -1
  158. package/dist/esm/dso-scrollable.entry.js +2 -2
  159. package/dist/esm/dso-skiplink.entry.js +1 -1
  160. package/dist/esm/dso-survey-rating.entry.js +3 -3
  161. package/dist/esm/dso-survey-rating.entry.js.map +1 -1
  162. package/dist/esm/dso-tabs.entry.js +1 -1
  163. package/dist/esm/dso-toggletip.entry.js +1 -1
  164. package/dist/esm/dso-toolkit.js +1 -1
  165. package/dist/esm/dso-tooltip.entry.js +1 -1
  166. package/dist/esm/dso-tree-view.entry.js +1 -1
  167. package/dist/esm/dso-viewer-grid.entry.js +3 -3
  168. package/dist/esm/dso-viewer-grid.entry.js.map +1 -1
  169. package/dist/esm/loader.js +1 -1
  170. package/dist/types/components/onboarding-tip/onboarding-tip.d.ts +25 -0
  171. package/dist/types/components/onboarding-tip/onboarding-tip.interfaces.d.ts +4 -0
  172. package/dist/types/components.d.ts +42 -0
  173. package/package.json +4 -3
  174. package/dist/dso-toolkit/p-26d6681e.entry.js +0 -2
  175. package/dist/dso-toolkit/p-3cb4ac7e.entry.js +0 -2
  176. package/dist/dso-toolkit/p-43b5e74b.entry.js +0 -2
  177. package/dist/dso-toolkit/p-7853e0ff.entry.js +0 -2
  178. package/dist/dso-toolkit/p-7b715bdf.entry.js +0 -2
  179. package/dist/dso-toolkit/p-a74dabd9.entry.js +0 -2
  180. package/dist/dso-toolkit/p-a74dabd9.entry.js.map +0 -1
  181. package/dist/dso-toolkit/p-b26fded2.entry.js +0 -2
  182. /package/dist/dso-toolkit/{p-c13b26ad.entry.js.map → p-0e6d0886.entry.js.map} +0 -0
  183. /package/dist/dso-toolkit/{p-5f820aec.entry.js.map → p-13cda4e5.entry.js.map} +0 -0
  184. /package/dist/dso-toolkit/{p-a0a78026.entry.js.map → p-3315d028.entry.js.map} +0 -0
  185. /package/dist/dso-toolkit/{p-4eefa210.entry.js.map → p-3aac8417.entry.js.map} +0 -0
  186. /package/dist/dso-toolkit/{p-00580562.entry.js.map → p-53910728.entry.js.map} +0 -0
  187. /package/dist/dso-toolkit/{p-3f85169a.entry.js.map → p-6c413b75.entry.js.map} +0 -0
  188. /package/dist/dso-toolkit/{p-ac221ee6.entry.js.map → p-70fc8d65.entry.js.map} +0 -0
  189. /package/dist/dso-toolkit/{p-7853e0ff.entry.js.map → p-710e1719.entry.js.map} +0 -0
  190. /package/dist/dso-toolkit/{p-b26fded2.entry.js.map → p-bb88881a.entry.js.map} +0 -0
  191. /package/dist/dso-toolkit/{p-6973b064.entry.js.map → p-c01b6283.entry.js.map} +0 -0
  192. /package/dist/dso-toolkit/{p-896b4e39.entry.js.map → p-c059397d.entry.js.map} +0 -0
  193. /package/dist/dso-toolkit/{p-c50310e2.entry.js.map → p-ca14935b.entry.js.map} +0 -0
  194. /package/dist/dso-toolkit/{p-7f8fc024.entry.js.map → p-f6a81839.entry.js.map} +0 -0
@@ -0,0 +1,1812 @@
1
+ import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { d as defineCustomElement$2 } from './icon.js';
3
+
4
+ /**
5
+ * Custom positioning reference element.
6
+ * @see https://floating-ui.com/docs/virtual-elements
7
+ */
8
+
9
+ const sides = ['top', 'right', 'bottom', 'left'];
10
+ const min = Math.min;
11
+ const max = Math.max;
12
+ const round = Math.round;
13
+ const floor = Math.floor;
14
+ const createCoords = v => ({
15
+ x: v,
16
+ y: v
17
+ });
18
+ const oppositeSideMap = {
19
+ left: 'right',
20
+ right: 'left',
21
+ bottom: 'top',
22
+ top: 'bottom'
23
+ };
24
+ const oppositeAlignmentMap = {
25
+ start: 'end',
26
+ end: 'start'
27
+ };
28
+ function clamp(start, value, end) {
29
+ return max(start, min(value, end));
30
+ }
31
+ function evaluate(value, param) {
32
+ return typeof value === 'function' ? value(param) : value;
33
+ }
34
+ function getSide(placement) {
35
+ return placement.split('-')[0];
36
+ }
37
+ function getAlignment(placement) {
38
+ return placement.split('-')[1];
39
+ }
40
+ function getOppositeAxis(axis) {
41
+ return axis === 'x' ? 'y' : 'x';
42
+ }
43
+ function getAxisLength(axis) {
44
+ return axis === 'y' ? 'height' : 'width';
45
+ }
46
+ function getSideAxis(placement) {
47
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
48
+ }
49
+ function getAlignmentAxis(placement) {
50
+ return getOppositeAxis(getSideAxis(placement));
51
+ }
52
+ function getAlignmentSides(placement, rects, rtl) {
53
+ if (rtl === void 0) {
54
+ rtl = false;
55
+ }
56
+ const alignment = getAlignment(placement);
57
+ const alignmentAxis = getAlignmentAxis(placement);
58
+ const length = getAxisLength(alignmentAxis);
59
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
60
+ if (rects.reference[length] > rects.floating[length]) {
61
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
62
+ }
63
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
64
+ }
65
+ function getExpandedPlacements(placement) {
66
+ const oppositePlacement = getOppositePlacement(placement);
67
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
68
+ }
69
+ function getOppositeAlignmentPlacement(placement) {
70
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
71
+ }
72
+ function getSideList(side, isStart, rtl) {
73
+ const lr = ['left', 'right'];
74
+ const rl = ['right', 'left'];
75
+ const tb = ['top', 'bottom'];
76
+ const bt = ['bottom', 'top'];
77
+ switch (side) {
78
+ case 'top':
79
+ case 'bottom':
80
+ if (rtl) return isStart ? rl : lr;
81
+ return isStart ? lr : rl;
82
+ case 'left':
83
+ case 'right':
84
+ return isStart ? tb : bt;
85
+ default:
86
+ return [];
87
+ }
88
+ }
89
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
90
+ const alignment = getAlignment(placement);
91
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
92
+ if (alignment) {
93
+ list = list.map(side => side + "-" + alignment);
94
+ if (flipAlignment) {
95
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
96
+ }
97
+ }
98
+ return list;
99
+ }
100
+ function getOppositePlacement(placement) {
101
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
102
+ }
103
+ function expandPaddingObject(padding) {
104
+ return {
105
+ top: 0,
106
+ right: 0,
107
+ bottom: 0,
108
+ left: 0,
109
+ ...padding
110
+ };
111
+ }
112
+ function getPaddingObject(padding) {
113
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
114
+ top: padding,
115
+ right: padding,
116
+ bottom: padding,
117
+ left: padding
118
+ };
119
+ }
120
+ function rectToClientRect(rect) {
121
+ const {
122
+ x,
123
+ y,
124
+ width,
125
+ height
126
+ } = rect;
127
+ return {
128
+ width,
129
+ height,
130
+ top: y,
131
+ left: x,
132
+ right: x + width,
133
+ bottom: y + height,
134
+ x,
135
+ y
136
+ };
137
+ }
138
+
139
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
140
+ let {
141
+ reference,
142
+ floating
143
+ } = _ref;
144
+ const sideAxis = getSideAxis(placement);
145
+ const alignmentAxis = getAlignmentAxis(placement);
146
+ const alignLength = getAxisLength(alignmentAxis);
147
+ const side = getSide(placement);
148
+ const isVertical = sideAxis === 'y';
149
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
150
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
151
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
152
+ let coords;
153
+ switch (side) {
154
+ case 'top':
155
+ coords = {
156
+ x: commonX,
157
+ y: reference.y - floating.height
158
+ };
159
+ break;
160
+ case 'bottom':
161
+ coords = {
162
+ x: commonX,
163
+ y: reference.y + reference.height
164
+ };
165
+ break;
166
+ case 'right':
167
+ coords = {
168
+ x: reference.x + reference.width,
169
+ y: commonY
170
+ };
171
+ break;
172
+ case 'left':
173
+ coords = {
174
+ x: reference.x - floating.width,
175
+ y: commonY
176
+ };
177
+ break;
178
+ default:
179
+ coords = {
180
+ x: reference.x,
181
+ y: reference.y
182
+ };
183
+ }
184
+ switch (getAlignment(placement)) {
185
+ case 'start':
186
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
187
+ break;
188
+ case 'end':
189
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
190
+ break;
191
+ }
192
+ return coords;
193
+ }
194
+
195
+ /**
196
+ * Computes the `x` and `y` coordinates that will place the floating element
197
+ * next to a given reference element.
198
+ *
199
+ * This export does not have any `platform` interface logic. You will need to
200
+ * write one for the platform you are using Floating UI with.
201
+ */
202
+ const computePosition$1 = async (reference, floating, config) => {
203
+ const {
204
+ placement = 'bottom',
205
+ strategy = 'absolute',
206
+ middleware = [],
207
+ platform
208
+ } = config;
209
+ const validMiddleware = middleware.filter(Boolean);
210
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
211
+ let rects = await platform.getElementRects({
212
+ reference,
213
+ floating,
214
+ strategy
215
+ });
216
+ let {
217
+ x,
218
+ y
219
+ } = computeCoordsFromPlacement(rects, placement, rtl);
220
+ let statefulPlacement = placement;
221
+ let middlewareData = {};
222
+ let resetCount = 0;
223
+ for (let i = 0; i < validMiddleware.length; i++) {
224
+ const {
225
+ name,
226
+ fn
227
+ } = validMiddleware[i];
228
+ const {
229
+ x: nextX,
230
+ y: nextY,
231
+ data,
232
+ reset
233
+ } = await fn({
234
+ x,
235
+ y,
236
+ initialPlacement: placement,
237
+ placement: statefulPlacement,
238
+ strategy,
239
+ middlewareData,
240
+ rects,
241
+ platform,
242
+ elements: {
243
+ reference,
244
+ floating
245
+ }
246
+ });
247
+ x = nextX != null ? nextX : x;
248
+ y = nextY != null ? nextY : y;
249
+ middlewareData = {
250
+ ...middlewareData,
251
+ [name]: {
252
+ ...middlewareData[name],
253
+ ...data
254
+ }
255
+ };
256
+ if (reset && resetCount <= 50) {
257
+ resetCount++;
258
+ if (typeof reset === 'object') {
259
+ if (reset.placement) {
260
+ statefulPlacement = reset.placement;
261
+ }
262
+ if (reset.rects) {
263
+ rects = reset.rects === true ? await platform.getElementRects({
264
+ reference,
265
+ floating,
266
+ strategy
267
+ }) : reset.rects;
268
+ }
269
+ ({
270
+ x,
271
+ y
272
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
273
+ }
274
+ i = -1;
275
+ }
276
+ }
277
+ return {
278
+ x,
279
+ y,
280
+ placement: statefulPlacement,
281
+ strategy,
282
+ middlewareData
283
+ };
284
+ };
285
+
286
+ /**
287
+ * Resolves with an object of overflow side offsets that determine how much the
288
+ * element is overflowing a given clipping boundary on each side.
289
+ * - positive = overflowing the boundary by that number of pixels
290
+ * - negative = how many pixels left before it will overflow
291
+ * - 0 = lies flush with the boundary
292
+ * @see https://floating-ui.com/docs/detectOverflow
293
+ */
294
+ async function detectOverflow(state, options) {
295
+ var _await$platform$isEle;
296
+ if (options === void 0) {
297
+ options = {};
298
+ }
299
+ const {
300
+ x,
301
+ y,
302
+ platform,
303
+ rects,
304
+ elements,
305
+ strategy
306
+ } = state;
307
+ const {
308
+ boundary = 'clippingAncestors',
309
+ rootBoundary = 'viewport',
310
+ elementContext = 'floating',
311
+ altBoundary = false,
312
+ padding = 0
313
+ } = evaluate(options, state);
314
+ const paddingObject = getPaddingObject(padding);
315
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
316
+ const element = elements[altBoundary ? altContext : elementContext];
317
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
318
+ 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))),
319
+ boundary,
320
+ rootBoundary,
321
+ strategy
322
+ }));
323
+ const rect = elementContext === 'floating' ? {
324
+ x,
325
+ y,
326
+ width: rects.floating.width,
327
+ height: rects.floating.height
328
+ } : rects.reference;
329
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
330
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
331
+ x: 1,
332
+ y: 1
333
+ } : {
334
+ x: 1,
335
+ y: 1
336
+ };
337
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
338
+ elements,
339
+ rect,
340
+ offsetParent,
341
+ strategy
342
+ }) : rect);
343
+ return {
344
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
345
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
346
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
347
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
348
+ };
349
+ }
350
+
351
+ /**
352
+ * Provides data to position an inner element of the floating element so that it
353
+ * appears centered to the reference element.
354
+ * @see https://floating-ui.com/docs/arrow
355
+ */
356
+ const arrow$1 = options => ({
357
+ name: 'arrow',
358
+ options,
359
+ async fn(state) {
360
+ const {
361
+ x,
362
+ y,
363
+ placement,
364
+ rects,
365
+ platform,
366
+ elements,
367
+ middlewareData
368
+ } = state;
369
+ // Since `element` is required, we don't Partial<> the type.
370
+ const {
371
+ element,
372
+ padding = 0
373
+ } = evaluate(options, state) || {};
374
+ if (element == null) {
375
+ return {};
376
+ }
377
+ const paddingObject = getPaddingObject(padding);
378
+ const coords = {
379
+ x,
380
+ y
381
+ };
382
+ const axis = getAlignmentAxis(placement);
383
+ const length = getAxisLength(axis);
384
+ const arrowDimensions = await platform.getDimensions(element);
385
+ const isYAxis = axis === 'y';
386
+ const minProp = isYAxis ? 'top' : 'left';
387
+ const maxProp = isYAxis ? 'bottom' : 'right';
388
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
389
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
390
+ const startDiff = coords[axis] - rects.reference[axis];
391
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
392
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
393
+
394
+ // DOM platform can return `window` as the `offsetParent`.
395
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
396
+ clientSize = elements.floating[clientProp] || rects.floating[length];
397
+ }
398
+ const centerToReference = endDiff / 2 - startDiff / 2;
399
+
400
+ // If the padding is large enough that it causes the arrow to no longer be
401
+ // centered, modify the padding so that it is centered.
402
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
403
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
404
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
405
+
406
+ // Make sure the arrow doesn't overflow the floating element if the center
407
+ // point is outside the floating element's bounds.
408
+ const min$1 = minPadding;
409
+ const max = clientSize - arrowDimensions[length] - maxPadding;
410
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
411
+ const offset = clamp(min$1, center, max);
412
+
413
+ // If the reference is small enough that the arrow's padding causes it to
414
+ // to point to nothing for an aligned placement, adjust the offset of the
415
+ // floating element itself. To ensure `shift()` continues to take action,
416
+ // a single reset is performed when this is true.
417
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
418
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
419
+ return {
420
+ [axis]: coords[axis] + alignmentOffset,
421
+ data: {
422
+ [axis]: offset,
423
+ centerOffset: center - offset - alignmentOffset,
424
+ ...(shouldAddOffset && {
425
+ alignmentOffset
426
+ })
427
+ },
428
+ reset: shouldAddOffset
429
+ };
430
+ }
431
+ });
432
+
433
+ /**
434
+ * Optimizes the visibility of the floating element by flipping the `placement`
435
+ * in order to keep it in view when the preferred placement(s) will overflow the
436
+ * clipping boundary. Alternative to `autoPlacement`.
437
+ * @see https://floating-ui.com/docs/flip
438
+ */
439
+ const flip$1 = function (options) {
440
+ if (options === void 0) {
441
+ options = {};
442
+ }
443
+ return {
444
+ name: 'flip',
445
+ options,
446
+ async fn(state) {
447
+ var _middlewareData$arrow, _middlewareData$flip;
448
+ const {
449
+ placement,
450
+ middlewareData,
451
+ rects,
452
+ initialPlacement,
453
+ platform,
454
+ elements
455
+ } = state;
456
+ const {
457
+ mainAxis: checkMainAxis = true,
458
+ crossAxis: checkCrossAxis = true,
459
+ fallbackPlacements: specifiedFallbackPlacements,
460
+ fallbackStrategy = 'bestFit',
461
+ fallbackAxisSideDirection = 'none',
462
+ flipAlignment = true,
463
+ ...detectOverflowOptions
464
+ } = evaluate(options, state);
465
+
466
+ // If a reset by the arrow was caused due to an alignment offset being
467
+ // added, we should skip any logic now since `flip()` has already done its
468
+ // work.
469
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
470
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
471
+ return {};
472
+ }
473
+ const side = getSide(placement);
474
+ const initialSideAxis = getSideAxis(initialPlacement);
475
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
476
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
477
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
478
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
479
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
480
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
481
+ }
482
+ const placements = [initialPlacement, ...fallbackPlacements];
483
+ const overflow = await detectOverflow(state, detectOverflowOptions);
484
+ const overflows = [];
485
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
486
+ if (checkMainAxis) {
487
+ overflows.push(overflow[side]);
488
+ }
489
+ if (checkCrossAxis) {
490
+ const sides = getAlignmentSides(placement, rects, rtl);
491
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
492
+ }
493
+ overflowsData = [...overflowsData, {
494
+ placement,
495
+ overflows
496
+ }];
497
+
498
+ // One or more sides is overflowing.
499
+ if (!overflows.every(side => side <= 0)) {
500
+ var _middlewareData$flip2, _overflowsData$filter;
501
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
502
+ const nextPlacement = placements[nextIndex];
503
+ if (nextPlacement) {
504
+ // Try next placement and re-run the lifecycle.
505
+ return {
506
+ data: {
507
+ index: nextIndex,
508
+ overflows: overflowsData
509
+ },
510
+ reset: {
511
+ placement: nextPlacement
512
+ }
513
+ };
514
+ }
515
+
516
+ // First, find the candidates that fit on the mainAxis side of overflow,
517
+ // then find the placement that fits the best on the main crossAxis side.
518
+ 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;
519
+
520
+ // Otherwise fallback.
521
+ if (!resetPlacement) {
522
+ switch (fallbackStrategy) {
523
+ case 'bestFit':
524
+ {
525
+ var _overflowsData$filter2;
526
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
527
+ if (hasFallbackAxisSideDirection) {
528
+ const currentSideAxis = getSideAxis(d.placement);
529
+ return currentSideAxis === initialSideAxis ||
530
+ // Create a bias to the `y` side axis due to horizontal
531
+ // reading directions favoring greater width.
532
+ currentSideAxis === 'y';
533
+ }
534
+ return true;
535
+ }).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];
536
+ if (placement) {
537
+ resetPlacement = placement;
538
+ }
539
+ break;
540
+ }
541
+ case 'initialPlacement':
542
+ resetPlacement = initialPlacement;
543
+ break;
544
+ }
545
+ }
546
+ if (placement !== resetPlacement) {
547
+ return {
548
+ reset: {
549
+ placement: resetPlacement
550
+ }
551
+ };
552
+ }
553
+ }
554
+ return {};
555
+ }
556
+ };
557
+ };
558
+
559
+ function getSideOffsets(overflow, rect) {
560
+ return {
561
+ top: overflow.top - rect.height,
562
+ right: overflow.right - rect.width,
563
+ bottom: overflow.bottom - rect.height,
564
+ left: overflow.left - rect.width
565
+ };
566
+ }
567
+ function isAnySideFullyClipped(overflow) {
568
+ return sides.some(side => overflow[side] >= 0);
569
+ }
570
+ /**
571
+ * Provides data to hide the floating element in applicable situations, such as
572
+ * when it is not in the same clipping context as the reference element.
573
+ * @see https://floating-ui.com/docs/hide
574
+ */
575
+ const hide$1 = function (options) {
576
+ if (options === void 0) {
577
+ options = {};
578
+ }
579
+ return {
580
+ name: 'hide',
581
+ options,
582
+ async fn(state) {
583
+ const {
584
+ rects
585
+ } = state;
586
+ const {
587
+ strategy = 'referenceHidden',
588
+ ...detectOverflowOptions
589
+ } = evaluate(options, state);
590
+ switch (strategy) {
591
+ case 'referenceHidden':
592
+ {
593
+ const overflow = await detectOverflow(state, {
594
+ ...detectOverflowOptions,
595
+ elementContext: 'reference'
596
+ });
597
+ const offsets = getSideOffsets(overflow, rects.reference);
598
+ return {
599
+ data: {
600
+ referenceHiddenOffsets: offsets,
601
+ referenceHidden: isAnySideFullyClipped(offsets)
602
+ }
603
+ };
604
+ }
605
+ case 'escaped':
606
+ {
607
+ const overflow = await detectOverflow(state, {
608
+ ...detectOverflowOptions,
609
+ altBoundary: true
610
+ });
611
+ const offsets = getSideOffsets(overflow, rects.floating);
612
+ return {
613
+ data: {
614
+ escapedOffsets: offsets,
615
+ escaped: isAnySideFullyClipped(offsets)
616
+ }
617
+ };
618
+ }
619
+ default:
620
+ {
621
+ return {};
622
+ }
623
+ }
624
+ }
625
+ };
626
+ };
627
+
628
+ // For type backwards-compatibility, the `OffsetOptions` type was also
629
+ // Derivable.
630
+
631
+ async function convertValueToCoords(state, options) {
632
+ const {
633
+ placement,
634
+ platform,
635
+ elements
636
+ } = state;
637
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
638
+ const side = getSide(placement);
639
+ const alignment = getAlignment(placement);
640
+ const isVertical = getSideAxis(placement) === 'y';
641
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
642
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
643
+ const rawValue = evaluate(options, state);
644
+
645
+ // eslint-disable-next-line prefer-const
646
+ let {
647
+ mainAxis,
648
+ crossAxis,
649
+ alignmentAxis
650
+ } = typeof rawValue === 'number' ? {
651
+ mainAxis: rawValue,
652
+ crossAxis: 0,
653
+ alignmentAxis: null
654
+ } : {
655
+ mainAxis: rawValue.mainAxis || 0,
656
+ crossAxis: rawValue.crossAxis || 0,
657
+ alignmentAxis: rawValue.alignmentAxis
658
+ };
659
+ if (alignment && typeof alignmentAxis === 'number') {
660
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
661
+ }
662
+ return isVertical ? {
663
+ x: crossAxis * crossAxisMulti,
664
+ y: mainAxis * mainAxisMulti
665
+ } : {
666
+ x: mainAxis * mainAxisMulti,
667
+ y: crossAxis * crossAxisMulti
668
+ };
669
+ }
670
+
671
+ /**
672
+ * Modifies the placement by translating the floating element along the
673
+ * specified axes.
674
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
675
+ * object may be passed.
676
+ * @see https://floating-ui.com/docs/offset
677
+ */
678
+ const offset$1 = function (options) {
679
+ if (options === void 0) {
680
+ options = 0;
681
+ }
682
+ return {
683
+ name: 'offset',
684
+ options,
685
+ async fn(state) {
686
+ var _middlewareData$offse, _middlewareData$arrow;
687
+ const {
688
+ x,
689
+ y,
690
+ placement,
691
+ middlewareData
692
+ } = state;
693
+ const diffCoords = await convertValueToCoords(state, options);
694
+
695
+ // If the placement is the same and the arrow caused an alignment offset
696
+ // then we don't need to change the positioning coordinates.
697
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
698
+ return {};
699
+ }
700
+ return {
701
+ x: x + diffCoords.x,
702
+ y: y + diffCoords.y,
703
+ data: {
704
+ ...diffCoords,
705
+ placement
706
+ }
707
+ };
708
+ }
709
+ };
710
+ };
711
+
712
+ /**
713
+ * Optimizes the visibility of the floating element by shifting it in order to
714
+ * keep it in view when it will overflow the clipping boundary.
715
+ * @see https://floating-ui.com/docs/shift
716
+ */
717
+ const shift$1 = function (options) {
718
+ if (options === void 0) {
719
+ options = {};
720
+ }
721
+ return {
722
+ name: 'shift',
723
+ options,
724
+ async fn(state) {
725
+ const {
726
+ x,
727
+ y,
728
+ placement
729
+ } = state;
730
+ const {
731
+ mainAxis: checkMainAxis = true,
732
+ crossAxis: checkCrossAxis = false,
733
+ limiter = {
734
+ fn: _ref => {
735
+ let {
736
+ x,
737
+ y
738
+ } = _ref;
739
+ return {
740
+ x,
741
+ y
742
+ };
743
+ }
744
+ },
745
+ ...detectOverflowOptions
746
+ } = evaluate(options, state);
747
+ const coords = {
748
+ x,
749
+ y
750
+ };
751
+ const overflow = await detectOverflow(state, detectOverflowOptions);
752
+ const crossAxis = getSideAxis(getSide(placement));
753
+ const mainAxis = getOppositeAxis(crossAxis);
754
+ let mainAxisCoord = coords[mainAxis];
755
+ let crossAxisCoord = coords[crossAxis];
756
+ if (checkMainAxis) {
757
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
758
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
759
+ const min = mainAxisCoord + overflow[minSide];
760
+ const max = mainAxisCoord - overflow[maxSide];
761
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
762
+ }
763
+ if (checkCrossAxis) {
764
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
765
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
766
+ const min = crossAxisCoord + overflow[minSide];
767
+ const max = crossAxisCoord - overflow[maxSide];
768
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
769
+ }
770
+ const limitedCoords = limiter.fn({
771
+ ...state,
772
+ [mainAxis]: mainAxisCoord,
773
+ [crossAxis]: crossAxisCoord
774
+ });
775
+ return {
776
+ ...limitedCoords,
777
+ data: {
778
+ x: limitedCoords.x - x,
779
+ y: limitedCoords.y - y,
780
+ enabled: {
781
+ [mainAxis]: checkMainAxis,
782
+ [crossAxis]: checkCrossAxis
783
+ }
784
+ }
785
+ };
786
+ }
787
+ };
788
+ };
789
+
790
+ function hasWindow() {
791
+ return typeof window !== 'undefined';
792
+ }
793
+ function getNodeName(node) {
794
+ if (isNode(node)) {
795
+ return (node.nodeName || '').toLowerCase();
796
+ }
797
+ // Mocked nodes in testing environments may not be instances of Node. By
798
+ // returning `#document` an infinite loop won't occur.
799
+ // https://github.com/floating-ui/floating-ui/issues/2317
800
+ return '#document';
801
+ }
802
+ function getWindow(node) {
803
+ var _node$ownerDocument;
804
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
805
+ }
806
+ function getDocumentElement(node) {
807
+ var _ref;
808
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
809
+ }
810
+ function isNode(value) {
811
+ if (!hasWindow()) {
812
+ return false;
813
+ }
814
+ return value instanceof Node || value instanceof getWindow(value).Node;
815
+ }
816
+ function isElement(value) {
817
+ if (!hasWindow()) {
818
+ return false;
819
+ }
820
+ return value instanceof Element || value instanceof getWindow(value).Element;
821
+ }
822
+ function isHTMLElement(value) {
823
+ if (!hasWindow()) {
824
+ return false;
825
+ }
826
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
827
+ }
828
+ function isShadowRoot(value) {
829
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
830
+ return false;
831
+ }
832
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
833
+ }
834
+ function isOverflowElement(element) {
835
+ const {
836
+ overflow,
837
+ overflowX,
838
+ overflowY,
839
+ display
840
+ } = getComputedStyle(element);
841
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
842
+ }
843
+ function isTableElement(element) {
844
+ return ['table', 'td', 'th'].includes(getNodeName(element));
845
+ }
846
+ function isTopLayer(element) {
847
+ return [':popover-open', ':modal'].some(selector => {
848
+ try {
849
+ return element.matches(selector);
850
+ } catch (e) {
851
+ return false;
852
+ }
853
+ });
854
+ }
855
+ function isContainingBlock(elementOrCss) {
856
+ const webkit = isWebKit();
857
+ const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
858
+
859
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
860
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
861
+ return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
862
+ }
863
+ function getContainingBlock(element) {
864
+ let currentNode = getParentNode(element);
865
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
866
+ if (isContainingBlock(currentNode)) {
867
+ return currentNode;
868
+ } else if (isTopLayer(currentNode)) {
869
+ return null;
870
+ }
871
+ currentNode = getParentNode(currentNode);
872
+ }
873
+ return null;
874
+ }
875
+ function isWebKit() {
876
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
877
+ return CSS.supports('-webkit-backdrop-filter', 'none');
878
+ }
879
+ function isLastTraversableNode(node) {
880
+ return ['html', 'body', '#document'].includes(getNodeName(node));
881
+ }
882
+ function getComputedStyle(element) {
883
+ return getWindow(element).getComputedStyle(element);
884
+ }
885
+ function getNodeScroll(element) {
886
+ if (isElement(element)) {
887
+ return {
888
+ scrollLeft: element.scrollLeft,
889
+ scrollTop: element.scrollTop
890
+ };
891
+ }
892
+ return {
893
+ scrollLeft: element.scrollX,
894
+ scrollTop: element.scrollY
895
+ };
896
+ }
897
+ function getParentNode(node) {
898
+ if (getNodeName(node) === 'html') {
899
+ return node;
900
+ }
901
+ const result =
902
+ // Step into the shadow DOM of the parent of a slotted node.
903
+ node.assignedSlot ||
904
+ // DOM Element detected.
905
+ node.parentNode ||
906
+ // ShadowRoot detected.
907
+ isShadowRoot(node) && node.host ||
908
+ // Fallback.
909
+ getDocumentElement(node);
910
+ return isShadowRoot(result) ? result.host : result;
911
+ }
912
+ function getNearestOverflowAncestor(node) {
913
+ const parentNode = getParentNode(node);
914
+ if (isLastTraversableNode(parentNode)) {
915
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
916
+ }
917
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
918
+ return parentNode;
919
+ }
920
+ return getNearestOverflowAncestor(parentNode);
921
+ }
922
+ function getOverflowAncestors(node, list, traverseIframes) {
923
+ var _node$ownerDocument2;
924
+ if (list === void 0) {
925
+ list = [];
926
+ }
927
+ if (traverseIframes === void 0) {
928
+ traverseIframes = true;
929
+ }
930
+ const scrollableAncestor = getNearestOverflowAncestor(node);
931
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
932
+ const win = getWindow(scrollableAncestor);
933
+ if (isBody) {
934
+ const frameElement = getFrameElement(win);
935
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
936
+ }
937
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
938
+ }
939
+ function getFrameElement(win) {
940
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
941
+ }
942
+
943
+ function getCssDimensions(element) {
944
+ const css = getComputedStyle(element);
945
+ // In testing environments, the `width` and `height` properties are empty
946
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
947
+ let width = parseFloat(css.width) || 0;
948
+ let height = parseFloat(css.height) || 0;
949
+ const hasOffset = isHTMLElement(element);
950
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
951
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
952
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
953
+ if (shouldFallback) {
954
+ width = offsetWidth;
955
+ height = offsetHeight;
956
+ }
957
+ return {
958
+ width,
959
+ height,
960
+ $: shouldFallback
961
+ };
962
+ }
963
+
964
+ function unwrapElement(element) {
965
+ return !isElement(element) ? element.contextElement : element;
966
+ }
967
+
968
+ function getScale(element) {
969
+ const domElement = unwrapElement(element);
970
+ if (!isHTMLElement(domElement)) {
971
+ return createCoords(1);
972
+ }
973
+ const rect = domElement.getBoundingClientRect();
974
+ const {
975
+ width,
976
+ height,
977
+ $
978
+ } = getCssDimensions(domElement);
979
+ let x = ($ ? round(rect.width) : rect.width) / width;
980
+ let y = ($ ? round(rect.height) : rect.height) / height;
981
+
982
+ // 0, NaN, or Infinity should always fallback to 1.
983
+
984
+ if (!x || !Number.isFinite(x)) {
985
+ x = 1;
986
+ }
987
+ if (!y || !Number.isFinite(y)) {
988
+ y = 1;
989
+ }
990
+ return {
991
+ x,
992
+ y
993
+ };
994
+ }
995
+
996
+ const noOffsets = /*#__PURE__*/createCoords(0);
997
+ function getVisualOffsets(element) {
998
+ const win = getWindow(element);
999
+ if (!isWebKit() || !win.visualViewport) {
1000
+ return noOffsets;
1001
+ }
1002
+ return {
1003
+ x: win.visualViewport.offsetLeft,
1004
+ y: win.visualViewport.offsetTop
1005
+ };
1006
+ }
1007
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1008
+ if (isFixed === void 0) {
1009
+ isFixed = false;
1010
+ }
1011
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1012
+ return false;
1013
+ }
1014
+ return isFixed;
1015
+ }
1016
+
1017
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1018
+ if (includeScale === void 0) {
1019
+ includeScale = false;
1020
+ }
1021
+ if (isFixedStrategy === void 0) {
1022
+ isFixedStrategy = false;
1023
+ }
1024
+ const clientRect = element.getBoundingClientRect();
1025
+ const domElement = unwrapElement(element);
1026
+ let scale = createCoords(1);
1027
+ if (includeScale) {
1028
+ if (offsetParent) {
1029
+ if (isElement(offsetParent)) {
1030
+ scale = getScale(offsetParent);
1031
+ }
1032
+ } else {
1033
+ scale = getScale(element);
1034
+ }
1035
+ }
1036
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1037
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1038
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1039
+ let width = clientRect.width / scale.x;
1040
+ let height = clientRect.height / scale.y;
1041
+ if (domElement) {
1042
+ const win = getWindow(domElement);
1043
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1044
+ let currentWin = win;
1045
+ let currentIFrame = getFrameElement(currentWin);
1046
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1047
+ const iframeScale = getScale(currentIFrame);
1048
+ const iframeRect = currentIFrame.getBoundingClientRect();
1049
+ const css = getComputedStyle(currentIFrame);
1050
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1051
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1052
+ x *= iframeScale.x;
1053
+ y *= iframeScale.y;
1054
+ width *= iframeScale.x;
1055
+ height *= iframeScale.y;
1056
+ x += left;
1057
+ y += top;
1058
+ currentWin = getWindow(currentIFrame);
1059
+ currentIFrame = getFrameElement(currentWin);
1060
+ }
1061
+ }
1062
+ return rectToClientRect({
1063
+ width,
1064
+ height,
1065
+ x,
1066
+ y
1067
+ });
1068
+ }
1069
+
1070
+ // If <html> has a CSS width greater than the viewport, then this will be
1071
+ // incorrect for RTL.
1072
+ function getWindowScrollBarX(element, rect) {
1073
+ const leftScroll = getNodeScroll(element).scrollLeft;
1074
+ if (!rect) {
1075
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1076
+ }
1077
+ return rect.left + leftScroll;
1078
+ }
1079
+
1080
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
1081
+ if (ignoreScrollbarX === void 0) {
1082
+ ignoreScrollbarX = false;
1083
+ }
1084
+ const htmlRect = documentElement.getBoundingClientRect();
1085
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
1086
+ // RTL <body> scrollbar.
1087
+ getWindowScrollBarX(documentElement, htmlRect));
1088
+ const y = htmlRect.top + scroll.scrollTop;
1089
+ return {
1090
+ x,
1091
+ y
1092
+ };
1093
+ }
1094
+
1095
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1096
+ let {
1097
+ elements,
1098
+ rect,
1099
+ offsetParent,
1100
+ strategy
1101
+ } = _ref;
1102
+ const isFixed = strategy === 'fixed';
1103
+ const documentElement = getDocumentElement(offsetParent);
1104
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1105
+ if (offsetParent === documentElement || topLayer && isFixed) {
1106
+ return rect;
1107
+ }
1108
+ let scroll = {
1109
+ scrollLeft: 0,
1110
+ scrollTop: 0
1111
+ };
1112
+ let scale = createCoords(1);
1113
+ const offsets = createCoords(0);
1114
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1115
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1116
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1117
+ scroll = getNodeScroll(offsetParent);
1118
+ }
1119
+ if (isHTMLElement(offsetParent)) {
1120
+ const offsetRect = getBoundingClientRect(offsetParent);
1121
+ scale = getScale(offsetParent);
1122
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1123
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1124
+ }
1125
+ }
1126
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
1127
+ return {
1128
+ width: rect.width * scale.x,
1129
+ height: rect.height * scale.y,
1130
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1131
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1132
+ };
1133
+ }
1134
+
1135
+ function getClientRects(element) {
1136
+ return Array.from(element.getClientRects());
1137
+ }
1138
+
1139
+ // Gets the entire size of the scrollable document area, even extending outside
1140
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1141
+ function getDocumentRect(element) {
1142
+ const html = getDocumentElement(element);
1143
+ const scroll = getNodeScroll(element);
1144
+ const body = element.ownerDocument.body;
1145
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1146
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1147
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1148
+ const y = -scroll.scrollTop;
1149
+ if (getComputedStyle(body).direction === 'rtl') {
1150
+ x += max(html.clientWidth, body.clientWidth) - width;
1151
+ }
1152
+ return {
1153
+ width,
1154
+ height,
1155
+ x,
1156
+ y
1157
+ };
1158
+ }
1159
+
1160
+ function getViewportRect(element, strategy) {
1161
+ const win = getWindow(element);
1162
+ const html = getDocumentElement(element);
1163
+ const visualViewport = win.visualViewport;
1164
+ let width = html.clientWidth;
1165
+ let height = html.clientHeight;
1166
+ let x = 0;
1167
+ let y = 0;
1168
+ if (visualViewport) {
1169
+ width = visualViewport.width;
1170
+ height = visualViewport.height;
1171
+ const visualViewportBased = isWebKit();
1172
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1173
+ x = visualViewport.offsetLeft;
1174
+ y = visualViewport.offsetTop;
1175
+ }
1176
+ }
1177
+ return {
1178
+ width,
1179
+ height,
1180
+ x,
1181
+ y
1182
+ };
1183
+ }
1184
+
1185
+ // Returns the inner client rect, subtracting scrollbars if present.
1186
+ function getInnerBoundingClientRect(element, strategy) {
1187
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1188
+ const top = clientRect.top + element.clientTop;
1189
+ const left = clientRect.left + element.clientLeft;
1190
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1191
+ const width = element.clientWidth * scale.x;
1192
+ const height = element.clientHeight * scale.y;
1193
+ const x = left * scale.x;
1194
+ const y = top * scale.y;
1195
+ return {
1196
+ width,
1197
+ height,
1198
+ x,
1199
+ y
1200
+ };
1201
+ }
1202
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1203
+ let rect;
1204
+ if (clippingAncestor === 'viewport') {
1205
+ rect = getViewportRect(element, strategy);
1206
+ } else if (clippingAncestor === 'document') {
1207
+ rect = getDocumentRect(getDocumentElement(element));
1208
+ } else if (isElement(clippingAncestor)) {
1209
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1210
+ } else {
1211
+ const visualOffsets = getVisualOffsets(element);
1212
+ rect = {
1213
+ x: clippingAncestor.x - visualOffsets.x,
1214
+ y: clippingAncestor.y - visualOffsets.y,
1215
+ width: clippingAncestor.width,
1216
+ height: clippingAncestor.height
1217
+ };
1218
+ }
1219
+ return rectToClientRect(rect);
1220
+ }
1221
+ function hasFixedPositionAncestor(element, stopNode) {
1222
+ const parentNode = getParentNode(element);
1223
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1224
+ return false;
1225
+ }
1226
+ return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1227
+ }
1228
+
1229
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1230
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1231
+ // of the given element up the tree.
1232
+ function getClippingElementAncestors(element, cache) {
1233
+ const cachedResult = cache.get(element);
1234
+ if (cachedResult) {
1235
+ return cachedResult;
1236
+ }
1237
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1238
+ let currentContainingBlockComputedStyle = null;
1239
+ const elementIsFixed = getComputedStyle(element).position === 'fixed';
1240
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1241
+
1242
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1243
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1244
+ const computedStyle = getComputedStyle(currentNode);
1245
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1246
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1247
+ currentContainingBlockComputedStyle = null;
1248
+ }
1249
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1250
+ if (shouldDropCurrentNode) {
1251
+ // Drop non-containing blocks.
1252
+ result = result.filter(ancestor => ancestor !== currentNode);
1253
+ } else {
1254
+ // Record last containing block for next iteration.
1255
+ currentContainingBlockComputedStyle = computedStyle;
1256
+ }
1257
+ currentNode = getParentNode(currentNode);
1258
+ }
1259
+ cache.set(element, result);
1260
+ return result;
1261
+ }
1262
+
1263
+ // Gets the maximum area that the element is visible in due to any number of
1264
+ // clipping ancestors.
1265
+ function getClippingRect(_ref) {
1266
+ let {
1267
+ element,
1268
+ boundary,
1269
+ rootBoundary,
1270
+ strategy
1271
+ } = _ref;
1272
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1273
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1274
+ const firstClippingAncestor = clippingAncestors[0];
1275
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1276
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1277
+ accRect.top = max(rect.top, accRect.top);
1278
+ accRect.right = min(rect.right, accRect.right);
1279
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1280
+ accRect.left = max(rect.left, accRect.left);
1281
+ return accRect;
1282
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1283
+ return {
1284
+ width: clippingRect.right - clippingRect.left,
1285
+ height: clippingRect.bottom - clippingRect.top,
1286
+ x: clippingRect.left,
1287
+ y: clippingRect.top
1288
+ };
1289
+ }
1290
+
1291
+ function getDimensions(element) {
1292
+ const {
1293
+ width,
1294
+ height
1295
+ } = getCssDimensions(element);
1296
+ return {
1297
+ width,
1298
+ height
1299
+ };
1300
+ }
1301
+
1302
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1303
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1304
+ const documentElement = getDocumentElement(offsetParent);
1305
+ const isFixed = strategy === 'fixed';
1306
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1307
+ let scroll = {
1308
+ scrollLeft: 0,
1309
+ scrollTop: 0
1310
+ };
1311
+ const offsets = createCoords(0);
1312
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1313
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1314
+ scroll = getNodeScroll(offsetParent);
1315
+ }
1316
+ if (isOffsetParentAnElement) {
1317
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1318
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1319
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1320
+ } else if (documentElement) {
1321
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1322
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1323
+ offsets.x = getWindowScrollBarX(documentElement);
1324
+ }
1325
+ }
1326
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1327
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1328
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1329
+ return {
1330
+ x,
1331
+ y,
1332
+ width: rect.width,
1333
+ height: rect.height
1334
+ };
1335
+ }
1336
+
1337
+ function isStaticPositioned(element) {
1338
+ return getComputedStyle(element).position === 'static';
1339
+ }
1340
+
1341
+ function getTrueOffsetParent(element, polyfill) {
1342
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1343
+ return null;
1344
+ }
1345
+ if (polyfill) {
1346
+ return polyfill(element);
1347
+ }
1348
+ let rawOffsetParent = element.offsetParent;
1349
+
1350
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
1351
+ // while Chrome and Safari return the <body> element. The <body> element must
1352
+ // be used to perform the correct calculations even if the <html> element is
1353
+ // non-static.
1354
+ if (getDocumentElement(element) === rawOffsetParent) {
1355
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1356
+ }
1357
+ return rawOffsetParent;
1358
+ }
1359
+
1360
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1361
+ // such as table ancestors and cross browser bugs.
1362
+ function getOffsetParent(element, polyfill) {
1363
+ const win = getWindow(element);
1364
+ if (isTopLayer(element)) {
1365
+ return win;
1366
+ }
1367
+ if (!isHTMLElement(element)) {
1368
+ let svgOffsetParent = getParentNode(element);
1369
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1370
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1371
+ return svgOffsetParent;
1372
+ }
1373
+ svgOffsetParent = getParentNode(svgOffsetParent);
1374
+ }
1375
+ return win;
1376
+ }
1377
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1378
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1379
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1380
+ }
1381
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1382
+ return win;
1383
+ }
1384
+ return offsetParent || getContainingBlock(element) || win;
1385
+ }
1386
+
1387
+ const getElementRects = async function (data) {
1388
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1389
+ const getDimensionsFn = this.getDimensions;
1390
+ const floatingDimensions = await getDimensionsFn(data.floating);
1391
+ return {
1392
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1393
+ floating: {
1394
+ x: 0,
1395
+ y: 0,
1396
+ width: floatingDimensions.width,
1397
+ height: floatingDimensions.height
1398
+ }
1399
+ };
1400
+ };
1401
+
1402
+ function isRTL(element) {
1403
+ return getComputedStyle(element).direction === 'rtl';
1404
+ }
1405
+
1406
+ const platform = {
1407
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1408
+ getDocumentElement,
1409
+ getClippingRect,
1410
+ getOffsetParent,
1411
+ getElementRects,
1412
+ getClientRects,
1413
+ getDimensions,
1414
+ getScale,
1415
+ isElement,
1416
+ isRTL
1417
+ };
1418
+
1419
+ function rectsAreEqual(a, b) {
1420
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1421
+ }
1422
+
1423
+ // https://samthor.au/2021/observing-dom/
1424
+ function observeMove(element, onMove) {
1425
+ let io = null;
1426
+ let timeoutId;
1427
+ const root = getDocumentElement(element);
1428
+ function cleanup() {
1429
+ var _io;
1430
+ clearTimeout(timeoutId);
1431
+ (_io = io) == null || _io.disconnect();
1432
+ io = null;
1433
+ }
1434
+ function refresh(skip, threshold) {
1435
+ if (skip === void 0) {
1436
+ skip = false;
1437
+ }
1438
+ if (threshold === void 0) {
1439
+ threshold = 1;
1440
+ }
1441
+ cleanup();
1442
+ const elementRectForRootMargin = element.getBoundingClientRect();
1443
+ const {
1444
+ left,
1445
+ top,
1446
+ width,
1447
+ height
1448
+ } = elementRectForRootMargin;
1449
+ if (!skip) {
1450
+ onMove();
1451
+ }
1452
+ if (!width || !height) {
1453
+ return;
1454
+ }
1455
+ const insetTop = floor(top);
1456
+ const insetRight = floor(root.clientWidth - (left + width));
1457
+ const insetBottom = floor(root.clientHeight - (top + height));
1458
+ const insetLeft = floor(left);
1459
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1460
+ const options = {
1461
+ rootMargin,
1462
+ threshold: max(0, min(1, threshold)) || 1
1463
+ };
1464
+ let isFirstUpdate = true;
1465
+ function handleObserve(entries) {
1466
+ const ratio = entries[0].intersectionRatio;
1467
+ if (ratio !== threshold) {
1468
+ if (!isFirstUpdate) {
1469
+ return refresh();
1470
+ }
1471
+ if (!ratio) {
1472
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
1473
+ // to prevent an infinite loop of updates.
1474
+ timeoutId = setTimeout(() => {
1475
+ refresh(false, 1e-7);
1476
+ }, 1000);
1477
+ } else {
1478
+ refresh(false, ratio);
1479
+ }
1480
+ }
1481
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1482
+ // It's possible that even though the ratio is reported as 1, the
1483
+ // element is not actually fully within the IntersectionObserver's root
1484
+ // area anymore. This can happen under performance constraints. This may
1485
+ // be a bug in the browser's IntersectionObserver implementation. To
1486
+ // work around this, we compare the element's bounding rect now with
1487
+ // what it was at the time we created the IntersectionObserver. If they
1488
+ // are not equal then the element moved, so we refresh.
1489
+ refresh();
1490
+ }
1491
+ isFirstUpdate = false;
1492
+ }
1493
+
1494
+ // Older browsers don't support a `document` as the root and will throw an
1495
+ // error.
1496
+ try {
1497
+ io = new IntersectionObserver(handleObserve, {
1498
+ ...options,
1499
+ // Handle <iframe>s
1500
+ root: root.ownerDocument
1501
+ });
1502
+ } catch (e) {
1503
+ io = new IntersectionObserver(handleObserve, options);
1504
+ }
1505
+ io.observe(element);
1506
+ }
1507
+ refresh(true);
1508
+ return cleanup;
1509
+ }
1510
+
1511
+ /**
1512
+ * Automatically updates the position of the floating element when necessary.
1513
+ * Should only be called when the floating element is mounted on the DOM or
1514
+ * visible on the screen.
1515
+ * @returns cleanup function that should be invoked when the floating element is
1516
+ * removed from the DOM or hidden from the screen.
1517
+ * @see https://floating-ui.com/docs/autoUpdate
1518
+ */
1519
+ function autoUpdate(reference, floating, update, options) {
1520
+ if (options === void 0) {
1521
+ options = {};
1522
+ }
1523
+ const {
1524
+ ancestorScroll = true,
1525
+ ancestorResize = true,
1526
+ elementResize = typeof ResizeObserver === 'function',
1527
+ layoutShift = typeof IntersectionObserver === 'function',
1528
+ animationFrame = false
1529
+ } = options;
1530
+ const referenceEl = unwrapElement(reference);
1531
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1532
+ ancestors.forEach(ancestor => {
1533
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1534
+ passive: true
1535
+ });
1536
+ ancestorResize && ancestor.addEventListener('resize', update);
1537
+ });
1538
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1539
+ let reobserveFrame = -1;
1540
+ let resizeObserver = null;
1541
+ if (elementResize) {
1542
+ resizeObserver = new ResizeObserver(_ref => {
1543
+ let [firstEntry] = _ref;
1544
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1545
+ // Prevent update loops when using the `size` middleware.
1546
+ // https://github.com/floating-ui/floating-ui/issues/1740
1547
+ resizeObserver.unobserve(floating);
1548
+ cancelAnimationFrame(reobserveFrame);
1549
+ reobserveFrame = requestAnimationFrame(() => {
1550
+ var _resizeObserver;
1551
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1552
+ });
1553
+ }
1554
+ update();
1555
+ });
1556
+ if (referenceEl && !animationFrame) {
1557
+ resizeObserver.observe(referenceEl);
1558
+ }
1559
+ resizeObserver.observe(floating);
1560
+ }
1561
+ let frameId;
1562
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1563
+ if (animationFrame) {
1564
+ frameLoop();
1565
+ }
1566
+ function frameLoop() {
1567
+ const nextRefRect = getBoundingClientRect(reference);
1568
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1569
+ update();
1570
+ }
1571
+ prevRefRect = nextRefRect;
1572
+ frameId = requestAnimationFrame(frameLoop);
1573
+ }
1574
+ update();
1575
+ return () => {
1576
+ var _resizeObserver2;
1577
+ ancestors.forEach(ancestor => {
1578
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1579
+ ancestorResize && ancestor.removeEventListener('resize', update);
1580
+ });
1581
+ cleanupIo == null || cleanupIo();
1582
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1583
+ resizeObserver = null;
1584
+ if (animationFrame) {
1585
+ cancelAnimationFrame(frameId);
1586
+ }
1587
+ };
1588
+ }
1589
+
1590
+ /**
1591
+ * Modifies the placement by translating the floating element along the
1592
+ * specified axes.
1593
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1594
+ * object may be passed.
1595
+ * @see https://floating-ui.com/docs/offset
1596
+ */
1597
+ const offset = offset$1;
1598
+
1599
+ /**
1600
+ * Optimizes the visibility of the floating element by shifting it in order to
1601
+ * keep it in view when it will overflow the clipping boundary.
1602
+ * @see https://floating-ui.com/docs/shift
1603
+ */
1604
+ const shift = shift$1;
1605
+
1606
+ /**
1607
+ * Optimizes the visibility of the floating element by flipping the `placement`
1608
+ * in order to keep it in view when the preferred placement(s) will overflow the
1609
+ * clipping boundary. Alternative to `autoPlacement`.
1610
+ * @see https://floating-ui.com/docs/flip
1611
+ */
1612
+ const flip = flip$1;
1613
+
1614
+ /**
1615
+ * Provides data to hide the floating element in applicable situations, such as
1616
+ * when it is not in the same clipping context as the reference element.
1617
+ * @see https://floating-ui.com/docs/hide
1618
+ */
1619
+ const hide = hide$1;
1620
+
1621
+ /**
1622
+ * Provides data to position an inner element of the floating element so that it
1623
+ * appears centered to the reference element.
1624
+ * @see https://floating-ui.com/docs/arrow
1625
+ */
1626
+ const arrow = arrow$1;
1627
+
1628
+ /**
1629
+ * Computes the `x` and `y` coordinates that will place the floating element
1630
+ * next to a given reference element.
1631
+ */
1632
+ const computePosition = (reference, floating, options) => {
1633
+ // This caches the expensive `getClippingElementAncestors` function so that
1634
+ // multiple lifecycle resets re-use the same result. It only lives for a
1635
+ // single call. If other functions become expensive, we can add them as well.
1636
+ const cache = new Map();
1637
+ const mergedOptions = {
1638
+ platform,
1639
+ ...options
1640
+ };
1641
+ const platformWithCache = {
1642
+ ...mergedOptions.platform,
1643
+ _c: cache
1644
+ };
1645
+ return computePosition$1(reference, floating, {
1646
+ ...mergedOptions,
1647
+ platform: platformWithCache
1648
+ });
1649
+ };
1650
+
1651
+ const onboardingTipCss = "*,*::after,*::before{box-sizing:border-box}.sr-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}::slotted([slot=heading]){display:flex !important;align-items:center !important;margin-block-end:0 !important;margin-block-start:0 !important;color:#fff !important;line-height:1.375 !important}:host{--_dso-button-primary-background-color:#fff;--_dso-button-primary-border-color:#fff;--_dso-button-primary-color:#000;--_dso-button-primary-hover-background-color:#ccc;--_dso-button-primary-hover-border-color:#ccc;--_dso-button-primary-hover-color:#000;--_dso-button-primary-active-background-color:#999;--_dso-button-primary-active-border-color:#999;--_dso-button-primary-active-color:#000;--_dso-button-primary-disabled-background-color:#fff;--_dso-button-primary-disabled-border-color:#fff;--_dso-button-primary-disabled-color:#b2b2b2;--_dso-button-secondary-background-color:#fff;--_dso-button-secondary-border-color:#fff;--_dso-button-secondary-color:#000;--_dso-button-secondary-hover-background-color:#ccc;--_dso-button-secondary-hover-border-color:#ccc;--_dso-button-secondary-hover-color:#000;--_dso-button-secondary-active-background-color:#999;--_dso-button-secondary-active-border-color:#999;--_dso-button-secondary-active-color:#000;--_dso-button-secondary-disabled-background-color:#fff;--_dso-button-secondary-disabled-border-color:#fff;--_dso-button-secondary-disabled-color:#b2b2b2;display:block;filter:drop-shadow(2px 2px 16px rgba(0, 0, 0, 0.4))}:host([popover]){margin:0 !important;border:0;padding:0;background-color:transparent;overflow:unset}.onboarding-tip{font-family:Asap, sans-serif;font-style:normal;font-weight:400;line-height:1.5;line-break:auto;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:break-word;word-spacing:normal;word-wrap:normal;white-space:normal;font-size:14px;inset-block-start:0;inset-inline-start:0;z-index:410}@media screen and (max-width: 360px){.onboarding-tip{padding-inline-start:8px !important}}.dso-close{-webkit-appearance:button;color:inherit;cursor:pointer;font:inherit;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;overflow:visible;text-transform:none;position:absolute;inset-block-start:0;inset-inline-end:0;block-size:32px;inline-size:32px;padding:0;background-color:transparent;border:0;text-align:center}.dso-close[disabled]{cursor:default}.dso-close::-moz-focus-inner{border:0;padding:0}.onboarding-tip-inner{--link-color:#fff;--link-hover-color:#b2b2b2;--link-visited-color:#7f7f7f;max-inline-size:min(360px, 100vw - 2 * 8px);max-block-size:40vh;overflow:auto;padding-block:32px 8px;padding-inline:8px;border-radius:4px;display:block;font-size:1rem;position:relative;z-index:2}.onboarding-tip-inner{background-color:#2b5780;border-color:#2b5780;color:#fff}.onboarding-tip-arrow{border-start-start-radius:4px;position:absolute;block-size:20px;inline-size:20px;background:#2b5780;z-index:1;pointer-events:none}.onboarding-tip-content-wrapper{padding-inline:16px;padding-block-end:16px}.onboarding-tip-content-heading{display:flex}.onboarding-tip-content-heading dso-icon{margin-inline-end:8px}";
1652
+
1653
+ const OnboardingTip = /*@__PURE__*/ proxyCustomElement(class OnboardingTip extends HTMLElement$1 {
1654
+ constructor() {
1655
+ super();
1656
+ this.__registerHost();
1657
+ this.__attachShadow();
1658
+ this.dsoClose = createEvent(this, "dsoClose", 7);
1659
+ /**
1660
+ * Where to place the Onboarding Tip relative to its reference element.
1661
+ */
1662
+ this.placement = "right";
1663
+ }
1664
+ componentDidRender() {
1665
+ if (!this.host.matches(":popover-open")) {
1666
+ this.host.showPopover();
1667
+ }
1668
+ if (!this.cleanUp && this.referenceElement && this.tipArrowRef instanceof HTMLElement$1) {
1669
+ this.cleanUp = OnboardingTip.positionTip(this.referenceElement, this.host, this.tipArrowRef, this.placement);
1670
+ }
1671
+ }
1672
+ disconnectedCallback() {
1673
+ var _a;
1674
+ if (this.host.matches(":popover-open")) {
1675
+ this.host.hidePopover();
1676
+ }
1677
+ (_a = this.cleanUp) === null || _a === void 0 ? void 0 : _a.call(this);
1678
+ this.cleanUp = undefined;
1679
+ }
1680
+ /**
1681
+ * This function positions the Onboarding Tip relative to its reference element. It is static so the position is calculated
1682
+ * only using the passed arguments.
1683
+ */
1684
+ static positionTip(referenceElement, tipRef, tipArrowRef, placement) {
1685
+ // Get half the arrow box's hypotenuse length
1686
+ const arrowLength = tipArrowRef.offsetWidth;
1687
+ const floatingOffset = Math.sqrt(2 * arrowLength ** 2) / 2;
1688
+ const padding = 5;
1689
+ return autoUpdate(referenceElement, tipRef, () => {
1690
+ computePosition(referenceElement, tipRef, {
1691
+ strategy: "fixed",
1692
+ middleware: [
1693
+ offset(floatingOffset),
1694
+ flip({
1695
+ padding,
1696
+ }),
1697
+ shift({
1698
+ padding,
1699
+ }),
1700
+ arrow({
1701
+ padding: padding + arrowLength,
1702
+ element: tipArrowRef,
1703
+ }),
1704
+ hide({
1705
+ padding: 42,
1706
+ }),
1707
+ ],
1708
+ placement,
1709
+ }).then(({ x, y, middlewareData, placement: computedPlacement }) => {
1710
+ if (middlewareData.hide) {
1711
+ Object.assign(tipRef.style, {
1712
+ visibility: middlewareData.hide.referenceHidden ? "hidden" : "visible",
1713
+ });
1714
+ }
1715
+ Object.assign(tipRef.style, {
1716
+ left: `${x}px`,
1717
+ top: `${y}px`,
1718
+ });
1719
+ const side = computedPlacement.split("-")[0];
1720
+ const staticSide = side
1721
+ ? {
1722
+ top: "bottom",
1723
+ right: "left",
1724
+ bottom: "top",
1725
+ left: "right",
1726
+ }[side]
1727
+ : "top";
1728
+ let angle;
1729
+ switch (staticSide) {
1730
+ default:
1731
+ case "top":
1732
+ angle = 45;
1733
+ break;
1734
+ case "right":
1735
+ angle = 135;
1736
+ break;
1737
+ case "bottom":
1738
+ angle = 225;
1739
+ break;
1740
+ case "left":
1741
+ angle = 315;
1742
+ break;
1743
+ }
1744
+ if (middlewareData.arrow && staticSide) {
1745
+ const { x: arrowX, y: arrowY } = middlewareData.arrow;
1746
+ Object.assign(tipArrowRef.style, {
1747
+ right: "",
1748
+ bottom: "",
1749
+ left: arrowX ? `${arrowX}px` : "",
1750
+ top: arrowY ? `${arrowY}px` : "",
1751
+ [staticSide]: `${-arrowLength / 2}px`,
1752
+ transform: `rotate(${angle}deg)`,
1753
+ });
1754
+ }
1755
+ });
1756
+ });
1757
+ }
1758
+ render() {
1759
+ return (h(Host, { key: '81f55bb9189b1e006db917d0563d67701710f519', popover: "manual" }, h("div", { key: 'eed3544de4a3a2b592c4ae418a582e87b2ee0133', class: "onboarding-tip", role: "tooltip" }, h("div", { key: '5847872cf4e5b918c525d62a3d592a765a8e8154', class: "onboarding-tip-inner" }, h("div", { key: 'c35d3a3fe5e926dde418019e1b8b209e6223d504', class: "onboarding-tip-content-wrapper" }, this.headingSlottedElement !== null && (h("div", { key: '1911891c6aff456fc4e43f80b687f87d1ba1df9d', class: "onboarding-tip-content-heading" }, h("dso-icon", { key: '3050474a5736b09709e114f1397b8160cb5b9868', icon: "light-bulb" }), h("slot", { key: '86c668f6602ba615db80c4338edc1157cdaa9999', name: "heading" }))), h("button", { key: '65d9ec9d3e84a409fa18ebd4d6343377a6e25126', type: "button", class: "dso-close", onClick: (e) => this.dsoClose.emit({ originalEvent: e }) }, h("dso-icon", { key: 'ec8eb3a63525d2736debd7986ce5546619315553', icon: "times" }), h("span", { key: '99e9048e8003e211488c7fdd2eeda4a32c740b3a', class: "sr-only" }, "Sluiten")), h("slot", { key: '886ba7c055fc303d0186dec7ca30c90d2c6c2943' }))), h("div", { key: 'e838baea223b335370a4d0f14f300fa6d48853a7', class: "onboarding-tip-arrow", ref: (ref) => (this.tipArrowRef = ref) }))));
1760
+ }
1761
+ get headingSlottedElement() {
1762
+ return this.host.querySelector("[slot='heading']");
1763
+ }
1764
+ get referenceElement() {
1765
+ const id = this.host.id;
1766
+ if (!id) {
1767
+ console.warn("Unable to find reference. Onboarding Tip has no [id] attribute.");
1768
+ return;
1769
+ }
1770
+ const rootNode = this.host.getRootNode();
1771
+ if (!(rootNode instanceof Document || rootNode instanceof ShadowRoot)) {
1772
+ console.warn(`rootNode is not instance of Document or ShadowRoot`);
1773
+ return;
1774
+ }
1775
+ const reference = rootNode.querySelector(`[aria-describedby="${id}`);
1776
+ if (!reference) {
1777
+ console.warn(`Unable to find reference element with aria-describedby ${id}`);
1778
+ return;
1779
+ }
1780
+ return reference;
1781
+ }
1782
+ get host() { return this; }
1783
+ static get style() { return onboardingTipCss; }
1784
+ }, [1, "dso-onboarding-tip", {
1785
+ "placement": [1]
1786
+ }]);
1787
+ function defineCustomElement$1() {
1788
+ if (typeof customElements === "undefined") {
1789
+ return;
1790
+ }
1791
+ const components = ["dso-onboarding-tip", "dso-icon"];
1792
+ components.forEach(tagName => { switch (tagName) {
1793
+ case "dso-onboarding-tip":
1794
+ if (!customElements.get(tagName)) {
1795
+ customElements.define(tagName, OnboardingTip);
1796
+ }
1797
+ break;
1798
+ case "dso-icon":
1799
+ if (!customElements.get(tagName)) {
1800
+ defineCustomElement$2();
1801
+ }
1802
+ break;
1803
+ } });
1804
+ }
1805
+
1806
+ const DsoOnboardingTip = OnboardingTip;
1807
+ const defineCustomElement = defineCustomElement$1;
1808
+
1809
+ export { DsoOnboardingTip, defineCustomElement };
1810
+ //# sourceMappingURL=dso-onboarding-tip.js.map
1811
+
1812
+ //# sourceMappingURL=dso-onboarding-tip.js.map