gitxp 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.output/nitro.json +17 -0
  2. package/.output/public/assets/index-BGHvBNtP.js +11 -0
  3. package/.output/public/assets/routes-DuE8S6pX.js +60 -0
  4. package/.output/public/assets/styles-D5xbQNYu.css +1 -0
  5. package/.output/server/_chunks/ssr-renderer.mjs +26 -0
  6. package/.output/server/_libs/@floating-ui/core+[...].mjs +671 -0
  7. package/.output/server/_libs/@floating-ui/dom+[...].mjs +649 -0
  8. package/.output/server/_libs/@floating-ui/react-dom+[...].mjs +856 -0
  9. package/.output/server/_libs/@radix-ui/react-arrow+[...].mjs +258 -0
  10. package/.output/server/_libs/@radix-ui/react-dialog+[...].mjs +1862 -0
  11. package/.output/server/_libs/@radix-ui/react-popper+[...].mjs +320 -0
  12. package/.output/server/_libs/@radix-ui/react-tooltip+[...].mjs +534 -0
  13. package/.output/server/_libs/@tanstack/db+[...].mjs +14680 -0
  14. package/.output/server/_libs/@tanstack/react-router+[...].mjs +14563 -0
  15. package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +126 -0
  16. package/.output/server/_libs/@tanstack/router-core+[...].mjs +3636 -0
  17. package/.output/server/_libs/class-variance-authority+clsx.mjs +69 -0
  18. package/.output/server/_libs/cmdk.mjs +504 -0
  19. package/.output/server/_libs/h3+rou3+srvx.mjs +1361 -0
  20. package/.output/server/_libs/h3-v2.mjs +285 -0
  21. package/.output/server/_libs/lucide-react.mjs +158 -0
  22. package/.output/server/_libs/radix-ui__primitive.mjs +44 -0
  23. package/.output/server/_libs/radix-ui__react-context.mjs +108 -0
  24. package/.output/server/_libs/tailwind-merge.mjs +3380 -0
  25. package/.output/server/_libs/tanstack__history.mjs +384 -0
  26. package/.output/server/_libs/tanstack__query-core.mjs +2225 -0
  27. package/.output/server/_libs/tanstack__react-db.mjs +242 -0
  28. package/.output/server/_libs/tanstack__react-query.mjs +140 -0
  29. package/.output/server/_libs/ufo.mjs +64 -0
  30. package/.output/server/_runtime.mjs +35 -0
  31. package/.output/server/_ssr/empty-plugin-adapters-D9UWiqvJ.mjs +5 -0
  32. package/.output/server/_ssr/events-BNrmOvgU.mjs +13 -0
  33. package/.output/server/_ssr/notifications-DUoENv6E.mjs +514 -0
  34. package/.output/server/_ssr/router-DsUHD4bT.mjs +179 -0
  35. package/.output/server/_ssr/routes-DIFfr242.mjs +982 -0
  36. package/.output/server/_ssr/ssr.mjs +1854 -0
  37. package/.output/server/_ssr/start-5Z2QO8AU.mjs +4 -0
  38. package/.output/server/_tanstack-start-manifest_v-CrD0YpZr.mjs +20 -0
  39. package/.output/server/index.mjs +310 -0
  40. package/.output/server/node_modules/tslib/modules/index.js +70 -0
  41. package/.output/server/node_modules/tslib/modules/package.json +3 -0
  42. package/.output/server/node_modules/tslib/package.json +47 -0
  43. package/.output/server/node_modules/tslib/tslib.js +484 -0
  44. package/.output/server/package.json +9 -0
  45. package/LICENSE +21 -0
  46. package/README.md +325 -0
  47. package/bin/gitxp.js +85 -0
  48. package/package.json +92 -0
