/******/ (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 ` ' + e.phrase("(Use line:column or scroll% syntax)") + ""; } c(i, "getJumpDialog"); function a(e, t) { var n = Number(t); return /^[-+]/.test(t) ? e.getCursor().line + n : n - 1; } c(a, "interpretLine"), o.commands.jumpToLine = function (e) { var t = e.getCursor(); s(e, i(e), e.phrase("Jump to line:"), t.line + 1 + ":" + t.ch, function (n) { if (n) { var r; if (r = /^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(n)) e.setCursor(a(e, r[1]), Number(r[2]));else if (r = /^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(n)) { var l = Math.round(e.lineCount() * Number(r[1]) / 100); /^[-+]/.test(r[1]) && (l = t.line + l + 1), e.setCursor(l - 1, t.ch); } else (r = /^\s*\:?\s*([\+\-]?\d+)\s*/.exec(n)) && e.setCursor(a(e, r[1]), t.ch); } }); }, o.keyMap.default["Alt-G"] = "jumpToLine"; }); })(); var d = b.exports; const j = f.getDefaultExportFromCjs(d), y = h({ __proto__: null, default: j }, [d]); exports.jumpToLine = y; /***/ }), /***/ "../../graphiql-react/dist/jump.cjs.js": /*!*********************************************!*\ !*** ../../graphiql-react/dist/jump.cjs.js ***! \*********************************************/ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { var c = Object.defineProperty; var s = (e, r) => c(e, "name", { value: r, configurable: !0 }); const u = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"), d = __webpack_require__(/*! ./SchemaReference.cjs.js */ "../../graphiql-react/dist/SchemaReference.cjs.js"); __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"); __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); __webpack_require__(/*! ./forEachState.cjs.js */ "../../graphiql-react/dist/forEachState.cjs.js"); u.CodeMirror.defineOption("jump", !1, (e, r, n) => { if (n && n !== u.CodeMirror.Init) { const t = e.state.jump.onMouseOver; u.CodeMirror.off(e.getWrapperElement(), "mouseover", t); const i = e.state.jump.onMouseOut; u.CodeMirror.off(e.getWrapperElement(), "mouseout", i), u.CodeMirror.off(document, "keydown", e.state.jump.onKeyDown), delete e.state.jump; } if (r) { const t = e.state.jump = { options: r, onMouseOver: M.bind(null, e), onMouseOut: m.bind(null, e), onKeyDown: g.bind(null, e) }; u.CodeMirror.on(e.getWrapperElement(), "mouseover", t.onMouseOver), u.CodeMirror.on(e.getWrapperElement(), "mouseout", t.onMouseOut), u.CodeMirror.on(document, "keydown", t.onKeyDown); } }); function M(e, r) { const n = r.target || r.srcElement; if (!(n instanceof HTMLElement) || (n == null ? void 0 : n.nodeName) !== "SPAN") return; const t = n.getBoundingClientRect(), i = { left: (t.left + t.right) / 2, top: (t.top + t.bottom) / 2 }; e.state.jump.cursor = i, e.state.jump.isHoldingModifier && l(e); } s(M, "onMouseOver"); function m(e) { if (!e.state.jump.isHoldingModifier && e.state.jump.cursor) { e.state.jump.cursor = null; return; } e.state.jump.isHoldingModifier && e.state.jump.marker && p(e); } s(m, "onMouseOut"); function g(e, r) { if (e.state.jump.isHoldingModifier || !k(r.key)) return; e.state.jump.isHoldingModifier = !0, e.state.jump.cursor && l(e); const n = s(o => { o.code === r.code && (e.state.jump.isHoldingModifier = !1, e.state.jump.marker && p(e), u.CodeMirror.off(document, "keyup", n), u.CodeMirror.off(document, "click", t), e.off("mousedown", i)); }, "onKeyUp"), t = s(o => { const { destination: a, options: f } = e.state.jump; a && f.onClick(a, o); }, "onClick"), i = s((o, a) => { e.state.jump.destination && (a.codemirrorIgnore = !0); }, "onMouseDown"); u.CodeMirror.on(document, "keyup", n), u.CodeMirror.on(document, "click", t), e.on("mousedown", i); } s(g, "onKeyDown"); const j = typeof navigator < "u" && navigator && navigator.appVersion.includes("Mac"); function k(e) { return e === (j ? "Meta" : "Control"); } s(k, "isJumpModifier"); function l(e) { if (e.state.jump.marker) return; const { cursor: r, options: n } = e.state.jump, t = e.coordsChar(r), i = e.getTokenAt(t, !0), o = n.getDestination || e.getHelper(t, "jump"); if (o) { const a = o(i, n, e); if (a) { const f = e.markText({ line: t.line, ch: i.start }, { line: t.line, ch: i.end }, { className: "CodeMirror-jump-token" }); e.state.jump.marker = f, e.state.jump.destination = a; } } } s(l, "enableJumpMode"); function p(e) { const { marker: r } = e.state.jump; e.state.jump.marker = null, e.state.jump.destination = null, r.clear(); } s(p, "disableJumpMode"); u.CodeMirror.registerHelper("jump", "graphql", (e, r) => { if (!r.schema || !r.onClick || !e.state) return; const { state: n } = e, { kind: t, step: i } = n, o = d.getTypeInfo(r.schema, n); if (t === "Field" && i === 0 && o.fieldDef || t === "AliasedField" && i === 2 && o.fieldDef) return d.getFieldReference(o); if (t === "Directive" && i === 1 && o.directiveDef) return d.getDirectiveReference(o); if (t === "Argument" && i === 0 && o.argDef) return d.getArgumentReference(o); if (t === "EnumValue" && o.enumValue) return d.getEnumValueReference(o); if (t === "NamedType" && o.type) return d.getTypeReference(o); }); /***/ }), /***/ "../../graphiql-react/dist/lint.cjs.js": /*!*********************************************!*\ !*** ../../graphiql-react/dist/lint.cjs.js ***! \*********************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { var W = Object.defineProperty; var s = (h, v) => W(h, "name", { value: v, configurable: !0 }); const x = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"); function q(h, v) { for (var l = 0; l < v.length; l++) { const u = v[l]; if (typeof u != "string" && !Array.isArray(u)) { for (const g in u) if (g !== "default" && !(g in h)) { const c = Object.getOwnPropertyDescriptor(u, g); c && Object.defineProperty(h, g, c.get ? c : { enumerable: !0, get: () => u[g] }); } } } return Object.freeze(Object.defineProperty(h, Symbol.toStringTag, { value: "Module" })); } s(q, "_mergeNamespaces"); var B = { exports: {} }; (function (h, v) { (function (l) { l(x.requireCodemirror()); })(function (l) { var u = "CodeMirror-lint-markers", g = "CodeMirror-lint-line-"; function c(t, e, r) { var n = document.createElement("div"); n.className = "CodeMirror-lint-tooltip cm-s-" + t.options.theme, n.appendChild(r.cloneNode(!0)), t.state.lint.options.selfContain ? t.getWrapperElement().appendChild(n) : document.body.appendChild(n); function i(o) { if (!n.parentNode) return l.off(document, "mousemove", i); n.style.top = Math.max(0, o.clientY - n.offsetHeight - 5) + "px", n.style.left = o.clientX + 5 + "px"; } return s(i, "position"), l.on(document, "mousemove", i), i(e), n.style.opacity != null && (n.style.opacity = 1), n; } s(c, "showTooltip"); function L(t) { t.parentNode && t.parentNode.removeChild(t); } s(L, "rm"); function A(t) { t.parentNode && (t.style.opacity == null && L(t), t.style.opacity = 0, setTimeout(function () { L(t); }, 600)); } s(A, "hideTooltip"); function M(t, e, r, n) { var i = c(t, e, r); function o() { l.off(n, "mouseout", o), i && (A(i), i = null); } s(o, "hide"); var a = setInterval(function () { if (i) for (var f = n;; f = f.parentNode) { if (f && f.nodeType == 11 && (f = f.host), f == document.body) return; if (!f) { o(); break; } } if (!i) return clearInterval(a); }, 400); l.on(n, "mouseout", o); } s(M, "showTooltipFor"); function F(t, e, r) { this.marked = [], e instanceof Function && (e = { getAnnotations: e }), (!e || e === !0) && (e = {}), this.options = {}, this.linterOptions = e.options || {}; for (var n in C) this.options[n] = C[n]; for (var n in e) C.hasOwnProperty(n) ? e[n] != null && (this.options[n] = e[n]) : e.options || (this.linterOptions[n] = e[n]); this.timeout = null, this.hasGutter = r, this.onMouseOver = function (i) { U(t, i); }, this.waitingFor = 0; } s(F, "LintState"); var C = { highlightLines: !1, tooltips: !0, delay: 500, lintOnChange: !0, getAnnotations: null, async: !1, selfContain: null, formatAnnotation: null, onUpdateLinting: null }; function E(t) { var e = t.state.lint; e.hasGutter && t.clearGutter(u), e.options.highlightLines && G(t); for (var r = 0; r < e.marked.length; ++r) e.marked[r].clear(); e.marked.length = 0; } s(E, "clearMarks"); function G(t) { t.eachLine(function (e) { var r = e.wrapClass && /\bCodeMirror-lint-line-\w+\b/.exec(e.wrapClass); r && t.removeLineClass(e, "wrap", r[0]); }); } s(G, "clearErrorLines"); function I(t, e, r, n, i) { var o = document.createElement("div"), a = o; return o.className = "CodeMirror-lint-marker CodeMirror-lint-marker-" + r, n && (a = o.appendChild(document.createElement("div")), a.className = "CodeMirror-lint-marker CodeMirror-lint-marker-multiple"), i != !1 && l.on(a, "mouseover", function (f) { M(t, f, e, a); }), o; } s(I, "makeMarker"); function D(t, e) { return t == "error" ? t : e; } s(D, "getMaxSeverity"); function j(t) { for (var e = [], r = 0; r < t.length; ++r) { var n = t[r], i = n.from.line; (e[i] || (e[i] = [])).push(n); } return e; } s(j, "groupByLine"); function N(t) { var e = t.severity; e || (e = "error"); var r = document.createElement("div"); return r.className = "CodeMirror-lint-message CodeMirror-lint-message-" + e, typeof t.messageHTML < "u" ? r.innerHTML = t.messageHTML : r.appendChild(document.createTextNode(t.message)), r; } s(N, "annotationTooltip"); function H(t, e) { var r = t.state.lint, n = ++r.waitingFor; function i() { n = -1, t.off("change", i); } s(i, "abort"), t.on("change", i), e(t.getValue(), function (o, a) { t.off("change", i), r.waitingFor == n && (a && o instanceof l && (o = a), t.operation(function () { O(t, o); })); }, r.linterOptions, t); } s(H, "lintAsync"); function k(t) { var e = t.state.lint; if (e) { var r = e.options, n = r.getAnnotations || t.getHelper(l.Pos(0, 0), "lint"); if (n) if (r.async || n.async) H(t, n);else { var i = n(t.getValue(), e.linterOptions, t); if (!i) return; i.then ? i.then(function (o) { t.operation(function () { O(t, o); }); }) : t.operation(function () { O(t, i); }); } } } s(k, "startLinting"); function O(t, e) { var r = t.state.lint; if (r) { var n = r.options; E(t); for (var i = j(e), o = 0; o < i.length; ++o) { var a = i[o]; if (a) { var f = []; a = a.filter(function (w) { return f.indexOf(w.message) > -1 ? !1 : f.push(w.message); }); for (var p = null, m = r.hasGutter && document.createDocumentFragment(), T = 0; T < a.length; ++T) { var d = a[T], y = d.severity; y || (y = "error"), p = D(p, y), n.formatAnnotation && (d = n.formatAnnotation(d)), r.hasGutter && m.appendChild(N(d)), d.to && r.marked.push(t.markText(d.from, d.to, { className: "CodeMirror-lint-mark CodeMirror-lint-mark-" + y, __annotation: d })); } r.hasGutter && t.setGutterMarker(o, u, I(t, m, p, i[o].length > 1, n.tooltips)), n.highlightLines && t.addLineClass(o, "wrap", g + p); } } n.onUpdateLinting && n.onUpdateLinting(e, i, t); } } s(O, "updateLinting"); function b(t) { var e = t.state.lint; e && (clearTimeout(e.timeout), e.timeout = setTimeout(function () { k(t); }, e.options.delay)); } s(b, "onChange"); function P(t, e, r) { for (var n = r.target || r.srcElement, i = document.createDocumentFragment(), o = 0; o < e.length; o++) { var a = e[o]; i.appendChild(N(a)); } M(t, r, i, n); } s(P, "popupTooltips"); function U(t, e) { var r = e.target || e.srcElement; if (/\bCodeMirror-lint-mark-/.test(r.className)) { for (var n = r.getBoundingClientRect(), i = (n.left + n.right) / 2, o = (n.top + n.bottom) / 2, a = t.findMarksAt(t.coordsChar({ left: i, top: o }, "client")), f = [], p = 0; p < a.length; ++p) { var m = a[p].__annotation; m && f.push(m); } f.length && P(t, f, e); } } s(U, "onMouseOver"), l.defineOption("lint", !1, function (t, e, r) { if (r && r != l.Init && (E(t), t.state.lint.options.lintOnChange !== !1 && t.off("change", b), l.off(t.getWrapperElement(), "mouseover", t.state.lint.onMouseOver), clearTimeout(t.state.lint.timeout), delete t.state.lint), e) { for (var n = t.getOption("gutters"), i = !1, o = 0; o < n.length; ++o) n[o] == u && (i = !0); var a = t.state.lint = new F(t, e, i); a.options.lintOnChange && t.on("change", b), a.options.tooltips != !1 && a.options.tooltips != "gutter" && l.on(t.getWrapperElement(), "mouseover", a.onMouseOver), k(t); } }), l.defineExtension("performLint", function () { k(this); }); }); })(); var _ = B.exports; const R = x.getDefaultExportFromCjs(_), V = q({ __proto__: null, default: R }, [_]); exports.lint = V; /***/ }), /***/ "../../graphiql-react/dist/lint.cjs2.js": /*!**********************************************!*\ !*** ../../graphiql-react/dist/lint.cjs2.js ***! \**********************************************/ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { const t = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"), c = __webpack_require__(/*! graphql-language-service */ "../../graphql-language-service/esm/index.js"); __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"); const a = ["error", "warning", "information", "hint"], g = { "GraphQL: Validation": "validation", "GraphQL: Deprecation": "deprecation", "GraphQL: Syntax": "syntax" }; t.CodeMirror.registerHelper("lint", "graphql", (n, s) => { const { schema: r, validationRules: i, externalFragments: o } = s; return c.getDiagnostics(n, r, i, void 0, o).map(e => ({ message: e.message, severity: e.severity ? a[e.severity - 1] : a[0], type: e.source ? g[e.source] : void 0, from: t.CodeMirror.Pos(e.range.start.line, e.range.start.character), to: t.CodeMirror.Pos(e.range.end.line, e.range.end.character) })); }); /***/ }), /***/ "../../graphiql-react/dist/lint.cjs3.js": /*!**********************************************!*\ !*** ../../graphiql-react/dist/lint.cjs3.js ***! \**********************************************/ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { var V = Object.defineProperty; var t = (e, n) => V(e, "name", { value: n, configurable: !0 }); const I = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"), b = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"); function C(e) { d = e, E = e.length, s = u = N = -1, o(), y(); const n = q(); return p("EOF"), n; } t(C, "jsonParse"); let d, E, s, u, N, r, l; function q() { const e = s, n = []; if (p("{"), !x("}")) { do n.push(M()); while (x(",")); p("}"); } return { kind: "Object", start: e, end: N, members: n }; } t(q, "parseObj"); function M() { const e = s, n = l === "String" ? G() : null; p("String"), p(":"); const i = B(); return { kind: "Member", start: e, end: N, key: n, value: i }; } t(M, "parseMember"); function v() { const e = s, n = []; if (p("["), !x("]")) { do n.push(B()); while (x(",")); p("]"); } return { kind: "Array", start: e, end: N, values: n }; } t(v, "parseArr"); function B() { switch (l) { case "[": return v(); case "{": return q(); case "String": case "Number": case "Boolean": case "Null": const e = G(); return y(), e; } p("Value"); } t(B, "parseVal"); function G() { return { kind: l, start: s, end: u, value: JSON.parse(d.slice(s, u)) }; } t(G, "curToken"); function p(e) { if (l === e) { y(); return; } let n; if (l === "EOF") n = "[end of file]";else if (u - s > 1) n = "`" + d.slice(s, u) + "`";else { const i = d.slice(s).match(/^.+?\b/); n = "`" + (i ? i[0] : d[s]) + "`"; } throw k(`Expected ${e} but found ${n}.`); } t(p, "expect"); class j extends Error { constructor(n, i) { super(n), this.position = i; } } t(j, "JSONSyntaxError"); function k(e) { return new j(e, { start: s, end: u }); } t(k, "syntaxError"); function x(e) { if (l === e) return y(), !0; } t(x, "skip"); function o() { return u < E && (u++, r = u === E ? 0 : d.charCodeAt(u)), r; } t(o, "ch"); function y() { for (N = u; r === 9 || r === 10 || r === 13 || r === 32;) o(); if (r === 0) { l = "EOF"; return; } switch (s = u, r) { case 34: return l = "String", D(); case 45: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: return l = "Number", H(); case 102: if (d.slice(s, s + 5) !== "false") break; u += 4, o(), l = "Boolean"; return; case 110: if (d.slice(s, s + 4) !== "null") break; u += 3, o(), l = "Null"; return; case 116: if (d.slice(s, s + 4) !== "true") break; u += 3, o(), l = "Boolean"; return; } l = d[s], o(); } t(y, "lex"); function D() { for (o(); r !== 34 && r > 31;) if (r === 92) switch (r = o(), r) { case 34: case 47: case 92: case 98: case 102: case 110: case 114: case 116: o(); break; case 117: o(), w(), w(), w(), w(); break; default: throw k("Bad character escape sequence."); } else { if (u === E) throw k("Unterminated string."); o(); } if (r === 34) { o(); return; } throw k("Unterminated string."); } t(D, "readString"); function w() { if (r >= 48 && r <= 57 || r >= 65 && r <= 70 || r >= 97 && r <= 102) return o(); throw k("Expected hexadecimal digit."); } t(w, "readHex"); function H() { r === 45 && o(), r === 48 ? o() : $(), r === 46 && (o(), $()), (r === 69 || r === 101) && (r = o(), (r === 43 || r === 45) && o(), $()); } t(H, "readNumber"); function $() { if (r < 48 || r > 57) throw k("Expected decimal digit."); do o(); while (r >= 48 && r <= 57); } t($, "readDigits"); I.CodeMirror.registerHelper("lint", "graphql-variables", (e, n, i) => { if (!e) return []; let f; try { f = C(e); } catch (c) { if (c instanceof j) return [F(i, c.position, c.message)]; throw c; } const { variableToType: a } = n; return a ? U(i, a, f) : []; }); function U(e, n, i) { var f; const a = []; for (const c of i.members) if (c) { const h = (f = c.key) === null || f === void 0 ? void 0 : f.value, m = n[h]; if (m) for (const [O, Q] of g(m, c.value)) a.push(F(e, O, Q));else a.push(F(e, c.key, `Variable "$${h}" does not appear in any GraphQL query.`)); } return a; } t(U, "validateVariables"); function g(e, n) { if (!e || !n) return []; if (e instanceof b.GraphQLNonNull) return n.kind === "Null" ? [[n, `Type "${e}" is non-nullable and cannot be null.`]] : g(e.ofType, n); if (n.kind === "Null") return []; if (e instanceof b.GraphQLList) { const i = e.ofType; if (n.kind === "Array") { const f = n.values || []; return L(f, a => g(i, a)); } return g(i, n); } if (e instanceof b.GraphQLInputObjectType) { if (n.kind !== "Object") return [[n, `Type "${e}" must be an Object.`]]; const i = Object.create(null), f = L(n.members, a => { var c; const h = (c = a == null ? void 0 : a.key) === null || c === void 0 ? void 0 : c.value; i[h] = !0; const m = e.getFields()[h]; if (!m) return [[a.key, `Type "${e}" does not have a field "${h}".`]]; const O = m ? m.type : void 0; return g(O, a.value); }); for (const a of Object.keys(e.getFields())) { const c = e.getFields()[a]; !i[a] && c.type instanceof b.GraphQLNonNull && !c.defaultValue && f.push([n, `Object of type "${e}" is missing required field "${a}".`]); } return f; } return e.name === "Boolean" && n.kind !== "Boolean" || e.name === "String" && n.kind !== "String" || e.name === "ID" && n.kind !== "Number" && n.kind !== "String" || e.name === "Float" && n.kind !== "Number" || e.name === "Int" && (n.kind !== "Number" || (n.value | 0) !== n.value) ? [[n, `Expected value of type "${e}".`]] : (e instanceof b.GraphQLEnumType || e instanceof b.GraphQLScalarType) && (n.kind !== "String" && n.kind !== "Number" && n.kind !== "Boolean" && n.kind !== "Null" || _(e.parseValue(n.value))) ? [[n, `Expected value of type "${e}".`]] : []; } t(g, "validateValue"); function F(e, n, i) { return { message: i, severity: "error", type: "validation", from: e.posFromIndex(n.start), to: e.posFromIndex(n.end) }; } t(F, "lintError"); function _(e) { return e == null || e !== e; } t(_, "isNullish"); function L(e, n) { return Array.prototype.concat.apply([], e.map(n)); } t(L, "mapCat"); /***/ }), /***/ "../../graphiql-react/dist/matchbrackets.cjs.js": /*!******************************************************!*\ !*** ../../graphiql-react/dist/matchbrackets.cjs.js ***! \******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { var i = Object.defineProperty; var s = (e, c) => i(e, "name", { value: c, configurable: !0 }); const u = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"), f = __webpack_require__(/*! ./matchbrackets.cjs2.js */ "../../graphiql-react/dist/matchbrackets.cjs2.js"); function b(e, c) { for (var o = 0; o < c.length; o++) { const t = c[o]; if (typeof t != "string" && !Array.isArray(t)) { for (const r in t) if (r !== "default" && !(r in e)) { const a = Object.getOwnPropertyDescriptor(t, r); a && Object.defineProperty(e, r, a.get ? a : { enumerable: !0, get: () => t[r] }); } } } return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" })); } s(b, "_mergeNamespaces"); var n = f.requireMatchbrackets(); const l = u.getDefaultExportFromCjs(n), m = b({ __proto__: null, default: l }, [n]); exports.matchbrackets = m; /***/ }), /***/ "../../graphiql-react/dist/matchbrackets.cjs2.js": /*!*******************************************************!*\ !*** ../../graphiql-react/dist/matchbrackets.cjs2.js ***! \*******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { var R = Object.defineProperty; var f = (L, y) => R(L, "name", { value: y, configurable: !0 }); const F = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"); var T = { exports: {} }, E; function I() { return E || (E = 1, function (L, y) { (function (o) { o(F.requireCodemirror()); })(function (o) { var S = /MSIE \d/.test(navigator.userAgent) && (document.documentMode == null || document.documentMode < 8), g = o.Pos, B = { "(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<", "<": ">>", ">": "<<" }; function A(t) { return t && t.bracketRegex || /[(){}[\]]/; } f(A, "bracketRegex"); function b(t, r, e) { var s = t.getLineHandle(r.line), n = r.ch - 1, h = e && e.afterCursor; h == null && (h = /(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className)); var l = A(e), u = !h && n >= 0 && l.test(s.text.charAt(n)) && B[s.text.charAt(n)] || l.test(s.text.charAt(n + 1)) && B[s.text.charAt(++n)]; if (!u) return null; var a = u.charAt(1) == ">" ? 1 : -1; if (e && e.strict && a > 0 != (n == r.ch)) return null; var k = t.getTokenTypeAt(g(r.line, n + 1)), i = H(t, g(r.line, n + (a > 0 ? 1 : 0)), a, k, e); return i == null ? null : { from: g(r.line, n), to: i && i.pos, match: i && i.ch == u.charAt(0), forward: a > 0 }; } f(b, "findMatchingBracket"); function H(t, r, e, s, n) { for (var h = n && n.maxScanLineLength || 1e4, l = n && n.maxScanLines || 1e3, u = [], a = A(n), k = e > 0 ? Math.min(r.line + l, t.lastLine() + 1) : Math.max(t.firstLine() - 1, r.line - l), i = r.line; i != k; i += e) { var c = t.getLine(i); if (c) { var v = e > 0 ? 0 : c.length - 1, q = e > 0 ? c.length : -1; if (!(c.length > h)) for (i == r.line && (v = r.ch - (e < 0 ? 1 : 0)); v != q; v += e) { var d = c.charAt(v); if (a.test(d) && (s === void 0 || (t.getTokenTypeAt(g(i, v + 1)) || "") == (s || ""))) { var m = B[d]; if (m && m.charAt(1) == ">" == e > 0) u.push(d);else if (u.length) u.pop();else return { pos: g(i, v), ch: d }; } } } } return i - e == (e > 0 ? t.lastLine() : t.firstLine()) ? !1 : null; } f(H, "scanForBracket"); function M(t, r, e) { for (var s = t.state.matchBrackets.maxHighlightLineLength || 1e3, n = e && e.highlightNonMatching, h = [], l = t.listSelections(), u = 0; u < l.length; u++) { var a = l[u].empty() && b(t, l[u].head, e); if (a && (a.match || n !== !1) && t.getLine(a.from.line).length <= s) { var k = a.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; h.push(t.markText(a.from, g(a.from.line, a.from.ch + 1), { className: k })), a.to && t.getLine(a.to.line).length <= s && h.push(t.markText(a.to, g(a.to.line, a.to.ch + 1), { className: k })); } } if (h.length) { S && t.state.focused && t.focus(); var i = f(function () { t.operation(function () { for (var c = 0; c < h.length; c++) h[c].clear(); }); }, "clear"); if (r) setTimeout(i, 800);else return i; } } f(M, "matchBrackets"); function x(t) { t.operation(function () { t.state.matchBrackets.currentlyHighlighted && (t.state.matchBrackets.currentlyHighlighted(), t.state.matchBrackets.currentlyHighlighted = null), t.state.matchBrackets.currentlyHighlighted = M(t, !1, t.state.matchBrackets); }); } f(x, "doMatchBrackets"); function p(t) { t.state.matchBrackets && t.state.matchBrackets.currentlyHighlighted && (t.state.matchBrackets.currentlyHighlighted(), t.state.matchBrackets.currentlyHighlighted = null); } f(p, "clearHighlighted"), o.defineOption("matchBrackets", !1, function (t, r, e) { e && e != o.Init && (t.off("cursorActivity", x), t.off("focus", x), t.off("blur", p), p(t)), r && (t.state.matchBrackets = typeof r == "object" ? r : {}, t.on("cursorActivity", x), t.on("focus", x), t.on("blur", p)); }), o.defineExtension("matchBrackets", function () { M(this, !0); }), o.defineExtension("findMatchingBracket", function (t, r, e) { return (e || typeof r == "boolean") && (e ? (e.strict = r, r = e) : r = r ? { strict: !0 } : null), b(this, t, r); }), o.defineExtension("scanForBracket", function (t, r, e, s) { return H(this, t, r, e, s); }); }); }()), T.exports; } f(I, "requireMatchbrackets"); exports.requireMatchbrackets = I; /***/ }), /***/ "../../graphiql-react/dist/mode-indent.cjs.js": /*!****************************************************!*\ !*** ../../graphiql-react/dist/mode-indent.cjs.js ***! \****************************************************/ /***/ (function(__unused_webpack_module, exports) { var o = Object.defineProperty; var v = (n, t) => o(n, "name", { value: t, configurable: !0 }); function s(n, t) { var e, i; const { levels: l, indentLevel: d } = n; return ((!l || l.length === 0 ? d : l.at(-1) - (!((e = this.electricInput) === null || e === void 0) && e.test(t) ? 1 : 0)) || 0) * (((i = this.config) === null || i === void 0 ? void 0 : i.indentUnit) || 0); } v(s, "indent"); exports.indent = s; /***/ }), /***/ "../../graphiql-react/dist/mode.cjs.js": /*!*********************************************!*\ !*** ../../graphiql-react/dist/mode.cjs.js ***! \*********************************************/ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { var n = Object.defineProperty; var s = (e, r) => n(e, "name", { value: r, configurable: !0 }); const o = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"), t = __webpack_require__(/*! graphql-language-service */ "../../graphql-language-service/esm/index.js"), i = __webpack_require__(/*! ./mode-indent.cjs.js */ "../../graphiql-react/dist/mode-indent.cjs.js"); __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"); const l = s(e => { const r = t.onlineParser({ eatWhitespace: a => a.eatWhile(t.isIgnored), lexRules: t.LexRules, parseRules: t.ParseRules, editorConfig: { tabSize: e.tabSize } }); return { config: e, startState: r.startState, token: r.token, indent: i.indent, electricInput: /^\s*[})\]]/, fold: "brace", lineComment: "#", closeBrackets: { pairs: '()[]{}""', explode: "()[]{}" } }; }, "graphqlModeFactory"); o.CodeMirror.defineMode("graphql", l); /***/ }), /***/ "../../graphiql-react/dist/mode.cjs2.js": /*!**********************************************!*\ !*** ../../graphiql-react/dist/mode.cjs2.js ***! \**********************************************/ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { var n = Object.defineProperty; var u = (t, r) => n(t, "name", { value: r, configurable: !0 }); const i = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"), e = __webpack_require__(/*! graphql-language-service */ "../../graphql-language-service/esm/index.js"), s = __webpack_require__(/*! ./mode-indent.cjs.js */ "../../graphiql-react/dist/mode-indent.cjs.js"); __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"); i.CodeMirror.defineMode("graphql-variables", t => { const r = e.onlineParser({ eatWhitespace: a => a.eatSpace(), lexRules: c, parseRules: o, editorConfig: { tabSize: t.tabSize } }); return { config: t, startState: r.startState, token: r.token, indent: s.indent, electricInput: /^\s*[}\]]/, fold: "brace", closeBrackets: { pairs: '[]{}""', explode: "[]{}" } }; }); const c = { Punctuation: /^\[|]|\{|\}|:|,/, Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/, String: /^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/, Keyword: /^true|false|null/ }, o = { Document: [e.p("{"), e.list("Variable", e.opt(e.p(","))), e.p("}")], Variable: [l("variable"), e.p(":"), "Value"], Value(t) { switch (t.kind) { case "Number": return "NumberValue"; case "String": return "StringValue"; case "Punctuation": switch (t.value) { case "[": return "ListValue"; case "{": return "ObjectValue"; } return null; case "Keyword": switch (t.value) { case "true": case "false": return "BooleanValue"; case "null": return "NullValue"; } return null; } }, NumberValue: [e.t("Number", "number")], StringValue: [e.t("String", "string")], BooleanValue: [e.t("Keyword", "builtin")], NullValue: [e.t("Keyword", "keyword")], ListValue: [e.p("["), e.list("Value", e.opt(e.p(","))), e.p("]")], ObjectValue: [e.p("{"), e.list("ObjectField", e.opt(e.p(","))), e.p("}")], ObjectField: [l("attribute"), e.p(":"), "Value"] }; function l(t) { return { style: t, match: r => r.kind === "String", update(r, a) { r.name = a.value.slice(1, -1); } }; } u(l, "namedKey"); /***/ }), /***/ "../../graphiql-react/dist/mode.cjs3.js": /*!**********************************************!*\ !*** ../../graphiql-react/dist/mode.cjs3.js ***! \**********************************************/ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { const a = __webpack_require__(/*! ./codemirror.cjs.js */ "../../graphiql-react/dist/codemirror.cjs.js"), e = __webpack_require__(/*! graphql-language-service */ "../../graphql-language-service/esm/index.js"), l = __webpack_require__(/*! ./mode-indent.cjs.js */ "../../graphiql-react/dist/mode-indent.cjs.js"); __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"); a.CodeMirror.defineMode("graphql-results", r => { const t = e.onlineParser({ eatWhitespace: u => u.eatSpace(), lexRules: n, parseRules: s, editorConfig: { tabSize: r.tabSize } }); return { config: r, startState: t.startState, token: t.token, indent: l.indent, electricInput: /^\s*[}\]]/, fold: "brace", closeBrackets: { pairs: '[]{}""', explode: "[]{}" } }; }); const n = { Punctuation: /^\[|]|\{|\}|:|,/, Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/, String: /^"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?/, Keyword: /^true|false|null/ }, s = { Document: [e.p("{"), e.list("Entry", e.p(",")), e.p("}")], Entry: [e.t("String", "def"), e.p(":"), "Value"], Value(r) { switch (r.kind) { case "Number": return "NumberValue"; case "String": return "StringValue"; case "Punctuation": switch (r.value) { case "[": return "ListValue"; case "{": return "ObjectValue"; } return null; case "Keyword": switch (r.value) { case "true": case "false": return "BooleanValue"; case "null": return "NullValue"; } return null; } }, NumberValue: [e.t("Number", "number")], StringValue: [e.t("String", "string")], BooleanValue: [e.t("Keyword", "builtin")], NullValue: [e.t("Keyword", "keyword")], ListValue: [e.p("["), e.list("Value", e.p(",")), e.p("]")], ObjectValue: [e.p("{"), e.list("ObjectField", e.p(",")), e.p("}")], ObjectField: [e.t("String", "property"), e.p(":"), "Value"] }; /***/ }), /***/ "../../graphiql-react/dist/search.cjs.js": /*!***********************************************!*\ !*** ../../graphiql-react/dist/search.cjs.js ***! \***********************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { var K = Object.defineProperty; var a = (S, O) => K(S, "name", { value: O, configurable: !0 }); const Q = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"), L = __webpack_require__(/*! ./searchcursor.cjs2.js */ "../../graphiql-react/dist/searchcursor.cjs2.js"), z = __webpack_require__(/*! ./dialog.cjs2.js */ "../../graphiql-react/dist/dialog.cjs2.js"); function U(S, O) { for (var i = 0; i < O.length; i++) { const y = O[i]; if (typeof y != "string" && !Array.isArray(y)) { for (const v in y) if (v !== "default" && !(v in S)) { const h = Object.getOwnPropertyDescriptor(y, v); h && Object.defineProperty(S, v, h.get ? h : { enumerable: !0, get: () => y[v] }); } } } return Object.freeze(Object.defineProperty(S, Symbol.toStringTag, { value: "Module" })); } a(U, "_mergeNamespaces"); var B = { exports: {} }; (function (S, O) { (function (i) { i(Q.requireCodemirror(), L.requireSearchcursor(), z.requireDialog()); })(function (i) { i.defineOption("search", { bottom: !1 }); function y(e, n) { return typeof e == "string" ? e = new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), n ? "gi" : "g") : e.global || (e = new RegExp(e.source, e.ignoreCase ? "gi" : "g")), { token: function (t) { e.lastIndex = t.pos; var o = e.exec(t.string); if (o && o.index == t.pos) return t.pos += o[0].length || 1, "searching"; o ? t.pos = o.index : t.skipToEnd(); } }; } a(y, "searchOverlay"); function v() { this.posFrom = this.posTo = this.lastQuery = this.query = null, this.overlay = null; } a(v, "SearchState"); function h(e) { return e.state.search || (e.state.search = new v()); } a(h, "getSearchState"); function m(e) { return typeof e == "string" && e == e.toLowerCase(); } a(m, "queryCaseInsensitive"); function N(e, n, t) { return e.getSearchCursor(n, t, { caseFold: m(n), multiline: !0 }); } a(N, "getSearchCursor"); function j(e, n, t, o, r) { e.openDialog(n, o, { value: t, selectValueOnOpen: !0, closeOnEnter: !1, onClose: function () { w(e); }, onKeyDown: r, bottom: e.options.search.bottom }); } a(j, "persistentDialog"); function R(e, n, t, o, r) { e.openDialog ? e.openDialog(n, r, { value: o, selectValueOnOpen: !0, bottom: e.options.search.bottom }) : r(prompt(t, o)); } a(R, "dialog"); function k(e, n, t, o) { e.openConfirm ? e.openConfirm(n, o) : confirm(t) && o[0](); } a(k, "confirmDialog"); function C(e) { return e.replace(/\\([nrt\\])/g, function (n, t) { return t == "n" ? ` ` : t == "r" ? "\r" : t == "t" ? " " : t == "\\" ? "\\" : n; }); } a(C, "parseString"); function T(e) { var n = e.match(/^\/(.*)\/([a-z]*)$/); if (n) try { e = new RegExp(n[1], n[2].indexOf("i") == -1 ? "" : "i"); } catch {} else e = C(e); return (typeof e == "string" ? e == "" : e.test("")) && (e = /x^/), e; } a(T, "parseQuery"); function D(e, n, t) { n.queryText = t, n.query = T(t), e.removeOverlay(n.overlay, m(n.query)), n.overlay = y(n.query, m(n.query)), e.addOverlay(n.overlay), e.showMatchesOnScrollbar && (n.annotate && (n.annotate.clear(), n.annotate = null), n.annotate = e.showMatchesOnScrollbar(n.query, m(n.query))); } a(D, "startSearch"); function b(e, n, t, o) { var r = h(e); if (r.query) return P(e, n); var s = e.getSelection() || r.lastQuery; if (s instanceof RegExp && s.source == "x^" && (s = null), t && e.openDialog) { var c = null, u = a(function (f, x) { i.e_stop(x), f && (f != r.queryText && (D(e, r, f), r.posFrom = r.posTo = e.getCursor()), c && (c.style.opacity = 1), P(e, x.shiftKey, function (d, g) { var p; g.line < 3 && document.querySelector && (p = e.display.wrapper.querySelector(".CodeMirror-dialog")) && p.getBoundingClientRect().bottom - 4 > e.cursorCoords(g, "window").top && ((c = p).style.opacity = .4); })); }, "searchNext"); j(e, _(e), s, u, function (f, x) { var d = i.keyName(f), g = e.getOption("extraKeys"), p = g && g[d] || i.keyMap[e.getOption("keyMap")][d]; p == "findNext" || p == "findPrev" || p == "findPersistentNext" || p == "findPersistentPrev" ? (i.e_stop(f), D(e, h(e), x), e.execCommand(p)) : (p == "find" || p == "findPersistent") && (i.e_stop(f), u(x, f)); }), o && s && (D(e, r, s), P(e, n)); } else R(e, _(e), "Search for:", s, function (f) { f && !r.query && e.operation(function () { D(e, r, f), r.posFrom = r.posTo = e.getCursor(), P(e, n); }); }); } a(b, "doSearch"); function P(e, n, t) { e.operation(function () { var o = h(e), r = N(e, o.query, n ? o.posFrom : o.posTo); !r.find(n) && (r = N(e, o.query, n ? i.Pos(e.lastLine()) : i.Pos(e.firstLine(), 0)), !r.find(n)) || (e.setSelection(r.from(), r.to()), e.scrollIntoView({ from: r.from(), to: r.to() }, 20), o.posFrom = r.from(), o.posTo = r.to(), t && t(r.from(), r.to())); }); } a(P, "findNext"); function w(e) { e.operation(function () { var n = h(e); n.lastQuery = n.query, n.query && (n.query = n.queryText = null, e.removeOverlay(n.overlay), n.annotate && (n.annotate.clear(), n.annotate = null)); }); } a(w, "clearSearch"); function l(e, n) { var t = e ? document.createElement(e) : document.createDocumentFragment(); for (var o in n) t[o] = n[o]; for (var r = 2; r < arguments.length; r++) { var s = arguments[r]; t.appendChild(typeof s == "string" ? document.createTextNode(s) : s); } return t; } a(l, "el"); function _(e) { return l("", null, l("span", { className: "CodeMirror-search-label" }, e.phrase("Search:")), " ", l("input", { type: "text", style: "width: 10em", className: "CodeMirror-search-field" }), " ", l("span", { style: "color: #888", className: "CodeMirror-search-hint" }, e.phrase("(Use /re/ syntax for regexp search)"))); } a(_, "getQueryDialog"); function A(e) { return l("", null, " ", l("input", { type: "text", style: "width: 10em", className: "CodeMirror-search-field" }), " ", l("span", { style: "color: #888", className: "CodeMirror-search-hint" }, e.phrase("(Use /re/ syntax for regexp search)"))); } a(A, "getReplaceQueryDialog"); function I(e) { return l("", null, l("span", { className: "CodeMirror-search-label" }, e.phrase("With:")), " ", l("input", { type: "text", style: "width: 10em", className: "CodeMirror-search-field" })); } a(I, "getReplacementQueryDialog"); function V(e) { return l("", null, l("span", { className: "CodeMirror-search-label" }, e.phrase("Replace?")), " ", l("button", {}, e.phrase("Yes")), " ", l("button", {}, e.phrase("No")), " ", l("button", {}, e.phrase("All")), " ", l("button", {}, e.phrase("Stop"))); } a(V, "getDoReplaceConfirm"); function E(e, n, t) { e.operation(function () { for (var o = N(e, n); o.findNext();) if (typeof n != "string") { var r = e.getRange(o.from(), o.to()).match(n); o.replace(t.replace(/\$(\d)/g, function (s, c) { return r[c]; })); } else o.replace(t); }); } a(E, "replaceAll"); function F(e, n) { if (!e.getOption("readOnly")) { var t = e.getSelection() || h(e).lastQuery, o = n ? e.phrase("Replace all:") : e.phrase("Replace:"), r = l("", null, l("span", { className: "CodeMirror-search-label" }, o), A(e)); R(e, r, o, t, function (s) { s && (s = T(s), R(e, I(e), e.phrase("Replace with:"), "", function (c) { if (c = C(c), n) E(e, s, c);else { w(e); var u = N(e, s, e.getCursor("from")), f = a(function () { var d = u.from(), g; !(g = u.findNext()) && (u = N(e, s), !(g = u.findNext()) || d && u.from().line == d.line && u.from().ch == d.ch) || (e.setSelection(u.from(), u.to()), e.scrollIntoView({ from: u.from(), to: u.to() }), k(e, V(e), e.phrase("Replace?"), [function () { x(g); }, f, function () { E(e, s, c); }])); }, "advance"), x = a(function (d) { u.replace(typeof s == "string" ? c : c.replace(/\$(\d)/g, function (g, p) { return d[p]; })), f(); }, "doReplace"); f(); } })); }); } } a(F, "replace"), i.commands.find = function (e) { w(e), b(e); }, i.commands.findPersistent = function (e) { w(e), b(e, !1, !0); }, i.commands.findPersistentNext = function (e) { b(e, !1, !0, !0); }, i.commands.findPersistentPrev = function (e) { b(e, !0, !0, !0); }, i.commands.findNext = b, i.commands.findPrev = function (e) { b(e, !0); }, i.commands.clearSearch = w, i.commands.replace = F, i.commands.replaceAll = function (e) { F(e, !0); }; }); })(); var $ = B.exports; const W = Q.getDefaultExportFromCjs($), Y = U({ __proto__: null, default: W }, [$]); exports.search = Y; /***/ }), /***/ "../../graphiql-react/dist/searchcursor.cjs.js": /*!*****************************************************!*\ !*** ../../graphiql-react/dist/searchcursor.cjs.js ***! \*****************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { var n = Object.defineProperty; var u = (r, o) => n(r, "name", { value: o, configurable: !0 }); const i = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"), f = __webpack_require__(/*! ./searchcursor.cjs2.js */ "../../graphiql-react/dist/searchcursor.cjs2.js"); function l(r, o) { for (var c = 0; c < o.length; c++) { const e = o[c]; if (typeof e != "string" && !Array.isArray(e)) { for (const t in e) if (t !== "default" && !(t in r)) { const s = Object.getOwnPropertyDescriptor(e, t); s && Object.defineProperty(r, t, s.get ? s : { enumerable: !0, get: () => e[t] }); } } } return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, { value: "Module" })); } u(l, "_mergeNamespaces"); var a = f.requireSearchcursor(); const g = i.getDefaultExportFromCjs(a), p = l({ __proto__: null, default: g }, [a]); exports.searchcursor = p; /***/ }), /***/ "../../graphiql-react/dist/searchcursor.cjs2.js": /*!******************************************************!*\ !*** ../../graphiql-react/dist/searchcursor.cjs2.js ***! \******************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { var W = Object.defineProperty; var o = (d, E) => W(d, "name", { value: E, configurable: !0 }); const G = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"); var N = { exports: {} }, b; function H() { return b || (b = 1, function (d, E) { (function (m) { m(G.requireCodemirror()); })(function (m) { var a = m.Pos; function B(e) { var t = e.flags; return t !== null && t !== void 0 ? t : (e.ignoreCase ? "i" : "") + (e.global ? "g" : "") + (e.multiline ? "m" : ""); } o(B, "regexpFlags"); function F(e, t) { for (var n = B(e), r = n, l = 0; l < t.length; l++) r.indexOf(t.charAt(l)) == -1 && (r += t.charAt(l)); return n == r ? e : new RegExp(e.source, r); } o(F, "ensureFlags"); function R(e) { return /\\s|\\n|\n|\\W|\\D|\[\^/.test(e.source); } o(R, "maybeMultiline"); function I(e, t, n) { t = F(t, "g"); for (var r = n.line, l = n.ch, i = e.lastLine(); r <= i; r++, l = 0) { t.lastIndex = l; var h = e.getLine(r), f = t.exec(h); if (f) return { from: a(r, f.index), to: a(r, f.index + f[0].length), match: f }; } } o(I, "searchRegexpForward"); function j(e, t, n) { if (!R(t)) return I(e, t, n); t = F(t, "gm"); for (var r, l = 1, i = n.line, h = e.lastLine(); i <= h;) { for (var f = 0; f < l && !(i > h); f++) { var p = e.getLine(i++); r = r == null ? p : r + ` ` + p; } l = l * 2, t.lastIndex = n.ch; var u = t.exec(r); if (u) { var s = r.slice(0, u.index).split(` `), c = u[0].split(` `), g = n.line + s.length - 1, v = s[s.length - 1].length; return { from: a(g, v), to: a(g + c.length - 1, c.length == 1 ? v + c[0].length : c[c.length - 1].length), match: u }; } } } o(j, "searchRegexpForwardMultiline"); function z(e, t, n) { for (var r, l = 0; l <= e.length;) { t.lastIndex = l; var i = t.exec(e); if (!i) break; var h = i.index + i[0].length; if (h > e.length - n) break; (!r || h > r.index + r[0].length) && (r = i), l = i.index + 1; } return r; } o(z, "lastMatchIn"); function D(e, t, n) { t = F(t, "g"); for (var r = n.line, l = n.ch, i = e.firstLine(); r >= i; r--, l = -1) { var h = e.getLine(r), f = z(h, t, l < 0 ? 0 : h.length - l); if (f) return { from: a(r, f.index), to: a(r, f.index + f[0].length), match: f }; } } o(D, "searchRegexpBackward"); function A(e, t, n) { if (!R(t)) return D(e, t, n); t = F(t, "gm"); for (var r, l = 1, i = e.getLine(n.line).length - n.ch, h = n.line, f = e.firstLine(); h >= f;) { for (var p = 0; p < l && h >= f; p++) { var u = e.getLine(h--); r = r == null ? u : u + ` ` + r; } l *= 2; var s = z(r, t, i); if (s) { var c = r.slice(0, s.index).split(` `), g = s[0].split(` `), v = h + c.length, x = c[c.length - 1].length; return { from: a(v, x), to: a(v + g.length - 1, g.length == 1 ? x + g[0].length : g[g.length - 1].length), match: s }; } } } o(A, "searchRegexpBackwardMultiline"); var P, k; String.prototype.normalize ? (P = o(function (e) { return e.normalize("NFD").toLowerCase(); }, "doFold"), k = o(function (e) { return e.normalize("NFD"); }, "noFold")) : (P = o(function (e) { return e.toLowerCase(); }, "doFold"), k = o(function (e) { return e; }, "noFold")); function L(e, t, n, r) { if (e.length == t.length) return n; for (var l = 0, i = n + Math.max(0, e.length - t.length);;) { if (l == i) return l; var h = l + i >> 1, f = r(e.slice(0, h)).length; if (f == n) return h; f > n ? i = h : l = h + 1; } } o(L, "adjustPos"); function y(e, t, n, r) { if (!t.length) return null; var l = r ? P : k, i = l(t).split(/\r|\n\r?/); t: for (var h = n.line, f = n.ch, p = e.lastLine() + 1 - i.length; h <= p; h++, f = 0) { var u = e.getLine(h).slice(f), s = l(u); if (i.length == 1) { var c = s.indexOf(i[0]); if (c == -1) continue t; var n = L(u, s, c, l) + f; return { from: a(h, L(u, s, c, l) + f), to: a(h, L(u, s, c + i[0].length, l) + f) }; } else { var g = s.length - i[0].length; if (s.slice(g) != i[0]) continue t; for (var v = 1; v < i.length - 1; v++) if (l(e.getLine(h + v)) != i[v]) continue t; var x = e.getLine(h + i.length - 1), O = l(x), S = i[i.length - 1]; if (O.slice(0, S.length) != S) continue t; return { from: a(h, L(u, s, g, l) + f), to: a(h + i.length - 1, L(x, O, S.length, l)) }; } } } o(y, "searchStringForward"); function C(e, t, n, r) { if (!t.length) return null; var l = r ? P : k, i = l(t).split(/\r|\n\r?/); t: for (var h = n.line, f = n.ch, p = e.firstLine() - 1 + i.length; h >= p; h--, f = -1) { var u = e.getLine(h); f > -1 && (u = u.slice(0, f)); var s = l(u); if (i.length == 1) { var c = s.lastIndexOf(i[0]); if (c == -1) continue t; return { from: a(h, L(u, s, c, l)), to: a(h, L(u, s, c + i[0].length, l)) }; } else { var g = i[i.length - 1]; if (s.slice(0, g.length) != g) continue t; for (var v = 1, n = h - i.length + 1; v < i.length - 1; v++) if (l(e.getLine(n + v)) != i[v]) continue t; var x = e.getLine(h + 1 - i.length), O = l(x); if (O.slice(O.length - i[0].length) != i[0]) continue t; return { from: a(h + 1 - i.length, L(x, O, x.length - i[0].length, l)), to: a(h, L(u, s, g.length, l)) }; } } } o(C, "searchStringBackward"); function w(e, t, n, r) { this.atOccurrence = !1, this.afterEmptyMatch = !1, this.doc = e, n = n ? e.clipPos(n) : a(0, 0), this.pos = { from: n, to: n }; var l; typeof r == "object" ? l = r.caseFold : (l = r, r = null), typeof t == "string" ? (l == null && (l = !1), this.matches = function (i, h) { return (i ? C : y)(e, t, h, l); }) : (t = F(t, "gm"), !r || r.multiline !== !1 ? this.matches = function (i, h) { return (i ? A : j)(e, t, h); } : this.matches = function (i, h) { return (i ? D : I)(e, t, h); }); } o(w, "SearchCursor"), w.prototype = { findNext: function () { return this.find(!1); }, findPrevious: function () { return this.find(!0); }, find: function (e) { var t = this.doc.clipPos(e ? this.pos.from : this.pos.to); if (this.afterEmptyMatch && this.atOccurrence && (t = a(t.line, t.ch), e ? (t.ch--, t.ch < 0 && (t.line--, t.ch = (this.doc.getLine(t.line) || "").length)) : (t.ch++, t.ch > (this.doc.getLine(t.line) || "").length && (t.ch = 0, t.line++)), m.cmpPos(t, this.doc.clipPos(t)) != 0)) return this.atOccurrence = !1; var n = this.matches(e, t); if (this.afterEmptyMatch = n && m.cmpPos(n.from, n.to) == 0, n) return this.pos = n, this.atOccurrence = !0, this.pos.match || !0; var r = a(e ? this.doc.firstLine() : this.doc.lastLine() + 1, 0); return this.pos = { from: r, to: r }, this.atOccurrence = !1; }, from: function () { if (this.atOccurrence) return this.pos.from; }, to: function () { if (this.atOccurrence) return this.pos.to; }, replace: function (e, t) { if (this.atOccurrence) { var n = m.splitLines(e); this.doc.replaceRange(n, this.pos.from, this.pos.to, t), this.pos.to = a(this.pos.from.line + n.length - 1, n[n.length - 1].length + (n.length == 1 ? this.pos.from.ch : 0)); } } }, m.defineExtension("getSearchCursor", function (e, t, n) { return new w(this.doc, e, t, n); }), m.defineDocExtension("getSearchCursor", function (e, t, n) { return new w(this, e, t, n); }), m.defineExtension("selectMatches", function (e, t) { for (var n = [], r = this.getSearchCursor(e, this.getCursor("from"), t); r.findNext() && !(m.cmpPos(r.to(), this.getCursor("to")) > 0);) n.push({ anchor: r.from(), head: r.to() }); n.length && this.setSelections(n, 0); }); }); }()), N.exports; } o(H, "requireSearchcursor"); exports.requireSearchcursor = H; /***/ }), /***/ "../../graphiql-react/dist/show-hint.cjs.js": /*!**************************************************!*\ !*** ../../graphiql-react/dist/show-hint.cjs.js ***! \**************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { var ct = Object.defineProperty; var p = (H, A) => ct(H, "name", { value: A, configurable: !0 }); const G = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"); function lt(H, A) { for (var r = 0; r < A.length; r++) { const w = A[r]; if (typeof w != "string" && !Array.isArray(w)) { for (const v in w) if (v !== "default" && !(v in H)) { const b = Object.getOwnPropertyDescriptor(w, v); b && Object.defineProperty(H, v, b.get ? b : { enumerable: !0, get: () => w[v] }); } } } return Object.freeze(Object.defineProperty(H, Symbol.toStringTag, { value: "Module" })); } p(lt, "_mergeNamespaces"); var ht = { exports: {} }; (function (H, A) { (function (r) { r(G.requireCodemirror()); })(function (r) { var w = "CodeMirror-hint", v = "CodeMirror-hint-active"; r.showHint = function (t, e, i) { if (!e) return t.showHint(i); i && i.async && (e.async = !0); var n = { hint: e }; if (i) for (var s in i) n[s] = i[s]; return t.showHint(n); }, r.defineExtension("showHint", function (t) { t = tt(this, this.getCursor("start"), t); var e = this.listSelections(); if (!(e.length > 1)) { if (this.somethingSelected()) { if (!t.hint.supportsSelection) return; for (var i = 0; i < e.length; i++) if (e[i].head.line != e[i].anchor.line) return; } this.state.completionActive && this.state.completionActive.close(); var n = this.state.completionActive = new b(this, t); n.options.hint && (r.signal(this, "startCompletion", this), n.update(!0)); } }), r.defineExtension("closeHint", function () { this.state.completionActive && this.state.completionActive.close(); }); function b(t, e) { if (this.cm = t, this.options = e, this.widget = null, this.debounce = 0, this.tick = 0, this.startPos = this.cm.getCursor("start"), this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length, this.options.updateOnCursorActivity) { var i = this; t.on("cursorActivity", this.activityFunc = function () { i.cursorActivity(); }); } } p(b, "Completion"); var Q = window.requestAnimationFrame || function (t) { return setTimeout(t, 1e3 / 60); }, Z = window.cancelAnimationFrame || clearTimeout; b.prototype = { close: function () { this.active() && (this.cm.state.completionActive = null, this.tick = null, this.options.updateOnCursorActivity && this.cm.off("cursorActivity", this.activityFunc), this.widget && this.data && r.signal(this.data, "close"), this.widget && this.widget.close(), r.signal(this.cm, "endCompletion", this.cm)); }, active: function () { return this.cm.state.completionActive == this; }, pick: function (t, e) { var i = t.list[e], n = this; this.cm.operation(function () { i.hint ? i.hint(n.cm, t, i) : n.cm.replaceRange(_(i), i.from || t.from, i.to || t.to, "complete"), r.signal(t, "pick", i), n.cm.scrollIntoView(); }), this.options.closeOnPick && this.close(); }, cursorActivity: function () { this.debounce && (Z(this.debounce), this.debounce = 0); var t = this.startPos; this.data && (t = this.data.from); var e = this.cm.getCursor(), i = this.cm.getLine(e.line); if (e.line != this.startPos.line || i.length - e.ch != this.startLen - this.startPos.ch || e.ch < t.ch || this.cm.somethingSelected() || !e.ch || this.options.closeCharacters.test(i.charAt(e.ch - 1))) this.close();else { var n = this; this.debounce = Q(function () { n.update(); }), this.widget && this.widget.disable(); } }, update: function (t) { if (this.tick != null) { var e = this, i = ++this.tick; U(this.options.hint, this.cm, this.options, function (n) { e.tick == i && e.finishUpdate(n, t); }); } }, finishUpdate: function (t, e) { this.data && r.signal(this.data, "update"); var i = this.widget && this.widget.picked || e && this.options.completeSingle; this.widget && this.widget.close(), this.data = t, t && t.list.length && (i && t.list.length == 1 ? this.pick(t, 0) : (this.widget = new K(this, t), r.signal(t, "shown"))); } }; function tt(t, e, i) { var n = t.options.hintOptions, s = {}; for (var c in D) s[c] = D[c]; if (n) for (var c in n) n[c] !== void 0 && (s[c] = n[c]); if (i) for (var c in i) i[c] !== void 0 && (s[c] = i[c]); return s.hint.resolve && (s.hint = s.hint.resolve(t, e)), s; } p(tt, "parseOptions"); function _(t) { return typeof t == "string" ? t : t.text; } p(_, "getText"); function et(t, e) { var i = { Up: function () { e.moveFocus(-1); }, Down: function () { e.moveFocus(1); }, PageUp: function () { e.moveFocus(-e.menuSize() + 1, !0); }, PageDown: function () { e.moveFocus(e.menuSize() - 1, !0); }, Home: function () { e.setFocus(0); }, End: function () { e.setFocus(e.length - 1); }, Enter: e.pick, Tab: e.pick, Esc: e.close }, n = /Mac/.test(navigator.platform); n && (i["Ctrl-P"] = function () { e.moveFocus(-1); }, i["Ctrl-N"] = function () { e.moveFocus(1); }); var s = t.options.customKeys, c = s ? {} : i; function o(u, l) { var a; typeof l != "string" ? a = p(function (S) { return l(S, e); }, "bound") : i.hasOwnProperty(l) ? a = i[l] : a = l, c[u] = a; } if (p(o, "addBinding"), s) for (var f in s) s.hasOwnProperty(f) && o(f, s[f]); var h = t.options.extraKeys; if (h) for (var f in h) h.hasOwnProperty(f) && o(f, h[f]); return c; } p(et, "buildKeyMap"); function B(t, e) { for (; e && e != t;) { if (e.nodeName.toUpperCase() === "LI" && e.parentNode == t) return e; e = e.parentNode; } } p(B, "getHintElement"); function K(t, e) { this.id = "cm-complete-" + Math.floor(Math.random(1e6)), this.completion = t, this.data = e, this.picked = !1; var i = this, n = t.cm, s = n.getInputField().ownerDocument, c = s.defaultView || s.parentWindow, o = this.hints = s.createElement("ul"); o.setAttribute("role", "listbox"), o.setAttribute("aria-expanded", "true"), o.id = this.id; var f = t.cm.options.theme; o.className = "CodeMirror-hints " + f, this.selectedHint = e.selectedHint || 0; for (var h = e.list, u = 0; u < h.length; ++u) { var l = o.appendChild(s.createElement("li")), a = h[u], S = w + (u != this.selectedHint ? "" : " " + v); a.className != null && (S = a.className + " " + S), l.className = S, u == this.selectedHint && l.setAttribute("aria-selected", "true"), l.id = this.id + "-" + u, l.setAttribute("role", "option"), a.render ? a.render(l, e, a) : l.appendChild(s.createTextNode(a.displayText || _(a))), l.hintId = u; } var T = t.options.container || s.body, y = n.cursorCoords(t.options.alignWithWord ? e.from : null), k = y.left, O = y.bottom, j = !0, F = 0, E = 0; if (T !== s.body) { var st = ["absolute", "relative", "fixed"].indexOf(c.getComputedStyle(T).position) !== -1, W = st ? T : T.offsetParent, M = W.getBoundingClientRect(), q = s.body.getBoundingClientRect(); F = M.left - q.left - W.scrollLeft, E = M.top - q.top - W.scrollTop; } o.style.left = k - F + "px", o.style.top = O - E + "px"; var N = c.innerWidth || Math.max(s.body.offsetWidth, s.documentElement.offsetWidth), L = c.innerHeight || Math.max(s.body.offsetHeight, s.documentElement.offsetHeight); T.appendChild(o), n.getInputField().setAttribute("aria-autocomplete", "list"), n.getInputField().setAttribute("aria-owns", this.id), n.getInputField().setAttribute("aria-activedescendant", this.id + "-" + this.selectedHint); var m = t.options.moveOnOverlap ? o.getBoundingClientRect() : new DOMRect(), z = t.options.paddingForScrollbar ? o.scrollHeight > o.clientHeight + 1 : !1, x; setTimeout(function () { x = n.getScrollInfo(); }); var ot = m.bottom - L; if (ot > 0) { var P = m.bottom - m.top, rt = y.top - (y.bottom - m.top); if (rt - P > 0) o.style.top = (O = y.top - P - E) + "px", j = !1;else if (P > L) { o.style.height = L - 5 + "px", o.style.top = (O = y.bottom - m.top - E) + "px"; var V = n.getCursor(); e.from.ch != V.ch && (y = n.cursorCoords(V), o.style.left = (k = y.left - F) + "px", m = o.getBoundingClientRect()); } } var C = m.right - N; if (z && (C += n.display.nativeBarWidth), C > 0 && (m.right - m.left > N && (o.style.width = N - 5 + "px", C -= m.right - m.left - N), o.style.left = (k = y.left - C - F) + "px"), z) for (var I = o.firstChild; I; I = I.nextSibling) I.style.paddingRight = n.display.nativeBarWidth + "px"; if (n.addKeyMap(this.keyMap = et(t, { moveFocus: function (d, g) { i.changeActive(i.selectedHint + d, g); }, setFocus: function (d) { i.changeActive(d); }, menuSize: function () { return i.screenAmount(); }, length: h.length, close: function () { t.close(); }, pick: function () { i.pick(); }, data: e })), t.options.closeOnUnfocus) { var Y; n.on("blur", this.onBlur = function () { Y = setTimeout(function () { t.close(); }, 100); }), n.on("focus", this.onFocus = function () { clearTimeout(Y); }); } n.on("scroll", this.onScroll = function () { var d = n.getScrollInfo(), g = n.getWrapperElement().getBoundingClientRect(); x || (x = n.getScrollInfo()); var X = O + x.top - d.top, R = X - (c.pageYOffset || (s.documentElement || s.body).scrollTop); if (j || (R += o.offsetHeight), R <= g.top || R >= g.bottom) return t.close(); o.style.top = X + "px", o.style.left = k + x.left - d.left + "px"; }), r.on(o, "dblclick", function (d) { var g = B(o, d.target || d.srcElement); g && g.hintId != null && (i.changeActive(g.hintId), i.pick()); }), r.on(o, "click", function (d) { var g = B(o, d.target || d.srcElement); g && g.hintId != null && (i.changeActive(g.hintId), t.options.completeOnSingleClick && i.pick()); }), r.on(o, "mousedown", function () { setTimeout(function () { n.focus(); }, 20); }); var $ = this.getSelectedHintRange(); return ($.from !== 0 || $.to !== 0) && this.scrollToActive(), r.signal(e, "select", h[this.selectedHint], o.childNodes[this.selectedHint]), !0; } p(K, "Widget"), K.prototype = { close: function () { if (this.completion.widget == this) { this.completion.widget = null, this.hints.parentNode && this.hints.parentNode.removeChild(this.hints), this.completion.cm.removeKeyMap(this.keyMap); var t = this.completion.cm.getInputField(); t.removeAttribute("aria-activedescendant"), t.removeAttribute("aria-owns"); var e = this.completion.cm; this.completion.options.closeOnUnfocus && (e.off("blur", this.onBlur), e.off("focus", this.onFocus)), e.off("scroll", this.onScroll); } }, disable: function () { this.completion.cm.removeKeyMap(this.keyMap); var t = this; this.keyMap = { Enter: function () { t.picked = !0; } }, this.completion.cm.addKeyMap(this.keyMap); }, pick: function () { this.completion.pick(this.data, this.selectedHint); }, changeActive: function (t, e) { if (t >= this.data.list.length ? t = e ? this.data.list.length - 1 : 0 : t < 0 && (t = e ? 0 : this.data.list.length - 1), this.selectedHint != t) { var i = this.hints.childNodes[this.selectedHint]; i && (i.className = i.className.replace(" " + v, ""), i.removeAttribute("aria-selected")), i = this.hints.childNodes[this.selectedHint = t], i.className += " " + v, i.setAttribute("aria-selected", "true"), this.completion.cm.getInputField().setAttribute("aria-activedescendant", i.id), this.scrollToActive(), r.signal(this.data, "select", this.data.list[this.selectedHint], i); } }, scrollToActive: function () { var t = this.getSelectedHintRange(), e = this.hints.childNodes[t.from], i = this.hints.childNodes[t.to], n = this.hints.firstChild; e.offsetTop < this.hints.scrollTop ? this.hints.scrollTop = e.offsetTop - n.offsetTop : i.offsetTop + i.offsetHeight > this.hints.scrollTop + this.hints.clientHeight && (this.hints.scrollTop = i.offsetTop + i.offsetHeight - this.hints.clientHeight + n.offsetTop); }, screenAmount: function () { return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1; }, getSelectedHintRange: function () { var t = this.completion.options.scrollMargin || 0; return { from: Math.max(0, this.selectedHint - t), to: Math.min(this.data.list.length - 1, this.selectedHint + t) }; } }; function it(t, e) { if (!t.somethingSelected()) return e; for (var i = [], n = 0; n < e.length; n++) e[n].supportsSelection && i.push(e[n]); return i; } p(it, "applicableHelpers"); function U(t, e, i, n) { if (t.async) t(e, n, i);else { var s = t(e, i); s && s.then ? s.then(n) : n(s); } } p(U, "fetchHints"); function nt(t, e) { var i = t.getHelpers(e, "hint"), n; if (i.length) { var s = p(function (c, o, f) { var h = it(c, i); function u(l) { if (l == h.length) return o(null); U(h[l], c, f, function (a) { a && a.list.length > 0 ? o(a) : u(l + 1); }); } p(u, "run"), u(0); }, "resolved"); return s.async = !0, s.supportsSelection = !0, s; } else return (n = t.getHelper(t.getCursor(), "hintWords")) ? function (c) { return r.hint.fromList(c, { words: n }); } : r.hint.anyword ? function (c, o) { return r.hint.anyword(c, o); } : function () {}; } p(nt, "resolveAutoHints"), r.registerHelper("hint", "auto", { resolve: nt }), r.registerHelper("hint", "fromList", function (t, e) { var i = t.getCursor(), n = t.getTokenAt(i), s, c = r.Pos(i.line, n.start), o = i; n.start < i.ch && /\w/.test(n.string.charAt(i.ch - n.start - 1)) ? s = n.string.substr(0, i.ch - n.start) : (s = "", c = i); for (var f = [], h = 0; h < e.words.length; h++) { var u = e.words[h]; u.slice(0, s.length) == s && f.push(u); } if (f.length) return { list: f, from: c, to: o }; }), r.commands.autocomplete = r.showHint; var D = { hint: r.hint.auto, completeSingle: !0, alignWithWord: !0, closeCharacters: /[\s()\[\]{};:>,]/, closeOnPick: !0, closeOnUnfocus: !0, updateOnCursorActivity: !0, completeOnSingleClick: !0, container: null, customKeys: null, extraKeys: null, paddingForScrollbar: !0, moveOnOverlap: !0 }; r.defineOption("hintOptions", null); }); })(); var J = ht.exports; const at = G.getDefaultExportFromCjs(J), ft = lt({ __proto__: null, default: at }, [J]); exports.showHint = ft; /***/ }), /***/ "../../graphiql-react/dist/sublime.cjs.js": /*!************************************************!*\ !*** ../../graphiql-react/dist/sublime.cjs.js ***! \************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { var _ = Object.defineProperty; var v = (m, B) => _(m, "name", { value: B, configurable: !0 }); const E = __webpack_require__(/*! ./codemirror.cjs2.js */ "../../graphiql-react/dist/codemirror.cjs2.js"), Y = __webpack_require__(/*! ./searchcursor.cjs2.js */ "../../graphiql-react/dist/searchcursor.cjs2.js"), z = __webpack_require__(/*! ./matchbrackets.cjs2.js */ "../../graphiql-react/dist/matchbrackets.cjs2.js"); function J(m, B) { for (var h = 0; h < B.length; h++) { const a = B[h]; if (typeof a != "string" && !Array.isArray(a)) { for (const f in a) if (f !== "default" && !(f in m)) { const A = Object.getOwnPropertyDescriptor(a, f); A && Object.defineProperty(m, f, A.get ? A : { enumerable: !0, get: () => a[f] }); } } } return Object.freeze(Object.defineProperty(m, Symbol.toStringTag, { value: "Module" })); } v(J, "_mergeNamespaces"); var G = { exports: {} }; (function (m, B) { (function (h) { h(E.requireCodemirror(), Y.requireSearchcursor(), z.requireMatchbrackets()); })(function (h) { var a = h.commands, f = h.Pos; function A(e, t, n) { if (n < 0 && t.ch == 0) return e.clipPos(f(t.line - 1)); var r = e.getLine(t.line); if (n > 0 && t.ch >= r.length) return e.clipPos(f(t.line + 1, 0)); for (var l = "start", i, o = t.ch, s = o, u = n < 0 ? 0 : r.length, d = 0; s != u; s += n, d++) { var p = r.charAt(n < 0 ? s - 1 : s), c = p != "_" && h.isWordChar(p) ? "w" : "o"; if (c == "w" && p.toUpperCase() == p && (c = "W"), l == "start") c != "o" ? (l = "in", i = c) : o = s + n;else if (l == "in" && i != c) { if (i == "w" && c == "W" && n < 0 && s--, i == "W" && c == "w" && n > 0) if (s == o + 1) { i = "w"; continue; } else s--; break; } } return f(t.line, s); } v(A, "findPosSubword"); function T(e, t) { e.extendSelectionsBy(function (n) { return e.display.shift || e.doc.extend || n.empty() ? A(e.doc, n.head, t) : t < 0 ? n.from() : n.to(); }); } v(T, "moveSubword"), a.goSubwordLeft = function (e) { T(e, -1); }, a.goSubwordRight = function (e) { T(e, 1); }, a.scrollLineUp = function (e) { var t = e.getScrollInfo(); if (!e.somethingSelected()) { var n = e.lineAtHeight(t.top + t.clientHeight, "local"); e.getCursor().line >= n && e.execCommand("goLineUp"); } e.scrollTo(null, t.top - e.defaultTextHeight()); }, a.scrollLineDown = function (e) { var t = e.getScrollInfo(); if (!e.somethingSelected()) { var n = e.lineAtHeight(t.top, "local") + 1; e.getCursor().line <= n && e.execCommand("goLineDown"); } e.scrollTo(null, t.top + e.defaultTextHeight()); }, a.splitSelectionByLine = function (e) { for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++) for (var l = t[r].from(), i = t[r].to(), o = l.line; o <= i.line; ++o) i.line > l.line && o == i.line && i.ch == 0 || n.push({ anchor: o == l.line ? l : f(o, 0), head: o == i.line ? i : f(o) }); e.setSelections(n, 0); }, a.singleSelectionTop = function (e) { var t = e.listSelections()[0]; e.setSelection(t.anchor, t.head, { scroll: !1 }); }, a.selectLine = function (e) { for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++) { var l = t[r]; n.push({ anchor: f(l.from().line, 0), head: f(l.to().line + 1, 0) }); } e.setSelections(n); }; function x(e, t) { if (e.isReadOnly()) return h.Pass; e.operation(function () { for (var n = e.listSelections().length, r = [], l = -1, i = 0; i < n; i++) { var o = e.listSelections()[i].head; if (!(o.line <= l)) { var s = f(o.line + (t ? 0 : 1), 0); e.replaceRange(` `, s, null, "+insertLine"), e.indentLine(s.line, null, !0), r.push({ head: s, anchor: s }), l = o.line + 1; } } e.setSelections(r); }), e.execCommand("indentAuto"); } v(x, "insertLine"), a.insertLineAfter = function (e) { return x(e, !1); }, a.insertLineBefore = function (e) { return x(e, !0); }; function K(e, t) { for (var n = t.ch, r = n, l = e.getLine(t.line); n && h.isWordChar(l.charAt(n - 1));) --n; for (; r < l.length && h.isWordChar(l.charAt(r));) ++r; return { from: f(t.line, n), to: f(t.line, r), word: l.slice(n, r) }; } v(K, "wordAt"), a.selectNextOccurrence = function (e) { var t = e.getCursor("from"), n = e.getCursor("to"), r = e.state.sublimeFindFullWord == e.doc.sel; if (h.cmpPos(t, n) == 0) { var l = K(e, t); if (!l.word) return; e.setSelection(l.from, l.to), r = !0; } else { var i = e.getRange(t, n), o = r ? new RegExp("\\b" + i + "\\b") : i, s = e.getSearchCursor(o, n), u = s.findNext(); if (u || (s = e.getSearchCursor(o, f(e.firstLine(), 0)), u = s.findNext()), !u || H(e.listSelections(), s.from(), s.to())) return; e.addSelection(s.from(), s.to()); } r && (e.state.sublimeFindFullWord = e.doc.sel); }, a.skipAndSelectNextOccurrence = function (e) { var t = e.getCursor("anchor"), n = e.getCursor("head"); a.selectNextOccurrence(e), h.cmpPos(t, n) != 0 && e.doc.setSelections(e.doc.listSelections().filter(function (r) { return r.anchor != t || r.head != n; })); }; function y(e, t) { for (var n = e.listSelections(), r = [], l = 0; l < n.length; l++) { var i = n[l], o = e.findPosV(i.anchor, t, "line", i.anchor.goalColumn), s = e.findPosV(i.head, t, "line", i.head.goalColumn); o.goalColumn = i.anchor.goalColumn != null ? i.anchor.goalColumn : e.cursorCoords(i.anchor, "div").left, s.goalColumn = i.head.goalColumn != null ? i.head.goalColumn : e.cursorCoords(i.head, "div").left; var u = { anchor: o, head: s }; r.push(i), r.push(u); } e.setSelections(r); } v(y, "addCursorToSelection"), a.addCursorToPrevLine = function (e) { y(e, -1); }, a.addCursorToNextLine = function (e) { y(e, 1); }; function H(e, t, n) { for (var r = 0; r < e.length; r++) if (h.cmpPos(e[r].from(), t) == 0 && h.cmpPos(e[r].to(), n) == 0) return !0; return !1; } v(H, "isSelectedRange"); var P = "(){}[]"; function U(e) { for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++) { var l = t[r], i = l.head, o = e.scanForBracket(i, -1); if (!o) return !1; for (;;) { var s = e.scanForBracket(i, 1); if (!s) return !1; if (s.ch == P.charAt(P.indexOf(o.ch) + 1)) { var u = f(o.pos.line, o.pos.ch + 1); if (h.cmpPos(u, l.from()) == 0 && h.cmpPos(s.pos, l.to()) == 0) { if (o = e.scanForBracket(o.pos, -1), !o) return !1; } else { n.push({ anchor: u, head: s.pos }); break; } } i = f(s.pos.line, s.pos.ch + 1); } } return e.setSelections(n), !0; } v(U, "selectBetweenBrackets"), a.selectScope = function (e) { U(e) || e.execCommand("selectAll"); }, a.selectBetweenBrackets = function (e) { if (!U(e)) return h.Pass; }; function I(e) { return e ? /\bpunctuation\b/.test(e) ? e : void 0 : null; } v(I, "puncType"), a.goToBracket = function (e) { e.extendSelectionsBy(function (t) { var n = e.scanForBracket(t.head, 1, I(e.getTokenTypeAt(t.head))); if (n && h.cmpPos(n.pos, t.head) != 0) return n.pos; var r = e.scanForBracket(t.head, -1, I(e.getTokenTypeAt(f(t.head.line, t.head.ch + 1)))); return r && f(r.pos.line, r.pos.ch + 1) || t.head; }); }, a.swapLineUp = function (e) { if (e.isReadOnly()) return h.Pass; for (var t = e.listSelections(), n = [], r = e.firstLine() - 1, l = [], i = 0; i < t.length; i++) { var o = t[i], s = o.from().line - 1, u = o.to().line; l.push({ anchor: f(o.anchor.line - 1, o.anchor.ch), head: f(o.head.line - 1, o.head.ch) }), o.to().ch == 0 && !o.empty() && --u, s > r ? n.push(s, u) : n.length && (n[n.length - 1] = u), r = u; } e.operation(function () { for (var d = 0; d < n.length; d += 2) { var p = n[d], c = n[d + 1], b = e.getLine(p); e.replaceRange("", f(p, 0), f(p + 1, 0), "+swapLine"), c > e.lastLine() ? e.replaceRange(` ` + b, f(e.lastLine()), null, "+swapLine") : e.replaceRange(b + ` `, f(c, 0), null, "+swapLine"); } e.setSelections(l), e.scrollIntoView(); }); }, a.swapLineDown = function (e) { if (e.isReadOnly()) return h.Pass; for (var t = e.listSelections(), n = [], r = e.lastLine() + 1, l = t.length - 1; l >= 0; l--) { var i = t[l], o = i.to().line + 1, s = i.from().line; i.to().ch == 0 && !i.empty() && o--, o < r ? n.push(o, s) : n.length && (n[n.length - 1] = s), r = s; } e.operation(function () { for (var u = n.length - 2; u >= 0; u -= 2) { var d = n[u], p = n[u + 1], c = e.getLine(d); d == e.lastLine() ? e.replaceRange("", f(d - 1), f(d), "+swapLine") : e.replaceRange("", f(d, 0), f(d + 1, 0), "+swapLine"), e.replaceRange(c + ` `, f(p, 0), null, "+swapLine"); } e.scrollIntoView(); }); }, a.toggleCommentIndented = function (e) { e.toggleComment({ indent: !0 }); }, a.joinLines = function (e) { for (var t = e.listSelections(), n = [], r = 0; r < t.length; r++) { for (var l = t[r], i = l.from(), o = i.line, s = l.to().line; r < t.length - 1 && t[r + 1].from().line == s;) s = t[++r].to().line; n.push({ start: o, end: s, anchor: !l.empty() && i }); } e.operation(function () { for (var u = 0, d = [], p = 0; p < n.length; p++) { for (var c = n[p], b = c.anchor && f(c.anchor.line - u, c.anchor.ch), w, g = c.start; g <= c.end; g++) { var S = g - u; g == c.end && (w = f(S, e.getLine(S).length + 1)), S < e.lastLine() && (e.replaceRange(" ", f(S), f(S + 1, /^\s*/.exec(e.getLine(S + 1))[0].length)), ++u); } d.push({ anchor: b || w, head: w }); } e.setSelections(d, 0); }); }, a.duplicateLine = function (e) { e.operation(function () { for (var t = e.listSelections().length, n = 0; n < t; n++) { var r = e.listSelections()[n]; r.empty() ? e.replaceRange(e.getLine(r.head.line) + ` `, f(r.head.line, 0)) : e.replaceRange(e.getRange(r.from(), r.to()), r.from()); } e.scrollIntoView(); }); }; function R(e, t, n) { if (e.isReadOnly()) return h.Pass; for (var r = e.listSelections(), l = [], i, o = 0; o < r.length; o++) { var s = r[o]; if (!s.empty()) { for (var u = s.from().line, d = s.to().line; o < r.length - 1 && r[o + 1].from().line == d;) d = r[++o].to().line; r[o].to().ch || d--, l.push(u, d); } } l.length ? i = !0 : l.push(e.firstLine(), e.lastLine()), e.operation(function () { for (var p = [], c = 0; c < l.length; c += 2) { var b = l[c], w = l[c + 1], g = f(b, 0), S = f(w), F = e.getRange(g, S, !1); t ? F.sort(function (k, L) { return k < L ? -n : k == L ? 0 : n; }) : F.sort(function (k, L) { var W = k.toUpperCase(), M = L.toUpperCase(); return W != M && (k = W, L = M), k < L ? -n : k == L ? 0 : n; }), e.replaceRange(F, g, S), i && p.push({ anchor: g, head: f(w + 1, 0) }); } i && e.setSelections(p, 0); }); } v(R, "sortLines"), a.sortLines = function (e) { R(e, !0, 1); }, a.reverseSortLines = function (e) { R(e, !0, -1); }, a.sortLinesInsensitive = function (e) { R(e, !1, 1); }, a.reverseSortLinesInsensitive = function (e) { R(e, !1, -1); }, a.nextBookmark = function (e) { var t = e.state.sublimeBookmarks; if (t) for (; t.length;) { var n = t.shift(), r = n.find(); if (r) return t.push(n), e.setSelection(r.from, r.to); } }, a.prevBookmark = function (e) { var t = e.state.sublimeBookmarks; if (t) for (; t.length;) { t.unshift(t.pop()); var n = t[t.length - 1].find(); if (!n) t.pop();else return e.setSelection(n.from, n.to); } }, a.toggleBookmark = function (e) { for (var t = e.listSelections(), n = e.state.sublimeBookmarks || (e.state.sublimeBookmarks = []), r = 0; r < t.length; r++) { for (var l = t[r].from(), i = t[r].to(), o = t[r].empty() ? e.findMarksAt(l) : e.findMarks(l, i), s = 0; s < o.length; s++) if (o[s].sublimeBookmark) { o[s].clear(); for (var u = 0; u < n.length; u++) n[u] == o[s] && n.splice(u--, 1); break; } s == o.length && n.push(e.markText(l, i, { sublimeBookmark: !0, clearWhenEmpty: !1 })); } }, a.clearBookmarks = function (e) { var t = e.state.sublimeBookmarks; if (t) for (var n = 0; n < t.length; n++) t[n].clear(); t.length = 0; }, a.selectBookmarks = function (e) { var t = e.state.sublimeBookmarks, n = []; if (t) for (var r = 0; r < t.length; r++) { var l = t[r].find(); l ? n.push({ anchor: l.from, head: l.to }) : t.splice(r--, 0); } n.length && e.setSelections(n, 0); }; function D(e, t) { e.operation(function () { for (var n = e.listSelections(), r = [], l = [], i = 0; i < n.length; i++) { var o = n[i]; o.empty() ? (r.push(i), l.push("")) : l.push(t(e.getRange(o.from(), o.to()))); } e.replaceSelections(l, "around", "case"); for (var i = r.length - 1, s; i >= 0; i--) { var o = n[r[i]]; if (!(s && h.cmpPos(o.head, s) > 0)) { var u = K(e, o.head); s = u.from, e.replaceRange(t(u.word), u.from, u.to); } } }); } v(D, "modifyWordOrSelection"), a.smartBackspace = function (e) { if (e.somethingSelected()) return h.Pass; e.operation(function () { for (var t = e.listSelections(), n = e.getOption("indentUnit"), r = t.length - 1; r >= 0; r--) { var l = t[r].head, i = e.getRange({ line: l.line, ch: 0 }, l), o = h.countColumn(i, null, e.getOption("tabSize")), s = e.findPosH(l, -1, "char", !1); if (i && !/\S/.test(i) && o % n == 0) { var u = new f(l.line, h.findColumn(i, o - n, n)); u.ch != l.ch && (s = u); } e.replaceRange("", s, l, "+delete"); } }); }, a.delLineRight = function (e) { e.operation(function () { for (var t = e.listSelections(), n = t.length - 1; n >= 0; n--) e.replaceRange("", t[n].anchor, f(t[n].to().line), "+delete"); e.scrollIntoView(); }); }, a.upcaseAtCursor = function (e) { D(e, function (t) { return t.toUpperCase(); }); }, a.downcaseAtCursor = function (e) { D(e, function (t) { return t.toLowerCase(); }); }, a.setSublimeMark = function (e) { e.state.sublimeMark && e.state.sublimeMark.clear(), e.state.sublimeMark = e.setBookmark(e.getCursor()); }, a.selectToSublimeMark = function (e) { var t = e.state.sublimeMark && e.state.sublimeMark.find(); t && e.setSelection(e.getCursor(), t); }, a.deleteToSublimeMark = function (e) { var t = e.state.sublimeMark && e.state.sublimeMark.find(); if (t) { var n = e.getCursor(), r = t; if (h.cmpPos(n, r) > 0) { var l = r; r = n, n = l; } e.state.sublimeKilled = e.getRange(n, r), e.replaceRange("", n, r); } }, a.swapWithSublimeMark = function (e) { var t = e.state.sublimeMark && e.state.sublimeMark.find(); t && (e.state.sublimeMark.clear(), e.state.sublimeMark = e.setBookmark(e.getCursor()), e.setCursor(t)); }, a.sublimeYank = function (e) { e.state.sublimeKilled != null && e.replaceSelection(e.state.sublimeKilled, null, "paste"); }, a.showInCenter = function (e) { var t = e.cursorCoords(null, "local"); e.scrollTo(null, (t.top + t.bottom) / 2 - e.getScrollInfo().clientHeight / 2); }; function N(e) { var t = e.getCursor("from"), n = e.getCursor("to"); if (h.cmpPos(t, n) == 0) { var r = K(e, t); if (!r.word) return; t = r.from, n = r.to; } return { from: t, to: n, query: e.getRange(t, n), word: r }; } v(N, "getTarget"); function O(e, t) { var n = N(e); if (n) { var r = n.query, l = e.getSearchCursor(r, t ? n.to : n.from); (t ? l.findNext() : l.findPrevious()) ? e.setSelection(l.from(), l.to()) : (l = e.getSearchCursor(r, t ? f(e.firstLine(), 0) : e.clipPos(f(e.lastLine()))), (t ? l.findNext() : l.findPrevious()) ? e.setSelection(l.from(), l.to()) : n.word && e.setSelection(n.from, n.to)); } } v(O, "findAndGoTo"), a.findUnder = function (e) { O(e, !0); }, a.findUnderPrevious = function (e) { O(e, !1); }, a.findAllUnder = function (e) { var t = N(e); if (t) { for (var n = e.getSearchCursor(t.query), r = [], l = -1; n.findNext();) r.push({ anchor: n.from(), head: n.to() }), n.from().line <= t.from.line && n.from().ch <= t.from.ch && l++; e.setSelections(r, l); } }; var C = h.keyMap; C.macSublime = { "Cmd-Left": "goLineStartSmart", "Shift-Tab": "indentLess", "Shift-Ctrl-K": "deleteLine", "Alt-Q": "wrapLines", "Ctrl-Left": "goSubwordLeft", "Ctrl-Right": "goSubwordRight", "Ctrl-Alt-Up": "scrollLineUp", "Ctrl-Alt-Down": "scrollLineDown", "Cmd-L": "selectLine", "Shift-Cmd-L": "splitSelectionByLine", Esc: "singleSelectionTop", "Cmd-Enter": "insertLineAfter", "Shift-Cmd-Enter": "insertLineBefore", "Cmd-D": "selectNextOccurrence", "Shift-Cmd-Space": "selectScope", "Shift-Cmd-M": "selectBetweenBrackets", "Cmd-M": "goToBracket", "Cmd-Ctrl-Up": "swapLineUp", "Cmd-Ctrl-Down": "swapLineDown", "Cmd-/": "toggleCommentIndented", "Cmd-J": "joinLines", "Shift-Cmd-D": "duplicateLine", F5: "sortLines", "Shift-F5": "reverseSortLines", "Cmd-F5": "sortLinesInsensitive", "Shift-Cmd-F5": "reverseSortLinesInsensitive", F2: "nextBookmark", "Shift-F2": "prevBookmark", "Cmd-F2": "toggleBookmark", "Shift-Cmd-F2": "clearBookmarks", "Alt-F2": "selectBookmarks", Backspace: "smartBackspace", "Cmd-K Cmd-D": "skipAndSelectNextOccurrence", "Cmd-K Cmd-K": "delLineRight", "Cmd-K Cmd-U": "upcaseAtCursor", "Cmd-K Cmd-L": "downcaseAtCursor", "Cmd-K Cmd-Space": "setSublimeMark", "Cmd-K Cmd-A": "selectToSublimeMark", "Cmd-K Cmd-W": "deleteToSublimeMark", "Cmd-K Cmd-X": "swapWithSublimeMark", "Cmd-K Cmd-Y": "sublimeYank", "Cmd-K Cmd-C": "showInCenter", "Cmd-K Cmd-G": "clearBookmarks", "Cmd-K Cmd-Backspace": "delLineLeft", "Cmd-K Cmd-1": "foldAll", "Cmd-K Cmd-0": "unfoldAll", "Cmd-K Cmd-J": "unfoldAll", "Ctrl-Shift-Up": "addCursorToPrevLine", "Ctrl-Shift-Down": "addCursorToNextLine", "Cmd-F3": "findUnder", "Shift-Cmd-F3": "findUnderPrevious", "Alt-F3": "findAllUnder", "Shift-Cmd-[": "fold", "Shift-Cmd-]": "unfold", "Cmd-I": "findIncremental", "Shift-Cmd-I": "findIncrementalReverse", "Cmd-H": "replace", F3: "findNext", "Shift-F3": "findPrev", fallthrough: "macDefault" }, h.normalizeKeyMap(C.macSublime), C.pcSublime = { "Shift-Tab": "indentLess", "Shift-Ctrl-K": "deleteLine", "Alt-Q": "wrapLines", "Ctrl-T": "transposeChars", "Alt-Left": "goSubwordLeft", "Alt-Right": "goSubwordRight", "Ctrl-Up": "scrollLineUp", "Ctrl-Down": "scrollLineDown", "Ctrl-L": "selectLine", "Shift-Ctrl-L": "splitSelectionByLine", Esc: "singleSelectionTop", "Ctrl-Enter": "insertLineAfter", "Shift-Ctrl-Enter": "insertLineBefore", "Ctrl-D": "selectNextOccurrence", "Shift-Ctrl-Space": "selectScope", "Shift-Ctrl-M": "selectBetweenBrackets", "Ctrl-M": "goToBracket", "Shift-Ctrl-Up": "swapLineUp", "Shift-Ctrl-Down": "swapLineDown", "Ctrl-/": "toggleCommentIndented", "Ctrl-J": "joinLines", "Shift-Ctrl-D": "duplicateLine", F9: "sortLines", "Shift-F9": "reverseSortLines", "Ctrl-F9": "sortLinesInsensitive", "Shift-Ctrl-F9": "reverseSortLinesInsensitive", F2: "nextBookmark", "Shift-F2": "prevBookmark", "Ctrl-F2": "toggleBookmark", "Shift-Ctrl-F2": "clearBookmarks", "Alt-F2": "selectBookmarks", Backspace: "smartBackspace", "Ctrl-K Ctrl-D": "skipAndSelectNextOccurrence", "Ctrl-K Ctrl-K": "delLineRight", "Ctrl-K Ctrl-U": "upcaseAtCursor", "Ctrl-K Ctrl-L": "downcaseAtCursor", "Ctrl-K Ctrl-Space": "setSublimeMark", "Ctrl-K Ctrl-A": "selectToSublimeMark", "Ctrl-K Ctrl-W": "deleteToSublimeMark", "Ctrl-K Ctrl-X": "swapWithSublimeMark", "Ctrl-K Ctrl-Y": "sublimeYank", "Ctrl-K Ctrl-C": "showInCenter", "Ctrl-K Ctrl-G": "clearBookmarks", "Ctrl-K Ctrl-Backspace": "delLineLeft", "Ctrl-K Ctrl-1": "foldAll", "Ctrl-K Ctrl-0": "unfoldAll", "Ctrl-K Ctrl-J": "unfoldAll", "Ctrl-Alt-Up": "addCursorToPrevLine", "Ctrl-Alt-Down": "addCursorToNextLine", "Ctrl-F3": "findUnder", "Shift-Ctrl-F3": "findUnderPrevious", "Alt-F3": "findAllUnder", "Shift-Ctrl-[": "fold", "Shift-Ctrl-]": "unfold", "Ctrl-I": "findIncremental", "Shift-Ctrl-I": "findIncrementalReverse", "Ctrl-H": "replace", F3: "findNext", "Shift-F3": "findPrev", fallthrough: "pcDefault" }, h.normalizeKeyMap(C.pcSublime); var V = C.default == C.macDefault; C.sublime = V ? C.macSublime : C.pcSublime; }); })(); var q = G.exports; const Q = E.getDefaultExportFromCjs(q), X = J({ __proto__: null, default: Q }, [q]); exports.sublime = X; /***/ }), /***/ "../../graphiql-toolkit/esm/async-helpers/index.js": /*!*********************************************************!*\ !*** ../../graphiql-toolkit/esm/async-helpers/index.js ***! \*********************************************************/ /***/ (function(__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fetcherReturnToPromise = fetcherReturnToPromise; exports.isAsyncIterable = isAsyncIterable; exports.isObservable = isObservable; exports.isPromise = isPromise; var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; function isPromise(value) { return typeof value === 'object' && value !== null && typeof value.then === 'function'; } function observableToPromise(observable) { return new Promise((resolve, reject) => { const subscription = observable.subscribe({ next(v) { resolve(v); subscription.unsubscribe(); }, error: reject, complete() { reject(new Error('no value resolved')); } }); }); } function isObservable(value) { return typeof value === 'object' && value !== null && 'subscribe' in value && typeof value.subscribe === 'function'; } function isAsyncIterable(input) { return typeof input === 'object' && input !== null && (input[Symbol.toStringTag] === 'AsyncGenerator' || Symbol.asyncIterator in input); } function asyncIterableToPromise(input) { var _a; return __awaiter(this, void 0, void 0, function* () { const iteratorReturn = (_a = ('return' in input ? input : input[Symbol.asyncIterator]()).return) === null || _a === void 0 ? void 0 : _a.bind(input); const iteratorNext = ('next' in input ? input : input[Symbol.asyncIterator]()).next.bind(input); const result = yield iteratorNext(); void (iteratorReturn === null || iteratorReturn === void 0 ? void 0 : iteratorReturn()); return result.value; }); } function fetcherReturnToPromise(fetcherResult) { return __awaiter(this, void 0, void 0, function* () { const result = yield fetcherResult; if (isAsyncIterable(result)) { return asyncIterableToPromise(result); } if (isObservable(result)) { return observableToPromise(result); } return result; }); } /***/ }), /***/ "../../graphiql-toolkit/esm/create-fetcher/createFetcher.js": /*!******************************************************************!*\ !*** ../../graphiql-toolkit/esm/create-fetcher/createFetcher.js ***! \******************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createGraphiQLFetcher = createGraphiQLFetcher; var _lib = __webpack_require__(/*! ./lib */ "../../graphiql-toolkit/esm/create-fetcher/lib.js"); function createGraphiQLFetcher(options) { let httpFetch; if (typeof window !== 'undefined' && window.fetch) { httpFetch = window.fetch; } if ((options === null || options === void 0 ? void 0 : options.enableIncrementalDelivery) === null || options.enableIncrementalDelivery !== false) { options.enableIncrementalDelivery = true; } if (options.fetch) { httpFetch = options.fetch; } if (!httpFetch) { throw new Error('No valid fetcher implementation available'); } const simpleFetcher = (0, _lib.createSimpleFetcher)(options, httpFetch); const httpFetcher = options.enableIncrementalDelivery ? (0, _lib.createMultipartFetcher)(options, httpFetch) : simpleFetcher; return (graphQLParams, fetcherOpts) => { if (graphQLParams.operationName === 'IntrospectionQuery') { return (options.schemaFetcher || simpleFetcher)(graphQLParams, fetcherOpts); } const isSubscription = (fetcherOpts === null || fetcherOpts === void 0 ? void 0 : fetcherOpts.documentAST) ? (0, _lib.isSubscriptionWithName)(fetcherOpts.documentAST, graphQLParams.operationName || undefined) : false; if (isSubscription) { const wsFetcher = (0, _lib.getWsFetcher)(options, fetcherOpts); if (!wsFetcher) { throw new Error(`Your GraphiQL createFetcher is not properly configured for websocket subscriptions yet. ${options.subscriptionUrl ? `Provided URL ${options.subscriptionUrl} failed` : 'Please provide subscriptionUrl, wsClient or legacyClient option first.'}`); } return wsFetcher(graphQLParams); } return httpFetcher(graphQLParams, fetcherOpts); }; } /***/ }), /***/ "../../graphiql-toolkit/esm/create-fetcher/index.js": /*!**********************************************************!*\ !*** ../../graphiql-toolkit/esm/create-fetcher/index.js ***! \**********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); var _exportNames = { createGraphiQLFetcher: true }; Object.defineProperty(exports, "createGraphiQLFetcher", ({ enumerable: true, get: function () { return _createFetcher.createGraphiQLFetcher; } })); var _types = __webpack_require__(/*! ./types */ "../../graphiql-toolkit/esm/create-fetcher/types.js"); Object.keys(_types).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _types[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _types[key]; } }); }); var _createFetcher = __webpack_require__(/*! ./createFetcher */ "../../graphiql-toolkit/esm/create-fetcher/createFetcher.js"); /***/ }), /***/ "../../graphiql-toolkit/esm/create-fetcher/lib.js": /*!********************************************************!*\ !*** ../../graphiql-toolkit/esm/create-fetcher/lib.js ***! \********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isSubscriptionWithName = exports.getWsFetcher = exports.createWebsocketsFetcherFromUrl = exports.createWebsocketsFetcherFromClient = exports.createSimpleFetcher = exports.createMultipartFetcher = exports.createLegacyWebsocketsFetcher = void 0; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); var _meros = __webpack_require__(/*! meros */ "../../../node_modules/meros/browser/index.mjs"); var _pushPullAsyncIterableIterator = __webpack_require__(/*! @n1ru4l/push-pull-async-iterable-iterator */ "../../../node_modules/@n1ru4l/push-pull-async-iterable-iterator/index.js"); var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __await = void 0 && (void 0).__await || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }; var __asyncValues = void 0 && (void 0).__asyncValues || function (o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); } }; var __asyncGenerator = void 0 && (void 0).__asyncGenerator || function (thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } }; const errorHasCode = err => { return typeof err === 'object' && err !== null && 'code' in err; }; const isSubscriptionWithName = (document, name) => { let isSubscription = false; (0, _graphql.visit)(document, { OperationDefinition(node) { var _a; if (name === ((_a = node.name) === null || _a === void 0 ? void 0 : _a.value) && node.operation === 'subscription') { isSubscription = true; } } }); return isSubscription; }; exports.isSubscriptionWithName = isSubscriptionWithName; const createSimpleFetcher = (options, httpFetch) => (graphQLParams, fetcherOpts) => __awaiter(void 0, void 0, void 0, function* () { const data = yield httpFetch(options.url, { method: 'POST', body: JSON.stringify(graphQLParams), headers: Object.assign(Object.assign({ 'content-type': 'application/json' }, options.headers), fetcherOpts === null || fetcherOpts === void 0 ? void 0 : fetcherOpts.headers) }); return data.json(); }); exports.createSimpleFetcher = createSimpleFetcher; const createWebsocketsFetcherFromUrl = (url, connectionParams) => { let wsClient; try { const { createClient } = __webpack_require__(/*! graphql-ws */ "../../../node_modules/graphql-ws/lib/index.js"); wsClient = createClient({ url, connectionParams }); return createWebsocketsFetcherFromClient(wsClient); } catch (err) { if (errorHasCode(err) && err.code === 'MODULE_NOT_FOUND') { throw new Error("You need to install the 'graphql-ws' package to use websockets when passing a 'subscriptionUrl'"); } console.error(`Error creating websocket client for ${url}`, err); } }; exports.createWebsocketsFetcherFromUrl = createWebsocketsFetcherFromUrl; const createWebsocketsFetcherFromClient = wsClient => graphQLParams => (0, _pushPullAsyncIterableIterator.makeAsyncIterableIteratorFromSink)(sink => wsClient.subscribe(graphQLParams, Object.assign(Object.assign({}, sink), { error(err) { if (err instanceof CloseEvent) { sink.error(new Error(`Socket closed with event ${err.code} ${err.reason || ''}`.trim())); } else { sink.error(err); } } }))); exports.createWebsocketsFetcherFromClient = createWebsocketsFetcherFromClient; const createLegacyWebsocketsFetcher = legacyWsClient => graphQLParams => { const observable = legacyWsClient.request(graphQLParams); return (0, _pushPullAsyncIterableIterator.makeAsyncIterableIteratorFromSink)(sink => observable.subscribe(sink).unsubscribe); }; exports.createLegacyWebsocketsFetcher = createLegacyWebsocketsFetcher; const createMultipartFetcher = (options, httpFetch) => function (graphQLParams, fetcherOpts) { return __asyncGenerator(this, arguments, function* () { var e_1, _a; const response = yield __await(httpFetch(options.url, { method: 'POST', body: JSON.stringify(graphQLParams), headers: Object.assign(Object.assign({ 'content-type': 'application/json', accept: 'application/json, multipart/mixed' }, options.headers), fetcherOpts === null || fetcherOpts === void 0 ? void 0 : fetcherOpts.headers) }).then(r => (0, _meros.meros)(r, { multiple: true }))); if (!(0, _pushPullAsyncIterableIterator.isAsyncIterable)(response)) { return yield __await(yield yield __await(response.json())); } try { for (var response_1 = __asyncValues(response), response_1_1; response_1_1 = yield __await(response_1.next()), !response_1_1.done;) { const chunk = response_1_1.value; if (chunk.some(part => !part.json)) { const message = chunk.map(part => `Headers::\n${part.headers}\n\nBody::\n${part.body}`); throw new Error(`Expected multipart chunks to be of json type. got:\n${message}`); } yield yield __await(chunk.map(part => part.body)); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (response_1_1 && !response_1_1.done && (_a = response_1.return)) yield __await(_a.call(response_1)); } finally { if (e_1) throw e_1.error; } } }); }; exports.createMultipartFetcher = createMultipartFetcher; const getWsFetcher = (options, fetcherOpts) => { if (options.wsClient) { return createWebsocketsFetcherFromClient(options.wsClient); } if (options.subscriptionUrl) { return createWebsocketsFetcherFromUrl(options.subscriptionUrl, Object.assign(Object.assign({}, options.wsConnectionParams), fetcherOpts === null || fetcherOpts === void 0 ? void 0 : fetcherOpts.headers)); } const legacyWebsocketsClient = options.legacyClient || options.legacyWsClient; if (legacyWebsocketsClient) { return createLegacyWebsocketsFetcher(legacyWebsocketsClient); } }; exports.getWsFetcher = getWsFetcher; /***/ }), /***/ "../../graphiql-toolkit/esm/create-fetcher/types.js": /*!**********************************************************!*\ !*** ../../graphiql-toolkit/esm/create-fetcher/types.js ***! \**********************************************************/ /***/ (function(__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), /***/ "../../graphiql-toolkit/esm/format/index.js": /*!**************************************************!*\ !*** ../../graphiql-toolkit/esm/format/index.js ***! \**************************************************/ /***/ (function(__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.formatError = formatError; exports.formatResult = formatResult; function stringify(obj) { return JSON.stringify(obj, null, 2); } function formatSingleError(error) { return Object.assign(Object.assign({}, error), { message: error.message, stack: error.stack }); } function handleSingleError(error) { if (error instanceof Error) { return formatSingleError(error); } return error; } function formatError(error) { if (Array.isArray(error)) { return stringify({ errors: error.map(e => handleSingleError(e)) }); } return stringify({ errors: [handleSingleError(error)] }); } function formatResult(result) { return stringify(result); } /***/ }), /***/ "../../graphiql-toolkit/esm/graphql-helpers/auto-complete.js": /*!*******************************************************************!*\ !*** ../../graphiql-toolkit/esm/graphql-helpers/auto-complete.js ***! \*******************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.fillLeafs = fillLeafs; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); function fillLeafs(schema, docString, getDefaultFieldNames) { const insertions = []; if (!schema || !docString) { return { insertions, result: docString }; } let ast; try { ast = (0, _graphql.parse)(docString); } catch (_a) { return { insertions, result: docString }; } const fieldNameFn = getDefaultFieldNames || defaultGetDefaultFieldNames; const typeInfo = new _graphql.TypeInfo(schema); (0, _graphql.visit)(ast, { leave(node) { typeInfo.leave(node); }, enter(node) { typeInfo.enter(node); if (node.kind === 'Field' && !node.selectionSet) { const fieldType = typeInfo.getType(); const selectionSet = buildSelectionSet(isFieldType(fieldType), fieldNameFn); if (selectionSet && node.loc) { const indent = getIndentation(docString, node.loc.start); insertions.push({ index: node.loc.end, string: ' ' + (0, _graphql.print)(selectionSet).replaceAll('\n', '\n' + indent) }); } } } }); return { insertions, result: withInsertions(docString, insertions) }; } function defaultGetDefaultFieldNames(type) { if (!('getFields' in type)) { return []; } const fields = type.getFields(); if (fields.id) { return ['id']; } if (fields.edges) { return ['edges']; } if (fields.node) { return ['node']; } const leafFieldNames = []; for (const fieldName of Object.keys(fields)) { if ((0, _graphql.isLeafType)(fields[fieldName].type)) { leafFieldNames.push(fieldName); } } return leafFieldNames; } function buildSelectionSet(type, getDefaultFieldNames) { const namedType = (0, _graphql.getNamedType)(type); if (!type || (0, _graphql.isLeafType)(type)) { return; } const fieldNames = getDefaultFieldNames(namedType); if (!Array.isArray(fieldNames) || fieldNames.length === 0 || !('getFields' in namedType)) { return; } return { kind: _graphql.Kind.SELECTION_SET, selections: fieldNames.map(fieldName => { const fieldDef = namedType.getFields()[fieldName]; const fieldType = fieldDef ? fieldDef.type : null; return { kind: _graphql.Kind.FIELD, name: { kind: _graphql.Kind.NAME, value: fieldName }, selectionSet: buildSelectionSet(fieldType, getDefaultFieldNames) }; }) }; } function withInsertions(initial, insertions) { if (insertions.length === 0) { return initial; } let edited = ''; let prevIndex = 0; for (const { index, string } of insertions) { edited += initial.slice(prevIndex, index) + string; prevIndex = index; } edited += initial.slice(prevIndex); return edited; } function getIndentation(str, index) { let indentStart = index; let indentEnd = index; while (indentStart) { const c = str.charCodeAt(indentStart - 1); if (c === 10 || c === 13 || c === 0x2028 || c === 0x2029) { break; } indentStart--; if (c !== 9 && c !== 11 && c !== 12 && c !== 32 && c !== 160) { indentEnd = indentStart; } } return str.slice(indentStart, indentEnd); } function isFieldType(fieldType) { if (fieldType) { return fieldType; } } /***/ }), /***/ "../../graphiql-toolkit/esm/graphql-helpers/index.js": /*!***********************************************************!*\ !*** ../../graphiql-toolkit/esm/graphql-helpers/index.js ***! \***********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); var _autoComplete = __webpack_require__(/*! ./auto-complete */ "../../graphiql-toolkit/esm/graphql-helpers/auto-complete.js"); Object.keys(_autoComplete).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _autoComplete[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _autoComplete[key]; } }); }); var _mergeAst = __webpack_require__(/*! ./merge-ast */ "../../graphiql-toolkit/esm/graphql-helpers/merge-ast.js"); Object.keys(_mergeAst).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _mergeAst[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _mergeAst[key]; } }); }); var _operationName = __webpack_require__(/*! ./operation-name */ "../../graphiql-toolkit/esm/graphql-helpers/operation-name.js"); Object.keys(_operationName).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _operationName[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _operationName[key]; } }); }); /***/ }), /***/ "../../graphiql-toolkit/esm/graphql-helpers/merge-ast.js": /*!***************************************************************!*\ !*** ../../graphiql-toolkit/esm/graphql-helpers/merge-ast.js ***! \***************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.mergeAst = mergeAst; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); function uniqueBy(array, iteratee) { var _a; const FilteredMap = new Map(); const result = []; for (const item of array) { if (item.kind === 'Field') { const uniqueValue = iteratee(item); const existing = FilteredMap.get(uniqueValue); if ((_a = item.directives) === null || _a === void 0 ? void 0 : _a.length) { const itemClone = Object.assign({}, item); result.push(itemClone); } else if ((existing === null || existing === void 0 ? void 0 : existing.selectionSet) && item.selectionSet) { existing.selectionSet.selections = [...existing.selectionSet.selections, ...item.selectionSet.selections]; } else if (!existing) { const itemClone = Object.assign({}, item); FilteredMap.set(uniqueValue, itemClone); result.push(itemClone); } } else { result.push(item); } } return result; } function inlineRelevantFragmentSpreads(fragmentDefinitions, selections, selectionSetType) { var _a; const selectionSetTypeName = selectionSetType ? (0, _graphql.getNamedType)(selectionSetType).name : null; const outputSelections = []; const seenSpreads = []; for (let selection of selections) { if (selection.kind === 'FragmentSpread') { const fragmentName = selection.name.value; if (!selection.directives || selection.directives.length === 0) { if (seenSpreads.includes(fragmentName)) { continue; } else { seenSpreads.push(fragmentName); } } const fragmentDefinition = fragmentDefinitions[selection.name.value]; if (fragmentDefinition) { const { typeCondition, directives, selectionSet } = fragmentDefinition; selection = { kind: _graphql.Kind.INLINE_FRAGMENT, typeCondition, directives, selectionSet }; } } if (selection.kind === _graphql.Kind.INLINE_FRAGMENT && (!selection.directives || ((_a = selection.directives) === null || _a === void 0 ? void 0 : _a.length) === 0)) { const fragmentTypeName = selection.typeCondition ? selection.typeCondition.name.value : null; if (!fragmentTypeName || fragmentTypeName === selectionSetTypeName) { outputSelections.push(...inlineRelevantFragmentSpreads(fragmentDefinitions, selection.selectionSet.selections, selectionSetType)); continue; } } outputSelections.push(selection); } return outputSelections; } function mergeAst(documentAST, schema) { const typeInfo = schema ? new _graphql.TypeInfo(schema) : null; const fragmentDefinitions = Object.create(null); for (const definition of documentAST.definitions) { if (definition.kind === _graphql.Kind.FRAGMENT_DEFINITION) { fragmentDefinitions[definition.name.value] = definition; } } const flattenVisitors = { SelectionSet(node) { const selectionSetType = typeInfo ? typeInfo.getParentType() : null; let { selections } = node; selections = inlineRelevantFragmentSpreads(fragmentDefinitions, selections, selectionSetType); return Object.assign(Object.assign({}, node), { selections }); }, FragmentDefinition() { return null; } }; const flattenedAST = (0, _graphql.visit)(documentAST, typeInfo ? (0, _graphql.visitWithTypeInfo)(typeInfo, flattenVisitors) : flattenVisitors); const deduplicateVisitors = { SelectionSet(node) { let { selections } = node; selections = uniqueBy(selections, selection => selection.alias ? selection.alias.value : selection.name.value); return Object.assign(Object.assign({}, node), { selections }); }, FragmentDefinition() { return null; } }; return (0, _graphql.visit)(flattenedAST, deduplicateVisitors); } /***/ }), /***/ "../../graphiql-toolkit/esm/graphql-helpers/operation-name.js": /*!********************************************************************!*\ !*** ../../graphiql-toolkit/esm/graphql-helpers/operation-name.js ***! \********************************************************************/ /***/ (function(__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getSelectedOperationName = getSelectedOperationName; function getSelectedOperationName(prevOperations, prevSelectedOperationName, operations) { if (!operations || operations.length < 1) { return; } const names = operations.map(op => { var _a; return (_a = op.name) === null || _a === void 0 ? void 0 : _a.value; }); if (prevSelectedOperationName && names.includes(prevSelectedOperationName)) { return prevSelectedOperationName; } if (prevSelectedOperationName && prevOperations) { const prevNames = prevOperations.map(op => { var _a; return (_a = op.name) === null || _a === void 0 ? void 0 : _a.value; }); const prevIndex = prevNames.indexOf(prevSelectedOperationName); if (prevIndex !== -1 && prevIndex < names.length) { return names[prevIndex]; } } return names[0]; } /***/ }), /***/ "../../graphiql-toolkit/esm/index.js": /*!*******************************************!*\ !*** ../../graphiql-toolkit/esm/index.js ***! \*******************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); var _asyncHelpers = __webpack_require__(/*! ./async-helpers */ "../../graphiql-toolkit/esm/async-helpers/index.js"); Object.keys(_asyncHelpers).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _asyncHelpers[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _asyncHelpers[key]; } }); }); var _createFetcher = __webpack_require__(/*! ./create-fetcher */ "../../graphiql-toolkit/esm/create-fetcher/index.js"); Object.keys(_createFetcher).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _createFetcher[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _createFetcher[key]; } }); }); var _format = __webpack_require__(/*! ./format */ "../../graphiql-toolkit/esm/format/index.js"); Object.keys(_format).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _format[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _format[key]; } }); }); var _graphqlHelpers = __webpack_require__(/*! ./graphql-helpers */ "../../graphiql-toolkit/esm/graphql-helpers/index.js"); Object.keys(_graphqlHelpers).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _graphqlHelpers[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _graphqlHelpers[key]; } }); }); var _storage = __webpack_require__(/*! ./storage */ "../../graphiql-toolkit/esm/storage/index.js"); Object.keys(_storage).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _storage[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _storage[key]; } }); }); /***/ }), /***/ "../../graphiql-toolkit/esm/storage/base.js": /*!**************************************************!*\ !*** ../../graphiql-toolkit/esm/storage/base.js ***! \**************************************************/ /***/ (function(__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.StorageAPI = void 0; function isQuotaError(storage, e) { return e instanceof DOMException && (e.code === 22 || e.code === 1014 || e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') && storage.length !== 0; } class StorageAPI { constructor(storage) { if (storage) { this.storage = storage; } else if (storage === null) { this.storage = null; } else if (typeof window === 'undefined') { this.storage = null; } else { this.storage = { getItem: window.localStorage.getItem.bind(window.localStorage), setItem: window.localStorage.setItem.bind(window.localStorage), removeItem: window.localStorage.removeItem.bind(window.localStorage), get length() { let keys = 0; for (const key in window.localStorage) { if (key.indexOf(`${STORAGE_NAMESPACE}:`) === 0) { keys += 1; } } return keys; }, clear() { for (const key in window.localStorage) { if (key.indexOf(`${STORAGE_NAMESPACE}:`) === 0) { window.localStorage.removeItem(key); } } } }; } } get(name) { if (!this.storage) { return null; } const key = `${STORAGE_NAMESPACE}:${name}`; const value = this.storage.getItem(key); if (value === 'null' || value === 'undefined') { this.storage.removeItem(key); return null; } return value || null; } set(name, value) { let quotaError = false; let error = null; if (this.storage) { const key = `${STORAGE_NAMESPACE}:${name}`; if (value) { try { this.storage.setItem(key, value); } catch (e) { error = e instanceof Error ? e : new Error(`${e}`); quotaError = isQuotaError(this.storage, e); } } else { this.storage.removeItem(key); } } return { isQuotaError: quotaError, error }; } clear() { if (this.storage) { this.storage.clear(); } } } exports.StorageAPI = StorageAPI; const STORAGE_NAMESPACE = 'graphiql'; /***/ }), /***/ "../../graphiql-toolkit/esm/storage/custom.js": /*!****************************************************!*\ !*** ../../graphiql-toolkit/esm/storage/custom.js ***! \****************************************************/ /***/ (function(__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createLocalStorage = createLocalStorage; function createLocalStorage(_ref) { let { namespace } = _ref; const storageKeyPrefix = `${namespace}:`; const getStorageKey = key => `${storageKeyPrefix}${key}`; const storage = { setItem: (key, value) => localStorage.setItem(getStorageKey(key), value), getItem: key => localStorage.getItem(getStorageKey(key)), removeItem: key => localStorage.removeItem(getStorageKey(key)), get length() { let keys = 0; for (const key in window.localStorage) { if (key.indexOf(storageKeyPrefix) === 0) { keys += 1; } } return keys; }, clear() { for (const key in window.localStorage) { if (key.indexOf(storageKeyPrefix) === 0) { window.localStorage.removeItem(key); } } } }; return storage; } /***/ }), /***/ "../../graphiql-toolkit/esm/storage/history.js": /*!*****************************************************!*\ !*** ../../graphiql-toolkit/esm/storage/history.js ***! \*****************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HistoryStore = void 0; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); var _query = __webpack_require__(/*! ./query */ "../../graphiql-toolkit/esm/storage/query.js"); const MAX_QUERY_SIZE = 100000; class HistoryStore { constructor(storage, maxHistoryLength) { var _this = this; this.storage = storage; this.maxHistoryLength = maxHistoryLength; this.updateHistory = _ref => { let { query, variables, headers, operationName } = _ref; if (!this.shouldSaveQuery(query, variables, headers, this.history.fetchRecent())) { return; } this.history.push({ query, variables, headers, operationName }); const historyQueries = this.history.items; const favoriteQueries = this.favorite.items; this.queries = historyQueries.concat(favoriteQueries); }; this.deleteHistory = function (_ref2) { let { query, variables, headers, operationName, favorite } = _ref2; let clearFavorites = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; function deleteFromStore(store) { const found = store.items.find(x => x.query === query && x.variables === variables && x.headers === headers && x.operationName === operationName); if (found) { store.delete(found); } } if (favorite || clearFavorites) { deleteFromStore(_this.favorite); } if (!favorite || clearFavorites) { deleteFromStore(_this.history); } _this.queries = [..._this.history.items, ..._this.favorite.items]; }; this.history = new _query.QueryStore('queries', this.storage, this.maxHistoryLength); this.favorite = new _query.QueryStore('favorites', this.storage, null); this.queries = [...this.history.fetchAll(), ...this.favorite.fetchAll()]; } shouldSaveQuery(query, variables, headers, lastQuerySaved) { if (!query) { return false; } try { (0, _graphql.parse)(query); } catch (_a) { return false; } if (query.length > MAX_QUERY_SIZE) { return false; } if (!lastQuerySaved) { return true; } if (JSON.stringify(query) === JSON.stringify(lastQuerySaved.query)) { if (JSON.stringify(variables) === JSON.stringify(lastQuerySaved.variables)) { if (JSON.stringify(headers) === JSON.stringify(lastQuerySaved.headers)) { return false; } if (headers && !lastQuerySaved.headers) { return false; } } if (variables && !lastQuerySaved.variables) { return false; } } return true; } toggleFavorite(_ref3) { let { query, variables, headers, operationName, label, favorite } = _ref3; const item = { query, variables, headers, operationName, label }; if (favorite) { item.favorite = false; this.favorite.delete(item); this.history.push(item); } else { item.favorite = true; this.favorite.push(item); this.history.delete(item); } this.queries = [...this.history.items, ...this.favorite.items]; } editLabel(_ref4, index) { let { query, variables, headers, operationName, label, favorite } = _ref4; const item = { query, variables, headers, operationName, label }; if (favorite) { this.favorite.edit(Object.assign(Object.assign({}, item), { favorite }), index); } else { this.history.edit(item, index); } this.queries = [...this.history.items, ...this.favorite.items]; } } exports.HistoryStore = HistoryStore; /***/ }), /***/ "../../graphiql-toolkit/esm/storage/index.js": /*!***************************************************!*\ !*** ../../graphiql-toolkit/esm/storage/index.js ***! \***************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); var _base = __webpack_require__(/*! ./base */ "../../graphiql-toolkit/esm/storage/base.js"); Object.keys(_base).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _base[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _base[key]; } }); }); var _history = __webpack_require__(/*! ./history */ "../../graphiql-toolkit/esm/storage/history.js"); Object.keys(_history).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _history[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _history[key]; } }); }); var _query = __webpack_require__(/*! ./query */ "../../graphiql-toolkit/esm/storage/query.js"); Object.keys(_query).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _query[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _query[key]; } }); }); var _custom = __webpack_require__(/*! ./custom */ "../../graphiql-toolkit/esm/storage/custom.js"); Object.keys(_custom).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _custom[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _custom[key]; } }); }); /***/ }), /***/ "../../graphiql-toolkit/esm/storage/query.js": /*!***************************************************!*\ !*** ../../graphiql-toolkit/esm/storage/query.js ***! \***************************************************/ /***/ (function(__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.QueryStore = void 0; class QueryStore { constructor(key, storage) { let maxSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; this.key = key; this.storage = storage; this.maxSize = maxSize; this.items = this.fetchAll(); } get length() { return this.items.length; } contains(item) { return this.items.some(x => x.query === item.query && x.variables === item.variables && x.headers === item.headers && x.operationName === item.operationName); } edit(item, index) { if (typeof index === 'number' && this.items[index]) { const found = this.items[index]; if (found.query === item.query && found.variables === item.variables && found.headers === item.headers && found.operationName === item.operationName) { this.items.splice(index, 1, item); this.save(); return; } } const itemIndex = this.items.findIndex(x => x.query === item.query && x.variables === item.variables && x.headers === item.headers && x.operationName === item.operationName); if (itemIndex !== -1) { this.items.splice(itemIndex, 1, item); this.save(); } } delete(item) { const itemIndex = this.items.findIndex(x => x.query === item.query && x.variables === item.variables && x.headers === item.headers && x.operationName === item.operationName); if (itemIndex !== -1) { this.items.splice(itemIndex, 1); this.save(); } } fetchRecent() { return this.items.at(-1); } fetchAll() { const raw = this.storage.get(this.key); if (raw) { return JSON.parse(raw)[this.key]; } return []; } push(item) { const items = [...this.items, item]; if (this.maxSize && items.length > this.maxSize) { items.shift(); } for (let attempts = 0; attempts < 5; attempts++) { const response = this.storage.set(this.key, JSON.stringify({ [this.key]: items })); if (!(response === null || response === void 0 ? void 0 : response.error)) { this.items = items; } else if (response.isQuotaError && this.maxSize) { items.shift(); } else { return; } } } save() { this.storage.set(this.key, JSON.stringify({ [this.key]: this.items })); } } exports.QueryStore = QueryStore; /***/ }), /***/ "./components/GraphiQL.tsx": /*!*********************************!*\ !*** ./components/GraphiQL.tsx ***! \*********************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GraphiQL = GraphiQL; exports.GraphiQLInterface = GraphiQLInterface; var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); var _react2 = __webpack_require__(/*! @graphiql/react */ "../../graphiql-react/dist/index.js"); 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; } function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } const majorVersion = parseInt(_react.default.version.slice(0, 2), 10); if (majorVersion < 16) { throw new Error(['GraphiQL 0.18.0 and after is not compatible with React 15 or below.', 'If you are using a CDN source (jsdelivr, unpkg, etc), follow this example:', 'https://github.com/graphql/graphiql/blob/master/examples/graphiql-cdn/index.html#L49'].join('\n')); } /** * The top-level React component for GraphiQL, intended to encompass the entire * browser viewport. * * @see https://github.com/graphql/graphiql#usage */ function GraphiQL(_ref) { let { dangerouslyAssumeSchemaIsValid, defaultQuery, defaultTabs, externalFragments, fetcher, getDefaultFieldNames, headers, inputValueDeprecation, introspectionQueryName, maxHistoryLength, onEditOperationName, onSchemaChange, onTabChange, onTogglePluginVisibility, operationName, plugins, query, response, schema, schemaDescription, shouldPersistHeaders, storage, validationRules, variables, visiblePlugin, defaultHeaders, ...props } = _ref; // Ensure props are correct if (typeof fetcher !== 'function') { throw new TypeError('The `GraphiQL` component requires a `fetcher` function to be passed as prop.'); } return /*#__PURE__*/_react.default.createElement(_react2.GraphiQLProvider, { getDefaultFieldNames: getDefaultFieldNames, dangerouslyAssumeSchemaIsValid: dangerouslyAssumeSchemaIsValid, defaultQuery: defaultQuery, defaultHeaders: defaultHeaders, defaultTabs: defaultTabs, externalFragments: externalFragments, fetcher: fetcher, headers: headers, inputValueDeprecation: inputValueDeprecation, introspectionQueryName: introspectionQueryName, maxHistoryLength: maxHistoryLength, onEditOperationName: onEditOperationName, onSchemaChange: onSchemaChange, onTabChange: onTabChange, onTogglePluginVisibility: onTogglePluginVisibility, plugins: plugins, visiblePlugin: visiblePlugin, operationName: operationName, query: query, response: response, schema: schema, schemaDescription: schemaDescription, shouldPersistHeaders: shouldPersistHeaders, storage: storage, validationRules: validationRules, variables: variables }, /*#__PURE__*/_react.default.createElement(GraphiQLInterface, _extends({ showPersistHeadersSettings: shouldPersistHeaders !== false }, props))); } // Export main windows/panes to be used separately if desired. GraphiQL.Logo = GraphiQLLogo; GraphiQL.Toolbar = GraphiQLToolbar; GraphiQL.Footer = GraphiQLFooter; function GraphiQLInterface(props) { var _props$isHeadersEdito, _pluginContext$visibl, _props$toolbar; const isHeadersEditorEnabled = (_props$isHeadersEdito = props.isHeadersEditorEnabled) !== null && _props$isHeadersEdito !== void 0 ? _props$isHeadersEdito : true; const editorContext = (0, _react2.useEditorContext)({ nonNull: true }); const executionContext = (0, _react2.useExecutionContext)({ nonNull: true }); const schemaContext = (0, _react2.useSchemaContext)({ nonNull: true }); const storageContext = (0, _react2.useStorageContext)(); const pluginContext = (0, _react2.usePluginContext)(); const copy = (0, _react2.useCopyQuery)({ onCopyQuery: props.onCopyQuery }); const merge = (0, _react2.useMergeQuery)(); const prettify = (0, _react2.usePrettifyEditors)(); const { theme, setTheme } = (0, _react2.useTheme)(); const PluginContent = pluginContext === null || pluginContext === void 0 ? void 0 : (_pluginContext$visibl = pluginContext.visiblePlugin) === null || _pluginContext$visibl === void 0 ? void 0 : _pluginContext$visibl.content; const pluginResize = (0, _react2.useDragResize)({ defaultSizeRelation: 1 / 3, direction: 'horizontal', initiallyHidden: pluginContext !== null && pluginContext !== void 0 && pluginContext.visiblePlugin ? undefined : 'first', onHiddenElementChange(resizableElement) { if (resizableElement === 'first') { pluginContext === null || pluginContext === void 0 ? void 0 : pluginContext.setVisiblePlugin(null); } }, sizeThresholdSecond: 200, storageKey: 'docExplorerFlex' }); const editorResize = (0, _react2.useDragResize)({ direction: 'horizontal', storageKey: 'editorFlex' }); const editorToolsResize = (0, _react2.useDragResize)({ defaultSizeRelation: 3, direction: 'vertical', initiallyHidden: (() => { if (props.defaultEditorToolsVisibility === 'variables' || props.defaultEditorToolsVisibility === 'headers') { return; } if (typeof props.defaultEditorToolsVisibility === 'boolean') { return props.defaultEditorToolsVisibility ? undefined : 'second'; } return editorContext.initialVariables || editorContext.initialHeaders ? undefined : 'second'; })(), sizeThresholdSecond: 60, storageKey: 'secondaryEditorFlex' }); const [activeSecondaryEditor, setActiveSecondaryEditor] = (0, _react.useState)(() => { if (props.defaultEditorToolsVisibility === 'variables' || props.defaultEditorToolsVisibility === 'headers') { return props.defaultEditorToolsVisibility; } return !editorContext.initialVariables && editorContext.initialHeaders && isHeadersEditorEnabled ? 'headers' : 'variables'; }); const [showDialog, setShowDialog] = (0, _react.useState)(null); const [clearStorageStatus, setClearStorageStatus] = (0, _react.useState)(null); const children = _react.default.Children.toArray(props.children); const logo = children.find(child => isChildComponentType(child, GraphiQL.Logo)) || /*#__PURE__*/_react.default.createElement(GraphiQL.Logo, null); const toolbar = children.find(child => isChildComponentType(child, GraphiQL.Toolbar)) || /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_react2.ToolbarButton, { onClick: prettify, label: "Prettify query (Shift-Ctrl-P)" }, /*#__PURE__*/_react.default.createElement(_react2.PrettifyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" })), /*#__PURE__*/_react.default.createElement(_react2.ToolbarButton, { onClick: merge, label: "Merge fragments into query (Shift-Ctrl-M)" }, /*#__PURE__*/_react.default.createElement(_react2.MergeIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" })), /*#__PURE__*/_react.default.createElement(_react2.ToolbarButton, { onClick: copy, label: "Copy query (Shift-Ctrl-C)" }, /*#__PURE__*/_react.default.createElement(_react2.CopyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" })), (_props$toolbar = props.toolbar) === null || _props$toolbar === void 0 ? void 0 : _props$toolbar.additionalContent); const footer = children.find(child => isChildComponentType(child, GraphiQL.Footer)); const onClickReference = (0, _react.useCallback)(() => { if (pluginResize.hiddenElement === 'first') { pluginResize.setHiddenElement(null); } }, [pluginResize]); const handleClearData = (0, _react.useCallback)(() => { try { storageContext === null || storageContext === void 0 ? void 0 : storageContext.clear(); setClearStorageStatus('success'); } catch { setClearStorageStatus('error'); } }, [storageContext]); const handlePersistHeaders = (0, _react.useCallback)(event => { editorContext.setShouldPersistHeaders(event.currentTarget.dataset.value === 'true'); }, [editorContext]); const handleChangeTheme = (0, _react.useCallback)(event => { const selectedTheme = event.currentTarget.dataset.theme; setTheme(selectedTheme || null); }, [setTheme]); const handleAddTab = editorContext.addTab; const handleRefetchSchema = schemaContext.introspect; const handleReorder = editorContext.moveTab; const handleShowDialog = (0, _react.useCallback)(event => { setShowDialog(event.currentTarget.dataset.value); }, []); const handlePluginClick = (0, _react.useCallback)(e => { const context = pluginContext; const pluginIndex = Number(e.currentTarget.dataset.index); const plugin = context.plugins.find((_, index) => pluginIndex === index); const isVisible = plugin === context.visiblePlugin; if (isVisible) { context.setVisiblePlugin(null); pluginResize.setHiddenElement('first'); } else { context.setVisiblePlugin(plugin); pluginResize.setHiddenElement(null); } }, [pluginContext, pluginResize]); const handleToolsTabClick = (0, _react.useCallback)(event => { if (editorToolsResize.hiddenElement === 'second') { editorToolsResize.setHiddenElement(null); } setActiveSecondaryEditor(event.currentTarget.dataset.name); }, [editorToolsResize]); const toggleEditorTools = (0, _react.useCallback)(() => { editorToolsResize.setHiddenElement(editorToolsResize.hiddenElement === 'second' ? null : 'second'); }, [editorToolsResize]); const handleOpenShortKeysDialog = (0, _react.useCallback)(isOpen => { if (!isOpen) { setShowDialog(null); } }, []); const handleOpenSettingsDialog = (0, _react.useCallback)(isOpen => { if (!isOpen) { setShowDialog(null); setClearStorageStatus(null); } }, []); const addTab = /*#__PURE__*/_react.default.createElement(_react2.Tooltip, { label: "Add tab" }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, { type: "button", className: "graphiql-tab-add", onClick: handleAddTab, "aria-label": "Add tab" }, /*#__PURE__*/_react.default.createElement(_react2.PlusIcon, { "aria-hidden": "true" }))); return /*#__PURE__*/_react.default.createElement(_react2.Tooltip.Provider, null, /*#__PURE__*/_react.default.createElement("div", { "data-testid": "graphiql-container", className: "graphiql-container" }, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-sidebar" }, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-sidebar-section" }, pluginContext === null || pluginContext === void 0 ? void 0 : pluginContext.plugins.map((plugin, index) => { const isVisible = plugin === pluginContext.visiblePlugin; const label = `${isVisible ? 'Hide' : 'Show'} ${plugin.title}`; const Icon = plugin.icon; return /*#__PURE__*/_react.default.createElement(_react2.Tooltip, { key: plugin.title, label: label }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, { type: "button", className: isVisible ? 'active' : '', onClick: handlePluginClick, "data-index": index, "aria-label": label }, /*#__PURE__*/_react.default.createElement(Icon, { "aria-hidden": "true" }))); })), /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-sidebar-section" }, /*#__PURE__*/_react.default.createElement(_react2.Tooltip, { label: "Re-fetch GraphQL schema" }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, { type: "button", disabled: schemaContext.isFetching, onClick: handleRefetchSchema, "aria-label": "Re-fetch GraphQL schema" }, /*#__PURE__*/_react.default.createElement(_react2.ReloadIcon, { className: schemaContext.isFetching ? 'graphiql-spin' : '', "aria-hidden": "true" }))), /*#__PURE__*/_react.default.createElement(_react2.Tooltip, { label: "Open short keys dialog" }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, { type: "button", "data-value": "short-keys", onClick: handleShowDialog, "aria-label": "Open short keys dialog" }, /*#__PURE__*/_react.default.createElement(_react2.KeyboardShortcutIcon, { "aria-hidden": "true" }))), /*#__PURE__*/_react.default.createElement(_react2.Tooltip, { label: "Open settings dialog" }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, { type: "button", "data-value": "settings", onClick: handleShowDialog, "aria-label": "Open settings dialog" }, /*#__PURE__*/_react.default.createElement(_react2.SettingsIcon, { "aria-hidden": "true" }))))), /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-main" }, /*#__PURE__*/_react.default.createElement("div", { ref: pluginResize.firstRef, style: { // Make sure the container shrinks when containing long // non-breaking texts minWidth: '200px' } }, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-plugin" }, PluginContent ? /*#__PURE__*/_react.default.createElement(PluginContent, null) : null)), (pluginContext === null || pluginContext === void 0 ? void 0 : pluginContext.visiblePlugin) && /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-horizontal-drag-bar", ref: pluginResize.dragBarRef }), /*#__PURE__*/_react.default.createElement("div", { ref: pluginResize.secondRef, className: "graphiql-sessions" }, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-session-header" }, /*#__PURE__*/_react.default.createElement(_react2.Tabs, { values: editorContext.tabs, onReorder: handleReorder, "aria-label": "Select active operation" }, editorContext.tabs.length > 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, editorContext.tabs.map((tab, index) => /*#__PURE__*/_react.default.createElement(_react2.Tab, { key: tab.id, value: tab, isActive: index === editorContext.activeTabIndex }, /*#__PURE__*/_react.default.createElement(_react2.Tab.Button, { "aria-controls": "graphiql-session", id: `graphiql-session-tab-${index}`, onClick: () => { executionContext.stop(); editorContext.changeTab(index); } }, tab.title), /*#__PURE__*/_react.default.createElement(_react2.Tab.Close, { onClick: () => { if (editorContext.activeTabIndex === index) { executionContext.stop(); } editorContext.closeTab(index); } }))), addTab)), /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-session-header-right" }, editorContext.tabs.length === 1 && addTab, logo)), /*#__PURE__*/_react.default.createElement("div", { role: "tabpanel", id: "graphiql-session", className: "graphiql-session", "aria-labelledby": `graphiql-session-tab-${editorContext.activeTabIndex}` }, /*#__PURE__*/_react.default.createElement("div", { ref: editorResize.firstRef }, /*#__PURE__*/_react.default.createElement("div", { className: `graphiql-editors${editorContext.tabs.length === 1 ? ' full-height' : ''}` }, /*#__PURE__*/_react.default.createElement("div", { ref: editorToolsResize.firstRef }, /*#__PURE__*/_react.default.createElement("section", { className: "graphiql-query-editor", "aria-label": "Query Editor" }, /*#__PURE__*/_react.default.createElement(_react2.QueryEditor, { editorTheme: props.editorTheme, keyMap: props.keyMap, onClickReference: onClickReference, onCopyQuery: props.onCopyQuery, onEdit: props.onEditQuery, readOnly: props.readOnly }), /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-toolbar", role: "toolbar", "aria-label": "Editor Commands" }, /*#__PURE__*/_react.default.createElement(_react2.ExecuteButton, null), toolbar))), /*#__PURE__*/_react.default.createElement("div", { ref: editorToolsResize.dragBarRef }, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-editor-tools" }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, { type: "button", className: activeSecondaryEditor === 'variables' && editorToolsResize.hiddenElement !== 'second' ? 'active' : '', onClick: handleToolsTabClick, "data-name": "variables" }, "Variables"), isHeadersEditorEnabled && /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, { type: "button", className: activeSecondaryEditor === 'headers' && editorToolsResize.hiddenElement !== 'second' ? 'active' : '', onClick: handleToolsTabClick, "data-name": "headers" }, "Headers"), /*#__PURE__*/_react.default.createElement(_react2.Tooltip, { label: editorToolsResize.hiddenElement === 'second' ? 'Show editor tools' : 'Hide editor tools' }, /*#__PURE__*/_react.default.createElement(_react2.UnStyledButton, { type: "button", onClick: toggleEditorTools, "aria-label": editorToolsResize.hiddenElement === 'second' ? 'Show editor tools' : 'Hide editor tools', className: "graphiql-toggle-editor-tools" }, editorToolsResize.hiddenElement === 'second' ? /*#__PURE__*/_react.default.createElement(_react2.ChevronUpIcon, { className: "graphiql-chevron-icon", "aria-hidden": "true" }) : /*#__PURE__*/_react.default.createElement(_react2.ChevronDownIcon, { className: "graphiql-chevron-icon", "aria-hidden": "true" }))))), /*#__PURE__*/_react.default.createElement("div", { ref: editorToolsResize.secondRef }, /*#__PURE__*/_react.default.createElement("section", { className: "graphiql-editor-tool", "aria-label": activeSecondaryEditor === 'variables' ? 'Variables' : 'Headers' }, /*#__PURE__*/_react.default.createElement(_react2.VariableEditor, { editorTheme: props.editorTheme, isHidden: activeSecondaryEditor !== 'variables', keyMap: props.keyMap, onEdit: props.onEditVariables, onClickReference: onClickReference, readOnly: props.readOnly }), isHeadersEditorEnabled && /*#__PURE__*/_react.default.createElement(_react2.HeaderEditor, { editorTheme: props.editorTheme, isHidden: activeSecondaryEditor !== 'headers', keyMap: props.keyMap, onEdit: props.onEditHeaders, readOnly: props.readOnly }))))), /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-horizontal-drag-bar", ref: editorResize.dragBarRef }), /*#__PURE__*/_react.default.createElement("div", { ref: editorResize.secondRef }, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-response" }, executionContext.isFetching ? /*#__PURE__*/_react.default.createElement(_react2.Spinner, null) : null, /*#__PURE__*/_react.default.createElement(_react2.ResponseEditor, { editorTheme: props.editorTheme, responseTooltip: props.responseTooltip, keyMap: props.keyMap }), footer))))), /*#__PURE__*/_react.default.createElement(_react2.Dialog, { open: showDialog === 'short-keys', onOpenChange: handleOpenShortKeysDialog }, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-header" }, /*#__PURE__*/_react.default.createElement(_react2.Dialog.Title, { className: "graphiql-dialog-title" }, "Short Keys"), /*#__PURE__*/_react.default.createElement(_react2.Dialog.Close, null)), /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-section" }, /*#__PURE__*/_react.default.createElement(ShortKeys, { keyMap: props.keyMap || 'sublime' }))), /*#__PURE__*/_react.default.createElement(_react2.Dialog, { open: showDialog === 'settings', onOpenChange: handleOpenSettingsDialog }, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-header" }, /*#__PURE__*/_react.default.createElement(_react2.Dialog.Title, { className: "graphiql-dialog-title" }, "Settings"), /*#__PURE__*/_react.default.createElement(_react2.Dialog.Close, null)), props.showPersistHeadersSettings ? /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-section" }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-section-title" }, "Persist headers"), /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-section-caption" }, "Save headers upon reloading.", ' ', /*#__PURE__*/_react.default.createElement("span", { className: "graphiql-warning-text" }, "Only enable if you trust this device."))), /*#__PURE__*/_react.default.createElement(_react2.ButtonGroup, null, /*#__PURE__*/_react.default.createElement(_react2.Button, { type: "button", id: "enable-persist-headers", className: editorContext.shouldPersistHeaders ? 'active' : '', "data-value": "true", onClick: handlePersistHeaders }, "On"), /*#__PURE__*/_react.default.createElement(_react2.Button, { type: "button", id: "disable-persist-headers", className: editorContext.shouldPersistHeaders ? '' : 'active', onClick: handlePersistHeaders }, "Off"))) : null, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-section" }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-section-title" }, "Theme"), /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-section-caption" }, "Adjust how the interface looks like.")), /*#__PURE__*/_react.default.createElement(_react2.ButtonGroup, null, /*#__PURE__*/_react.default.createElement(_react2.Button, { type: "button", className: theme === null ? 'active' : '', onClick: handleChangeTheme }, "System"), /*#__PURE__*/_react.default.createElement(_react2.Button, { type: "button", className: theme === 'light' ? 'active' : '', "data-theme": "light", onClick: handleChangeTheme }, "Light"), /*#__PURE__*/_react.default.createElement(_react2.Button, { type: "button", className: theme === 'dark' ? 'active' : '', "data-theme": "dark", onClick: handleChangeTheme }, "Dark"))), storageContext ? /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-section" }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-section-title" }, "Clear storage"), /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-dialog-section-caption" }, "Remove all locally stored data and start fresh.")), /*#__PURE__*/_react.default.createElement(_react2.Button, { type: "button", state: clearStorageStatus || undefined, disabled: clearStorageStatus === 'success', onClick: handleClearData }, { success: 'Cleared data', error: 'Failed' }[clearStorageStatus] || 'Clear data')) : null))); } const modifier = typeof window !== 'undefined' && window.navigator.platform.toLowerCase().indexOf('mac') === 0 ? 'Cmd' : 'Ctrl'; const SHORT_KEYS = Object.entries({ 'Search in editor': [modifier, 'F'], 'Search in documentation': [modifier, 'K'], 'Execute query': [modifier, 'Enter'], 'Prettify editors': ['Ctrl', 'Shift', 'P'], 'Merge fragments definitions into operation definition': ['Ctrl', 'Shift', 'M'], 'Copy query': ['Ctrl', 'Shift', 'C'], 'Re-fetch schema using introspection': ['Ctrl', 'Shift', 'R'] }); function ShortKeys(_ref2) { let { keyMap } = _ref2; return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("table", { className: "graphiql-table" }, /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("th", null, "Short Key"), /*#__PURE__*/_react.default.createElement("th", null, "Function"))), /*#__PURE__*/_react.default.createElement("tbody", null, SHORT_KEYS.map(_ref3 => { let [title, keys] = _ref3; return /*#__PURE__*/_react.default.createElement("tr", { key: title }, /*#__PURE__*/_react.default.createElement("td", null, keys.map((key, index, array) => /*#__PURE__*/_react.default.createElement(_react.Fragment, { key: key }, /*#__PURE__*/_react.default.createElement("code", { className: "graphiql-key" }, key), index !== array.length - 1 && ' + '))), /*#__PURE__*/_react.default.createElement("td", null, title)); }))), /*#__PURE__*/_react.default.createElement("p", null, "The editors use", ' ', /*#__PURE__*/_react.default.createElement("a", { href: "https://codemirror.net/5/doc/manual.html#keymaps", target: "_blank", rel: "noopener noreferrer" }, "CodeMirror Key Maps"), ' ', "that add more short keys. This instance of Graph", /*#__PURE__*/_react.default.createElement("em", null, "i"), "QL uses", ' ', /*#__PURE__*/_react.default.createElement("code", null, keyMap), ".")); } // Configure the UI by providing this Component as a child of GraphiQL. function GraphiQLLogo(props) { return /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-logo" }, props.children || /*#__PURE__*/_react.default.createElement("a", { className: "graphiql-logo-link", href: "https://github.com/graphql/graphiql", target: "_blank", rel: "noreferrer" }, "Graph", /*#__PURE__*/_react.default.createElement("em", null, "i"), "QL")); } GraphiQLLogo.displayName = 'GraphiQLLogo'; // Configure the UI by providing this Component as a child of GraphiQL. function GraphiQLToolbar(props) { // eslint-disable-next-line react/jsx-no-useless-fragment return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.children); } GraphiQLToolbar.displayName = 'GraphiQLToolbar'; // Configure the UI by providing this Component as a child of GraphiQL. function GraphiQLFooter(props) { return /*#__PURE__*/_react.default.createElement("div", { className: "graphiql-footer" }, props.children); } GraphiQLFooter.displayName = 'GraphiQLFooter'; // Determines if the React child is of the same type of the provided React component function isChildComponentType(child, component) { var _child$type; if (child !== null && child !== void 0 && (_child$type = child.type) !== null && _child$type !== void 0 && _child$type.displayName && child.type.displayName === component.displayName) { return true; } return child.type === component; } /***/ }), /***/ "../../graphql-language-service/esm/index.js": /*!***************************************************!*\ !*** ../../graphql-language-service/esm/index.js ***! \***************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "CharacterStream", ({ enumerable: true, get: function () { return _parser.CharacterStream; } })); Object.defineProperty(exports, "CompletionItemKind", ({ enumerable: true, get: function () { return _types.CompletionItemKind; } })); Object.defineProperty(exports, "DIAGNOSTIC_SEVERITY", ({ enumerable: true, get: function () { return _interface.DIAGNOSTIC_SEVERITY; } })); Object.defineProperty(exports, "FileChangeTypeKind", ({ enumerable: true, get: function () { return _types.FileChangeTypeKind; } })); Object.defineProperty(exports, "LexRules", ({ enumerable: true, get: function () { return _parser.LexRules; } })); Object.defineProperty(exports, "ParseRules", ({ enumerable: true, get: function () { return _parser.ParseRules; } })); Object.defineProperty(exports, "Position", ({ enumerable: true, get: function () { return _utils.Position; } })); Object.defineProperty(exports, "Range", ({ enumerable: true, get: function () { return _utils.Range; } })); Object.defineProperty(exports, "RuleKinds", ({ enumerable: true, get: function () { return _parser.RuleKinds; } })); Object.defineProperty(exports, "SEVERITY", ({ enumerable: true, get: function () { return _interface.SEVERITY; } })); Object.defineProperty(exports, "SuggestionCommand", ({ enumerable: true, get: function () { return _interface.SuggestionCommand; } })); Object.defineProperty(exports, "canUseDirective", ({ enumerable: true, get: function () { return _interface.canUseDirective; } })); Object.defineProperty(exports, "collectVariables", ({ enumerable: true, get: function () { return _utils.collectVariables; } })); Object.defineProperty(exports, "getASTNodeAtPosition", ({ enumerable: true, get: function () { return _utils.getASTNodeAtPosition; } })); Object.defineProperty(exports, "getAutocompleteSuggestions", ({ enumerable: true, get: function () { return _interface.getAutocompleteSuggestions; } })); Object.defineProperty(exports, "getDefinitionQueryResultForDefinitionNode", ({ enumerable: true, get: function () { return _interface.getDefinitionQueryResultForDefinitionNode; } })); Object.defineProperty(exports, "getDefinitionQueryResultForField", ({ enumerable: true, get: function () { return _interface.getDefinitionQueryResultForField; } })); Object.defineProperty(exports, "getDefinitionQueryResultForFragmentSpread", ({ enumerable: true, get: function () { return _interface.getDefinitionQueryResultForFragmentSpread; } })); Object.defineProperty(exports, "getDefinitionQueryResultForNamedType", ({ enumerable: true, get: function () { return _interface.getDefinitionQueryResultForNamedType; } })); Object.defineProperty(exports, "getDefinitionState", ({ enumerable: true, get: function () { return _interface.getDefinitionState; } })); Object.defineProperty(exports, "getDiagnostics", ({ enumerable: true, get: function () { return _interface.getDiagnostics; } })); Object.defineProperty(exports, "getFieldDef", ({ enumerable: true, get: function () { return _interface.getFieldDef; } })); Object.defineProperty(exports, "getFragmentDefinitions", ({ enumerable: true, get: function () { return _interface.getFragmentDefinitions; } })); Object.defineProperty(exports, "getFragmentDependencies", ({ enumerable: true, get: function () { return _utils.getFragmentDependencies; } })); Object.defineProperty(exports, "getFragmentDependenciesForAST", ({ enumerable: true, get: function () { return _utils.getFragmentDependenciesForAST; } })); Object.defineProperty(exports, "getHoverInformation", ({ enumerable: true, get: function () { return _interface.getHoverInformation; } })); Object.defineProperty(exports, "getOperationASTFacts", ({ enumerable: true, get: function () { return _utils.getOperationASTFacts; } })); Object.defineProperty(exports, "getOperationFacts", ({ enumerable: true, get: function () { return _utils.getOperationFacts; } })); Object.defineProperty(exports, "getOutline", ({ enumerable: true, get: function () { return _interface.getOutline; } })); Object.defineProperty(exports, "getQueryFacts", ({ enumerable: true, get: function () { return _utils.getQueryFacts; } })); Object.defineProperty(exports, "getRange", ({ enumerable: true, get: function () { return _interface.getRange; } })); Object.defineProperty(exports, "getTokenAtPosition", ({ enumerable: true, get: function () { return _interface.getTokenAtPosition; } })); Object.defineProperty(exports, "getTypeInfo", ({ enumerable: true, get: function () { return _interface.getTypeInfo; } })); Object.defineProperty(exports, "getVariableCompletions", ({ enumerable: true, get: function () { return _interface.getVariableCompletions; } })); Object.defineProperty(exports, "getVariablesJSONSchema", ({ enumerable: true, get: function () { return _utils.getVariablesJSONSchema; } })); Object.defineProperty(exports, "isIgnored", ({ enumerable: true, get: function () { return _parser.isIgnored; } })); Object.defineProperty(exports, "list", ({ enumerable: true, get: function () { return _parser.list; } })); Object.defineProperty(exports, "offsetToPosition", ({ enumerable: true, get: function () { return _utils.offsetToPosition; } })); Object.defineProperty(exports, "onlineParser", ({ enumerable: true, get: function () { return _parser.onlineParser; } })); Object.defineProperty(exports, "opt", ({ enumerable: true, get: function () { return _parser.opt; } })); Object.defineProperty(exports, "p", ({ enumerable: true, get: function () { return _parser.p; } })); Object.defineProperty(exports, "pointToOffset", ({ enumerable: true, get: function () { return _utils.pointToOffset; } })); Object.defineProperty(exports, "t", ({ enumerable: true, get: function () { return _parser.t; } })); Object.defineProperty(exports, "validateQuery", ({ enumerable: true, get: function () { return _interface.validateQuery; } })); Object.defineProperty(exports, "validateWithCustomRules", ({ enumerable: true, get: function () { return _utils.validateWithCustomRules; } })); var _interface = __webpack_require__(/*! ./interface */ "../../graphql-language-service/esm/interface/index.js"); var _parser = __webpack_require__(/*! ./parser */ "../../graphql-language-service/esm/parser/index.js"); var _types = __webpack_require__(/*! ./types */ "../../graphql-language-service/esm/types.js"); var _utils = __webpack_require__(/*! ./utils */ "../../graphql-language-service/esm/utils/index.js"); /***/ }), /***/ "../../graphql-language-service/esm/interface/autocompleteUtils.js": /*!*************************************************************************!*\ !*** ../../graphql-language-service/esm/interface/autocompleteUtils.js ***! \*************************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.forEachState = forEachState; exports.getDefinitionState = getDefinitionState; exports.getFieldDef = getFieldDef; exports.hintList = hintList; exports.objectValues = objectValues; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); function getDefinitionState(tokenState) { let definitionState; forEachState(tokenState, state => { switch (state.kind) { case 'Query': case 'ShortQuery': case 'Mutation': case 'Subscription': case 'FragmentDefinition': definitionState = state; break; } }); return definitionState; } function getFieldDef(schema, type, fieldName) { if (fieldName === _graphql.SchemaMetaFieldDef.name && schema.getQueryType() === type) { return _graphql.SchemaMetaFieldDef; } if (fieldName === _graphql.TypeMetaFieldDef.name && schema.getQueryType() === type) { return _graphql.TypeMetaFieldDef; } if (fieldName === _graphql.TypeNameMetaFieldDef.name && (0, _graphql.isCompositeType)(type)) { return _graphql.TypeNameMetaFieldDef; } if ('getFields' in type) { return type.getFields()[fieldName]; } return null; } function forEachState(stack, fn) { const reverseStateStack = []; let state = stack; while (state === null || state === void 0 ? void 0 : state.kind) { reverseStateStack.push(state); state = state.prevState; } for (let i = reverseStateStack.length - 1; i >= 0; i--) { fn(reverseStateStack[i]); } } function objectValues(object) { const keys = Object.keys(object); const len = keys.length; const values = new Array(len); for (let i = 0; i < len; ++i) { values[i] = object[keys[i]]; } return values; } function hintList(token, list) { return filterAndSortList(list, normalizeText(token.string)); } function filterAndSortList(list, text) { if (!text) { return filterNonEmpty(list, entry => !entry.isDeprecated); } const byProximity = list.map(entry => ({ proximity: getProximity(normalizeText(entry.label), text), entry })); return filterNonEmpty(filterNonEmpty(byProximity, pair => pair.proximity <= 2), pair => !pair.entry.isDeprecated).sort((a, b) => (a.entry.isDeprecated ? 1 : 0) - (b.entry.isDeprecated ? 1 : 0) || a.proximity - b.proximity || a.entry.label.length - b.entry.label.length).map(pair => pair.entry); } function filterNonEmpty(array, predicate) { const filtered = array.filter(predicate); return filtered.length === 0 ? array : filtered; } function normalizeText(text) { return text.toLowerCase().replaceAll(/\W/g, ''); } function getProximity(suggestion, text) { let proximity = lexicalDistance(text, suggestion); if (suggestion.length > text.length) { proximity -= suggestion.length - text.length - 1; proximity += suggestion.indexOf(text) === 0 ? 0 : 0.5; } return proximity; } function lexicalDistance(a, b) { let i; let j; const d = []; const aLength = a.length; const bLength = b.length; for (i = 0; i <= aLength; i++) { d[i] = [i]; } for (j = 1; j <= bLength; j++) { d[0][j] = j; } for (i = 1; i <= aLength; i++) { for (j = 1; j <= bLength; j++) { const cost = a[i - 1] === b[j - 1] ? 0 : 1; d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost); if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + cost); } } } return d[aLength][bLength]; } /***/ }), /***/ "../../graphql-language-service/esm/interface/getAutocompleteSuggestions.js": /*!**********************************************************************************!*\ !*** ../../graphql-language-service/esm/interface/getAutocompleteSuggestions.js ***! \**********************************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SuggestionCommand = exports.GraphQLDocumentMode = void 0; exports.canUseDirective = canUseDirective; exports.getAutocompleteSuggestions = getAutocompleteSuggestions; exports.getFragmentDefinitions = getFragmentDefinitions; exports.getTokenAtPosition = getTokenAtPosition; exports.getTypeInfo = getTypeInfo; exports.getVariableCompletions = getVariableCompletions; exports.runOnlineParser = runOnlineParser; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); var _types = __webpack_require__(/*! ../types */ "../../graphql-language-service/esm/types.js"); var _parser = __webpack_require__(/*! ../parser */ "../../graphql-language-service/esm/parser/index.js"); var _autocompleteUtils = __webpack_require__(/*! ./autocompleteUtils */ "../../graphql-language-service/esm/interface/autocompleteUtils.js"); const SuggestionCommand = { command: 'editor.action.triggerSuggest', title: 'Suggestions' }; exports.SuggestionCommand = SuggestionCommand; const collectFragmentDefs = op => { const externalFragments = []; if (op) { try { (0, _graphql.visit)((0, _graphql.parse)(op), { FragmentDefinition(def) { externalFragments.push(def); } }); } catch (_a) { return []; } } return externalFragments; }; const typeSystemKinds = [_graphql.Kind.SCHEMA_DEFINITION, _graphql.Kind.OPERATION_TYPE_DEFINITION, _graphql.Kind.SCALAR_TYPE_DEFINITION, _graphql.Kind.OBJECT_TYPE_DEFINITION, _graphql.Kind.INTERFACE_TYPE_DEFINITION, _graphql.Kind.UNION_TYPE_DEFINITION, _graphql.Kind.ENUM_TYPE_DEFINITION, _graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION, _graphql.Kind.DIRECTIVE_DEFINITION, _graphql.Kind.SCHEMA_EXTENSION, _graphql.Kind.SCALAR_TYPE_EXTENSION, _graphql.Kind.OBJECT_TYPE_EXTENSION, _graphql.Kind.INTERFACE_TYPE_EXTENSION, _graphql.Kind.UNION_TYPE_EXTENSION, _graphql.Kind.ENUM_TYPE_EXTENSION, _graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION]; const hasTypeSystemDefinitions = sdl => { let hasTypeSystemDef = false; if (sdl) { try { (0, _graphql.visit)((0, _graphql.parse)(sdl), { enter(node) { if (node.kind === 'Document') { return; } if (typeSystemKinds.includes(node.kind)) { hasTypeSystemDef = true; return _graphql.BREAK; } return false; } }); } catch (_a) { return hasTypeSystemDef; } } return hasTypeSystemDef; }; function getAutocompleteSuggestions(schema, queryText, cursor, contextToken, fragmentDefs, options) { var _a; const opts = Object.assign(Object.assign({}, options), { schema }); const token = contextToken || getTokenAtPosition(queryText, cursor, 1); const state = token.state.kind === 'Invalid' ? token.state.prevState : token.state; const mode = (options === null || options === void 0 ? void 0 : options.mode) || getDocumentMode(queryText, options === null || options === void 0 ? void 0 : options.uri); if (!state) { return []; } const { kind, step, prevState } = state; const typeInfo = getTypeInfo(schema, token.state); if (kind === _parser.RuleKinds.DOCUMENT) { if (mode === GraphQLDocumentMode.TYPE_SYSTEM) { return getSuggestionsForTypeSystemDefinitions(token); } return getSuggestionsForExecutableDefinitions(token); } if (kind === _parser.RuleKinds.EXTEND_DEF) { return getSuggestionsForExtensionDefinitions(token); } if (((_a = prevState === null || prevState === void 0 ? void 0 : prevState.prevState) === null || _a === void 0 ? void 0 : _a.kind) === _parser.RuleKinds.EXTENSION_DEFINITION && state.name) { return (0, _autocompleteUtils.hintList)(token, []); } if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.SCALAR_TYPE_EXTENSION) { return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(_graphql.isScalarType).map(type => ({ label: type.name, kind: _types.CompletionItemKind.Function }))); } if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.OBJECT_TYPE_EXTENSION) { return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(type => (0, _graphql.isObjectType)(type) && !type.name.startsWith('__')).map(type => ({ label: type.name, kind: _types.CompletionItemKind.Function }))); } if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.INTERFACE_TYPE_EXTENSION) { return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(_graphql.isInterfaceType).map(type => ({ label: type.name, kind: _types.CompletionItemKind.Function }))); } if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.UNION_TYPE_EXTENSION) { return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(_graphql.isUnionType).map(type => ({ label: type.name, kind: _types.CompletionItemKind.Function }))); } if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.ENUM_TYPE_EXTENSION) { return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(type => (0, _graphql.isEnumType)(type) && !type.name.startsWith('__')).map(type => ({ label: type.name, kind: _types.CompletionItemKind.Function }))); } if ((prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION) { return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(_graphql.isInputObjectType).map(type => ({ label: type.name, kind: _types.CompletionItemKind.Function }))); } if (kind === _parser.RuleKinds.IMPLEMENTS || kind === _parser.RuleKinds.NAMED_TYPE && (prevState === null || prevState === void 0 ? void 0 : prevState.kind) === _parser.RuleKinds.IMPLEMENTS) { return getSuggestionsForImplements(token, state, schema, queryText, typeInfo); } if (kind === _parser.RuleKinds.SELECTION_SET || kind === _parser.RuleKinds.FIELD || kind === _parser.RuleKinds.ALIASED_FIELD) { return getSuggestionsForFieldNames(token, typeInfo, opts); } if (kind === _parser.RuleKinds.ARGUMENTS || kind === _parser.RuleKinds.ARGUMENT && step === 0) { const { argDefs } = typeInfo; if (argDefs) { return (0, _autocompleteUtils.hintList)(token, argDefs.map(argDef => { var _a; return { label: argDef.name, insertText: argDef.name + ': ', command: SuggestionCommand, detail: String(argDef.type), documentation: (_a = argDef.description) !== null && _a !== void 0 ? _a : undefined, kind: _types.CompletionItemKind.Variable, type: argDef.type }; })); } } if ((kind === _parser.RuleKinds.OBJECT_VALUE || kind === _parser.RuleKinds.OBJECT_FIELD && step === 0) && typeInfo.objectFieldDefs) { const objectFields = (0, _autocompleteUtils.objectValues)(typeInfo.objectFieldDefs); const completionKind = kind === _parser.RuleKinds.OBJECT_VALUE ? _types.CompletionItemKind.Value : _types.CompletionItemKind.Field; return (0, _autocompleteUtils.hintList)(token, objectFields.map(field => { var _a; return { label: field.name, detail: String(field.type), documentation: (_a = field.description) !== null && _a !== void 0 ? _a : undefined, kind: completionKind, type: field.type }; })); } if (kind === _parser.RuleKinds.ENUM_VALUE || kind === _parser.RuleKinds.LIST_VALUE && step === 1 || kind === _parser.RuleKinds.OBJECT_FIELD && step === 2 || kind === _parser.RuleKinds.ARGUMENT && step === 2) { return getSuggestionsForInputValues(token, typeInfo, queryText, schema); } if (kind === _parser.RuleKinds.VARIABLE && step === 1) { const namedInputType = (0, _graphql.getNamedType)(typeInfo.inputType); const variableDefinitions = getVariableCompletions(queryText, schema, token); return (0, _autocompleteUtils.hintList)(token, variableDefinitions.filter(v => v.detail === (namedInputType === null || namedInputType === void 0 ? void 0 : namedInputType.name))); } if (kind === _parser.RuleKinds.TYPE_CONDITION && step === 1 || kind === _parser.RuleKinds.NAMED_TYPE && prevState != null && prevState.kind === _parser.RuleKinds.TYPE_CONDITION) { return getSuggestionsForFragmentTypeConditions(token, typeInfo, schema, kind); } if (kind === _parser.RuleKinds.FRAGMENT_SPREAD && step === 1) { return getSuggestionsForFragmentSpread(token, typeInfo, schema, queryText, Array.isArray(fragmentDefs) ? fragmentDefs : collectFragmentDefs(fragmentDefs)); } const unwrappedState = unwrapType(state); if (mode === GraphQLDocumentMode.TYPE_SYSTEM && !unwrappedState.needsAdvance && kind === _parser.RuleKinds.NAMED_TYPE || kind === _parser.RuleKinds.LIST_TYPE) { if (unwrappedState.kind === _parser.RuleKinds.FIELD_DEF) { return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(type => (0, _graphql.isOutputType)(type) && !type.name.startsWith('__')).map(type => ({ label: type.name, kind: _types.CompletionItemKind.Function }))); } if (unwrappedState.kind === _parser.RuleKinds.INPUT_VALUE_DEF) { return (0, _autocompleteUtils.hintList)(token, Object.values(schema.getTypeMap()).filter(type => (0, _graphql.isInputType)(type) && !type.name.startsWith('__')).map(type => ({ label: type.name, kind: _types.CompletionItemKind.Function }))); } } if (kind === _parser.RuleKinds.VARIABLE_DEFINITION && step === 2 || kind === _parser.RuleKinds.LIST_TYPE && step === 1 || kind === _parser.RuleKinds.NAMED_TYPE && prevState && (prevState.kind === _parser.RuleKinds.VARIABLE_DEFINITION || prevState.kind === _parser.RuleKinds.LIST_TYPE || prevState.kind === _parser.RuleKinds.NON_NULL_TYPE)) { return getSuggestionsForVariableDefinition(token, schema, kind); } if (kind === _parser.RuleKinds.DIRECTIVE) { return getSuggestionsForDirective(token, state, schema, kind); } return []; } const insertSuffix = ' {\n $1\n}'; const getInsertText = field => { const { type } = field; if ((0, _graphql.isCompositeType)(type)) { return insertSuffix; } if ((0, _graphql.isListType)(type) && (0, _graphql.isCompositeType)(type.ofType)) { return insertSuffix; } if ((0, _graphql.isNonNullType)(type)) { if ((0, _graphql.isCompositeType)(type.ofType)) { return insertSuffix; } if ((0, _graphql.isListType)(type.ofType) && (0, _graphql.isCompositeType)(type.ofType.ofType)) { return insertSuffix; } } return null; }; function getSuggestionsForTypeSystemDefinitions(token) { return (0, _autocompleteUtils.hintList)(token, [{ label: 'extend', kind: _types.CompletionItemKind.Function }, { label: 'type', kind: _types.CompletionItemKind.Function }, { label: 'interface', kind: _types.CompletionItemKind.Function }, { label: 'union', kind: _types.CompletionItemKind.Function }, { label: 'input', kind: _types.CompletionItemKind.Function }, { label: 'scalar', kind: _types.CompletionItemKind.Function }, { label: 'schema', kind: _types.CompletionItemKind.Function }]); } function getSuggestionsForExecutableDefinitions(token) { return (0, _autocompleteUtils.hintList)(token, [{ label: 'query', kind: _types.CompletionItemKind.Function }, { label: 'mutation', kind: _types.CompletionItemKind.Function }, { label: 'subscription', kind: _types.CompletionItemKind.Function }, { label: 'fragment', kind: _types.CompletionItemKind.Function }, { label: '{', kind: _types.CompletionItemKind.Constructor }]); } function getSuggestionsForExtensionDefinitions(token) { return (0, _autocompleteUtils.hintList)(token, [{ label: 'type', kind: _types.CompletionItemKind.Function }, { label: 'interface', kind: _types.CompletionItemKind.Function }, { label: 'union', kind: _types.CompletionItemKind.Function }, { label: 'input', kind: _types.CompletionItemKind.Function }, { label: 'scalar', kind: _types.CompletionItemKind.Function }, { label: 'schema', kind: _types.CompletionItemKind.Function }]); } function getSuggestionsForFieldNames(token, typeInfo, options) { var _a; if (typeInfo.parentType) { const { parentType } = typeInfo; let fields = []; if ('getFields' in parentType) { fields = (0, _autocompleteUtils.objectValues)(parentType.getFields()); } if ((0, _graphql.isCompositeType)(parentType)) { fields.push(_graphql.TypeNameMetaFieldDef); } if (parentType === ((_a = options === null || options === void 0 ? void 0 : options.schema) === null || _a === void 0 ? void 0 : _a.getQueryType())) { fields.push(_graphql.SchemaMetaFieldDef, _graphql.TypeMetaFieldDef); } return (0, _autocompleteUtils.hintList)(token, fields.map((field, index) => { var _a; const suggestion = { sortText: String(index) + field.name, label: field.name, detail: String(field.type), documentation: (_a = field.description) !== null && _a !== void 0 ? _a : undefined, deprecated: Boolean(field.deprecationReason), isDeprecated: Boolean(field.deprecationReason), deprecationReason: field.deprecationReason, kind: _types.CompletionItemKind.Field, type: field.type }; if (options === null || options === void 0 ? void 0 : options.fillLeafsOnComplete) { const insertText = getInsertText(field); if (insertText) { suggestion.insertText = field.name + insertText; suggestion.insertTextFormat = _types.InsertTextFormat.Snippet; suggestion.command = SuggestionCommand; } } return suggestion; })); } return []; } function getSuggestionsForInputValues(token, typeInfo, queryText, schema) { const namedInputType = (0, _graphql.getNamedType)(typeInfo.inputType); const queryVariables = getVariableCompletions(queryText, schema, token).filter(v => v.detail === namedInputType.name); if (namedInputType instanceof _graphql.GraphQLEnumType) { const values = namedInputType.getValues(); return (0, _autocompleteUtils.hintList)(token, values.map(value => { var _a; return { label: value.name, detail: String(namedInputType), documentation: (_a = value.description) !== null && _a !== void 0 ? _a : undefined, deprecated: Boolean(value.deprecationReason), isDeprecated: Boolean(value.deprecationReason), deprecationReason: value.deprecationReason, kind: _types.CompletionItemKind.EnumMember, type: namedInputType }; }).concat(queryVariables)); } if (namedInputType === _graphql.GraphQLBoolean) { return (0, _autocompleteUtils.hintList)(token, queryVariables.concat([{ label: 'true', detail: String(_graphql.GraphQLBoolean), documentation: 'Not false.', kind: _types.CompletionItemKind.Variable, type: _graphql.GraphQLBoolean }, { label: 'false', detail: String(_graphql.GraphQLBoolean), documentation: 'Not true.', kind: _types.CompletionItemKind.Variable, type: _graphql.GraphQLBoolean }])); } return queryVariables; } function getSuggestionsForImplements(token, tokenState, schema, documentText, typeInfo) { if (tokenState.needsSeparator) { return []; } const typeMap = schema.getTypeMap(); const schemaInterfaces = (0, _autocompleteUtils.objectValues)(typeMap).filter(_graphql.isInterfaceType); const schemaInterfaceNames = schemaInterfaces.map(_ref => { let { name } = _ref; return name; }); const inlineInterfaces = new Set(); runOnlineParser(documentText, (_, state) => { var _a, _b, _c, _d, _e; if (state.name) { if (state.kind === _parser.RuleKinds.INTERFACE_DEF && !schemaInterfaceNames.includes(state.name)) { inlineInterfaces.add(state.name); } if (state.kind === _parser.RuleKinds.NAMED_TYPE && ((_a = state.prevState) === null || _a === void 0 ? void 0 : _a.kind) === _parser.RuleKinds.IMPLEMENTS) { if (typeInfo.interfaceDef) { const existingType = (_b = typeInfo.interfaceDef) === null || _b === void 0 ? void 0 : _b.getInterfaces().find(_ref2 => { let { name } = _ref2; return name === state.name; }); if (existingType) { return; } const type = schema.getType(state.name); const interfaceConfig = (_c = typeInfo.interfaceDef) === null || _c === void 0 ? void 0 : _c.toConfig(); typeInfo.interfaceDef = new _graphql.GraphQLInterfaceType(Object.assign(Object.assign({}, interfaceConfig), { interfaces: [...interfaceConfig.interfaces, type || new _graphql.GraphQLInterfaceType({ name: state.name, fields: {} })] })); } else if (typeInfo.objectTypeDef) { const existingType = (_d = typeInfo.objectTypeDef) === null || _d === void 0 ? void 0 : _d.getInterfaces().find(_ref3 => { let { name } = _ref3; return name === state.name; }); if (existingType) { return; } const type = schema.getType(state.name); const objectTypeConfig = (_e = typeInfo.objectTypeDef) === null || _e === void 0 ? void 0 : _e.toConfig(); typeInfo.objectTypeDef = new _graphql.GraphQLObjectType(Object.assign(Object.assign({}, objectTypeConfig), { interfaces: [...objectTypeConfig.interfaces, type || new _graphql.GraphQLInterfaceType({ name: state.name, fields: {} })] })); } } } }); const currentTypeToExtend = typeInfo.interfaceDef || typeInfo.objectTypeDef; const siblingInterfaces = (currentTypeToExtend === null || currentTypeToExtend === void 0 ? void 0 : currentTypeToExtend.getInterfaces()) || []; const siblingInterfaceNames = siblingInterfaces.map(_ref4 => { let { name } = _ref4; return name; }); const possibleInterfaces = schemaInterfaces.concat([...inlineInterfaces].map(name => ({ name }))).filter(_ref5 => { let { name } = _ref5; return name !== (currentTypeToExtend === null || currentTypeToExtend === void 0 ? void 0 : currentTypeToExtend.name) && !siblingInterfaceNames.includes(name); }); return (0, _autocompleteUtils.hintList)(token, possibleInterfaces.map(type => { const result = { label: type.name, kind: _types.CompletionItemKind.Interface, type }; if (type === null || type === void 0 ? void 0 : type.description) { result.documentation = type.description; } return result; })); } function getSuggestionsForFragmentTypeConditions(token, typeInfo, schema, _kind) { let possibleTypes; if (typeInfo.parentType) { if ((0, _graphql.isAbstractType)(typeInfo.parentType)) { const abstractType = (0, _graphql.assertAbstractType)(typeInfo.parentType); const possibleObjTypes = schema.getPossibleTypes(abstractType); const possibleIfaceMap = Object.create(null); for (const type of possibleObjTypes) { for (const iface of type.getInterfaces()) { possibleIfaceMap[iface.name] = iface; } } possibleTypes = possibleObjTypes.concat((0, _autocompleteUtils.objectValues)(possibleIfaceMap)); } else { possibleTypes = [typeInfo.parentType]; } } else { const typeMap = schema.getTypeMap(); possibleTypes = (0, _autocompleteUtils.objectValues)(typeMap).filter(type => (0, _graphql.isCompositeType)(type) && !type.name.startsWith('__')); } return (0, _autocompleteUtils.hintList)(token, possibleTypes.map(type => { const namedType = (0, _graphql.getNamedType)(type); return { label: String(type), documentation: (namedType === null || namedType === void 0 ? void 0 : namedType.description) || '', kind: _types.CompletionItemKind.Field }; })); } function getSuggestionsForFragmentSpread(token, typeInfo, schema, queryText, fragmentDefs) { if (!queryText) { return []; } const typeMap = schema.getTypeMap(); const defState = (0, _autocompleteUtils.getDefinitionState)(token.state); const fragments = getFragmentDefinitions(queryText); if (fragmentDefs && fragmentDefs.length > 0) { fragments.push(...fragmentDefs); } const relevantFrags = fragments.filter(frag => typeMap[frag.typeCondition.name.value] && !(defState && defState.kind === _parser.RuleKinds.FRAGMENT_DEFINITION && defState.name === frag.name.value) && (0, _graphql.isCompositeType)(typeInfo.parentType) && (0, _graphql.isCompositeType)(typeMap[frag.typeCondition.name.value]) && (0, _graphql.doTypesOverlap)(schema, typeInfo.parentType, typeMap[frag.typeCondition.name.value])); return (0, _autocompleteUtils.hintList)(token, relevantFrags.map(frag => ({ label: frag.name.value, detail: String(typeMap[frag.typeCondition.name.value]), documentation: `fragment ${frag.name.value} on ${frag.typeCondition.name.value}`, kind: _types.CompletionItemKind.Field, type: typeMap[frag.typeCondition.name.value] }))); } const getParentDefinition = (state, kind) => { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; if (((_a = state.prevState) === null || _a === void 0 ? void 0 : _a.kind) === kind) { return state.prevState; } if (((_c = (_b = state.prevState) === null || _b === void 0 ? void 0 : _b.prevState) === null || _c === void 0 ? void 0 : _c.kind) === kind) { return state.prevState.prevState; } if (((_f = (_e = (_d = state.prevState) === null || _d === void 0 ? void 0 : _d.prevState) === null || _e === void 0 ? void 0 : _e.prevState) === null || _f === void 0 ? void 0 : _f.kind) === kind) { return state.prevState.prevState.prevState; } if (((_k = (_j = (_h = (_g = state.prevState) === null || _g === void 0 ? void 0 : _g.prevState) === null || _h === void 0 ? void 0 : _h.prevState) === null || _j === void 0 ? void 0 : _j.prevState) === null || _k === void 0 ? void 0 : _k.kind) === kind) { return state.prevState.prevState.prevState.prevState; } }; function getVariableCompletions(queryText, schema, token) { let variableName = null; let variableType; const definitions = Object.create({}); runOnlineParser(queryText, (_, state) => { if ((state === null || state === void 0 ? void 0 : state.kind) === _parser.RuleKinds.VARIABLE && state.name) { variableName = state.name; } if ((state === null || state === void 0 ? void 0 : state.kind) === _parser.RuleKinds.NAMED_TYPE && variableName) { const parentDefinition = getParentDefinition(state, _parser.RuleKinds.TYPE); if (parentDefinition === null || parentDefinition === void 0 ? void 0 : parentDefinition.type) { variableType = schema.getType(parentDefinition === null || parentDefinition === void 0 ? void 0 : parentDefinition.type); } } if (variableName && variableType && !definitions[variableName]) { definitions[variableName] = { detail: variableType.toString(), insertText: token.string === '$' ? variableName : '$' + variableName, label: variableName, type: variableType, kind: _types.CompletionItemKind.Variable }; variableName = null; variableType = null; } }); return (0, _autocompleteUtils.objectValues)(definitions); } function getFragmentDefinitions(queryText) { const fragmentDefs = []; runOnlineParser(queryText, (_, state) => { if (state.kind === _parser.RuleKinds.FRAGMENT_DEFINITION && state.name && state.type) { fragmentDefs.push({ kind: _parser.RuleKinds.FRAGMENT_DEFINITION, name: { kind: _graphql.Kind.NAME, value: state.name }, selectionSet: { kind: _parser.RuleKinds.SELECTION_SET, selections: [] }, typeCondition: { kind: _parser.RuleKinds.NAMED_TYPE, name: { kind: _graphql.Kind.NAME, value: state.type } } }); } }); return fragmentDefs; } function getSuggestionsForVariableDefinition(token, schema, _kind) { const inputTypeMap = schema.getTypeMap(); const inputTypes = (0, _autocompleteUtils.objectValues)(inputTypeMap).filter(_graphql.isInputType); return (0, _autocompleteUtils.hintList)(token, inputTypes.map(type => ({ label: type.name, documentation: type.description, kind: _types.CompletionItemKind.Variable }))); } function getSuggestionsForDirective(token, state, schema, _kind) { var _a; if ((_a = state.prevState) === null || _a === void 0 ? void 0 : _a.kind) { const directives = schema.getDirectives().filter(directive => canUseDirective(state.prevState, directive)); return (0, _autocompleteUtils.hintList)(token, directives.map(directive => ({ label: directive.name, documentation: directive.description || '', kind: _types.CompletionItemKind.Function }))); } return []; } function getTokenAtPosition(queryText, cursor) { let offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; let styleAtCursor = null; let stateAtCursor = null; let stringAtCursor = null; const token = runOnlineParser(queryText, (stream, state, style, index) => { if (index !== cursor.line || stream.getCurrentPosition() + offset < cursor.character + 1) { return; } styleAtCursor = style; stateAtCursor = Object.assign({}, state); stringAtCursor = stream.current(); return 'BREAK'; }); return { start: token.start, end: token.end, string: stringAtCursor || token.string, state: stateAtCursor || token.state, style: styleAtCursor || token.style }; } function runOnlineParser(queryText, callback) { const lines = queryText.split('\n'); const parser = (0, _parser.onlineParser)(); let state = parser.startState(); let style = ''; let stream = new _parser.CharacterStream(''); for (let i = 0; i < lines.length; i++) { stream = new _parser.CharacterStream(lines[i]); while (!stream.eol()) { style = parser.token(stream, state); const code = callback(stream, state, style, i); if (code === 'BREAK') { break; } } callback(stream, state, style, i); if (!state.kind) { state = parser.startState(); } } return { start: stream.getStartOfToken(), end: stream.getCurrentPosition(), string: stream.current(), state, style }; } function canUseDirective(state, directive) { if (!(state === null || state === void 0 ? void 0 : state.kind)) { return false; } const { kind, prevState } = state; const { locations } = directive; switch (kind) { case _parser.RuleKinds.QUERY: return locations.includes(_graphql.DirectiveLocation.QUERY); case _parser.RuleKinds.MUTATION: return locations.includes(_graphql.DirectiveLocation.MUTATION); case _parser.RuleKinds.SUBSCRIPTION: return locations.includes(_graphql.DirectiveLocation.SUBSCRIPTION); case _parser.RuleKinds.FIELD: case _parser.RuleKinds.ALIASED_FIELD: return locations.includes(_graphql.DirectiveLocation.FIELD); case _parser.RuleKinds.FRAGMENT_DEFINITION: return locations.includes(_graphql.DirectiveLocation.FRAGMENT_DEFINITION); case _parser.RuleKinds.FRAGMENT_SPREAD: return locations.includes(_graphql.DirectiveLocation.FRAGMENT_SPREAD); case _parser.RuleKinds.INLINE_FRAGMENT: return locations.includes(_graphql.DirectiveLocation.INLINE_FRAGMENT); case _parser.RuleKinds.SCHEMA_DEF: return locations.includes(_graphql.DirectiveLocation.SCHEMA); case _parser.RuleKinds.SCALAR_DEF: return locations.includes(_graphql.DirectiveLocation.SCALAR); case _parser.RuleKinds.OBJECT_TYPE_DEF: return locations.includes(_graphql.DirectiveLocation.OBJECT); case _parser.RuleKinds.FIELD_DEF: return locations.includes(_graphql.DirectiveLocation.FIELD_DEFINITION); case _parser.RuleKinds.INTERFACE_DEF: return locations.includes(_graphql.DirectiveLocation.INTERFACE); case _parser.RuleKinds.UNION_DEF: return locations.includes(_graphql.DirectiveLocation.UNION); case _parser.RuleKinds.ENUM_DEF: return locations.includes(_graphql.DirectiveLocation.ENUM); case _parser.RuleKinds.ENUM_VALUE: return locations.includes(_graphql.DirectiveLocation.ENUM_VALUE); case _parser.RuleKinds.INPUT_DEF: return locations.includes(_graphql.DirectiveLocation.INPUT_OBJECT); case _parser.RuleKinds.INPUT_VALUE_DEF: const prevStateKind = prevState === null || prevState === void 0 ? void 0 : prevState.kind; switch (prevStateKind) { case _parser.RuleKinds.ARGUMENTS_DEF: return locations.includes(_graphql.DirectiveLocation.ARGUMENT_DEFINITION); case _parser.RuleKinds.INPUT_DEF: return locations.includes(_graphql.DirectiveLocation.INPUT_FIELD_DEFINITION); } } return false; } function getTypeInfo(schema, tokenState) { let argDef; let argDefs; let directiveDef; let enumValue; let fieldDef; let inputType; let objectTypeDef; let objectFieldDefs; let parentType; let type; let interfaceDef; (0, _autocompleteUtils.forEachState)(tokenState, state => { var _a; switch (state.kind) { case _parser.RuleKinds.QUERY: case 'ShortQuery': type = schema.getQueryType(); break; case _parser.RuleKinds.MUTATION: type = schema.getMutationType(); break; case _parser.RuleKinds.SUBSCRIPTION: type = schema.getSubscriptionType(); break; case _parser.RuleKinds.INLINE_FRAGMENT: case _parser.RuleKinds.FRAGMENT_DEFINITION: if (state.type) { type = schema.getType(state.type); } break; case _parser.RuleKinds.FIELD: case _parser.RuleKinds.ALIASED_FIELD: { if (!type || !state.name) { fieldDef = null; } else { fieldDef = parentType ? (0, _autocompleteUtils.getFieldDef)(schema, parentType, state.name) : null; type = fieldDef ? fieldDef.type : null; } break; } case _parser.RuleKinds.SELECTION_SET: parentType = (0, _graphql.getNamedType)(type); break; case _parser.RuleKinds.DIRECTIVE: directiveDef = state.name ? schema.getDirective(state.name) : null; break; case _parser.RuleKinds.INTERFACE_DEF: if (state.name) { objectTypeDef = null; interfaceDef = new _graphql.GraphQLInterfaceType({ name: state.name, interfaces: [], fields: {} }); } break; case _parser.RuleKinds.OBJECT_TYPE_DEF: if (state.name) { interfaceDef = null; objectTypeDef = new _graphql.GraphQLObjectType({ name: state.name, interfaces: [], fields: {} }); } break; case _parser.RuleKinds.ARGUMENTS: { if (state.prevState) { switch (state.prevState.kind) { case _parser.RuleKinds.FIELD: argDefs = fieldDef && fieldDef.args; break; case _parser.RuleKinds.DIRECTIVE: argDefs = directiveDef && directiveDef.args; break; case _parser.RuleKinds.ALIASED_FIELD: { const name = (_a = state.prevState) === null || _a === void 0 ? void 0 : _a.name; if (!name) { argDefs = null; break; } const field = parentType ? (0, _autocompleteUtils.getFieldDef)(schema, parentType, name) : null; if (!field) { argDefs = null; break; } argDefs = field.args; break; } default: argDefs = null; break; } } else { argDefs = null; } break; } case _parser.RuleKinds.ARGUMENT: if (argDefs) { for (let i = 0; i < argDefs.length; i++) { if (argDefs[i].name === state.name) { argDef = argDefs[i]; break; } } } inputType = argDef === null || argDef === void 0 ? void 0 : argDef.type; break; case _parser.RuleKinds.ENUM_VALUE: const enumType = (0, _graphql.getNamedType)(inputType); enumValue = enumType instanceof _graphql.GraphQLEnumType ? enumType.getValues().find(val => val.value === state.name) : null; break; case _parser.RuleKinds.LIST_VALUE: const nullableType = (0, _graphql.getNullableType)(inputType); inputType = nullableType instanceof _graphql.GraphQLList ? nullableType.ofType : null; break; case _parser.RuleKinds.OBJECT_VALUE: const objectType = (0, _graphql.getNamedType)(inputType); objectFieldDefs = objectType instanceof _graphql.GraphQLInputObjectType ? objectType.getFields() : null; break; case _parser.RuleKinds.OBJECT_FIELD: const objectField = state.name && objectFieldDefs ? objectFieldDefs[state.name] : null; inputType = objectField === null || objectField === void 0 ? void 0 : objectField.type; break; case _parser.RuleKinds.NAMED_TYPE: if (state.name) { type = schema.getType(state.name); } break; } }); return { argDef, argDefs, directiveDef, enumValue, fieldDef, inputType, objectFieldDefs, parentType, type, interfaceDef, objectTypeDef }; } var GraphQLDocumentMode; exports.GraphQLDocumentMode = GraphQLDocumentMode; (function (GraphQLDocumentMode) { GraphQLDocumentMode["TYPE_SYSTEM"] = "TYPE_SYSTEM"; GraphQLDocumentMode["EXECUTABLE"] = "EXECUTABLE"; })(GraphQLDocumentMode || (exports.GraphQLDocumentMode = GraphQLDocumentMode = {})); function getDocumentMode(documentText, uri) { if (uri === null || uri === void 0 ? void 0 : uri.endsWith('.graphqls')) { return GraphQLDocumentMode.TYPE_SYSTEM; } return hasTypeSystemDefinitions(documentText) ? GraphQLDocumentMode.TYPE_SYSTEM : GraphQLDocumentMode.EXECUTABLE; } function unwrapType(state) { if (state.prevState && state.kind && [_parser.RuleKinds.NAMED_TYPE, _parser.RuleKinds.LIST_TYPE, _parser.RuleKinds.TYPE, _parser.RuleKinds.NON_NULL_TYPE].includes(state.kind)) { return unwrapType(state.prevState); } return state; } /***/ }), /***/ "../../graphql-language-service/esm/interface/getDefinition.js": /*!*********************************************************************!*\ !*** ../../graphql-language-service/esm/interface/getDefinition.js ***! \*********************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.LANGUAGE = void 0; exports.getDefinitionQueryResultForDefinitionNode = getDefinitionQueryResultForDefinitionNode; exports.getDefinitionQueryResultForField = getDefinitionQueryResultForField; exports.getDefinitionQueryResultForFragmentSpread = getDefinitionQueryResultForFragmentSpread; exports.getDefinitionQueryResultForNamedType = getDefinitionQueryResultForNamedType; var _utils = __webpack_require__(/*! ../utils */ "../../graphql-language-service/esm/utils/index.js"); var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; const LANGUAGE = 'GraphQL'; exports.LANGUAGE = LANGUAGE; function assert(value, message) { if (!value) { throw new Error(message); } } function getRange(text, node) { const location = node.loc; assert(location, 'Expected ASTNode to have a location.'); return (0, _utils.locToRange)(text, location); } function getPosition(text, node) { const location = node.loc; assert(location, 'Expected ASTNode to have a location.'); return (0, _utils.offsetToPosition)(text, location.start); } function getDefinitionQueryResultForNamedType(text, node, dependencies) { return __awaiter(this, void 0, void 0, function* () { const name = node.name.value; const defNodes = dependencies.filter(_ref => { let { definition } = _ref; return definition.name && definition.name.value === name; }); if (defNodes.length === 0) { throw new Error(`Definition not found for GraphQL type ${name}`); } const definitions = defNodes.map(_ref2 => { let { filePath, content, definition } = _ref2; return getDefinitionForNodeDefinition(filePath || '', content, definition); }); return { definitions, queryRange: definitions.map(_ => getRange(text, node)) }; }); } function getDefinitionQueryResultForField(fieldName, typeName, dependencies) { var _a; return __awaiter(this, void 0, void 0, function* () { const defNodes = dependencies.filter(_ref3 => { let { definition } = _ref3; return definition.name && definition.name.value === typeName; }); if (defNodes.length === 0) { throw new Error(`Definition not found for GraphQL type ${typeName}`); } const definitions = []; for (const { filePath, content, definition } of defNodes) { const fieldDefinition = (_a = definition.fields) === null || _a === void 0 ? void 0 : _a.find(item => item.name.value === fieldName); if (fieldDefinition == null) { continue; } definitions.push(getDefinitionForFieldDefinition(filePath || '', content, fieldDefinition)); } return { definitions, queryRange: [] }; }); } function getDefinitionQueryResultForFragmentSpread(text, fragment, dependencies) { return __awaiter(this, void 0, void 0, function* () { const name = fragment.name.value; const defNodes = dependencies.filter(_ref4 => { let { definition } = _ref4; return definition.name.value === name; }); if (defNodes.length === 0) { throw new Error(`Definition not found for GraphQL fragment ${name}`); } const definitions = defNodes.map(_ref5 => { let { filePath, content, definition } = _ref5; return getDefinitionForFragmentDefinition(filePath || '', content, definition); }); return { definitions, queryRange: definitions.map(_ => getRange(text, fragment)) }; }); } function getDefinitionQueryResultForDefinitionNode(path, text, definition) { return { definitions: [getDefinitionForFragmentDefinition(path, text, definition)], queryRange: definition.name ? [getRange(text, definition.name)] : [] }; } function getDefinitionForFragmentDefinition(path, text, definition) { const { name } = definition; if (!name) { throw new Error('Expected ASTNode to have a Name.'); } return { path, position: getPosition(text, definition), range: getRange(text, definition), name: name.value || '', language: LANGUAGE, projectRoot: path }; } function getDefinitionForNodeDefinition(path, text, definition) { const { name } = definition; assert(name, 'Expected ASTNode to have a Name.'); return { path, position: getPosition(text, definition), range: getRange(text, definition), name: name.value || '', language: LANGUAGE, projectRoot: path }; } function getDefinitionForFieldDefinition(path, text, definition) { const { name } = definition; assert(name, 'Expected ASTNode to have a Name.'); return { path, position: getPosition(text, definition), range: getRange(text, definition), name: name.value || '', language: LANGUAGE, projectRoot: path }; } /***/ }), /***/ "../../graphql-language-service/esm/interface/getDiagnostics.js": /*!**********************************************************************!*\ !*** ../../graphql-language-service/esm/interface/getDiagnostics.js ***! \**********************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SEVERITY = exports.DIAGNOSTIC_SEVERITY = void 0; exports.getDiagnostics = getDiagnostics; exports.getRange = getRange; exports.validateQuery = validateQuery; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); var _parser = __webpack_require__(/*! ../parser */ "../../graphql-language-service/esm/parser/index.js"); var _utils = __webpack_require__(/*! ../utils */ "../../graphql-language-service/esm/utils/index.js"); const SEVERITY = { Error: 'Error', Warning: 'Warning', Information: 'Information', Hint: 'Hint' }; exports.SEVERITY = SEVERITY; const DIAGNOSTIC_SEVERITY = { [SEVERITY.Error]: 1, [SEVERITY.Warning]: 2, [SEVERITY.Information]: 3, [SEVERITY.Hint]: 4 }; exports.DIAGNOSTIC_SEVERITY = DIAGNOSTIC_SEVERITY; const invariant = (condition, message) => { if (!condition) { throw new Error(message); } }; function getDiagnostics(query) { let schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; let customRules = arguments.length > 2 ? arguments[2] : undefined; let isRelayCompatMode = arguments.length > 3 ? arguments[3] : undefined; let externalFragments = arguments.length > 4 ? arguments[4] : undefined; var _a, _b; let ast = null; let fragments = ''; if (externalFragments) { fragments = typeof externalFragments === 'string' ? externalFragments : externalFragments.reduce((acc, node) => acc + (0, _graphql.print)(node) + '\n\n', ''); } const enhancedQuery = fragments ? `${query}\n\n${fragments}` : query; try { ast = (0, _graphql.parse)(enhancedQuery); } catch (error) { if (error instanceof _graphql.GraphQLError) { const range = getRange((_b = (_a = error.locations) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : { line: 0, column: 0 }, enhancedQuery); return [{ severity: DIAGNOSTIC_SEVERITY.Error, message: error.message, source: 'GraphQL: Syntax', range }]; } throw error; } return validateQuery(ast, schema, customRules, isRelayCompatMode); } function validateQuery(ast) { let schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; let customRules = arguments.length > 2 ? arguments[2] : undefined; let isRelayCompatMode = arguments.length > 3 ? arguments[3] : undefined; if (!schema) { return []; } const validationErrorAnnotations = (0, _utils.validateWithCustomRules)(schema, ast, customRules, isRelayCompatMode).flatMap(error => annotations(error, DIAGNOSTIC_SEVERITY.Error, 'Validation')); const deprecationWarningAnnotations = (0, _graphql.validate)(schema, ast, [_graphql.NoDeprecatedCustomRule]).flatMap(error => annotations(error, DIAGNOSTIC_SEVERITY.Warning, 'Deprecation')); return validationErrorAnnotations.concat(deprecationWarningAnnotations); } function annotations(error, severity, type) { if (!error.nodes) { return []; } const highlightedNodes = []; for (const [i, node] of error.nodes.entries()) { const highlightNode = node.kind !== 'Variable' && 'name' in node && node.name !== undefined ? node.name : 'variable' in node && node.variable !== undefined ? node.variable : node; if (highlightNode) { invariant(error.locations, 'GraphQL validation error requires locations.'); const loc = error.locations[i]; const highlightLoc = getLocation(highlightNode); const end = loc.column + (highlightLoc.end - highlightLoc.start); highlightedNodes.push({ source: `GraphQL: ${type}`, message: error.message, severity, range: new _utils.Range(new _utils.Position(loc.line - 1, loc.column - 1), new _utils.Position(loc.line - 1, end)) }); } } return highlightedNodes; } function getRange(location, queryText) { const parser = (0, _parser.onlineParser)(); const state = parser.startState(); const lines = queryText.split('\n'); invariant(lines.length >= location.line, 'Query text must have more lines than where the error happened'); let stream = null; for (let i = 0; i < location.line; i++) { stream = new _parser.CharacterStream(lines[i]); while (!stream.eol()) { const style = parser.token(stream, state); if (style === 'invalidchar') { break; } } } invariant(stream, 'Expected Parser stream to be available.'); const line = location.line - 1; const start = stream.getStartOfToken(); const end = stream.getCurrentPosition(); return new _utils.Range(new _utils.Position(line, start), new _utils.Position(line, end)); } function getLocation(node) { const typeCastedNode = node; const location = typeCastedNode.loc; invariant(location, 'Expected ASTNode to have a location.'); return location; } /***/ }), /***/ "../../graphql-language-service/esm/interface/getHoverInformation.js": /*!***************************************************************************!*\ !*** ../../graphql-language-service/esm/interface/getHoverInformation.js ***! \***************************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getHoverInformation = getHoverInformation; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); var _getAutocompleteSuggestions = __webpack_require__(/*! ./getAutocompleteSuggestions */ "../../graphql-language-service/esm/interface/getAutocompleteSuggestions.js"); function getHoverInformation(schema, queryText, cursor, contextToken, config) { const token = contextToken || (0, _getAutocompleteSuggestions.getTokenAtPosition)(queryText, cursor); if (!schema || !token || !token.state) { return ''; } const { kind, step } = token.state; const typeInfo = (0, _getAutocompleteSuggestions.getTypeInfo)(schema, token.state); const options = Object.assign(Object.assign({}, config), { schema }); if (kind === 'Field' && step === 0 && typeInfo.fieldDef || kind === 'AliasedField' && step === 2 && typeInfo.fieldDef) { const into = []; renderMdCodeStart(into, options); renderField(into, typeInfo, options); renderMdCodeEnd(into, options); renderDescription(into, options, typeInfo.fieldDef); return into.join('').trim(); } if (kind === 'Directive' && step === 1 && typeInfo.directiveDef) { const into = []; renderMdCodeStart(into, options); renderDirective(into, typeInfo, options); renderMdCodeEnd(into, options); renderDescription(into, options, typeInfo.directiveDef); return into.join('').trim(); } if (kind === 'Argument' && step === 0 && typeInfo.argDef) { const into = []; renderMdCodeStart(into, options); renderArg(into, typeInfo, options); renderMdCodeEnd(into, options); renderDescription(into, options, typeInfo.argDef); return into.join('').trim(); } if (kind === 'EnumValue' && typeInfo.enumValue && 'description' in typeInfo.enumValue) { const into = []; renderMdCodeStart(into, options); renderEnumValue(into, typeInfo, options); renderMdCodeEnd(into, options); renderDescription(into, options, typeInfo.enumValue); return into.join('').trim(); } if (kind === 'NamedType' && typeInfo.type && 'description' in typeInfo.type) { const into = []; renderMdCodeStart(into, options); renderType(into, typeInfo, options, typeInfo.type); renderMdCodeEnd(into, options); renderDescription(into, options, typeInfo.type); return into.join('').trim(); } return ''; } function renderMdCodeStart(into, options) { if (options.useMarkdown) { text(into, '```graphql\n'); } } function renderMdCodeEnd(into, options) { if (options.useMarkdown) { text(into, '\n```'); } } function renderField(into, typeInfo, options) { renderQualifiedField(into, typeInfo, options); renderTypeAnnotation(into, typeInfo, options, typeInfo.type); } function renderQualifiedField(into, typeInfo, options) { if (!typeInfo.fieldDef) { return; } const fieldName = typeInfo.fieldDef.name; if (fieldName.slice(0, 2) !== '__') { renderType(into, typeInfo, options, typeInfo.parentType); text(into, '.'); } text(into, fieldName); } function renderDirective(into, typeInfo, _options) { if (!typeInfo.directiveDef) { return; } const name = '@' + typeInfo.directiveDef.name; text(into, name); } function renderArg(into, typeInfo, options) { if (typeInfo.directiveDef) { renderDirective(into, typeInfo, options); } else if (typeInfo.fieldDef) { renderQualifiedField(into, typeInfo, options); } if (!typeInfo.argDef) { return; } const { name } = typeInfo.argDef; text(into, '('); text(into, name); renderTypeAnnotation(into, typeInfo, options, typeInfo.inputType); text(into, ')'); } function renderTypeAnnotation(into, typeInfo, options, t) { text(into, ': '); renderType(into, typeInfo, options, t); } function renderEnumValue(into, typeInfo, options) { if (!typeInfo.enumValue) { return; } const { name } = typeInfo.enumValue; renderType(into, typeInfo, options, typeInfo.inputType); text(into, '.'); text(into, name); } function renderType(into, typeInfo, options, t) { if (!t) { return; } if (t instanceof _graphql.GraphQLNonNull) { renderType(into, typeInfo, options, t.ofType); text(into, '!'); } else if (t instanceof _graphql.GraphQLList) { text(into, '['); renderType(into, typeInfo, options, t.ofType); text(into, ']'); } else { text(into, t.name); } } function renderDescription(into, options, def) { if (!def) { return; } const description = typeof def.description === 'string' ? def.description : null; if (description) { text(into, '\n\n'); text(into, description); } renderDeprecation(into, options, def); } function renderDeprecation(into, _options, def) { if (!def) { return; } const reason = def.deprecationReason || null; if (!reason) { return; } text(into, '\n\n'); text(into, 'Deprecated: '); text(into, reason); } function text(into, content) { into.push(content); } /***/ }), /***/ "../../graphql-language-service/esm/interface/getOutline.js": /*!******************************************************************!*\ !*** ../../graphql-language-service/esm/interface/getOutline.js ***! \******************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOutline = getOutline; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); var _utils = __webpack_require__(/*! ../utils */ "../../graphql-language-service/esm/utils/index.js"); const { INLINE_FRAGMENT } = _graphql.Kind; const OUTLINEABLE_KINDS = { Field: true, OperationDefinition: true, Document: true, SelectionSet: true, Name: true, FragmentDefinition: true, FragmentSpread: true, InlineFragment: true, ObjectTypeDefinition: true, InputObjectTypeDefinition: true, InterfaceTypeDefinition: true, EnumTypeDefinition: true, EnumValueDefinition: true, InputValueDefinition: true, FieldDefinition: true }; function getOutline(documentText) { let ast; try { ast = (0, _graphql.parse)(documentText); } catch (_a) { return null; } const visitorFns = outlineTreeConverter(documentText); const outlineTrees = (0, _graphql.visit)(ast, { leave(node) { if (visitorFns !== undefined && node.kind in visitorFns) { return visitorFns[node.kind](node); } return null; } }); return { outlineTrees }; } function outlineTreeConverter(docText) { const meta = node => { return { representativeName: node.name, startPosition: (0, _utils.offsetToPosition)(docText, node.loc.start), endPosition: (0, _utils.offsetToPosition)(docText, node.loc.end), kind: node.kind, children: node.selectionSet || node.fields || node.values || node.arguments || [] }; }; return { Field(node) { const tokenizedText = node.alias ? [buildToken('plain', node.alias), buildToken('plain', ': ')] : []; tokenizedText.push(buildToken('plain', node.name)); return Object.assign({ tokenizedText }, meta(node)); }, OperationDefinition: node => Object.assign({ tokenizedText: [buildToken('keyword', node.operation), buildToken('whitespace', ' '), buildToken('class-name', node.name)] }, meta(node)), Document: node => node.definitions, SelectionSet: node => concatMap(node.selections, child => { return child.kind === INLINE_FRAGMENT ? child.selectionSet : child; }), Name: node => node.value, FragmentDefinition: node => Object.assign({ tokenizedText: [buildToken('keyword', 'fragment'), buildToken('whitespace', ' '), buildToken('class-name', node.name)] }, meta(node)), InterfaceTypeDefinition: node => Object.assign({ tokenizedText: [buildToken('keyword', 'interface'), buildToken('whitespace', ' '), buildToken('class-name', node.name)] }, meta(node)), EnumTypeDefinition: node => Object.assign({ tokenizedText: [buildToken('keyword', 'enum'), buildToken('whitespace', ' '), buildToken('class-name', node.name)] }, meta(node)), EnumValueDefinition: node => Object.assign({ tokenizedText: [buildToken('plain', node.name)] }, meta(node)), ObjectTypeDefinition: node => Object.assign({ tokenizedText: [buildToken('keyword', 'type'), buildToken('whitespace', ' '), buildToken('class-name', node.name)] }, meta(node)), InputObjectTypeDefinition: node => Object.assign({ tokenizedText: [buildToken('keyword', 'input'), buildToken('whitespace', ' '), buildToken('class-name', node.name)] }, meta(node)), FragmentSpread: node => Object.assign({ tokenizedText: [buildToken('plain', '...'), buildToken('class-name', node.name)] }, meta(node)), InputValueDefinition(node) { return Object.assign({ tokenizedText: [buildToken('plain', node.name)] }, meta(node)); }, FieldDefinition(node) { return Object.assign({ tokenizedText: [buildToken('plain', node.name)] }, meta(node)); }, InlineFragment: node => node.selectionSet }; } function buildToken(kind, value) { return { kind, value }; } function concatMap(arr, fn) { const res = []; for (let i = 0; i < arr.length; i++) { const x = fn(arr[i], i); if (Array.isArray(x)) { res.push(...x); } else { res.push(x); } } return res; } /***/ }), /***/ "../../graphql-language-service/esm/interface/index.js": /*!*************************************************************!*\ !*** ../../graphql-language-service/esm/interface/index.js ***! \*************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); var _exportNames = { getOutline: true, getHoverInformation: true }; Object.defineProperty(exports, "getHoverInformation", ({ enumerable: true, get: function () { return _getHoverInformation.getHoverInformation; } })); Object.defineProperty(exports, "getOutline", ({ enumerable: true, get: function () { return _getOutline.getOutline; } })); var _autocompleteUtils = __webpack_require__(/*! ./autocompleteUtils */ "../../graphql-language-service/esm/interface/autocompleteUtils.js"); Object.keys(_autocompleteUtils).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _autocompleteUtils[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _autocompleteUtils[key]; } }); }); var _getAutocompleteSuggestions = __webpack_require__(/*! ./getAutocompleteSuggestions */ "../../graphql-language-service/esm/interface/getAutocompleteSuggestions.js"); Object.keys(_getAutocompleteSuggestions).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _getAutocompleteSuggestions[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _getAutocompleteSuggestions[key]; } }); }); var _getDefinition = __webpack_require__(/*! ./getDefinition */ "../../graphql-language-service/esm/interface/getDefinition.js"); Object.keys(_getDefinition).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _getDefinition[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _getDefinition[key]; } }); }); var _getDiagnostics = __webpack_require__(/*! ./getDiagnostics */ "../../graphql-language-service/esm/interface/getDiagnostics.js"); Object.keys(_getDiagnostics).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _getDiagnostics[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _getDiagnostics[key]; } }); }); var _getOutline = __webpack_require__(/*! ./getOutline */ "../../graphql-language-service/esm/interface/getOutline.js"); var _getHoverInformation = __webpack_require__(/*! ./getHoverInformation */ "../../graphql-language-service/esm/interface/getHoverInformation.js"); /***/ }), /***/ "../../graphql-language-service/esm/parser/CharacterStream.js": /*!********************************************************************!*\ !*** ../../graphql-language-service/esm/parser/CharacterStream.js ***! \********************************************************************/ /***/ (function(__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = void 0; class CharacterStream { constructor(sourceText) { var _this = this; this._start = 0; this._pos = 0; this.getStartOfToken = () => this._start; this.getCurrentPosition = () => this._pos; this.eol = () => this._sourceText.length === this._pos; this.sol = () => this._pos === 0; this.peek = () => { return this._sourceText.charAt(this._pos) || null; }; this.next = () => { const char = this._sourceText.charAt(this._pos); this._pos++; return char; }; this.eat = pattern => { const isMatched = this._testNextCharacter(pattern); if (isMatched) { this._start = this._pos; this._pos++; return this._sourceText.charAt(this._pos - 1); } return undefined; }; this.eatWhile = match => { let isMatched = this._testNextCharacter(match); let didEat = false; if (isMatched) { didEat = isMatched; this._start = this._pos; } while (isMatched) { this._pos++; isMatched = this._testNextCharacter(match); didEat = true; } return didEat; }; this.eatSpace = () => this.eatWhile(/[\s\u00a0]/); this.skipToEnd = () => { this._pos = this._sourceText.length; }; this.skipTo = position => { this._pos = position; }; this.match = function (pattern) { let consume = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; let caseFold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; let token = null; let match = null; if (typeof pattern === 'string') { const regex = new RegExp(pattern, caseFold ? 'i' : 'g'); match = regex.test(_this._sourceText.slice(_this._pos, _this._pos + pattern.length)); token = pattern; } else if (pattern instanceof RegExp) { match = _this._sourceText.slice(_this._pos).match(pattern); token = match === null || match === void 0 ? void 0 : match[0]; } if (match != null && (typeof pattern === 'string' || match instanceof Array && _this._sourceText.startsWith(match[0], _this._pos))) { if (consume) { _this._start = _this._pos; if (token && token.length) { _this._pos += token.length; } } return match; } return false; }; this.backUp = num => { this._pos -= num; }; this.column = () => this._pos; this.indentation = () => { const match = this._sourceText.match(/\s*/); let indent = 0; if (match && match.length !== 0) { const whiteSpaces = match[0]; let pos = 0; while (whiteSpaces.length > pos) { if (whiteSpaces.charCodeAt(pos) === 9) { indent += 2; } else { indent++; } pos++; } } return indent; }; this.current = () => this._sourceText.slice(this._start, this._pos); this._sourceText = sourceText; } _testNextCharacter(pattern) { const character = this._sourceText.charAt(this._pos); let isMatched = false; if (typeof pattern === 'string') { isMatched = character === pattern; } else { isMatched = pattern instanceof RegExp ? pattern.test(character) : pattern(character); } return isMatched; } } exports["default"] = CharacterStream; /***/ }), /***/ "../../graphql-language-service/esm/parser/RuleHelpers.js": /*!****************************************************************!*\ !*** ../../graphql-language-service/esm/parser/RuleHelpers.js ***! \****************************************************************/ /***/ (function(__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.butNot = butNot; exports.list = list; exports.opt = opt; exports.p = p; exports.t = t; function opt(ofRule) { return { ofRule }; } function list(ofRule, separator) { return { ofRule, isList: true, separator }; } function butNot(rule, exclusions) { const ruleMatch = rule.match; rule.match = token => { let check = false; if (ruleMatch) { check = ruleMatch(token); } return check && exclusions.every(exclusion => exclusion.match && !exclusion.match(token)); }; return rule; } function t(kind, style) { return { style, match: token => token.kind === kind }; } function p(value, style) { return { style: style || 'punctuation', match: token => token.kind === 'Punctuation' && token.value === value }; } /***/ }), /***/ "../../graphql-language-service/esm/parser/Rules.js": /*!**********************************************************!*\ !*** ../../graphql-language-service/esm/parser/Rules.js ***! \**********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isIgnored = exports.ParseRules = exports.LexRules = void 0; var _RuleHelpers = __webpack_require__(/*! ./RuleHelpers */ "../../graphql-language-service/esm/parser/RuleHelpers.js"); var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); const isIgnored = ch => ch === ' ' || ch === '\t' || ch === ',' || ch === '\n' || ch === '\r' || ch === '\uFEFF' || ch === '\u00A0'; exports.isIgnored = isIgnored; const LexRules = { Name: /^[_A-Za-z][_0-9A-Za-z]*/, Punctuation: /^(?:!|\$|\(|\)|\.\.\.|:|=|&|@|\[|]|\{|\||\})/, Number: /^-?(?:0|(?:[1-9][0-9]*))(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?/, String: /^(?:"""(?:\\"""|[^"]|"[^"]|""[^"])*(?:""")?|"(?:[^"\\]|\\(?:"|\/|\\|b|f|n|r|t|u[0-9a-fA-F]{4}))*"?)/, Comment: /^#.*/ }; exports.LexRules = LexRules; const ParseRules = { Document: [(0, _RuleHelpers.list)('Definition')], Definition(token) { switch (token.value) { case '{': return 'ShortQuery'; case 'query': return 'Query'; case 'mutation': return 'Mutation'; case 'subscription': return 'Subscription'; case 'fragment': return _graphql.Kind.FRAGMENT_DEFINITION; case 'schema': return 'SchemaDef'; case 'scalar': return 'ScalarDef'; case 'type': return 'ObjectTypeDef'; case 'interface': return 'InterfaceDef'; case 'union': return 'UnionDef'; case 'enum': return 'EnumDef'; case 'input': return 'InputDef'; case 'extend': return 'ExtendDef'; case 'directive': return 'DirectiveDef'; } }, ShortQuery: ['SelectionSet'], Query: [word('query'), (0, _RuleHelpers.opt)(name('def')), (0, _RuleHelpers.opt)('VariableDefinitions'), (0, _RuleHelpers.list)('Directive'), 'SelectionSet'], Mutation: [word('mutation'), (0, _RuleHelpers.opt)(name('def')), (0, _RuleHelpers.opt)('VariableDefinitions'), (0, _RuleHelpers.list)('Directive'), 'SelectionSet'], Subscription: [word('subscription'), (0, _RuleHelpers.opt)(name('def')), (0, _RuleHelpers.opt)('VariableDefinitions'), (0, _RuleHelpers.list)('Directive'), 'SelectionSet'], VariableDefinitions: [(0, _RuleHelpers.p)('('), (0, _RuleHelpers.list)('VariableDefinition'), (0, _RuleHelpers.p)(')')], VariableDefinition: ['Variable', (0, _RuleHelpers.p)(':'), 'Type', (0, _RuleHelpers.opt)('DefaultValue')], Variable: [(0, _RuleHelpers.p)('$', 'variable'), name('variable')], DefaultValue: [(0, _RuleHelpers.p)('='), 'Value'], SelectionSet: [(0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('Selection'), (0, _RuleHelpers.p)('}')], Selection(token, stream) { return token.value === '...' ? stream.match(/[\s\u00a0,]*(on\b|@|{)/, false) ? 'InlineFragment' : 'FragmentSpread' : stream.match(/[\s\u00a0,]*:/, false) ? 'AliasedField' : 'Field'; }, AliasedField: [name('property'), (0, _RuleHelpers.p)(':'), name('qualifier'), (0, _RuleHelpers.opt)('Arguments'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.opt)('SelectionSet')], Field: [name('property'), (0, _RuleHelpers.opt)('Arguments'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.opt)('SelectionSet')], Arguments: [(0, _RuleHelpers.p)('('), (0, _RuleHelpers.list)('Argument'), (0, _RuleHelpers.p)(')')], Argument: [name('attribute'), (0, _RuleHelpers.p)(':'), 'Value'], FragmentSpread: [(0, _RuleHelpers.p)('...'), name('def'), (0, _RuleHelpers.list)('Directive')], InlineFragment: [(0, _RuleHelpers.p)('...'), (0, _RuleHelpers.opt)('TypeCondition'), (0, _RuleHelpers.list)('Directive'), 'SelectionSet'], FragmentDefinition: [word('fragment'), (0, _RuleHelpers.opt)((0, _RuleHelpers.butNot)(name('def'), [word('on')])), 'TypeCondition', (0, _RuleHelpers.list)('Directive'), 'SelectionSet'], TypeCondition: [word('on'), 'NamedType'], Value(token) { switch (token.kind) { case 'Number': return 'NumberValue'; case 'String': return 'StringValue'; case 'Punctuation': switch (token.value) { case '[': return 'ListValue'; case '{': return 'ObjectValue'; case '$': return 'Variable'; case '&': return 'NamedType'; } return null; case 'Name': switch (token.value) { case 'true': case 'false': return 'BooleanValue'; } if (token.value === 'null') { return 'NullValue'; } return 'EnumValue'; } }, NumberValue: [(0, _RuleHelpers.t)('Number', 'number')], StringValue: [{ style: 'string', match: token => token.kind === 'String', update(state, token) { if (token.value.startsWith('"""')) { state.inBlockstring = !token.value.slice(3).endsWith('"""'); } } }], BooleanValue: [(0, _RuleHelpers.t)('Name', 'builtin')], NullValue: [(0, _RuleHelpers.t)('Name', 'keyword')], EnumValue: [name('string-2')], ListValue: [(0, _RuleHelpers.p)('['), (0, _RuleHelpers.list)('Value'), (0, _RuleHelpers.p)(']')], ObjectValue: [(0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('ObjectField'), (0, _RuleHelpers.p)('}')], ObjectField: [name('attribute'), (0, _RuleHelpers.p)(':'), 'Value'], Type(token) { return token.value === '[' ? 'ListType' : 'NonNullType'; }, ListType: [(0, _RuleHelpers.p)('['), 'Type', (0, _RuleHelpers.p)(']'), (0, _RuleHelpers.opt)((0, _RuleHelpers.p)('!'))], NonNullType: ['NamedType', (0, _RuleHelpers.opt)((0, _RuleHelpers.p)('!'))], NamedType: [type('atom')], Directive: [(0, _RuleHelpers.p)('@', 'meta'), name('meta'), (0, _RuleHelpers.opt)('Arguments')], DirectiveDef: [word('directive'), (0, _RuleHelpers.p)('@', 'meta'), name('meta'), (0, _RuleHelpers.opt)('ArgumentsDef'), word('on'), (0, _RuleHelpers.list)('DirectiveLocation', (0, _RuleHelpers.p)('|'))], InterfaceDef: [word('interface'), name('atom'), (0, _RuleHelpers.opt)('Implements'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('FieldDef'), (0, _RuleHelpers.p)('}')], Implements: [word('implements'), (0, _RuleHelpers.list)('NamedType', (0, _RuleHelpers.p)('&'))], DirectiveLocation: [name('string-2')], SchemaDef: [word('schema'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('OperationTypeDef'), (0, _RuleHelpers.p)('}')], OperationTypeDef: [name('keyword'), (0, _RuleHelpers.p)(':'), name('atom')], ScalarDef: [word('scalar'), name('atom'), (0, _RuleHelpers.list)('Directive')], ObjectTypeDef: [word('type'), name('atom'), (0, _RuleHelpers.opt)('Implements'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('FieldDef'), (0, _RuleHelpers.p)('}')], FieldDef: [name('property'), (0, _RuleHelpers.opt)('ArgumentsDef'), (0, _RuleHelpers.p)(':'), 'Type', (0, _RuleHelpers.list)('Directive')], ArgumentsDef: [(0, _RuleHelpers.p)('('), (0, _RuleHelpers.list)('InputValueDef'), (0, _RuleHelpers.p)(')')], InputValueDef: [name('attribute'), (0, _RuleHelpers.p)(':'), 'Type', (0, _RuleHelpers.opt)('DefaultValue'), (0, _RuleHelpers.list)('Directive')], UnionDef: [word('union'), name('atom'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('='), (0, _RuleHelpers.list)('UnionMember', (0, _RuleHelpers.p)('|'))], UnionMember: ['NamedType'], EnumDef: [word('enum'), name('atom'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('EnumValueDef'), (0, _RuleHelpers.p)('}')], EnumValueDef: [name('string-2'), (0, _RuleHelpers.list)('Directive')], InputDef: [word('input'), name('atom'), (0, _RuleHelpers.list)('Directive'), (0, _RuleHelpers.p)('{'), (0, _RuleHelpers.list)('InputValueDef'), (0, _RuleHelpers.p)('}')], ExtendDef: [word('extend'), 'ExtensionDefinition'], ExtensionDefinition(token) { switch (token.value) { case 'schema': return _graphql.Kind.SCHEMA_EXTENSION; case 'scalar': return _graphql.Kind.SCALAR_TYPE_EXTENSION; case 'type': return _graphql.Kind.OBJECT_TYPE_EXTENSION; case 'interface': return _graphql.Kind.INTERFACE_TYPE_EXTENSION; case 'union': return _graphql.Kind.UNION_TYPE_EXTENSION; case 'enum': return _graphql.Kind.ENUM_TYPE_EXTENSION; case 'input': return _graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION; } }, [_graphql.Kind.SCHEMA_EXTENSION]: ['SchemaDef'], [_graphql.Kind.SCALAR_TYPE_EXTENSION]: ['ScalarDef'], [_graphql.Kind.OBJECT_TYPE_EXTENSION]: ['ObjectTypeDef'], [_graphql.Kind.INTERFACE_TYPE_EXTENSION]: ['InterfaceDef'], [_graphql.Kind.UNION_TYPE_EXTENSION]: ['UnionDef'], [_graphql.Kind.ENUM_TYPE_EXTENSION]: ['EnumDef'], [_graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION]: ['InputDef'] }; exports.ParseRules = ParseRules; function word(value) { return { style: 'keyword', match: token => token.kind === 'Name' && token.value === value }; } function name(style) { return { style, match: token => token.kind === 'Name', update(state, token) { state.name = token.value; } }; } function type(style) { return { style, match: token => token.kind === 'Name', update(state, token) { var _a; if ((_a = state.prevState) === null || _a === void 0 ? void 0 : _a.prevState) { state.name = token.value; state.prevState.prevState.type = token.value; } } }; } /***/ }), /***/ "../../graphql-language-service/esm/parser/index.js": /*!**********************************************************!*\ !*** ../../graphql-language-service/esm/parser/index.js ***! \**********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); var _exportNames = { CharacterStream: true, LexRules: true, ParseRules: true, isIgnored: true, butNot: true, list: true, opt: true, p: true, t: true, onlineParser: true }; Object.defineProperty(exports, "CharacterStream", ({ enumerable: true, get: function () { return _CharacterStream.default; } })); Object.defineProperty(exports, "LexRules", ({ enumerable: true, get: function () { return _Rules.LexRules; } })); Object.defineProperty(exports, "ParseRules", ({ enumerable: true, get: function () { return _Rules.ParseRules; } })); Object.defineProperty(exports, "butNot", ({ enumerable: true, get: function () { return _RuleHelpers.butNot; } })); Object.defineProperty(exports, "isIgnored", ({ enumerable: true, get: function () { return _Rules.isIgnored; } })); Object.defineProperty(exports, "list", ({ enumerable: true, get: function () { return _RuleHelpers.list; } })); Object.defineProperty(exports, "onlineParser", ({ enumerable: true, get: function () { return _onlineParser.default; } })); Object.defineProperty(exports, "opt", ({ enumerable: true, get: function () { return _RuleHelpers.opt; } })); Object.defineProperty(exports, "p", ({ enumerable: true, get: function () { return _RuleHelpers.p; } })); Object.defineProperty(exports, "t", ({ enumerable: true, get: function () { return _RuleHelpers.t; } })); var _CharacterStream = _interopRequireDefault(__webpack_require__(/*! ./CharacterStream */ "../../graphql-language-service/esm/parser/CharacterStream.js")); var _Rules = __webpack_require__(/*! ./Rules */ "../../graphql-language-service/esm/parser/Rules.js"); var _RuleHelpers = __webpack_require__(/*! ./RuleHelpers */ "../../graphql-language-service/esm/parser/RuleHelpers.js"); var _onlineParser = _interopRequireDefault(__webpack_require__(/*! ./onlineParser */ "../../graphql-language-service/esm/parser/onlineParser.js")); var _types = __webpack_require__(/*! ./types */ "../../graphql-language-service/esm/parser/types.js"); Object.keys(_types).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; if (key in exports && exports[key] === _types[key]) return; Object.defineProperty(exports, key, { enumerable: true, get: function () { return _types[key]; } }); }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), /***/ "../../graphql-language-service/esm/parser/onlineParser.js": /*!*****************************************************************!*\ !*** ../../graphql-language-service/esm/parser/onlineParser.js ***! \*****************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = onlineParser; var _Rules = __webpack_require__(/*! ./Rules */ "../../graphql-language-service/esm/parser/Rules.js"); var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); function onlineParser() { let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { eatWhitespace: stream => stream.eatWhile(_Rules.isIgnored), lexRules: _Rules.LexRules, parseRules: _Rules.ParseRules, editorConfig: {} }; return { startState() { const initialState = { level: 0, step: 0, name: null, kind: null, type: null, rule: null, needsSeparator: false, prevState: null }; pushRule(options.parseRules, initialState, _graphql.Kind.DOCUMENT); return initialState; }, token(stream, state) { return getToken(stream, state, options); } }; } function getToken(stream, state, options) { var _a; if (state.inBlockstring) { if (stream.match(/.*"""/)) { state.inBlockstring = false; return 'string'; } stream.skipToEnd(); return 'string'; } const { lexRules, parseRules, eatWhitespace, editorConfig } = options; if (state.rule && state.rule.length === 0) { popRule(state); } else if (state.needsAdvance) { state.needsAdvance = false; advanceRule(state, true); } if (stream.sol()) { const tabSize = (editorConfig === null || editorConfig === void 0 ? void 0 : editorConfig.tabSize) || 2; state.indentLevel = Math.floor(stream.indentation() / tabSize); } if (eatWhitespace(stream)) { return 'ws'; } const token = lex(lexRules, stream); if (!token) { const matchedSomething = stream.match(/\S+/); if (!matchedSomething) { stream.match(/\s/); } pushRule(SpecialParseRules, state, 'Invalid'); return 'invalidchar'; } if (token.kind === 'Comment') { pushRule(SpecialParseRules, state, 'Comment'); return 'comment'; } const backupState = assign({}, state); if (token.kind === 'Punctuation') { if (/^[{([]/.test(token.value)) { if (state.indentLevel !== undefined) { state.levels = (state.levels || []).concat(state.indentLevel + 1); } } else if (/^[})\]]/.test(token.value)) { const levels = state.levels = (state.levels || []).slice(0, -1); if (state.indentLevel && levels.length > 0 && levels.at(-1) < state.indentLevel) { state.indentLevel = levels.at(-1); } } } while (state.rule) { let expected = typeof state.rule === 'function' ? state.step === 0 ? state.rule(token, stream) : null : state.rule[state.step]; if (state.needsSeparator) { expected = expected === null || expected === void 0 ? void 0 : expected.separator; } if (expected) { if (expected.ofRule) { expected = expected.ofRule; } if (typeof expected === 'string') { pushRule(parseRules, state, expected); continue; } if ((_a = expected.match) === null || _a === void 0 ? void 0 : _a.call(expected, token)) { if (expected.update) { expected.update(state, token); } if (token.kind === 'Punctuation') { advanceRule(state, true); } else { state.needsAdvance = true; } return expected.style; } } unsuccessful(state); } assign(state, backupState); pushRule(SpecialParseRules, state, 'Invalid'); return 'invalidchar'; } function assign(to, from) { const keys = Object.keys(from); for (let i = 0; i < keys.length; i++) { to[keys[i]] = from[keys[i]]; } return to; } const SpecialParseRules = { Invalid: [], Comment: [] }; function pushRule(rules, state, ruleKind) { if (!rules[ruleKind]) { throw new TypeError('Unknown rule: ' + ruleKind); } state.prevState = Object.assign({}, state); state.kind = ruleKind; state.name = null; state.type = null; state.rule = rules[ruleKind]; state.step = 0; state.needsSeparator = false; } function popRule(state) { if (!state.prevState) { return; } state.kind = state.prevState.kind; state.name = state.prevState.name; state.type = state.prevState.type; state.rule = state.prevState.rule; state.step = state.prevState.step; state.needsSeparator = state.prevState.needsSeparator; state.prevState = state.prevState.prevState; } function advanceRule(state, successful) { var _a; if (isList(state) && state.rule) { const step = state.rule[state.step]; if (step.separator) { const { separator } = step; state.needsSeparator = !state.needsSeparator; if (!state.needsSeparator && separator.ofRule) { return; } } if (successful) { return; } } state.needsSeparator = false; state.step++; while (state.rule && !(Array.isArray(state.rule) && state.step < state.rule.length)) { popRule(state); if (state.rule) { if (isList(state)) { if ((_a = state.rule) === null || _a === void 0 ? void 0 : _a[state.step].separator) { state.needsSeparator = !state.needsSeparator; } } else { state.needsSeparator = false; state.step++; } } } } function isList(state) { const step = Array.isArray(state.rule) && typeof state.rule[state.step] !== 'string' && state.rule[state.step]; return step && step.isList; } function unsuccessful(state) { while (state.rule && !(Array.isArray(state.rule) && state.rule[state.step].ofRule)) { popRule(state); } if (state.rule) { advanceRule(state, false); } } function lex(lexRules, stream) { const kinds = Object.keys(lexRules); for (let i = 0; i < kinds.length; i++) { const match = stream.match(lexRules[kinds[i]]); if (match && match instanceof Array) { return { kind: kinds[i], value: match[0] }; } } } /***/ }), /***/ "../../graphql-language-service/esm/parser/types.js": /*!**********************************************************!*\ !*** ../../graphql-language-service/esm/parser/types.js ***! \**********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.RuleKinds = exports.AdditionalRuleKinds = void 0; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); const AdditionalRuleKinds = { ALIASED_FIELD: 'AliasedField', ARGUMENTS: 'Arguments', SHORT_QUERY: 'ShortQuery', QUERY: 'Query', MUTATION: 'Mutation', SUBSCRIPTION: 'Subscription', TYPE_CONDITION: 'TypeCondition', INVALID: 'Invalid', COMMENT: 'Comment', SCHEMA_DEF: 'SchemaDef', SCALAR_DEF: 'ScalarDef', OBJECT_TYPE_DEF: 'ObjectTypeDef', OBJECT_VALUE: 'ObjectValue', LIST_VALUE: 'ListValue', INTERFACE_DEF: 'InterfaceDef', UNION_DEF: 'UnionDef', ENUM_DEF: 'EnumDef', ENUM_VALUE: 'EnumValue', FIELD_DEF: 'FieldDef', INPUT_DEF: 'InputDef', INPUT_VALUE_DEF: 'InputValueDef', ARGUMENTS_DEF: 'ArgumentsDef', EXTEND_DEF: 'ExtendDef', EXTENSION_DEFINITION: 'ExtensionDefinition', DIRECTIVE_DEF: 'DirectiveDef', IMPLEMENTS: 'Implements', VARIABLE_DEFINITIONS: 'VariableDefinitions', TYPE: 'Type' }; exports.AdditionalRuleKinds = AdditionalRuleKinds; const RuleKinds = Object.assign(Object.assign({}, _graphql.Kind), AdditionalRuleKinds); exports.RuleKinds = RuleKinds; /***/ }), /***/ "../../graphql-language-service/esm/types.js": /*!***************************************************!*\ !*** ../../graphql-language-service/esm/types.js ***! \***************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.FileChangeTypeKind = exports.CompletionItemKind = void 0; Object.defineProperty(exports, "InsertTextFormat", ({ enumerable: true, get: function () { return _vscodeLanguageserverTypes.InsertTextFormat; } })); var _vscodeLanguageserverTypes = __webpack_require__(/*! vscode-languageserver-types */ "../../../node_modules/vscode-languageserver-types/lib/esm/main.js"); const FileChangeTypeKind = { Created: 1, Changed: 2, Deleted: 3 }; exports.FileChangeTypeKind = FileChangeTypeKind; var CompletionItemKind; exports.CompletionItemKind = CompletionItemKind; (function (CompletionItemKind) { CompletionItemKind.Text = 1; CompletionItemKind.Method = 2; CompletionItemKind.Function = 3; CompletionItemKind.Constructor = 4; CompletionItemKind.Field = 5; CompletionItemKind.Variable = 6; CompletionItemKind.Class = 7; CompletionItemKind.Interface = 8; CompletionItemKind.Module = 9; CompletionItemKind.Property = 10; CompletionItemKind.Unit = 11; CompletionItemKind.Value = 12; CompletionItemKind.Enum = 13; CompletionItemKind.Keyword = 14; CompletionItemKind.Snippet = 15; CompletionItemKind.Color = 16; CompletionItemKind.File = 17; CompletionItemKind.Reference = 18; CompletionItemKind.Folder = 19; CompletionItemKind.EnumMember = 20; CompletionItemKind.Constant = 21; CompletionItemKind.Struct = 22; CompletionItemKind.Event = 23; CompletionItemKind.Operator = 24; CompletionItemKind.TypeParameter = 25; })(CompletionItemKind || (exports.CompletionItemKind = CompletionItemKind = {})); /***/ }), /***/ "../../graphql-language-service/esm/utils/Range.js": /*!*********************************************************!*\ !*** ../../graphql-language-service/esm/utils/Range.js ***! \*********************************************************/ /***/ (function(__unused_webpack_module, exports) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Range = exports.Position = void 0; exports.locToRange = locToRange; exports.offsetToPosition = offsetToPosition; class Range { constructor(start, end) { this.containsPosition = position => { if (this.start.line === position.line) { return this.start.character <= position.character; } if (this.end.line === position.line) { return this.end.character >= position.character; } return this.start.line <= position.line && this.end.line >= position.line; }; this.start = start; this.end = end; } setStart(line, character) { this.start = new Position(line, character); } setEnd(line, character) { this.end = new Position(line, character); } } exports.Range = Range; class Position { constructor(line, character) { this.lessThanOrEqualTo = position => this.line < position.line || this.line === position.line && this.character <= position.character; this.line = line; this.character = character; } setLine(line) { this.line = line; } setCharacter(character) { this.character = character; } } exports.Position = Position; function offsetToPosition(text, loc) { const EOL = '\n'; const buf = text.slice(0, loc); const lines = buf.split(EOL).length - 1; const lastLineIndex = buf.lastIndexOf(EOL); return new Position(lines, loc - lastLineIndex - 1); } function locToRange(text, loc) { const start = offsetToPosition(text, loc.start); const end = offsetToPosition(text, loc.end); return new Range(start, end); } /***/ }), /***/ "../../graphql-language-service/esm/utils/collectVariables.js": /*!********************************************************************!*\ !*** ../../graphql-language-service/esm/utils/collectVariables.js ***! \********************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.collectVariables = collectVariables; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); function collectVariables(schema, documentAST) { const variableToType = Object.create(null); for (const definition of documentAST.definitions) { if (definition.kind === 'OperationDefinition') { const { variableDefinitions } = definition; if (variableDefinitions) { for (const { variable, type } of variableDefinitions) { const inputType = (0, _graphql.typeFromAST)(schema, type); if (inputType) { variableToType[variable.name.value] = inputType; } else if (type.kind === _graphql.Kind.NAMED_TYPE && type.name.value === 'Float') { variableToType[variable.name.value] = _graphql.GraphQLFloat; } } } } } return variableToType; } /***/ }), /***/ "../../graphql-language-service/esm/utils/fragmentDependencies.js": /*!************************************************************************!*\ !*** ../../graphql-language-service/esm/utils/fragmentDependencies.js ***! \************************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getFragmentDependenciesForAST = exports.getFragmentDependencies = void 0; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); var _nullthrows = _interopRequireDefault(__webpack_require__(/*! nullthrows */ "../../../node_modules/nullthrows/nullthrows.js")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const getFragmentDependencies = (operationString, fragmentDefinitions) => { if (!fragmentDefinitions) { return []; } let parsedOperation; try { parsedOperation = (0, _graphql.parse)(operationString); } catch (_a) { return []; } return getFragmentDependenciesForAST(parsedOperation, fragmentDefinitions); }; exports.getFragmentDependencies = getFragmentDependencies; const getFragmentDependenciesForAST = (parsedOperation, fragmentDefinitions) => { if (!fragmentDefinitions) { return []; } const existingFrags = new Map(); const referencedFragNames = new Set(); (0, _graphql.visit)(parsedOperation, { FragmentDefinition(node) { existingFrags.set(node.name.value, true); }, FragmentSpread(node) { if (!referencedFragNames.has(node.name.value)) { referencedFragNames.add(node.name.value); } } }); const asts = new Set(); for (const name of referencedFragNames) { if (!existingFrags.has(name) && fragmentDefinitions.has(name)) { asts.add((0, _nullthrows.default)(fragmentDefinitions.get(name))); } } const referencedFragments = []; for (const ast of asts) { (0, _graphql.visit)(ast, { FragmentSpread(node) { if (!referencedFragNames.has(node.name.value) && fragmentDefinitions.get(node.name.value)) { asts.add((0, _nullthrows.default)(fragmentDefinitions.get(node.name.value))); referencedFragNames.add(node.name.value); } } }); if (!existingFrags.has(ast.name.value)) { referencedFragments.push(ast); } } return referencedFragments; }; exports.getFragmentDependenciesForAST = getFragmentDependenciesForAST; /***/ }), /***/ "../../graphql-language-service/esm/utils/getASTNodeAtPosition.js": /*!************************************************************************!*\ !*** ../../graphql-language-service/esm/utils/getASTNodeAtPosition.js ***! \************************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getASTNodeAtPosition = getASTNodeAtPosition; exports.pointToOffset = pointToOffset; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); function getASTNodeAtPosition(query, ast, point) { const offset = pointToOffset(query, point); let nodeContainingPosition; (0, _graphql.visit)(ast, { enter(node) { if (node.kind !== 'Name' && node.loc && node.loc.start <= offset && offset <= node.loc.end) { nodeContainingPosition = node; } else { return false; } }, leave(node) { if (node.loc && node.loc.start <= offset && offset <= node.loc.end) { return false; } } }); return nodeContainingPosition; } function pointToOffset(text, point) { const linesUntilPosition = text.split('\n').slice(0, point.line); return point.character + linesUntilPosition.map(line => line.length + 1).reduce((a, b) => a + b, 0); } /***/ }), /***/ "../../graphql-language-service/esm/utils/getOperationFacts.js": /*!*********************************************************************!*\ !*** ../../graphql-language-service/esm/utils/getOperationFacts.js ***! \*********************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = getOperationFacts; exports.getOperationASTFacts = getOperationASTFacts; exports.getQueryFacts = void 0; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); var _collectVariables = __webpack_require__(/*! ./collectVariables */ "../../graphql-language-service/esm/utils/collectVariables.js"); function getOperationASTFacts(documentAST, schema) { const variableToType = schema ? (0, _collectVariables.collectVariables)(schema, documentAST) : undefined; const operations = []; (0, _graphql.visit)(documentAST, { OperationDefinition(node) { operations.push(node); } }); return { variableToType, operations }; } function getOperationFacts(schema, documentString) { if (!documentString) { return; } try { const documentAST = (0, _graphql.parse)(documentString); return Object.assign(Object.assign({}, getOperationASTFacts(documentAST, schema)), { documentAST }); } catch (_a) { return; } } const getQueryFacts = getOperationFacts; exports.getQueryFacts = getQueryFacts; /***/ }), /***/ "../../graphql-language-service/esm/utils/getVariablesJSONSchema.js": /*!**************************************************************************!*\ !*** ../../graphql-language-service/esm/utils/getVariablesJSONSchema.js ***! \**************************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.defaultJSONSchemaOptions = void 0; exports.getVariablesJSONSchema = getVariablesJSONSchema; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); const defaultJSONSchemaOptions = { useMarkdownDescription: false }; exports.defaultJSONSchemaOptions = defaultJSONSchemaOptions; function text(into, newText) { into.push(newText); } function renderType(into, t) { if ((0, _graphql.isNonNullType)(t)) { renderType(into, t.ofType); text(into, '!'); } else if ((0, _graphql.isListType)(t)) { text(into, '['); renderType(into, t.ofType); text(into, ']'); } else { text(into, t.name); } } function renderTypeToString(t, useMarkdown) { const into = []; if (useMarkdown) { text(into, '```graphql\n'); } renderType(into, t); if (useMarkdown) { text(into, '\n```'); } return into.join(''); } const scalarTypesMap = { Int: 'integer', String: 'string', Float: 'number', ID: 'string', Boolean: 'boolean', DateTime: 'string' }; class Marker { constructor() { this.set = new Set(); } mark(name) { if (this.set.has(name)) { return false; } this.set.add(name); return true; } } function getJSONSchemaFromGraphQLType(type, options) { let required = false; let definition = Object.create(null); const definitions = Object.create(null); if ('defaultValue' in type && type.defaultValue !== undefined) { definition.default = type.defaultValue; } if ((0, _graphql.isEnumType)(type)) { definition.type = 'string'; definition.enum = type.getValues().map(val => val.name); } if ((0, _graphql.isScalarType)(type) && scalarTypesMap[type.name]) { definition.type = scalarTypesMap[type.name]; } if ((0, _graphql.isListType)(type)) { definition.type = 'array'; const { definition: def, definitions: defs } = getJSONSchemaFromGraphQLType(type.ofType, options); if (def.$ref) { definition.items = { $ref: def.$ref }; } else { definition.items = def; } if (defs) { for (const defName of Object.keys(defs)) { definitions[defName] = defs[defName]; } } } if ((0, _graphql.isNonNullType)(type)) { required = true; const { definition: def, definitions: defs } = getJSONSchemaFromGraphQLType(type.ofType, options); definition = def; if (defs) { for (const defName of Object.keys(defs)) { definitions[defName] = defs[defName]; } } } if ((0, _graphql.isInputObjectType)(type)) { definition.$ref = `#/definitions/${type.name}`; if (options === null || options === void 0 ? void 0 : options.definitionMarker.mark(type.name)) { const fields = type.getFields(); const fieldDef = { type: 'object', properties: {}, required: [] }; if (type.description) { fieldDef.description = type.description + '\n' + renderTypeToString(type); if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) { fieldDef.markdownDescription = type.description + '\n' + renderTypeToString(type, true); } } else { fieldDef.description = renderTypeToString(type); if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) { fieldDef.markdownDescription = renderTypeToString(type, true); } } for (const fieldName of Object.keys(fields)) { const field = fields[fieldName]; const { required: fieldRequired, definition: typeDefinition, definitions: typeDefinitions } = getJSONSchemaFromGraphQLType(field.type, options); const { definition: fieldDefinition } = getJSONSchemaFromGraphQLType(field, options); fieldDef.properties[fieldName] = Object.assign(Object.assign({}, typeDefinition), fieldDefinition); const renderedField = renderTypeToString(field.type); fieldDef.properties[fieldName].description = field.description ? field.description + '\n' + renderedField : renderedField; if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) { const renderedFieldMarkdown = renderTypeToString(field.type, true); fieldDef.properties[fieldName].markdownDescription = field.description ? field.description + '\n' + renderedFieldMarkdown : renderedFieldMarkdown; } if (fieldRequired) { fieldDef.required.push(fieldName); } if (typeDefinitions) { for (const [defName, value] of Object.entries(typeDefinitions)) { definitions[defName] = value; } } } definitions[type.name] = fieldDef; } } if ('description' in type && !(0, _graphql.isScalarType)(type) && type.description && !definition.description) { definition.description = type.description + '\n' + renderTypeToString(type); if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) { definition.markdownDescription = type.description + '\n' + renderTypeToString(type, true); } } else { definition.description = renderTypeToString(type); if (options === null || options === void 0 ? void 0 : options.useMarkdownDescription) { definition.markdownDescription = renderTypeToString(type, true); } } return { required, definition, definitions }; } function getVariablesJSONSchema(variableToType, options) { var _a; const jsonSchema = { $schema: 'https://json-schema.org/draft/2020-12/schema', type: 'object', properties: {}, required: [] }; const runtimeOptions = Object.assign(Object.assign({}, options), { definitionMarker: new Marker() }); if (variableToType) { for (const [variableName, type] of Object.entries(variableToType)) { const { definition, required, definitions } = getJSONSchemaFromGraphQLType(type, runtimeOptions); jsonSchema.properties[variableName] = definition; if (required) { (_a = jsonSchema.required) === null || _a === void 0 ? void 0 : _a.push(variableName); } if (definitions) { jsonSchema.definitions = Object.assign(Object.assign({}, jsonSchema === null || jsonSchema === void 0 ? void 0 : jsonSchema.definitions), definitions); } } } return jsonSchema; } /***/ }), /***/ "../../graphql-language-service/esm/utils/index.js": /*!*********************************************************!*\ !*** ../../graphql-language-service/esm/utils/index.js ***! \*********************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "Position", ({ enumerable: true, get: function () { return _Range.Position; } })); Object.defineProperty(exports, "Range", ({ enumerable: true, get: function () { return _Range.Range; } })); Object.defineProperty(exports, "collectVariables", ({ enumerable: true, get: function () { return _collectVariables.collectVariables; } })); Object.defineProperty(exports, "getASTNodeAtPosition", ({ enumerable: true, get: function () { return _getASTNodeAtPosition.getASTNodeAtPosition; } })); Object.defineProperty(exports, "getFragmentDependencies", ({ enumerable: true, get: function () { return _fragmentDependencies.getFragmentDependencies; } })); Object.defineProperty(exports, "getFragmentDependenciesForAST", ({ enumerable: true, get: function () { return _fragmentDependencies.getFragmentDependenciesForAST; } })); Object.defineProperty(exports, "getOperationASTFacts", ({ enumerable: true, get: function () { return _getOperationFacts.getOperationASTFacts; } })); Object.defineProperty(exports, "getOperationFacts", ({ enumerable: true, get: function () { return _getOperationFacts.default; } })); Object.defineProperty(exports, "getQueryFacts", ({ enumerable: true, get: function () { return _getOperationFacts.getQueryFacts; } })); Object.defineProperty(exports, "getVariablesJSONSchema", ({ enumerable: true, get: function () { return _getVariablesJSONSchema.getVariablesJSONSchema; } })); Object.defineProperty(exports, "locToRange", ({ enumerable: true, get: function () { return _Range.locToRange; } })); Object.defineProperty(exports, "offsetToPosition", ({ enumerable: true, get: function () { return _Range.offsetToPosition; } })); Object.defineProperty(exports, "pointToOffset", ({ enumerable: true, get: function () { return _getASTNodeAtPosition.pointToOffset; } })); Object.defineProperty(exports, "validateWithCustomRules", ({ enumerable: true, get: function () { return _validateWithCustomRules.validateWithCustomRules; } })); var _fragmentDependencies = __webpack_require__(/*! ./fragmentDependencies */ "../../graphql-language-service/esm/utils/fragmentDependencies.js"); var _getVariablesJSONSchema = __webpack_require__(/*! ./getVariablesJSONSchema */ "../../graphql-language-service/esm/utils/getVariablesJSONSchema.js"); var _getASTNodeAtPosition = __webpack_require__(/*! ./getASTNodeAtPosition */ "../../graphql-language-service/esm/utils/getASTNodeAtPosition.js"); var _Range = __webpack_require__(/*! ./Range */ "../../graphql-language-service/esm/utils/Range.js"); var _validateWithCustomRules = __webpack_require__(/*! ./validateWithCustomRules */ "../../graphql-language-service/esm/utils/validateWithCustomRules.js"); var _collectVariables = __webpack_require__(/*! ./collectVariables */ "../../graphql-language-service/esm/utils/collectVariables.js"); var _getOperationFacts = _interopRequireWildcard(__webpack_require__(/*! ./getOperationFacts */ "../../graphql-language-service/esm/utils/getOperationFacts.js")); 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; } /***/ }), /***/ "../../graphql-language-service/esm/utils/validateWithCustomRules.js": /*!***************************************************************************!*\ !*** ../../graphql-language-service/esm/utils/validateWithCustomRules.js ***! \***************************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.validateWithCustomRules = validateWithCustomRules; var _graphql = __webpack_require__(/*! graphql */ "../../../node_modules/graphql/index.mjs"); const specifiedSDLRules = [_graphql.LoneSchemaDefinitionRule, _graphql.UniqueOperationTypesRule, _graphql.UniqueTypeNamesRule, _graphql.UniqueEnumValueNamesRule, _graphql.UniqueFieldDefinitionNamesRule, _graphql.UniqueDirectiveNamesRule, _graphql.KnownTypeNamesRule, _graphql.KnownDirectivesRule, _graphql.UniqueDirectivesPerLocationRule, _graphql.PossibleTypeExtensionsRule, _graphql.UniqueArgumentNamesRule, _graphql.UniqueInputFieldNamesRule]; function validateWithCustomRules(schema, ast, customRules, isRelayCompatMode, isSchemaDocument) { const rules = _graphql.specifiedRules.filter(rule => { if (rule === _graphql.NoUnusedFragmentsRule || rule === _graphql.ExecutableDefinitionsRule) { return false; } if (isRelayCompatMode && rule === _graphql.KnownFragmentNamesRule) { return false; } return true; }); if (customRules) { Array.prototype.push.apply(rules, customRules); } if (isSchemaDocument) { Array.prototype.push.apply(rules, specifiedSDLRules); } const errors = (0, _graphql.validate)(schema, ast, rules); return errors.filter(error => { if (error.message.includes('Unknown directive') && error.nodes) { const node = error.nodes[0]; if (node && node.kind === _graphql.Kind.DIRECTIVE) { const name = node.name.value; if (name === 'arguments' || name === 'argumentDefinitions') { return false; } } } return true; }); } /***/ }), /***/ "./style.css": /*!*******************!*\ !*** ./style.css ***! \*******************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); // extracted by mini-css-extract-plugin /***/ }), /***/ "../../graphiql-react/dist/style.css": /*!*******************************************!*\ !*** ../../graphiql-react/dist/style.css ***! \*******************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); // extracted by mini-css-extract-plugin /***/ }), /***/ "../../graphiql-react/font/fira-code.css": /*!***********************************************!*\ !*** ../../graphiql-react/font/fira-code.css ***! \***********************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); // extracted by mini-css-extract-plugin /***/ }), /***/ "../../graphiql-react/font/roboto.css": /*!********************************************!*\ !*** ../../graphiql-react/font/roboto.css ***! \********************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); // extracted by mini-css-extract-plugin /***/ }), /***/ "react": /*!************************!*\ !*** external "React" ***! \************************/ /***/ (function(module) { module.exports = window["React"]; /***/ }), /***/ "react-dom": /*!***************************!*\ !*** external "ReactDOM" ***! \***************************/ /***/ (function(module) { module.exports = window["ReactDOM"]; /***/ }), /***/ "../../../node_modules/@headlessui/react/dist/headlessui.dev.cjs": /*!***********************************************************************!*\ !*** ../../../node_modules/@headlessui/react/dist/headlessui.dev.cjs ***! \***********************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; // src/index.ts var src_exports = {}; __export(src_exports, { Combobox: () => Combobox, Dialog: () => Dialog, Disclosure: () => Disclosure, FocusTrap: () => FocusTrap, Listbox: () => Listbox, Menu: () => Menu, Popover: () => Popover, Portal: () => Portal, RadioGroup: () => RadioGroup, Switch: () => Switch, Tab: () => Tab, Transition: () => Transition }); module.exports = __toCommonJS(src_exports); // src/components/combobox/combobox.tsx var import_react19 = __toESM(__webpack_require__(/*! react */ "react"), 1); // src/hooks/use-computed.ts var import_react3 = __webpack_require__(/*! react */ "react"); // src/hooks/use-iso-morphic-effect.ts var import_react = __webpack_require__(/*! react */ "react"); // src/utils/env.ts var Env = class { constructor() { __publicField(this, "current", this.detect()); __publicField(this, "handoffState", "pending"); __publicField(this, "currentId", 0); } set(env2) { if (this.current === env2) return; this.handoffState = "pending"; this.currentId = 0; this.current = env2; } reset() { this.set(this.detect()); } nextId() { return ++this.currentId; } get isServer() { return this.current === "server"; } get isClient() { return this.current === "client"; } detect() { if (typeof window === "undefined" || typeof document === "undefined") { return "server"; } return "client"; } handoff() { if (this.handoffState === "pending") { this.handoffState = "complete"; } } get isHandoffComplete() { return this.handoffState === "complete"; } }; var env = new Env(); // src/hooks/use-iso-morphic-effect.ts var useIsoMorphicEffect = (effect, deps) => { if (env.isServer) { (0, import_react.useEffect)(effect, deps); } else { (0, import_react.useLayoutEffect)(effect, deps); } }; // src/hooks/use-latest-value.ts var import_react2 = __webpack_require__(/*! react */ "react"); function useLatestValue(value) { let cache = (0, import_react2.useRef)(value); useIsoMorphicEffect(() => { cache.current = value; }, [value]); return cache; } // src/hooks/use-computed.ts function useComputed(cb, dependencies) { let [value, setValue] = (0, import_react3.useState)(cb); let cbRef = useLatestValue(cb); useIsoMorphicEffect(() => setValue(cbRef.current), [cbRef, setValue, ...dependencies]); return value; } // src/hooks/use-disposables.ts var import_react4 = __webpack_require__(/*! react */ "react"); // src/utils/micro-task.ts function microTask(cb) { if (typeof queueMicrotask === "function") { queueMicrotask(cb); } else { Promise.resolve().then(cb).catch( (e) => setTimeout(() => { throw e; }) ); } } // src/utils/disposables.ts function disposables() { let _disposables = []; let api = { addEventListener(element, name, listener, options) { element.addEventListener(name, listener, options); return api.add(() => element.removeEventListener(name, listener, options)); }, requestAnimationFrame(...args) { let raf = requestAnimationFrame(...args); return api.add(() => cancelAnimationFrame(raf)); }, nextFrame(...args) { return api.requestAnimationFrame(() => { return api.requestAnimationFrame(...args); }); }, setTimeout(...args) { let timer = setTimeout(...args); return api.add(() => clearTimeout(timer)); }, microTask(...args) { let task = { current: true }; microTask(() => { if (task.current) { args[0](); } }); return api.add(() => { task.current = false; }); }, style(node, property, value) { let previous = node.style.getPropertyValue(property); Object.assign(node.style, { [property]: value }); return this.add(() => { Object.assign(node.style, { [property]: previous }); }); }, group(cb) { let d = disposables(); cb(d); return this.add(() => d.dispose()); }, add(cb) { _disposables.push(cb); return () => { let idx = _disposables.indexOf(cb); if (idx >= 0) { for (let dispose of _disposables.splice(idx, 1)) { dispose(); } } }; }, dispose() { for (let dispose of _disposables.splice(0)) { dispose(); } } }; return api; } // src/hooks/use-disposables.ts function useDisposables() { let [d] = (0, import_react4.useState)(disposables); (0, import_react4.useEffect)(() => () => d.dispose(), [d]); return d; } // src/hooks/use-event.ts var import_react5 = __toESM(__webpack_require__(/*! react */ "react"), 1); var useEvent = ( // TODO: Add React.useEvent ?? once the useEvent hook is available function useEvent2(cb) { let cache = useLatestValue(cb); return import_react5.default.useCallback((...args) => cache.current(...args), [cache]); } ); // src/hooks/use-id.ts var import_react7 = __toESM(__webpack_require__(/*! react */ "react"), 1); // src/hooks/use-server-handoff-complete.ts var import_react6 = __webpack_require__(/*! react */ "react"); function useServerHandoffComplete() { let [complete, setComplete] = (0, import_react6.useState)(env.isHandoffComplete); if (complete && env.isHandoffComplete === false) { setComplete(false); } (0, import_react6.useEffect)(() => { if (complete === true) return; setComplete(true); }, [complete]); (0, import_react6.useEffect)(() => env.handoff(), []); return complete; } // src/hooks/use-id.ts var _a; var useId = ( // Prefer React's `useId` if it's available. // @ts-expect-error - `useId` doesn't exist in React < 18. (_a = import_react7.default.useId) != null ? _a : function useId2() { let ready = useServerHandoffComplete(); let [id, setId] = import_react7.default.useState(ready ? () => env.nextId() : null); useIsoMorphicEffect(() => { if (id === null) setId(env.nextId()); }, [id]); return id != null ? "" + id : void 0; } ); // src/hooks/use-outside-click.ts var import_react10 = __webpack_require__(/*! react */ "react"); // src/utils/match.ts function match(value, lookup, ...args) { if (value in lookup) { let returnValue = lookup[value]; return typeof returnValue === "function" ? returnValue(...args) : returnValue; } let error = new Error( `Tried to handle "${value}" but there is no handler defined. Only defined handlers are: ${Object.keys( lookup ).map((key) => `"${key}"`).join(", ")}.` ); if (Error.captureStackTrace) Error.captureStackTrace(error, match); throw error; } // src/utils/owner.ts function getOwnerDocument(element) { if (env.isServer) return null; if (element instanceof Node) return element.ownerDocument; if (element == null ? void 0 : element.hasOwnProperty("current")) { if (element.current instanceof Node) return element.current.ownerDocument; } return document; } // src/utils/focus-management.ts var focusableSelector = [ "[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])" ].map( false ? ( // TODO: Remove this once JSDOM fixes the issue where an element that is // "hidden" can be the document.activeElement, because this is not possible // in real browsers. 0 ) : (selector) => `${selector}:not([tabindex='-1'])` ).join(","); function getFocusableElements(container = document.body) { if (container == null) return []; return Array.from(container.querySelectorAll(focusableSelector)).sort( // We want to move `tabIndex={0}` to the end of the list, this is what the browser does as well. (a, z) => Math.sign((a.tabIndex || Number.MAX_SAFE_INTEGER) - (z.tabIndex || Number.MAX_SAFE_INTEGER)) ); } function isFocusableElement(element, mode = 0 /* Strict */) { var _a3; if (element === ((_a3 = getOwnerDocument(element)) == null ? void 0 : _a3.body)) return false; return match(mode, { [0 /* Strict */]() { return element.matches(focusableSelector); }, [1 /* Loose */]() { let next = element; while (next !== null) { if (next.matches(focusableSelector)) return true; next = next.parentElement; } return false; } }); } function restoreFocusIfNecessary(element) { let ownerDocument = getOwnerDocument(element); disposables().nextFrame(() => { if (ownerDocument && !isFocusableElement(ownerDocument.activeElement, 0 /* Strict */)) { focusElement(element); } }); } if (typeof window !== "undefined" && typeof document !== "undefined") { document.addEventListener( "keydown", (event) => { if (event.metaKey || event.altKey || event.ctrlKey) { return; } document.documentElement.dataset.headlessuiFocusVisible = ""; }, true ); document.addEventListener( "click", (event) => { if (event.detail === 1 /* Mouse */) { delete document.documentElement.dataset.headlessuiFocusVisible; } else if (event.detail === 0 /* Keyboard */) { document.documentElement.dataset.headlessuiFocusVisible = ""; } }, true ); } function focusElement(element) { element == null ? void 0 : element.focus({ preventScroll: true }); } var selectableSelector = ["textarea", "input"].join(","); function isSelectableElement(element) { var _a3, _b; return (_b = (_a3 = element == null ? void 0 : element.matches) == null ? void 0 : _a3.call(element, selectableSelector)) != null ? _b : false; } function sortByDomNode(nodes, resolveKey = (i) => i) { return nodes.slice().sort((aItem, zItem) => { let a = resolveKey(aItem); let z = resolveKey(zItem); if (a === null || z === null) return 0; let position = a.compareDocumentPosition(z); if (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1; if (position & Node.DOCUMENT_POSITION_PRECEDING) return 1; return 0; }); } function focusFrom(current, focus) { return focusIn(getFocusableElements(), focus, { relativeTo: current }); } function focusIn(container, focus, { sorted = true, relativeTo = null, skipElements = [] } = {}) { let ownerDocument = Array.isArray(container) ? container.length > 0 ? container[0].ownerDocument : document : container.ownerDocument; let elements = Array.isArray(container) ? sorted ? sortByDomNode(container) : container : getFocusableElements(container); if (skipElements.length > 0 && elements.length > 1) { elements = elements.filter((x) => !skipElements.includes(x)); } relativeTo = relativeTo != null ? relativeTo : ownerDocument.activeElement; let direction = (() => { if (focus & (1 /* First */ | 4 /* Next */)) return 1 /* Next */; if (focus & (2 /* Previous */ | 8 /* Last */)) return -1 /* Previous */; throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last"); })(); let startIndex = (() => { if (focus & 1 /* First */) return 0; if (focus & 2 /* Previous */) return Math.max(0, elements.indexOf(relativeTo)) - 1; if (focus & 4 /* Next */) return Math.max(0, elements.indexOf(relativeTo)) + 1; if (focus & 8 /* Last */) return elements.length - 1; throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last"); })(); let focusOptions = focus & 32 /* NoScroll */ ? { preventScroll: true } : {}; let offset = 0; let total = elements.length; let next = void 0; do { if (offset >= total || offset + total <= 0) return 0 /* Error */; let nextIdx = startIndex + offset; if (focus & 16 /* WrapAround */) { nextIdx = (nextIdx + total) % total; } else { if (nextIdx < 0) return 3 /* Underflow */; if (nextIdx >= total) return 1 /* Overflow */; } next = elements[nextIdx]; next == null ? void 0 : next.focus(focusOptions); offset += direction; } while (next !== ownerDocument.activeElement); if (focus & (4 /* Next */ | 2 /* Previous */) && isSelectableElement(next)) { next.select(); } return 2 /* Success */; } // src/hooks/use-document-event.ts var import_react8 = __webpack_require__(/*! react */ "react"); function useDocumentEvent(type, listener, options) { let listenerRef = useLatestValue(listener); (0, import_react8.useEffect)(() => { function handler(event) { listenerRef.current(event); } document.addEventListener(type, handler, options); return () => document.removeEventListener(type, handler, options); }, [type, options]); } // src/hooks/use-window-event.ts var import_react9 = __webpack_require__(/*! react */ "react"); function useWindowEvent(type, listener, options) { let listenerRef = useLatestValue(listener); (0, import_react9.useEffect)(() => { function handler(event) { listenerRef.current(event); } window.addEventListener(type, handler, options); return () => window.removeEventListener(type, handler, options); }, [type, options]); } // src/hooks/use-outside-click.ts function useOutsideClick(containers, cb, enabled = true) { let enabledRef = (0, import_react10.useRef)(false); (0, import_react10.useEffect)( false ? 0 : () => { requestAnimationFrame(() => { enabledRef.current = enabled; }); }, [enabled] ); function handleOutsideClick(event, resolveTarget) { if (!enabledRef.current) return; if (event.defaultPrevented) return; let target = resolveTarget(event); if (target === null) { return; } if (!target.getRootNode().contains(target)) return; let _containers = function resolve(containers2) { if (typeof containers2 === "function") { return resolve(containers2()); } if (Array.isArray(containers2)) { return containers2; } if (containers2 instanceof Set) { return containers2; } return [containers2]; }(containers); for (let container of _containers) { if (container === null) continue; let domNode = container instanceof HTMLElement ? container : container.current; if (domNode == null ? void 0 : domNode.contains(target)) { return; } if (event.composed && event.composedPath().includes(domNode)) { return; } } if ( // This check alllows us to know whether or not we clicked on a "focusable" element like a // button or an input. This is a backwards compatibility check so that you can open a and click on another which should close Menu A and open Menu B. We might // revisit that so that you will require 2 clicks instead. !isFocusableElement(target, 1 /* Loose */) && // This could be improved, but the `Combobox.Button` adds tabIndex={-1} to make it // unfocusable via the keyboard so that tabbing to the next item from the input doesn't // first go to the button. target.tabIndex !== -1 ) { event.preventDefault(); } return cb(event, target); } let initialClickTarget = (0, import_react10.useRef)(null); useDocumentEvent( "mousedown", (event) => { var _a3, _b; if (enabledRef.current) { initialClickTarget.current = ((_b = (_a3 = event.composedPath) == null ? void 0 : _a3.call(event)) == null ? void 0 : _b[0]) || event.target; } }, true ); useDocumentEvent( "click", (event) => { if (!initialClickTarget.current) { return; } handleOutsideClick(event, () => { return initialClickTarget.current; }); initialClickTarget.current = null; }, // We will use the `capture` phase so that layers in between with `event.stopPropagation()` // don't "cancel" this outside click check. E.g.: A `Menu` inside a `DialogPanel` if the `Menu` // is open, and you click outside of it in the `DialogPanel` the `Menu` should close. However, // the `DialogPanel` has a `onClick(e) { e.stopPropagation() }` which would cancel this. true ); useWindowEvent( "blur", (event) => handleOutsideClick( event, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null ), true ); } // src/hooks/use-resolve-button-type.ts var import_react11 = __webpack_require__(/*! react */ "react"); function resolveType(props) { var _a3; if (props.type) return props.type; let tag = (_a3 = props.as) != null ? _a3 : "button"; if (typeof tag === "string" && tag.toLowerCase() === "button") return "button"; return void 0; } function useResolveButtonType(props, ref) { let [type, setType] = (0, import_react11.useState)(() => resolveType(props)); useIsoMorphicEffect(() => { setType(resolveType(props)); }, [props.type, props.as]); useIsoMorphicEffect(() => { if (type) return; if (!ref.current) return; if (ref.current instanceof HTMLButtonElement && !ref.current.hasAttribute("type")) { setType("button"); } }, [type, ref]); return type; } // src/hooks/use-sync-refs.ts var import_react12 = __webpack_require__(/*! react */ "react"); var Optional = Symbol(); function optionalRef(cb, isOptional = true) { return Object.assign(cb, { [Optional]: isOptional }); } function useSyncRefs(...refs) { let cache = (0, import_react12.useRef)(refs); (0, import_react12.useEffect)(() => { cache.current = refs; }, [refs]); let syncRefs = useEvent((value) => { for (let ref of cache.current) { if (ref == null) continue; if (typeof ref === "function") ref(value); else ref.current = value; } }); return refs.every( (ref) => ref == null || // @ts-expect-error (ref == null ? void 0 : ref[Optional]) ) ? void 0 : syncRefs; } // src/hooks/use-tree-walker.ts var import_react13 = __webpack_require__(/*! react */ "react"); function useTreeWalker({ container, accept, walk, enabled = true }) { let acceptRef = (0, import_react13.useRef)(accept); let walkRef = (0, import_react13.useRef)(walk); (0, import_react13.useEffect)(() => { acceptRef.current = accept; walkRef.current = walk; }, [accept, walk]); useIsoMorphicEffect(() => { if (!container) return; if (!enabled) return; let ownerDocument = getOwnerDocument(container); if (!ownerDocument) return; let accept2 = acceptRef.current; let walk2 = walkRef.current; let acceptNode = Object.assign((node) => accept2(node), { acceptNode: accept2 }); let walker = ownerDocument.createTreeWalker( container, NodeFilter.SHOW_ELEMENT, acceptNode, // @ts-expect-error This `false` is a simple small fix for older browsers false ); while (walker.nextNode()) walk2(walker.currentNode); }, [container, enabled, acceptRef, walkRef]); } // src/utils/calculate-active-index.ts function assertNever(x) { throw new Error("Unexpected object: " + x); } function calculateActiveIndex(action, resolvers) { let items = resolvers.resolveItems(); if (items.length <= 0) return null; let currentActiveIndex = resolvers.resolveActiveIndex(); let activeIndex = currentActiveIndex != null ? currentActiveIndex : -1; let nextActiveIndex = (() => { switch (action.focus) { case 0 /* First */: return items.findIndex((item) => !resolvers.resolveDisabled(item)); case 1 /* Previous */: { let idx = items.slice().reverse().findIndex((item, idx2, all) => { if (activeIndex !== -1 && all.length - idx2 - 1 >= activeIndex) return false; return !resolvers.resolveDisabled(item); }); if (idx === -1) return idx; return items.length - 1 - idx; } case 2 /* Next */: return items.findIndex((item, idx) => { if (idx <= activeIndex) return false; return !resolvers.resolveDisabled(item); }); case 3 /* Last */: { let idx = items.slice().reverse().findIndex((item) => !resolvers.resolveDisabled(item)); if (idx === -1) return idx; return items.length - 1 - idx; } case 4 /* Specific */: return items.findIndex((item) => resolvers.resolveId(item) === action.id); case 5 /* Nothing */: return null; default: assertNever(action); } })(); return nextActiveIndex === -1 ? currentActiveIndex : nextActiveIndex; } // src/utils/render.ts var import_react14 = __webpack_require__(/*! react */ "react"); // src/utils/class-names.ts function classNames(...classes) { return classes.filter(Boolean).join(" "); } // src/utils/render.ts function render({ ourProps, theirProps, slot, defaultTag, features, visible = true, name }) { let props = mergeProps(theirProps, ourProps); if (visible) return _render(props, slot, defaultTag, name); let featureFlags = features != null ? features : 0 /* None */; if (featureFlags & 2 /* Static */) { let { static: isStatic = false, ...rest } = props; if (isStatic) return _render(rest, slot, defaultTag, name); } if (featureFlags & 1 /* RenderStrategy */) { let { unmount = true, ...rest } = props; let strategy = unmount ? 0 /* Unmount */ : 1 /* Hidden */; return match(strategy, { [0 /* Unmount */]() { return null; }, [1 /* Hidden */]() { return _render( { ...rest, ...{ hidden: true, style: { display: "none" } } }, slot, defaultTag, name ); } }); } return _render(props, slot, defaultTag, name); } function _render(props, slot = {}, tag, name) { let { as: Component = tag, children, refName = "ref", ...rest } = omit(props, ["unmount", "static"]); let refRelatedProps = props.ref !== void 0 ? { [refName]: props.ref } : {}; let resolvedChildren = typeof children === "function" ? children(slot) : children; if ("className" in rest && rest.className && typeof rest.className === "function") { rest.className = rest.className(slot); } let dataAttributes = {}; if (slot) { let exposeState = false; let states = []; for (let [k, v] of Object.entries(slot)) { if (typeof v === "boolean") { exposeState = true; } if (v === true) { states.push(k); } } if (exposeState) dataAttributes[`data-headlessui-state`] = states.join(" "); } if (Component === import_react14.Fragment) { if (Object.keys(compact(rest)).length > 0) { if (!(0, import_react14.isValidElement)(resolvedChildren) || Array.isArray(resolvedChildren) && resolvedChildren.length > 1) { throw new Error( [ 'Passing props on "Fragment"!', "", `The current component <${name} /> is rendering a "Fragment".`, `However we need to passthrough the following props:`, Object.keys(rest).map((line) => ` - ${line}`).join("\n"), "", "You can apply a few solutions:", [ 'Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element." ].map((line) => ` - ${line}`).join("\n") ].join("\n") ); } let childProps = resolvedChildren.props; let newClassName = typeof (childProps == null ? void 0 : childProps.className) === "function" ? (...args) => classNames(childProps == null ? void 0 : childProps.className(...args), rest.className) : classNames(childProps == null ? void 0 : childProps.className, rest.className); let classNameProps = newClassName ? { className: newClassName } : {}; return (0, import_react14.cloneElement)( resolvedChildren, Object.assign( {}, // Filter out undefined values so that they don't override the existing values mergeProps(resolvedChildren.props, compact(omit(rest, ["ref"]))), dataAttributes, refRelatedProps, mergeRefs(resolvedChildren.ref, refRelatedProps.ref), classNameProps ) ); } } return (0, import_react14.createElement)( Component, Object.assign( {}, omit(rest, ["ref"]), Component !== import_react14.Fragment && refRelatedProps, Component !== import_react14.Fragment && dataAttributes ), resolvedChildren ); } function mergeRefs(...refs) { return { ref: refs.every((ref) => ref == null) ? void 0 : (value) => { for (let ref of refs) { if (ref == null) continue; if (typeof ref === "function") ref(value); else ref.current = value; } } }; } function mergeProps(...listOfProps) { var _a3; if (listOfProps.length === 0) return {}; if (listOfProps.length === 1) return listOfProps[0]; let target = {}; let eventHandlers = {}; for (let props of listOfProps) { for (let prop in props) { if (prop.startsWith("on") && typeof props[prop] === "function") { (_a3 = eventHandlers[prop]) != null ? _a3 : eventHandlers[prop] = []; eventHandlers[prop].push(props[prop]); } else { target[prop] = props[prop]; } } } if (target.disabled || target["aria-disabled"]) { return Object.assign( target, // Set all event listeners that we collected to `undefined`. This is // important because of the `cloneElement` from above, which merges the // existing and new props, they don't just override therefore we have to // explicitly nullify them. Object.fromEntries(Object.keys(eventHandlers).map((eventName) => [eventName, void 0])) ); } for (let eventName in eventHandlers) { Object.assign(target, { [eventName](event, ...args) { let handlers = eventHandlers[eventName]; for (let handler of handlers) { if ((event instanceof Event || (event == null ? void 0 : event.nativeEvent) instanceof Event) && event.defaultPrevented) { return; } handler(event, ...args); } } }); } return target; } function forwardRefWithAs(component) { var _a3; return Object.assign((0, import_react14.forwardRef)(component), { displayName: (_a3 = component.displayName) != null ? _a3 : component.name }); } function compact(object) { let clone = Object.assign({}, object); for (let key in clone) { if (clone[key] === void 0) delete clone[key]; } return clone; } function omit(object, keysToOmit = []) { let clone = Object.assign({}, object); for (let key of keysToOmit) { if (key in clone) delete clone[key]; } return clone; } // src/utils/bugs.ts function isDisabledReactIssue7711(element) { let parent = element.parentElement; let legend = null; while (parent && !(parent instanceof HTMLFieldSetElement)) { if (parent instanceof HTMLLegendElement) legend = parent; parent = parent.parentElement; } let isParentDisabled = (parent == null ? void 0 : parent.getAttribute("disabled")) === ""; if (isParentDisabled && isFirstLegend(legend)) return false; return isParentDisabled; } function isFirstLegend(element) { if (!element) return false; let previous = element.previousElementSibling; while (previous !== null) { if (previous instanceof HTMLLegendElement) return false; previous = previous.previousElementSibling; } return true; } // src/utils/form.ts function objectToFormEntries(source = {}, parentKey = null, entries = []) { for (let [key, value] of Object.entries(source)) { append(entries, composeKey(parentKey, key), value); } return entries; } function composeKey(parent, key) { return parent ? parent + "[" + key + "]" : key; } function append(entries, key, value) { if (Array.isArray(value)) { for (let [subkey, subvalue] of value.entries()) { append(entries, composeKey(key, subkey.toString()), subvalue); } } else if (value instanceof Date) { entries.push([key, value.toISOString()]); } else if (typeof value === "boolean") { entries.push([key, value ? "1" : "0"]); } else if (typeof value === "string") { entries.push([key, value]); } else if (typeof value === "number") { entries.push([key, `${value}`]); } else if (value === null || value === void 0) { entries.push([key, ""]); } else { objectToFormEntries(value, key, entries); } } function attemptSubmit(element) { var _a3; let form = (_a3 = element == null ? void 0 : element.form) != null ? _a3 : element.closest("form"); if (!form) return; for (let element2 of form.elements) { if (element2.tagName === "INPUT" && element2.type === "submit" || element2.tagName === "BUTTON" && element2.type === "submit" || element2.nodeName === "INPUT" && element2.type === "image") { element2.click(); return; } } } // src/internal/hidden.tsx var DEFAULT_VISUALLY_HIDDEN_TAG = "div"; function VisuallyHidden(props, ref) { let { features = 1 /* None */, ...theirProps } = props; let ourProps = { ref, "aria-hidden": (features & 2 /* Focusable */) === 2 /* Focusable */ ? true : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(features & 4 /* Hidden */) === 4 /* Hidden */ && !((features & 2 /* Focusable */) === 2 /* Focusable */) && { display: "none" } } }; return render({ ourProps, theirProps, slot: {}, defaultTag: DEFAULT_VISUALLY_HIDDEN_TAG, name: "Hidden" }); } var Hidden = forwardRefWithAs(VisuallyHidden); // src/internal/open-closed.tsx var import_react15 = __toESM(__webpack_require__(/*! react */ "react"), 1); var Context = (0, import_react15.createContext)(null); Context.displayName = "OpenClosedContext"; function useOpenClosed() { return (0, import_react15.useContext)(Context); } function OpenClosedProvider({ value, children }) { return /* @__PURE__ */ import_react15.default.createElement(Context.Provider, { value }, children); } // src/hooks/use-controllable.ts var import_react16 = __webpack_require__(/*! react */ "react"); function useControllable(controlledValue, onChange, defaultValue) { let [internalValue, setInternalValue] = (0, import_react16.useState)(defaultValue); let isControlled = controlledValue !== void 0; let wasControlled = (0, import_react16.useRef)(isControlled); let didWarnOnUncontrolledToControlled = (0, import_react16.useRef)(false); let didWarnOnControlledToUncontrolled = (0, import_react16.useRef)(false); if (isControlled && !wasControlled.current && !didWarnOnUncontrolledToControlled.current) { didWarnOnUncontrolledToControlled.current = true; wasControlled.current = isControlled; console.error( "A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen." ); } else if (!isControlled && wasControlled.current && !didWarnOnControlledToUncontrolled.current) { didWarnOnControlledToUncontrolled.current = true; wasControlled.current = isControlled; console.error( "A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen." ); } return [ isControlled ? controlledValue : internalValue, useEvent((value) => { if (isControlled) { return onChange == null ? void 0 : onChange(value); } else { setInternalValue(value); return onChange == null ? void 0 : onChange(value); } }) ]; } // src/hooks/use-watch.ts var import_react17 = __webpack_require__(/*! react */ "react"); function useWatch(cb, dependencies) { let track = (0, import_react17.useRef)([]); let action = useEvent(cb); (0, import_react17.useEffect)(() => { let oldValues = [...track.current]; for (let [idx, value] of dependencies.entries()) { if (track.current[idx] !== value) { let returnValue = action(dependencies, oldValues); track.current = dependencies; return returnValue; } } }, [action, ...dependencies]); } // src/hooks/use-tracked-pointer.ts var import_react18 = __webpack_require__(/*! react */ "react"); function eventToPosition(evt) { return [evt.screenX, evt.screenY]; } function useTrackedPointer() { let lastPos = (0, import_react18.useRef)([-1, -1]); return { wasMoved(evt) { if (false) {} let newPos = eventToPosition(evt); if (lastPos.current[0] === newPos[0] && lastPos.current[1] === newPos[1]) { return false; } lastPos.current = newPos; return true; }, update(evt) { lastPos.current = eventToPosition(evt); } }; } // src/utils/platform.ts function isIOS() { return ( // Check if it is an iPhone /iPhone/gi.test(window.navigator.platform) || // Check if it is an iPad. iPad reports itself as "MacIntel", but we can check if it is a touch // screen. Let's hope that Apple doesn't release a touch screen Mac (or maybe this would then // work as expected 🤔). /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0 ); } function isAndroid() { return /Android/gi.test(window.navigator.userAgent); } function isMobile() { return isIOS() || isAndroid(); } // src/components/combobox/combobox.tsx function adjustOrderedState(state, adjustment = (i) => i) { let currentActiveOption = state.activeOptionIndex !== null ? state.options[state.activeOptionIndex] : null; let sortedOptions = sortByDomNode( adjustment(state.options.slice()), (option) => option.dataRef.current.domRef.current ); let adjustedActiveOptionIndex = currentActiveOption ? sortedOptions.indexOf(currentActiveOption) : null; if (adjustedActiveOptionIndex === -1) { adjustedActiveOptionIndex = null; } return { options: sortedOptions, activeOptionIndex: adjustedActiveOptionIndex }; } var reducers = { [1 /* CloseCombobox */](state) { var _a3; if ((_a3 = state.dataRef.current) == null ? void 0 : _a3.disabled) return state; if (state.comboboxState === 1 /* Closed */) return state; return { ...state, activeOptionIndex: null, comboboxState: 1 /* Closed */ }; }, [0 /* OpenCombobox */](state) { var _a3; if ((_a3 = state.dataRef.current) == null ? void 0 : _a3.disabled) return state; if (state.comboboxState === 0 /* Open */) return state; let activeOptionIndex = state.activeOptionIndex; if (state.dataRef.current) { let { isSelected } = state.dataRef.current; let optionIdx = state.options.findIndex((option) => isSelected(option.dataRef.current.value)); if (optionIdx !== -1) { activeOptionIndex = optionIdx; } } return { ...state, comboboxState: 0 /* Open */, activeOptionIndex }; }, [2 /* GoToOption */](state, action) { var _a3, _b, _c, _d; if ((_a3 = state.dataRef.current) == null ? void 0 : _a3.disabled) return state; if (((_b = state.dataRef.current) == null ? void 0 : _b.optionsRef.current) && !((_c = state.dataRef.current) == null ? void 0 : _c.optionsPropsRef.current.static) && state.comboboxState === 1 /* Closed */) { return state; } let adjustedState = adjustOrderedState(state); if (adjustedState.activeOptionIndex === null) { let localActiveOptionIndex = adjustedState.options.findIndex( (option) => !option.dataRef.current.disabled ); if (localActiveOptionIndex !== -1) { adjustedState.activeOptionIndex = localActiveOptionIndex; } } let activeOptionIndex = calculateActiveIndex(action, { resolveItems: () => adjustedState.options, resolveActiveIndex: () => adjustedState.activeOptionIndex, resolveId: (item) => item.id, resolveDisabled: (item) => item.dataRef.current.disabled }); return { ...state, ...adjustedState, activeOptionIndex, activationTrigger: (_d = action.trigger) != null ? _d : 1 /* Other */ }; }, [3 /* RegisterOption */]: (state, action) => { var _a3, _b; let option = { id: action.id, dataRef: action.dataRef }; let adjustedState = adjustOrderedState(state, (options) => [...options, option]); if (state.activeOptionIndex === null) { if ((_a3 = state.dataRef.current) == null ? void 0 : _a3.isSelected(action.dataRef.current.value)) { adjustedState.activeOptionIndex = adjustedState.options.indexOf(option); } } let nextState = { ...state, ...adjustedState, activationTrigger: 1 /* Other */ }; if (((_b = state.dataRef.current) == null ? void 0 : _b.__demoMode) && state.dataRef.current.value === void 0) { nextState.activeOptionIndex = 0; } return nextState; }, [4 /* UnregisterOption */]: (state, action) => { let adjustedState = adjustOrderedState(state, (options) => { let idx = options.findIndex((a) => a.id === action.id); if (idx !== -1) options.splice(idx, 1); return options; }); return { ...state, ...adjustedState, activationTrigger: 1 /* Other */ }; }, [5 /* RegisterLabel */]: (state, action) => { return { ...state, labelId: action.id }; } }; var ComboboxActionsContext = (0, import_react19.createContext)(null); ComboboxActionsContext.displayName = "ComboboxActionsContext"; function useActions(component) { let context = (0, import_react19.useContext)(ComboboxActionsContext); if (context === null) { let err = new Error(`<${component} /> is missing a parent component.`); if (Error.captureStackTrace) Error.captureStackTrace(err, useActions); throw err; } return context; } var ComboboxDataContext = (0, import_react19.createContext)(null); ComboboxDataContext.displayName = "ComboboxDataContext"; function useData(component) { let context = (0, import_react19.useContext)(ComboboxDataContext); if (context === null) { let err = new Error(`<${component} /> is missing a parent component.`); if (Error.captureStackTrace) Error.captureStackTrace(err, useData); throw err; } return context; } function stateReducer(state, action) { return match(action.type, reducers, state, action); } var DEFAULT_COMBOBOX_TAG = import_react19.Fragment; function ComboboxFn(props, ref) { let { value: controlledValue, defaultValue, onChange: controlledOnChange, form: formName, name, by = (a, z) => a === z, disabled = false, __demoMode = false, nullable = false, multiple = false, ...theirProps } = props; let [value = multiple ? [] : void 0, theirOnChange] = useControllable( controlledValue, controlledOnChange, defaultValue ); let [state, dispatch] = (0, import_react19.useReducer)(stateReducer, { dataRef: (0, import_react19.createRef)(), comboboxState: __demoMode ? 0 /* Open */ : 1 /* Closed */, options: [], activeOptionIndex: null, activationTrigger: 1 /* Other */, labelId: null }); let defaultToFirstOption = (0, import_react19.useRef)(false); let optionsPropsRef = (0, import_react19.useRef)({ static: false, hold: false }); let labelRef = (0, import_react19.useRef)(null); let inputRef = (0, import_react19.useRef)(null); let buttonRef = (0, import_react19.useRef)(null); let optionsRef = (0, import_react19.useRef)(null); let compare = useEvent( // @ts-expect-error Eventually we'll want to tackle this, but for now this will do. typeof by === "string" ? (a, z) => { let property = by; return (a == null ? void 0 : a[property]) === (z == null ? void 0 : z[property]); } : by ); let isSelected = (0, import_react19.useCallback)( (compareValue) => match(data.mode, { [1 /* Multi */]: () => value.some((option) => compare(option, compareValue)), [0 /* Single */]: () => compare(value, compareValue) }), [value] ); let data = (0, import_react19.useMemo)( () => ({ ...state, optionsPropsRef, labelRef, inputRef, buttonRef, optionsRef, value, defaultValue, disabled, mode: multiple ? 1 /* Multi */ : 0 /* Single */, get activeOptionIndex() { if (defaultToFirstOption.current && state.activeOptionIndex === null && state.options.length > 0) { let localActiveOptionIndex = state.options.findIndex( (option) => !option.dataRef.current.disabled ); if (localActiveOptionIndex !== -1) { return localActiveOptionIndex; } } return state.activeOptionIndex; }, compare, isSelected, nullable, __demoMode }), [value, defaultValue, disabled, multiple, nullable, __demoMode, state] ); let lastActiveOption = (0, import_react19.useRef)( data.activeOptionIndex !== null ? data.options[data.activeOptionIndex] : null ); (0, import_react19.useEffect)(() => { let currentActiveOption = data.activeOptionIndex !== null ? data.options[data.activeOptionIndex] : null; if (lastActiveOption.current !== currentActiveOption) { lastActiveOption.current = currentActiveOption; } }); useIsoMorphicEffect(() => { state.dataRef.current = data; }, [data]); useOutsideClick( [data.buttonRef, data.inputRef, data.optionsRef], () => actions.closeCombobox(), data.comboboxState === 0 /* Open */ ); let slot = (0, import_react19.useMemo)( () => ({ open: data.comboboxState === 0 /* Open */, disabled, activeIndex: data.activeOptionIndex, activeOption: data.activeOptionIndex === null ? null : data.options[data.activeOptionIndex].dataRef.current.value, value }), [data, disabled, value] ); let selectOption = useEvent((id) => { let option = data.options.find((item) => item.id === id); if (!option) return; onChange(option.dataRef.current.value); }); let selectActiveOption = useEvent(() => { if (data.activeOptionIndex !== null) { let { dataRef, id } = data.options[data.activeOptionIndex]; onChange(dataRef.current.value); actions.goToOption(4 /* Specific */, id); } }); let openCombobox = useEvent(() => { dispatch({ type: 0 /* OpenCombobox */ }); defaultToFirstOption.current = true; }); let closeCombobox = useEvent(() => { dispatch({ type: 1 /* CloseCombobox */ }); defaultToFirstOption.current = false; }); let goToOption = useEvent((focus, id, trigger) => { defaultToFirstOption.current = false; if (focus === 4 /* Specific */) { return dispatch({ type: 2 /* GoToOption */, focus: 4 /* Specific */, id, trigger }); } return dispatch({ type: 2 /* GoToOption */, focus, trigger }); }); let registerOption = useEvent((id, dataRef) => { dispatch({ type: 3 /* RegisterOption */, id, dataRef }); return () => { var _a3; if (((_a3 = lastActiveOption.current) == null ? void 0 : _a3.id) === id) { defaultToFirstOption.current = true; } dispatch({ type: 4 /* UnregisterOption */, id }); }; }); let registerLabel = useEvent((id) => { dispatch({ type: 5 /* RegisterLabel */, id }); return () => dispatch({ type: 5 /* RegisterLabel */, id: null }); }); let onChange = useEvent((value2) => { return match(data.mode, { [0 /* Single */]() { return theirOnChange == null ? void 0 : theirOnChange(value2); }, [1 /* Multi */]() { let copy = data.value.slice(); let idx = copy.findIndex((item) => compare(item, value2)); if (idx === -1) { copy.push(value2); } else { copy.splice(idx, 1); } return theirOnChange == null ? void 0 : theirOnChange(copy); } }); }); let actions = (0, import_react19.useMemo)( () => ({ onChange, registerOption, registerLabel, goToOption, closeCombobox, openCombobox, selectActiveOption, selectOption }), [] ); let ourProps = ref === null ? {} : { ref }; let form = (0, import_react19.useRef)(null); let d = useDisposables(); (0, import_react19.useEffect)(() => { if (!form.current) return; if (defaultValue === void 0) return; d.addEventListener(form.current, "reset", () => { onChange(defaultValue); }); }, [ form, onChange /* Explicitly ignoring `defaultValue` */ ]); return /* @__PURE__ */ import_react19.default.createElement(ComboboxActionsContext.Provider, { value: actions }, /* @__PURE__ */ import_react19.default.createElement(ComboboxDataContext.Provider, { value: data }, /* @__PURE__ */ import_react19.default.createElement( OpenClosedProvider, { value: match(data.comboboxState, { [0 /* Open */]: 1 /* Open */, [1 /* Closed */]: 2 /* Closed */ }) }, name != null && value != null && objectToFormEntries({ [name]: value }).map(([name2, value2], idx) => /* @__PURE__ */ import_react19.default.createElement( Hidden, { features: 4 /* Hidden */, ref: idx === 0 ? (element) => { var _a3; form.current = (_a3 = element == null ? void 0 : element.closest("form")) != null ? _a3 : null; } : void 0, ...compact({ key: name2, as: "input", type: "hidden", hidden: true, readOnly: true, form: formName, name: name2, value: value2 }) } )), render({ ourProps, theirProps, slot, defaultTag: DEFAULT_COMBOBOX_TAG, name: "Combobox" }) ))); } var DEFAULT_INPUT_TAG = "input"; function InputFn(props, ref) { var _a3, _b, _c, _d; let internalId = useId(); let { id = `headlessui-combobox-input-${internalId}`, onChange, displayValue, // @ts-ignore: We know this MAY NOT exist for a given tag but we only care when it _does_ exist. type = "text", ...theirProps } = props; let data = useData("Combobox.Input"); let actions = useActions("Combobox.Input"); let inputRef = useSyncRefs(data.inputRef, ref); let isTyping = (0, import_react19.useRef)(false); let d = useDisposables(); let currentDisplayValue = function() { var _a4; if (typeof displayValue === "function" && data.value !== void 0) { return (_a4 = displayValue(data.value)) != null ? _a4 : ""; } else if (typeof data.value === "string") { return data.value; } else { return ""; } }(); useWatch( ([currentDisplayValue2, state], [oldCurrentDisplayValue, oldState]) => { if (isTyping.current) return; if (!data.inputRef.current) return; if (oldState === 0 /* Open */ && state === 1 /* Closed */) { data.inputRef.current.value = currentDisplayValue2; } else if (currentDisplayValue2 !== oldCurrentDisplayValue) { data.inputRef.current.value = currentDisplayValue2; } }, [currentDisplayValue, data.comboboxState] ); useWatch( ([newState], [oldState]) => { if (newState === 0 /* Open */ && oldState === 1 /* Closed */) { let input = data.inputRef.current; if (!input) return; let currentValue = input.value; let { selectionStart, selectionEnd, selectionDirection } = input; input.value = ""; input.value = currentValue; if (selectionDirection !== null) { input.setSelectionRange(selectionStart, selectionEnd, selectionDirection); } else { input.setSelectionRange(selectionStart, selectionEnd); } } }, [data.comboboxState] ); let isComposing = (0, import_react19.useRef)(false); let composedChangeEvent = (0, import_react19.useRef)(null); let handleCompositionStart = useEvent(() => { isComposing.current = true; }); let handleCompositionEnd = useEvent(() => { d.nextFrame(() => { isComposing.current = false; if (composedChangeEvent.current) { actions.openCombobox(); onChange == null ? void 0 : onChange(composedChangeEvent.current); composedChangeEvent.current = null; } }); }); let handleKeyDown = useEvent((event) => { isTyping.current = true; switch (event.key) { case "Backspace" /* Backspace */: case "Delete" /* Delete */: if (data.mode !== 0 /* Single */) return; if (!data.nullable) return; let input = event.currentTarget; d.requestAnimationFrame(() => { if (input.value === "") { actions.onChange(null); if (data.optionsRef.current) { data.optionsRef.current.scrollTop = 0; } actions.goToOption(5 /* Nothing */); } }); break; case "Enter" /* Enter */: isTyping.current = false; if (data.comboboxState !== 0 /* Open */) return; if (isComposing.current) return; event.preventDefault(); event.stopPropagation(); if (data.activeOptionIndex === null) { actions.closeCombobox(); return; } actions.selectActiveOption(); if (data.mode === 0 /* Single */) { actions.closeCombobox(); } break; case "ArrowDown" /* ArrowDown */: isTyping.current = false; event.preventDefault(); event.stopPropagation(); return match(data.comboboxState, { [0 /* Open */]: () => { actions.goToOption(2 /* Next */); }, [1 /* Closed */]: () => { actions.openCombobox(); } }); case "ArrowUp" /* ArrowUp */: isTyping.current = false; event.preventDefault(); event.stopPropagation(); return match(data.comboboxState, { [0 /* Open */]: () => { actions.goToOption(1 /* Previous */); }, [1 /* Closed */]: () => { actions.openCombobox(); d.nextFrame(() => { if (!data.value) { actions.goToOption(3 /* Last */); } }); } }); case "Home" /* Home */: if (event.shiftKey) { break; } isTyping.current = false; event.preventDefault(); event.stopPropagation(); return actions.goToOption(0 /* First */); case "PageUp" /* PageUp */: isTyping.current = false; event.preventDefault(); event.stopPropagation(); return actions.goToOption(0 /* First */); case "End" /* End */: if (event.shiftKey) { break; } isTyping.current = false; event.preventDefault(); event.stopPropagation(); return actions.goToOption(3 /* Last */); case "PageDown" /* PageDown */: isTyping.current = false; event.preventDefault(); event.stopPropagation(); return actions.goToOption(3 /* Last */); case "Escape" /* Escape */: isTyping.current = false; if (data.comboboxState !== 0 /* Open */) return; event.preventDefault(); if (data.optionsRef.current && !data.optionsPropsRef.current.static) { event.stopPropagation(); } return actions.closeCombobox(); case "Tab" /* Tab */: isTyping.current = false; if (data.comboboxState !== 0 /* Open */) return; if (data.mode === 0 /* Single */) actions.selectActiveOption(); actions.closeCombobox(); break; } }); let handleChange = useEvent((event) => { if (isComposing.current) { composedChangeEvent.current = event; return; } actions.openCombobox(); onChange == null ? void 0 : onChange(event); }); let handleBlur = useEvent(() => { isTyping.current = false; }); let labelledby = useComputed(() => { if (!data.labelId) return void 0; return [data.labelId].join(" "); }, [data.labelId]); let slot = (0, import_react19.useMemo)( () => ({ open: data.comboboxState === 0 /* Open */, disabled: data.disabled }), [data] ); let ourProps = { ref: inputRef, id, role: "combobox", type, "aria-controls": (_a3 = data.optionsRef.current) == null ? void 0 : _a3.id, "aria-expanded": data.disabled ? void 0 : data.comboboxState === 0 /* Open */, "aria-activedescendant": data.activeOptionIndex === null ? void 0 : (_b = data.options[data.activeOptionIndex]) == null ? void 0 : _b.id, "aria-labelledby": labelledby, "aria-autocomplete": "list", defaultValue: (_d = (_c = props.defaultValue) != null ? _c : data.defaultValue !== void 0 ? displayValue == null ? void 0 : displayValue(data.defaultValue) : null) != null ? _d : data.defaultValue, disabled: data.disabled, onCompositionStart: handleCompositionStart, onCompositionEnd: handleCompositionEnd, onKeyDown: handleKeyDown, onChange: handleChange, onBlur: handleBlur }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_INPUT_TAG, name: "Combobox.Input" }); } var DEFAULT_BUTTON_TAG = "button"; function ButtonFn(props, ref) { var _a3; let data = useData("Combobox.Button"); let actions = useActions("Combobox.Button"); let buttonRef = useSyncRefs(data.buttonRef, ref); let internalId = useId(); let { id = `headlessui-combobox-button-${internalId}`, ...theirProps } = props; let d = useDisposables(); let handleKeyDown = useEvent((event) => { switch (event.key) { case "ArrowDown" /* ArrowDown */: event.preventDefault(); event.stopPropagation(); if (data.comboboxState === 1 /* Closed */) { actions.openCombobox(); } return d.nextFrame(() => { var _a4; return (_a4 = data.inputRef.current) == null ? void 0 : _a4.focus({ preventScroll: true }); }); case "ArrowUp" /* ArrowUp */: event.preventDefault(); event.stopPropagation(); if (data.comboboxState === 1 /* Closed */) { actions.openCombobox(); d.nextFrame(() => { if (!data.value) { actions.goToOption(3 /* Last */); } }); } return d.nextFrame(() => { var _a4; return (_a4 = data.inputRef.current) == null ? void 0 : _a4.focus({ preventScroll: true }); }); case "Escape" /* Escape */: if (data.comboboxState !== 0 /* Open */) return; event.preventDefault(); if (data.optionsRef.current && !data.optionsPropsRef.current.static) { event.stopPropagation(); } actions.closeCombobox(); return d.nextFrame(() => { var _a4; return (_a4 = data.inputRef.current) == null ? void 0 : _a4.focus({ preventScroll: true }); }); default: return; } }); let handleClick = useEvent((event) => { if (isDisabledReactIssue7711(event.currentTarget)) return event.preventDefault(); if (data.comboboxState === 0 /* Open */) { actions.closeCombobox(); } else { event.preventDefault(); actions.openCombobox(); } d.nextFrame(() => { var _a4; return (_a4 = data.inputRef.current) == null ? void 0 : _a4.focus({ preventScroll: true }); }); }); let labelledby = useComputed(() => { if (!data.labelId) return void 0; return [data.labelId, id].join(" "); }, [data.labelId, id]); let slot = (0, import_react19.useMemo)( () => ({ open: data.comboboxState === 0 /* Open */, disabled: data.disabled, value: data.value }), [data] ); let ourProps = { ref: buttonRef, id, type: useResolveButtonType(props, data.buttonRef), tabIndex: -1, "aria-haspopup": "listbox", "aria-controls": (_a3 = data.optionsRef.current) == null ? void 0 : _a3.id, "aria-expanded": data.disabled ? void 0 : data.comboboxState === 0 /* Open */, "aria-labelledby": labelledby, disabled: data.disabled, onClick: handleClick, onKeyDown: handleKeyDown }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_BUTTON_TAG, name: "Combobox.Button" }); } var DEFAULT_LABEL_TAG = "label"; function LabelFn(props, ref) { let internalId = useId(); let { id = `headlessui-combobox-label-${internalId}`, ...theirProps } = props; let data = useData("Combobox.Label"); let actions = useActions("Combobox.Label"); let labelRef = useSyncRefs(data.labelRef, ref); useIsoMorphicEffect(() => actions.registerLabel(id), [id]); let handleClick = useEvent(() => { var _a3; return (_a3 = data.inputRef.current) == null ? void 0 : _a3.focus({ preventScroll: true }); }); let slot = (0, import_react19.useMemo)( () => ({ open: data.comboboxState === 0 /* Open */, disabled: data.disabled }), [data] ); let ourProps = { ref: labelRef, id, onClick: handleClick }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_LABEL_TAG, name: "Combobox.Label" }); } var DEFAULT_OPTIONS_TAG = "ul"; var OptionsRenderFeatures = 1 /* RenderStrategy */ | 2 /* Static */; function OptionsFn(props, ref) { let internalId = useId(); let { id = `headlessui-combobox-options-${internalId}`, hold = false, ...theirProps } = props; let data = useData("Combobox.Options"); let optionsRef = useSyncRefs(data.optionsRef, ref); let usesOpenClosedState = useOpenClosed(); let visible = (() => { if (usesOpenClosedState !== null) { return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */; } return data.comboboxState === 0 /* Open */; })(); useIsoMorphicEffect(() => { var _a3; data.optionsPropsRef.current.static = (_a3 = props.static) != null ? _a3 : false; }, [data.optionsPropsRef, props.static]); useIsoMorphicEffect(() => { data.optionsPropsRef.current.hold = hold; }, [data.optionsPropsRef, hold]); useTreeWalker({ container: data.optionsRef.current, enabled: data.comboboxState === 0 /* Open */, accept(node) { if (node.getAttribute("role") === "option") return NodeFilter.FILTER_REJECT; if (node.hasAttribute("role")) return NodeFilter.FILTER_SKIP; return NodeFilter.FILTER_ACCEPT; }, walk(node) { node.setAttribute("role", "none"); } }); let labelledby = useComputed( () => { var _a3, _b; return (_b = data.labelId) != null ? _b : (_a3 = data.buttonRef.current) == null ? void 0 : _a3.id; }, [data.labelId, data.buttonRef.current] ); let slot = (0, import_react19.useMemo)( () => ({ open: data.comboboxState === 0 /* Open */ }), [data] ); let ourProps = { "aria-labelledby": labelledby, role: "listbox", "aria-multiselectable": data.mode === 1 /* Multi */ ? true : void 0, id, ref: optionsRef }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_OPTIONS_TAG, features: OptionsRenderFeatures, visible, name: "Combobox.Options" }); } var DEFAULT_OPTION_TAG = "li"; function OptionFn(props, ref) { var _a3, _b; let internalId = useId(); let { id = `headlessui-combobox-option-${internalId}`, disabled = false, value, ...theirProps } = props; let data = useData("Combobox.Option"); let actions = useActions("Combobox.Option"); let active = data.activeOptionIndex !== null ? data.options[data.activeOptionIndex].id === id : false; let selected = data.isSelected(value); let internalOptionRef = (0, import_react19.useRef)(null); let bag = useLatestValue({ disabled, value, domRef: internalOptionRef, textValue: (_b = (_a3 = internalOptionRef.current) == null ? void 0 : _a3.textContent) == null ? void 0 : _b.toLowerCase() }); let optionRef = useSyncRefs(ref, internalOptionRef); let select = useEvent(() => actions.selectOption(id)); useIsoMorphicEffect(() => actions.registerOption(id, bag), [bag, id]); let enableScrollIntoView = (0, import_react19.useRef)(data.__demoMode ? false : true); useIsoMorphicEffect(() => { if (!data.__demoMode) return; let d = disposables(); d.requestAnimationFrame(() => { enableScrollIntoView.current = true; }); return d.dispose; }, []); useIsoMorphicEffect(() => { if (data.comboboxState !== 0 /* Open */) return; if (!active) return; if (!enableScrollIntoView.current) return; if (data.activationTrigger === 0 /* Pointer */) return; let d = disposables(); d.requestAnimationFrame(() => { var _a4, _b2; (_b2 = (_a4 = internalOptionRef.current) == null ? void 0 : _a4.scrollIntoView) == null ? void 0 : _b2.call(_a4, { block: "nearest" }); }); return d.dispose; }, [ internalOptionRef, active, data.comboboxState, data.activationTrigger, /* We also want to trigger this when the position of the active item changes so that we can re-trigger the scrollIntoView */ data.activeOptionIndex ]); let handleClick = useEvent((event) => { if (disabled) return event.preventDefault(); select(); if (data.mode === 0 /* Single */) { actions.closeCombobox(); } if (!isMobile()) { requestAnimationFrame(() => { var _a4; return (_a4 = data.inputRef.current) == null ? void 0 : _a4.focus(); }); } }); let handleFocus = useEvent(() => { if (disabled) return actions.goToOption(5 /* Nothing */); actions.goToOption(4 /* Specific */, id); }); let pointer = useTrackedPointer(); let handleEnter = useEvent((evt) => pointer.update(evt)); let handleMove = useEvent((evt) => { if (!pointer.wasMoved(evt)) return; if (disabled) return; if (active) return; actions.goToOption(4 /* Specific */, id, 0 /* Pointer */); }); let handleLeave = useEvent((evt) => { if (!pointer.wasMoved(evt)) return; if (disabled) return; if (!active) return; if (data.optionsPropsRef.current.hold) return; actions.goToOption(5 /* Nothing */); }); let slot = (0, import_react19.useMemo)( () => ({ active, selected, disabled }), [active, selected, disabled] ); let ourProps = { id, ref: optionRef, role: "option", tabIndex: disabled === true ? void 0 : -1, "aria-disabled": disabled === true ? true : void 0, // According to the WAI-ARIA best practices, we should use aria-checked for // multi-select,but Voice-Over disagrees. So we use aria-checked instead for // both single and multi-select. "aria-selected": selected, disabled: void 0, // Never forward the `disabled` prop onClick: handleClick, onFocus: handleFocus, onPointerEnter: handleEnter, onMouseEnter: handleEnter, onPointerMove: handleMove, onMouseMove: handleMove, onPointerLeave: handleLeave, onMouseLeave: handleLeave }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_OPTION_TAG, name: "Combobox.Option" }); } var ComboboxRoot = forwardRefWithAs(ComboboxFn); var Button = forwardRefWithAs(ButtonFn); var Input = forwardRefWithAs(InputFn); var Label = forwardRefWithAs(LabelFn); var Options = forwardRefWithAs(OptionsFn); var Option = forwardRefWithAs(OptionFn); var Combobox = Object.assign(ComboboxRoot, { Input, Button, Label, Options, Option }); // src/components/dialog/dialog.tsx var import_react31 = __toESM(__webpack_require__(/*! react */ "react"), 1); // src/components/focus-trap/focus-trap.tsx var import_react25 = __toESM(__webpack_require__(/*! react */ "react"), 1); // src/hooks/use-tab-direction.ts var import_react20 = __webpack_require__(/*! react */ "react"); function useTabDirection() { let direction = (0, import_react20.useRef)(0 /* Forwards */); useWindowEvent( "keydown", (event) => { if (event.key === "Tab") { direction.current = event.shiftKey ? 1 /* Backwards */ : 0 /* Forwards */; } }, true ); return direction; } // src/hooks/use-is-mounted.ts var import_react21 = __webpack_require__(/*! react */ "react"); function useIsMounted() { let mounted = (0, import_react21.useRef)(false); useIsoMorphicEffect(() => { mounted.current = true; return () => { mounted.current = false; }; }, []); return mounted; } // src/hooks/use-owner.ts var import_react22 = __webpack_require__(/*! react */ "react"); function useOwnerDocument(...args) { return (0, import_react22.useMemo)(() => getOwnerDocument(...args), [...args]); } // src/hooks/use-event-listener.ts var import_react23 = __webpack_require__(/*! react */ "react"); function useEventListener(element, type, listener, options) { let listenerRef = useLatestValue(listener); (0, import_react23.useEffect)(() => { element = element != null ? element : window; function handler(event) { listenerRef.current(event); } element.addEventListener(type, handler, options); return () => element.removeEventListener(type, handler, options); }, [element, type, options]); } // src/utils/document-ready.ts function onDocumentReady(cb) { function check() { if (document.readyState === "loading") return; cb(); document.removeEventListener("DOMContentLoaded", check); } if (typeof window !== "undefined" && typeof document !== "undefined") { document.addEventListener("DOMContentLoaded", check); check(); } } // src/hooks/use-on-unmount.ts var import_react24 = __webpack_require__(/*! react */ "react"); function useOnUnmount(cb) { let stableCb = useEvent(cb); let trulyUnmounted = (0, import_react24.useRef)(false); (0, import_react24.useEffect)(() => { trulyUnmounted.current = false; return () => { trulyUnmounted.current = true; microTask(() => { if (!trulyUnmounted.current) return; stableCb(); }); }; }, [stableCb]); } // src/components/focus-trap/focus-trap.tsx function resolveContainers(containers) { if (!containers) return /* @__PURE__ */ new Set(); if (typeof containers === "function") return new Set(containers()); let all = /* @__PURE__ */ new Set(); for (let container of containers.current) { if (container.current instanceof HTMLElement) { all.add(container.current); } } return all; } var DEFAULT_FOCUS_TRAP_TAG = "div"; var Features3 = /* @__PURE__ */ ((Features4) => { Features4[Features4["None"] = 1] = "None"; Features4[Features4["InitialFocus"] = 2] = "InitialFocus"; Features4[Features4["TabLock"] = 4] = "TabLock"; Features4[Features4["FocusLock"] = 8] = "FocusLock"; Features4[Features4["RestoreFocus"] = 16] = "RestoreFocus"; Features4[Features4["All"] = 30] = "All"; return Features4; })(Features3 || {}); function FocusTrapFn(props, ref) { let container = (0, import_react25.useRef)(null); let focusTrapRef = useSyncRefs(container, ref); let { initialFocus, containers, features = 30 /* All */, ...theirProps } = props; if (!useServerHandoffComplete()) { features = 1 /* None */; } let ownerDocument = useOwnerDocument(container); useRestoreFocus({ ownerDocument }, Boolean(features & 16 /* RestoreFocus */)); let previousActiveElement = useInitialFocus( { ownerDocument, container, initialFocus }, Boolean(features & 2 /* InitialFocus */) ); useFocusLock( { ownerDocument, container, containers, previousActiveElement }, Boolean(features & 8 /* FocusLock */) ); let direction = useTabDirection(); let handleFocus = useEvent((e) => { let el = container.current; if (!el) return; let wrapper = false ? 0 : (cb) => cb(); wrapper(() => { match(direction.current, { [0 /* Forwards */]: () => { focusIn(el, 1 /* First */, { skipElements: [e.relatedTarget] }); }, [1 /* Backwards */]: () => { focusIn(el, 8 /* Last */, { skipElements: [e.relatedTarget] }); } }); }); }); let d = useDisposables(); let recentlyUsedTabKey = (0, import_react25.useRef)(false); let ourProps = { ref: focusTrapRef, onKeyDown(e) { if (e.key == "Tab") { recentlyUsedTabKey.current = true; d.requestAnimationFrame(() => { recentlyUsedTabKey.current = false; }); } }, onBlur(e) { let allContainers = resolveContainers(containers); if (container.current instanceof HTMLElement) allContainers.add(container.current); let relatedTarget = e.relatedTarget; if (!(relatedTarget instanceof HTMLElement)) return; if (relatedTarget.dataset.headlessuiFocusGuard === "true") { return; } if (!contains(allContainers, relatedTarget)) { if (recentlyUsedTabKey.current) { focusIn( container.current, match(direction.current, { [0 /* Forwards */]: () => 4 /* Next */, [1 /* Backwards */]: () => 2 /* Previous */ }) | 16 /* WrapAround */, { relativeTo: e.target } ); } else if (e.target instanceof HTMLElement) { focusElement(e.target); } } } }; return /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, Boolean(features & 4 /* TabLock */) && /* @__PURE__ */ import_react25.default.createElement( Hidden, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: handleFocus, features: 2 /* Focusable */ } ), render({ ourProps, theirProps, defaultTag: DEFAULT_FOCUS_TRAP_TAG, name: "FocusTrap" }), Boolean(features & 4 /* TabLock */) && /* @__PURE__ */ import_react25.default.createElement( Hidden, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: handleFocus, features: 2 /* Focusable */ } )); } var FocusTrapRoot = forwardRefWithAs(FocusTrapFn); var FocusTrap = Object.assign(FocusTrapRoot, { features: Features3 }); var history = []; onDocumentReady(() => { function handle(e) { if (!(e.target instanceof HTMLElement)) return; if (e.target === document.body) return; if (history[0] === e.target) return; history.unshift(e.target); history = history.filter((x) => x != null && x.isConnected); history.splice(10); } window.addEventListener("click", handle, { capture: true }); window.addEventListener("mousedown", handle, { capture: true }); window.addEventListener("focus", handle, { capture: true }); document.body.addEventListener("click", handle, { capture: true }); document.body.addEventListener("mousedown", handle, { capture: true }); document.body.addEventListener("focus", handle, { capture: true }); }); function useRestoreElement(enabled = true) { let localHistory = (0, import_react25.useRef)(history.slice()); useWatch( ([newEnabled], [oldEnabled]) => { if (oldEnabled === true && newEnabled === false) { microTask(() => { localHistory.current.splice(0); }); } if (oldEnabled === false && newEnabled === true) { localHistory.current = history.slice(); } }, [enabled, history, localHistory] ); return useEvent(() => { var _a3; return (_a3 = localHistory.current.find((x) => x != null && x.isConnected)) != null ? _a3 : null; }); } function useRestoreFocus({ ownerDocument }, enabled) { let getRestoreElement = useRestoreElement(enabled); useWatch(() => { if (enabled) return; if ((ownerDocument == null ? void 0 : ownerDocument.activeElement) === (ownerDocument == null ? void 0 : ownerDocument.body)) { focusElement(getRestoreElement()); } }, [enabled]); useOnUnmount(() => { if (!enabled) return; focusElement(getRestoreElement()); }); } function useInitialFocus({ ownerDocument, container, initialFocus }, enabled) { let previousActiveElement = (0, import_react25.useRef)(null); let mounted = useIsMounted(); useWatch(() => { if (!enabled) return; let containerElement = container.current; if (!containerElement) return; microTask(() => { if (!mounted.current) { return; } let activeElement = ownerDocument == null ? void 0 : ownerDocument.activeElement; if (initialFocus == null ? void 0 : initialFocus.current) { if ((initialFocus == null ? void 0 : initialFocus.current) === activeElement) { previousActiveElement.current = activeElement; return; } } else if (containerElement.contains(activeElement)) { previousActiveElement.current = activeElement; return; } if (initialFocus == null ? void 0 : initialFocus.current) { focusElement(initialFocus.current); } else { if (focusIn(containerElement, 1 /* First */) === 0 /* Error */) { console.warn("There are no focusable elements inside the "); } } previousActiveElement.current = ownerDocument == null ? void 0 : ownerDocument.activeElement; }); }, [enabled]); return previousActiveElement; } function useFocusLock({ ownerDocument, container, containers, previousActiveElement }, enabled) { let mounted = useIsMounted(); useEventListener( ownerDocument == null ? void 0 : ownerDocument.defaultView, "focus", (event) => { if (!enabled) return; if (!mounted.current) return; let allContainers = resolveContainers(containers); if (container.current instanceof HTMLElement) allContainers.add(container.current); let previous = previousActiveElement.current; if (!previous) return; let toElement = event.target; if (toElement && toElement instanceof HTMLElement) { if (!contains(allContainers, toElement)) { event.preventDefault(); event.stopPropagation(); focusElement(previous); } else { previousActiveElement.current = toElement; focusElement(toElement); } } else { focusElement(previousActiveElement.current); } }, true ); } function contains(containers, element) { for (let container of containers) { if (container.contains(element)) return true; } return false; } // src/components/portal/portal.tsx var import_react27 = __toESM(__webpack_require__(/*! react */ "react"), 1); var import_react_dom = __webpack_require__(/*! react-dom */ "react-dom"); // src/internal/portal-force-root.tsx var import_react26 = __toESM(__webpack_require__(/*! react */ "react"), 1); var ForcePortalRootContext = (0, import_react26.createContext)(false); function usePortalRoot() { return (0, import_react26.useContext)(ForcePortalRootContext); } function ForcePortalRoot(props) { return /* @__PURE__ */ import_react26.default.createElement(ForcePortalRootContext.Provider, { value: props.force }, props.children); } // src/components/portal/portal.tsx function usePortalTarget(ref) { let forceInRoot = usePortalRoot(); let groupTarget = (0, import_react27.useContext)(PortalGroupContext); let ownerDocument = useOwnerDocument(ref); let [target, setTarget] = (0, import_react27.useState)(() => { if (!forceInRoot && groupTarget !== null) return null; if (env.isServer) return null; let existingRoot = ownerDocument == null ? void 0 : ownerDocument.getElementById("headlessui-portal-root"); if (existingRoot) return existingRoot; if (ownerDocument === null) return null; let root = ownerDocument.createElement("div"); root.setAttribute("id", "headlessui-portal-root"); return ownerDocument.body.appendChild(root); }); (0, import_react27.useEffect)(() => { if (target === null) return; if (!(ownerDocument == null ? void 0 : ownerDocument.body.contains(target))) { ownerDocument == null ? void 0 : ownerDocument.body.appendChild(target); } }, [target, ownerDocument]); (0, import_react27.useEffect)(() => { if (forceInRoot) return; if (groupTarget === null) return; setTarget(groupTarget.current); }, [groupTarget, setTarget, forceInRoot]); return target; } var DEFAULT_PORTAL_TAG = import_react27.Fragment; function PortalFn(props, ref) { let theirProps = props; let internalPortalRootRef = (0, import_react27.useRef)(null); let portalRef = useSyncRefs( optionalRef((ref2) => { internalPortalRootRef.current = ref2; }), ref ); let ownerDocument = useOwnerDocument(internalPortalRootRef); let target = usePortalTarget(internalPortalRootRef); let [element] = (0, import_react27.useState)( () => { var _a3; return env.isServer ? null : (_a3 = ownerDocument == null ? void 0 : ownerDocument.createElement("div")) != null ? _a3 : null; } ); let parent = (0, import_react27.useContext)(PortalParentContext); let ready = useServerHandoffComplete(); useIsoMorphicEffect(() => { if (!target || !element) return; if (!target.contains(element)) { element.setAttribute("data-headlessui-portal", ""); target.appendChild(element); } }, [target, element]); useIsoMorphicEffect(() => { if (!element) return; if (!parent) return; return parent.register(element); }, [parent, element]); useOnUnmount(() => { var _a3; if (!target || !element) return; if (element instanceof Node && target.contains(element)) { target.removeChild(element); } if (target.childNodes.length <= 0) { (_a3 = target.parentElement) == null ? void 0 : _a3.removeChild(target); } }); if (!ready) return null; let ourProps = { ref: portalRef }; return !target || !element ? null : (0, import_react_dom.createPortal)( render({ ourProps, theirProps, defaultTag: DEFAULT_PORTAL_TAG, name: "Portal" }), element ); } var DEFAULT_GROUP_TAG = import_react27.Fragment; var PortalGroupContext = (0, import_react27.createContext)(null); function GroupFn(props, ref) { let { target, ...theirProps } = props; let groupRef = useSyncRefs(ref); let ourProps = { ref: groupRef }; return /* @__PURE__ */ import_react27.default.createElement(PortalGroupContext.Provider, { value: target }, render({ ourProps, theirProps, defaultTag: DEFAULT_GROUP_TAG, name: "Popover.Group" })); } var PortalParentContext = (0, import_react27.createContext)(null); function useNestedPortals() { let parent = (0, import_react27.useContext)(PortalParentContext); let portals = (0, import_react27.useRef)([]); let register = useEvent((portal) => { portals.current.push(portal); if (parent) parent.register(portal); return () => unregister(portal); }); let unregister = useEvent((portal) => { let idx = portals.current.indexOf(portal); if (idx !== -1) portals.current.splice(idx, 1); if (parent) parent.unregister(portal); }); let api = (0, import_react27.useMemo)( () => ({ register, unregister, portals }), [register, unregister, portals] ); return [ portals, (0, import_react27.useMemo)(() => { return function PortalWrapper({ children }) { return /* @__PURE__ */ import_react27.default.createElement(PortalParentContext.Provider, { value: api }, children); }; }, [api]) ]; } var PortalRoot = forwardRefWithAs(PortalFn); var Group = forwardRefWithAs(GroupFn); var Portal = Object.assign(PortalRoot, { Group }); // src/components/description/description.tsx var import_react28 = __toESM(__webpack_require__(/*! react */ "react"), 1); var DescriptionContext = (0, import_react28.createContext)(null); function useDescriptionContext() { let context = (0, import_react28.useContext)(DescriptionContext); if (context === null) { let err = new Error( "You used a component, but it is not inside a relevant parent." ); if (Error.captureStackTrace) Error.captureStackTrace(err, useDescriptionContext); throw err; } return context; } function useDescriptions() { let [descriptionIds, setDescriptionIds] = (0, import_react28.useState)([]); return [ // The actual id's as string or undefined descriptionIds.length > 0 ? descriptionIds.join(" ") : void 0, // The provider component (0, import_react28.useMemo)(() => { return function DescriptionProvider(props) { let register = useEvent((value) => { setDescriptionIds((existing) => [...existing, value]); return () => setDescriptionIds((existing) => { let clone = existing.slice(); let idx = clone.indexOf(value); if (idx !== -1) clone.splice(idx, 1); return clone; }); }); let contextBag = (0, import_react28.useMemo)( () => ({ register, slot: props.slot, name: props.name, props: props.props }), [register, props.slot, props.name, props.props] ); return /* @__PURE__ */ import_react28.default.createElement(DescriptionContext.Provider, { value: contextBag }, props.children); }; }, [setDescriptionIds]) ]; } var DEFAULT_DESCRIPTION_TAG = "p"; function DescriptionFn(props, ref) { let internalId = useId(); let { id = `headlessui-description-${internalId}`, ...theirProps } = props; let context = useDescriptionContext(); let descriptionRef = useSyncRefs(ref); useIsoMorphicEffect(() => context.register(id), [id, context.register]); let ourProps = { ref: descriptionRef, ...context.props, id }; return render({ ourProps, theirProps, slot: context.slot || {}, defaultTag: DEFAULT_DESCRIPTION_TAG, name: context.name || "Description" }); } var DescriptionRoot = forwardRefWithAs(DescriptionFn); var Description = Object.assign(DescriptionRoot, { // }); // src/internal/stack-context.tsx var import_react29 = __toESM(__webpack_require__(/*! react */ "react"), 1); var StackContext = (0, import_react29.createContext)(() => { }); StackContext.displayName = "StackContext"; function useStackContext() { return (0, import_react29.useContext)(StackContext); } function StackProvider({ children, onUpdate, type, element, enabled }) { let parentUpdate = useStackContext(); let notify = useEvent((...args) => { onUpdate == null ? void 0 : onUpdate(...args); parentUpdate(...args); }); useIsoMorphicEffect(() => { let shouldNotify = enabled === void 0 || enabled === true; shouldNotify && notify(0 /* Add */, type, element); return () => { shouldNotify && notify(1 /* Remove */, type, element); }; }, [notify, type, element, enabled]); return /* @__PURE__ */ import_react29.default.createElement(StackContext.Provider, { value: notify }, children); } // src/use-sync-external-store-shim/index.ts var React11 = __toESM(__webpack_require__(/*! react */ "react"), 1); // src/use-sync-external-store-shim/useSyncExternalStoreShimClient.ts var React10 = __toESM(__webpack_require__(/*! react */ "react"), 1); function isPolyfill(x, y) { return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y; } var is = typeof Object.is === "function" ? Object.is : isPolyfill; var { useState: useState8, useEffect: useEffect14, useLayoutEffect: useLayoutEffect2, useDebugValue } = React10; var didWarnOld18Alpha = false; var didWarnUncachedGetSnapshot = false; function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { if (true) { if (!didWarnOld18Alpha) { if ("startTransition" in React10) { didWarnOld18Alpha = true; console.error( "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release." ); } } } const value = getSnapshot(); if (true) { if (!didWarnUncachedGetSnapshot) { const cachedValue = getSnapshot(); if (!is(value, cachedValue)) { console.error("The result of getSnapshot should be cached to avoid an infinite loop"); didWarnUncachedGetSnapshot = true; } } } const [{ inst }, forceUpdate] = useState8({ inst: { value, getSnapshot } }); useLayoutEffect2(() => { inst.value = value; inst.getSnapshot = getSnapshot; if (checkIfSnapshotChanged(inst)) { forceUpdate({ inst }); } }, [subscribe, value, getSnapshot]); useEffect14(() => { if (checkIfSnapshotChanged(inst)) { forceUpdate({ inst }); } const handleStoreChange = () => { if (checkIfSnapshotChanged(inst)) { forceUpdate({ inst }); } }; return subscribe(handleStoreChange); }, [subscribe]); useDebugValue(value); return value; } function checkIfSnapshotChanged(inst) { const latestGetSnapshot = inst.getSnapshot; const prevValue = inst.value; try { const nextValue = latestGetSnapshot(); return !is(prevValue, nextValue); } catch (error) { return true; } } // src/use-sync-external-store-shim/useSyncExternalStoreShimServer.ts function useSyncExternalStore2(subscribe, getSnapshot, getServerSnapshot) { return getSnapshot(); } // src/use-sync-external-store-shim/index.ts var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"); var isServerEnvironment = !canUseDOM; var shim = isServerEnvironment ? useSyncExternalStore2 : useSyncExternalStore; var useSyncExternalStore3 = "useSyncExternalStore" in React11 ? ((r) => r.useSyncExternalStore)(React11) : shim; // src/hooks/use-store.ts function useStore(store) { return useSyncExternalStore3(store.subscribe, store.getSnapshot, store.getSnapshot); } // src/utils/store.ts function createStore(initial, actions) { let state = initial(); let listeners = /* @__PURE__ */ new Set(); return { getSnapshot() { return state; }, subscribe(onChange) { listeners.add(onChange); return () => listeners.delete(onChange); }, dispatch(key, ...args) { let newState = actions[key].call(state, ...args); if (newState) { state = newState; listeners.forEach((listener) => listener()); } } }; } // src/hooks/document-overflow/adjust-scrollbar-padding.ts function adjustScrollbarPadding() { let scrollbarWidthBefore; return { before({ doc }) { var _a3; let documentElement = doc.documentElement; let ownerWindow = (_a3 = doc.defaultView) != null ? _a3 : window; scrollbarWidthBefore = ownerWindow.innerWidth - documentElement.clientWidth; }, after({ doc, d }) { let documentElement = doc.documentElement; let scrollbarWidthAfter = documentElement.clientWidth - documentElement.offsetWidth; let scrollbarWidth = scrollbarWidthBefore - scrollbarWidthAfter; d.style(documentElement, "paddingRight", `${scrollbarWidth}px`); } }; } // src/hooks/document-overflow/handle-ios-locking.ts function handleIOSLocking() { if (!isIOS()) { return {}; } let scrollPosition; return { before() { scrollPosition = window.pageYOffset; }, after({ doc, d, meta }) { function inAllowedContainer(el) { return meta.containers.flatMap((resolve) => resolve()).some((container) => container.contains(el)); } d.style(doc.body, "marginTop", `-${scrollPosition}px`); window.scrollTo(0, 0); let scrollToElement = null; d.addEventListener( doc, "click", (e) => { if (!(e.target instanceof HTMLElement)) { return; } try { let anchor = e.target.closest("a"); if (!anchor) return; let { hash } = new URL(anchor.href); let el = doc.querySelector(hash); if (el && !inAllowedContainer(el)) { scrollToElement = el; } } catch (err) { } }, true ); d.addEventListener( doc, "touchmove", (e) => { if (e.target instanceof HTMLElement && !inAllowedContainer(e.target)) { e.preventDefault(); } }, { passive: false } ); d.add(() => { window.scrollTo(0, window.pageYOffset + scrollPosition); if (scrollToElement && scrollToElement.isConnected) { scrollToElement.scrollIntoView({ block: "nearest" }); scrollToElement = null; } }); } }; } // src/hooks/document-overflow/prevent-scroll.ts function preventScroll() { return { before({ doc, d }) { d.style(doc.documentElement, "overflow", "hidden"); } }; } // src/hooks/document-overflow/overflow-store.ts function buildMeta(fns) { let tmp = {}; for (let fn of fns) { Object.assign(tmp, fn(tmp)); } return tmp; } var overflows = createStore(() => /* @__PURE__ */ new Map(), { PUSH(doc, meta) { var _a3; let entry = (_a3 = this.get(doc)) != null ? _a3 : { doc, count: 0, d: disposables(), meta: /* @__PURE__ */ new Set() }; entry.count++; entry.meta.add(meta); this.set(doc, entry); return this; }, POP(doc, meta) { let entry = this.get(doc); if (entry) { entry.count--; entry.meta.delete(meta); } return this; }, SCROLL_PREVENT({ doc, d, meta }) { let ctx = { doc, d, meta: buildMeta(meta) }; let steps = [ handleIOSLocking(), adjustScrollbarPadding(), preventScroll() ]; steps.forEach(({ before }) => before == null ? void 0 : before(ctx)); steps.forEach(({ after }) => after == null ? void 0 : after(ctx)); }, SCROLL_ALLOW({ d }) { d.dispose(); }, TEARDOWN({ doc }) { this.delete(doc); } }); overflows.subscribe(() => { let docs = overflows.getSnapshot(); let styles = /* @__PURE__ */ new Map(); for (let [doc] of docs) { styles.set(doc, doc.documentElement.style.overflow); } for (let entry of docs.values()) { let isHidden = styles.get(entry.doc) === "hidden"; let isLocked = entry.count !== 0; let willChange = isLocked && !isHidden || !isLocked && isHidden; if (willChange) { overflows.dispatch(entry.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", entry); } if (entry.count === 0) { overflows.dispatch("TEARDOWN", entry); } } }); // src/hooks/document-overflow/use-document-overflow.ts function useDocumentOverflowLockedEffect(doc, shouldBeLocked, meta) { let store = useStore(overflows); let entry = doc ? store.get(doc) : void 0; let locked = entry ? entry.count > 0 : false; useIsoMorphicEffect(() => { if (!doc || !shouldBeLocked) { return; } overflows.dispatch("PUSH", doc, meta); return () => overflows.dispatch("POP", doc, meta); }, [shouldBeLocked, doc]); return locked; } // src/hooks/use-inert.tsx var originals = /* @__PURE__ */ new Map(); var counts = /* @__PURE__ */ new Map(); function useInert(node, enabled = true) { useIsoMorphicEffect(() => { var _a3; if (!enabled) return; let element = typeof node === "function" ? node() : node.current; if (!element) return; function cleanup() { var _a4; if (!element) return; let count2 = (_a4 = counts.get(element)) != null ? _a4 : 1; if (count2 === 1) counts.delete(element); else counts.set(element, count2 - 1); if (count2 !== 1) return; let original = originals.get(element); if (!original) return; if (original["aria-hidden"] === null) element.removeAttribute("aria-hidden"); else element.setAttribute("aria-hidden", original["aria-hidden"]); element.inert = original.inert; originals.delete(element); } let count = (_a3 = counts.get(element)) != null ? _a3 : 0; counts.set(element, count + 1); if (count !== 0) return cleanup; originals.set(element, { "aria-hidden": element.getAttribute("aria-hidden"), inert: element.inert }); element.setAttribute("aria-hidden", "true"); element.inert = true; return cleanup; }, [node, enabled]); } // src/hooks/use-root-containers.tsx var import_react30 = __toESM(__webpack_require__(/*! react */ "react"), 1); function useRootContainers({ defaultContainers = [], portals } = {}) { let mainTreeNodeRef = (0, import_react30.useRef)(null); let ownerDocument = useOwnerDocument(mainTreeNodeRef); let resolveContainers2 = useEvent(() => { var _a3; let containers = []; for (let container of defaultContainers) { if (container === null) continue; if (container instanceof HTMLElement) { containers.push(container); } else if ("current" in container && container.current instanceof HTMLElement) { containers.push(container.current); } } if (portals == null ? void 0 : portals.current) { for (let portal of portals.current) { containers.push(portal); } } for (let container of (_a3 = ownerDocument == null ? void 0 : ownerDocument.querySelectorAll("html > *, body > *")) != null ? _a3 : []) { if (container === document.body) continue; if (container === document.head) continue; if (!(container instanceof HTMLElement)) continue; if (container.id === "headlessui-portal-root") continue; if (container.contains(mainTreeNodeRef.current)) continue; if (containers.some((defaultContainer) => container.contains(defaultContainer))) continue; containers.push(container); } return containers; }); return { resolveContainers: resolveContainers2, contains: useEvent( (element) => resolveContainers2().some((container) => container.contains(element)) ), mainTreeNodeRef, MainTreeNode: (0, import_react30.useMemo)(() => { return function MainTreeNode() { return /* @__PURE__ */ import_react30.default.createElement(Hidden, { features: 4 /* Hidden */, ref: mainTreeNodeRef }); }; }, [mainTreeNodeRef]) }; } // src/components/dialog/dialog.tsx var reducers2 = { [0 /* SetTitleId */](state, action) { if (state.titleId === action.id) return state; return { ...state, titleId: action.id }; } }; var DialogContext = (0, import_react31.createContext)(null); DialogContext.displayName = "DialogContext"; function useDialogContext(component) { let context = (0, import_react31.useContext)(DialogContext); if (context === null) { let err = new Error(`<${component} /> is missing a parent component.`); if (Error.captureStackTrace) Error.captureStackTrace(err, useDialogContext); throw err; } return context; } function useScrollLock(ownerDocument, enabled, resolveAllowedContainers = () => [document.body]) { useDocumentOverflowLockedEffect(ownerDocument, enabled, (meta) => { var _a3; return { containers: [...(_a3 = meta.containers) != null ? _a3 : [], resolveAllowedContainers] }; }); } function stateReducer2(state, action) { return match(action.type, reducers2, state, action); } var DEFAULT_DIALOG_TAG = "div"; var DialogRenderFeatures = 1 /* RenderStrategy */ | 2 /* Static */; function DialogFn(props, ref) { var _a3; let internalId = useId(); let { id = `headlessui-dialog-${internalId}`, open, onClose, initialFocus, __demoMode = false, ...theirProps } = props; let [nestedDialogCount, setNestedDialogCount] = (0, import_react31.useState)(0); let usesOpenClosedState = useOpenClosed(); if (open === void 0 && usesOpenClosedState !== null) { open = (usesOpenClosedState & 1 /* Open */) === 1 /* Open */; } let internalDialogRef = (0, import_react31.useRef)(null); let dialogRef = useSyncRefs(internalDialogRef, ref); let ownerDocument = useOwnerDocument(internalDialogRef); let hasOpen = props.hasOwnProperty("open") || usesOpenClosedState !== null; let hasOnClose = props.hasOwnProperty("onClose"); if (!hasOpen && !hasOnClose) { throw new Error( `You have to provide an \`open\` and an \`onClose\` prop to the \`Dialog\` component.` ); } if (!hasOpen) { throw new Error( `You provided an \`onClose\` prop to the \`Dialog\`, but forgot an \`open\` prop.` ); } if (!hasOnClose) { throw new Error( `You provided an \`open\` prop to the \`Dialog\`, but forgot an \`onClose\` prop.` ); } if (typeof open !== "boolean") { throw new Error( `You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${open}` ); } if (typeof onClose !== "function") { throw new Error( `You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${onClose}` ); } let dialogState = open ? 0 /* Open */ : 1 /* Closed */; let [state, dispatch] = (0, import_react31.useReducer)(stateReducer2, { titleId: null, descriptionId: null, panelRef: (0, import_react31.createRef)() }); let close = useEvent(() => onClose(false)); let setTitleId = useEvent((id2) => dispatch({ type: 0 /* SetTitleId */, id: id2 })); let ready = useServerHandoffComplete(); let enabled = ready ? __demoMode ? false : dialogState === 0 /* Open */ : false; let hasNestedDialogs = nestedDialogCount > 1; let hasParentDialog = (0, import_react31.useContext)(DialogContext) !== null; let [portals, PortalWrapper] = useNestedPortals(); let { resolveContainers: resolveRootContainers, mainTreeNodeRef, MainTreeNode } = useRootContainers({ portals, defaultContainers: [(_a3 = state.panelRef.current) != null ? _a3 : internalDialogRef.current] }); let position = !hasNestedDialogs ? "leaf" : "parent"; let isClosing = usesOpenClosedState !== null ? (usesOpenClosedState & 4 /* Closing */) === 4 /* Closing */ : false; let inertOthersEnabled = (() => { if (hasParentDialog) return false; if (isClosing) return false; return enabled; })(); let resolveRootOfMainTreeNode = (0, import_react31.useCallback)(() => { var _a4, _b; return (_b = Array.from((_a4 = ownerDocument == null ? void 0 : ownerDocument.querySelectorAll("body > *")) != null ? _a4 : []).find((root) => { if (root.id === "headlessui-portal-root") return false; return root.contains(mainTreeNodeRef.current) && root instanceof HTMLElement; })) != null ? _b : null; }, [mainTreeNodeRef]); useInert(resolveRootOfMainTreeNode, inertOthersEnabled); let inertParentDialogs = (() => { if (hasNestedDialogs) return true; return enabled; })(); let resolveRootOfParentDialog = (0, import_react31.useCallback)(() => { var _a4, _b; return (_b = Array.from((_a4 = ownerDocument == null ? void 0 : ownerDocument.querySelectorAll("[data-headlessui-portal]")) != null ? _a4 : []).find( (root) => root.contains(mainTreeNodeRef.current) && root instanceof HTMLElement )) != null ? _b : null; }, [mainTreeNodeRef]); useInert(resolveRootOfParentDialog, inertParentDialogs); let outsideClickEnabled = (() => { if (!enabled) return false; if (hasNestedDialogs) return false; return true; })(); useOutsideClick(resolveRootContainers, close, outsideClickEnabled); let escapeToCloseEnabled = (() => { if (hasNestedDialogs) return false; if (dialogState !== 0 /* Open */) return false; return true; })(); useEventListener(ownerDocument == null ? void 0 : ownerDocument.defaultView, "keydown", (event) => { if (!escapeToCloseEnabled) return; if (event.defaultPrevented) return; if (event.key !== "Escape" /* Escape */) return; event.preventDefault(); event.stopPropagation(); close(); }); let scrollLockEnabled = (() => { if (isClosing) return false; if (dialogState !== 0 /* Open */) return false; if (hasParentDialog) return false; return true; })(); useScrollLock(ownerDocument, scrollLockEnabled, resolveRootContainers); (0, import_react31.useEffect)(() => { if (dialogState !== 0 /* Open */) return; if (!internalDialogRef.current) return; let observer = new ResizeObserver((entries) => { for (let entry of entries) { let rect = entry.target.getBoundingClientRect(); if (rect.x === 0 && rect.y === 0 && rect.width === 0 && rect.height === 0) { close(); } } }); observer.observe(internalDialogRef.current); return () => observer.disconnect(); }, [dialogState, internalDialogRef, close]); let [describedby, DescriptionProvider] = useDescriptions(); let contextBag = (0, import_react31.useMemo)( () => [{ dialogState, close, setTitleId }, state], [dialogState, state, close, setTitleId] ); let slot = (0, import_react31.useMemo)( () => ({ open: dialogState === 0 /* Open */ }), [dialogState] ); let ourProps = { ref: dialogRef, id, role: "dialog", "aria-modal": dialogState === 0 /* Open */ ? true : void 0, "aria-labelledby": state.titleId, "aria-describedby": describedby }; return /* @__PURE__ */ import_react31.default.createElement( StackProvider, { type: "Dialog", enabled: dialogState === 0 /* Open */, element: internalDialogRef, onUpdate: useEvent((message, type) => { if (type !== "Dialog") return; match(message, { [0 /* Add */]: () => setNestedDialogCount((count) => count + 1), [1 /* Remove */]: () => setNestedDialogCount((count) => count - 1) }); }) }, /* @__PURE__ */ import_react31.default.createElement(ForcePortalRoot, { force: true }, /* @__PURE__ */ import_react31.default.createElement(Portal, null, /* @__PURE__ */ import_react31.default.createElement(DialogContext.Provider, { value: contextBag }, /* @__PURE__ */ import_react31.default.createElement(Portal.Group, { target: internalDialogRef }, /* @__PURE__ */ import_react31.default.createElement(ForcePortalRoot, { force: false }, /* @__PURE__ */ import_react31.default.createElement(DescriptionProvider, { slot, name: "Dialog.Description" }, /* @__PURE__ */ import_react31.default.createElement( FocusTrap, { initialFocus, containers: resolveRootContainers, features: enabled ? match(position, { parent: FocusTrap.features.RestoreFocus, leaf: FocusTrap.features.All & ~FocusTrap.features.FocusLock }) : FocusTrap.features.None }, /* @__PURE__ */ import_react31.default.createElement(PortalWrapper, null, render({ ourProps, theirProps, slot, defaultTag: DEFAULT_DIALOG_TAG, features: DialogRenderFeatures, visible: dialogState === 0 /* Open */, name: "Dialog" })) ))))))), /* @__PURE__ */ import_react31.default.createElement(MainTreeNode, null) ); } var DEFAULT_OVERLAY_TAG = "div"; function OverlayFn(props, ref) { let internalId = useId(); let { id = `headlessui-dialog-overlay-${internalId}`, ...theirProps } = props; let [{ dialogState, close }] = useDialogContext("Dialog.Overlay"); let overlayRef = useSyncRefs(ref); let handleClick = useEvent((event) => { if (event.target !== event.currentTarget) return; if (isDisabledReactIssue7711(event.currentTarget)) return event.preventDefault(); event.preventDefault(); event.stopPropagation(); close(); }); let slot = (0, import_react31.useMemo)( () => ({ open: dialogState === 0 /* Open */ }), [dialogState] ); let ourProps = { ref: overlayRef, id, "aria-hidden": true, onClick: handleClick }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_OVERLAY_TAG, name: "Dialog.Overlay" }); } var DEFAULT_BACKDROP_TAG = "div"; function BackdropFn(props, ref) { let internalId = useId(); let { id = `headlessui-dialog-backdrop-${internalId}`, ...theirProps } = props; let [{ dialogState }, state] = useDialogContext("Dialog.Backdrop"); let backdropRef = useSyncRefs(ref); (0, import_react31.useEffect)(() => { if (state.panelRef.current === null) { throw new Error( `A component is being used, but a component is missing.` ); } }, [state.panelRef]); let slot = (0, import_react31.useMemo)( () => ({ open: dialogState === 0 /* Open */ }), [dialogState] ); let ourProps = { ref: backdropRef, id, "aria-hidden": true }; return /* @__PURE__ */ import_react31.default.createElement(ForcePortalRoot, { force: true }, /* @__PURE__ */ import_react31.default.createElement(Portal, null, render({ ourProps, theirProps, slot, defaultTag: DEFAULT_BACKDROP_TAG, name: "Dialog.Backdrop" }))); } var DEFAULT_PANEL_TAG = "div"; function PanelFn(props, ref) { let internalId = useId(); let { id = `headlessui-dialog-panel-${internalId}`, ...theirProps } = props; let [{ dialogState }, state] = useDialogContext("Dialog.Panel"); let panelRef = useSyncRefs(ref, state.panelRef); let slot = (0, import_react31.useMemo)( () => ({ open: dialogState === 0 /* Open */ }), [dialogState] ); let handleClick = useEvent((event) => { event.stopPropagation(); }); let ourProps = { ref: panelRef, id, onClick: handleClick }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_PANEL_TAG, name: "Dialog.Panel" }); } var DEFAULT_TITLE_TAG = "h2"; function TitleFn(props, ref) { let internalId = useId(); let { id = `headlessui-dialog-title-${internalId}`, ...theirProps } = props; let [{ dialogState, setTitleId }] = useDialogContext("Dialog.Title"); let titleRef = useSyncRefs(ref); (0, import_react31.useEffect)(() => { setTitleId(id); return () => setTitleId(null); }, [id, setTitleId]); let slot = (0, import_react31.useMemo)( () => ({ open: dialogState === 0 /* Open */ }), [dialogState] ); let ourProps = { ref: titleRef, id }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_TITLE_TAG, name: "Dialog.Title" }); } var DialogRoot = forwardRefWithAs(DialogFn); var Backdrop = forwardRefWithAs(BackdropFn); var Panel = forwardRefWithAs(PanelFn); var Overlay = forwardRefWithAs(OverlayFn); var Title = forwardRefWithAs(TitleFn); var Dialog = Object.assign(DialogRoot, { Backdrop, Panel, Overlay, Title, Description }); // src/components/disclosure/disclosure.tsx var import_react33 = __toESM(__webpack_require__(/*! react */ "react"), 1); // src/utils/start-transition.ts var import_react32 = __toESM(__webpack_require__(/*! react */ "react"), 1); var _a2; var startTransition = ( // Prefer React's `startTransition` if it's available. // @ts-expect-error - `startTransition` doesn't exist in React < 18. (_a2 = import_react32.default.startTransition) != null ? _a2 : function startTransition2(cb) { cb(); } ); // src/components/disclosure/disclosure.tsx var reducers3 = { [0 /* ToggleDisclosure */]: (state) => ({ ...state, disclosureState: match(state.disclosureState, { [0 /* Open */]: 1 /* Closed */, [1 /* Closed */]: 0 /* Open */ }) }), [1 /* CloseDisclosure */]: (state) => { if (state.disclosureState === 1 /* Closed */) return state; return { ...state, disclosureState: 1 /* Closed */ }; }, [4 /* LinkPanel */](state) { if (state.linkedPanel === true) return state; return { ...state, linkedPanel: true }; }, [5 /* UnlinkPanel */](state) { if (state.linkedPanel === false) return state; return { ...state, linkedPanel: false }; }, [2 /* SetButtonId */](state, action) { if (state.buttonId === action.buttonId) return state; return { ...state, buttonId: action.buttonId }; }, [3 /* SetPanelId */](state, action) { if (state.panelId === action.panelId) return state; return { ...state, panelId: action.panelId }; } }; var DisclosureContext = (0, import_react33.createContext)(null); DisclosureContext.displayName = "DisclosureContext"; function useDisclosureContext(component) { let context = (0, import_react33.useContext)(DisclosureContext); if (context === null) { let err = new Error(`<${component} /> is missing a parent component.`); if (Error.captureStackTrace) Error.captureStackTrace(err, useDisclosureContext); throw err; } return context; } var DisclosureAPIContext = (0, import_react33.createContext)(null); DisclosureAPIContext.displayName = "DisclosureAPIContext"; function useDisclosureAPIContext(component) { let context = (0, import_react33.useContext)(DisclosureAPIContext); if (context === null) { let err = new Error(`<${component} /> is missing a parent component.`); if (Error.captureStackTrace) Error.captureStackTrace(err, useDisclosureAPIContext); throw err; } return context; } var DisclosurePanelContext = (0, import_react33.createContext)(null); DisclosurePanelContext.displayName = "DisclosurePanelContext"; function useDisclosurePanelContext() { return (0, import_react33.useContext)(DisclosurePanelContext); } function stateReducer3(state, action) { return match(action.type, reducers3, state, action); } var DEFAULT_DISCLOSURE_TAG = import_react33.Fragment; function DisclosureFn(props, ref) { let { defaultOpen = false, ...theirProps } = props; let internalDisclosureRef = (0, import_react33.useRef)(null); let disclosureRef = useSyncRefs( ref, optionalRef( (ref2) => { internalDisclosureRef.current = ref2; }, props.as === void 0 || // @ts-expect-error The `as` prop _can_ be a Fragment props.as === import_react33.Fragment ) ); let panelRef = (0, import_react33.useRef)(null); let buttonRef = (0, import_react33.useRef)(null); let reducerBag = (0, import_react33.useReducer)(stateReducer3, { disclosureState: defaultOpen ? 0 /* Open */ : 1 /* Closed */, linkedPanel: false, buttonRef, panelRef, buttonId: null, panelId: null }); let [{ disclosureState, buttonId }, dispatch] = reducerBag; let close = useEvent((focusableElement) => { dispatch({ type: 1 /* CloseDisclosure */ }); let ownerDocument = getOwnerDocument(internalDisclosureRef); if (!ownerDocument) return; if (!buttonId) return; let restoreElement = (() => { if (!focusableElement) return ownerDocument.getElementById(buttonId); if (focusableElement instanceof HTMLElement) return focusableElement; if (focusableElement.current instanceof HTMLElement) return focusableElement.current; return ownerDocument.getElementById(buttonId); })(); restoreElement == null ? void 0 : restoreElement.focus(); }); let api = (0, import_react33.useMemo)(() => ({ close }), [close]); let slot = (0, import_react33.useMemo)( () => ({ open: disclosureState === 0 /* Open */, close }), [disclosureState, close] ); let ourProps = { ref: disclosureRef }; return /* @__PURE__ */ import_react33.default.createElement(DisclosureContext.Provider, { value: reducerBag }, /* @__PURE__ */ import_react33.default.createElement(DisclosureAPIContext.Provider, { value: api }, /* @__PURE__ */ import_react33.default.createElement( OpenClosedProvider, { value: match(disclosureState, { [0 /* Open */]: 1 /* Open */, [1 /* Closed */]: 2 /* Closed */ }) }, render({ ourProps, theirProps, slot, defaultTag: DEFAULT_DISCLOSURE_TAG, name: "Disclosure" }) ))); } var DEFAULT_BUTTON_TAG2 = "button"; function ButtonFn2(props, ref) { let internalId = useId(); let { id = `headlessui-disclosure-button-${internalId}`, ...theirProps } = props; let [state, dispatch] = useDisclosureContext("Disclosure.Button"); let panelContext = useDisclosurePanelContext(); let isWithinPanel = panelContext === null ? false : panelContext === state.panelId; let internalButtonRef = (0, import_react33.useRef)(null); let buttonRef = useSyncRefs(internalButtonRef, ref, !isWithinPanel ? state.buttonRef : null); (0, import_react33.useEffect)(() => { if (isWithinPanel) return; dispatch({ type: 2 /* SetButtonId */, buttonId: id }); return () => { dispatch({ type: 2 /* SetButtonId */, buttonId: null }); }; }, [id, dispatch, isWithinPanel]); let handleKeyDown = useEvent((event) => { var _a3; if (isWithinPanel) { if (state.disclosureState === 1 /* Closed */) return; switch (event.key) { case " " /* Space */: case "Enter" /* Enter */: event.preventDefault(); event.stopPropagation(); dispatch({ type: 0 /* ToggleDisclosure */ }); (_a3 = state.buttonRef.current) == null ? void 0 : _a3.focus(); break; } } else { switch (event.key) { case " " /* Space */: case "Enter" /* Enter */: event.preventDefault(); event.stopPropagation(); dispatch({ type: 0 /* ToggleDisclosure */ }); break; } } }); let handleKeyUp = useEvent((event) => { switch (event.key) { case " " /* Space */: event.preventDefault(); break; } }); let handleClick = useEvent((event) => { var _a3; if (isDisabledReactIssue7711(event.currentTarget)) return; if (props.disabled) return; if (isWithinPanel) { dispatch({ type: 0 /* ToggleDisclosure */ }); (_a3 = state.buttonRef.current) == null ? void 0 : _a3.focus(); } else { dispatch({ type: 0 /* ToggleDisclosure */ }); } }); let slot = (0, import_react33.useMemo)( () => ({ open: state.disclosureState === 0 /* Open */ }), [state] ); let type = useResolveButtonType(props, internalButtonRef); let ourProps = isWithinPanel ? { ref: buttonRef, type, onKeyDown: handleKeyDown, onClick: handleClick } : { ref: buttonRef, id, type, "aria-expanded": props.disabled ? void 0 : state.disclosureState === 0 /* Open */, "aria-controls": state.linkedPanel ? state.panelId : void 0, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onClick: handleClick }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_BUTTON_TAG2, name: "Disclosure.Button" }); } var DEFAULT_PANEL_TAG2 = "div"; var PanelRenderFeatures = 1 /* RenderStrategy */ | 2 /* Static */; function PanelFn2(props, ref) { let internalId = useId(); let { id = `headlessui-disclosure-panel-${internalId}`, ...theirProps } = props; let [state, dispatch] = useDisclosureContext("Disclosure.Panel"); let { close } = useDisclosureAPIContext("Disclosure.Panel"); let panelRef = useSyncRefs(ref, state.panelRef, (el) => { startTransition(() => dispatch({ type: el ? 4 /* LinkPanel */ : 5 /* UnlinkPanel */ })); }); (0, import_react33.useEffect)(() => { dispatch({ type: 3 /* SetPanelId */, panelId: id }); return () => { dispatch({ type: 3 /* SetPanelId */, panelId: null }); }; }, [id, dispatch]); let usesOpenClosedState = useOpenClosed(); let visible = (() => { if (usesOpenClosedState !== null) { return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */; } return state.disclosureState === 0 /* Open */; })(); let slot = (0, import_react33.useMemo)( () => ({ open: state.disclosureState === 0 /* Open */, close }), [state, close] ); let ourProps = { ref: panelRef, id }; return /* @__PURE__ */ import_react33.default.createElement(DisclosurePanelContext.Provider, { value: state.panelId }, render({ ourProps, theirProps, slot, defaultTag: DEFAULT_PANEL_TAG2, features: PanelRenderFeatures, visible, name: "Disclosure.Panel" })); } var DisclosureRoot = forwardRefWithAs(DisclosureFn); var Button2 = forwardRefWithAs(ButtonFn2); var Panel2 = forwardRefWithAs(PanelFn2); var Disclosure = Object.assign(DisclosureRoot, { Button: Button2, Panel: Panel2 }); // src/components/listbox/listbox.tsx var import_react35 = __toESM(__webpack_require__(/*! react */ "react"), 1); // src/hooks/use-text-value.ts var import_react34 = __webpack_require__(/*! react */ "react"); // src/utils/get-text-value.ts var emojiRegex = /([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g; function getTextContents(element) { var _a3, _b; let currentInnerText = (_a3 = element.innerText) != null ? _a3 : ""; let copy = element.cloneNode(true); if (!(copy instanceof HTMLElement)) { return currentInnerText; } let dropped = false; for (let child of copy.querySelectorAll('[hidden],[aria-hidden],[role="img"]')) { child.remove(); dropped = true; } let value = dropped ? (_b = copy.innerText) != null ? _b : "" : currentInnerText; if (emojiRegex.test(value)) { value = value.replace(emojiRegex, ""); } return value; } function getTextValue(element) { let label = element.getAttribute("aria-label"); if (typeof label === "string") return label.trim(); let labelledby = element.getAttribute("aria-labelledby"); if (labelledby) { let labels = labelledby.split(" ").map((labelledby2) => { let labelEl = document.getElementById(labelledby2); if (labelEl) { let label2 = labelEl.getAttribute("aria-label"); if (typeof label2 === "string") return label2.trim(); return getTextContents(labelEl).trim(); } return null; }).filter(Boolean); if (labels.length > 0) return labels.join(", "); } return getTextContents(element).trim(); } // src/hooks/use-text-value.ts function useTextValue(element) { let cacheKey = (0, import_react34.useRef)(""); let cacheValue = (0, import_react34.useRef)(""); return useEvent(() => { let el = element.current; if (!el) return ""; let currentKey = el.innerText; if (cacheKey.current === currentKey) { return cacheValue.current; } let value = getTextValue(el).trim().toLowerCase(); cacheKey.current = currentKey; cacheValue.current = value; return value; }); } // src/components/listbox/listbox.tsx function adjustOrderedState2(state, adjustment = (i) => i) { let currentActiveOption = state.activeOptionIndex !== null ? state.options[state.activeOptionIndex] : null; let sortedOptions = sortByDomNode( adjustment(state.options.slice()), (option) => option.dataRef.current.domRef.current ); let adjustedActiveOptionIndex = currentActiveOption ? sortedOptions.indexOf(currentActiveOption) : null; if (adjustedActiveOptionIndex === -1) { adjustedActiveOptionIndex = null; } return { options: sortedOptions, activeOptionIndex: adjustedActiveOptionIndex }; } var reducers4 = { [1 /* CloseListbox */](state) { if (state.dataRef.current.disabled) return state; if (state.listboxState === 1 /* Closed */) return state; return { ...state, activeOptionIndex: null, listboxState: 1 /* Closed */ }; }, [0 /* OpenListbox */](state) { if (state.dataRef.current.disabled) return state; if (state.listboxState === 0 /* Open */) return state; let activeOptionIndex = state.activeOptionIndex; let { isSelected } = state.dataRef.current; let optionIdx = state.options.findIndex((option) => isSelected(option.dataRef.current.value)); if (optionIdx !== -1) { activeOptionIndex = optionIdx; } return { ...state, listboxState: 0 /* Open */, activeOptionIndex }; }, [2 /* GoToOption */](state, action) { var _a3; if (state.dataRef.current.disabled) return state; if (state.listboxState === 1 /* Closed */) return state; let adjustedState = adjustOrderedState2(state); let activeOptionIndex = calculateActiveIndex(action, { resolveItems: () => adjustedState.options, resolveActiveIndex: () => adjustedState.activeOptionIndex, resolveId: (option) => option.id, resolveDisabled: (option) => option.dataRef.current.disabled }); return { ...state, ...adjustedState, searchQuery: "", activeOptionIndex, activationTrigger: (_a3 = action.trigger) != null ? _a3 : 1 /* Other */ }; }, [3 /* Search */]: (state, action) => { if (state.dataRef.current.disabled) return state; if (state.listboxState === 1 /* Closed */) return state; let wasAlreadySearching = state.searchQuery !== ""; let offset = wasAlreadySearching ? 0 : 1; let searchQuery = state.searchQuery + action.value.toLowerCase(); let reOrderedOptions = state.activeOptionIndex !== null ? state.options.slice(state.activeOptionIndex + offset).concat(state.options.slice(0, state.activeOptionIndex + offset)) : state.options; let matchingOption = reOrderedOptions.find( (option) => { var _a3; return !option.dataRef.current.disabled && ((_a3 = option.dataRef.current.textValue) == null ? void 0 : _a3.startsWith(searchQuery)); } ); let matchIdx = matchingOption ? state.options.indexOf(matchingOption) : -1; if (matchIdx === -1 || matchIdx === state.activeOptionIndex) return { ...state, searchQuery }; return { ...state, searchQuery, activeOptionIndex: matchIdx, activationTrigger: 1 /* Other */ }; }, [4 /* ClearSearch */](state) { if (state.dataRef.current.disabled) return state; if (state.listboxState === 1 /* Closed */) return state; if (state.searchQuery === "") return state; return { ...state, searchQuery: "" }; }, [5 /* RegisterOption */]: (state, action) => { let option = { id: action.id, dataRef: action.dataRef }; let adjustedState = adjustOrderedState2(state, (options) => [...options, option]); if (state.activeOptionIndex === null) { if (state.dataRef.current.isSelected(action.dataRef.current.value)) { adjustedState.activeOptionIndex = adjustedState.options.indexOf(option); } } return { ...state, ...adjustedState }; }, [6 /* UnregisterOption */]: (state, action) => { let adjustedState = adjustOrderedState2(state, (options) => { let idx = options.findIndex((a) => a.id === action.id); if (idx !== -1) options.splice(idx, 1); return options; }); return { ...state, ...adjustedState, activationTrigger: 1 /* Other */ }; }, [7 /* RegisterLabel */]: (state, action) => { return { ...state, labelId: action.id }; } }; var ListboxActionsContext = (0, import_react35.createContext)(null); ListboxActionsContext.displayName = "ListboxActionsContext"; function useActions2(component) { let context = (0, import_react35.useContext)(ListboxActionsContext); if (context === null) { let err = new Error(`<${component} /> is missing a parent component.`); if (Error.captureStackTrace) Error.captureStackTrace(err, useActions2); throw err; } return context; } var ListboxDataContext = (0, import_react35.createContext)(null); ListboxDataContext.displayName = "ListboxDataContext"; function useData2(component) { let context = (0, import_react35.useContext)(ListboxDataContext); if (context === null) { let err = new Error(`<${component} /> is missing a parent component.`); if (Error.captureStackTrace) Error.captureStackTrace(err, useData2); throw err; } return context; } function stateReducer4(state, action) { return match(action.type, reducers4, state, action); } var DEFAULT_LISTBOX_TAG = import_react35.Fragment; function ListboxFn(props, ref) { let { value: controlledValue, defaultValue, form: formName, name, onChange: controlledOnChange, by = (a, z) => a === z, disabled = false, horizontal = false, multiple = false, ...theirProps } = props; const orientation = horizontal ? "horizontal" : "vertical"; let listboxRef = useSyncRefs(ref); let [value = multiple ? [] : void 0, theirOnChange] = useControllable( controlledValue, controlledOnChange, defaultValue ); let [state, dispatch] = (0, import_react35.useReducer)(stateReducer4, { dataRef: (0, import_react35.createRef)(), listboxState: 1 /* Closed */, options: [], searchQuery: "", labelId: null, activeOptionIndex: null, activationTrigger: 1 /* Other */ }); let optionsPropsRef = (0, import_react35.useRef)({ static: false, hold: false }); let labelRef = (0, import_react35.useRef)(null); let buttonRef = (0, import_react35.useRef)(null); let optionsRef = (0, import_react35.useRef)(null); let compare = useEvent( typeof by === "string" ? (a, z) => { let property = by; return (a == null ? void 0 : a[property]) === (z == null ? void 0 : z[property]); } : by ); let isSelected = (0, import_react35.useCallback)( (compareValue) => match(data.mode, { [1 /* Multi */]: () => value.some((option) => compare(option, compareValue)), [0 /* Single */]: () => compare(value, compareValue) }), [value] ); let data = (0, import_react35.useMemo)( () => ({ ...state, value, disabled, mode: multiple ? 1 /* Multi */ : 0 /* Single */, orientation, compare, isSelected, optionsPropsRef, labelRef, buttonRef, optionsRef }), [value, disabled, multiple, state] ); useIsoMorphicEffect(() => { state.dataRef.current = data; }, [data]); useOutsideClick( [data.buttonRef, data.optionsRef], (event, target) => { var _a3; dispatch({ type: 1 /* CloseListbox */ }); if (!isFocusableElement(target, 1 /* Loose */)) { event.preventDefault(); (_a3 = data.buttonRef.current) == null ? void 0 : _a3.focus(); } }, data.listboxState === 0 /* Open */ ); let slot = (0, import_react35.useMemo)( () => ({ open: data.listboxState === 0 /* Open */, disabled, value }), [data, disabled, value] ); let selectOption = useEvent((id) => { let option = data.options.find((item) => item.id === id); if (!option) return; onChange(option.dataRef.current.value); }); let selectActiveOption = useEvent(() => { if (data.activeOptionIndex !== null) { let { dataRef, id } = data.options[data.activeOptionIndex]; onChange(dataRef.current.value); dispatch({ type: 2 /* GoToOption */, focus: 4 /* Specific */, id }); } }); let openListbox = useEvent(() => dispatch({ type: 0 /* OpenListbox */ })); let closeListbox = useEvent(() => dispatch({ type: 1 /* CloseListbox */ })); let goToOption = useEvent((focus, id, trigger) => { if (focus === 4 /* Specific */) { return dispatch({ type: 2 /* GoToOption */, focus: 4 /* Specific */, id, trigger }); } return dispatch({ type: 2 /* GoToOption */, focus, trigger }); }); let registerOption = useEvent((id, dataRef) => { dispatch({ type: 5 /* RegisterOption */, id, dataRef }); return () => dispatch({ type: 6 /* UnregisterOption */, id }); }); let registerLabel = useEvent((id) => { dispatch({ type: 7 /* RegisterLabel */, id }); return () => dispatch({ type: 7 /* RegisterLabel */, id: null }); }); let onChange = useEvent((value2) => { return match(data.mode, { [0 /* Single */]() { return theirOnChange == null ? void 0 : theirOnChange(value2); }, [1 /* Multi */]() { let copy = data.value.slice(); let idx = copy.findIndex((item) => compare(item, value2)); if (idx === -1) { copy.push(value2); } else { copy.splice(idx, 1); } return theirOnChange == null ? void 0 : theirOnChange(copy); } }); }); let search = useEvent((value2) => dispatch({ type: 3 /* Search */, value: value2 })); let clearSearch = useEvent(() => dispatch({ type: 4 /* ClearSearch */ })); let actions = (0, import_react35.useMemo)( () => ({ onChange, registerOption, registerLabel, goToOption, closeListbox, openListbox, selectActiveOption, selectOption, search, clearSearch }), [] ); let ourProps = { ref: listboxRef }; let form = (0, import_react35.useRef)(null); let d = useDisposables(); (0, import_react35.useEffect)(() => { if (!form.current) return; if (defaultValue === void 0) return; d.addEventListener(form.current, "reset", () => { onChange(defaultValue); }); }, [ form, onChange /* Explicitly ignoring `defaultValue` */ ]); return /* @__PURE__ */ import_react35.default.createElement(ListboxActionsContext.Provider, { value: actions }, /* @__PURE__ */ import_react35.default.createElement(ListboxDataContext.Provider, { value: data }, /* @__PURE__ */ import_react35.default.createElement( OpenClosedProvider, { value: match(data.listboxState, { [0 /* Open */]: 1 /* Open */, [1 /* Closed */]: 2 /* Closed */ }) }, name != null && value != null && objectToFormEntries({ [name]: value }).map(([name2, value2], idx) => /* @__PURE__ */ import_react35.default.createElement( Hidden, { features: 4 /* Hidden */, ref: idx === 0 ? (element) => { var _a3; form.current = (_a3 = element == null ? void 0 : element.closest("form")) != null ? _a3 : null; } : void 0, ...compact({ key: name2, as: "input", type: "hidden", hidden: true, readOnly: true, form: formName, name: name2, value: value2 }) } )), render({ ourProps, theirProps, slot, defaultTag: DEFAULT_LISTBOX_TAG, name: "Listbox" }) ))); } var DEFAULT_BUTTON_TAG3 = "button"; function ButtonFn3(props, ref) { var _a3; let internalId = useId(); let { id = `headlessui-listbox-button-${internalId}`, ...theirProps } = props; let data = useData2("Listbox.Button"); let actions = useActions2("Listbox.Button"); let buttonRef = useSyncRefs(data.buttonRef, ref); let d = useDisposables(); let handleKeyDown = useEvent((event) => { switch (event.key) { case " " /* Space */: case "Enter" /* Enter */: case "ArrowDown" /* ArrowDown */: event.preventDefault(); actions.openListbox(); d.nextFrame(() => { if (!data.value) actions.goToOption(0 /* First */); }); break; case "ArrowUp" /* ArrowUp */: event.preventDefault(); actions.openListbox(); d.nextFrame(() => { if (!data.value) actions.goToOption(3 /* Last */); }); break; } }); let handleKeyUp = useEvent((event) => { switch (event.key) { case " " /* Space */: event.preventDefault(); break; } }); let handleClick = useEvent((event) => { if (isDisabledReactIssue7711(event.currentTarget)) return event.preventDefault(); if (data.listboxState === 0 /* Open */) { actions.closeListbox(); d.nextFrame(() => { var _a4; return (_a4 = data.buttonRef.current) == null ? void 0 : _a4.focus({ preventScroll: true }); }); } else { event.preventDefault(); actions.openListbox(); } }); let labelledby = useComputed(() => { if (!data.labelId) return void 0; return [data.labelId, id].join(" "); }, [data.labelId, id]); let slot = (0, import_react35.useMemo)( () => ({ open: data.listboxState === 0 /* Open */, disabled: data.disabled, value: data.value }), [data] ); let ourProps = { ref: buttonRef, id, type: useResolveButtonType(props, data.buttonRef), "aria-haspopup": "listbox", "aria-controls": (_a3 = data.optionsRef.current) == null ? void 0 : _a3.id, "aria-expanded": data.disabled ? void 0 : data.listboxState === 0 /* Open */, "aria-labelledby": labelledby, disabled: data.disabled, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onClick: handleClick }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_BUTTON_TAG3, name: "Listbox.Button" }); } var DEFAULT_LABEL_TAG2 = "label"; function LabelFn2(props, ref) { let internalId = useId(); let { id = `headlessui-listbox-label-${internalId}`, ...theirProps } = props; let data = useData2("Listbox.Label"); let actions = useActions2("Listbox.Label"); let labelRef = useSyncRefs(data.labelRef, ref); useIsoMorphicEffect(() => actions.registerLabel(id), [id]); let handleClick = useEvent(() => { var _a3; return (_a3 = data.buttonRef.current) == null ? void 0 : _a3.focus({ preventScroll: true }); }); let slot = (0, import_react35.useMemo)( () => ({ open: data.listboxState === 0 /* Open */, disabled: data.disabled }), [data] ); let ourProps = { ref: labelRef, id, onClick: handleClick }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_LABEL_TAG2, name: "Listbox.Label" }); } var DEFAULT_OPTIONS_TAG2 = "ul"; var OptionsRenderFeatures2 = 1 /* RenderStrategy */ | 2 /* Static */; function OptionsFn2(props, ref) { var _a3; let internalId = useId(); let { id = `headlessui-listbox-options-${internalId}`, ...theirProps } = props; let data = useData2("Listbox.Options"); let actions = useActions2("Listbox.Options"); let optionsRef = useSyncRefs(data.optionsRef, ref); let d = useDisposables(); let searchDisposables = useDisposables(); let usesOpenClosedState = useOpenClosed(); let visible = (() => { if (usesOpenClosedState !== null) { return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */; } return data.listboxState === 0 /* Open */; })(); (0, import_react35.useEffect)(() => { var _a4; let container = data.optionsRef.current; if (!container) return; if (data.listboxState !== 0 /* Open */) return; if (container === ((_a4 = getOwnerDocument(container)) == null ? void 0 : _a4.activeElement)) return; container.focus({ preventScroll: true }); }, [data.listboxState, data.optionsRef]); let handleKeyDown = useEvent((event) => { searchDisposables.dispose(); switch (event.key) { case " " /* Space */: if (data.searchQuery !== "") { event.preventDefault(); event.stopPropagation(); return actions.search(event.key); } case "Enter" /* Enter */: event.preventDefault(); event.stopPropagation(); if (data.activeOptionIndex !== null) { let { dataRef } = data.options[data.activeOptionIndex]; actions.onChange(dataRef.current.value); } if (data.mode === 0 /* Single */) { actions.closeListbox(); disposables().nextFrame(() => { var _a4; return (_a4 = data.buttonRef.current) == null ? void 0 : _a4.focus({ preventScroll: true }); }); } break; case match(data.orientation, { vertical: "ArrowDown" /* ArrowDown */, horizontal: "ArrowRight" /* ArrowRight */ }): event.preventDefault(); event.stopPropagation(); return actions.goToOption(2 /* Next */); case match(data.orientation, { vertical: "ArrowUp" /* ArrowUp */, horizontal: "ArrowLeft" /* ArrowLeft */ }): event.preventDefault(); event.stopPropagation(); return actions.goToOption(1 /* Previous */); case "Home" /* Home */: case "PageUp" /* PageUp */: event.preventDefault(); event.stopPropagation(); return actions.goToOption(0 /* First */); case "End" /* End */: case "PageDown" /* PageDown */: event.preventDefault(); event.stopPropagation(); return actions.goToOption(3 /* Last */); case "Escape" /* Escape */: event.preventDefault(); event.stopPropagation(); actions.closeListbox(); return d.nextFrame(() => { var _a4; return (_a4 = data.buttonRef.current) == null ? void 0 : _a4.focus({ preventScroll: true }); }); case "Tab" /* Tab */: event.preventDefault(); event.stopPropagation(); break; default: if (event.key.length === 1) { actions.search(event.key); searchDisposables.setTimeout(() => actions.clearSearch(), 350); } break; } }); let labelledby = useComputed( () => { var _a4, _b, _c; return (_c = (_a4 = data.labelRef.current) == null ? void 0 : _a4.id) != null ? _c : (_b = data.buttonRef.current) == null ? void 0 : _b.id; }, [data.labelRef.current, data.buttonRef.current] ); let slot = (0, import_react35.useMemo)( () => ({ open: data.listboxState === 0 /* Open */ }), [data] ); let ourProps = { "aria-activedescendant": data.activeOptionIndex === null ? void 0 : (_a3 = data.options[data.activeOptionIndex]) == null ? void 0 : _a3.id, "aria-multiselectable": data.mode === 1 /* Multi */ ? true : void 0, "aria-labelledby": labelledby, "aria-orientation": data.orientation, id, onKeyDown: handleKeyDown, role: "listbox", tabIndex: 0, ref: optionsRef }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_OPTIONS_TAG2, features: OptionsRenderFeatures2, visible, name: "Listbox.Options" }); } var DEFAULT_OPTION_TAG2 = "li"; function OptionFn2(props, ref) { let internalId = useId(); let { id = `headlessui-listbox-option-${internalId}`, disabled = false, value, ...theirProps } = props; let data = useData2("Listbox.Option"); let actions = useActions2("Listbox.Option"); let active = data.activeOptionIndex !== null ? data.options[data.activeOptionIndex].id === id : false; let selected = data.isSelected(value); let internalOptionRef = (0, import_react35.useRef)(null); let getTextValue2 = useTextValue(internalOptionRef); let bag = useLatestValue({ disabled, value, domRef: internalOptionRef, get textValue() { return getTextValue2(); } }); let optionRef = useSyncRefs(ref, internalOptionRef); useIsoMorphicEffect(() => { if (data.listboxState !== 0 /* Open */) return; if (!active) return; if (data.activationTrigger === 0 /* Pointer */) return; let d = disposables(); d.requestAnimationFrame(() => { var _a3, _b; (_b = (_a3 = internalOptionRef.current) == null ? void 0 : _a3.scrollIntoView) == null ? void 0 : _b.call(_a3, { block: "nearest" }); }); return d.dispose; }, [ internalOptionRef, active, data.listboxState, data.activationTrigger, /* We also want to trigger this when the position of the active item changes so that we can re-trigger the scrollIntoView */ data.activeOptionIndex ]); useIsoMorphicEffect(() => actions.registerOption(id, bag), [bag, id]); let handleClick = useEvent((event) => { if (disabled) return event.preventDefault(); actions.onChange(value); if (data.mode === 0 /* Single */) { actions.closeListbox(); disposables().nextFrame(() => { var _a3; return (_a3 = data.buttonRef.current) == null ? void 0 : _a3.focus({ preventScroll: true }); }); } }); let handleFocus = useEvent(() => { if (disabled) return actions.goToOption(5 /* Nothing */); actions.goToOption(4 /* Specific */, id); }); let pointer = useTrackedPointer(); let handleEnter = useEvent((evt) => pointer.update(evt)); let handleMove = useEvent((evt) => { if (!pointer.wasMoved(evt)) return; if (disabled) return; if (active) return; actions.goToOption(4 /* Specific */, id, 0 /* Pointer */); }); let handleLeave = useEvent((evt) => { if (!pointer.wasMoved(evt)) return; if (disabled) return; if (!active) return; actions.goToOption(5 /* Nothing */); }); let slot = (0, import_react35.useMemo)( () => ({ active, selected, disabled }), [active, selected, disabled] ); let ourProps = { id, ref: optionRef, role: "option", tabIndex: disabled === true ? void 0 : -1, "aria-disabled": disabled === true ? true : void 0, // According to the WAI-ARIA best practices, we should use aria-checked for // multi-select,but Voice-Over disagrees. So we use aria-checked instead for // both single and multi-select. "aria-selected": selected, disabled: void 0, // Never forward the `disabled` prop onClick: handleClick, onFocus: handleFocus, onPointerEnter: handleEnter, onMouseEnter: handleEnter, onPointerMove: handleMove, onMouseMove: handleMove, onPointerLeave: handleLeave, onMouseLeave: handleLeave }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_OPTION_TAG2, name: "Listbox.Option" }); } var ListboxRoot = forwardRefWithAs(ListboxFn); var Button3 = forwardRefWithAs(ButtonFn3); var Label2 = forwardRefWithAs(LabelFn2); var Options2 = forwardRefWithAs(OptionsFn2); var Option2 = forwardRefWithAs(OptionFn2); var Listbox = Object.assign(ListboxRoot, { Button: Button3, Label: Label2, Options: Options2, Option: Option2 }); // src/components/menu/menu.tsx var import_react36 = __toESM(__webpack_require__(/*! react */ "react"), 1); function adjustOrderedState3(state, adjustment = (i) => i) { let currentActiveItem = state.activeItemIndex !== null ? state.items[state.activeItemIndex] : null; let sortedItems = sortByDomNode( adjustment(state.items.slice()), (item) => item.dataRef.current.domRef.current ); let adjustedActiveItemIndex = currentActiveItem ? sortedItems.indexOf(currentActiveItem) : null; if (adjustedActiveItemIndex === -1) { adjustedActiveItemIndex = null; } return { items: sortedItems, activeItemIndex: adjustedActiveItemIndex }; } var reducers5 = { [1 /* CloseMenu */](state) { if (state.menuState === 1 /* Closed */) return state; return { ...state, activeItemIndex: null, menuState: 1 /* Closed */ }; }, [0 /* OpenMenu */](state) { if (state.menuState === 0 /* Open */) return state; return { ...state, /* We can turn off demo mode once we re-open the `Menu` */ __demoMode: false, menuState: 0 /* Open */ }; }, [2 /* GoToItem */]: (state, action) => { var _a3; let adjustedState = adjustOrderedState3(state); let activeItemIndex = calculateActiveIndex(action, { resolveItems: () => adjustedState.items, resolveActiveIndex: () => adjustedState.activeItemIndex, resolveId: (item) => item.id, resolveDisabled: (item) => item.dataRef.current.disabled }); return { ...state, ...adjustedState, searchQuery: "", activeItemIndex, activationTrigger: (_a3 = action.trigger) != null ? _a3 : 1 /* Other */ }; }, [3 /* Search */]: (state, action) => { let wasAlreadySearching = state.searchQuery !== ""; let offset = wasAlreadySearching ? 0 : 1; let searchQuery = state.searchQuery + action.value.toLowerCase(); let reOrderedItems = state.activeItemIndex !== null ? state.items.slice(state.activeItemIndex + offset).concat(state.items.slice(0, state.activeItemIndex + offset)) : state.items; let matchingItem = reOrderedItems.find( (item) => { var _a3; return ((_a3 = item.dataRef.current.textValue) == null ? void 0 : _a3.startsWith(searchQuery)) && !item.dataRef.current.disabled; } ); let matchIdx = matchingItem ? state.items.indexOf(matchingItem) : -1; if (matchIdx === -1 || matchIdx === state.activeItemIndex) return { ...state, searchQuery }; return { ...state, searchQuery, activeItemIndex: matchIdx, activationTrigger: 1 /* Other */ }; }, [4 /* ClearSearch */](state) { if (state.searchQuery === "") return state; return { ...state, searchQuery: "", searchActiveItemIndex: null }; }, [5 /* RegisterItem */]: (state, action) => { let adjustedState = adjustOrderedState3(state, (items) => [ ...items, { id: action.id, dataRef: action.dataRef } ]); return { ...state, ...adjustedState }; }, [6 /* UnregisterItem */]: (state, action) => { let adjustedState = adjustOrderedState3(state, (items) => { let idx = items.findIndex((a) => a.id === action.id); if (idx !== -1) items.splice(idx, 1); return items; }); return { ...state, ...adjustedState, activationTrigger: 1 /* Other */ }; } }; var MenuContext = (0, import_react36.createContext)(null); MenuContext.displayName = "MenuContext"; function useMenuContext(component) { let context = (0, import_react36.useContext)(MenuContext); if (context === null) { let err = new Error(`<${component} /> is missing a parent component.`); if (Error.captureStackTrace) Error.captureStackTrace(err, useMenuContext); throw err; } return context; } function stateReducer5(state, action) { return match(action.type, reducers5, state, action); } var DEFAULT_MENU_TAG = import_react36.Fragment; function MenuFn(props, ref) { let { __demoMode = false, ...theirProps } = props; let reducerBag = (0, import_react36.useReducer)(stateReducer5, { __demoMode, menuState: __demoMode ? 0 /* Open */ : 1 /* Closed */, buttonRef: (0, import_react36.createRef)(), itemsRef: (0, import_react36.createRef)(), items: [], searchQuery: "", activeItemIndex: null, activationTrigger: 1 /* Other */ }); let [{ menuState, itemsRef, buttonRef }, dispatch] = reducerBag; let menuRef = useSyncRefs(ref); useOutsideClick( [buttonRef, itemsRef], (event, target) => { var _a3; dispatch({ type: 1 /* CloseMenu */ }); if (!isFocusableElement(target, 1 /* Loose */)) { event.preventDefault(); (_a3 = buttonRef.current) == null ? void 0 : _a3.focus(); } }, menuState === 0 /* Open */ ); let close = useEvent(() => { dispatch({ type: 1 /* CloseMenu */ }); }); let slot = (0, import_react36.useMemo)( () => ({ open: menuState === 0 /* Open */, close }), [menuState, close] ); let ourProps = { ref: menuRef }; return /* @__PURE__ */ import_react36.default.createElement(MenuContext.Provider, { value: reducerBag }, /* @__PURE__ */ import_react36.default.createElement( OpenClosedProvider, { value: match(menuState, { [0 /* Open */]: 1 /* Open */, [1 /* Closed */]: 2 /* Closed */ }) }, render({ ourProps, theirProps, slot, defaultTag: DEFAULT_MENU_TAG, name: "Menu" }) )); } var DEFAULT_BUTTON_TAG4 = "button"; function ButtonFn4(props, ref) { var _a3; let internalId = useId(); let { id = `headlessui-menu-button-${internalId}`, ...theirProps } = props; let [state, dispatch] = useMenuContext("Menu.Button"); let buttonRef = useSyncRefs(state.buttonRef, ref); let d = useDisposables(); let handleKeyDown = useEvent((event) => { switch (event.key) { case " " /* Space */: case "Enter" /* Enter */: case "ArrowDown" /* ArrowDown */: event.preventDefault(); event.stopPropagation(); dispatch({ type: 0 /* OpenMenu */ }); d.nextFrame(() => dispatch({ type: 2 /* GoToItem */, focus: 0 /* First */ })); break; case "ArrowUp" /* ArrowUp */: event.preventDefault(); event.stopPropagation(); dispatch({ type: 0 /* OpenMenu */ }); d.nextFrame(() => dispatch({ type: 2 /* GoToItem */, focus: 3 /* Last */ })); break; } }); let handleKeyUp = useEvent((event) => { switch (event.key) { case " " /* Space */: event.preventDefault(); break; } }); let handleClick = useEvent((event) => { if (isDisabledReactIssue7711(event.currentTarget)) return event.preventDefault(); if (props.disabled) return; if (state.menuState === 0 /* Open */) { dispatch({ type: 1 /* CloseMenu */ }); d.nextFrame(() => { var _a4; return (_a4 = state.buttonRef.current) == null ? void 0 : _a4.focus({ preventScroll: true }); }); } else { event.preventDefault(); dispatch({ type: 0 /* OpenMenu */ }); } }); let slot = (0, import_react36.useMemo)( () => ({ open: state.menuState === 0 /* Open */ }), [state] ); let ourProps = { ref: buttonRef, id, type: useResolveButtonType(props, state.buttonRef), "aria-haspopup": "menu", "aria-controls": (_a3 = state.itemsRef.current) == null ? void 0 : _a3.id, "aria-expanded": props.disabled ? void 0 : state.menuState === 0 /* Open */, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onClick: handleClick }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_BUTTON_TAG4, name: "Menu.Button" }); } var DEFAULT_ITEMS_TAG = "div"; var ItemsRenderFeatures = 1 /* RenderStrategy */ | 2 /* Static */; function ItemsFn(props, ref) { var _a3, _b; let internalId = useId(); let { id = `headlessui-menu-items-${internalId}`, ...theirProps } = props; let [state, dispatch] = useMenuContext("Menu.Items"); let itemsRef = useSyncRefs(state.itemsRef, ref); let ownerDocument = useOwnerDocument(state.itemsRef); let searchDisposables = useDisposables(); let usesOpenClosedState = useOpenClosed(); let visible = (() => { if (usesOpenClosedState !== null) { return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */; } return state.menuState === 0 /* Open */; })(); (0, import_react36.useEffect)(() => { let container = state.itemsRef.current; if (!container) return; if (state.menuState !== 0 /* Open */) return; if (container === (ownerDocument == null ? void 0 : ownerDocument.activeElement)) return; container.focus({ preventScroll: true }); }, [state.menuState, state.itemsRef, ownerDocument]); useTreeWalker({ container: state.itemsRef.current, enabled: state.menuState === 0 /* Open */, accept(node) { if (node.getAttribute("role") === "menuitem") return NodeFilter.FILTER_REJECT; if (node.hasAttribute("role")) return NodeFilter.FILTER_SKIP; return NodeFilter.FILTER_ACCEPT; }, walk(node) { node.setAttribute("role", "none"); } }); let handleKeyDown = useEvent((event) => { var _a4, _b2; searchDisposables.dispose(); switch (event.key) { case " " /* Space */: if (state.searchQuery !== "") { event.preventDefault(); event.stopPropagation(); return dispatch({ type: 3 /* Search */, value: event.key }); } case "Enter" /* Enter */: event.preventDefault(); event.stopPropagation(); dispatch({ type: 1 /* CloseMenu */ }); if (state.activeItemIndex !== null) { let { dataRef } = state.items[state.activeItemIndex]; (_b2 = (_a4 = dataRef.current) == null ? void 0 : _a4.domRef.current) == null ? void 0 : _b2.click(); } restoreFocusIfNecessary(state.buttonRef.current); break; case "ArrowDown" /* ArrowDown */: event.preventDefault(); event.stopPropagation(); return dispatch({ type: 2 /* GoToItem */, focus: 2 /* Next */ }); case "ArrowUp" /* ArrowUp */: event.preventDefault(); event.stopPropagation(); return dispatch({ type: 2 /* GoToItem */, focus: 1 /* Previous */ }); case "Home" /* Home */: case "PageUp" /* PageUp */: event.preventDefault(); event.stopPropagation(); return dispatch({ type: 2 /* GoToItem */, focus: 0 /* First */ }); case "End" /* End */: case "PageDown" /* PageDown */: event.preventDefault(); event.stopPropagation(); return dispatch({ type: 2 /* GoToItem */, focus: 3 /* Last */ }); case "Escape" /* Escape */: event.preventDefault(); event.stopPropagation(); dispatch({ type: 1 /* CloseMenu */ }); disposables().nextFrame(() => { var _a5; return (_a5 = state.buttonRef.current) == null ? void 0 : _a5.focus({ preventScroll: true }); }); break; case "Tab" /* Tab */: event.preventDefault(); event.stopPropagation(); dispatch({ type: 1 /* CloseMenu */ }); disposables().nextFrame(() => { focusFrom( state.buttonRef.current, event.shiftKey ? 2 /* Previous */ : 4 /* Next */ ); }); break; default: if (event.key.length === 1) { dispatch({ type: 3 /* Search */, value: event.key }); searchDisposables.setTimeout(() => dispatch({ type: 4 /* ClearSearch */ }), 350); } break; } }); let handleKeyUp = useEvent((event) => { switch (event.key) { case " " /* Space */: event.preventDefault(); break; } }); let slot = (0, import_react36.useMemo)( () => ({ open: state.menuState === 0 /* Open */ }), [state] ); let ourProps = { "aria-activedescendant": state.activeItemIndex === null ? void 0 : (_a3 = state.items[state.activeItemIndex]) == null ? void 0 : _a3.id, "aria-labelledby": (_b = state.buttonRef.current) == null ? void 0 : _b.id, id, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, role: "menu", tabIndex: 0, ref: itemsRef }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_ITEMS_TAG, features: ItemsRenderFeatures, visible, name: "Menu.Items" }); } var DEFAULT_ITEM_TAG = import_react36.Fragment; function ItemFn(props, ref) { let internalId = useId(); let { id = `headlessui-menu-item-${internalId}`, disabled = false, ...theirProps } = props; let [state, dispatch] = useMenuContext("Menu.Item"); let active = state.activeItemIndex !== null ? state.items[state.activeItemIndex].id === id : false; let internalItemRef = (0, import_react36.useRef)(null); let itemRef = useSyncRefs(ref, internalItemRef); useIsoMorphicEffect(() => { if (state.__demoMode) return; if (state.menuState !== 0 /* Open */) return; if (!active) return; if (state.activationTrigger === 0 /* Pointer */) return; let d = disposables(); d.requestAnimationFrame(() => { var _a3, _b; (_b = (_a3 = internalItemRef.current) == null ? void 0 : _a3.scrollIntoView) == null ? void 0 : _b.call(_a3, { block: "nearest" }); }); return d.dispose; }, [ state.__demoMode, internalItemRef, active, state.menuState, state.activationTrigger, /* We also want to trigger this when the position of the active item changes so that we can re-trigger the scrollIntoView */ state.activeItemIndex ]); let getTextValue2 = useTextValue(internalItemRef); let bag = (0, import_react36.useRef)({ disabled, domRef: internalItemRef, get textValue() { return getTextValue2(); } }); useIsoMorphicEffect(() => { bag.current.disabled = disabled; }, [bag, disabled]); useIsoMorphicEffect(() => { dispatch({ type: 5 /* RegisterItem */, id, dataRef: bag }); return () => dispatch({ type: 6 /* UnregisterItem */, id }); }, [bag, id]); let close = useEvent(() => { dispatch({ type: 1 /* CloseMenu */ }); }); let handleClick = useEvent((event) => { if (disabled) return event.preventDefault(); dispatch({ type: 1 /* CloseMenu */ }); restoreFocusIfNecessary(state.buttonRef.current); }); let handleFocus = useEvent(() => { if (disabled) return dispatch({ type: 2 /* GoToItem */, focus: 5 /* Nothing */ }); dispatch({ type: 2 /* GoToItem */, focus: 4 /* Specific */, id }); }); let pointer = useTrackedPointer(); let handleEnter = useEvent((evt) => pointer.update(evt)); let handleMove = useEvent((evt) => { if (!pointer.wasMoved(evt)) return; if (disabled) return; if (active) return; dispatch({ type: 2 /* GoToItem */, focus: 4 /* Specific */, id, trigger: 0 /* Pointer */ }); }); let handleLeave = useEvent((evt) => { if (!pointer.wasMoved(evt)) return; if (disabled) return; if (!active) return; dispatch({ type: 2 /* GoToItem */, focus: 5 /* Nothing */ }); }); let slot = (0, import_react36.useMemo)( () => ({ active, disabled, close }), [active, disabled, close] ); let ourProps = { id, ref: itemRef, role: "menuitem", tabIndex: disabled === true ? void 0 : -1, "aria-disabled": disabled === true ? true : void 0, disabled: void 0, // Never forward the `disabled` prop onClick: handleClick, onFocus: handleFocus, onPointerEnter: handleEnter, onMouseEnter: handleEnter, onPointerMove: handleMove, onMouseMove: handleMove, onPointerLeave: handleLeave, onMouseLeave: handleLeave }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_ITEM_TAG, name: "Menu.Item" }); } var MenuRoot = forwardRefWithAs(MenuFn); var Button4 = forwardRefWithAs(ButtonFn4); var Items = forwardRefWithAs(ItemsFn); var Item = forwardRefWithAs(ItemFn); var Menu = Object.assign(MenuRoot, { Button: Button4, Items, Item }); // src/components/popover/popover.tsx var import_react37 = __toESM(__webpack_require__(/*! react */ "react"), 1); var reducers6 = { [0 /* TogglePopover */]: (state) => { let nextState = { ...state, popoverState: match(state.popoverState, { [0 /* Open */]: 1 /* Closed */, [1 /* Closed */]: 0 /* Open */ }) }; if (nextState.popoverState === 0 /* Open */) { nextState.__demoMode = false; } return nextState; }, [1 /* ClosePopover */](state) { if (state.popoverState === 1 /* Closed */) return state; return { ...state, popoverState: 1 /* Closed */ }; }, [2 /* SetButton */](state, action) { if (state.button === action.button) return state; return { ...state, button: action.button }; }, [3 /* SetButtonId */](state, action) { if (state.buttonId === action.buttonId) return state; return { ...state, buttonId: action.buttonId }; }, [4 /* SetPanel */](state, action) { if (state.panel === action.panel) return state; return { ...state, panel: action.panel }; }, [5 /* SetPanelId */](state, action) { if (state.panelId === action.panelId) return state; return { ...state, panelId: action.panelId }; } }; var PopoverContext = (0, import_react37.createContext)(null); PopoverContext.displayName = "PopoverContext"; function usePopoverContext(component) { let context = (0, import_react37.useContext)(PopoverContext); if (context === null) { let err = new Error(`<${component} /> is missing a parent component.`); if (Error.captureStackTrace) Error.captureStackTrace(err, usePopoverContext); throw err; } return context; } var PopoverAPIContext = (0, import_react37.createContext)(null); PopoverAPIContext.displayName = "PopoverAPIContext"; function usePopoverAPIContext(component) { let context = (0, import_react37.useContext)(PopoverAPIContext); if (context === null) { let err = new Error(`<${component} /> is missing a parent component.`); if (Error.captureStackTrace) Error.captureStackTrace(err, usePopoverAPIContext); throw err; } return context; } var PopoverGroupContext = (0, import_react37.createContext)(null); PopoverGroupContext.displayName = "PopoverGroupContext"; function usePopoverGroupContext() { return (0, import_react37.useContext)(PopoverGroupContext); } var PopoverPanelContext = (0, import_react37.createContext)(null); PopoverPanelContext.displayName = "PopoverPanelContext"; function usePopoverPanelContext() { return (0, import_react37.useContext)(PopoverPanelContext); } function stateReducer6(state, action) { return match(action.type, reducers6, state, action); } var DEFAULT_POPOVER_TAG = "div"; function PopoverFn(props, ref) { var _a3; let { __demoMode = false, ...theirProps } = props; let internalPopoverRef = (0, import_react37.useRef)(null); let popoverRef = useSyncRefs( ref, optionalRef((ref2) => { internalPopoverRef.current = ref2; }) ); let buttons = (0, import_react37.useRef)([]); let reducerBag = (0, import_react37.useReducer)(stateReducer6, { __demoMode, popoverState: __demoMode ? 0 /* Open */ : 1 /* Closed */, buttons, button: null, buttonId: null, panel: null, panelId: null, beforePanelSentinel: (0, import_react37.createRef)(), afterPanelSentinel: (0, import_react37.createRef)() }); let [ { popoverState, button, buttonId, panel, panelId, beforePanelSentinel, afterPanelSentinel }, dispatch ] = reducerBag; let ownerDocument = useOwnerDocument((_a3 = internalPopoverRef.current) != null ? _a3 : button); let isPortalled = (0, import_react37.useMemo)(() => { if (!button) return false; if (!panel) return false; for (let root2 of document.querySelectorAll("body > *")) { if (Number(root2 == null ? void 0 : root2.contains(button)) ^ Number(root2 == null ? void 0 : root2.contains(panel))) { return true; } } let elements = getFocusableElements(); let buttonIdx = elements.indexOf(button); let beforeIdx = (buttonIdx + elements.length - 1) % elements.length; let afterIdx = (buttonIdx + 1) % elements.length; let beforeElement = elements[beforeIdx]; let afterElement = elements[afterIdx]; if (!panel.contains(beforeElement) && !panel.contains(afterElement)) { return true; } return false; }, [button, panel]); let buttonIdRef = useLatestValue(buttonId); let panelIdRef = useLatestValue(panelId); let registerBag = (0, import_react37.useMemo)( () => ({ buttonId: buttonIdRef, panelId: panelIdRef, close: () => dispatch({ type: 1 /* ClosePopover */ }) }), [buttonIdRef, panelIdRef, dispatch] ); let groupContext = usePopoverGroupContext(); let registerPopover = groupContext == null ? void 0 : groupContext.registerPopover; let isFocusWithinPopoverGroup = useEvent(() => { var _a4; return (_a4 = groupContext == null ? void 0 : groupContext.isFocusWithinPopoverGroup()) != null ? _a4 : (ownerDocument == null ? void 0 : ownerDocument.activeElement) && ((button == null ? void 0 : button.contains(ownerDocument.activeElement)) || (panel == null ? void 0 : panel.contains(ownerDocument.activeElement))); }); (0, import_react37.useEffect)(() => registerPopover == null ? void 0 : registerPopover(registerBag), [registerPopover, registerBag]); let [portals, PortalWrapper] = useNestedPortals(); let root = useRootContainers({ portals, defaultContainers: [button, panel] }); useEventListener( ownerDocument == null ? void 0 : ownerDocument.defaultView, "focus", (event) => { var _a4, _b, _c, _d; if (event.target === window) return; if (!(event.target instanceof HTMLElement)) return; if (popoverState !== 0 /* Open */) return; if (isFocusWithinPopoverGroup()) return; if (!button) return; if (!panel) return; if (root.contains(event.target)) return; if ((_b = (_a4 = beforePanelSentinel.current) == null ? void 0 : _a4.contains) == null ? void 0 : _b.call(_a4, event.target)) return; if ((_d = (_c = afterPanelSentinel.current) == null ? void 0 : _c.contains) == null ? void 0 : _d.call(_c, event.target)) return; dispatch({ type: 1 /* ClosePopover */ }); }, true ); useOutsideClick( root.resolveContainers, (event, target) => { dispatch({ type: 1 /* ClosePopover */ }); if (!isFocusableElement(target, 1 /* Loose */)) { event.preventDefault(); button == null ? void 0 : button.focus(); } }, popoverState === 0 /* Open */ ); let close = useEvent( (focusableElement) => { dispatch({ type: 1 /* ClosePopover */ }); let restoreElement = (() => { if (!focusableElement) return button; if (focusableElement instanceof HTMLElement) return focusableElement; if ("current" in focusableElement && focusableElement.current instanceof HTMLElement) return focusableElement.current; return button; })(); restoreElement == null ? void 0 : restoreElement.focus(); } ); let api = (0, import_react37.useMemo)( () => ({ close, isPortalled }), [close, isPortalled] ); let slot = (0, import_react37.useMemo)( () => ({ open: popoverState === 0 /* Open */, close }), [popoverState, close] ); let ourProps = { ref: popoverRef }; return /* @__PURE__ */ import_react37.default.createElement(PopoverPanelContext.Provider, { value: null }, /* @__PURE__ */ import_react37.default.createElement(PopoverContext.Provider, { value: reducerBag }, /* @__PURE__ */ import_react37.default.createElement(PopoverAPIContext.Provider, { value: api }, /* @__PURE__ */ import_react37.default.createElement( OpenClosedProvider, { value: match(popoverState, { [0 /* Open */]: 1 /* Open */, [1 /* Closed */]: 2 /* Closed */ }) }, /* @__PURE__ */ import_react37.default.createElement(PortalWrapper, null, render({ ourProps, theirProps, slot, defaultTag: DEFAULT_POPOVER_TAG, name: "Popover" }), /* @__PURE__ */ import_react37.default.createElement(root.MainTreeNode, null)) )))); } var DEFAULT_BUTTON_TAG5 = "button"; function ButtonFn5(props, ref) { let internalId = useId(); let { id = `headlessui-popover-button-${internalId}`, ...theirProps } = props; let [state, dispatch] = usePopoverContext("Popover.Button"); let { isPortalled } = usePopoverAPIContext("Popover.Button"); let internalButtonRef = (0, import_react37.useRef)(null); let sentinelId = `headlessui-focus-sentinel-${useId()}`; let groupContext = usePopoverGroupContext(); let closeOthers = groupContext == null ? void 0 : groupContext.closeOthers; let panelContext = usePopoverPanelContext(); let isWithinPanel = panelContext !== null; (0, import_react37.useEffect)(() => { if (isWithinPanel) return; dispatch({ type: 3 /* SetButtonId */, buttonId: id }); return () => { dispatch({ type: 3 /* SetButtonId */, buttonId: null }); }; }, [isWithinPanel, id, dispatch]); let [uniqueIdentifier] = (0, import_react37.useState)(() => Symbol()); let buttonRef = useSyncRefs( internalButtonRef, ref, isWithinPanel ? null : (button) => { if (button) { state.buttons.current.push(uniqueIdentifier); } else { let idx = state.buttons.current.indexOf(uniqueIdentifier); if (idx !== -1) state.buttons.current.splice(idx, 1); } if (state.buttons.current.length > 1) { console.warn( "You are already using a but only 1 is supported." ); } button && dispatch({ type: 2 /* SetButton */, button }); } ); let withinPanelButtonRef = useSyncRefs(internalButtonRef, ref); let ownerDocument = useOwnerDocument(internalButtonRef); let handleKeyDown = useEvent((event) => { var _a3, _b, _c; if (isWithinPanel) { if (state.popoverState === 1 /* Closed */) return; switch (event.key) { case " " /* Space */: case "Enter" /* Enter */: event.preventDefault(); (_b = (_a3 = event.target).click) == null ? void 0 : _b.call(_a3); dispatch({ type: 1 /* ClosePopover */ }); (_c = state.button) == null ? void 0 : _c.focus(); break; } } else { switch (event.key) { case " " /* Space */: case "Enter" /* Enter */: event.preventDefault(); event.stopPropagation(); if (state.popoverState === 1 /* Closed */) closeOthers == null ? void 0 : closeOthers(state.buttonId); dispatch({ type: 0 /* TogglePopover */ }); break; case "Escape" /* Escape */: if (state.popoverState !== 0 /* Open */) return closeOthers == null ? void 0 : closeOthers(state.buttonId); if (!internalButtonRef.current) return; if ((ownerDocument == null ? void 0 : ownerDocument.activeElement) && !internalButtonRef.current.contains(ownerDocument.activeElement)) { return; } event.preventDefault(); event.stopPropagation(); dispatch({ type: 1 /* ClosePopover */ }); break; } } }); let handleKeyUp = useEvent((event) => { if (isWithinPanel) return; if (event.key === " " /* Space */) { event.preventDefault(); } }); let handleClick = useEvent((event) => { var _a3, _b; if (isDisabledReactIssue7711(event.currentTarget)) return; if (props.disabled) return; if (isWithinPanel) { dispatch({ type: 1 /* ClosePopover */ }); (_a3 = state.button) == null ? void 0 : _a3.focus(); } else { event.preventDefault(); event.stopPropagation(); if (state.popoverState === 1 /* Closed */) closeOthers == null ? void 0 : closeOthers(state.buttonId); dispatch({ type: 0 /* TogglePopover */ }); (_b = state.button) == null ? void 0 : _b.focus(); } }); let handleMouseDown = useEvent((event) => { event.preventDefault(); event.stopPropagation(); }); let visible = state.popoverState === 0 /* Open */; let slot = (0, import_react37.useMemo)(() => ({ open: visible }), [visible]); let type = useResolveButtonType(props, internalButtonRef); let ourProps = isWithinPanel ? { ref: withinPanelButtonRef, type, onKeyDown: handleKeyDown, onClick: handleClick } : { ref: buttonRef, id: state.buttonId, type, "aria-expanded": props.disabled ? void 0 : state.popoverState === 0 /* Open */, "aria-controls": state.panel ? state.panelId : void 0, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onClick: handleClick, onMouseDown: handleMouseDown }; let direction = useTabDirection(); let handleFocus = useEvent(() => { let el = state.panel; if (!el) return; function run() { let result = match(direction.current, { [0 /* Forwards */]: () => focusIn(el, 1 /* First */), [1 /* Backwards */]: () => focusIn(el, 8 /* Last */) }); if (result === 0 /* Error */) { focusIn( getFocusableElements().filter((el2) => el2.dataset.headlessuiFocusGuard !== "true"), match(direction.current, { [0 /* Forwards */]: 4 /* Next */, [1 /* Backwards */]: 2 /* Previous */ }), { relativeTo: state.button } ); } } if (false) {} else { run(); } }); return /* @__PURE__ */ import_react37.default.createElement(import_react37.default.Fragment, null, render({ ourProps, theirProps, slot, defaultTag: DEFAULT_BUTTON_TAG5, name: "Popover.Button" }), visible && !isWithinPanel && isPortalled && /* @__PURE__ */ import_react37.default.createElement( Hidden, { id: sentinelId, features: 2 /* Focusable */, "data-headlessui-focus-guard": true, as: "button", type: "button", onFocus: handleFocus } )); } var DEFAULT_OVERLAY_TAG2 = "div"; var OverlayRenderFeatures = 1 /* RenderStrategy */ | 2 /* Static */; function OverlayFn2(props, ref) { let internalId = useId(); let { id = `headlessui-popover-overlay-${internalId}`, ...theirProps } = props; let [{ popoverState }, dispatch] = usePopoverContext("Popover.Overlay"); let overlayRef = useSyncRefs(ref); let usesOpenClosedState = useOpenClosed(); let visible = (() => { if (usesOpenClosedState !== null) { return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */; } return popoverState === 0 /* Open */; })(); let handleClick = useEvent((event) => { if (isDisabledReactIssue7711(event.currentTarget)) return event.preventDefault(); dispatch({ type: 1 /* ClosePopover */ }); }); let slot = (0, import_react37.useMemo)( () => ({ open: popoverState === 0 /* Open */ }), [popoverState] ); let ourProps = { ref: overlayRef, id, "aria-hidden": true, onClick: handleClick }; return render({ ourProps, theirProps, slot, defaultTag: DEFAULT_OVERLAY_TAG2, features: OverlayRenderFeatures, visible, name: "Popover.Overlay" }); } var DEFAULT_PANEL_TAG3 = "div"; var PanelRenderFeatures2 = 1 /* RenderStrategy */ | 2 /* Static */; function PanelFn3(props, ref) { let internalId = useId(); let { id = `headlessui-popover-panel-${internalId}`, focus = false, ...theirProps } = props; let [state, dispatch] = usePopoverContext("Popover.Panel"); let { close, isPortalled } = usePopoverAPIContext("Popover.Panel"); let beforePanelSentinelId = `headlessui-focus-sentinel-before-${useId()}`; let afterPanelSentinelId = `headlessui-focus-sentinel-after-${useId()}`; let internalPanelRef = (0, import_react37.useRef)(null); let panelRef = useSyncRefs(internalPanelRef, ref, (panel) => { dispatch({ type: 4 /* SetPanel */, panel }); }); let ownerDocument = useOwnerDocument(internalPanelRef); useIsoMorphicEffect(() => { dispatch({ type: 5 /* SetPanelId */, panelId: id }); return () => { dispatch({ type: 5 /* SetPanelId */, panelId: null }); }; }, [id, dispatch]); let usesOpenClosedState = useOpenClosed(); let visible = (() => { if (usesOpenClosedState !== null) { return (usesOpenClosedState & 1 /* Open */) === 1 /* Open */; } return state.popoverState === 0 /* Open */; })(); let handleKeyDown = useEvent((event) => { var _a3; switch (event.key) { case "Escape" /* Escape */: if (state.popoverState !== 0 /* Open */) return; if (!internalPanelRef.current) return; if ((ownerDocument == null ? void 0 : ownerDocument.activeElement) && !internalPanelRef.current.contains(ownerDocument.activeElement)) { return; } event.preventDefault(); event.stopPropagation(); dispatch({ type: 1 /* ClosePopover */ }); (_a3 = state.button) == null ? void 0 : _a3.focus(); break; } }); (0, import_react37.useEffect)(() => { var _a3; if (props.static) return; if (state.popoverState === 1 /* Closed */ && ((_a3 = props.unmount) != null ? _a3 : true)) { dispatch({ type: 4 /* SetPanel */, panel: null }); } }, [state.popoverState, props.unmount, props.static, dispatch]); (0, import_react37.useEffect)(() => { if (state.__demoMode) return; if (!focus) return; if (state.popoverState !== 0 /* Open */) return; if (!internalPanelRef.current) return; let activeElement = ownerDocument == null ? void 0 : ownerDocument.activeElement; if (internalPanelRef.current.contains(activeElement)) return; focusIn(internalPanelRef.current, 1 /* First */); }, [state.__demoMode, focus, internalPanelRef, state.popoverState]); let slot = (0, import_react37.useMemo)( () => ({ open: state.popoverState === 0 /* Open */, close }), [state, close] ); let ourProps = { ref: panelRef, id, onKeyDown: handleKeyDown, onBlur: focus && state.popoverState === 0 /* Open */ ? (event) => { var _a3, _b, _c, _d, _e; let el = event.relatedTarget; if (!el) return; if (!internalPanelRef.current) return; if ((_a3 = internalPanelRef.current) == null ? void 0 : _a3.contains(el)) return; dispatch({ type: 1 /* ClosePopover */ }); if (((_c = (_b = state.beforePanelSentinel.current) == null ? void 0 : _b.contains) == null ? void 0 : _c.call(_b, el)) || ((_e = (_d = state.afterPanelSentinel.current) == null ? void 0 : _d.contains) == null ? void 0 : _e.call(_d, el))) { el.focus({ preventScroll: true }); } } : void 0, tabIndex: -1 }; let direction = useTabDirection(); let handleBeforeFocus = useEvent(() => { let el = internalPanelRef.current; if (!el) return; function run() { match(direction.current, { [0 /* Forwards */]: () => { var _a3; let result = focusIn(el, 1 /* First */); if (result === 0 /* Error */) { (_a3 = state.afterPanelSentinel.current) == null ? void 0 : _a3.focus(); } }, [1 /* Backwards */]: () => { var _a3; (_a3 = state.button) == null ? void 0 : _a3.focus({ preventScroll: true }); } }); } if (false) {} else { run(); } }); let handleAfterFocus = useEvent(() => { let el = internalPanelRef.current; if (!el) return; function run() { match(direction.current, { [0 /* Forwards */]: () => { var _a3; if (!state.button) return; let elements = getFocusableElements(); let idx = elements.indexOf(state.button); let before = elements.slice(0, idx + 1); let after = elements.slice(idx + 1); let combined = [...after, ...before]; for (let element of combined.slice()) { if (element.dataset.headlessuiFocusGuard === "true" || ((_a3 = state.panel) == null ? void 0 : _a3.contains(element))) { let idx2 = combined.indexOf(element); if (idx2 !== -1) combined.splice(idx2, 1); } } focusIn(combined, 1 /* First */, { sorted: false }); }, [1 /* Backwards */]: () => { var _a3; let result = focusIn(el, 2 /* Previous */); if (result === 0 /* Error */) { (_a3 = state.button) == null ? void 0 : _a3.focus(); } } }); } if (false) {} else { run(); } }); return /* @__PURE__ */ import_react37.default.createElement(PopoverPanelContext.Provider, { value: id }, visible && isPortalled && /* @__PURE__ */ import_react37.default.createElement( Hidden, { id: beforePanelSentinelId, ref: state.beforePanelSentinel, features: 2 /* Focusable */, "data-headlessui-focus-guard": true, as: "button", type: "button", onFocus: handleBeforeFocus } ), render({ ourProps, theirProps, slot, defaultTag: DEFAULT_PANEL_TAG3, features: PanelRenderFeatures2, visible, name: "Popover.Panel" }), visible && isPortalled && /* @__PURE__ */ import_react37.default.createElement( Hidden, { id: afterPanelSentinelId, ref: state.afterPanelSentinel, features: 2 /* Focusable */, "data-headlessui-focus-guard": true, as: "button", type: "button", onFocus: handleAfterFocus } )); } var DEFAULT_GROUP_TAG2 = "div"; function GroupFn2(props, ref) { let internalGroupRef = (0, import_react37.useRef)(null); let groupRef = useSyncRefs(internalGroupRef, ref); let [popovers, setPopovers] = (0, import_react37.useState)([]); let unregisterPopover = useEvent((registerbag) => { setPopovers((existing) => { let idx = existing.indexOf(registerbag); if (idx !== -1) { let clone = existing.slice(); clone.splice(idx, 1); return clone; } return existing; }); }); let registerPopover = useEvent((registerbag) => { setPopovers((existing) => [...existing, registerbag]); return () => unregisterPopover(registerbag); }); let isFocusWithinPopoverGroup = useEvent(() => { var _a3; let ownerDocument = getOwnerDocument(internalGroupRef); if (!ownerDocument) return false; let element = ownerDocument.activeElement; if ((_a3 = internalGroupRef.current) == null ? void 0 : _a3.contains(element)) return true; return popovers.some((bag) => { var _a4, _b; return ((_a4 = ownerDocument.getElementById(bag.buttonId.current)) == null ? void 0 : _a4.contains(element)) || ((_b = ownerDocument.getElementById(bag.panelId.current)) == null ? void 0 : _b.contains(element)); }); }); let closeOthers = useEvent((buttonId) => { for (let popover of popovers) { if (popover.buttonId.current !== buttonId) popover.close(); } }); let contextBag = (0, import_react37.useMemo)( () => ({ registerPopover, unregisterPopover, isFocusWithinPopoverGroup, closeOthers }), [registerPopover, unregisterPopover, isFocusWithinPopoverGroup, closeOthers] ); let slot = (0, import_react37.useMemo)(() => ({}), []); let theirProps = props; let ourProps = { ref: groupRef }; return /* @__PURE__ */ import_react37.default.createElement(PopoverGroupContext.Provider, { value: contextBag }, render({ ourProps, theirProps, slot, defaultTag: DEFAULT_GROUP_TAG2, name: "Popover.Group" })); } var PopoverRoot = forwardRefWithAs(PopoverFn); var Button5 = forwardRefWithAs(ButtonFn5); var Overlay2 = forwardRefWithAs(OverlayFn2); var Panel3 = forwardRefWithAs(PanelFn3); var Group2 = forwardRefWithAs(GroupFn2); var Popover = Object.assign(PopoverRoot, { Button: Button5, Overlay: Overlay2, Panel: Panel3, Group: Group2 }); // src/components/radio-group/radio-group.tsx var import_react40 = __toESM(__webpack_require__(/*! react */ "react"), 1); // src/hooks/use-flags.ts var import_react38 = __webpack_require__(/*! react */ "react"); function useFlags(initialFlags = 0) { let [flags, setFlags] = (0, import_react38.useState)(initialFlags); let mounted = useIsMounted(); let addFlag = (0, import_react38.useCallback)( (flag) => { if (!mounted.current) return; setFlags((flags2) => flags2 | flag); }, [flags, mounted] ); let hasFlag = (0, import_react38.useCallback)((flag) => Boolean(flags & flag), [flags]); let removeFlag = (0, import_react38.useCallback)( (flag) => { if (!mounted.current) return; setFlags((flags2) => flags2 & ~flag); }, [setFlags, mounted] ); let toggleFlag = (0, import_react38.useCallback)( (flag) => { if (!mounted.current) return; setFlags((flags2) => flags2 ^ flag); }, [setFlags] ); return { flags, addFlag, hasFlag, removeFlag, toggleFlag }; } // src/components/label/label.tsx var import_react39 = __toESM(__webpack_require__(/*! react */ "react"), 1); var LabelContext = (0, import_react39.createContext)( null ); function useLabelContext() { let context = (0, import_react39.useContext)(LabelContext); if (context === null) { let err = new Error("You used a