prosekit 0.0.0-next-20230627094841
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.
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/dist/basic/style.css +133 -0
- package/dist/chunk-23S3SZFA.js +46 -0
- package/dist/chunk-2MVHS73Q.js +709 -0
- package/dist/chunk-4GDRVRDP.js +0 -0
- package/dist/chunk-5PFF57NB.js +1546 -0
- package/dist/chunk-6A2XHVFY.js +46 -0
- package/dist/chunk-7OYIOTDD.js +16472 -0
- package/dist/chunk-ARJTWYPA.js +1321 -0
- package/dist/chunk-CDGN4JUS.js +1546 -0
- package/dist/chunk-CG5B6PMC.js +973 -0
- package/dist/chunk-DDN3TFRH.js +185 -0
- package/dist/chunk-EQV3CWHZ.js +2213 -0
- package/dist/chunk-ERNIDFFW.js +1711 -0
- package/dist/chunk-FAVXZAF7.js +3279 -0
- package/dist/chunk-HSPTUO6P.js +53 -0
- package/dist/chunk-JMNJUDT7.js +165 -0
- package/dist/chunk-LXCCO2LO.js +52 -0
- package/dist/chunk-MIPON3OH.js +922 -0
- package/dist/chunk-NAWSCY5F.js +166 -0
- package/dist/chunk-S64NFSV2.js +236 -0
- package/dist/chunk-S65R2BUY.js +15 -0
- package/dist/chunk-T2V5UU6H.js +204 -0
- package/dist/chunk-TWIMWRRZ.js +57 -0
- package/dist/chunk-US2P3K6I.js +185 -0
- package/dist/chunk-UTNVEPBA.js +950 -0
- package/dist/chunk-UWHQRU5N.js +4883 -0
- package/dist/chunk-VIKPJJET.js +662 -0
- package/dist/chunk-WAMZOD5I.js +67 -0
- package/dist/chunk-YUY5I2TY.js +236 -0
- package/dist/core/style.css +54 -0
- package/dist/extension-list/style.css +78 -0
- package/dist/pm/view/style/prosemirror.css +52 -0
- package/dist/prosekit-basic.js +2 -0
- package/dist/prosekit-core.js +2 -0
- package/dist/prosekit-extension-blockquote.js +2 -0
- package/dist/prosekit-extension-bold.js +2 -0
- package/dist/prosekit-extension-code-block.js +2 -0
- package/dist/prosekit-extension-code.js +2 -0
- package/dist/prosekit-extension-heading.js +2 -0
- package/dist/prosekit-extension-horizontal-rule.js +2 -0
- package/dist/prosekit-extension-italic.js +2 -0
- package/dist/prosekit-extension-list.js +2 -0
- package/dist/prosekit-extension-suggestion.js +2 -0
- package/dist/prosekit-lit-elements-menu-item.js +2 -0
- package/dist/prosekit-lit-elements-menu.js +2 -0
- package/dist/prosekit-lit-elements-popover.js +2 -0
- package/dist/prosekit-lit.js +2 -0
- package/dist/prosekit-pm-commands.js +2 -0
- package/dist/prosekit-pm-inputrules.js +2 -0
- package/dist/prosekit-pm-keymap.js +2 -0
- package/dist/prosekit-pm-model.js +2 -0
- package/dist/prosekit-pm-state.js +2 -0
- package/dist/prosekit-pm-transform.js +2 -0
- package/dist/prosekit-pm-view.js +2 -0
- package/dist/prosekit-pm.js +2 -0
- package/dist/prosekit-react-components-menu-item.js +2 -0
- package/dist/prosekit-react-components-menu.js +2 -0
- package/dist/prosekit-react-components-popover-suggestion.js +2 -0
- package/dist/prosekit-react-components-popover.js +2 -0
- package/dist/prosekit-react.js +2 -0
- package/dist/prosekit-vue-components-menu-item.js +2 -0
- package/dist/prosekit-vue-components-menu.js +2 -0
- package/dist/prosekit-vue-components-popover-suggestion.js +2 -0
- package/dist/prosekit-vue-components-popover.js +2 -0
- package/dist/prosekit-vue.js +2 -0
- package/dist/prosekit.js +0 -0
- package/package.json +262 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,1546 @@
|
|
|
1
|
+
import {
|
|
2
|
+
T,
|
|
3
|
+
b,
|
|
4
|
+
blockComponentStyles,
|
|
5
|
+
e,
|
|
6
|
+
n,
|
|
7
|
+
r,
|
|
8
|
+
s,
|
|
9
|
+
t
|
|
10
|
+
} from "./chunk-CG5B6PMC.js";
|
|
11
|
+
import {
|
|
12
|
+
__decorateClass
|
|
13
|
+
} from "./chunk-HSPTUO6P.js";
|
|
14
|
+
|
|
15
|
+
// ../../node_modules/.pnpm/@floating-ui+core@1.3.1/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
16
|
+
function getAlignment(placement) {
|
|
17
|
+
return placement.split("-")[1];
|
|
18
|
+
}
|
|
19
|
+
function getLengthFromAxis(axis) {
|
|
20
|
+
return axis === "y" ? "height" : "width";
|
|
21
|
+
}
|
|
22
|
+
function getSide(placement) {
|
|
23
|
+
return placement.split("-")[0];
|
|
24
|
+
}
|
|
25
|
+
function getMainAxisFromPlacement(placement) {
|
|
26
|
+
return ["top", "bottom"].includes(getSide(placement)) ? "x" : "y";
|
|
27
|
+
}
|
|
28
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
29
|
+
let {
|
|
30
|
+
reference,
|
|
31
|
+
floating
|
|
32
|
+
} = _ref;
|
|
33
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
34
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
35
|
+
const mainAxis = getMainAxisFromPlacement(placement);
|
|
36
|
+
const length = getLengthFromAxis(mainAxis);
|
|
37
|
+
const commonAlign = reference[length] / 2 - floating[length] / 2;
|
|
38
|
+
const side = getSide(placement);
|
|
39
|
+
const isVertical = mainAxis === "x";
|
|
40
|
+
let coords;
|
|
41
|
+
switch (side) {
|
|
42
|
+
case "top":
|
|
43
|
+
coords = {
|
|
44
|
+
x: commonX,
|
|
45
|
+
y: reference.y - floating.height
|
|
46
|
+
};
|
|
47
|
+
break;
|
|
48
|
+
case "bottom":
|
|
49
|
+
coords = {
|
|
50
|
+
x: commonX,
|
|
51
|
+
y: reference.y + reference.height
|
|
52
|
+
};
|
|
53
|
+
break;
|
|
54
|
+
case "right":
|
|
55
|
+
coords = {
|
|
56
|
+
x: reference.x + reference.width,
|
|
57
|
+
y: commonY
|
|
58
|
+
};
|
|
59
|
+
break;
|
|
60
|
+
case "left":
|
|
61
|
+
coords = {
|
|
62
|
+
x: reference.x - floating.width,
|
|
63
|
+
y: commonY
|
|
64
|
+
};
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
coords = {
|
|
68
|
+
x: reference.x,
|
|
69
|
+
y: reference.y
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
switch (getAlignment(placement)) {
|
|
73
|
+
case "start":
|
|
74
|
+
coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
75
|
+
break;
|
|
76
|
+
case "end":
|
|
77
|
+
coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
return coords;
|
|
81
|
+
}
|
|
82
|
+
var computePosition = async (reference, floating, config) => {
|
|
83
|
+
const {
|
|
84
|
+
placement = "bottom",
|
|
85
|
+
strategy = "absolute",
|
|
86
|
+
middleware = [],
|
|
87
|
+
platform: platform2
|
|
88
|
+
} = config;
|
|
89
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
90
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
91
|
+
let rects = await platform2.getElementRects({
|
|
92
|
+
reference,
|
|
93
|
+
floating,
|
|
94
|
+
strategy
|
|
95
|
+
});
|
|
96
|
+
let {
|
|
97
|
+
x,
|
|
98
|
+
y
|
|
99
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
100
|
+
let statefulPlacement = placement;
|
|
101
|
+
let middlewareData = {};
|
|
102
|
+
let resetCount = 0;
|
|
103
|
+
for (let i3 = 0; i3 < validMiddleware.length; i3++) {
|
|
104
|
+
const {
|
|
105
|
+
name,
|
|
106
|
+
fn
|
|
107
|
+
} = validMiddleware[i3];
|
|
108
|
+
const {
|
|
109
|
+
x: nextX,
|
|
110
|
+
y: nextY,
|
|
111
|
+
data,
|
|
112
|
+
reset
|
|
113
|
+
} = await fn({
|
|
114
|
+
x,
|
|
115
|
+
y,
|
|
116
|
+
initialPlacement: placement,
|
|
117
|
+
placement: statefulPlacement,
|
|
118
|
+
strategy,
|
|
119
|
+
middlewareData,
|
|
120
|
+
rects,
|
|
121
|
+
platform: platform2,
|
|
122
|
+
elements: {
|
|
123
|
+
reference,
|
|
124
|
+
floating
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
x = nextX != null ? nextX : x;
|
|
128
|
+
y = nextY != null ? nextY : y;
|
|
129
|
+
middlewareData = {
|
|
130
|
+
...middlewareData,
|
|
131
|
+
[name]: {
|
|
132
|
+
...middlewareData[name],
|
|
133
|
+
...data
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
if (reset && resetCount <= 50) {
|
|
137
|
+
resetCount++;
|
|
138
|
+
if (typeof reset === "object") {
|
|
139
|
+
if (reset.placement) {
|
|
140
|
+
statefulPlacement = reset.placement;
|
|
141
|
+
}
|
|
142
|
+
if (reset.rects) {
|
|
143
|
+
rects = reset.rects === true ? await platform2.getElementRects({
|
|
144
|
+
reference,
|
|
145
|
+
floating,
|
|
146
|
+
strategy
|
|
147
|
+
}) : reset.rects;
|
|
148
|
+
}
|
|
149
|
+
({
|
|
150
|
+
x,
|
|
151
|
+
y
|
|
152
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
153
|
+
}
|
|
154
|
+
i3 = -1;
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
x,
|
|
160
|
+
y,
|
|
161
|
+
placement: statefulPlacement,
|
|
162
|
+
strategy,
|
|
163
|
+
middlewareData
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
function evaluate(value, param) {
|
|
167
|
+
return typeof value === "function" ? value(param) : value;
|
|
168
|
+
}
|
|
169
|
+
function expandPaddingObject(padding) {
|
|
170
|
+
return {
|
|
171
|
+
top: 0,
|
|
172
|
+
right: 0,
|
|
173
|
+
bottom: 0,
|
|
174
|
+
left: 0,
|
|
175
|
+
...padding
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function getSideObjectFromPadding(padding) {
|
|
179
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
180
|
+
top: padding,
|
|
181
|
+
right: padding,
|
|
182
|
+
bottom: padding,
|
|
183
|
+
left: padding
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function rectToClientRect(rect) {
|
|
187
|
+
return {
|
|
188
|
+
...rect,
|
|
189
|
+
top: rect.y,
|
|
190
|
+
left: rect.x,
|
|
191
|
+
right: rect.x + rect.width,
|
|
192
|
+
bottom: rect.y + rect.height
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
async function detectOverflow(state, options) {
|
|
196
|
+
var _await$platform$isEle;
|
|
197
|
+
if (options === void 0) {
|
|
198
|
+
options = {};
|
|
199
|
+
}
|
|
200
|
+
const {
|
|
201
|
+
x,
|
|
202
|
+
y,
|
|
203
|
+
platform: platform2,
|
|
204
|
+
rects,
|
|
205
|
+
elements,
|
|
206
|
+
strategy
|
|
207
|
+
} = state;
|
|
208
|
+
const {
|
|
209
|
+
boundary = "clippingAncestors",
|
|
210
|
+
rootBoundary = "viewport",
|
|
211
|
+
elementContext = "floating",
|
|
212
|
+
altBoundary = false,
|
|
213
|
+
padding = 0
|
|
214
|
+
} = evaluate(options, state);
|
|
215
|
+
const paddingObject = getSideObjectFromPadding(padding);
|
|
216
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
217
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
218
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
219
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
220
|
+
boundary,
|
|
221
|
+
rootBoundary,
|
|
222
|
+
strategy
|
|
223
|
+
}));
|
|
224
|
+
const rect = elementContext === "floating" ? {
|
|
225
|
+
...rects.floating,
|
|
226
|
+
x,
|
|
227
|
+
y
|
|
228
|
+
} : rects.reference;
|
|
229
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
230
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
231
|
+
x: 1,
|
|
232
|
+
y: 1
|
|
233
|
+
} : {
|
|
234
|
+
x: 1,
|
|
235
|
+
y: 1
|
|
236
|
+
};
|
|
237
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
238
|
+
rect,
|
|
239
|
+
offsetParent,
|
|
240
|
+
strategy
|
|
241
|
+
}) : rect);
|
|
242
|
+
return {
|
|
243
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
244
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
245
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
246
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
var min = Math.min;
|
|
250
|
+
var max = Math.max;
|
|
251
|
+
function within(min$1, value, max$1) {
|
|
252
|
+
return max(min$1, min(value, max$1));
|
|
253
|
+
}
|
|
254
|
+
var oppositeSideMap = {
|
|
255
|
+
left: "right",
|
|
256
|
+
right: "left",
|
|
257
|
+
bottom: "top",
|
|
258
|
+
top: "bottom"
|
|
259
|
+
};
|
|
260
|
+
function getOppositePlacement(placement) {
|
|
261
|
+
return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
|
|
262
|
+
}
|
|
263
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
264
|
+
if (rtl === void 0) {
|
|
265
|
+
rtl = false;
|
|
266
|
+
}
|
|
267
|
+
const alignment = getAlignment(placement);
|
|
268
|
+
const mainAxis = getMainAxisFromPlacement(placement);
|
|
269
|
+
const length = getLengthFromAxis(mainAxis);
|
|
270
|
+
let mainAlignmentSide = mainAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
271
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
272
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
main: mainAlignmentSide,
|
|
276
|
+
cross: getOppositePlacement(mainAlignmentSide)
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
var oppositeAlignmentMap = {
|
|
280
|
+
start: "end",
|
|
281
|
+
end: "start"
|
|
282
|
+
};
|
|
283
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
284
|
+
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
|
285
|
+
}
|
|
286
|
+
function getExpandedPlacements(placement) {
|
|
287
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
288
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
289
|
+
}
|
|
290
|
+
function getSideList(side, isStart, rtl) {
|
|
291
|
+
const lr = ["left", "right"];
|
|
292
|
+
const rl = ["right", "left"];
|
|
293
|
+
const tb = ["top", "bottom"];
|
|
294
|
+
const bt = ["bottom", "top"];
|
|
295
|
+
switch (side) {
|
|
296
|
+
case "top":
|
|
297
|
+
case "bottom":
|
|
298
|
+
if (rtl)
|
|
299
|
+
return isStart ? rl : lr;
|
|
300
|
+
return isStart ? lr : rl;
|
|
301
|
+
case "left":
|
|
302
|
+
case "right":
|
|
303
|
+
return isStart ? tb : bt;
|
|
304
|
+
default:
|
|
305
|
+
return [];
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
309
|
+
const alignment = getAlignment(placement);
|
|
310
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
311
|
+
if (alignment) {
|
|
312
|
+
list = list.map((side) => side + "-" + alignment);
|
|
313
|
+
if (flipAlignment) {
|
|
314
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return list;
|
|
318
|
+
}
|
|
319
|
+
var flip = function(options) {
|
|
320
|
+
if (options === void 0) {
|
|
321
|
+
options = {};
|
|
322
|
+
}
|
|
323
|
+
return {
|
|
324
|
+
name: "flip",
|
|
325
|
+
options,
|
|
326
|
+
async fn(state) {
|
|
327
|
+
var _middlewareData$flip;
|
|
328
|
+
const {
|
|
329
|
+
placement,
|
|
330
|
+
middlewareData,
|
|
331
|
+
rects,
|
|
332
|
+
initialPlacement,
|
|
333
|
+
platform: platform2,
|
|
334
|
+
elements
|
|
335
|
+
} = state;
|
|
336
|
+
const {
|
|
337
|
+
mainAxis: checkMainAxis = true,
|
|
338
|
+
crossAxis: checkCrossAxis = true,
|
|
339
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
340
|
+
fallbackStrategy = "bestFit",
|
|
341
|
+
fallbackAxisSideDirection = "none",
|
|
342
|
+
flipAlignment = true,
|
|
343
|
+
...detectOverflowOptions
|
|
344
|
+
} = evaluate(options, state);
|
|
345
|
+
const side = getSide(placement);
|
|
346
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
347
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
348
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
349
|
+
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
|
|
350
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
351
|
+
}
|
|
352
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
353
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
354
|
+
const overflows = [];
|
|
355
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
356
|
+
if (checkMainAxis) {
|
|
357
|
+
overflows.push(overflow[side]);
|
|
358
|
+
}
|
|
359
|
+
if (checkCrossAxis) {
|
|
360
|
+
const {
|
|
361
|
+
main,
|
|
362
|
+
cross
|
|
363
|
+
} = getAlignmentSides(placement, rects, rtl);
|
|
364
|
+
overflows.push(overflow[main], overflow[cross]);
|
|
365
|
+
}
|
|
366
|
+
overflowsData = [...overflowsData, {
|
|
367
|
+
placement,
|
|
368
|
+
overflows
|
|
369
|
+
}];
|
|
370
|
+
if (!overflows.every((side2) => side2 <= 0)) {
|
|
371
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
372
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
373
|
+
const nextPlacement = placements[nextIndex];
|
|
374
|
+
if (nextPlacement) {
|
|
375
|
+
return {
|
|
376
|
+
data: {
|
|
377
|
+
index: nextIndex,
|
|
378
|
+
overflows: overflowsData
|
|
379
|
+
},
|
|
380
|
+
reset: {
|
|
381
|
+
placement: nextPlacement
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b2) => a.overflows[1] - b2.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
386
|
+
if (!resetPlacement) {
|
|
387
|
+
switch (fallbackStrategy) {
|
|
388
|
+
case "bestFit": {
|
|
389
|
+
var _overflowsData$map$so;
|
|
390
|
+
const placement2 = (_overflowsData$map$so = overflowsData.map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b2) => a[1] - b2[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
|
|
391
|
+
if (placement2) {
|
|
392
|
+
resetPlacement = placement2;
|
|
393
|
+
}
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
case "initialPlacement":
|
|
397
|
+
resetPlacement = initialPlacement;
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
if (placement !== resetPlacement) {
|
|
402
|
+
return {
|
|
403
|
+
reset: {
|
|
404
|
+
placement: resetPlacement
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return {};
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
function getBoundingRect(rects) {
|
|
414
|
+
const minX = min(...rects.map((rect) => rect.left));
|
|
415
|
+
const minY = min(...rects.map((rect) => rect.top));
|
|
416
|
+
const maxX = max(...rects.map((rect) => rect.right));
|
|
417
|
+
const maxY = max(...rects.map((rect) => rect.bottom));
|
|
418
|
+
return {
|
|
419
|
+
x: minX,
|
|
420
|
+
y: minY,
|
|
421
|
+
width: maxX - minX,
|
|
422
|
+
height: maxY - minY
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function getRectsByLine(rects) {
|
|
426
|
+
const sortedRects = rects.slice().sort((a, b2) => a.y - b2.y);
|
|
427
|
+
const groups = [];
|
|
428
|
+
let prevRect = null;
|
|
429
|
+
for (let i3 = 0; i3 < sortedRects.length; i3++) {
|
|
430
|
+
const rect = sortedRects[i3];
|
|
431
|
+
if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
|
|
432
|
+
groups.push([rect]);
|
|
433
|
+
} else {
|
|
434
|
+
groups[groups.length - 1].push(rect);
|
|
435
|
+
}
|
|
436
|
+
prevRect = rect;
|
|
437
|
+
}
|
|
438
|
+
return groups.map((rect) => rectToClientRect(getBoundingRect(rect)));
|
|
439
|
+
}
|
|
440
|
+
var inline = function(options) {
|
|
441
|
+
if (options === void 0) {
|
|
442
|
+
options = {};
|
|
443
|
+
}
|
|
444
|
+
return {
|
|
445
|
+
name: "inline",
|
|
446
|
+
options,
|
|
447
|
+
async fn(state) {
|
|
448
|
+
const {
|
|
449
|
+
placement,
|
|
450
|
+
elements,
|
|
451
|
+
rects,
|
|
452
|
+
platform: platform2,
|
|
453
|
+
strategy
|
|
454
|
+
} = state;
|
|
455
|
+
const {
|
|
456
|
+
padding = 2,
|
|
457
|
+
x,
|
|
458
|
+
y
|
|
459
|
+
} = evaluate(options, state);
|
|
460
|
+
const nativeClientRects = Array.from(await (platform2.getClientRects == null ? void 0 : platform2.getClientRects(elements.reference)) || []);
|
|
461
|
+
const clientRects = getRectsByLine(nativeClientRects);
|
|
462
|
+
const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
|
|
463
|
+
const paddingObject = getSideObjectFromPadding(padding);
|
|
464
|
+
function getBoundingClientRect2() {
|
|
465
|
+
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
|
|
466
|
+
return clientRects.find((rect) => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
|
|
467
|
+
}
|
|
468
|
+
if (clientRects.length >= 2) {
|
|
469
|
+
if (getMainAxisFromPlacement(placement) === "x") {
|
|
470
|
+
const firstRect = clientRects[0];
|
|
471
|
+
const lastRect = clientRects[clientRects.length - 1];
|
|
472
|
+
const isTop = getSide(placement) === "top";
|
|
473
|
+
const top2 = firstRect.top;
|
|
474
|
+
const bottom2 = lastRect.bottom;
|
|
475
|
+
const left2 = isTop ? firstRect.left : lastRect.left;
|
|
476
|
+
const right2 = isTop ? firstRect.right : lastRect.right;
|
|
477
|
+
const width2 = right2 - left2;
|
|
478
|
+
const height2 = bottom2 - top2;
|
|
479
|
+
return {
|
|
480
|
+
top: top2,
|
|
481
|
+
bottom: bottom2,
|
|
482
|
+
left: left2,
|
|
483
|
+
right: right2,
|
|
484
|
+
width: width2,
|
|
485
|
+
height: height2,
|
|
486
|
+
x: left2,
|
|
487
|
+
y: top2
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
const isLeftSide = getSide(placement) === "left";
|
|
491
|
+
const maxRight = max(...clientRects.map((rect) => rect.right));
|
|
492
|
+
const minLeft = min(...clientRects.map((rect) => rect.left));
|
|
493
|
+
const measureRects = clientRects.filter((rect) => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
|
|
494
|
+
const top = measureRects[0].top;
|
|
495
|
+
const bottom = measureRects[measureRects.length - 1].bottom;
|
|
496
|
+
const left = minLeft;
|
|
497
|
+
const right = maxRight;
|
|
498
|
+
const width = right - left;
|
|
499
|
+
const height = bottom - top;
|
|
500
|
+
return {
|
|
501
|
+
top,
|
|
502
|
+
bottom,
|
|
503
|
+
left,
|
|
504
|
+
right,
|
|
505
|
+
width,
|
|
506
|
+
height,
|
|
507
|
+
x: left,
|
|
508
|
+
y: top
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
return fallback;
|
|
512
|
+
}
|
|
513
|
+
const resetRects = await platform2.getElementRects({
|
|
514
|
+
reference: {
|
|
515
|
+
getBoundingClientRect: getBoundingClientRect2
|
|
516
|
+
},
|
|
517
|
+
floating: elements.floating,
|
|
518
|
+
strategy
|
|
519
|
+
});
|
|
520
|
+
if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
|
|
521
|
+
return {
|
|
522
|
+
reset: {
|
|
523
|
+
rects: resetRects
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
return {};
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
};
|
|
531
|
+
async function convertValueToCoords(state, options) {
|
|
532
|
+
const {
|
|
533
|
+
placement,
|
|
534
|
+
platform: platform2,
|
|
535
|
+
elements
|
|
536
|
+
} = state;
|
|
537
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
538
|
+
const side = getSide(placement);
|
|
539
|
+
const alignment = getAlignment(placement);
|
|
540
|
+
const isVertical = getMainAxisFromPlacement(placement) === "x";
|
|
541
|
+
const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
|
|
542
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
543
|
+
const rawValue = evaluate(options, state);
|
|
544
|
+
let {
|
|
545
|
+
mainAxis,
|
|
546
|
+
crossAxis,
|
|
547
|
+
alignmentAxis
|
|
548
|
+
} = typeof rawValue === "number" ? {
|
|
549
|
+
mainAxis: rawValue,
|
|
550
|
+
crossAxis: 0,
|
|
551
|
+
alignmentAxis: null
|
|
552
|
+
} : {
|
|
553
|
+
mainAxis: 0,
|
|
554
|
+
crossAxis: 0,
|
|
555
|
+
alignmentAxis: null,
|
|
556
|
+
...rawValue
|
|
557
|
+
};
|
|
558
|
+
if (alignment && typeof alignmentAxis === "number") {
|
|
559
|
+
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
560
|
+
}
|
|
561
|
+
return isVertical ? {
|
|
562
|
+
x: crossAxis * crossAxisMulti,
|
|
563
|
+
y: mainAxis * mainAxisMulti
|
|
564
|
+
} : {
|
|
565
|
+
x: mainAxis * mainAxisMulti,
|
|
566
|
+
y: crossAxis * crossAxisMulti
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
var offset = function(options) {
|
|
570
|
+
if (options === void 0) {
|
|
571
|
+
options = 0;
|
|
572
|
+
}
|
|
573
|
+
return {
|
|
574
|
+
name: "offset",
|
|
575
|
+
options,
|
|
576
|
+
async fn(state) {
|
|
577
|
+
const {
|
|
578
|
+
x,
|
|
579
|
+
y
|
|
580
|
+
} = state;
|
|
581
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
582
|
+
return {
|
|
583
|
+
x: x + diffCoords.x,
|
|
584
|
+
y: y + diffCoords.y,
|
|
585
|
+
data: diffCoords
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
};
|
|
590
|
+
function getCrossAxis(axis) {
|
|
591
|
+
return axis === "x" ? "y" : "x";
|
|
592
|
+
}
|
|
593
|
+
var shift = function(options) {
|
|
594
|
+
if (options === void 0) {
|
|
595
|
+
options = {};
|
|
596
|
+
}
|
|
597
|
+
return {
|
|
598
|
+
name: "shift",
|
|
599
|
+
options,
|
|
600
|
+
async fn(state) {
|
|
601
|
+
const {
|
|
602
|
+
x,
|
|
603
|
+
y,
|
|
604
|
+
placement
|
|
605
|
+
} = state;
|
|
606
|
+
const {
|
|
607
|
+
mainAxis: checkMainAxis = true,
|
|
608
|
+
crossAxis: checkCrossAxis = false,
|
|
609
|
+
limiter = {
|
|
610
|
+
fn: (_ref) => {
|
|
611
|
+
let {
|
|
612
|
+
x: x2,
|
|
613
|
+
y: y2
|
|
614
|
+
} = _ref;
|
|
615
|
+
return {
|
|
616
|
+
x: x2,
|
|
617
|
+
y: y2
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
...detectOverflowOptions
|
|
622
|
+
} = evaluate(options, state);
|
|
623
|
+
const coords = {
|
|
624
|
+
x,
|
|
625
|
+
y
|
|
626
|
+
};
|
|
627
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
628
|
+
const mainAxis = getMainAxisFromPlacement(getSide(placement));
|
|
629
|
+
const crossAxis = getCrossAxis(mainAxis);
|
|
630
|
+
let mainAxisCoord = coords[mainAxis];
|
|
631
|
+
let crossAxisCoord = coords[crossAxis];
|
|
632
|
+
if (checkMainAxis) {
|
|
633
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
634
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
635
|
+
const min3 = mainAxisCoord + overflow[minSide];
|
|
636
|
+
const max3 = mainAxisCoord - overflow[maxSide];
|
|
637
|
+
mainAxisCoord = within(min3, mainAxisCoord, max3);
|
|
638
|
+
}
|
|
639
|
+
if (checkCrossAxis) {
|
|
640
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
641
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
642
|
+
const min3 = crossAxisCoord + overflow[minSide];
|
|
643
|
+
const max3 = crossAxisCoord - overflow[maxSide];
|
|
644
|
+
crossAxisCoord = within(min3, crossAxisCoord, max3);
|
|
645
|
+
}
|
|
646
|
+
const limitedCoords = limiter.fn({
|
|
647
|
+
...state,
|
|
648
|
+
[mainAxis]: mainAxisCoord,
|
|
649
|
+
[crossAxis]: crossAxisCoord
|
|
650
|
+
});
|
|
651
|
+
return {
|
|
652
|
+
...limitedCoords,
|
|
653
|
+
data: {
|
|
654
|
+
x: limitedCoords.x - x,
|
|
655
|
+
y: limitedCoords.y - y
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
};
|
|
661
|
+
var size = function(options) {
|
|
662
|
+
if (options === void 0) {
|
|
663
|
+
options = {};
|
|
664
|
+
}
|
|
665
|
+
return {
|
|
666
|
+
name: "size",
|
|
667
|
+
options,
|
|
668
|
+
async fn(state) {
|
|
669
|
+
const {
|
|
670
|
+
placement,
|
|
671
|
+
rects,
|
|
672
|
+
platform: platform2,
|
|
673
|
+
elements
|
|
674
|
+
} = state;
|
|
675
|
+
const {
|
|
676
|
+
apply = () => {
|
|
677
|
+
},
|
|
678
|
+
...detectOverflowOptions
|
|
679
|
+
} = evaluate(options, state);
|
|
680
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
681
|
+
const side = getSide(placement);
|
|
682
|
+
const alignment = getAlignment(placement);
|
|
683
|
+
const axis = getMainAxisFromPlacement(placement);
|
|
684
|
+
const isXAxis = axis === "x";
|
|
685
|
+
const {
|
|
686
|
+
width,
|
|
687
|
+
height
|
|
688
|
+
} = rects.floating;
|
|
689
|
+
let heightSide;
|
|
690
|
+
let widthSide;
|
|
691
|
+
if (side === "top" || side === "bottom") {
|
|
692
|
+
heightSide = side;
|
|
693
|
+
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
694
|
+
} else {
|
|
695
|
+
widthSide = side;
|
|
696
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
697
|
+
}
|
|
698
|
+
const overflowAvailableHeight = height - overflow[heightSide];
|
|
699
|
+
const overflowAvailableWidth = width - overflow[widthSide];
|
|
700
|
+
const noShift = !state.middlewareData.shift;
|
|
701
|
+
let availableHeight = overflowAvailableHeight;
|
|
702
|
+
let availableWidth = overflowAvailableWidth;
|
|
703
|
+
if (isXAxis) {
|
|
704
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
705
|
+
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
706
|
+
} else {
|
|
707
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
708
|
+
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
709
|
+
}
|
|
710
|
+
if (noShift && !alignment) {
|
|
711
|
+
const xMin = max(overflow.left, 0);
|
|
712
|
+
const xMax = max(overflow.right, 0);
|
|
713
|
+
const yMin = max(overflow.top, 0);
|
|
714
|
+
const yMax = max(overflow.bottom, 0);
|
|
715
|
+
if (isXAxis) {
|
|
716
|
+
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
717
|
+
} else {
|
|
718
|
+
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
await apply({
|
|
722
|
+
...state,
|
|
723
|
+
availableWidth,
|
|
724
|
+
availableHeight
|
|
725
|
+
});
|
|
726
|
+
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
727
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
728
|
+
return {
|
|
729
|
+
reset: {
|
|
730
|
+
rects: true
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
return {};
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
// ../../node_modules/.pnpm/@floating-ui+dom@1.4.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
740
|
+
function getWindow(node) {
|
|
741
|
+
var _node$ownerDocument;
|
|
742
|
+
return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
743
|
+
}
|
|
744
|
+
function getComputedStyle$1(element) {
|
|
745
|
+
return getWindow(element).getComputedStyle(element);
|
|
746
|
+
}
|
|
747
|
+
function isNode(value) {
|
|
748
|
+
return value instanceof getWindow(value).Node;
|
|
749
|
+
}
|
|
750
|
+
function getNodeName(node) {
|
|
751
|
+
if (isNode(node)) {
|
|
752
|
+
return (node.nodeName || "").toLowerCase();
|
|
753
|
+
}
|
|
754
|
+
return "#document";
|
|
755
|
+
}
|
|
756
|
+
function isHTMLElement(value) {
|
|
757
|
+
return value instanceof getWindow(value).HTMLElement;
|
|
758
|
+
}
|
|
759
|
+
function isElement(value) {
|
|
760
|
+
return value instanceof getWindow(value).Element;
|
|
761
|
+
}
|
|
762
|
+
function isShadowRoot(node) {
|
|
763
|
+
if (typeof ShadowRoot === "undefined") {
|
|
764
|
+
return false;
|
|
765
|
+
}
|
|
766
|
+
return node instanceof getWindow(node).ShadowRoot || node instanceof ShadowRoot;
|
|
767
|
+
}
|
|
768
|
+
function isOverflowElement(element) {
|
|
769
|
+
const {
|
|
770
|
+
overflow,
|
|
771
|
+
overflowX,
|
|
772
|
+
overflowY,
|
|
773
|
+
display
|
|
774
|
+
} = getComputedStyle$1(element);
|
|
775
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
776
|
+
}
|
|
777
|
+
function isTableElement(element) {
|
|
778
|
+
return ["table", "td", "th"].includes(getNodeName(element));
|
|
779
|
+
}
|
|
780
|
+
function isContainingBlock(element) {
|
|
781
|
+
const safari = isSafari();
|
|
782
|
+
const css = getComputedStyle$1(element);
|
|
783
|
+
return css.transform !== "none" || css.perspective !== "none" || !safari && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !safari && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
|
|
784
|
+
}
|
|
785
|
+
function isSafari() {
|
|
786
|
+
if (typeof CSS === "undefined" || !CSS.supports)
|
|
787
|
+
return false;
|
|
788
|
+
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
789
|
+
}
|
|
790
|
+
function isLastTraversableNode(node) {
|
|
791
|
+
return ["html", "body", "#document"].includes(getNodeName(node));
|
|
792
|
+
}
|
|
793
|
+
var min2 = Math.min;
|
|
794
|
+
var max2 = Math.max;
|
|
795
|
+
var round = Math.round;
|
|
796
|
+
var floor = Math.floor;
|
|
797
|
+
var createEmptyCoords = (v) => ({
|
|
798
|
+
x: v,
|
|
799
|
+
y: v
|
|
800
|
+
});
|
|
801
|
+
function getCssDimensions(element) {
|
|
802
|
+
const css = getComputedStyle$1(element);
|
|
803
|
+
let width = parseFloat(css.width) || 0;
|
|
804
|
+
let height = parseFloat(css.height) || 0;
|
|
805
|
+
const hasOffset = isHTMLElement(element);
|
|
806
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
807
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
808
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
809
|
+
if (shouldFallback) {
|
|
810
|
+
width = offsetWidth;
|
|
811
|
+
height = offsetHeight;
|
|
812
|
+
}
|
|
813
|
+
return {
|
|
814
|
+
width,
|
|
815
|
+
height,
|
|
816
|
+
$: shouldFallback
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
function unwrapElement(element) {
|
|
820
|
+
return !isElement(element) ? element.contextElement : element;
|
|
821
|
+
}
|
|
822
|
+
function getScale(element) {
|
|
823
|
+
const domElement = unwrapElement(element);
|
|
824
|
+
if (!isHTMLElement(domElement)) {
|
|
825
|
+
return createEmptyCoords(1);
|
|
826
|
+
}
|
|
827
|
+
const rect = domElement.getBoundingClientRect();
|
|
828
|
+
const {
|
|
829
|
+
width,
|
|
830
|
+
height,
|
|
831
|
+
$
|
|
832
|
+
} = getCssDimensions(domElement);
|
|
833
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
834
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
835
|
+
if (!x || !Number.isFinite(x)) {
|
|
836
|
+
x = 1;
|
|
837
|
+
}
|
|
838
|
+
if (!y || !Number.isFinite(y)) {
|
|
839
|
+
y = 1;
|
|
840
|
+
}
|
|
841
|
+
return {
|
|
842
|
+
x,
|
|
843
|
+
y
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
var noOffsets = /* @__PURE__ */ createEmptyCoords(0);
|
|
847
|
+
function getVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
848
|
+
var _win$visualViewport, _win$visualViewport2;
|
|
849
|
+
if (isFixed === void 0) {
|
|
850
|
+
isFixed = true;
|
|
851
|
+
}
|
|
852
|
+
if (!isSafari()) {
|
|
853
|
+
return noOffsets;
|
|
854
|
+
}
|
|
855
|
+
const win = element ? getWindow(element) : window;
|
|
856
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== win) {
|
|
857
|
+
return noOffsets;
|
|
858
|
+
}
|
|
859
|
+
return {
|
|
860
|
+
x: ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0,
|
|
861
|
+
y: ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
865
|
+
if (includeScale === void 0) {
|
|
866
|
+
includeScale = false;
|
|
867
|
+
}
|
|
868
|
+
if (isFixedStrategy === void 0) {
|
|
869
|
+
isFixedStrategy = false;
|
|
870
|
+
}
|
|
871
|
+
const clientRect = element.getBoundingClientRect();
|
|
872
|
+
const domElement = unwrapElement(element);
|
|
873
|
+
let scale = createEmptyCoords(1);
|
|
874
|
+
if (includeScale) {
|
|
875
|
+
if (offsetParent) {
|
|
876
|
+
if (isElement(offsetParent)) {
|
|
877
|
+
scale = getScale(offsetParent);
|
|
878
|
+
}
|
|
879
|
+
} else {
|
|
880
|
+
scale = getScale(element);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
const visualOffsets = getVisualOffsets(domElement, isFixedStrategy, offsetParent);
|
|
884
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
885
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
886
|
+
let width = clientRect.width / scale.x;
|
|
887
|
+
let height = clientRect.height / scale.y;
|
|
888
|
+
if (domElement) {
|
|
889
|
+
const win = getWindow(domElement);
|
|
890
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
891
|
+
let currentIFrame = win.frameElement;
|
|
892
|
+
while (currentIFrame && offsetParent && offsetWin !== win) {
|
|
893
|
+
const iframeScale = getScale(currentIFrame);
|
|
894
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
895
|
+
const css = getComputedStyle(currentIFrame);
|
|
896
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
897
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
898
|
+
x *= iframeScale.x;
|
|
899
|
+
y *= iframeScale.y;
|
|
900
|
+
width *= iframeScale.x;
|
|
901
|
+
height *= iframeScale.y;
|
|
902
|
+
x += left;
|
|
903
|
+
y += top;
|
|
904
|
+
currentIFrame = getWindow(currentIFrame).frameElement;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
return rectToClientRect({
|
|
908
|
+
width,
|
|
909
|
+
height,
|
|
910
|
+
x,
|
|
911
|
+
y
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
function getDocumentElement(node) {
|
|
915
|
+
return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
|
|
916
|
+
}
|
|
917
|
+
function getNodeScroll(element) {
|
|
918
|
+
if (isElement(element)) {
|
|
919
|
+
return {
|
|
920
|
+
scrollLeft: element.scrollLeft,
|
|
921
|
+
scrollTop: element.scrollTop
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
return {
|
|
925
|
+
scrollLeft: element.pageXOffset,
|
|
926
|
+
scrollTop: element.pageYOffset
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
930
|
+
let {
|
|
931
|
+
rect,
|
|
932
|
+
offsetParent,
|
|
933
|
+
strategy
|
|
934
|
+
} = _ref;
|
|
935
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
936
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
937
|
+
if (offsetParent === documentElement) {
|
|
938
|
+
return rect;
|
|
939
|
+
}
|
|
940
|
+
let scroll = {
|
|
941
|
+
scrollLeft: 0,
|
|
942
|
+
scrollTop: 0
|
|
943
|
+
};
|
|
944
|
+
let scale = createEmptyCoords(1);
|
|
945
|
+
const offsets = createEmptyCoords(0);
|
|
946
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
|
|
947
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
948
|
+
scroll = getNodeScroll(offsetParent);
|
|
949
|
+
}
|
|
950
|
+
if (isHTMLElement(offsetParent)) {
|
|
951
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
952
|
+
scale = getScale(offsetParent);
|
|
953
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
954
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
return {
|
|
958
|
+
width: rect.width * scale.x,
|
|
959
|
+
height: rect.height * scale.y,
|
|
960
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
961
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
function getWindowScrollBarX(element) {
|
|
965
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
966
|
+
}
|
|
967
|
+
function getDocumentRect(element) {
|
|
968
|
+
const html = getDocumentElement(element);
|
|
969
|
+
const scroll = getNodeScroll(element);
|
|
970
|
+
const body = element.ownerDocument.body;
|
|
971
|
+
const width = max2(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
972
|
+
const height = max2(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
973
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
974
|
+
const y = -scroll.scrollTop;
|
|
975
|
+
if (getComputedStyle$1(body).direction === "rtl") {
|
|
976
|
+
x += max2(html.clientWidth, body.clientWidth) - width;
|
|
977
|
+
}
|
|
978
|
+
return {
|
|
979
|
+
width,
|
|
980
|
+
height,
|
|
981
|
+
x,
|
|
982
|
+
y
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
function getParentNode(node) {
|
|
986
|
+
if (getNodeName(node) === "html") {
|
|
987
|
+
return node;
|
|
988
|
+
}
|
|
989
|
+
const result = (
|
|
990
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
991
|
+
node.assignedSlot || // DOM Element detected.
|
|
992
|
+
node.parentNode || // ShadowRoot detected.
|
|
993
|
+
isShadowRoot(node) && node.host || // Fallback.
|
|
994
|
+
getDocumentElement(node)
|
|
995
|
+
);
|
|
996
|
+
return isShadowRoot(result) ? result.host : result;
|
|
997
|
+
}
|
|
998
|
+
function getNearestOverflowAncestor(node) {
|
|
999
|
+
const parentNode = getParentNode(node);
|
|
1000
|
+
if (isLastTraversableNode(parentNode)) {
|
|
1001
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
1002
|
+
}
|
|
1003
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
1004
|
+
return parentNode;
|
|
1005
|
+
}
|
|
1006
|
+
return getNearestOverflowAncestor(parentNode);
|
|
1007
|
+
}
|
|
1008
|
+
function getOverflowAncestors(node, list) {
|
|
1009
|
+
var _node$ownerDocument;
|
|
1010
|
+
if (list === void 0) {
|
|
1011
|
+
list = [];
|
|
1012
|
+
}
|
|
1013
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
1014
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
|
|
1015
|
+
const win = getWindow(scrollableAncestor);
|
|
1016
|
+
if (isBody) {
|
|
1017
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
|
|
1018
|
+
}
|
|
1019
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));
|
|
1020
|
+
}
|
|
1021
|
+
function getViewportRect(element, strategy) {
|
|
1022
|
+
const win = getWindow(element);
|
|
1023
|
+
const html = getDocumentElement(element);
|
|
1024
|
+
const visualViewport = win.visualViewport;
|
|
1025
|
+
let width = html.clientWidth;
|
|
1026
|
+
let height = html.clientHeight;
|
|
1027
|
+
let x = 0;
|
|
1028
|
+
let y = 0;
|
|
1029
|
+
if (visualViewport) {
|
|
1030
|
+
width = visualViewport.width;
|
|
1031
|
+
height = visualViewport.height;
|
|
1032
|
+
const visualViewportBased = isSafari();
|
|
1033
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
1034
|
+
x = visualViewport.offsetLeft;
|
|
1035
|
+
y = visualViewport.offsetTop;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
return {
|
|
1039
|
+
width,
|
|
1040
|
+
height,
|
|
1041
|
+
x,
|
|
1042
|
+
y
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
1046
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
1047
|
+
const top = clientRect.top + element.clientTop;
|
|
1048
|
+
const left = clientRect.left + element.clientLeft;
|
|
1049
|
+
const scale = isHTMLElement(element) ? getScale(element) : createEmptyCoords(1);
|
|
1050
|
+
const width = element.clientWidth * scale.x;
|
|
1051
|
+
const height = element.clientHeight * scale.y;
|
|
1052
|
+
const x = left * scale.x;
|
|
1053
|
+
const y = top * scale.y;
|
|
1054
|
+
return {
|
|
1055
|
+
width,
|
|
1056
|
+
height,
|
|
1057
|
+
x,
|
|
1058
|
+
y
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1062
|
+
let rect;
|
|
1063
|
+
if (clippingAncestor === "viewport") {
|
|
1064
|
+
rect = getViewportRect(element, strategy);
|
|
1065
|
+
} else if (clippingAncestor === "document") {
|
|
1066
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
1067
|
+
} else if (isElement(clippingAncestor)) {
|
|
1068
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1069
|
+
} else {
|
|
1070
|
+
const visualOffsets = getVisualOffsets(element);
|
|
1071
|
+
rect = {
|
|
1072
|
+
...clippingAncestor,
|
|
1073
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
1074
|
+
y: clippingAncestor.y - visualOffsets.y
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
return rectToClientRect(rect);
|
|
1078
|
+
}
|
|
1079
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
1080
|
+
const parentNode = getParentNode(element);
|
|
1081
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1082
|
+
return false;
|
|
1083
|
+
}
|
|
1084
|
+
return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1085
|
+
}
|
|
1086
|
+
function getClippingElementAncestors(element, cache) {
|
|
1087
|
+
const cachedResult = cache.get(element);
|
|
1088
|
+
if (cachedResult) {
|
|
1089
|
+
return cachedResult;
|
|
1090
|
+
}
|
|
1091
|
+
let result = getOverflowAncestors(element).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
1092
|
+
let currentContainingBlockComputedStyle = null;
|
|
1093
|
+
const elementIsFixed = getComputedStyle$1(element).position === "fixed";
|
|
1094
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1095
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1096
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
1097
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1098
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
1099
|
+
currentContainingBlockComputedStyle = null;
|
|
1100
|
+
}
|
|
1101
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1102
|
+
if (shouldDropCurrentNode) {
|
|
1103
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
1104
|
+
} else {
|
|
1105
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
1106
|
+
}
|
|
1107
|
+
currentNode = getParentNode(currentNode);
|
|
1108
|
+
}
|
|
1109
|
+
cache.set(element, result);
|
|
1110
|
+
return result;
|
|
1111
|
+
}
|
|
1112
|
+
function getClippingRect(_ref) {
|
|
1113
|
+
let {
|
|
1114
|
+
element,
|
|
1115
|
+
boundary,
|
|
1116
|
+
rootBoundary,
|
|
1117
|
+
strategy
|
|
1118
|
+
} = _ref;
|
|
1119
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1120
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1121
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
1122
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
1123
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
1124
|
+
accRect.top = max2(rect.top, accRect.top);
|
|
1125
|
+
accRect.right = min2(rect.right, accRect.right);
|
|
1126
|
+
accRect.bottom = min2(rect.bottom, accRect.bottom);
|
|
1127
|
+
accRect.left = max2(rect.left, accRect.left);
|
|
1128
|
+
return accRect;
|
|
1129
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
1130
|
+
return {
|
|
1131
|
+
width: clippingRect.right - clippingRect.left,
|
|
1132
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
1133
|
+
x: clippingRect.left,
|
|
1134
|
+
y: clippingRect.top
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
function getDimensions(element) {
|
|
1138
|
+
return getCssDimensions(element);
|
|
1139
|
+
}
|
|
1140
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
1141
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
|
|
1142
|
+
return null;
|
|
1143
|
+
}
|
|
1144
|
+
if (polyfill) {
|
|
1145
|
+
return polyfill(element);
|
|
1146
|
+
}
|
|
1147
|
+
return element.offsetParent;
|
|
1148
|
+
}
|
|
1149
|
+
function getContainingBlock(element) {
|
|
1150
|
+
let currentNode = getParentNode(element);
|
|
1151
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1152
|
+
if (isContainingBlock(currentNode)) {
|
|
1153
|
+
return currentNode;
|
|
1154
|
+
} else {
|
|
1155
|
+
currentNode = getParentNode(currentNode);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
return null;
|
|
1159
|
+
}
|
|
1160
|
+
function getOffsetParent(element, polyfill) {
|
|
1161
|
+
const window2 = getWindow(element);
|
|
1162
|
+
if (!isHTMLElement(element)) {
|
|
1163
|
+
return window2;
|
|
1164
|
+
}
|
|
1165
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1166
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
|
|
1167
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1168
|
+
}
|
|
1169
|
+
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
|
|
1170
|
+
return window2;
|
|
1171
|
+
}
|
|
1172
|
+
return offsetParent || getContainingBlock(element) || window2;
|
|
1173
|
+
}
|
|
1174
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1175
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1176
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
1177
|
+
const isFixed = strategy === "fixed";
|
|
1178
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1179
|
+
let scroll = {
|
|
1180
|
+
scrollLeft: 0,
|
|
1181
|
+
scrollTop: 0
|
|
1182
|
+
};
|
|
1183
|
+
const offsets = createEmptyCoords(0);
|
|
1184
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1185
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1186
|
+
scroll = getNodeScroll(offsetParent);
|
|
1187
|
+
}
|
|
1188
|
+
if (isHTMLElement(offsetParent)) {
|
|
1189
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1190
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1191
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1192
|
+
} else if (documentElement) {
|
|
1193
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
return {
|
|
1197
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
1198
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
|
1199
|
+
width: rect.width,
|
|
1200
|
+
height: rect.height
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
var platform = {
|
|
1204
|
+
getClippingRect,
|
|
1205
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1206
|
+
isElement,
|
|
1207
|
+
getDimensions,
|
|
1208
|
+
getOffsetParent,
|
|
1209
|
+
getDocumentElement,
|
|
1210
|
+
getScale,
|
|
1211
|
+
async getElementRects(_ref) {
|
|
1212
|
+
let {
|
|
1213
|
+
reference,
|
|
1214
|
+
floating,
|
|
1215
|
+
strategy
|
|
1216
|
+
} = _ref;
|
|
1217
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1218
|
+
const getDimensionsFn = this.getDimensions;
|
|
1219
|
+
return {
|
|
1220
|
+
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
|
|
1221
|
+
floating: {
|
|
1222
|
+
x: 0,
|
|
1223
|
+
y: 0,
|
|
1224
|
+
...await getDimensionsFn(floating)
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1227
|
+
},
|
|
1228
|
+
getClientRects: (element) => Array.from(element.getClientRects()),
|
|
1229
|
+
isRTL: (element) => getComputedStyle$1(element).direction === "rtl"
|
|
1230
|
+
};
|
|
1231
|
+
function observeMove(element, onMove) {
|
|
1232
|
+
let io = null;
|
|
1233
|
+
let timeoutId;
|
|
1234
|
+
const root = getDocumentElement(element);
|
|
1235
|
+
function cleanup() {
|
|
1236
|
+
clearTimeout(timeoutId);
|
|
1237
|
+
io && io.disconnect();
|
|
1238
|
+
io = null;
|
|
1239
|
+
}
|
|
1240
|
+
function refresh(skip, threshold) {
|
|
1241
|
+
if (skip === void 0) {
|
|
1242
|
+
skip = false;
|
|
1243
|
+
}
|
|
1244
|
+
if (threshold === void 0) {
|
|
1245
|
+
threshold = 1;
|
|
1246
|
+
}
|
|
1247
|
+
cleanup();
|
|
1248
|
+
const {
|
|
1249
|
+
left,
|
|
1250
|
+
top,
|
|
1251
|
+
width,
|
|
1252
|
+
height
|
|
1253
|
+
} = element.getBoundingClientRect();
|
|
1254
|
+
if (!skip) {
|
|
1255
|
+
onMove();
|
|
1256
|
+
}
|
|
1257
|
+
if (!width || !height) {
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
const insetTop = floor(top);
|
|
1261
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
1262
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
1263
|
+
const insetLeft = floor(left);
|
|
1264
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
1265
|
+
let isFirstUpdate = true;
|
|
1266
|
+
io = new IntersectionObserver((entries) => {
|
|
1267
|
+
const ratio = entries[0].intersectionRatio;
|
|
1268
|
+
if (ratio !== threshold) {
|
|
1269
|
+
if (!isFirstUpdate) {
|
|
1270
|
+
return refresh();
|
|
1271
|
+
}
|
|
1272
|
+
if (!ratio) {
|
|
1273
|
+
timeoutId = setTimeout(() => {
|
|
1274
|
+
refresh(false, 1e-7);
|
|
1275
|
+
}, 100);
|
|
1276
|
+
} else {
|
|
1277
|
+
refresh(false, ratio);
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
isFirstUpdate = false;
|
|
1281
|
+
}, {
|
|
1282
|
+
rootMargin,
|
|
1283
|
+
threshold: max2(0, min2(1, threshold)) || 1
|
|
1284
|
+
});
|
|
1285
|
+
io.observe(element);
|
|
1286
|
+
}
|
|
1287
|
+
refresh(true);
|
|
1288
|
+
return cleanup;
|
|
1289
|
+
}
|
|
1290
|
+
function autoUpdate(reference, floating, update, options) {
|
|
1291
|
+
if (options === void 0) {
|
|
1292
|
+
options = {};
|
|
1293
|
+
}
|
|
1294
|
+
const {
|
|
1295
|
+
ancestorScroll = true,
|
|
1296
|
+
ancestorResize = true,
|
|
1297
|
+
elementResize = true,
|
|
1298
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
1299
|
+
animationFrame = false
|
|
1300
|
+
} = options;
|
|
1301
|
+
const referenceEl = unwrapElement(reference);
|
|
1302
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
1303
|
+
ancestors.forEach((ancestor) => {
|
|
1304
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
1305
|
+
passive: true
|
|
1306
|
+
});
|
|
1307
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
1308
|
+
});
|
|
1309
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
1310
|
+
let resizeObserver = null;
|
|
1311
|
+
if (elementResize) {
|
|
1312
|
+
resizeObserver = new ResizeObserver(update);
|
|
1313
|
+
if (referenceEl && !animationFrame) {
|
|
1314
|
+
resizeObserver.observe(referenceEl);
|
|
1315
|
+
}
|
|
1316
|
+
resizeObserver.observe(floating);
|
|
1317
|
+
}
|
|
1318
|
+
let frameId;
|
|
1319
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
1320
|
+
if (animationFrame) {
|
|
1321
|
+
frameLoop();
|
|
1322
|
+
}
|
|
1323
|
+
function frameLoop() {
|
|
1324
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
1325
|
+
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
1326
|
+
update();
|
|
1327
|
+
}
|
|
1328
|
+
prevRefRect = nextRefRect;
|
|
1329
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
1330
|
+
}
|
|
1331
|
+
update();
|
|
1332
|
+
return () => {
|
|
1333
|
+
ancestors.forEach((ancestor) => {
|
|
1334
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
1335
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
1336
|
+
});
|
|
1337
|
+
cleanupIo && cleanupIo();
|
|
1338
|
+
resizeObserver && resizeObserver.disconnect();
|
|
1339
|
+
resizeObserver = null;
|
|
1340
|
+
if (animationFrame) {
|
|
1341
|
+
cancelAnimationFrame(frameId);
|
|
1342
|
+
}
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
var computePosition2 = (reference, floating, options) => {
|
|
1346
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1347
|
+
const mergedOptions = {
|
|
1348
|
+
platform,
|
|
1349
|
+
...options
|
|
1350
|
+
};
|
|
1351
|
+
const platformWithCache = {
|
|
1352
|
+
...mergedOptions.platform,
|
|
1353
|
+
_c: cache
|
|
1354
|
+
};
|
|
1355
|
+
return computePosition(reference, floating, {
|
|
1356
|
+
...mergedOptions,
|
|
1357
|
+
platform: platformWithCache
|
|
1358
|
+
});
|
|
1359
|
+
};
|
|
1360
|
+
|
|
1361
|
+
// ../../node_modules/.pnpm/lit-html@3.0.0-pre.0/node_modules/lit-html/node/directive.js
|
|
1362
|
+
var t2 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
|
|
1363
|
+
var e2 = (t3) => (...e3) => ({ _$litDirective$: t3, values: e3 });
|
|
1364
|
+
var i = class {
|
|
1365
|
+
constructor(t3) {
|
|
1366
|
+
}
|
|
1367
|
+
get _$AU() {
|
|
1368
|
+
return this._$AM._$AU;
|
|
1369
|
+
}
|
|
1370
|
+
_$AT(t3, e3, i3) {
|
|
1371
|
+
this._$Ct = t3, this._$AM = e3, this._$Ci = i3;
|
|
1372
|
+
}
|
|
1373
|
+
_$AS(t3, e3) {
|
|
1374
|
+
return this.update(t3, e3);
|
|
1375
|
+
}
|
|
1376
|
+
update(t3, e3) {
|
|
1377
|
+
return this.render(...e3);
|
|
1378
|
+
}
|
|
1379
|
+
};
|
|
1380
|
+
|
|
1381
|
+
// ../../node_modules/.pnpm/lit-html@3.0.0-pre.0/node_modules/lit-html/node/directives/style-map.js
|
|
1382
|
+
var n2 = "important";
|
|
1383
|
+
var i2 = " !" + n2;
|
|
1384
|
+
var o = e2(class extends i {
|
|
1385
|
+
constructor(t3) {
|
|
1386
|
+
var _a;
|
|
1387
|
+
if (super(t3), t3.type !== t2.ATTRIBUTE || "style" !== t3.name || ((_a = t3.strings) == null ? void 0 : _a.length) > 2)
|
|
1388
|
+
throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
1389
|
+
}
|
|
1390
|
+
render(t3) {
|
|
1391
|
+
return Object.keys(t3).reduce((e3, r2) => {
|
|
1392
|
+
const s2 = t3[r2];
|
|
1393
|
+
return null == s2 ? e3 : e3 + `${r2 = r2.includes("-") ? r2 : r2.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s2};`;
|
|
1394
|
+
}, "");
|
|
1395
|
+
}
|
|
1396
|
+
update(e3, [r2]) {
|
|
1397
|
+
const { style: s2 } = e3.element;
|
|
1398
|
+
if (void 0 === this.ut)
|
|
1399
|
+
return this.ut = new Set(Object.keys(r2)), this.render(r2);
|
|
1400
|
+
for (const t3 of this.ut)
|
|
1401
|
+
null == r2[t3] && (this.ut.delete(t3), t3.includes("-") ? s2.removeProperty(t3) : s2[t3] = null);
|
|
1402
|
+
for (const t3 in r2) {
|
|
1403
|
+
const e4 = r2[t3];
|
|
1404
|
+
if (null != e4) {
|
|
1405
|
+
this.ut.add(t3);
|
|
1406
|
+
const r3 = "string" == typeof e4 && e4.endsWith(i2);
|
|
1407
|
+
t3.includes("-") || r3 ? s2.setProperty(t3, r3 ? e4.slice(0, -11) : e4, r3 ? n2 : "") : s2[t3] = e4;
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
return T;
|
|
1411
|
+
}
|
|
1412
|
+
});
|
|
1413
|
+
|
|
1414
|
+
// ../lit/src/utils/round-by-dpr.ts
|
|
1415
|
+
function roundByDPR(value) {
|
|
1416
|
+
const dpr = window.devicePixelRatio || 1;
|
|
1417
|
+
return Math.round(value * dpr) / dpr;
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
// ../lit/src/elements/popover/popover.ts
|
|
1421
|
+
var Popover = class extends s {
|
|
1422
|
+
/** @hidden */
|
|
1423
|
+
constructor() {
|
|
1424
|
+
super();
|
|
1425
|
+
this.active = false;
|
|
1426
|
+
this.autoUpdate = false;
|
|
1427
|
+
}
|
|
1428
|
+
/** @hidden */
|
|
1429
|
+
disconnectedCallback() {
|
|
1430
|
+
this.cleanup();
|
|
1431
|
+
}
|
|
1432
|
+
/** @hidden */
|
|
1433
|
+
updated(changed) {
|
|
1434
|
+
if (!changed.has("computed")) {
|
|
1435
|
+
this.start();
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
/** @hidden */
|
|
1439
|
+
start() {
|
|
1440
|
+
this.cleanup();
|
|
1441
|
+
const reference = this.reference;
|
|
1442
|
+
const floating = this.floating;
|
|
1443
|
+
if (!reference)
|
|
1444
|
+
return;
|
|
1445
|
+
if (this.autoUpdate) {
|
|
1446
|
+
this.cleanupAutoUpdate = autoUpdate(
|
|
1447
|
+
reference,
|
|
1448
|
+
floating,
|
|
1449
|
+
() => void this.compute(),
|
|
1450
|
+
this.autoUpdateOptions
|
|
1451
|
+
);
|
|
1452
|
+
} else {
|
|
1453
|
+
void this.compute();
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
/** @hidden */
|
|
1457
|
+
async compute() {
|
|
1458
|
+
const reference = this.reference;
|
|
1459
|
+
const floating = this.floating;
|
|
1460
|
+
if (!reference)
|
|
1461
|
+
return;
|
|
1462
|
+
const options = this.options;
|
|
1463
|
+
this.computed = await computePosition2(reference, floating, options);
|
|
1464
|
+
}
|
|
1465
|
+
/** @hidden */
|
|
1466
|
+
cleanup() {
|
|
1467
|
+
var _a;
|
|
1468
|
+
(_a = this.cleanupAutoUpdate) == null ? void 0 : _a.call(this);
|
|
1469
|
+
this.cleanupAutoUpdate = void 0;
|
|
1470
|
+
}
|
|
1471
|
+
/** @hidden */
|
|
1472
|
+
render() {
|
|
1473
|
+
var _a;
|
|
1474
|
+
const { x, y, strategy } = (_a = this.computed) != null ? _a : {
|
|
1475
|
+
x: 0,
|
|
1476
|
+
y: 0,
|
|
1477
|
+
strategy: "absolute"
|
|
1478
|
+
};
|
|
1479
|
+
const style = {
|
|
1480
|
+
top: "0",
|
|
1481
|
+
left: "0",
|
|
1482
|
+
position: strategy,
|
|
1483
|
+
transform: `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`,
|
|
1484
|
+
display: this.active ? void 0 : "none"
|
|
1485
|
+
};
|
|
1486
|
+
return b`
|
|
1487
|
+
<div class="floating" style=${o(style)}>
|
|
1488
|
+
<slot></slot>
|
|
1489
|
+
</div>
|
|
1490
|
+
`;
|
|
1491
|
+
}
|
|
1492
|
+
};
|
|
1493
|
+
/** @hidden */
|
|
1494
|
+
Popover.styles = blockComponentStyles;
|
|
1495
|
+
__decorateClass([
|
|
1496
|
+
n({ type: Boolean, reflect: true })
|
|
1497
|
+
], Popover.prototype, "active", 2);
|
|
1498
|
+
__decorateClass([
|
|
1499
|
+
r(".floating")
|
|
1500
|
+
], Popover.prototype, "floating", 2);
|
|
1501
|
+
__decorateClass([
|
|
1502
|
+
n()
|
|
1503
|
+
], Popover.prototype, "reference", 2);
|
|
1504
|
+
__decorateClass([
|
|
1505
|
+
n()
|
|
1506
|
+
], Popover.prototype, "options", 2);
|
|
1507
|
+
__decorateClass([
|
|
1508
|
+
n({
|
|
1509
|
+
type: Boolean,
|
|
1510
|
+
reflect: true
|
|
1511
|
+
})
|
|
1512
|
+
], Popover.prototype, "autoUpdate", 2);
|
|
1513
|
+
__decorateClass([
|
|
1514
|
+
n({ type: Object })
|
|
1515
|
+
], Popover.prototype, "autoUpdateOptions", 2);
|
|
1516
|
+
__decorateClass([
|
|
1517
|
+
t()
|
|
1518
|
+
], Popover.prototype, "computed", 2);
|
|
1519
|
+
Popover = __decorateClass([
|
|
1520
|
+
e("prosekit-popover")
|
|
1521
|
+
], Popover);
|
|
1522
|
+
|
|
1523
|
+
export {
|
|
1524
|
+
flip,
|
|
1525
|
+
inline,
|
|
1526
|
+
offset,
|
|
1527
|
+
shift,
|
|
1528
|
+
size,
|
|
1529
|
+
Popover
|
|
1530
|
+
};
|
|
1531
|
+
/*! Bundled license information:
|
|
1532
|
+
|
|
1533
|
+
lit-html/node/directive.js:
|
|
1534
|
+
(**
|
|
1535
|
+
* @license
|
|
1536
|
+
* Copyright 2017 Google LLC
|
|
1537
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1538
|
+
*)
|
|
1539
|
+
|
|
1540
|
+
lit-html/node/directives/style-map.js:
|
|
1541
|
+
(**
|
|
1542
|
+
* @license
|
|
1543
|
+
* Copyright 2018 Google LLC
|
|
1544
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1545
|
+
*)
|
|
1546
|
+
*/
|