@@ -0,0 +1,671 @@
1
+ //#region node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
2
+ /**
3
+ * Custom positioning reference element.
4
+ * @see https://floating-ui.com/docs/virtual-elements
5
+ */
6
+ var sides = [
7
+ "top",
8
+ "right",
9
+ "bottom",
10
+ "left"
11
+ ];
12
+ var min = Math.min;
13
+ var max = Math.max;
14
+ var round = Math.round;
15
+ var floor = Math.floor;
16
+ var createCoords = (v) => ({
17
+ x: v,
18
+ y: v
19
+ });
20
+ var oppositeSideMap = {
21
+ left: "right",
22
+ right: "left",
23
+ bottom: "top",
24
+ top: "bottom"
25
+ };
26
+ function clamp(start, value, end) {
27
+ return max(start, min(value, end));
28
+ }
29
+ function evaluate(value, param) {
30
+ return typeof value === "function" ? value(param) : value;
31
+ }
32
+ function getSide(placement) {
33
+ return placement.split("-")[0];
34
+ }
35
+ function getAlignment(placement) {
36
+ return placement.split("-")[1];
37
+ }
38
+ function getOppositeAxis(axis) {
39
+ return axis === "x" ? "y" : "x";
40
+ }
41
+ function getAxisLength(axis) {
42
+ return axis === "y" ? "height" : "width";
43
+ }
44
+ function getSideAxis(placement) {
45
+ const firstChar = placement[0];
46
+ return firstChar === "t" || firstChar === "b" ? "y" : "x";
47
+ }
48
+ function getAlignmentAxis(placement) {
49
+ return getOppositeAxis(getSideAxis(placement));
50
+ }
51
+ function getAlignmentSides(placement, rects, rtl) {
52
+ if (rtl === void 0) rtl = false;
53
+ const alignment = getAlignment(placement);
54
+ const alignmentAxis = getAlignmentAxis(placement);
55
+ const length = getAxisLength(alignmentAxis);
56
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
57
+ if (rects.reference[length] > rects.floating[length]) mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
58
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
59
+ }
60
+ function getExpandedPlacements(placement) {
61
+ const oppositePlacement = getOppositePlacement(placement);
62
+ return [
63
+ getOppositeAlignmentPlacement(placement),
64
+ oppositePlacement,
65
+ getOppositeAlignmentPlacement(oppositePlacement)
66
+ ];
67
+ }
68
+ function getOppositeAlignmentPlacement(placement) {
69
+ return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
70
+ }
71
+ var lrPlacement = ["left", "right"];
72
+ var rlPlacement = ["right", "left"];
73
+ var tbPlacement = ["top", "bottom"];
74
+ var btPlacement = ["bottom", "top"];
75
+ function getSideList(side, isStart, rtl) {
76
+ switch (side) {
77
+ case "top":
78
+ case "bottom":
79
+ if (rtl) return isStart ? rlPlacement : lrPlacement;
80
+ return isStart ? lrPlacement : rlPlacement;
81
+ case "left":
82
+ case "right": return isStart ? tbPlacement : btPlacement;
83
+ default: return [];
84
+ }
85
+ }
86
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
87
+ const alignment = getAlignment(placement);
88
+ let list = getSideList(getSide(placement), direction === "start", rtl);
89
+ if (alignment) {
90
+ list = list.map((side) => side + "-" + alignment);
91
+ if (flipAlignment) list = list.concat(list.map(getOppositeAlignmentPlacement));
92
+ }
93
+ return list;
94
+ }
95
+ function getOppositePlacement(placement) {
96
+ const side = getSide(placement);
97
+ return oppositeSideMap[side] + placement.slice(side.length);
98
+ }
99
+ function expandPaddingObject(padding) {
100
+ var _padding$top, _padding$right, _padding$bottom, _padding$left;
101
+ return {
102
+ top: (_padding$top = padding.top) != null ? _padding$top : 0,
103
+ right: (_padding$right = padding.right) != null ? _padding$right : 0,
104
+ bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
105
+ left: (_padding$left = padding.left) != null ? _padding$left : 0
106
+ };
107
+ }
108
+ function getPaddingObject(padding) {
109
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
110
+ top: padding,
111
+ right: padding,
112
+ bottom: padding,
113
+ left: padding
114
+ };
115
+ }
116
+ function rectToClientRect(rect) {
117
+ const { x, y, width, height } = rect;
118
+ return {
119
+ width,
120
+ height,
121
+ top: y,
122
+ left: x,
123
+ right: x + width,
124
+ bottom: y + height,
125
+ x,
126
+ y
127
+ };
128
+ }
129
+ //#endregion
130
+ //#region node_modules/@floating-ui/core/dist/floating-ui.core.mjs
131
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
132
+ let { reference, floating } = _ref;
133
+ const sideAxis = getSideAxis(placement);
134
+ const alignmentAxis = getAlignmentAxis(placement);
135
+ const alignLength = getAxisLength(alignmentAxis);
136
+ const side = getSide(placement);
137
+ const isVertical = sideAxis === "y";
138
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
139
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
140
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
141
+ let coords;
142
+ switch (side) {
143
+ case "top":
144
+ coords = {
145
+ x: commonX,
146
+ y: reference.y - floating.height
147
+ };
148
+ break;
149
+ case "bottom":
150
+ coords = {
151
+ x: commonX,
152
+ y: reference.y + reference.height
153
+ };
154
+ break;
155
+ case "right":
156
+ coords = {
157
+ x: reference.x + reference.width,
158
+ y: commonY
159
+ };
160
+ break;
161
+ case "left":
162
+ coords = {
163
+ x: reference.x - floating.width,
164
+ y: commonY
165
+ };
166
+ break;
167
+ default: coords = {
168
+ x: reference.x,
169
+ y: reference.y
170
+ };
171
+ }
172
+ const alignment = getAlignment(placement);
173
+ if (alignment) coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
174
+ return coords;
175
+ }
176
+ /**
177
+ * Resolves with an object of overflow side offsets that determine how much the
178
+ * element is overflowing a given clipping boundary on each side.
179
+ * - positive = overflowing the boundary by that number of pixels
180
+ * - negative = how many pixels left before it will overflow
181
+ * - 0 = lies flush with the boundary
182
+ * @see https://floating-ui.com/docs/detectOverflow
183
+ */
184
+ async function detectOverflow(state, options) {
185
+ var _await$platform$isEle;
186
+ if (options === void 0) options = {};
187
+ const { x, y, platform, rects, elements, strategy } = state;
188
+ const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate(options, state);
189
+ const paddingObject = getPaddingObject(padding);
190
+ const element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext];
191
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
192
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)),
193
+ boundary,
194
+ rootBoundary,
195
+ strategy
196
+ }));
197
+ const rect = elementContext === "floating" ? {
198
+ x,
199
+ y,
200
+ width: rects.floating.width,
201
+ height: rects.floating.height
202
+ } : rects.reference;
203
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
204
+ const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) && await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
205
+ x: 1,
206
+ y: 1
207
+ };
208
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
209
+ elements,
210
+ rect,
211
+ offsetParent,
212
+ strategy
213
+ }) : rect);
214
+ return {
215
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
216
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
217
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
218
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
219
+ };
220
+ }
221
+ var MAX_RESET_COUNT = 50;
222
+ /**
223
+ * Computes the `x` and `y` coordinates that will place the floating element
224
+ * next to a given reference element.
225
+ *
226
+ * This export does not have any `platform` interface logic. You will need to
227
+ * write one for the platform you are using Floating UI with.
228
+ */
229
+ var computePosition = async (reference, floating, config) => {
230
+ const { placement = "bottom", strategy = "absolute", middleware = [], platform } = config;
231
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
232
+ ...platform,
233
+ detectOverflow
234
+ };
235
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
236
+ let rects = await platform.getElementRects({
237
+ reference,
238
+ floating,
239
+ strategy
240
+ });
241
+ let { x, y } = computeCoordsFromPlacement(rects, placement, rtl);
242
+ let statefulPlacement = placement;
243
+ let resetCount = 0;
244
+ const middlewareData = {};
245
+ for (let i = 0; i < middleware.length; i++) {
246
+ const currentMiddleware = middleware[i];
247
+ if (!currentMiddleware) continue;
248
+ const { name, fn } = currentMiddleware;
249
+ const { x: nextX, y: nextY, data, reset } = await fn({
250
+ x,
251
+ y,
252
+ initialPlacement: placement,
253
+ placement: statefulPlacement,
254
+ strategy,
255
+ middlewareData,
256
+ rects,
257
+ platform: platformWithDetectOverflow,
258
+ elements: {
259
+ reference,
260
+ floating
261
+ }
262
+ });
263
+ x = nextX != null ? nextX : x;
264
+ y = nextY != null ? nextY : y;
265
+ middlewareData[name] = {
266
+ ...middlewareData[name],
267
+ ...data
268
+ };
269
+ if (reset && resetCount < MAX_RESET_COUNT) {
270
+ resetCount++;
271
+ if (typeof reset === "object") {
272
+ if (reset.placement) statefulPlacement = reset.placement;
273
+ if (reset.rects) rects = reset.rects === true ? await platform.getElementRects({
274
+ reference,
275
+ floating,
276
+ strategy
277
+ }) : reset.rects;
278
+ ({x, y} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
279
+ }
280
+ i = -1;
281
+ }
282
+ }
283
+ return {
284
+ x,
285
+ y,
286
+ placement: statefulPlacement,
287
+ strategy,
288
+ middlewareData
289
+ };
290
+ };
291
+ /**
292
+ * Provides data to position an inner element of the floating element so that it
293
+ * appears centered to the reference element.
294
+ * @see https://floating-ui.com/docs/arrow
295
+ */
296
+ var arrow = (options) => ({
297
+ name: "arrow",
298
+ options,
299
+ async fn(state) {
300
+ const { x, y, placement, rects, platform, elements, middlewareData } = state;
301
+ const { element, padding = 0 } = evaluate(options, state) || {};
302
+ if (element == null) return {};
303
+ const paddingObject = getPaddingObject(padding);
304
+ const coords = {
305
+ x,
306
+ y
307
+ };
308
+ const axis = getAlignmentAxis(placement);
309
+ const length = getAxisLength(axis);
310
+ const arrowDimensions = await platform.getDimensions(element);
311
+ const isYAxis = axis === "y";
312
+ const minProp = isYAxis ? "top" : "left";
313
+ const maxProp = isYAxis ? "bottom" : "right";
314
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
315
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
316
+ const startDiff = coords[axis] - rects.reference[axis];
317
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
318
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
319
+ if (!clientSize || !await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent))) clientSize = elements.floating[clientProp] || rects.floating[length];
320
+ const centerToReference = endDiff / 2 - startDiff / 2;
321
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
322
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
323
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
324
+ const max = clientSize - arrowDimensions[length] - maxPadding;
325
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
326
+ const offset = clamp(minPadding, center, max);
327
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
328
+ const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0;
329
+ return {
330
+ [axis]: coords[axis] + alignmentOffset,
331
+ data: {
332
+ [axis]: offset,
333
+ centerOffset: center - offset - alignmentOffset,
334
+ ...shouldAddOffset && { alignmentOffset }
335
+ },
336
+ reset: shouldAddOffset
337
+ };
338
+ }
339
+ });
340
+ /**
341
+ * Optimizes the visibility of the floating element by flipping the `placement`
342
+ * in order to keep it in view when the preferred placement(s) will overflow the
343
+ * clipping boundary. Alternative to `autoPlacement`.
344
+ * @see https://floating-ui.com/docs/flip
345
+ */
346
+ var flip = function(options) {
347
+ if (options === void 0) options = {};
348
+ return {
349
+ name: "flip",
350
+ options,
351
+ async fn(state) {
352
+ var _middlewareData$arrow, _middlewareData$flip;
353
+ const { placement, middlewareData, rects, initialPlacement, platform, elements } = state;
354
+ const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = evaluate(options, state);
355
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
356
+ const side = getSide(placement);
357
+ const initialSideAxis = getSideAxis(initialPlacement);
358
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
359
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
360
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
361
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
362
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
363
+ const placements = [initialPlacement, ...fallbackPlacements];
364
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
365
+ const overflows = [];
366
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
367
+ if (checkMainAxis) overflows.push(overflow[side]);
368
+ if (checkCrossAxis) {
369
+ const sides = getAlignmentSides(placement, rects, rtl);
370
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
371
+ }
372
+ overflowsData = [...overflowsData, {
373
+ placement,
374
+ overflows
375
+ }];
376
+ if (!overflows.every((side) => side <= 0)) {
377
+ var _middlewareData$flip2, _overflowsData$filter;
378
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
379
+ const nextPlacement = placements[nextIndex];
380
+ if (nextPlacement) {
381
+ if (!(checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false) || overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) return {
382
+ data: {
383
+ index: nextIndex,
384
+ overflows: overflowsData
385
+ },
386
+ reset: { placement: nextPlacement }
387
+ };
388
+ }
389
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
390
+ if (!resetPlacement) switch (fallbackStrategy) {
391
+ case "bestFit": {
392
+ var _overflowsData$filter2;
393
+ const placement = (_overflowsData$filter2 = overflowsData.filter((d) => {
394
+ if (hasFallbackAxisSideDirection) {
395
+ const currentSideAxis = getSideAxis(d.placement);
396
+ return currentSideAxis === initialSideAxis || currentSideAxis === "y";
397
+ }
398
+ return true;
399
+ }).map((d) => [d.placement, d.overflows.filter((overflow) => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
400
+ if (placement) resetPlacement = placement;
401
+ break;
402
+ }
403
+ case "initialPlacement": resetPlacement = initialPlacement;
404
+ }
405
+ if (placement !== resetPlacement) return { reset: { placement: resetPlacement } };
406
+ }
407
+ return {};
408
+ }
409
+ };
410
+ };
411
+ function getSideOffsets(overflow, rect) {
412
+ return {
413
+ top: overflow.top - rect.height,
414
+ right: overflow.right - rect.width,
415
+ bottom: overflow.bottom - rect.height,
416
+ left: overflow.left - rect.width
417
+ };
418
+ }
419
+ function isAnySideFullyClipped(overflow) {
420
+ return sides.some((side) => overflow[side] >= 0);
421
+ }
422
+ /**
423
+ * Provides data to hide the floating element in applicable situations, such as
424
+ * when it is not in the same clipping context as the reference element.
425
+ * @see https://floating-ui.com/docs/hide
426
+ */
427
+ var hide = function(options) {
428
+ if (options === void 0) options = {};
429
+ return {
430
+ name: "hide",
431
+ options,
432
+ async fn(state) {
433
+ const { rects, platform } = state;
434
+ const { strategy = "referenceHidden", ...detectOverflowOptions } = evaluate(options, state);
435
+ switch (strategy) {
436
+ case "referenceHidden": {
437
+ const offsets = getSideOffsets(await platform.detectOverflow(state, {
438
+ ...detectOverflowOptions,
439
+ elementContext: "reference"
440
+ }), rects.reference);
441
+ return { data: {
442
+ referenceHiddenOffsets: offsets,
443
+ referenceHidden: isAnySideFullyClipped(offsets)
444
+ } };
445
+ }
446
+ case "escaped": {
447
+ const offsets = getSideOffsets(await platform.detectOverflow(state, {
448
+ ...detectOverflowOptions,
449
+ altBoundary: true
450
+ }), rects.floating);
451
+ return { data: {
452
+ escapedOffsets: offsets,
453
+ escaped: isAnySideFullyClipped(offsets)
454
+ } };
455
+ }
456
+ default: return {};
457
+ }
458
+ }
459
+ };
460
+ };
461
+ var originSides = /*#__PURE__*/ new Set(["left", "top"]);
462
+ async function convertValueToCoords(state, options) {
463
+ const { placement, platform, elements } = state;
464
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
465
+ const side = getSide(placement);
466
+ const alignment = getAlignment(placement);
467
+ const isVertical = getSideAxis(placement) === "y";
468
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
469
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
470
+ const rawValue = evaluate(options, state);
471
+ let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === "number" ? {
472
+ mainAxis: rawValue,
473
+ crossAxis: 0,
474
+ alignmentAxis: null
475
+ } : {
476
+ mainAxis: rawValue.mainAxis || 0,
477
+ crossAxis: rawValue.crossAxis || 0,
478
+ alignmentAxis: rawValue.alignmentAxis
479
+ };
480
+ if (alignment && typeof alignmentAxis === "number") crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
481
+ return isVertical ? {
482
+ x: crossAxis * crossAxisMulti,
483
+ y: mainAxis * mainAxisMulti
484
+ } : {
485
+ x: mainAxis * mainAxisMulti,
486
+ y: crossAxis * crossAxisMulti
487
+ };
488
+ }
489
+ /**
490
+ * Modifies the placement by translating the floating element along the
491
+ * specified axes.
492
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
493
+ * object may be passed.
494
+ * @see https://floating-ui.com/docs/offset
495
+ */
496
+ var offset = function(options) {
497
+ if (options === void 0) options = 0;
498
+ return {
499
+ name: "offset",
500
+ options,
501
+ async fn(state) {
502
+ var _middlewareData$offse, _middlewareData$arrow;
503
+ const { x, y, placement, middlewareData } = state;
504
+ const diffCoords = await convertValueToCoords(state, options);
505
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
506
+ return {
507
+ x: x + diffCoords.x,
508
+ y: y + diffCoords.y,
509
+ data: {
510
+ ...diffCoords,
511
+ placement
512
+ }
513
+ };
514
+ }
515
+ };
516
+ };
517
+ /**
518
+ * Optimizes the visibility of the floating element by shifting it in order to
519
+ * keep it in view when it will overflow the clipping boundary.
520
+ * @see https://floating-ui.com/docs/shift
521
+ */
522
+ var shift = function(options) {
523
+ if (options === void 0) options = {};
524
+ return {
525
+ name: "shift",
526
+ options,
527
+ async fn(state) {
528
+ const { x, y, placement, platform } = state;
529
+ const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => {
530
+ let { x, y } = _ref;
531
+ return {
532
+ x,
533
+ y
534
+ };
535
+ } }, ...detectOverflowOptions } = evaluate(options, state);
536
+ const coords = {
537
+ x,
538
+ y
539
+ };
540
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
541
+ const crossAxis = getSideAxis(placement);
542
+ const mainAxis = getOppositeAxis(crossAxis);
543
+ let mainAxisCoord = coords[mainAxis];
544
+ let crossAxisCoord = coords[crossAxis];
545
+ const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
546
+ if (checkMainAxis) mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
547
+ if (checkCrossAxis) crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
548
+ const limitedCoords = limiter.fn({
549
+ ...state,
550
+ [mainAxis]: mainAxisCoord,
551
+ [crossAxis]: crossAxisCoord
552
+ });
553
+ return {
554
+ ...limitedCoords,
555
+ data: {
556
+ x: limitedCoords.x - x,
557
+ y: limitedCoords.y - y,
558
+ enabled: {
559
+ [mainAxis]: checkMainAxis,
560
+ [crossAxis]: checkCrossAxis
561
+ }
562
+ }
563
+ };
564
+ }
565
+ };
566
+ };
567
+ /**
568
+ * Built-in `limiter` that will stop `shift()` at a certain point.
569
+ */
570
+ var limitShift = function(options) {
571
+ if (options === void 0) options = {};
572
+ return {
573
+ options,
574
+ fn(state) {
575
+ var _rawOffset$mainAxis, _rawOffset$crossAxis;
576
+ const { x, y, placement, rects, middlewareData } = state;
577
+ const { offset = 0, mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true } = evaluate(options, state);
578
+ const coords = {
579
+ x,
580
+ y
581
+ };
582
+ const crossAxis = getSideAxis(placement);
583
+ const mainAxis = getOppositeAxis(crossAxis);
584
+ let mainAxisCoord = coords[mainAxis];
585
+ let crossAxisCoord = coords[crossAxis];
586
+ const rawOffset = evaluate(offset, state);
587
+ const computedOffset = typeof rawOffset === "number" ? {
588
+ mainAxis: rawOffset,
589
+ crossAxis: 0
590
+ } : {
591
+ mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,
592
+ crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0
593
+ };
594
+ if (checkMainAxis) {
595
+ const len = mainAxis === "y" ? "height" : "width";
596
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
597
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
598
+ if (mainAxisCoord < limitMin) mainAxisCoord = limitMin;
599
+ else if (mainAxisCoord > limitMax) mainAxisCoord = limitMax;
600
+ }
601
+ if (checkCrossAxis) {
602
+ var _middlewareData$offse, _middlewareData$offse2;
603
+ const len = mainAxis === "y" ? "width" : "height";
604
+ const isOriginSide = originSides.has(getSide(placement));
605
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
606
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
607
+ if (crossAxisCoord < limitMin) crossAxisCoord = limitMin;
608
+ else if (crossAxisCoord > limitMax) crossAxisCoord = limitMax;
609
+ }
610
+ return {
611
+ [mainAxis]: mainAxisCoord,
612
+ [crossAxis]: crossAxisCoord
613
+ };
614
+ }
615
+ };
616
+ };
617
+ /**
618
+ * Provides data that allows you to change the size of the floating element —
619
+ * for instance, prevent it from overflowing the clipping boundary or match the
620
+ * width of the reference element.
621
+ * @see https://floating-ui.com/docs/size
622
+ */
623
+ var size = function(options) {
624
+ if (options === void 0) options = {};
625
+ return {
626
+ name: "size",
627
+ options,
628
+ async fn(state) {
629
+ const { placement, rects, platform, elements } = state;
630
+ const { apply = () => {}, ...detectOverflowOptions } = evaluate(options, state);
631
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
632
+ const side = getSide(placement);
633
+ const alignment = getAlignment(placement);
634
+ const isYAxis = getSideAxis(placement) === "y";
635
+ const { width, height } = rects.floating;
636
+ let heightSide;
637
+ let widthSide;
638
+ if (side === "top" || side === "bottom") {
639
+ heightSide = side;
640
+ widthSide = alignment === (await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
641
+ } else {
642
+ widthSide = side;
643
+ heightSide = alignment === "end" ? "top" : "bottom";
644
+ }
645
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
646
+ const maximumClippingWidth = width - overflow.left - overflow.right;
647
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
648
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
649
+ const shiftData = state.middlewareData.shift;
650
+ const noShift = !shiftData;
651
+ let availableHeight = overflowAvailableHeight;
652
+ let availableWidth = overflowAvailableWidth;
653
+ if (shiftData != null && shiftData.enabled.x) availableWidth = maximumClippingWidth;
654
+ if (shiftData != null && shiftData.enabled.y) availableHeight = maximumClippingHeight;
655
+ if (noShift && !alignment) {
656
+ if (isYAxis) availableWidth = width - 2 * max(overflow.left, overflow.right);
657
+ else availableHeight = height - 2 * max(overflow.top, overflow.bottom);
658
+ }
659
+ await apply({
660
+ ...state,
661
+ availableWidth,
662
+ availableHeight
663
+ });
664
+ const nextDimensions = await platform.getDimensions(elements.floating);
665
+ if (width !== nextDimensions.width || height !== nextDimensions.height) return { reset: { rects: true } };
666
+ return {};
667
+ }
668
+ };
669
+ };
670
+ //#endregion
671
+ export { limitShift as a, size as c, max as d, min as f, hide as i, createCoords as l, round as m, computePosition as n, offset as o, rectToClientRect as p, flip as r, shift as s, arrow as t, floor as u };