satis 2.0.7 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +11 -0
- data/.gitignore +15 -0
- data/.nvmrc +1 -0
- data/.rubocop.yml +18 -0
- data/Gemfile +27 -0
- data/Procfile +2 -0
- data/TODO.md +26 -0
- data/app/assets/images/satis/.keep +0 -0
- data/bin/importmap +4 -0
- data/bin/rails +14 -0
- data/lib/satis/version.rb +1 -1
- data/package.json +9 -0
- data/satis.gemspec +39 -0
- data/vendor/javascript/@codemirror--autocomplete.js +2 -0
- data/vendor/javascript/@codemirror--commands.js +2 -0
- data/vendor/javascript/@codemirror--lang-css.js +2 -0
- data/vendor/javascript/@codemirror--lang-html.js +2 -0
- data/vendor/javascript/@codemirror--lang-javascript.js +2 -0
- data/vendor/javascript/@codemirror--lang-json.js +2 -0
- data/vendor/javascript/@codemirror--lang-liquid.js +2 -0
- data/vendor/javascript/@codemirror--lang-markdown.js +2 -0
- data/vendor/javascript/@codemirror--lang-yaml.js +2 -0
- data/vendor/javascript/@codemirror--language.js +2 -0
- data/vendor/javascript/@codemirror--lint.js +2 -0
- data/vendor/javascript/@codemirror--search.js +2 -0
- data/vendor/javascript/@codemirror--state.js +2 -0
- data/vendor/javascript/@codemirror--view.js +2 -0
- data/vendor/javascript/@lezer--common.js +2 -0
- data/vendor/javascript/@lezer--css.js +2 -0
- data/vendor/javascript/@lezer--highlight.js +2 -0
- data/vendor/javascript/@lezer--html.js +2 -0
- data/vendor/javascript/@lezer--javascript.js +2 -0
- data/vendor/javascript/@lezer--json.js +2 -0
- data/vendor/javascript/@lezer--lr.js +2 -0
- data/vendor/javascript/@lezer--markdown.js +2 -0
- data/vendor/javascript/@lezer--yaml.js +2 -0
- data/vendor/javascript/@rails--actiontext.js +2 -0
- data/vendor/javascript/codemirror.js +2 -0
- data/vendor/javascript/crelt.js +2 -0
- data/vendor/javascript/data.min.js +7 -0
- data/vendor/javascript/intl-tel-input-utils.js +520 -0
- data/vendor/javascript/intl-tel-input.js +1782 -0
- data/vendor/javascript/leaflet.js +6 -0
- data/vendor/javascript/popper.js.js +1805 -0
- data/vendor/javascript/sortablejs.js +134 -0
- data/vendor/javascript/style-mod.js +2 -0
- data/vendor/javascript/tippy.js.js +2 -0
- data/vendor/javascript/trix.js +2 -0
- data/vendor/javascript/w3c-keyname.js +2 -0
- data/yarn.lock +821 -0
- metadata +51 -2
@@ -0,0 +1,1805 @@
|
|
1
|
+
var top = 'top';
|
2
|
+
var bottom = 'bottom';
|
3
|
+
var right = 'right';
|
4
|
+
var left = 'left';
|
5
|
+
var auto = 'auto';
|
6
|
+
var basePlacements = [top, bottom, right, left];
|
7
|
+
var start = 'start';
|
8
|
+
var end = 'end';
|
9
|
+
var clippingParents = 'clippingParents';
|
10
|
+
var viewport = 'viewport';
|
11
|
+
var popper = 'popper';
|
12
|
+
var reference = 'reference';
|
13
|
+
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
14
|
+
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
15
|
+
}, []);
|
16
|
+
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
17
|
+
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
18
|
+
}, []); // modifiers that need to read the DOM
|
19
|
+
|
20
|
+
var beforeRead = 'beforeRead';
|
21
|
+
var read = 'read';
|
22
|
+
var afterRead = 'afterRead'; // pure-logic modifiers
|
23
|
+
|
24
|
+
var beforeMain = 'beforeMain';
|
25
|
+
var main = 'main';
|
26
|
+
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
27
|
+
|
28
|
+
var beforeWrite = 'beforeWrite';
|
29
|
+
var write = 'write';
|
30
|
+
var afterWrite = 'afterWrite';
|
31
|
+
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
32
|
+
|
33
|
+
function getNodeName(element) {
|
34
|
+
return element ? (element.nodeName || '').toLowerCase() : null;
|
35
|
+
}
|
36
|
+
|
37
|
+
function getWindow(node) {
|
38
|
+
if (node == null) {
|
39
|
+
return window;
|
40
|
+
}
|
41
|
+
|
42
|
+
if (node.toString() !== '[object Window]') {
|
43
|
+
var ownerDocument = node.ownerDocument;
|
44
|
+
return ownerDocument ? ownerDocument.defaultView || window : window;
|
45
|
+
}
|
46
|
+
|
47
|
+
return node;
|
48
|
+
}
|
49
|
+
|
50
|
+
function isElement(node) {
|
51
|
+
var OwnElement = getWindow(node).Element;
|
52
|
+
return node instanceof OwnElement || node instanceof Element;
|
53
|
+
}
|
54
|
+
|
55
|
+
function isHTMLElement(node) {
|
56
|
+
var OwnElement = getWindow(node).HTMLElement;
|
57
|
+
return node instanceof OwnElement || node instanceof HTMLElement;
|
58
|
+
}
|
59
|
+
|
60
|
+
function isShadowRoot(node) {
|
61
|
+
// IE 11 has no ShadowRoot
|
62
|
+
if (typeof ShadowRoot === 'undefined') {
|
63
|
+
return false;
|
64
|
+
}
|
65
|
+
|
66
|
+
var OwnElement = getWindow(node).ShadowRoot;
|
67
|
+
return node instanceof OwnElement || node instanceof ShadowRoot;
|
68
|
+
}
|
69
|
+
|
70
|
+
// and applies them to the HTMLElements such as popper and arrow
|
71
|
+
|
72
|
+
function applyStyles(_ref) {
|
73
|
+
var state = _ref.state;
|
74
|
+
Object.keys(state.elements).forEach(function (name) {
|
75
|
+
var style = state.styles[name] || {};
|
76
|
+
var attributes = state.attributes[name] || {};
|
77
|
+
var element = state.elements[name]; // arrow is optional + virtual elements
|
78
|
+
|
79
|
+
if (!isHTMLElement(element) || !getNodeName(element)) {
|
80
|
+
return;
|
81
|
+
} // Flow doesn't support to extend this property, but it's the most
|
82
|
+
// effective way to apply styles to an HTMLElement
|
83
|
+
// $FlowFixMe[cannot-write]
|
84
|
+
|
85
|
+
|
86
|
+
Object.assign(element.style, style);
|
87
|
+
Object.keys(attributes).forEach(function (name) {
|
88
|
+
var value = attributes[name];
|
89
|
+
|
90
|
+
if (value === false) {
|
91
|
+
element.removeAttribute(name);
|
92
|
+
} else {
|
93
|
+
element.setAttribute(name, value === true ? '' : value);
|
94
|
+
}
|
95
|
+
});
|
96
|
+
});
|
97
|
+
}
|
98
|
+
|
99
|
+
function effect$2(_ref2) {
|
100
|
+
var state = _ref2.state;
|
101
|
+
var initialStyles = {
|
102
|
+
popper: {
|
103
|
+
position: state.options.strategy,
|
104
|
+
left: '0',
|
105
|
+
top: '0',
|
106
|
+
margin: '0'
|
107
|
+
},
|
108
|
+
arrow: {
|
109
|
+
position: 'absolute'
|
110
|
+
},
|
111
|
+
reference: {}
|
112
|
+
};
|
113
|
+
Object.assign(state.elements.popper.style, initialStyles.popper);
|
114
|
+
state.styles = initialStyles;
|
115
|
+
|
116
|
+
if (state.elements.arrow) {
|
117
|
+
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
118
|
+
}
|
119
|
+
|
120
|
+
return function () {
|
121
|
+
Object.keys(state.elements).forEach(function (name) {
|
122
|
+
var element = state.elements[name];
|
123
|
+
var attributes = state.attributes[name] || {};
|
124
|
+
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
|
125
|
+
|
126
|
+
var style = styleProperties.reduce(function (style, property) {
|
127
|
+
style[property] = '';
|
128
|
+
return style;
|
129
|
+
}, {}); // arrow is optional + virtual elements
|
130
|
+
|
131
|
+
if (!isHTMLElement(element) || !getNodeName(element)) {
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
|
135
|
+
Object.assign(element.style, style);
|
136
|
+
Object.keys(attributes).forEach(function (attribute) {
|
137
|
+
element.removeAttribute(attribute);
|
138
|
+
});
|
139
|
+
});
|
140
|
+
};
|
141
|
+
} // eslint-disable-next-line import/no-unused-modules
|
142
|
+
|
143
|
+
|
144
|
+
var applyStyles$1 = {
|
145
|
+
name: 'applyStyles',
|
146
|
+
enabled: true,
|
147
|
+
phase: 'write',
|
148
|
+
fn: applyStyles,
|
149
|
+
effect: effect$2,
|
150
|
+
requires: ['computeStyles']
|
151
|
+
};
|
152
|
+
|
153
|
+
function getBasePlacement(placement) {
|
154
|
+
return placement.split('-')[0];
|
155
|
+
}
|
156
|
+
|
157
|
+
var max = Math.max;
|
158
|
+
var min = Math.min;
|
159
|
+
var round = Math.round;
|
160
|
+
|
161
|
+
function getUAString() {
|
162
|
+
var uaData = navigator.userAgentData;
|
163
|
+
|
164
|
+
if (uaData != null && uaData.brands) {
|
165
|
+
return uaData.brands.map(function (item) {
|
166
|
+
return item.brand + "/" + item.version;
|
167
|
+
}).join(' ');
|
168
|
+
}
|
169
|
+
|
170
|
+
return navigator.userAgent;
|
171
|
+
}
|
172
|
+
|
173
|
+
function isLayoutViewport() {
|
174
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
175
|
+
}
|
176
|
+
|
177
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
178
|
+
if (includeScale === void 0) {
|
179
|
+
includeScale = false;
|
180
|
+
}
|
181
|
+
|
182
|
+
if (isFixedStrategy === void 0) {
|
183
|
+
isFixedStrategy = false;
|
184
|
+
}
|
185
|
+
|
186
|
+
var clientRect = element.getBoundingClientRect();
|
187
|
+
var scaleX = 1;
|
188
|
+
var scaleY = 1;
|
189
|
+
|
190
|
+
if (includeScale && isHTMLElement(element)) {
|
191
|
+
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
192
|
+
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
193
|
+
}
|
194
|
+
|
195
|
+
var _ref = isElement(element) ? getWindow(element) : window,
|
196
|
+
visualViewport = _ref.visualViewport;
|
197
|
+
|
198
|
+
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
199
|
+
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
200
|
+
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
201
|
+
var width = clientRect.width / scaleX;
|
202
|
+
var height = clientRect.height / scaleY;
|
203
|
+
return {
|
204
|
+
width: width,
|
205
|
+
height: height,
|
206
|
+
top: y,
|
207
|
+
right: x + width,
|
208
|
+
bottom: y + height,
|
209
|
+
left: x,
|
210
|
+
x: x,
|
211
|
+
y: y
|
212
|
+
};
|
213
|
+
}
|
214
|
+
|
215
|
+
// means it doesn't take into account transforms.
|
216
|
+
|
217
|
+
function getLayoutRect(element) {
|
218
|
+
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
219
|
+
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
220
|
+
|
221
|
+
var width = element.offsetWidth;
|
222
|
+
var height = element.offsetHeight;
|
223
|
+
|
224
|
+
if (Math.abs(clientRect.width - width) <= 1) {
|
225
|
+
width = clientRect.width;
|
226
|
+
}
|
227
|
+
|
228
|
+
if (Math.abs(clientRect.height - height) <= 1) {
|
229
|
+
height = clientRect.height;
|
230
|
+
}
|
231
|
+
|
232
|
+
return {
|
233
|
+
x: element.offsetLeft,
|
234
|
+
y: element.offsetTop,
|
235
|
+
width: width,
|
236
|
+
height: height
|
237
|
+
};
|
238
|
+
}
|
239
|
+
|
240
|
+
function contains(parent, child) {
|
241
|
+
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
242
|
+
|
243
|
+
if (parent.contains(child)) {
|
244
|
+
return true;
|
245
|
+
} // then fallback to custom implementation with Shadow DOM support
|
246
|
+
else if (rootNode && isShadowRoot(rootNode)) {
|
247
|
+
var next = child;
|
248
|
+
|
249
|
+
do {
|
250
|
+
if (next && parent.isSameNode(next)) {
|
251
|
+
return true;
|
252
|
+
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
253
|
+
|
254
|
+
|
255
|
+
next = next.parentNode || next.host;
|
256
|
+
} while (next);
|
257
|
+
} // Give up, the result is false
|
258
|
+
|
259
|
+
|
260
|
+
return false;
|
261
|
+
}
|
262
|
+
|
263
|
+
function getComputedStyle(element) {
|
264
|
+
return getWindow(element).getComputedStyle(element);
|
265
|
+
}
|
266
|
+
|
267
|
+
function isTableElement(element) {
|
268
|
+
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
|
269
|
+
}
|
270
|
+
|
271
|
+
function getDocumentElement(element) {
|
272
|
+
// $FlowFixMe[incompatible-return]: assume body is always available
|
273
|
+
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
274
|
+
element.document) || window.document).documentElement;
|
275
|
+
}
|
276
|
+
|
277
|
+
function getParentNode(element) {
|
278
|
+
if (getNodeName(element) === 'html') {
|
279
|
+
return element;
|
280
|
+
}
|
281
|
+
|
282
|
+
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
283
|
+
// $FlowFixMe[incompatible-return]
|
284
|
+
// $FlowFixMe[prop-missing]
|
285
|
+
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
286
|
+
element.parentNode || ( // DOM Element detected
|
287
|
+
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
288
|
+
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
289
|
+
getDocumentElement(element) // fallback
|
290
|
+
|
291
|
+
);
|
292
|
+
}
|
293
|
+
|
294
|
+
function getTrueOffsetParent(element) {
|
295
|
+
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
296
|
+
getComputedStyle(element).position === 'fixed') {
|
297
|
+
return null;
|
298
|
+
}
|
299
|
+
|
300
|
+
return element.offsetParent;
|
301
|
+
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
302
|
+
// return the containing block
|
303
|
+
|
304
|
+
|
305
|
+
function getContainingBlock(element) {
|
306
|
+
var isFirefox = /firefox/i.test(getUAString());
|
307
|
+
var isIE = /Trident/i.test(getUAString());
|
308
|
+
|
309
|
+
if (isIE && isHTMLElement(element)) {
|
310
|
+
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
311
|
+
var elementCss = getComputedStyle(element);
|
312
|
+
|
313
|
+
if (elementCss.position === 'fixed') {
|
314
|
+
return null;
|
315
|
+
}
|
316
|
+
}
|
317
|
+
|
318
|
+
var currentNode = getParentNode(element);
|
319
|
+
|
320
|
+
if (isShadowRoot(currentNode)) {
|
321
|
+
currentNode = currentNode.host;
|
322
|
+
}
|
323
|
+
|
324
|
+
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
325
|
+
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
326
|
+
// create a containing block.
|
327
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
328
|
+
|
329
|
+
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
330
|
+
return currentNode;
|
331
|
+
} else {
|
332
|
+
currentNode = currentNode.parentNode;
|
333
|
+
}
|
334
|
+
}
|
335
|
+
|
336
|
+
return null;
|
337
|
+
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
338
|
+
// such as table ancestors and cross browser bugs.
|
339
|
+
|
340
|
+
|
341
|
+
function getOffsetParent(element) {
|
342
|
+
var window = getWindow(element);
|
343
|
+
var offsetParent = getTrueOffsetParent(element);
|
344
|
+
|
345
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
346
|
+
offsetParent = getTrueOffsetParent(offsetParent);
|
347
|
+
}
|
348
|
+
|
349
|
+
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
|
350
|
+
return window;
|
351
|
+
}
|
352
|
+
|
353
|
+
return offsetParent || getContainingBlock(element) || window;
|
354
|
+
}
|
355
|
+
|
356
|
+
function getMainAxisFromPlacement(placement) {
|
357
|
+
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
358
|
+
}
|
359
|
+
|
360
|
+
function within(min$1, value, max$1) {
|
361
|
+
return max(min$1, min(value, max$1));
|
362
|
+
}
|
363
|
+
function withinMaxClamp(min, value, max) {
|
364
|
+
var v = within(min, value, max);
|
365
|
+
return v > max ? max : v;
|
366
|
+
}
|
367
|
+
|
368
|
+
function getFreshSideObject() {
|
369
|
+
return {
|
370
|
+
top: 0,
|
371
|
+
right: 0,
|
372
|
+
bottom: 0,
|
373
|
+
left: 0
|
374
|
+
};
|
375
|
+
}
|
376
|
+
|
377
|
+
function mergePaddingObject(paddingObject) {
|
378
|
+
return Object.assign({}, getFreshSideObject(), paddingObject);
|
379
|
+
}
|
380
|
+
|
381
|
+
function expandToHashMap(value, keys) {
|
382
|
+
return keys.reduce(function (hashMap, key) {
|
383
|
+
hashMap[key] = value;
|
384
|
+
return hashMap;
|
385
|
+
}, {});
|
386
|
+
}
|
387
|
+
|
388
|
+
var toPaddingObject = function toPaddingObject(padding, state) {
|
389
|
+
padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
|
390
|
+
placement: state.placement
|
391
|
+
})) : padding;
|
392
|
+
return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
393
|
+
};
|
394
|
+
|
395
|
+
function arrow(_ref) {
|
396
|
+
var _state$modifiersData$;
|
397
|
+
|
398
|
+
var state = _ref.state,
|
399
|
+
name = _ref.name,
|
400
|
+
options = _ref.options;
|
401
|
+
var arrowElement = state.elements.arrow;
|
402
|
+
var popperOffsets = state.modifiersData.popperOffsets;
|
403
|
+
var basePlacement = getBasePlacement(state.placement);
|
404
|
+
var axis = getMainAxisFromPlacement(basePlacement);
|
405
|
+
var isVertical = [left, right].indexOf(basePlacement) >= 0;
|
406
|
+
var len = isVertical ? 'height' : 'width';
|
407
|
+
|
408
|
+
if (!arrowElement || !popperOffsets) {
|
409
|
+
return;
|
410
|
+
}
|
411
|
+
|
412
|
+
var paddingObject = toPaddingObject(options.padding, state);
|
413
|
+
var arrowRect = getLayoutRect(arrowElement);
|
414
|
+
var minProp = axis === 'y' ? top : left;
|
415
|
+
var maxProp = axis === 'y' ? bottom : right;
|
416
|
+
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
|
417
|
+
var startDiff = popperOffsets[axis] - state.rects.reference[axis];
|
418
|
+
var arrowOffsetParent = getOffsetParent(arrowElement);
|
419
|
+
var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
420
|
+
var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
|
421
|
+
// outside of the popper bounds
|
422
|
+
|
423
|
+
var min = paddingObject[minProp];
|
424
|
+
var max = clientSize - arrowRect[len] - paddingObject[maxProp];
|
425
|
+
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
|
426
|
+
var offset = within(min, center, max); // Prevents breaking syntax highlighting...
|
427
|
+
|
428
|
+
var axisProp = axis;
|
429
|
+
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
|
430
|
+
}
|
431
|
+
|
432
|
+
function effect$1(_ref2) {
|
433
|
+
var state = _ref2.state,
|
434
|
+
options = _ref2.options;
|
435
|
+
var _options$element = options.element,
|
436
|
+
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
|
437
|
+
|
438
|
+
if (arrowElement == null) {
|
439
|
+
return;
|
440
|
+
} // CSS selector
|
441
|
+
|
442
|
+
|
443
|
+
if (typeof arrowElement === 'string') {
|
444
|
+
arrowElement = state.elements.popper.querySelector(arrowElement);
|
445
|
+
|
446
|
+
if (!arrowElement) {
|
447
|
+
return;
|
448
|
+
}
|
449
|
+
}
|
450
|
+
|
451
|
+
if (!contains(state.elements.popper, arrowElement)) {
|
452
|
+
|
453
|
+
return;
|
454
|
+
}
|
455
|
+
|
456
|
+
state.elements.arrow = arrowElement;
|
457
|
+
} // eslint-disable-next-line import/no-unused-modules
|
458
|
+
|
459
|
+
|
460
|
+
var arrow$1 = {
|
461
|
+
name: 'arrow',
|
462
|
+
enabled: true,
|
463
|
+
phase: 'main',
|
464
|
+
fn: arrow,
|
465
|
+
effect: effect$1,
|
466
|
+
requires: ['popperOffsets'],
|
467
|
+
requiresIfExists: ['preventOverflow']
|
468
|
+
};
|
469
|
+
|
470
|
+
function getVariation(placement) {
|
471
|
+
return placement.split('-')[1];
|
472
|
+
}
|
473
|
+
|
474
|
+
var unsetSides = {
|
475
|
+
top: 'auto',
|
476
|
+
right: 'auto',
|
477
|
+
bottom: 'auto',
|
478
|
+
left: 'auto'
|
479
|
+
}; // Round the offsets to the nearest suitable subpixel based on the DPR.
|
480
|
+
// Zooming can change the DPR, but it seems to report a value that will
|
481
|
+
// cleanly divide the values into the appropriate subpixels.
|
482
|
+
|
483
|
+
function roundOffsetsByDPR(_ref) {
|
484
|
+
var x = _ref.x,
|
485
|
+
y = _ref.y;
|
486
|
+
var win = window;
|
487
|
+
var dpr = win.devicePixelRatio || 1;
|
488
|
+
return {
|
489
|
+
x: round(x * dpr) / dpr || 0,
|
490
|
+
y: round(y * dpr) / dpr || 0
|
491
|
+
};
|
492
|
+
}
|
493
|
+
|
494
|
+
function mapToStyles(_ref2) {
|
495
|
+
var _Object$assign2;
|
496
|
+
|
497
|
+
var popper = _ref2.popper,
|
498
|
+
popperRect = _ref2.popperRect,
|
499
|
+
placement = _ref2.placement,
|
500
|
+
variation = _ref2.variation,
|
501
|
+
offsets = _ref2.offsets,
|
502
|
+
position = _ref2.position,
|
503
|
+
gpuAcceleration = _ref2.gpuAcceleration,
|
504
|
+
adaptive = _ref2.adaptive,
|
505
|
+
roundOffsets = _ref2.roundOffsets,
|
506
|
+
isFixed = _ref2.isFixed;
|
507
|
+
var _offsets$x = offsets.x,
|
508
|
+
x = _offsets$x === void 0 ? 0 : _offsets$x,
|
509
|
+
_offsets$y = offsets.y,
|
510
|
+
y = _offsets$y === void 0 ? 0 : _offsets$y;
|
511
|
+
|
512
|
+
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
513
|
+
x: x,
|
514
|
+
y: y
|
515
|
+
}) : {
|
516
|
+
x: x,
|
517
|
+
y: y
|
518
|
+
};
|
519
|
+
|
520
|
+
x = _ref3.x;
|
521
|
+
y = _ref3.y;
|
522
|
+
var hasX = offsets.hasOwnProperty('x');
|
523
|
+
var hasY = offsets.hasOwnProperty('y');
|
524
|
+
var sideX = left;
|
525
|
+
var sideY = top;
|
526
|
+
var win = window;
|
527
|
+
|
528
|
+
if (adaptive) {
|
529
|
+
var offsetParent = getOffsetParent(popper);
|
530
|
+
var heightProp = 'clientHeight';
|
531
|
+
var widthProp = 'clientWidth';
|
532
|
+
|
533
|
+
if (offsetParent === getWindow(popper)) {
|
534
|
+
offsetParent = getDocumentElement(popper);
|
535
|
+
|
536
|
+
if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
|
537
|
+
heightProp = 'scrollHeight';
|
538
|
+
widthProp = 'scrollWidth';
|
539
|
+
}
|
540
|
+
} // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
|
541
|
+
|
542
|
+
|
543
|
+
offsetParent = offsetParent;
|
544
|
+
|
545
|
+
if (placement === top || (placement === left || placement === right) && variation === end) {
|
546
|
+
sideY = bottom;
|
547
|
+
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
548
|
+
offsetParent[heightProp];
|
549
|
+
y -= offsetY - popperRect.height;
|
550
|
+
y *= gpuAcceleration ? 1 : -1;
|
551
|
+
}
|
552
|
+
|
553
|
+
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
554
|
+
sideX = right;
|
555
|
+
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
556
|
+
offsetParent[widthProp];
|
557
|
+
x -= offsetX - popperRect.width;
|
558
|
+
x *= gpuAcceleration ? 1 : -1;
|
559
|
+
}
|
560
|
+
}
|
561
|
+
|
562
|
+
var commonStyles = Object.assign({
|
563
|
+
position: position
|
564
|
+
}, adaptive && unsetSides);
|
565
|
+
|
566
|
+
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
567
|
+
x: x,
|
568
|
+
y: y
|
569
|
+
}) : {
|
570
|
+
x: x,
|
571
|
+
y: y
|
572
|
+
};
|
573
|
+
|
574
|
+
x = _ref4.x;
|
575
|
+
y = _ref4.y;
|
576
|
+
|
577
|
+
if (gpuAcceleration) {
|
578
|
+
var _Object$assign;
|
579
|
+
|
580
|
+
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
581
|
+
}
|
582
|
+
|
583
|
+
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
584
|
+
}
|
585
|
+
|
586
|
+
function computeStyles(_ref5) {
|
587
|
+
var state = _ref5.state,
|
588
|
+
options = _ref5.options;
|
589
|
+
var _options$gpuAccelerat = options.gpuAcceleration,
|
590
|
+
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
591
|
+
_options$adaptive = options.adaptive,
|
592
|
+
adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
|
593
|
+
_options$roundOffsets = options.roundOffsets,
|
594
|
+
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
595
|
+
|
596
|
+
var commonStyles = {
|
597
|
+
placement: getBasePlacement(state.placement),
|
598
|
+
variation: getVariation(state.placement),
|
599
|
+
popper: state.elements.popper,
|
600
|
+
popperRect: state.rects.popper,
|
601
|
+
gpuAcceleration: gpuAcceleration,
|
602
|
+
isFixed: state.options.strategy === 'fixed'
|
603
|
+
};
|
604
|
+
|
605
|
+
if (state.modifiersData.popperOffsets != null) {
|
606
|
+
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
607
|
+
offsets: state.modifiersData.popperOffsets,
|
608
|
+
position: state.options.strategy,
|
609
|
+
adaptive: adaptive,
|
610
|
+
roundOffsets: roundOffsets
|
611
|
+
})));
|
612
|
+
}
|
613
|
+
|
614
|
+
if (state.modifiersData.arrow != null) {
|
615
|
+
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
616
|
+
offsets: state.modifiersData.arrow,
|
617
|
+
position: 'absolute',
|
618
|
+
adaptive: false,
|
619
|
+
roundOffsets: roundOffsets
|
620
|
+
})));
|
621
|
+
}
|
622
|
+
|
623
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
624
|
+
'data-popper-placement': state.placement
|
625
|
+
});
|
626
|
+
} // eslint-disable-next-line import/no-unused-modules
|
627
|
+
|
628
|
+
|
629
|
+
var computeStyles$1 = {
|
630
|
+
name: 'computeStyles',
|
631
|
+
enabled: true,
|
632
|
+
phase: 'beforeWrite',
|
633
|
+
fn: computeStyles,
|
634
|
+
data: {}
|
635
|
+
};
|
636
|
+
|
637
|
+
var passive = {
|
638
|
+
passive: true
|
639
|
+
};
|
640
|
+
|
641
|
+
function effect(_ref) {
|
642
|
+
var state = _ref.state,
|
643
|
+
instance = _ref.instance,
|
644
|
+
options = _ref.options;
|
645
|
+
var _options$scroll = options.scroll,
|
646
|
+
scroll = _options$scroll === void 0 ? true : _options$scroll,
|
647
|
+
_options$resize = options.resize,
|
648
|
+
resize = _options$resize === void 0 ? true : _options$resize;
|
649
|
+
var window = getWindow(state.elements.popper);
|
650
|
+
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
651
|
+
|
652
|
+
if (scroll) {
|
653
|
+
scrollParents.forEach(function (scrollParent) {
|
654
|
+
scrollParent.addEventListener('scroll', instance.update, passive);
|
655
|
+
});
|
656
|
+
}
|
657
|
+
|
658
|
+
if (resize) {
|
659
|
+
window.addEventListener('resize', instance.update, passive);
|
660
|
+
}
|
661
|
+
|
662
|
+
return function () {
|
663
|
+
if (scroll) {
|
664
|
+
scrollParents.forEach(function (scrollParent) {
|
665
|
+
scrollParent.removeEventListener('scroll', instance.update, passive);
|
666
|
+
});
|
667
|
+
}
|
668
|
+
|
669
|
+
if (resize) {
|
670
|
+
window.removeEventListener('resize', instance.update, passive);
|
671
|
+
}
|
672
|
+
};
|
673
|
+
} // eslint-disable-next-line import/no-unused-modules
|
674
|
+
|
675
|
+
|
676
|
+
var eventListeners = {
|
677
|
+
name: 'eventListeners',
|
678
|
+
enabled: true,
|
679
|
+
phase: 'write',
|
680
|
+
fn: function fn() {},
|
681
|
+
effect: effect,
|
682
|
+
data: {}
|
683
|
+
};
|
684
|
+
|
685
|
+
var hash$1 = {
|
686
|
+
left: 'right',
|
687
|
+
right: 'left',
|
688
|
+
bottom: 'top',
|
689
|
+
top: 'bottom'
|
690
|
+
};
|
691
|
+
function getOppositePlacement(placement) {
|
692
|
+
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
693
|
+
return hash$1[matched];
|
694
|
+
});
|
695
|
+
}
|
696
|
+
|
697
|
+
var hash = {
|
698
|
+
start: 'end',
|
699
|
+
end: 'start'
|
700
|
+
};
|
701
|
+
function getOppositeVariationPlacement(placement) {
|
702
|
+
return placement.replace(/start|end/g, function (matched) {
|
703
|
+
return hash[matched];
|
704
|
+
});
|
705
|
+
}
|
706
|
+
|
707
|
+
function getWindowScroll(node) {
|
708
|
+
var win = getWindow(node);
|
709
|
+
var scrollLeft = win.pageXOffset;
|
710
|
+
var scrollTop = win.pageYOffset;
|
711
|
+
return {
|
712
|
+
scrollLeft: scrollLeft,
|
713
|
+
scrollTop: scrollTop
|
714
|
+
};
|
715
|
+
}
|
716
|
+
|
717
|
+
function getWindowScrollBarX(element) {
|
718
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
719
|
+
// incorrect for RTL.
|
720
|
+
// Popper 1 is broken in this case and never had a bug report so let's assume
|
721
|
+
// it's not an issue. I don't think anyone ever specifies width on <html>
|
722
|
+
// anyway.
|
723
|
+
// Browsers where the left scrollbar doesn't cause an issue report `0` for
|
724
|
+
// this (e.g. Edge 2019, IE11, Safari)
|
725
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
726
|
+
}
|
727
|
+
|
728
|
+
function getViewportRect(element, strategy) {
|
729
|
+
var win = getWindow(element);
|
730
|
+
var html = getDocumentElement(element);
|
731
|
+
var visualViewport = win.visualViewport;
|
732
|
+
var width = html.clientWidth;
|
733
|
+
var height = html.clientHeight;
|
734
|
+
var x = 0;
|
735
|
+
var y = 0;
|
736
|
+
|
737
|
+
if (visualViewport) {
|
738
|
+
width = visualViewport.width;
|
739
|
+
height = visualViewport.height;
|
740
|
+
var layoutViewport = isLayoutViewport();
|
741
|
+
|
742
|
+
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
743
|
+
x = visualViewport.offsetLeft;
|
744
|
+
y = visualViewport.offsetTop;
|
745
|
+
}
|
746
|
+
}
|
747
|
+
|
748
|
+
return {
|
749
|
+
width: width,
|
750
|
+
height: height,
|
751
|
+
x: x + getWindowScrollBarX(element),
|
752
|
+
y: y
|
753
|
+
};
|
754
|
+
}
|
755
|
+
|
756
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
757
|
+
|
758
|
+
function getDocumentRect(element) {
|
759
|
+
var _element$ownerDocumen;
|
760
|
+
|
761
|
+
var html = getDocumentElement(element);
|
762
|
+
var winScroll = getWindowScroll(element);
|
763
|
+
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
764
|
+
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
765
|
+
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
766
|
+
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
767
|
+
var y = -winScroll.scrollTop;
|
768
|
+
|
769
|
+
if (getComputedStyle(body || html).direction === 'rtl') {
|
770
|
+
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
771
|
+
}
|
772
|
+
|
773
|
+
return {
|
774
|
+
width: width,
|
775
|
+
height: height,
|
776
|
+
x: x,
|
777
|
+
y: y
|
778
|
+
};
|
779
|
+
}
|
780
|
+
|
781
|
+
function isScrollParent(element) {
|
782
|
+
// Firefox wants us to check `-x` and `-y` variations as well
|
783
|
+
var _getComputedStyle = getComputedStyle(element),
|
784
|
+
overflow = _getComputedStyle.overflow,
|
785
|
+
overflowX = _getComputedStyle.overflowX,
|
786
|
+
overflowY = _getComputedStyle.overflowY;
|
787
|
+
|
788
|
+
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
789
|
+
}
|
790
|
+
|
791
|
+
function getScrollParent(node) {
|
792
|
+
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
793
|
+
// $FlowFixMe[incompatible-return]: assume body is always available
|
794
|
+
return node.ownerDocument.body;
|
795
|
+
}
|
796
|
+
|
797
|
+
if (isHTMLElement(node) && isScrollParent(node)) {
|
798
|
+
return node;
|
799
|
+
}
|
800
|
+
|
801
|
+
return getScrollParent(getParentNode(node));
|
802
|
+
}
|
803
|
+
|
804
|
+
/*
|
805
|
+
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
806
|
+
until we get to the top window object. This list is what we attach scroll listeners
|
807
|
+
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
808
|
+
reference element's position.
|
809
|
+
*/
|
810
|
+
|
811
|
+
function listScrollParents(element, list) {
|
812
|
+
var _element$ownerDocumen;
|
813
|
+
|
814
|
+
if (list === void 0) {
|
815
|
+
list = [];
|
816
|
+
}
|
817
|
+
|
818
|
+
var scrollParent = getScrollParent(element);
|
819
|
+
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
820
|
+
var win = getWindow(scrollParent);
|
821
|
+
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
822
|
+
var updatedList = list.concat(target);
|
823
|
+
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
824
|
+
updatedList.concat(listScrollParents(getParentNode(target)));
|
825
|
+
}
|
826
|
+
|
827
|
+
function rectToClientRect(rect) {
|
828
|
+
return Object.assign({}, rect, {
|
829
|
+
left: rect.x,
|
830
|
+
top: rect.y,
|
831
|
+
right: rect.x + rect.width,
|
832
|
+
bottom: rect.y + rect.height
|
833
|
+
});
|
834
|
+
}
|
835
|
+
|
836
|
+
function getInnerBoundingClientRect(element, strategy) {
|
837
|
+
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
838
|
+
rect.top = rect.top + element.clientTop;
|
839
|
+
rect.left = rect.left + element.clientLeft;
|
840
|
+
rect.bottom = rect.top + element.clientHeight;
|
841
|
+
rect.right = rect.left + element.clientWidth;
|
842
|
+
rect.width = element.clientWidth;
|
843
|
+
rect.height = element.clientHeight;
|
844
|
+
rect.x = rect.left;
|
845
|
+
rect.y = rect.top;
|
846
|
+
return rect;
|
847
|
+
}
|
848
|
+
|
849
|
+
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
850
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
851
|
+
} // A "clipping parent" is an overflowable container with the characteristic of
|
852
|
+
// clipping (or hiding) overflowing elements with a position different from
|
853
|
+
// `initial`
|
854
|
+
|
855
|
+
|
856
|
+
function getClippingParents(element) {
|
857
|
+
var clippingParents = listScrollParents(getParentNode(element));
|
858
|
+
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
|
859
|
+
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
860
|
+
|
861
|
+
if (!isElement(clipperElement)) {
|
862
|
+
return [];
|
863
|
+
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
864
|
+
|
865
|
+
|
866
|
+
return clippingParents.filter(function (clippingParent) {
|
867
|
+
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
868
|
+
});
|
869
|
+
} // Gets the maximum area that the element is visible in due to any number of
|
870
|
+
// clipping parents
|
871
|
+
|
872
|
+
|
873
|
+
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
874
|
+
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
875
|
+
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
876
|
+
var firstClippingParent = clippingParents[0];
|
877
|
+
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
878
|
+
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
879
|
+
accRect.top = max(rect.top, accRect.top);
|
880
|
+
accRect.right = min(rect.right, accRect.right);
|
881
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
882
|
+
accRect.left = max(rect.left, accRect.left);
|
883
|
+
return accRect;
|
884
|
+
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
885
|
+
clippingRect.width = clippingRect.right - clippingRect.left;
|
886
|
+
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
887
|
+
clippingRect.x = clippingRect.left;
|
888
|
+
clippingRect.y = clippingRect.top;
|
889
|
+
return clippingRect;
|
890
|
+
}
|
891
|
+
|
892
|
+
function computeOffsets(_ref) {
|
893
|
+
var reference = _ref.reference,
|
894
|
+
element = _ref.element,
|
895
|
+
placement = _ref.placement;
|
896
|
+
var basePlacement = placement ? getBasePlacement(placement) : null;
|
897
|
+
var variation = placement ? getVariation(placement) : null;
|
898
|
+
var commonX = reference.x + reference.width / 2 - element.width / 2;
|
899
|
+
var commonY = reference.y + reference.height / 2 - element.height / 2;
|
900
|
+
var offsets;
|
901
|
+
|
902
|
+
switch (basePlacement) {
|
903
|
+
case top:
|
904
|
+
offsets = {
|
905
|
+
x: commonX,
|
906
|
+
y: reference.y - element.height
|
907
|
+
};
|
908
|
+
break;
|
909
|
+
|
910
|
+
case bottom:
|
911
|
+
offsets = {
|
912
|
+
x: commonX,
|
913
|
+
y: reference.y + reference.height
|
914
|
+
};
|
915
|
+
break;
|
916
|
+
|
917
|
+
case right:
|
918
|
+
offsets = {
|
919
|
+
x: reference.x + reference.width,
|
920
|
+
y: commonY
|
921
|
+
};
|
922
|
+
break;
|
923
|
+
|
924
|
+
case left:
|
925
|
+
offsets = {
|
926
|
+
x: reference.x - element.width,
|
927
|
+
y: commonY
|
928
|
+
};
|
929
|
+
break;
|
930
|
+
|
931
|
+
default:
|
932
|
+
offsets = {
|
933
|
+
x: reference.x,
|
934
|
+
y: reference.y
|
935
|
+
};
|
936
|
+
}
|
937
|
+
|
938
|
+
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
939
|
+
|
940
|
+
if (mainAxis != null) {
|
941
|
+
var len = mainAxis === 'y' ? 'height' : 'width';
|
942
|
+
|
943
|
+
switch (variation) {
|
944
|
+
case start:
|
945
|
+
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
946
|
+
break;
|
947
|
+
|
948
|
+
case end:
|
949
|
+
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
|
950
|
+
break;
|
951
|
+
}
|
952
|
+
}
|
953
|
+
|
954
|
+
return offsets;
|
955
|
+
}
|
956
|
+
|
957
|
+
function detectOverflow(state, options) {
|
958
|
+
if (options === void 0) {
|
959
|
+
options = {};
|
960
|
+
}
|
961
|
+
|
962
|
+
var _options = options,
|
963
|
+
_options$placement = _options.placement,
|
964
|
+
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
965
|
+
_options$strategy = _options.strategy,
|
966
|
+
strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
|
967
|
+
_options$boundary = _options.boundary,
|
968
|
+
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
969
|
+
_options$rootBoundary = _options.rootBoundary,
|
970
|
+
rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
|
971
|
+
_options$elementConte = _options.elementContext,
|
972
|
+
elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
|
973
|
+
_options$altBoundary = _options.altBoundary,
|
974
|
+
altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
|
975
|
+
_options$padding = _options.padding,
|
976
|
+
padding = _options$padding === void 0 ? 0 : _options$padding;
|
977
|
+
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
978
|
+
var altContext = elementContext === popper ? reference : popper;
|
979
|
+
var popperRect = state.rects.popper;
|
980
|
+
var element = state.elements[altBoundary ? altContext : elementContext];
|
981
|
+
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
982
|
+
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
983
|
+
var popperOffsets = computeOffsets({
|
984
|
+
reference: referenceClientRect,
|
985
|
+
element: popperRect,
|
986
|
+
strategy: 'absolute',
|
987
|
+
placement: placement
|
988
|
+
});
|
989
|
+
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
990
|
+
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
991
|
+
// 0 or negative = within the clipping rect
|
992
|
+
|
993
|
+
var overflowOffsets = {
|
994
|
+
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
995
|
+
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
996
|
+
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
997
|
+
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
998
|
+
};
|
999
|
+
var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
|
1000
|
+
|
1001
|
+
if (elementContext === popper && offsetData) {
|
1002
|
+
var offset = offsetData[placement];
|
1003
|
+
Object.keys(overflowOffsets).forEach(function (key) {
|
1004
|
+
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
1005
|
+
var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
|
1006
|
+
overflowOffsets[key] += offset[axis] * multiply;
|
1007
|
+
});
|
1008
|
+
}
|
1009
|
+
|
1010
|
+
return overflowOffsets;
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
function computeAutoPlacement(state, options) {
|
1014
|
+
if (options === void 0) {
|
1015
|
+
options = {};
|
1016
|
+
}
|
1017
|
+
|
1018
|
+
var _options = options,
|
1019
|
+
placement = _options.placement,
|
1020
|
+
boundary = _options.boundary,
|
1021
|
+
rootBoundary = _options.rootBoundary,
|
1022
|
+
padding = _options.padding,
|
1023
|
+
flipVariations = _options.flipVariations,
|
1024
|
+
_options$allowedAutoP = _options.allowedAutoPlacements,
|
1025
|
+
allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
|
1026
|
+
var variation = getVariation(placement);
|
1027
|
+
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
|
1028
|
+
return getVariation(placement) === variation;
|
1029
|
+
}) : basePlacements;
|
1030
|
+
var allowedPlacements = placements$1.filter(function (placement) {
|
1031
|
+
return allowedAutoPlacements.indexOf(placement) >= 0;
|
1032
|
+
});
|
1033
|
+
|
1034
|
+
if (allowedPlacements.length === 0) {
|
1035
|
+
allowedPlacements = placements$1;
|
1036
|
+
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
|
1037
|
+
|
1038
|
+
|
1039
|
+
var overflows = allowedPlacements.reduce(function (acc, placement) {
|
1040
|
+
acc[placement] = detectOverflow(state, {
|
1041
|
+
placement: placement,
|
1042
|
+
boundary: boundary,
|
1043
|
+
rootBoundary: rootBoundary,
|
1044
|
+
padding: padding
|
1045
|
+
})[getBasePlacement(placement)];
|
1046
|
+
return acc;
|
1047
|
+
}, {});
|
1048
|
+
return Object.keys(overflows).sort(function (a, b) {
|
1049
|
+
return overflows[a] - overflows[b];
|
1050
|
+
});
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
function getExpandedFallbackPlacements(placement) {
|
1054
|
+
if (getBasePlacement(placement) === auto) {
|
1055
|
+
return [];
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
var oppositePlacement = getOppositePlacement(placement);
|
1059
|
+
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
function flip(_ref) {
|
1063
|
+
var state = _ref.state,
|
1064
|
+
options = _ref.options,
|
1065
|
+
name = _ref.name;
|
1066
|
+
|
1067
|
+
if (state.modifiersData[name]._skip) {
|
1068
|
+
return;
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
var _options$mainAxis = options.mainAxis,
|
1072
|
+
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
1073
|
+
_options$altAxis = options.altAxis,
|
1074
|
+
checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
|
1075
|
+
specifiedFallbackPlacements = options.fallbackPlacements,
|
1076
|
+
padding = options.padding,
|
1077
|
+
boundary = options.boundary,
|
1078
|
+
rootBoundary = options.rootBoundary,
|
1079
|
+
altBoundary = options.altBoundary,
|
1080
|
+
_options$flipVariatio = options.flipVariations,
|
1081
|
+
flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
|
1082
|
+
allowedAutoPlacements = options.allowedAutoPlacements;
|
1083
|
+
var preferredPlacement = state.options.placement;
|
1084
|
+
var basePlacement = getBasePlacement(preferredPlacement);
|
1085
|
+
var isBasePlacement = basePlacement === preferredPlacement;
|
1086
|
+
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
1087
|
+
var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
|
1088
|
+
return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
|
1089
|
+
placement: placement,
|
1090
|
+
boundary: boundary,
|
1091
|
+
rootBoundary: rootBoundary,
|
1092
|
+
padding: padding,
|
1093
|
+
flipVariations: flipVariations,
|
1094
|
+
allowedAutoPlacements: allowedAutoPlacements
|
1095
|
+
}) : placement);
|
1096
|
+
}, []);
|
1097
|
+
var referenceRect = state.rects.reference;
|
1098
|
+
var popperRect = state.rects.popper;
|
1099
|
+
var checksMap = new Map();
|
1100
|
+
var makeFallbackChecks = true;
|
1101
|
+
var firstFittingPlacement = placements[0];
|
1102
|
+
|
1103
|
+
for (var i = 0; i < placements.length; i++) {
|
1104
|
+
var placement = placements[i];
|
1105
|
+
|
1106
|
+
var _basePlacement = getBasePlacement(placement);
|
1107
|
+
|
1108
|
+
var isStartVariation = getVariation(placement) === start;
|
1109
|
+
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
1110
|
+
var len = isVertical ? 'width' : 'height';
|
1111
|
+
var overflow = detectOverflow(state, {
|
1112
|
+
placement: placement,
|
1113
|
+
boundary: boundary,
|
1114
|
+
rootBoundary: rootBoundary,
|
1115
|
+
altBoundary: altBoundary,
|
1116
|
+
padding: padding
|
1117
|
+
});
|
1118
|
+
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
1119
|
+
|
1120
|
+
if (referenceRect[len] > popperRect[len]) {
|
1121
|
+
mainVariationSide = getOppositePlacement(mainVariationSide);
|
1122
|
+
}
|
1123
|
+
|
1124
|
+
var altVariationSide = getOppositePlacement(mainVariationSide);
|
1125
|
+
var checks = [];
|
1126
|
+
|
1127
|
+
if (checkMainAxis) {
|
1128
|
+
checks.push(overflow[_basePlacement] <= 0);
|
1129
|
+
}
|
1130
|
+
|
1131
|
+
if (checkAltAxis) {
|
1132
|
+
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
1133
|
+
}
|
1134
|
+
|
1135
|
+
if (checks.every(function (check) {
|
1136
|
+
return check;
|
1137
|
+
})) {
|
1138
|
+
firstFittingPlacement = placement;
|
1139
|
+
makeFallbackChecks = false;
|
1140
|
+
break;
|
1141
|
+
}
|
1142
|
+
|
1143
|
+
checksMap.set(placement, checks);
|
1144
|
+
}
|
1145
|
+
|
1146
|
+
if (makeFallbackChecks) {
|
1147
|
+
// `2` may be desired in some cases – research later
|
1148
|
+
var numberOfChecks = flipVariations ? 3 : 1;
|
1149
|
+
|
1150
|
+
var _loop = function _loop(_i) {
|
1151
|
+
var fittingPlacement = placements.find(function (placement) {
|
1152
|
+
var checks = checksMap.get(placement);
|
1153
|
+
|
1154
|
+
if (checks) {
|
1155
|
+
return checks.slice(0, _i).every(function (check) {
|
1156
|
+
return check;
|
1157
|
+
});
|
1158
|
+
}
|
1159
|
+
});
|
1160
|
+
|
1161
|
+
if (fittingPlacement) {
|
1162
|
+
firstFittingPlacement = fittingPlacement;
|
1163
|
+
return "break";
|
1164
|
+
}
|
1165
|
+
};
|
1166
|
+
|
1167
|
+
for (var _i = numberOfChecks; _i > 0; _i--) {
|
1168
|
+
var _ret = _loop(_i);
|
1169
|
+
|
1170
|
+
if (_ret === "break") break;
|
1171
|
+
}
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
if (state.placement !== firstFittingPlacement) {
|
1175
|
+
state.modifiersData[name]._skip = true;
|
1176
|
+
state.placement = firstFittingPlacement;
|
1177
|
+
state.reset = true;
|
1178
|
+
}
|
1179
|
+
} // eslint-disable-next-line import/no-unused-modules
|
1180
|
+
|
1181
|
+
|
1182
|
+
var flip$1 = {
|
1183
|
+
name: 'flip',
|
1184
|
+
enabled: true,
|
1185
|
+
phase: 'main',
|
1186
|
+
fn: flip,
|
1187
|
+
requiresIfExists: ['offset'],
|
1188
|
+
data: {
|
1189
|
+
_skip: false
|
1190
|
+
}
|
1191
|
+
};
|
1192
|
+
|
1193
|
+
function getSideOffsets(overflow, rect, preventedOffsets) {
|
1194
|
+
if (preventedOffsets === void 0) {
|
1195
|
+
preventedOffsets = {
|
1196
|
+
x: 0,
|
1197
|
+
y: 0
|
1198
|
+
};
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
return {
|
1202
|
+
top: overflow.top - rect.height - preventedOffsets.y,
|
1203
|
+
right: overflow.right - rect.width + preventedOffsets.x,
|
1204
|
+
bottom: overflow.bottom - rect.height + preventedOffsets.y,
|
1205
|
+
left: overflow.left - rect.width - preventedOffsets.x
|
1206
|
+
};
|
1207
|
+
}
|
1208
|
+
|
1209
|
+
function isAnySideFullyClipped(overflow) {
|
1210
|
+
return [top, right, bottom, left].some(function (side) {
|
1211
|
+
return overflow[side] >= 0;
|
1212
|
+
});
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
function hide(_ref) {
|
1216
|
+
var state = _ref.state,
|
1217
|
+
name = _ref.name;
|
1218
|
+
var referenceRect = state.rects.reference;
|
1219
|
+
var popperRect = state.rects.popper;
|
1220
|
+
var preventedOffsets = state.modifiersData.preventOverflow;
|
1221
|
+
var referenceOverflow = detectOverflow(state, {
|
1222
|
+
elementContext: 'reference'
|
1223
|
+
});
|
1224
|
+
var popperAltOverflow = detectOverflow(state, {
|
1225
|
+
altBoundary: true
|
1226
|
+
});
|
1227
|
+
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
1228
|
+
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
1229
|
+
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
1230
|
+
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
1231
|
+
state.modifiersData[name] = {
|
1232
|
+
referenceClippingOffsets: referenceClippingOffsets,
|
1233
|
+
popperEscapeOffsets: popperEscapeOffsets,
|
1234
|
+
isReferenceHidden: isReferenceHidden,
|
1235
|
+
hasPopperEscaped: hasPopperEscaped
|
1236
|
+
};
|
1237
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
1238
|
+
'data-popper-reference-hidden': isReferenceHidden,
|
1239
|
+
'data-popper-escaped': hasPopperEscaped
|
1240
|
+
});
|
1241
|
+
} // eslint-disable-next-line import/no-unused-modules
|
1242
|
+
|
1243
|
+
|
1244
|
+
var hide$1 = {
|
1245
|
+
name: 'hide',
|
1246
|
+
enabled: true,
|
1247
|
+
phase: 'main',
|
1248
|
+
requiresIfExists: ['preventOverflow'],
|
1249
|
+
fn: hide
|
1250
|
+
};
|
1251
|
+
|
1252
|
+
function distanceAndSkiddingToXY(placement, rects, offset) {
|
1253
|
+
var basePlacement = getBasePlacement(placement);
|
1254
|
+
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
1255
|
+
|
1256
|
+
var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
|
1257
|
+
placement: placement
|
1258
|
+
})) : offset,
|
1259
|
+
skidding = _ref[0],
|
1260
|
+
distance = _ref[1];
|
1261
|
+
|
1262
|
+
skidding = skidding || 0;
|
1263
|
+
distance = (distance || 0) * invertDistance;
|
1264
|
+
return [left, right].indexOf(basePlacement) >= 0 ? {
|
1265
|
+
x: distance,
|
1266
|
+
y: skidding
|
1267
|
+
} : {
|
1268
|
+
x: skidding,
|
1269
|
+
y: distance
|
1270
|
+
};
|
1271
|
+
}
|
1272
|
+
|
1273
|
+
function offset(_ref2) {
|
1274
|
+
var state = _ref2.state,
|
1275
|
+
options = _ref2.options,
|
1276
|
+
name = _ref2.name;
|
1277
|
+
var _options$offset = options.offset,
|
1278
|
+
offset = _options$offset === void 0 ? [0, 0] : _options$offset;
|
1279
|
+
var data = placements.reduce(function (acc, placement) {
|
1280
|
+
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
|
1281
|
+
return acc;
|
1282
|
+
}, {});
|
1283
|
+
var _data$state$placement = data[state.placement],
|
1284
|
+
x = _data$state$placement.x,
|
1285
|
+
y = _data$state$placement.y;
|
1286
|
+
|
1287
|
+
if (state.modifiersData.popperOffsets != null) {
|
1288
|
+
state.modifiersData.popperOffsets.x += x;
|
1289
|
+
state.modifiersData.popperOffsets.y += y;
|
1290
|
+
}
|
1291
|
+
|
1292
|
+
state.modifiersData[name] = data;
|
1293
|
+
} // eslint-disable-next-line import/no-unused-modules
|
1294
|
+
|
1295
|
+
|
1296
|
+
var offset$1 = {
|
1297
|
+
name: 'offset',
|
1298
|
+
enabled: true,
|
1299
|
+
phase: 'main',
|
1300
|
+
requires: ['popperOffsets'],
|
1301
|
+
fn: offset
|
1302
|
+
};
|
1303
|
+
|
1304
|
+
function popperOffsets(_ref) {
|
1305
|
+
var state = _ref.state,
|
1306
|
+
name = _ref.name;
|
1307
|
+
// Offsets are the actual position the popper needs to have to be
|
1308
|
+
// properly positioned near its reference element
|
1309
|
+
// This is the most basic placement, and will be adjusted by
|
1310
|
+
// the modifiers in the next step
|
1311
|
+
state.modifiersData[name] = computeOffsets({
|
1312
|
+
reference: state.rects.reference,
|
1313
|
+
element: state.rects.popper,
|
1314
|
+
strategy: 'absolute',
|
1315
|
+
placement: state.placement
|
1316
|
+
});
|
1317
|
+
} // eslint-disable-next-line import/no-unused-modules
|
1318
|
+
|
1319
|
+
|
1320
|
+
var popperOffsets$1 = {
|
1321
|
+
name: 'popperOffsets',
|
1322
|
+
enabled: true,
|
1323
|
+
phase: 'read',
|
1324
|
+
fn: popperOffsets,
|
1325
|
+
data: {}
|
1326
|
+
};
|
1327
|
+
|
1328
|
+
function getAltAxis(axis) {
|
1329
|
+
return axis === 'x' ? 'y' : 'x';
|
1330
|
+
}
|
1331
|
+
|
1332
|
+
function preventOverflow(_ref) {
|
1333
|
+
var state = _ref.state,
|
1334
|
+
options = _ref.options,
|
1335
|
+
name = _ref.name;
|
1336
|
+
var _options$mainAxis = options.mainAxis,
|
1337
|
+
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
1338
|
+
_options$altAxis = options.altAxis,
|
1339
|
+
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
|
1340
|
+
boundary = options.boundary,
|
1341
|
+
rootBoundary = options.rootBoundary,
|
1342
|
+
altBoundary = options.altBoundary,
|
1343
|
+
padding = options.padding,
|
1344
|
+
_options$tether = options.tether,
|
1345
|
+
tether = _options$tether === void 0 ? true : _options$tether,
|
1346
|
+
_options$tetherOffset = options.tetherOffset,
|
1347
|
+
tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
1348
|
+
var overflow = detectOverflow(state, {
|
1349
|
+
boundary: boundary,
|
1350
|
+
rootBoundary: rootBoundary,
|
1351
|
+
padding: padding,
|
1352
|
+
altBoundary: altBoundary
|
1353
|
+
});
|
1354
|
+
var basePlacement = getBasePlacement(state.placement);
|
1355
|
+
var variation = getVariation(state.placement);
|
1356
|
+
var isBasePlacement = !variation;
|
1357
|
+
var mainAxis = getMainAxisFromPlacement(basePlacement);
|
1358
|
+
var altAxis = getAltAxis(mainAxis);
|
1359
|
+
var popperOffsets = state.modifiersData.popperOffsets;
|
1360
|
+
var referenceRect = state.rects.reference;
|
1361
|
+
var popperRect = state.rects.popper;
|
1362
|
+
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
|
1363
|
+
placement: state.placement
|
1364
|
+
})) : tetherOffset;
|
1365
|
+
var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
|
1366
|
+
mainAxis: tetherOffsetValue,
|
1367
|
+
altAxis: tetherOffsetValue
|
1368
|
+
} : Object.assign({
|
1369
|
+
mainAxis: 0,
|
1370
|
+
altAxis: 0
|
1371
|
+
}, tetherOffsetValue);
|
1372
|
+
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
1373
|
+
var data = {
|
1374
|
+
x: 0,
|
1375
|
+
y: 0
|
1376
|
+
};
|
1377
|
+
|
1378
|
+
if (!popperOffsets) {
|
1379
|
+
return;
|
1380
|
+
}
|
1381
|
+
|
1382
|
+
if (checkMainAxis) {
|
1383
|
+
var _offsetModifierState$;
|
1384
|
+
|
1385
|
+
var mainSide = mainAxis === 'y' ? top : left;
|
1386
|
+
var altSide = mainAxis === 'y' ? bottom : right;
|
1387
|
+
var len = mainAxis === 'y' ? 'height' : 'width';
|
1388
|
+
var offset = popperOffsets[mainAxis];
|
1389
|
+
var min$1 = offset + overflow[mainSide];
|
1390
|
+
var max$1 = offset - overflow[altSide];
|
1391
|
+
var additive = tether ? -popperRect[len] / 2 : 0;
|
1392
|
+
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
1393
|
+
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
1394
|
+
// outside the reference bounds
|
1395
|
+
|
1396
|
+
var arrowElement = state.elements.arrow;
|
1397
|
+
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
|
1398
|
+
width: 0,
|
1399
|
+
height: 0
|
1400
|
+
};
|
1401
|
+
var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
|
1402
|
+
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
1403
|
+
var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
|
1404
|
+
// to include its full size in the calculation. If the reference is small
|
1405
|
+
// and near the edge of a boundary, the popper can overflow even if the
|
1406
|
+
// reference is not overflowing as well (e.g. virtual elements with no
|
1407
|
+
// width or height)
|
1408
|
+
|
1409
|
+
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
1410
|
+
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
1411
|
+
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
1412
|
+
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
1413
|
+
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
1414
|
+
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
1415
|
+
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
|
1416
|
+
var tetherMax = offset + maxOffset - offsetModifierValue;
|
1417
|
+
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
|
1418
|
+
popperOffsets[mainAxis] = preventedOffset;
|
1419
|
+
data[mainAxis] = preventedOffset - offset;
|
1420
|
+
}
|
1421
|
+
|
1422
|
+
if (checkAltAxis) {
|
1423
|
+
var _offsetModifierState$2;
|
1424
|
+
|
1425
|
+
var _mainSide = mainAxis === 'x' ? top : left;
|
1426
|
+
|
1427
|
+
var _altSide = mainAxis === 'x' ? bottom : right;
|
1428
|
+
|
1429
|
+
var _offset = popperOffsets[altAxis];
|
1430
|
+
|
1431
|
+
var _len = altAxis === 'y' ? 'height' : 'width';
|
1432
|
+
|
1433
|
+
var _min = _offset + overflow[_mainSide];
|
1434
|
+
|
1435
|
+
var _max = _offset - overflow[_altSide];
|
1436
|
+
|
1437
|
+
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
1438
|
+
|
1439
|
+
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
1440
|
+
|
1441
|
+
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
1442
|
+
|
1443
|
+
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
1444
|
+
|
1445
|
+
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
1446
|
+
|
1447
|
+
popperOffsets[altAxis] = _preventedOffset;
|
1448
|
+
data[altAxis] = _preventedOffset - _offset;
|
1449
|
+
}
|
1450
|
+
|
1451
|
+
state.modifiersData[name] = data;
|
1452
|
+
} // eslint-disable-next-line import/no-unused-modules
|
1453
|
+
|
1454
|
+
|
1455
|
+
var preventOverflow$1 = {
|
1456
|
+
name: 'preventOverflow',
|
1457
|
+
enabled: true,
|
1458
|
+
phase: 'main',
|
1459
|
+
fn: preventOverflow,
|
1460
|
+
requiresIfExists: ['offset']
|
1461
|
+
};
|
1462
|
+
|
1463
|
+
function getHTMLElementScroll(element) {
|
1464
|
+
return {
|
1465
|
+
scrollLeft: element.scrollLeft,
|
1466
|
+
scrollTop: element.scrollTop
|
1467
|
+
};
|
1468
|
+
}
|
1469
|
+
|
1470
|
+
function getNodeScroll(node) {
|
1471
|
+
if (node === getWindow(node) || !isHTMLElement(node)) {
|
1472
|
+
return getWindowScroll(node);
|
1473
|
+
} else {
|
1474
|
+
return getHTMLElementScroll(node);
|
1475
|
+
}
|
1476
|
+
}
|
1477
|
+
|
1478
|
+
function isElementScaled(element) {
|
1479
|
+
var rect = element.getBoundingClientRect();
|
1480
|
+
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
1481
|
+
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
1482
|
+
return scaleX !== 1 || scaleY !== 1;
|
1483
|
+
} // Returns the composite rect of an element relative to its offsetParent.
|
1484
|
+
// Composite means it takes into account transforms as well as layout.
|
1485
|
+
|
1486
|
+
|
1487
|
+
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
1488
|
+
if (isFixed === void 0) {
|
1489
|
+
isFixed = false;
|
1490
|
+
}
|
1491
|
+
|
1492
|
+
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
1493
|
+
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
1494
|
+
var documentElement = getDocumentElement(offsetParent);
|
1495
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
1496
|
+
var scroll = {
|
1497
|
+
scrollLeft: 0,
|
1498
|
+
scrollTop: 0
|
1499
|
+
};
|
1500
|
+
var offsets = {
|
1501
|
+
x: 0,
|
1502
|
+
y: 0
|
1503
|
+
};
|
1504
|
+
|
1505
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
1506
|
+
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
1507
|
+
isScrollParent(documentElement)) {
|
1508
|
+
scroll = getNodeScroll(offsetParent);
|
1509
|
+
}
|
1510
|
+
|
1511
|
+
if (isHTMLElement(offsetParent)) {
|
1512
|
+
offsets = getBoundingClientRect(offsetParent, true);
|
1513
|
+
offsets.x += offsetParent.clientLeft;
|
1514
|
+
offsets.y += offsetParent.clientTop;
|
1515
|
+
} else if (documentElement) {
|
1516
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
1517
|
+
}
|
1518
|
+
}
|
1519
|
+
|
1520
|
+
return {
|
1521
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
1522
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
1523
|
+
width: rect.width,
|
1524
|
+
height: rect.height
|
1525
|
+
};
|
1526
|
+
}
|
1527
|
+
|
1528
|
+
function order(modifiers) {
|
1529
|
+
var map = new Map();
|
1530
|
+
var visited = new Set();
|
1531
|
+
var result = [];
|
1532
|
+
modifiers.forEach(function (modifier) {
|
1533
|
+
map.set(modifier.name, modifier);
|
1534
|
+
}); // On visiting object, check for its dependencies and visit them recursively
|
1535
|
+
|
1536
|
+
function sort(modifier) {
|
1537
|
+
visited.add(modifier.name);
|
1538
|
+
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
1539
|
+
requires.forEach(function (dep) {
|
1540
|
+
if (!visited.has(dep)) {
|
1541
|
+
var depModifier = map.get(dep);
|
1542
|
+
|
1543
|
+
if (depModifier) {
|
1544
|
+
sort(depModifier);
|
1545
|
+
}
|
1546
|
+
}
|
1547
|
+
});
|
1548
|
+
result.push(modifier);
|
1549
|
+
}
|
1550
|
+
|
1551
|
+
modifiers.forEach(function (modifier) {
|
1552
|
+
if (!visited.has(modifier.name)) {
|
1553
|
+
// check for visited object
|
1554
|
+
sort(modifier);
|
1555
|
+
}
|
1556
|
+
});
|
1557
|
+
return result;
|
1558
|
+
}
|
1559
|
+
|
1560
|
+
function orderModifiers(modifiers) {
|
1561
|
+
// order based on dependencies
|
1562
|
+
var orderedModifiers = order(modifiers); // order based on phase
|
1563
|
+
|
1564
|
+
return modifierPhases.reduce(function (acc, phase) {
|
1565
|
+
return acc.concat(orderedModifiers.filter(function (modifier) {
|
1566
|
+
return modifier.phase === phase;
|
1567
|
+
}));
|
1568
|
+
}, []);
|
1569
|
+
}
|
1570
|
+
|
1571
|
+
function debounce(fn) {
|
1572
|
+
var pending;
|
1573
|
+
return function () {
|
1574
|
+
if (!pending) {
|
1575
|
+
pending = new Promise(function (resolve) {
|
1576
|
+
Promise.resolve().then(function () {
|
1577
|
+
pending = undefined;
|
1578
|
+
resolve(fn());
|
1579
|
+
});
|
1580
|
+
});
|
1581
|
+
}
|
1582
|
+
|
1583
|
+
return pending;
|
1584
|
+
};
|
1585
|
+
}
|
1586
|
+
|
1587
|
+
function mergeByName(modifiers) {
|
1588
|
+
var merged = modifiers.reduce(function (merged, current) {
|
1589
|
+
var existing = merged[current.name];
|
1590
|
+
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
1591
|
+
options: Object.assign({}, existing.options, current.options),
|
1592
|
+
data: Object.assign({}, existing.data, current.data)
|
1593
|
+
}) : current;
|
1594
|
+
return merged;
|
1595
|
+
}, {}); // IE11 does not support Object.values
|
1596
|
+
|
1597
|
+
return Object.keys(merged).map(function (key) {
|
1598
|
+
return merged[key];
|
1599
|
+
});
|
1600
|
+
}
|
1601
|
+
|
1602
|
+
var DEFAULT_OPTIONS = {
|
1603
|
+
placement: 'bottom',
|
1604
|
+
modifiers: [],
|
1605
|
+
strategy: 'absolute'
|
1606
|
+
};
|
1607
|
+
|
1608
|
+
function areValidElements() {
|
1609
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
1610
|
+
args[_key] = arguments[_key];
|
1611
|
+
}
|
1612
|
+
|
1613
|
+
return !args.some(function (element) {
|
1614
|
+
return !(element && typeof element.getBoundingClientRect === 'function');
|
1615
|
+
});
|
1616
|
+
}
|
1617
|
+
|
1618
|
+
function popperGenerator(generatorOptions) {
|
1619
|
+
if (generatorOptions === void 0) {
|
1620
|
+
generatorOptions = {};
|
1621
|
+
}
|
1622
|
+
|
1623
|
+
var _generatorOptions = generatorOptions,
|
1624
|
+
_generatorOptions$def = _generatorOptions.defaultModifiers,
|
1625
|
+
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
|
1626
|
+
_generatorOptions$def2 = _generatorOptions.defaultOptions,
|
1627
|
+
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
1628
|
+
return function createPopper(reference, popper, options) {
|
1629
|
+
if (options === void 0) {
|
1630
|
+
options = defaultOptions;
|
1631
|
+
}
|
1632
|
+
|
1633
|
+
var state = {
|
1634
|
+
placement: 'bottom',
|
1635
|
+
orderedModifiers: [],
|
1636
|
+
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
1637
|
+
modifiersData: {},
|
1638
|
+
elements: {
|
1639
|
+
reference: reference,
|
1640
|
+
popper: popper
|
1641
|
+
},
|
1642
|
+
attributes: {},
|
1643
|
+
styles: {}
|
1644
|
+
};
|
1645
|
+
var effectCleanupFns = [];
|
1646
|
+
var isDestroyed = false;
|
1647
|
+
var instance = {
|
1648
|
+
state: state,
|
1649
|
+
setOptions: function setOptions(setOptionsAction) {
|
1650
|
+
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
1651
|
+
cleanupModifierEffects();
|
1652
|
+
state.options = Object.assign({}, defaultOptions, state.options, options);
|
1653
|
+
state.scrollParents = {
|
1654
|
+
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
1655
|
+
popper: listScrollParents(popper)
|
1656
|
+
}; // Orders the modifiers based on their dependencies and `phase`
|
1657
|
+
// properties
|
1658
|
+
|
1659
|
+
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
|
1660
|
+
|
1661
|
+
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
1662
|
+
return m.enabled;
|
1663
|
+
}); // Validate the provided modifiers so that the consumer will get warned
|
1664
|
+
|
1665
|
+
runModifierEffects();
|
1666
|
+
return instance.update();
|
1667
|
+
},
|
1668
|
+
// Sync update – it will always be executed, even if not necessary. This
|
1669
|
+
// is useful for low frequency updates where sync behavior simplifies the
|
1670
|
+
// logic.
|
1671
|
+
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
1672
|
+
// prefer the async Popper#update method
|
1673
|
+
forceUpdate: function forceUpdate() {
|
1674
|
+
if (isDestroyed) {
|
1675
|
+
return;
|
1676
|
+
}
|
1677
|
+
|
1678
|
+
var _state$elements = state.elements,
|
1679
|
+
reference = _state$elements.reference,
|
1680
|
+
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
|
1681
|
+
// anymore
|
1682
|
+
|
1683
|
+
if (!areValidElements(reference, popper)) {
|
1684
|
+
|
1685
|
+
return;
|
1686
|
+
} // Store the reference and popper rects to be read by modifiers
|
1687
|
+
|
1688
|
+
|
1689
|
+
state.rects = {
|
1690
|
+
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
1691
|
+
popper: getLayoutRect(popper)
|
1692
|
+
}; // Modifiers have the ability to reset the current update cycle. The
|
1693
|
+
// most common use case for this is the `flip` modifier changing the
|
1694
|
+
// placement, which then needs to re-run all the modifiers, because the
|
1695
|
+
// logic was previously ran for the previous placement and is therefore
|
1696
|
+
// stale/incorrect
|
1697
|
+
|
1698
|
+
state.reset = false;
|
1699
|
+
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
|
1700
|
+
// is filled with the initial data specified by the modifier. This means
|
1701
|
+
// it doesn't persist and is fresh on each update.
|
1702
|
+
// To ensure persistent data, use `${name}#persistent`
|
1703
|
+
|
1704
|
+
state.orderedModifiers.forEach(function (modifier) {
|
1705
|
+
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
1706
|
+
});
|
1707
|
+
|
1708
|
+
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
1709
|
+
|
1710
|
+
if (state.reset === true) {
|
1711
|
+
state.reset = false;
|
1712
|
+
index = -1;
|
1713
|
+
continue;
|
1714
|
+
}
|
1715
|
+
|
1716
|
+
var _state$orderedModifie = state.orderedModifiers[index],
|
1717
|
+
fn = _state$orderedModifie.fn,
|
1718
|
+
_state$orderedModifie2 = _state$orderedModifie.options,
|
1719
|
+
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
|
1720
|
+
name = _state$orderedModifie.name;
|
1721
|
+
|
1722
|
+
if (typeof fn === 'function') {
|
1723
|
+
state = fn({
|
1724
|
+
state: state,
|
1725
|
+
options: _options,
|
1726
|
+
name: name,
|
1727
|
+
instance: instance
|
1728
|
+
}) || state;
|
1729
|
+
}
|
1730
|
+
}
|
1731
|
+
},
|
1732
|
+
// Async and optimistically optimized update – it will not be executed if
|
1733
|
+
// not necessary (debounced to run at most once-per-tick)
|
1734
|
+
update: debounce(function () {
|
1735
|
+
return new Promise(function (resolve) {
|
1736
|
+
instance.forceUpdate();
|
1737
|
+
resolve(state);
|
1738
|
+
});
|
1739
|
+
}),
|
1740
|
+
destroy: function destroy() {
|
1741
|
+
cleanupModifierEffects();
|
1742
|
+
isDestroyed = true;
|
1743
|
+
}
|
1744
|
+
};
|
1745
|
+
|
1746
|
+
if (!areValidElements(reference, popper)) {
|
1747
|
+
|
1748
|
+
return instance;
|
1749
|
+
}
|
1750
|
+
|
1751
|
+
instance.setOptions(options).then(function (state) {
|
1752
|
+
if (!isDestroyed && options.onFirstUpdate) {
|
1753
|
+
options.onFirstUpdate(state);
|
1754
|
+
}
|
1755
|
+
}); // Modifiers have the ability to execute arbitrary code before the first
|
1756
|
+
// update cycle runs. They will be executed in the same order as the update
|
1757
|
+
// cycle. This is useful when a modifier adds some persistent data that
|
1758
|
+
// other modifiers need to use, but the modifier is run after the dependent
|
1759
|
+
// one.
|
1760
|
+
|
1761
|
+
function runModifierEffects() {
|
1762
|
+
state.orderedModifiers.forEach(function (_ref3) {
|
1763
|
+
var name = _ref3.name,
|
1764
|
+
_ref3$options = _ref3.options,
|
1765
|
+
options = _ref3$options === void 0 ? {} : _ref3$options,
|
1766
|
+
effect = _ref3.effect;
|
1767
|
+
|
1768
|
+
if (typeof effect === 'function') {
|
1769
|
+
var cleanupFn = effect({
|
1770
|
+
state: state,
|
1771
|
+
name: name,
|
1772
|
+
instance: instance,
|
1773
|
+
options: options
|
1774
|
+
});
|
1775
|
+
|
1776
|
+
var noopFn = function noopFn() {};
|
1777
|
+
|
1778
|
+
effectCleanupFns.push(cleanupFn || noopFn);
|
1779
|
+
}
|
1780
|
+
});
|
1781
|
+
}
|
1782
|
+
|
1783
|
+
function cleanupModifierEffects() {
|
1784
|
+
effectCleanupFns.forEach(function (fn) {
|
1785
|
+
return fn();
|
1786
|
+
});
|
1787
|
+
effectCleanupFns = [];
|
1788
|
+
}
|
1789
|
+
|
1790
|
+
return instance;
|
1791
|
+
};
|
1792
|
+
}
|
1793
|
+
var createPopper$2 = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules
|
1794
|
+
|
1795
|
+
var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
|
1796
|
+
var createPopper$1 = /*#__PURE__*/popperGenerator({
|
1797
|
+
defaultModifiers: defaultModifiers$1
|
1798
|
+
}); // eslint-disable-next-line import/no-unused-modules
|
1799
|
+
|
1800
|
+
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
|
1801
|
+
var createPopper = /*#__PURE__*/popperGenerator({
|
1802
|
+
defaultModifiers: defaultModifiers
|
1803
|
+
}); // eslint-disable-next-line import/no-unused-modules
|
1804
|
+
|
1805
|
+
export { afterMain, afterRead, afterWrite, applyStyles$1 as applyStyles, arrow$1 as arrow, auto, basePlacements, beforeMain, beforeRead, beforeWrite, bottom, clippingParents, computeStyles$1 as computeStyles, createPopper, createPopper$2 as createPopperBase, createPopper$1 as createPopperLite, detectOverflow, end, eventListeners, flip$1 as flip, hide$1 as hide, left, main, modifierPhases, offset$1 as offset, placements, popper, popperGenerator, popperOffsets$1 as popperOffsets, preventOverflow$1 as preventOverflow, read, reference, right, start, top, variationPlacements, viewport, write };
|