/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "../../../node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js ***!
\**************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _memoize = _interopRequireDefault(__webpack_require__(/*! @emotion/memoize */ "../../../node_modules/@emotion/memoize/dist/memoize.browser.esm.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
var index = (0, _memoize.default)(function (prop) {
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
/* o */ && prop.charCodeAt(1) === 110
/* n */ && prop.charCodeAt(2) < 91;
}
/* Z+1 */);
var _default = index;
exports["default"] = _default;
/***/ }),
/***/ "../../../node_modules/@emotion/memoize/dist/memoize.browser.esm.js":
/*!**************************************************************************!*\
!*** ../../../node_modules/@emotion/memoize/dist/memoize.browser.esm.js ***!
\**************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
function memoize(fn) {
var cache = {};
return function (arg) {
if (cache[arg] === undefined) cache[arg] = fn(arg);
return cache[arg];
};
}
var _default = memoize;
exports["default"] = _default;
/***/ }),
/***/ "../../../node_modules/@floating-ui/core/dist/floating-ui.core.esm.js":
/*!****************************************************************************!*\
!*** ../../../node_modules/@floating-ui/core/dist/floating-ui.core.esm.js ***!
\****************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.computePosition = exports.autoPlacement = exports.arrow = void 0;
exports.detectOverflow = detectOverflow;
exports.offset = exports.limitShift = exports.inline = exports.hide = exports.flip = void 0;
exports.rectToClientRect = rectToClientRect;
exports.size = exports.shift = void 0;
function getAlignment(placement) {
return placement.split('-')[1];
}
function getLengthFromAxis(axis) {
return axis === 'y' ? 'height' : 'width';
}
function getSide(placement) {
return placement.split('-')[0];
}
function getMainAxisFromPlacement(placement) {
return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
}
function computeCoordsFromPlacement(_ref, placement, rtl) {
let {
reference,
floating
} = _ref;
const commonX = reference.x + reference.width / 2 - floating.width / 2;
const commonY = reference.y + reference.height / 2 - floating.height / 2;
const mainAxis = getMainAxisFromPlacement(placement);
const length = getLengthFromAxis(mainAxis);
const commonAlign = reference[length] / 2 - floating[length] / 2;
const side = getSide(placement);
const isVertical = mainAxis === 'x';
let coords;
switch (side) {
case 'top':
coords = {
x: commonX,
y: reference.y - floating.height
};
break;
case 'bottom':
coords = {
x: commonX,
y: reference.y + reference.height
};
break;
case 'right':
coords = {
x: reference.x + reference.width,
y: commonY
};
break;
case 'left':
coords = {
x: reference.x - floating.width,
y: commonY
};
break;
default:
coords = {
x: reference.x,
y: reference.y
};
}
switch (getAlignment(placement)) {
case 'start':
coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
break;
case 'end':
coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
break;
}
return coords;
}
/**
* Computes the `x` and `y` coordinates that will place the floating element
* next to a reference element when it is given a certain positioning strategy.
*
* This export does not have any `platform` interface logic. You will need to
* write one for the platform you are using Floating UI with.
*/
const computePosition = async (reference, floating, config) => {
const {
placement = 'bottom',
strategy = 'absolute',
middleware = [],
platform
} = config;
const validMiddleware = middleware.filter(Boolean);
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
let rects = await platform.getElementRects({
reference,
floating,
strategy
});
let {
x,
y
} = computeCoordsFromPlacement(rects, placement, rtl);
let statefulPlacement = placement;
let middlewareData = {};
let resetCount = 0;
for (let i = 0; i < validMiddleware.length; i++) {
const {
name,
fn
} = validMiddleware[i];
const {
x: nextX,
y: nextY,
data,
reset
} = await fn({
x,
y,
initialPlacement: placement,
placement: statefulPlacement,
strategy,
middlewareData,
rects,
platform,
elements: {
reference,
floating
}
});
x = nextX != null ? nextX : x;
y = nextY != null ? nextY : y;
middlewareData = {
...middlewareData,
[name]: {
...middlewareData[name],
...data
}
};
if (reset && resetCount <= 50) {
resetCount++;
if (typeof reset === 'object') {
if (reset.placement) {
statefulPlacement = reset.placement;
}
if (reset.rects) {
rects = reset.rects === true ? await platform.getElementRects({
reference,
floating,
strategy
}) : reset.rects;
}
({
x,
y
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
}
i = -1;
continue;
}
}
return {
x,
y,
placement: statefulPlacement,
strategy,
middlewareData
};
};
exports.computePosition = computePosition;
function evaluate(value, param) {
return typeof value === 'function' ? value(param) : value;
}
function expandPaddingObject(padding) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...padding
};
}
function getSideObjectFromPadding(padding) {
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
top: padding,
right: padding,
bottom: padding,
left: padding
};
}
function rectToClientRect(rect) {
return {
...rect,
top: rect.y,
left: rect.x,
right: rect.x + rect.width,
bottom: rect.y + rect.height
};
}
/**
* Resolves with an object of overflow side offsets that determine how much the
* element is overflowing a given clipping boundary on each side.
* - positive = overflowing the boundary by that number of pixels
* - negative = how many pixels left before it will overflow
* - 0 = lies flush with the boundary
* @see https://floating-ui.com/docs/detectOverflow
*/
async function detectOverflow(state, options) {
var _await$platform$isEle;
if (options === void 0) {
options = {};
}
const {
x,
y,
platform,
rects,
elements,
strategy
} = state;
const {
boundary = 'clippingAncestors',
rootBoundary = 'viewport',
elementContext = 'floating',
altBoundary = false,
padding = 0
} = evaluate(options, state);
const paddingObject = getSideObjectFromPadding(padding);
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
const element = elements[altBoundary ? altContext : elementContext];
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
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))),
boundary,
rootBoundary,
strategy
}));
const rect = elementContext === 'floating' ? {
...rects.floating,
x,
y
} : rects.reference;
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
};
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
rect,
offsetParent,
strategy
}) : rect);
return {
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
};
}
const min = Math.min;
const max = Math.max;
function within(min$1, value, max$1) {
return max(min$1, min(value, max$1));
}
/**
* Provides data to position an inner element of the floating element so that it
* appears centered to the reference element.
* @see https://floating-ui.com/docs/arrow
*/
const arrow = options => ({
name: 'arrow',
options,
async fn(state) {
const {
x,
y,
placement,
rects,
platform,
elements
} = state;
// Since `element` is required, we don't Partial<> the type.
const {
element,
padding = 0
} = evaluate(options, state) || {};
if (element == null) {
return {};
}
const paddingObject = getSideObjectFromPadding(padding);
const coords = {
x,
y
};
const axis = getMainAxisFromPlacement(placement);
const length = getLengthFromAxis(axis);
const arrowDimensions = await platform.getDimensions(element);
const isYAxis = axis === 'y';
const minProp = isYAxis ? 'top' : 'left';
const maxProp = isYAxis ? 'bottom' : 'right';
const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
const startDiff = coords[axis] - rects.reference[axis];
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
// DOM platform can return `window` as the `offsetParent`.
if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
clientSize = elements.floating[clientProp] || rects.floating[length];
}
const centerToReference = endDiff / 2 - startDiff / 2;
// If the padding is large enough that it causes the arrow to no longer be
// centered, modify the padding so that it is centered.
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
// Make sure the arrow doesn't overflow the floating element if the center
// point is outside the floating element's bounds.
const min$1 = minPadding;
const max = clientSize - arrowDimensions[length] - maxPadding;
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
const offset = within(min$1, center, max);
// If the reference is small enough that the arrow's padding causes it to
// to point to nothing for an aligned placement, adjust the offset of the
// floating element itself. This stops `shift()` from taking action, but can
// be worked around by calling it again after the `arrow()` if desired.
const shouldAddOffset = getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
const alignmentOffset = shouldAddOffset ? center < min$1 ? min$1 - center : max - center : 0;
return {
[axis]: coords[axis] - alignmentOffset,
data: {
[axis]: offset,
centerOffset: center - offset
}
};
}
});
exports.arrow = arrow;
const sides = ['top', 'right', 'bottom', 'left'];
const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
const oppositeSideMap = {
left: 'right',
right: 'left',
bottom: 'top',
top: 'bottom'
};
function getOppositePlacement(placement) {
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
}
function getAlignmentSides(placement, rects, rtl) {
if (rtl === void 0) {
rtl = false;
}
const alignment = getAlignment(placement);
const mainAxis = getMainAxisFromPlacement(placement);
const length = getLengthFromAxis(mainAxis);
let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
if (rects.reference[length] > rects.floating[length]) {
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
}
return {
main: mainAlignmentSide,
cross: getOppositePlacement(mainAlignmentSide)
};
}
const oppositeAlignmentMap = {
start: 'end',
end: 'start'
};
function getOppositeAlignmentPlacement(placement) {
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
}
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
return allowedPlacementsSortedByAlignment.filter(placement => {
if (alignment) {
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
}
return true;
});
}
/**
* Optimizes the visibility of the floating element by choosing the placement
* that has the most space available automatically, without needing to specify a
* preferred placement. Alternative to `flip`.
* @see https://floating-ui.com/docs/autoPlacement
*/
const autoPlacement = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'autoPlacement',
options,
async fn(state) {
var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
const {
rects,
middlewareData,
placement,
platform,
elements
} = state;
const {
crossAxis = false,
alignment,
allowedPlacements = allPlacements,
autoAlignment = true,
...detectOverflowOptions
} = evaluate(options, state);
const placements = alignment !== undefined || allowedPlacements === allPlacements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
const overflow = await detectOverflow(state, detectOverflowOptions);
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
const currentPlacement = placements[currentIndex];
if (currentPlacement == null) {
return {};
}
const {
main,
cross
} = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
// Make `computeCoords` start from the right place.
if (placement !== currentPlacement) {
return {
reset: {
placement: placements[0]
}
};
}
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main], overflow[cross]];
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
placement: currentPlacement,
overflows: currentOverflows
}];
const nextPlacement = placements[currentIndex + 1];
// There are more placements to check.
if (nextPlacement) {
return {
data: {
index: currentIndex + 1,
overflows: allOverflows
},
reset: {
placement: nextPlacement
}
};
}
const placementsSortedByMostSpace = allOverflows.map(d => {
const alignment = getAlignment(d.placement);
return [d.placement, alignment && crossAxis ?
// Check along the mainAxis and main crossAxis side.
d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
// Check only the mainAxis.
d.overflows[0], d.overflows];
}).sort((a, b) => a[1] - b[1]);
const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
// Aligned placements should not check their opposite crossAxis
// side.
getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
if (resetPlacement !== placement) {
return {
data: {
index: currentIndex + 1,
overflows: allOverflows
},
reset: {
placement: resetPlacement
}
};
}
return {};
}
};
};
exports.autoPlacement = autoPlacement;
function getExpandedPlacements(placement) {
const oppositePlacement = getOppositePlacement(placement);
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
}
function getSideList(side, isStart, rtl) {
const lr = ['left', 'right'];
const rl = ['right', 'left'];
const tb = ['top', 'bottom'];
const bt = ['bottom', 'top'];
switch (side) {
case 'top':
case 'bottom':
if (rtl) return isStart ? rl : lr;
return isStart ? lr : rl;
case 'left':
case 'right':
return isStart ? tb : bt;
default:
return [];
}
}
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
const alignment = getAlignment(placement);
let list = getSideList(getSide(placement), direction === 'start', rtl);
if (alignment) {
list = list.map(side => side + "-" + alignment);
if (flipAlignment) {
list = list.concat(list.map(getOppositeAlignmentPlacement));
}
}
return list;
}
/**
* Optimizes the visibility of the floating element by flipping the `placement`
* in order to keep it in view when the preferred placement(s) will overflow the
* clipping boundary. Alternative to `autoPlacement`.
* @see https://floating-ui.com/docs/flip
*/
const flip = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'flip',
options,
async fn(state) {
var _middlewareData$flip;
const {
placement,
middlewareData,
rects,
initialPlacement,
platform,
elements
} = state;
const {
mainAxis: checkMainAxis = true,
crossAxis: checkCrossAxis = true,
fallbackPlacements: specifiedFallbackPlacements,
fallbackStrategy = 'bestFit',
fallbackAxisSideDirection = 'none',
flipAlignment = true,
...detectOverflowOptions
} = evaluate(options, state);
const side = getSide(placement);
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
}
const placements = [initialPlacement, ...fallbackPlacements];
const overflow = await detectOverflow(state, detectOverflowOptions);
const overflows = [];
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
if (checkMainAxis) {
overflows.push(overflow[side]);
}
if (checkCrossAxis) {
const {
main,
cross
} = getAlignmentSides(placement, rects, rtl);
overflows.push(overflow[main], overflow[cross]);
}
overflowsData = [...overflowsData, {
placement,
overflows
}];
// One or more sides is overflowing.
if (!overflows.every(side => side <= 0)) {
var _middlewareData$flip2, _overflowsData$filter;
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
const nextPlacement = placements[nextIndex];
if (nextPlacement) {
// Try next placement and re-run the lifecycle.
return {
data: {
index: nextIndex,
overflows: overflowsData
},
reset: {
placement: nextPlacement
}
};
}
// First, find the candidates that fit on the mainAxis side of overflow,
// then find the placement that fits the best on the main crossAxis side.
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;
// Otherwise fallback.
if (!resetPlacement) {
switch (fallbackStrategy) {
case 'bestFit':
{
var _overflowsData$map$so;
const placement = (_overflowsData$map$so = overflowsData.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$map$so[0];
if (placement) {
resetPlacement = placement;
}
break;
}
case 'initialPlacement':
resetPlacement = initialPlacement;
break;
}
}
if (placement !== resetPlacement) {
return {
reset: {
placement: resetPlacement
}
};
}
}
return {};
}
};
};
exports.flip = flip;
function getSideOffsets(overflow, rect) {
return {
top: overflow.top - rect.height,
right: overflow.right - rect.width,
bottom: overflow.bottom - rect.height,
left: overflow.left - rect.width
};
}
function isAnySideFullyClipped(overflow) {
return sides.some(side => overflow[side] >= 0);
}
/**
* Provides data to hide the floating element in applicable situations, such as
* when it is not in the same clipping context as the reference element.
* @see https://floating-ui.com/docs/hide
*/
const hide = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'hide',
options,
async fn(state) {
const {
rects
} = state;
const {
strategy = 'referenceHidden',
...detectOverflowOptions
} = evaluate(options, state);
switch (strategy) {
case 'referenceHidden':
{
const overflow = await detectOverflow(state, {
...detectOverflowOptions,
elementContext: 'reference'
});
const offsets = getSideOffsets(overflow, rects.reference);
return {
data: {
referenceHiddenOffsets: offsets,
referenceHidden: isAnySideFullyClipped(offsets)
}
};
}
case 'escaped':
{
const overflow = await detectOverflow(state, {
...detectOverflowOptions,
altBoundary: true
});
const offsets = getSideOffsets(overflow, rects.floating);
return {
data: {
escapedOffsets: offsets,
escaped: isAnySideFullyClipped(offsets)
}
};
}
default:
{
return {};
}
}
}
};
};
exports.hide = hide;
function getBoundingRect(rects) {
const minX = min(...rects.map(rect => rect.left));
const minY = min(...rects.map(rect => rect.top));
const maxX = max(...rects.map(rect => rect.right));
const maxY = max(...rects.map(rect => rect.bottom));
return {
x: minX,
y: minY,
width: maxX - minX,
height: maxY - minY
};
}
function getRectsByLine(rects) {
const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
const groups = [];
let prevRect = null;
for (let i = 0; i < sortedRects.length; i++) {
const rect = sortedRects[i];
if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
groups.push([rect]);
} else {
groups[groups.length - 1].push(rect);
}
prevRect = rect;
}
return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
}
/**
* Provides improved positioning for inline reference elements that can span
* over multiple lines, such as hyperlinks or range selections.
* @see https://floating-ui.com/docs/inline
*/
const inline = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'inline',
options,
async fn(state) {
const {
placement,
elements,
rects,
platform,
strategy
} = state;
// A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
// ClientRect's bounds, despite the event listener being triggered. A
// padding of 2 seems to handle this issue.
const {
padding = 2,
x,
y
} = evaluate(options, state);
const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
const clientRects = getRectsByLine(nativeClientRects);
const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
const paddingObject = getSideObjectFromPadding(padding);
function getBoundingClientRect() {
// There are two rects and they are disjoined.
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
// Find the first rect in which the point is fully inside.
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;
}
// There are 2 or more connected rects.
if (clientRects.length >= 2) {
if (getMainAxisFromPlacement(placement) === 'x') {
const firstRect = clientRects[0];
const lastRect = clientRects[clientRects.length - 1];
const isTop = getSide(placement) === 'top';
const top = firstRect.top;
const bottom = lastRect.bottom;
const left = isTop ? firstRect.left : lastRect.left;
const right = isTop ? firstRect.right : lastRect.right;
const width = right - left;
const height = bottom - top;
return {
top,
bottom,
left,
right,
width,
height,
x: left,
y: top
};
}
const isLeftSide = getSide(placement) === 'left';
const maxRight = max(...clientRects.map(rect => rect.right));
const minLeft = min(...clientRects.map(rect => rect.left));
const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
const top = measureRects[0].top;
const bottom = measureRects[measureRects.length - 1].bottom;
const left = minLeft;
const right = maxRight;
const width = right - left;
const height = bottom - top;
return {
top,
bottom,
left,
right,
width,
height,
x: left,
y: top
};
}
return fallback;
}
const resetRects = await platform.getElementRects({
reference: {
getBoundingClientRect
},
floating: elements.floating,
strategy
});
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) {
return {
reset: {
rects: resetRects
}
};
}
return {};
}
};
};
exports.inline = inline;
async function convertValueToCoords(state, options) {
const {
placement,
platform,
elements
} = state;
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
const side = getSide(placement);
const alignment = getAlignment(placement);
const isVertical = getMainAxisFromPlacement(placement) === 'x';
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
const crossAxisMulti = rtl && isVertical ? -1 : 1;
const rawValue = evaluate(options, state);
// eslint-disable-next-line prefer-const
let {
mainAxis,
crossAxis,
alignmentAxis
} = typeof rawValue === 'number' ? {
mainAxis: rawValue,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: 0,
crossAxis: 0,
alignmentAxis: null,
...rawValue
};
if (alignment && typeof alignmentAxis === 'number') {
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
}
return isVertical ? {
x: crossAxis * crossAxisMulti,
y: mainAxis * mainAxisMulti
} : {
x: mainAxis * mainAxisMulti,
y: crossAxis * crossAxisMulti
};
}
/**
* Modifies the placement by translating the floating element along the
* specified axes.
* A number (shorthand for `mainAxis` or distance), or an axes configuration
* object may be passed.
* @see https://floating-ui.com/docs/offset
*/
const offset = function (options) {
if (options === void 0) {
options = 0;
}
return {
name: 'offset',
options,
async fn(state) {
const {
x,
y
} = state;
const diffCoords = await convertValueToCoords(state, options);
return {
x: x + diffCoords.x,
y: y + diffCoords.y,
data: diffCoords
};
}
};
};
exports.offset = offset;
function getCrossAxis(axis) {
return axis === 'x' ? 'y' : 'x';
}
/**
* Optimizes the visibility of the floating element by shifting it in order to
* keep it in view when it will overflow the clipping boundary.
* @see https://floating-ui.com/docs/shift
*/
const shift = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'shift',
options,
async fn(state) {
const {
x,
y,
placement
} = state;
const {
mainAxis: checkMainAxis = true,
crossAxis: checkCrossAxis = false,
limiter = {
fn: _ref => {
let {
x,
y
} = _ref;
return {
x,
y
};
}
},
...detectOverflowOptions
} = evaluate(options, state);
const coords = {
x,
y
};
const overflow = await detectOverflow(state, detectOverflowOptions);
const mainAxis = getMainAxisFromPlacement(getSide(placement));
const crossAxis = getCrossAxis(mainAxis);
let mainAxisCoord = coords[mainAxis];
let crossAxisCoord = coords[crossAxis];
if (checkMainAxis) {
const minSide = mainAxis === 'y' ? 'top' : 'left';
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
const min = mainAxisCoord + overflow[minSide];
const max = mainAxisCoord - overflow[maxSide];
mainAxisCoord = within(min, mainAxisCoord, max);
}
if (checkCrossAxis) {
const minSide = crossAxis === 'y' ? 'top' : 'left';
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
const min = crossAxisCoord + overflow[minSide];
const max = crossAxisCoord - overflow[maxSide];
crossAxisCoord = within(min, crossAxisCoord, max);
}
const limitedCoords = limiter.fn({
...state,
[mainAxis]: mainAxisCoord,
[crossAxis]: crossAxisCoord
});
return {
...limitedCoords,
data: {
x: limitedCoords.x - x,
y: limitedCoords.y - y
}
};
}
};
};
/**
* Built-in `limiter` that will stop `shift()` at a certain point.
*/
exports.shift = shift;
const limitShift = function (options) {
if (options === void 0) {
options = {};
}
return {
options,
fn(state) {
const {
x,
y,
placement,
rects,
middlewareData
} = state;
const {
offset = 0,
mainAxis: checkMainAxis = true,
crossAxis: checkCrossAxis = true
} = evaluate(options, state);
const coords = {
x,
y
};
const mainAxis = getMainAxisFromPlacement(placement);
const crossAxis = getCrossAxis(mainAxis);
let mainAxisCoord = coords[mainAxis];
let crossAxisCoord = coords[crossAxis];
const rawOffset = evaluate(offset, state);
const computedOffset = typeof rawOffset === 'number' ? {
mainAxis: rawOffset,
crossAxis: 0
} : {
mainAxis: 0,
crossAxis: 0,
...rawOffset
};
if (checkMainAxis) {
const len = mainAxis === 'y' ? 'height' : 'width';
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
if (mainAxisCoord < limitMin) {
mainAxisCoord = limitMin;
} else if (mainAxisCoord > limitMax) {
mainAxisCoord = limitMax;
}
}
if (checkCrossAxis) {
var _middlewareData$offse, _middlewareData$offse2;
const len = mainAxis === 'y' ? 'width' : 'height';
const isOriginSide = ['top', 'left'].includes(getSide(placement));
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);
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);
if (crossAxisCoord < limitMin) {
crossAxisCoord = limitMin;
} else if (crossAxisCoord > limitMax) {
crossAxisCoord = limitMax;
}
}
return {
[mainAxis]: mainAxisCoord,
[crossAxis]: crossAxisCoord
};
}
};
};
/**
* Provides data that allows you to change the size of the floating element —
* for instance, prevent it from overflowing the clipping boundary or match the
* width of the reference element.
* @see https://floating-ui.com/docs/size
*/
exports.limitShift = limitShift;
const size = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'size',
options,
async fn(state) {
const {
placement,
rects,
platform,
elements
} = state;
const {
apply = () => {},
...detectOverflowOptions
} = evaluate(options, state);
const overflow = await detectOverflow(state, detectOverflowOptions);
const side = getSide(placement);
const alignment = getAlignment(placement);
const axis = getMainAxisFromPlacement(placement);
const isXAxis = axis === 'x';
const {
width,
height
} = rects.floating;
let heightSide;
let widthSide;
if (side === 'top' || side === 'bottom') {
heightSide = side;
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
} else {
widthSide = side;
heightSide = alignment === 'end' ? 'top' : 'bottom';
}
const overflowAvailableHeight = height - overflow[heightSide];
const overflowAvailableWidth = width - overflow[widthSide];
const noShift = !state.middlewareData.shift;
let availableHeight = overflowAvailableHeight;
let availableWidth = overflowAvailableWidth;
if (isXAxis) {
const maximumClippingWidth = width - overflow.left - overflow.right;
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
} else {
const maximumClippingHeight = height - overflow.top - overflow.bottom;
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
}
if (noShift && !alignment) {
const xMin = max(overflow.left, 0);
const xMax = max(overflow.right, 0);
const yMin = max(overflow.top, 0);
const yMax = max(overflow.bottom, 0);
if (isXAxis) {
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
} else {
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
}
}
await apply({
...state,
availableWidth,
availableHeight
});
const nextDimensions = await platform.getDimensions(elements.floating);
if (width !== nextDimensions.width || height !== nextDimensions.height) {
return {
reset: {
rects: true
}
};
}
return {};
}
};
};
exports.size = size;
/***/ }),
/***/ "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js":
/*!**************************************************************************!*\
!*** ../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js ***!
\**************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "arrow", ({
enumerable: true,
get: function () {
return _core.arrow;
}
}));
Object.defineProperty(exports, "autoPlacement", ({
enumerable: true,
get: function () {
return _core.autoPlacement;
}
}));
exports.autoUpdate = autoUpdate;
exports.computePosition = void 0;
Object.defineProperty(exports, "detectOverflow", ({
enumerable: true,
get: function () {
return _core.detectOverflow;
}
}));
Object.defineProperty(exports, "flip", ({
enumerable: true,
get: function () {
return _core.flip;
}
}));
exports.getOverflowAncestors = getOverflowAncestors;
Object.defineProperty(exports, "hide", ({
enumerable: true,
get: function () {
return _core.hide;
}
}));
Object.defineProperty(exports, "inline", ({
enumerable: true,
get: function () {
return _core.inline;
}
}));
Object.defineProperty(exports, "limitShift", ({
enumerable: true,
get: function () {
return _core.limitShift;
}
}));
Object.defineProperty(exports, "offset", ({
enumerable: true,
get: function () {
return _core.offset;
}
}));
exports.platform = void 0;
Object.defineProperty(exports, "shift", ({
enumerable: true,
get: function () {
return _core.shift;
}
}));
Object.defineProperty(exports, "size", ({
enumerable: true,
get: function () {
return _core.size;
}
}));
var _core = __webpack_require__(/*! @floating-ui/core */ "../../../node_modules/@floating-ui/core/dist/floating-ui.core.esm.js");
function getWindow(node) {
var _node$ownerDocument;
return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
}
function getComputedStyle$1(element) {
return getWindow(element).getComputedStyle(element);
}
function isNode(value) {
return value instanceof getWindow(value).Node;
}
function getNodeName(node) {
return isNode(node) ? (node.nodeName || '').toLowerCase() : '';
}
function isHTMLElement(value) {
return value instanceof getWindow(value).HTMLElement;
}
function isElement(value) {
return value instanceof getWindow(value).Element;
}
function isShadowRoot(node) {
// Browsers without `ShadowRoot` support.
if (typeof ShadowRoot === 'undefined') {
return false;
}
const OwnElement = getWindow(node).ShadowRoot;
return node instanceof OwnElement || node instanceof ShadowRoot;
}
function isOverflowElement(element) {
const {
overflow,
overflowX,
overflowY,
display
} = getComputedStyle$1(element);
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
}
function isTableElement(element) {
return ['table', 'td', 'th'].includes(getNodeName(element));
}
function isContainingBlock(element) {
const safari = isSafari();
const css = getComputedStyle$1(element);
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
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));
}
function isSafari() {
if (typeof CSS === 'undefined' || !CSS.supports) return false;
return CSS.supports('-webkit-backdrop-filter', 'none');
}
function isLastTraversableNode(node) {
return ['html', 'body', '#document'].includes(getNodeName(node));
}
const min = Math.min;
const max = Math.max;
const round = Math.round;
function getCssDimensions(element) {
const css = getComputedStyle$1(element);
// In testing environments, the `width` and `height` properties are empty
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
let width = parseFloat(css.width) || 0;
let height = parseFloat(css.height) || 0;
const hasOffset = isHTMLElement(element);
const offsetWidth = hasOffset ? element.offsetWidth : width;
const offsetHeight = hasOffset ? element.offsetHeight : height;
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
if (shouldFallback) {
width = offsetWidth;
height = offsetHeight;
}
return {
width,
height,
fallback: shouldFallback
};
}
function unwrapElement(element) {
return !isElement(element) ? element.contextElement : element;
}
const FALLBACK_SCALE = {
x: 1,
y: 1
};
function getScale(element) {
const domElement = unwrapElement(element);
if (!isHTMLElement(domElement)) {
return FALLBACK_SCALE;
}
const rect = domElement.getBoundingClientRect();
const {
width,
height,
fallback
} = getCssDimensions(domElement);
let x = (fallback ? round(rect.width) : rect.width) / width;
let y = (fallback ? round(rect.height) : rect.height) / height;
// 0, NaN, or Infinity should always fallback to 1.
if (!x || !Number.isFinite(x)) {
x = 1;
}
if (!y || !Number.isFinite(y)) {
y = 1;
}
return {
x,
y
};
}
const noOffsets = {
x: 0,
y: 0
};
function getVisualOffsets(element, isFixed, floatingOffsetParent) {
var _win$visualViewport, _win$visualViewport2;
if (isFixed === void 0) {
isFixed = true;
}
if (!isSafari()) {
return noOffsets;
}
const win = element ? getWindow(element) : window;
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== win) {
return noOffsets;
}
return {
x: ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0,
y: ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0
};
}
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
if (includeScale === void 0) {
includeScale = false;
}
if (isFixedStrategy === void 0) {
isFixedStrategy = false;
}
const clientRect = element.getBoundingClientRect();
const domElement = unwrapElement(element);
let scale = FALLBACK_SCALE;
if (includeScale) {
if (offsetParent) {
if (isElement(offsetParent)) {
scale = getScale(offsetParent);
}
} else {
scale = getScale(element);
}
}
const visualOffsets = getVisualOffsets(domElement, isFixedStrategy, offsetParent);
let x = (clientRect.left + visualOffsets.x) / scale.x;
let y = (clientRect.top + visualOffsets.y) / scale.y;
let width = clientRect.width / scale.x;
let height = clientRect.height / scale.y;
if (domElement) {
const win = getWindow(domElement);
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
let currentIFrame = win.frameElement;
while (currentIFrame && offsetParent && offsetWin !== win) {
const iframeScale = getScale(currentIFrame);
const iframeRect = currentIFrame.getBoundingClientRect();
const css = getComputedStyle(currentIFrame);
iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
x *= iframeScale.x;
y *= iframeScale.y;
width *= iframeScale.x;
height *= iframeScale.y;
x += iframeRect.x;
y += iframeRect.y;
currentIFrame = getWindow(currentIFrame).frameElement;
}
}
return (0, _core.rectToClientRect)({
width,
height,
x,
y
});
}
function getDocumentElement(node) {
return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
}
function getNodeScroll(element) {
if (isElement(element)) {
return {
scrollLeft: element.scrollLeft,
scrollTop: element.scrollTop
};
}
return {
scrollLeft: element.pageXOffset,
scrollTop: element.pageYOffset
};
}
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
let {
rect,
offsetParent,
strategy
} = _ref;
const isOffsetParentAnElement = isHTMLElement(offsetParent);
const documentElement = getDocumentElement(offsetParent);
if (offsetParent === documentElement) {
return rect;
}
let scroll = {
scrollLeft: 0,
scrollTop: 0
};
let scale = {
x: 1,
y: 1
};
const offsets = {
x: 0,
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
const offsetRect = getBoundingClientRect(offsetParent);
scale = getScale(offsetParent);
offsets.x = offsetRect.x + offsetParent.clientLeft;
offsets.y = offsetRect.y + offsetParent.clientTop;
}
}
return {
width: rect.width * scale.x,
height: rect.height * scale.y,
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
};
}
function getWindowScrollBarX(element) {
// If has a CSS width greater than the viewport, then this will be
// incorrect for RTL.
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
}
// Gets the entire size of the scrollable document area, even extending outside
// of the `` and `
` rect bounds if horizontally scrollable.
function getDocumentRect(element) {
const html = getDocumentElement(element);
const scroll = getNodeScroll(element);
const body = element.ownerDocument.body;
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
const y = -scroll.scrollTop;
if (getComputedStyle$1(body).direction === 'rtl') {
x += max(html.clientWidth, body.clientWidth) - width;
}
return {
width,
height,
x,
y
};
}
function getParentNode(node) {
if (getNodeName(node) === 'html') {
return node;
}
const result =
// Step into the shadow DOM of the parent of a slotted node.
node.assignedSlot ||
// DOM Element detected.
node.parentNode ||
// ShadowRoot detected.
isShadowRoot(node) && node.host ||
// Fallback.
getDocumentElement(node);
return isShadowRoot(result) ? result.host : result;
}
function getNearestOverflowAncestor(node) {
const parentNode = getParentNode(node);
if (isLastTraversableNode(parentNode)) {
// `getParentNode` will never return a `Document` due to the fallback
// check, so it's either the or element.
return parentNode.ownerDocument.body;
}
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
return parentNode;
}
return getNearestOverflowAncestor(parentNode);
}
function getOverflowAncestors(node, list) {
var _node$ownerDocument;
if (list === void 0) {
list = [];
}
const scrollableAncestor = getNearestOverflowAncestor(node);
const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
const win = getWindow(scrollableAncestor);
if (isBody) {
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
}
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));
}
function getViewportRect(element, strategy) {
const win = getWindow(element);
const html = getDocumentElement(element);
const visualViewport = win.visualViewport;
let width = html.clientWidth;
let height = html.clientHeight;
let x = 0;
let y = 0;
if (visualViewport) {
width = visualViewport.width;
height = visualViewport.height;
const visualViewportBased = isSafari();
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
x = visualViewport.offsetLeft;
y = visualViewport.offsetTop;
}
}
return {
width,
height,
x,
y
};
}
// Returns the inner client rect, subtracting scrollbars if present.
function getInnerBoundingClientRect(element, strategy) {
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
const top = clientRect.top + element.clientTop;
const left = clientRect.left + element.clientLeft;
const scale = isHTMLElement(element) ? getScale(element) : {
x: 1,
y: 1
};
const width = element.clientWidth * scale.x;
const height = element.clientHeight * scale.y;
const x = left * scale.x;
const y = top * scale.y;
return {
width,
height,
x,
y
};
}
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
let rect;
if (clippingAncestor === 'viewport') {
rect = getViewportRect(element, strategy);
} else if (clippingAncestor === 'document') {
rect = getDocumentRect(getDocumentElement(element));
} else if (isElement(clippingAncestor)) {
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
} else {
const visualOffsets = getVisualOffsets(element);
rect = {
...clippingAncestor,
x: clippingAncestor.x - visualOffsets.x,
y: clippingAncestor.y - visualOffsets.y
};
}
return (0, _core.rectToClientRect)(rect);
}
function hasFixedPositionAncestor(element, stopNode) {
const parentNode = getParentNode(element);
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
return false;
}
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
}
// A "clipping ancestor" is an `overflow` element with the characteristic of
// clipping (or hiding) child elements. This returns all clipping ancestors
// of the given element up the tree.
function getClippingElementAncestors(element, cache) {
const cachedResult = cache.get(element);
if (cachedResult) {
return cachedResult;
}
let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
let currentContainingBlockComputedStyle = null;
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
let currentNode = elementIsFixed ? getParentNode(element) : element;
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
const computedStyle = getComputedStyle$1(currentNode);
const currentNodeIsContaining = isContainingBlock(currentNode);
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
currentContainingBlockComputedStyle = null;
}
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
if (shouldDropCurrentNode) {
// Drop non-containing blocks.
result = result.filter(ancestor => ancestor !== currentNode);
} else {
// Record last containing block for next iteration.
currentContainingBlockComputedStyle = computedStyle;
}
currentNode = getParentNode(currentNode);
}
cache.set(element, result);
return result;
}
// Gets the maximum area that the element is visible in due to any number of
// clipping ancestors.
function getClippingRect(_ref) {
let {
element,
boundary,
rootBoundary,
strategy
} = _ref;
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
const firstClippingAncestor = clippingAncestors[0];
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
accRect.top = max(rect.top, accRect.top);
accRect.right = min(rect.right, accRect.right);
accRect.bottom = min(rect.bottom, accRect.bottom);
accRect.left = max(rect.left, accRect.left);
return accRect;
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
return {
width: clippingRect.right - clippingRect.left,
height: clippingRect.bottom - clippingRect.top,
x: clippingRect.left,
y: clippingRect.top
};
}
function getDimensions(element) {
return getCssDimensions(element);
}
function getTrueOffsetParent(element, polyfill) {
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
return null;
}
if (polyfill) {
return polyfill(element);
}
return element.offsetParent;
}
function getContainingBlock(element) {
let currentNode = getParentNode(element);
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
if (isContainingBlock(currentNode)) {
return currentNode;
} else {
currentNode = getParentNode(currentNode);
}
}
return null;
}
// Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.
function getOffsetParent(element, polyfill) {
const window = getWindow(element);
if (!isHTMLElement(element)) {
return window;
}
let offsetParent = getTrueOffsetParent(element, polyfill);
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
}
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
return window;
}
return offsetParent || getContainingBlock(element) || window;
}
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
const isOffsetParentAnElement = isHTMLElement(offsetParent);
const documentElement = getDocumentElement(offsetParent);
const isFixed = strategy === 'fixed';
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
let scroll = {
scrollLeft: 0,
scrollTop: 0
};
const offsets = {
x: 0,
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
offsets.x = offsetRect.x + offsetParent.clientLeft;
offsets.y = offsetRect.y + offsetParent.clientTop;
} else if (documentElement) {
offsets.x = getWindowScrollBarX(documentElement);
}
}
return {
x: rect.left + scroll.scrollLeft - offsets.x,
y: rect.top + scroll.scrollTop - offsets.y,
width: rect.width,
height: rect.height
};
}
const platform = {
getClippingRect,
convertOffsetParentRelativeRectToViewportRelativeRect,
isElement,
getDimensions,
getOffsetParent,
getDocumentElement,
getScale,
async getElementRects(_ref) {
let {
reference,
floating,
strategy
} = _ref;
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
const getDimensionsFn = this.getDimensions;
return {
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
floating: {
x: 0,
y: 0,
...(await getDimensionsFn(floating))
}
};
},
getClientRects: element => Array.from(element.getClientRects()),
isRTL: element => getComputedStyle$1(element).direction === 'rtl'
};
/**
* Automatically updates the position of the floating element when necessary.
* Should only be called when the floating element is mounted on the DOM or
* visible on the screen.
* @returns cleanup function that should be invoked when the floating element is
* removed from the DOM or hidden from the screen.
* @see https://floating-ui.com/docs/autoUpdate
*/
exports.platform = platform;
function autoUpdate(reference, floating, update, options) {
if (options === void 0) {
options = {};
}
const {
ancestorScroll = true,
ancestorResize = true,
elementResize = true,
animationFrame = false
} = options;
const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : reference.contextElement ? getOverflowAncestors(reference.contextElement) : []), ...getOverflowAncestors(floating)] : [];
ancestors.forEach(ancestor => {
// ignores Window, checks for [object VisualViewport]
const isVisualViewport = !isElement(ancestor) && ancestor.toString().includes('V');
if (ancestorScroll && (animationFrame ? isVisualViewport : true)) {
ancestor.addEventListener('scroll', update, {
passive: true
});
}
ancestorResize && ancestor.addEventListener('resize', update);
});
let observer = null;
if (elementResize) {
observer = new ResizeObserver(() => {
update();
});
isElement(reference) && !animationFrame && observer.observe(reference);
if (!isElement(reference) && reference.contextElement && !animationFrame) {
observer.observe(reference.contextElement);
}
observer.observe(floating);
}
let frameId;
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
if (animationFrame) {
frameLoop();
}
function frameLoop() {
const nextRefRect = getBoundingClientRect(reference);
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
update();
}
prevRefRect = nextRefRect;
frameId = requestAnimationFrame(frameLoop);
}
update();
return () => {
var _observer;
ancestors.forEach(ancestor => {
ancestorScroll && ancestor.removeEventListener('scroll', update);
ancestorResize && ancestor.removeEventListener('resize', update);
});
(_observer = observer) == null ? void 0 : _observer.disconnect();
observer = null;
if (animationFrame) {
cancelAnimationFrame(frameId);
}
};
}
/**
* Computes the `x` and `y` coordinates that will place the floating element
* next to a reference element when it is given a certain CSS positioning
* strategy.
*/
const computePosition = (reference, floating, options) => {
// This caches the expensive `getClippingElementAncestors` function so that
// multiple lifecycle resets re-use the same result. It only lives for a
// single call. If other functions become expensive, we can add them as well.
const cache = new Map();
const mergedOptions = {
platform,
...options
};
const platformWithCache = {
...mergedOptions.platform,
_c: cache
};
return (0, _core.computePosition)(reference, floating, {
...mergedOptions,
platform: platformWithCache
});
};
exports.computePosition = computePosition;
/***/ }),
/***/ "../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js ***!
\**************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.arrow = void 0;
Object.defineProperty(exports, "autoPlacement", ({
enumerable: true,
get: function () {
return _dom.autoPlacement;
}
}));
Object.defineProperty(exports, "autoUpdate", ({
enumerable: true,
get: function () {
return _dom.autoUpdate;
}
}));
Object.defineProperty(exports, "computePosition", ({
enumerable: true,
get: function () {
return _dom.computePosition;
}
}));
Object.defineProperty(exports, "detectOverflow", ({
enumerable: true,
get: function () {
return _dom.detectOverflow;
}
}));
Object.defineProperty(exports, "flip", ({
enumerable: true,
get: function () {
return _dom.flip;
}
}));
Object.defineProperty(exports, "getOverflowAncestors", ({
enumerable: true,
get: function () {
return _dom.getOverflowAncestors;
}
}));
Object.defineProperty(exports, "hide", ({
enumerable: true,
get: function () {
return _dom.hide;
}
}));
Object.defineProperty(exports, "inline", ({
enumerable: true,
get: function () {
return _dom.inline;
}
}));
Object.defineProperty(exports, "limitShift", ({
enumerable: true,
get: function () {
return _dom.limitShift;
}
}));
Object.defineProperty(exports, "offset", ({
enumerable: true,
get: function () {
return _dom.offset;
}
}));
Object.defineProperty(exports, "platform", ({
enumerable: true,
get: function () {
return _dom.platform;
}
}));
Object.defineProperty(exports, "shift", ({
enumerable: true,
get: function () {
return _dom.shift;
}
}));
Object.defineProperty(exports, "size", ({
enumerable: true,
get: function () {
return _dom.size;
}
}));
exports.useFloating = useFloating;
var _dom = __webpack_require__(/*! @floating-ui/dom */ "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js");
var React = _interopRequireWildcard(__webpack_require__(/*! react */ "react"));
var ReactDOM = _interopRequireWildcard(__webpack_require__(/*! react-dom */ "react-dom"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/**
* Provides data to position an inner element of the floating element so that it
* appears centered to the reference element.
* This wraps the core `arrow` middleware to allow React refs as the element.
* @see https://floating-ui.com/docs/arrow
*/
const arrow = options => {
function isRef(value) {
return {}.hasOwnProperty.call(value, 'current');
}
return {
name: 'arrow',
options,
fn(state) {
const {
element,
padding
} = typeof options === 'function' ? options(state) : options;
if (element && isRef(element)) {
if (element.current != null) {
return (0, _dom.arrow)({
element: element.current,
padding
}).fn(state);
}
return {};
} else if (element) {
return (0, _dom.arrow)({
element,
padding
}).fn(state);
}
return {};
}
};
};
exports.arrow = arrow;
var index = typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect;
// Fork of `fast-deep-equal` that only does the comparisons we need and compares
// functions
function deepEqual(a, b) {
if (a === b) {
return true;
}
if (typeof a !== typeof b) {
return false;
}
if (typeof a === 'function' && a.toString() === b.toString()) {
return true;
}
let length, i, keys;
if (a && b && typeof a == 'object') {
if (Array.isArray(a)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;) {
if (!deepEqual(a[i], b[i])) {
return false;
}
}
return true;
}
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) {
return false;
}
for (i = length; i-- !== 0;) {
if (!{}.hasOwnProperty.call(b, keys[i])) {
return false;
}
}
for (i = length; i-- !== 0;) {
const key = keys[i];
if (key === '_owner' && a.$$typeof) {
continue;
}
if (!deepEqual(a[key], b[key])) {
return false;
}
}
return true;
}
return a !== a && b !== b;
}
function getDPR(element) {
if (typeof window === 'undefined') {
return 1;
}
const win = element.ownerDocument.defaultView || window;
return win.devicePixelRatio || 1;
}
function roundByDPR(element, value) {
const dpr = getDPR(element);
return Math.round(value * dpr) / dpr;
}
function useLatestRef(value) {
const ref = React.useRef(value);
index(() => {
ref.current = value;
});
return ref;
}
/**
* Provides data to position a floating element.
* @see https://floating-ui.com/docs/react
*/
function useFloating(options) {
if (options === void 0) {
options = {};
}
const {
placement = 'bottom',
strategy = 'absolute',
middleware = [],
platform,
elements: {
reference: externalReference,
floating: externalFloating
} = {},
transform = true,
whileElementsMounted,
open
} = options;
const [data, setData] = React.useState({
x: 0,
y: 0,
strategy,
placement,
middlewareData: {},
isPositioned: false
});
const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
if (!deepEqual(latestMiddleware, middleware)) {
setLatestMiddleware(middleware);
}
const [_reference, _setReference] = React.useState(null);
const [_floating, _setFloating] = React.useState(null);
const setReference = React.useCallback(node => {
if (node != referenceRef.current) {
referenceRef.current = node;
_setReference(node);
}
}, [_setReference]);
const setFloating = React.useCallback(node => {
if (node !== floatingRef.current) {
floatingRef.current = node;
_setFloating(node);
}
}, [_setFloating]);
const referenceEl = externalReference || _reference;
const floatingEl = externalFloating || _floating;
const referenceRef = React.useRef(null);
const floatingRef = React.useRef(null);
const dataRef = React.useRef(data);
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
const platformRef = useLatestRef(platform);
const update = React.useCallback(() => {
if (!referenceRef.current || !floatingRef.current) {
return;
}
const config = {
placement,
strategy,
middleware: latestMiddleware
};
if (platformRef.current) {
config.platform = platformRef.current;
}
(0, _dom.computePosition)(referenceRef.current, floatingRef.current, config).then(data => {
const fullData = {
...data,
isPositioned: true
};
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
dataRef.current = fullData;
ReactDOM.flushSync(() => {
setData(fullData);
});
}
});
}, [latestMiddleware, placement, strategy, platformRef]);
index(() => {
if (open === false && dataRef.current.isPositioned) {
dataRef.current.isPositioned = false;
setData(data => ({
...data,
isPositioned: false
}));
}
}, [open]);
const isMountedRef = React.useRef(false);
index(() => {
isMountedRef.current = true;
return () => {
isMountedRef.current = false;
};
}, []);
index(() => {
if (referenceEl) referenceRef.current = referenceEl;
if (floatingEl) floatingRef.current = floatingEl;
if (referenceEl && floatingEl) {
if (whileElementsMountedRef.current) {
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
} else {
update();
}
}
}, [referenceEl, floatingEl, update, whileElementsMountedRef]);
const refs = React.useMemo(() => ({
reference: referenceRef,
floating: floatingRef,
setReference,
setFloating
}), [setReference, setFloating]);
const elements = React.useMemo(() => ({
reference: referenceEl,
floating: floatingEl
}), [referenceEl, floatingEl]);
const floatingStyles = React.useMemo(() => {
const initialStyles = {
position: strategy,
left: 0,
top: 0
};
if (!elements.floating) {
return initialStyles;
}
const x = roundByDPR(elements.floating, data.x);
const y = roundByDPR(elements.floating, data.y);
if (transform) {
return {
...initialStyles,
transform: "translate(" + x + "px, " + y + "px)",
...(getDPR(elements.floating) >= 1.5 && {
willChange: 'transform'
})
};
}
return {
position: strategy,
left: x,
top: y
};
}, [strategy, transform, elements.floating, data.x, data.y]);
return React.useMemo(() => ({
...data,
update,
refs,
elements,
floatingStyles
}), [data, update, refs, elements, floatingStyles]);
}
/***/ }),
/***/ "../../../node_modules/@motionone/animation/dist/Animation.es.js":
/*!***********************************************************************!*\
!*** ../../../node_modules/@motionone/animation/dist/Animation.es.js ***!
\***********************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.Animation = void 0;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _easingEs = __webpack_require__(/*! ./utils/easing.es.js */ "../../../node_modules/@motionone/animation/dist/utils/easing.es.js");
class Animation {
constructor(output) {
let keyframes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 1];
let {
easing,
duration: initialDuration = _utils.defaults.duration,
delay = _utils.defaults.delay,
endDelay = _utils.defaults.endDelay,
repeat = _utils.defaults.repeat,
offset,
direction = "normal"
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
this.startTime = null;
this.rate = 1;
this.t = 0;
this.cancelTimestamp = null;
this.easing = _utils.noopReturn;
this.duration = 0;
this.totalDuration = 0;
this.repeat = 0;
this.playState = "idle";
this.finished = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
easing = easing || _utils.defaults.easing;
if ((0, _utils.isEasingGenerator)(easing)) {
const custom = easing.createAnimation(keyframes);
easing = custom.easing;
keyframes = custom.keyframes || keyframes;
initialDuration = custom.duration || initialDuration;
}
this.repeat = repeat;
this.easing = (0, _utils.isEasingList)(easing) ? _utils.noopReturn : (0, _easingEs.getEasingFunction)(easing);
this.updateDuration(initialDuration);
const interpolate$1 = (0, _utils.interpolate)(keyframes, offset, (0, _utils.isEasingList)(easing) ? easing.map(_easingEs.getEasingFunction) : _utils.noopReturn);
this.tick = timestamp => {
var _a;
// TODO: Temporary fix for OptionsResolver typing
delay = delay;
let t = 0;
if (this.pauseTime !== undefined) {
t = this.pauseTime;
} else {
t = (timestamp - this.startTime) * this.rate;
}
this.t = t;
// Convert to seconds
t /= 1000;
// Rebase on delay
t = Math.max(t - delay, 0);
/**
* If this animation has finished, set the current time
* to the total duration.
*/
if (this.playState === "finished" && this.pauseTime === undefined) {
t = this.totalDuration;
}
/**
* Get the current progress (0-1) of the animation. If t is >
* than duration we'll get values like 2.5 (midway through the
* third iteration)
*/
const progress = t / this.duration;
// TODO progress += iterationStart
/**
* Get the current iteration (0 indexed). For instance the floor of
* 2.5 is 2.
*/
let currentIteration = Math.floor(progress);
/**
* Get the current progress of the iteration by taking the remainder
* so 2.5 is 0.5 through iteration 2
*/
let iterationProgress = progress % 1.0;
if (!iterationProgress && progress >= 1) {
iterationProgress = 1;
}
/**
* If iteration progress is 1 we count that as the end
* of the previous iteration.
*/
iterationProgress === 1 && currentIteration--;
/**
* Reverse progress if we're not running in "normal" direction
*/
const iterationIsOdd = currentIteration % 2;
if (direction === "reverse" || direction === "alternate" && iterationIsOdd || direction === "alternate-reverse" && !iterationIsOdd) {
iterationProgress = 1 - iterationProgress;
}
const p = t >= this.totalDuration ? 1 : Math.min(iterationProgress, 1);
const latest = interpolate$1(this.easing(p));
output(latest);
const isAnimationFinished = this.pauseTime === undefined && (this.playState === "finished" || t >= this.totalDuration + endDelay);
if (isAnimationFinished) {
this.playState = "finished";
(_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, latest);
} else if (this.playState !== "idle") {
this.frameRequestId = requestAnimationFrame(this.tick);
}
};
this.play();
}
play() {
const now = performance.now();
this.playState = "running";
if (this.pauseTime !== undefined) {
this.startTime = now - this.pauseTime;
} else if (!this.startTime) {
this.startTime = now;
}
this.cancelTimestamp = this.startTime;
this.pauseTime = undefined;
this.frameRequestId = requestAnimationFrame(this.tick);
}
pause() {
this.playState = "paused";
this.pauseTime = this.t;
}
finish() {
this.playState = "finished";
this.tick(0);
}
stop() {
var _a;
this.playState = "idle";
if (this.frameRequestId !== undefined) {
cancelAnimationFrame(this.frameRequestId);
}
(_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, false);
}
cancel() {
this.stop();
this.tick(this.cancelTimestamp);
}
reverse() {
this.rate *= -1;
}
commitStyles() {}
updateDuration(duration) {
this.duration = duration;
this.totalDuration = duration * (this.repeat + 1);
}
get currentTime() {
return this.t;
}
set currentTime(t) {
if (this.pauseTime !== undefined || this.rate === 0) {
this.pauseTime = t;
} else {
this.startTime = performance.now() - t / this.rate;
}
}
get playbackRate() {
return this.rate;
}
set playbackRate(rate) {
this.rate = rate;
}
}
exports.Animation = Animation;
/***/ }),
/***/ "../../../node_modules/@motionone/animation/dist/index.es.js":
/*!*******************************************************************!*\
!*** ../../../node_modules/@motionone/animation/dist/index.es.js ***!
\*******************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "Animation", ({
enumerable: true,
get: function () {
return _AnimationEs.Animation;
}
}));
Object.defineProperty(exports, "getEasingFunction", ({
enumerable: true,
get: function () {
return _easingEs.getEasingFunction;
}
}));
var _AnimationEs = __webpack_require__(/*! ./Animation.es.js */ "../../../node_modules/@motionone/animation/dist/Animation.es.js");
var _easingEs = __webpack_require__(/*! ./utils/easing.es.js */ "../../../node_modules/@motionone/animation/dist/utils/easing.es.js");
/***/ }),
/***/ "../../../node_modules/@motionone/animation/dist/utils/easing.es.js":
/*!**************************************************************************!*\
!*** ../../../node_modules/@motionone/animation/dist/utils/easing.es.js ***!
\**************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.getEasingFunction = getEasingFunction;
var _easing = __webpack_require__(/*! @motionone/easing */ "../../../node_modules/@motionone/easing/dist/index.es.js");
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
const namedEasings = {
ease: (0, _easing.cubicBezier)(0.25, 0.1, 0.25, 1.0),
"ease-in": (0, _easing.cubicBezier)(0.42, 0.0, 1.0, 1.0),
"ease-in-out": (0, _easing.cubicBezier)(0.42, 0.0, 0.58, 1.0),
"ease-out": (0, _easing.cubicBezier)(0.0, 0.0, 0.58, 1.0)
};
const functionArgsRegex = /\((.*?)\)/;
function getEasingFunction(definition) {
// If already an easing function, return
if ((0, _utils.isFunction)(definition)) return definition;
// If an easing curve definition, return bezier function
if ((0, _utils.isCubicBezier)(definition)) return (0, _easing.cubicBezier)(...definition);
// If we have a predefined easing function, return
if (namedEasings[definition]) return namedEasings[definition];
// If this is a steps function, attempt to create easing curve
if (definition.startsWith("steps")) {
const args = functionArgsRegex.exec(definition);
if (args) {
const argsArray = args[1].split(",");
return (0, _easing.steps)(parseFloat(argsArray[0]), argsArray[1].trim());
}
}
return _utils.noopReturn;
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/animate-style.es.js":
/*!*****************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/animate-style.es.js ***!
\*****************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.animateStyle = animateStyle;
var _dataEs = __webpack_require__(/*! ./data.es.js */ "../../../node_modules/@motionone/dom/dist/animate/data.es.js");
var _cssVarEs = __webpack_require__(/*! ./utils/css-var.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/css-var.es.js");
var _animation = __webpack_require__(/*! @motionone/animation */ "../../../node_modules/@motionone/animation/dist/index.es.js");
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _transformsEs = __webpack_require__(/*! ./utils/transforms.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/transforms.es.js");
var _easingEs = __webpack_require__(/*! ./utils/easing.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/easing.es.js");
var _featureDetectionEs = __webpack_require__(/*! ./utils/feature-detection.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/feature-detection.es.js");
var _keyframesEs = __webpack_require__(/*! ./utils/keyframes.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/keyframes.es.js");
var _styleEs = __webpack_require__(/*! ./style.es.js */ "../../../node_modules/@motionone/dom/dist/animate/style.es.js");
var _getStyleNameEs = __webpack_require__(/*! ./utils/get-style-name.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/get-style-name.es.js");
var _stopAnimationEs = __webpack_require__(/*! ./utils/stop-animation.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/stop-animation.es.js");
function getDevToolsRecord() {
return window.__MOTION_DEV_TOOLS_RECORD;
}
function animateStyle(element, key, keyframesDefinition) {
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
const record = getDevToolsRecord();
const isRecording = options.record !== false && record;
let animation;
let {
duration = _utils.defaults.duration,
delay = _utils.defaults.delay,
endDelay = _utils.defaults.endDelay,
repeat = _utils.defaults.repeat,
easing = _utils.defaults.easing,
direction,
offset,
allowWebkitAcceleration = false
} = options;
const data = (0, _dataEs.getAnimationData)(element);
let canAnimateNatively = _featureDetectionEs.supports.waapi();
const valueIsTransform = (0, _transformsEs.isTransform)(key);
/**
* If this is an individual transform, we need to map its
* key to a CSS variable and update the element's transform style
*/
valueIsTransform && (0, _transformsEs.addTransformToElement)(element, key);
const name = (0, _getStyleNameEs.getStyleName)(key);
const motionValue = (0, _dataEs.getMotionValue)(data.values, name);
/**
* Get definition of value, this will be used to convert numerical
* keyframes into the default value type.
*/
const definition = _transformsEs.transformDefinitions.get(name);
/**
* Stop the current animation, if any. Because this will trigger
* commitStyles (DOM writes) and we might later trigger DOM reads,
* this is fired now and we return a factory function to create
* the actual animation that can get called in batch,
*/
(0, _stopAnimationEs.stopAnimation)(motionValue.animation, !((0, _utils.isEasingGenerator)(easing) && motionValue.generator) && options.record !== false);
/**
* Batchable factory function containing all DOM reads.
*/
return () => {
const readInitialValue = () => {
var _a, _b;
return (_b = (_a = _styleEs.style.get(element, name)) !== null && _a !== void 0 ? _a : definition === null || definition === void 0 ? void 0 : definition.initialValue) !== null && _b !== void 0 ? _b : 0;
};
/**
* Replace null values with the previous keyframe value, or read
* it from the DOM if it's the first keyframe.
*/
let keyframes = (0, _keyframesEs.hydrateKeyframes)((0, _keyframesEs.keyframesList)(keyframesDefinition), readInitialValue);
if ((0, _utils.isEasingGenerator)(easing)) {
const custom = easing.createAnimation(keyframes, readInitialValue, valueIsTransform, name, motionValue);
easing = custom.easing;
if (custom.keyframes !== undefined) keyframes = custom.keyframes;
if (custom.duration !== undefined) duration = custom.duration;
}
/**
* If this is a CSS variable we need to register it with the browser
* before it can be animated natively. We also set it with setProperty
* rather than directly onto the element.style object.
*/
if ((0, _cssVarEs.isCssVar)(name)) {
if (_featureDetectionEs.supports.cssRegisterProperty()) {
(0, _cssVarEs.registerCssVariable)(name);
} else {
canAnimateNatively = false;
}
}
/**
* If we can animate this value with WAAPI, do so. Currently this only
* feature detects CSS.registerProperty but could check WAAPI too.
*/
if (canAnimateNatively) {
/**
* Convert numbers to default value types. Currently this only supports
* transforms but it could also support other value types.
*/
if (definition) {
keyframes = keyframes.map(value => (0, _utils.isNumber)(value) ? definition.toDefaultUnit(value) : value);
}
/**
* If this browser doesn't support partial/implicit keyframes we need to
* explicitly provide one.
*/
if (keyframes.length === 1 && (!_featureDetectionEs.supports.partialKeyframes() || isRecording)) {
keyframes.unshift(readInitialValue());
}
const animationOptions = {
delay: _utils.time.ms(delay),
duration: _utils.time.ms(duration),
endDelay: _utils.time.ms(endDelay),
easing: !(0, _utils.isEasingList)(easing) ? (0, _easingEs.convertEasing)(easing) : undefined,
direction,
iterations: repeat + 1,
fill: "both"
};
animation = element.animate({
[name]: keyframes,
offset,
easing: (0, _utils.isEasingList)(easing) ? easing.map(_easingEs.convertEasing) : undefined
}, animationOptions);
/**
* Polyfill finished Promise in browsers that don't support it
*/
if (!animation.finished) {
animation.finished = new Promise((resolve, reject) => {
animation.onfinish = resolve;
animation.oncancel = reject;
});
}
const target = keyframes[keyframes.length - 1];
animation.finished.then(() => {
// Apply styles to target
_styleEs.style.set(element, name, target);
// Ensure fill modes don't persist
animation.cancel();
}).catch(_utils.noop);
/**
* This forces Webkit to run animations on the main thread by exploiting
* this condition:
* https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp?rev=281238#L1099
*
* This fixes Webkit's timing bugs, like accelerated animations falling
* out of sync with main thread animations and massive delays in starting
* accelerated animations in WKWebView.
*/
if (!allowWebkitAcceleration) animation.playbackRate = 1.000001;
/**
* If we can't animate the value natively then we can fallback to the numbers-only
* polyfill for transforms.
*/
} else if (valueIsTransform) {
/**
* If any keyframe is a string (because we measured it from the DOM), we need to convert
* it into a number before passing to the Animation polyfill.
*/
keyframes = keyframes.map(value => typeof value === "string" ? parseFloat(value) : value);
/**
* If we only have a single keyframe, we need to create an initial keyframe by reading
* the current value from the DOM.
*/
if (keyframes.length === 1) {
keyframes.unshift(parseFloat(readInitialValue()));
}
const render = latest => {
if (definition) latest = definition.toDefaultUnit(latest);
_styleEs.style.set(element, name, latest);
};
animation = new _animation.Animation(render, keyframes, Object.assign(Object.assign({}, options), {
duration,
easing
}));
} else {
const target = keyframes[keyframes.length - 1];
_styleEs.style.set(element, name, definition && (0, _utils.isNumber)(target) ? definition.toDefaultUnit(target) : target);
}
if (isRecording) {
record(element, key, keyframes, {
duration,
delay: delay,
easing,
repeat,
offset
}, "motion-one");
}
motionValue.setAnimation(animation);
return animation;
};
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/data.es.js":
/*!********************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/data.es.js ***!
\********************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.getAnimationData = getAnimationData;
exports.getMotionValue = getMotionValue;
var _types = __webpack_require__(/*! @motionone/types */ "../../../node_modules/@motionone/types/dist/index.es.js");
const data = new WeakMap();
function getAnimationData(element) {
if (!data.has(element)) {
data.set(element, {
transforms: [],
values: new Map()
});
}
return data.get(element);
}
function getMotionValue(motionValues, name) {
if (!motionValues.has(name)) {
motionValues.set(name, new _types.MotionValue());
}
return motionValues.get(name);
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/index.es.js":
/*!*********************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/index.es.js ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.animate = animate;
var _animateStyleEs = __webpack_require__(/*! ./animate-style.es.js */ "../../../node_modules/@motionone/dom/dist/animate/animate-style.es.js");
var _optionsEs = __webpack_require__(/*! ./utils/options.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/options.es.js");
var _resolveElementsEs = __webpack_require__(/*! ../utils/resolve-elements.es.js */ "../../../node_modules/@motionone/dom/dist/utils/resolve-elements.es.js");
var _controlsEs = __webpack_require__(/*! ./utils/controls.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/controls.es.js");
var _staggerEs = __webpack_require__(/*! ../utils/stagger.es.js */ "../../../node_modules/@motionone/dom/dist/utils/stagger.es.js");
function animate(elements, keyframes) {
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
elements = (0, _resolveElementsEs.resolveElements)(elements);
const numElements = elements.length;
/**
* Create and start new animations
*/
const animationFactories = [];
for (let i = 0; i < numElements; i++) {
const element = elements[i];
for (const key in keyframes) {
const valueOptions = (0, _optionsEs.getOptions)(options, key);
valueOptions.delay = (0, _staggerEs.resolveOption)(valueOptions.delay, i, numElements);
const animation = (0, _animateStyleEs.animateStyle)(element, key, keyframes[key], valueOptions);
animationFactories.push(animation);
}
}
return (0, _controlsEs.withControls)(animationFactories, options,
/**
* TODO:
* If easing is set to spring or glide, duration will be dynamically
* generated. Ideally we would dynamically generate this from
* animation.effect.getComputedTiming().duration but this isn't
* supported in iOS13 or our number polyfill. Perhaps it's possible
* to Proxy animations returned from animateStyle that has duration
* as a getter.
*/
options.duration);
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/style.es.js":
/*!*********************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/style.es.js ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.style = void 0;
var _cssVarEs = __webpack_require__(/*! ./utils/css-var.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/css-var.es.js");
var _getStyleNameEs = __webpack_require__(/*! ./utils/get-style-name.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/get-style-name.es.js");
var _transformsEs = __webpack_require__(/*! ./utils/transforms.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/transforms.es.js");
const style = {
get: (element, name) => {
name = (0, _getStyleNameEs.getStyleName)(name);
let value = (0, _cssVarEs.isCssVar)(name) ? element.style.getPropertyValue(name) : getComputedStyle(element)[name];
if (!value && value !== 0) {
const definition = _transformsEs.transformDefinitions.get(name);
if (definition) value = definition.initialValue;
}
return value;
},
set: (element, name, value) => {
name = (0, _getStyleNameEs.getStyleName)(name);
if ((0, _cssVarEs.isCssVar)(name)) {
element.style.setProperty(name, value);
} else {
element.style[name] = value;
}
}
};
exports.style = style;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/utils/controls.es.js":
/*!******************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/utils/controls.es.js ***!
\******************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.withControls = exports.controls = void 0;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _stopAnimationEs = __webpack_require__(/*! ./stop-animation.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/stop-animation.es.js");
const createAnimation = factory => factory();
const withControls = function (animationFactory, options) {
let duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _utils.defaults.duration;
return new Proxy({
animations: animationFactory.map(createAnimation).filter(Boolean),
duration,
options
}, controls);
};
/**
* TODO:
* Currently this returns the first animation, ideally it would return
* the first active animation.
*/
exports.withControls = withControls;
const getActiveAnimation = state => state.animations[0];
const controls = {
get: (target, key) => {
const activeAnimation = getActiveAnimation(target);
switch (key) {
case "duration":
return target.duration;
case "currentTime":
return _utils.time.s((activeAnimation === null || activeAnimation === void 0 ? void 0 : activeAnimation[key]) || 0);
case "playbackRate":
case "playState":
return activeAnimation === null || activeAnimation === void 0 ? void 0 : activeAnimation[key];
case "finished":
if (!target.finished) {
target.finished = Promise.all(target.animations.map(selectFinished)).catch(_utils.noop);
}
return target.finished;
case "stop":
return () => {
target.animations.forEach(animation => (0, _stopAnimationEs.stopAnimation)(animation));
};
case "forEachNative":
/**
* This is for internal use only, fire a callback for each
* underlying animation.
*/
return callback => {
target.animations.forEach(animation => callback(animation, target));
};
default:
return typeof (activeAnimation === null || activeAnimation === void 0 ? void 0 : activeAnimation[key]) === "undefined" ? undefined : () => target.animations.forEach(animation => animation[key]());
}
},
set: (target, key, value) => {
switch (key) {
case "currentTime":
value = _utils.time.ms(value);
case "currentTime":
case "playbackRate":
for (let i = 0; i < target.animations.length; i++) {
target.animations[i][key] = value;
}
return true;
}
return false;
}
};
exports.controls = controls;
const selectFinished = animation => animation.finished;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/utils/css-var.es.js":
/*!*****************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/utils/css-var.es.js ***!
\*****************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isCssVar = void 0;
exports.registerCssVariable = registerCssVariable;
exports.registeredProperties = void 0;
var _transformsEs = __webpack_require__(/*! ./transforms.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/transforms.es.js");
const isCssVar = name => name.startsWith("--");
exports.isCssVar = isCssVar;
const registeredProperties = new Set();
exports.registeredProperties = registeredProperties;
function registerCssVariable(name) {
if (registeredProperties.has(name)) return;
registeredProperties.add(name);
try {
const {
syntax,
initialValue
} = _transformsEs.transformDefinitions.has(name) ? _transformsEs.transformDefinitions.get(name) : {};
CSS.registerProperty({
name,
inherits: false,
syntax,
initialValue
});
} catch (e) {}
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/utils/easing.es.js":
/*!****************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/utils/easing.es.js ***!
\****************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.cubicBezierAsString = exports.convertEasing = void 0;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
const convertEasing = easing => (0, _utils.isCubicBezier)(easing) ? cubicBezierAsString(easing) : easing;
exports.convertEasing = convertEasing;
const cubicBezierAsString = _ref => {
let [a, b, c, d] = _ref;
return `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
};
exports.cubicBezierAsString = cubicBezierAsString;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/utils/feature-detection.es.js":
/*!***************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/utils/feature-detection.es.js ***!
\***************************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.supports = void 0;
const testAnimation = keyframes => document.createElement("div").animate(keyframes, {
duration: 0.001
});
const featureTests = {
cssRegisterProperty: () => typeof CSS !== "undefined" && Object.hasOwnProperty.call(CSS, "registerProperty"),
waapi: () => Object.hasOwnProperty.call(Element.prototype, "animate"),
partialKeyframes: () => {
try {
testAnimation({
opacity: [1]
});
} catch (e) {
return false;
}
return true;
},
finished: () => Boolean(testAnimation({
opacity: [0, 1]
}).finished)
};
const results = {};
const supports = {};
exports.supports = supports;
for (const key in featureTests) {
supports[key] = () => {
if (results[key] === undefined) results[key] = featureTests[key]();
return results[key];
};
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/utils/get-style-name.es.js":
/*!************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/utils/get-style-name.es.js ***!
\************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.getStyleName = getStyleName;
var _transformsEs = __webpack_require__(/*! ./transforms.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/transforms.es.js");
function getStyleName(key) {
if (_transformsEs.transformAlias[key]) key = _transformsEs.transformAlias[key];
return (0, _transformsEs.isTransform)(key) ? (0, _transformsEs.asTransformCssVar)(key) : key;
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/utils/keyframes.es.js":
/*!*******************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/utils/keyframes.es.js ***!
\*******************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.hydrateKeyframes = hydrateKeyframes;
exports.keyframesList = void 0;
function hydrateKeyframes(keyframes, readInitialValue) {
for (let i = 0; i < keyframes.length; i++) {
if (keyframes[i] === null) {
keyframes[i] = i ? keyframes[i - 1] : readInitialValue();
}
}
return keyframes;
}
const keyframesList = keyframes => Array.isArray(keyframes) ? keyframes : [keyframes];
exports.keyframesList = keyframesList;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/utils/options.es.js":
/*!*****************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/utils/options.es.js ***!
\*****************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.getOptions = void 0;
const getOptions = (options, key) =>
/**
* TODO: Make test for this
* Always return a new object otherwise delay is overwritten by results of stagger
* and this results in no stagger
*/
options[key] ? Object.assign(Object.assign({}, options), options[key]) : Object.assign({}, options);
exports.getOptions = getOptions;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/utils/stop-animation.es.js":
/*!************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/utils/stop-animation.es.js ***!
\************************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.stopAnimation = stopAnimation;
function stopAnimation(animation) {
let needsCommit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
if (!animation || animation.playState === "finished") return;
// Suppress error thrown by WAAPI
try {
if (animation.stop) {
animation.stop();
} else {
needsCommit && animation.commitStyles();
animation.cancel();
}
} catch (e) {}
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/utils/style-object.es.js":
/*!**********************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/utils/style-object.es.js ***!
\**********************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.createStyles = createStyles;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _transformsEs = __webpack_require__(/*! ./transforms.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/transforms.es.js");
function createStyles(keyframes) {
const initialKeyframes = {};
const transformKeys = [];
for (let key in keyframes) {
const value = keyframes[key];
if ((0, _transformsEs.isTransform)(key)) {
if (_transformsEs.transformAlias[key]) key = _transformsEs.transformAlias[key];
transformKeys.push(key);
key = (0, _transformsEs.asTransformCssVar)(key);
}
let initialKeyframe = Array.isArray(value) ? value[0] : value;
/**
* If this is a number and we have a default value type, convert the number
* to this type.
*/
const definition = _transformsEs.transformDefinitions.get(key);
if (definition) {
initialKeyframe = (0, _utils.isNumber)(value) ? definition.toDefaultUnit(value) : value;
}
initialKeyframes[key] = initialKeyframe;
}
if (transformKeys.length) {
initialKeyframes.transform = (0, _transformsEs.buildTransformTemplate)(transformKeys);
}
return initialKeyframes;
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/utils/style-string.es.js":
/*!**********************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/utils/style-string.es.js ***!
\**********************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.createStyleString = createStyleString;
var _styleObjectEs = __webpack_require__(/*! ./style-object.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/style-object.es.js");
const camelLetterToPipeLetter = letter => `-${letter.toLowerCase()}`;
const camelToPipeCase = str => str.replace(/[A-Z]/g, camelLetterToPipeLetter);
function createStyleString() {
let target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
const styles = (0, _styleObjectEs.createStyles)(target);
let style = "";
for (const key in styles) {
style += key.startsWith("--") ? key : camelToPipeCase(key);
style += `: ${styles[key]}; `;
}
return style;
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/animate/utils/transforms.es.js":
/*!********************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/animate/utils/transforms.es.js ***!
\********************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.transformDefinitions = exports.transformAlias = exports.isTransform = exports.compareTransformOrder = exports.buildTransformTemplate = exports.axes = exports.asTransformCssVar = exports.addTransformToElement = void 0;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _dataEs = __webpack_require__(/*! ../data.es.js */ "../../../node_modules/@motionone/dom/dist/animate/data.es.js");
/**
* A list of all transformable axes. We'll use this list to generated a version
* of each axes for each transform.
*/
const axes = ["", "X", "Y", "Z"];
/**
* An ordered array of each transformable value. By default, transform values
* will be sorted to this order.
*/
exports.axes = axes;
const order = ["translate", "scale", "rotate", "skew"];
const transformAlias = {
x: "translateX",
y: "translateY",
z: "translateZ"
};
exports.transformAlias = transformAlias;
const rotation = {
syntax: "",
initialValue: "0deg",
toDefaultUnit: v => v + "deg"
};
const baseTransformProperties = {
translate: {
syntax: "",
initialValue: "0px",
toDefaultUnit: v => v + "px"
},
rotate: rotation,
scale: {
syntax: "",
initialValue: 1,
toDefaultUnit: _utils.noopReturn
},
skew: rotation
};
const transformDefinitions = new Map();
exports.transformDefinitions = transformDefinitions;
const asTransformCssVar = name => `--motion-${name}`;
/**
* Generate a list of every possible transform key
*/
exports.asTransformCssVar = asTransformCssVar;
const transforms = ["x", "y", "z"];
order.forEach(name => {
axes.forEach(axis => {
transforms.push(name + axis);
transformDefinitions.set(asTransformCssVar(name + axis), baseTransformProperties[name]);
});
});
/**
* A function to use with Array.sort to sort transform keys by their default order.
*/
const compareTransformOrder = (a, b) => transforms.indexOf(a) - transforms.indexOf(b);
/**
* Provide a quick way to check if a string is the name of a transform
*/
exports.compareTransformOrder = compareTransformOrder;
const transformLookup = new Set(transforms);
const isTransform = name => transformLookup.has(name);
exports.isTransform = isTransform;
const addTransformToElement = (element, name) => {
// Map x to translateX etc
if (transformAlias[name]) name = transformAlias[name];
const {
transforms
} = (0, _dataEs.getAnimationData)(element);
(0, _utils.addUniqueItem)(transforms, name);
/**
* TODO: An optimisation here could be to cache the transform in element data
* and only update if this has changed.
*/
element.style.transform = buildTransformTemplate(transforms);
};
exports.addTransformToElement = addTransformToElement;
const buildTransformTemplate = transforms => transforms.sort(compareTransformOrder).reduce(transformListToString, "").trim();
exports.buildTransformTemplate = buildTransformTemplate;
const transformListToString = (template, name) => `${template} ${name}(var(${asTransformCssVar(name)}))`;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/easing/create-generator-easing.es.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/easing/create-generator-easing.es.js ***!
\**************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.createGeneratorEasing = createGeneratorEasing;
var _generators = __webpack_require__(/*! @motionone/generators */ "../../../node_modules/@motionone/generators/dist/index.es.js");
function createGeneratorEasing(createGenerator) {
const keyframesCache = new WeakMap();
return function () {
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
const generatorCache = new Map();
const getGenerator = function () {
let from = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
let velocity = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
let isScale = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
const key = `${from}-${to}-${velocity}-${isScale}`;
if (!generatorCache.has(key)) {
generatorCache.set(key, createGenerator(Object.assign({
from,
to,
velocity,
restSpeed: isScale ? 0.05 : 2,
restDistance: isScale ? 0.01 : 0.5
}, options)));
}
return generatorCache.get(key);
};
const getKeyframes = generator => {
if (!keyframesCache.has(generator)) {
keyframesCache.set(generator, (0, _generators.pregenerateKeyframes)(generator));
}
return keyframesCache.get(generator);
};
return {
createAnimation: (keyframes, getOrigin, canUseGenerator, name, motionValue) => {
var _a, _b;
let settings;
const numKeyframes = keyframes.length;
let shouldUseGenerator = canUseGenerator && numKeyframes <= 2 && keyframes.every(isNumberOrNull);
if (shouldUseGenerator) {
const target = keyframes[numKeyframes - 1];
const unresolvedOrigin = numKeyframes === 1 ? null : keyframes[0];
let velocity = 0;
let origin = 0;
const prevGenerator = motionValue === null || motionValue === void 0 ? void 0 : motionValue.generator;
if (prevGenerator) {
/**
* If we have a generator for this value we can use it to resolve
* the animations's current value and velocity.
*/
const {
animation,
generatorStartTime
} = motionValue;
const startTime = (animation === null || animation === void 0 ? void 0 : animation.startTime) || generatorStartTime || 0;
const currentTime = (animation === null || animation === void 0 ? void 0 : animation.currentTime) || performance.now() - startTime;
const prevGeneratorCurrent = prevGenerator(currentTime).current;
origin = (_a = unresolvedOrigin) !== null && _a !== void 0 ? _a : prevGeneratorCurrent;
if (numKeyframes === 1 || numKeyframes === 2 && keyframes[0] === null) {
velocity = (0, _generators.calcGeneratorVelocity)(t => prevGenerator(t).current, currentTime, prevGeneratorCurrent);
}
} else {
origin = (_b = unresolvedOrigin) !== null && _b !== void 0 ? _b : parseFloat(getOrigin());
}
const generator = getGenerator(origin, target, velocity, name === null || name === void 0 ? void 0 : name.includes("scale"));
const keyframesMetadata = getKeyframes(generator);
settings = Object.assign(Object.assign({}, keyframesMetadata), {
easing: "linear"
});
// TODO Add test for this
if (motionValue) {
motionValue.generator = generator;
motionValue.generatorStartTime = performance.now();
}
} else {
const keyframesMetadata = getKeyframes(getGenerator(0, 100));
settings = {
easing: "ease",
duration: keyframesMetadata.overshootDuration
};
}
return settings;
}
};
};
}
const isNumberOrNull = value => typeof value !== "string";
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/easing/glide/index.es.js":
/*!**************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/easing/glide/index.es.js ***!
\**************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.glide = void 0;
var _generators = __webpack_require__(/*! @motionone/generators */ "../../../node_modules/@motionone/generators/dist/index.es.js");
var _createGeneratorEasingEs = __webpack_require__(/*! ../create-generator-easing.es.js */ "../../../node_modules/@motionone/dom/dist/easing/create-generator-easing.es.js");
const glide = (0, _createGeneratorEasingEs.createGeneratorEasing)(_generators.glide);
exports.glide = glide;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/easing/spring/index.es.js":
/*!***************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/easing/spring/index.es.js ***!
\***************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.spring = void 0;
var _generators = __webpack_require__(/*! @motionone/generators */ "../../../node_modules/@motionone/generators/dist/index.es.js");
var _createGeneratorEasingEs = __webpack_require__(/*! ../create-generator-easing.es.js */ "../../../node_modules/@motionone/dom/dist/easing/create-generator-easing.es.js");
const spring = (0, _createGeneratorEasingEs.createGeneratorEasing)(_generators.spring);
exports.spring = spring;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/in-view.es.js":
/*!************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/in-view.es.js ***!
\************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.inView = inView;
var _resolveElementsEs = __webpack_require__(/*! ../utils/resolve-elements.es.js */ "../../../node_modules/@motionone/dom/dist/utils/resolve-elements.es.js");
const thresholds = {
any: 0,
all: 1
};
function inView(elementOrSelector, onStart) {
let {
root,
margin: rootMargin,
amount = "any"
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
/**
* If this browser doesn't support IntersectionObserver, return a dummy stop function.
* Default triggering of onStart is tricky - it could be used for starting/stopping
* videos, lazy loading content etc. We could provide an option to enable a fallback, or
* provide a fallback callback option.
*/
if (typeof IntersectionObserver === "undefined") {
return () => {};
}
const elements = (0, _resolveElementsEs.resolveElements)(elementOrSelector);
const activeIntersections = new WeakMap();
const onIntersectionChange = entries => {
entries.forEach(entry => {
const onEnd = activeIntersections.get(entry.target);
/**
* If there's no change to the intersection, we don't need to
* do anything here.
*/
if (entry.isIntersecting === Boolean(onEnd)) return;
if (entry.isIntersecting) {
const newOnEnd = onStart(entry);
if (typeof newOnEnd === "function") {
activeIntersections.set(entry.target, newOnEnd);
} else {
observer.unobserve(entry.target);
}
} else if (onEnd) {
onEnd(entry);
activeIntersections.delete(entry.target);
}
});
};
const observer = new IntersectionObserver(onIntersectionChange, {
root,
rootMargin,
threshold: typeof amount === "number" ? amount : thresholds[amount]
});
elements.forEach(element => observer.observe(element));
return () => observer.disconnect();
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/resize/handle-element.es.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/resize/handle-element.es.js ***!
\**************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.resizeElement = resizeElement;
var _resolveElementsEs = __webpack_require__(/*! ../../utils/resolve-elements.es.js */ "../../../node_modules/@motionone/dom/dist/utils/resolve-elements.es.js");
const resizeHandlers = new WeakMap();
let observer;
function getElementSize(target, borderBoxSize) {
if (borderBoxSize) {
const {
inlineSize,
blockSize
} = borderBoxSize[0];
return {
width: inlineSize,
height: blockSize
};
} else if (target instanceof SVGElement && "getBBox" in target) {
return target.getBBox();
} else {
return {
width: target.offsetWidth,
height: target.offsetHeight
};
}
}
function notifyTarget(_ref) {
let {
target,
contentRect,
borderBoxSize
} = _ref;
var _a;
(_a = resizeHandlers.get(target)) === null || _a === void 0 ? void 0 : _a.forEach(handler => {
handler({
target,
contentSize: contentRect,
get size() {
return getElementSize(target, borderBoxSize);
}
});
});
}
function notifyAll(entries) {
entries.forEach(notifyTarget);
}
function createResizeObserver() {
if (typeof ResizeObserver === "undefined") return;
observer = new ResizeObserver(notifyAll);
}
function resizeElement(target, handler) {
if (!observer) createResizeObserver();
const elements = (0, _resolveElementsEs.resolveElements)(target);
elements.forEach(element => {
let elementHandlers = resizeHandlers.get(element);
if (!elementHandlers) {
elementHandlers = new Set();
resizeHandlers.set(element, elementHandlers);
}
elementHandlers.add(handler);
observer === null || observer === void 0 ? void 0 : observer.observe(element);
});
return () => {
elements.forEach(element => {
const elementHandlers = resizeHandlers.get(element);
elementHandlers === null || elementHandlers === void 0 ? void 0 : elementHandlers.delete(handler);
if (!(elementHandlers === null || elementHandlers === void 0 ? void 0 : elementHandlers.size)) {
observer === null || observer === void 0 ? void 0 : observer.unobserve(element);
}
});
};
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/resize/handle-window.es.js":
/*!*************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/resize/handle-window.es.js ***!
\*************************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.resizeWindow = resizeWindow;
const windowCallbacks = new Set();
let windowResizeHandler;
function createWindowResizeHandler() {
windowResizeHandler = () => {
const size = {
width: window.innerWidth,
height: window.innerHeight
};
const info = {
target: window,
size,
contentSize: size
};
windowCallbacks.forEach(callback => callback(info));
};
window.addEventListener("resize", windowResizeHandler);
}
function resizeWindow(callback) {
windowCallbacks.add(callback);
if (!windowResizeHandler) createWindowResizeHandler();
return () => {
windowCallbacks.delete(callback);
if (!windowCallbacks.size && windowResizeHandler) {
windowResizeHandler = undefined;
}
};
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/resize/index.es.js":
/*!*****************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/resize/index.es.js ***!
\*****************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.resize = resize;
var _handleElementEs = __webpack_require__(/*! ./handle-element.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/resize/handle-element.es.js");
var _handleWindowEs = __webpack_require__(/*! ./handle-window.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/resize/handle-window.es.js");
function resize(a, b) {
return typeof a === "function" ? (0, _handleWindowEs.resizeWindow)(a) : (0, _handleElementEs.resizeElement)(a, b);
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/scroll/index.es.js":
/*!*****************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/scroll/index.es.js ***!
\*****************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.scroll = scroll;
var _tslib = __webpack_require__(/*! tslib */ "../../../node_modules/tslib/tslib.es6.js");
var _indexEs = __webpack_require__(/*! ../resize/index.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/resize/index.es.js");
var _infoEs = __webpack_require__(/*! ./info.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/scroll/info.es.js");
var _onScrollHandlerEs = __webpack_require__(/*! ./on-scroll-handler.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/scroll/on-scroll-handler.es.js");
const scrollListeners = new WeakMap();
const resizeListeners = new WeakMap();
const onScrollHandlers = new WeakMap();
const getEventTarget = element => element === document.documentElement ? window : element;
function scroll(onScroll) {
let _a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var {
container = document.documentElement
} = _a,
options = (0, _tslib.__rest)(_a, ["container"]);
let containerHandlers = onScrollHandlers.get(container);
/**
* Get the onScroll handlers for this container.
* If one isn't found, create a new one.
*/
if (!containerHandlers) {
containerHandlers = new Set();
onScrollHandlers.set(container, containerHandlers);
}
/**
* Create a new onScroll handler for the provided callback.
*/
const info = (0, _infoEs.createScrollInfo)();
const containerHandler = (0, _onScrollHandlerEs.createOnScrollHandler)(container, onScroll, info, options);
containerHandlers.add(containerHandler);
/**
* Check if there's a scroll event listener for this container.
* If not, create one.
*/
if (!scrollListeners.has(container)) {
const listener = () => {
const time = performance.now();
for (const handler of containerHandlers) handler.measure();
for (const handler of containerHandlers) handler.update(time);
for (const handler of containerHandlers) handler.notify();
};
scrollListeners.set(container, listener);
const target = getEventTarget(container);
window.addEventListener("resize", listener, {
passive: true
});
if (container !== document.documentElement) {
resizeListeners.set(container, (0, _indexEs.resize)(container, listener));
}
target.addEventListener("scroll", listener, {
passive: true
});
}
const listener = scrollListeners.get(container);
const onLoadProcesss = requestAnimationFrame(listener);
return () => {
var _a;
if (typeof onScroll !== "function") onScroll.stop();
cancelAnimationFrame(onLoadProcesss);
/**
* Check if we even have any handlers for this container.
*/
const containerHandlers = onScrollHandlers.get(container);
if (!containerHandlers) return;
containerHandlers.delete(containerHandler);
if (containerHandlers.size) return;
/**
* If no more handlers, remove the scroll listener too.
*/
const listener = scrollListeners.get(container);
scrollListeners.delete(container);
if (listener) {
getEventTarget(container).removeEventListener("scroll", listener);
(_a = resizeListeners.get(container)) === null || _a === void 0 ? void 0 : _a();
window.removeEventListener("resize", listener);
}
};
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/scroll/info.es.js":
/*!****************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/scroll/info.es.js ***!
\****************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.createScrollInfo = void 0;
exports.updateScrollInfo = updateScrollInfo;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
/**
* A time in milliseconds, beyond which we consider the scroll velocity to be 0.
*/
const maxElapsed = 50;
const createAxisInfo = () => ({
current: 0,
offset: [],
progress: 0,
scrollLength: 0,
targetOffset: 0,
targetLength: 0,
containerLength: 0,
velocity: 0
});
const createScrollInfo = () => ({
time: 0,
x: createAxisInfo(),
y: createAxisInfo()
});
exports.createScrollInfo = createScrollInfo;
const keys = {
x: {
length: "Width",
position: "Left"
},
y: {
length: "Height",
position: "Top"
}
};
function updateAxisInfo(element, axisName, info, time) {
const axis = info[axisName];
const {
length,
position
} = keys[axisName];
const prev = axis.current;
const prevTime = info.time;
axis.current = element["scroll" + position];
axis.scrollLength = element["scroll" + length] - element["client" + length];
axis.offset.length = 0;
axis.offset[0] = 0;
axis.offset[1] = axis.scrollLength;
axis.progress = (0, _utils.progress)(0, axis.scrollLength, axis.current);
const elapsed = time - prevTime;
axis.velocity = elapsed > maxElapsed ? 0 : (0, _utils.velocityPerSecond)(axis.current - prev, elapsed);
}
function updateScrollInfo(element, info, time) {
updateAxisInfo(element, "x", info, time);
updateAxisInfo(element, "y", info, time);
info.time = time;
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/edge.es.js":
/*!************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/edge.es.js ***!
\************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.namedEdges = void 0;
exports.resolveEdge = resolveEdge;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
const namedEdges = {
start: 0,
center: 0.5,
end: 1
};
exports.namedEdges = namedEdges;
function resolveEdge(edge, length) {
let inset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
let delta = 0;
/**
* If we have this edge defined as a preset, replace the definition
* with the numerical value.
*/
if (namedEdges[edge] !== undefined) {
edge = namedEdges[edge];
}
/**
* Handle unit values
*/
if ((0, _utils.isString)(edge)) {
const asNumber = parseFloat(edge);
if (edge.endsWith("px")) {
delta = asNumber;
} else if (edge.endsWith("%")) {
edge = asNumber / 100;
} else if (edge.endsWith("vw")) {
delta = asNumber / 100 * document.documentElement.clientWidth;
} else if (edge.endsWith("vh")) {
delta = asNumber / 100 * document.documentElement.clientHeight;
} else {
edge = asNumber;
}
}
/**
* If the edge is defined as a number, handle as a progress value.
*/
if ((0, _utils.isNumber)(edge)) {
delta = length * edge;
}
return inset + delta;
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/index.es.js":
/*!*************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/index.es.js ***!
\*************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.resolveOffsets = resolveOffsets;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _insetEs = __webpack_require__(/*! ./inset.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/inset.es.js");
var _presetsEs = __webpack_require__(/*! ./presets.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/presets.es.js");
var _offsetEs = __webpack_require__(/*! ./offset.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/offset.es.js");
const point = {
x: 0,
y: 0
};
function resolveOffsets(container, info, options) {
let {
offset: offsetDefinition = _presetsEs.ScrollOffset.All
} = options;
const {
target = container,
axis = "y"
} = options;
const lengthLabel = axis === "y" ? "height" : "width";
const inset = target !== container ? (0, _insetEs.calcInset)(target, container) : point;
/**
* Measure the target and container. If they're the same thing then we
* use the container's scrollWidth/Height as the target, from there
* all other calculations can remain the same.
*/
const targetSize = target === container ? {
width: container.scrollWidth,
height: container.scrollHeight
} : {
width: target.clientWidth,
height: target.clientHeight
};
const containerSize = {
width: container.clientWidth,
height: container.clientHeight
};
/**
* Reset the length of the resolved offset array rather than creating a new one.
* TODO: More reusable data structures for targetSize/containerSize would also be good.
*/
info[axis].offset.length = 0;
/**
* Populate the offset array by resolving the user's offset definition into
* a list of pixel scroll offets.
*/
let hasChanged = !info[axis].interpolate;
const numOffsets = offsetDefinition.length;
for (let i = 0; i < numOffsets; i++) {
const offset = (0, _offsetEs.resolveOffset)(offsetDefinition[i], containerSize[lengthLabel], targetSize[lengthLabel], inset[axis]);
if (!hasChanged && offset !== info[axis].interpolatorOffsets[i]) {
hasChanged = true;
}
info[axis].offset[i] = offset;
}
/**
* If the pixel scroll offsets have changed, create a new interpolator function
* to map scroll value into a progress.
*/
if (hasChanged) {
info[axis].interpolate = (0, _utils.interpolate)((0, _utils.defaultOffset)(numOffsets), info[axis].offset);
info[axis].interpolatorOffsets = [...info[axis].offset];
}
info[axis].progress = info[axis].interpolate(info[axis].current);
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/inset.es.js":
/*!*************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/inset.es.js ***!
\*************************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.calcInset = calcInset;
function calcInset(element, container) {
let inset = {
x: 0,
y: 0
};
let current = element;
while (current && current !== container) {
if (current instanceof HTMLElement) {
inset.x += current.offsetLeft;
inset.y += current.offsetTop;
current = current.offsetParent;
} else if (current instanceof SVGGraphicsElement && "getBBox" in current) {
const {
top,
left
} = current.getBBox();
inset.x += left;
inset.y += top;
/**
* Assign the next parent element as the tag.
*/
while (current && current.tagName !== "svg") {
current = current.parentNode;
}
}
}
return inset;
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/offset.es.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/offset.es.js ***!
\**************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.resolveOffset = resolveOffset;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _edgeEs = __webpack_require__(/*! ./edge.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/edge.es.js");
const defaultOffset = [0, 0];
function resolveOffset(offset, containerLength, targetLength, targetInset) {
let offsetDefinition = Array.isArray(offset) ? offset : defaultOffset;
let targetPoint = 0;
let containerPoint = 0;
if ((0, _utils.isNumber)(offset)) {
/**
* If we're provided offset: [0, 0.5, 1] then each number x should become
* [x, x], so we default to the behaviour of mapping 0 => 0 of both target
* and container etc.
*/
offsetDefinition = [offset, offset];
} else if ((0, _utils.isString)(offset)) {
offset = offset.trim();
if (offset.includes(" ")) {
offsetDefinition = offset.split(" ");
} else {
/**
* If we're provided a definition like "100px" then we want to apply
* that only to the top of the target point, leaving the container at 0.
* Whereas a named offset like "end" should be applied to both.
*/
offsetDefinition = [offset, _edgeEs.namedEdges[offset] ? offset : `0`];
}
}
targetPoint = (0, _edgeEs.resolveEdge)(offsetDefinition[0], targetLength, targetInset);
containerPoint = (0, _edgeEs.resolveEdge)(offsetDefinition[1], containerLength);
return targetPoint - containerPoint;
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/presets.es.js":
/*!***************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/presets.es.js ***!
\***************************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.ScrollOffset = void 0;
const ScrollOffset = {
Enter: [[0, 1], [1, 1]],
Exit: [[0, 0], [1, 0]],
Any: [[1, 0], [0, 1]],
All: [[0, 0], [1, 1]]
};
exports.ScrollOffset = ScrollOffset;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/gestures/scroll/on-scroll-handler.es.js":
/*!*****************************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/gestures/scroll/on-scroll-handler.es.js ***!
\*****************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.createOnScrollHandler = createOnScrollHandler;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _infoEs = __webpack_require__(/*! ./info.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/scroll/info.es.js");
var _indexEs = __webpack_require__(/*! ./offsets/index.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/index.es.js");
function measure(container) {
let target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : container;
let info = arguments.length > 2 ? arguments[2] : undefined;
/**
* Find inset of target within scrollable container
*/
info.x.targetOffset = 0;
info.y.targetOffset = 0;
if (target !== container) {
let node = target;
while (node && node != container) {
info.x.targetOffset += node.offsetLeft;
info.y.targetOffset += node.offsetTop;
node = node.offsetParent;
}
}
info.x.targetLength = target === container ? target.scrollWidth : target.clientWidth;
info.y.targetLength = target === container ? target.scrollHeight : target.clientHeight;
info.x.containerLength = container.clientWidth;
info.y.containerLength = container.clientHeight;
}
function createOnScrollHandler(element, onScroll, info) {
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
const axis = options.axis || "y";
return {
measure: () => measure(element, options.target, info),
update: time => {
(0, _infoEs.updateScrollInfo)(element, info, time);
if (options.offset || options.target) {
(0, _indexEs.resolveOffsets)(element, info, options);
}
},
notify: typeof onScroll === "function" ? () => onScroll(info) : scrubAnimation(onScroll, info[axis])
};
}
function scrubAnimation(controls, axisInfo) {
controls.pause();
controls.forEachNative((animation, _ref) => {
let {
easing
} = _ref;
var _a, _b;
if (animation.updateDuration) {
if (!easing) animation.easing = _utils.noopReturn;
animation.updateDuration(1);
} else {
const timingOptions = {
duration: 1000
};
if (!easing) timingOptions.easing = "linear";
(_b = (_a = animation.effect) === null || _a === void 0 ? void 0 : _a.updateTiming) === null || _b === void 0 ? void 0 : _b.call(_a, timingOptions);
}
});
return () => {
controls.currentTime = axisInfo.progress;
};
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/index.es.js":
/*!*************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/index.es.js ***!
\*************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "ScrollOffset", ({
enumerable: true,
get: function () {
return _presetsEs.ScrollOffset;
}
}));
Object.defineProperty(exports, "animate", ({
enumerable: true,
get: function () {
return _indexEs.animate;
}
}));
Object.defineProperty(exports, "animateStyle", ({
enumerable: true,
get: function () {
return _animateStyleEs.animateStyle;
}
}));
Object.defineProperty(exports, "createMotionState", ({
enumerable: true,
get: function () {
return _indexEs7.createMotionState;
}
}));
Object.defineProperty(exports, "createStyleString", ({
enumerable: true,
get: function () {
return _styleStringEs.createStyleString;
}
}));
Object.defineProperty(exports, "createStyles", ({
enumerable: true,
get: function () {
return _styleObjectEs.createStyles;
}
}));
Object.defineProperty(exports, "getAnimationData", ({
enumerable: true,
get: function () {
return _dataEs.getAnimationData;
}
}));
Object.defineProperty(exports, "getStyleName", ({
enumerable: true,
get: function () {
return _getStyleNameEs.getStyleName;
}
}));
Object.defineProperty(exports, "glide", ({
enumerable: true,
get: function () {
return _indexEs4.glide;
}
}));
Object.defineProperty(exports, "inView", ({
enumerable: true,
get: function () {
return _inViewEs.inView;
}
}));
Object.defineProperty(exports, "mountedStates", ({
enumerable: true,
get: function () {
return _indexEs7.mountedStates;
}
}));
Object.defineProperty(exports, "resize", ({
enumerable: true,
get: function () {
return _indexEs5.resize;
}
}));
Object.defineProperty(exports, "scroll", ({
enumerable: true,
get: function () {
return _indexEs6.scroll;
}
}));
Object.defineProperty(exports, "spring", ({
enumerable: true,
get: function () {
return _indexEs3.spring;
}
}));
Object.defineProperty(exports, "stagger", ({
enumerable: true,
get: function () {
return _staggerEs.stagger;
}
}));
Object.defineProperty(exports, "style", ({
enumerable: true,
get: function () {
return _styleEs.style;
}
}));
Object.defineProperty(exports, "timeline", ({
enumerable: true,
get: function () {
return _indexEs2.timeline;
}
}));
Object.defineProperty(exports, "withControls", ({
enumerable: true,
get: function () {
return _controlsEs.withControls;
}
}));
var _indexEs = __webpack_require__(/*! ./animate/index.es.js */ "../../../node_modules/@motionone/dom/dist/animate/index.es.js");
var _animateStyleEs = __webpack_require__(/*! ./animate/animate-style.es.js */ "../../../node_modules/@motionone/dom/dist/animate/animate-style.es.js");
var _indexEs2 = __webpack_require__(/*! ./timeline/index.es.js */ "../../../node_modules/@motionone/dom/dist/timeline/index.es.js");
var _staggerEs = __webpack_require__(/*! ./utils/stagger.es.js */ "../../../node_modules/@motionone/dom/dist/utils/stagger.es.js");
var _indexEs3 = __webpack_require__(/*! ./easing/spring/index.es.js */ "../../../node_modules/@motionone/dom/dist/easing/spring/index.es.js");
var _indexEs4 = __webpack_require__(/*! ./easing/glide/index.es.js */ "../../../node_modules/@motionone/dom/dist/easing/glide/index.es.js");
var _styleEs = __webpack_require__(/*! ./animate/style.es.js */ "../../../node_modules/@motionone/dom/dist/animate/style.es.js");
var _inViewEs = __webpack_require__(/*! ./gestures/in-view.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/in-view.es.js");
var _indexEs5 = __webpack_require__(/*! ./gestures/resize/index.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/resize/index.es.js");
var _indexEs6 = __webpack_require__(/*! ./gestures/scroll/index.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/scroll/index.es.js");
var _presetsEs = __webpack_require__(/*! ./gestures/scroll/offsets/presets.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/scroll/offsets/presets.es.js");
var _controlsEs = __webpack_require__(/*! ./animate/utils/controls.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/controls.es.js");
var _dataEs = __webpack_require__(/*! ./animate/data.es.js */ "../../../node_modules/@motionone/dom/dist/animate/data.es.js");
var _getStyleNameEs = __webpack_require__(/*! ./animate/utils/get-style-name.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/get-style-name.es.js");
var _indexEs7 = __webpack_require__(/*! ./state/index.es.js */ "../../../node_modules/@motionone/dom/dist/state/index.es.js");
var _styleObjectEs = __webpack_require__(/*! ./animate/utils/style-object.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/style-object.es.js");
var _styleStringEs = __webpack_require__(/*! ./animate/utils/style-string.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/style-string.es.js");
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/state/gestures/hover.es.js":
/*!****************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/state/gestures/hover.es.js ***!
\****************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.hover = void 0;
var _eventsEs = __webpack_require__(/*! ../utils/events.es.js */ "../../../node_modules/@motionone/dom/dist/state/utils/events.es.js");
const mouseEvent = (element, name, action) => event => {
if (event.pointerType && event.pointerType !== "mouse") return;
action();
(0, _eventsEs.dispatchPointerEvent)(element, name, event);
};
const hover = {
isActive: options => Boolean(options.hover),
subscribe: (element, _ref) => {
let {
enable,
disable
} = _ref;
const onEnter = mouseEvent(element, "hoverstart", enable);
const onLeave = mouseEvent(element, "hoverend", disable);
element.addEventListener("pointerenter", onEnter);
element.addEventListener("pointerleave", onLeave);
return () => {
element.removeEventListener("pointerenter", onEnter);
element.removeEventListener("pointerleave", onLeave);
};
}
};
exports.hover = hover;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/state/gestures/in-view.es.js":
/*!******************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/state/gestures/in-view.es.js ***!
\******************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.inView = void 0;
var _tslib = __webpack_require__(/*! tslib */ "../../../node_modules/tslib/tslib.es6.js");
var _eventsEs = __webpack_require__(/*! ../utils/events.es.js */ "../../../node_modules/@motionone/dom/dist/state/utils/events.es.js");
var _inViewEs = __webpack_require__(/*! ../../gestures/in-view.es.js */ "../../../node_modules/@motionone/dom/dist/gestures/in-view.es.js");
const inView = {
isActive: options => Boolean(options.inView),
subscribe: (element, _ref, _ref2) => {
let {
enable,
disable
} = _ref;
let {
inViewOptions = {}
} = _ref2;
const {
once
} = inViewOptions,
viewOptions = (0, _tslib.__rest)(inViewOptions, ["once"]);
return (0, _inViewEs.inView)(element, enterEntry => {
enable();
(0, _eventsEs.dispatchViewEvent)(element, "viewenter", enterEntry);
if (!once) {
return leaveEntry => {
disable();
(0, _eventsEs.dispatchViewEvent)(element, "viewleave", leaveEntry);
};
}
}, viewOptions);
}
};
exports.inView = inView;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/state/gestures/press.es.js":
/*!****************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/state/gestures/press.es.js ***!
\****************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.press = void 0;
var _eventsEs = __webpack_require__(/*! ../utils/events.es.js */ "../../../node_modules/@motionone/dom/dist/state/utils/events.es.js");
const press = {
isActive: options => Boolean(options.press),
subscribe: (element, _ref) => {
let {
enable,
disable
} = _ref;
const onPointerUp = event => {
disable();
(0, _eventsEs.dispatchPointerEvent)(element, "pressend", event);
window.removeEventListener("pointerup", onPointerUp);
};
const onPointerDown = event => {
enable();
(0, _eventsEs.dispatchPointerEvent)(element, "pressstart", event);
window.addEventListener("pointerup", onPointerUp);
};
element.addEventListener("pointerdown", onPointerDown);
return () => {
element.removeEventListener("pointerdown", onPointerDown);
window.removeEventListener("pointerup", onPointerUp);
};
}
};
exports.press = press;
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/state/index.es.js":
/*!*******************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/state/index.es.js ***!
\*******************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.createMotionState = createMotionState;
exports.mountedStates = void 0;
var _tslib = __webpack_require__(/*! tslib */ "../../../node_modules/tslib/tslib.es6.js");
var _heyListen = __webpack_require__(/*! hey-listen */ "../../../node_modules/hey-listen/dist/hey-listen.es.js");
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _animateStyleEs = __webpack_require__(/*! ../animate/animate-style.es.js */ "../../../node_modules/@motionone/dom/dist/animate/animate-style.es.js");
var _styleEs = __webpack_require__(/*! ../animate/style.es.js */ "../../../node_modules/@motionone/dom/dist/animate/style.es.js");
var _optionsEs = __webpack_require__(/*! ../animate/utils/options.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/options.es.js");
var _hasChangedEs = __webpack_require__(/*! ./utils/has-changed.es.js */ "../../../node_modules/@motionone/dom/dist/state/utils/has-changed.es.js");
var _resolveVariantEs = __webpack_require__(/*! ./utils/resolve-variant.es.js */ "../../../node_modules/@motionone/dom/dist/state/utils/resolve-variant.es.js");
var _scheduleEs = __webpack_require__(/*! ./utils/schedule.es.js */ "../../../node_modules/@motionone/dom/dist/state/utils/schedule.es.js");
var _inViewEs = __webpack_require__(/*! ./gestures/in-view.es.js */ "../../../node_modules/@motionone/dom/dist/state/gestures/in-view.es.js");
var _hoverEs = __webpack_require__(/*! ./gestures/hover.es.js */ "../../../node_modules/@motionone/dom/dist/state/gestures/hover.es.js");
var _pressEs = __webpack_require__(/*! ./gestures/press.es.js */ "../../../node_modules/@motionone/dom/dist/state/gestures/press.es.js");
var _eventsEs = __webpack_require__(/*! ./utils/events.es.js */ "../../../node_modules/@motionone/dom/dist/state/utils/events.es.js");
const gestures = {
inView: _inViewEs.inView,
hover: _hoverEs.hover,
press: _pressEs.press
};
/**
* A list of state types, in priority order. If a value is defined in
* a righter-most type, it will override any definition in a lefter-most.
*/
const stateTypes = ["initial", "animate", ...Object.keys(gestures), "exit"];
/**
* A global store of all generated motion states. This can be used to lookup
* a motion state for a given Element.
*/
const mountedStates = new WeakMap();
exports.mountedStates = mountedStates;
function createMotionState() {
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
let parent = arguments.length > 1 ? arguments[1] : undefined;
/**
* The element represented by the motion state. This is an empty reference
* when we create the state to support SSR and allow for later mounting
* in view libraries.
*
* @ts-ignore
*/
let element;
/**
* Calculate a depth that we can use to order motion states by tree depth.
*/
let depth = parent ? parent.getDepth() + 1 : 0;
/**
* Track which states are currently active.
*/
const activeStates = {
initial: true,
animate: true
};
/**
* A map of functions that, when called, will remove event listeners for
* a given gesture.
*/
const gestureSubscriptions = {};
/**
* Initialise a context to share through motion states. This
* will be populated by variant names (if any).
*/
const context = {};
for (const name of stateTypes) {
context[name] = typeof options[name] === "string" ? options[name] : parent === null || parent === void 0 ? void 0 : parent.getContext()[name];
}
/**
* If initial is set to false we use the animate prop as the initial
* animation state.
*/
const initialVariantSource = options.initial === false ? "animate" : "initial";
/**
* Destructure an initial target out from the resolved initial variant.
*/
let _a = (0, _resolveVariantEs.resolveVariant)(options[initialVariantSource] || context[initialVariantSource], options.variants) || {},
target = (0, _tslib.__rest)(_a, ["transition"]);
/**
* The base target is a cached map of values that we'll use to animate
* back to if a value is removed from all active state types. This
* is usually the initial value as read from the DOM, for instance if
* it hasn't been defined in initial.
*/
const baseTarget = Object.assign({}, target);
/**
* A generator that will be processed by the global animation scheduler.
* This yeilds when it switches from reading the DOM to writing to it
* to prevent layout thrashing.
*/
function* animateUpdates() {
var _a, _b;
const prevTarget = target;
target = {};
const animationOptions = {};
for (const name of stateTypes) {
if (!activeStates[name]) continue;
const variant = (0, _resolveVariantEs.resolveVariant)(options[name]);
if (!variant) continue;
for (const key in variant) {
if (key === "transition") continue;
target[key] = variant[key];
animationOptions[key] = (0, _optionsEs.getOptions)((_b = (_a = variant.transition) !== null && _a !== void 0 ? _a : options.transition) !== null && _b !== void 0 ? _b : {}, key);
}
}
const allTargetKeys = new Set([...Object.keys(target), ...Object.keys(prevTarget)]);
const animationFactories = [];
allTargetKeys.forEach(key => {
var _a;
if (target[key] === undefined) {
target[key] = baseTarget[key];
}
if ((0, _hasChangedEs.hasChanged)(prevTarget[key], target[key])) {
(_a = baseTarget[key]) !== null && _a !== void 0 ? _a : baseTarget[key] = _styleEs.style.get(element, key);
animationFactories.push((0, _animateStyleEs.animateStyle)(element, key, target[key], animationOptions[key]));
}
});
// Wait for all animation states to read from the DOM
yield;
const animations = animationFactories.map(factory => factory()).filter(Boolean);
if (!animations.length) return;
const animationTarget = target;
element.dispatchEvent((0, _eventsEs.motionEvent)("motionstart", animationTarget));
Promise.all(animations.map(animation => animation.finished)).then(() => {
element.dispatchEvent((0, _eventsEs.motionEvent)("motioncomplete", animationTarget));
}).catch(_utils.noop);
}
const setGesture = (name, isActive) => () => {
activeStates[name] = isActive;
(0, _scheduleEs.scheduleAnimation)(state);
};
const updateGestureSubscriptions = () => {
for (const name in gestures) {
const isGestureActive = gestures[name].isActive(options);
const remove = gestureSubscriptions[name];
if (isGestureActive && !remove) {
gestureSubscriptions[name] = gestures[name].subscribe(element, {
enable: setGesture(name, true),
disable: setGesture(name, false)
}, options);
} else if (!isGestureActive && remove) {
remove();
delete gestureSubscriptions[name];
}
}
};
const state = {
update: newOptions => {
if (!element) return;
options = newOptions;
updateGestureSubscriptions();
(0, _scheduleEs.scheduleAnimation)(state);
},
setActive: (name, isActive) => {
if (!element) return;
activeStates[name] = isActive;
(0, _scheduleEs.scheduleAnimation)(state);
},
animateUpdates,
getDepth: () => depth,
getTarget: () => target,
getOptions: () => options,
getContext: () => context,
mount: newElement => {
(0, _heyListen.invariant)(Boolean(newElement), "Animation state must be mounted with valid Element");
element = newElement;
mountedStates.set(element, state);
updateGestureSubscriptions();
return () => {
mountedStates.delete(element);
(0, _scheduleEs.unscheduleAnimation)(state);
for (const key in gestureSubscriptions) {
gestureSubscriptions[key]();
}
};
},
isMounted: () => Boolean(element)
};
return state;
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/state/utils/events.es.js":
/*!**************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/state/utils/events.es.js ***!
\**************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.dispatchPointerEvent = dispatchPointerEvent;
exports.dispatchViewEvent = dispatchViewEvent;
exports.motionEvent = void 0;
const motionEvent = (name, target) => new CustomEvent(name, {
detail: {
target
}
});
exports.motionEvent = motionEvent;
function dispatchPointerEvent(element, name, event) {
element.dispatchEvent(new CustomEvent(name, {
detail: {
originalEvent: event
}
}));
}
function dispatchViewEvent(element, name, entry) {
element.dispatchEvent(new CustomEvent(name, {
detail: {
originalEntry: entry
}
}));
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/state/utils/has-changed.es.js":
/*!*******************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/state/utils/has-changed.es.js ***!
\*******************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.hasChanged = hasChanged;
exports.shallowCompare = shallowCompare;
function hasChanged(a, b) {
if (typeof a !== typeof b) return true;
if (Array.isArray(a) && Array.isArray(b)) return !shallowCompare(a, b);
return a !== b;
}
function shallowCompare(next, prev) {
const prevLength = prev.length;
if (prevLength !== next.length) return false;
for (let i = 0; i < prevLength; i++) {
if (prev[i] !== next[i]) return false;
}
return true;
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/state/utils/is-variant.es.js":
/*!******************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/state/utils/is-variant.es.js ***!
\******************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isVariant = isVariant;
function isVariant(definition) {
return typeof definition === "object";
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/state/utils/resolve-variant.es.js":
/*!***********************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/state/utils/resolve-variant.es.js ***!
\***********************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.resolveVariant = resolveVariant;
var _isVariantEs = __webpack_require__(/*! ./is-variant.es.js */ "../../../node_modules/@motionone/dom/dist/state/utils/is-variant.es.js");
function resolveVariant(definition, variants) {
if ((0, _isVariantEs.isVariant)(definition)) {
return definition;
} else if (definition && variants) {
return variants[definition];
}
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/state/utils/schedule.es.js":
/*!****************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/state/utils/schedule.es.js ***!
\****************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.scheduleAnimation = scheduleAnimation;
exports.unscheduleAnimation = unscheduleAnimation;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
let scheduled = undefined;
function processScheduledAnimations() {
if (!scheduled) return;
const generators = scheduled.sort(compareByDepth).map(fireAnimateUpdates);
generators.forEach(fireNext);
generators.forEach(fireNext);
scheduled = undefined;
}
function scheduleAnimation(state) {
if (!scheduled) {
scheduled = [state];
requestAnimationFrame(processScheduledAnimations);
} else {
(0, _utils.addUniqueItem)(scheduled, state);
}
}
function unscheduleAnimation(state) {
scheduled && (0, _utils.removeItem)(scheduled, state);
}
const compareByDepth = (a, b) => a.getDepth() - b.getDepth();
const fireAnimateUpdates = state => state.animateUpdates();
const fireNext = iterator => iterator.next();
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/timeline/index.es.js":
/*!**********************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/timeline/index.es.js ***!
\**********************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.createAnimationsFromTimeline = createAnimationsFromTimeline;
exports.timeline = timeline;
var _tslib = __webpack_require__(/*! tslib */ "../../../node_modules/tslib/tslib.es6.js");
var _heyListen = __webpack_require__(/*! hey-listen */ "../../../node_modules/hey-listen/dist/hey-listen.es.js");
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _staggerEs = __webpack_require__(/*! ../utils/stagger.es.js */ "../../../node_modules/@motionone/dom/dist/utils/stagger.es.js");
var _animateStyleEs = __webpack_require__(/*! ../animate/animate-style.es.js */ "../../../node_modules/@motionone/dom/dist/animate/animate-style.es.js");
var _controlsEs = __webpack_require__(/*! ../animate/utils/controls.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/controls.es.js");
var _keyframesEs = __webpack_require__(/*! ../animate/utils/keyframes.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/keyframes.es.js");
var _optionsEs = __webpack_require__(/*! ../animate/utils/options.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/options.es.js");
var _resolveElementsEs = __webpack_require__(/*! ../utils/resolve-elements.es.js */ "../../../node_modules/@motionone/dom/dist/utils/resolve-elements.es.js");
var _transformsEs = __webpack_require__(/*! ../animate/utils/transforms.es.js */ "../../../node_modules/@motionone/dom/dist/animate/utils/transforms.es.js");
var _calcTimeEs = __webpack_require__(/*! ./utils/calc-time.es.js */ "../../../node_modules/@motionone/dom/dist/timeline/utils/calc-time.es.js");
var _editEs = __webpack_require__(/*! ./utils/edit.es.js */ "../../../node_modules/@motionone/dom/dist/timeline/utils/edit.es.js");
var _sortEs = __webpack_require__(/*! ./utils/sort.es.js */ "../../../node_modules/@motionone/dom/dist/timeline/utils/sort.es.js");
function timeline(definition) {
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _a;
const animationDefinitions = createAnimationsFromTimeline(definition, options);
/**
* Create and start animations
*/
const animationFactories = animationDefinitions.map(definition => (0, _animateStyleEs.animateStyle)(...definition)).filter(Boolean);
return (0, _controlsEs.withControls)(animationFactories, options,
// Get the duration from the first animation definition
(_a = animationDefinitions[0]) === null || _a === void 0 ? void 0 : _a[3].duration);
}
function createAnimationsFromTimeline(definition) {
let _a = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var {
defaultOptions = {}
} = _a,
timelineOptions = (0, _tslib.__rest)(_a, ["defaultOptions"]);
const animationDefinitions = [];
const elementSequences = new Map();
const elementCache = {};
const timeLabels = new Map();
let prevTime = 0;
let currentTime = 0;
let totalDuration = 0;
/**
* Build the timeline by mapping over the definition array and converting
* the definitions into keyframes and offsets with absolute time values.
* These will later get converted into relative offsets in a second pass.
*/
for (let i = 0; i < definition.length; i++) {
const segment = definition[i];
/**
* If this is a timeline label, mark it and skip the rest of this iteration.
*/
if ((0, _utils.isString)(segment)) {
timeLabels.set(segment, currentTime);
continue;
} else if (!Array.isArray(segment)) {
timeLabels.set(segment.name, (0, _calcTimeEs.calcNextTime)(currentTime, segment.at, prevTime, timeLabels));
continue;
}
const [elementDefinition, keyframes, options = {}] = segment;
/**
* If a relative or absolute time value has been specified we need to resolve
* it in relation to the currentTime.
*/
if (options.at !== undefined) {
currentTime = (0, _calcTimeEs.calcNextTime)(currentTime, options.at, prevTime, timeLabels);
}
/**
* Keep track of the maximum duration in this definition. This will be
* applied to currentTime once the definition has been parsed.
*/
let maxDuration = 0;
/**
* Find all the elements specified in the definition and parse value
* keyframes from their timeline definitions.
*/
const elements = (0, _resolveElementsEs.resolveElements)(elementDefinition, elementCache);
const numElements = elements.length;
for (let elementIndex = 0; elementIndex < numElements; elementIndex++) {
const element = elements[elementIndex];
const elementSequence = getElementSequence(element, elementSequences);
for (const key in keyframes) {
const valueSequence = getValueSequence(key, elementSequence);
let valueKeyframes = (0, _keyframesEs.keyframesList)(keyframes[key]);
const valueOptions = (0, _optionsEs.getOptions)(options, key);
let {
duration = defaultOptions.duration || _utils.defaults.duration,
easing = defaultOptions.easing || _utils.defaults.easing
} = valueOptions;
if ((0, _utils.isEasingGenerator)(easing)) {
const valueIsTransform = (0, _transformsEs.isTransform)(key);
(0, _heyListen.invariant)(valueKeyframes.length === 2 || !valueIsTransform, "spring must be provided 2 keyframes within timeline");
const custom = easing.createAnimation(valueKeyframes,
// TODO We currently only support explicit keyframes
// so this doesn't currently read from the DOM
() => "0", valueIsTransform);
easing = custom.easing;
if (custom.keyframes !== undefined) valueKeyframes = custom.keyframes;
if (custom.duration !== undefined) duration = custom.duration;
}
const delay = (0, _staggerEs.resolveOption)(options.delay, elementIndex, numElements) || 0;
const startTime = currentTime + delay;
const targetTime = startTime + duration;
/**
*
*/
let {
offset = (0, _utils.defaultOffset)(valueKeyframes.length)
} = valueOptions;
/**
* If there's only one offset of 0, fill in a second with length 1
*
* TODO: Ensure there's a test that covers this removal
*/
if (offset.length === 1 && offset[0] === 0) {
offset[1] = 1;
}
/**
* Fill out if offset if fewer offsets than keyframes
*/
const remainder = length - valueKeyframes.length;
remainder > 0 && (0, _utils.fillOffset)(offset, remainder);
/**
* If only one value has been set, ie [1], push a null to the start of
* the keyframe array. This will let us mark a keyframe at this point
* that will later be hydrated with the previous value.
*/
valueKeyframes.length === 1 && valueKeyframes.unshift(null);
/**
* Add keyframes, mapping offsets to absolute time.
*/
(0, _editEs.addKeyframes)(valueSequence, valueKeyframes, easing, offset, startTime, targetTime);
maxDuration = Math.max(delay + duration, maxDuration);
totalDuration = Math.max(targetTime, totalDuration);
}
}
prevTime = currentTime;
currentTime += maxDuration;
}
/**
* For every element and value combination create a new animation.
*/
elementSequences.forEach((valueSequences, element) => {
for (const key in valueSequences) {
const valueSequence = valueSequences[key];
/**
* Arrange all the keyframes in ascending time order.
*/
valueSequence.sort(_sortEs.compareByTime);
const keyframes = [];
const valueOffset = [];
const valueEasing = [];
/**
* For each keyframe, translate absolute times into
* relative offsets based on the total duration of the timeline.
*/
for (let i = 0; i < valueSequence.length; i++) {
const {
at,
value,
easing
} = valueSequence[i];
keyframes.push(value);
valueOffset.push((0, _utils.progress)(0, totalDuration, at));
valueEasing.push(easing || _utils.defaults.easing);
}
/**
* If the first keyframe doesn't land on offset: 0
* provide one by duplicating the initial keyframe. This ensures
* it snaps to the first keyframe when the animation starts.
*/
if (valueOffset[0] !== 0) {
valueOffset.unshift(0);
keyframes.unshift(keyframes[0]);
valueEasing.unshift("linear");
}
/**
* If the last keyframe doesn't land on offset: 1
* provide one with a null wildcard value. This will ensure it
* stays static until the end of the animation.
*/
if (valueOffset[valueOffset.length - 1] !== 1) {
valueOffset.push(1);
keyframes.push(null);
}
animationDefinitions.push([element, key, keyframes, Object.assign(Object.assign(Object.assign({}, defaultOptions), {
duration: totalDuration,
easing: valueEasing,
offset: valueOffset
}), timelineOptions)]);
}
});
return animationDefinitions;
}
function getElementSequence(element, sequences) {
!sequences.has(element) && sequences.set(element, {});
return sequences.get(element);
}
function getValueSequence(name, sequences) {
if (!sequences[name]) sequences[name] = [];
return sequences[name];
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/timeline/utils/calc-time.es.js":
/*!********************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/timeline/utils/calc-time.es.js ***!
\********************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.calcNextTime = calcNextTime;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
function calcNextTime(current, next, prev, labels) {
var _a;
if ((0, _utils.isNumber)(next)) {
return next;
} else if (next.startsWith("-") || next.startsWith("+")) {
return Math.max(0, current + parseFloat(next));
} else if (next === "<") {
return prev;
} else {
return (_a = labels.get(next)) !== null && _a !== void 0 ? _a : current;
}
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/timeline/utils/edit.es.js":
/*!***************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/timeline/utils/edit.es.js ***!
\***************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.addKeyframes = addKeyframes;
exports.eraseKeyframes = eraseKeyframes;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
function eraseKeyframes(sequence, startTime, endTime) {
for (let i = 0; i < sequence.length; i++) {
const keyframe = sequence[i];
if (keyframe.at > startTime && keyframe.at < endTime) {
(0, _utils.removeItem)(sequence, keyframe);
// If we remove this item we have to push the pointer back one
i--;
}
}
}
function addKeyframes(sequence, keyframes, easing, offset, startTime, endTime) {
/**
* Erase every existing value between currentTime and targetTime,
* this will essentially splice this timeline into any currently
* defined ones.
*/
eraseKeyframes(sequence, startTime, endTime);
for (let i = 0; i < keyframes.length; i++) {
sequence.push({
value: keyframes[i],
at: (0, _utils.mix)(startTime, endTime, offset[i]),
easing: (0, _utils.getEasingForSegment)(easing, i)
});
}
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/timeline/utils/sort.es.js":
/*!***************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/timeline/utils/sort.es.js ***!
\***************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.compareByTime = compareByTime;
function compareByTime(a, b) {
if (a.at === b.at) {
return a.value === null ? 1 : -1;
} else {
return a.at - b.at;
}
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/utils/resolve-elements.es.js":
/*!******************************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/utils/resolve-elements.es.js ***!
\******************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.resolveElements = resolveElements;
function resolveElements(elements, selectorCache) {
var _a;
if (typeof elements === "string") {
if (selectorCache) {
(_a = selectorCache[elements]) !== null && _a !== void 0 ? _a : selectorCache[elements] = document.querySelectorAll(elements);
elements = selectorCache[elements];
} else {
elements = document.querySelectorAll(elements);
}
} else if (elements instanceof Element) {
elements = [elements];
}
/**
* Return an empty array
*/
return Array.from(elements || []);
}
/***/ }),
/***/ "../../../node_modules/@motionone/dom/dist/utils/stagger.es.js":
/*!*********************************************************************!*\
!*** ../../../node_modules/@motionone/dom/dist/utils/stagger.es.js ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.getFromIndex = getFromIndex;
exports.resolveOption = resolveOption;
exports.stagger = stagger;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _animation = __webpack_require__(/*! @motionone/animation */ "../../../node_modules/@motionone/animation/dist/index.es.js");
function stagger() {
let duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.1;
let {
start = 0,
from = 0,
easing
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return (i, total) => {
const fromIndex = (0, _utils.isNumber)(from) ? from : getFromIndex(from, total);
const distance = Math.abs(fromIndex - i);
let delay = duration * distance;
if (easing) {
const maxDelay = total * duration;
const easingFunction = (0, _animation.getEasingFunction)(easing);
delay = easingFunction(delay / maxDelay) * maxDelay;
}
return start + delay;
};
}
function getFromIndex(from, total) {
if (from === "first") {
return 0;
} else {
const lastIndex = total - 1;
return from === "last" ? lastIndex : lastIndex / 2;
}
}
function resolveOption(option, i, total) {
return typeof option === "function" ? option(i, total) : option;
}
/***/ }),
/***/ "../../../node_modules/@motionone/easing/dist/cubic-bezier.es.js":
/*!***********************************************************************!*\
!*** ../../../node_modules/@motionone/easing/dist/cubic-bezier.es.js ***!
\***********************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.cubicBezier = cubicBezier;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
/*
Bezier function generator
This has been modified from Gaëtan Renaudeau's BezierEasing
https://github.com/gre/bezier-easing/blob/master/src/index.js
https://github.com/gre/bezier-easing/blob/master/LICENSE
I've removed the newtonRaphsonIterate algo because in benchmarking it
wasn't noticiably faster than binarySubdivision, indeed removing it
usually improved times, depending on the curve.
I also removed the lookup table, as for the added bundle size and loop we're
only cutting ~4 or so subdivision iterations. I bumped the max iterations up
to 12 to compensate and this still tended to be faster for no perceivable
loss in accuracy.
Usage
const easeOut = cubicBezier(.17,.67,.83,.67);
const x = easeOut(0.5); // returns 0.627...
*/
// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
const calcBezier = (t, a1, a2) => (((1.0 - 3.0 * a2 + 3.0 * a1) * t + (3.0 * a2 - 6.0 * a1)) * t + 3.0 * a1) * t;
const subdivisionPrecision = 0.0000001;
const subdivisionMaxIterations = 12;
function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) {
let currentX;
let currentT;
let i = 0;
do {
currentT = lowerBound + (upperBound - lowerBound) / 2.0;
currentX = calcBezier(currentT, mX1, mX2) - x;
if (currentX > 0.0) {
upperBound = currentT;
} else {
lowerBound = currentT;
}
} while (Math.abs(currentX) > subdivisionPrecision && ++i < subdivisionMaxIterations);
return currentT;
}
function cubicBezier(mX1, mY1, mX2, mY2) {
// If this is a linear gradient, return linear easing
if (mX1 === mY1 && mX2 === mY2) return _utils.noopReturn;
const getTForX = aX => binarySubdivide(aX, 0, 1, mX1, mX2);
// If animation is at start/end, return t without easing
return t => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
}
/***/ }),
/***/ "../../../node_modules/@motionone/easing/dist/index.es.js":
/*!****************************************************************!*\
!*** ../../../node_modules/@motionone/easing/dist/index.es.js ***!
\****************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "cubicBezier", ({
enumerable: true,
get: function () {
return _cubicBezierEs.cubicBezier;
}
}));
Object.defineProperty(exports, "steps", ({
enumerable: true,
get: function () {
return _stepsEs.steps;
}
}));
var _cubicBezierEs = __webpack_require__(/*! ./cubic-bezier.es.js */ "../../../node_modules/@motionone/easing/dist/cubic-bezier.es.js");
var _stepsEs = __webpack_require__(/*! ./steps.es.js */ "../../../node_modules/@motionone/easing/dist/steps.es.js");
/***/ }),
/***/ "../../../node_modules/@motionone/easing/dist/steps.es.js":
/*!****************************************************************!*\
!*** ../../../node_modules/@motionone/easing/dist/steps.es.js ***!
\****************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.steps = void 0;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
const steps = function (steps) {
let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "end";
return progress => {
progress = direction === "end" ? Math.min(progress, 0.999) : Math.max(progress, 0.001);
const expanded = progress * steps;
const rounded = direction === "end" ? Math.floor(expanded) : Math.ceil(expanded);
return (0, _utils.clamp)(0, 1, rounded / steps);
};
};
exports.steps = steps;
/***/ }),
/***/ "../../../node_modules/@motionone/generators/dist/glide/index.es.js":
/*!**************************************************************************!*\
!*** ../../../node_modules/@motionone/generators/dist/glide/index.es.js ***!
\**************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.glide = void 0;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _velocityEs = __webpack_require__(/*! ../utils/velocity.es.js */ "../../../node_modules/@motionone/generators/dist/utils/velocity.es.js");
var _indexEs = __webpack_require__(/*! ../spring/index.es.js */ "../../../node_modules/@motionone/generators/dist/spring/index.es.js");
const glide = _ref => {
let {
from = 0,
velocity = 0.0,
power = 0.8,
decay = 0.325,
bounceDamping,
bounceStiffness,
changeTarget,
min,
max,
restDistance = 0.5,
restSpeed
} = _ref;
decay = _utils.time.ms(decay);
const state = {
hasReachedTarget: false,
done: false,
current: from,
target: from
};
const isOutOfBounds = v => min !== undefined && v < min || max !== undefined && v > max;
const nearestBoundary = v => {
if (min === undefined) return max;
if (max === undefined) return min;
return Math.abs(min - v) < Math.abs(max - v) ? min : max;
};
let amplitude = power * velocity;
const ideal = from + amplitude;
const target = changeTarget === undefined ? ideal : changeTarget(ideal);
state.target = target;
/**
* If the target has changed we need to re-calculate the amplitude, otherwise
* the animation will start from the wrong position.
*/
if (target !== ideal) amplitude = target - from;
const calcDelta = t => -amplitude * Math.exp(-t / decay);
const calcLatest = t => target + calcDelta(t);
const applyFriction = t => {
const delta = calcDelta(t);
const latest = calcLatest(t);
state.done = Math.abs(delta) <= restDistance;
state.current = state.done ? target : latest;
};
/**
* Ideally this would resolve for t in a stateless way, we could
* do that by always precalculating the animation but as we know
* this will be done anyway we can assume that spring will
* be discovered during that.
*/
let timeReachedBoundary;
let spring$1;
const checkCatchBoundary = t => {
if (!isOutOfBounds(state.current)) return;
timeReachedBoundary = t;
spring$1 = (0, _indexEs.spring)({
from: state.current,
to: nearestBoundary(state.current),
velocity: (0, _velocityEs.calcGeneratorVelocity)(calcLatest, t, state.current),
damping: bounceDamping,
stiffness: bounceStiffness,
restDistance,
restSpeed
});
};
checkCatchBoundary(0);
return t => {
/**
* We need to resolve the friction to figure out if we need a
* spring but we don't want to do this twice per frame. So here
* we flag if we updated for this frame and later if we did
* we can skip doing it again.
*/
let hasUpdatedFrame = false;
if (!spring$1 && timeReachedBoundary === undefined) {
hasUpdatedFrame = true;
applyFriction(t);
checkCatchBoundary(t);
}
/**
* If we have a spring and the provided t is beyond the moment the friction
* animation crossed the min/max boundary, use the spring.
*/
if (timeReachedBoundary !== undefined && t > timeReachedBoundary) {
state.hasReachedTarget = true;
return spring$1(t - timeReachedBoundary);
} else {
state.hasReachedTarget = false;
!hasUpdatedFrame && applyFriction(t);
return state;
}
};
};
exports.glide = glide;
/***/ }),
/***/ "../../../node_modules/@motionone/generators/dist/index.es.js":
/*!********************************************************************!*\
!*** ../../../node_modules/@motionone/generators/dist/index.es.js ***!
\********************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "calcGeneratorVelocity", ({
enumerable: true,
get: function () {
return _velocityEs.calcGeneratorVelocity;
}
}));
Object.defineProperty(exports, "glide", ({
enumerable: true,
get: function () {
return _indexEs.glide;
}
}));
Object.defineProperty(exports, "pregenerateKeyframes", ({
enumerable: true,
get: function () {
return _pregenerateKeyframesEs.pregenerateKeyframes;
}
}));
Object.defineProperty(exports, "spring", ({
enumerable: true,
get: function () {
return _indexEs2.spring;
}
}));
var _indexEs = __webpack_require__(/*! ./glide/index.es.js */ "../../../node_modules/@motionone/generators/dist/glide/index.es.js");
var _indexEs2 = __webpack_require__(/*! ./spring/index.es.js */ "../../../node_modules/@motionone/generators/dist/spring/index.es.js");
var _pregenerateKeyframesEs = __webpack_require__(/*! ./utils/pregenerate-keyframes.es.js */ "../../../node_modules/@motionone/generators/dist/utils/pregenerate-keyframes.es.js");
var _velocityEs = __webpack_require__(/*! ./utils/velocity.es.js */ "../../../node_modules/@motionone/generators/dist/utils/velocity.es.js");
/***/ }),
/***/ "../../../node_modules/@motionone/generators/dist/spring/defaults.es.js":
/*!******************************************************************************!*\
!*** ../../../node_modules/@motionone/generators/dist/spring/defaults.es.js ***!
\******************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.defaults = void 0;
const defaults = {
stiffness: 100.0,
damping: 10.0,
mass: 1.0
};
exports.defaults = defaults;
/***/ }),
/***/ "../../../node_modules/@motionone/generators/dist/spring/index.es.js":
/*!***************************************************************************!*\
!*** ../../../node_modules/@motionone/generators/dist/spring/index.es.js ***!
\***************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.spring = void 0;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
var _defaultsEs = __webpack_require__(/*! ./defaults.es.js */ "../../../node_modules/@motionone/generators/dist/spring/defaults.es.js");
var _utilsEs = __webpack_require__(/*! ./utils.es.js */ "../../../node_modules/@motionone/generators/dist/spring/utils.es.js");
var _hasReachedTargetEs = __webpack_require__(/*! ../utils/has-reached-target.es.js */ "../../../node_modules/@motionone/generators/dist/utils/has-reached-target.es.js");
var _velocityEs = __webpack_require__(/*! ../utils/velocity.es.js */ "../../../node_modules/@motionone/generators/dist/utils/velocity.es.js");
const spring = function () {
let {
stiffness = _defaultsEs.defaults.stiffness,
damping = _defaultsEs.defaults.damping,
mass = _defaultsEs.defaults.mass,
from = 0,
to = 1,
velocity = 0.0,
restSpeed = 2,
restDistance = 0.5
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
velocity = velocity ? _utils.time.s(velocity) : 0.0;
const state = {
done: false,
hasReachedTarget: false,
current: from,
target: to
};
const initialDelta = to - from;
const undampedAngularFreq = Math.sqrt(stiffness / mass) / 1000;
const dampingRatio = (0, _utilsEs.calcDampingRatio)(stiffness, damping, mass);
let resolveSpring;
if (dampingRatio < 1) {
const angularFreq = undampedAngularFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
// Underdamped spring (bouncy)
resolveSpring = t => to - Math.exp(-dampingRatio * undampedAngularFreq * t) * ((-velocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq * t) + initialDelta * Math.cos(angularFreq * t));
} else {
// Critically damped spring
resolveSpring = t => {
return to - Math.exp(-undampedAngularFreq * t) * (initialDelta + (-velocity + undampedAngularFreq * initialDelta) * t);
};
}
return t => {
state.current = resolveSpring(t);
const currentVelocity = t === 0 ? velocity : (0, _velocityEs.calcGeneratorVelocity)(resolveSpring, t, state.current);
const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
const isBelowDisplacementThreshold = Math.abs(to - state.current) <= restDistance;
state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold;
state.hasReachedTarget = (0, _hasReachedTargetEs.hasReachedTarget)(from, to, state.current);
return state;
};
};
exports.spring = spring;
/***/ }),
/***/ "../../../node_modules/@motionone/generators/dist/spring/utils.es.js":
/*!***************************************************************************!*\
!*** ../../../node_modules/@motionone/generators/dist/spring/utils.es.js ***!
\***************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.calcDampingRatio = void 0;
var _defaultsEs = __webpack_require__(/*! ./defaults.es.js */ "../../../node_modules/@motionone/generators/dist/spring/defaults.es.js");
const calcDampingRatio = function () {
let stiffness = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _defaultsEs.defaults.stiffness;
let damping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _defaultsEs.defaults.damping;
let mass = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _defaultsEs.defaults.mass;
return damping / (2 * Math.sqrt(stiffness * mass));
};
exports.calcDampingRatio = calcDampingRatio;
/***/ }),
/***/ "../../../node_modules/@motionone/generators/dist/utils/has-reached-target.es.js":
/*!***************************************************************************************!*\
!*** ../../../node_modules/@motionone/generators/dist/utils/has-reached-target.es.js ***!
\***************************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.hasReachedTarget = hasReachedTarget;
function hasReachedTarget(origin, target, current) {
return origin < target && current >= target || origin > target && current <= target;
}
/***/ }),
/***/ "../../../node_modules/@motionone/generators/dist/utils/pregenerate-keyframes.es.js":
/*!******************************************************************************************!*\
!*** ../../../node_modules/@motionone/generators/dist/utils/pregenerate-keyframes.es.js ***!
\******************************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.pregenerateKeyframes = pregenerateKeyframes;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
const timeStep = 10;
const maxDuration = 10000;
function pregenerateKeyframes(generator) {
let toUnit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _utils.noopReturn;
let overshootDuration = undefined;
let timestamp = timeStep;
let state = generator(0);
const keyframes = [toUnit(state.current)];
while (!state.done && timestamp < maxDuration) {
state = generator(timestamp);
keyframes.push(toUnit(state.done ? state.target : state.current));
if (overshootDuration === undefined && state.hasReachedTarget) {
overshootDuration = timestamp;
}
timestamp += timeStep;
}
const duration = timestamp - timeStep;
/**
* If generating an animation that didn't actually move,
* generate a second keyframe so we have an origin and target.
*/
if (keyframes.length === 1) keyframes.push(state.current);
return {
keyframes,
duration: duration / 1000,
overshootDuration: (overshootDuration !== null && overshootDuration !== void 0 ? overshootDuration : duration) / 1000
};
}
/***/ }),
/***/ "../../../node_modules/@motionone/generators/dist/utils/velocity.es.js":
/*!*****************************************************************************!*\
!*** ../../../node_modules/@motionone/generators/dist/utils/velocity.es.js ***!
\*****************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.calcGeneratorVelocity = calcGeneratorVelocity;
var _utils = __webpack_require__(/*! @motionone/utils */ "../../../node_modules/@motionone/utils/dist/index.es.js");
const sampleT = 5; // ms
function calcGeneratorVelocity(resolveValue, t, current) {
const prevT = Math.max(t - sampleT, 0);
return (0, _utils.velocityPerSecond)(current - resolveValue(prevT), t - prevT);
}
/***/ }),
/***/ "../../../node_modules/@motionone/types/dist/MotionValue.es.js":
/*!*********************************************************************!*\
!*** ../../../node_modules/@motionone/types/dist/MotionValue.es.js ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.MotionValue = void 0;
/**
* The MotionValue tracks the state of a single animatable
* value. Currently, updatedAt and current are unused. The
* long term idea is to use this to minimise the number
* of DOM reads, and to abstract the DOM interactions here.
*/
class MotionValue {
setAnimation(animation) {
this.animation = animation;
animation === null || animation === void 0 ? void 0 : animation.finished.then(() => this.clearAnimation()).catch(() => {});
}
clearAnimation() {
this.animation = this.generator = undefined;
}
}
exports.MotionValue = MotionValue;
/***/ }),
/***/ "../../../node_modules/@motionone/types/dist/index.es.js":
/*!***************************************************************!*\
!*** ../../../node_modules/@motionone/types/dist/index.es.js ***!
\***************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "MotionValue", ({
enumerable: true,
get: function () {
return _MotionValueEs.MotionValue;
}
}));
var _MotionValueEs = __webpack_require__(/*! ./MotionValue.es.js */ "../../../node_modules/@motionone/types/dist/MotionValue.es.js");
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/array.es.js":
/*!***************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/array.es.js ***!
\***************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.addUniqueItem = addUniqueItem;
exports.removeItem = removeItem;
function addUniqueItem(array, item) {
array.indexOf(item) === -1 && array.push(item);
}
function removeItem(arr, item) {
const index = arr.indexOf(item);
index > -1 && arr.splice(index, 1);
}
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/clamp.es.js":
/*!***************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/clamp.es.js ***!
\***************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.clamp = void 0;
const clamp = (min, max, v) => Math.min(Math.max(v, min), max);
exports.clamp = clamp;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/defaults.es.js":
/*!******************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/defaults.es.js ***!
\******************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.defaults = void 0;
const defaults = {
duration: 0.3,
delay: 0,
endDelay: 0,
repeat: 0,
easing: "ease"
};
exports.defaults = defaults;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/easing.es.js":
/*!****************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/easing.es.js ***!
\****************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.getEasingForSegment = getEasingForSegment;
var _isEasingListEs = __webpack_require__(/*! ./is-easing-list.es.js */ "../../../node_modules/@motionone/utils/dist/is-easing-list.es.js");
var _wrapEs = __webpack_require__(/*! ./wrap.es.js */ "../../../node_modules/@motionone/utils/dist/wrap.es.js");
function getEasingForSegment(easing, i) {
return (0, _isEasingListEs.isEasingList)(easing) ? easing[(0, _wrapEs.wrap)(0, easing.length, i)] : easing;
}
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/index.es.js":
/*!***************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/index.es.js ***!
\***************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
Object.defineProperty(exports, "addUniqueItem", ({
enumerable: true,
get: function () {
return _arrayEs.addUniqueItem;
}
}));
Object.defineProperty(exports, "clamp", ({
enumerable: true,
get: function () {
return _clampEs.clamp;
}
}));
Object.defineProperty(exports, "defaultOffset", ({
enumerable: true,
get: function () {
return _offsetEs.defaultOffset;
}
}));
Object.defineProperty(exports, "defaults", ({
enumerable: true,
get: function () {
return _defaultsEs.defaults;
}
}));
Object.defineProperty(exports, "fillOffset", ({
enumerable: true,
get: function () {
return _offsetEs.fillOffset;
}
}));
Object.defineProperty(exports, "getEasingForSegment", ({
enumerable: true,
get: function () {
return _easingEs.getEasingForSegment;
}
}));
Object.defineProperty(exports, "interpolate", ({
enumerable: true,
get: function () {
return _interpolateEs.interpolate;
}
}));
Object.defineProperty(exports, "isCubicBezier", ({
enumerable: true,
get: function () {
return _isCubicBezierEs.isCubicBezier;
}
}));
Object.defineProperty(exports, "isEasingGenerator", ({
enumerable: true,
get: function () {
return _isEasingGeneratorEs.isEasingGenerator;
}
}));
Object.defineProperty(exports, "isEasingList", ({
enumerable: true,
get: function () {
return _isEasingListEs.isEasingList;
}
}));
Object.defineProperty(exports, "isFunction", ({
enumerable: true,
get: function () {
return _isFunctionEs.isFunction;
}
}));
Object.defineProperty(exports, "isNumber", ({
enumerable: true,
get: function () {
return _isNumberEs.isNumber;
}
}));
Object.defineProperty(exports, "isString", ({
enumerable: true,
get: function () {
return _isStringEs.isString;
}
}));
Object.defineProperty(exports, "mix", ({
enumerable: true,
get: function () {
return _mixEs.mix;
}
}));
Object.defineProperty(exports, "noop", ({
enumerable: true,
get: function () {
return _noopEs.noop;
}
}));
Object.defineProperty(exports, "noopReturn", ({
enumerable: true,
get: function () {
return _noopEs.noopReturn;
}
}));
Object.defineProperty(exports, "progress", ({
enumerable: true,
get: function () {
return _progressEs.progress;
}
}));
Object.defineProperty(exports, "removeItem", ({
enumerable: true,
get: function () {
return _arrayEs.removeItem;
}
}));
Object.defineProperty(exports, "time", ({
enumerable: true,
get: function () {
return _timeEs.time;
}
}));
Object.defineProperty(exports, "velocityPerSecond", ({
enumerable: true,
get: function () {
return _velocityEs.velocityPerSecond;
}
}));
Object.defineProperty(exports, "wrap", ({
enumerable: true,
get: function () {
return _wrapEs.wrap;
}
}));
var _arrayEs = __webpack_require__(/*! ./array.es.js */ "../../../node_modules/@motionone/utils/dist/array.es.js");
var _clampEs = __webpack_require__(/*! ./clamp.es.js */ "../../../node_modules/@motionone/utils/dist/clamp.es.js");
var _defaultsEs = __webpack_require__(/*! ./defaults.es.js */ "../../../node_modules/@motionone/utils/dist/defaults.es.js");
var _easingEs = __webpack_require__(/*! ./easing.es.js */ "../../../node_modules/@motionone/utils/dist/easing.es.js");
var _interpolateEs = __webpack_require__(/*! ./interpolate.es.js */ "../../../node_modules/@motionone/utils/dist/interpolate.es.js");
var _isCubicBezierEs = __webpack_require__(/*! ./is-cubic-bezier.es.js */ "../../../node_modules/@motionone/utils/dist/is-cubic-bezier.es.js");
var _isEasingGeneratorEs = __webpack_require__(/*! ./is-easing-generator.es.js */ "../../../node_modules/@motionone/utils/dist/is-easing-generator.es.js");
var _isEasingListEs = __webpack_require__(/*! ./is-easing-list.es.js */ "../../../node_modules/@motionone/utils/dist/is-easing-list.es.js");
var _isFunctionEs = __webpack_require__(/*! ./is-function.es.js */ "../../../node_modules/@motionone/utils/dist/is-function.es.js");
var _isNumberEs = __webpack_require__(/*! ./is-number.es.js */ "../../../node_modules/@motionone/utils/dist/is-number.es.js");
var _isStringEs = __webpack_require__(/*! ./is-string.es.js */ "../../../node_modules/@motionone/utils/dist/is-string.es.js");
var _mixEs = __webpack_require__(/*! ./mix.es.js */ "../../../node_modules/@motionone/utils/dist/mix.es.js");
var _noopEs = __webpack_require__(/*! ./noop.es.js */ "../../../node_modules/@motionone/utils/dist/noop.es.js");
var _offsetEs = __webpack_require__(/*! ./offset.es.js */ "../../../node_modules/@motionone/utils/dist/offset.es.js");
var _progressEs = __webpack_require__(/*! ./progress.es.js */ "../../../node_modules/@motionone/utils/dist/progress.es.js");
var _timeEs = __webpack_require__(/*! ./time.es.js */ "../../../node_modules/@motionone/utils/dist/time.es.js");
var _velocityEs = __webpack_require__(/*! ./velocity.es.js */ "../../../node_modules/@motionone/utils/dist/velocity.es.js");
var _wrapEs = __webpack_require__(/*! ./wrap.es.js */ "../../../node_modules/@motionone/utils/dist/wrap.es.js");
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/interpolate.es.js":
/*!*********************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/interpolate.es.js ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.interpolate = interpolate;
var _mixEs = __webpack_require__(/*! ./mix.es.js */ "../../../node_modules/@motionone/utils/dist/mix.es.js");
var _noopEs = __webpack_require__(/*! ./noop.es.js */ "../../../node_modules/@motionone/utils/dist/noop.es.js");
var _offsetEs = __webpack_require__(/*! ./offset.es.js */ "../../../node_modules/@motionone/utils/dist/offset.es.js");
var _progressEs = __webpack_require__(/*! ./progress.es.js */ "../../../node_modules/@motionone/utils/dist/progress.es.js");
var _easingEs = __webpack_require__(/*! ./easing.es.js */ "../../../node_modules/@motionone/utils/dist/easing.es.js");
var _clampEs = __webpack_require__(/*! ./clamp.es.js */ "../../../node_modules/@motionone/utils/dist/clamp.es.js");
function interpolate(output) {
let input = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _offsetEs.defaultOffset)(output.length);
let easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _noopEs.noopReturn;
const length = output.length;
/**
* If the input length is lower than the output we
* fill the input to match. This currently assumes the input
* is an animation progress value so is a good candidate for
* moving outside the function.
*/
const remainder = length - input.length;
remainder > 0 && (0, _offsetEs.fillOffset)(input, remainder);
return t => {
let i = 0;
for (; i < length - 2; i++) {
if (t < input[i + 1]) break;
}
let progressInRange = (0, _clampEs.clamp)(0, 1, (0, _progressEs.progress)(input[i], input[i + 1], t));
const segmentEasing = (0, _easingEs.getEasingForSegment)(easing, i);
progressInRange = segmentEasing(progressInRange);
return (0, _mixEs.mix)(output[i], output[i + 1], progressInRange);
};
}
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/is-cubic-bezier.es.js":
/*!*************************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/is-cubic-bezier.es.js ***!
\*************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isCubicBezier = void 0;
var _isNumberEs = __webpack_require__(/*! ./is-number.es.js */ "../../../node_modules/@motionone/utils/dist/is-number.es.js");
const isCubicBezier = easing => Array.isArray(easing) && (0, _isNumberEs.isNumber)(easing[0]);
exports.isCubicBezier = isCubicBezier;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/is-easing-generator.es.js":
/*!*****************************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/is-easing-generator.es.js ***!
\*****************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isEasingGenerator = void 0;
const isEasingGenerator = easing => typeof easing === "object" && Boolean(easing.createAnimation);
exports.isEasingGenerator = isEasingGenerator;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/is-easing-list.es.js":
/*!************************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/is-easing-list.es.js ***!
\************************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isEasingList = void 0;
var _isNumberEs = __webpack_require__(/*! ./is-number.es.js */ "../../../node_modules/@motionone/utils/dist/is-number.es.js");
const isEasingList = easing => Array.isArray(easing) && !(0, _isNumberEs.isNumber)(easing[0]);
exports.isEasingList = isEasingList;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/is-function.es.js":
/*!*********************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/is-function.es.js ***!
\*********************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isFunction = void 0;
const isFunction = value => typeof value === "function";
exports.isFunction = isFunction;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/is-number.es.js":
/*!*******************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/is-number.es.js ***!
\*******************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isNumber = void 0;
const isNumber = value => typeof value === "number";
exports.isNumber = isNumber;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/is-string.es.js":
/*!*******************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/is-string.es.js ***!
\*******************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isString = void 0;
const isString = value => typeof value === "string";
exports.isString = isString;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/mix.es.js":
/*!*************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/mix.es.js ***!
\*************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.mix = void 0;
const mix = (min, max, progress) => -progress * min + progress * max + min;
exports.mix = mix;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/noop.es.js":
/*!**************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/noop.es.js ***!
\**************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.noopReturn = exports.noop = void 0;
const noop = () => {};
exports.noop = noop;
const noopReturn = v => v;
exports.noopReturn = noopReturn;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/offset.es.js":
/*!****************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/offset.es.js ***!
\****************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.defaultOffset = defaultOffset;
exports.fillOffset = fillOffset;
var _mixEs = __webpack_require__(/*! ./mix.es.js */ "../../../node_modules/@motionone/utils/dist/mix.es.js");
var _progressEs = __webpack_require__(/*! ./progress.es.js */ "../../../node_modules/@motionone/utils/dist/progress.es.js");
function fillOffset(offset, remaining) {
const min = offset[offset.length - 1];
for (let i = 1; i <= remaining; i++) {
const offsetProgress = (0, _progressEs.progress)(0, remaining, i);
offset.push((0, _mixEs.mix)(min, 1, offsetProgress));
}
}
function defaultOffset(length) {
const offset = [0];
fillOffset(offset, length - 1);
return offset;
}
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/progress.es.js":
/*!******************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/progress.es.js ***!
\******************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.progress = void 0;
const progress = (min, max, value) => max - min === 0 ? 1 : (value - min) / (max - min);
exports.progress = progress;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/time.es.js":
/*!**************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/time.es.js ***!
\**************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.time = void 0;
const time = {
ms: seconds => seconds * 1000,
s: milliseconds => milliseconds / 1000
};
exports.time = time;
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/velocity.es.js":
/*!******************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/velocity.es.js ***!
\******************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.velocityPerSecond = velocityPerSecond;
/*
Convert velocity into velocity per second
@param [number]: Unit per frame
@param [number]: Frame duration in ms
*/
function velocityPerSecond(velocity, frameDuration) {
return frameDuration ? velocity * (1000 / frameDuration) : 0;
}
/***/ }),
/***/ "../../../node_modules/@motionone/utils/dist/wrap.es.js":
/*!**************************************************************!*\
!*** ../../../node_modules/@motionone/utils/dist/wrap.es.js ***!
\**************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.wrap = void 0;
const wrap = (min, max, v) => {
const rangeSize = max - min;
return ((v - min) % rangeSize + rangeSize) % rangeSize + min;
};
exports.wrap = wrap;
/***/ }),
/***/ "../../../node_modules/@n1ru4l/push-pull-async-iterable-iterator/index.js":
/*!********************************************************************************!*\
!*** ../../../node_modules/@n1ru4l/push-pull-async-iterable-iterator/index.js ***!
\********************************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
function createDeferred() {
const d = {};
d.promise = new Promise((resolve, reject) => {
d.resolve = resolve;
d.reject = reject;
});
return d;
}
const SYMBOL_FINISHED = Symbol();
const SYMBOL_NEW_VALUE = Symbol();
/**
* makePushPullAsyncIterableIterator
*
* The iterable will publish values until return or throw is called.
* Afterwards it is in the completed state and cannot be used for publishing any further values.
* It will handle back-pressure and keep pushed values until they are consumed by a source.
*/
function makePushPullAsyncIterableIterator() {
let isRunning = true;
const values = [];
let newValueD = createDeferred();
const finishedD = createDeferred();
const asyncIterableIterator = async function* PushPullAsyncIterableIterator() {
while (true) {
if (values.length > 0) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
yield values.shift();
} else {
const result = await Promise.race([newValueD.promise, finishedD.promise]);
if (result === SYMBOL_FINISHED) {
break;
}
if (result !== SYMBOL_NEW_VALUE) {
throw result;
}
}
}
}();
function pushValue(value) {
if (isRunning === false) {
// TODO: Should this throw?
return;
}
values.push(value);
newValueD.resolve(SYMBOL_NEW_VALUE);
newValueD = createDeferred();
}
// We monkey patch the original generator for clean-up
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const originalReturn = asyncIterableIterator.return.bind(asyncIterableIterator);
asyncIterableIterator.return = function () {
isRunning = false;
finishedD.resolve(SYMBOL_FINISHED);
return originalReturn(...arguments);
};
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const originalThrow = asyncIterableIterator.throw.bind(asyncIterableIterator);
asyncIterableIterator.throw = err => {
isRunning = false;
finishedD.resolve(err);
return originalThrow(err);
};
return {
pushValue,
asyncIterableIterator
};
}
const makeAsyncIterableIteratorFromSink = make => {
const {
pushValue,
asyncIterableIterator
} = makePushPullAsyncIterableIterator();
const dispose = make({
next: value => {
pushValue(value);
},
complete: () => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
asyncIterableIterator.return();
},
error: err => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
asyncIterableIterator.throw(err);
}
});
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const originalReturn = asyncIterableIterator.return;
let returnValue = undefined;
asyncIterableIterator.return = () => {
if (returnValue === undefined) {
dispose();
returnValue = originalReturn();
}
return returnValue;
};
return asyncIterableIterator;
};
function applyAsyncIterableIteratorToSink(asyncIterableIterator, sink) {
const run = async () => {
try {
for await (const value of asyncIterableIterator) {
sink.next(value);
}
sink.complete();
} catch (err) {
sink.error(err);
}
};
run();
return () => {
var _a;
(_a = asyncIterableIterator.return) === null || _a === void 0 ? void 0 : _a.call(asyncIterableIterator);
};
}
function isAsyncIterable(input) {
return typeof input === "object" && input !== null && (
// The AsyncGenerator check is for Safari on iOS which currently does not have
// Symbol.asyncIterator implemented
// That means every custom AsyncIterable must be built using a AsyncGeneratorFunction (async function * () {})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
input[Symbol.toStringTag] === "AsyncGenerator" || Symbol.asyncIterator && Symbol.asyncIterator in input);
}
exports.applyAsyncIterableIteratorToSink = applyAsyncIterableIteratorToSink;
exports.isAsyncIterable = isAsyncIterable;
exports.makeAsyncIterableIteratorFromSink = makeAsyncIterableIteratorFromSink;
exports.makePushPullAsyncIterableIterator = makePushPullAsyncIterableIterator;
/***/ }),
/***/ "../../../node_modules/@radix-ui/primitive/dist/index.js":
/*!***************************************************************!*\
!*** ../../../node_modules/@radix-ui/primitive/dist/index.js ***!
\***************************************************************/
/***/ (function(module) {
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "composeEventHandlers", () => $1a6a90a521dcd173$export$b9ecd428b558ff10);
function $1a6a90a521dcd173$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler) {
let {
checkForDefaultPrevented = true
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return function handleEvent(event) {
originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
};
}
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-arrow/dist/index.js":
/*!*****************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-arrow/dist/index.js ***!
\*****************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $eQpDd$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $eQpDd$react = __webpack_require__(/*! react */ "react");
var $eQpDd$radixuireactprimitive = __webpack_require__(/*! @radix-ui/react-primitive */ "../../../node_modules/@radix-ui/react-primitive/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "Arrow", () => $09f4ad68a9251bc3$export$21b07c8f274aebd5);
$parcel$export(module.exports, "Root", () => $09f4ad68a9251bc3$export$be92b6f5f03c0fe9);
/* -------------------------------------------------------------------------------------------------
* Arrow
* -----------------------------------------------------------------------------------------------*/
const $09f4ad68a9251bc3$var$NAME = 'Arrow';
const $09f4ad68a9251bc3$export$21b07c8f274aebd5 = /*#__PURE__*/$eQpDd$react.forwardRef((props, forwardedRef) => {
const {
children: children,
width = 10,
height = 5,
...arrowProps
} = props;
return /*#__PURE__*/$eQpDd$react.createElement($eQpDd$radixuireactprimitive.Primitive.svg, $parcel$interopDefault($eQpDd$babelruntimehelpersextends)({}, arrowProps, {
ref: forwardedRef,
width: width,
height: height,
viewBox: "0 0 30 10",
preserveAspectRatio: "none"
}), props.asChild ? children : /*#__PURE__*/$eQpDd$react.createElement("polygon", {
points: "0,0 30,0 15,10"
}));
});
/*#__PURE__*/
Object.assign($09f4ad68a9251bc3$export$21b07c8f274aebd5, {
displayName: $09f4ad68a9251bc3$var$NAME
});
/* -----------------------------------------------------------------------------------------------*/
const $09f4ad68a9251bc3$export$be92b6f5f03c0fe9 = $09f4ad68a9251bc3$export$21b07c8f274aebd5;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-collection/dist/index.js":
/*!**********************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-collection/dist/index.js ***!
\**********************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $hnlpS$react = __webpack_require__(/*! react */ "react");
var $hnlpS$radixuireactcontext = __webpack_require__(/*! @radix-ui/react-context */ "../../../node_modules/@radix-ui/react-context/dist/index.js");
var $hnlpS$radixuireactcomposerefs = __webpack_require__(/*! @radix-ui/react-compose-refs */ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js");
var $hnlpS$radixuireactslot = __webpack_require__(/*! @radix-ui/react-slot */ "../../../node_modules/@radix-ui/react-slot/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "createCollection", () => $1a96635ec239608b$export$c74125a8e3af6bb2);
// We have resorted to returning slots directly rather than exposing primitives that can then
// be slotted like `…`.
// This is because we encountered issues with generic types that cannot be statically analysed
// due to creating them dynamically via createCollection.
function $1a96635ec239608b$export$c74125a8e3af6bb2(name) {
/* -----------------------------------------------------------------------------------------------
* CollectionProvider
* ---------------------------------------------------------------------------------------------*/
const PROVIDER_NAME = name + 'CollectionProvider';
const [createCollectionContext, createCollectionScope] = $hnlpS$radixuireactcontext.createContextScope(PROVIDER_NAME);
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
collectionRef: {
current: null
},
itemMap: new Map()
});
const CollectionProvider = props => {
const {
scope: scope,
children: children
} = props;
const ref = $parcel$interopDefault($hnlpS$react).useRef(null);
const itemMap = $parcel$interopDefault($hnlpS$react).useRef(new Map()).current;
return /*#__PURE__*/$parcel$interopDefault($hnlpS$react).createElement(CollectionProviderImpl, {
scope: scope,
itemMap: itemMap,
collectionRef: ref
}, children);
};
/*#__PURE__*/
Object.assign(CollectionProvider, {
displayName: PROVIDER_NAME
});
/* -----------------------------------------------------------------------------------------------
* CollectionSlot
* ---------------------------------------------------------------------------------------------*/
const COLLECTION_SLOT_NAME = name + 'CollectionSlot';
const CollectionSlot = /*#__PURE__*/$parcel$interopDefault($hnlpS$react).forwardRef((props, forwardedRef) => {
const {
scope: scope,
children: children
} = props;
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
const composedRefs = $hnlpS$radixuireactcomposerefs.useComposedRefs(forwardedRef, context.collectionRef);
return /*#__PURE__*/$parcel$interopDefault($hnlpS$react).createElement($hnlpS$radixuireactslot.Slot, {
ref: composedRefs
}, children);
});
/*#__PURE__*/
Object.assign(CollectionSlot, {
displayName: COLLECTION_SLOT_NAME
});
/* -----------------------------------------------------------------------------------------------
* CollectionItem
* ---------------------------------------------------------------------------------------------*/
const ITEM_SLOT_NAME = name + 'CollectionItemSlot';
const ITEM_DATA_ATTR = 'data-radix-collection-item';
const CollectionItemSlot = /*#__PURE__*/$parcel$interopDefault($hnlpS$react).forwardRef((props, forwardedRef) => {
const {
scope: scope,
children: children,
...itemData
} = props;
const ref = $parcel$interopDefault($hnlpS$react).useRef(null);
const composedRefs = $hnlpS$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
$parcel$interopDefault($hnlpS$react).useEffect(() => {
context.itemMap.set(ref, {
ref: ref,
...itemData
});
return () => void context.itemMap.delete(ref);
});
return /*#__PURE__*/$parcel$interopDefault($hnlpS$react).createElement($hnlpS$radixuireactslot.Slot, {
[ITEM_DATA_ATTR]: '',
ref: composedRefs
}, children);
});
/*#__PURE__*/
Object.assign(CollectionItemSlot, {
displayName: ITEM_SLOT_NAME
});
/* -----------------------------------------------------------------------------------------------
* useCollection
* ---------------------------------------------------------------------------------------------*/
function useCollection(scope) {
const context = useCollectionContext(name + 'CollectionConsumer', scope);
const getItems = $parcel$interopDefault($hnlpS$react).useCallback(() => {
const collectionNode = context.collectionRef.current;
if (!collectionNode) return [];
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
const items = Array.from(context.itemMap.values());
const orderedItems = items.sort((a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current));
return orderedItems;
}, [context.collectionRef, context.itemMap]);
return getItems;
}
return [{
Provider: CollectionProvider,
Slot: CollectionSlot,
ItemSlot: CollectionItemSlot
}, useCollection, createCollectionScope];
}
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js":
/*!************************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-compose-refs/dist/index.js ***!
\************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $dJwbH$react = __webpack_require__(/*! react */ "react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "composeRefs", () => $9c2aaba23466b352$export$43e446d32b3d21af);
$parcel$export(module.exports, "useComposedRefs", () => $9c2aaba23466b352$export$c7b2cbe3552a0d05);
/**
* Set a given ref to a given value
* This utility takes care of different types of refs: callback refs and RefObject(s)
*/
function $9c2aaba23466b352$var$setRef(ref, value) {
if (typeof ref === 'function') ref(value);else if (ref !== null && ref !== undefined) ref.current = value;
}
/**
* A utility to compose multiple refs together
* Accepts callback refs and RefObject(s)
*/
function $9c2aaba23466b352$export$43e446d32b3d21af() {
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
refs[_key] = arguments[_key];
}
return node => refs.forEach(ref => $9c2aaba23466b352$var$setRef(ref, node));
}
/**
* A custom hook that composes multiple refs
* Accepts callback refs and RefObject(s)
*/
function $9c2aaba23466b352$export$c7b2cbe3552a0d05() {
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
refs[_key2] = arguments[_key2];
}
// eslint-disable-next-line react-hooks/exhaustive-deps
return $dJwbH$react.useCallback($9c2aaba23466b352$export$43e446d32b3d21af(...refs), refs);
}
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-context/dist/index.js":
/*!*******************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-context/dist/index.js ***!
\*******************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $4O1Ne$react = __webpack_require__(/*! react */ "react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "createContext", () => $dec3cc0142d4f286$export$fd42f52fd3ae1109);
$parcel$export(module.exports, "createContextScope", () => $dec3cc0142d4f286$export$50c7b4e9d9f19c1);
function $dec3cc0142d4f286$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
const Context = /*#__PURE__*/$4O1Ne$react.createContext(defaultContext);
function Provider(props) {
const {
children: children,
...context
} = props; // Only re-memoize when prop values change
// eslint-disable-next-line react-hooks/exhaustive-deps
const value = $4O1Ne$react.useMemo(() => context, Object.values(context));
return /*#__PURE__*/$4O1Ne$react.createElement(Context.Provider, {
value: value
}, children);
}
function useContext(consumerName) {
const context = $4O1Ne$react.useContext(Context);
if (context) return context;
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + 'Provider';
return [Provider, useContext];
}
/* -------------------------------------------------------------------------------------------------
* createContextScope
* -----------------------------------------------------------------------------------------------*/
function $dec3cc0142d4f286$export$50c7b4e9d9f19c1(scopeName) {
let createContextScopeDeps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
let defaultContexts = [];
/* -----------------------------------------------------------------------------------------------
* createContext
* ---------------------------------------------------------------------------------------------*/
function $dec3cc0142d4f286$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
const BaseContext = /*#__PURE__*/$4O1Ne$react.createContext(defaultContext);
const index = defaultContexts.length;
defaultContexts = [...defaultContexts, defaultContext];
function Provider(props) {
const {
scope: scope,
children: children,
...context
} = props;
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
// eslint-disable-next-line react-hooks/exhaustive-deps
const value = $4O1Ne$react.useMemo(() => context, Object.values(context));
return /*#__PURE__*/$4O1Ne$react.createElement(Context.Provider, {
value: value
}, children);
}
function useContext(consumerName, scope) {
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
const context = $4O1Ne$react.useContext(Context);
if (context) return context;
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + 'Provider';
return [Provider, useContext];
}
/* -----------------------------------------------------------------------------------------------
* createScope
* ---------------------------------------------------------------------------------------------*/
const createScope = () => {
const scopeContexts = defaultContexts.map(defaultContext => {
return /*#__PURE__*/$4O1Ne$react.createContext(defaultContext);
});
return function useScope(scope) {
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
return $4O1Ne$react.useMemo(() => ({
[`__scope${scopeName}`]: {
...scope,
[scopeName]: contexts
}
}), [scope, contexts]);
};
};
createScope.scopeName = scopeName;
return [$dec3cc0142d4f286$export$fd42f52fd3ae1109, $dec3cc0142d4f286$var$composeContextScopes(createScope, ...createContextScopeDeps)];
}
/* -------------------------------------------------------------------------------------------------
* composeContextScopes
* -----------------------------------------------------------------------------------------------*/
function $dec3cc0142d4f286$var$composeContextScopes() {
for (var _len = arguments.length, scopes = new Array(_len), _key = 0; _key < _len; _key++) {
scopes[_key] = arguments[_key];
}
const baseScope = scopes[0];
if (scopes.length === 1) return baseScope;
const createScope1 = () => {
const scopeHooks = scopes.map(createScope => ({
useScope: createScope(),
scopeName: createScope.scopeName
}));
return function useComposedScopes(overrideScopes) {
const nextScopes1 = scopeHooks.reduce((nextScopes, _ref) => {
let {
useScope: useScope,
scopeName: scopeName
} = _ref;
// We are calling a hook inside a callback which React warns against to avoid inconsistent
// renders, however, scoping doesn't have render side effects so we ignore the rule.
// eslint-disable-next-line react-hooks/rules-of-hooks
const scopeProps = useScope(overrideScopes);
const currentScope = scopeProps[`__scope${scopeName}`];
return {
...nextScopes,
...currentScope
};
}, {});
return $4O1Ne$react.useMemo(() => ({
[`__scope${baseScope.scopeName}`]: nextScopes1
}), [nextScopes1]);
};
};
createScope1.scopeName = baseScope.scopeName;
return createScope1;
}
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-dialog/dist/index.js":
/*!******************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-dialog/dist/index.js ***!
\******************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $aJCrN$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $aJCrN$react = __webpack_require__(/*! react */ "react");
var $aJCrN$radixuiprimitive = __webpack_require__(/*! @radix-ui/primitive */ "../../../node_modules/@radix-ui/primitive/dist/index.js");
var $aJCrN$radixuireactcomposerefs = __webpack_require__(/*! @radix-ui/react-compose-refs */ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js");
var $aJCrN$radixuireactcontext = __webpack_require__(/*! @radix-ui/react-context */ "../../../node_modules/@radix-ui/react-context/dist/index.js");
var $aJCrN$radixuireactid = __webpack_require__(/*! @radix-ui/react-id */ "../../../node_modules/@radix-ui/react-id/dist/index.js");
var $aJCrN$radixuireactusecontrollablestate = __webpack_require__(/*! @radix-ui/react-use-controllable-state */ "../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.js");
var $aJCrN$radixuireactdismissablelayer = __webpack_require__(/*! @radix-ui/react-dismissable-layer */ "../../../node_modules/@radix-ui/react-dismissable-layer/dist/index.js");
var $aJCrN$radixuireactfocusscope = __webpack_require__(/*! @radix-ui/react-focus-scope */ "../../../node_modules/@radix-ui/react-focus-scope/dist/index.js");
var $aJCrN$radixuireactportal = __webpack_require__(/*! @radix-ui/react-portal */ "../../../node_modules/@radix-ui/react-portal/dist/index.js");
var $aJCrN$radixuireactpresence = __webpack_require__(/*! @radix-ui/react-presence */ "../../../node_modules/@radix-ui/react-presence/dist/index.js");
var $aJCrN$radixuireactprimitive = __webpack_require__(/*! @radix-ui/react-primitive */ "../../../node_modules/@radix-ui/react-primitive/dist/index.js");
var $aJCrN$radixuireactfocusguards = __webpack_require__(/*! @radix-ui/react-focus-guards */ "../../../node_modules/@radix-ui/react-focus-guards/dist/index.js");
var $aJCrN$reactremovescroll = __webpack_require__(/*! react-remove-scroll */ "../../../node_modules/react-remove-scroll/dist/es2015/index.js");
var $aJCrN$ariahidden = __webpack_require__(/*! aria-hidden */ "../../../node_modules/aria-hidden/dist/es2015/index.js");
var $aJCrN$radixuireactslot = __webpack_require__(/*! @radix-ui/react-slot */ "../../../node_modules/@radix-ui/react-slot/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "createDialogScope", () => $f4833395aa1bca1a$export$cc702773b8ea3e41);
$parcel$export(module.exports, "Dialog", () => $f4833395aa1bca1a$export$3ddf2d174ce01153);
$parcel$export(module.exports, "DialogTrigger", () => $f4833395aa1bca1a$export$2e1e1122cf0cba88);
$parcel$export(module.exports, "DialogPortal", () => $f4833395aa1bca1a$export$dad7c95542bacce0);
$parcel$export(module.exports, "DialogOverlay", () => $f4833395aa1bca1a$export$bd1d06c79be19e17);
$parcel$export(module.exports, "DialogContent", () => $f4833395aa1bca1a$export$b6d9565de1e068cf);
$parcel$export(module.exports, "DialogTitle", () => $f4833395aa1bca1a$export$16f7638e4a34b909);
$parcel$export(module.exports, "DialogDescription", () => $f4833395aa1bca1a$export$94e94c2ec2c954d5);
$parcel$export(module.exports, "DialogClose", () => $f4833395aa1bca1a$export$fba2fb7cd781b7ac);
$parcel$export(module.exports, "Root", () => $f4833395aa1bca1a$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Trigger", () => $f4833395aa1bca1a$export$41fb9f06171c75f4);
$parcel$export(module.exports, "Portal", () => $f4833395aa1bca1a$export$602eac185826482c);
$parcel$export(module.exports, "Overlay", () => $f4833395aa1bca1a$export$c6fdb837b070b4ff);
$parcel$export(module.exports, "Content", () => $f4833395aa1bca1a$export$7c6e2c02157bb7d2);
$parcel$export(module.exports, "Title", () => $f4833395aa1bca1a$export$f99233281efd08a0);
$parcel$export(module.exports, "Description", () => $f4833395aa1bca1a$export$393edc798c47379d);
$parcel$export(module.exports, "Close", () => $f4833395aa1bca1a$export$f39c2d165cd861fe);
$parcel$export(module.exports, "WarningProvider", () => $f4833395aa1bca1a$export$69b62a49393917d6);
/* -------------------------------------------------------------------------------------------------
* Dialog
* -----------------------------------------------------------------------------------------------*/
const $f4833395aa1bca1a$var$DIALOG_NAME = 'Dialog';
const [$f4833395aa1bca1a$var$createDialogContext, $f4833395aa1bca1a$export$cc702773b8ea3e41] = $aJCrN$radixuireactcontext.createContextScope($f4833395aa1bca1a$var$DIALOG_NAME);
const [$f4833395aa1bca1a$var$DialogProvider, $f4833395aa1bca1a$var$useDialogContext] = $f4833395aa1bca1a$var$createDialogContext($f4833395aa1bca1a$var$DIALOG_NAME);
const $f4833395aa1bca1a$export$3ddf2d174ce01153 = props => {
const {
__scopeDialog: __scopeDialog,
children: children,
open: openProp,
defaultOpen: defaultOpen,
onOpenChange: onOpenChange,
modal = true
} = props;
const triggerRef = $aJCrN$react.useRef(null);
const contentRef = $aJCrN$react.useRef(null);
const [open = false, setOpen] = $aJCrN$radixuireactusecontrollablestate.useControllableState({
prop: openProp,
defaultProp: defaultOpen,
onChange: onOpenChange
});
return /*#__PURE__*/$aJCrN$react.createElement($f4833395aa1bca1a$var$DialogProvider, {
scope: __scopeDialog,
triggerRef: triggerRef,
contentRef: contentRef,
contentId: $aJCrN$radixuireactid.useId(),
titleId: $aJCrN$radixuireactid.useId(),
descriptionId: $aJCrN$radixuireactid.useId(),
open: open,
onOpenChange: setOpen,
onOpenToggle: $aJCrN$react.useCallback(() => setOpen(prevOpen => !prevOpen), [setOpen]),
modal: modal
}, children);
};
/*#__PURE__*/
Object.assign($f4833395aa1bca1a$export$3ddf2d174ce01153, {
displayName: $f4833395aa1bca1a$var$DIALOG_NAME
});
/* -------------------------------------------------------------------------------------------------
* DialogTrigger
* -----------------------------------------------------------------------------------------------*/
const $f4833395aa1bca1a$var$TRIGGER_NAME = 'DialogTrigger';
const $f4833395aa1bca1a$export$2e1e1122cf0cba88 = /*#__PURE__*/$aJCrN$react.forwardRef((props, forwardedRef) => {
const {
__scopeDialog: __scopeDialog,
...triggerProps
} = props;
const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$TRIGGER_NAME, __scopeDialog);
const composedTriggerRef = $aJCrN$radixuireactcomposerefs.useComposedRefs(forwardedRef, context.triggerRef);
return /*#__PURE__*/$aJCrN$react.createElement($aJCrN$radixuireactprimitive.Primitive.button, $parcel$interopDefault($aJCrN$babelruntimehelpersextends)({
type: "button",
"aria-haspopup": "dialog",
"aria-expanded": context.open,
"aria-controls": context.contentId,
"data-state": $f4833395aa1bca1a$var$getState(context.open)
}, triggerProps, {
ref: composedTriggerRef,
onClick: $aJCrN$radixuiprimitive.composeEventHandlers(props.onClick, context.onOpenToggle)
}));
});
/*#__PURE__*/
Object.assign($f4833395aa1bca1a$export$2e1e1122cf0cba88, {
displayName: $f4833395aa1bca1a$var$TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* DialogPortal
* -----------------------------------------------------------------------------------------------*/
const $f4833395aa1bca1a$var$PORTAL_NAME = 'DialogPortal';
const [$f4833395aa1bca1a$var$PortalProvider, $f4833395aa1bca1a$var$usePortalContext] = $f4833395aa1bca1a$var$createDialogContext($f4833395aa1bca1a$var$PORTAL_NAME, {
forceMount: undefined
});
const $f4833395aa1bca1a$export$dad7c95542bacce0 = props => {
const {
__scopeDialog: __scopeDialog,
forceMount: forceMount,
children: children,
container: container
} = props;
const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$PORTAL_NAME, __scopeDialog);
return /*#__PURE__*/$aJCrN$react.createElement($f4833395aa1bca1a$var$PortalProvider, {
scope: __scopeDialog,
forceMount: forceMount
}, $aJCrN$react.Children.map(children, child => /*#__PURE__*/$aJCrN$react.createElement($aJCrN$radixuireactpresence.Presence, {
present: forceMount || context.open
}, /*#__PURE__*/$aJCrN$react.createElement($aJCrN$radixuireactportal.Portal, {
asChild: true,
container: container
}, child))));
};
/*#__PURE__*/
Object.assign($f4833395aa1bca1a$export$dad7c95542bacce0, {
displayName: $f4833395aa1bca1a$var$PORTAL_NAME
});
/* -------------------------------------------------------------------------------------------------
* DialogOverlay
* -----------------------------------------------------------------------------------------------*/
const $f4833395aa1bca1a$var$OVERLAY_NAME = 'DialogOverlay';
const $f4833395aa1bca1a$export$bd1d06c79be19e17 = /*#__PURE__*/$aJCrN$react.forwardRef((props, forwardedRef) => {
const portalContext = $f4833395aa1bca1a$var$usePortalContext($f4833395aa1bca1a$var$OVERLAY_NAME, props.__scopeDialog);
const {
forceMount = portalContext.forceMount,
...overlayProps
} = props;
const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$OVERLAY_NAME, props.__scopeDialog);
return context.modal ? /*#__PURE__*/$aJCrN$react.createElement($aJCrN$radixuireactpresence.Presence, {
present: forceMount || context.open
}, /*#__PURE__*/$aJCrN$react.createElement($f4833395aa1bca1a$var$DialogOverlayImpl, $parcel$interopDefault($aJCrN$babelruntimehelpersextends)({}, overlayProps, {
ref: forwardedRef
}))) : null;
});
/*#__PURE__*/
Object.assign($f4833395aa1bca1a$export$bd1d06c79be19e17, {
displayName: $f4833395aa1bca1a$var$OVERLAY_NAME
});
const $f4833395aa1bca1a$var$DialogOverlayImpl = /*#__PURE__*/$aJCrN$react.forwardRef((props, forwardedRef) => {
const {
__scopeDialog: __scopeDialog,
...overlayProps
} = props;
const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$OVERLAY_NAME, __scopeDialog);
return /*#__PURE__*/ (// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
// ie. when `Overlay` and `Content` are siblings
$aJCrN$react.createElement($aJCrN$reactremovescroll.RemoveScroll, {
as: $aJCrN$radixuireactslot.Slot,
allowPinchZoom: true,
shards: [context.contentRef]
}, /*#__PURE__*/$aJCrN$react.createElement($aJCrN$radixuireactprimitive.Primitive.div, $parcel$interopDefault($aJCrN$babelruntimehelpersextends)({
"data-state": $f4833395aa1bca1a$var$getState(context.open)
}, overlayProps, {
ref: forwardedRef // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.
,
style: {
pointerEvents: 'auto',
...overlayProps.style
}
})))
);
});
/* -------------------------------------------------------------------------------------------------
* DialogContent
* -----------------------------------------------------------------------------------------------*/
const $f4833395aa1bca1a$var$CONTENT_NAME = 'DialogContent';
const $f4833395aa1bca1a$export$b6d9565de1e068cf = /*#__PURE__*/$aJCrN$react.forwardRef((props, forwardedRef) => {
const portalContext = $f4833395aa1bca1a$var$usePortalContext($f4833395aa1bca1a$var$CONTENT_NAME, props.__scopeDialog);
const {
forceMount = portalContext.forceMount,
...contentProps
} = props;
const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$CONTENT_NAME, props.__scopeDialog);
return /*#__PURE__*/$aJCrN$react.createElement($aJCrN$radixuireactpresence.Presence, {
present: forceMount || context.open
}, context.modal ? /*#__PURE__*/$aJCrN$react.createElement($f4833395aa1bca1a$var$DialogContentModal, $parcel$interopDefault($aJCrN$babelruntimehelpersextends)({}, contentProps, {
ref: forwardedRef
})) : /*#__PURE__*/$aJCrN$react.createElement($f4833395aa1bca1a$var$DialogContentNonModal, $parcel$interopDefault($aJCrN$babelruntimehelpersextends)({}, contentProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/
Object.assign($f4833395aa1bca1a$export$b6d9565de1e068cf, {
displayName: $f4833395aa1bca1a$var$CONTENT_NAME
});
/* -----------------------------------------------------------------------------------------------*/
const $f4833395aa1bca1a$var$DialogContentModal = /*#__PURE__*/$aJCrN$react.forwardRef((props, forwardedRef) => {
const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$CONTENT_NAME, props.__scopeDialog);
const contentRef = $aJCrN$react.useRef(null);
const composedRefs = $aJCrN$radixuireactcomposerefs.useComposedRefs(forwardedRef, context.contentRef, contentRef); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
$aJCrN$react.useEffect(() => {
const content = contentRef.current;
if (content) return $aJCrN$ariahidden.hideOthers(content);
}, []);
return /*#__PURE__*/$aJCrN$react.createElement($f4833395aa1bca1a$var$DialogContentImpl, $parcel$interopDefault($aJCrN$babelruntimehelpersextends)({}, props, {
ref: composedRefs // we make sure focus isn't trapped once `DialogContent` has been closed
,
trapFocus: context.open,
disableOutsidePointerEvents: true,
onCloseAutoFocus: $aJCrN$radixuiprimitive.composeEventHandlers(props.onCloseAutoFocus, event => {
var _context$triggerRef$c;
event.preventDefault();
(_context$triggerRef$c = context.triggerRef.current) === null || _context$triggerRef$c === void 0 || _context$triggerRef$c.focus();
}),
onPointerDownOutside: $aJCrN$radixuiprimitive.composeEventHandlers(props.onPointerDownOutside, event => {
const originalEvent = event.detail.originalEvent;
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
const isRightClick = originalEvent.button === 2 || ctrlLeftClick; // If the event is a right-click, we shouldn't close because
// it is effectively as if we right-clicked the `Overlay`.
if (isRightClick) event.preventDefault();
}) // When focus is trapped, a `focusout` event may still happen.
,
onFocusOutside: $aJCrN$radixuiprimitive.composeEventHandlers(props.onFocusOutside, event => event.preventDefault())
}));
});
/* -----------------------------------------------------------------------------------------------*/
const $f4833395aa1bca1a$var$DialogContentNonModal = /*#__PURE__*/$aJCrN$react.forwardRef((props, forwardedRef) => {
const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$CONTENT_NAME, props.__scopeDialog);
const hasInteractedOutsideRef = $aJCrN$react.useRef(false);
const hasPointerDownOutsideRef = $aJCrN$react.useRef(false);
return /*#__PURE__*/$aJCrN$react.createElement($f4833395aa1bca1a$var$DialogContentImpl, $parcel$interopDefault($aJCrN$babelruntimehelpersextends)({}, props, {
ref: forwardedRef,
trapFocus: false,
disableOutsidePointerEvents: false,
onCloseAutoFocus: event => {
var _props$onCloseAutoFoc;
(_props$onCloseAutoFoc = props.onCloseAutoFocus) === null || _props$onCloseAutoFoc === void 0 || _props$onCloseAutoFoc.call(props, event);
if (!event.defaultPrevented) {
var _context$triggerRef$c2;
if (!hasInteractedOutsideRef.current) (_context$triggerRef$c2 = context.triggerRef.current) === null || _context$triggerRef$c2 === void 0 || _context$triggerRef$c2.focus(); // Always prevent auto focus because we either focus manually or want user agent focus
event.preventDefault();
}
hasInteractedOutsideRef.current = false;
hasPointerDownOutsideRef.current = false;
},
onInteractOutside: event => {
var _props$onInteractOuts, _context$triggerRef$c3;
(_props$onInteractOuts = props.onInteractOutside) === null || _props$onInteractOuts === void 0 || _props$onInteractOuts.call(props, event);
if (!event.defaultPrevented) {
hasInteractedOutsideRef.current = true;
if (event.detail.originalEvent.type === 'pointerdown') hasPointerDownOutsideRef.current = true;
} // Prevent dismissing when clicking the trigger.
// As the trigger is already setup to close, without doing so would
// cause it to close and immediately open.
const target = event.target;
const targetIsTrigger = (_context$triggerRef$c3 = context.triggerRef.current) === null || _context$triggerRef$c3 === void 0 ? void 0 : _context$triggerRef$c3.contains(target);
if (targetIsTrigger) event.preventDefault(); // On Safari if the trigger is inside a container with tabIndex={0}, when clicked
// we will get the pointer down outside event on the trigger, but then a subsequent
// focus outside event on the container, we ignore any focus outside event when we've
// already had a pointer down outside event.
if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) event.preventDefault();
}
}));
});
/* -----------------------------------------------------------------------------------------------*/
const $f4833395aa1bca1a$var$DialogContentImpl = /*#__PURE__*/$aJCrN$react.forwardRef((props, forwardedRef) => {
const {
__scopeDialog: __scopeDialog,
trapFocus: trapFocus,
onOpenAutoFocus: onOpenAutoFocus,
onCloseAutoFocus: onCloseAutoFocus,
...contentProps
} = props;
const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$CONTENT_NAME, __scopeDialog);
const contentRef = $aJCrN$react.useRef(null);
const composedRefs = $aJCrN$radixuireactcomposerefs.useComposedRefs(forwardedRef, contentRef); // Make sure the whole tree has focus guards as our `Dialog` will be
// the last element in the DOM (beacuse of the `Portal`)
$aJCrN$radixuireactfocusguards.useFocusGuards();
return /*#__PURE__*/$aJCrN$react.createElement($aJCrN$react.Fragment, null, /*#__PURE__*/$aJCrN$react.createElement($aJCrN$radixuireactfocusscope.FocusScope, {
asChild: true,
loop: true,
trapped: trapFocus,
onMountAutoFocus: onOpenAutoFocus,
onUnmountAutoFocus: onCloseAutoFocus
}, /*#__PURE__*/$aJCrN$react.createElement($aJCrN$radixuireactdismissablelayer.DismissableLayer, $parcel$interopDefault($aJCrN$babelruntimehelpersextends)({
role: "dialog",
id: context.contentId,
"aria-describedby": context.descriptionId,
"aria-labelledby": context.titleId,
"data-state": $f4833395aa1bca1a$var$getState(context.open)
}, contentProps, {
ref: composedRefs,
onDismiss: () => context.onOpenChange(false)
}))), false);
});
/* -------------------------------------------------------------------------------------------------
* DialogTitle
* -----------------------------------------------------------------------------------------------*/
const $f4833395aa1bca1a$var$TITLE_NAME = 'DialogTitle';
const $f4833395aa1bca1a$export$16f7638e4a34b909 = /*#__PURE__*/$aJCrN$react.forwardRef((props, forwardedRef) => {
const {
__scopeDialog: __scopeDialog,
...titleProps
} = props;
const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$TITLE_NAME, __scopeDialog);
return /*#__PURE__*/$aJCrN$react.createElement($aJCrN$radixuireactprimitive.Primitive.h2, $parcel$interopDefault($aJCrN$babelruntimehelpersextends)({
id: context.titleId
}, titleProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($f4833395aa1bca1a$export$16f7638e4a34b909, {
displayName: $f4833395aa1bca1a$var$TITLE_NAME
});
/* -------------------------------------------------------------------------------------------------
* DialogDescription
* -----------------------------------------------------------------------------------------------*/
const $f4833395aa1bca1a$var$DESCRIPTION_NAME = 'DialogDescription';
const $f4833395aa1bca1a$export$94e94c2ec2c954d5 = /*#__PURE__*/$aJCrN$react.forwardRef((props, forwardedRef) => {
const {
__scopeDialog: __scopeDialog,
...descriptionProps
} = props;
const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$DESCRIPTION_NAME, __scopeDialog);
return /*#__PURE__*/$aJCrN$react.createElement($aJCrN$radixuireactprimitive.Primitive.p, $parcel$interopDefault($aJCrN$babelruntimehelpersextends)({
id: context.descriptionId
}, descriptionProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($f4833395aa1bca1a$export$94e94c2ec2c954d5, {
displayName: $f4833395aa1bca1a$var$DESCRIPTION_NAME
});
/* -------------------------------------------------------------------------------------------------
* DialogClose
* -----------------------------------------------------------------------------------------------*/
const $f4833395aa1bca1a$var$CLOSE_NAME = 'DialogClose';
const $f4833395aa1bca1a$export$fba2fb7cd781b7ac = /*#__PURE__*/$aJCrN$react.forwardRef((props, forwardedRef) => {
const {
__scopeDialog: __scopeDialog,
...closeProps
} = props;
const context = $f4833395aa1bca1a$var$useDialogContext($f4833395aa1bca1a$var$CLOSE_NAME, __scopeDialog);
return /*#__PURE__*/$aJCrN$react.createElement($aJCrN$radixuireactprimitive.Primitive.button, $parcel$interopDefault($aJCrN$babelruntimehelpersextends)({
type: "button"
}, closeProps, {
ref: forwardedRef,
onClick: $aJCrN$radixuiprimitive.composeEventHandlers(props.onClick, () => context.onOpenChange(false))
}));
});
/*#__PURE__*/
Object.assign($f4833395aa1bca1a$export$fba2fb7cd781b7ac, {
displayName: $f4833395aa1bca1a$var$CLOSE_NAME
});
/* -----------------------------------------------------------------------------------------------*/
function $f4833395aa1bca1a$var$getState(open) {
return open ? 'open' : 'closed';
}
const $f4833395aa1bca1a$var$TITLE_WARNING_NAME = 'DialogTitleWarning';
const [$f4833395aa1bca1a$export$69b62a49393917d6, $f4833395aa1bca1a$var$useWarningContext] = $aJCrN$radixuireactcontext.createContext($f4833395aa1bca1a$var$TITLE_WARNING_NAME, {
contentName: $f4833395aa1bca1a$var$CONTENT_NAME,
titleName: $f4833395aa1bca1a$var$TITLE_NAME,
docsSlug: 'dialog'
});
const $f4833395aa1bca1a$var$TitleWarning = _ref => {
let {
titleId: titleId
} = _ref;
const titleWarningContext = $f4833395aa1bca1a$var$useWarningContext($f4833395aa1bca1a$var$TITLE_WARNING_NAME);
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
$aJCrN$react.useEffect(() => {
if (titleId) {
const hasTitle = document.getElementById(titleId);
if (!hasTitle) throw new Error(MESSAGE);
}
}, [MESSAGE, titleId]);
return null;
};
const $f4833395aa1bca1a$var$DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning';
const $f4833395aa1bca1a$var$DescriptionWarning = _ref2 => {
let {
contentRef: contentRef,
descriptionId: descriptionId
} = _ref2;
const descriptionWarningContext = $f4833395aa1bca1a$var$useWarningContext($f4833395aa1bca1a$var$DESCRIPTION_WARNING_NAME);
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
$aJCrN$react.useEffect(() => {
var _contentRef$current;
const describedById = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.getAttribute('aria-describedby'); // if we have an id and the user hasn't set aria-describedby={undefined}
if (descriptionId && describedById) {
const hasDescription = document.getElementById(descriptionId);
if (!hasDescription) console.warn(MESSAGE);
}
}, [MESSAGE, contentRef, descriptionId]);
return null;
};
const $f4833395aa1bca1a$export$be92b6f5f03c0fe9 = $f4833395aa1bca1a$export$3ddf2d174ce01153;
const $f4833395aa1bca1a$export$41fb9f06171c75f4 = $f4833395aa1bca1a$export$2e1e1122cf0cba88;
const $f4833395aa1bca1a$export$602eac185826482c = $f4833395aa1bca1a$export$dad7c95542bacce0;
const $f4833395aa1bca1a$export$c6fdb837b070b4ff = $f4833395aa1bca1a$export$bd1d06c79be19e17;
const $f4833395aa1bca1a$export$7c6e2c02157bb7d2 = $f4833395aa1bca1a$export$b6d9565de1e068cf;
const $f4833395aa1bca1a$export$f99233281efd08a0 = $f4833395aa1bca1a$export$16f7638e4a34b909;
const $f4833395aa1bca1a$export$393edc798c47379d = $f4833395aa1bca1a$export$94e94c2ec2c954d5;
const $f4833395aa1bca1a$export$f39c2d165cd861fe = $f4833395aa1bca1a$export$fba2fb7cd781b7ac;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-direction/dist/index.js":
/*!*********************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-direction/dist/index.js ***!
\*********************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $9g4ps$react = __webpack_require__(/*! react */ "react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "useDirection", () => $cc45c1b701a63adc$export$b39126d51d94e6f3);
$parcel$export(module.exports, "Provider", () => $cc45c1b701a63adc$export$2881499e37b75b9a);
$parcel$export(module.exports, "DirectionProvider", () => $cc45c1b701a63adc$export$c760c09fdd558351);
const $cc45c1b701a63adc$var$DirectionContext = /*#__PURE__*/$9g4ps$react.createContext(undefined);
/* -------------------------------------------------------------------------------------------------
* Direction
* -----------------------------------------------------------------------------------------------*/
const $cc45c1b701a63adc$export$c760c09fdd558351 = props => {
const {
dir: dir,
children: children
} = props;
return /*#__PURE__*/$9g4ps$react.createElement($cc45c1b701a63adc$var$DirectionContext.Provider, {
value: dir
}, children);
};
/* -----------------------------------------------------------------------------------------------*/
function $cc45c1b701a63adc$export$b39126d51d94e6f3(localDir) {
const globalDir = $9g4ps$react.useContext($cc45c1b701a63adc$var$DirectionContext);
return localDir || globalDir || 'ltr';
}
const $cc45c1b701a63adc$export$2881499e37b75b9a = $cc45c1b701a63adc$export$c760c09fdd558351;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-dismissable-layer/dist/index.js":
/*!*****************************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-dismissable-layer/dist/index.js ***!
\*****************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $g2vWm$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $g2vWm$react = __webpack_require__(/*! react */ "react");
var $g2vWm$radixuiprimitive = __webpack_require__(/*! @radix-ui/primitive */ "../../../node_modules/@radix-ui/primitive/dist/index.js");
var $g2vWm$radixuireactprimitive = __webpack_require__(/*! @radix-ui/react-primitive */ "../../../node_modules/@radix-ui/react-primitive/dist/index.js");
var $g2vWm$radixuireactcomposerefs = __webpack_require__(/*! @radix-ui/react-compose-refs */ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js");
var $g2vWm$radixuireactusecallbackref = __webpack_require__(/*! @radix-ui/react-use-callback-ref */ "../../../node_modules/@radix-ui/react-use-callback-ref/dist/index.js");
var $g2vWm$radixuireactuseescapekeydown = __webpack_require__(/*! @radix-ui/react-use-escape-keydown */ "../../../node_modules/@radix-ui/react-use-escape-keydown/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "DismissableLayer", () => $d715e0554b679f1f$export$177fb62ff3ec1f22);
$parcel$export(module.exports, "DismissableLayerBranch", () => $d715e0554b679f1f$export$4d5eb2109db14228);
$parcel$export(module.exports, "Root", () => $d715e0554b679f1f$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Branch", () => $d715e0554b679f1f$export$aecb2ddcb55c95be);
/* -------------------------------------------------------------------------------------------------
* DismissableLayer
* -----------------------------------------------------------------------------------------------*/
const $d715e0554b679f1f$var$DISMISSABLE_LAYER_NAME = 'DismissableLayer';
const $d715e0554b679f1f$var$CONTEXT_UPDATE = 'dismissableLayer.update';
const $d715e0554b679f1f$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
const $d715e0554b679f1f$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
let $d715e0554b679f1f$var$originalBodyPointerEvents;
const $d715e0554b679f1f$var$DismissableLayerContext = /*#__PURE__*/$g2vWm$react.createContext({
layers: new Set(),
layersWithOutsidePointerEventsDisabled: new Set(),
branches: new Set()
});
const $d715e0554b679f1f$export$177fb62ff3ec1f22 = /*#__PURE__*/$g2vWm$react.forwardRef((props, forwardedRef) => {
var _node$ownerDocument;
const {
disableOutsidePointerEvents = false,
onEscapeKeyDown: onEscapeKeyDown,
onPointerDownOutside: onPointerDownOutside,
onFocusOutside: onFocusOutside,
onInteractOutside: onInteractOutside,
onDismiss: onDismiss,
...layerProps
} = props;
const context = $g2vWm$react.useContext($d715e0554b679f1f$var$DismissableLayerContext);
const [node1, setNode] = $g2vWm$react.useState(null);
const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
const [, force] = $g2vWm$react.useState({});
const composedRefs = $g2vWm$radixuireactcomposerefs.useComposedRefs(forwardedRef, node => setNode(node));
const layers = Array.from(context.layers);
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1); // prettier-ignore
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore
const index = node1 ? layers.indexOf(node1) : -1;
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
const pointerDownOutside = $d715e0554b679f1f$var$usePointerDownOutside(event => {
const target = event.target;
const isPointerDownOnBranch = [...context.branches].some(branch => branch.contains(target));
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
}, ownerDocument);
const focusOutside = $d715e0554b679f1f$var$useFocusOutside(event => {
const target = event.target;
const isFocusInBranch = [...context.branches].some(branch => branch.contains(target));
if (isFocusInBranch) return;
onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
}, ownerDocument);
$g2vWm$radixuireactuseescapekeydown.useEscapeKeydown(event => {
const isHighestLayer = index === context.layers.size - 1;
if (!isHighestLayer) return;
onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
if (!event.defaultPrevented && onDismiss) {
event.preventDefault();
onDismiss();
}
}, ownerDocument);
$g2vWm$react.useEffect(() => {
if (!node1) return;
if (disableOutsidePointerEvents) {
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
$d715e0554b679f1f$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
ownerDocument.body.style.pointerEvents = 'none';
}
context.layersWithOutsidePointerEventsDisabled.add(node1);
}
context.layers.add(node1);
$d715e0554b679f1f$var$dispatchUpdate();
return () => {
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $d715e0554b679f1f$var$originalBodyPointerEvents;
};
}, [node1, ownerDocument, disableOutsidePointerEvents, context]);
/**
* We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect
* because a change to `disableOutsidePointerEvents` would remove this layer from the stack
* and add it to the end again so the layering order wouldn't be _creation order_.
* We only want them to be removed from context stacks when unmounted.
*/
$g2vWm$react.useEffect(() => {
return () => {
if (!node1) return;
context.layers.delete(node1);
context.layersWithOutsidePointerEventsDisabled.delete(node1);
$d715e0554b679f1f$var$dispatchUpdate();
};
}, [node1, context]);
$g2vWm$react.useEffect(() => {
const handleUpdate = () => force({});
document.addEventListener($d715e0554b679f1f$var$CONTEXT_UPDATE, handleUpdate);
return () => document.removeEventListener($d715e0554b679f1f$var$CONTEXT_UPDATE, handleUpdate);
}, []);
return /*#__PURE__*/$g2vWm$react.createElement($g2vWm$radixuireactprimitive.Primitive.div, $parcel$interopDefault($g2vWm$babelruntimehelpersextends)({}, layerProps, {
ref: composedRefs,
style: {
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,
...props.style
},
onFocusCapture: $g2vWm$radixuiprimitive.composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
onBlurCapture: $g2vWm$radixuiprimitive.composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
onPointerDownCapture: $g2vWm$radixuiprimitive.composeEventHandlers(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
}));
});
/*#__PURE__*/
Object.assign($d715e0554b679f1f$export$177fb62ff3ec1f22, {
displayName: $d715e0554b679f1f$var$DISMISSABLE_LAYER_NAME
});
/* -------------------------------------------------------------------------------------------------
* DismissableLayerBranch
* -----------------------------------------------------------------------------------------------*/
const $d715e0554b679f1f$var$BRANCH_NAME = 'DismissableLayerBranch';
const $d715e0554b679f1f$export$4d5eb2109db14228 = /*#__PURE__*/$g2vWm$react.forwardRef((props, forwardedRef) => {
const context = $g2vWm$react.useContext($d715e0554b679f1f$var$DismissableLayerContext);
const ref = $g2vWm$react.useRef(null);
const composedRefs = $g2vWm$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
$g2vWm$react.useEffect(() => {
const node = ref.current;
if (node) {
context.branches.add(node);
return () => {
context.branches.delete(node);
};
}
}, [context.branches]);
return /*#__PURE__*/$g2vWm$react.createElement($g2vWm$radixuireactprimitive.Primitive.div, $parcel$interopDefault($g2vWm$babelruntimehelpersextends)({}, props, {
ref: composedRefs
}));
});
/*#__PURE__*/
Object.assign($d715e0554b679f1f$export$4d5eb2109db14228, {
displayName: $d715e0554b679f1f$var$BRANCH_NAME
});
/* -----------------------------------------------------------------------------------------------*/ /**
* Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`
* to mimic layer dismissing behaviour present in OS.
* Returns props to pass to the node we want to check for outside events.
*/
function $d715e0554b679f1f$var$usePointerDownOutside(onPointerDownOutside) {
let ownerDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
const handlePointerDownOutside = $g2vWm$radixuireactusecallbackref.useCallbackRef(onPointerDownOutside);
const isPointerInsideReactTreeRef = $g2vWm$react.useRef(false);
const handleClickRef = $g2vWm$react.useRef(() => {});
$g2vWm$react.useEffect(() => {
const handlePointerDown = event => {
if (event.target && !isPointerInsideReactTreeRef.current) {
const eventDetail = {
originalEvent: event
};
function handleAndDispatchPointerDownOutsideEvent() {
$d715e0554b679f1f$var$handleAndDispatchCustomEvent($d715e0554b679f1f$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
discrete: true
});
}
/**
* On touch devices, we need to wait for a click event because browsers implement
* a ~350ms delay between the time the user stops touching the display and when the
* browser executres events. We need to ensure we don't reactivate pointer-events within
* this timeframe otherwise the browser may execute events that should have been prevented.
*
* Additionally, this also lets us deal automatically with cancellations when a click event
* isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.
*
* This is why we also continuously remove the previous listener, because we cannot be
* certain that it was raised, and therefore cleaned-up.
*/
if (event.pointerType === 'touch') {
ownerDocument.removeEventListener('click', handleClickRef.current);
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
ownerDocument.addEventListener('click', handleClickRef.current, {
once: true
});
} else handleAndDispatchPointerDownOutsideEvent();
}
isPointerInsideReactTreeRef.current = false;
};
/**
* if this hook executes in a component that mounts via a `pointerdown` event, the event
* would bubble up to the document and trigger a `pointerDownOutside` event. We avoid
* this by delaying the event listener registration on the document.
* This is not React specific, but rather how the DOM works, ie:
* ```
* button.addEventListener('pointerdown', () => {
* console.log('I will log');
* document.addEventListener('pointerdown', () => {
* console.log('I will also log');
* })
* });
*/
const timerId = window.setTimeout(() => {
ownerDocument.addEventListener('pointerdown', handlePointerDown);
}, 0);
return () => {
window.clearTimeout(timerId);
ownerDocument.removeEventListener('pointerdown', handlePointerDown);
ownerDocument.removeEventListener('click', handleClickRef.current);
};
}, [ownerDocument, handlePointerDownOutside]);
return {
// ensures we check React component tree (not just DOM tree)
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
};
}
/**
* Listens for when focus happens outside a react subtree.
* Returns props to pass to the root (node) of the subtree we want to check.
*/
function $d715e0554b679f1f$var$useFocusOutside(onFocusOutside) {
let ownerDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
const handleFocusOutside = $g2vWm$radixuireactusecallbackref.useCallbackRef(onFocusOutside);
const isFocusInsideReactTreeRef = $g2vWm$react.useRef(false);
$g2vWm$react.useEffect(() => {
const handleFocus = event => {
if (event.target && !isFocusInsideReactTreeRef.current) {
const eventDetail = {
originalEvent: event
};
$d715e0554b679f1f$var$handleAndDispatchCustomEvent($d715e0554b679f1f$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
discrete: false
});
}
};
ownerDocument.addEventListener('focusin', handleFocus);
return () => ownerDocument.removeEventListener('focusin', handleFocus);
}, [ownerDocument, handleFocusOutside]);
return {
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
};
}
function $d715e0554b679f1f$var$dispatchUpdate() {
const event = new CustomEvent($d715e0554b679f1f$var$CONTEXT_UPDATE);
document.dispatchEvent(event);
}
function $d715e0554b679f1f$var$handleAndDispatchCustomEvent(name, handler, detail, _ref) {
let {
discrete: discrete
} = _ref;
const target = detail.originalEvent.target;
const event = new CustomEvent(name, {
bubbles: false,
cancelable: true,
detail: detail
});
if (handler) target.addEventListener(name, handler, {
once: true
});
if (discrete) $g2vWm$radixuireactprimitive.dispatchDiscreteCustomEvent(target, event);else target.dispatchEvent(event);
}
const $d715e0554b679f1f$export$be92b6f5f03c0fe9 = $d715e0554b679f1f$export$177fb62ff3ec1f22;
const $d715e0554b679f1f$export$aecb2ddcb55c95be = $d715e0554b679f1f$export$4d5eb2109db14228;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-dropdown-menu/dist/index.js":
/*!*************************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-dropdown-menu/dist/index.js ***!
\*************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $7dQ7Q$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $7dQ7Q$react = __webpack_require__(/*! react */ "react");
var $7dQ7Q$radixuiprimitive = __webpack_require__(/*! @radix-ui/primitive */ "../../../node_modules/@radix-ui/primitive/dist/index.js");
var $7dQ7Q$radixuireactcomposerefs = __webpack_require__(/*! @radix-ui/react-compose-refs */ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js");
var $7dQ7Q$radixuireactcontext = __webpack_require__(/*! @radix-ui/react-context */ "../../../node_modules/@radix-ui/react-context/dist/index.js");
var $7dQ7Q$radixuireactusecontrollablestate = __webpack_require__(/*! @radix-ui/react-use-controllable-state */ "../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.js");
var $7dQ7Q$radixuireactprimitive = __webpack_require__(/*! @radix-ui/react-primitive */ "../../../node_modules/@radix-ui/react-primitive/dist/index.js");
var $7dQ7Q$radixuireactmenu = __webpack_require__(/*! @radix-ui/react-menu */ "../../../node_modules/@radix-ui/react-menu/dist/index.js");
var $7dQ7Q$radixuireactid = __webpack_require__(/*! @radix-ui/react-id */ "../../../node_modules/@radix-ui/react-id/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "createDropdownMenuScope", () => $d1bf075a6b218014$export$c0623cd925aeb687);
$parcel$export(module.exports, "DropdownMenu", () => $d1bf075a6b218014$export$e44a253a59704894);
$parcel$export(module.exports, "DropdownMenuTrigger", () => $d1bf075a6b218014$export$d2469213b3befba9);
$parcel$export(module.exports, "DropdownMenuPortal", () => $d1bf075a6b218014$export$cd369b4d4d54efc9);
$parcel$export(module.exports, "DropdownMenuContent", () => $d1bf075a6b218014$export$6e76d93a37c01248);
$parcel$export(module.exports, "DropdownMenuGroup", () => $d1bf075a6b218014$export$246bebaba3a2f70e);
$parcel$export(module.exports, "DropdownMenuLabel", () => $d1bf075a6b218014$export$76e48c5b57f24495);
$parcel$export(module.exports, "DropdownMenuItem", () => $d1bf075a6b218014$export$ed97964d1871885d);
$parcel$export(module.exports, "DropdownMenuCheckboxItem", () => $d1bf075a6b218014$export$53a69729da201fa9);
$parcel$export(module.exports, "DropdownMenuRadioGroup", () => $d1bf075a6b218014$export$3323ad73d55f587e);
$parcel$export(module.exports, "DropdownMenuRadioItem", () => $d1bf075a6b218014$export$e4f69b41b1637536);
$parcel$export(module.exports, "DropdownMenuItemIndicator", () => $d1bf075a6b218014$export$42355ae145153fb6);
$parcel$export(module.exports, "DropdownMenuSeparator", () => $d1bf075a6b218014$export$da160178fd3bc7e9);
$parcel$export(module.exports, "DropdownMenuArrow", () => $d1bf075a6b218014$export$34b8980744021ec5);
$parcel$export(module.exports, "DropdownMenuSub", () => $d1bf075a6b218014$export$2f307d81a64f5442);
$parcel$export(module.exports, "DropdownMenuSubTrigger", () => $d1bf075a6b218014$export$21dcb7ec56f874cf);
$parcel$export(module.exports, "DropdownMenuSubContent", () => $d1bf075a6b218014$export$f34ec8bc2482cc5f);
$parcel$export(module.exports, "Root", () => $d1bf075a6b218014$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Trigger", () => $d1bf075a6b218014$export$41fb9f06171c75f4);
$parcel$export(module.exports, "Portal", () => $d1bf075a6b218014$export$602eac185826482c);
$parcel$export(module.exports, "Content", () => $d1bf075a6b218014$export$7c6e2c02157bb7d2);
$parcel$export(module.exports, "Group", () => $d1bf075a6b218014$export$eb2fcfdbd7ba97d4);
$parcel$export(module.exports, "Label", () => $d1bf075a6b218014$export$b04be29aa201d4f5);
$parcel$export(module.exports, "Item", () => $d1bf075a6b218014$export$6d08773d2e66f8f2);
$parcel$export(module.exports, "CheckboxItem", () => $d1bf075a6b218014$export$16ce288f89fa631c);
$parcel$export(module.exports, "RadioGroup", () => $d1bf075a6b218014$export$a98f0dcb43a68a25);
$parcel$export(module.exports, "RadioItem", () => $d1bf075a6b218014$export$371ab307eab489c0);
$parcel$export(module.exports, "ItemIndicator", () => $d1bf075a6b218014$export$c3468e2714d175fa);
$parcel$export(module.exports, "Separator", () => $d1bf075a6b218014$export$1ff3c3f08ae963c0);
$parcel$export(module.exports, "Arrow", () => $d1bf075a6b218014$export$21b07c8f274aebd5);
$parcel$export(module.exports, "Sub", () => $d1bf075a6b218014$export$d7a01e11500dfb6f);
$parcel$export(module.exports, "SubTrigger", () => $d1bf075a6b218014$export$2ea8a7a591ac5eac);
$parcel$export(module.exports, "SubContent", () => $d1bf075a6b218014$export$6d4de93b380beddf);
/* -------------------------------------------------------------------------------------------------
* DropdownMenu
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$DROPDOWN_MENU_NAME = 'DropdownMenu';
const [$d1bf075a6b218014$var$createDropdownMenuContext, $d1bf075a6b218014$export$c0623cd925aeb687] = $7dQ7Q$radixuireactcontext.createContextScope($d1bf075a6b218014$var$DROPDOWN_MENU_NAME, [$7dQ7Q$radixuireactmenu.createMenuScope]);
const $d1bf075a6b218014$var$useMenuScope = $7dQ7Q$radixuireactmenu.createMenuScope();
const [$d1bf075a6b218014$var$DropdownMenuProvider, $d1bf075a6b218014$var$useDropdownMenuContext] = $d1bf075a6b218014$var$createDropdownMenuContext($d1bf075a6b218014$var$DROPDOWN_MENU_NAME);
const $d1bf075a6b218014$export$e44a253a59704894 = props => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
children: children,
dir: dir,
open: openProp,
defaultOpen: defaultOpen,
onOpenChange: onOpenChange,
modal = true
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
const triggerRef = $7dQ7Q$react.useRef(null);
const [open = false, setOpen] = $7dQ7Q$radixuireactusecontrollablestate.useControllableState({
prop: openProp,
defaultProp: defaultOpen,
onChange: onOpenChange
});
return /*#__PURE__*/$7dQ7Q$react.createElement($d1bf075a6b218014$var$DropdownMenuProvider, {
scope: __scopeDropdownMenu,
triggerId: $7dQ7Q$radixuireactid.useId(),
triggerRef: triggerRef,
contentId: $7dQ7Q$radixuireactid.useId(),
open: open,
onOpenChange: setOpen,
onOpenToggle: $7dQ7Q$react.useCallback(() => setOpen(prevOpen => !prevOpen), [setOpen]),
modal: modal
}, /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.Root, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, {
open: open,
onOpenChange: setOpen,
dir: dir,
modal: modal
}), children));
};
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$e44a253a59704894, {
displayName: $d1bf075a6b218014$var$DROPDOWN_MENU_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuTrigger
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$TRIGGER_NAME = 'DropdownMenuTrigger';
const $d1bf075a6b218014$export$d2469213b3befba9 = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
disabled = false,
...triggerProps
} = props;
const context = $d1bf075a6b218014$var$useDropdownMenuContext($d1bf075a6b218014$var$TRIGGER_NAME, __scopeDropdownMenu);
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.Anchor, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({
asChild: true
}, menuScope), /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactprimitive.Primitive.button, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({
type: "button",
id: context.triggerId,
"aria-haspopup": "menu",
"aria-expanded": context.open,
"aria-controls": context.open ? context.contentId : undefined,
"data-state": context.open ? 'open' : 'closed',
"data-disabled": disabled ? '' : undefined,
disabled: disabled
}, triggerProps, {
ref: $7dQ7Q$radixuireactcomposerefs.composeRefs(forwardedRef, context.triggerRef),
onPointerDown: $7dQ7Q$radixuiprimitive.composeEventHandlers(props.onPointerDown, event => {
// only call handler if it's the left button (mousedown gets triggered by all mouse buttons)
// but not when the control key is pressed (avoiding MacOS right click)
if (!disabled && event.button === 0 && event.ctrlKey === false) {
context.onOpenToggle(); // prevent trigger focusing when opening
// this allows the content to be given focus without competition
if (!context.open) event.preventDefault();
}
}),
onKeyDown: $7dQ7Q$radixuiprimitive.composeEventHandlers(props.onKeyDown, event => {
if (disabled) return;
if (['Enter', ' '].includes(event.key)) context.onOpenToggle();
if (event.key === 'ArrowDown') context.onOpenChange(true); // prevent keydown from scrolling window / first focused item to execute
// that keydown (inadvertently closing the menu)
if (['Enter', ' ', 'ArrowDown'].includes(event.key)) event.preventDefault();
})
})));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$d2469213b3befba9, {
displayName: $d1bf075a6b218014$var$TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuPortal
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$PORTAL_NAME = 'DropdownMenuPortal';
const $d1bf075a6b218014$export$cd369b4d4d54efc9 = props => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...portalProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.Portal, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, portalProps));
};
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$cd369b4d4d54efc9, {
displayName: $d1bf075a6b218014$var$PORTAL_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuContent
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$CONTENT_NAME = 'DropdownMenuContent';
const $d1bf075a6b218014$export$6e76d93a37c01248 = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...contentProps
} = props;
const context = $d1bf075a6b218014$var$useDropdownMenuContext($d1bf075a6b218014$var$CONTENT_NAME, __scopeDropdownMenu);
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
const hasInteractedOutsideRef = $7dQ7Q$react.useRef(false);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.Content, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({
id: context.contentId,
"aria-labelledby": context.triggerId
}, menuScope, contentProps, {
ref: forwardedRef,
onCloseAutoFocus: $7dQ7Q$radixuiprimitive.composeEventHandlers(props.onCloseAutoFocus, event => {
var _context$triggerRef$c;
if (!hasInteractedOutsideRef.current) (_context$triggerRef$c = context.triggerRef.current) === null || _context$triggerRef$c === void 0 || _context$triggerRef$c.focus();
hasInteractedOutsideRef.current = false; // Always prevent auto focus because we either focus manually or want user agent focus
event.preventDefault();
}),
onInteractOutside: $7dQ7Q$radixuiprimitive.composeEventHandlers(props.onInteractOutside, event => {
const originalEvent = event.detail.originalEvent;
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;
}),
style: {
...props.style,
'--radix-dropdown-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',
'--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',
'--radix-dropdown-menu-content-available-height': 'var(--radix-popper-available-height)',
'--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',
'--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)'
}
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$6e76d93a37c01248, {
displayName: $d1bf075a6b218014$var$CONTENT_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuGroup
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$GROUP_NAME = 'DropdownMenuGroup';
const $d1bf075a6b218014$export$246bebaba3a2f70e = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...groupProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.Group, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, groupProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$246bebaba3a2f70e, {
displayName: $d1bf075a6b218014$var$GROUP_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuLabel
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$LABEL_NAME = 'DropdownMenuLabel';
const $d1bf075a6b218014$export$76e48c5b57f24495 = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...labelProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.Label, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, labelProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$76e48c5b57f24495, {
displayName: $d1bf075a6b218014$var$LABEL_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuItem
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$ITEM_NAME = 'DropdownMenuItem';
const $d1bf075a6b218014$export$ed97964d1871885d = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...itemProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.Item, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, itemProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$ed97964d1871885d, {
displayName: $d1bf075a6b218014$var$ITEM_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuCheckboxItem
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$CHECKBOX_ITEM_NAME = 'DropdownMenuCheckboxItem';
const $d1bf075a6b218014$export$53a69729da201fa9 = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...checkboxItemProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.CheckboxItem, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, checkboxItemProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$53a69729da201fa9, {
displayName: $d1bf075a6b218014$var$CHECKBOX_ITEM_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuRadioGroup
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$RADIO_GROUP_NAME = 'DropdownMenuRadioGroup';
const $d1bf075a6b218014$export$3323ad73d55f587e = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...radioGroupProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.RadioGroup, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, radioGroupProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$3323ad73d55f587e, {
displayName: $d1bf075a6b218014$var$RADIO_GROUP_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuRadioItem
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$RADIO_ITEM_NAME = 'DropdownMenuRadioItem';
const $d1bf075a6b218014$export$e4f69b41b1637536 = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...radioItemProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.RadioItem, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, radioItemProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$e4f69b41b1637536, {
displayName: $d1bf075a6b218014$var$RADIO_ITEM_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuItemIndicator
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$INDICATOR_NAME = 'DropdownMenuItemIndicator';
const $d1bf075a6b218014$export$42355ae145153fb6 = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...itemIndicatorProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.ItemIndicator, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, itemIndicatorProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$42355ae145153fb6, {
displayName: $d1bf075a6b218014$var$INDICATOR_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuSeparator
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$SEPARATOR_NAME = 'DropdownMenuSeparator';
const $d1bf075a6b218014$export$da160178fd3bc7e9 = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...separatorProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.Separator, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, separatorProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$da160178fd3bc7e9, {
displayName: $d1bf075a6b218014$var$SEPARATOR_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuArrow
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$ARROW_NAME = 'DropdownMenuArrow';
const $d1bf075a6b218014$export$34b8980744021ec5 = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...arrowProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.Arrow, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, arrowProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$34b8980744021ec5, {
displayName: $d1bf075a6b218014$var$ARROW_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuSub
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$export$2f307d81a64f5442 = props => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
children: children,
open: openProp,
onOpenChange: onOpenChange,
defaultOpen: defaultOpen
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
const [open = false, setOpen] = $7dQ7Q$radixuireactusecontrollablestate.useControllableState({
prop: openProp,
defaultProp: defaultOpen,
onChange: onOpenChange
});
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.Sub, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, {
open: open,
onOpenChange: setOpen
}), children);
};
/* -------------------------------------------------------------------------------------------------
* DropdownMenuSubTrigger
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$SUB_TRIGGER_NAME = 'DropdownMenuSubTrigger';
const $d1bf075a6b218014$export$21dcb7ec56f874cf = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...subTriggerProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.SubTrigger, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, subTriggerProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$21dcb7ec56f874cf, {
displayName: $d1bf075a6b218014$var$SUB_TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* DropdownMenuSubContent
* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$var$SUB_CONTENT_NAME = 'DropdownMenuSubContent';
const $d1bf075a6b218014$export$f34ec8bc2482cc5f = /*#__PURE__*/$7dQ7Q$react.forwardRef((props, forwardedRef) => {
const {
__scopeDropdownMenu: __scopeDropdownMenu,
...subContentProps
} = props;
const menuScope = $d1bf075a6b218014$var$useMenuScope(__scopeDropdownMenu);
return /*#__PURE__*/$7dQ7Q$react.createElement($7dQ7Q$radixuireactmenu.SubContent, $parcel$interopDefault($7dQ7Q$babelruntimehelpersextends)({}, menuScope, subContentProps, {
ref: forwardedRef,
style: {
...props.style,
'--radix-dropdown-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',
'--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',
'--radix-dropdown-menu-content-available-height': 'var(--radix-popper-available-height)',
'--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',
'--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)'
}
}));
});
/*#__PURE__*/
Object.assign($d1bf075a6b218014$export$f34ec8bc2482cc5f, {
displayName: $d1bf075a6b218014$var$SUB_CONTENT_NAME
});
/* -----------------------------------------------------------------------------------------------*/
const $d1bf075a6b218014$export$be92b6f5f03c0fe9 = $d1bf075a6b218014$export$e44a253a59704894;
const $d1bf075a6b218014$export$41fb9f06171c75f4 = $d1bf075a6b218014$export$d2469213b3befba9;
const $d1bf075a6b218014$export$602eac185826482c = $d1bf075a6b218014$export$cd369b4d4d54efc9;
const $d1bf075a6b218014$export$7c6e2c02157bb7d2 = $d1bf075a6b218014$export$6e76d93a37c01248;
const $d1bf075a6b218014$export$eb2fcfdbd7ba97d4 = $d1bf075a6b218014$export$246bebaba3a2f70e;
const $d1bf075a6b218014$export$b04be29aa201d4f5 = $d1bf075a6b218014$export$76e48c5b57f24495;
const $d1bf075a6b218014$export$6d08773d2e66f8f2 = $d1bf075a6b218014$export$ed97964d1871885d;
const $d1bf075a6b218014$export$16ce288f89fa631c = $d1bf075a6b218014$export$53a69729da201fa9;
const $d1bf075a6b218014$export$a98f0dcb43a68a25 = $d1bf075a6b218014$export$3323ad73d55f587e;
const $d1bf075a6b218014$export$371ab307eab489c0 = $d1bf075a6b218014$export$e4f69b41b1637536;
const $d1bf075a6b218014$export$c3468e2714d175fa = $d1bf075a6b218014$export$42355ae145153fb6;
const $d1bf075a6b218014$export$1ff3c3f08ae963c0 = $d1bf075a6b218014$export$da160178fd3bc7e9;
const $d1bf075a6b218014$export$21b07c8f274aebd5 = $d1bf075a6b218014$export$34b8980744021ec5;
const $d1bf075a6b218014$export$d7a01e11500dfb6f = $d1bf075a6b218014$export$2f307d81a64f5442;
const $d1bf075a6b218014$export$2ea8a7a591ac5eac = $d1bf075a6b218014$export$21dcb7ec56f874cf;
const $d1bf075a6b218014$export$6d4de93b380beddf = $d1bf075a6b218014$export$f34ec8bc2482cc5f;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-focus-guards/dist/index.js":
/*!************************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-focus-guards/dist/index.js ***!
\************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $cnctE$react = __webpack_require__(/*! react */ "react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "FocusGuards", () => $71476a6ed7dbbaf3$export$ac5b58043b79449b);
$parcel$export(module.exports, "Root", () => $71476a6ed7dbbaf3$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "useFocusGuards", () => $71476a6ed7dbbaf3$export$b7ece24a22aeda8c);
/** Number of components which have requested interest to have focus guards */
let $71476a6ed7dbbaf3$var$count = 0;
function $71476a6ed7dbbaf3$export$ac5b58043b79449b(props) {
$71476a6ed7dbbaf3$export$b7ece24a22aeda8c();
return props.children;
}
/**
* Injects a pair of focus guards at the edges of the whole DOM tree
* to ensure `focusin` & `focusout` events can be caught consistently.
*/
function $71476a6ed7dbbaf3$export$b7ece24a22aeda8c() {
$cnctE$react.useEffect(() => {
var _edgeGuards$, _edgeGuards$2;
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $71476a6ed7dbbaf3$var$createFocusGuard());
document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $71476a6ed7dbbaf3$var$createFocusGuard());
$71476a6ed7dbbaf3$var$count++;
return () => {
if ($71476a6ed7dbbaf3$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach(node => node.remove());
$71476a6ed7dbbaf3$var$count--;
};
}, []);
}
function $71476a6ed7dbbaf3$var$createFocusGuard() {
const element = document.createElement('span');
element.setAttribute('data-radix-focus-guard', '');
element.tabIndex = 0;
element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';
return element;
}
const $71476a6ed7dbbaf3$export$be92b6f5f03c0fe9 = $71476a6ed7dbbaf3$export$ac5b58043b79449b;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-focus-scope/dist/index.js":
/*!***********************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-focus-scope/dist/index.js ***!
\***********************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $buum9$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $buum9$react = __webpack_require__(/*! react */ "react");
var $buum9$radixuireactcomposerefs = __webpack_require__(/*! @radix-ui/react-compose-refs */ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js");
var $buum9$radixuireactprimitive = __webpack_require__(/*! @radix-ui/react-primitive */ "../../../node_modules/@radix-ui/react-primitive/dist/index.js");
var $buum9$radixuireactusecallbackref = __webpack_require__(/*! @radix-ui/react-use-callback-ref */ "../../../node_modules/@radix-ui/react-use-callback-ref/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "FocusScope", () => $2bc01e66e04aa9ed$export$20e40289641fbbb6);
$parcel$export(module.exports, "Root", () => $2bc01e66e04aa9ed$export$be92b6f5f03c0fe9);
const $2bc01e66e04aa9ed$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
const $2bc01e66e04aa9ed$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
const $2bc01e66e04aa9ed$var$EVENT_OPTIONS = {
bubbles: false,
cancelable: true
};
/* -------------------------------------------------------------------------------------------------
* FocusScope
* -----------------------------------------------------------------------------------------------*/
const $2bc01e66e04aa9ed$var$FOCUS_SCOPE_NAME = 'FocusScope';
const $2bc01e66e04aa9ed$export$20e40289641fbbb6 = /*#__PURE__*/$buum9$react.forwardRef((props, forwardedRef) => {
const {
loop = false,
trapped = false,
onMountAutoFocus: onMountAutoFocusProp,
onUnmountAutoFocus: onUnmountAutoFocusProp,
...scopeProps
} = props;
const [container1, setContainer] = $buum9$react.useState(null);
const onMountAutoFocus = $buum9$radixuireactusecallbackref.useCallbackRef(onMountAutoFocusProp);
const onUnmountAutoFocus = $buum9$radixuireactusecallbackref.useCallbackRef(onUnmountAutoFocusProp);
const lastFocusedElementRef = $buum9$react.useRef(null);
const composedRefs = $buum9$radixuireactcomposerefs.useComposedRefs(forwardedRef, node => setContainer(node));
const focusScope = $buum9$react.useRef({
paused: false,
pause() {
this.paused = true;
},
resume() {
this.paused = false;
}
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
$buum9$react.useEffect(() => {
if (trapped) {
function handleFocusIn(event) {
if (focusScope.paused || !container1) return;
const target = event.target;
if (container1.contains(target)) lastFocusedElementRef.current = target;else $2bc01e66e04aa9ed$var$focus(lastFocusedElementRef.current, {
select: true
});
}
function handleFocusOut(event) {
if (focusScope.paused || !container1) return;
const relatedTarget = event.relatedTarget; // A `focusout` event with a `null` `relatedTarget` will happen in at least two cases:
//
// 1. When the user switches app/tabs/windows/the browser itself loses focus.
// 2. In Google Chrome, when the focused element is removed from the DOM.
//
// We let the browser do its thing here because:
//
// 1. The browser already keeps a memory of what's focused for when the page gets refocused.
// 2. In Google Chrome, if we try to focus the deleted focused element (as per below), it
// throws the CPU to 100%, so we avoid doing anything for this reason here too.
if (relatedTarget === null) return; // If the focus has moved to an actual legitimate element (`relatedTarget !== null`)
// that is outside the container, we move focus to the last valid focused element inside.
if (!container1.contains(relatedTarget)) $2bc01e66e04aa9ed$var$focus(lastFocusedElementRef.current, {
select: true
});
} // When the focused element gets removed from the DOM, browsers move focus
// back to the document.body. In this case, we move focus to the container
// to keep focus trapped correctly.
function handleMutations(mutations) {
const focusedElement = document.activeElement;
for (const mutation of mutations) {
if (mutation.removedNodes.length > 0) {
if (!(container1 !== null && container1 !== void 0 && container1.contains(focusedElement))) $2bc01e66e04aa9ed$var$focus(container1);
}
}
}
document.addEventListener('focusin', handleFocusIn);
document.addEventListener('focusout', handleFocusOut);
const mutationObserver = new MutationObserver(handleMutations);
if (container1) mutationObserver.observe(container1, {
childList: true,
subtree: true
});
return () => {
document.removeEventListener('focusin', handleFocusIn);
document.removeEventListener('focusout', handleFocusOut);
mutationObserver.disconnect();
};
}
}, [trapped, container1, focusScope.paused]);
$buum9$react.useEffect(() => {
if (container1) {
$2bc01e66e04aa9ed$var$focusScopesStack.add(focusScope);
const previouslyFocusedElement = document.activeElement;
const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
if (!hasFocusedCandidate) {
const mountEvent = new CustomEvent($2bc01e66e04aa9ed$var$AUTOFOCUS_ON_MOUNT, $2bc01e66e04aa9ed$var$EVENT_OPTIONS);
container1.addEventListener($2bc01e66e04aa9ed$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
container1.dispatchEvent(mountEvent);
if (!mountEvent.defaultPrevented) {
$2bc01e66e04aa9ed$var$focusFirst($2bc01e66e04aa9ed$var$removeLinks($2bc01e66e04aa9ed$var$getTabbableCandidates(container1)), {
select: true
});
if (document.activeElement === previouslyFocusedElement) $2bc01e66e04aa9ed$var$focus(container1);
}
}
return () => {
container1.removeEventListener($2bc01e66e04aa9ed$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
// We need to delay the focus a little to get around it for now.
// See: https://github.com/facebook/react/issues/17894
setTimeout(() => {
const unmountEvent = new CustomEvent($2bc01e66e04aa9ed$var$AUTOFOCUS_ON_UNMOUNT, $2bc01e66e04aa9ed$var$EVENT_OPTIONS);
container1.addEventListener($2bc01e66e04aa9ed$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
container1.dispatchEvent(unmountEvent);
if (!unmountEvent.defaultPrevented) $2bc01e66e04aa9ed$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
select: true
});
// we need to remove the listener after we `dispatchEvent`
container1.removeEventListener($2bc01e66e04aa9ed$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
$2bc01e66e04aa9ed$var$focusScopesStack.remove(focusScope);
}, 0);
};
}
}, [container1, onMountAutoFocus, onUnmountAutoFocus, focusScope]); // Takes care of looping focus (when tabbing whilst at the edges)
const handleKeyDown = $buum9$react.useCallback(event => {
if (!loop && !trapped) return;
if (focusScope.paused) return;
const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
const focusedElement = document.activeElement;
if (isTabKey && focusedElement) {
const container = event.currentTarget;
const [first, last] = $2bc01e66e04aa9ed$var$getTabbableEdges(container);
const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
if (!hasTabbableElementsInside) {
if (focusedElement === container) event.preventDefault();
} else {
if (!event.shiftKey && focusedElement === last) {
event.preventDefault();
if (loop) $2bc01e66e04aa9ed$var$focus(first, {
select: true
});
} else if (event.shiftKey && focusedElement === first) {
event.preventDefault();
if (loop) $2bc01e66e04aa9ed$var$focus(last, {
select: true
});
}
}
}
}, [loop, trapped, focusScope.paused]);
return /*#__PURE__*/$buum9$react.createElement($buum9$radixuireactprimitive.Primitive.div, $parcel$interopDefault($buum9$babelruntimehelpersextends)({
tabIndex: -1
}, scopeProps, {
ref: composedRefs,
onKeyDown: handleKeyDown
}));
});
/*#__PURE__*/
Object.assign($2bc01e66e04aa9ed$export$20e40289641fbbb6, {
displayName: $2bc01e66e04aa9ed$var$FOCUS_SCOPE_NAME
});
/* -------------------------------------------------------------------------------------------------
* Utils
* -----------------------------------------------------------------------------------------------*/ /**
* Attempts focusing the first element in a list of candidates.
* Stops when focus has actually moved.
*/
function $2bc01e66e04aa9ed$var$focusFirst(candidates) {
let {
select = false
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const previouslyFocusedElement = document.activeElement;
for (const candidate of candidates) {
$2bc01e66e04aa9ed$var$focus(candidate, {
select: select
});
if (document.activeElement !== previouslyFocusedElement) return;
}
}
/**
* Returns the first and last tabbable elements inside a container.
*/
function $2bc01e66e04aa9ed$var$getTabbableEdges(container) {
const candidates = $2bc01e66e04aa9ed$var$getTabbableCandidates(container);
const first = $2bc01e66e04aa9ed$var$findVisible(candidates, container);
const last = $2bc01e66e04aa9ed$var$findVisible(candidates.reverse(), container);
return [first, last];
}
/**
* Returns a list of potential tabbable candidates.
*
* NOTE: This is only a close approximation. For example it doesn't take into account cases like when
* elements are not visible. This cannot be worked out easily by just reading a property, but rather
* necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
*
* See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
* Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
*/
function $2bc01e66e04aa9ed$var$getTabbableCandidates(container) {
const nodes = [];
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
acceptNode: node => {
const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
// runtime's understanding of tabbability, so this automatically accounts
// for any kind of element that could be tabbed to.
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
}
});
while (walker.nextNode()) nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
// hinders accessibility to have tab order different from visual order.
return nodes;
}
/**
* Returns the first visible element in a list.
* NOTE: Only checks visibility up to the `container`.
*/
function $2bc01e66e04aa9ed$var$findVisible(elements, container) {
for (const element of elements) {
// we stop checking if it's hidden at the `container` level (excluding)
if (!$2bc01e66e04aa9ed$var$isHidden(element, {
upTo: container
})) return element;
}
}
function $2bc01e66e04aa9ed$var$isHidden(node, _ref) {
let {
upTo: upTo
} = _ref;
if (getComputedStyle(node).visibility === 'hidden') return true;
while (node) {
// we stop at `upTo` (excluding it)
if (upTo !== undefined && node === upTo) return false;
if (getComputedStyle(node).display === 'none') return true;
node = node.parentElement;
}
return false;
}
function $2bc01e66e04aa9ed$var$isSelectableInput(element) {
return element instanceof HTMLInputElement && 'select' in element;
}
function $2bc01e66e04aa9ed$var$focus(element) {
let {
select = false
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
// only focus if that element is focusable
if (element && element.focus) {
const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
element.focus({
preventScroll: true
}); // only select if its not the same element, it supports selection and we need to select
if (element !== previouslyFocusedElement && $2bc01e66e04aa9ed$var$isSelectableInput(element) && select) element.select();
}
}
/* -------------------------------------------------------------------------------------------------
* FocusScope stack
* -----------------------------------------------------------------------------------------------*/
const $2bc01e66e04aa9ed$var$focusScopesStack = $2bc01e66e04aa9ed$var$createFocusScopesStack();
function $2bc01e66e04aa9ed$var$createFocusScopesStack() {
/** A stack of focus scopes, with the active one at the top */let stack = [];
return {
add(focusScope) {
// pause the currently active focus scope (at the top of the stack)
const activeFocusScope = stack[0];
if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
// remove in case it already exists (because we'll re-add it at the top of the stack)
stack = $2bc01e66e04aa9ed$var$arrayRemove(stack, focusScope);
stack.unshift(focusScope);
},
remove(focusScope) {
var _stack$;
stack = $2bc01e66e04aa9ed$var$arrayRemove(stack, focusScope);
(_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
}
};
}
function $2bc01e66e04aa9ed$var$arrayRemove(array, item) {
const updatedArray = [...array];
const index = updatedArray.indexOf(item);
if (index !== -1) updatedArray.splice(index, 1);
return updatedArray;
}
function $2bc01e66e04aa9ed$var$removeLinks(items) {
return items.filter(item => item.tagName !== 'A');
}
const $2bc01e66e04aa9ed$export$be92b6f5f03c0fe9 = $2bc01e66e04aa9ed$export$20e40289641fbbb6;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-id/dist/index.js":
/*!**************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-id/dist/index.js ***!
\**************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $47woD$react = __webpack_require__(/*! react */ "react");
var $47woD$radixuireactuselayouteffect = __webpack_require__(/*! @radix-ui/react-use-layout-effect */ "../../../node_modules/@radix-ui/react-use-layout-effect/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "useId", () => $dc478e4659f630c5$export$f680877a34711e37);
const $dc478e4659f630c5$var$useReactId = $47woD$react['useId'.toString()] || (() => undefined);
let $dc478e4659f630c5$var$count = 0;
function $dc478e4659f630c5$export$f680877a34711e37(deterministicId) {
const [id, setId] = $47woD$react.useState($dc478e4659f630c5$var$useReactId()); // React versions older than 18 will have client-side ids only.
$47woD$radixuireactuselayouteffect.useLayoutEffect(() => {
if (!deterministicId) setId(reactId => reactId !== null && reactId !== void 0 ? reactId : String($dc478e4659f630c5$var$count++));
}, [deterministicId]);
return deterministicId || (id ? `radix-${id}` : '');
}
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-menu/dist/index.js":
/*!****************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-menu/dist/index.js ***!
\****************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $cnSS2$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $cnSS2$react = __webpack_require__(/*! react */ "react");
var $cnSS2$radixuiprimitive = __webpack_require__(/*! @radix-ui/primitive */ "../../../node_modules/@radix-ui/primitive/dist/index.js");
var $cnSS2$radixuireactcollection = __webpack_require__(/*! @radix-ui/react-collection */ "../../../node_modules/@radix-ui/react-collection/dist/index.js");
var $cnSS2$radixuireactcomposerefs = __webpack_require__(/*! @radix-ui/react-compose-refs */ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js");
var $cnSS2$radixuireactcontext = __webpack_require__(/*! @radix-ui/react-context */ "../../../node_modules/@radix-ui/react-context/dist/index.js");
var $cnSS2$radixuireactdirection = __webpack_require__(/*! @radix-ui/react-direction */ "../../../node_modules/@radix-ui/react-direction/dist/index.js");
var $cnSS2$radixuireactdismissablelayer = __webpack_require__(/*! @radix-ui/react-dismissable-layer */ "../../../node_modules/@radix-ui/react-dismissable-layer/dist/index.js");
var $cnSS2$radixuireactfocusguards = __webpack_require__(/*! @radix-ui/react-focus-guards */ "../../../node_modules/@radix-ui/react-focus-guards/dist/index.js");
var $cnSS2$radixuireactfocusscope = __webpack_require__(/*! @radix-ui/react-focus-scope */ "../../../node_modules/@radix-ui/react-focus-scope/dist/index.js");
var $cnSS2$radixuireactid = __webpack_require__(/*! @radix-ui/react-id */ "../../../node_modules/@radix-ui/react-id/dist/index.js");
var $cnSS2$radixuireactpopper = __webpack_require__(/*! @radix-ui/react-popper */ "../../../node_modules/@radix-ui/react-popper/dist/index.js");
var $cnSS2$radixuireactportal = __webpack_require__(/*! @radix-ui/react-portal */ "../../../node_modules/@radix-ui/react-portal/dist/index.js");
var $cnSS2$radixuireactpresence = __webpack_require__(/*! @radix-ui/react-presence */ "../../../node_modules/@radix-ui/react-presence/dist/index.js");
var $cnSS2$radixuireactprimitive = __webpack_require__(/*! @radix-ui/react-primitive */ "../../../node_modules/@radix-ui/react-primitive/dist/index.js");
var $cnSS2$radixuireactrovingfocus = __webpack_require__(/*! @radix-ui/react-roving-focus */ "../../../node_modules/@radix-ui/react-roving-focus/dist/index.js");
var $cnSS2$radixuireactslot = __webpack_require__(/*! @radix-ui/react-slot */ "../../../node_modules/@radix-ui/react-slot/dist/index.js");
var $cnSS2$radixuireactusecallbackref = __webpack_require__(/*! @radix-ui/react-use-callback-ref */ "../../../node_modules/@radix-ui/react-use-callback-ref/dist/index.js");
var $cnSS2$ariahidden = __webpack_require__(/*! aria-hidden */ "../../../node_modules/aria-hidden/dist/es2015/index.js");
var $cnSS2$reactremovescroll = __webpack_require__(/*! react-remove-scroll */ "../../../node_modules/react-remove-scroll/dist/es2015/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "createMenuScope", () => $213e4d2df823067d$export$4027731b685e72eb);
$parcel$export(module.exports, "Menu", () => $213e4d2df823067d$export$d9b273488cd8ce6f);
$parcel$export(module.exports, "MenuAnchor", () => $213e4d2df823067d$export$9fa5ebd18bee4d43);
$parcel$export(module.exports, "MenuPortal", () => $213e4d2df823067d$export$793392f970497feb);
$parcel$export(module.exports, "MenuContent", () => $213e4d2df823067d$export$479f0f2f71193efe);
$parcel$export(module.exports, "MenuGroup", () => $213e4d2df823067d$export$22a631d1f72787bb);
$parcel$export(module.exports, "MenuLabel", () => $213e4d2df823067d$export$dd37bec0e8a99143);
$parcel$export(module.exports, "MenuItem", () => $213e4d2df823067d$export$2ce376c2cc3355c8);
$parcel$export(module.exports, "MenuCheckboxItem", () => $213e4d2df823067d$export$f6f243521332502d);
$parcel$export(module.exports, "MenuRadioGroup", () => $213e4d2df823067d$export$ea2200c9eee416b3);
$parcel$export(module.exports, "MenuRadioItem", () => $213e4d2df823067d$export$69bd225e9817f6d0);
$parcel$export(module.exports, "MenuItemIndicator", () => $213e4d2df823067d$export$a2593e23056970a3);
$parcel$export(module.exports, "MenuSeparator", () => $213e4d2df823067d$export$1cec7dcdd713e220);
$parcel$export(module.exports, "MenuArrow", () => $213e4d2df823067d$export$bcdda4773debf5fa);
$parcel$export(module.exports, "MenuSub", () => $213e4d2df823067d$export$71bdb9d1e2909932);
$parcel$export(module.exports, "MenuSubTrigger", () => $213e4d2df823067d$export$5fbbb3ba7297405f);
$parcel$export(module.exports, "MenuSubContent", () => $213e4d2df823067d$export$e7142ab31822bde6);
$parcel$export(module.exports, "Root", () => $213e4d2df823067d$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Anchor", () => $213e4d2df823067d$export$b688253958b8dfe7);
$parcel$export(module.exports, "Portal", () => $213e4d2df823067d$export$602eac185826482c);
$parcel$export(module.exports, "Content", () => $213e4d2df823067d$export$7c6e2c02157bb7d2);
$parcel$export(module.exports, "Group", () => $213e4d2df823067d$export$eb2fcfdbd7ba97d4);
$parcel$export(module.exports, "Label", () => $213e4d2df823067d$export$b04be29aa201d4f5);
$parcel$export(module.exports, "Item", () => $213e4d2df823067d$export$6d08773d2e66f8f2);
$parcel$export(module.exports, "CheckboxItem", () => $213e4d2df823067d$export$16ce288f89fa631c);
$parcel$export(module.exports, "RadioGroup", () => $213e4d2df823067d$export$a98f0dcb43a68a25);
$parcel$export(module.exports, "RadioItem", () => $213e4d2df823067d$export$371ab307eab489c0);
$parcel$export(module.exports, "ItemIndicator", () => $213e4d2df823067d$export$c3468e2714d175fa);
$parcel$export(module.exports, "Separator", () => $213e4d2df823067d$export$1ff3c3f08ae963c0);
$parcel$export(module.exports, "Arrow", () => $213e4d2df823067d$export$21b07c8f274aebd5);
$parcel$export(module.exports, "Sub", () => $213e4d2df823067d$export$d7a01e11500dfb6f);
$parcel$export(module.exports, "SubTrigger", () => $213e4d2df823067d$export$2ea8a7a591ac5eac);
$parcel$export(module.exports, "SubContent", () => $213e4d2df823067d$export$6d4de93b380beddf);
const $213e4d2df823067d$var$SELECTION_KEYS = ['Enter', ' '];
const $213e4d2df823067d$var$FIRST_KEYS = ['ArrowDown', 'PageUp', 'Home'];
const $213e4d2df823067d$var$LAST_KEYS = ['ArrowUp', 'PageDown', 'End'];
const $213e4d2df823067d$var$FIRST_LAST_KEYS = [...$213e4d2df823067d$var$FIRST_KEYS, ...$213e4d2df823067d$var$LAST_KEYS];
const $213e4d2df823067d$var$SUB_OPEN_KEYS = {
ltr: [...$213e4d2df823067d$var$SELECTION_KEYS, 'ArrowRight'],
rtl: [...$213e4d2df823067d$var$SELECTION_KEYS, 'ArrowLeft']
};
const $213e4d2df823067d$var$SUB_CLOSE_KEYS = {
ltr: ['ArrowLeft'],
rtl: ['ArrowRight']
};
/* -------------------------------------------------------------------------------------------------
* Menu
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$MENU_NAME = 'Menu';
const [$213e4d2df823067d$var$Collection, $213e4d2df823067d$var$useCollection, $213e4d2df823067d$var$createCollectionScope] = $cnSS2$radixuireactcollection.createCollection($213e4d2df823067d$var$MENU_NAME);
const [$213e4d2df823067d$var$createMenuContext, $213e4d2df823067d$export$4027731b685e72eb] = $cnSS2$radixuireactcontext.createContextScope($213e4d2df823067d$var$MENU_NAME, [$213e4d2df823067d$var$createCollectionScope, $cnSS2$radixuireactpopper.createPopperScope, $cnSS2$radixuireactrovingfocus.createRovingFocusGroupScope]);
const $213e4d2df823067d$var$usePopperScope = $cnSS2$radixuireactpopper.createPopperScope();
const $213e4d2df823067d$var$useRovingFocusGroupScope = $cnSS2$radixuireactrovingfocus.createRovingFocusGroupScope();
const [$213e4d2df823067d$var$MenuProvider, $213e4d2df823067d$var$useMenuContext] = $213e4d2df823067d$var$createMenuContext($213e4d2df823067d$var$MENU_NAME);
const [$213e4d2df823067d$var$MenuRootProvider, $213e4d2df823067d$var$useMenuRootContext] = $213e4d2df823067d$var$createMenuContext($213e4d2df823067d$var$MENU_NAME);
const $213e4d2df823067d$export$d9b273488cd8ce6f = props => {
const {
__scopeMenu: __scopeMenu,
open = false,
children: children,
dir: dir,
onOpenChange: onOpenChange,
modal = true
} = props;
const popperScope = $213e4d2df823067d$var$usePopperScope(__scopeMenu);
const [content, setContent] = $cnSS2$react.useState(null);
const isUsingKeyboardRef = $cnSS2$react.useRef(false);
const handleOpenChange = $cnSS2$radixuireactusecallbackref.useCallbackRef(onOpenChange);
const direction = $cnSS2$radixuireactdirection.useDirection(dir);
$cnSS2$react.useEffect(() => {
// Capture phase ensures we set the boolean before any side effects execute
// in response to the key or pointer event as they might depend on this value.
const handleKeyDown = () => {
isUsingKeyboardRef.current = true;
document.addEventListener('pointerdown', handlePointer, {
capture: true,
once: true
});
document.addEventListener('pointermove', handlePointer, {
capture: true,
once: true
});
};
const handlePointer = () => isUsingKeyboardRef.current = false;
document.addEventListener('keydown', handleKeyDown, {
capture: true
});
return () => {
document.removeEventListener('keydown', handleKeyDown, {
capture: true
});
document.removeEventListener('pointerdown', handlePointer, {
capture: true
});
document.removeEventListener('pointermove', handlePointer, {
capture: true
});
};
}, []);
return /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactpopper.Root, popperScope, /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuProvider, {
scope: __scopeMenu,
open: open,
onOpenChange: handleOpenChange,
content: content,
onContentChange: setContent
}, /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuRootProvider, {
scope: __scopeMenu,
onClose: $cnSS2$react.useCallback(() => handleOpenChange(false), [handleOpenChange]),
isUsingKeyboardRef: isUsingKeyboardRef,
dir: direction,
modal: modal
}, children)));
};
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$d9b273488cd8ce6f, {
displayName: $213e4d2df823067d$var$MENU_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuAnchor
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$ANCHOR_NAME = 'MenuAnchor';
const $213e4d2df823067d$export$9fa5ebd18bee4d43 = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
__scopeMenu: __scopeMenu,
...anchorProps
} = props;
const popperScope = $213e4d2df823067d$var$usePopperScope(__scopeMenu);
return /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactpopper.Anchor, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({}, popperScope, anchorProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$9fa5ebd18bee4d43, {
displayName: $213e4d2df823067d$var$ANCHOR_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuPortal
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$PORTAL_NAME = 'MenuPortal';
const [$213e4d2df823067d$var$PortalProvider, $213e4d2df823067d$var$usePortalContext] = $213e4d2df823067d$var$createMenuContext($213e4d2df823067d$var$PORTAL_NAME, {
forceMount: undefined
});
const $213e4d2df823067d$export$793392f970497feb = props => {
const {
__scopeMenu: __scopeMenu,
forceMount: forceMount,
children: children,
container: container
} = props;
const context = $213e4d2df823067d$var$useMenuContext($213e4d2df823067d$var$PORTAL_NAME, __scopeMenu);
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$PortalProvider, {
scope: __scopeMenu,
forceMount: forceMount
}, /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactpresence.Presence, {
present: forceMount || context.open
}, /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactportal.Portal, {
asChild: true,
container: container
}, children)));
};
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$793392f970497feb, {
displayName: $213e4d2df823067d$var$PORTAL_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuContent
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$CONTENT_NAME = 'MenuContent';
const [$213e4d2df823067d$var$MenuContentProvider, $213e4d2df823067d$var$useMenuContentContext] = $213e4d2df823067d$var$createMenuContext($213e4d2df823067d$var$CONTENT_NAME);
const $213e4d2df823067d$export$479f0f2f71193efe = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const portalContext = $213e4d2df823067d$var$usePortalContext($213e4d2df823067d$var$CONTENT_NAME, props.__scopeMenu);
const {
forceMount = portalContext.forceMount,
...contentProps
} = props;
const context = $213e4d2df823067d$var$useMenuContext($213e4d2df823067d$var$CONTENT_NAME, props.__scopeMenu);
const rootContext = $213e4d2df823067d$var$useMenuRootContext($213e4d2df823067d$var$CONTENT_NAME, props.__scopeMenu);
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$Collection.Provider, {
scope: props.__scopeMenu
}, /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactpresence.Presence, {
present: forceMount || context.open
}, /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$Collection.Slot, {
scope: props.__scopeMenu
}, rootContext.modal ? /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuRootContentModal, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({}, contentProps, {
ref: forwardedRef
})) : /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuRootContentNonModal, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({}, contentProps, {
ref: forwardedRef
})))));
});
/* ---------------------------------------------------------------------------------------------- */
const $213e4d2df823067d$var$MenuRootContentModal = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const context = $213e4d2df823067d$var$useMenuContext($213e4d2df823067d$var$CONTENT_NAME, props.__scopeMenu);
const ref = $cnSS2$react.useRef(null);
const composedRefs = $cnSS2$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref); // Hide everything from ARIA except the `MenuContent`
$cnSS2$react.useEffect(() => {
const content = ref.current;
if (content) return $cnSS2$ariahidden.hideOthers(content);
}, []);
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuContentImpl, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({}, props, {
ref: composedRefs // we make sure we're not trapping once it's been closed
,
trapFocus: context.open // make sure to only disable pointer events when open
,
disableOutsidePointerEvents: context.open,
disableOutsideScroll: true // When focus is trapped, a `focusout` event may still happen.
,
onFocusOutside: $cnSS2$radixuiprimitive.composeEventHandlers(props.onFocusOutside, event => event.preventDefault(), {
checkForDefaultPrevented: false
}),
onDismiss: () => context.onOpenChange(false)
}));
});
const $213e4d2df823067d$var$MenuRootContentNonModal = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const context = $213e4d2df823067d$var$useMenuContext($213e4d2df823067d$var$CONTENT_NAME, props.__scopeMenu);
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuContentImpl, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({}, props, {
ref: forwardedRef,
trapFocus: false,
disableOutsidePointerEvents: false,
disableOutsideScroll: false,
onDismiss: () => context.onOpenChange(false)
}));
});
/* ---------------------------------------------------------------------------------------------- */
const $213e4d2df823067d$var$MenuContentImpl = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
__scopeMenu: __scopeMenu,
loop = false,
trapFocus: trapFocus,
onOpenAutoFocus: onOpenAutoFocus,
onCloseAutoFocus: onCloseAutoFocus,
disableOutsidePointerEvents: disableOutsidePointerEvents,
onEntryFocus: onEntryFocus,
onEscapeKeyDown: onEscapeKeyDown,
onPointerDownOutside: onPointerDownOutside,
onFocusOutside: onFocusOutside,
onInteractOutside: onInteractOutside,
onDismiss: onDismiss,
disableOutsideScroll: disableOutsideScroll,
...contentProps
} = props;
const context = $213e4d2df823067d$var$useMenuContext($213e4d2df823067d$var$CONTENT_NAME, __scopeMenu);
const rootContext = $213e4d2df823067d$var$useMenuRootContext($213e4d2df823067d$var$CONTENT_NAME, __scopeMenu);
const popperScope = $213e4d2df823067d$var$usePopperScope(__scopeMenu);
const rovingFocusGroupScope = $213e4d2df823067d$var$useRovingFocusGroupScope(__scopeMenu);
const getItems = $213e4d2df823067d$var$useCollection(__scopeMenu);
const [currentItemId, setCurrentItemId] = $cnSS2$react.useState(null);
const contentRef = $cnSS2$react.useRef(null);
const composedRefs = $cnSS2$radixuireactcomposerefs.useComposedRefs(forwardedRef, contentRef, context.onContentChange);
const timerRef = $cnSS2$react.useRef(0);
const searchRef = $cnSS2$react.useRef('');
const pointerGraceTimerRef = $cnSS2$react.useRef(0);
const pointerGraceIntentRef = $cnSS2$react.useRef(null);
const pointerDirRef = $cnSS2$react.useRef('right');
const lastPointerXRef = $cnSS2$react.useRef(0);
const ScrollLockWrapper = disableOutsideScroll ? $cnSS2$reactremovescroll.RemoveScroll : $cnSS2$react.Fragment;
const scrollLockWrapperProps = disableOutsideScroll ? {
as: $cnSS2$radixuireactslot.Slot,
allowPinchZoom: true
} : undefined;
const handleTypeaheadSearch = key => {
var _items$find, _items$find2;
const search = searchRef.current + key;
const items = getItems().filter(item => !item.disabled);
const currentItem = document.activeElement;
const currentMatch = (_items$find = items.find(item => item.ref.current === currentItem)) === null || _items$find === void 0 ? void 0 : _items$find.textValue;
const values = items.map(item => item.textValue);
const nextMatch = $213e4d2df823067d$var$getNextMatch(values, search, currentMatch);
const newItem = (_items$find2 = items.find(item => item.textValue === nextMatch)) === null || _items$find2 === void 0 ? void 0 : _items$find2.ref.current; // Reset `searchRef` 1 second after it was last updated
(function updateSearch(value) {
searchRef.current = value;
window.clearTimeout(timerRef.current);
if (value !== '') timerRef.current = window.setTimeout(() => updateSearch(''), 1000);
})(search);
if (newItem)
/**
* Imperative focus during keydown is risky so we prevent React's batching updates
* to avoid potential bugs. See: https://github.com/facebook/react/issues/20332
*/
setTimeout(() => newItem.focus());
};
$cnSS2$react.useEffect(() => {
return () => window.clearTimeout(timerRef.current);
}, []); // Make sure the whole tree has focus guards as our `MenuContent` may be
// the last element in the DOM (beacuse of the `Portal`)
$cnSS2$radixuireactfocusguards.useFocusGuards();
const isPointerMovingToSubmenu = $cnSS2$react.useCallback(event => {
var _pointerGraceIntentRe, _pointerGraceIntentRe2;
const isMovingTowards = pointerDirRef.current === ((_pointerGraceIntentRe = pointerGraceIntentRef.current) === null || _pointerGraceIntentRe === void 0 ? void 0 : _pointerGraceIntentRe.side);
return isMovingTowards && $213e4d2df823067d$var$isPointerInGraceArea(event, (_pointerGraceIntentRe2 = pointerGraceIntentRef.current) === null || _pointerGraceIntentRe2 === void 0 ? void 0 : _pointerGraceIntentRe2.area);
}, []);
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuContentProvider, {
scope: __scopeMenu,
searchRef: searchRef,
onItemEnter: $cnSS2$react.useCallback(event => {
if (isPointerMovingToSubmenu(event)) event.preventDefault();
}, [isPointerMovingToSubmenu]),
onItemLeave: $cnSS2$react.useCallback(event => {
var _contentRef$current;
if (isPointerMovingToSubmenu(event)) return;
(_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 || _contentRef$current.focus();
setCurrentItemId(null);
}, [isPointerMovingToSubmenu]),
onTriggerLeave: $cnSS2$react.useCallback(event => {
if (isPointerMovingToSubmenu(event)) event.preventDefault();
}, [isPointerMovingToSubmenu]),
pointerGraceTimerRef: pointerGraceTimerRef,
onPointerGraceIntentChange: $cnSS2$react.useCallback(intent => {
pointerGraceIntentRef.current = intent;
}, [])
}, /*#__PURE__*/$cnSS2$react.createElement(ScrollLockWrapper, scrollLockWrapperProps, /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactfocusscope.FocusScope, {
asChild: true,
trapped: trapFocus,
onMountAutoFocus: $cnSS2$radixuiprimitive.composeEventHandlers(onOpenAutoFocus, event => {
var _contentRef$current2;
// when opening, explicitly focus the content area only and leave
// `onEntryFocus` in control of focusing first item
event.preventDefault();
(_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 || _contentRef$current2.focus();
}),
onUnmountAutoFocus: onCloseAutoFocus
}, /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactdismissablelayer.DismissableLayer, {
asChild: true,
disableOutsidePointerEvents: disableOutsidePointerEvents,
onEscapeKeyDown: onEscapeKeyDown,
onPointerDownOutside: onPointerDownOutside,
onFocusOutside: onFocusOutside,
onInteractOutside: onInteractOutside,
onDismiss: onDismiss
}, /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactrovingfocus.Root, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({
asChild: true
}, rovingFocusGroupScope, {
dir: rootContext.dir,
orientation: "vertical",
loop: loop,
currentTabStopId: currentItemId,
onCurrentTabStopIdChange: setCurrentItemId,
onEntryFocus: $cnSS2$radixuiprimitive.composeEventHandlers(onEntryFocus, event => {
// only focus first item when using keyboard
if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
})
}), /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactpopper.Content, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({
role: "menu",
"aria-orientation": "vertical",
"data-state": $213e4d2df823067d$var$getOpenState(context.open),
"data-radix-menu-content": "",
dir: rootContext.dir
}, popperScope, contentProps, {
ref: composedRefs,
style: {
outline: 'none',
...contentProps.style
},
onKeyDown: $cnSS2$radixuiprimitive.composeEventHandlers(contentProps.onKeyDown, event => {
// submenu key events bubble through portals. We only care about keys in this menu.
const target = event.target;
const isKeyDownInside = target.closest('[data-radix-menu-content]') === event.currentTarget;
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
const isCharacterKey = event.key.length === 1;
if (isKeyDownInside) {
// menus should not be navigated using tab key so we prevent it
if (event.key === 'Tab') event.preventDefault();
if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);
} // focus first/last item based on key pressed
const content = contentRef.current;
if (event.target !== content) return;
if (!$213e4d2df823067d$var$FIRST_LAST_KEYS.includes(event.key)) return;
event.preventDefault();
const items = getItems().filter(item => !item.disabled);
const candidateNodes = items.map(item => item.ref.current);
if ($213e4d2df823067d$var$LAST_KEYS.includes(event.key)) candidateNodes.reverse();
$213e4d2df823067d$var$focusFirst(candidateNodes);
}),
onBlur: $cnSS2$radixuiprimitive.composeEventHandlers(props.onBlur, event => {
// clear search buffer when leaving the menu
if (!event.currentTarget.contains(event.target)) {
window.clearTimeout(timerRef.current);
searchRef.current = '';
}
}),
onPointerMove: $cnSS2$radixuiprimitive.composeEventHandlers(props.onPointerMove, $213e4d2df823067d$var$whenMouse(event => {
const target = event.target;
const pointerXHasChanged = lastPointerXRef.current !== event.clientX; // We don't use `event.movementX` for this check because Safari will
// always return `0` on a pointer event.
if (event.currentTarget.contains(target) && pointerXHasChanged) {
const newDir = event.clientX > lastPointerXRef.current ? 'right' : 'left';
pointerDirRef.current = newDir;
lastPointerXRef.current = event.clientX;
}
}))
})))))));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$479f0f2f71193efe, {
displayName: $213e4d2df823067d$var$CONTENT_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuGroup
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$GROUP_NAME = 'MenuGroup';
const $213e4d2df823067d$export$22a631d1f72787bb = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
__scopeMenu: __scopeMenu,
...groupProps
} = props;
return /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactprimitive.Primitive.div, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({
role: "group"
}, groupProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$22a631d1f72787bb, {
displayName: $213e4d2df823067d$var$GROUP_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuLabel
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$LABEL_NAME = 'MenuLabel';
const $213e4d2df823067d$export$dd37bec0e8a99143 = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
__scopeMenu: __scopeMenu,
...labelProps
} = props;
return /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactprimitive.Primitive.div, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({}, labelProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$dd37bec0e8a99143, {
displayName: $213e4d2df823067d$var$LABEL_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuItem
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$ITEM_NAME = 'MenuItem';
const $213e4d2df823067d$var$ITEM_SELECT = 'menu.itemSelect';
const $213e4d2df823067d$export$2ce376c2cc3355c8 = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
disabled = false,
onSelect: onSelect,
...itemProps
} = props;
const ref = $cnSS2$react.useRef(null);
const rootContext = $213e4d2df823067d$var$useMenuRootContext($213e4d2df823067d$var$ITEM_NAME, props.__scopeMenu);
const contentContext = $213e4d2df823067d$var$useMenuContentContext($213e4d2df823067d$var$ITEM_NAME, props.__scopeMenu);
const composedRefs = $cnSS2$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
const isPointerDownRef = $cnSS2$react.useRef(false);
const handleSelect = () => {
const menuItem = ref.current;
if (!disabled && menuItem) {
const itemSelectEvent = new CustomEvent($213e4d2df823067d$var$ITEM_SELECT, {
bubbles: true,
cancelable: true
});
menuItem.addEventListener($213e4d2df823067d$var$ITEM_SELECT, event => onSelect === null || onSelect === void 0 ? void 0 : onSelect(event), {
once: true
});
$cnSS2$radixuireactprimitive.dispatchDiscreteCustomEvent(menuItem, itemSelectEvent);
if (itemSelectEvent.defaultPrevented) isPointerDownRef.current = false;else rootContext.onClose();
}
};
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuItemImpl, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({}, itemProps, {
ref: composedRefs,
disabled: disabled,
onClick: $cnSS2$radixuiprimitive.composeEventHandlers(props.onClick, handleSelect),
onPointerDown: event => {
var _props$onPointerDown;
(_props$onPointerDown = props.onPointerDown) === null || _props$onPointerDown === void 0 || _props$onPointerDown.call(props, event);
isPointerDownRef.current = true;
},
onPointerUp: $cnSS2$radixuiprimitive.composeEventHandlers(props.onPointerUp, event => {
var _event$currentTarget;
// Pointer down can move to a different menu item which should activate it on pointer up.
// We dispatch a click for selection to allow composition with click based triggers and to
// prevent Firefox from getting stuck in text selection mode when the menu closes.
if (!isPointerDownRef.current) (_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 || _event$currentTarget.click();
}),
onKeyDown: $cnSS2$radixuiprimitive.composeEventHandlers(props.onKeyDown, event => {
const isTypingAhead = contentContext.searchRef.current !== '';
if (disabled || isTypingAhead && event.key === ' ') return;
if ($213e4d2df823067d$var$SELECTION_KEYS.includes(event.key)) {
event.currentTarget.click();
/**
* We prevent default browser behaviour for selection keys as they should trigger
* a selection only:
* - prevents space from scrolling the page.
* - if keydown causes focus to move, prevents keydown from firing on the new target.
*/
event.preventDefault();
}
})
}));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$2ce376c2cc3355c8, {
displayName: $213e4d2df823067d$var$ITEM_NAME
});
/* ---------------------------------------------------------------------------------------------- */
const $213e4d2df823067d$var$MenuItemImpl = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
__scopeMenu: __scopeMenu,
disabled = false,
textValue: textValue,
...itemProps
} = props;
const contentContext = $213e4d2df823067d$var$useMenuContentContext($213e4d2df823067d$var$ITEM_NAME, __scopeMenu);
const rovingFocusGroupScope = $213e4d2df823067d$var$useRovingFocusGroupScope(__scopeMenu);
const ref = $cnSS2$react.useRef(null);
const composedRefs = $cnSS2$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
const [isFocused, setIsFocused] = $cnSS2$react.useState(false); // get the item's `.textContent` as default strategy for typeahead `textValue`
const [textContent, setTextContent] = $cnSS2$react.useState('');
$cnSS2$react.useEffect(() => {
const menuItem = ref.current;
if (menuItem) {
var _menuItem$textContent;
setTextContent(((_menuItem$textContent = menuItem.textContent) !== null && _menuItem$textContent !== void 0 ? _menuItem$textContent : '').trim());
}
}, [itemProps.children]);
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$Collection.ItemSlot, {
scope: __scopeMenu,
disabled: disabled,
textValue: textValue !== null && textValue !== void 0 ? textValue : textContent
}, /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactrovingfocus.Item, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({
asChild: true
}, rovingFocusGroupScope, {
focusable: !disabled
}), /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactprimitive.Primitive.div, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({
role: "menuitem",
"data-highlighted": isFocused ? '' : undefined,
"aria-disabled": disabled || undefined,
"data-disabled": disabled ? '' : undefined
}, itemProps, {
ref: composedRefs,
onPointerMove: $cnSS2$radixuiprimitive.composeEventHandlers(props.onPointerMove, $213e4d2df823067d$var$whenMouse(event => {
if (disabled) contentContext.onItemLeave(event);else {
contentContext.onItemEnter(event);
if (!event.defaultPrevented) {
const item = event.currentTarget;
item.focus();
}
}
})),
onPointerLeave: $cnSS2$radixuiprimitive.composeEventHandlers(props.onPointerLeave, $213e4d2df823067d$var$whenMouse(event => contentContext.onItemLeave(event))),
onFocus: $cnSS2$radixuiprimitive.composeEventHandlers(props.onFocus, () => setIsFocused(true)),
onBlur: $cnSS2$radixuiprimitive.composeEventHandlers(props.onBlur, () => setIsFocused(false))
}))));
});
/* -------------------------------------------------------------------------------------------------
* MenuCheckboxItem
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$CHECKBOX_ITEM_NAME = 'MenuCheckboxItem';
const $213e4d2df823067d$export$f6f243521332502d = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
checked = false,
onCheckedChange: onCheckedChange,
...checkboxItemProps
} = props;
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$ItemIndicatorProvider, {
scope: props.__scopeMenu,
checked: checked
}, /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$export$2ce376c2cc3355c8, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({
role: "menuitemcheckbox",
"aria-checked": $213e4d2df823067d$var$isIndeterminate(checked) ? 'mixed' : checked
}, checkboxItemProps, {
ref: forwardedRef,
"data-state": $213e4d2df823067d$var$getCheckedState(checked),
onSelect: $cnSS2$radixuiprimitive.composeEventHandlers(checkboxItemProps.onSelect, () => onCheckedChange === null || onCheckedChange === void 0 ? void 0 : onCheckedChange($213e4d2df823067d$var$isIndeterminate(checked) ? true : !checked), {
checkForDefaultPrevented: false
})
})));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$f6f243521332502d, {
displayName: $213e4d2df823067d$var$CHECKBOX_ITEM_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuRadioGroup
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$RADIO_GROUP_NAME = 'MenuRadioGroup';
const [$213e4d2df823067d$var$RadioGroupProvider, $213e4d2df823067d$var$useRadioGroupContext] = $213e4d2df823067d$var$createMenuContext($213e4d2df823067d$var$RADIO_GROUP_NAME, {
value: undefined,
onValueChange: () => {}
});
const $213e4d2df823067d$export$ea2200c9eee416b3 = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
value: value,
onValueChange: onValueChange,
...groupProps
} = props;
const handleValueChange = $cnSS2$radixuireactusecallbackref.useCallbackRef(onValueChange);
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$RadioGroupProvider, {
scope: props.__scopeMenu,
value: value,
onValueChange: handleValueChange
}, /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$export$22a631d1f72787bb, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({}, groupProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$ea2200c9eee416b3, {
displayName: $213e4d2df823067d$var$RADIO_GROUP_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuRadioItem
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$RADIO_ITEM_NAME = 'MenuRadioItem';
const $213e4d2df823067d$export$69bd225e9817f6d0 = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
value: value,
...radioItemProps
} = props;
const context = $213e4d2df823067d$var$useRadioGroupContext($213e4d2df823067d$var$RADIO_ITEM_NAME, props.__scopeMenu);
const checked = value === context.value;
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$ItemIndicatorProvider, {
scope: props.__scopeMenu,
checked: checked
}, /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$export$2ce376c2cc3355c8, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({
role: "menuitemradio",
"aria-checked": checked
}, radioItemProps, {
ref: forwardedRef,
"data-state": $213e4d2df823067d$var$getCheckedState(checked),
onSelect: $cnSS2$radixuiprimitive.composeEventHandlers(radioItemProps.onSelect, () => {
var _context$onValueChang;
return (_context$onValueChang = context.onValueChange) === null || _context$onValueChang === void 0 ? void 0 : _context$onValueChang.call(context, value);
}, {
checkForDefaultPrevented: false
})
})));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$69bd225e9817f6d0, {
displayName: $213e4d2df823067d$var$RADIO_ITEM_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuItemIndicator
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$ITEM_INDICATOR_NAME = 'MenuItemIndicator';
const [$213e4d2df823067d$var$ItemIndicatorProvider, $213e4d2df823067d$var$useItemIndicatorContext] = $213e4d2df823067d$var$createMenuContext($213e4d2df823067d$var$ITEM_INDICATOR_NAME, {
checked: false
});
const $213e4d2df823067d$export$a2593e23056970a3 = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
__scopeMenu: __scopeMenu,
forceMount: forceMount,
...itemIndicatorProps
} = props;
const indicatorContext = $213e4d2df823067d$var$useItemIndicatorContext($213e4d2df823067d$var$ITEM_INDICATOR_NAME, __scopeMenu);
return /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactpresence.Presence, {
present: forceMount || $213e4d2df823067d$var$isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true
}, /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactprimitive.Primitive.span, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({}, itemIndicatorProps, {
ref: forwardedRef,
"data-state": $213e4d2df823067d$var$getCheckedState(indicatorContext.checked)
})));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$a2593e23056970a3, {
displayName: $213e4d2df823067d$var$ITEM_INDICATOR_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuSeparator
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$SEPARATOR_NAME = 'MenuSeparator';
const $213e4d2df823067d$export$1cec7dcdd713e220 = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
__scopeMenu: __scopeMenu,
...separatorProps
} = props;
return /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactprimitive.Primitive.div, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({
role: "separator",
"aria-orientation": "horizontal"
}, separatorProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$1cec7dcdd713e220, {
displayName: $213e4d2df823067d$var$SEPARATOR_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuArrow
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$ARROW_NAME = 'MenuArrow';
const $213e4d2df823067d$export$bcdda4773debf5fa = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const {
__scopeMenu: __scopeMenu,
...arrowProps
} = props;
const popperScope = $213e4d2df823067d$var$usePopperScope(__scopeMenu);
return /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactpopper.Arrow, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({}, popperScope, arrowProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$bcdda4773debf5fa, {
displayName: $213e4d2df823067d$var$ARROW_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuSub
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$SUB_NAME = 'MenuSub';
const [$213e4d2df823067d$var$MenuSubProvider, $213e4d2df823067d$var$useMenuSubContext] = $213e4d2df823067d$var$createMenuContext($213e4d2df823067d$var$SUB_NAME);
const $213e4d2df823067d$export$71bdb9d1e2909932 = props => {
const {
__scopeMenu: __scopeMenu,
children: children,
open = false,
onOpenChange: onOpenChange
} = props;
const parentMenuContext = $213e4d2df823067d$var$useMenuContext($213e4d2df823067d$var$SUB_NAME, __scopeMenu);
const popperScope = $213e4d2df823067d$var$usePopperScope(__scopeMenu);
const [trigger, setTrigger] = $cnSS2$react.useState(null);
const [content, setContent] = $cnSS2$react.useState(null);
const handleOpenChange = $cnSS2$radixuireactusecallbackref.useCallbackRef(onOpenChange); // Prevent the parent menu from reopening with open submenus.
$cnSS2$react.useEffect(() => {
if (parentMenuContext.open === false) handleOpenChange(false);
return () => handleOpenChange(false);
}, [parentMenuContext.open, handleOpenChange]);
return /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactpopper.Root, popperScope, /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuProvider, {
scope: __scopeMenu,
open: open,
onOpenChange: handleOpenChange,
content: content,
onContentChange: setContent
}, /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuSubProvider, {
scope: __scopeMenu,
contentId: $cnSS2$radixuireactid.useId(),
triggerId: $cnSS2$radixuireactid.useId(),
trigger: trigger,
onTriggerChange: setTrigger
}, children)));
};
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$71bdb9d1e2909932, {
displayName: $213e4d2df823067d$var$SUB_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuSubTrigger
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$SUB_TRIGGER_NAME = 'MenuSubTrigger';
const $213e4d2df823067d$export$5fbbb3ba7297405f = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const context = $213e4d2df823067d$var$useMenuContext($213e4d2df823067d$var$SUB_TRIGGER_NAME, props.__scopeMenu);
const rootContext = $213e4d2df823067d$var$useMenuRootContext($213e4d2df823067d$var$SUB_TRIGGER_NAME, props.__scopeMenu);
const subContext = $213e4d2df823067d$var$useMenuSubContext($213e4d2df823067d$var$SUB_TRIGGER_NAME, props.__scopeMenu);
const contentContext = $213e4d2df823067d$var$useMenuContentContext($213e4d2df823067d$var$SUB_TRIGGER_NAME, props.__scopeMenu);
const openTimerRef = $cnSS2$react.useRef(null);
const {
pointerGraceTimerRef: pointerGraceTimerRef,
onPointerGraceIntentChange: onPointerGraceIntentChange
} = contentContext;
const scope = {
__scopeMenu: props.__scopeMenu
};
const clearOpenTimer = $cnSS2$react.useCallback(() => {
if (openTimerRef.current) window.clearTimeout(openTimerRef.current);
openTimerRef.current = null;
}, []);
$cnSS2$react.useEffect(() => clearOpenTimer, [clearOpenTimer]);
$cnSS2$react.useEffect(() => {
const pointerGraceTimer = pointerGraceTimerRef.current;
return () => {
window.clearTimeout(pointerGraceTimer);
onPointerGraceIntentChange(null);
};
}, [pointerGraceTimerRef, onPointerGraceIntentChange]);
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$export$9fa5ebd18bee4d43, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({
asChild: true
}, scope), /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuItemImpl, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({
id: subContext.triggerId,
"aria-haspopup": "menu",
"aria-expanded": context.open,
"aria-controls": subContext.contentId,
"data-state": $213e4d2df823067d$var$getOpenState(context.open)
}, props, {
ref: $cnSS2$radixuireactcomposerefs.composeRefs(forwardedRef, subContext.onTriggerChange) // This is redundant for mouse users but we cannot determine pointer type from
,
onClick: event => {
var _props$onClick;
(_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props, event);
if (props.disabled || event.defaultPrevented) return;
/**
* We manually focus because iOS Safari doesn't always focus on click (e.g. buttons)
* and we rely heavily on `onFocusOutside` for submenus to close when switching
* between separate submenus.
*/
event.currentTarget.focus();
if (!context.open) context.onOpenChange(true);
},
onPointerMove: $cnSS2$radixuiprimitive.composeEventHandlers(props.onPointerMove, $213e4d2df823067d$var$whenMouse(event => {
contentContext.onItemEnter(event);
if (event.defaultPrevented) return;
if (!props.disabled && !context.open && !openTimerRef.current) {
contentContext.onPointerGraceIntentChange(null);
openTimerRef.current = window.setTimeout(() => {
context.onOpenChange(true);
clearOpenTimer();
}, 100);
}
})),
onPointerLeave: $cnSS2$radixuiprimitive.composeEventHandlers(props.onPointerLeave, $213e4d2df823067d$var$whenMouse(event => {
var _context$content;
clearOpenTimer();
const contentRect = (_context$content = context.content) === null || _context$content === void 0 ? void 0 : _context$content.getBoundingClientRect();
if (contentRect) {
var _context$content2;
// TODO: make sure to update this when we change positioning logic
const side = (_context$content2 = context.content) === null || _context$content2 === void 0 ? void 0 : _context$content2.dataset.side;
const rightSide = side === 'right';
const bleed = rightSide ? -5 : 5;
const contentNearEdge = contentRect[rightSide ? 'left' : 'right'];
const contentFarEdge = contentRect[rightSide ? 'right' : 'left'];
contentContext.onPointerGraceIntentChange({
area: [
// consistently within polygon bounds
{
x: event.clientX + bleed,
y: event.clientY
}, {
x: contentNearEdge,
y: contentRect.top
}, {
x: contentFarEdge,
y: contentRect.top
}, {
x: contentFarEdge,
y: contentRect.bottom
}, {
x: contentNearEdge,
y: contentRect.bottom
}],
side: side
});
window.clearTimeout(pointerGraceTimerRef.current);
pointerGraceTimerRef.current = window.setTimeout(() => contentContext.onPointerGraceIntentChange(null), 300);
} else {
contentContext.onTriggerLeave(event);
if (event.defaultPrevented) return; // There's 100ms where the user may leave an item before the submenu was opened.
contentContext.onPointerGraceIntentChange(null);
}
})),
onKeyDown: $cnSS2$radixuiprimitive.composeEventHandlers(props.onKeyDown, event => {
const isTypingAhead = contentContext.searchRef.current !== '';
if (props.disabled || isTypingAhead && event.key === ' ') return;
if ($213e4d2df823067d$var$SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) {
var _context$content3;
context.onOpenChange(true); // The trigger may hold focus if opened via pointer interaction
// so we ensure content is given focus again when switching to keyboard.
(_context$content3 = context.content) === null || _context$content3 === void 0 || _context$content3.focus(); // prevent window from scrolling
event.preventDefault();
}
})
})));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$5fbbb3ba7297405f, {
displayName: $213e4d2df823067d$var$SUB_TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* MenuSubContent
* -----------------------------------------------------------------------------------------------*/
const $213e4d2df823067d$var$SUB_CONTENT_NAME = 'MenuSubContent';
const $213e4d2df823067d$export$e7142ab31822bde6 = /*#__PURE__*/$cnSS2$react.forwardRef((props, forwardedRef) => {
const portalContext = $213e4d2df823067d$var$usePortalContext($213e4d2df823067d$var$CONTENT_NAME, props.__scopeMenu);
const {
forceMount = portalContext.forceMount,
...subContentProps
} = props;
const context = $213e4d2df823067d$var$useMenuContext($213e4d2df823067d$var$CONTENT_NAME, props.__scopeMenu);
const rootContext = $213e4d2df823067d$var$useMenuRootContext($213e4d2df823067d$var$CONTENT_NAME, props.__scopeMenu);
const subContext = $213e4d2df823067d$var$useMenuSubContext($213e4d2df823067d$var$SUB_CONTENT_NAME, props.__scopeMenu);
const ref = $cnSS2$react.useRef(null);
const composedRefs = $cnSS2$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
return /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$Collection.Provider, {
scope: props.__scopeMenu
}, /*#__PURE__*/$cnSS2$react.createElement($cnSS2$radixuireactpresence.Presence, {
present: forceMount || context.open
}, /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$Collection.Slot, {
scope: props.__scopeMenu
}, /*#__PURE__*/$cnSS2$react.createElement($213e4d2df823067d$var$MenuContentImpl, $parcel$interopDefault($cnSS2$babelruntimehelpersextends)({
id: subContext.contentId,
"aria-labelledby": subContext.triggerId
}, subContentProps, {
ref: composedRefs,
align: "start",
side: rootContext.dir === 'rtl' ? 'left' : 'right',
disableOutsidePointerEvents: false,
disableOutsideScroll: false,
trapFocus: false,
onOpenAutoFocus: event => {
var _ref$current;
// when opening a submenu, focus content for keyboard users only
if (rootContext.isUsingKeyboardRef.current) (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.focus();
event.preventDefault();
} // The menu might close because of focusing another menu item in the parent menu. We
,
onCloseAutoFocus: event => event.preventDefault(),
onFocusOutside: $cnSS2$radixuiprimitive.composeEventHandlers(props.onFocusOutside, event => {
// We prevent closing when the trigger is focused to avoid triggering a re-open animation
// on pointer interaction.
if (event.target !== subContext.trigger) context.onOpenChange(false);
}),
onEscapeKeyDown: $cnSS2$radixuiprimitive.composeEventHandlers(props.onEscapeKeyDown, event => {
rootContext.onClose(); // ensure pressing escape in submenu doesn't escape full screen mode
event.preventDefault();
}),
onKeyDown: $cnSS2$radixuiprimitive.composeEventHandlers(props.onKeyDown, event => {
// Submenu key events bubble through portals. We only care about keys in this menu.
const isKeyDownInside = event.currentTarget.contains(event.target);
const isCloseKey = $213e4d2df823067d$var$SUB_CLOSE_KEYS[rootContext.dir].includes(event.key);
if (isKeyDownInside && isCloseKey) {
var _subContext$trigger;
context.onOpenChange(false); // We focus manually because we prevented it in `onCloseAutoFocus`
(_subContext$trigger = subContext.trigger) === null || _subContext$trigger === void 0 || _subContext$trigger.focus(); // prevent window from scrolling
event.preventDefault();
}
})
})))));
});
/*#__PURE__*/
Object.assign($213e4d2df823067d$export$e7142ab31822bde6, {
displayName: $213e4d2df823067d$var$SUB_CONTENT_NAME
});
/* -----------------------------------------------------------------------------------------------*/
function $213e4d2df823067d$var$getOpenState(open) {
return open ? 'open' : 'closed';
}
function $213e4d2df823067d$var$isIndeterminate(checked) {
return checked === 'indeterminate';
}
function $213e4d2df823067d$var$getCheckedState(checked) {
return $213e4d2df823067d$var$isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';
}
function $213e4d2df823067d$var$focusFirst(candidates) {
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
for (const candidate of candidates) {
// if focus is already where we want to go, we don't want to keep going through the candidates
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
candidate.focus();
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
}
}
/**
* Wraps an array around itself at a given start index
* Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`
*/
function $213e4d2df823067d$var$wrapArray(array, startIndex) {
return array.map((_, index) => array[(startIndex + index) % array.length]);
}
/**
* This is the "meat" of the typeahead matching logic. It takes in all the values,
* the search and the current match, and returns the next match (or `undefined`).
*
* We normalize the search because if a user has repeatedly pressed a character,
* we want the exact same behavior as if we only had that one character
* (ie. cycle through options starting with that character)
*
* We also reorder the values by wrapping the array around the current match.
* This is so we always look forward from the current match, and picking the first
* match will always be the correct one.
*
* Finally, if the normalized search is exactly one character, we exclude the
* current match from the values because otherwise it would be the first to match always
* and focus would never move. This is as opposed to the regular case, where we
* don't want focus to move if the current match still matches.
*/
function $213e4d2df823067d$var$getNextMatch(values, search, currentMatch) {
const isRepeated = search.length > 1 && Array.from(search).every(char => char === search[0]);
const normalizedSearch = isRepeated ? search[0] : search;
const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;
let wrappedValues = $213e4d2df823067d$var$wrapArray(values, Math.max(currentMatchIndex, 0));
const excludeCurrentMatch = normalizedSearch.length === 1;
if (excludeCurrentMatch) wrappedValues = wrappedValues.filter(v => v !== currentMatch);
const nextMatch = wrappedValues.find(value => value.toLowerCase().startsWith(normalizedSearch.toLowerCase()));
return nextMatch !== currentMatch ? nextMatch : undefined;
}
// Determine if a point is inside of a polygon.
// Based on https://github.com/substack/point-in-polygon
function $213e4d2df823067d$var$isPointInPolygon(point, polygon) {
const {
x: x,
y: y
} = point;
let inside = false;
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
const xi = polygon[i].x;
const yi = polygon[i].y;
const xj = polygon[j].x;
const yj = polygon[j].y; // prettier-ignore
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
if (intersect) inside = !inside;
}
return inside;
}
function $213e4d2df823067d$var$isPointerInGraceArea(event, area) {
if (!area) return false;
const cursorPos = {
x: event.clientX,
y: event.clientY
};
return $213e4d2df823067d$var$isPointInPolygon(cursorPos, area);
}
function $213e4d2df823067d$var$whenMouse(handler) {
return event => event.pointerType === 'mouse' ? handler(event) : undefined;
}
const $213e4d2df823067d$export$be92b6f5f03c0fe9 = $213e4d2df823067d$export$d9b273488cd8ce6f;
const $213e4d2df823067d$export$b688253958b8dfe7 = $213e4d2df823067d$export$9fa5ebd18bee4d43;
const $213e4d2df823067d$export$602eac185826482c = $213e4d2df823067d$export$793392f970497feb;
const $213e4d2df823067d$export$7c6e2c02157bb7d2 = $213e4d2df823067d$export$479f0f2f71193efe;
const $213e4d2df823067d$export$eb2fcfdbd7ba97d4 = $213e4d2df823067d$export$22a631d1f72787bb;
const $213e4d2df823067d$export$b04be29aa201d4f5 = $213e4d2df823067d$export$dd37bec0e8a99143;
const $213e4d2df823067d$export$6d08773d2e66f8f2 = $213e4d2df823067d$export$2ce376c2cc3355c8;
const $213e4d2df823067d$export$16ce288f89fa631c = $213e4d2df823067d$export$f6f243521332502d;
const $213e4d2df823067d$export$a98f0dcb43a68a25 = $213e4d2df823067d$export$ea2200c9eee416b3;
const $213e4d2df823067d$export$371ab307eab489c0 = $213e4d2df823067d$export$69bd225e9817f6d0;
const $213e4d2df823067d$export$c3468e2714d175fa = $213e4d2df823067d$export$a2593e23056970a3;
const $213e4d2df823067d$export$1ff3c3f08ae963c0 = $213e4d2df823067d$export$1cec7dcdd713e220;
const $213e4d2df823067d$export$21b07c8f274aebd5 = $213e4d2df823067d$export$bcdda4773debf5fa;
const $213e4d2df823067d$export$d7a01e11500dfb6f = $213e4d2df823067d$export$71bdb9d1e2909932;
const $213e4d2df823067d$export$2ea8a7a591ac5eac = $213e4d2df823067d$export$5fbbb3ba7297405f;
const $213e4d2df823067d$export$6d4de93b380beddf = $213e4d2df823067d$export$e7142ab31822bde6;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-popper/dist/index.js":
/*!******************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-popper/dist/index.js ***!
\******************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $50Iv9$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $50Iv9$react = __webpack_require__(/*! react */ "react");
var $50Iv9$floatinguireactdom = __webpack_require__(/*! @floating-ui/react-dom */ "../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js");
var $50Iv9$radixuireactarrow = __webpack_require__(/*! @radix-ui/react-arrow */ "../../../node_modules/@radix-ui/react-arrow/dist/index.js");
var $50Iv9$radixuireactcomposerefs = __webpack_require__(/*! @radix-ui/react-compose-refs */ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js");
var $50Iv9$radixuireactcontext = __webpack_require__(/*! @radix-ui/react-context */ "../../../node_modules/@radix-ui/react-context/dist/index.js");
var $50Iv9$radixuireactprimitive = __webpack_require__(/*! @radix-ui/react-primitive */ "../../../node_modules/@radix-ui/react-primitive/dist/index.js");
var $50Iv9$radixuireactusecallbackref = __webpack_require__(/*! @radix-ui/react-use-callback-ref */ "../../../node_modules/@radix-ui/react-use-callback-ref/dist/index.js");
var $50Iv9$radixuireactuselayouteffect = __webpack_require__(/*! @radix-ui/react-use-layout-effect */ "../../../node_modules/@radix-ui/react-use-layout-effect/dist/index.js");
var $50Iv9$radixuireactusesize = __webpack_require__(/*! @radix-ui/react-use-size */ "../../../node_modules/@radix-ui/react-use-size/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "createPopperScope", () => $34310caa050a8d63$export$722aac194ae923);
$parcel$export(module.exports, "Popper", () => $34310caa050a8d63$export$badac9ada3a0bdf9);
$parcel$export(module.exports, "PopperAnchor", () => $34310caa050a8d63$export$ecd4e1ccab6ed6d);
$parcel$export(module.exports, "PopperContent", () => $34310caa050a8d63$export$bc4ae5855d3c4fc);
$parcel$export(module.exports, "PopperArrow", () => $34310caa050a8d63$export$79d62cd4e10a3fd0);
$parcel$export(module.exports, "Root", () => $34310caa050a8d63$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Anchor", () => $34310caa050a8d63$export$b688253958b8dfe7);
$parcel$export(module.exports, "Content", () => $34310caa050a8d63$export$7c6e2c02157bb7d2);
$parcel$export(module.exports, "Arrow", () => $34310caa050a8d63$export$21b07c8f274aebd5);
$parcel$export(module.exports, "SIDE_OPTIONS", () => $34310caa050a8d63$export$36f0086da09c4b9f);
$parcel$export(module.exports, "ALIGN_OPTIONS", () => $34310caa050a8d63$export$3671ffab7b302fc9);
const $34310caa050a8d63$export$36f0086da09c4b9f = ['top', 'right', 'bottom', 'left'];
const $34310caa050a8d63$export$3671ffab7b302fc9 = ['start', 'center', 'end'];
/* -------------------------------------------------------------------------------------------------
* Popper
* -----------------------------------------------------------------------------------------------*/
const $34310caa050a8d63$var$POPPER_NAME = 'Popper';
const [$34310caa050a8d63$var$createPopperContext, $34310caa050a8d63$export$722aac194ae923] = $50Iv9$radixuireactcontext.createContextScope($34310caa050a8d63$var$POPPER_NAME);
const [$34310caa050a8d63$var$PopperProvider, $34310caa050a8d63$var$usePopperContext] = $34310caa050a8d63$var$createPopperContext($34310caa050a8d63$var$POPPER_NAME);
const $34310caa050a8d63$export$badac9ada3a0bdf9 = props => {
const {
__scopePopper: __scopePopper,
children: children
} = props;
const [anchor, setAnchor] = $50Iv9$react.useState(null);
return /*#__PURE__*/$50Iv9$react.createElement($34310caa050a8d63$var$PopperProvider, {
scope: __scopePopper,
anchor: anchor,
onAnchorChange: setAnchor
}, children);
};
/*#__PURE__*/
Object.assign($34310caa050a8d63$export$badac9ada3a0bdf9, {
displayName: $34310caa050a8d63$var$POPPER_NAME
});
/* -------------------------------------------------------------------------------------------------
* PopperAnchor
* -----------------------------------------------------------------------------------------------*/
const $34310caa050a8d63$var$ANCHOR_NAME = 'PopperAnchor';
const $34310caa050a8d63$export$ecd4e1ccab6ed6d = /*#__PURE__*/$50Iv9$react.forwardRef((props, forwardedRef) => {
const {
__scopePopper: __scopePopper,
virtualRef: virtualRef,
...anchorProps
} = props;
const context = $34310caa050a8d63$var$usePopperContext($34310caa050a8d63$var$ANCHOR_NAME, __scopePopper);
const ref = $50Iv9$react.useRef(null);
const composedRefs = $50Iv9$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
$50Iv9$react.useEffect(() => {
// Consumer can anchor the popper to something that isn't
// a DOM node e.g. pointer position, so we override the
// `anchorRef` with their virtual ref in this case.
context.onAnchorChange((virtualRef === null || virtualRef === void 0 ? void 0 : virtualRef.current) || ref.current);
});
return virtualRef ? null : /*#__PURE__*/$50Iv9$react.createElement($50Iv9$radixuireactprimitive.Primitive.div, $parcel$interopDefault($50Iv9$babelruntimehelpersextends)({}, anchorProps, {
ref: composedRefs
}));
});
/*#__PURE__*/
Object.assign($34310caa050a8d63$export$ecd4e1ccab6ed6d, {
displayName: $34310caa050a8d63$var$ANCHOR_NAME
});
/* -------------------------------------------------------------------------------------------------
* PopperContent
* -----------------------------------------------------------------------------------------------*/
const $34310caa050a8d63$var$CONTENT_NAME = 'PopperContent';
const [$34310caa050a8d63$var$PopperContentProvider, $34310caa050a8d63$var$useContentContext] = $34310caa050a8d63$var$createPopperContext($34310caa050a8d63$var$CONTENT_NAME);
const $34310caa050a8d63$export$bc4ae5855d3c4fc = /*#__PURE__*/$50Iv9$react.forwardRef((props, forwardedRef) => {
var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$trans, _middlewareData$trans2, _middlewareData$hide;
const {
__scopePopper: __scopePopper,
side = 'bottom',
sideOffset = 0,
align = 'center',
alignOffset = 0,
arrowPadding = 0,
collisionBoundary = [],
collisionPadding: collisionPaddingProp = 0,
sticky = 'partial',
hideWhenDetached = false,
avoidCollisions = true,
onPlaced: onPlaced,
...contentProps
} = props;
const context = $34310caa050a8d63$var$usePopperContext($34310caa050a8d63$var$CONTENT_NAME, __scopePopper);
const [content, setContent] = $50Iv9$react.useState(null);
const composedRefs = $50Iv9$radixuireactcomposerefs.useComposedRefs(forwardedRef, node => setContent(node));
const [arrow, setArrow] = $50Iv9$react.useState(null);
const arrowSize = $50Iv9$radixuireactusesize.useSize(arrow);
const arrowWidth = (_arrowSize$width = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.width) !== null && _arrowSize$width !== void 0 ? _arrowSize$width : 0;
const arrowHeight = (_arrowSize$height = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.height) !== null && _arrowSize$height !== void 0 ? _arrowSize$height : 0;
const desiredPlacement = side + (align !== 'center' ? '-' + align : '');
const collisionPadding = typeof collisionPaddingProp === 'number' ? collisionPaddingProp : {
top: 0,
right: 0,
bottom: 0,
left: 0,
...collisionPaddingProp
};
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
const hasExplicitBoundaries = boundary.length > 0;
const detectOverflowOptions = {
padding: collisionPadding,
boundary: boundary.filter($34310caa050a8d63$var$isNotNull),
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
altBoundary: hasExplicitBoundaries
};
const {
refs: refs,
floatingStyles: floatingStyles,
placement: placement,
isPositioned: isPositioned,
middlewareData: middlewareData
} = $50Iv9$floatinguireactdom.useFloating({
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
strategy: 'fixed',
placement: desiredPlacement,
whileElementsMounted: $50Iv9$floatinguireactdom.autoUpdate,
elements: {
reference: context.anchor
},
middleware: [$50Iv9$floatinguireactdom.offset({
mainAxis: sideOffset + arrowHeight,
alignmentAxis: alignOffset
}), avoidCollisions && $50Iv9$floatinguireactdom.shift({
mainAxis: true,
crossAxis: false,
limiter: sticky === 'partial' ? $50Iv9$floatinguireactdom.limitShift() : undefined,
...detectOverflowOptions
}), avoidCollisions && $50Iv9$floatinguireactdom.flip({
...detectOverflowOptions
}), $50Iv9$floatinguireactdom.size({
...detectOverflowOptions,
apply: _ref => {
let {
elements: elements,
rects: rects,
availableWidth: availableWidth,
availableHeight: availableHeight
} = _ref;
const {
width: anchorWidth,
height: anchorHeight
} = rects.reference;
const contentStyle = elements.floating.style;
contentStyle.setProperty('--radix-popper-available-width', `${availableWidth}px`);
contentStyle.setProperty('--radix-popper-available-height', `${availableHeight}px`);
contentStyle.setProperty('--radix-popper-anchor-width', `${anchorWidth}px`);
contentStyle.setProperty('--radix-popper-anchor-height', `${anchorHeight}px`);
}
}), arrow && $50Iv9$floatinguireactdom.arrow({
element: arrow,
padding: arrowPadding
}), $34310caa050a8d63$var$transformOrigin({
arrowWidth: arrowWidth,
arrowHeight: arrowHeight
}), hideWhenDetached && $50Iv9$floatinguireactdom.hide({
strategy: 'referenceHidden'
})]
});
const [placedSide, placedAlign] = $34310caa050a8d63$var$getSideAndAlignFromPlacement(placement);
const handlePlaced = $50Iv9$radixuireactusecallbackref.useCallbackRef(onPlaced);
$50Iv9$radixuireactuselayouteffect.useLayoutEffect(() => {
if (isPositioned) handlePlaced === null || handlePlaced === void 0 || handlePlaced();
}, [isPositioned, handlePlaced]);
const arrowX = (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x;
const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y;
const cannotCenterArrow = ((_middlewareData$arrow3 = middlewareData.arrow) === null || _middlewareData$arrow3 === void 0 ? void 0 : _middlewareData$arrow3.centerOffset) !== 0;
const [contentZIndex, setContentZIndex] = $50Iv9$react.useState();
$50Iv9$radixuireactuselayouteffect.useLayoutEffect(() => {
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
}, [content]);
return /*#__PURE__*/$50Iv9$react.createElement("div", {
ref: refs.setFloating,
"data-radix-popper-content-wrapper": "",
style: {
...floatingStyles,
transform: isPositioned ? floatingStyles.transform : 'translate(0, -200%)',
// keep off the page when measuring
minWidth: 'max-content',
zIndex: contentZIndex,
['--radix-popper-transform-origin']: [(_middlewareData$trans = middlewareData.transformOrigin) === null || _middlewareData$trans === void 0 ? void 0 : _middlewareData$trans.x, (_middlewareData$trans2 = middlewareData.transformOrigin) === null || _middlewareData$trans2 === void 0 ? void 0 : _middlewareData$trans2.y].join(' ')
} // Floating UI interally calculates logical alignment based the `dir` attribute on
,
dir: props.dir
}, /*#__PURE__*/$50Iv9$react.createElement($34310caa050a8d63$var$PopperContentProvider, {
scope: __scopePopper,
placedSide: placedSide,
onArrowChange: setArrow,
arrowX: arrowX,
arrowY: arrowY,
shouldHideArrow: cannotCenterArrow
}, /*#__PURE__*/$50Iv9$react.createElement($50Iv9$radixuireactprimitive.Primitive.div, $parcel$interopDefault($50Iv9$babelruntimehelpersextends)({
"data-side": placedSide,
"data-align": placedAlign
}, contentProps, {
ref: composedRefs,
style: {
...contentProps.style,
// if the PopperContent hasn't been placed yet (not all measurements done)
// we prevent animations so that users's animation don't kick in too early referring wrong sides
animation: !isPositioned ? 'none' : undefined,
// hide the content if using the hide middleware and should be hidden
opacity: (_middlewareData$hide = middlewareData.hide) !== null && _middlewareData$hide !== void 0 && _middlewareData$hide.referenceHidden ? 0 : undefined
}
}))));
});
/*#__PURE__*/
Object.assign($34310caa050a8d63$export$bc4ae5855d3c4fc, {
displayName: $34310caa050a8d63$var$CONTENT_NAME
});
/* -------------------------------------------------------------------------------------------------
* PopperArrow
* -----------------------------------------------------------------------------------------------*/
const $34310caa050a8d63$var$ARROW_NAME = 'PopperArrow';
const $34310caa050a8d63$var$OPPOSITE_SIDE = {
top: 'bottom',
right: 'left',
bottom: 'top',
left: 'right'
};
const $34310caa050a8d63$export$79d62cd4e10a3fd0 = /*#__PURE__*/$50Iv9$react.forwardRef(function $34310caa050a8d63$export$79d62cd4e10a3fd0(props, forwardedRef) {
const {
__scopePopper: __scopePopper,
...arrowProps
} = props;
const contentContext = $34310caa050a8d63$var$useContentContext($34310caa050a8d63$var$ARROW_NAME, __scopePopper);
const baseSide = $34310caa050a8d63$var$OPPOSITE_SIDE[contentContext.placedSide];
return /*#__PURE__*/ (// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
// doesn't report size as we'd expect on SVG elements.
// it reports their bounding box which is effectively the largest path inside the SVG.
$50Iv9$react.createElement("span", {
ref: contentContext.onArrowChange,
style: {
position: 'absolute',
left: contentContext.arrowX,
top: contentContext.arrowY,
[baseSide]: 0,
transformOrigin: {
top: '',
right: '0 0',
bottom: 'center 0',
left: '100% 0'
}[contentContext.placedSide],
transform: {
top: 'translateY(100%)',
right: 'translateY(50%) rotate(90deg) translateX(-50%)',
bottom: `rotate(180deg)`,
left: 'translateY(50%) rotate(-90deg) translateX(50%)'
}[contentContext.placedSide],
visibility: contentContext.shouldHideArrow ? 'hidden' : undefined
}
}, /*#__PURE__*/$50Iv9$react.createElement($50Iv9$radixuireactarrow.Root, $parcel$interopDefault($50Iv9$babelruntimehelpersextends)({}, arrowProps, {
ref: forwardedRef,
style: {
...arrowProps.style,
// ensures the element can be measured correctly (mostly for if SVG)
display: 'block'
}
})))
);
});
/*#__PURE__*/
Object.assign($34310caa050a8d63$export$79d62cd4e10a3fd0, {
displayName: $34310caa050a8d63$var$ARROW_NAME
});
/* -----------------------------------------------------------------------------------------------*/
function $34310caa050a8d63$var$isNotNull(value) {
return value !== null;
}
const $34310caa050a8d63$var$transformOrigin = options => ({
name: 'transformOrigin',
options: options,
fn(data) {
var _middlewareData$arrow4, _middlewareData$arrow5, _middlewareData$arrow6, _middlewareData$arrow7, _middlewareData$arrow8;
const {
placement: placement,
rects: rects,
middlewareData: middlewareData
} = data;
const cannotCenterArrow = ((_middlewareData$arrow4 = middlewareData.arrow) === null || _middlewareData$arrow4 === void 0 ? void 0 : _middlewareData$arrow4.centerOffset) !== 0;
const isArrowHidden = cannotCenterArrow;
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
const [placedSide, placedAlign] = $34310caa050a8d63$var$getSideAndAlignFromPlacement(placement);
const noArrowAlign = {
start: '0%',
center: '50%',
end: '100%'
}[placedAlign];
const arrowXCenter = ((_middlewareData$arrow5 = (_middlewareData$arrow6 = middlewareData.arrow) === null || _middlewareData$arrow6 === void 0 ? void 0 : _middlewareData$arrow6.x) !== null && _middlewareData$arrow5 !== void 0 ? _middlewareData$arrow5 : 0) + arrowWidth / 2;
const arrowYCenter = ((_middlewareData$arrow7 = (_middlewareData$arrow8 = middlewareData.arrow) === null || _middlewareData$arrow8 === void 0 ? void 0 : _middlewareData$arrow8.y) !== null && _middlewareData$arrow7 !== void 0 ? _middlewareData$arrow7 : 0) + arrowHeight / 2;
let x = '';
let y = '';
if (placedSide === 'bottom') {
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
y = `${-arrowHeight}px`;
} else if (placedSide === 'top') {
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
y = `${rects.floating.height + arrowHeight}px`;
} else if (placedSide === 'right') {
x = `${-arrowHeight}px`;
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
} else if (placedSide === 'left') {
x = `${rects.floating.width + arrowHeight}px`;
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
}
return {
data: {
x: x,
y: y
}
};
}
});
function $34310caa050a8d63$var$getSideAndAlignFromPlacement(placement) {
const [side, align = 'center'] = placement.split('-');
return [side, align];
}
const $34310caa050a8d63$export$be92b6f5f03c0fe9 = $34310caa050a8d63$export$badac9ada3a0bdf9;
const $34310caa050a8d63$export$b688253958b8dfe7 = $34310caa050a8d63$export$ecd4e1ccab6ed6d;
const $34310caa050a8d63$export$7c6e2c02157bb7d2 = $34310caa050a8d63$export$bc4ae5855d3c4fc;
const $34310caa050a8d63$export$21b07c8f274aebd5 = $34310caa050a8d63$export$79d62cd4e10a3fd0;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-portal/dist/index.js":
/*!******************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-portal/dist/index.js ***!
\******************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $amzHf$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $amzHf$react = __webpack_require__(/*! react */ "react");
var $amzHf$reactdom = __webpack_require__(/*! react-dom */ "react-dom");
var $amzHf$radixuireactprimitive = __webpack_require__(/*! @radix-ui/react-primitive */ "../../../node_modules/@radix-ui/react-primitive/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "Portal", () => $913a70b877676c16$export$602eac185826482c);
$parcel$export(module.exports, "Root", () => $913a70b877676c16$export$be92b6f5f03c0fe9);
/* -------------------------------------------------------------------------------------------------
* Portal
* -----------------------------------------------------------------------------------------------*/
const $913a70b877676c16$var$PORTAL_NAME = 'Portal';
const $913a70b877676c16$export$602eac185826482c = /*#__PURE__*/$amzHf$react.forwardRef((props, forwardedRef) => {
var _globalThis$document;
const {
container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body,
...portalProps
} = props;
return container ? /*#__PURE__*/$parcel$interopDefault($amzHf$reactdom).createPortal( /*#__PURE__*/$amzHf$react.createElement($amzHf$radixuireactprimitive.Primitive.div, $parcel$interopDefault($amzHf$babelruntimehelpersextends)({}, portalProps, {
ref: forwardedRef
})), container) : null;
});
/*#__PURE__*/
Object.assign($913a70b877676c16$export$602eac185826482c, {
displayName: $913a70b877676c16$var$PORTAL_NAME
});
/* -----------------------------------------------------------------------------------------------*/
const $913a70b877676c16$export$be92b6f5f03c0fe9 = $913a70b877676c16$export$602eac185826482c;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-presence/dist/index.js":
/*!********************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-presence/dist/index.js ***!
\********************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $fnLeV$react = __webpack_require__(/*! react */ "react");
var $fnLeV$reactdom = __webpack_require__(/*! react-dom */ "react-dom");
var $fnLeV$radixuireactcomposerefs = __webpack_require__(/*! @radix-ui/react-compose-refs */ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js");
var $fnLeV$radixuireactuselayouteffect = __webpack_require__(/*! @radix-ui/react-use-layout-effect */ "../../../node_modules/@radix-ui/react-use-layout-effect/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "Presence", () => $a2fa0214bb2735a1$export$99c2b779aa4e8b8b);
function $8f63844556d0d3cd$export$3e6543de14f8614f(initialState, machine) {
return $fnLeV$react.useReducer((state, event) => {
const nextState = machine[state][event];
return nextState !== null && nextState !== void 0 ? nextState : state;
}, initialState);
}
const $a2fa0214bb2735a1$export$99c2b779aa4e8b8b = props => {
const {
present: present,
children: children
} = props;
const presence = $a2fa0214bb2735a1$var$usePresence(present);
const child = typeof children === 'function' ? children({
present: presence.isPresent
}) : $fnLeV$react.Children.only(children);
const ref = $fnLeV$radixuireactcomposerefs.useComposedRefs(presence.ref, child.ref);
const forceMount = typeof children === 'function';
return forceMount || presence.isPresent ? /*#__PURE__*/$fnLeV$react.cloneElement(child, {
ref: ref
}) : null;
};
$a2fa0214bb2735a1$export$99c2b779aa4e8b8b.displayName = 'Presence';
/* -------------------------------------------------------------------------------------------------
* usePresence
* -----------------------------------------------------------------------------------------------*/
function $a2fa0214bb2735a1$var$usePresence(present) {
const [node1, setNode] = $fnLeV$react.useState();
const stylesRef = $fnLeV$react.useRef({});
const prevPresentRef = $fnLeV$react.useRef(present);
const prevAnimationNameRef = $fnLeV$react.useRef('none');
const initialState = present ? 'mounted' : 'unmounted';
const [state, send] = $8f63844556d0d3cd$export$3e6543de14f8614f(initialState, {
mounted: {
UNMOUNT: 'unmounted',
ANIMATION_OUT: 'unmountSuspended'
},
unmountSuspended: {
MOUNT: 'mounted',
ANIMATION_END: 'unmounted'
},
unmounted: {
MOUNT: 'mounted'
}
});
$fnLeV$react.useEffect(() => {
const currentAnimationName = $a2fa0214bb2735a1$var$getAnimationName(stylesRef.current);
prevAnimationNameRef.current = state === 'mounted' ? currentAnimationName : 'none';
}, [state]);
$fnLeV$radixuireactuselayouteffect.useLayoutEffect(() => {
const styles = stylesRef.current;
const wasPresent = prevPresentRef.current;
const hasPresentChanged = wasPresent !== present;
if (hasPresentChanged) {
const prevAnimationName = prevAnimationNameRef.current;
const currentAnimationName = $a2fa0214bb2735a1$var$getAnimationName(styles);
if (present) send('MOUNT');else if (currentAnimationName === 'none' || (styles === null || styles === void 0 ? void 0 : styles.display) === 'none')
// If there is no exit animation or the element is hidden, animations won't run
// so we unmount instantly
send('UNMOUNT');else {
/**
* When `present` changes to `false`, we check changes to animation-name to
* determine whether an animation has started. We chose this approach (reading
* computed styles) because there is no `animationrun` event and `animationstart`
* fires after `animation-delay` has expired which would be too late.
*/
const isAnimating = prevAnimationName !== currentAnimationName;
if (wasPresent && isAnimating) send('ANIMATION_OUT');else send('UNMOUNT');
}
prevPresentRef.current = present;
}
}, [present, send]);
$fnLeV$radixuireactuselayouteffect.useLayoutEffect(() => {
if (node1) {
/**
* Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`
* event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we
* make sure we only trigger ANIMATION_END for the currently active animation.
*/
const handleAnimationEnd = event => {
const currentAnimationName = $a2fa0214bb2735a1$var$getAnimationName(stylesRef.current);
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
if (event.target === node1 && isCurrentAnimation)
// With React 18 concurrency this update is applied
// a frame after the animation ends, creating a flash of visible content.
// By manually flushing we ensure they sync within a frame, removing the flash.
$fnLeV$reactdom.flushSync(() => send('ANIMATION_END'));
};
const handleAnimationStart = event => {
if (event.target === node1)
// if animation occurred, store its name as the previous animation.
prevAnimationNameRef.current = $a2fa0214bb2735a1$var$getAnimationName(stylesRef.current);
};
node1.addEventListener('animationstart', handleAnimationStart);
node1.addEventListener('animationcancel', handleAnimationEnd);
node1.addEventListener('animationend', handleAnimationEnd);
return () => {
node1.removeEventListener('animationstart', handleAnimationStart);
node1.removeEventListener('animationcancel', handleAnimationEnd);
node1.removeEventListener('animationend', handleAnimationEnd);
};
} else
// Transition to the unmounted state if the node is removed prematurely.
// We avoid doing so during cleanup as the node may change but still exist.
send('ANIMATION_END');
}, [node1, send]);
return {
isPresent: ['mounted', 'unmountSuspended'].includes(state),
ref: $fnLeV$react.useCallback(node => {
if (node) stylesRef.current = getComputedStyle(node);
setNode(node);
}, [])
};
}
/* -----------------------------------------------------------------------------------------------*/
function $a2fa0214bb2735a1$var$getAnimationName(styles) {
return (styles === null || styles === void 0 ? void 0 : styles.animationName) || 'none';
}
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-primitive/dist/index.js":
/*!*********************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-primitive/dist/index.js ***!
\*********************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $iMixA$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $iMixA$react = __webpack_require__(/*! react */ "react");
var $iMixA$reactdom = __webpack_require__(/*! react-dom */ "react-dom");
var $iMixA$radixuireactslot = __webpack_require__(/*! @radix-ui/react-slot */ "../../../node_modules/@radix-ui/react-slot/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "Primitive", () => $c3def6332c2749a6$export$250ffa63cdc0d034);
$parcel$export(module.exports, "Root", () => $c3def6332c2749a6$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "dispatchDiscreteCustomEvent", () => $c3def6332c2749a6$export$6d1a0317bde7de7f);
const $c3def6332c2749a6$var$NODES = ['a', 'button', 'div', 'form', 'h2', 'h3', 'img', 'input', 'label', 'li', 'nav', 'ol', 'p', 'span', 'svg', 'ul']; // Temporary while we await merge of this fix:
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
// prettier-ignore
/* -------------------------------------------------------------------------------------------------
* Primitive
* -----------------------------------------------------------------------------------------------*/
const $c3def6332c2749a6$export$250ffa63cdc0d034 = $c3def6332c2749a6$var$NODES.reduce((primitive, node) => {
const Node = /*#__PURE__*/$iMixA$react.forwardRef((props, forwardedRef) => {
const {
asChild: asChild,
...primitiveProps
} = props;
const Comp = asChild ? $iMixA$radixuireactslot.Slot : node;
$iMixA$react.useEffect(() => {
window[Symbol.for('radix-ui')] = true;
}, []);
return /*#__PURE__*/$iMixA$react.createElement(Comp, $parcel$interopDefault($iMixA$babelruntimehelpersextends)({}, primitiveProps, {
ref: forwardedRef
}));
});
Node.displayName = `Primitive.${node}`;
return {
...primitive,
[node]: Node
};
}, {});
/* -------------------------------------------------------------------------------------------------
* Utils
* -----------------------------------------------------------------------------------------------*/ /**
* Flush custom event dispatch
* https://github.com/radix-ui/primitives/pull/1378
*
* React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.
*
* Internally, React prioritises events in the following order:
* - discrete
* - continuous
* - default
*
* https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350
*
* `discrete` is an important distinction as updates within these events are applied immediately.
* React however, is not able to infer the priority of custom event types due to how they are detected internally.
* Because of this, it's possible for updates from custom events to be unexpectedly batched when
* dispatched by another `discrete` event.
*
* In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.
* This utility should be used when dispatching a custom event from within another `discrete` event, this utility
* is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.
* For example:
*
* dispatching a known click 👎
* target.dispatchEvent(new Event(‘click’))
*
* dispatching a custom type within a non-discrete event 👎
* onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}
*
* dispatching a custom type within a `discrete` event 👍
* onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}
*
* Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use
* this utility with them. This is because it's possible for those handlers to be called implicitly during render
* e.g. when focus is within a component as it is unmounted, or when managing focus on mount.
*/
function $c3def6332c2749a6$export$6d1a0317bde7de7f(target, event) {
if (target) $iMixA$reactdom.flushSync(() => target.dispatchEvent(event));
}
/* -----------------------------------------------------------------------------------------------*/
const $c3def6332c2749a6$export$be92b6f5f03c0fe9 = $c3def6332c2749a6$export$250ffa63cdc0d034;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-roving-focus/dist/index.js":
/*!************************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-roving-focus/dist/index.js ***!
\************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $9QJ9Y$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $9QJ9Y$react = __webpack_require__(/*! react */ "react");
var $9QJ9Y$radixuiprimitive = __webpack_require__(/*! @radix-ui/primitive */ "../../../node_modules/@radix-ui/primitive/dist/index.js");
var $9QJ9Y$radixuireactcollection = __webpack_require__(/*! @radix-ui/react-collection */ "../../../node_modules/@radix-ui/react-collection/dist/index.js");
var $9QJ9Y$radixuireactcomposerefs = __webpack_require__(/*! @radix-ui/react-compose-refs */ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js");
var $9QJ9Y$radixuireactcontext = __webpack_require__(/*! @radix-ui/react-context */ "../../../node_modules/@radix-ui/react-context/dist/index.js");
var $9QJ9Y$radixuireactid = __webpack_require__(/*! @radix-ui/react-id */ "../../../node_modules/@radix-ui/react-id/dist/index.js");
var $9QJ9Y$radixuireactprimitive = __webpack_require__(/*! @radix-ui/react-primitive */ "../../../node_modules/@radix-ui/react-primitive/dist/index.js");
var $9QJ9Y$radixuireactusecallbackref = __webpack_require__(/*! @radix-ui/react-use-callback-ref */ "../../../node_modules/@radix-ui/react-use-callback-ref/dist/index.js");
var $9QJ9Y$radixuireactusecontrollablestate = __webpack_require__(/*! @radix-ui/react-use-controllable-state */ "../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.js");
var $9QJ9Y$radixuireactdirection = __webpack_require__(/*! @radix-ui/react-direction */ "../../../node_modules/@radix-ui/react-direction/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "createRovingFocusGroupScope", () => $0063afae63b3fa70$export$c7109489551a4f4);
$parcel$export(module.exports, "RovingFocusGroup", () => $0063afae63b3fa70$export$8699f7c8af148338);
$parcel$export(module.exports, "RovingFocusGroupItem", () => $0063afae63b3fa70$export$ab9df7c53fe8454);
$parcel$export(module.exports, "Root", () => $0063afae63b3fa70$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Item", () => $0063afae63b3fa70$export$6d08773d2e66f8f2);
const $0063afae63b3fa70$var$ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus';
const $0063afae63b3fa70$var$EVENT_OPTIONS = {
bubbles: false,
cancelable: true
};
/* -------------------------------------------------------------------------------------------------
* RovingFocusGroup
* -----------------------------------------------------------------------------------------------*/
const $0063afae63b3fa70$var$GROUP_NAME = 'RovingFocusGroup';
const [$0063afae63b3fa70$var$Collection, $0063afae63b3fa70$var$useCollection, $0063afae63b3fa70$var$createCollectionScope] = $9QJ9Y$radixuireactcollection.createCollection($0063afae63b3fa70$var$GROUP_NAME);
const [$0063afae63b3fa70$var$createRovingFocusGroupContext, $0063afae63b3fa70$export$c7109489551a4f4] = $9QJ9Y$radixuireactcontext.createContextScope($0063afae63b3fa70$var$GROUP_NAME, [$0063afae63b3fa70$var$createCollectionScope]);
const [$0063afae63b3fa70$var$RovingFocusProvider, $0063afae63b3fa70$var$useRovingFocusContext] = $0063afae63b3fa70$var$createRovingFocusGroupContext($0063afae63b3fa70$var$GROUP_NAME);
const $0063afae63b3fa70$export$8699f7c8af148338 = /*#__PURE__*/$9QJ9Y$react.forwardRef((props, forwardedRef) => {
return /*#__PURE__*/$9QJ9Y$react.createElement($0063afae63b3fa70$var$Collection.Provider, {
scope: props.__scopeRovingFocusGroup
}, /*#__PURE__*/$9QJ9Y$react.createElement($0063afae63b3fa70$var$Collection.Slot, {
scope: props.__scopeRovingFocusGroup
}, /*#__PURE__*/$9QJ9Y$react.createElement($0063afae63b3fa70$var$RovingFocusGroupImpl, $parcel$interopDefault($9QJ9Y$babelruntimehelpersextends)({}, props, {
ref: forwardedRef
}))));
});
/*#__PURE__*/
Object.assign($0063afae63b3fa70$export$8699f7c8af148338, {
displayName: $0063afae63b3fa70$var$GROUP_NAME
});
/* -----------------------------------------------------------------------------------------------*/
const $0063afae63b3fa70$var$RovingFocusGroupImpl = /*#__PURE__*/$9QJ9Y$react.forwardRef((props, forwardedRef) => {
const {
__scopeRovingFocusGroup: __scopeRovingFocusGroup,
orientation: orientation,
loop = false,
dir: dir,
currentTabStopId: currentTabStopIdProp,
defaultCurrentTabStopId: defaultCurrentTabStopId,
onCurrentTabStopIdChange: onCurrentTabStopIdChange,
onEntryFocus: onEntryFocus,
...groupProps
} = props;
const ref = $9QJ9Y$react.useRef(null);
const composedRefs = $9QJ9Y$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
const direction = $9QJ9Y$radixuireactdirection.useDirection(dir);
const [currentTabStopId = null, setCurrentTabStopId] = $9QJ9Y$radixuireactusecontrollablestate.useControllableState({
prop: currentTabStopIdProp,
defaultProp: defaultCurrentTabStopId,
onChange: onCurrentTabStopIdChange
});
const [isTabbingBackOut, setIsTabbingBackOut] = $9QJ9Y$react.useState(false);
const handleEntryFocus = $9QJ9Y$radixuireactusecallbackref.useCallbackRef(onEntryFocus);
const getItems = $0063afae63b3fa70$var$useCollection(__scopeRovingFocusGroup);
const isClickFocusRef = $9QJ9Y$react.useRef(false);
const [focusableItemsCount, setFocusableItemsCount] = $9QJ9Y$react.useState(0);
$9QJ9Y$react.useEffect(() => {
const node = ref.current;
if (node) {
node.addEventListener($0063afae63b3fa70$var$ENTRY_FOCUS, handleEntryFocus);
return () => node.removeEventListener($0063afae63b3fa70$var$ENTRY_FOCUS, handleEntryFocus);
}
}, [handleEntryFocus]);
return /*#__PURE__*/$9QJ9Y$react.createElement($0063afae63b3fa70$var$RovingFocusProvider, {
scope: __scopeRovingFocusGroup,
orientation: orientation,
dir: direction,
loop: loop,
currentTabStopId: currentTabStopId,
onItemFocus: $9QJ9Y$react.useCallback(tabStopId => setCurrentTabStopId(tabStopId), [setCurrentTabStopId]),
onItemShiftTab: $9QJ9Y$react.useCallback(() => setIsTabbingBackOut(true), []),
onFocusableItemAdd: $9QJ9Y$react.useCallback(() => setFocusableItemsCount(prevCount => prevCount + 1), []),
onFocusableItemRemove: $9QJ9Y$react.useCallback(() => setFocusableItemsCount(prevCount => prevCount - 1), [])
}, /*#__PURE__*/$9QJ9Y$react.createElement($9QJ9Y$radixuireactprimitive.Primitive.div, $parcel$interopDefault($9QJ9Y$babelruntimehelpersextends)({
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
"data-orientation": orientation
}, groupProps, {
ref: composedRefs,
style: {
outline: 'none',
...props.style
},
onMouseDown: $9QJ9Y$radixuiprimitive.composeEventHandlers(props.onMouseDown, () => {
isClickFocusRef.current = true;
}),
onFocus: $9QJ9Y$radixuiprimitive.composeEventHandlers(props.onFocus, event => {
// We normally wouldn't need this check, because we already check
// that the focus is on the current target and not bubbling to it.
// We do this because Safari doesn't focus buttons when clicked, and
// instead, the wrapper will get focused and not through a bubbling event.
const isKeyboardFocus = !isClickFocusRef.current;
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
const entryFocusEvent = new CustomEvent($0063afae63b3fa70$var$ENTRY_FOCUS, $0063afae63b3fa70$var$EVENT_OPTIONS);
event.currentTarget.dispatchEvent(entryFocusEvent);
if (!entryFocusEvent.defaultPrevented) {
const items = getItems().filter(item => item.focusable);
const activeItem = items.find(item => item.active);
const currentItem = items.find(item => item.id === currentTabStopId);
const candidateItems = [activeItem, currentItem, ...items].filter(Boolean);
const candidateNodes = candidateItems.map(item => item.ref.current);
$0063afae63b3fa70$var$focusFirst(candidateNodes);
}
}
isClickFocusRef.current = false;
}),
onBlur: $9QJ9Y$radixuiprimitive.composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
})));
});
/* -------------------------------------------------------------------------------------------------
* RovingFocusGroupItem
* -----------------------------------------------------------------------------------------------*/
const $0063afae63b3fa70$var$ITEM_NAME = 'RovingFocusGroupItem';
const $0063afae63b3fa70$export$ab9df7c53fe8454 = /*#__PURE__*/$9QJ9Y$react.forwardRef((props, forwardedRef) => {
const {
__scopeRovingFocusGroup: __scopeRovingFocusGroup,
focusable = true,
active = false,
tabStopId: tabStopId,
...itemProps
} = props;
const autoId = $9QJ9Y$radixuireactid.useId();
const id = tabStopId || autoId;
const context = $0063afae63b3fa70$var$useRovingFocusContext($0063afae63b3fa70$var$ITEM_NAME, __scopeRovingFocusGroup);
const isCurrentTabStop = context.currentTabStopId === id;
const getItems = $0063afae63b3fa70$var$useCollection(__scopeRovingFocusGroup);
const {
onFocusableItemAdd: onFocusableItemAdd,
onFocusableItemRemove: onFocusableItemRemove
} = context;
$9QJ9Y$react.useEffect(() => {
if (focusable) {
onFocusableItemAdd();
return () => onFocusableItemRemove();
}
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
return /*#__PURE__*/$9QJ9Y$react.createElement($0063afae63b3fa70$var$Collection.ItemSlot, {
scope: __scopeRovingFocusGroup,
id: id,
focusable: focusable,
active: active
}, /*#__PURE__*/$9QJ9Y$react.createElement($9QJ9Y$radixuireactprimitive.Primitive.span, $parcel$interopDefault($9QJ9Y$babelruntimehelpersextends)({
tabIndex: isCurrentTabStop ? 0 : -1,
"data-orientation": context.orientation
}, itemProps, {
ref: forwardedRef,
onMouseDown: $9QJ9Y$radixuiprimitive.composeEventHandlers(props.onMouseDown, event => {
// We prevent focusing non-focusable items on `mousedown`.
// Even though the item has tabIndex={-1}, that only means take it out of the tab order.
if (!focusable) event.preventDefault(); // Safari doesn't focus a button when clicked so we run our logic on mousedown also
else context.onItemFocus(id);
}),
onFocus: $9QJ9Y$radixuiprimitive.composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
onKeyDown: $9QJ9Y$radixuiprimitive.composeEventHandlers(props.onKeyDown, event => {
if (event.key === 'Tab' && event.shiftKey) {
context.onItemShiftTab();
return;
}
if (event.target !== event.currentTarget) return;
const focusIntent = $0063afae63b3fa70$var$getFocusIntent(event, context.orientation, context.dir);
if (focusIntent !== undefined) {
event.preventDefault();
const items = getItems().filter(item => item.focusable);
let candidateNodes = items.map(item => item.ref.current);
if (focusIntent === 'last') candidateNodes.reverse();else if (focusIntent === 'prev' || focusIntent === 'next') {
if (focusIntent === 'prev') candidateNodes.reverse();
const currentIndex = candidateNodes.indexOf(event.currentTarget);
candidateNodes = context.loop ? $0063afae63b3fa70$var$wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
}
/**
* Imperative focus during keydown is risky so we prevent React's batching updates
* to avoid potential bugs. See: https://github.com/facebook/react/issues/20332
*/
setTimeout(() => $0063afae63b3fa70$var$focusFirst(candidateNodes));
}
})
})));
});
/*#__PURE__*/
Object.assign($0063afae63b3fa70$export$ab9df7c53fe8454, {
displayName: $0063afae63b3fa70$var$ITEM_NAME
});
/* -----------------------------------------------------------------------------------------------*/ // prettier-ignore
const $0063afae63b3fa70$var$MAP_KEY_TO_FOCUS_INTENT = {
ArrowLeft: 'prev',
ArrowUp: 'prev',
ArrowRight: 'next',
ArrowDown: 'next',
PageUp: 'first',
Home: 'first',
PageDown: 'last',
End: 'last'
};
function $0063afae63b3fa70$var$getDirectionAwareKey(key, dir) {
if (dir !== 'rtl') return key;
return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;
}
function $0063afae63b3fa70$var$getFocusIntent(event, orientation, dir) {
const key = $0063afae63b3fa70$var$getDirectionAwareKey(event.key, dir);
if (orientation === 'vertical' && ['ArrowLeft', 'ArrowRight'].includes(key)) return undefined;
if (orientation === 'horizontal' && ['ArrowUp', 'ArrowDown'].includes(key)) return undefined;
return $0063afae63b3fa70$var$MAP_KEY_TO_FOCUS_INTENT[key];
}
function $0063afae63b3fa70$var$focusFirst(candidates) {
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
for (const candidate of candidates) {
// if focus is already where we want to go, we don't want to keep going through the candidates
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
candidate.focus();
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
}
}
/**
* Wraps an array around itself at a given start index
* Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`
*/
function $0063afae63b3fa70$var$wrapArray(array, startIndex) {
return array.map((_, index) => array[(startIndex + index) % array.length]);
}
const $0063afae63b3fa70$export$be92b6f5f03c0fe9 = $0063afae63b3fa70$export$8699f7c8af148338;
const $0063afae63b3fa70$export$6d08773d2e66f8f2 = $0063afae63b3fa70$export$ab9df7c53fe8454;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-slot/dist/index.js":
/*!****************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-slot/dist/index.js ***!
\****************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $dAvBt$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $dAvBt$react = __webpack_require__(/*! react */ "react");
var $dAvBt$radixuireactcomposerefs = __webpack_require__(/*! @radix-ui/react-compose-refs */ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "Slot", () => $82dc8d030dec7549$export$8c6ed5c666ac1360);
$parcel$export(module.exports, "Slottable", () => $82dc8d030dec7549$export$d9f1ccf0bdb05d45);
$parcel$export(module.exports, "Root", () => $82dc8d030dec7549$export$be92b6f5f03c0fe9);
/* -------------------------------------------------------------------------------------------------
* Slot
* -----------------------------------------------------------------------------------------------*/
const $82dc8d030dec7549$export$8c6ed5c666ac1360 = /*#__PURE__*/$dAvBt$react.forwardRef((props, forwardedRef) => {
const {
children: children,
...slotProps
} = props;
const childrenArray = $dAvBt$react.Children.toArray(children);
const slottable = childrenArray.find($82dc8d030dec7549$var$isSlottable);
if (slottable) {
// the new element to render is the one passed as a child of `Slottable`
const newElement = slottable.props.children;
const newChildren = childrenArray.map(child => {
if (child === slottable) {
// because the new element will be the one rendered, we are only interested
// in grabbing its children (`newElement.props.children`)
if ($dAvBt$react.Children.count(newElement) > 1) return $dAvBt$react.Children.only(null);
return /*#__PURE__*/$dAvBt$react.isValidElement(newElement) ? newElement.props.children : null;
} else return child;
});
return /*#__PURE__*/$dAvBt$react.createElement($82dc8d030dec7549$var$SlotClone, $parcel$interopDefault($dAvBt$babelruntimehelpersextends)({}, slotProps, {
ref: forwardedRef
}), /*#__PURE__*/$dAvBt$react.isValidElement(newElement) ? /*#__PURE__*/$dAvBt$react.cloneElement(newElement, undefined, newChildren) : null);
}
return /*#__PURE__*/$dAvBt$react.createElement($82dc8d030dec7549$var$SlotClone, $parcel$interopDefault($dAvBt$babelruntimehelpersextends)({}, slotProps, {
ref: forwardedRef
}), children);
});
$82dc8d030dec7549$export$8c6ed5c666ac1360.displayName = 'Slot';
/* -------------------------------------------------------------------------------------------------
* SlotClone
* -----------------------------------------------------------------------------------------------*/
const $82dc8d030dec7549$var$SlotClone = /*#__PURE__*/$dAvBt$react.forwardRef((props, forwardedRef) => {
const {
children: children,
...slotProps
} = props;
if ( /*#__PURE__*/$dAvBt$react.isValidElement(children)) return /*#__PURE__*/$dAvBt$react.cloneElement(children, {
...$82dc8d030dec7549$var$mergeProps(slotProps, children.props),
ref: forwardedRef ? $dAvBt$radixuireactcomposerefs.composeRefs(forwardedRef, children.ref) : children.ref
});
return $dAvBt$react.Children.count(children) > 1 ? $dAvBt$react.Children.only(null) : null;
});
$82dc8d030dec7549$var$SlotClone.displayName = 'SlotClone';
/* -------------------------------------------------------------------------------------------------
* Slottable
* -----------------------------------------------------------------------------------------------*/
const $82dc8d030dec7549$export$d9f1ccf0bdb05d45 = _ref => {
let {
children: children
} = _ref;
return /*#__PURE__*/$dAvBt$react.createElement($dAvBt$react.Fragment, null, children);
};
/* ---------------------------------------------------------------------------------------------- */
function $82dc8d030dec7549$var$isSlottable(child) {
return /*#__PURE__*/$dAvBt$react.isValidElement(child) && child.type === $82dc8d030dec7549$export$d9f1ccf0bdb05d45;
}
function $82dc8d030dec7549$var$mergeProps(slotProps, childProps) {
// all child props should override
const overrideProps = {
...childProps
};
for (const propName in childProps) {
const slotPropValue = slotProps[propName];
const childPropValue = childProps[propName];
const isHandler = /^on[A-Z]/.test(propName);
if (isHandler) {
// if the handler exists on both, we compose them
if (slotPropValue && childPropValue) overrideProps[propName] = function () {
childPropValue(...arguments);
slotPropValue(...arguments);
};else if (slotPropValue) overrideProps[propName] = slotPropValue;
} else if (propName === 'style') overrideProps[propName] = {
...slotPropValue,
...childPropValue
};else if (propName === 'className') overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ');
}
return {
...slotProps,
...overrideProps
};
}
const $82dc8d030dec7549$export$be92b6f5f03c0fe9 = $82dc8d030dec7549$export$8c6ed5c666ac1360;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-tooltip/dist/index.js":
/*!*******************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-tooltip/dist/index.js ***!
\*******************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $iVrL9$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $iVrL9$react = __webpack_require__(/*! react */ "react");
var $iVrL9$radixuiprimitive = __webpack_require__(/*! @radix-ui/primitive */ "../../../node_modules/@radix-ui/primitive/dist/index.js");
var $iVrL9$radixuireactcomposerefs = __webpack_require__(/*! @radix-ui/react-compose-refs */ "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js");
var $iVrL9$radixuireactcontext = __webpack_require__(/*! @radix-ui/react-context */ "../../../node_modules/@radix-ui/react-context/dist/index.js");
var $iVrL9$radixuireactdismissablelayer = __webpack_require__(/*! @radix-ui/react-dismissable-layer */ "../../../node_modules/@radix-ui/react-dismissable-layer/dist/index.js");
var $iVrL9$radixuireactid = __webpack_require__(/*! @radix-ui/react-id */ "../../../node_modules/@radix-ui/react-id/dist/index.js");
var $iVrL9$radixuireactpopper = __webpack_require__(/*! @radix-ui/react-popper */ "../../../node_modules/@radix-ui/react-popper/dist/index.js");
var $iVrL9$radixuireactportal = __webpack_require__(/*! @radix-ui/react-portal */ "../../../node_modules/@radix-ui/react-portal/dist/index.js");
var $iVrL9$radixuireactpresence = __webpack_require__(/*! @radix-ui/react-presence */ "../../../node_modules/@radix-ui/react-presence/dist/index.js");
var $iVrL9$radixuireactprimitive = __webpack_require__(/*! @radix-ui/react-primitive */ "../../../node_modules/@radix-ui/react-primitive/dist/index.js");
var $iVrL9$radixuireactslot = __webpack_require__(/*! @radix-ui/react-slot */ "../../../node_modules/@radix-ui/react-slot/dist/index.js");
var $iVrL9$radixuireactusecontrollablestate = __webpack_require__(/*! @radix-ui/react-use-controllable-state */ "../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.js");
var $iVrL9$radixuireactvisuallyhidden = __webpack_require__(/*! @radix-ui/react-visually-hidden */ "../../../node_modules/@radix-ui/react-visually-hidden/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "createTooltipScope", () => $c34afbc43c90cc6f$export$1c540a2224f0d865);
$parcel$export(module.exports, "TooltipProvider", () => $c34afbc43c90cc6f$export$f78649fb9ca566b8);
$parcel$export(module.exports, "Tooltip", () => $c34afbc43c90cc6f$export$28c660c63b792dea);
$parcel$export(module.exports, "TooltipTrigger", () => $c34afbc43c90cc6f$export$8c610744efcf8a1d);
$parcel$export(module.exports, "TooltipPortal", () => $c34afbc43c90cc6f$export$7b36b8f925ab7497);
$parcel$export(module.exports, "TooltipContent", () => $c34afbc43c90cc6f$export$e9003e2be37ec060);
$parcel$export(module.exports, "TooltipArrow", () => $c34afbc43c90cc6f$export$c27ee0ad710f7559);
$parcel$export(module.exports, "Provider", () => $c34afbc43c90cc6f$export$2881499e37b75b9a);
$parcel$export(module.exports, "Root", () => $c34afbc43c90cc6f$export$be92b6f5f03c0fe9);
$parcel$export(module.exports, "Trigger", () => $c34afbc43c90cc6f$export$41fb9f06171c75f4);
$parcel$export(module.exports, "Portal", () => $c34afbc43c90cc6f$export$602eac185826482c);
$parcel$export(module.exports, "Content", () => $c34afbc43c90cc6f$export$7c6e2c02157bb7d2);
$parcel$export(module.exports, "Arrow", () => $c34afbc43c90cc6f$export$21b07c8f274aebd5);
const [$c34afbc43c90cc6f$var$createTooltipContext, $c34afbc43c90cc6f$export$1c540a2224f0d865] = $iVrL9$radixuireactcontext.createContextScope('Tooltip', [$iVrL9$radixuireactpopper.createPopperScope]);
const $c34afbc43c90cc6f$var$usePopperScope = $iVrL9$radixuireactpopper.createPopperScope();
/* -------------------------------------------------------------------------------------------------
* TooltipProvider
* -----------------------------------------------------------------------------------------------*/
const $c34afbc43c90cc6f$var$PROVIDER_NAME = 'TooltipProvider';
const $c34afbc43c90cc6f$var$DEFAULT_DELAY_DURATION = 700;
const $c34afbc43c90cc6f$var$TOOLTIP_OPEN = 'tooltip.open';
const [$c34afbc43c90cc6f$var$TooltipProviderContextProvider, $c34afbc43c90cc6f$var$useTooltipProviderContext] = $c34afbc43c90cc6f$var$createTooltipContext($c34afbc43c90cc6f$var$PROVIDER_NAME);
const $c34afbc43c90cc6f$export$f78649fb9ca566b8 = props => {
const {
__scopeTooltip: __scopeTooltip,
delayDuration = $c34afbc43c90cc6f$var$DEFAULT_DELAY_DURATION,
skipDelayDuration = 300,
disableHoverableContent = false,
children: children
} = props;
const [isOpenDelayed, setIsOpenDelayed] = $iVrL9$react.useState(true);
const isPointerInTransitRef = $iVrL9$react.useRef(false);
const skipDelayTimerRef = $iVrL9$react.useRef(0);
$iVrL9$react.useEffect(() => {
const skipDelayTimer = skipDelayTimerRef.current;
return () => window.clearTimeout(skipDelayTimer);
}, []);
return /*#__PURE__*/$iVrL9$react.createElement($c34afbc43c90cc6f$var$TooltipProviderContextProvider, {
scope: __scopeTooltip,
isOpenDelayed: isOpenDelayed,
delayDuration: delayDuration,
onOpen: $iVrL9$react.useCallback(() => {
window.clearTimeout(skipDelayTimerRef.current);
setIsOpenDelayed(false);
}, []),
onClose: $iVrL9$react.useCallback(() => {
window.clearTimeout(skipDelayTimerRef.current);
skipDelayTimerRef.current = window.setTimeout(() => setIsOpenDelayed(true), skipDelayDuration);
}, [skipDelayDuration]),
isPointerInTransitRef: isPointerInTransitRef,
onPointerInTransitChange: $iVrL9$react.useCallback(inTransit => {
isPointerInTransitRef.current = inTransit;
}, []),
disableHoverableContent: disableHoverableContent
}, children);
};
/*#__PURE__*/
Object.assign($c34afbc43c90cc6f$export$f78649fb9ca566b8, {
displayName: $c34afbc43c90cc6f$var$PROVIDER_NAME
});
/* -------------------------------------------------------------------------------------------------
* Tooltip
* -----------------------------------------------------------------------------------------------*/
const $c34afbc43c90cc6f$var$TOOLTIP_NAME = 'Tooltip';
const [$c34afbc43c90cc6f$var$TooltipContextProvider, $c34afbc43c90cc6f$var$useTooltipContext] = $c34afbc43c90cc6f$var$createTooltipContext($c34afbc43c90cc6f$var$TOOLTIP_NAME);
const $c34afbc43c90cc6f$export$28c660c63b792dea = props => {
const {
__scopeTooltip: __scopeTooltip,
children: children,
open: openProp,
defaultOpen = false,
onOpenChange: onOpenChange,
disableHoverableContent: disableHoverableContentProp,
delayDuration: delayDurationProp
} = props;
const providerContext = $c34afbc43c90cc6f$var$useTooltipProviderContext($c34afbc43c90cc6f$var$TOOLTIP_NAME, props.__scopeTooltip);
const popperScope = $c34afbc43c90cc6f$var$usePopperScope(__scopeTooltip);
const [trigger, setTrigger] = $iVrL9$react.useState(null);
const contentId = $iVrL9$radixuireactid.useId();
const openTimerRef = $iVrL9$react.useRef(0);
const disableHoverableContent = disableHoverableContentProp !== null && disableHoverableContentProp !== void 0 ? disableHoverableContentProp : providerContext.disableHoverableContent;
const delayDuration = delayDurationProp !== null && delayDurationProp !== void 0 ? delayDurationProp : providerContext.delayDuration;
const wasOpenDelayedRef = $iVrL9$react.useRef(false);
const [open1 = false, setOpen] = $iVrL9$radixuireactusecontrollablestate.useControllableState({
prop: openProp,
defaultProp: defaultOpen,
onChange: open => {
if (open) {
providerContext.onOpen(); // as `onChange` is called within a lifecycle method we
// avoid dispatching via `dispatchDiscreteCustomEvent`.
document.dispatchEvent(new CustomEvent($c34afbc43c90cc6f$var$TOOLTIP_OPEN));
} else providerContext.onClose();
onOpenChange === null || onOpenChange === void 0 || onOpenChange(open);
}
});
const stateAttribute = $iVrL9$react.useMemo(() => {
return open1 ? wasOpenDelayedRef.current ? 'delayed-open' : 'instant-open' : 'closed';
}, [open1]);
const handleOpen = $iVrL9$react.useCallback(() => {
window.clearTimeout(openTimerRef.current);
wasOpenDelayedRef.current = false;
setOpen(true);
}, [setOpen]);
const handleClose = $iVrL9$react.useCallback(() => {
window.clearTimeout(openTimerRef.current);
setOpen(false);
}, [setOpen]);
const handleDelayedOpen = $iVrL9$react.useCallback(() => {
window.clearTimeout(openTimerRef.current);
openTimerRef.current = window.setTimeout(() => {
wasOpenDelayedRef.current = true;
setOpen(true);
}, delayDuration);
}, [delayDuration, setOpen]);
$iVrL9$react.useEffect(() => {
return () => window.clearTimeout(openTimerRef.current);
}, []);
return /*#__PURE__*/$iVrL9$react.createElement($iVrL9$radixuireactpopper.Root, popperScope, /*#__PURE__*/$iVrL9$react.createElement($c34afbc43c90cc6f$var$TooltipContextProvider, {
scope: __scopeTooltip,
contentId: contentId,
open: open1,
stateAttribute: stateAttribute,
trigger: trigger,
onTriggerChange: setTrigger,
onTriggerEnter: $iVrL9$react.useCallback(() => {
if (providerContext.isOpenDelayed) handleDelayedOpen();else handleOpen();
}, [providerContext.isOpenDelayed, handleDelayedOpen, handleOpen]),
onTriggerLeave: $iVrL9$react.useCallback(() => {
if (disableHoverableContent) handleClose();else
// Clear the timer in case the pointer leaves the trigger before the tooltip is opened.
window.clearTimeout(openTimerRef.current);
}, [handleClose, disableHoverableContent]),
onOpen: handleOpen,
onClose: handleClose,
disableHoverableContent: disableHoverableContent
}, children));
};
/*#__PURE__*/
Object.assign($c34afbc43c90cc6f$export$28c660c63b792dea, {
displayName: $c34afbc43c90cc6f$var$TOOLTIP_NAME
});
/* -------------------------------------------------------------------------------------------------
* TooltipTrigger
* -----------------------------------------------------------------------------------------------*/
const $c34afbc43c90cc6f$var$TRIGGER_NAME = 'TooltipTrigger';
const $c34afbc43c90cc6f$export$8c610744efcf8a1d = /*#__PURE__*/$iVrL9$react.forwardRef((props, forwardedRef) => {
const {
__scopeTooltip: __scopeTooltip,
...triggerProps
} = props;
const context = $c34afbc43c90cc6f$var$useTooltipContext($c34afbc43c90cc6f$var$TRIGGER_NAME, __scopeTooltip);
const providerContext = $c34afbc43c90cc6f$var$useTooltipProviderContext($c34afbc43c90cc6f$var$TRIGGER_NAME, __scopeTooltip);
const popperScope = $c34afbc43c90cc6f$var$usePopperScope(__scopeTooltip);
const ref = $iVrL9$react.useRef(null);
const composedRefs = $iVrL9$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref, context.onTriggerChange);
const isPointerDownRef = $iVrL9$react.useRef(false);
const hasPointerMoveOpenedRef = $iVrL9$react.useRef(false);
const handlePointerUp = $iVrL9$react.useCallback(() => isPointerDownRef.current = false, []);
$iVrL9$react.useEffect(() => {
return () => document.removeEventListener('pointerup', handlePointerUp);
}, [handlePointerUp]);
return /*#__PURE__*/$iVrL9$react.createElement($iVrL9$radixuireactpopper.Anchor, $parcel$interopDefault($iVrL9$babelruntimehelpersextends)({
asChild: true
}, popperScope), /*#__PURE__*/$iVrL9$react.createElement($iVrL9$radixuireactprimitive.Primitive.button, $parcel$interopDefault($iVrL9$babelruntimehelpersextends)({
// We purposefully avoid adding `type=button` here because tooltip triggers are also
// commonly anchors and the anchor `type` attribute signifies MIME type.
"aria-describedby": context.open ? context.contentId : undefined,
"data-state": context.stateAttribute
}, triggerProps, {
ref: composedRefs,
onPointerMove: $iVrL9$radixuiprimitive.composeEventHandlers(props.onPointerMove, event => {
if (event.pointerType === 'touch') return;
if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
context.onTriggerEnter();
hasPointerMoveOpenedRef.current = true;
}
}),
onPointerLeave: $iVrL9$radixuiprimitive.composeEventHandlers(props.onPointerLeave, () => {
context.onTriggerLeave();
hasPointerMoveOpenedRef.current = false;
}),
onPointerDown: $iVrL9$radixuiprimitive.composeEventHandlers(props.onPointerDown, () => {
isPointerDownRef.current = true;
document.addEventListener('pointerup', handlePointerUp, {
once: true
});
}),
onFocus: $iVrL9$radixuiprimitive.composeEventHandlers(props.onFocus, () => {
if (!isPointerDownRef.current) context.onOpen();
}),
onBlur: $iVrL9$radixuiprimitive.composeEventHandlers(props.onBlur, context.onClose),
onClick: $iVrL9$radixuiprimitive.composeEventHandlers(props.onClick, context.onClose)
})));
});
/*#__PURE__*/
Object.assign($c34afbc43c90cc6f$export$8c610744efcf8a1d, {
displayName: $c34afbc43c90cc6f$var$TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* TooltipPortal
* -----------------------------------------------------------------------------------------------*/
const $c34afbc43c90cc6f$var$PORTAL_NAME = 'TooltipPortal';
const [$c34afbc43c90cc6f$var$PortalProvider, $c34afbc43c90cc6f$var$usePortalContext] = $c34afbc43c90cc6f$var$createTooltipContext($c34afbc43c90cc6f$var$PORTAL_NAME, {
forceMount: undefined
});
const $c34afbc43c90cc6f$export$7b36b8f925ab7497 = props => {
const {
__scopeTooltip: __scopeTooltip,
forceMount: forceMount,
children: children,
container: container
} = props;
const context = $c34afbc43c90cc6f$var$useTooltipContext($c34afbc43c90cc6f$var$PORTAL_NAME, __scopeTooltip);
return /*#__PURE__*/$iVrL9$react.createElement($c34afbc43c90cc6f$var$PortalProvider, {
scope: __scopeTooltip,
forceMount: forceMount
}, /*#__PURE__*/$iVrL9$react.createElement($iVrL9$radixuireactpresence.Presence, {
present: forceMount || context.open
}, /*#__PURE__*/$iVrL9$react.createElement($iVrL9$radixuireactportal.Portal, {
asChild: true,
container: container
}, children)));
};
/*#__PURE__*/
Object.assign($c34afbc43c90cc6f$export$7b36b8f925ab7497, {
displayName: $c34afbc43c90cc6f$var$PORTAL_NAME
});
/* -------------------------------------------------------------------------------------------------
* TooltipContent
* -----------------------------------------------------------------------------------------------*/
const $c34afbc43c90cc6f$var$CONTENT_NAME = 'TooltipContent';
const $c34afbc43c90cc6f$export$e9003e2be37ec060 = /*#__PURE__*/$iVrL9$react.forwardRef((props, forwardedRef) => {
const portalContext = $c34afbc43c90cc6f$var$usePortalContext($c34afbc43c90cc6f$var$CONTENT_NAME, props.__scopeTooltip);
const {
forceMount = portalContext.forceMount,
side = 'top',
...contentProps
} = props;
const context = $c34afbc43c90cc6f$var$useTooltipContext($c34afbc43c90cc6f$var$CONTENT_NAME, props.__scopeTooltip);
return /*#__PURE__*/$iVrL9$react.createElement($iVrL9$radixuireactpresence.Presence, {
present: forceMount || context.open
}, context.disableHoverableContent ? /*#__PURE__*/$iVrL9$react.createElement($c34afbc43c90cc6f$var$TooltipContentImpl, $parcel$interopDefault($iVrL9$babelruntimehelpersextends)({
side: side
}, contentProps, {
ref: forwardedRef
})) : /*#__PURE__*/$iVrL9$react.createElement($c34afbc43c90cc6f$var$TooltipContentHoverable, $parcel$interopDefault($iVrL9$babelruntimehelpersextends)({
side: side
}, contentProps, {
ref: forwardedRef
})));
});
const $c34afbc43c90cc6f$var$TooltipContentHoverable = /*#__PURE__*/$iVrL9$react.forwardRef((props, forwardedRef) => {
const context = $c34afbc43c90cc6f$var$useTooltipContext($c34afbc43c90cc6f$var$CONTENT_NAME, props.__scopeTooltip);
const providerContext = $c34afbc43c90cc6f$var$useTooltipProviderContext($c34afbc43c90cc6f$var$CONTENT_NAME, props.__scopeTooltip);
const ref = $iVrL9$react.useRef(null);
const composedRefs = $iVrL9$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
const [pointerGraceArea, setPointerGraceArea] = $iVrL9$react.useState(null);
const {
trigger: trigger,
onClose: onClose
} = context;
const content = ref.current;
const {
onPointerInTransitChange: onPointerInTransitChange
} = providerContext;
const handleRemoveGraceArea = $iVrL9$react.useCallback(() => {
setPointerGraceArea(null);
onPointerInTransitChange(false);
}, [onPointerInTransitChange]);
const handleCreateGraceArea = $iVrL9$react.useCallback((event, hoverTarget) => {
const currentTarget = event.currentTarget;
const exitPoint = {
x: event.clientX,
y: event.clientY
};
const exitSide = $c34afbc43c90cc6f$var$getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
const paddedExitPoints = $c34afbc43c90cc6f$var$getPaddedExitPoints(exitPoint, exitSide);
const hoverTargetPoints = $c34afbc43c90cc6f$var$getPointsFromRect(hoverTarget.getBoundingClientRect());
const graceArea = $c34afbc43c90cc6f$var$getHull([...paddedExitPoints, ...hoverTargetPoints]);
setPointerGraceArea(graceArea);
onPointerInTransitChange(true);
}, [onPointerInTransitChange]);
$iVrL9$react.useEffect(() => {
return () => handleRemoveGraceArea();
}, [handleRemoveGraceArea]);
$iVrL9$react.useEffect(() => {
if (trigger && content) {
const handleTriggerLeave = event => handleCreateGraceArea(event, content);
const handleContentLeave = event => handleCreateGraceArea(event, trigger);
trigger.addEventListener('pointerleave', handleTriggerLeave);
content.addEventListener('pointerleave', handleContentLeave);
return () => {
trigger.removeEventListener('pointerleave', handleTriggerLeave);
content.removeEventListener('pointerleave', handleContentLeave);
};
}
}, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
$iVrL9$react.useEffect(() => {
if (pointerGraceArea) {
const handleTrackPointerGrace = event => {
const target = event.target;
const pointerPosition = {
x: event.clientX,
y: event.clientY
};
const hasEnteredTarget = (trigger === null || trigger === void 0 ? void 0 : trigger.contains(target)) || (content === null || content === void 0 ? void 0 : content.contains(target));
const isPointerOutsideGraceArea = !$c34afbc43c90cc6f$var$isPointInPolygon(pointerPosition, pointerGraceArea);
if (hasEnteredTarget) handleRemoveGraceArea();else if (isPointerOutsideGraceArea) {
handleRemoveGraceArea();
onClose();
}
};
document.addEventListener('pointermove', handleTrackPointerGrace);
return () => document.removeEventListener('pointermove', handleTrackPointerGrace);
}
}, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
return /*#__PURE__*/$iVrL9$react.createElement($c34afbc43c90cc6f$var$TooltipContentImpl, $parcel$interopDefault($iVrL9$babelruntimehelpersextends)({}, props, {
ref: composedRefs
}));
});
const [$c34afbc43c90cc6f$var$VisuallyHiddenContentContextProvider, $c34afbc43c90cc6f$var$useVisuallyHiddenContentContext] = $c34afbc43c90cc6f$var$createTooltipContext($c34afbc43c90cc6f$var$TOOLTIP_NAME, {
isInside: false
});
const $c34afbc43c90cc6f$var$TooltipContentImpl = /*#__PURE__*/$iVrL9$react.forwardRef((props, forwardedRef) => {
const {
__scopeTooltip: __scopeTooltip,
children: children,
'aria-label': ariaLabel,
onEscapeKeyDown: onEscapeKeyDown,
onPointerDownOutside: onPointerDownOutside,
...contentProps
} = props;
const context = $c34afbc43c90cc6f$var$useTooltipContext($c34afbc43c90cc6f$var$CONTENT_NAME, __scopeTooltip);
const popperScope = $c34afbc43c90cc6f$var$usePopperScope(__scopeTooltip);
const {
onClose: onClose
} = context; // Close this tooltip if another one opens
$iVrL9$react.useEffect(() => {
document.addEventListener($c34afbc43c90cc6f$var$TOOLTIP_OPEN, onClose);
return () => document.removeEventListener($c34afbc43c90cc6f$var$TOOLTIP_OPEN, onClose);
}, [onClose]); // Close the tooltip if the trigger is scrolled
$iVrL9$react.useEffect(() => {
if (context.trigger) {
const handleScroll = event => {
const target = event.target;
if (target !== null && target !== void 0 && target.contains(context.trigger)) onClose();
};
window.addEventListener('scroll', handleScroll, {
capture: true
});
return () => window.removeEventListener('scroll', handleScroll, {
capture: true
});
}
}, [context.trigger, onClose]);
return /*#__PURE__*/$iVrL9$react.createElement($iVrL9$radixuireactdismissablelayer.DismissableLayer, {
asChild: true,
disableOutsidePointerEvents: false,
onEscapeKeyDown: onEscapeKeyDown,
onPointerDownOutside: onPointerDownOutside,
onFocusOutside: event => event.preventDefault(),
onDismiss: onClose
}, /*#__PURE__*/$iVrL9$react.createElement($iVrL9$radixuireactpopper.Content, $parcel$interopDefault($iVrL9$babelruntimehelpersextends)({
"data-state": context.stateAttribute
}, popperScope, contentProps, {
ref: forwardedRef,
style: {
...contentProps.style,
'--radix-tooltip-content-transform-origin': 'var(--radix-popper-transform-origin)',
'--radix-tooltip-content-available-width': 'var(--radix-popper-available-width)',
'--radix-tooltip-content-available-height': 'var(--radix-popper-available-height)',
'--radix-tooltip-trigger-width': 'var(--radix-popper-anchor-width)',
'--radix-tooltip-trigger-height': 'var(--radix-popper-anchor-height)'
}
}), /*#__PURE__*/$iVrL9$react.createElement($iVrL9$radixuireactslot.Slottable, null, children), /*#__PURE__*/$iVrL9$react.createElement($c34afbc43c90cc6f$var$VisuallyHiddenContentContextProvider, {
scope: __scopeTooltip,
isInside: true
}, /*#__PURE__*/$iVrL9$react.createElement($iVrL9$radixuireactvisuallyhidden.Root, {
id: context.contentId,
role: "tooltip"
}, ariaLabel || children))));
});
/*#__PURE__*/
Object.assign($c34afbc43c90cc6f$export$e9003e2be37ec060, {
displayName: $c34afbc43c90cc6f$var$CONTENT_NAME
});
/* -------------------------------------------------------------------------------------------------
* TooltipArrow
* -----------------------------------------------------------------------------------------------*/
const $c34afbc43c90cc6f$var$ARROW_NAME = 'TooltipArrow';
const $c34afbc43c90cc6f$export$c27ee0ad710f7559 = /*#__PURE__*/$iVrL9$react.forwardRef((props, forwardedRef) => {
const {
__scopeTooltip: __scopeTooltip,
...arrowProps
} = props;
const popperScope = $c34afbc43c90cc6f$var$usePopperScope(__scopeTooltip);
const visuallyHiddenContentContext = $c34afbc43c90cc6f$var$useVisuallyHiddenContentContext($c34afbc43c90cc6f$var$ARROW_NAME, __scopeTooltip); // if the arrow is inside the `VisuallyHidden`, we don't want to render it all to
// prevent issues in positioning the arrow due to the duplicate
return visuallyHiddenContentContext.isInside ? null : /*#__PURE__*/$iVrL9$react.createElement($iVrL9$radixuireactpopper.Arrow, $parcel$interopDefault($iVrL9$babelruntimehelpersextends)({}, popperScope, arrowProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/
Object.assign($c34afbc43c90cc6f$export$c27ee0ad710f7559, {
displayName: $c34afbc43c90cc6f$var$ARROW_NAME
});
/* -----------------------------------------------------------------------------------------------*/
function $c34afbc43c90cc6f$var$getExitSideFromRect(point, rect) {
const top = Math.abs(rect.top - point.y);
const bottom = Math.abs(rect.bottom - point.y);
const right = Math.abs(rect.right - point.x);
const left = Math.abs(rect.left - point.x);
switch (Math.min(top, bottom, right, left)) {
case left:
return 'left';
case right:
return 'right';
case top:
return 'top';
case bottom:
return 'bottom';
default:
throw new Error('unreachable');
}
}
function $c34afbc43c90cc6f$var$getPaddedExitPoints(exitPoint, exitSide) {
let padding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
const paddedExitPoints = [];
switch (exitSide) {
case 'top':
paddedExitPoints.push({
x: exitPoint.x - padding,
y: exitPoint.y + padding
}, {
x: exitPoint.x + padding,
y: exitPoint.y + padding
});
break;
case 'bottom':
paddedExitPoints.push({
x: exitPoint.x - padding,
y: exitPoint.y - padding
}, {
x: exitPoint.x + padding,
y: exitPoint.y - padding
});
break;
case 'left':
paddedExitPoints.push({
x: exitPoint.x + padding,
y: exitPoint.y - padding
}, {
x: exitPoint.x + padding,
y: exitPoint.y + padding
});
break;
case 'right':
paddedExitPoints.push({
x: exitPoint.x - padding,
y: exitPoint.y - padding
}, {
x: exitPoint.x - padding,
y: exitPoint.y + padding
});
break;
}
return paddedExitPoints;
}
function $c34afbc43c90cc6f$var$getPointsFromRect(rect) {
const {
top: top,
right: right,
bottom: bottom,
left: left
} = rect;
return [{
x: left,
y: top
}, {
x: right,
y: top
}, {
x: right,
y: bottom
}, {
x: left,
y: bottom
}];
} // Determine if a point is inside of a polygon.
// Based on https://github.com/substack/point-in-polygon
function $c34afbc43c90cc6f$var$isPointInPolygon(point, polygon) {
const {
x: x,
y: y
} = point;
let inside = false;
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
const xi = polygon[i].x;
const yi = polygon[i].y;
const xj = polygon[j].x;
const yj = polygon[j].y; // prettier-ignore
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
if (intersect) inside = !inside;
}
return inside;
} // Returns a new array of points representing the convex hull of the given set of points.
// https://www.nayuki.io/page/convex-hull-algorithm
function $c34afbc43c90cc6f$var$getHull(points) {
const newPoints = points.slice();
newPoints.sort((a, b) => {
if (a.x < b.x) return -1;else if (a.x > b.x) return 1;else if (a.y < b.y) return -1;else if (a.y > b.y) return 1;else return 0;
});
return $c34afbc43c90cc6f$var$getHullPresorted(newPoints);
} // Returns the convex hull, assuming that each points[i] <= points[i + 1]. Runs in O(n) time.
function $c34afbc43c90cc6f$var$getHullPresorted(points) {
if (points.length <= 1) return points.slice();
const upperHull = [];
for (let i = 0; i < points.length; i++) {
const p = points[i];
while (upperHull.length >= 2) {
const q = upperHull[upperHull.length - 1];
const r = upperHull[upperHull.length - 2];
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();else break;
}
upperHull.push(p);
}
upperHull.pop();
const lowerHull = [];
for (let i1 = points.length - 1; i1 >= 0; i1--) {
const p = points[i1];
while (lowerHull.length >= 2) {
const q = lowerHull[lowerHull.length - 1];
const r = lowerHull[lowerHull.length - 2];
if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();else break;
}
lowerHull.push(p);
}
lowerHull.pop();
if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) return upperHull;else return upperHull.concat(lowerHull);
}
const $c34afbc43c90cc6f$export$2881499e37b75b9a = $c34afbc43c90cc6f$export$f78649fb9ca566b8;
const $c34afbc43c90cc6f$export$be92b6f5f03c0fe9 = $c34afbc43c90cc6f$export$28c660c63b792dea;
const $c34afbc43c90cc6f$export$41fb9f06171c75f4 = $c34afbc43c90cc6f$export$8c610744efcf8a1d;
const $c34afbc43c90cc6f$export$602eac185826482c = $c34afbc43c90cc6f$export$7b36b8f925ab7497;
const $c34afbc43c90cc6f$export$7c6e2c02157bb7d2 = $c34afbc43c90cc6f$export$e9003e2be37ec060;
const $c34afbc43c90cc6f$export$21b07c8f274aebd5 = $c34afbc43c90cc6f$export$c27ee0ad710f7559;
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-use-callback-ref/dist/index.js":
/*!****************************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-use-callback-ref/dist/index.js ***!
\****************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $92muK$react = __webpack_require__(/*! react */ "react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "useCallbackRef", () => $28e03942f763e819$export$25bec8c6f54ee79a);
/**
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
* prop or avoid re-executing effects when passed as a dependency
*/
function $28e03942f763e819$export$25bec8c6f54ee79a(callback) {
const callbackRef = $92muK$react.useRef(callback);
$92muK$react.useEffect(() => {
callbackRef.current = callback;
}); // https://github.com/facebook/react/issues/19240
return $92muK$react.useMemo(() => function () {
var _callbackRef$current;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
}, []);
}
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.js":
/*!**********************************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.js ***!
\**********************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $ijazI$react = __webpack_require__(/*! react */ "react");
var $ijazI$radixuireactusecallbackref = __webpack_require__(/*! @radix-ui/react-use-callback-ref */ "../../../node_modules/@radix-ui/react-use-callback-ref/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "useControllableState", () => $b84d42d44371bff7$export$6f32135080cb4c3);
function $b84d42d44371bff7$export$6f32135080cb4c3(_ref) {
let {
prop: prop,
defaultProp: defaultProp,
onChange = () => {}
} = _ref;
const [uncontrolledProp, setUncontrolledProp] = $b84d42d44371bff7$var$useUncontrolledState({
defaultProp: defaultProp,
onChange: onChange
});
const isControlled = prop !== undefined;
const value1 = isControlled ? prop : uncontrolledProp;
const handleChange = $ijazI$radixuireactusecallbackref.useCallbackRef(onChange);
const setValue = $ijazI$react.useCallback(nextValue => {
if (isControlled) {
const setter = nextValue;
const value = typeof nextValue === 'function' ? setter(prop) : nextValue;
if (value !== prop) handleChange(value);
} else setUncontrolledProp(nextValue);
}, [isControlled, prop, setUncontrolledProp, handleChange]);
return [value1, setValue];
}
function $b84d42d44371bff7$var$useUncontrolledState(_ref2) {
let {
defaultProp: defaultProp,
onChange: onChange
} = _ref2;
const uncontrolledState = $ijazI$react.useState(defaultProp);
const [value] = uncontrolledState;
const prevValueRef = $ijazI$react.useRef(value);
const handleChange = $ijazI$radixuireactusecallbackref.useCallbackRef(onChange);
$ijazI$react.useEffect(() => {
if (prevValueRef.current !== value) {
handleChange(value);
prevValueRef.current = value;
}
}, [value, prevValueRef, handleChange]);
return uncontrolledState;
}
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-use-escape-keydown/dist/index.js":
/*!******************************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-use-escape-keydown/dist/index.js ***!
\******************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $b0gz3$react = __webpack_require__(/*! react */ "react");
var $b0gz3$radixuireactusecallbackref = __webpack_require__(/*! @radix-ui/react-use-callback-ref */ "../../../node_modules/@radix-ui/react-use-callback-ref/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "useEscapeKeydown", () => $24c84e9f83c4454f$export$3a72a57244d6e765);
/**
* Listens for when the escape key is down
*/
function $24c84e9f83c4454f$export$3a72a57244d6e765(onEscapeKeyDownProp) {
let ownerDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
const onEscapeKeyDown = $b0gz3$radixuireactusecallbackref.useCallbackRef(onEscapeKeyDownProp);
$b0gz3$react.useEffect(() => {
const handleKeyDown = event => {
if (event.key === 'Escape') onEscapeKeyDown(event);
};
ownerDocument.addEventListener('keydown', handleKeyDown);
return () => ownerDocument.removeEventListener('keydown', handleKeyDown);
}, [onEscapeKeyDown, ownerDocument]);
}
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-use-layout-effect/dist/index.js":
/*!*****************************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-use-layout-effect/dist/index.js ***!
\*****************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $caHyQ$react = __webpack_require__(/*! react */ "react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "useLayoutEffect", () => $ca21affb0542a8a4$export$e5c5a5f917a5871c);
/**
* On the server, React emits a warning when calling `useLayoutEffect`.
* This is because neither `useLayoutEffect` nor `useEffect` run on the server.
* We use this safe version which suppresses the warning by replacing it with a noop on the server.
*
* See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
*/
const $ca21affb0542a8a4$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? $caHyQ$react.useLayoutEffect : () => {};
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-use-size/dist/index.js":
/*!********************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-use-size/dist/index.js ***!
\********************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $ksDzM$react = __webpack_require__(/*! react */ "react");
var $ksDzM$radixuireactuselayouteffect = __webpack_require__(/*! @radix-ui/react-use-layout-effect */ "../../../node_modules/@radix-ui/react-use-layout-effect/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
$parcel$export(module.exports, "useSize", () => $d2c1d285af17635b$export$1ab7ae714698c4b8);
function $d2c1d285af17635b$export$1ab7ae714698c4b8(element) {
const [size, setSize] = $ksDzM$react.useState(undefined);
$ksDzM$radixuireactuselayouteffect.useLayoutEffect(() => {
if (element) {
// provide size as early as possible
setSize({
width: element.offsetWidth,
height: element.offsetHeight
});
const resizeObserver = new ResizeObserver(entries => {
if (!Array.isArray(entries)) return;
// Since we only observe the one element, we don't need to loop over the
// array
if (!entries.length) return;
const entry = entries[0];
let width;
let height;
if ('borderBoxSize' in entry) {
const borderSizeEntry = entry['borderBoxSize']; // iron out differences between browsers
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
width = borderSize['inlineSize'];
height = borderSize['blockSize'];
} else {
// for browsers that don't support `borderBoxSize`
// we calculate it ourselves to get the correct border box.
width = element.offsetWidth;
height = element.offsetHeight;
}
setSize({
width: width,
height: height
});
});
resizeObserver.observe(element, {
box: 'border-box'
});
return () => resizeObserver.unobserve(element);
} else
// We only want to reset to `undefined` when the element becomes `null`,
// not if it changes to another element.
setSize(undefined);
}, [element]);
return size;
}
/***/ }),
/***/ "../../../node_modules/@radix-ui/react-visually-hidden/dist/index.js":
/*!***************************************************************************!*\
!*** ../../../node_modules/@radix-ui/react-visually-hidden/dist/index.js ***!
\***************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var $awrN2$babelruntimehelpersextends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "../../../node_modules/@babel/runtime/helpers/extends.js");
var $awrN2$react = __webpack_require__(/*! react */ "react");
var $awrN2$radixuireactprimitive = __webpack_require__(/*! @radix-ui/react-primitive */ "../../../node_modules/@radix-ui/react-primitive/dist/index.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {
get: v,
set: s,
enumerable: true,
configurable: true
});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "VisuallyHidden", () => $685371e9c20848e2$export$439d29a4e110a164);
$parcel$export(module.exports, "Root", () => $685371e9c20848e2$export$be92b6f5f03c0fe9);
/* -------------------------------------------------------------------------------------------------
* VisuallyHidden
* -----------------------------------------------------------------------------------------------*/
const $685371e9c20848e2$var$NAME = 'VisuallyHidden';
const $685371e9c20848e2$export$439d29a4e110a164 = /*#__PURE__*/$awrN2$react.forwardRef((props, forwardedRef) => {
return /*#__PURE__*/$awrN2$react.createElement($awrN2$radixuireactprimitive.Primitive.span, $parcel$interopDefault($awrN2$babelruntimehelpersextends)({}, props, {
ref: forwardedRef,
style: {
// See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
position: 'absolute',
border: 0,
width: 1,
height: 1,
padding: 0,
margin: -1,
overflow: 'hidden',
clip: 'rect(0, 0, 0, 0)',
whiteSpace: 'nowrap',
wordWrap: 'normal',
...props.style
}
}));
});
/*#__PURE__*/
Object.assign($685371e9c20848e2$export$439d29a4e110a164, {
displayName: $685371e9c20848e2$var$NAME
});
/* -----------------------------------------------------------------------------------------------*/
const $685371e9c20848e2$export$be92b6f5f03c0fe9 = $685371e9c20848e2$export$439d29a4e110a164;
/***/ }),
/***/ "../../../node_modules/aria-hidden/dist/es2015/index.js":
/*!**************************************************************!*\
!*** ../../../node_modules/aria-hidden/dist/es2015/index.js ***!
\**************************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.suppressOthers = exports.supportsInert = exports.inertOthers = exports.hideOthers = void 0;
var getDefaultParent = function (originalTarget) {
if (typeof document === 'undefined') {
return null;
}
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
return sampleTarget.ownerDocument.body;
};
var counterMap = new WeakMap();
var uncontrolledNodes = new WeakMap();
var markerMap = {};
var lockCount = 0;
var unwrapHost = function (node) {
return node && (node.host || unwrapHost(node.parentNode));
};
var correctTargets = function (parent, targets) {
return targets.map(function (target) {
if (parent.contains(target)) {
return target;
}
var correctedTarget = unwrapHost(target);
if (correctedTarget && parent.contains(correctedTarget)) {
return correctedTarget;
}
console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing');
return null;
}).filter(function (x) {
return Boolean(x);
});
};
/**
* Marks everything except given node(or nodes) as aria-hidden
* @param {Element | Element[]} originalTarget - elements to keep on the page
* @param [parentNode] - top element, defaults to document.body
* @param {String} [markerName] - a special attribute to mark every node
* @param {String} [controlAttribute] - html Attribute to control
* @return {Undo} undo command
*/
var applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) {
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
if (!markerMap[markerName]) {
markerMap[markerName] = new WeakMap();
}
var markerCounter = markerMap[markerName];
var hiddenNodes = [];
var elementsToKeep = new Set();
var elementsToStop = new Set(targets);
var keep = function (el) {
if (!el || elementsToKeep.has(el)) {
return;
}
elementsToKeep.add(el);
keep(el.parentNode);
};
targets.forEach(keep);
var deep = function (parent) {
if (!parent || elementsToStop.has(parent)) {
return;
}
Array.prototype.forEach.call(parent.children, function (node) {
if (elementsToKeep.has(node)) {
deep(node);
} else {
var attr = node.getAttribute(controlAttribute);
var alreadyHidden = attr !== null && attr !== 'false';
var counterValue = (counterMap.get(node) || 0) + 1;
var markerValue = (markerCounter.get(node) || 0) + 1;
counterMap.set(node, counterValue);
markerCounter.set(node, markerValue);
hiddenNodes.push(node);
if (counterValue === 1 && alreadyHidden) {
uncontrolledNodes.set(node, true);
}
if (markerValue === 1) {
node.setAttribute(markerName, 'true');
}
if (!alreadyHidden) {
node.setAttribute(controlAttribute, 'true');
}
}
});
};
deep(parentNode);
elementsToKeep.clear();
lockCount++;
return function () {
hiddenNodes.forEach(function (node) {
var counterValue = counterMap.get(node) - 1;
var markerValue = markerCounter.get(node) - 1;
counterMap.set(node, counterValue);
markerCounter.set(node, markerValue);
if (!counterValue) {
if (!uncontrolledNodes.has(node)) {
node.removeAttribute(controlAttribute);
}
uncontrolledNodes.delete(node);
}
if (!markerValue) {
node.removeAttribute(markerName);
}
});
lockCount--;
if (!lockCount) {
// clear
counterMap = new WeakMap();
counterMap = new WeakMap();
uncontrolledNodes = new WeakMap();
markerMap = {};
}
};
};
/**
* Marks everything except given node(or nodes) as aria-hidden
* @param {Element | Element[]} originalTarget - elements to keep on the page
* @param [parentNode] - top element, defaults to document.body
* @param {String} [markerName] - a special attribute to mark every node
* @return {Undo} undo command
*/
var hideOthers = function (originalTarget, parentNode, markerName) {
if (markerName === void 0) {
markerName = 'data-aria-hidden';
}
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
var activeParentNode = parentNode || getDefaultParent(originalTarget);
if (!activeParentNode) {
return function () {
return null;
};
}
// we should not hide ariaLive elements - https://github.com/theKashey/aria-hidden/issues/10
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll('[aria-live]')));
return applyAttributeToOthers(targets, activeParentNode, markerName, 'aria-hidden');
};
/**
* Marks everything except given node(or nodes) as inert
* @param {Element | Element[]} originalTarget - elements to keep on the page
* @param [parentNode] - top element, defaults to document.body
* @param {String} [markerName] - a special attribute to mark every node
* @return {Undo} undo command
*/
exports.hideOthers = hideOthers;
var inertOthers = function (originalTarget, parentNode, markerName) {
if (markerName === void 0) {
markerName = 'data-inert-ed';
}
var activeParentNode = parentNode || getDefaultParent(originalTarget);
if (!activeParentNode) {
return function () {
return null;
};
}
return applyAttributeToOthers(originalTarget, activeParentNode, markerName, 'inert');
};
/**
* @returns if current browser supports inert
*/
exports.inertOthers = inertOthers;
var supportsInert = function () {
return typeof HTMLElement !== 'undefined' && HTMLElement.prototype.hasOwnProperty('inert');
};
/**
* Automatic function to "suppress" DOM elements - _hide_ or _inert_ in the best possible way
* @param {Element | Element[]} originalTarget - elements to keep on the page
* @param [parentNode] - top element, defaults to document.body
* @param {String} [markerName] - a special attribute to mark every node
* @return {Undo} undo command
*/
exports.supportsInert = supportsInert;
var suppressOthers = function (originalTarget, parentNode, markerName) {
if (markerName === void 0) {
markerName = 'data-suppressed';
}
return (supportsInert() ? inertOthers : hideOthers)(originalTarget, parentNode, markerName);
};
exports.suppressOthers = suppressOthers;
/***/ }),
/***/ "../../../node_modules/clsx/dist/clsx.m.js":
/*!*************************************************!*\
!*** ../../../node_modules/clsx/dist/clsx.m.js ***!
\*************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.clsx = clsx;
exports["default"] = void 0;
function r(e) {
var t,
f,
n = "";
if ("string" == typeof e || "number" == typeof e) n += e;else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);else for (t in e) e[t] && (n && (n += " "), n += t);
return n;
}
function clsx() {
for (var e, t, f = 0, n = ""; f < arguments.length;) (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
return n;
}
var _default = clsx;
exports["default"] = _default;
/***/ }),
/***/ "../../../node_modules/copy-to-clipboard/index.js":
/*!********************************************************!*\
!*** ../../../node_modules/copy-to-clipboard/index.js ***!
\********************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var deselectCurrent = __webpack_require__(/*! toggle-selection */ "../../../node_modules/toggle-selection/index.js");
var clipboardToIE11Formatting = {
"text/plain": "Text",
"text/html": "Url",
"default": "Text"
};
var defaultMessage = "Copy to clipboard: #{key}, Enter";
function format(message) {
var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
return message.replace(/#{\s*key\s*}/g, copyKey);
}
function copy(text, options) {
var debug,
message,
reselectPrevious,
range,
selection,
mark,
success = false;
if (!options) {
options = {};
}
debug = options.debug || false;
try {
reselectPrevious = deselectCurrent();
range = document.createRange();
selection = document.getSelection();
mark = document.createElement("span");
mark.textContent = text;
// avoid screen readers from reading out loud the text
mark.ariaHidden = "true";
// reset user styles for span element
mark.style.all = "unset";
// prevents scrolling to the end of the page
mark.style.position = "fixed";
mark.style.top = 0;
mark.style.clip = "rect(0, 0, 0, 0)";
// used to preserve spaces and line breaks
mark.style.whiteSpace = "pre";
// do not inherit user-select (it may be `none`)
mark.style.webkitUserSelect = "text";
mark.style.MozUserSelect = "text";
mark.style.msUserSelect = "text";
mark.style.userSelect = "text";
mark.addEventListener("copy", function (e) {
e.stopPropagation();
if (options.format) {
e.preventDefault();
if (typeof e.clipboardData === "undefined") {
// IE 11
debug && console.warn("unable to use e.clipboardData");
debug && console.warn("trying IE specific stuff");
window.clipboardData.clearData();
var format = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"];
window.clipboardData.setData(format, text);
} else {
// all other browsers
e.clipboardData.clearData();
e.clipboardData.setData(options.format, text);
}
}
if (options.onCopy) {
e.preventDefault();
options.onCopy(e.clipboardData);
}
});
document.body.appendChild(mark);
range.selectNodeContents(mark);
selection.addRange(range);
var successful = document.execCommand("copy");
if (!successful) {
throw new Error("copy command was unsuccessful");
}
success = true;
} catch (err) {
debug && console.error("unable to copy using execCommand: ", err);
debug && console.warn("trying IE specific stuff");
try {
window.clipboardData.setData(options.format || "text", text);
options.onCopy && options.onCopy(window.clipboardData);
success = true;
} catch (err) {
debug && console.error("unable to copy using clipboardData: ", err);
debug && console.error("falling back to prompt");
message = format("message" in options ? options.message : defaultMessage);
window.prompt(message, text);
}
} finally {
if (selection) {
if (typeof selection.removeRange == "function") {
selection.removeRange(range);
} else {
selection.removeAllRanges();
}
}
if (mark) {
document.body.removeChild(mark);
}
reselectPrevious();
}
return success;
}
module.exports = copy;
/***/ }),
/***/ "../../../node_modules/detect-node-es/esm/browser.js":
/*!***********************************************************!*\
!*** ../../../node_modules/detect-node-es/esm/browser.js ***!
\***********************************************************/
/***/ (function(__unused_webpack_module, exports) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isNode = void 0;
const isNode = false;
exports.isNode = isNode;
/***/ }),
/***/ "../../../node_modules/framer-motion/dist/cjs/index.js":
/*!*************************************************************!*\
!*** ../../../node_modules/framer-motion/dist/cjs/index.js ***!
\*************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
var tslib = __webpack_require__(/*! tslib */ "../../../node_modules/tslib/tslib.es6.js");
var React = __webpack_require__(/*! react */ "react");
var heyListen = __webpack_require__(/*! hey-listen */ "../../../node_modules/hey-listen/dist/hey-listen.es.js");
var styleValueTypes = __webpack_require__(/*! style-value-types */ "../../../node_modules/style-value-types/dist/valueTypes.cjs.js");
var popmotion = __webpack_require__(/*! popmotion */ "../../../node_modules/popmotion/dist/popmotion.cjs.js");
var sync = __webpack_require__(/*! framesync */ "../../../node_modules/framesync/dist/framesync.cjs.js");
var dom = __webpack_require__(/*! @motionone/dom */ "../../../node_modules/@motionone/dom/dist/index.es.js");
function _interopDefaultLegacy(e) {
return e && typeof e === 'object' && 'default' in e ? e : {
'default': e
};
}
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () {
return e[k];
}
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespace(React);
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var sync__default = /*#__PURE__*/_interopDefaultLegacy(sync);
/**
* Browser-safe usage of process
*/
var defaultEnvironment = "production";
var env = typeof process === "undefined" || process.env === undefined ? defaultEnvironment : "development" || 0;
var createDefinition = function (propNames) {
return {
isEnabled: function (props) {
return propNames.some(function (name) {
return !!props[name];
});
}
};
};
var featureDefinitions = {
measureLayout: createDefinition(["layout", "layoutId", "drag"]),
animation: createDefinition(["animate", "exit", "variants", "whileHover", "whileTap", "whileFocus", "whileDrag", "whileInView"]),
exit: createDefinition(["exit"]),
drag: createDefinition(["drag", "dragControls"]),
focus: createDefinition(["whileFocus"]),
hover: createDefinition(["whileHover", "onHoverStart", "onHoverEnd"]),
tap: createDefinition(["whileTap", "onTap", "onTapStart", "onTapCancel"]),
pan: createDefinition(["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"]),
inView: createDefinition(["whileInView", "onViewportEnter", "onViewportLeave"])
};
function loadFeatures(features) {
for (var key in features) {
if (features[key] === null) continue;
if (key === "projectionNodeConstructor") {
featureDefinitions.projectionNodeConstructor = features[key];
} else {
featureDefinitions[key].Component = features[key];
}
}
}
var LazyContext = React.createContext({
strict: false
});
var featureNames = Object.keys(featureDefinitions);
var numFeatures = featureNames.length;
/**
* Load features via renderless components based on the provided MotionProps.
*/
function useFeatures(props, visualElement, preloadedFeatures) {
var features = [];
var lazyContext = React.useContext(LazyContext);
if (!visualElement) return null;
/**
* If we're in development mode, check to make sure we're not rendering a motion component
* as a child of LazyMotion, as this will break the file-size benefits of using it.
*/
if (env !== "production" && preloadedFeatures && lazyContext.strict) {
heyListen.invariant(false, "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.");
}
for (var i = 0; i < numFeatures; i++) {
var name_1 = featureNames[i];
var _a = featureDefinitions[name_1],
isEnabled = _a.isEnabled,
Component = _a.Component;
/**
* It might be possible in the future to use this moment to
* dynamically request functionality. In initial tests this
* was producing a lot of duplication amongst bundles.
*/
if (isEnabled(props) && Component) {
features.push(React__namespace.createElement(Component, tslib.__assign({
key: name_1
}, props, {
visualElement: visualElement
})));
}
}
return features;
}
/**
* @public
*/
var MotionConfigContext = React.createContext({
transformPagePoint: function (p) {
return p;
},
isStatic: false,
reducedMotion: "never"
});
var MotionContext = React.createContext({});
function useVisualElementContext() {
return React.useContext(MotionContext).visualElement;
}
/**
* @public
*/
var PresenceContext = React.createContext(null);
var isBrowser = typeof document !== "undefined";
var useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
// Does this device prefer reduced motion? Returns `null` server-side.
var prefersReducedMotion = {
current: null
};
var hasDetected = false;
function initPrefersReducedMotion() {
hasDetected = true;
if (!isBrowser) return;
if (window.matchMedia) {
var motionMediaQuery_1 = window.matchMedia("(prefers-reduced-motion)");
var setReducedMotionPreferences = function () {
return prefersReducedMotion.current = motionMediaQuery_1.matches;
};
motionMediaQuery_1.addListener(setReducedMotionPreferences);
setReducedMotionPreferences();
} else {
prefersReducedMotion.current = false;
}
}
/**
* A hook that returns `true` if we should be using reduced motion based on the current device's Reduced Motion setting.
*
* This can be used to implement changes to your UI based on Reduced Motion. For instance, replacing motion-sickness inducing
* `x`/`y` animations with `opacity`, disabling the autoplay of background videos, or turning off parallax motion.
*
* It will actively respond to changes and re-render your components with the latest setting.
*
* ```jsx
* export function Sidebar({ isOpen }) {
* const shouldReduceMotion = useReducedMotion()
* const closedX = shouldReduceMotion ? 0 : "-100%"
*
* return (
*
* )
* }
* ```
*
* @return boolean
*
* @public
*/
function useReducedMotion() {
/**
* Lazy initialisation of prefersReducedMotion
*/
!hasDetected && initPrefersReducedMotion();
var _a = tslib.__read(React.useState(prefersReducedMotion.current), 1),
shouldReduceMotion = _a[0];
/**
* TODO See if people miss automatically updating shouldReduceMotion setting
*/
return shouldReduceMotion;
}
function useReducedMotionConfig() {
var reducedMotionPreference = useReducedMotion();
var reducedMotion = React.useContext(MotionConfigContext).reducedMotion;
if (reducedMotion === "never") {
return false;
} else if (reducedMotion === "always") {
return true;
} else {
return reducedMotionPreference;
}
}
function useVisualElement(Component, visualState, props, createVisualElement) {
var lazyContext = React.useContext(LazyContext);
var parent = useVisualElementContext();
var presenceContext = React.useContext(PresenceContext);
var shouldReduceMotion = useReducedMotionConfig();
var visualElementRef = React.useRef(undefined);
/**
* If we haven't preloaded a renderer, check to see if we have one lazy-loaded
*/
if (!createVisualElement) createVisualElement = lazyContext.renderer;
if (!visualElementRef.current && createVisualElement) {
visualElementRef.current = createVisualElement(Component, {
visualState: visualState,
parent: parent,
props: props,
presenceId: presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.id,
blockInitialAnimation: (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false,
shouldReduceMotion: shouldReduceMotion
});
}
var visualElement = visualElementRef.current;
useIsomorphicLayoutEffect(function () {
visualElement === null || visualElement === void 0 ? void 0 : visualElement.syncRender();
});
React.useEffect(function () {
var _a;
(_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.animationState) === null || _a === void 0 ? void 0 : _a.animateChanges();
});
useIsomorphicLayoutEffect(function () {
return function () {
return visualElement === null || visualElement === void 0 ? void 0 : visualElement.notifyUnmount();
};
}, []);
return visualElement;
}
function isRefObject(ref) {
return typeof ref === "object" && Object.prototype.hasOwnProperty.call(ref, "current");
}
/**
* Creates a ref function that, when called, hydrates the provided
* external ref and VisualElement.
*/
function useMotionRef(visualState, visualElement, externalRef) {
return React.useCallback(function (instance) {
var _a;
instance && ((_a = visualState.mount) === null || _a === void 0 ? void 0 : _a.call(visualState, instance));
if (visualElement) {
instance ? visualElement.mount(instance) : visualElement.unmount();
}
if (externalRef) {
if (typeof externalRef === "function") {
externalRef(instance);
} else if (isRefObject(externalRef)) {
externalRef.current = instance;
}
}
},
/**
* Only pass a new ref callback to React if we've received a visual element
* factory. Otherwise we'll be mounting/remounting every time externalRef
* or other dependencies change.
*/
[visualElement]);
}
/**
* Decides if the supplied variable is an array of variant labels
*/
function isVariantLabels(v) {
return Array.isArray(v);
}
/**
* Decides if the supplied variable is variant label
*/
function isVariantLabel(v) {
return typeof v === "string" || isVariantLabels(v);
}
/**
* Creates an object containing the latest state of every MotionValue on a VisualElement
*/
function getCurrent(visualElement) {
var current = {};
visualElement.forEachValue(function (value, key) {
return current[key] = value.get();
});
return current;
}
/**
* Creates an object containing the latest velocity of every MotionValue on a VisualElement
*/
function getVelocity$1(visualElement) {
var velocity = {};
visualElement.forEachValue(function (value, key) {
return velocity[key] = value.getVelocity();
});
return velocity;
}
function resolveVariantFromProps(props, definition, custom, currentValues, currentVelocity) {
var _a;
if (currentValues === void 0) {
currentValues = {};
}
if (currentVelocity === void 0) {
currentVelocity = {};
}
/**
* If the variant definition is a function, resolve.
*/
if (typeof definition === "function") {
definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
}
/**
* If the variant definition is a variant label, or
* the function returned a variant label, resolve.
*/
if (typeof definition === "string") {
definition = (_a = props.variants) === null || _a === void 0 ? void 0 : _a[definition];
}
/**
* At this point we've resolved both functions and variant labels,
* but the resolved variant label might itself have been a function.
* If so, resolve. This can only have returned a valid target object.
*/
if (typeof definition === "function") {
definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
}
return definition;
}
function resolveVariant(visualElement, definition, custom) {
var props = visualElement.getProps();
return resolveVariantFromProps(props, definition, custom !== null && custom !== void 0 ? custom : props.custom, getCurrent(visualElement), getVelocity$1(visualElement));
}
function checkIfControllingVariants(props) {
var _a;
return typeof ((_a = props.animate) === null || _a === void 0 ? void 0 : _a.start) === "function" || isVariantLabel(props.initial) || isVariantLabel(props.animate) || isVariantLabel(props.whileHover) || isVariantLabel(props.whileDrag) || isVariantLabel(props.whileTap) || isVariantLabel(props.whileFocus) || isVariantLabel(props.exit);
}
function checkIfVariantNode(props) {
return Boolean(checkIfControllingVariants(props) || props.variants);
}
function getCurrentTreeVariants(props, context) {
if (checkIfControllingVariants(props)) {
var initial = props.initial,
animate = props.animate;
return {
initial: initial === false || isVariantLabel(initial) ? initial : undefined,
animate: isVariantLabel(animate) ? animate : undefined
};
}
return props.inherit !== false ? context : {};
}
function useCreateMotionContext(props) {
var _a = getCurrentTreeVariants(props, React.useContext(MotionContext)),
initial = _a.initial,
animate = _a.animate;
return React.useMemo(function () {
return {
initial: initial,
animate: animate
};
}, [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
}
function variantLabelsAsDependency(prop) {
return Array.isArray(prop) ? prop.join(" ") : prop;
}
/**
* Creates a constant value over the lifecycle of a component.
*
* Even if `useMemo` is provided an empty array as its final argument, it doesn't offer
* a guarantee that it won't re-run for performance reasons later on. By using `useConstant`
* you can ensure that initialisers don't execute twice or more.
*/
function useConstant(init) {
var ref = React.useRef(null);
if (ref.current === null) {
ref.current = init();
}
return ref.current;
}
/**
* This should only ever be modified on the client otherwise it'll
* persist through server requests. If we need instanced states we
* could lazy-init via root.
*/
var globalProjectionState = {
/**
* Global flag as to whether the tree has animated since the last time
* we resized the window
*/
hasAnimatedSinceResize: true,
/**
* We set this to true once, on the first update. Any nodes added to the tree beyond that
* update will be given a `data-projection-id` attribute.
*/
hasEverUpdated: false
};
var id$1 = 1;
function useProjectionId() {
return useConstant(function () {
if (globalProjectionState.hasEverUpdated) {
return id$1++;
}
});
}
var LayoutGroupContext = React.createContext({});
/**
* Internal, exported only for usage in Framer
*/
var SwitchLayoutGroupContext = React.createContext({});
function useProjection(projectionId, _a, visualElement, ProjectionNodeConstructor) {
var _b;
var layoutId = _a.layoutId,
layout = _a.layout,
drag = _a.drag,
dragConstraints = _a.dragConstraints,
layoutScroll = _a.layoutScroll;
var initialPromotionConfig = React.useContext(SwitchLayoutGroupContext);
if (!ProjectionNodeConstructor || !visualElement || (visualElement === null || visualElement === void 0 ? void 0 : visualElement.projection)) {
return;
}
visualElement.projection = new ProjectionNodeConstructor(projectionId, visualElement.getLatestValues(), (_b = visualElement.parent) === null || _b === void 0 ? void 0 : _b.projection);
visualElement.projection.setOptions({
layoutId: layoutId,
layout: layout,
alwaysMeasureLayout: Boolean(drag) || dragConstraints && isRefObject(dragConstraints),
visualElement: visualElement,
scheduleRender: function () {
return visualElement.scheduleRender();
},
/**
* TODO: Update options in an effect. This could be tricky as it'll be too late
* to update by the time layout animations run.
* We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
* ensuring it gets called if there's no potential layout animations.
*
*/
animationType: typeof layout === "string" ? layout : "both",
initialPromotionConfig: initialPromotionConfig,
layoutScroll: layoutScroll
});
}
var VisualElementHandler = /** @class */function (_super) {
tslib.__extends(VisualElementHandler, _super);
function VisualElementHandler() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Update visual element props as soon as we know this update is going to be commited.
*/
VisualElementHandler.prototype.getSnapshotBeforeUpdate = function () {
this.updateProps();
return null;
};
VisualElementHandler.prototype.componentDidUpdate = function () {};
VisualElementHandler.prototype.updateProps = function () {
var _a = this.props,
visualElement = _a.visualElement,
props = _a.props;
if (visualElement) visualElement.setProps(props);
};
VisualElementHandler.prototype.render = function () {
return this.props.children;
};
return VisualElementHandler;
}(React__default["default"].Component);
/**
* Create a `motion` component.
*
* This function accepts a Component argument, which can be either a string (ie "div"
* for `motion.div`), or an actual React component.
*
* Alongside this is a config option which provides a way of rendering the provided
* component "offline", or outside the React render cycle.
*/
function createMotionComponent(_a) {
var preloadedFeatures = _a.preloadedFeatures,
createVisualElement = _a.createVisualElement,
projectionNodeConstructor = _a.projectionNodeConstructor,
useRender = _a.useRender,
useVisualState = _a.useVisualState,
Component = _a.Component;
preloadedFeatures && loadFeatures(preloadedFeatures);
function MotionComponent(props, externalRef) {
var layoutId = useLayoutId(props);
props = tslib.__assign(tslib.__assign({}, props), {
layoutId: layoutId
});
/**
* If we're rendering in a static environment, we only visually update the component
* as a result of a React-rerender rather than interactions or animations. This
* means we don't need to load additional memory structures like VisualElement,
* or any gesture/animation features.
*/
var config = React.useContext(MotionConfigContext);
var features = null;
var context = useCreateMotionContext(props);
/**
* Create a unique projection ID for this component. If a new component is added
* during a layout animation we'll use this to query the DOM and hydrate its ref early, allowing
* us to measure it as soon as any layout effect flushes pending layout animations.
*
* Performance note: It'd be better not to have to search the DOM for these elements.
* For newly-entering components it could be enough to only correct treeScale, in which
* case we could mount in a scale-correction mode. This wouldn't be enough for
* shared element transitions however. Perhaps for those we could revert to a root node
* that gets forceRendered and layout animations are triggered on its layout effect.
*/
var projectionId = config.isStatic ? undefined : useProjectionId();
/**
*
*/
var visualState = useVisualState(props, config.isStatic);
if (!config.isStatic && isBrowser) {
/**
* Create a VisualElement for this component. A VisualElement provides a common
* interface to renderer-specific APIs (ie DOM/Three.js etc) as well as
* providing a way of rendering to these APIs outside of the React render loop
* for more performant animations and interactions
*/
context.visualElement = useVisualElement(Component, visualState, tslib.__assign(tslib.__assign({}, config), props), createVisualElement);
useProjection(projectionId, props, context.visualElement, projectionNodeConstructor || featureDefinitions.projectionNodeConstructor);
/**
* Load Motion gesture and animation features. These are rendered as renderless
* components so each feature can optionally make use of React lifecycle methods.
*/
features = useFeatures(props, context.visualElement, preloadedFeatures);
}
/**
* The mount order and hierarchy is specific to ensure our element ref
* is hydrated by the time features fire their effects.
*/
return React__namespace.createElement(VisualElementHandler, {
visualElement: context.visualElement,
props: tslib.__assign(tslib.__assign({}, config), props)
}, features, React__namespace.createElement(MotionContext.Provider, {
value: context
}, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, config.isStatic, context.visualElement)));
}
return React.forwardRef(MotionComponent);
}
function useLayoutId(_a) {
var _b;
var layoutId = _a.layoutId;
var layoutGroupId = (_b = React.useContext(LayoutGroupContext)) === null || _b === void 0 ? void 0 : _b.id;
return layoutGroupId && layoutId !== undefined ? layoutGroupId + "-" + layoutId : layoutId;
}
/**
* Convert any React component into a `motion` component. The provided component
* **must** use `React.forwardRef` to the underlying DOM component you want to animate.
*
* ```jsx
* const Component = React.forwardRef((props, ref) => {
* return
* })
*
* const MotionComponent = motion(Component)
* ```
*
* @public
*/
function createMotionProxy(createConfig) {
function custom(Component, customMotionComponentConfig) {
if (customMotionComponentConfig === void 0) {
customMotionComponentConfig = {};
}
return createMotionComponent(createConfig(Component, customMotionComponentConfig));
}
if (typeof Proxy === "undefined") {
return custom;
}
/**
* A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.
* Rather than generating them anew every render.
*/
var componentCache = new Map();
return new Proxy(custom, {
/**
* Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
* The prop name is passed through as `key` and we can use that to generate a `motion`
* DOM component with that name.
*/
get: function (_target, key) {
/**
* If this element doesn't exist in the component cache, create it and cache.
*/
if (!componentCache.has(key)) {
componentCache.set(key, custom(key));
}
return componentCache.get(key);
}
});
}
/**
* We keep these listed seperately as we use the lowercase tag names as part
* of the runtime bundle to detect SVG components
*/
var lowercaseSVGElements = ["animate", "circle", "defs", "desc", "ellipse", "g", "image", "line", "filter", "marker", "mask", "metadata", "path", "pattern", "polygon", "polyline", "rect", "stop", "svg", "switch", "symbol", "text", "tspan", "use", "view"];
function isSVGComponent(Component) {
if (
/**
* If it's not a string, it's a custom React component. Currently we only support
* HTML custom React components.
*/
typeof Component !== "string" ||
/**
* If it contains a dash, the element is a custom HTML webcomponent.
*/
Component.includes("-")) {
return false;
} else if (
/**
* If it's in our list of lowercase SVG tags, it's an SVG component
*/
lowercaseSVGElements.indexOf(Component) > -1 ||
/**
* If it contains a capital letter, it's an SVG component
*/
/[A-Z]/.test(Component)) {
return true;
}
return false;
}
var scaleCorrectors = {};
function addScaleCorrector(correctors) {
Object.assign(scaleCorrectors, correctors);
}
/**
* A list of all transformable axes. We'll use this list to generated a version
* of each axes for each transform.
*/
var transformAxes = ["", "X", "Y", "Z"];
/**
* An ordered array of each transformable value. By default, transform values
* will be sorted to this order.
*/
var order = ["translate", "scale", "rotate", "skew"];
/**
* Generate a list of every possible transform key.
*/
var transformProps = ["transformPerspective", "x", "y", "z"];
order.forEach(function (operationKey) {
return transformAxes.forEach(function (axesKey) {
return transformProps.push(operationKey + axesKey);
});
});
/**
* A function to use with Array.sort to sort transform keys by their default order.
*/
function sortTransformProps(a, b) {
return transformProps.indexOf(a) - transformProps.indexOf(b);
}
/**
* A quick lookup for transform props.
*/
var transformPropSet = new Set(transformProps);
function isTransformProp(key) {
return transformPropSet.has(key);
}
/**
* A quick lookup for transform origin props
*/
var transformOriginProps = new Set(["originX", "originY", "originZ"]);
function isTransformOriginProp(key) {
return transformOriginProps.has(key);
}
function isForcedMotionValue(key, _a) {
var layout = _a.layout,
layoutId = _a.layoutId;
return isTransformProp(key) || isTransformOriginProp(key) || (layout || layoutId !== undefined) && (!!scaleCorrectors[key] || key === "opacity");
}
var isMotionValue = function (value) {
return Boolean(value !== null && typeof value === "object" && value.getVelocity);
};
var translateAlias = {
x: "translateX",
y: "translateY",
z: "translateZ",
transformPerspective: "perspective"
};
/**
* Build a CSS transform style from individual x/y/scale etc properties.
*
* This outputs with a default order of transforms/scales/rotations, this can be customised by
* providing a transformTemplate function.
*/
function buildTransform(_a, _b, transformIsDefault, transformTemplate) {
var transform = _a.transform,
transformKeys = _a.transformKeys;
var _c = _b.enableHardwareAcceleration,
enableHardwareAcceleration = _c === void 0 ? true : _c,
_d = _b.allowTransformNone,
allowTransformNone = _d === void 0 ? true : _d;
// The transform string we're going to build into.
var transformString = "";
// Transform keys into their default order - this will determine the output order.
transformKeys.sort(sortTransformProps);
// Track whether the defined transform has a defined z so we don't add a
// second to enable hardware acceleration
var transformHasZ = false;
// Loop over each transform and build them into transformString
var numTransformKeys = transformKeys.length;
for (var i = 0; i < numTransformKeys; i++) {
var key = transformKeys[i];
transformString += "".concat(translateAlias[key] || key, "(").concat(transform[key], ") ");
if (key === "z") transformHasZ = true;
}
if (!transformHasZ && enableHardwareAcceleration) {
transformString += "translateZ(0)";
} else {
transformString = transformString.trim();
}
// If we have a custom `transform` template, pass our transform values and
// generated transformString to that before returning
if (transformTemplate) {
transformString = transformTemplate(transform, transformIsDefault ? "" : transformString);
} else if (allowTransformNone && transformIsDefault) {
transformString = "none";
}
return transformString;
}
/**
* Build a transformOrigin style. Uses the same defaults as the browser for
* undefined origins.
*/
function buildTransformOrigin(_a) {
var _b = _a.originX,
originX = _b === void 0 ? "50%" : _b,
_c = _a.originY,
originY = _c === void 0 ? "50%" : _c,
_d = _a.originZ,
originZ = _d === void 0 ? 0 : _d;
return "".concat(originX, " ").concat(originY, " ").concat(originZ);
}
/**
* Returns true if the provided key is a CSS variable
*/
function isCSSVariable$1(key) {
return key.startsWith("--");
}
/**
* Provided a value and a ValueType, returns the value as that value type.
*/
var getValueAsType = function (value, type) {
return type && typeof value === "number" ? type.transform(value) : value;
};
var int = tslib.__assign(tslib.__assign({}, styleValueTypes.number), {
transform: Math.round
});
var numberValueTypes = {
// Border props
borderWidth: styleValueTypes.px,
borderTopWidth: styleValueTypes.px,
borderRightWidth: styleValueTypes.px,
borderBottomWidth: styleValueTypes.px,
borderLeftWidth: styleValueTypes.px,
borderRadius: styleValueTypes.px,
radius: styleValueTypes.px,
borderTopLeftRadius: styleValueTypes.px,
borderTopRightRadius: styleValueTypes.px,
borderBottomRightRadius: styleValueTypes.px,
borderBottomLeftRadius: styleValueTypes.px,
// Positioning props
width: styleValueTypes.px,
maxWidth: styleValueTypes.px,
height: styleValueTypes.px,
maxHeight: styleValueTypes.px,
size: styleValueTypes.px,
top: styleValueTypes.px,
right: styleValueTypes.px,
bottom: styleValueTypes.px,
left: styleValueTypes.px,
// Spacing props
padding: styleValueTypes.px,
paddingTop: styleValueTypes.px,
paddingRight: styleValueTypes.px,
paddingBottom: styleValueTypes.px,
paddingLeft: styleValueTypes.px,
margin: styleValueTypes.px,
marginTop: styleValueTypes.px,
marginRight: styleValueTypes.px,
marginBottom: styleValueTypes.px,
marginLeft: styleValueTypes.px,
// Transform props
rotate: styleValueTypes.degrees,
rotateX: styleValueTypes.degrees,
rotateY: styleValueTypes.degrees,
rotateZ: styleValueTypes.degrees,
scale: styleValueTypes.scale,
scaleX: styleValueTypes.scale,
scaleY: styleValueTypes.scale,
scaleZ: styleValueTypes.scale,
skew: styleValueTypes.degrees,
skewX: styleValueTypes.degrees,
skewY: styleValueTypes.degrees,
distance: styleValueTypes.px,
translateX: styleValueTypes.px,
translateY: styleValueTypes.px,
translateZ: styleValueTypes.px,
x: styleValueTypes.px,
y: styleValueTypes.px,
z: styleValueTypes.px,
perspective: styleValueTypes.px,
transformPerspective: styleValueTypes.px,
opacity: styleValueTypes.alpha,
originX: styleValueTypes.progressPercentage,
originY: styleValueTypes.progressPercentage,
originZ: styleValueTypes.px,
// Misc
zIndex: int,
// SVG
fillOpacity: styleValueTypes.alpha,
strokeOpacity: styleValueTypes.alpha,
numOctaves: int
};
function buildHTMLStyles(state, latestValues, options, transformTemplate) {
var _a;
var style = state.style,
vars = state.vars,
transform = state.transform,
transformKeys = state.transformKeys,
transformOrigin = state.transformOrigin;
// Empty the transformKeys array. As we're throwing out refs to its items
// this might not be as cheap as suspected. Maybe using the array as a buffer
// with a manual incrementation would be better.
transformKeys.length = 0;
// Track whether we encounter any transform or transformOrigin values.
var hasTransform = false;
var hasTransformOrigin = false;
// Does the calculated transform essentially equal "none"?
var transformIsNone = true;
/**
* Loop over all our latest animated values and decide whether to handle them
* as a style or CSS variable.
*
* Transforms and transform origins are kept seperately for further processing.
*/
for (var key in latestValues) {
var value = latestValues[key];
/**
* If this is a CSS variable we don't do any further processing.
*/
if (isCSSVariable$1(key)) {
vars[key] = value;
continue;
}
// Convert the value to its default value type, ie 0 -> "0px"
var valueType = numberValueTypes[key];
var valueAsType = getValueAsType(value, valueType);
if (isTransformProp(key)) {
// If this is a transform, flag to enable further transform processing
hasTransform = true;
transform[key] = valueAsType;
transformKeys.push(key);
// If we already know we have a non-default transform, early return
if (!transformIsNone) continue;
// Otherwise check to see if this is a default transform
if (value !== ((_a = valueType.default) !== null && _a !== void 0 ? _a : 0)) transformIsNone = false;
} else if (isTransformOriginProp(key)) {
transformOrigin[key] = valueAsType;
// If this is a transform origin, flag and enable further transform-origin processing
hasTransformOrigin = true;
} else {
style[key] = valueAsType;
}
}
if (hasTransform) {
style.transform = buildTransform(state, options, transformIsNone, transformTemplate);
} else if (transformTemplate) {
style.transform = transformTemplate({}, "");
} else if (!latestValues.transform && style.transform) {
style.transform = "none";
}
if (hasTransformOrigin) {
style.transformOrigin = buildTransformOrigin(transformOrigin);
}
}
var createHtmlRenderState = function () {
return {
style: {},
transform: {},
transformKeys: [],
transformOrigin: {},
vars: {}
};
};
function copyRawValuesOnly(target, source, props) {
for (var key in source) {
if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
target[key] = source[key];
}
}
}
function useInitialMotionValues(_a, visualState, isStatic) {
var transformTemplate = _a.transformTemplate;
return React.useMemo(function () {
var state = createHtmlRenderState();
buildHTMLStyles(state, visualState, {
enableHardwareAcceleration: !isStatic
}, transformTemplate);
var vars = state.vars,
style = state.style;
return tslib.__assign(tslib.__assign({}, vars), style);
}, [visualState]);
}
function useStyle(props, visualState, isStatic) {
var styleProp = props.style || {};
var style = {};
/**
* Copy non-Motion Values straight into style
*/
copyRawValuesOnly(style, styleProp, props);
Object.assign(style, useInitialMotionValues(props, visualState, isStatic));
if (props.transformValues) {
style = props.transformValues(style);
}
return style;
}
function useHTMLProps(props, visualState, isStatic) {
// The `any` isn't ideal but it is the type of createElement props argument
var htmlProps = {};
var style = useStyle(props, visualState, isStatic);
if (Boolean(props.drag) && props.dragListener !== false) {
// Disable the ghost element when a user drags
htmlProps.draggable = false;
// Disable text selection
style.userSelect = style.WebkitUserSelect = style.WebkitTouchCallout = "none";
// Disable scrolling on the draggable direction
style.touchAction = props.drag === true ? "none" : "pan-".concat(props.drag === "x" ? "y" : "x");
}
htmlProps.style = style;
return htmlProps;
}
/**
* A list of all valid MotionProps.
*
* @privateRemarks
* This doesn't throw if a `MotionProp` name is missing - it should.
*/
var validMotionProps = new Set(["initial", "animate", "exit", "style", "variants", "transition", "transformTemplate", "transformValues", "custom", "inherit", "layout", "layoutId", "layoutDependency", "onLayoutAnimationStart", "onLayoutAnimationComplete", "onLayoutMeasure", "onBeforeLayoutMeasure", "onAnimationStart", "onAnimationComplete", "onUpdate", "onDragStart", "onDrag", "onDragEnd", "onMeasureDragConstraints", "onDirectionLock", "onDragTransitionEnd", "drag", "dragControls", "dragListener", "dragConstraints", "dragDirectionLock", "dragSnapToOrigin", "_dragX", "_dragY", "dragElastic", "dragMomentum", "dragPropagation", "dragTransition", "whileDrag", "onPan", "onPanStart", "onPanEnd", "onPanSessionStart", "onTap", "onTapStart", "onTapCancel", "onHoverStart", "onHoverEnd", "whileFocus", "whileTap", "whileHover", "whileInView", "onViewportEnter", "onViewportLeave", "viewport", "layoutScroll"]);
/**
* Check whether a prop name is a valid `MotionProp` key.
*
* @param key - Name of the property to check
* @returns `true` is key is a valid `MotionProp`.
*
* @public
*/
function isValidMotionProp(key) {
return validMotionProps.has(key);
}
var shouldForward = function (key) {
return !isValidMotionProp(key);
};
function loadExternalIsValidProp(isValidProp) {
if (!isValidProp) return;
// Explicitly filter our events
shouldForward = function (key) {
return key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
};
}
/**
* Emotion and Styled Components both allow users to pass through arbitrary props to their components
* to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
* of these should be passed to the underlying DOM node.
*
* However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
* as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
* passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
* `@emotion/is-prop-valid`, however to fix this problem we need to use it.
*
* By making it an optionalDependency we can offer this functionality only in the situations where it's
* actually required.
*/
try {
/**
* We attempt to import this package but require won't be defined in esm environments, in that case
* isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed
* in favour of explicit injection.
*/
loadExternalIsValidProp((__webpack_require__(/*! @emotion/is-prop-valid */ "../../../node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js")["default"]));
} catch (_a) {
// We don't need to actually do anything here - the fallback is the existing `isPropValid`.
}
function filterProps(props, isDom, forwardMotionProps) {
var filteredProps = {};
for (var key in props) {
if (shouldForward(key) || forwardMotionProps === true && isValidMotionProp(key) || !isDom && !isValidMotionProp(key) ||
// If trying to use native HTML drag events, forward drag listeners
props["draggable"] && key.startsWith("onDrag")) {
filteredProps[key] = props[key];
}
}
return filteredProps;
}
function calcOrigin$1(origin, offset, size) {
return typeof origin === "string" ? origin : styleValueTypes.px.transform(offset + size * origin);
}
/**
* The SVG transform origin defaults are different to CSS and is less intuitive,
* so we use the measured dimensions of the SVG to reconcile these.
*/
function calcSVGTransformOrigin(dimensions, originX, originY) {
var pxOriginX = calcOrigin$1(originX, dimensions.x, dimensions.width);
var pxOriginY = calcOrigin$1(originY, dimensions.y, dimensions.height);
return "".concat(pxOriginX, " ").concat(pxOriginY);
}
var dashKeys = {
offset: "stroke-dashoffset",
array: "stroke-dasharray"
};
var camelKeys = {
offset: "strokeDashoffset",
array: "strokeDasharray"
};
/**
* Build SVG path properties. Uses the path's measured length to convert
* our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset
* and stroke-dasharray attributes.
*
* This function is mutative to reduce per-frame GC.
*/
function buildSVGPath(attrs, length, spacing, offset, useDashCase) {
if (spacing === void 0) {
spacing = 1;
}
if (offset === void 0) {
offset = 0;
}
if (useDashCase === void 0) {
useDashCase = true;
}
// Normalise path length by setting SVG attribute pathLength to 1
attrs.pathLength = 1;
// We use dash case when setting attributes directly to the DOM node and camel case
// when defining props on a React component.
var keys = useDashCase ? dashKeys : camelKeys;
// Build the dash offset
attrs[keys.offset] = styleValueTypes.px.transform(-offset);
// Build the dash array
var pathLength = styleValueTypes.px.transform(length);
var pathSpacing = styleValueTypes.px.transform(spacing);
attrs[keys.array] = "".concat(pathLength, " ").concat(pathSpacing);
}
/**
* Build SVG visual attrbutes, like cx and style.transform
*/
function buildSVGAttrs(state, _a, options, transformTemplate) {
var attrX = _a.attrX,
attrY = _a.attrY,
originX = _a.originX,
originY = _a.originY,
pathLength = _a.pathLength,
_b = _a.pathSpacing,
pathSpacing = _b === void 0 ? 1 : _b,
_c = _a.pathOffset,
pathOffset = _c === void 0 ? 0 : _c,
// This is object creation, which we try to avoid per-frame.
latest = tslib.__rest(_a, ["attrX", "attrY", "originX", "originY", "pathLength", "pathSpacing", "pathOffset"]);
buildHTMLStyles(state, latest, options, transformTemplate);
state.attrs = state.style;
state.style = {};
var attrs = state.attrs,
style = state.style,
dimensions = state.dimensions;
/**
* However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs
* and copy it into style.
*/
if (attrs.transform) {
if (dimensions) style.transform = attrs.transform;
delete attrs.transform;
}
// Parse transformOrigin
if (dimensions && (originX !== undefined || originY !== undefined || style.transform)) {
style.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== undefined ? originX : 0.5, originY !== undefined ? originY : 0.5);
}
// Treat x/y not as shortcuts but as actual attributes
if (attrX !== undefined) attrs.x = attrX;
if (attrY !== undefined) attrs.y = attrY;
// Build SVG path if one has been defined
if (pathLength !== undefined) {
buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
}
}
var createSvgRenderState = function () {
return tslib.__assign(tslib.__assign({}, createHtmlRenderState()), {
attrs: {}
});
};
function useSVGProps(props, visualState) {
var visualProps = React.useMemo(function () {
var state = createSvgRenderState();
buildSVGAttrs(state, visualState, {
enableHardwareAcceleration: false
}, props.transformTemplate);
return tslib.__assign(tslib.__assign({}, state.attrs), {
style: tslib.__assign({}, state.style)
});
}, [visualState]);
if (props.style) {
var rawStyles = {};
copyRawValuesOnly(rawStyles, props.style, props);
visualProps.style = tslib.__assign(tslib.__assign({}, rawStyles), visualProps.style);
}
return visualProps;
}
function createUseRender(forwardMotionProps) {
if (forwardMotionProps === void 0) {
forwardMotionProps = false;
}
var useRender = function (Component, props, projectionId, ref, _a, isStatic) {
var latestValues = _a.latestValues;
var useVisualProps = isSVGComponent(Component) ? useSVGProps : useHTMLProps;
var visualProps = useVisualProps(props, latestValues, isStatic);
var filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
var elementProps = tslib.__assign(tslib.__assign(tslib.__assign({}, filteredProps), visualProps), {
ref: ref
});
if (projectionId) {
elementProps["data-projection-id"] = projectionId;
}
return React.createElement(Component, elementProps);
};
return useRender;
}
var CAMEL_CASE_PATTERN = /([a-z])([A-Z])/g;
var REPLACE_TEMPLATE = "$1-$2";
/**
* Convert camelCase to dash-case properties.
*/
var camelToDash = function (str) {
return str.replace(CAMEL_CASE_PATTERN, REPLACE_TEMPLATE).toLowerCase();
};
function renderHTML(element, _a, styleProp, projection) {
var style = _a.style,
vars = _a.vars;
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
// Loop over any CSS variables and assign those.
for (var key in vars) {
element.style.setProperty(key, vars[key]);
}
}
/**
* A set of attribute names that are always read/written as camel case.
*/
var camelCaseAttributes = new Set(["baseFrequency", "diffuseConstant", "kernelMatrix", "kernelUnitLength", "keySplines", "keyTimes", "limitingConeAngle", "markerHeight", "markerWidth", "numOctaves", "targetX", "targetY", "surfaceScale", "specularConstant", "specularExponent", "stdDeviation", "tableValues", "viewBox", "gradientTransform", "pathLength"]);
function renderSVG(element, renderState, _styleProp, projection) {
renderHTML(element, renderState, undefined, projection);
for (var key in renderState.attrs) {
element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
}
}
function scrapeMotionValuesFromProps$1(props) {
var style = props.style;
var newValues = {};
for (var key in style) {
if (isMotionValue(style[key]) || isForcedMotionValue(key, props)) {
newValues[key] = style[key];
}
}
return newValues;
}
function scrapeMotionValuesFromProps(props) {
var newValues = scrapeMotionValuesFromProps$1(props);
for (var key in props) {
if (isMotionValue(props[key])) {
var targetKey = key === "x" || key === "y" ? "attr" + key.toUpperCase() : key;
newValues[targetKey] = props[key];
}
}
return newValues;
}
function isAnimationControls(v) {
return typeof v === "object" && typeof v.start === "function";
}
var isKeyframesTarget = function (v) {
return Array.isArray(v);
};
var isCustomValue = function (v) {
return Boolean(v && typeof v === "object" && v.mix && v.toValue);
};
var resolveFinalValueInKeyframes = function (v) {
// TODO maybe throw if v.length - 1 is placeholder token?
return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
};
/**
* If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
*
* TODO: Remove and move to library
*/
function resolveMotionValue(value) {
var unwrappedValue = isMotionValue(value) ? value.get() : value;
return isCustomValue(unwrappedValue) ? unwrappedValue.toValue() : unwrappedValue;
}
function makeState(_a, props, context, presenceContext) {
var scrapeMotionValuesFromProps = _a.scrapeMotionValuesFromProps,
createRenderState = _a.createRenderState,
onMount = _a.onMount;
var state = {
latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),
renderState: createRenderState()
};
if (onMount) {
state.mount = function (instance) {
return onMount(props, instance, state);
};
}
return state;
}
var makeUseVisualState = function (config) {
return function (props, isStatic) {
var context = React.useContext(MotionContext);
var presenceContext = React.useContext(PresenceContext);
return isStatic ? makeState(config, props, context, presenceContext) : useConstant(function () {
return makeState(config, props, context, presenceContext);
});
};
};
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
var values = {};
var blockInitialAnimation = (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false;
var motionValues = scrapeMotionValues(props);
for (var key in motionValues) {
values[key] = resolveMotionValue(motionValues[key]);
}
var initial = props.initial,
animate = props.animate;
var isControllingVariants = checkIfControllingVariants(props);
var isVariantNode = checkIfVariantNode(props);
if (context && isVariantNode && !isControllingVariants && props.inherit !== false) {
initial !== null && initial !== void 0 ? initial : initial = context.initial;
animate !== null && animate !== void 0 ? animate : animate = context.animate;
}
var initialAnimationIsBlocked = blockInitialAnimation || initial === false;
var variantToSet = initialAnimationIsBlocked ? animate : initial;
if (variantToSet && typeof variantToSet !== "boolean" && !isAnimationControls(variantToSet)) {
var list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
list.forEach(function (definition) {
var resolved = resolveVariantFromProps(props, definition);
if (!resolved) return;
var transitionEnd = resolved.transitionEnd;
resolved.transition;
var target = tslib.__rest(resolved, ["transitionEnd", "transition"]);
for (var key in target) {
var valueTarget = target[key];
if (Array.isArray(valueTarget)) {
/**
* Take final keyframe if the initial animation is blocked because
* we want to initialise at the end of that blocked animation.
*/
var index = initialAnimationIsBlocked ? valueTarget.length - 1 : 0;
valueTarget = valueTarget[index];
}
if (valueTarget !== null) {
values[key] = valueTarget;
}
}
for (var key in transitionEnd) values[key] = transitionEnd[key];
});
}
return values;
}
var svgMotionConfig = {
useVisualState: makeUseVisualState({
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
createRenderState: createSvgRenderState,
onMount: function (props, instance, _a) {
var renderState = _a.renderState,
latestValues = _a.latestValues;
try {
renderState.dimensions = typeof instance.getBBox === "function" ? instance.getBBox() : instance.getBoundingClientRect();
} catch (e) {
// Most likely trying to measure an unrendered element under Firefox
renderState.dimensions = {
x: 0,
y: 0,
width: 0,
height: 0
};
}
buildSVGAttrs(renderState, latestValues, {
enableHardwareAcceleration: false
}, props.transformTemplate);
renderSVG(instance, renderState);
}
})
};
var htmlMotionConfig = {
useVisualState: makeUseVisualState({
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
createRenderState: createHtmlRenderState
})
};
function createDomMotionConfig(Component, _a, preloadedFeatures, createVisualElement, projectionNodeConstructor) {
var _b = _a.forwardMotionProps,
forwardMotionProps = _b === void 0 ? false : _b;
var baseConfig = isSVGComponent(Component) ? svgMotionConfig : htmlMotionConfig;
return tslib.__assign(tslib.__assign({}, baseConfig), {
preloadedFeatures: preloadedFeatures,
useRender: createUseRender(forwardMotionProps),
createVisualElement: createVisualElement,
projectionNodeConstructor: projectionNodeConstructor,
Component: Component
});
}
exports.AnimationType = void 0;
(function (AnimationType) {
AnimationType["Animate"] = "animate";
AnimationType["Hover"] = "whileHover";
AnimationType["Tap"] = "whileTap";
AnimationType["Drag"] = "whileDrag";
AnimationType["Focus"] = "whileFocus";
AnimationType["InView"] = "whileInView";
AnimationType["Exit"] = "exit";
})(exports.AnimationType || (exports.AnimationType = {}));
function addDomEvent(target, eventName, handler, options) {
if (options === void 0) {
options = {
passive: true
};
}
target.addEventListener(eventName, handler, options);
return function () {
return target.removeEventListener(eventName, handler);
};
}
/**
* Attaches an event listener directly to the provided DOM element.
*
* Bypassing React's event system can be desirable, for instance when attaching non-passive
* event handlers.
*
* ```jsx
* const ref = useRef(null)
*
* useDomEvent(ref, 'wheel', onWheel, { passive: false })
*
* return
* ```
*
* @param ref - React.RefObject that's been provided to the element you want to bind the listener to.
* @param eventName - Name of the event you want listen for.
* @param handler - Function to fire when receiving the event.
* @param options - Options to pass to `Event.addEventListener`.
*
* @public
*/
function useDomEvent(ref, eventName, handler, options) {
React.useEffect(function () {
var element = ref.current;
if (handler && element) {
return addDomEvent(element, eventName, handler, options);
}
}, [ref, eventName, handler, options]);
}
/**
*
* @param props
* @param ref
* @internal
*/
function useFocusGesture(_a) {
var whileFocus = _a.whileFocus,
visualElement = _a.visualElement;
var onFocus = function () {
var _a;
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(exports.AnimationType.Focus, true);
};
var onBlur = function () {
var _a;
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(exports.AnimationType.Focus, false);
};
useDomEvent(visualElement, "focus", whileFocus ? onFocus : undefined);
useDomEvent(visualElement, "blur", whileFocus ? onBlur : undefined);
}
function isMouseEvent(event) {
// PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
if (typeof PointerEvent !== "undefined" && event instanceof PointerEvent) {
return !!(event.pointerType === "mouse");
}
return event instanceof MouseEvent;
}
function isTouchEvent(event) {
var hasTouches = !!event.touches;
return hasTouches;
}
/**
* Filters out events not attached to the primary pointer (currently left mouse button)
* @param eventHandler
*/
function filterPrimaryPointer(eventHandler) {
return function (event) {
var isMouseEvent = event instanceof MouseEvent;
var isPrimaryPointer = !isMouseEvent || isMouseEvent && event.button === 0;
if (isPrimaryPointer) {
eventHandler(event);
}
};
}
var defaultPagePoint = {
pageX: 0,
pageY: 0
};
function pointFromTouch(e, pointType) {
if (pointType === void 0) {
pointType = "page";
}
var primaryTouch = e.touches[0] || e.changedTouches[0];
var point = primaryTouch || defaultPagePoint;
return {
x: point[pointType + "X"],
y: point[pointType + "Y"]
};
}
function pointFromMouse(point, pointType) {
if (pointType === void 0) {
pointType = "page";
}
return {
x: point[pointType + "X"],
y: point[pointType + "Y"]
};
}
function extractEventInfo(event, pointType) {
if (pointType === void 0) {
pointType = "page";
}
return {
point: isTouchEvent(event) ? pointFromTouch(event, pointType) : pointFromMouse(event, pointType)
};
}
var wrapHandler = function (handler, shouldFilterPrimaryPointer) {
if (shouldFilterPrimaryPointer === void 0) {
shouldFilterPrimaryPointer = false;
}
var listener = function (event) {
return handler(event, extractEventInfo(event));
};
return shouldFilterPrimaryPointer ? filterPrimaryPointer(listener) : listener;
};
// We check for event support via functions in case they've been mocked by a testing suite.
var supportsPointerEvents = function () {
return isBrowser && window.onpointerdown === null;
};
var supportsTouchEvents = function () {
return isBrowser && window.ontouchstart === null;
};
var supportsMouseEvents = function () {
return isBrowser && window.onmousedown === null;
};
var mouseEventNames = {
pointerdown: "mousedown",
pointermove: "mousemove",
pointerup: "mouseup",
pointercancel: "mousecancel",
pointerover: "mouseover",
pointerout: "mouseout",
pointerenter: "mouseenter",
pointerleave: "mouseleave"
};
var touchEventNames = {
pointerdown: "touchstart",
pointermove: "touchmove",
pointerup: "touchend",
pointercancel: "touchcancel"
};
function getPointerEventName(name) {
if (supportsPointerEvents()) {
return name;
} else if (supportsTouchEvents()) {
return touchEventNames[name];
} else if (supportsMouseEvents()) {
return mouseEventNames[name];
}
return name;
}
function addPointerEvent(target, eventName, handler, options) {
return addDomEvent(target, getPointerEventName(eventName), wrapHandler(handler, eventName === "pointerdown"), options);
}
function usePointerEvent(ref, eventName, handler, options) {
return useDomEvent(ref, getPointerEventName(eventName), handler && wrapHandler(handler, eventName === "pointerdown"), options);
}
function createLock(name) {
var lock = null;
return function () {
var openLock = function () {
lock = null;
};
if (lock === null) {
lock = name;
return openLock;
}
return false;
};
}
var globalHorizontalLock = createLock("dragHorizontal");
var globalVerticalLock = createLock("dragVertical");
function getGlobalLock(drag) {
var lock = false;
if (drag === "y") {
lock = globalVerticalLock();
} else if (drag === "x") {
lock = globalHorizontalLock();
} else {
var openHorizontal_1 = globalHorizontalLock();
var openVertical_1 = globalVerticalLock();
if (openHorizontal_1 && openVertical_1) {
lock = function () {
openHorizontal_1();
openVertical_1();
};
} else {
// Release the locks because we don't use them
if (openHorizontal_1) openHorizontal_1();
if (openVertical_1) openVertical_1();
}
}
return lock;
}
function isDragActive() {
// Check the gesture lock - if we get it, it means no drag gesture is active
// and we can safely fire the tap gesture.
var openGestureLock = getGlobalLock(true);
if (!openGestureLock) return true;
openGestureLock();
return false;
}
function createHoverEvent(visualElement, isActive, callback) {
return function (event, info) {
var _a;
if (!isMouseEvent(event) || isDragActive()) return;
/**
* Ensure we trigger animations before firing event callback
*/
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(exports.AnimationType.Hover, isActive);
callback === null || callback === void 0 ? void 0 : callback(event, info);
};
}
function useHoverGesture(_a) {
var onHoverStart = _a.onHoverStart,
onHoverEnd = _a.onHoverEnd,
whileHover = _a.whileHover,
visualElement = _a.visualElement;
usePointerEvent(visualElement, "pointerenter", onHoverStart || whileHover ? createHoverEvent(visualElement, true, onHoverStart) : undefined, {
passive: !onHoverStart
});
usePointerEvent(visualElement, "pointerleave", onHoverEnd || whileHover ? createHoverEvent(visualElement, false, onHoverEnd) : undefined, {
passive: !onHoverEnd
});
}
/**
* Recursively traverse up the tree to check whether the provided child node
* is the parent or a descendant of it.
*
* @param parent - Element to find
* @param child - Element to test against parent
*/
var isNodeOrChild = function (parent, child) {
if (!child) {
return false;
} else if (parent === child) {
return true;
} else {
return isNodeOrChild(parent, child.parentElement);
}
};
function useUnmountEffect(callback) {
return React.useEffect(function () {
return function () {
return callback();
};
}, []);
}
/**
* @param handlers -
* @internal
*/
function useTapGesture(_a) {
var onTap = _a.onTap,
onTapStart = _a.onTapStart,
onTapCancel = _a.onTapCancel,
whileTap = _a.whileTap,
visualElement = _a.visualElement;
var hasPressListeners = onTap || onTapStart || onTapCancel || whileTap;
var isPressing = React.useRef(false);
var cancelPointerEndListeners = React.useRef(null);
/**
* Only set listener to passive if there are no external listeners.
*/
var eventOptions = {
passive: !(onTapStart || onTap || onTapCancel || onPointerDown)
};
function removePointerEndListener() {
var _a;
(_a = cancelPointerEndListeners.current) === null || _a === void 0 ? void 0 : _a.call(cancelPointerEndListeners);
cancelPointerEndListeners.current = null;
}
function checkPointerEnd() {
var _a;
removePointerEndListener();
isPressing.current = false;
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(exports.AnimationType.Tap, false);
return !isDragActive();
}
function onPointerUp(event, info) {
if (!checkPointerEnd()) return;
/**
* We only count this as a tap gesture if the event.target is the same
* as, or a child of, this component's element
*/
!isNodeOrChild(visualElement.getInstance(), event.target) ? onTapCancel === null || onTapCancel === void 0 ? void 0 : onTapCancel(event, info) : onTap === null || onTap === void 0 ? void 0 : onTap(event, info);
}
function onPointerCancel(event, info) {
if (!checkPointerEnd()) return;
onTapCancel === null || onTapCancel === void 0 ? void 0 : onTapCancel(event, info);
}
function onPointerDown(event, info) {
var _a;
removePointerEndListener();
if (isPressing.current) return;
isPressing.current = true;
cancelPointerEndListeners.current = popmotion.pipe(addPointerEvent(window, "pointerup", onPointerUp, eventOptions), addPointerEvent(window, "pointercancel", onPointerCancel, eventOptions));
/**
* Ensure we trigger animations before firing event callback
*/
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(exports.AnimationType.Tap, true);
onTapStart === null || onTapStart === void 0 ? void 0 : onTapStart(event, info);
}
usePointerEvent(visualElement, "pointerdown", hasPressListeners ? onPointerDown : undefined, eventOptions);
useUnmountEffect(removePointerEndListener);
}
var warned = new Set();
function warnOnce(condition, message, element) {
if (condition || warned.has(message)) return;
console.warn(message);
if (element) console.warn(element);
warned.add(message);
}
/**
* Map an IntersectionHandler callback to an element. We only ever make one handler for one
* element, so even though these handlers might all be triggered by different
* observers, we can keep them in the same map.
*/
var observerCallbacks = new WeakMap();
/**
* Multiple observers can be created for multiple element/document roots. Each with
* different settings. So here we store dictionaries of observers to each root,
* using serialised settings (threshold/margin) as lookup keys.
*/
var observers = new WeakMap();
var fireObserverCallback = function (entry) {
var _a;
(_a = observerCallbacks.get(entry.target)) === null || _a === void 0 ? void 0 : _a(entry);
};
var fireAllObserverCallbacks = function (entries) {
entries.forEach(fireObserverCallback);
};
function initIntersectionObserver(_a) {
var root = _a.root,
options = tslib.__rest(_a, ["root"]);
var lookupRoot = root || document;
/**
* If we don't have an observer lookup map for this root, create one.
*/
if (!observers.has(lookupRoot)) {
observers.set(lookupRoot, {});
}
var rootObservers = observers.get(lookupRoot);
var key = JSON.stringify(options);
/**
* If we don't have an observer for this combination of root and settings,
* create one.
*/
if (!rootObservers[key]) {
rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, tslib.__assign({
root: root
}, options));
}
return rootObservers[key];
}
function observeIntersection(element, options, callback) {
var rootInteresectionObserver = initIntersectionObserver(options);
observerCallbacks.set(element, callback);
rootInteresectionObserver.observe(element);
return function () {
observerCallbacks.delete(element);
rootInteresectionObserver.unobserve(element);
};
}
function useViewport(_a) {
var visualElement = _a.visualElement,
whileInView = _a.whileInView,
onViewportEnter = _a.onViewportEnter,
onViewportLeave = _a.onViewportLeave,
_b = _a.viewport,
viewport = _b === void 0 ? {} : _b;
var state = React.useRef({
hasEnteredView: false,
isInView: false
});
var shouldObserve = Boolean(whileInView || onViewportEnter || onViewportLeave);
if (viewport.once && state.current.hasEnteredView) shouldObserve = false;
var useObserver = typeof IntersectionObserver === "undefined" ? useMissingIntersectionObserver : useIntersectionObserver;
useObserver(shouldObserve, state.current, visualElement, viewport);
}
var thresholdNames = {
some: 0,
all: 1
};
function useIntersectionObserver(shouldObserve, state, visualElement, _a) {
var root = _a.root,
rootMargin = _a.margin,
_b = _a.amount,
amount = _b === void 0 ? "some" : _b,
once = _a.once;
React.useEffect(function () {
if (!shouldObserve) return;
var options = {
root: root === null || root === void 0 ? void 0 : root.current,
rootMargin: rootMargin,
threshold: typeof amount === "number" ? amount : thresholdNames[amount]
};
var intersectionCallback = function (entry) {
var _a;
var isIntersecting = entry.isIntersecting;
/**
* If there's been no change in the viewport state, early return.
*/
if (state.isInView === isIntersecting) return;
state.isInView = isIntersecting;
/**
* Handle hasEnteredView. If this is only meant to run once, and
* element isn't visible, early return. Otherwise set hasEnteredView to true.
*/
if (once && !isIntersecting && state.hasEnteredView) {
return;
} else if (isIntersecting) {
state.hasEnteredView = true;
}
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(exports.AnimationType.InView, isIntersecting);
/**
* Use the latest committed props rather than the ones in scope
* when this observer is created
*/
var props = visualElement.getProps();
var callback = isIntersecting ? props.onViewportEnter : props.onViewportLeave;
callback === null || callback === void 0 ? void 0 : callback(entry);
};
return observeIntersection(visualElement.getInstance(), options, intersectionCallback);
}, [shouldObserve, root, rootMargin, amount]);
}
/**
* If IntersectionObserver is missing, we activate inView and fire onViewportEnter
* on mount. This way, the page will be in the state the author expects users
* to see it in for everyone.
*/
function useMissingIntersectionObserver(shouldObserve, state, visualElement, _a) {
var _b = _a.fallback,
fallback = _b === void 0 ? true : _b;
React.useEffect(function () {
if (!shouldObserve || !fallback) return;
if (env !== "production") {
warnOnce(false, "IntersectionObserver not available on this device. whileInView animations will trigger on mount.");
}
/**
* Fire this in an rAF because, at this point, the animation state
* won't have flushed for the first time and there's certain logic in
* there that behaves differently on the initial animation.
*
* This hook should be quite rarely called so setting this in an rAF
* is preferred to changing the behaviour of the animation state.
*/
requestAnimationFrame(function () {
var _a;
state.hasEnteredView = true;
var onViewportEnter = visualElement.getProps().onViewportEnter;
onViewportEnter === null || onViewportEnter === void 0 ? void 0 : onViewportEnter(null);
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(exports.AnimationType.InView, true);
});
}, [shouldObserve]);
}
var makeRenderlessComponent = function (hook) {
return function (props) {
hook(props);
return null;
};
};
var gestureAnimations = {
inView: makeRenderlessComponent(useViewport),
tap: makeRenderlessComponent(useTapGesture),
focus: makeRenderlessComponent(useFocusGesture),
hover: makeRenderlessComponent(useHoverGesture)
};
var counter = 0;
var incrementId = function () {
return counter++;
};
var useId = function () {
return useConstant(incrementId);
};
/**
* Ideally we'd use the following code to support React 18 optionally.
* But this fairly fails in Webpack (otherwise treeshaking wouldn't work at all).
* Need to come up with a different way of figuring this out.
*/
// export const useId = (React as any).useId
// ? (React as any).useId
// : () => useConstant(incrementId)
/**
* When a component is the child of `AnimatePresence`, it can use `usePresence`
* to access information about whether it's still present in the React tree.
*
* ```jsx
* import { usePresence } from "framer-motion"
*
* export const Component = () => {
* const [isPresent, safeToRemove] = usePresence()
*
* useEffect(() => {
* !isPresent && setTimeout(safeToRemove, 1000)
* }, [isPresent])
*
* return
* }
* ```
*
* If `isPresent` is `false`, it means that a component has been removed the tree, but
* `AnimatePresence` won't really remove it until `safeToRemove` has been called.
*
* @public
*/
function usePresence() {
var context = React.useContext(PresenceContext);
if (context === null) return [true, null];
var isPresent = context.isPresent,
onExitComplete = context.onExitComplete,
register = context.register;
// It's safe to call the following hooks conditionally (after an early return) because the context will always
// either be null or non-null for the lifespan of the component.
// Replace with useId when released in React
var id = useId();
React.useEffect(function () {
return register(id);
}, []);
var safeToRemove = function () {
return onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete(id);
};
return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
}
/**
* Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
* There is no `safeToRemove` function.
*
* ```jsx
* import { useIsPresent } from "framer-motion"
*
* export const Component = () => {
* const isPresent = useIsPresent()
*
* useEffect(() => {
* !isPresent && console.log("I've been removed!")
* }, [isPresent])
*
* return
* }
* ```
*
* @public
*/
function useIsPresent() {
return isPresent(React.useContext(PresenceContext));
}
function isPresent(context) {
return context === null ? true : context.isPresent;
}
function shallowCompare(next, prev) {
if (!Array.isArray(prev)) return false;
var prevLength = prev.length;
if (prevLength !== next.length) return false;
for (var i = 0; i < prevLength; i++) {
if (prev[i] !== next[i]) return false;
}
return true;
}
/**
* Converts seconds to milliseconds
*
* @param seconds - Time in seconds.
* @return milliseconds - Converted time in milliseconds.
*/
var secondsToMilliseconds = function (seconds) {
return seconds * 1000;
};
var easingLookup = {
linear: popmotion.linear,
easeIn: popmotion.easeIn,
easeInOut: popmotion.easeInOut,
easeOut: popmotion.easeOut,
circIn: popmotion.circIn,
circInOut: popmotion.circInOut,
circOut: popmotion.circOut,
backIn: popmotion.backIn,
backInOut: popmotion.backInOut,
backOut: popmotion.backOut,
anticipate: popmotion.anticipate,
bounceIn: popmotion.bounceIn,
bounceInOut: popmotion.bounceInOut,
bounceOut: popmotion.bounceOut
};
var easingDefinitionToFunction = function (definition) {
if (Array.isArray(definition)) {
// If cubic bezier definition, create bezier curve
heyListen.invariant(definition.length === 4, "Cubic bezier arrays must contain four numerical values.");
var _a = tslib.__read(definition, 4),
x1 = _a[0],
y1 = _a[1],
x2 = _a[2],
y2 = _a[3];
return popmotion.cubicBezier(x1, y1, x2, y2);
} else if (typeof definition === "string") {
// Else lookup from table
heyListen.invariant(easingLookup[definition] !== undefined, "Invalid easing type '".concat(definition, "'"));
return easingLookup[definition];
}
return definition;
};
var isEasingArray = function (ease) {
return Array.isArray(ease) && typeof ease[0] !== "number";
};
/**
* Check if a value is animatable. Examples:
*
* ✅: 100, "100px", "#fff"
* ❌: "block", "url(2.jpg)"
* @param value
*
* @internal
*/
var isAnimatable = function (key, value) {
// If the list of keys tat might be non-animatable grows, replace with Set
if (key === "zIndex") return false;
// If it's a number or a keyframes array, we can animate it. We might at some point
// need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,
// but for now lets leave it like this for performance reasons
if (typeof value === "number" || Array.isArray(value)) return true;
if (typeof value === "string" &&
// It's animatable if we have a string
styleValueTypes.complex.test(value) &&
// And it contains numbers and/or colors
!value.startsWith("url(") // Unless it starts with "url("
) {
return true;
}
return false;
};
var underDampedSpring = function () {
return {
type: "spring",
stiffness: 500,
damping: 25,
restSpeed: 10
};
};
var criticallyDampedSpring = function (to) {
return {
type: "spring",
stiffness: 550,
damping: to === 0 ? 2 * Math.sqrt(550) : 30,
restSpeed: 10
};
};
var linearTween = function () {
return {
type: "keyframes",
ease: "linear",
duration: 0.3
};
};
var keyframes = function (values) {
return {
type: "keyframes",
duration: 0.8,
values: values
};
};
var defaultTransitions = {
x: underDampedSpring,
y: underDampedSpring,
z: underDampedSpring,
rotate: underDampedSpring,
rotateX: underDampedSpring,
rotateY: underDampedSpring,
rotateZ: underDampedSpring,
scaleX: criticallyDampedSpring,
scaleY: criticallyDampedSpring,
scale: criticallyDampedSpring,
opacity: linearTween,
backgroundColor: linearTween,
color: linearTween,
default: criticallyDampedSpring
};
var getDefaultTransition = function (valueKey, to) {
var transitionFactory;
if (isKeyframesTarget(to)) {
transitionFactory = keyframes;
} else {
transitionFactory = defaultTransitions[valueKey] || defaultTransitions.default;
}
return tslib.__assign({
to: to
}, transitionFactory(to));
};
/**
* A map of default value types for common values
*/
var defaultValueTypes = tslib.__assign(tslib.__assign({}, numberValueTypes), {
// Color props
color: styleValueTypes.color,
backgroundColor: styleValueTypes.color,
outlineColor: styleValueTypes.color,
fill: styleValueTypes.color,
stroke: styleValueTypes.color,
// Border props
borderColor: styleValueTypes.color,
borderTopColor: styleValueTypes.color,
borderRightColor: styleValueTypes.color,
borderBottomColor: styleValueTypes.color,
borderLeftColor: styleValueTypes.color,
filter: styleValueTypes.filter,
WebkitFilter: styleValueTypes.filter
});
/**
* Gets the default ValueType for the provided value key
*/
var getDefaultValueType = function (key) {
return defaultValueTypes[key];
};
function getAnimatableNone(key, value) {
var _a;
var defaultValueType = getDefaultValueType(key);
if (defaultValueType !== styleValueTypes.filter) defaultValueType = styleValueTypes.complex;
// If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
return (_a = defaultValueType.getAnimatableNone) === null || _a === void 0 ? void 0 : _a.call(defaultValueType, value);
}
var instantAnimationState = {
current: false
};
/**
* Decide whether a transition is defined on a given Transition.
* This filters out orchestration options and returns true
* if any options are left.
*/
function isTransitionDefined(_a) {
_a.when;
_a.delay;
_a.delayChildren;
_a.staggerChildren;
_a.staggerDirection;
_a.repeat;
_a.repeatType;
_a.repeatDelay;
_a.from;
var transition = tslib.__rest(_a, ["when", "delay", "delayChildren", "staggerChildren", "staggerDirection", "repeat", "repeatType", "repeatDelay", "from"]);
return !!Object.keys(transition).length;
}
var legacyRepeatWarning = false;
/**
* Convert Framer Motion's Transition type into Popmotion-compatible options.
*/
function convertTransitionToAnimationOptions(_a) {
var ease = _a.ease,
times = _a.times,
yoyo = _a.yoyo,
flip = _a.flip,
loop = _a.loop,
transition = tslib.__rest(_a, ["ease", "times", "yoyo", "flip", "loop"]);
var options = tslib.__assign({}, transition);
if (times) options["offset"] = times;
/**
* Convert any existing durations from seconds to milliseconds
*/
if (transition.duration) options["duration"] = secondsToMilliseconds(transition.duration);
if (transition.repeatDelay) options.repeatDelay = secondsToMilliseconds(transition.repeatDelay);
/**
* Map easing names to Popmotion's easing functions
*/
if (ease) {
options["ease"] = isEasingArray(ease) ? ease.map(easingDefinitionToFunction) : easingDefinitionToFunction(ease);
}
/**
* Support legacy transition API
*/
if (transition.type === "tween") options.type = "keyframes";
/**
* TODO: These options are officially removed from the API.
*/
if (yoyo || loop || flip) {
heyListen.warning(!legacyRepeatWarning, "yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options.");
legacyRepeatWarning = true;
if (yoyo) {
options.repeatType = "reverse";
} else if (loop) {
options.repeatType = "loop";
} else if (flip) {
options.repeatType = "mirror";
}
options.repeat = loop || yoyo || flip || transition.repeat;
}
/**
* TODO: Popmotion 9 has the ability to automatically detect whether to use
* a keyframes or spring animation, but does so by detecting velocity and other spring options.
* It'd be good to introduce a similar thing here.
*/
if (transition.type !== "spring") options.type = "keyframes";
return options;
}
/**
* Get the delay for a value by checking Transition with decreasing specificity.
*/
function getDelayFromTransition(transition, key) {
var _a, _b;
var valueTransition = getValueTransition(transition, key) || {};
return (_b = (_a = valueTransition.delay) !== null && _a !== void 0 ? _a : transition.delay) !== null && _b !== void 0 ? _b : 0;
}
function hydrateKeyframes(options) {
if (Array.isArray(options.to) && options.to[0] === null) {
options.to = tslib.__spreadArray([], tslib.__read(options.to), false);
options.to[0] = options.from;
}
return options;
}
function getPopmotionAnimationOptions(transition, options, key) {
var _a;
if (Array.isArray(options.to)) {
(_a = transition.duration) !== null && _a !== void 0 ? _a : transition.duration = 0.8;
}
hydrateKeyframes(options);
/**
* Get a default transition if none is determined to be defined.
*/
if (!isTransitionDefined(transition)) {
transition = tslib.__assign(tslib.__assign({}, transition), getDefaultTransition(key, options.to));
}
return tslib.__assign(tslib.__assign({}, options), convertTransitionToAnimationOptions(transition));
}
/**
*
*/
function getAnimation(key, value, target, transition, onComplete) {
var _a;
var valueTransition = getValueTransition(transition, key);
var origin = (_a = valueTransition.from) !== null && _a !== void 0 ? _a : value.get();
var isTargetAnimatable = isAnimatable(key, target);
if (origin === "none" && isTargetAnimatable && typeof target === "string") {
/**
* If we're trying to animate from "none", try and get an animatable version
* of the target. This could be improved to work both ways.
*/
origin = getAnimatableNone(key, target);
} else if (isZero(origin) && typeof target === "string") {
origin = getZeroUnit(target);
} else if (!Array.isArray(target) && isZero(target) && typeof origin === "string") {
target = getZeroUnit(origin);
}
var isOriginAnimatable = isAnimatable(key, origin);
heyListen.warning(isOriginAnimatable === isTargetAnimatable, "You are trying to animate ".concat(key, " from \"").concat(origin, "\" to \"").concat(target, "\". ").concat(origin, " is not an animatable value - to enable this animation set ").concat(origin, " to a value animatable to ").concat(target, " via the `style` property."));
function start() {
var options = {
from: origin,
to: target,
velocity: value.getVelocity(),
onComplete: onComplete,
onUpdate: function (v) {
return value.set(v);
}
};
return valueTransition.type === "inertia" || valueTransition.type === "decay" ? popmotion.inertia(tslib.__assign(tslib.__assign({}, options), valueTransition)) : popmotion.animate(tslib.__assign(tslib.__assign({}, getPopmotionAnimationOptions(valueTransition, options, key)), {
onUpdate: function (v) {
var _a;
options.onUpdate(v);
(_a = valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, v);
},
onComplete: function () {
var _a;
options.onComplete();
(_a = valueTransition.onComplete) === null || _a === void 0 ? void 0 : _a.call(valueTransition);
}
}));
}
function set() {
var _a, _b;
var finalTarget = resolveFinalValueInKeyframes(target);
value.set(finalTarget);
onComplete();
(_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, finalTarget);
(_b = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onComplete) === null || _b === void 0 ? void 0 : _b.call(valueTransition);
return {
stop: function () {}
};
}
return !isOriginAnimatable || !isTargetAnimatable || valueTransition.type === false ? set : start;
}
function isZero(value) {
return value === 0 || typeof value === "string" && parseFloat(value) === 0 && value.indexOf(" ") === -1;
}
function getZeroUnit(potentialUnitType) {
return typeof potentialUnitType === "number" ? 0 : getAnimatableNone("", potentialUnitType);
}
function getValueTransition(transition, key) {
return transition[key] || transition["default"] || transition;
}
/**
* Start animation on a MotionValue. This function is an interface between
* Framer Motion and Popmotion
*/
function startAnimation(key, value, target, transition) {
if (transition === void 0) {
transition = {};
}
if (instantAnimationState.current) {
transition = {
type: false
};
}
return value.start(function (onComplete) {
var delayTimer;
var controls;
var animation = getAnimation(key, value, target, transition, onComplete);
var delay = getDelayFromTransition(transition, key);
var start = function () {
return controls = animation();
};
if (delay) {
delayTimer = window.setTimeout(start, secondsToMilliseconds(delay));
} else {
start();
}
return function () {
clearTimeout(delayTimer);
controls === null || controls === void 0 ? void 0 : controls.stop();
};
});
}
/**
* Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1"
*/
var isNumericalString = function (v) {
return /^\-?\d*\.?\d+$/.test(v);
};
/**
* Check if the value is a zero value string like "0px" or "0%"
*/
var isZeroValueString = function (v) {
return /^0[^.\s]+$/.test(v);
};
function addUniqueItem(arr, item) {
arr.indexOf(item) === -1 && arr.push(item);
}
function removeItem(arr, item) {
var index = arr.indexOf(item);
index > -1 && arr.splice(index, 1);
}
// Adapted from array-move
function moveItem(_a, fromIndex, toIndex) {
var _b = tslib.__read(_a),
arr = _b.slice(0);
var startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;
if (startIndex >= 0 && startIndex < arr.length) {
var endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;
var _c = tslib.__read(arr.splice(fromIndex, 1), 1),
item = _c[0];
arr.splice(endIndex, 0, item);
}
return arr;
}
var SubscriptionManager = /** @class */function () {
function SubscriptionManager() {
this.subscriptions = [];
}
SubscriptionManager.prototype.add = function (handler) {
var _this = this;
addUniqueItem(this.subscriptions, handler);
return function () {
return removeItem(_this.subscriptions, handler);
};
};
SubscriptionManager.prototype.notify = function (a, b, c) {
var numSubscriptions = this.subscriptions.length;
if (!numSubscriptions) return;
if (numSubscriptions === 1) {
/**
* If there's only a single handler we can just call it without invoking a loop.
*/
this.subscriptions[0](a, b, c);
} else {
for (var i = 0; i < numSubscriptions; i++) {
/**
* Check whether the handler exists before firing as it's possible
* the subscriptions were modified during this loop running.
*/
var handler = this.subscriptions[i];
handler && handler(a, b, c);
}
}
};
SubscriptionManager.prototype.getSize = function () {
return this.subscriptions.length;
};
SubscriptionManager.prototype.clear = function () {
this.subscriptions.length = 0;
};
return SubscriptionManager;
}();
var isFloat = function (value) {
return !isNaN(parseFloat(value));
};
/**
* `MotionValue` is used to track the state and velocity of motion values.
*
* @public
*/
var MotionValue = /** @class */function () {
/**
* @param init - The initiating value
* @param config - Optional configuration options
*
* - `transformer`: A function to transform incoming values with.
*
* @internal
*/
function MotionValue(init) {
var _this = this;
/**
* This will be replaced by the build step with the latest version number.
* When MotionValues are provided to motion components, warn if versions are mixed.
*/
this.version = "6.5.1";
/**
* Duration, in milliseconds, since last updating frame.
*
* @internal
*/
this.timeDelta = 0;
/**
* Timestamp of the last time this `MotionValue` was updated.
*
* @internal
*/
this.lastUpdated = 0;
/**
* Functions to notify when the `MotionValue` updates.
*
* @internal
*/
this.updateSubscribers = new SubscriptionManager();
/**
* Functions to notify when the velocity updates.
*
* @internal
*/
this.velocityUpdateSubscribers = new SubscriptionManager();
/**
* Functions to notify when the `MotionValue` updates and `render` is set to `true`.
*
* @internal
*/
this.renderSubscribers = new SubscriptionManager();
/**
* Tracks whether this value can output a velocity. Currently this is only true
* if the value is numerical, but we might be able to widen the scope here and support
* other value types.
*
* @internal
*/
this.canTrackVelocity = false;
this.updateAndNotify = function (v, render) {
if (render === void 0) {
render = true;
}
_this.prev = _this.current;
_this.current = v;
// Update timestamp
var _a = sync.getFrameData(),
delta = _a.delta,
timestamp = _a.timestamp;
if (_this.lastUpdated !== timestamp) {
_this.timeDelta = delta;
_this.lastUpdated = timestamp;
sync__default["default"].postRender(_this.scheduleVelocityCheck);
}
// Update update subscribers
if (_this.prev !== _this.current) {
_this.updateSubscribers.notify(_this.current);
}
// Update velocity subscribers
if (_this.velocityUpdateSubscribers.getSize()) {
_this.velocityUpdateSubscribers.notify(_this.getVelocity());
}
// Update render subscribers
if (render) {
_this.renderSubscribers.notify(_this.current);
}
};
/**
* Schedule a velocity check for the next frame.
*
* This is an instanced and bound function to prevent generating a new
* function once per frame.
*
* @internal
*/
this.scheduleVelocityCheck = function () {
return sync__default["default"].postRender(_this.velocityCheck);
};
/**
* Updates `prev` with `current` if the value hasn't been updated this frame.
* This ensures velocity calculations return `0`.
*
* This is an instanced and bound function to prevent generating a new
* function once per frame.
*
* @internal
*/
this.velocityCheck = function (_a) {
var timestamp = _a.timestamp;
if (timestamp !== _this.lastUpdated) {
_this.prev = _this.current;
_this.velocityUpdateSubscribers.notify(_this.getVelocity());
}
};
this.hasAnimated = false;
this.prev = this.current = init;
this.canTrackVelocity = isFloat(this.current);
}
/**
* Adds a function that will be notified when the `MotionValue` is updated.
*
* It returns a function that, when called, will cancel the subscription.
*
* When calling `onChange` inside a React component, it should be wrapped with the
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
* from the `useEffect` function to ensure you don't add duplicate subscribers..
*
* ```jsx
* export const MyComponent = () => {
* const x = useMotionValue(0)
* const y = useMotionValue(0)
* const opacity = useMotionValue(1)
*
* useEffect(() => {
* function updateOpacity() {
* const maxXY = Math.max(x.get(), y.get())
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
* opacity.set(newOpacity)
* }
*
* const unsubscribeX = x.onChange(updateOpacity)
* const unsubscribeY = y.onChange(updateOpacity)
*
* return () => {
* unsubscribeX()
* unsubscribeY()
* }
* }, [])
*
* return
* }
* ```
*
* @privateRemarks
*
* We could look into a `useOnChange` hook if the above lifecycle management proves confusing.
*
* ```jsx
* useOnChange(x, () => {})
* ```
*
* @param subscriber - A function that receives the latest value.
* @returns A function that, when called, will cancel this subscription.
*
* @public
*/
MotionValue.prototype.onChange = function (subscription) {
return this.updateSubscribers.add(subscription);
};
MotionValue.prototype.clearListeners = function () {
this.updateSubscribers.clear();
};
/**
* Adds a function that will be notified when the `MotionValue` requests a render.
*
* @param subscriber - A function that's provided the latest value.
* @returns A function that, when called, will cancel this subscription.
*
* @internal
*/
MotionValue.prototype.onRenderRequest = function (subscription) {
// Render immediately
subscription(this.get());
return this.renderSubscribers.add(subscription);
};
/**
* Attaches a passive effect to the `MotionValue`.
*
* @internal
*/
MotionValue.prototype.attach = function (passiveEffect) {
this.passiveEffect = passiveEffect;
};
/**
* Sets the state of the `MotionValue`.
*
* @remarks
*
* ```jsx
* const x = useMotionValue(0)
* x.set(10)
* ```
*
* @param latest - Latest value to set.
* @param render - Whether to notify render subscribers. Defaults to `true`
*
* @public
*/
MotionValue.prototype.set = function (v, render) {
if (render === void 0) {
render = true;
}
if (!render || !this.passiveEffect) {
this.updateAndNotify(v, render);
} else {
this.passiveEffect(v, this.updateAndNotify);
}
};
/**
* Returns the latest state of `MotionValue`
*
* @returns - The latest state of `MotionValue`
*
* @public
*/
MotionValue.prototype.get = function () {
return this.current;
};
/**
* @public
*/
MotionValue.prototype.getPrevious = function () {
return this.prev;
};
/**
* Returns the latest velocity of `MotionValue`
*
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
*
* @public
*/
MotionValue.prototype.getVelocity = function () {
// This could be isFloat(this.prev) && isFloat(this.current), but that would be wasteful
return this.canTrackVelocity ?
// These casts could be avoided if parseFloat would be typed better
popmotion.velocityPerSecond(parseFloat(this.current) - parseFloat(this.prev), this.timeDelta) : 0;
};
/**
* Registers a new animation to control this `MotionValue`. Only one
* animation can drive a `MotionValue` at one time.
*
* ```jsx
* value.start()
* ```
*
* @param animation - A function that starts the provided animation
*
* @internal
*/
MotionValue.prototype.start = function (animation) {
var _this = this;
this.stop();
return new Promise(function (resolve) {
_this.hasAnimated = true;
_this.stopAnimation = animation(resolve);
}).then(function () {
return _this.clearAnimation();
});
};
/**
* Stop the currently active animation.
*
* @public
*/
MotionValue.prototype.stop = function () {
if (this.stopAnimation) this.stopAnimation();
this.clearAnimation();
};
/**
* Returns `true` if this value is currently animating.
*
* @public
*/
MotionValue.prototype.isAnimating = function () {
return !!this.stopAnimation;
};
MotionValue.prototype.clearAnimation = function () {
this.stopAnimation = null;
};
/**
* Destroy and clean up subscribers to this `MotionValue`.
*
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
* created a `MotionValue` via the `motionValue` function.
*
* @public
*/
MotionValue.prototype.destroy = function () {
this.updateSubscribers.clear();
this.renderSubscribers.clear();
this.stop();
};
return MotionValue;
}();
function motionValue(init) {
return new MotionValue(init);
}
/**
* Tests a provided value against a ValueType
*/
var testValueType = function (v) {
return function (type) {
return type.test(v);
};
};
/**
* ValueType for "auto"
*/
var auto = {
test: function (v) {
return v === "auto";
},
parse: function (v) {
return v;
}
};
/**
* A list of value types commonly used for dimensions
*/
var dimensionValueTypes = [styleValueTypes.number, styleValueTypes.px, styleValueTypes.percent, styleValueTypes.degrees, styleValueTypes.vw, styleValueTypes.vh, auto];
/**
* Tests a dimensional value against the list of dimension ValueTypes
*/
var findDimensionValueType = function (v) {
return dimensionValueTypes.find(testValueType(v));
};
/**
* A list of all ValueTypes
*/
var valueTypes = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(dimensionValueTypes), false), [styleValueTypes.color, styleValueTypes.complex], false);
/**
* Tests a value against the list of ValueTypes
*/
var findValueType = function (v) {
return valueTypes.find(testValueType(v));
};
/**
* Set VisualElement's MotionValue, creating a new MotionValue for it if
* it doesn't exist.
*/
function setMotionValue(visualElement, key, value) {
if (visualElement.hasValue(key)) {
visualElement.getValue(key).set(value);
} else {
visualElement.addValue(key, motionValue(value));
}
}
function setTarget(visualElement, definition) {
var resolved = resolveVariant(visualElement, definition);
var _a = resolved ? visualElement.makeTargetAnimatable(resolved, false) : {},
_b = _a.transitionEnd,
transitionEnd = _b === void 0 ? {} : _b;
_a.transition;
var target = tslib.__rest(_a, ["transitionEnd", "transition"]);
target = tslib.__assign(tslib.__assign({}, target), transitionEnd);
for (var key in target) {
var value = resolveFinalValueInKeyframes(target[key]);
setMotionValue(visualElement, key, value);
}
}
function setVariants(visualElement, variantLabels) {
var reversedLabels = tslib.__spreadArray([], tslib.__read(variantLabels), false).reverse();
reversedLabels.forEach(function (key) {
var _a;
var variant = visualElement.getVariant(key);
variant && setTarget(visualElement, variant);
(_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
setVariants(child, variantLabels);
});
});
}
function setValues(visualElement, definition) {
if (Array.isArray(definition)) {
return setVariants(visualElement, definition);
} else if (typeof definition === "string") {
return setVariants(visualElement, [definition]);
} else {
setTarget(visualElement, definition);
}
}
function checkTargetForNewValues(visualElement, target, origin) {
var _a, _b, _c;
var _d;
var newValueKeys = Object.keys(target).filter(function (key) {
return !visualElement.hasValue(key);
});
var numNewValues = newValueKeys.length;
if (!numNewValues) return;
for (var i = 0; i < numNewValues; i++) {
var key = newValueKeys[i];
var targetValue = target[key];
var value = null;
/**
* If the target is a series of keyframes, we can use the first value
* in the array. If this first value is null, we'll still need to read from the DOM.
*/
if (Array.isArray(targetValue)) {
value = targetValue[0];
}
/**
* If the target isn't keyframes, or the first keyframe was null, we need to
* first check if an origin value was explicitly defined in the transition as "from",
* if not read the value from the DOM. As an absolute fallback, take the defined target value.
*/
if (value === null) {
value = (_b = (_a = origin[key]) !== null && _a !== void 0 ? _a : visualElement.readValue(key)) !== null && _b !== void 0 ? _b : target[key];
}
/**
* If value is still undefined or null, ignore it. Preferably this would throw,
* but this was causing issues in Framer.
*/
if (value === undefined || value === null) continue;
if (typeof value === "string" && (isNumericalString(value) || isZeroValueString(value))) {
// If this is a number read as a string, ie "0" or "200", convert it to a number
value = parseFloat(value);
} else if (!findValueType(value) && styleValueTypes.complex.test(targetValue)) {
value = getAnimatableNone(key, targetValue);
}
visualElement.addValue(key, motionValue(value));
(_c = (_d = origin)[key]) !== null && _c !== void 0 ? _c : _d[key] = value;
visualElement.setBaseTarget(key, value);
}
}
function getOriginFromTransition(key, transition) {
if (!transition) return;
var valueTransition = transition[key] || transition["default"] || transition;
return valueTransition.from;
}
function getOrigin(target, transition, visualElement) {
var _a, _b;
var origin = {};
for (var key in target) {
origin[key] = (_a = getOriginFromTransition(key, transition)) !== null && _a !== void 0 ? _a : (_b = visualElement.getValue(key)) === null || _b === void 0 ? void 0 : _b.get();
}
return origin;
}
function animateVisualElement(visualElement, definition, options) {
if (options === void 0) {
options = {};
}
visualElement.notifyAnimationStart(definition);
var animation;
if (Array.isArray(definition)) {
var animations = definition.map(function (variant) {
return animateVariant(visualElement, variant, options);
});
animation = Promise.all(animations);
} else if (typeof definition === "string") {
animation = animateVariant(visualElement, definition, options);
} else {
var resolvedDefinition = typeof definition === "function" ? resolveVariant(visualElement, definition, options.custom) : definition;
animation = animateTarget(visualElement, resolvedDefinition, options);
}
return animation.then(function () {
return visualElement.notifyAnimationComplete(definition);
});
}
function animateVariant(visualElement, variant, options) {
var _a;
if (options === void 0) {
options = {};
}
var resolved = resolveVariant(visualElement, variant, options.custom);
var _b = (resolved || {}).transition,
transition = _b === void 0 ? visualElement.getDefaultTransition() || {} : _b;
if (options.transitionOverride) {
transition = options.transitionOverride;
}
/**
* If we have a variant, create a callback that runs it as an animation.
* Otherwise, we resolve a Promise immediately for a composable no-op.
*/
var getAnimation = resolved ? function () {
return animateTarget(visualElement, resolved, options);
} : function () {
return Promise.resolve();
};
/**
* If we have children, create a callback that runs all their animations.
* Otherwise, we resolve a Promise immediately for a composable no-op.
*/
var getChildAnimations = ((_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.size) ? function (forwardDelay) {
if (forwardDelay === void 0) {
forwardDelay = 0;
}
var _a = transition.delayChildren,
delayChildren = _a === void 0 ? 0 : _a,
staggerChildren = transition.staggerChildren,
staggerDirection = transition.staggerDirection;
return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options);
} : function () {
return Promise.resolve();
};
/**
* If the transition explicitly defines a "when" option, we need to resolve either
* this animation or all children animations before playing the other.
*/
var when = transition.when;
if (when) {
var _c = tslib.__read(when === "beforeChildren" ? [getAnimation, getChildAnimations] : [getChildAnimations, getAnimation], 2),
first = _c[0],
last = _c[1];
return first().then(last);
} else {
return Promise.all([getAnimation(), getChildAnimations(options.delay)]);
}
}
/**
* @internal
*/
function animateTarget(visualElement, definition, _a) {
var _b;
var _c = _a === void 0 ? {} : _a,
_d = _c.delay,
delay = _d === void 0 ? 0 : _d,
transitionOverride = _c.transitionOverride,
type = _c.type;
var _e = visualElement.makeTargetAnimatable(definition),
_f = _e.transition,
transition = _f === void 0 ? visualElement.getDefaultTransition() : _f,
transitionEnd = _e.transitionEnd,
target = tslib.__rest(_e, ["transition", "transitionEnd"]);
if (transitionOverride) transition = transitionOverride;
var animations = [];
var animationTypeState = type && ((_b = visualElement.animationState) === null || _b === void 0 ? void 0 : _b.getState()[type]);
for (var key in target) {
var value = visualElement.getValue(key);
var valueTarget = target[key];
if (!value || valueTarget === undefined || animationTypeState && shouldBlockAnimation(animationTypeState, key)) {
continue;
}
var valueTransition = tslib.__assign({
delay: delay
}, transition);
/**
* Make animation instant if this is a transform prop and we should reduce motion.
*/
if (visualElement.shouldReduceMotion && isTransformProp(key)) {
valueTransition = tslib.__assign(tslib.__assign({}, valueTransition), {
type: false,
delay: 0
});
}
var animation = startAnimation(key, value, valueTarget, valueTransition);
animations.push(animation);
}
return Promise.all(animations).then(function () {
transitionEnd && setTarget(visualElement, transitionEnd);
});
}
function animateChildren(visualElement, variant, delayChildren, staggerChildren, staggerDirection, options) {
if (delayChildren === void 0) {
delayChildren = 0;
}
if (staggerChildren === void 0) {
staggerChildren = 0;
}
if (staggerDirection === void 0) {
staggerDirection = 1;
}
var animations = [];
var maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
var generateStaggerDuration = staggerDirection === 1 ? function (i) {
if (i === void 0) {
i = 0;
}
return i * staggerChildren;
} : function (i) {
if (i === void 0) {
i = 0;
}
return maxStaggerDuration - i * staggerChildren;
};
Array.from(visualElement.variantChildren).sort(sortByTreeOrder).forEach(function (child, i) {
animations.push(animateVariant(child, variant, tslib.__assign(tslib.__assign({}, options), {
delay: delayChildren + generateStaggerDuration(i)
})).then(function () {
return child.notifyAnimationComplete(variant);
}));
});
return Promise.all(animations);
}
function stopAnimation(visualElement) {
visualElement.forEachValue(function (value) {
return value.stop();
});
}
function sortByTreeOrder(a, b) {
return a.sortNodePosition(b);
}
/**
* Decide whether we should block this animation. Previously, we achieved this
* just by checking whether the key was listed in protectedKeys, but this
* posed problems if an animation was triggered by afterChildren and protectedKeys
* had been set to true in the meantime.
*/
function shouldBlockAnimation(_a, key) {
var protectedKeys = _a.protectedKeys,
needsAnimating = _a.needsAnimating;
var shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
needsAnimating[key] = false;
return shouldBlock;
}
var variantPriorityOrder = [exports.AnimationType.Animate, exports.AnimationType.InView, exports.AnimationType.Focus, exports.AnimationType.Hover, exports.AnimationType.Tap, exports.AnimationType.Drag, exports.AnimationType.Exit];
var reversePriorityOrder = tslib.__spreadArray([], tslib.__read(variantPriorityOrder), false).reverse();
var numAnimationTypes = variantPriorityOrder.length;
function animateList(visualElement) {
return function (animations) {
return Promise.all(animations.map(function (_a) {
var animation = _a.animation,
options = _a.options;
return animateVisualElement(visualElement, animation, options);
}));
};
}
function createAnimationState(visualElement) {
var animate = animateList(visualElement);
var state = createState();
var allAnimatedKeys = {};
var isInitialRender = true;
/**
* This function will be used to reduce the animation definitions for
* each active animation type into an object of resolved values for it.
*/
var buildResolvedTypeValues = function (acc, definition) {
var resolved = resolveVariant(visualElement, definition);
if (resolved) {
resolved.transition;
var transitionEnd = resolved.transitionEnd,
target = tslib.__rest(resolved, ["transition", "transitionEnd"]);
acc = tslib.__assign(tslib.__assign(tslib.__assign({}, acc), target), transitionEnd);
}
return acc;
};
function isAnimated(key) {
return allAnimatedKeys[key] !== undefined;
}
/**
* This just allows us to inject mocked animation functions
* @internal
*/
function setAnimateFunction(makeAnimator) {
animate = makeAnimator(visualElement);
}
/**
* When we receive new props, we need to:
* 1. Create a list of protected keys for each type. This is a directory of
* value keys that are currently being "handled" by types of a higher priority
* so that whenever an animation is played of a given type, these values are
* protected from being animated.
* 2. Determine if an animation type needs animating.
* 3. Determine if any values have been removed from a type and figure out
* what to animate those to.
*/
function animateChanges(options, changedActiveType) {
var _a;
var props = visualElement.getProps();
var context = visualElement.getVariantContext(true) || {};
/**
* A list of animations that we'll build into as we iterate through the animation
* types. This will get executed at the end of the function.
*/
var animations = [];
/**
* Keep track of which values have been removed. Then, as we hit lower priority
* animation types, we can check if they contain removed values and animate to that.
*/
var removedKeys = new Set();
/**
* A dictionary of all encountered keys. This is an object to let us build into and
* copy it without iteration. Each time we hit an animation type we set its protected
* keys - the keys its not allowed to animate - to the latest version of this object.
*/
var encounteredKeys = {};
/**
* If a variant has been removed at a given index, and this component is controlling
* variant animations, we want to ensure lower-priority variants are forced to animate.
*/
var removedVariantIndex = Infinity;
var _loop_1 = function (i) {
var type = reversePriorityOrder[i];
var typeState = state[type];
var prop = (_a = props[type]) !== null && _a !== void 0 ? _a : context[type];
var propIsVariant = isVariantLabel(prop);
/**
* If this type has *just* changed isActive status, set activeDelta
* to that status. Otherwise set to null.
*/
var activeDelta = type === changedActiveType ? typeState.isActive : null;
if (activeDelta === false) removedVariantIndex = i;
/**
* If this prop is an inherited variant, rather than been set directly on the
* component itself, we want to make sure we allow the parent to trigger animations.
*
* TODO: Can probably change this to a !isControllingVariants check
*/
var isInherited = prop === context[type] && prop !== props[type] && propIsVariant;
/**
*
*/
if (isInherited && isInitialRender && visualElement.manuallyAnimateOnMount) {
isInherited = false;
}
/**
* Set all encountered keys so far as the protected keys for this type. This will
* be any key that has been animated or otherwise handled by active, higher-priortiy types.
*/
typeState.protectedKeys = tslib.__assign({}, encounteredKeys);
// Check if we can skip analysing this prop early
if (
// If it isn't active and hasn't *just* been set as inactive
!typeState.isActive && activeDelta === null ||
// If we didn't and don't have any defined prop for this animation type
!prop && !typeState.prevProp ||
// Or if the prop doesn't define an animation
isAnimationControls(prop) || typeof prop === "boolean") {
return "continue";
}
/**
* As we go look through the values defined on this type, if we detect
* a changed value or a value that was removed in a higher priority, we set
* this to true and add this prop to the animation list.
*/
var variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
var shouldAnimateType = variantDidChange ||
// If we're making this variant active, we want to always make it active
type === changedActiveType && typeState.isActive && !isInherited && propIsVariant ||
// If we removed a higher-priority variant (i is in reverse order)
i > removedVariantIndex && propIsVariant;
/**
* As animations can be set as variant lists, variants or target objects, we
* coerce everything to an array if it isn't one already
*/
var definitionList = Array.isArray(prop) ? prop : [prop];
/**
* Build an object of all the resolved values. We'll use this in the subsequent
* animateChanges calls to determine whether a value has changed.
*/
var resolvedValues = definitionList.reduce(buildResolvedTypeValues, {});
if (activeDelta === false) resolvedValues = {};
/**
* Now we need to loop through all the keys in the prev prop and this prop,
* and decide:
* 1. If the value has changed, and needs animating
* 2. If it has been removed, and needs adding to the removedKeys set
* 3. If it has been removed in a higher priority type and needs animating
* 4. If it hasn't been removed in a higher priority but hasn't changed, and
* needs adding to the type's protectedKeys list.
*/
var _b = typeState.prevResolvedValues,
prevResolvedValues = _b === void 0 ? {} : _b;
var allKeys = tslib.__assign(tslib.__assign({}, prevResolvedValues), resolvedValues);
var markToAnimate = function (key) {
shouldAnimateType = true;
removedKeys.delete(key);
typeState.needsAnimating[key] = true;
};
for (var key in allKeys) {
var next = resolvedValues[key];
var prev = prevResolvedValues[key];
// If we've already handled this we can just skip ahead
if (encounteredKeys.hasOwnProperty(key)) continue;
/**
* If the value has changed, we probably want to animate it.
*/
if (next !== prev) {
/**
* If both values are keyframes, we need to shallow compare them to
* detect whether any value has changed. If it has, we animate it.
*/
if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
if (!shallowCompare(next, prev) || variantDidChange) {
markToAnimate(key);
} else {
/**
* If it hasn't changed, we want to ensure it doesn't animate by
* adding it to the list of protected keys.
*/
typeState.protectedKeys[key] = true;
}
} else if (next !== undefined) {
// If next is defined and doesn't equal prev, it needs animating
markToAnimate(key);
} else {
// If it's undefined, it's been removed.
removedKeys.add(key);
}
} else if (next !== undefined && removedKeys.has(key)) {
/**
* If next hasn't changed and it isn't undefined, we want to check if it's
* been removed by a higher priority
*/
markToAnimate(key);
} else {
/**
* If it hasn't changed, we add it to the list of protected values
* to ensure it doesn't get animated.
*/
typeState.protectedKeys[key] = true;
}
}
/**
* Update the typeState so next time animateChanges is called we can compare the
* latest prop and resolvedValues to these.
*/
typeState.prevProp = prop;
typeState.prevResolvedValues = resolvedValues;
/**
*
*/
if (typeState.isActive) {
encounteredKeys = tslib.__assign(tslib.__assign({}, encounteredKeys), resolvedValues);
}
if (isInitialRender && visualElement.blockInitialAnimation) {
shouldAnimateType = false;
}
/**
* If this is an inherited prop we want to hard-block animations
* TODO: Test as this should probably still handle animations triggered
* by removed values?
*/
if (shouldAnimateType && !isInherited) {
animations.push.apply(animations, tslib.__spreadArray([], tslib.__read(definitionList.map(function (animation) {
return {
animation: animation,
options: tslib.__assign({
type: type
}, options)
};
})), false));
}
};
/**
* Iterate through all animation types in reverse priority order. For each, we want to
* detect which values it's handling and whether or not they've changed (and therefore
* need to be animated). If any values have been removed, we want to detect those in
* lower priority props and flag for animation.
*/
for (var i = 0; i < numAnimationTypes; i++) {
_loop_1(i);
}
allAnimatedKeys = tslib.__assign({}, encounteredKeys);
/**
* If there are some removed value that haven't been dealt with,
* we need to create a new animation that falls back either to the value
* defined in the style prop, or the last read value.
*/
if (removedKeys.size) {
var fallbackAnimation_1 = {};
removedKeys.forEach(function (key) {
var fallbackTarget = visualElement.getBaseTarget(key);
if (fallbackTarget !== undefined) {
fallbackAnimation_1[key] = fallbackTarget;
}
});
animations.push({
animation: fallbackAnimation_1
});
}
var shouldAnimate = Boolean(animations.length);
if (isInitialRender && props.initial === false && !visualElement.manuallyAnimateOnMount) {
shouldAnimate = false;
}
isInitialRender = false;
return shouldAnimate ? animate(animations) : Promise.resolve();
}
/**
* Change whether a certain animation type is active.
*/
function setActive(type, isActive, options) {
var _a;
// If the active state hasn't changed, we can safely do nothing here
if (state[type].isActive === isActive) return Promise.resolve();
// Propagate active change to children
(_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
var _a;
return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive);
});
state[type].isActive = isActive;
var animations = animateChanges(options, type);
for (var key in state) {
state[key].protectedKeys = {};
}
return animations;
}
return {
isAnimated: isAnimated,
animateChanges: animateChanges,
setActive: setActive,
setAnimateFunction: setAnimateFunction,
getState: function () {
return state;
}
};
}
function checkVariantsDidChange(prev, next) {
if (typeof next === "string") {
return next !== prev;
} else if (isVariantLabels(next)) {
return !shallowCompare(next, prev);
}
return false;
}
function createTypeState(isActive) {
if (isActive === void 0) {
isActive = false;
}
return {
isActive: isActive,
protectedKeys: {},
needsAnimating: {},
prevResolvedValues: {}
};
}
function createState() {
var _a;
return _a = {}, _a[exports.AnimationType.Animate] = createTypeState(true), _a[exports.AnimationType.InView] = createTypeState(), _a[exports.AnimationType.Hover] = createTypeState(), _a[exports.AnimationType.Tap] = createTypeState(), _a[exports.AnimationType.Drag] = createTypeState(), _a[exports.AnimationType.Focus] = createTypeState(), _a[exports.AnimationType.Exit] = createTypeState(), _a;
}
var animations = {
animation: makeRenderlessComponent(function (_a) {
var visualElement = _a.visualElement,
animate = _a.animate;
/**
* We dynamically generate the AnimationState manager as it contains a reference
* to the underlying animation library. We only want to load that if we load this,
* so people can optionally code split it out using the `m` component.
*/
visualElement.animationState || (visualElement.animationState = createAnimationState(visualElement));
/**
* Subscribe any provided AnimationControls to the component's VisualElement
*/
if (isAnimationControls(animate)) {
React.useEffect(function () {
return animate.subscribe(visualElement);
}, [animate]);
}
}),
exit: makeRenderlessComponent(function (props) {
var custom = props.custom,
visualElement = props.visualElement;
var _a = tslib.__read(usePresence(), 2),
isPresent = _a[0],
safeToRemove = _a[1];
var presenceContext = React.useContext(PresenceContext);
React.useEffect(function () {
var _a, _b;
visualElement.isPresent = isPresent;
var animation = (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(exports.AnimationType.Exit, !isPresent, {
custom: (_b = presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.custom) !== null && _b !== void 0 ? _b : custom
});
!isPresent && (animation === null || animation === void 0 ? void 0 : animation.then(safeToRemove));
}, [isPresent]);
})
};
/**
* @internal
*/
var PanSession = /** @class */function () {
function PanSession(event, handlers, _a) {
var _this = this;
var _b = _a === void 0 ? {} : _a,
transformPagePoint = _b.transformPagePoint;
/**
* @internal
*/
this.startEvent = null;
/**
* @internal
*/
this.lastMoveEvent = null;
/**
* @internal
*/
this.lastMoveEventInfo = null;
/**
* @internal
*/
this.handlers = {};
this.updatePoint = function () {
if (!(_this.lastMoveEvent && _this.lastMoveEventInfo)) return;
var info = getPanInfo(_this.lastMoveEventInfo, _this.history);
var isPanStarted = _this.startEvent !== null;
// Only start panning if the offset is larger than 3 pixels. If we make it
// any larger than this we'll want to reset the pointer history
// on the first update to avoid visual snapping to the cursoe.
var isDistancePastThreshold = popmotion.distance(info.offset, {
x: 0,
y: 0
}) >= 3;
if (!isPanStarted && !isDistancePastThreshold) return;
var point = info.point;
var timestamp = sync.getFrameData().timestamp;
_this.history.push(tslib.__assign(tslib.__assign({}, point), {
timestamp: timestamp
}));
var _a = _this.handlers,
onStart = _a.onStart,
onMove = _a.onMove;
if (!isPanStarted) {
onStart && onStart(_this.lastMoveEvent, info);
_this.startEvent = _this.lastMoveEvent;
}
onMove && onMove(_this.lastMoveEvent, info);
};
this.handlePointerMove = function (event, info) {
_this.lastMoveEvent = event;
_this.lastMoveEventInfo = transformPoint(info, _this.transformPagePoint);
// Because Safari doesn't trigger mouseup events when it's above a `