diff --git a/apps/OpenSign/public/static/js/public-template.bundle.js b/apps/OpenSign/public/static/js/public-template.bundle.js index 8cf5c66ec..b762cd6b0 100644 --- a/apps/OpenSign/public/static/js/public-template.bundle.js +++ b/apps/OpenSign/public/static/js/public-template.bundle.js @@ -11,23 +11,24 @@ return /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ "./node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js": +/***/ "./node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js": /*!*******************************************************************************!*\ - !*** ./node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js ***! + !*** ./node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js ***! \*******************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ "default": () => (/* binding */ isPropValid) /* harmony export */ }); -/* harmony import */ var _emotion_memoize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @emotion/memoize */ "./node_modules/@emotion/is-prop-valid/node_modules/@emotion/memoize/dist/memoize.browser.esm.js"); +/* harmony import */ var _emotion_memoize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @emotion/memoize */ "./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js"); -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 +// eslint-disable-next-line no-undef +var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|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|disableRemotePlayback|download|draggable|encType|enterKeyHint|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|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|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,_emotion_memoize__WEBPACK_IMPORTED_MODULE_0__["default"])(function (prop) { +var isPropValid = /* #__PURE__ */(0,_emotion_memoize__WEBPACK_IMPORTED_MODULE_0__["default"])(function (prop) { return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 /* o */ && prop.charCodeAt(1) === 110 @@ -37,15 +38,39 @@ var index = (0,_emotion_memoize__WEBPACK_IMPORTED_MODULE_0__["default"])(functio /* Z+1 */ ); -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (index); + /***/ }), -/***/ "./node_modules/@emotion/is-prop-valid/node_modules/@emotion/memoize/dist/memoize.browser.esm.js": -/*!*******************************************************************************************************!*\ - !*** ./node_modules/@emotion/is-prop-valid/node_modules/@emotion/memoize/dist/memoize.browser.esm.js ***! - \*******************************************************************************************************/ +/***/ "./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ memoize) +/* harmony export */ }); +function memoize(fn) { + var cache = Object.create(null); + return function (arg) { + if (cache[arg] === undefined) cache[arg] = fn(arg); + return cache[arg]; + }; +} + + + + +/***/ }), + +/***/ "./node_modules/@emotion/stylis/dist/stylis.browser.esm.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@emotion/stylis/dist/stylis.browser.esm.js ***! + \*****************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; @@ -53,15 +78,621 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); -function memoize(fn) { - var cache = {}; - return function (arg) { - if (cache[arg] === undefined) cache[arg] = fn(arg); - return cache[arg]; - }; +function stylis_min (W) { + function M(d, c, e, h, a) { + for (var m = 0, b = 0, v = 0, n = 0, q, g, x = 0, K = 0, k, u = k = q = 0, l = 0, r = 0, I = 0, t = 0, B = e.length, J = B - 1, y, f = '', p = '', F = '', G = '', C; l < B;) { + g = e.charCodeAt(l); + l === J && 0 !== b + n + v + m && (0 !== b && (g = 47 === b ? 10 : 47), n = v = m = 0, B++, J++); + + if (0 === b + n + v + m) { + if (l === J && (0 < r && (f = f.replace(N, '')), 0 < f.trim().length)) { + switch (g) { + case 32: + case 9: + case 59: + case 13: + case 10: + break; + + default: + f += e.charAt(l); + } + + g = 59; + } + + switch (g) { + case 123: + f = f.trim(); + q = f.charCodeAt(0); + k = 1; + + for (t = ++l; l < B;) { + switch (g = e.charCodeAt(l)) { + case 123: + k++; + break; + + case 125: + k--; + break; + + case 47: + switch (g = e.charCodeAt(l + 1)) { + case 42: + case 47: + a: { + for (u = l + 1; u < J; ++u) { + switch (e.charCodeAt(u)) { + case 47: + if (42 === g && 42 === e.charCodeAt(u - 1) && l + 2 !== u) { + l = u + 1; + break a; + } + + break; + + case 10: + if (47 === g) { + l = u + 1; + break a; + } + + } + } + + l = u; + } + + } + + break; + + case 91: + g++; + + case 40: + g++; + + case 34: + case 39: + for (; l++ < J && e.charCodeAt(l) !== g;) { + } + + } + + if (0 === k) break; + l++; + } + + k = e.substring(t, l); + 0 === q && (q = (f = f.replace(ca, '').trim()).charCodeAt(0)); + + switch (q) { + case 64: + 0 < r && (f = f.replace(N, '')); + g = f.charCodeAt(1); + + switch (g) { + case 100: + case 109: + case 115: + case 45: + r = c; + break; + + default: + r = O; + } + + k = M(c, r, k, g, a + 1); + t = k.length; + 0 < A && (r = X(O, f, I), C = H(3, k, r, c, D, z, t, g, a, h), f = r.join(''), void 0 !== C && 0 === (t = (k = C.trim()).length) && (g = 0, k = '')); + if (0 < t) switch (g) { + case 115: + f = f.replace(da, ea); + + case 100: + case 109: + case 45: + k = f + '{' + k + '}'; + break; + + case 107: + f = f.replace(fa, '$1 $2'); + k = f + '{' + k + '}'; + k = 1 === w || 2 === w && L('@' + k, 3) ? '@-webkit-' + k + '@' + k : '@' + k; + break; + + default: + k = f + k, 112 === h && (k = (p += k, '')); + } else k = ''; + break; + + default: + k = M(c, X(c, f, I), k, h, a + 1); + } + + F += k; + k = I = r = u = q = 0; + f = ''; + g = e.charCodeAt(++l); + break; + + case 125: + case 59: + f = (0 < r ? f.replace(N, '') : f).trim(); + if (1 < (t = f.length)) switch (0 === u && (q = f.charCodeAt(0), 45 === q || 96 < q && 123 > q) && (t = (f = f.replace(' ', ':')).length), 0 < A && void 0 !== (C = H(1, f, c, d, D, z, p.length, h, a, h)) && 0 === (t = (f = C.trim()).length) && (f = '\x00\x00'), q = f.charCodeAt(0), g = f.charCodeAt(1), q) { + case 0: + break; + + case 64: + if (105 === g || 99 === g) { + G += f + e.charAt(l); + break; + } + + default: + 58 !== f.charCodeAt(t - 1) && (p += P(f, q, g, f.charCodeAt(2))); + } + I = r = u = q = 0; + f = ''; + g = e.charCodeAt(++l); + } + } + + switch (g) { + case 13: + case 10: + 47 === b ? b = 0 : 0 === 1 + q && 107 !== h && 0 < f.length && (r = 1, f += '\x00'); + 0 < A * Y && H(0, f, c, d, D, z, p.length, h, a, h); + z = 1; + D++; + break; + + case 59: + case 125: + if (0 === b + n + v + m) { + z++; + break; + } + + default: + z++; + y = e.charAt(l); + + switch (g) { + case 9: + case 32: + if (0 === n + m + b) switch (x) { + case 44: + case 58: + case 9: + case 32: + y = ''; + break; + + default: + 32 !== g && (y = ' '); + } + break; + + case 0: + y = '\\0'; + break; + + case 12: + y = '\\f'; + break; + + case 11: + y = '\\v'; + break; + + case 38: + 0 === n + b + m && (r = I = 1, y = '\f' + y); + break; + + case 108: + if (0 === n + b + m + E && 0 < u) switch (l - u) { + case 2: + 112 === x && 58 === e.charCodeAt(l - 3) && (E = x); + + case 8: + 111 === K && (E = K); + } + break; + + case 58: + 0 === n + b + m && (u = l); + break; + + case 44: + 0 === b + v + n + m && (r = 1, y += '\r'); + break; + + case 34: + case 39: + 0 === b && (n = n === g ? 0 : 0 === n ? g : n); + break; + + case 91: + 0 === n + b + v && m++; + break; + + case 93: + 0 === n + b + v && m--; + break; + + case 41: + 0 === n + b + m && v--; + break; + + case 40: + if (0 === n + b + m) { + if (0 === q) switch (2 * x + 3 * K) { + case 533: + break; + + default: + q = 1; + } + v++; + } + + break; + + case 64: + 0 === b + v + n + m + u + k && (k = 1); + break; + + case 42: + case 47: + if (!(0 < n + m + v)) switch (b) { + case 0: + switch (2 * g + 3 * e.charCodeAt(l + 1)) { + case 235: + b = 47; + break; + + case 220: + t = l, b = 42; + } + + break; + + case 42: + 47 === g && 42 === x && t + 2 !== l && (33 === e.charCodeAt(t + 2) && (p += e.substring(t, l + 1)), y = '', b = 0); + } + } + + 0 === b && (f += y); + } + + K = x; + x = g; + l++; + } + + t = p.length; + + if (0 < t) { + r = c; + if (0 < A && (C = H(2, p, r, d, D, z, t, h, a, h), void 0 !== C && 0 === (p = C).length)) return G + p + F; + p = r.join(',') + '{' + p + '}'; + + if (0 !== w * E) { + 2 !== w || L(p, 2) || (E = 0); + + switch (E) { + case 111: + p = p.replace(ha, ':-moz-$1') + p; + break; + + case 112: + p = p.replace(Q, '::-webkit-input-$1') + p.replace(Q, '::-moz-$1') + p.replace(Q, ':-ms-input-$1') + p; + } + + E = 0; + } + } + + return G + p + F; + } + + function X(d, c, e) { + var h = c.trim().split(ia); + c = h; + var a = h.length, + m = d.length; + + switch (m) { + case 0: + case 1: + var b = 0; + + for (d = 0 === m ? '' : d[0] + ' '; b < a; ++b) { + c[b] = Z(d, c[b], e).trim(); + } + + break; + + default: + var v = b = 0; + + for (c = []; b < a; ++b) { + for (var n = 0; n < m; ++n) { + c[v++] = Z(d[n] + ' ', h[b], e).trim(); + } + } + + } + + return c; + } + + function Z(d, c, e) { + var h = c.charCodeAt(0); + 33 > h && (h = (c = c.trim()).charCodeAt(0)); + + switch (h) { + case 38: + return c.replace(F, '$1' + d.trim()); + + case 58: + return d.trim() + c.replace(F, '$1' + d.trim()); + + default: + if (0 < 1 * e && 0 < c.indexOf('\f')) return c.replace(F, (58 === d.charCodeAt(0) ? '' : '$1') + d.trim()); + } + + return d + c; + } + + function P(d, c, e, h) { + var a = d + ';', + m = 2 * c + 3 * e + 4 * h; + + if (944 === m) { + d = a.indexOf(':', 9) + 1; + var b = a.substring(d, a.length - 1).trim(); + b = a.substring(0, d).trim() + b + ';'; + return 1 === w || 2 === w && L(b, 1) ? '-webkit-' + b + b : b; + } + + if (0 === w || 2 === w && !L(a, 1)) return a; + + switch (m) { + case 1015: + return 97 === a.charCodeAt(10) ? '-webkit-' + a + a : a; + + case 951: + return 116 === a.charCodeAt(3) ? '-webkit-' + a + a : a; + + case 963: + return 110 === a.charCodeAt(5) ? '-webkit-' + a + a : a; + + case 1009: + if (100 !== a.charCodeAt(4)) break; + + case 969: + case 942: + return '-webkit-' + a + a; + + case 978: + return '-webkit-' + a + '-moz-' + a + a; + + case 1019: + case 983: + return '-webkit-' + a + '-moz-' + a + '-ms-' + a + a; + + case 883: + if (45 === a.charCodeAt(8)) return '-webkit-' + a + a; + if (0 < a.indexOf('image-set(', 11)) return a.replace(ja, '$1-webkit-$2') + a; + break; + + case 932: + if (45 === a.charCodeAt(4)) switch (a.charCodeAt(5)) { + case 103: + return '-webkit-box-' + a.replace('-grow', '') + '-webkit-' + a + '-ms-' + a.replace('grow', 'positive') + a; + + case 115: + return '-webkit-' + a + '-ms-' + a.replace('shrink', 'negative') + a; + + case 98: + return '-webkit-' + a + '-ms-' + a.replace('basis', 'preferred-size') + a; + } + return '-webkit-' + a + '-ms-' + a + a; + + case 964: + return '-webkit-' + a + '-ms-flex-' + a + a; + + case 1023: + if (99 !== a.charCodeAt(8)) break; + b = a.substring(a.indexOf(':', 15)).replace('flex-', '').replace('space-between', 'justify'); + return '-webkit-box-pack' + b + '-webkit-' + a + '-ms-flex-pack' + b + a; + + case 1005: + return ka.test(a) ? a.replace(aa, ':-webkit-') + a.replace(aa, ':-moz-') + a : a; + + case 1e3: + b = a.substring(13).trim(); + c = b.indexOf('-') + 1; + + switch (b.charCodeAt(0) + b.charCodeAt(c)) { + case 226: + b = a.replace(G, 'tb'); + break; + + case 232: + b = a.replace(G, 'tb-rl'); + break; + + case 220: + b = a.replace(G, 'lr'); + break; + + default: + return a; + } + + return '-webkit-' + a + '-ms-' + b + a; + + case 1017: + if (-1 === a.indexOf('sticky', 9)) break; + + case 975: + c = (a = d).length - 10; + b = (33 === a.charCodeAt(c) ? a.substring(0, c) : a).substring(d.indexOf(':', 7) + 1).trim(); + + switch (m = b.charCodeAt(0) + (b.charCodeAt(7) | 0)) { + case 203: + if (111 > b.charCodeAt(8)) break; + + case 115: + a = a.replace(b, '-webkit-' + b) + ';' + a; + break; + + case 207: + case 102: + a = a.replace(b, '-webkit-' + (102 < m ? 'inline-' : '') + 'box') + ';' + a.replace(b, '-webkit-' + b) + ';' + a.replace(b, '-ms-' + b + 'box') + ';' + a; + } + + return a + ';'; + + case 938: + if (45 === a.charCodeAt(5)) switch (a.charCodeAt(6)) { + case 105: + return b = a.replace('-items', ''), '-webkit-' + a + '-webkit-box-' + b + '-ms-flex-' + b + a; + + case 115: + return '-webkit-' + a + '-ms-flex-item-' + a.replace(ba, '') + a; + + default: + return '-webkit-' + a + '-ms-flex-line-pack' + a.replace('align-content', '').replace(ba, '') + a; + } + break; + + case 973: + case 989: + if (45 !== a.charCodeAt(3) || 122 === a.charCodeAt(4)) break; + + case 931: + case 953: + if (!0 === la.test(d)) return 115 === (b = d.substring(d.indexOf(':') + 1)).charCodeAt(0) ? P(d.replace('stretch', 'fill-available'), c, e, h).replace(':fill-available', ':stretch') : a.replace(b, '-webkit-' + b) + a.replace(b, '-moz-' + b.replace('fill-', '')) + a; + break; + + case 962: + if (a = '-webkit-' + a + (102 === a.charCodeAt(5) ? '-ms-' + a : '') + a, 211 === e + h && 105 === a.charCodeAt(13) && 0 < a.indexOf('transform', 10)) return a.substring(0, a.indexOf(';', 27) + 1).replace(ma, '$1-webkit-$2') + a; + } + + return a; + } + + function L(d, c) { + var e = d.indexOf(1 === c ? ':' : '{'), + h = d.substring(0, 3 !== c ? e : 10); + e = d.substring(e + 1, d.length - 1); + return R(2 !== c ? h : h.replace(na, '$1'), e, c); + } + + function ea(d, c) { + var e = P(c, c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2)); + return e !== c + ';' ? e.replace(oa, ' or ($1)').substring(4) : '(' + c + ')'; + } + + function H(d, c, e, h, a, m, b, v, n, q) { + for (var g = 0, x = c, w; g < A; ++g) { + switch (w = S[g].call(B, d, x, e, h, a, m, b, v, n, q)) { + case void 0: + case !1: + case !0: + case null: + break; + + default: + x = w; + } + } + + if (x !== c) return x; + } + + function T(d) { + switch (d) { + case void 0: + case null: + A = S.length = 0; + break; + + default: + if ('function' === typeof d) S[A++] = d;else if ('object' === typeof d) for (var c = 0, e = d.length; c < e; ++c) { + T(d[c]); + } else Y = !!d | 0; + } + + return T; + } + + function U(d) { + d = d.prefix; + void 0 !== d && (R = null, d ? 'function' !== typeof d ? w = 1 : (w = 2, R = d) : w = 0); + return U; + } + + function B(d, c) { + var e = d; + 33 > e.charCodeAt(0) && (e = e.trim()); + V = e; + e = [V]; + + if (0 < A) { + var h = H(-1, c, e, e, D, z, 0, 0, 0, 0); + void 0 !== h && 'string' === typeof h && (c = h); + } + + var a = M(O, e, c, 0, 0); + 0 < A && (h = H(-2, a, e, e, D, z, a.length, 0, 0, 0), void 0 !== h && (a = h)); + V = ''; + E = 0; + z = D = 1; + return a; + } + + var ca = /^\0+/g, + N = /[\0\r\f]/g, + aa = /: */g, + ka = /zoo|gra/, + ma = /([,: ])(transform)/g, + ia = /,\r+?/g, + F = /([\t\r\n ])*\f?&/g, + fa = /@(k\w+)\s*(\S*)\s*/, + Q = /::(place)/g, + ha = /:(read-only)/g, + G = /[svh]\w+-[tblr]{2}/, + da = /\(\s*(.*)\s*\)/g, + oa = /([\s\S]*?);/g, + ba = /-self|flex-/g, + na = /[^]*?(:[rp][el]a[\w-]+)[^]*/, + la = /stretch|:\s*\w+\-(?:conte|avail)/, + ja = /([^-])(image-set\()/, + z = 1, + D = 1, + E = 0, + w = 1, + O = [], + S = [], + A = 0, + R = null, + Y = 0, + V = ''; + B.use = T; + B.set = U; + void 0 !== W && U(W); + return B; } -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (memoize); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (stylis_min); /***/ }), @@ -85,22 +716,22 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ FloatingOverlay: () => (/* binding */ FloatingOverlay), /* harmony export */ FloatingPortal: () => (/* binding */ FloatingPortal), /* harmony export */ FloatingTree: () => (/* binding */ FloatingTree), -/* harmony export */ arrow: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__.arrow), -/* harmony export */ autoPlacement: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__.autoPlacement), -/* harmony export */ autoUpdate: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.autoUpdate), -/* harmony export */ computePosition: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.computePosition), -/* harmony export */ detectOverflow: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.detectOverflow), -/* harmony export */ flip: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__.flip), -/* harmony export */ getOverflowAncestors: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.getOverflowAncestors), -/* harmony export */ hide: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__.hide), -/* harmony export */ inline: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__.inline), +/* harmony export */ arrow: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.arrow), +/* harmony export */ autoPlacement: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.autoPlacement), +/* harmony export */ autoUpdate: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.autoUpdate), +/* harmony export */ computePosition: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.computePosition), +/* harmony export */ detectOverflow: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.detectOverflow), +/* harmony export */ flip: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.flip), +/* harmony export */ getOverflowAncestors: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.getOverflowAncestors), +/* harmony export */ hide: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.hide), +/* harmony export */ inline: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.inline), /* harmony export */ inner: () => (/* binding */ inner), -/* harmony export */ limitShift: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__.limitShift), -/* harmony export */ offset: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__.offset), -/* harmony export */ platform: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.platform), +/* harmony export */ limitShift: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.limitShift), +/* harmony export */ offset: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.offset), +/* harmony export */ platform: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.platform), /* harmony export */ safePolygon: () => (/* binding */ safePolygon), -/* harmony export */ shift: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__.shift), -/* harmony export */ size: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__.size), +/* harmony export */ shift: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.shift), +/* harmony export */ size: () => (/* reexport safe */ _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.size), /* harmony export */ useClick: () => (/* binding */ useClick), /* harmony export */ useClientPoint: () => (/* binding */ useClientPoint), /* harmony export */ useDelayGroup: () => (/* binding */ useDelayGroup), @@ -129,11 +760,11 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @floating-ui/react/utils */ "./node_modules/@floating-ui/react/dist/floating-ui.react.utils.mjs"); /* harmony import */ var _floating_ui_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @floating-ui/utils */ "./node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs"); -/* harmony import */ var _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @floating-ui/react-dom */ "./node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs"); -/* harmony import */ var _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @floating-ui/utils/dom */ "./node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs"); -/* harmony import */ var _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @floating-ui/react-dom */ "./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs"); +/* harmony import */ var _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @floating-ui/react-dom */ "./node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs"); /* harmony import */ var tabbable__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! tabbable */ "./node_modules/tabbable/dist/index.esm.js"); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); +/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); +/* harmony import */ var _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @floating-ui/react-dom */ "./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs"); +/* harmony import */ var _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @floating-ui/react-dom */ "./node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs"); @@ -860,6 +1491,16 @@ const FloatingArrow = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef } } const clipPathId = useId(); + const [isRTL, setIsRTL] = react__WEBPACK_IMPORTED_MODULE_0__.useState(false); + + // https://github.com/floating-ui/floating-ui/issues/2932 + index(() => { + if (!floating) return; + const isRTL = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.getComputedStyle)(floating).direction === 'rtl'; + if (isRTL) { + setIsRTL(true); + } + }, [floating]); if (!floating) { return null; } @@ -871,7 +1512,6 @@ const FloatingArrow = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef const svgX = width / 2 * (tipRadius / -8 + 1); const svgY = height / 2 * tipRadius / 4; const [side, alignment] = placement.split('-'); - const isRTL = _floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.platform.isRTL(floating); const isCustomShape = !!d; const isVerticalSide = side === 'top' || side === 'bottom'; const yOffsetProp = staticOffset && alignment === 'end' ? 'bottom' : 'top'; @@ -979,7 +1619,6 @@ function useFloatingNodeId(customParentId) { }, [tree, id, parentId]); return id; } - /** * Provides parent node context for nested floating elements. * @see https://floating-ui.com/docs/FloatingTree @@ -997,7 +1636,6 @@ function FloatingNode(props) { }), [id, parentId]) }, children); } - /** * Provides context for nested floating elements when they are not children of * each other on the DOM. @@ -1066,10 +1704,7 @@ function useHover(context, props) { onOpenChange, dataRef, events, - elements: { - domReference, - floating - } + elements } = context; const { enabled = true, @@ -1083,6 +1718,7 @@ function useHover(context, props) { const parentId = useFloatingParentNodeId(); const handleCloseRef = useLatestRef(handleClose); const delayRef = useLatestRef(delay); + const openRef = useLatestRef(open); const pointerTypeRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(); const timeoutRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(-1); const handlerRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(); @@ -1099,9 +1735,7 @@ function useHover(context, props) { // When closing before opening, clear the delay timeouts to cancel it // from showing. react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { - if (!enabled) { - return; - } + if (!enabled) return; function onOpenChange(_ref) { let { open @@ -1118,20 +1752,20 @@ function useHover(context, props) { }; }, [enabled, events]); react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { - if (!enabled || !handleCloseRef.current || !open) { - return; - } + if (!enabled) return; + if (!handleCloseRef.current) return; + if (!open) return; function onLeave(event) { if (isHoverOpen()) { onOpenChange(false, event, 'hover'); } } - const html = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating).documentElement; + const html = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(elements.floating).documentElement; html.addEventListener('mouseleave', onLeave); return () => { html.removeEventListener('mouseleave', onLeave); }; - }, [floating, open, onOpenChange, enabled, handleCloseRef, isHoverOpen]); + }, [elements.floating, open, onOpenChange, enabled, handleCloseRef, isHoverOpen]); const closeWithDelay = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(function (event, runElseBranch, reason) { if (runElseBranch === void 0) { runElseBranch = true; @@ -1154,7 +1788,7 @@ function useHover(context, props) { }); const clearPointerEvents = useEffectEvent(() => { if (performedPointerEventsMutationRef.current) { - const body = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating).body; + const body = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(elements.floating).body; body.style.pointerEvents = ''; body.removeAttribute(safePolygonIdentifier); performedPointerEventsMutationRef.current = false; @@ -1165,9 +1799,7 @@ function useHover(context, props) { // delegation system. If the cursor was on a disabled element and then entered // the reference (no gap), `mouseenter` doesn't fire in the delegation system. react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { - if (!enabled) { - return; - } + if (!enabled) return; function isClickLikeOpenEvent() { return dataRef.current.openEvent ? ['click', 'mousedown'].includes(dataRef.current.openEvent.type) : false; } @@ -1180,7 +1812,9 @@ function useHover(context, props) { const openDelay = getDelay(delayRef.current, 'open', pointerTypeRef.current); if (openDelay) { timeoutRef.current = window.setTimeout(() => { - onOpenChange(true, event, 'hover'); + if (!openRef.current) { + onOpenChange(true, event, 'hover'); + } }, openDelay); } else { onOpenChange(true, event, 'hover'); @@ -1189,7 +1823,7 @@ function useHover(context, props) { function onMouseLeave(event) { if (isClickLikeOpenEvent()) return; unbindMouseMoveRef.current(); - const doc = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating); + const doc = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(elements.floating); clearTimeout(restTimeoutRef.current); if (handleCloseRef.current && dataRef.current.floatingContext) { // Prevent clearing `onScrollMouseLeave` timeout. @@ -1218,7 +1852,7 @@ function useHover(context, props) { // Allow interactivity without `safePolygon` on touch devices. With a // pointer, a short close delay is an alternative, so it should work // consistently. - const shouldClose = pointerTypeRef.current === 'touch' ? !(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(floating, event.relatedTarget) : true; + const shouldClose = pointerTypeRef.current === 'touch' ? !(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(elements.floating, event.relatedTarget) : true; if (shouldClose) { closeWithDelay(event); } @@ -1242,24 +1876,26 @@ function useHover(context, props) { } })(event); } - if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(domReference)) { - const ref = domReference; + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(elements.domReference)) { + var _elements$floating; + const ref = elements.domReference; open && ref.addEventListener('mouseleave', onScrollMouseLeave); - floating == null || floating.addEventListener('mouseleave', onScrollMouseLeave); + (_elements$floating = elements.floating) == null || _elements$floating.addEventListener('mouseleave', onScrollMouseLeave); move && ref.addEventListener('mousemove', onMouseEnter, { once: true }); ref.addEventListener('mouseenter', onMouseEnter); ref.addEventListener('mouseleave', onMouseLeave); return () => { + var _elements$floating2; open && ref.removeEventListener('mouseleave', onScrollMouseLeave); - floating == null || floating.removeEventListener('mouseleave', onScrollMouseLeave); + (_elements$floating2 = elements.floating) == null || _elements$floating2.removeEventListener('mouseleave', onScrollMouseLeave); move && ref.removeEventListener('mousemove', onMouseEnter); ref.removeEventListener('mouseenter', onMouseEnter); ref.removeEventListener('mouseleave', onMouseLeave); }; } - }, [domReference, floating, enabled, context, mouseOnly, restMs, move, closeWithDelay, cleanupMouseMoveHandler, clearPointerEvents, onOpenChange, open, tree, delayRef, handleCloseRef, dataRef]); + }, [elements, enabled, context, mouseOnly, restMs, move, closeWithDelay, cleanupMouseMoveHandler, clearPointerEvents, onOpenChange, open, openRef, tree, delayRef, handleCloseRef, dataRef]); // Block pointer-events of every element other than the reference and floating // while the floating element is open and has a `handleClose` handler. Also @@ -1267,30 +1903,29 @@ function useHover(context, props) { // https://github.com/floating-ui/floating-ui/issues/1722 index(() => { var _handleCloseRef$curre; - if (!enabled) { - return; - } + if (!enabled) return; if (open && (_handleCloseRef$curre = handleCloseRef.current) != null && _handleCloseRef$curre.__options.blockPointerEvents && isHoverOpen()) { - const body = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating).body; + const body = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(elements.floating).body; body.setAttribute(safePolygonIdentifier, ''); body.style.pointerEvents = 'none'; performedPointerEventsMutationRef.current = true; - if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(domReference) && floating) { + const floatingEl = elements.floating; + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(elements.domReference) && floatingEl) { var _tree$nodesRef$curren; - const ref = domReference; + const ref = elements.domReference; const parentFloating = tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find(node => node.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren.elements.floating; if (parentFloating) { parentFloating.style.pointerEvents = ''; } ref.style.pointerEvents = 'auto'; - floating.style.pointerEvents = 'auto'; + floatingEl.style.pointerEvents = 'auto'; return () => { ref.style.pointerEvents = ''; - floating.style.pointerEvents = ''; + floatingEl.style.pointerEvents = ''; }; } } - }, [enabled, open, parentId, floating, domReference, tree, handleCloseRef, isHoverOpen]); + }, [enabled, open, parentId, elements, tree, handleCloseRef, isHoverOpen]); index(() => { if (!open) { pointerTypeRef.current = undefined; @@ -1305,48 +1940,50 @@ function useHover(context, props) { clearTimeout(restTimeoutRef.current); clearPointerEvents(); }; - }, [enabled, domReference, cleanupMouseMoveHandler, clearPointerEvents]); - return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { - if (!enabled) { - return {}; - } + }, [enabled, elements.domReference, cleanupMouseMoveHandler, clearPointerEvents]); + const reference = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { function setPointerRef(event) { pointerTypeRef.current = event.pointerType; } return { - reference: { - onPointerDown: setPointerRef, - onPointerEnter: setPointerRef, - onMouseMove(event) { - function handleMouseMove() { - if (!blockMouseMoveRef.current) { - onOpenChange(true, event.nativeEvent, 'hover'); - } - } - if (mouseOnly && !(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isMouseLikePointerType)(pointerTypeRef.current)) { - return; - } - if (open || restMs === 0) { - return; - } - clearTimeout(restTimeoutRef.current); - if (pointerTypeRef.current === 'touch') { - handleMouseMove(); - } else { - restTimeoutRef.current = window.setTimeout(handleMouseMove, restMs); + onPointerDown: setPointerRef, + onPointerEnter: setPointerRef, + onMouseMove(event) { + const { + nativeEvent + } = event; + function handleMouseMove() { + if (!blockMouseMoveRef.current && !openRef.current) { + onOpenChange(true, nativeEvent, 'hover'); } } - }, - floating: { - onMouseEnter() { - clearTimeout(timeoutRef.current); - }, - onMouseLeave(event) { - closeWithDelay(event.nativeEvent, false); + if (mouseOnly && !(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isMouseLikePointerType)(pointerTypeRef.current)) { + return; + } + if (open || restMs === 0) { + return; + } + clearTimeout(restTimeoutRef.current); + if (pointerTypeRef.current === 'touch') { + handleMouseMove(); + } else { + restTimeoutRef.current = window.setTimeout(handleMouseMove, restMs); } } }; - }, [enabled, mouseOnly, open, restMs, onOpenChange, closeWithDelay]); + }, [mouseOnly, onOpenChange, open, openRef, restMs]); + const floating = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => ({ + onMouseEnter() { + clearTimeout(timeoutRef.current); + }, + onMouseLeave(event) { + closeWithDelay(event.nativeEvent, false); + } + }), [closeWithDelay]); + return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => enabled ? { + reference, + floating + } : {}, [enabled, reference, floating]); } const NOOP = () => {}; @@ -1575,7 +2212,7 @@ function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, iner return; } [].forEach.call(parent.children, node => { - if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.getNodeName)(node) === 'script') return; + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.getNodeName)(node) === 'script') return; if (elementsToKeep.has(node)) { deep(node); } else { @@ -1682,6 +2319,32 @@ function enableFocusInside(container) { } }); } +function getClosestTabbableElement(tabbableElements, element, floating) { + const elementIndex = tabbableElements.indexOf(element); + function traverseTabbableElements(next) { + const attr = createAttribute('focus-guard'); + let index = elementIndex + (next ? 1 : 0); + let currentElement = tabbableElements[index]; + while (currentElement && (!currentElement.isConnected || currentElement.hasAttribute(attr) || (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(floating, currentElement))) { + if (next) { + index++; + } else { + index--; + } + currentElement = tabbableElements[index]; + } + return currentElement; + } + + // First, try to find the next tabbable element + const next = traverseTabbableElements(true); + if (next) { + return next; + } + + // If we can't find a next tabbable element, try to find the previous one + return traverseTabbableElements(false); +} // See Diego Haz's Sandbox for making this logic work well on Safari/iOS: // https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/FocusTrap.tsx @@ -1736,7 +2399,6 @@ const FocusGuard = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(fu const PortalContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createContext(null); const attr = /*#__PURE__*/createAttribute('portal'); - /** * @see https://floating-ui.com/docs/FloatingPortal#usefloatingportalnode */ @@ -1782,7 +2444,7 @@ function useFloatingPortalNode(props) { if (!uniqueId) return; if (portalNodeRef.current) return; let container = root || (portalContext == null ? void 0 : portalContext.portalNode); - if (container && !(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(container)) container = container.current; + if (container && !(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(container)) container = container.current; container = container || document.body; let idWrapper = null; if (id) { @@ -1883,7 +2545,7 @@ function FloatingPortal(props) { }), shouldRenderGuards && portalNode && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { "aria-owns": portalNode.id, style: HIDDEN_STYLES - }), portalNode && /*#__PURE__*/(0,react_dom__WEBPACK_IMPORTED_MODULE_4__.createPortal)(children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(FocusGuard, { + }), portalNode && /*#__PURE__*/react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal(children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(FocusGuard, { "data-type": "outside", ref: afterOutsideRef, onFocus: event => { @@ -1905,7 +2567,7 @@ let previouslyFocusedElements = []; function addPreviouslyFocusedElement(element) { previouslyFocusedElements = previouslyFocusedElements.filter(el => el.isConnected); let tabbableEl = element; - if (!tabbableEl || (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.getNodeName)(tabbableEl) === 'body') return; + if (!tabbableEl || (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.getNodeName)(tabbableEl) === 'body') return; if (!(0,tabbable__WEBPACK_IMPORTED_MODULE_7__.isTabbable)(tabbableEl, getTabbableOptions())) { const tabbableChild = (0,tabbable__WEBPACK_IMPORTED_MODULE_7__.tabbable)(tabbableEl, getTabbableOptions())[0]; if (tabbableChild) { @@ -1941,6 +2603,7 @@ function FloatingFocusManager(props) { guards: _guards = true, initialFocus = 0, returnFocus = true, + restoreFocus = false, modal = true, visuallyHiddenDismiss = false, closeOnFocusOut = true @@ -1952,6 +2615,7 @@ function FloatingFocusManager(props) { onOpenChange, events, dataRef, + floatingId, elements: { domReference, floating @@ -1976,31 +2640,37 @@ function FloatingFocusManager(props) { const endDismissButtonRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null); const preventReturnFocusRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false); const isPointerDownRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false); + const tabbableIndexRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(-1); const isInsidePortal = portalContext != null; - const getTabbableContent = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(function (container) { + const firstElementChild = floating == null ? void 0 : floating.firstElementChild; + // If the floating element is acting as a positioning wrapper rather than the + // element that receives aria props, use it as the focus root instead. + const floatingFocusNode = (firstElementChild == null ? void 0 : firstElementChild.id) === floatingId ? firstElementChild : floating; + const getTabbableContent = useEffectEvent(function (container) { if (container === void 0) { - container = floating; + container = floatingFocusNode; } return container ? (0,tabbable__WEBPACK_IMPORTED_MODULE_7__.tabbable)(container, getTabbableOptions()) : []; - }, [floating]); - const getTabbableElements = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(container => { + }); + const getTabbableElements = useEffectEvent(container => { const content = getTabbableContent(container); return orderRef.current.map(type => { if (domReference && type === 'reference') { return domReference; } - if (floating && type === 'floating') { - return floating; + if (floatingFocusNode && type === 'floating') { + return floatingFocusNode; } return content; }).filter(Boolean).flat(); - }, [domReference, floating, orderRef, getTabbableContent]); + }); react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { - if (disabled || !modal) return; + if (disabled) return; + if (!modal) return; function onKeyDown(event) { if (event.key === 'Tab') { // The focus guards have nothing to focus, so we need to stop the event. - if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(floating, (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) { + if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(floatingFocusNode, (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floatingFocusNode))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) { (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); } const els = getTabbableElements(); @@ -2013,20 +2683,37 @@ function FloatingFocusManager(props) { enqueueFocus(els[1]); } } - if (orderRef.current[1] === 'floating' && target === floating && event.shiftKey) { + if (orderRef.current[1] === 'floating' && target === floatingFocusNode && event.shiftKey) { (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); enqueueFocus(els[0]); } } } - const doc = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating); + const doc = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floatingFocusNode); doc.addEventListener('keydown', onKeyDown); return () => { doc.removeEventListener('keydown', onKeyDown); }; - }, [disabled, domReference, floating, modal, orderRef, isUntrappedTypeableCombobox, getTabbableContent, getTabbableElements]); + }, [disabled, domReference, floatingFocusNode, modal, orderRef, isUntrappedTypeableCombobox, getTabbableContent, getTabbableElements]); react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { - if (disabled || !closeOnFocusOut) return; + if (disabled) return; + if (!floating) return; + function handleFocusIn(event) { + const target = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getTarget)(event); + const tabbableContent = getTabbableContent(); + const tabbableIndex = tabbableContent.indexOf(target); + if (tabbableIndex !== -1) { + tabbableIndexRef.current = tabbableIndex; + } + } + floating.addEventListener('focusin', handleFocusIn); + return () => { + floating.removeEventListener('focusin', handleFocusIn); + }; + }, [disabled, floating, getTabbableContent]); + react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { + if (disabled) return; + if (!closeOnFocusOut) return; // In Safari, buttons lose focus when pressing them. function handlePointerDown() { @@ -2046,9 +2733,25 @@ function FloatingFocusManager(props) { return ((_node$context3 = node.context) == null ? void 0 : _node$context3.elements.floating) === relatedTarget || ((_node$context4 = node.context) == null ? void 0 : _node$context4.elements.domReference) === relatedTarget; }))); + // Restore focus to the previous tabbable element index to prevent + // focus from being lost outside the floating tree. + if (restoreFocus && movedToUnrelatedNode && (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floatingFocusNode)) === (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floatingFocusNode).body) { + // Let `FloatingPortal` effect knows that focus is still inside the + // floating tree. + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isHTMLElement)(floatingFocusNode)) { + floatingFocusNode == null || floatingFocusNode.focus(); + } + const prevTabbableIndex = tabbableIndexRef.current; + const tabbableContent = getTabbableContent(); + const nodeToFocus = tabbableContent[prevTabbableIndex] || tabbableContent[tabbableContent.length - 1] || floatingFocusNode; + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isHTMLElement)(nodeToFocus)) { + nodeToFocus.focus(); + } + } + // Focus did not move inside the floating tree, and there are no tabbable // portal guards to handle closing. - if (relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && + if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && // Fix React 18 Strict Mode returnFocus due to double rendering. relatedTarget !== getPreviouslyFocusedElement()) { preventReturnFocusRef.current = true; @@ -2056,17 +2759,17 @@ function FloatingFocusManager(props) { } }); } - if (floating && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isHTMLElement)(domReference)) { + if (floating && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isHTMLElement)(domReference)) { domReference.addEventListener('focusout', handleFocusOutside); domReference.addEventListener('pointerdown', handlePointerDown); - !modal && floating.addEventListener('focusout', handleFocusOutside); + floating.addEventListener('focusout', handleFocusOutside); return () => { domReference.removeEventListener('focusout', handleFocusOutside); domReference.removeEventListener('pointerdown', handlePointerDown); - !modal && floating.removeEventListener('focusout', handleFocusOutside); + floating.removeEventListener('focusout', handleFocusOutside); }; } - }, [disabled, domReference, floating, modal, nodeId, tree, portalContext, onOpenChange, closeOnFocusOut]); + }, [disabled, domReference, floating, floatingFocusNode, modal, nodeId, tree, portalContext, onOpenChange, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox]); react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { var _portalContext$portal; if (disabled) return; @@ -2082,30 +2785,31 @@ function FloatingFocusManager(props) { } }, [disabled, domReference, floating, modal, orderRef, portalContext, isUntrappedTypeableCombobox, guards]); index(() => { - if (disabled || !floating) return; - const doc = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating); + if (disabled || !(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isHTMLElement)(floatingFocusNode)) return; + const doc = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floatingFocusNode); const previouslyFocusedElement = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)(doc); // Wait for any layout effect state setters to execute to set `tabIndex`. queueMicrotask(() => { - const focusableElements = getTabbableElements(floating); + const focusableElements = getTabbableElements(floatingFocusNode); const initialFocusValue = initialFocusRef.current; - const elToFocus = (typeof initialFocusValue === 'number' ? focusableElements[initialFocusValue] : initialFocusValue.current) || floating; - const focusAlreadyInsideFloatingEl = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(floating, previouslyFocusedElement); + const elToFocus = (typeof initialFocusValue === 'number' ? focusableElements[initialFocusValue] : initialFocusValue.current) || floatingFocusNode; + const focusAlreadyInsideFloatingEl = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(floatingFocusNode, previouslyFocusedElement); if (!ignoreInitialFocus && !focusAlreadyInsideFloatingEl && open) { enqueueFocus(elToFocus, { - preventScroll: elToFocus === floating + preventScroll: elToFocus === floatingFocusNode }); } }); - }, [disabled, open, floating, ignoreInitialFocus, getTabbableElements, initialFocusRef]); + }, [disabled, open, floatingFocusNode, ignoreInitialFocus, getTabbableElements, initialFocusRef]); index(() => { - if (disabled || !floating) return; + if (disabled || !floatingFocusNode) return; let preventReturnFocusScroll = false; - const doc = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating); + const doc = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floatingFocusNode); const previouslyFocusedElement = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)(doc); const contextData = dataRef.current; let openEvent = contextData.openEvent; + const domReference = refs.domReference.current; addPreviouslyFocusedElement(previouslyFocusedElement); // Dismissing via outside press should always ignore `returnFocus` to @@ -2146,30 +2850,36 @@ function FloatingFocusManager(props) { if (shouldFocusReference && refs.domReference.current) { addPreviouslyFocusedElement(refs.domReference.current); } - const returnElement = getPreviouslyFocusedElement(); - if ( - // eslint-disable-next-line react-hooks/exhaustive-deps - returnFocusRef.current && !preventReturnFocusRef.current && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isHTMLElement)(returnElement) && ( - // If the focus moved somewhere else after mount, avoid returning focus - // since it likely entered a different element which should be - // respected: https://github.com/floating-ui/floating-ui/issues/2607 - returnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) { - enqueueFocus(returnElement, { - // When dismissing nested floating elements, by the time the rAF has - // executed, the menus will all have been unmounted. When they try - // to get focused, the calls get ignored — leaving the root - // reference focused as desired. - cancelPrevious: false, - preventScroll: preventReturnFocusScroll - }); - } + const returnContextElement = domReference || previouslyFocusedElement; + const tabbableElements = (0,tabbable__WEBPACK_IMPORTED_MODULE_7__.tabbable)((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(returnContextElement).body, getTabbableOptions()); + + // Wait for the return element to get potentially disconnected before + // checking. + queueMicrotask(() => { + let returnElement = getPreviouslyFocusedElement(); + if (!returnElement && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isHTMLElement)(returnContextElement) && floating) { + returnElement = getClosestTabbableElement(tabbableElements, returnContextElement, floating); + } + if ( + // eslint-disable-next-line react-hooks/exhaustive-deps + returnFocusRef.current && !preventReturnFocusRef.current && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isHTMLElement)(returnElement) && ( + // If the focus moved somewhere else after mount, avoid returning focus + // since it likely entered a different element which should be + // respected: https://github.com/floating-ui/floating-ui/issues/2607 + returnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) { + returnElement.focus({ + preventScroll: preventReturnFocusScroll + }); + } + }); }; - }, [disabled, floating, returnFocusRef, dataRef, refs, events, tree, nodeId]); + }, [disabled, floating, floatingFocusNode, returnFocusRef, dataRef, refs, events, tree, nodeId]); // Synchronize the `context` & `modal` value to the FloatingPortal context. // It will decide whether or not it needs to render its own guards. index(() => { - if (disabled || !portalContext) return; + if (disabled) return; + if (!portalContext) return; portalContext.setFocusManagerState({ modal, closeOnFocusOut, @@ -2182,22 +2892,29 @@ function FloatingFocusManager(props) { }; }, [disabled, portalContext, modal, open, onOpenChange, refs, closeOnFocusOut]); index(() => { - if (disabled || !floating || typeof MutationObserver !== 'function' || ignoreInitialFocus) { - return; - } + if (disabled) return; + if (!floatingFocusNode) return; + if (typeof MutationObserver !== 'function') return; + if (ignoreInitialFocus) return; const handleMutation = () => { - const tabIndex = floating.getAttribute('tabindex'); - if (orderRef.current.includes('floating') || (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating)) !== refs.domReference.current && getTabbableContent().length === 0) { + const tabIndex = floatingFocusNode.getAttribute('tabindex'); + const tabbableContent = getTabbableContent(); + const activeEl = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating)); + const tabbableIndex = tabbableContent.indexOf(activeEl); + if (tabbableIndex !== -1) { + tabbableIndexRef.current = tabbableIndex; + } + if (orderRef.current.includes('floating') || activeEl !== refs.domReference.current && tabbableContent.length === 0) { if (tabIndex !== '0') { - floating.setAttribute('tabindex', '0'); + floatingFocusNode.setAttribute('tabindex', '0'); } } else if (tabIndex !== '-1') { - floating.setAttribute('tabindex', '-1'); + floatingFocusNode.setAttribute('tabindex', '-1'); } }; handleMutation(); const observer = new MutationObserver(handleMutation); - observer.observe(floating, { + observer.observe(floatingFocusNode, { childList: true, subtree: true, attributes: true @@ -2205,7 +2922,7 @@ function FloatingFocusManager(props) { return () => { observer.disconnect(); }; - }, [disabled, floating, refs, orderRef, getTabbableContent, ignoreInitialFocus]); + }, [disabled, floating, floatingFocusNode, refs, orderRef, getTabbableContent, ignoreInitialFocus]); function renderDismissButton(location) { if (disabled || !visuallyHiddenDismiss || !modal) { return null; @@ -2215,7 +2932,7 @@ function FloatingFocusManager(props) { onClick: event => onOpenChange(false, event.nativeEvent) }, typeof visuallyHiddenDismiss === 'string' ? visuallyHiddenDismiss : 'Dismiss'); } - const shouldRenderGuards = !disabled && guards && (isInsidePortal || modal); + const shouldRenderGuards = !disabled && guards && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal); return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, shouldRenderGuards && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(FocusGuard, { "data-type": "inside", ref: portalContext == null ? void 0 : portalContext.beforeInsideRef, @@ -2278,8 +2995,8 @@ const FloatingOverlay = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardR const scrollbarX = Math.round(document.documentElement.getBoundingClientRect().left) + document.documentElement.scrollLeft; const paddingProp = scrollbarX ? 'paddingLeft' : 'paddingRight'; const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; - const scrollX = bodyStyle.left ? parseFloat(bodyStyle.left) : window.pageXOffset; - const scrollY = bodyStyle.top ? parseFloat(bodyStyle.top) : window.pageYOffset; + const scrollX = bodyStyle.left ? parseFloat(bodyStyle.left) : window.scrollX; + const scrollY = bodyStyle.top ? parseFloat(bodyStyle.top) : window.scrollY; bodyStyle.overflow = 'hidden'; if (scrollbarWidth) { bodyStyle[paddingProp] = scrollbarWidth + "px"; @@ -2334,7 +3051,7 @@ const FloatingOverlay = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.forwardR }); function isButtonTarget(event) { - return (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isHTMLElement)(event.target) && event.target.tagName === 'BUTTON'; + return (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isHTMLElement)(event.target) && event.target.tagName === 'BUTTON'; } function isSpaceIgnored(element) { return (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isTypeableElement)(element); @@ -2364,81 +3081,74 @@ function useClick(context, props) { } = props; const pointerTypeRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(); const didKeyDownRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false); - return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { - if (!enabled) return {}; - return { - reference: { - onPointerDown(event) { - pointerTypeRef.current = event.pointerType; - }, - onMouseDown(event) { - // Ignore all buttons except for the "main" button. - // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button - if (event.button !== 0) { - return; - } - if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isMouseLikePointerType)(pointerTypeRef.current, true) && ignoreMouse) { - return; - } - if (eventOption === 'click') { - return; - } - if (open && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === 'mousedown' : true)) { - onOpenChange(false, event.nativeEvent, 'click'); - } else { - // Prevent stealing focus from the floating element - event.preventDefault(); - onOpenChange(true, event.nativeEvent, 'click'); - } - }, - onClick(event) { - if (eventOption === 'mousedown' && pointerTypeRef.current) { - pointerTypeRef.current = undefined; - return; - } - if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isMouseLikePointerType)(pointerTypeRef.current, true) && ignoreMouse) { - return; - } - if (open && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === 'click' : true)) { - onOpenChange(false, event.nativeEvent, 'click'); - } else { - onOpenChange(true, event.nativeEvent, 'click'); - } - }, - onKeyDown(event) { - pointerTypeRef.current = undefined; - if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event)) { - return; - } - if (event.key === ' ' && !isSpaceIgnored(domReference)) { - // Prevent scrolling - event.preventDefault(); - didKeyDownRef.current = true; - } - if (event.key === 'Enter') { - if (open && toggle) { - onOpenChange(false, event.nativeEvent, 'click'); - } else { - onOpenChange(true, event.nativeEvent, 'click'); - } - } - }, - onKeyUp(event) { - if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) { - return; - } - if (event.key === ' ' && didKeyDownRef.current) { - didKeyDownRef.current = false; - if (open && toggle) { - onOpenChange(false, event.nativeEvent, 'click'); - } else { - onOpenChange(true, event.nativeEvent, 'click'); - } - } + const reference = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => ({ + onPointerDown(event) { + pointerTypeRef.current = event.pointerType; + }, + onMouseDown(event) { + const pointerType = pointerTypeRef.current; + + // Ignore all buttons except for the "main" button. + // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button + if (event.button !== 0) return; + if (eventOption === 'click') return; + if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isMouseLikePointerType)(pointerType, true) && ignoreMouse) return; + if (open && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === 'mousedown' : true)) { + onOpenChange(false, event.nativeEvent, 'click'); + } else { + // Prevent stealing focus from the floating element + event.preventDefault(); + onOpenChange(true, event.nativeEvent, 'click'); + } + }, + onClick(event) { + const pointerType = pointerTypeRef.current; + if (eventOption === 'mousedown' && pointerTypeRef.current) { + pointerTypeRef.current = undefined; + return; + } + if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isMouseLikePointerType)(pointerType, true) && ignoreMouse) return; + if (open && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === 'click' : true)) { + onOpenChange(false, event.nativeEvent, 'click'); + } else { + onOpenChange(true, event.nativeEvent, 'click'); + } + }, + onKeyDown(event) { + pointerTypeRef.current = undefined; + if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event)) { + return; + } + if (event.key === ' ' && !isSpaceIgnored(domReference)) { + // Prevent scrolling + event.preventDefault(); + didKeyDownRef.current = true; + } + if (event.key === 'Enter') { + if (open && toggle) { + onOpenChange(false, event.nativeEvent, 'click'); + } else { + onOpenChange(true, event.nativeEvent, 'click'); } } - }; - }, [enabled, dataRef, eventOption, ignoreMouse, keyboardHandlers, domReference, toggle, open, onOpenChange]); + }, + onKeyUp(event) { + if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) { + return; + } + if (event.key === ' ' && didKeyDownRef.current) { + didKeyDownRef.current = false; + if (open && toggle) { + onOpenChange(false, event.nativeEvent, 'click'); + } else { + onOpenChange(true, event.nativeEvent, 'click'); + } + } + } + }), [dataRef, domReference, eventOption, ignoreMouse, keyboardHandlers, onOpenChange, open, toggle]); + return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => enabled ? { + reference + } : {}, [enabled, reference]); } function createVirtualElement(domElement, data) { @@ -2563,7 +3273,7 @@ function useClientPoint(context, props) { const addListener = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(() => { // Explicitly specified `x`/`y` coordinates shouldn't add a listener. if (!openCheck || !enabled || x != null || y != null) return; - const win = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.getWindow)(floating); + const win = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.getWindow)(floating); function handleMouseMove(event) { const target = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getTarget)(event); if (!(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(floating, target)) { @@ -2603,8 +3313,7 @@ function useClientPoint(context, props) { setReference(x, y); } }, [enabled, x, y, setReference]); - return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { - if (!enabled) return {}; + const reference = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { function setPointerTypeRef(_ref) { let { pointerType @@ -2612,14 +3321,15 @@ function useClientPoint(context, props) { setPointerType(pointerType); } return { - reference: { - onPointerDown: setPointerTypeRef, - onPointerEnter: setPointerTypeRef, - onMouseMove: handleReferenceEnterOrMove, - onMouseEnter: handleReferenceEnterOrMove - } + onPointerDown: setPointerTypeRef, + onPointerEnter: setPointerTypeRef, + onMouseMove: handleReferenceEnterOrMove, + onMouseEnter: handleReferenceEnterOrMove }; - }, [enabled, handleReferenceEnterOrMove]); + }, [handleReferenceEnterOrMove]); + return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => enabled ? { + reference + } : {}, [enabled, reference]); } const bubbleHandlerKeys = { @@ -2651,11 +3361,7 @@ function useDismiss(context, props) { const { open, onOpenChange, - elements: { - reference, - domReference, - floating - }, + elements, dataRef } = context; const { @@ -2740,11 +3446,11 @@ function useDismiss(context, props) { } const target = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getTarget)(event); const inertSelector = "[" + createAttribute('inert') + "]"; - const markers = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating).querySelectorAll(inertSelector); - let targetRootAncestor = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(target) ? target : null; - while (targetRootAncestor && !(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isLastTraversableNode)(targetRootAncestor)) { - const nextParent = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.getParentNode)(targetRootAncestor); - if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isLastTraversableNode)(nextParent) || !(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(nextParent)) { + const markers = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(elements.floating).querySelectorAll(inertSelector); + let targetRootAncestor = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(target) ? target : null; + while (targetRootAncestor && !(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isLastTraversableNode)(targetRootAncestor)) { + const nextParent = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.getParentNode)(targetRootAncestor); + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isLastTraversableNode)(nextParent) || !(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(nextParent)) { break; } targetRootAncestor = nextParent; @@ -2752,9 +3458,9 @@ function useDismiss(context, props) { // Check if the click occurred on a third-party element injected after the // floating element rendered. - if (markers.length && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(target) && !(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isRootElement)(target) && + if (markers.length && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(target) && !(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isRootElement)(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). - !(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(target, floating) && + !(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(target, elements.floating) && // If the target root element contains none of the markers, then the // element was injected after the floating element rendered. Array.from(markers).every(marker => !(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(targetRootAncestor, marker))) { @@ -2762,7 +3468,7 @@ function useDismiss(context, props) { } // Check if the click occurred on the scrollbar - if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isHTMLElement)(target) && floating) { + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isHTMLElement)(target) && floating) { // In Firefox, `target.scrollWidth > target.clientWidth` for inline // elements. const canScrollX = target.clientWidth > 0 && target.scrollWidth > target.clientWidth; @@ -2774,7 +3480,7 @@ function useDismiss(context, props) { // check for. Plus, for modal dialogs with backdrops, it is more // important that the backdrop is checked but not so much the window. if (canScrollY) { - const isRTL = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.getComputedStyle)(target).direction === 'rtl'; + const isRTL = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.getComputedStyle)(target).direction === 'rtl'; if (isRTL) { xCond = event.offsetX <= target.offsetWidth - target.clientWidth; } @@ -2788,7 +3494,7 @@ function useDismiss(context, props) { var _node$context; return (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isEventTargetWithin)(event, (_node$context = node.context) == null ? void 0 : _node$context.elements.floating); }); - if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isEventTargetWithin)(event, floating) || (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isEventTargetWithin)(event, domReference) || targetIsInsideChildren) { + if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isEventTargetWithin)(event, elements.floating) || (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isEventTargetWithin)(event, elements.domReference) || targetIsInsideChildren) { return; } const children = tree ? getChildren(tree.nodesRef.current, nodeId) : []; @@ -2825,19 +3531,19 @@ function useDismiss(context, props) { function onScroll(event) { onOpenChange(false, event, 'ancestor-scroll'); } - const doc = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating); + const doc = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(elements.floating); escapeKey && doc.addEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture); outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture); let ancestors = []; if (ancestorScroll) { - if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(domReference)) { - ancestors = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.getOverflowAncestors)(domReference); + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(elements.domReference)) { + ancestors = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.getOverflowAncestors)(elements.domReference); } - if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(floating)) { - ancestors = ancestors.concat((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.getOverflowAncestors)(floating)); + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(elements.floating)) { + ancestors = ancestors.concat((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.getOverflowAncestors)(elements.floating)); } - if (!(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(reference) && reference && reference.contextElement) { - ancestors = ancestors.concat((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.getOverflowAncestors)(reference.contextElement)); + if (!(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(elements.reference) && elements.reference && elements.reference.contextElement) { + ancestors = ancestors.concat((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.getOverflowAncestors)(elements.reference.contextElement)); } } @@ -2858,37 +3564,34 @@ function useDismiss(context, props) { ancestor.removeEventListener('scroll', onScroll); }); }; - }, [dataRef, floating, domReference, reference, escapeKey, outsidePress, outsidePressEvent, open, onOpenChange, ancestorScroll, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, escapeKeyCapture, closeOnEscapeKeyDownCapture, closeOnPressOutside, outsidePressCapture, closeOnPressOutsideCapture]); + }, [dataRef, elements, escapeKey, outsidePress, outsidePressEvent, open, onOpenChange, ancestorScroll, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, escapeKeyCapture, closeOnEscapeKeyDownCapture, closeOnPressOutside, outsidePressCapture, closeOnPressOutsideCapture]); react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { insideReactTreeRef.current = false; }, [outsidePress, outsidePressEvent]); - return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { - if (!enabled) { - return {}; - } - return { - reference: { - onKeyDown: closeOnEscapeKeyDown, - [bubbleHandlerKeys[referencePressEvent]]: event => { - if (referencePress) { - onOpenChange(false, event.nativeEvent, 'reference-press'); - } - } - }, - floating: { - onKeyDown: closeOnEscapeKeyDown, - onMouseDown() { - endedOrStartedInsideRef.current = true; - }, - onMouseUp() { - endedOrStartedInsideRef.current = true; - }, - [captureHandlerKeys[outsidePressEvent]]: () => { - insideReactTreeRef.current = true; - } + const reference = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => ({ + onKeyDown: closeOnEscapeKeyDown, + [bubbleHandlerKeys[referencePressEvent]]: event => { + if (referencePress) { + onOpenChange(false, event.nativeEvent, 'reference-press'); } - }; - }, [enabled, referencePress, outsidePressEvent, referencePressEvent, onOpenChange, closeOnEscapeKeyDown]); + } + }), [closeOnEscapeKeyDown, onOpenChange, referencePress, referencePressEvent]); + const floating = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => ({ + onKeyDown: closeOnEscapeKeyDown, + onMouseDown() { + endedOrStartedInsideRef.current = true; + }, + onMouseUp() { + endedOrStartedInsideRef.current = true; + }, + [captureHandlerKeys[outsidePressEvent]]: () => { + insideReactTreeRef.current = true; + } + }), [closeOnEscapeKeyDown, outsidePressEvent]); + return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => enabled ? { + reference, + floating + } : {}, [enabled, reference, floating]); } function useFloatingRootContext(options) { @@ -2903,7 +3606,7 @@ function useFloatingRootContext(options) { const nested = useFloatingParentNodeId() != null; if (true) { const optionDomReference = elementsProp.reference; - if (optionDomReference && !(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(optionDomReference)) { + if (optionDomReference && !(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(optionDomReference)) { error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `refs.setPositionReference()`', 'instead.'); } } @@ -2969,7 +3672,7 @@ function useFloating(options) { domReferenceRef.current = domReference; } }, [domReference]); - const position = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__.useFloating)({ + const position = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.useFloating)({ ...options, elements: { ...computedElements, @@ -2979,7 +3682,7 @@ function useFloating(options) { } }); const setPositionReference = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(node => { - const computedPositionReference = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(node) ? { + const computedPositionReference = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(node) ? { getBoundingClientRect: () => node.getBoundingClientRect(), contextElement: node } : node; @@ -2989,18 +3692,18 @@ function useFloating(options) { position.refs.setReference(computedPositionReference); }, [position.refs]); const setReference = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(node => { - if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(node) || node === null) { + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(node) || node === null) { domReferenceRef.current = node; setDomReference(node); } // Backwards-compatibility for passing a virtual element to `reference` // after it has set the DOM reference. - if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(position.refs.reference.current) || position.refs.reference.current === null || + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to // `null` to support `positionReference` + an unstable `reference` // callback ref. - node !== null && !(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(node)) { + node !== null && !(0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(node)) { position.refs.setReference(node); } }, [position.refs]); @@ -3050,9 +3753,7 @@ function useFocus(context, props) { onOpenChange, events, dataRef, - elements: { - domReference - } + elements } = context; const { enabled = true, @@ -3062,16 +3763,14 @@ function useFocus(context, props) { const timeoutRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(); const keyboardModalityRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(true); react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { - if (!enabled) { - return; - } - const win = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.getWindow)(domReference); + if (!enabled) return; + const win = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.getWindow)(elements.domReference); // If the reference was focused and the user left the tab/window, and the // floating element was not open, the focus should be blocked when they // return to the tab/window. function onBlur() { - if (!open && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isHTMLElement)(domReference) && domReference === (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(domReference))) { + if (!open && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isHTMLElement)(elements.domReference) && elements.domReference === (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(elements.domReference))) { blockFocusRef.current = true; } } @@ -3084,11 +3783,9 @@ function useFocus(context, props) { win.removeEventListener('blur', onBlur); win.removeEventListener('keydown', onKeyDown, true); }; - }, [domReference, open, enabled]); + }, [elements.domReference, open, enabled]); react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { - if (!enabled) { - return; - } + if (!enabled) return; function onOpenChange(_ref) { let { reason @@ -3107,70 +3804,67 @@ function useFocus(context, props) { clearTimeout(timeoutRef.current); }; }, []); - return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { - if (!enabled) { - return {}; - } - return { - reference: { - onPointerDown(event) { - if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isVirtualPointerEvent)(event.nativeEvent)) return; - keyboardModalityRef.current = false; - }, - onMouseLeave() { - blockFocusRef.current = false; - }, - onFocus(event) { - if (blockFocusRef.current) return; - const target = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getTarget)(event.nativeEvent); - if (visibleOnly && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(target)) { - try { - // Mac Safari unreliably matches `:focus-visible` on the reference - // if focus was outside the page initially - use the fallback - // instead. - if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isSafari)() && (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isMac)()) throw Error(); - if (!target.matches(':focus-visible')) return; - } catch (e) { - // Old browsers will throw an error when using `:focus-visible`. - if (!keyboardModalityRef.current && !(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isTypeableElement)(target)) { - return; - } - } + const reference = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => ({ + onPointerDown(event) { + if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isVirtualPointerEvent)(event.nativeEvent)) return; + keyboardModalityRef.current = false; + }, + onMouseLeave() { + blockFocusRef.current = false; + }, + onFocus(event) { + if (blockFocusRef.current) return; + const target = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getTarget)(event.nativeEvent); + if (visibleOnly && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(target)) { + try { + // Mac Safari unreliably matches `:focus-visible` on the reference + // if focus was outside the page initially - use the fallback + // instead. + if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isSafari)() && (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isMac)()) throw Error(); + if (!target.matches(':focus-visible')) return; + } catch (e) { + // Old browsers will throw an error when using `:focus-visible`. + if (!keyboardModalityRef.current && !(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isTypeableElement)(target)) { + return; } - onOpenChange(true, event.nativeEvent, 'focus'); - }, - onBlur(event) { - blockFocusRef.current = false; - const relatedTarget = event.relatedTarget; - - // Hit the non-modal focus management portal guard. Focus will be - // moved into the floating element immediately after. - const movedToFocusGuard = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(relatedTarget) && relatedTarget.hasAttribute(createAttribute('focus-guard')) && relatedTarget.getAttribute('data-type') === 'outside'; - - // Wait for the window blur listener to fire. - timeoutRef.current = window.setTimeout(() => { - var _dataRef$current$floa; - const activeEl = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)(domReference ? domReference.ownerDocument : document); - - // Focus left the page, keep it open. - if (!relatedTarget && activeEl === domReference) return; - - // When focusing the reference element (e.g. regular click), then - // clicking into the floating element, prevent it from hiding. - // Note: it must be focusable, e.g. `tabindex="-1"`. - // We can not rely on relatedTarget to point to the correct element - // as it will only point to the shadow host of the newly focused element - // and not the element that actually has received focus if it is located - // inside a shadow root. - if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)((_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.refs.floating.current, activeEl) || (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(domReference, activeEl) || movedToFocusGuard) { - return; - } - onOpenChange(false, event.nativeEvent, 'focus'); - }); } } - }; - }, [enabled, visibleOnly, dataRef, domReference, onOpenChange]); + onOpenChange(true, event.nativeEvent, 'focus'); + }, + onBlur(event) { + blockFocusRef.current = false; + const relatedTarget = event.relatedTarget; + const nativeEvent = event.nativeEvent; + + // Hit the non-modal focus management portal guard. Focus will be + // moved into the floating element immediately after. + const movedToFocusGuard = (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(relatedTarget) && relatedTarget.hasAttribute(createAttribute('focus-guard')) && relatedTarget.getAttribute('data-type') === 'outside'; + + // Wait for the window blur listener to fire. + timeoutRef.current = window.setTimeout(() => { + var _dataRef$current$floa; + const activeEl = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)(elements.domReference ? elements.domReference.ownerDocument : document); + + // Focus left the page, keep it open. + if (!relatedTarget && activeEl === elements.domReference) return; + + // When focusing the reference element (e.g. regular click), then + // clicking into the floating element, prevent it from hiding. + // Note: it must be focusable, e.g. `tabindex="-1"`. + // We can not rely on relatedTarget to point to the correct element + // as it will only point to the shadow host of the newly focused element + // and not the element that actually has received focus if it is located + // inside a shadow root. + if ((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)((_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.refs.floating.current, activeEl) || (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(elements.domReference, activeEl) || movedToFocusGuard) { + return; + } + onOpenChange(false, nativeEvent, 'focus'); + }); + } + }), [dataRef, elements.domReference, onOpenChange, visibleOnly]); + return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => enabled ? { + reference + } : {}, [enabled, reference]); } const ACTIVE_KEY = 'active'; @@ -3240,22 +3934,18 @@ function useInteractions(propsList) { if (propsList === void 0) { propsList = []; } - // The dependencies are a dynamic array, so we can't use the linter's - // suggestion to add it to the deps array. - const deps = propsList; + const referenceDeps = propsList.map(key => key == null ? void 0 : key.reference); + const floatingDeps = propsList.map(key => key == null ? void 0 : key.floating); + const itemDeps = propsList.map(key => key == null ? void 0 : key.item); const getReferenceProps = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(userProps => mergeProps(userProps, propsList, 'reference'), // eslint-disable-next-line react-hooks/exhaustive-deps - deps); + referenceDeps); const getFloatingProps = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(userProps => mergeProps(userProps, propsList, 'floating'), // eslint-disable-next-line react-hooks/exhaustive-deps - deps); + floatingDeps); const getItemProps = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(userProps => mergeProps(userProps, propsList, 'item'), - // Granularly check for `item` changes, because the `getItemProps` getter - // should be as referentially stable as possible since it may be passed as - // a prop to many components. All `item` key values must therefore be - // memoized. // eslint-disable-next-line react-hooks/exhaustive-deps - propsList.map(key => key == null ? void 0 : key.item)); + itemDeps); return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => ({ getReferenceProps, getFloatingProps, @@ -3303,10 +3993,7 @@ function useListNavigation(context, props) { const { open, onOpenChange, - elements: { - domReference, - floating - } + elements } = context; const { listRef, @@ -3351,13 +4038,14 @@ function useListNavigation(context, props) { const keyRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null); const isPointerModalityRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(true); const previousOnNavigateRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(onNavigate); - const previousMountedRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(!!floating); + const previousMountedRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(!!elements.floating); + const previousOpenRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(open); const forceSyncFocus = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false); const forceScrollIntoViewRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false); const disabledIndicesRef = useLatestRef(disabledIndices); const latestOpenRef = useLatestRef(open); const scrollItemIntoViewRef = useLatestRef(scrollItemIntoView); - const floatingRef = useLatestRef(floating); + const floatingRef = useLatestRef(elements.floating); const selectedIndexRef = useLatestRef(selectedIndex); const [activeId, setActiveId] = react__WEBPACK_IMPORTED_MODULE_0__.useState(); const [virtualId, setVirtualId] = react__WEBPACK_IMPORTED_MODULE_0__.useState(); @@ -3421,10 +4109,8 @@ function useListNavigation(context, props) { // Sync `selectedIndex` to be the `activeIndex` upon opening the floating // element. Also, reset `activeIndex` upon closing the floating element. index(() => { - if (!enabled) { - return; - } - if (open && floating) { + if (!enabled) return; + if (open && elements.floating) { if (focusItemOnOpenRef.current && selectedIndex != null) { // Regardless of the pointer modality, we want to ensure the selected // item comes into view when the floating element is opened. @@ -3439,15 +4125,13 @@ function useListNavigation(context, props) { indexRef.current = -1; previousOnNavigateRef.current(null); } - }, [enabled, open, floating, selectedIndex, onNavigate]); + }, [enabled, open, elements.floating, selectedIndex, onNavigate]); // Sync `activeIndex` to be the focused item while the floating element is // open. index(() => { - if (!enabled) { - return; - } - if (open && floating) { + if (!enabled) return; + if (open && elements.floating) { if (activeIndex == null) { forceSyncFocus.current = false; if (selectedIndexRef.current != null) { @@ -3461,7 +4145,7 @@ function useListNavigation(context, props) { } // Initial sync. - if (!previousMountedRef.current && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) { + if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) { let runs = 0; const waitForListPopulated = () => { if (listRef.current[0] == null) { @@ -3487,27 +4171,30 @@ function useListNavigation(context, props) { forceScrollIntoViewRef.current = false; } } - }, [enabled, open, floating, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, disabledIndicesRef]); + }, [enabled, open, elements.floating, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, disabledIndicesRef]); // Ensure the parent floating element has focus when a nested child closes // to allow arrow key navigation to work after the pointer leaves the child. index(() => { var _nodes$find; - if (!enabled || floating || !tree || virtual || !previousMountedRef.current) { + if (!enabled || elements.floating || !tree || virtual || !previousMountedRef.current) { return; } const nodes = tree.nodesRef.current; const parent = (_nodes$find = nodes.find(node => node.id === parentId)) == null || (_nodes$find = _nodes$find.context) == null ? void 0 : _nodes$find.elements.floating; - const activeEl = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(floating)); + const activeEl = (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getDocument)(elements.floating)); const treeContainsActiveEl = nodes.some(node => node.context && (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(node.context.elements.floating, activeEl)); if (parent && !treeContainsActiveEl && isPointerModalityRef.current) { parent.focus({ preventScroll: true }); } - }, [enabled, floating, tree, parentId, virtual]); + }, [enabled, elements.floating, tree, parentId, virtual]); index(() => { - if (!enabled || !tree || !virtual || parentId) return; + if (!enabled) return; + if (!tree) return; + if (!virtual) return; + if (parentId) return; function handleVirtualFocus(item) { setVirtualId(item.id); if (virtualItemRef) { @@ -3521,13 +4208,16 @@ function useListNavigation(context, props) { }, [enabled, tree, virtual, parentId, virtualItemRef]); index(() => { previousOnNavigateRef.current = onNavigate; - previousMountedRef.current = !!floating; + previousMountedRef.current = !!elements.floating; }); index(() => { if (!open) { keyRef.current = null; } }, [open]); + index(() => { + previousOpenRef.current = open; + }, [open]); const hasActiveIndex = activeIndex != null; const item = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { function syncCurrentTarget(currentTarget) { @@ -3580,125 +4270,136 @@ function useListNavigation(context, props) { }; return props; }, [open, floatingRef, focusItem, focusItemOnHover, listRef, onNavigate, virtual]); - return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { - if (!enabled) { - return {}; - } - const disabledIndices = disabledIndicesRef.current; - function onKeyDown(event) { - isPointerModalityRef.current = false; - forceSyncFocus.current = true; + const commonOnKeyDown = useEffectEvent(event => { + isPointerModalityRef.current = false; + forceSyncFocus.current = true; - // If the floating element is animating out, ignore navigation. Otherwise, - // the `activeIndex` gets set to 0 despite not being open so the next time - // the user ArrowDowns, the first item won't be focused. - if (!latestOpenRef.current && event.currentTarget === floatingRef.current) { + // If the floating element is animating out, ignore navigation. Otherwise, + // the `activeIndex` gets set to 0 despite not being open so the next time + // the user ArrowDowns, the first item won't be focused. + if (!latestOpenRef.current && event.currentTarget === floatingRef.current) { + return; + } + if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl)) { + (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); + onOpenChange(false, event.nativeEvent, 'list-navigation'); + if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isHTMLElement)(elements.domReference) && !virtual) { + elements.domReference.focus(); + } + return; + } + const currentIndex = indexRef.current; + const minIndex = getMinIndex(listRef, disabledIndices); + const maxIndex = getMaxIndex(listRef, disabledIndices); + if (event.key === 'Home') { + (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); + indexRef.current = minIndex; + onNavigate(indexRef.current); + } + if (event.key === 'End') { + (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); + indexRef.current = maxIndex; + onNavigate(indexRef.current); + } + + // Grid navigation. + if (cols > 1) { + const sizes = itemSizes || Array.from({ + length: listRef.current.length + }, () => ({ + width: 1, + height: 1 + })); + // To calculate movements on the grid, we use hypothetical cell indices + // as if every item was 1x1, then convert back to real indices. + const cellMap = buildCellMap(sizes, cols, dense); + const minGridIndex = cellMap.findIndex(index => index != null && !isDisabled(listRef.current, index, disabledIndices)); + // last enabled index + const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !isDisabled(listRef.current, index, disabledIndices) ? cellIndex : foundIndex, -1); + indexRef.current = cellMap[getGridNavigatedIndex({ + current: cellMap.map(itemIndex => itemIndex != null ? listRef.current[itemIndex] : null) + }, { + event, + orientation, + loop, + cols, + // treat undefined (empty grid spaces) as disabled indices so we + // don't end up in them + disabledIndices: getCellIndices([...(disabledIndices || listRef.current.map((_, index) => isDisabled(listRef.current, index) ? index : undefined)), undefined], cellMap), + minIndex: minGridIndex, + maxIndex: maxGridIndex, + prevIndex: getCellIndexOfCorner(indexRef.current > maxIndex ? minIndex : indexRef.current, sizes, cellMap, cols, + // use a corner matching the edge closest to the direction + // we're moving in so we don't end up in the same item. Prefer + // top/left over bottom/right. + event.key === ARROW_DOWN ? 'bl' : event.key === ARROW_RIGHT ? 'tr' : 'tl'), + stopEvent: true + })]; // navigated cell will never be nullish + + onNavigate(indexRef.current); + if (orientation === 'both') { return; } - if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl)) { - (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); - onOpenChange(false, event.nativeEvent, 'list-navigation'); - if ((0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isHTMLElement)(domReference) && !virtual) { - domReference.focus(); - } + } + if (isMainOrientationKey(event.key, orientation)) { + (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); + + // Reset the index if no item is focused. + if (open && !virtual && (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)(event.currentTarget.ownerDocument) === event.currentTarget) { + indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex; + onNavigate(indexRef.current); return; } - const currentIndex = indexRef.current; - const minIndex = getMinIndex(listRef, disabledIndices); - const maxIndex = getMaxIndex(listRef, disabledIndices); - if (event.key === 'Home') { - (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); - indexRef.current = minIndex; - onNavigate(indexRef.current); - } - if (event.key === 'End') { - (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); - indexRef.current = maxIndex; - onNavigate(indexRef.current); - } - - // Grid navigation. - if (cols > 1) { - const sizes = itemSizes || Array.from({ - length: listRef.current.length - }, () => ({ - width: 1, - height: 1 - })); - // To calculate movements on the grid, we use hypothetical cell indices - // as if every item was 1x1, then convert back to real indices. - const cellMap = buildCellMap(sizes, cols, dense); - const minGridIndex = cellMap.findIndex(index => index != null && !isDisabled(listRef.current, index, disabledIndices)); - // last enabled index - const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !isDisabled(listRef.current, index, disabledIndices) ? cellIndex : foundIndex, -1); - indexRef.current = cellMap[getGridNavigatedIndex({ - current: cellMap.map(itemIndex => itemIndex != null ? listRef.current[itemIndex] : null) - }, { - event, - orientation, - loop, - cols, - // treat undefined (empty grid spaces) as disabled indices so we - // don't end up in them - disabledIndices: getCellIndices([...(disabledIndices || listRef.current.map((_, index) => isDisabled(listRef.current, index) ? index : undefined)), undefined], cellMap), - minIndex: minGridIndex, - maxIndex: maxGridIndex, - prevIndex: getCellIndexOfCorner(indexRef.current > maxIndex ? minIndex : indexRef.current, sizes, cellMap, cols, - // use a corner matching the edge closest to the direction - // we're moving in so we don't end up in the same item. Prefer - // top/left over bottom/right. - event.key === ARROW_DOWN ? 'bl' : event.key === ARROW_RIGHT ? 'tr' : 'tl'), - stopEvent: true - })]; // navigated cell will never be nullish - - onNavigate(indexRef.current); - if (orientation === 'both') { - return; - } - } - if (isMainOrientationKey(event.key, orientation)) { - (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); - - // Reset the index if no item is focused. - if (open && !virtual && (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.activeElement)(event.currentTarget.ownerDocument) === event.currentTarget) { - indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex; - onNavigate(indexRef.current); - return; - } - if (isMainOrientationToEndKey(event.key, orientation, rtl)) { - if (loop) { - indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : findNonDisabledIndex(listRef, { - startingIndex: currentIndex, - disabledIndices - }); - } else { - indexRef.current = Math.min(maxIndex, findNonDisabledIndex(listRef, { - startingIndex: currentIndex, - disabledIndices - })); - } + if (isMainOrientationToEndKey(event.key, orientation, rtl)) { + if (loop) { + indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : findNonDisabledIndex(listRef, { + startingIndex: currentIndex, + disabledIndices + }); } else { - if (loop) { - indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : findNonDisabledIndex(listRef, { - startingIndex: currentIndex, - decrement: true, - disabledIndices - }); - } else { - indexRef.current = Math.max(minIndex, findNonDisabledIndex(listRef, { - startingIndex: currentIndex, - decrement: true, - disabledIndices - })); - } + indexRef.current = Math.min(maxIndex, findNonDisabledIndex(listRef, { + startingIndex: currentIndex, + disabledIndices + })); } - if (isIndexOutOfBounds(listRef, indexRef.current)) { - onNavigate(null); + } else { + if (loop) { + indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : findNonDisabledIndex(listRef, { + startingIndex: currentIndex, + decrement: true, + disabledIndices + }); } else { - onNavigate(indexRef.current); + indexRef.current = Math.max(minIndex, findNonDisabledIndex(listRef, { + startingIndex: currentIndex, + decrement: true, + disabledIndices + })); } } + if (isIndexOutOfBounds(listRef, indexRef.current)) { + onNavigate(null); + } else { + onNavigate(indexRef.current); + } } + }); + const ariaActiveDescendantProp = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { + return virtual && open && hasActiveIndex && { + 'aria-activedescendant': virtualId || activeId + }; + }, [virtual, open, hasActiveIndex, virtualId, activeId]); + const floating = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { + return { + 'aria-orientation': orientation === 'both' ? undefined : orientation, + ...(!(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isTypeableCombobox)(elements.domReference) && ariaActiveDescendantProp), + onKeyDown: commonOnKeyDown, + onPointerMove() { + isPointerModalityRef.current = true; + } + }; + }, [ariaActiveDescendantProp, commonOnKeyDown, elements.domReference, orientation]); + const reference = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { function checkVirtualMouse(event) { if (focusItemOnOpen === 'auto' && (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isVirtualClick)(event.nativeEvent)) { focusItemOnOpenRef.current = true; @@ -3711,105 +4412,95 @@ function useListNavigation(context, props) { focusItemOnOpenRef.current = true; } } - const ariaActiveDescendantProp = virtual && open && hasActiveIndex && { - 'aria-activedescendant': virtualId || activeId - }; - const activeItem = listRef.current.find(item => (item == null ? void 0 : item.id) === activeId); return { - reference: { - ...ariaActiveDescendantProp, - onKeyDown(event) { - isPointerModalityRef.current = false; - const isArrowKey = event.key.indexOf('Arrow') === 0; - const isCrossOpenKey = isCrossOrientationOpenKey(event.key, orientation, rtl); - const isCrossCloseKey = isCrossOrientationCloseKey(event.key, orientation, rtl); - const isMainKey = isMainOrientationKey(event.key, orientation); - const isNavigationKey = (nested ? isCrossOpenKey : isMainKey) || event.key === 'Enter' || event.key.trim() === ''; - if (virtual && open) { - const rootNode = tree == null ? void 0 : tree.nodesRef.current.find(node => node.parentId == null); - const deepestNode = tree && rootNode ? getDeepestNode(tree.nodesRef.current, rootNode.id) : null; - if (isArrowKey && deepestNode && virtualItemRef) { - const eventObject = new KeyboardEvent('keydown', { - key: event.key, - bubbles: true - }); - if (isCrossOpenKey || isCrossCloseKey) { - var _deepestNode$context, _deepestNode$context2; - const isCurrentTarget = ((_deepestNode$context = deepestNode.context) == null ? void 0 : _deepestNode$context.elements.domReference) === event.currentTarget; - const dispatchItem = isCrossCloseKey && !isCurrentTarget ? (_deepestNode$context2 = deepestNode.context) == null ? void 0 : _deepestNode$context2.elements.domReference : isCrossOpenKey ? activeItem : null; - if (dispatchItem) { - (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); - dispatchItem.dispatchEvent(eventObject); - setVirtualId(undefined); - } - } - if (isMainKey && deepestNode.context) { - if (deepestNode.context.open && deepestNode.parentId && event.currentTarget !== deepestNode.context.elements.domReference) { - var _deepestNode$context$; - (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); - (_deepestNode$context$ = deepestNode.context.elements.domReference) == null || _deepestNode$context$.dispatchEvent(eventObject); - return; - } + ...ariaActiveDescendantProp, + onKeyDown(event) { + isPointerModalityRef.current = false; + const isArrowKey = event.key.indexOf('Arrow') === 0; + const isCrossOpenKey = isCrossOrientationOpenKey(event.key, orientation, rtl); + const isCrossCloseKey = isCrossOrientationCloseKey(event.key, orientation, rtl); + const isMainKey = isMainOrientationKey(event.key, orientation); + const isNavigationKey = (nested ? isCrossOpenKey : isMainKey) || event.key === 'Enter' || event.key.trim() === ''; + if (virtual && open) { + const rootNode = tree == null ? void 0 : tree.nodesRef.current.find(node => node.parentId == null); + const deepestNode = tree && rootNode ? getDeepestNode(tree.nodesRef.current, rootNode.id) : null; + if (isArrowKey && deepestNode && virtualItemRef) { + const eventObject = new KeyboardEvent('keydown', { + key: event.key, + bubbles: true + }); + if (isCrossOpenKey || isCrossCloseKey) { + var _deepestNode$context, _deepestNode$context2; + const isCurrentTarget = ((_deepestNode$context = deepestNode.context) == null ? void 0 : _deepestNode$context.elements.domReference) === event.currentTarget; + const dispatchItem = isCrossCloseKey && !isCurrentTarget ? (_deepestNode$context2 = deepestNode.context) == null ? void 0 : _deepestNode$context2.elements.domReference : isCrossOpenKey ? listRef.current.find(item => (item == null ? void 0 : item.id) === activeId) : null; + if (dispatchItem) { + (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); + dispatchItem.dispatchEvent(eventObject); + setVirtualId(undefined); + } + } + if (isMainKey && deepestNode.context) { + if (deepestNode.context.open && deepestNode.parentId && event.currentTarget !== deepestNode.context.elements.domReference) { + var _deepestNode$context$; + (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); + (_deepestNode$context$ = deepestNode.context.elements.domReference) == null || _deepestNode$context$.dispatchEvent(eventObject); + return; } } - return onKeyDown(event); } + return commonOnKeyDown(event); + } - // If a floating element should not open on arrow key down, avoid - // setting `activeIndex` while it's closed. - if (!open && !openOnArrowKeyDown && isArrowKey) { - return; - } - if (isNavigationKey) { - keyRef.current = nested && isMainKey ? null : event.key; - } - if (nested) { - if (isCrossOpenKey) { - (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); - if (open) { - indexRef.current = getMinIndex(listRef, disabledIndices); - onNavigate(indexRef.current); - } else { - onOpenChange(true, event.nativeEvent, 'list-navigation'); - } - } - return; - } - if (isMainKey) { - if (selectedIndex != null) { - indexRef.current = selectedIndex; - } + // If a floating element should not open on arrow key down, avoid + // setting `activeIndex` while it's closed. + if (!open && !openOnArrowKeyDown && isArrowKey) { + return; + } + if (isNavigationKey) { + keyRef.current = nested && isMainKey ? null : event.key; + } + if (nested) { + if (isCrossOpenKey) { (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); - if (!open && openOnArrowKeyDown) { - onOpenChange(true, event.nativeEvent, 'list-navigation'); - } else { - onKeyDown(event); - } if (open) { + indexRef.current = getMinIndex(listRef, disabledIndicesRef.current); onNavigate(indexRef.current); + } else { + onOpenChange(true, event.nativeEvent, 'list-navigation'); } } - }, - onFocus() { - if (open && !virtual) { - onNavigate(null); + return; + } + if (isMainKey) { + if (selectedIndex != null) { + indexRef.current = selectedIndex; + } + (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); + if (!open && openOnArrowKeyDown) { + onOpenChange(true, event.nativeEvent, 'list-navigation'); + } else { + commonOnKeyDown(event); + } + if (open) { + onNavigate(indexRef.current); } - }, - onPointerDown: checkVirtualPointer, - onMouseDown: checkVirtualMouse, - onClick: checkVirtualMouse - }, - floating: { - 'aria-orientation': orientation === 'both' ? undefined : orientation, - ...(!(0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.isTypeableCombobox)(domReference) && ariaActiveDescendantProp), - onKeyDown, - onPointerMove() { - isPointerModalityRef.current = true; } }, - item + onFocus() { + if (open && !virtual) { + onNavigate(null); + } + }, + onPointerDown: checkVirtualPointer, + onMouseDown: checkVirtualMouse, + onClick: checkVirtualMouse }; - }, [domReference, floatingRef, activeId, virtualId, disabledIndicesRef, latestOpenRef, listRef, enabled, orientation, rtl, virtual, open, hasActiveIndex, nested, selectedIndex, openOnArrowKeyDown, allowEscape, cols, loop, focusItemOnOpen, onNavigate, onOpenChange, item, tree, virtualItemRef, itemSizes, dense]); + }, [activeId, ariaActiveDescendantProp, commonOnKeyDown, disabledIndicesRef, focusItemOnOpen, listRef, nested, onNavigate, onOpenChange, open, openOnArrowKeyDown, orientation, rtl, selectedIndex, tree, virtual, virtualItemRef]); + return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => enabled ? { + reference, + floating, + item + } : {}, [enabled, reference, floating, item]); } const componentRoleToAriaRoleMap = /*#__PURE__*/new Map([['select', 'listbox'], ['combobox', 'listbox'], ['label', false]]); @@ -3836,8 +4527,34 @@ function useRole(context, props) { const referenceId = useId(); const parentId = useFloatingParentNodeId(); const isNested = parentId != null; - return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { - if (!enabled) return {}; + const reference = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { + if (ariaRole === 'tooltip' || role === 'label') { + return { + ["aria-" + (role === 'label' ? 'labelledby' : 'describedby')]: open ? floatingId : undefined + }; + } + return { + 'aria-expanded': open ? 'true' : 'false', + 'aria-haspopup': ariaRole === 'alertdialog' ? 'dialog' : ariaRole, + 'aria-controls': open ? floatingId : undefined, + ...(ariaRole === 'listbox' && { + role: 'combobox' + }), + ...(ariaRole === 'menu' && { + id: referenceId + }), + ...(ariaRole === 'menu' && isNested && { + role: 'menuitem' + }), + ...(role === 'select' && { + 'aria-autocomplete': 'none' + }), + ...(role === 'combobox' && { + 'aria-autocomplete': 'list' + }) + }; + }, [ariaRole, floatingId, isNested, open, referenceId, role]); + const floating = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { const floatingProps = { id: floatingId, ...(ariaRole && { @@ -3845,75 +4562,53 @@ function useRole(context, props) { }) }; if (ariaRole === 'tooltip' || role === 'label') { - return { - reference: { - ["aria-" + (role === 'label' ? 'labelledby' : 'describedby')]: open ? floatingId : undefined - }, - floating: floatingProps - }; + return floatingProps; } return { - reference: { - 'aria-expanded': open ? 'true' : 'false', - 'aria-haspopup': ariaRole === 'alertdialog' ? 'dialog' : ariaRole, - 'aria-controls': open ? floatingId : undefined, - ...(ariaRole === 'listbox' && { - role: 'combobox' - }), - ...(ariaRole === 'menu' && { - id: referenceId - }), - ...(ariaRole === 'menu' && isNested && { - role: 'menuitem' - }), - ...(role === 'select' && { - 'aria-autocomplete': 'none' - }), - ...(role === 'combobox' && { - 'aria-autocomplete': 'list' - }) - }, - floating: { - ...floatingProps, - ...(ariaRole === 'menu' && { - 'aria-labelledby': referenceId - }) - }, - item(_ref) { - let { - active, - selected - } = _ref; - const commonProps = { - role: 'option', - ...(active && { - id: floatingId + "-option" - }) - }; - - // For `menu`, we are unable to tell if the item is a `menuitemradio` - // or `menuitemcheckbox`. For backwards-compatibility reasons, also - // avoid defaulting to `menuitem` as it may overwrite custom role props. - switch (role) { - case 'select': - return { - ...commonProps, - 'aria-selected': active && selected - }; - case 'combobox': - { - return { - ...commonProps, - ...(active && { - 'aria-selected': true - }) - }; - } - } - return {}; - } + ...floatingProps, + ...(ariaRole === 'menu' && { + 'aria-labelledby': referenceId + }) }; - }, [enabled, role, ariaRole, open, floatingId, referenceId, isNested]); + }, [ariaRole, floatingId, referenceId, role]); + const item = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(_ref => { + let { + active, + selected + } = _ref; + const commonProps = { + role: 'option', + ...(active && { + id: floatingId + "-option" + }) + }; + + // For `menu`, we are unable to tell if the item is a `menuitemradio` + // or `menuitemcheckbox`. For backwards-compatibility reasons, also + // avoid defaulting to `menuitem` as it may overwrite custom role props. + switch (role) { + case 'select': + return { + ...commonProps, + 'aria-selected': active && selected + }; + case 'combobox': + { + return { + ...commonProps, + ...(active && { + 'aria-selected': true + }) + }; + } + } + return {}; + }, [floatingId, role]); + return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => enabled ? { + reference, + floating, + item + } : {}, [enabled, reference, floating, item]); } // Converts a JS style key like `backgroundColor` to a CSS transition-property @@ -4102,92 +4797,91 @@ function useTypeahead(context, props) { prevIndexRef.current = (_ref2 = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref2 : -1; } }, [open, selectedIndex, activeIndex]); - return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { - if (!enabled) { - return {}; - } - function setTypingChange(value) { - if (value) { - if (!dataRef.current.typing) { - dataRef.current.typing = value; - onTypingChange(value); - } - } else { - if (dataRef.current.typing) { - dataRef.current.typing = value; - onTypingChange(value); - } + const setTypingChange = useEffectEvent(value => { + if (value) { + if (!dataRef.current.typing) { + dataRef.current.typing = value; + onTypingChange(value); + } + } else { + if (dataRef.current.typing) { + dataRef.current.typing = value; + onTypingChange(value); } } + }); + const onKeyDown = useEffectEvent(event => { function getMatchingIndex(list, orderedList, string) { const str = findMatchRef.current ? findMatchRef.current(orderedList, string) : orderedList.find(text => (text == null ? void 0 : text.toLocaleLowerCase().indexOf(string.toLocaleLowerCase())) === 0); return str ? list.indexOf(str) : -1; } - function onKeyDown(event) { - const listContent = listRef.current; - if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') { - if (getMatchingIndex(listContent, listContent, stringRef.current) === -1) { - setTypingChange(false); - } else if (event.key === ' ') { - (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); - } - } - if (listContent == null || ignoreKeysRef.current.includes(event.key) || - // Character key. - event.key.length !== 1 || - // Modifier key. - event.ctrlKey || event.metaKey || event.altKey) { - return; - } - if (open && event.key !== ' ') { + const listContent = listRef.current; + if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') { + if (getMatchingIndex(listContent, listContent, stringRef.current) === -1) { + setTypingChange(false); + } else if (event.key === ' ') { (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); - setTypingChange(true); - } - - // Bail out if the list contains a word like "llama" or "aaron". TODO: - // allow it in this case, too. - const allowRapidSuccessionOfFirstLetter = listContent.every(text => { - var _text$, _text$2; - return text ? ((_text$ = text[0]) == null ? void 0 : _text$.toLocaleLowerCase()) !== ((_text$2 = text[1]) == null ? void 0 : _text$2.toLocaleLowerCase()) : true; - }); - - // Allows the user to cycle through items that start with the same letter - // in rapid succession. - if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) { - stringRef.current = ''; - prevIndexRef.current = matchIndexRef.current; - } - stringRef.current += event.key; - clearTimeout(timeoutIdRef.current); - timeoutIdRef.current = setTimeout(() => { - stringRef.current = ''; - prevIndexRef.current = matchIndexRef.current; - setTypingChange(false); - }, resetMs); - const prevIndex = prevIndexRef.current; - const index = getMatchingIndex(listContent, [...listContent.slice((prevIndex || 0) + 1), ...listContent.slice(0, (prevIndex || 0) + 1)], stringRef.current); - if (index !== -1) { - onMatch(index); - matchIndexRef.current = index; - } else if (event.key !== ' ') { - stringRef.current = ''; - setTypingChange(false); } } + if (listContent == null || ignoreKeysRef.current.includes(event.key) || + // Character key. + event.key.length !== 1 || + // Modifier key. + event.ctrlKey || event.metaKey || event.altKey) { + return; + } + if (open && event.key !== ' ') { + (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.stopEvent)(event); + setTypingChange(true); + } + + // Bail out if the list contains a word like "llama" or "aaron". TODO: + // allow it in this case, too. + const allowRapidSuccessionOfFirstLetter = listContent.every(text => { + var _text$, _text$2; + return text ? ((_text$ = text[0]) == null ? void 0 : _text$.toLocaleLowerCase()) !== ((_text$2 = text[1]) == null ? void 0 : _text$2.toLocaleLowerCase()) : true; + }); + + // Allows the user to cycle through items that start with the same letter + // in rapid succession. + if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) { + stringRef.current = ''; + prevIndexRef.current = matchIndexRef.current; + } + stringRef.current += event.key; + clearTimeout(timeoutIdRef.current); + timeoutIdRef.current = setTimeout(() => { + stringRef.current = ''; + prevIndexRef.current = matchIndexRef.current; + setTypingChange(false); + }, resetMs); + const prevIndex = prevIndexRef.current; + const index = getMatchingIndex(listContent, [...listContent.slice((prevIndex || 0) + 1), ...listContent.slice(0, (prevIndex || 0) + 1)], stringRef.current); + if (index !== -1) { + onMatch(index); + matchIndexRef.current = index; + } else if (event.key !== ' ') { + stringRef.current = ''; + setTypingChange(false); + } + }); + const reference = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => ({ + onKeyDown + }), [onKeyDown]); + const floating = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { return { - reference: { - onKeyDown - }, - floating: { - onKeyDown, - onKeyUp(event) { - if (event.key === ' ') { - setTypingChange(false); - } + onKeyDown, + onKeyUp(event) { + if (event.key === ' ') { + setTypingChange(false); } } }; - }, [enabled, open, dataRef, listRef, resetMs, ignoreKeysRef, findMatchRef, onMatch, onTypingChange]); + }, [onKeyDown, setTypingChange]); + return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => enabled ? { + reference, + floating + } : {}, [enabled, reference, floating]); } function getArgsWithCustomFloatingHeight(state, height) { @@ -4203,8 +4897,8 @@ function getArgsWithCustomFloatingHeight(state, height) { }; } /** - * Positions the floating element such that an inner element inside - * of it is anchored to the reference element. + * Positions the floating element such that an inner element inside of it is + * anchored to the reference element. * @see https://floating-ui.com/docs/inner */ const inner = props => ({ @@ -4221,7 +4915,7 @@ const inner = props => ({ referenceOverflowThreshold = 0, scrollRef, ...detectOverflowOptions - } = props; + } = (0,_floating_ui_utils__WEBPACK_IMPORTED_MODULE_6__.evaluate)(props, state); const { rects, elements: { @@ -4239,11 +4933,11 @@ const inner = props => ({ } const nextArgs = { ...state, - ...(await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_1__.offset)(-item.offsetTop - floating.clientTop - rects.reference.height / 2 - item.offsetHeight / 2 - innerOffset).fn(state)) + ...(await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.offset)(-item.offsetTop - floating.clientTop - rects.reference.height / 2 - item.offsetHeight / 2 - innerOffset).fn(state)) }; const el = (scrollRef == null ? void 0 : scrollRef.current) || floating; - const overflow = await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.detectOverflow)(getArgsWithCustomFloatingHeight(nextArgs, el.scrollHeight), detectOverflowOptions); - const refOverflow = await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.detectOverflow)(nextArgs, { + const overflow = await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.detectOverflow)(getArgsWithCustomFloatingHeight(nextArgs, el.scrollHeight), detectOverflowOptions); + const refOverflow = await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.detectOverflow)(nextArgs, { ...detectOverflowOptions, elementContext: 'reference' }); @@ -4256,13 +4950,13 @@ const inner = props => ({ // There is not enough space, fallback to standard anchored positioning if (onFallbackChange) { if (el.offsetHeight < item.offsetHeight * Math.min(minItemsVisible, listRef.current.length - 1) - 1 || refOverflow.top >= -referenceOverflowThreshold || refOverflow.bottom >= -referenceOverflowThreshold) { - (0,react_dom__WEBPACK_IMPORTED_MODULE_4__.flushSync)(() => onFallbackChange(true)); + react_dom__WEBPACK_IMPORTED_MODULE_1__.flushSync(() => onFallbackChange(true)); } else { - (0,react_dom__WEBPACK_IMPORTED_MODULE_4__.flushSync)(() => onFallbackChange(false)); + react_dom__WEBPACK_IMPORTED_MODULE_1__.flushSync(() => onFallbackChange(false)); } } if (overflowRef) { - overflowRef.current = await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_2__.detectOverflow)(getArgsWithCustomFloatingHeight({ + overflowRef.current = await (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.detectOverflow)(getArgsWithCustomFloatingHeight({ ...nextArgs, y: nextY }, el.offsetHeight), detectOverflowOptions); @@ -4293,9 +4987,7 @@ function useInnerOffset(context, props) { const prevScrollTopRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null); const initialOverflowRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null); react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => { - if (!enabled) { - return; - } + if (!enabled) return; function onWheel(e) { if (e.ctrlKey || !el || overflowRef.current == null) { return; @@ -4311,7 +5003,7 @@ function useInnerOffset(context, props) { } if (!isAtTop && dY > 0 || !isAtBottom && dY < 0) { e.preventDefault(); - (0,react_dom__WEBPACK_IMPORTED_MODULE_4__.flushSync)(() => { + react_dom__WEBPACK_IMPORTED_MODULE_1__.flushSync(() => { onChange(d => d + Math[method](dY, remainingScroll * sign)); }); } else if (/firefox/i.test((0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.getUserAgent)())) { @@ -4340,41 +5032,37 @@ function useInnerOffset(context, props) { }; } }, [enabled, open, elements.floating, overflowRef, scrollRef, onChange]); - return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { - if (!enabled) { - return {}; - } - return { - floating: { - onKeyDown() { - controlledScrollingRef.current = true; - }, - onWheel() { - controlledScrollingRef.current = false; - }, - onPointerMove() { - controlledScrollingRef.current = false; - }, - onScroll() { - const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating; - if (!overflowRef.current || !el || !controlledScrollingRef.current) { - return; - } - if (prevScrollTopRef.current !== null) { - const scrollDiff = el.scrollTop - prevScrollTopRef.current; - if (overflowRef.current.bottom < -0.5 && scrollDiff < -1 || overflowRef.current.top < -0.5 && scrollDiff > 1) { - (0,react_dom__WEBPACK_IMPORTED_MODULE_4__.flushSync)(() => onChange(d => d + scrollDiff)); - } - } - - // [Firefox] Wait for the height change to have been applied. - requestAnimationFrame(() => { - prevScrollTopRef.current = el.scrollTop; - }); + const floating = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => ({ + onKeyDown() { + controlledScrollingRef.current = true; + }, + onWheel() { + controlledScrollingRef.current = false; + }, + onPointerMove() { + controlledScrollingRef.current = false; + }, + onScroll() { + const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating; + if (!overflowRef.current || !el || !controlledScrollingRef.current) { + return; + } + if (prevScrollTopRef.current !== null) { + const scrollDiff = el.scrollTop - prevScrollTopRef.current; + if (overflowRef.current.bottom < -0.5 && scrollDiff < -1 || overflowRef.current.top < -0.5 && scrollDiff > 1) { + react_dom__WEBPACK_IMPORTED_MODULE_1__.flushSync(() => onChange(d => d + scrollDiff)); } } - }; - }, [enabled, overflowRef, elements.floating, scrollRef, onChange]); + + // [Firefox] Wait for the height change to have been applied. + requestAnimationFrame(() => { + prevScrollTopRef.current = el.scrollTop; + }); + } + }), [elements.floating, onChange, overflowRef, scrollRef]); + return react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => enabled ? { + floating + } : {}, [enabled, floating]); } function isPointInPolygon(point, polygon) { @@ -4488,7 +5176,7 @@ function safePolygon(options) { // Prevent overlapping floating element from being stuck in an open-close // loop: https://github.com/floating-ui/floating-ui/issues/1910 - if (isLeave && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_3__.isElement)(event.relatedTarget) && (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(elements.floating, event.relatedTarget)) { + if (isLeave && (0,_floating_ui_react_dom__WEBPACK_IMPORTED_MODULE_4__.isElement)(event.relatedTarget) && (0,_floating_ui_react_utils__WEBPACK_IMPORTED_MODULE_5__.contains)(elements.floating, event.relatedTarget)) { return; } @@ -6495,15 +7183,13 @@ function Header(_ref) { "aria-hidden": "true" }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", { className: "hidden lg:block ml-1" - }, "Mail"))) : isPublicTemplate ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { + }, "Mail"))) : isPublicTemplate ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "flex" }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { type: "button", className: "op-btn op-btn-primary op-btn-sm shadow", - onClick: () => { - embedWidgetsData(); - } - }, "Sign Now"))) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { + onClick: () => embedWidgetsData() + }, "Sign Now")) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "flex" }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { onClick: () => window.history.go(-2), @@ -7106,8 +7792,7 @@ function Placeholder(props) { })); }; const xPos = (pos, signYourself) => { - const getPdfPageWidth = props.pdfOriginalWH.find(data => data.pageNumber === props.pageNumber); - const containerScale = props.containerWH.width / (getPdfPageWidth === null || getPdfPageWidth === void 0 ? void 0 : getPdfPageWidth.width); + const containerScale = (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_4__.getContainerScale)(props.pdfOriginalWH, props.pageNumber, props.containerWH); const resizePos = pos.xPosition; if (signYourself) { return resizePos * containerScale * props.scale; @@ -7129,8 +7814,7 @@ function Placeholder(props) { } }; const yPos = (pos, signYourself) => { - const getPdfPageWidth = props.pdfOriginalWH.find(data => data.pageNumber === props.pageNumber); - const containerScale = props.containerWH.width / getPdfPageWidth.width; + const containerScale = (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_4__.getContainerScale)(props.pdfOriginalWH, props.pageNumber, props.containerWH); const resizePos = pos.yPosition; if (signYourself) { return resizePos * containerScale * props.scale; @@ -7345,14 +8029,11 @@ function PlaceholderBorder(props) { return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { onMouseEnter: () => !_constant_Utils__WEBPACK_IMPORTED_MODULE_2__.isMobile && (props === null || props === void 0 ? void 0 : props.setDraggingEnabled(true)), onTouchEnd: () => props.pos.type === _constant_Utils__WEBPACK_IMPORTED_MODULE_2__.textWidget && (props === null || props === void 0 ? void 0 : props.setDraggingEnabled(true)), - className: "absolute inline-block w-[14px] h-[14px] hover:cursor-sw-resize", + className: "absolute inline-block w-[14px] h-[14px] border-[0.2px] overflow-hidden border-dashed", style: { borderColor: _constant_const__WEBPACK_IMPORTED_MODULE_1__.themeColor, - borderStyle: "dashed", minWidth: handleMinWidth() || 0, - minHeight: handleMinHeight() || 0, - borderWidth: "0.2px", - overflow: "hidden" + minHeight: handleMinHeight() || 0 } }); } @@ -7388,7 +8069,7 @@ __webpack_require__.r(__webpack_exports__); -const textWidgetCls = "w-full h-full md:min-w-full md:min-h-full z-[999] text-[12px] rounded-[2px] border-[1px] border-[#007bff] overflow-hidden resize-none outline-none text-base-content item-center whitespace-pre-wrap"; +const textWidgetCls = "w-full h-full md:min-w-full md:min-h-full z-[999] text-[12px] rounded-[2px] border-[1px] border-[#007bff] overflow-hidden resize-none outline-none text-base-content item-center whitespace-pre-wrap bg-white"; const selectWidgetCls = "w-full h-full absolute left-0 top-0 border-[1px] border-[#007bff] rounded-[2px] focus:outline-none text-base-content"; function PlaceholderType(props) { var _props$pos, _props$pos19, _props$data4, _props$data5, _props$pos20, _props$data6, _props$data7, _props$pos21, _props$pos$options7, _props$data9, _props$pos$options11, _props$pos$options12, _props$pos$options13, _props$pos$options14, _props$pos$options15, _props$pos$options16, _props$data11, _props$pos22, _props$pos23, _props$pos24, _props$data13, _props$data14, _props$pos25, _props$data15, _props$pos$options17, _props$pos$options18, _props$pos$options19, _props$pos$options20, _props$pos$options21, _props$pos$options22, _props$data17, _props$pos$options23, _props$pos$options24, _props$pos$options25, _props$pos$options26, _props$pos$options27, _props$pos$options28, _props$data19, _props$pos$options29, _props$pos$options30, _props$pos$options31, _props$pos$options32, _props$pos$options33, _props$pos$options34, _props$data21, _props$data22, _props$pos$options35, _props$selectDate, _props$pos26, _props$pos27, _props$selectDate2, _props$pos28, _props$pos29, _props$data23, _props$data24, _props$pos30, _props$data25, _props$pos$options36, _props$pos$options37, _props$pos$options38, _props$pos$options39, _props$pos$options40, _props$pos$options41, _props$pos$options42, _props$pos$options45, _props$pos$options46, _props$pos$options47, _props$data29, _props$data30; @@ -7491,10 +8172,7 @@ function PlaceholderType(props) { onClick } = _ref; return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { - className: "".concat(selectWidgetCls, " overflow-hidden"), - style: { - fontSize: calculateFontSize() - }, + className: "".concat(selectWidgetCls, " text-[12px] overflow-hidden"), onClick: onClick, ref: ref }, value, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", { @@ -7512,11 +8190,6 @@ function PlaceholderType(props) { } // eslint-disable-next-line react-hooks/exhaustive-deps }, [type]); - const calculateFontSize = () => { - const fontSize = 10 + Math.min(props.pos.Width, props.pos.Height) * 0.1; - const size = fontSize ? fontSize : 12; - return size + "px"; - }; //function for show checked checkbox const selectCheckbox = ind => { var _props$pos$options2, _props$pos$options3; @@ -7695,12 +8368,13 @@ function PlaceholderType(props) { }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { style: { fontSize: (_props$pos$options14 = props.pos.options) !== null && _props$pos$options14 !== void 0 && _props$pos$options14.fontSize ? ((_props$pos$options15 = props.pos.options) === null || _props$pos$options15 === void 0 ? void 0 : _props$pos$options15.fontSize) + "px" : "12px", - color: ((_props$pos$options16 = props.pos.options) === null || _props$pos$options16 === void 0 ? void 0 : _props$pos$options16.fontColor) || "black" + color: ((_props$pos$options16 = props.pos.options) === null || _props$pos$options16 === void 0 ? void 0 : _props$pos$options16.fontColor) || "black", + overflow: "hidden" } }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", null, type)); case "dropdown": return ((_props$data11 = props.data) === null || _props$data11 === void 0 ? void 0 : _props$data11.signerObjId) === props.signerObjId ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("select", { - className: "".concat(selectWidgetCls, " text-[12px]"), + className: "".concat(selectWidgetCls, " text-[12px] bg-inherit"), id: "myDropdown", value: selectOption, onChange: e => { @@ -7718,10 +8392,7 @@ function PlaceholderType(props) { value: data }, data); })) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { - className: selectWidgetCls, - style: { - fontSize: calculateFontSize() - } + className: "text-[12px] overflow-hidden" }, (_props$pos24 = props.pos) !== null && _props$pos24 !== void 0 && (_props$pos24 = _props$pos24.options) !== null && _props$pos24 !== void 0 && _props$pos24.name ? props.pos.options.name : type); case "initials": return props.pos.SignUrl ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("img", { @@ -7754,7 +8425,9 @@ function PlaceholderType(props) { }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { style: { fontSize: (_props$pos$options20 = props.pos.options) !== null && _props$pos$options20 !== void 0 && _props$pos$options20.fontSize ? ((_props$pos$options21 = props.pos.options) === null || _props$pos$options21 === void 0 ? void 0 : _props$pos$options21.fontSize) + "px" : "12px", - color: ((_props$pos$options22 = props.pos.options) === null || _props$pos$options22 === void 0 ? void 0 : _props$pos$options22.fontColor) || "black" + color: ((_props$pos$options22 = props.pos.options) === null || _props$pos$options22 === void 0 ? void 0 : _props$pos$options22.fontColor) || "black", + fontFamily: "Arial, sans-serif", + overflow: "hidden" } }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", null, type)); case "company": @@ -7778,7 +8451,9 @@ function PlaceholderType(props) { }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { style: { fontSize: (_props$pos$options26 = props.pos.options) !== null && _props$pos$options26 !== void 0 && _props$pos$options26.fontSize ? ((_props$pos$options27 = props.pos.options) === null || _props$pos$options27 === void 0 ? void 0 : _props$pos$options27.fontSize) + "px" : "12px", - color: ((_props$pos$options28 = props.pos.options) === null || _props$pos$options28 === void 0 ? void 0 : _props$pos$options28.fontColor) || "black" + color: ((_props$pos$options28 = props.pos.options) === null || _props$pos$options28 === void 0 ? void 0 : _props$pos$options28.fontColor) || "black", + overflow: "hidden", + fontFamily: "Arial, sans-serif" } }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", null, type)); case "job title": @@ -7802,7 +8477,9 @@ function PlaceholderType(props) { }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { style: { fontSize: (_props$pos$options32 = props.pos.options) !== null && _props$pos$options32 !== void 0 && _props$pos$options32.fontSize ? ((_props$pos$options33 = props.pos.options) === null || _props$pos$options33 === void 0 ? void 0 : _props$pos$options33.fontSize) + "px" : "12px", - color: ((_props$pos$options34 = props.pos.options) === null || _props$pos$options34 === void 0 ? void 0 : _props$pos$options34.fontColor) || "black" + color: ((_props$pos$options34 = props.pos.options) === null || _props$pos$options34 === void 0 ? void 0 : _props$pos$options34.fontColor) || "black", + fontFamily: "Arial, sans-serif", + overflow: "hidden" } }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", null, type)); case "date": @@ -7855,7 +8532,7 @@ function PlaceholderType(props) { customInput: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(ExampleCustomInput, null), dateFormat: props.selectDate ? (_props$selectDate = props.selectDate) === null || _props$selectDate === void 0 ? void 0 : _props$selectDate.format : (_props$pos26 = props.pos) !== null && _props$pos26 !== void 0 && (_props$pos26 = _props$pos26.options) !== null && _props$pos26 !== void 0 && (_props$pos26 = _props$pos26.validation) !== null && _props$pos26 !== void 0 && _props$pos26.format ? (_props$pos27 = props.pos) === null || _props$pos27 === void 0 || (_props$pos27 = _props$pos27.options) === null || _props$pos27 === void 0 || (_props$pos27 = _props$pos27.validation) === null || _props$pos27 === void 0 ? void 0 : _props$pos27.format : "MM/dd/yyyy" })) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { - className: "text-[12px] text-black uppercase items-center" + className: "text-[12px] text-black items-center overflow-hidden" }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", null, props.selectDate ? (_props$selectDate2 = props.selectDate) === null || _props$selectDate2 === void 0 ? void 0 : _props$selectDate2.format : (_props$pos28 = props.pos) !== null && _props$pos28 !== void 0 && (_props$pos28 = _props$pos28.options) !== null && _props$pos28 !== void 0 && (_props$pos28 = _props$pos28.validation) !== null && _props$pos28 !== void 0 && _props$pos28.format ? (_props$pos29 = props.pos) === null || _props$pos29 === void 0 || (_props$pos29 = _props$pos29.options) === null || _props$pos29 === void 0 || (_props$pos29 = _props$pos29.validation) === null || _props$pos29 === void 0 ? void 0 : _props$pos29.format : "MM/dd/yyyy")); case "image": return props.pos.SignUrl ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("img", { @@ -7882,13 +8559,16 @@ function PlaceholderType(props) { className: textWidgetCls, style: { fontSize: (_props$pos$options36 = props.pos.options) !== null && _props$pos$options36 !== void 0 && _props$pos$options36.fontSize ? ((_props$pos$options37 = props.pos.options) === null || _props$pos$options37 === void 0 ? void 0 : _props$pos$options37.fontSize) + "px" : "12px", - color: ((_props$pos$options38 = props.pos.options) === null || _props$pos$options38 === void 0 ? void 0 : _props$pos$options38.fontColor) || "black" + color: ((_props$pos$options38 = props.pos.options) === null || _props$pos$options38 === void 0 ? void 0 : _props$pos$options38.fontColor) || "black", + fontFamily: "Arial, sans-serif" }, cols: "50" }) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { style: { fontSize: (_props$pos$options39 = props.pos.options) !== null && _props$pos$options39 !== void 0 && _props$pos$options39.fontSize ? ((_props$pos$options40 = props.pos.options) === null || _props$pos$options40 === void 0 ? void 0 : _props$pos$options40.fontSize) + "px" : "12px", - color: ((_props$pos$options41 = props.pos.options) === null || _props$pos$options41 === void 0 ? void 0 : _props$pos$options41.fontColor) || "black" + color: ((_props$pos$options41 = props.pos.options) === null || _props$pos$options41 === void 0 ? void 0 : _props$pos$options41.fontColor) || "black", + fontFamily: "Arial, sans-serif", + overflow: "hidden" } }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", null, type)); case _constant_Utils__WEBPACK_IMPORTED_MODULE_1__.radioButtonWidget: @@ -7925,6 +8605,7 @@ function PlaceholderType(props) { }, className: textWidgetCls, style: { + fontFamily: "Arial, sans-serif", fontSize: (_props$pos$options45 = props.pos.options) !== null && _props$pos$options45 !== void 0 && _props$pos$options45.fontSize ? ((_props$pos$options46 = props.pos.options) === null || _props$pos$options46 === void 0 ? void 0 : _props$pos$options46.fontSize) + "px" : "12px", color: ((_props$pos$options47 = props.pos.options) === null || _props$pos$options47 === void 0 ? void 0 : _props$pos$options47.fontColor) || "black" }, @@ -8208,8 +8889,7 @@ function RenderPdf(_ref) { // handle signature block width and height according to screen const posWidth = (pos, signYourself) => { - const getPdfPageWidth = pdfOriginalWH.find(data => data.pageNumber === pageNumber); - const containerScale = containerWH.width / getPdfPageWidth.width || 1; + const containerScale = (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_2__.getContainerScale)(pdfOriginalWH, pageNumber, containerWH); const defaultWidth = (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_2__.defaultWidthHeight)(pos.type).width; const posWidth = pos.Width ? pos.Width : defaultWidth; if (signYourself) { @@ -8235,8 +8915,7 @@ function RenderPdf(_ref) { } }; const posHeight = (pos, signYourself) => { - const getPdfPageWidth = pdfOriginalWH.find(data => data.pageNumber === pageNumber); - const containerScale = containerWH.width / (getPdfPageWidth === null || getPdfPageWidth === void 0 ? void 0 : getPdfPageWidth.width) || 1; + const containerScale = (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_2__.getContainerScale)(pdfOriginalWH, pageNumber, containerWH); const posHeight = pos.Height || (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_2__.defaultWidthHeight)(pos.type).height; if (signYourself) { return posHeight * scale * containerScale; @@ -8593,7 +9272,7 @@ function RenderPdf(_ref) { })); })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_pdf__WEBPACK_IMPORTED_MODULE_5__["default"], { onLoadError: () => { - pdfLoad(false); + setPdfLoad(false); }, loading: "Loading Document..", onLoadSuccess: pageDetails, @@ -8729,7 +9408,7 @@ function SignPad(_ref) { } else { if (isTab === "type") { setIsSignImg(""); - onSaveSign(null, false, textWidth, textHeight); + onSaveSign(null, false, !isInitial && textWidth > 150 ? 150 : textWidth, !isInitial && textHeight > 35 ? 35 : textHeight); } else { setIsSignImg(""); canvasRef.current.clear(); @@ -8810,11 +9489,11 @@ function SignPad(_ref) { //get text content to convert in image const textContent = text; const fontfamily = fontStyle ? fontStyle : fontSelect ? fontSelect : "Fasthand"; - + const fontSizeValue = "40px"; //creating span for getting text content width const span = document.createElement("span"); span.textContent = textContent; - span.style.font = "20px ".concat(fontfamily); // here put your text size and font family + span.style.font = "".concat(fontSizeValue, " ").concat(fontfamily); // here put your text size and font family span.style.color = color ? color : penColor; span.style.display = "hidden"; document.body.appendChild(span); // Replace 'container' with the ID of the container element @@ -8824,7 +9503,8 @@ function SignPad(_ref) { // Draw the text content on the canvas const ctx = canvasElement.getContext("2d"); const pixelRatio = window.devicePixelRatio || 1; - const width = span.offsetWidth; + const addExtraWidth = isInitial ? 10 : 50; + const width = span.offsetWidth + addExtraWidth; const height = span.offsetHeight; setTextWidth(width); setTextHeight(height); @@ -9245,12 +9925,15 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ embedDocId: () => (/* binding */ embedDocId), /* harmony export */ fetchImageBase64: () => (/* binding */ fetchImageBase64), /* harmony export */ fetchSubscription: () => (/* binding */ fetchSubscription), +/* harmony export */ fetchSubscriptionInfo: () => (/* binding */ fetchSubscriptionInfo), +/* harmony export */ fetchUrl: () => (/* binding */ fetchUrl), /* harmony export */ findContact: () => (/* binding */ findContact), /* harmony export */ fontColorArr: () => (/* binding */ fontColorArr), /* harmony export */ fontsizeArr: () => (/* binding */ fontsizeArr), /* harmony export */ getAppLogo: () => (/* binding */ getAppLogo), /* harmony export */ getBase64FromIMG: () => (/* binding */ getBase64FromIMG), /* harmony export */ getBase64FromUrl: () => (/* binding */ getBase64FromUrl), +/* harmony export */ getContainerScale: () => (/* binding */ getContainerScale), /* harmony export */ getDate: () => (/* binding */ getDate), /* harmony export */ getDrive: () => (/* binding */ getDrive), /* harmony export */ getFileName: () => (/* binding */ getFileName), @@ -9292,7 +9975,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ urlValidator: () => (/* binding */ urlValidator), /* harmony export */ widgets: () => (/* binding */ widgets) /* harmony export */ }); -/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! axios */ "./node_modules/axios/lib/axios.js"); +/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! axios */ "./node_modules/axios/lib/axios.js"); /* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment */ "./node_modules/moment/moment.js"); /* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); @@ -9305,6 +9988,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(file_saver__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var print_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! print-js */ "./node_modules/print-js/dist/print.js"); /* harmony import */ var print_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(print_js__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var _json_plansArr__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../json/plansArr */ "./src/json/plansArr.js"); @@ -9313,7 +9997,8 @@ __webpack_require__.r(__webpack_exports__); -const fontsizeArr = [7, 8, 9, 10, 11, 12, 13, 14, 15, 18]; + +const fontsizeArr = [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28]; const fontColorArr = ["red", "black", "blue", "yellow"]; const isMobile = window.innerWidth < 767; const isTabAndMobile = window.innerWidth < 1023; @@ -9351,7 +10036,7 @@ async function fetchSubscription(extUserId, contactObjId) { } : { extUserId: extUser }; - const tenatRes = await axios__WEBPACK_IMPORTED_MODULE_7__["default"].post(url, params, { + const tenatRes = await axios__WEBPACK_IMPORTED_MODULE_8__["default"].post(url, params, { headers: headers }); let plan, status, billingDate; @@ -9377,6 +10062,47 @@ async function fetchSubscription(extUserId, contactObjId) { }; } } +async function fetchSubscriptionInfo() { + try { + const Extand_Class = localStorage.getItem("Extand_Class"); + const extClass = Extand_Class && JSON.parse(Extand_Class); + // console.log("extClass ", extClass); + if (extClass && extClass.length > 0) { + var _tenatRes$data5, _tenatRes$data6, _tenatRes$data7, _tenatRes$data8; + const extUser = extClass[0].objectId; + const baseURL = localStorage.getItem("baseUrl"); + const url = "".concat(baseURL, "functions/getsubscriptions"); + const headers = { + "Content-Type": "application/json", + "X-Parse-Application-Id": localStorage.getItem("parseAppId"), + sessionToken: localStorage.getItem("accesstoken") + }; + const params = { + extUserId: extUser + }; + const tenatRes = await axios__WEBPACK_IMPORTED_MODULE_8__["default"].post(url, params, { + headers: headers + }); + const price = (_tenatRes$data5 = tenatRes.data) === null || _tenatRes$data5 === void 0 || (_tenatRes$data5 = _tenatRes$data5.result) === null || _tenatRes$data5 === void 0 || (_tenatRes$data5 = _tenatRes$data5.result) === null || _tenatRes$data5 === void 0 || (_tenatRes$data5 = _tenatRes$data5.SubscriptionDetails) === null || _tenatRes$data5 === void 0 || (_tenatRes$data5 = _tenatRes$data5.data) === null || _tenatRes$data5 === void 0 || (_tenatRes$data5 = _tenatRes$data5.subscription) === null || _tenatRes$data5 === void 0 || (_tenatRes$data5 = _tenatRes$data5.plan) === null || _tenatRes$data5 === void 0 ? void 0 : _tenatRes$data5.price; + const totalPrice = (_tenatRes$data6 = tenatRes.data) === null || _tenatRes$data6 === void 0 || (_tenatRes$data6 = _tenatRes$data6.result) === null || _tenatRes$data6 === void 0 || (_tenatRes$data6 = _tenatRes$data6.result) === null || _tenatRes$data6 === void 0 || (_tenatRes$data6 = _tenatRes$data6.SubscriptionDetails) === null || _tenatRes$data6 === void 0 || (_tenatRes$data6 = _tenatRes$data6.data) === null || _tenatRes$data6 === void 0 || (_tenatRes$data6 = _tenatRes$data6.subscription) === null || _tenatRes$data6 === void 0 ? void 0 : _tenatRes$data6.amount; + const planId = (_tenatRes$data7 = tenatRes.data) === null || _tenatRes$data7 === void 0 || (_tenatRes$data7 = _tenatRes$data7.result) === null || _tenatRes$data7 === void 0 || (_tenatRes$data7 = _tenatRes$data7.result) === null || _tenatRes$data7 === void 0 || (_tenatRes$data7 = _tenatRes$data7.SubscriptionDetails) === null || _tenatRes$data7 === void 0 || (_tenatRes$data7 = _tenatRes$data7.data) === null || _tenatRes$data7 === void 0 || (_tenatRes$data7 = _tenatRes$data7.subscription) === null || _tenatRes$data7 === void 0 ? void 0 : _tenatRes$data7.subscription_id; + const plan_code = (_tenatRes$data8 = tenatRes.data) === null || _tenatRes$data8 === void 0 || (_tenatRes$data8 = _tenatRes$data8.result) === null || _tenatRes$data8 === void 0 || (_tenatRes$data8 = _tenatRes$data8.result) === null || _tenatRes$data8 === void 0 || (_tenatRes$data8 = _tenatRes$data8.SubscriptionDetails) === null || _tenatRes$data8 === void 0 || (_tenatRes$data8 = _tenatRes$data8.data) === null || _tenatRes$data8 === void 0 || (_tenatRes$data8 = _tenatRes$data8.subscription) === null || _tenatRes$data8 === void 0 || (_tenatRes$data8 = _tenatRes$data8.plan) === null || _tenatRes$data8 === void 0 ? void 0 : _tenatRes$data8.plan_code; + return { + status: "success", + price: price, + totalPrice: totalPrice, + planId: planId, + plan_code: plan_code + }; + } + } catch (err) { + console.log("Err in fetch subscription", err); + return { + status: "error", + error: err + }; + } +} //function to get subcripition details from subscription class async function checkIsSubscribed() { try { @@ -9405,7 +10131,7 @@ async function checkIsSubscribedTeam() { if (res.plan === "freeplan") { return false; } else if (res.billingDate) { - const plan = res.plan === "team-weekly" || res.plan === "team-yearly" || res.plan === "teams-monthly" || res.plan === "teams-yearly" || res.plan === "enterprise-monthly" || res.plan === "enterprise-yearly"; + const plan = _json_plansArr__WEBPACK_IMPORTED_MODULE_7__.validplan[res.plan] || false; if (plan && new Date(res.billingDate) > new Date()) { return true; } else { @@ -9440,7 +10166,7 @@ const getDrive = async function (documentId) { limit: limit, skip: skip }; - const driveDeatils = await axios__WEBPACK_IMPORTED_MODULE_7__["default"].post("".concat(localStorage.getItem("baseUrl"), "functions/getDrive"), data, { + const driveDeatils = await axios__WEBPACK_IMPORTED_MODULE_8__["default"].post("".concat(localStorage.getItem("baseUrl"), "functions/getDrive"), data, { headers: { "Content-Type": "application/json", "X-Parse-Application-Id": localStorage.getItem("parseAppId"), @@ -9470,28 +10196,19 @@ const pdfNewWidthFun = divRef => { }; //`contractUsers` function is used to get contract_User details -const contractUsers = async email => { - const data = { - email: email - }; - const userDetails = await axios__WEBPACK_IMPORTED_MODULE_7__["default"].post("".concat(localStorage.getItem("baseUrl"), "functions/getUserDetails"), data, { - headers: { - "Content-Type": "application/json", - "X-Parse-Application-Id": localStorage.getItem("parseAppId"), - sessionToken: localStorage.getItem("accesstoken") - } - }).then(Listdata => { - const json = Listdata.data; +const contractUsers = async () => { + try { + const userDetails = await parse__WEBPACK_IMPORTED_MODULE_3___default().Cloud.run("getUserDetails"); let data = []; - if (json && json.result) { - data.push(json.result); + if (userDetails) { + const json = JSON.parse(JSON.stringify(userDetails)); + data.push(json); } return data; - }).catch(err => { + } catch (err) { console.log("Err in getUserDetails cloud function", err); return "Error: Something went wrong!"; - }); - return userDetails; + } }; //function for resize image and update width and height for mulitisigners @@ -9844,14 +10561,16 @@ const handleSignYourselfImageResize = (ref, key, xyPostion, setXyPostion, index, }; //function for call cloud function signPdf and generate digital signature -const signPdfFun = async (base64Url, documentId, signerObjectId, setIsAlert, objectId, isSubscribed, activeMailAdapter, xyPosition) => { - let singleSign, - isCustomCompletionMail = false; +const signPdfFun = async (base64Url, documentId, signerObjectId, objectId, isSubscribed, activeMailAdapter, widgets) => { + let isCustomCompletionMail = false; try { //get tenant details const tenantDetails = await getTenantDetails(objectId); if (tenantDetails && tenantDetails === "user does not exist!") { - alert("User does not exist"); + return { + status: "error", + message: "User does not exist." + }; } else { if (tenantDetails !== null && tenantDetails !== void 0 && tenantDetails.CompletionBody && tenantDetails !== null && tenantDetails !== void 0 && tenantDetails.CompletionSubject && isSubscribed) { isCustomCompletionMail = true; @@ -9861,7 +10580,7 @@ const signPdfFun = async (base64Url, documentId, signerObjectId, setIsAlert, obj // below for loop is used to get first signature of user to send if to signpdf // for adding it in completion certificate let getSignature; - for (let item of xyPosition) { + for (let item of widgets) { if (!getSignature) { const typeExist = item.pos.some(data => data === null || data === void 0 ? void 0 : data.type); if (typeExist) { @@ -9879,13 +10598,17 @@ const signPdfFun = async (base64Url, documentId, signerObjectId, setIsAlert, obj base64Sign = await fetchImageBase64(base64Sign); } catch (e) { console.log("error", e); + return { + status: "error", + message: "something went wrong." + }; } } - //change image width and height to 104/44 in png base64 + //change image width and height to 100/40 in png base64 const getNewse64 = await changeImageWH(base64Sign); //remove suffiix of base64 const suffixbase64 = getNewse64 && getNewse64.split(",").pop(); - singleSign = { + const params = { mailProvider: activeMailAdapter, pdfFile: base64Url, docId: documentId, @@ -9893,30 +10616,30 @@ const signPdfFun = async (base64Url, documentId, signerObjectId, setIsAlert, obj isCustomCompletionMail: isCustomCompletionMail, signature: suffixbase64 }; - const response = await axios__WEBPACK_IMPORTED_MODULE_7__["default"].post("".concat(localStorage.getItem("baseUrl"), "functions/signPdf"), singleSign, { - headers: { - "Content-Type": "application/json", - "X-Parse-Application-Id": localStorage.getItem("parseAppId"), - // sessionToken: localStorage.getItem("accesstoken") - "X-Parse-Session-Token": localStorage.getItem("accesstoken") - } - }).then(Listdata => { - const json = Listdata.data; - const res = json.result; - return res; - }).catch(err => { - console.log("Err in signPdf cloud function ", err); - setIsAlert({ - isShow: true, - alertMessage: "something went wrong" - }); - }); - return response; + const resSignPdf = await parse__WEBPACK_IMPORTED_MODULE_3___default().Cloud.run("signPdf", params); + if (resSignPdf) { + const signedPdf = JSON.parse(JSON.stringify(resSignPdf)); + return signedPdf; + } } catch (e) { - setIsAlert({ - isShow: true, - alertMessage: "something went wrong" - }); + var _e$message; + console.log("Err in signPdf cloud function ", e.message); + if (e && e !== null && e !== void 0 && (_e$message = e.message) !== null && _e$message !== void 0 && _e$message.includes("is encrypted.")) { + return { + status: "error", + message: "Currently encrypted pdf files are not supported." + }; + } else if (e.message === "PKCS#12 MAC could not be verified. Invalid password?") { + return { + status: "error", + message: "PFX file password is invalid." + }; + } else { + return { + status: "error", + message: "something went wrong." + }; + } } }; const randomId = () => { @@ -9969,7 +10692,7 @@ const createDocument = async (template, placeholders, signerData) => { RemindOnceInEvery: parseInt((Doc === null || Doc === void 0 ? void 0 : Doc.RemindOnceInEvery) || 5) }; try { - const res = await axios__WEBPACK_IMPORTED_MODULE_7__["default"].post("".concat(localStorage.getItem("baseUrl"), "classes/contracts_Document"), data, { + const res = await axios__WEBPACK_IMPORTED_MODULE_8__["default"].post("".concat(localStorage.getItem("baseUrl"), "classes/contracts_Document"), data, { headers: { "Content-Type": "application/json", "X-Parse-Application-Id": localStorage.getItem("parseAppId"), @@ -10482,9 +11205,8 @@ const changeImageWH = async base64Image => { const ctx = canvas.getContext("2d"); canvas.width = newWidth; canvas.height = newHeight; - ctx.imageSmoothingEnabled = false; ctx.drawImage(img, 0, 0, newWidth, newHeight); - const resizedBase64 = canvas.toDataURL("image/png", 1); + const resizedBase64 = canvas.toDataURL("image/png", 1.0); resolve(resizedBase64); }; img.onerror = error => { @@ -10493,9 +11215,20 @@ const changeImageWH = async base64Image => { }); }; +//function to calculate font size of text area widgets +const calculateFontSize = (position, containerScale, signyourself) => { + var _position$options; + const font = (position === null || position === void 0 || (_position$options = position.options) === null || _position$options === void 0 ? void 0 : _position$options.fontSize) || 12; + if (!signyourself && position !== null && position !== void 0 && position.isMobile && position !== null && position !== void 0 && position.scale) { + return font / (position === null || position === void 0 ? void 0 : position.scale) / containerScale; + } else { + return font / containerScale; + } +}; //function for embed multiple signature using pdf-lib -const multiSignEmbed = async (xyPositionArray, pdfDoc, signyourself, scale) => { - for (let item of xyPositionArray) { +const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale, pdfOriginalWH, containerWH) => { + for (let item of widgets) { + const containerScale = getContainerScale(pdfOriginalWH, item === null || item === void 0 ? void 0 : item.pageNumber, containerWH); const typeExist = item.pos.some(data => data === null || data === void 0 ? void 0 : data.type); let updateItem; if (typeExist) { @@ -10575,24 +11308,24 @@ const multiSignEmbed = async (xyPositionArray, pdfDoc, signyourself, scale) => { }; const widgetTypeExist = [textWidget, textInputWidget, "name", "company", "job title", "date", "email"].includes(position.type); if (position.type === "checkbox") { - var _position$options; + var _position$options2; const font = await pdfDoc.embedFont("Helvetica"); let checkboxOptionGapFromTop, isCheck; let y = yPos(position); const optionsFontSize = 13; const checkboxSize = 18; const checkboxTextGapFromLeft = 22; - if ((position === null || position === void 0 || (_position$options = position.options) === null || _position$options === void 0 ? void 0 : _position$options.values.length) > 0) { - var _position$options2; - position === null || position === void 0 || (_position$options2 = position.options) === null || _position$options2 === void 0 || _position$options2.values.forEach((item, ind) => { - var _position$options3, _position$options4, _position$options6, _position$options8; + if ((position === null || position === void 0 || (_position$options2 = position.options) === null || _position$options2 === void 0 ? void 0 : _position$options2.values.length) > 0) { + var _position$options3; + position === null || position === void 0 || (_position$options3 = position.options) === null || _position$options3 === void 0 || _position$options3.values.forEach((item, ind) => { + var _position$options4, _position$options5, _position$options7, _position$options9; const checkboxRandomId = "checkbox" + randomId(); - if (position !== null && position !== void 0 && (_position$options3 = position.options) !== null && _position$options3 !== void 0 && _position$options3.response && (position === null || position === void 0 || (_position$options4 = position.options) === null || _position$options4 === void 0 || (_position$options4 = _position$options4.response) === null || _position$options4 === void 0 ? void 0 : _position$options4.length) > 0) { - var _position$options5; - isCheck = position === null || position === void 0 || (_position$options5 = position.options) === null || _position$options5 === void 0 || (_position$options5 = _position$options5.response) === null || _position$options5 === void 0 ? void 0 : _position$options5.includes(ind); - } else if (position !== null && position !== void 0 && (_position$options6 = position.options) !== null && _position$options6 !== void 0 && _position$options6.defaultValue) { - var _position$options7; - isCheck = position === null || position === void 0 || (_position$options7 = position.options) === null || _position$options7 === void 0 || (_position$options7 = _position$options7.defaultValue) === null || _position$options7 === void 0 ? void 0 : _position$options7.includes(ind); + if (position !== null && position !== void 0 && (_position$options4 = position.options) !== null && _position$options4 !== void 0 && _position$options4.response && (position === null || position === void 0 || (_position$options5 = position.options) === null || _position$options5 === void 0 || (_position$options5 = _position$options5.response) === null || _position$options5 === void 0 ? void 0 : _position$options5.length) > 0) { + var _position$options6; + isCheck = position === null || position === void 0 || (_position$options6 = position.options) === null || _position$options6 === void 0 || (_position$options6 = _position$options6.response) === null || _position$options6 === void 0 ? void 0 : _position$options6.includes(ind); + } else if (position !== null && position !== void 0 && (_position$options7 = position.options) !== null && _position$options7 !== void 0 && _position$options7.defaultValue) { + var _position$options8; + isCheck = position === null || position === void 0 || (_position$options8 = position.options) === null || _position$options8 === void 0 || (_position$options8 = _position$options8.defaultValue) === null || _position$options8 === void 0 ? void 0 : _position$options8.includes(ind); } const checkbox = form.createCheckBox(checkboxRandomId); if (ind > 0) { @@ -10600,7 +11333,7 @@ const multiSignEmbed = async (xyPositionArray, pdfDoc, signyourself, scale) => { } else { checkboxOptionGapFromTop = 26; } - if (!(position !== null && position !== void 0 && (_position$options8 = position.options) !== null && _position$options8 !== void 0 && _position$options8.isHideLabel)) { + if (!(position !== null && position !== void 0 && (_position$options9 = position.options) !== null && _position$options9 !== void 0 && _position$options9.isHideLabel)) { // below line of code is used to embed label with radio button in pdf const optionsPosition = compensateRotation(page.getRotation().angle, xPos(position) + checkboxTextGapFromLeft, y, 1, page.getSize(), optionsFontSize, (0,pdf_lib__WEBPACK_IMPORTED_MODULE_2__.rgb)(0, 0, 0), font, page); page.drawText(item, optionsPosition); @@ -10624,9 +11357,10 @@ const multiSignEmbed = async (xyPositionArray, pdfDoc, signyourself, scale) => { }); } } else if (widgetTypeExist) { - var _position$options9, _position$options10, _position$options11, _position$options13; + var _position$options10, _position$options11, _position$options13; const font = await pdfDoc.embedFont("Helvetica"); - const fontSize = parseInt(position === null || position === void 0 || (_position$options9 = position.options) === null || _position$options9 === void 0 ? void 0 : _position$options9.fontSize) || 12; + const fontSize = calculateFontSize(position, containerScale, signyourself); + parseInt(fontSize); const color = position === null || position === void 0 || (_position$options10 = position.options) === null || _position$options10 === void 0 ? void 0 : _position$options10.fontColor; let updateColorInRgb; if (color === "red") { @@ -10781,7 +11515,7 @@ const multiSignEmbed = async (xyPositionArray, pdfDoc, signyourself, scale) => { const pdfBytes = await pdfDoc.saveAsBase64({ useObjectStreams: false }); - // console.log("pdf", pdfBytes); + //console.log("pdf", pdfBytes); return pdfBytes; }; @@ -10831,7 +11565,7 @@ const placeholderHeight = pos => { //function for getting contracts_contactbook details const contactBook = async objectId => { - const result = await axios__WEBPACK_IMPORTED_MODULE_7__["default"].get("".concat(localStorage.getItem("baseUrl"), "classes/contracts_Contactbook?where={\"objectId\":\"").concat(objectId, "\"}"), { + const result = await axios__WEBPACK_IMPORTED_MODULE_8__["default"].get("".concat(localStorage.getItem("baseUrl"), "classes/contracts_Contactbook?where={\"objectId\":\"").concat(objectId, "\"}"), { headers: { "Content-Type": "application/json", "X-Parse-Application-Id": localStorage.getItem("parseAppId"), @@ -10853,7 +11587,7 @@ const contractDocument = async documentId => { const data = { docId: documentId }; - const documentDeatils = await axios__WEBPACK_IMPORTED_MODULE_7__["default"].post("".concat(localStorage.getItem("baseUrl"), "functions/getDocument"), data, { + const documentDeatils = await axios__WEBPACK_IMPORTED_MODULE_8__["default"].post("".concat(localStorage.getItem("baseUrl"), "functions/getDocument"), data, { headers: { "Content-Type": "application/json", "X-Parse-Application-Id": localStorage.getItem("parseAppId"), @@ -11133,20 +11867,34 @@ const handleSendOTP = async email => { const body = { email: email }; - await axios__WEBPACK_IMPORTED_MODULE_7__["default"].post(url, body, { + await axios__WEBPACK_IMPORTED_MODULE_8__["default"].post(url, body, { headers: headers }); } catch (error) { alert(error.message); } }; +const fetchUrl = async (url, pdfName) => { + try { + const response = await fetch(url); + if (!response.ok) { + alert("something went wrong, please try again later."); + throw new Error("Network response was not ok"); + } + const blob = await response.blob(); + (0,file_saver__WEBPACK_IMPORTED_MODULE_5__.saveAs)(blob, "".concat(sanitizeFileName(pdfName), "_signed_by_OpenSign\u2122.pdf")); + } catch (error) { + alert("something went wrong, please try again later."); + console.error("Error downloading the file:", error); + } +}; //handle download signed pdf const handleDownloadPdf = async (pdfDetails, pdfUrl, setIsDownloading) => { const pdfName = pdfDetails[0] && pdfDetails[0].Name; setIsDownloading("pdf"); try { // const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl }); - const axiosRes = await axios__WEBPACK_IMPORTED_MODULE_7__["default"].post("".concat(localStorage.getItem("baseUrl"), "/functions/getsignedurl"), { + const axiosRes = await axios__WEBPACK_IMPORTED_MODULE_8__["default"].post("".concat(localStorage.getItem("baseUrl"), "/functions/getsignedurl"), { url: pdfUrl }, { headers: { @@ -11156,7 +11904,7 @@ const handleDownloadPdf = async (pdfDetails, pdfUrl, setIsDownloading) => { } }); const url = axiosRes.data.result; - (0,file_saver__WEBPACK_IMPORTED_MODULE_5__.saveAs)(url, "".concat(sanitizeFileName(pdfName), "_signed_by_OpenSign\u2122.pdf")); + await fetchUrl(url, pdfName); setIsDownloading(""); } catch (err) { console.log("err in getsignedurl", err); @@ -11176,7 +11924,7 @@ const handleToPrint = async (event, pdfUrl, setIsDownloading) => { // const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl }); //`localStorage.getItem("baseUrl")` is also use in public-profile flow for public-sign //if we give this `appInfo.baseUrl` as a base url then in public-profile it will create base url of it's window.location.origin ex- opensign.me which is not base url - const axiosRes = await axios__WEBPACK_IMPORTED_MODULE_7__["default"].post("".concat(localStorage.getItem("baseUrl"), "/functions/getsignedurl"), { + const axiosRes = await axios__WEBPACK_IMPORTED_MODULE_8__["default"].post("".concat(localStorage.getItem("baseUrl"), "/functions/getsignedurl"), { url: pdfUrl }, { headers: { @@ -11231,7 +11979,7 @@ const handleDownloadCertificate = async (pdfDetails, setIsDownloading) => { const data = { docId: (_pdfDetails$4 = pdfDetails[0]) === null || _pdfDetails$4 === void 0 ? void 0 : _pdfDetails$4.objectId }; - const docDetails = await axios__WEBPACK_IMPORTED_MODULE_7__["default"].post("".concat(localStorage.getItem("baseUrl"), "functions/getDocument"), data, { + const docDetails = await axios__WEBPACK_IMPORTED_MODULE_8__["default"].post("".concat(localStorage.getItem("baseUrl"), "functions/getDocument"), data, { headers: { "Content-Type": "application/json", "X-Parse-Application-Id": localStorage.getItem("parseAppId"), @@ -11344,6 +12092,12 @@ function getImagePosition(page, image, sizeRatio) { rotate: page.getRotation() }; } +//function to use calculate pdf rendering scale in the container +const getContainerScale = (pdfOriginalWH, pageNumber, containerWH) => { + const getPdfPageWidth = pdfOriginalWH.find(data => data.pageNumber === pageNumber); + const containerScale = (containerWH === null || containerWH === void 0 ? void 0 : containerWH.width) / (getPdfPageWidth === null || getPdfPageWidth === void 0 ? void 0 : getPdfPageWidth.width) || 1; + return containerScale; +}; /***/ }), @@ -11424,7 +12178,97 @@ const themeColor = "#47a3ad"; const iconColor = "#686968"; const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; const isEnableSubscription = true && ((_process$env$REACT_AP = "true") === null || _process$env$REACT_AP === void 0 ? void 0 : _process$env$REACT_AP.toLowerCase()) === "true" ? true : false; -const isStaging = window.location.origin === "https://staging-app.opensignlabs.com"; +const isStaging = "http://localhost:3001"; +// window.location.origin === "https://staging-app.opensignlabs.com"; + +/***/ }), + +/***/ "./src/json/plansArr.js": +/*!******************************!*\ + !*** ./src/json/plansArr.js ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), +/* harmony export */ validplan: () => (/* binding */ validplan) +/* harmony export */ }); +/* harmony import */ var _constant_const__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constant/const */ "./src/constant/const.js"); + +const plans = [{ + planName: "OPENSIGN™ FREE", + img: "free.png", + currency: "", + monthlyPrice: "Free", + yearlyPrice: "Free", + subtitle: "Free Unlimited E-signatures, Forever.", + btn: { + text: "Subscribe", + color: "op-btn-primary" + }, + url: "", + target: "_blank", + benefits: ["Unlimited envelopes", "Sign documents yourself", "Request signatures from others", "14 field types", "Automatic e-signatures", "Completion certificates", "Send in order", "Document templates", "Import from Dropbox", "Contact book", "Document expiry support", "Decline document support", "Email notifications", "Recipient authentication using OTP", "Bulk send (upto 5 docs)", "Public profiles", "And much more"], + yearlyBenefits: ["Unlimited envelopes", "Sign documents yourself", "Request signatures from others", "14 field types", "Automatic e-signatures", "Completion certificates", "Send in order", "Document templates", "Import from Dropbox", "Contact book", "Document expiry support", "Decline document support", "Email notifications", "Recipient authentication using OTP", "Bulk send (upto 5 docs)", "Public profiles", "And much more"] +}, { + planName: "OPENSIGN™ PROFESSIONAL", + img: "professional.png", + currency: "$", + monthlyPrice: "29.99", + yearlyPrice: "9.99/month", + subtitle: "Exclusive Access to advanced features.", + btn: { + text: "Subscribe", + color: "op-btn-primary" + }, + url: _constant_const__WEBPACK_IMPORTED_MODULE_0__.isStaging ? "https://billing.zoho.in/subscribe/9627f62a09df1c8ce500f2f4dc8328dd84ecda20eeae13878ce581d60240f206/pro-weekly" : "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af901d1a09dfa8085585cdd4ec4d7f32137f3/professional-monthly", + yearlyUrl: _constant_const__WEBPACK_IMPORTED_MODULE_0__.isStaging ? "https://billing.zoho.in/subscribe/9627f62a09df1c8ce500f2f4dc8328ddc184411129224f1f29ed84f6cef3b862/pro-yearly" : "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af901d8ad1135190dff951330360e47585a71/professional-yearly", + target: "_self", + benefits: ["Everything in OpenSign™ free", "Field validations", "Regular expression validations", "Organize docs in OpenSign™ Drive", "Webhooks", "Zapier integration", "API Access", "100 API signatures included", "Custom email templates", "Auto reminders", "Bulk send (upto 20 docs)", "Premium Public profile usernames", "Embedding (coming soon)"], + yearlyBenefits: ["Everything in OpenSign™ free", "Field validations", "Regular expression validations", "Organize docs in OpenSign™ Drive", "Webhooks", "Zapier integration", "API Access", "240 API signatures included", "Custom email templates", "Auto reminders", "Bulk send (upto 20 docs)", "Premium Public profile usernames", "Embedding (coming soon)"] +}, { + planName: "OPENSIGN™ TEAMS", + img: "teams.png", + currency: "$", + monthlyPrice: "39.99/user", + yearlyPrice: "19.99/user/month", + subtitle: "Exclusive Access to advanced features.", + btn: { + text: "Subscribe", + color: "op-btn-accent" + }, + url: _constant_const__WEBPACK_IMPORTED_MODULE_0__.isStaging ? "https://billing.zoho.in/subscribe/ed8097273a82b6bf39892c11a3bb3c381eb2705736014cfbdbde1ccf1c7a189d/team-weekly" : "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af901237d0702bfaa959406306635d80f138c/teams-monthly", + yearlyUrl: _constant_const__WEBPACK_IMPORTED_MODULE_0__.isStaging ? "https://billing.zoho.in/subscribe/ed8097273a82b6bf39892c11a3bb3c381eb2705736014cfbdbde1ccf1c7a189d/team-weekly" : "https://billing.opensignlabs.com/subscribe/ef798486e6a0a11ea65f2bae8f2af9011a864994bbeeec71fcf106188630199d/teams-yearly", + target: "_self", + benefits: ["Everything in OpenSign™ professional", "100 API signatures included", "Teams and Organizations", "Share Templates with teams", "Share Templates with individuals", "DocumentId removal from signed docs", "Bulk send (upto 50 docs)", "Request Payments (coming soon)", "Mobile app (coming soon)"], + yearlyBenefits: ["Everything in OpenSign™ professional", "500 API signatures included", "Teams and Organizations", "Share Templates with teams", "Share Templates with individuals", "DocumentId removal from signed docs", "Bulk send (upto 50 docs)", "Request Payments (coming soon)", "Mobile app (coming soon)"] +}, { + planName: "OPENSIGN™ ENTERPRISE", + img: "enterprise.png", + currency: "", + monthlyPrice: "
Request Price
", + yearlyPrice: "Request Price
", + subtitle: "Scalable Features with priority support.", + btn: { + text: "Contact us", + color: "op-btn-primary" + }, + url: "https://www.opensignlabs.com/contact-us", + target: "_blank", + benefits: ["All features", "Custom domain", "Custom branding", "Uptime SLA", "SSO support", "Priority support"], + yearlyBenefits: ["All features", "Custom domain", "Custom branding", "Uptime SLA", "SSO support", "Priority support"] +}]; +const validplan = { + "team-weekly": true, + "team-yearly": true, + "teams-monthly": true, + "teams-yearly": true, + "enterprise-monthly": true, + "enterprise-yearly": true +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (plans); /***/ }), @@ -11500,7 +12344,7 @@ __webpack_require__.r(__webpack_exports__); function PdfRequestFiles(props) { - var _window$location, _window$location2, _pdfDetails$13, _pdfDetails$14; + var _window$location, _window$location2, _pdfDetails$12, _pdfDetails$13; const [pdfDetails, setPdfDetails] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]); const [signedSigners, setSignedSigners] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]); const [unsignedSigners, setUnSignedSigners] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]); @@ -11941,11 +12785,8 @@ function PdfRequestFiles(props) { setRequestSignTour(true); } else { //else condition to check current user exist in contracts_Users class and check tour message status - //if not then check user exist in contracts_Contactbook class and check tour message status - const localuser = localStorage.getItem("Parse/".concat(localStorage.getItem("parseAppId"), "/currentUser")); - const currentUser = JSON.parse(localuser); - const currentUserEmail = currentUser.email; - const res = await (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_10__.contractUsers)(currentUserEmail); + //if not then check user exist in contracts_Contactbook class and check tour message statu + const res = await (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_10__.contractUsers)(); if (res === "Error: Something went wrong!") { setHandleError("Error: Something went wrong!"); } else if (res[0] && res !== null && res !== void 0 && res.length) { @@ -12048,7 +12889,7 @@ function PdfRequestFiles(props) { widgetKey, radioExist, requiredCheckbox, - pageNumber; // `pageNumber` is used to check on which page user did not fill widget's data then change current pageNumber and show tour message on that page + TourPageNumber; // `pageNumber` is used to check on which page user did not fill widget's data then change current pageNumber and show tour message on that page for (let i = 0; i < checkUser[0].placeHolder.length; i++) { for (let j = 0; j < checkUser[0].placeHolder[i].pos.length; j++) { @@ -12085,7 +12926,7 @@ function PdfRequestFiles(props) { if (parseMin > 0 && parseMax > 0 && !response && !defaultValue && !showAlert) { showAlert = true; widgetKey = requiredCheckbox[i].key; - pageNumber = updatePage; + TourPageNumber = updatePage; setminRequiredCount(parseMin); } //else condition to validate minimum required checkbox @@ -12093,7 +12934,7 @@ function PdfRequestFiles(props) { if (!showAlert) { showAlert = true; widgetKey = requiredCheckbox[i].key; - pageNumber = updatePage; + TourPageNumber = updatePage; setminRequiredCount(parseMin); } } @@ -12120,7 +12961,7 @@ function PdfRequestFiles(props) { if (!checkDefaultSigned && !showAlert) { showAlert = true; widgetKey = requiredRadio[i].key; - pageNumber = updatePage; + TourPageNumber = updatePage; setminRequiredCount(null); } } @@ -12148,7 +12989,7 @@ function PdfRequestFiles(props) { if (!checkDefaultSigned && !showAlert) { showAlert = true; widgetKey = requiredWidgets[i].key; - pageNumber = updatePage; + TourPageNumber = updatePage; setminRequiredCount(null); } } @@ -12164,19 +13005,21 @@ function PdfRequestFiles(props) { } if (checkboxExist && requiredCheckbox && showAlert) { setUnSignedWidgetId(widgetKey); - setPageNumber(pageNumber); + setPageNumber(TourPageNumber); setWidgetsTour(true); } else if (radioExist && showAlert) { setUnSignedWidgetId(widgetKey); - setPageNumber(pageNumber); + setPageNumber(TourPageNumber); setWidgetsTour(true); } else if (showAlert) { setUnSignedWidgetId(widgetKey); - setPageNumber(pageNumber); + setPageNumber(TourPageNumber); setWidgetsTour(true); } else { + var _checkUser$; setIsUiLoading(true); - const pngUrl = checkUser[0].placeHolder; + // `widgets` is Used to return widgets details with page number of current user + const widgets = checkUser === null || checkUser === void 0 || (_checkUser$ = checkUser[0]) === null || _checkUser$ === void 0 ? void 0 : _checkUser$.placeHolder; let pdfArrBuffer; //`contractDocument` function used to get updated SignedUrl //resolved issue of sign document by multiple signers simultaneously @@ -12200,7 +13043,7 @@ function PdfRequestFiles(props) { // Load a PDFDocument from the existing PDF bytes const existingPdfBytes = pdfArrBuffer; try { - var _pdfDetails$, _pdfDetails$2; + var _pdfDetails$; const pdfDoc = await pdf_lib__WEBPACK_IMPORTED_MODULE_2__.PDFDocument.load(existingPdfBytes); const isSignYourSelfFlow = false; const extUserPtr = pdfDetails[0].ExtUserPtr; @@ -12212,13 +13055,12 @@ function PdfRequestFiles(props) { } } //embed multi signature in pdf - const pdfBytes = await (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_10__.multiSignEmbed)(pngUrl, pdfDoc, isSignYourSelfFlow, scale); - // console.log("pdfte", pdfBytes); + const pdfBytes = await (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_10__.multiSignEmbed)(widgets, pdfDoc, isSignYourSelfFlow, scale, pdfOriginalWH, containerWH); + // console.log("pdfte", pdfBytes); //get ExistUserPtr object id of user class to get tenantDetails const objectId = pdfDetails === null || pdfDetails === void 0 || (_pdfDetails$ = pdfDetails[0]) === null || _pdfDetails$ === void 0 || (_pdfDetails$ = _pdfDetails$.ExtUserPtr) === null || _pdfDetails$ === void 0 || (_pdfDetails$ = _pdfDetails$.UserId) === null || _pdfDetails$ === void 0 ? void 0 : _pdfDetails$.objectId; //get ExistUserPtr email to get userDetails - const currentUserEmail = pdfDetails === null || pdfDetails === void 0 || (_pdfDetails$2 = pdfDetails[0]) === null || _pdfDetails$2 === void 0 || (_pdfDetails$2 = _pdfDetails$2.ExtUserPtr) === null || _pdfDetails$2 === void 0 ? void 0 : _pdfDetails$2.Email; - const res = await (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_10__.contractUsers)(currentUserEmail); + const res = await (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_10__.contractUsers)(); let activeMailAdapter = ""; if (res === "Error: Something went wrong!") { setHandleError("Error: Something went wrong!"); @@ -12232,107 +13074,101 @@ function PdfRequestFiles(props) { activeMailAdapter = (_res$2 = res[0]) === null || _res$2 === void 0 ? void 0 : _res$2.active_mail_adapter; } //function for call to embed signature in pdf and get digital signature pdf - try { - const res = await (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_10__.signPdfFun)(pdfBytes, documentId, signerObjectId, setIsAlert, objectId, isSubscribed, activeMailAdapter, pngUrl); - if (res && res.status === "success") { - var _pdfDetails$3, _pdfDetails$4; - setPdfUrl(res.data); - setIsSigned(true); - setSignedSigners([]); - setUnSignedSigners([]); - getDocumentDetails(true); - const index = pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].Signers.findIndex(x => { - var _currentUser5; - return x.Email === ((_currentUser5 = currentUser) === null || _currentUser5 === void 0 ? void 0 : _currentUser5.email); - }); - const newIndex = index + 1; - const usermail = { - Email: (pdfDetails === null || pdfDetails === void 0 || (_pdfDetails$3 = pdfDetails[0]) === null || _pdfDetails$3 === void 0 || (_pdfDetails$3 = _pdfDetails$3.Placeholders[newIndex]) === null || _pdfDetails$3 === void 0 ? void 0 : _pdfDetails$3.email) || "" - }; - const user = usermail !== null && usermail !== void 0 && usermail.Email ? usermail : pdfDetails === null || pdfDetails === void 0 || (_pdfDetails$4 = pdfDetails[0]) === null || _pdfDetails$4 === void 0 ? void 0 : _pdfDetails$4.Signers[newIndex]; - if (sendmail !== "false" && sendInOrder) { - var _pdfDetails$5, _pdfDetails$6; - const requestBody = pdfDetails === null || pdfDetails === void 0 || (_pdfDetails$5 = pdfDetails[0]) === null || _pdfDetails$5 === void 0 ? void 0 : _pdfDetails$5.RequestBody; - const requestSubject = pdfDetails === null || pdfDetails === void 0 || (_pdfDetails$6 = pdfDetails[0]) === null || _pdfDetails$6 === void 0 ? void 0 : _pdfDetails$6.RequestSubject; - if (user) { - var _pdfDetails$7; - const expireDate = pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].ExpiryDate.iso; - const newDate = new Date(expireDate); - const localExpireDate = newDate.toLocaleDateString("en-US", { - day: "numeric", - month: "long", - year: "numeric" - }); - let senderEmail = pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].ExtUserPtr.Email; - let senderPhone = pdfDetails === null || pdfDetails === void 0 || (_pdfDetails$7 = pdfDetails[0]) === null || _pdfDetails$7 === void 0 || (_pdfDetails$7 = _pdfDetails$7.ExtUserPtr) === null || _pdfDetails$7 === void 0 ? void 0 : _pdfDetails$7.Phone; - const senderName = "".concat(pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].ExtUserPtr.Name); - try { - var _pdfDetails$8, _replaceVar, _replaceVar2; - const imgPng = "https://qikinnovation.ams3.digitaloceanspaces.com/logo.png"; - let url = "".concat(localStorage.getItem("baseUrl"), "functions/sendmailv3"); - const headers = { - "Content-Type": "application/json", - "X-Parse-Application-Id": localStorage.getItem("parseAppId"), - sessionToken: localStorage.getItem("accesstoken") - }; - const objectId = user === null || user === void 0 ? void 0 : user.objectId; - const hostUrl = window.location.origin; - //encode this url value `${pdfDetails?.[0].objectId}/${user.Email}/${objectId}` to base64 using `btoa` function - let encodeBase64; - if (objectId) { - encodeBase64 = btoa("".concat(pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].objectId, "/").concat(user.Email, "/").concat(objectId)); - } else { - encodeBase64 = btoa("".concat(pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].objectId, "/").concat(user.Email)); - } - const hostPublicUrl = _constant_const__WEBPACK_IMPORTED_MODULE_1__.isStaging ? "https://staging-app.opensignlabs.com" : "https://app.opensignlabs.com"; - let signPdf = props !== null && props !== void 0 && props.templateId ? "".concat(hostPublicUrl, "/login/").concat(encodeBase64) : "".concat(hostUrl, "/login/").concat(encodeBase64); - const openSignUrl = "https://www.opensignlabs.com/contact-us"; - const orgName = (_pdfDetails$8 = pdfDetails[0]) !== null && _pdfDetails$8 !== void 0 && _pdfDetails$8.ExtUserPtr.Company ? pdfDetails[0].ExtUserPtr.Company : ""; - const themeBGcolor = _constant_const__WEBPACK_IMPORTED_MODULE_1__.themeColor; - let replaceVar; - if (requestBody && requestSubject && isSubscribed) { - const replacedRequestBody = requestBody.replace(/"/g, "'"); - const htmlReqBody = "" + replacedRequestBody + " "; - const variables = { - document_title: pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].Name, - sender_name: senderName, - sender_mail: senderEmail, - sender_phone: senderPhone, - receiver_name: user.Name, - receiver_email: user.Email, - receiver_phone: user.Phone, - expiry_date: localExpireDate, - company_name: orgName, - signing_url: "Sign here") - }; - replaceVar = (0,_constant_Utils__WEBPACK_IMPORTED_MODULE_10__.replaceMailVaribles)(requestSubject, htmlReqBody, variables); - } - let params = { - mailProvider: activeMailAdapter, - extUserId: extUserId, - recipient: user.Email, - subject: requestSubject ? (_replaceVar = replaceVar) === null || _replaceVar === void 0 ? void 0 : _replaceVar.subject : "".concat(pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].ExtUserPtr.Name, " has requested you to sign \"").concat(pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].Name, "\""), - from: senderEmail, - html: requestBody ? (_replaceVar2 = replaceVar) === null || _replaceVar2 === void 0 ? void 0 : _replaceVar2.body : "Digital Signature Request
" + (pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].ExtUserPtr.Name) + " has requested you to review and sign " + (pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].Name) + ".
| Sender | " + senderEmail + " | |
| Organization | " + orgName + " | |
| Expires on | " + localExpireDate + " | |
This is an automated email from OpenSign™. For any queries regarding this email, please contact the sender " + senderEmail + " directly.If you think this email is inappropriate or spam, you may file a complaint with OpenSign™ here.
Digital Signature Request
" + (pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].ExtUserPtr.Name) + " has requested you to review and sign " + (pdfDetails === null || pdfDetails === void 0 ? void 0 : pdfDetails[0].Name) + ".
| Sender | " + senderEmail + " | |
| Organization | " + orgName + " | |
| Expires on | " + localExpireDate + " | |
This is an automated email from OpenSign™. For any queries regarding this email, please contact the sender " + senderEmail + " directly.If you think this email is inappropriate or spam, you may file a complaint with OpenSign™ here.
d)a=De.ArrowLeft,l=(u=g(a,l,c)).newCalculatedDate,c=u.newCalculatedMonth;if(Xe(l,n.props))l=(u=g(a,l,c)).newCalculatedDate,c=u.newCalculatedMonth;else o=!0;s++}return{newCalculatedDate:l,newCalculatedMonth:c}}(t,l,r),D=y.newCalculatedDate,k=y.newCalculatedMonth;switch(t){case De.ArrowRight:case De.ArrowLeft:case De.ArrowUp:case De.ArrowDown:n.handleMonthNavigation(k,D)}}else n.isMonthDisabled(r)||(n.onMonthClick(e,r),null==c||c(s))}},n.getVerticalOffset=function(e){var t,r;return null!==(r=null===(t=Yt[e])||void 0===t?void 0:t.verticalNavigationOffset)&&void 0!==r?r:0},n.onMonthKeyDown=function(e,t){var r=n.props,a=r.disabledKeyboardNavigation,o=r.handleOnMonthKeyDown,s=e.key;s!==De.Tab&&e.preventDefault(),a||n.handleKeyboardNavigation(e,s,t),o&&o(e)},n.onQuarterClick=function(e,t){var r=z.setQuarter(n.props.day,t);Ge(r,n.props)||n.handleDayClick(Ie(r),e)},n.onQuarterMouseEnter=function(e){var t=z.setQuarter(n.props.day,e);Ge(t,n.props)||n.handleDayMouseEnter(Ie(t))},n.handleQuarterNavigation=function(e,t){var r,a,o,s;n.isDisabled(t)||n.isExcluded(t)||(null===(a=(r=n.props).setPreSelection)||void 0===a||a.call(r,t),null===(s=null===(o=n.QUARTER_REFS[e-1])||void 0===o?void 0:o.current)||void 0===s||s.focus())},n.onQuarterKeyDown=function(e,t){var r,a,o=e.key;if(!n.props.disabledKeyboardNavigation)switch(o){case De.Enter:n.onQuarterClick(e,t),null===(a=(r=n.props).setPreSelection)||void 0===a||a.call(r,n.props.selected);break;case De.ArrowRight:if(!n.props.preSelection)break;n.handleQuarterNavigation(4===t?1:t+1,l.addQuarters(n.props.preSelection,1));break;case De.ArrowLeft:if(!n.props.preSelection)break;n.handleQuarterNavigation(1===t?4:t-1,oe.subQuarters(n.props.preSelection,1))}},n.isMonthDisabledForLabelDate=function(e){var t,r=n.props,a=r.day,o=r.minDate,s=r.maxDate,i=r.excludeDates,l=r.includeDates,c=$.setMonth(a,e);return{isDisabled:null!==(t=(o||s||i||l)&&$e(c,n.props))&&void 0!==t&&t,labelDate:c}},n.isMonthDisabled=function(e){return n.isMonthDisabledForLabelDate(e).isDisabled},n.getMonthClassNames=function(e){var r=n.props,a=r.day,o=r.startDate,s=r.endDate,i=r.selected,l=r.preSelection,c=r.monthClassName,p=c?c($.setMonth(a,e)):void 0;return t.clsx("react-datepicker__month-text","react-datepicker__month-".concat(e),p,{"react-datepicker__month-text--disabled":n.isMonthDisabled(e),"react-datepicker__month-text--selected":i?n.isSelectedMonth(a,e,i):void 0,"react-datepicker__month-text--keyboard-selected":!n.props.disabledKeyboardNavigation&&l&&n.isSelectedMonth(a,e,l),"react-datepicker__month-text--in-selecting-range":n.isInSelectingRangeMonth(e),"react-datepicker__month-text--in-range":o&&s?ze(o,s,e,a):void 0,"react-datepicker__month-text--range-start":n.isRangeStartMonth(e),"react-datepicker__month-text--range-end":n.isRangeEndMonth(e),"react-datepicker__month-text--selecting-range-start":n.isSelectingMonthRangeStart(e),"react-datepicker__month-text--selecting-range-end":n.isSelectingMonthRangeEnd(e),"react-datepicker__month-text--today":n.isCurrentMonth(a,e)})},n.getTabIndex=function(e){if(null==n.props.preSelection)return"-1";var t=C.getMonth(n.props.preSelection);return n.props.disabledKeyboardNavigation||e!==t?"-1":"0"},n.getQuarterTabIndex=function(e){if(null==n.props.preSelection)return"-1";var t=E.getQuarter(n.props.preSelection);return n.props.disabledKeyboardNavigation||e!==t?"-1":"0"},n.getAriaLabel=function(e){var t=n.props,r=t.chooseDayAriaLabelPrefix,a=void 0===r?"Choose":r,o=t.disabledDayAriaLabelPrefix,s=void 0===o?"Not available":o,i=t.day,l=t.locale,c=$.setMonth(i,e),p=n.isDisabled(c)||n.isExcluded(c)?s:a;return"".concat(p," ").concat(Ce(c,"MMMM yyyy",l))},n.getQuarterClassNames=function(e){var r=n.props,a=r.day,o=r.startDate,s=r.endDate,i=r.selected,l=r.minDate,c=r.maxDate,p=r.preSelection,d=r.disabledKeyboardNavigation;return t.clsx("react-datepicker__quarter-text","react-datepicker__quarter-".concat(e),{"react-datepicker__quarter-text--disabled":(l||c)&&Ge(z.setQuarter(a,e),n.props),"react-datepicker__quarter-text--selected":i?n.isSelectedQuarter(a,e,i):void 0,"react-datepicker__quarter-text--keyboard-selected":!d&&p&&n.isSelectedQuarter(a,e,p),"react-datepicker__quarter-text--in-selecting-range":n.isInSelectingRangeQuarter(e),"react-datepicker__quarter-text--in-range":o&&s?et(o,s,e,a):void 0,"react-datepicker__quarter-text--range-start":n.isRangeStartQuarter(e),"react-datepicker__quarter-text--range-end":n.isRangeEndQuarter(e)})},n.getMonthContent=function(e){var t=n.props,r=t.showFullMonthYearPicker,a=t.renderMonthContent,o=t.locale,s=t.day,i=Ve(e,o),l=Be(e,o);return a?a(e,i,l,s):r?l:i},n.getQuarterContent=function(e){var t,r=n.props,a=r.renderQuarterContent,o=function(e,t){return Ce(z.setQuarter(Me(),e),"QQQ",t)}(e,r.locale);return null!==(t=null==a?void 0:a(e,o))&&void 0!==t?t:o},n.renderMonths=function(){var e,t=n.props,r=t.showTwoColumnMonthYearPicker,a=t.showFourColumnMonthYearPicker,o=t.day,s=t.selected,i=null===(e=Yt[Pt(a,r)])||void 0===e?void 0:e.grid;return null==i?void 0:i.map((function(e,t){return ue.default.createElement("div",{className:"react-datepicker__month-wrapper",key:t},e.map((function(e,t){return ue.default.createElement("div",{ref:n.MONTH_REFS[e],key:t,onClick:function(t){n.onMonthClick(t,e)},onKeyDown:function(t){Dt(t)&&(t.preventDefault(),t.key=De.Enter),n.onMonthKeyDown(t,e)},onMouseEnter:n.props.usePointerEvent?void 0:function(){return n.onMonthMouseEnter(e)},onPointerEnter:n.props.usePointerEvent?function(){return n.onMonthMouseEnter(e)}:void 0,tabIndex:Number(n.getTabIndex(e)),className:n.getMonthClassNames(e),"aria-disabled":n.isMonthDisabled(e),role:"option","aria-label":n.getAriaLabel(e),"aria-current":n.isCurrentMonth(o,e)?"date":void 0,"aria-selected":s?n.isSelectedMonth(o,e,s):void 0},n.getMonthContent(e))})))}))},n.renderQuarters=function(){var e=n.props,t=e.day,r=e.selected;return ue.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(e,a){return ue.default.createElement("div",{key:a,ref:n.QUARTER_REFS[a],role:"option",onClick:function(t){n.onQuarterClick(t,e)},onKeyDown:function(t){n.onQuarterKeyDown(t,e)},onMouseEnter:n.props.usePointerEvent?void 0:function(){return n.onQuarterMouseEnter(e)},onPointerEnter:n.props.usePointerEvent?function(){return n.onQuarterMouseEnter(e)}:void 0,className:n.getQuarterClassNames(e),"aria-selected":r?n.isSelectedQuarter(t,e,r):void 0,tabIndex:Number(n.getQuarterTabIndex(e)),"aria-current":n.isCurrentQuarter(t,e)?"date":void 0},n.getQuarterContent(e))})))},n.getClassNames=function(){var e=n.props,r=e.selectingDate,a=e.selectsStart,o=e.selectsEnd,s=e.showMonthYearPicker,i=e.showQuarterYearPicker,l=e.showWeekPicker;return t.clsx("react-datepicker__month",{"react-datepicker__month--selecting-range":r&&(a||o)},{"react-datepicker__monthPicker":s},{"react-datepicker__quarterPicker":i},{"react-datepicker__weekPicker":l})},n}return ve(n,e),n.prototype.render=function(){var e=this.props,t=e.showMonthYearPicker,r=e.showQuarterYearPicker,n=e.day,a=e.ariaLabelPrefix,o=void 0===a?"Month ":a,s=o?o.trim()+" ":"";return ue.default.createElement("div",{className:this.getClassNames(),onMouseLeave:this.props.usePointerEvent?void 0:this.handleMouseLeave,onPointerLeave:this.props.usePointerEvent?this.handleMouseLeave:void 0,"aria-label":"".concat(s).concat(Ce(n,"MMMM, yyyy",this.props.locale)),role:"listbox"},t?this.renderMonths():r?this.renderQuarters():this.renderWeeks())},n}(r.Component),Nt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isSelectedMonth=function(e){return t.props.month===e},t.renderOptions=function(){return t.props.monthNames.map((function(e,r){return ue.default.createElement("div",{className:t.isSelectedMonth(r)?"react-datepicker__month-option react-datepicker__month-option--selected_month":"react-datepicker__month-option",key:e,onClick:t.onChange.bind(t,r),"aria-selected":t.isSelectedMonth(r)?"true":void 0},t.isSelectedMonth(r)?ue.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",e)}))},t.onChange=function(e){return t.props.onChange(e)},t.handleClickOutside=function(){return t.props.onCancel()},t}return ve(t,e),t.prototype.render=function(){return ue.default.createElement("div",{className:"react-datepicker__month-dropdown"},this.renderOptions())},t}(r.Component),Ot=fe.default(Nt),It=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={dropdownVisible:!1},t.renderSelectOptions=function(e){return e.map((function(e,t){return ue.default.createElement("option",{key:e,value:t},e)}))},t.renderSelectMode=function(e){return ue.default.createElement("select",{value:t.props.month,className:"react-datepicker__month-select",onChange:function(e){return t.onChange(parseInt(e.target.value))}},t.renderSelectOptions(e))},t.renderReadView=function(e,r){return ue.default.createElement("div",{key:"read",style:{visibility:e?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:t.toggleDropdown},ue.default.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},r[t.props.month]))},t.renderDropdown=function(e){return ue.default.createElement(Ot,ge({key:"dropdown"},t.props,{monthNames:e,onChange:t.onChange,onCancel:t.toggleDropdown}))},t.renderScrollMode=function(e){var r=t.state.dropdownVisible,n=[t.renderReadView(!r,e)];return r&&n.unshift(t.renderDropdown(e)),n},t.onChange=function(e){t.toggleDropdown(),e!==t.props.month&&t.props.onChange(e)},t.toggleDropdown=function(){return t.setState({dropdownVisible:!t.state.dropdownVisible})},t}return ve(t,e),t.prototype.render=function(){var e,t=this,r=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(e){return Ve(e,t.props.locale)}:function(e){return Be(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(r);break;case"select":e=this.renderSelectMode(r)}return ue.default.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},e)},t}(r.Component);function Tt(e,t){for(var r=[],n=Ne(e),a=Ne(t);!N.isAfter(n,a);)r.push(Me(n)),n=i.addMonths(n,1);return r}var Rt=function(e){function r(t){var r=e.call(this,t)||this;return r.renderOptions=function(){return r.state.monthYearsList.map((function(e){var t=P.getTime(e),n=Le(r.props.date,e)&&Ae(r.props.date,e);return ue.default.createElement("div",{className:n?"react-datepicker__month-year-option--selected_month-year":"react-datepicker__month-year-option",key:t,onClick:r.onChange.bind(r,t),"aria-selected":n?"true":void 0},n?ue.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Ce(e,r.props.dateFormat,r.props.locale))}))},r.onChange=function(e){return r.props.onChange(e)},r.handleClickOutside=function(){r.props.onCancel()},r.state={monthYearsList:Tt(r.props.minDate,r.props.maxDate)},r}return ve(r,e),r.prototype.render=function(){var e=t.clsx({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return ue.default.createElement("div",{className:e},this.renderOptions())},r}(r.Component),Lt=fe.default(Rt),At=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={dropdownVisible:!1},t.renderSelectOptions=function(){for(var e=Ne(t.props.minDate),r=Ne(t.props.maxDate),n=[];!N.isAfter(e,r);){var a=P.getTime(e);n.push(ue.default.createElement("option",{key:a,value:a},Ce(e,t.props.dateFormat,t.props.locale))),e=i.addMonths(e,1)}return n},t.onSelectChange=function(e){t.onChange(parseInt(e.target.value))},t.renderSelectMode=function(){return ue.default.createElement("select",{value:P.getTime(Ne(t.props.date)),className:"react-datepicker__month-year-select",onChange:t.onSelectChange},t.renderSelectOptions())},t.renderReadView=function(e){var r=Ce(t.props.date,t.props.dateFormat,t.props.locale);return ue.default.createElement("div",{key:"read",style:{visibility:e?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:t.toggleDropdown},ue.default.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},r))},t.renderDropdown=function(){return ue.default.createElement(Lt,ge({key:"dropdown"},t.props,{onChange:t.onChange,onCancel:t.toggleDropdown}))},t.renderScrollMode=function(){var e=t.state.dropdownVisible,r=[t.renderReadView(!e)];return e&&r.unshift(t.renderDropdown()),r},t.onChange=function(e){t.toggleDropdown();var r=Me(e);Le(t.props.date,r)&&Ae(t.props.date,r)||t.props.onChange(r)},t.toggleDropdown=function(){return t.setState({dropdownVisible:!t.state.dropdownVisible})},t}return ve(t,e),t.prototype.render=function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return ue.default.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},e)},t}(r.Component),Ft=function(e){function t(){var r=null!==e&&e.apply(this,arguments)||this;return r.state={height:null},r.scrollToTheSelectedTime=function(){requestAnimationFrame((function(){var e,n,a;r.list&&(r.list.scrollTop=null!==(a=r.centerLi&&t.calcCenterPosition(r.props.monthRef?r.props.monthRef.clientHeight-(null!==(n=null===(e=r.header)||void 0===e?void 0:e.clientHeight)&&void 0!==n?n:0):r.list.clientHeight,r.centerLi))&&void 0!==a?a:0)}))},r.handleClick=function(e){var t,n;(r.props.minTime||r.props.maxTime)&&at(e,r.props)||(r.props.excludeTimes||r.props.includeTimes||r.props.filterTime)&&nt(e,r.props)||null===(n=(t=r.props).onChange)||void 0===n||n.call(t,e)},r.isSelectedTime=function(e){return r.props.selected&&(t=r.props.selected,n=e,vt(t).getTime()===vt(n).getTime());var t,n},r.isDisabledTime=function(e){return(r.props.minTime||r.props.maxTime)&&at(e,r.props)||(r.props.excludeTimes||r.props.includeTimes||r.props.filterTime)&&nt(e,r.props)},r.liClasses=function(e){var n,a=["react-datepicker__time-list-item",r.props.timeClassName?r.props.timeClassName(e):void 0];return r.isSelectedTime(e)&&a.push("react-datepicker__time-list-item--selected"),r.isDisabledTime(e)&&a.push("react-datepicker__time-list-item--disabled"),r.props.injectTimes&&(3600*b.getHours(e)+60*_.getMinutes(e)+Y.getSeconds(e))%(60*(null!==(n=r.props.intervals)&&void 0!==n?n:t.defaultProps.intervals))!=0&&a.push("react-datepicker__time-list-item--injected"),a.join(" ")},r.handleOnKeyDown=function(e,t){var n,a;e.key===De.Space&&(e.preventDefault(),e.key=De.Enter),(e.key===De.ArrowUp||e.key===De.ArrowLeft)&&e.target instanceof HTMLElement&&e.target.previousSibling&&(e.preventDefault(),e.target.previousSibling instanceof HTMLElement&&e.target.previousSibling.focus()),(e.key===De.ArrowDown||e.key===De.ArrowRight)&&e.target instanceof HTMLElement&&e.target.nextSibling&&(e.preventDefault(),e.target.nextSibling instanceof HTMLElement&&e.target.nextSibling.focus()),e.key===De.Enter&&r.handleClick(t),null===(a=(n=r.props).handleOnKeyDown)||void 0===a||a.call(n,e)},r.renderTimes=function(){for(var e,n=[],a=r.props.format?r.props.format:"p",o=null!==(e=r.props.intervals)&&void 0!==e?e:t.defaultProps.intervals,i=r.props.selected||r.props.openToDate||Me(),l=Pe(i),c=r.props.injectTimes&&r.props.injectTimes.sort((function(e,t){return e.getTime()-t.getTime()})),p=60*function(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(e.getFullYear(),e.getMonth(),e.getDate(),24);return Math.round((+r-+t)/36e5)}(i),d=p/o,u=0;u =p&&t m){u=l%f;t<=m&&t>m-u?f=u:f+=u,h=t+f}a.handleYearNavigation(h,d.addYears(a.props.preSelection,f))}c&&c(e)},a.getYearClassNames=function(e){var r=a.props,n=r.date,o=r.minDate,s=r.maxDate,i=r.selected,l=r.excludeDates,c=r.includeDates,p=r.filterDate,d=r.yearClassName;return t.clsx("react-datepicker__year-text","react-datepicker__year-".concat(e),n?null==d?void 0:d(G.setYear(n,e)):void 0,{"react-datepicker__year-text--selected":i?e===x.getYear(i):void 0,"react-datepicker__year-text--disabled":(o||s||l||c||p)&&Ze(e,a.props),"react-datepicker__year-text--keyboard-selected":a.isKeyboardSelected(e),"react-datepicker__year-text--range-start":a.isRangeStart(e),"react-datepicker__year-text--range-end":a.isRangeEnd(e),"react-datepicker__year-text--in-range":a.isInRange(e),"react-datepicker__year-text--in-selecting-range":a.isInSelectingRange(e),"react-datepicker__year-text--selecting-range-start":a.isSelectingRangeStart(e),"react-datepicker__year-text--selecting-range-end":a.isSelectingRangeEnd(e),"react-datepicker__year-text--today":a.isCurrentYear(e)})},a.getYearTabIndex=function(e){return a.props.disabledKeyboardNavigation||null==a.props.preSelection?"-1":e===x.getYear(a.props.preSelection)?"0":"-1"},a.getYearContainerClassNames=function(){var e=a.props,r=e.selectingDate,n=e.selectsStart,o=e.selectsEnd,s=e.selectsRange;return t.clsx("react-datepicker__year",{"react-datepicker__year--selecting-range":r&&(n||o||s)})},a.getYearContent=function(e){return a.props.renderYearContent?a.props.renderYearContent(e):e},a}return ve(n,e),n.prototype.render=function(){var e=this,t=[],r=this.props,n=r.date,a=r.yearItemNumber,o=r.onYearMouseEnter,s=r.onYearMouseLeave;if(void 0===n)return null;for(var i=mt(n,a),l=i.startPeriod,c=i.endPeriod,p=function(r){t.push(ue.default.createElement("div",{ref:d.YEAR_REFS[r-l],onClick:function(t){e.onYearClick(t,r)},onKeyDown:function(t){Dt(t)&&(t.preventDefault(),t.key=De.Enter),e.onYearKeyDown(t,r)},tabIndex:Number(d.getYearTabIndex(r)),className:d.getYearClassNames(r),onMouseEnter:d.props.usePointerEvent?void 0:function(e){return o(e,r)},onPointerEnter:d.props.usePointerEvent?function(e){return o(e,r)}:void 0,onMouseLeave:d.props.usePointerEvent?void 0:function(e){return s(e,r)},onPointerLeave:d.props.usePointerEvent?function(e){return s(e,r)}:void 0,key:r,"aria-current":d.isCurrentYear(r)?"date":void 0},d.getYearContent(r)))},d=this,u=l;u<=c;u++)p(u);return ue.default.createElement("div",{className:this.getYearContainerClassNames()},ue.default.createElement("div",{className:"react-datepicker__year-wrapper",onMouseLeave:this.props.usePointerEvent?void 0:this.props.clearSelectingDate,onPointerLeave:this.props.usePointerEvent?this.props.clearSelectingDate:void 0},t))},n}(r.Component);function Wt(e,t,r,n){for(var a=[],o=0;o<2*t+1;o++){var s=e+t-o,i=!0;r&&(i=x.getYear(r)<=s),n&&i&&(i=x.getYear(n)>=s),i&&a.push(s)}return a}var Qt=function(e){function n(t){var n=e.call(this,t)||this;n.renderOptions=function(){var e=n.props.year,t=n.state.yearsList.map((function(t){return ue.default.createElement("div",{className:e===t?"react-datepicker__year-option react-datepicker__year-option--selected_year":"react-datepicker__year-option",key:t,onClick:n.onChange.bind(n,t),"aria-selected":e===t?"true":void 0},e===t?ue.default.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",t)})),r=n.props.minDate?x.getYear(n.props.minDate):null,a=n.props.maxDate?x.getYear(n.props.maxDate):null;return a&&n.state.yearsList.find((function(e){return e===a}))||t.unshift(ue.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:n.incrementYears},ue.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),r&&n.state.yearsList.find((function(e){return e===r}))||t.push(ue.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:n.decrementYears},ue.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t},n.onChange=function(e){n.props.onChange(e)},n.handleClickOutside=function(){n.props.onCancel()},n.shiftYears=function(e){var t=n.state.yearsList.map((function(t){return t+e}));n.setState({yearsList:t})},n.incrementYears=function(){return n.shiftYears(1)},n.decrementYears=function(){return n.shiftYears(-1)};var a=t.yearDropdownItemNumber,o=t.scrollableYearDropdown,s=a||(o?10:5);return n.state={yearsList:Wt(n.props.year,s,n.props.minDate,n.props.maxDate)},n.dropdownRef=r.createRef(),n}return ve(n,e),n.prototype.componentDidMount=function(){var e=this.dropdownRef.current;if(e){var t=e.children?Array.from(e.children):null,r=t?t.find((function(e){return e.ariaSelected})):null;e.scrollTop=r&&r instanceof HTMLElement?r.offsetTop+(r.clientHeight-e.clientHeight)/2:(e.scrollHeight-e.clientHeight)/2}},n.prototype.render=function(){var e=t.clsx({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return ue.default.createElement("div",{className:e,ref:this.dropdownRef},this.renderOptions())},n}(r.Component),qt=fe.default(Qt),Kt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={dropdownVisible:!1},t.renderSelectOptions=function(){for(var e=t.props.minDate?x.getYear(t.props.minDate):1900,r=t.props.maxDate?x.getYear(t.props.maxDate):2100,n=[],a=e;a<=r;a++)n.push(ue.default.createElement("option",{key:a,value:a},a));return n},t.onSelectChange=function(e){t.onChange(parseInt(e.target.value))},t.renderSelectMode=function(){return ue.default.createElement("select",{value:t.props.year,className:"react-datepicker__year-select",onChange:t.onSelectChange},t.renderSelectOptions())},t.renderReadView=function(e){return ue.default.createElement("div",{key:"read",style:{visibility:e?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:function(e){return t.toggleDropdown(e)}},ue.default.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},t.props.year))},t.renderDropdown=function(){return ue.default.createElement(qt,ge({key:"dropdown"},t.props,{onChange:t.onChange,onCancel:t.toggleDropdown}))},t.renderScrollMode=function(){var e=t.state.dropdownVisible,r=[t.renderReadView(!e)];return e&&r.unshift(t.renderDropdown()),r},t.onChange=function(e){t.toggleDropdown(),e!==t.props.year&&t.props.onChange(e)},t.toggleDropdown=function(e){t.setState({dropdownVisible:!t.state.dropdownVisible},(function(){t.props.adjustDateOnChange&&t.handleYearChange(t.props.date,e)}))},t.handleYearChange=function(e,r){t.onSelect(e,r),t.setOpen()},t.onSelect=function(e,r){t.props.onSelect&&t.props.onSelect(e,r)},t.setOpen=function(){t.props.setOpen&&t.props.setOpen(!0)},t}return ve(t,e),t.prototype.render=function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return ue.default.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},e)},t}(r.Component),Bt=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Vt=function(e){function n(o){var s=e.call(this,o)||this;return s.monthContainer=void 0,s.handleClickOutside=function(e){s.props.onClickOutside(e)},s.setClickOutsideRef=function(){return s.containerRef.current},s.handleDropdownFocus=function(e){var t,r,n,a;n=e.target,a=(n.className||"").split(/\s+/),Bt.some((function(e){return a.indexOf(e)>=0}))&&(null===(r=(t=s.props).onDropdownFocus)||void 0===r||r.call(t,e))},s.getDateInView=function(){var e=s.props,t=e.preSelection,r=e.selected,n=e.openToDate,a=ct(s.props),o=pt(s.props),i=Me(),l=n||r||t;return l||(a&&O.isBefore(i,a)?a:o&&N.isAfter(i,o)?o:i)},s.increaseMonth=function(){s.setState((function(e){var t=e.date;return{date:i.addMonths(t,1)}}),(function(){return s.handleMonthChange(s.state.date)}))},s.decreaseMonth=function(){s.setState((function(e){var t=e.date;return{date:ae.subMonths(t,1)}}),(function(){return s.handleMonthChange(s.state.date)}))},s.handleDayClick=function(e,t,r){s.props.onSelect(e,t,r),s.props.setPreSelection&&s.props.setPreSelection(e)},s.handleDayMouseEnter=function(e){s.setState({selectingDate:e}),s.props.onDayMouseEnter&&s.props.onDayMouseEnter(e)},s.handleMonthMouseLeave=function(){s.setState({selectingDate:void 0}),s.props.onMonthMouseLeave&&s.props.onMonthMouseLeave()},s.handleYearMouseEnter=function(e,t){s.setState({selectingDate:G.setYear(Me(),t)}),s.props.onYearMouseEnter&&s.props.onYearMouseEnter(e,t)},s.handleYearMouseLeave=function(e,t){s.props.onYearMouseLeave&&s.props.onYearMouseLeave(e,t)},s.handleYearChange=function(e){s.props.onYearChange&&(s.props.onYearChange(e),s.setState({isRenderAriaLiveMessage:!0})),s.props.adjustDateOnChange&&(s.props.onSelect&&s.props.onSelect(e),s.props.setOpen&&s.props.setOpen(!0)),s.props.setPreSelection&&s.props.setPreSelection(e)},s.handleMonthChange=function(e){s.handleCustomMonthChange(e),s.props.adjustDateOnChange&&(s.props.onSelect&&s.props.onSelect(e),s.props.setOpen&&s.props.setOpen(!0)),s.props.setPreSelection&&s.props.setPreSelection(e)},s.handleCustomMonthChange=function(e){s.props.onMonthChange&&(s.props.onMonthChange(e),s.setState({isRenderAriaLiveMessage:!0}))},s.handleMonthYearChange=function(e){s.handleYearChange(e),s.handleMonthChange(e)},s.changeYear=function(e){s.setState((function(t){var r=t.date;return{date:G.setYear(r,Number(e))}}),(function(){return s.handleYearChange(s.state.date)}))},s.changeMonth=function(e){s.setState((function(t){var r=t.date;return{date:$.setMonth(r,Number(e))}}),(function(){return s.handleMonthChange(s.state.date)}))},s.changeMonthYear=function(e){s.setState((function(t){var r=t.date;return{date:G.setYear($.setMonth(r,C.getMonth(e)),x.getYear(e))}}),(function(){return s.handleMonthYearChange(s.state.date)}))},s.header=function(e){void 0===e&&(e=s.state.date);var r=xe(e,s.props.locale,s.props.calendarStartDay),n=[];return s.props.showWeekNumbers&&n.push(ue.default.createElement("div",{key:"W",className:"react-datepicker__day-name"},s.props.weekLabel||"#")),n.concat([0,1,2,3,4,5,6].map((function(e){var n=a.addDays(r,e),o=s.formatWeekday(n,s.props.locale),i=s.props.weekDayClassName?s.props.weekDayClassName(n):void 0;return ue.default.createElement("div",{key:e,"aria-label":Ce(n,"EEEE",s.props.locale),className:t.clsx("react-datepicker__day-name",i)},o)})))},s.formatWeekday=function(e,t){return s.props.formatWeekDay?function(e,t,r){return t(Ce(e,"EEEE",r))}(e,s.props.formatWeekDay,t):s.props.useWeekdaysShort?function(e,t){return Ce(e,"EEE",t)}(e,t):function(e,t){return Ce(e,"EEEEEE",t)}(e,t)},s.decreaseYear=function(){s.setState((function(e){var t,r=e.date;return{date:ie.subYears(r,s.props.showYearPicker?null!==(t=s.props.yearItemNumber)&&void 0!==t?t:n.defaultProps.yearItemNumber:1)}}),(function(){return s.handleYearChange(s.state.date)}))},s.clearSelectingDate=function(){s.setState({selectingDate:void 0})},s.renderPreviousButton=function(){var e;if(!s.props.renderCustomHeader){var t;switch(!0){case s.props.showMonthYearPicker:t=it(s.state.date,s.props);break;case s.props.showYearPicker:t=function(e,t){var r=void 0===t?{}:t,n=r.minDate,a=r.yearItemNumber,o=void 0===a?Se:a,s=mt(Oe(ie.subYears(e,o)),o).endPeriod,i=n&&x.getYear(n);return i&&i>s||!1}(s.state.date,s.props);break;case s.props.showQuarterYearPicker:t=function(e,t){var r=void 0===t?{}:t,n=r.minDate,a=r.includeDates,o=re.startOfYear(e),s=oe.subQuarters(o,1);return n&&h.differenceInCalendarQuarters(n,s)>0||a&&a.every((function(e){return h.differenceInCalendarQuarters(e,s)>0}))||!1}(s.state.date,s.props);break;default:t=ot(s.state.date,s.props)}if(((null!==(e=s.props.forceShowMonthNavigation)&&void 0!==e?e:n.defaultProps.forceShowMonthNavigation)||s.props.showDisabledMonthNavigation||!t)&&!s.props.showTimeSelectOnly){var r=["react-datepicker__navigation","react-datepicker__navigation--previous"],a=s.decreaseMonth;(s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker)&&(a=s.decreaseYear),t&&s.props.showDisabledMonthNavigation&&(r.push("react-datepicker__navigation--previous--disabled"),a=void 0);var o=s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker,i=s.props,l=i.previousMonthButtonLabel,c=void 0===l?n.defaultProps.previousMonthButtonLabel:l,p=i.previousYearButtonLabel,d=void 0===p?n.defaultProps.previousYearButtonLabel:p,u=s.props,f=u.previousMonthAriaLabel,m=void 0===f?"string"==typeof c?c:"Previous Month":f,v=u.previousYearAriaLabel,g=void 0===v?"string"==typeof d?d:"Previous Year":v;return ue.default.createElement("button",{type:"button",className:r.join(" "),onClick:a,onKeyDown:s.props.handleOnKeyDown,"aria-label":o?g:m},ue.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"].join(" ")},o?d:c))}}},s.increaseYear=function(){s.setState((function(e){var t,r=e.date;return{date:d.addYears(r,s.props.showYearPicker?null!==(t=s.props.yearItemNumber)&&void 0!==t?t:n.defaultProps.yearItemNumber:1)}}),(function(){return s.handleYearChange(s.state.date)}))},s.renderNextButton=function(){var e;if(!s.props.renderCustomHeader){var t;switch(!0){case s.props.showMonthYearPicker:t=lt(s.state.date,s.props);break;case s.props.showYearPicker:t=function(e,t){var r=void 0===t?{}:t,n=r.maxDate,a=r.yearItemNumber,o=void 0===a?Se:a,s=mt(d.addYears(e,o),o).startPeriod,i=n&&x.getYear(n);return i&&i d)a=ye.ArrowLeft,l=(u=g(a,l,c)).newCalculatedDate,c=u.newCalculatedMonth;if(Xe(l,n.props))l=(u=g(a,l,c)).newCalculatedDate,c=u.newCalculatedMonth;else o=!0;s++}return{newCalculatedDate:l,newCalculatedMonth:c}}(t,l,r),y=D.newCalculatedDate,k=D.newCalculatedMonth;switch(t){case ye.ArrowRight:case ye.ArrowLeft:case ye.ArrowUp:case ye.ArrowDown:n.handleMonthNavigation(k,y)}}else n.isMonthDisabled(r)||(n.onMonthClick(e,r),null==c||c(s))}},n.getVerticalOffset=function(e){var t,r;return null!==(r=null===(t=Pt[e])||void 0===t?void 0:t.verticalNavigationOffset)&&void 0!==r?r:0},n.onMonthKeyDown=function(e,t){var r=n.props,a=r.disabledKeyboardNavigation,o=r.handleOnMonthKeyDown,s=e.key;s!==ye.Tab&&e.preventDefault(),a||n.handleKeyboardNavigation(e,s,t),o&&o(e)},n.onQuarterClick=function(e,t){var r=z.setQuarter(n.props.day,t);Ge(r,n.props)||n.handleDayClick(Ie(r),e)},n.onQuarterMouseEnter=function(e){var t=z.setQuarter(n.props.day,e);Ge(t,n.props)||n.handleDayMouseEnter(Ie(t))},n.handleQuarterNavigation=function(e,t){var r,a,o,s;n.isDisabled(t)||n.isExcluded(t)||(null===(a=(r=n.props).setPreSelection)||void 0===a||a.call(r,t),null===(s=null===(o=n.QUARTER_REFS[e-1])||void 0===o?void 0:o.current)||void 0===s||s.focus())},n.onQuarterKeyDown=function(e,t){var r,a,o=e.key;if(!n.props.disabledKeyboardNavigation)switch(o){case ye.Enter:n.onQuarterClick(e,t),null===(a=(r=n.props).setPreSelection)||void 0===a||a.call(r,n.props.selected);break;case ye.ArrowRight:if(!n.props.preSelection)break;n.handleQuarterNavigation(4===t?1:t+1,l.addQuarters(n.props.preSelection,1));break;case ye.ArrowLeft:if(!n.props.preSelection)break;n.handleQuarterNavigation(1===t?4:t-1,oe.subQuarters(n.props.preSelection,1))}},n.isMonthDisabledForLabelDate=function(e){var t,r=n.props,a=r.day,o=r.minDate,s=r.maxDate,i=r.excludeDates,l=r.includeDates,c=$.setMonth(a,e);return{isDisabled:null!==(t=(o||s||i||l)&&$e(c,n.props))&&void 0!==t&&t,labelDate:c}},n.isMonthDisabled=function(e){return n.isMonthDisabledForLabelDate(e).isDisabled},n.getMonthClassNames=function(e){var r=n.props,a=r.day,o=r.startDate,s=r.endDate,i=r.preSelection,l=r.monthClassName,c=l?l($.setMonth(a,e)):void 0,p=n.getSelection();return t.clsx("react-datepicker__month-text","react-datepicker__month-".concat(e),c,{"react-datepicker__month-text--disabled":n.isMonthDisabled(e),"react-datepicker__month-text--selected":p?n.isSelectMonthInList(a,e,p):void 0,"react-datepicker__month-text--keyboard-selected":!n.props.disabledKeyboardNavigation&&i&&n.isSelectedMonth(a,e,i)&&!n.isMonthDisabled(e),"react-datepicker__month-text--in-selecting-range":n.isInSelectingRangeMonth(e),"react-datepicker__month-text--in-range":o&&s?ze(o,s,e,a):void 0,"react-datepicker__month-text--range-start":n.isRangeStartMonth(e),"react-datepicker__month-text--range-end":n.isRangeEndMonth(e),"react-datepicker__month-text--selecting-range-start":n.isSelectingMonthRangeStart(e),"react-datepicker__month-text--selecting-range-end":n.isSelectingMonthRangeEnd(e),"react-datepicker__month-text--today":n.isCurrentMonth(a,e)})},n.getTabIndex=function(e){if(null==n.props.preSelection)return"-1";var t=_.getMonth(n.props.preSelection);return n.props.disabledKeyboardNavigation||e!==t?"-1":"0"},n.getQuarterTabIndex=function(e){if(null==n.props.preSelection)return"-1";var t=E.getQuarter(n.props.preSelection);return n.props.disabledKeyboardNavigation||e!==t?"-1":"0"},n.getAriaLabel=function(e){var t=n.props,r=t.chooseDayAriaLabelPrefix,a=void 0===r?"Choose":r,o=t.disabledDayAriaLabelPrefix,s=void 0===o?"Not available":o,i=t.day,l=t.locale,c=$.setMonth(i,e),p=n.isDisabled(c)||n.isExcluded(c)?s:a;return"".concat(p," ").concat(_e(c,"MMMM yyyy",l))},n.getQuarterClassNames=function(e){var r=n.props,a=r.day,o=r.startDate,s=r.endDate,i=r.selected,l=r.minDate,c=r.maxDate,p=r.excludeDates,d=r.includeDates,u=r.filterDate,f=r.preSelection,h=r.disabledKeyboardNavigation,m=(l||c||p||d||u)&&Ge(z.setQuarter(a,e),n.props);return t.clsx("react-datepicker__quarter-text","react-datepicker__quarter-".concat(e),{"react-datepicker__quarter-text--disabled":m,"react-datepicker__quarter-text--selected":i?n.isSelectedQuarter(a,e,i):void 0,"react-datepicker__quarter-text--keyboard-selected":!h&&f&&n.isSelectedQuarter(a,e,f)&&!m,"react-datepicker__quarter-text--in-selecting-range":n.isInSelectingRangeQuarter(e),"react-datepicker__quarter-text--in-range":o&&s?et(o,s,e,a):void 0,"react-datepicker__quarter-text--range-start":n.isRangeStartQuarter(e),"react-datepicker__quarter-text--range-end":n.isRangeEndQuarter(e)})},n.getMonthContent=function(e){var t=n.props,r=t.showFullMonthYearPicker,a=t.renderMonthContent,o=t.locale,s=t.day,i=Ve(e,o),l=Be(e,o);return a?a(e,i,l,s):r?l:i},n.getQuarterContent=function(e){var t,r=n.props,a=r.renderQuarterContent,o=function(e,t){return _e(z.setQuarter(Me(),e),"QQQ",t)}(e,r.locale);return null!==(t=null==a?void 0:a(e,o))&&void 0!==t?t:o},n.renderMonths=function(){var e,t=n.props,r=t.showTwoColumnMonthYearPicker,a=t.showFourColumnMonthYearPicker,o=t.day,s=t.selected,i=null===(e=Pt[Yt(a,r)])||void 0===e?void 0:e.grid;return null==i?void 0:i.map((function(e,t){return ue.default.createElement("div",{className:"react-datepicker__month-wrapper",key:t},e.map((function(e,t){return ue.default.createElement("div",{ref:n.MONTH_REFS[e],key:t,onClick:function(t){n.onMonthClick(t,e)},onKeyDown:function(t){yt(t)&&(t.preventDefault(),t.key=ye.Enter),n.onMonthKeyDown(t,e)},onMouseEnter:n.props.usePointerEvent?void 0:function(){return n.onMonthMouseEnter(e)},onPointerEnter:n.props.usePointerEvent?function(){return n.onMonthMouseEnter(e)}:void 0,tabIndex:Number(n.getTabIndex(e)),className:n.getMonthClassNames(e),"aria-disabled":n.isMonthDisabled(e),role:"option","aria-label":n.getAriaLabel(e),"aria-current":n.isCurrentMonth(o,e)?"date":void 0,"aria-selected":s?n.isSelectedMonth(o,e,s):void 0},n.getMonthContent(e))})))}))},n.renderQuarters=function(){var e=n.props,t=e.day,r=e.selected;return ue.default.createElement("div",{className:"react-datepicker__quarter-wrapper"},[1,2,3,4].map((function(e,a){return ue.default.createElement("div",{key:a,ref:n.QUARTER_REFS[a],role:"option",onClick:function(t){n.onQuarterClick(t,e)},onKeyDown:function(t){n.onQuarterKeyDown(t,e)},onMouseEnter:n.props.usePointerEvent?void 0:function(){return n.onQuarterMouseEnter(e)},onPointerEnter:n.props.usePointerEvent?function(){return n.onQuarterMouseEnter(e)}:void 0,className:n.getQuarterClassNames(e),"aria-selected":r?n.isSelectedQuarter(t,e,r):void 0,tabIndex:Number(n.getQuarterTabIndex(e)),"aria-current":n.isCurrentQuarter(t,e)?"date":void 0},n.getQuarterContent(e))})))},n.getClassNames=function(){var e=n.props,r=e.selectingDate,a=e.selectsStart,o=e.selectsEnd,s=e.showMonthYearPicker,i=e.showQuarterYearPicker,l=e.showWeekPicker;return t.clsx("react-datepicker__month",{"react-datepicker__month--selecting-range":r&&(a||o)},{"react-datepicker__monthPicker":s},{"react-datepicker__quarterPicker":i},{"react-datepicker__weekPicker":l})},n}return ve(n,e),n.prototype.getSelection=function(){var e=this.props,t=e.selected,r=e.selectedDates;return e.selectsMultiple?r:t?[t]:void 0},n.prototype.render=function(){var e=this.props,t=e.showMonthYearPicker,r=e.showQuarterYearPicker,n=e.day,a=e.ariaLabelPrefix,o=void 0===a?"Month ":a,s=o?o.trim()+" ":"";return ue.default.createElement("div",{className:this.getClassNames(),onMouseLeave:this.props.usePointerEvent?void 0:this.handleMouseLeave,onPointerLeave:this.props.usePointerEvent?this.handleMouseLeave:void 0,"aria-label":"".concat(s).concat(_e(n,"MMMM, yyyy",this.props.locale)),role:"listbox"},t?this.renderMonths():r?this.renderQuarters():this.renderWeeks())},n}(r.Component),Nt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isSelectedMonth=function(e){return t.props.month===e},t.renderOptions=function(){return t.props.monthNames.map((function(e,r){return ue.default.createElement("div",{className:t.isSelectedMonth(r)?"react-datepicker__month-option react-datepicker__month-option--selected_month":"react-datepicker__month-option",key:e,onClick:t.onChange.bind(t,r),"aria-selected":t.isSelectedMonth(r)?"true":void 0},t.isSelectedMonth(r)?ue.default.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",e)}))},t.onChange=function(e){return t.props.onChange(e)},t.handleClickOutside=function(){return t.props.onCancel()},t}return ve(t,e),t.prototype.render=function(){return ue.default.createElement("div",{className:"react-datepicker__month-dropdown"},this.renderOptions())},t}(r.Component),Ot=fe.default(Nt),It=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={dropdownVisible:!1},t.renderSelectOptions=function(e){return e.map((function(e,t){return ue.default.createElement("option",{key:e,value:t},e)}))},t.renderSelectMode=function(e){return ue.default.createElement("select",{value:t.props.month,className:"react-datepicker__month-select",onChange:function(e){return t.onChange(parseInt(e.target.value))}},t.renderSelectOptions(e))},t.renderReadView=function(e,r){return ue.default.createElement("div",{key:"read",style:{visibility:e?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:t.toggleDropdown},ue.default.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},r[t.props.month]))},t.renderDropdown=function(e){return ue.default.createElement(Ot,ge({key:"dropdown"},t.props,{monthNames:e,onChange:t.onChange,onCancel:t.toggleDropdown}))},t.renderScrollMode=function(e){var r=t.state.dropdownVisible,n=[t.renderReadView(!r,e)];return r&&n.unshift(t.renderDropdown(e)),n},t.onChange=function(e){t.toggleDropdown(),e!==t.props.month&&t.props.onChange(e)},t.toggleDropdown=function(){return t.setState({dropdownVisible:!t.state.dropdownVisible})},t}return ve(t,e),t.prototype.render=function(){var e,t=this,r=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(e){return Ve(e,t.props.locale)}:function(e){return Be(e,t.props.locale)});switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode(r);break;case"select":e=this.renderSelectMode(r)}return ue.default.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},e)},t}(r.Component);function Tt(e,t){for(var r=[],n=Ne(e),a=Ne(t);!N.isAfter(n,a);)r.push(Me(n)),n=i.addMonths(n,1);return r}var Rt=function(e){function r(t){var r=e.call(this,t)||this;return r.renderOptions=function(){return r.state.monthYearsList.map((function(e){var t=Y.getTime(e),n=Le(r.props.date,e)&&Ae(r.props.date,e);return ue.default.createElement("div",{className:n?"react-datepicker__month-year-option--selected_month-year":"react-datepicker__month-year-option",key:t,onClick:r.onChange.bind(r,t),"aria-selected":n?"true":void 0},n?ue.default.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",_e(e,r.props.dateFormat,r.props.locale))}))},r.onChange=function(e){return r.props.onChange(e)},r.handleClickOutside=function(){r.props.onCancel()},r.state={monthYearsList:Tt(r.props.minDate,r.props.maxDate)},r}return ve(r,e),r.prototype.render=function(){var e=t.clsx({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return ue.default.createElement("div",{className:e},this.renderOptions())},r}(r.Component),Lt=fe.default(Rt),At=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={dropdownVisible:!1},t.renderSelectOptions=function(){for(var e=Ne(t.props.minDate),r=Ne(t.props.maxDate),n=[];!N.isAfter(e,r);){var a=Y.getTime(e);n.push(ue.default.createElement("option",{key:a,value:a},_e(e,t.props.dateFormat,t.props.locale))),e=i.addMonths(e,1)}return n},t.onSelectChange=function(e){t.onChange(parseInt(e.target.value))},t.renderSelectMode=function(){return ue.default.createElement("select",{value:Y.getTime(Ne(t.props.date)),className:"react-datepicker__month-year-select",onChange:t.onSelectChange},t.renderSelectOptions())},t.renderReadView=function(e){var r=_e(t.props.date,t.props.dateFormat,t.props.locale);return ue.default.createElement("div",{key:"read",style:{visibility:e?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:t.toggleDropdown},ue.default.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},r))},t.renderDropdown=function(){return ue.default.createElement(Lt,ge({key:"dropdown"},t.props,{onChange:t.onChange,onCancel:t.toggleDropdown}))},t.renderScrollMode=function(){var e=t.state.dropdownVisible,r=[t.renderReadView(!e)];return e&&r.unshift(t.renderDropdown()),r},t.onChange=function(e){t.toggleDropdown();var r=Me(e);Le(t.props.date,r)&&Ae(t.props.date,r)||t.props.onChange(r)},t.toggleDropdown=function(){return t.setState({dropdownVisible:!t.state.dropdownVisible})},t}return ve(t,e),t.prototype.render=function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return ue.default.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},e)},t}(r.Component),Ft=function(e){function t(){var r=null!==e&&e.apply(this,arguments)||this;return r.state={height:null},r.scrollToTheSelectedTime=function(){requestAnimationFrame((function(){var e,n,a;r.list&&(r.list.scrollTop=null!==(a=r.centerLi&&t.calcCenterPosition(r.props.monthRef?r.props.monthRef.clientHeight-(null!==(n=null===(e=r.header)||void 0===e?void 0:e.clientHeight)&&void 0!==n?n:0):r.list.clientHeight,r.centerLi))&&void 0!==a?a:0)}))},r.handleClick=function(e){var t,n;(r.props.minTime||r.props.maxTime)&&at(e,r.props)||(r.props.excludeTimes||r.props.includeTimes||r.props.filterTime)&&nt(e,r.props)||null===(n=(t=r.props).onChange)||void 0===n||n.call(t,e)},r.isSelectedTime=function(e){return r.props.selected&&(t=r.props.selected,n=e,vt(t).getTime()===vt(n).getTime());var t,n},r.isDisabledTime=function(e){return(r.props.minTime||r.props.maxTime)&&at(e,r.props)||(r.props.excludeTimes||r.props.includeTimes||r.props.filterTime)&&nt(e,r.props)},r.liClasses=function(e){var n,a=["react-datepicker__time-list-item",r.props.timeClassName?r.props.timeClassName(e):void 0];return r.isSelectedTime(e)&&a.push("react-datepicker__time-list-item--selected"),r.isDisabledTime(e)&&a.push("react-datepicker__time-list-item--disabled"),r.props.injectTimes&&(3600*b.getHours(e)+60*C.getMinutes(e)+P.getSeconds(e))%(60*(null!==(n=r.props.intervals)&&void 0!==n?n:t.defaultProps.intervals))!=0&&a.push("react-datepicker__time-list-item--injected"),a.join(" ")},r.handleOnKeyDown=function(e,t){var n,a;e.key===ye.Space&&(e.preventDefault(),e.key=ye.Enter),(e.key===ye.ArrowUp||e.key===ye.ArrowLeft)&&e.target instanceof HTMLElement&&e.target.previousSibling&&(e.preventDefault(),e.target.previousSibling instanceof HTMLElement&&e.target.previousSibling.focus()),(e.key===ye.ArrowDown||e.key===ye.ArrowRight)&&e.target instanceof HTMLElement&&e.target.nextSibling&&(e.preventDefault(),e.target.nextSibling instanceof HTMLElement&&e.target.nextSibling.focus()),e.key===ye.Enter&&r.handleClick(t),null===(a=(n=r.props).handleOnKeyDown)||void 0===a||a.call(n,e)},r.renderTimes=function(){for(var e,n=[],a=r.props.format?r.props.format:"p",o=null!==(e=r.props.intervals)&&void 0!==e?e:t.defaultProps.intervals,i=r.props.selected||r.props.openToDate||Me(),l=Ye(i),c=r.props.injectTimes&&r.props.injectTimes.sort((function(e,t){return e.getTime()-t.getTime()})),p=60*function(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(e.getFullYear(),e.getMonth(),e.getDate(),24);return Math.round((+r-+t)/36e5)}(i),d=p/o,u=0;u =p&&t m){u=l%f;t<=m&&t>m-u?f=u:f+=u,h=t+f}a.handleYearNavigation(h,d.addYears(a.props.preSelection,f))}c&&c(e)},a.getYearClassNames=function(e){var r=a.props,n=r.date,o=r.minDate,s=r.maxDate,i=r.selected,l=r.excludeDates,c=r.includeDates,p=r.filterDate,d=r.yearClassName;return t.clsx("react-datepicker__year-text","react-datepicker__year-".concat(e),n?null==d?void 0:d(G.setYear(n,e)):void 0,{"react-datepicker__year-text--selected":i?e===x.getYear(i):void 0,"react-datepicker__year-text--disabled":(o||s||l||c||p)&&Ze(e,a.props),"react-datepicker__year-text--keyboard-selected":a.isKeyboardSelected(e),"react-datepicker__year-text--range-start":a.isRangeStart(e),"react-datepicker__year-text--range-end":a.isRangeEnd(e),"react-datepicker__year-text--in-range":a.isInRange(e),"react-datepicker__year-text--in-selecting-range":a.isInSelectingRange(e),"react-datepicker__year-text--selecting-range-start":a.isSelectingRangeStart(e),"react-datepicker__year-text--selecting-range-end":a.isSelectingRangeEnd(e),"react-datepicker__year-text--today":a.isCurrentYear(e)})},a.getYearTabIndex=function(e){return a.props.disabledKeyboardNavigation||null==a.props.preSelection?"-1":e===x.getYear(a.props.preSelection)?"0":"-1"},a.getYearContainerClassNames=function(){var e=a.props,r=e.selectingDate,n=e.selectsStart,o=e.selectsEnd,s=e.selectsRange;return t.clsx("react-datepicker__year",{"react-datepicker__year--selecting-range":r&&(n||o||s)})},a.getYearContent=function(e){return a.props.renderYearContent?a.props.renderYearContent(e):e},a}return ve(n,e),n.prototype.render=function(){var e=this,t=[],r=this.props,n=r.date,a=r.yearItemNumber,o=r.onYearMouseEnter,s=r.onYearMouseLeave;if(void 0===n)return null;for(var i=mt(n,a),l=i.startPeriod,c=i.endPeriod,p=function(r){t.push(ue.default.createElement("div",{ref:d.YEAR_REFS[r-l],onClick:function(t){e.onYearClick(t,r)},onKeyDown:function(t){yt(t)&&(t.preventDefault(),t.key=ye.Enter),e.onYearKeyDown(t,r)},tabIndex:Number(d.getYearTabIndex(r)),className:d.getYearClassNames(r),onMouseEnter:d.props.usePointerEvent?void 0:function(e){return o(e,r)},onPointerEnter:d.props.usePointerEvent?function(e){return o(e,r)}:void 0,onMouseLeave:d.props.usePointerEvent?void 0:function(e){return s(e,r)},onPointerLeave:d.props.usePointerEvent?function(e){return s(e,r)}:void 0,key:r,"aria-current":d.isCurrentYear(r)?"date":void 0},d.getYearContent(r)))},d=this,u=l;u<=c;u++)p(u);return ue.default.createElement("div",{className:this.getYearContainerClassNames()},ue.default.createElement("div",{className:"react-datepicker__year-wrapper",onMouseLeave:this.props.usePointerEvent?void 0:this.props.clearSelectingDate,onPointerLeave:this.props.usePointerEvent?this.props.clearSelectingDate:void 0},t))},n}(r.Component);function Wt(e,t,r,n){for(var a=[],o=0;o<2*t+1;o++){var s=e+t-o,i=!0;r&&(i=x.getYear(r)<=s),n&&i&&(i=x.getYear(n)>=s),i&&a.push(s)}return a}var Qt=function(e){function n(t){var n=e.call(this,t)||this;n.renderOptions=function(){var e=n.props.year,t=n.state.yearsList.map((function(t){return ue.default.createElement("div",{className:e===t?"react-datepicker__year-option react-datepicker__year-option--selected_year":"react-datepicker__year-option",key:t,onClick:n.onChange.bind(n,t),"aria-selected":e===t?"true":void 0},e===t?ue.default.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",t)})),r=n.props.minDate?x.getYear(n.props.minDate):null,a=n.props.maxDate?x.getYear(n.props.maxDate):null;return a&&n.state.yearsList.find((function(e){return e===a}))||t.unshift(ue.default.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:n.incrementYears},ue.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),r&&n.state.yearsList.find((function(e){return e===r}))||t.push(ue.default.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:n.decrementYears},ue.default.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),t},n.onChange=function(e){n.props.onChange(e)},n.handleClickOutside=function(){n.props.onCancel()},n.shiftYears=function(e){var t=n.state.yearsList.map((function(t){return t+e}));n.setState({yearsList:t})},n.incrementYears=function(){return n.shiftYears(1)},n.decrementYears=function(){return n.shiftYears(-1)};var a=t.yearDropdownItemNumber,o=t.scrollableYearDropdown,s=a||(o?10:5);return n.state={yearsList:Wt(n.props.year,s,n.props.minDate,n.props.maxDate)},n.dropdownRef=r.createRef(),n}return ve(n,e),n.prototype.componentDidMount=function(){var e=this.dropdownRef.current;if(e){var t=e.children?Array.from(e.children):null,r=t?t.find((function(e){return e.ariaSelected})):null;e.scrollTop=r&&r instanceof HTMLElement?r.offsetTop+(r.clientHeight-e.clientHeight)/2:(e.scrollHeight-e.clientHeight)/2}},n.prototype.render=function(){var e=t.clsx({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return ue.default.createElement("div",{className:e,ref:this.dropdownRef},this.renderOptions())},n}(r.Component),qt=fe.default(Qt),Kt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={dropdownVisible:!1},t.renderSelectOptions=function(){for(var e=t.props.minDate?x.getYear(t.props.minDate):1900,r=t.props.maxDate?x.getYear(t.props.maxDate):2100,n=[],a=e;a<=r;a++)n.push(ue.default.createElement("option",{key:a,value:a},a));return n},t.onSelectChange=function(e){t.onChange(parseInt(e.target.value))},t.renderSelectMode=function(){return ue.default.createElement("select",{value:t.props.year,className:"react-datepicker__year-select",onChange:t.onSelectChange},t.renderSelectOptions())},t.renderReadView=function(e){return ue.default.createElement("div",{key:"read",style:{visibility:e?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:function(e){return t.toggleDropdown(e)}},ue.default.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),ue.default.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},t.props.year))},t.renderDropdown=function(){return ue.default.createElement(qt,ge({key:"dropdown"},t.props,{onChange:t.onChange,onCancel:t.toggleDropdown}))},t.renderScrollMode=function(){var e=t.state.dropdownVisible,r=[t.renderReadView(!e)];return e&&r.unshift(t.renderDropdown()),r},t.onChange=function(e){t.toggleDropdown(),e!==t.props.year&&t.props.onChange(e)},t.toggleDropdown=function(e){t.setState({dropdownVisible:!t.state.dropdownVisible},(function(){t.props.adjustDateOnChange&&t.handleYearChange(t.props.date,e)}))},t.handleYearChange=function(e,r){t.onSelect(e,r),t.setOpen()},t.onSelect=function(e,r){t.props.onSelect&&t.props.onSelect(e,r)},t.setOpen=function(){t.props.setOpen&&t.props.setOpen(!0)},t}return ve(t,e),t.prototype.render=function(){var e;switch(this.props.dropdownMode){case"scroll":e=this.renderScrollMode();break;case"select":e=this.renderSelectMode()}return ue.default.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},e)},t}(r.Component),Bt=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Vt=function(e){function n(o){var s=e.call(this,o)||this;return s.monthContainer=void 0,s.handleClickOutside=function(e){s.props.onClickOutside(e)},s.setClickOutsideRef=function(){return s.containerRef.current},s.handleDropdownFocus=function(e){var t,r,n,a;n=e.target,a=(n.className||"").split(/\s+/),Bt.some((function(e){return a.indexOf(e)>=0}))&&(null===(r=(t=s.props).onDropdownFocus)||void 0===r||r.call(t,e))},s.getDateInView=function(){var e=s.props,t=e.preSelection,r=e.selected,n=e.openToDate,a=ct(s.props),o=pt(s.props),i=Me(),l=n||r||t;return l||(a&&O.isBefore(i,a)?a:o&&N.isAfter(i,o)?o:i)},s.increaseMonth=function(){s.setState((function(e){var t=e.date;return{date:i.addMonths(t,1)}}),(function(){return s.handleMonthChange(s.state.date)}))},s.decreaseMonth=function(){s.setState((function(e){var t=e.date;return{date:ae.subMonths(t,1)}}),(function(){return s.handleMonthChange(s.state.date)}))},s.handleDayClick=function(e,t,r){s.props.onSelect(e,t,r),s.props.setPreSelection&&s.props.setPreSelection(e)},s.handleDayMouseEnter=function(e){s.setState({selectingDate:e}),s.props.onDayMouseEnter&&s.props.onDayMouseEnter(e)},s.handleMonthMouseLeave=function(){s.setState({selectingDate:void 0}),s.props.onMonthMouseLeave&&s.props.onMonthMouseLeave()},s.handleYearMouseEnter=function(e,t){s.setState({selectingDate:G.setYear(Me(),t)}),s.props.onYearMouseEnter&&s.props.onYearMouseEnter(e,t)},s.handleYearMouseLeave=function(e,t){s.props.onYearMouseLeave&&s.props.onYearMouseLeave(e,t)},s.handleYearChange=function(e){s.props.onYearChange&&(s.props.onYearChange(e),s.setState({isRenderAriaLiveMessage:!0})),s.props.adjustDateOnChange&&(s.props.onSelect&&s.props.onSelect(e),s.props.setOpen&&s.props.setOpen(!0)),s.props.setPreSelection&&s.props.setPreSelection(e)},s.handleMonthChange=function(e){s.handleCustomMonthChange(e),s.props.adjustDateOnChange&&(s.props.onSelect&&s.props.onSelect(e),s.props.setOpen&&s.props.setOpen(!0)),s.props.setPreSelection&&s.props.setPreSelection(e)},s.handleCustomMonthChange=function(e){s.props.onMonthChange&&(s.props.onMonthChange(e),s.setState({isRenderAriaLiveMessage:!0}))},s.handleMonthYearChange=function(e){s.handleYearChange(e),s.handleMonthChange(e)},s.changeYear=function(e){s.setState((function(t){var r=t.date;return{date:G.setYear(r,Number(e))}}),(function(){return s.handleYearChange(s.state.date)}))},s.changeMonth=function(e){s.setState((function(t){var r=t.date;return{date:$.setMonth(r,Number(e))}}),(function(){return s.handleMonthChange(s.state.date)}))},s.changeMonthYear=function(e){s.setState((function(t){var r=t.date;return{date:G.setYear($.setMonth(r,_.getMonth(e)),x.getYear(e))}}),(function(){return s.handleMonthYearChange(s.state.date)}))},s.header=function(e){void 0===e&&(e=s.state.date);var r=xe(e,s.props.locale,s.props.calendarStartDay),n=[];return s.props.showWeekNumbers&&n.push(ue.default.createElement("div",{key:"W",className:"react-datepicker__day-name"},s.props.weekLabel||"#")),n.concat([0,1,2,3,4,5,6].map((function(e){var n=a.addDays(r,e),o=s.formatWeekday(n,s.props.locale),i=s.props.weekDayClassName?s.props.weekDayClassName(n):void 0;return ue.default.createElement("div",{key:e,"aria-label":_e(n,"EEEE",s.props.locale),className:t.clsx("react-datepicker__day-name",i)},o)})))},s.formatWeekday=function(e,t){return s.props.formatWeekDay?function(e,t,r){return t(_e(e,"EEEE",r))}(e,s.props.formatWeekDay,t):s.props.useWeekdaysShort?function(e,t){return _e(e,"EEE",t)}(e,t):function(e,t){return _e(e,"EEEEEE",t)}(e,t)},s.decreaseYear=function(){s.setState((function(e){var t,r=e.date;return{date:ie.subYears(r,s.props.showYearPicker?null!==(t=s.props.yearItemNumber)&&void 0!==t?t:n.defaultProps.yearItemNumber:1)}}),(function(){return s.handleYearChange(s.state.date)}))},s.clearSelectingDate=function(){s.setState({selectingDate:void 0})},s.renderPreviousButton=function(){var e;if(!s.props.renderCustomHeader){var t;switch(!0){case s.props.showMonthYearPicker:t=it(s.state.date,s.props);break;case s.props.showYearPicker:t=function(e,t){var r=void 0===t?{}:t,n=r.minDate,a=r.yearItemNumber,o=void 0===a?Se:a,s=mt(Oe(ie.subYears(e,o)),o).endPeriod,i=n&&x.getYear(n);return i&&i>s||!1}(s.state.date,s.props);break;case s.props.showQuarterYearPicker:t=function(e,t){var r=void 0===t?{}:t,n=r.minDate,a=r.includeDates,o=re.startOfYear(e),s=oe.subQuarters(o,1);return n&&h.differenceInCalendarQuarters(n,s)>0||a&&a.every((function(e){return h.differenceInCalendarQuarters(e,s)>0}))||!1}(s.state.date,s.props);break;default:t=ot(s.state.date,s.props)}if(((null!==(e=s.props.forceShowMonthNavigation)&&void 0!==e?e:n.defaultProps.forceShowMonthNavigation)||s.props.showDisabledMonthNavigation||!t)&&!s.props.showTimeSelectOnly){var r=["react-datepicker__navigation","react-datepicker__navigation--previous"],a=s.decreaseMonth;(s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker)&&(a=s.decreaseYear),t&&s.props.showDisabledMonthNavigation&&(r.push("react-datepicker__navigation--previous--disabled"),a=void 0);var o=s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker,i=s.props,l=i.previousMonthButtonLabel,c=void 0===l?n.defaultProps.previousMonthButtonLabel:l,p=i.previousYearButtonLabel,d=void 0===p?n.defaultProps.previousYearButtonLabel:p,u=s.props,f=u.previousMonthAriaLabel,m=void 0===f?"string"==typeof c?c:"Previous Month":f,v=u.previousYearAriaLabel,g=void 0===v?"string"==typeof d?d:"Previous Year":v;return ue.default.createElement("button",{type:"button",className:r.join(" "),onClick:a,onKeyDown:s.props.handleOnKeyDown,"aria-label":o?g:m},ue.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"].join(" ")},o?d:c))}}},s.increaseYear=function(){s.setState((function(e){var t,r=e.date;return{date:d.addYears(r,s.props.showYearPicker?null!==(t=s.props.yearItemNumber)&&void 0!==t?t:n.defaultProps.yearItemNumber:1)}}),(function(){return s.handleYearChange(s.state.date)}))},s.renderNextButton=function(){var e;if(!s.props.renderCustomHeader){var t;switch(!0){case s.props.showMonthYearPicker:t=lt(s.state.date,s.props);break;case s.props.showYearPicker:t=function(e,t){var r=void 0===t?{}:t,n=r.maxDate,a=r.yearItemNumber,o=void 0===a?Se:a,s=mt(d.addYears(e,o),o).startPeriod,i=n&&x.getYear(n);return i&&i0||a&&a.every((function(e){return h.differenceInCalendarQuarters(s,e)>0}))||!1}(s.state.date,s.props);break;default:t=st(s.state.date,s.props)}if(((null!==(e=s.props.forceShowMonthNavigation)&&void 0!==e?e:n.defaultProps.forceShowMonthNavigation)||s.props.showDisabledMonthNavigation||!t)&&!s.props.showTimeSelectOnly){var r=["react-datepicker__navigation","react-datepicker__navigation--next"];s.props.showTimeSelect&&r.push("react-datepicker__navigation--next--with-time"),s.props.todayButton&&r.push("react-datepicker__navigation--next--with-today-button");var a=s.increaseMonth;(s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker)&&(a=s.increaseYear),t&&s.props.showDisabledMonthNavigation&&(r.push("react-datepicker__navigation--next--disabled"),a=void 0);var o=s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker,i=s.props,c=i.nextMonthButtonLabel,p=void 0===c?n.defaultProps.nextMonthButtonLabel:c,u=i.nextYearButtonLabel,f=void 0===u?n.defaultProps.nextYearButtonLabel:u,m=s.props,v=m.nextMonthAriaLabel,g=void 0===v?"string"==typeof p?p:"Next Month":v,y=m.nextYearAriaLabel,k=void 0===y?"string"==typeof f?f:"Next Year":y;return ue.default.createElement("button",{type:"button",className:r.join(" "),onClick:a,onKeyDown:s.props.handleOnKeyDown,"aria-label":o?k:g},ue.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"].join(" ")},o?f:p))}}},s.renderCurrentMonth=function(e){void 0===e&&(e=s.state.date);var t=["react-datepicker__current-month"];return s.props.showYearDropdown&&t.push("react-datepicker__current-month--hasYearDropdown"),s.props.showMonthDropdown&&t.push("react-datepicker__current-month--hasMonthDropdown"),s.props.showMonthYearDropdown&&t.push("react-datepicker__current-month--hasMonthYearDropdown"),ue.default.createElement("h2",{className:t.join(" ")},Ce(e,s.props.dateFormat,s.props.locale))},s.renderYearDropdown=function(e){if(void 0===e&&(e=!1),s.props.showYearDropdown&&!e)return ue.default.createElement(Kt,ge({},n.defaultProps,s.props,{date:s.state.date,onChange:s.changeYear,year:x.getYear(s.state.date)}))},s.renderMonthDropdown=function(e){if(void 0===e&&(e=!1),s.props.showMonthDropdown&&!e)return ue.default.createElement(It,ge({},n.defaultProps,s.props,{month:C.getMonth(s.state.date),onChange:s.changeMonth}))},s.renderMonthYearDropdown=function(e){if(void 0===e&&(e=!1),s.props.showMonthYearDropdown&&!e)return ue.default.createElement(At,ge({},n.defaultProps,s.props,{date:s.state.date,onChange:s.changeMonthYear}))},s.handleTodayButtonClick=function(e){s.props.onSelect(Te(),e),s.props.setPreSelection&&s.props.setPreSelection(Te())},s.renderTodayButton=function(){if(s.props.todayButton&&!s.props.showTimeSelectOnly)return ue.default.createElement("div",{className:"react-datepicker__today-button",onClick:s.handleTodayButtonClick},s.props.todayButton)},s.renderDefaultHeader=function(e){var t=e.monthDate,r=e.i;return ue.default.createElement("div",{className:"react-datepicker__header ".concat(s.props.showTimeSelect?"react-datepicker__header--has-time-select":"")},s.renderCurrentMonth(t),ue.default.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(s.props.dropdownMode),onFocus:s.handleDropdownFocus},s.renderMonthDropdown(0!==r),s.renderMonthYearDropdown(0!==r),s.renderYearDropdown(0!==r)),ue.default.createElement("div",{className:"react-datepicker__day-names"},s.header(t)))},s.renderCustomHeader=function(e){var t,r,n=e.monthDate,a=e.i;if(s.props.showTimeSelect&&!s.state.monthContainer||s.props.showTimeSelectOnly)return null;var o=ot(s.state.date,s.props),i=st(s.state.date,s.props),l=it(s.state.date,s.props),c=lt(s.state.date,s.props),p=!s.props.showMonthYearPicker&&!s.props.showQuarterYearPicker&&!s.props.showYearPicker;return ue.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:s.props.onDropdownFocus},null===(r=(t=s.props).renderCustomHeader)||void 0===r?void 0:r.call(t,ge(ge({},s.state),{customHeaderCount:a,monthDate:n,changeMonth:s.changeMonth,changeYear:s.changeYear,decreaseMonth:s.decreaseMonth,increaseMonth:s.increaseMonth,decreaseYear:s.decreaseYear,increaseYear:s.increaseYear,prevMonthButtonDisabled:o,nextMonthButtonDisabled:i,prevYearButtonDisabled:l,nextYearButtonDisabled:c})),p&&ue.default.createElement("div",{className:"react-datepicker__day-names"},s.header(n)))},s.renderYearHeader=function(e){var t=e.monthDate,r=s.props,a=r.showYearPicker,o=r.yearItemNumber,i=mt(t,void 0===o?n.defaultProps.yearItemNumber:o),l=i.startPeriod,c=i.endPeriod;return ue.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},a?"".concat(l," - ").concat(c):x.getYear(t))},s.renderHeader=function(e){var t=e.monthDate,r=e.i,n={monthDate:t,i:void 0===r?0:r};switch(!0){case void 0!==s.props.renderCustomHeader:return s.renderCustomHeader(n);case s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker:return s.renderYearHeader(n);default:return s.renderDefaultHeader(n)}},s.renderMonths=function(){var e,t;if(!s.props.showTimeSelectOnly&&!s.props.showYearPicker){for(var r=[],a=null!==(e=s.props.monthsShown)&&void 0!==e?e:n.defaultProps.monthsShown,o=s.props.showPreviousMonths?a-1:0,l=s.props.showMonthYearPicker||s.props.showQuarterYearPicker?d.addYears(s.state.date,o):ae.subMonths(s.state.date,o),c=null!==(t=s.props.monthSelectedIn)&&void 0!==t?t:o,p=0;p0;r.push(ue.default.createElement("div",{key:h,ref:function(e){s.monthContainer=null!=e?e:void 0},className:"react-datepicker__month-container"},s.renderHeader({monthDate:f,i:p}),ue.default.createElement(xt,ge({},n.defaultProps,s.props,{ariaLabelPrefix:s.props.monthAriaLabelPrefix,day:f,onDayClick:s.handleDayClick,handleOnKeyDown:s.props.handleOnDayKeyDown,handleOnMonthKeyDown:s.props.handleOnKeyDown,onDayMouseEnter:s.handleDayMouseEnter,onMouseLeave:s.handleMonthMouseLeave,orderInDisplay:p,selectingDate:s.state.selectingDate,monthShowsDuplicateDaysEnd:m,monthShowsDuplicateDaysStart:v}))))}return r}},s.renderYears=function(){if(!s.props.showTimeSelectOnly)return s.props.showYearPicker?ue.default.createElement("div",{className:"react-datepicker__year--container"},s.renderHeader({monthDate:s.state.date}),ue.default.createElement(Ht,ge({},n.defaultProps,s.props,{selectingDate:s.state.selectingDate,date:s.state.date,onDayClick:s.handleDayClick,clearSelectingDate:s.clearSelectingDate,onYearMouseEnter:s.handleYearMouseEnter,onYearMouseLeave:s.handleYearMouseLeave}))):void 0},s.renderTimeSection=function(){if(s.props.showTimeSelect&&(s.state.monthContainer||s.props.showTimeSelectOnly))return ue.default.createElement(Ft,ge({},n.defaultProps,s.props,{onChange:s.props.onTimeChange,format:s.props.timeFormat,intervals:s.props.timeIntervals,monthRef:s.state.monthContainer}))},s.renderInputTimeSection=function(){var e=s.props.selected?new Date(s.props.selected):void 0,t=e&&_e(e)&&Boolean(s.props.selected)?"".concat(ht(e.getHours()),":").concat(ht(e.getMinutes())):"";if(s.props.showTimeInput)return ue.default.createElement(wt,ge({},n.defaultProps,s.props,{date:e,timeString:t,onChange:s.props.onTimeChange}))},s.renderAriaLiveRegion=function(){var e,t,r=mt(s.state.date,null!==(e=s.props.yearItemNumber)&&void 0!==e?e:n.defaultProps.yearItemNumber),a=r.startPeriod,o=r.endPeriod;return t=s.props.showYearPicker?"".concat(a," - ").concat(o):s.props.showMonthYearPicker||s.props.showQuarterYearPicker?x.getYear(s.state.date):"".concat(Be(C.getMonth(s.state.date),s.props.locale)," ").concat(x.getYear(s.state.date)),ue.default.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"},s.state.isRenderAriaLiveMessage&&t)},s.renderChildren=function(){if(s.props.children)return ue.default.createElement("div",{className:"react-datepicker__children-container"},s.props.children)},s.containerRef=r.createRef(),s.state={date:s.getDateInView(),selectingDate:void 0,monthContainer:void 0,isRenderAriaLiveMessage:!1},s}return ve(n,e),Object.defineProperty(n,"defaultProps",{get:function(){return{monthsShown:1,forceShowMonthNavigation:!1,timeCaption:"Time",previousYearButtonLabel:"Previous Year",nextYearButtonLabel:"Next Year",previousMonthButtonLabel:"Previous Month",nextMonthButtonLabel:"Next Month",yearItemNumber:Se}},enumerable:!1,configurable:!0}),n.prototype.componentDidMount=function(){var e=this;this.props.showTimeSelect&&(this.assignMonthContainer=void e.setState({monthContainer:e.monthContainer}))},n.prototype.componentDidUpdate=function(e){var t=this;if(!this.props.preSelection||He(this.props.preSelection,e.preSelection)&&this.props.monthSelectedIn===e.monthSelectedIn)this.props.openToDate&&!He(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate});else{var r=!Ae(this.state.date,this.props.preSelection);this.setState({date:this.props.preSelection},(function(){return r&&t.handleCustomMonthChange(t.state.date)}))}},n.prototype.render=function(){var e=this.props.container||ke;return ue.default.createElement("div",{style:{display:"contents"},ref:this.containerRef},ue.default.createElement(e,{className:t.clsx("react-datepicker",this.props.className,{"react-datepicker--time-only":this.props.showTimeSelectOnly}),showTime:this.props.showTimeSelect||this.props.showTimeInput,showTimeSelectOnly:this.props.showTimeSelectOnly},this.renderAriaLiveRegion(),this.renderPreviousButton(),this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.renderChildren()))},n}(r.Component),jt=function(e){var t=e.icon,r=e.className,n=void 0===r?"":r,a=e.onClick,o="react-datepicker__calendar-icon";return"string"==typeof t?ue.default.createElement("i",{className:"".concat(o," ").concat(t," ").concat(n),"aria-hidden":"true",onClick:a}):ue.default.isValidElement(t)?ue.default.cloneElement(t,{className:"".concat(t.props.className||""," ").concat(o," ").concat(n),onClick:function(e){"function"==typeof t.props.onClick&&t.props.onClick(e),"function"==typeof a&&a(e)}}):ue.default.createElement("svg",{className:"".concat(o," ").concat(n),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",onClick:a},ue.default.createElement("path",{d:"M96 32V64H48C21.5 64 0 85.5 0 112v48H448V112c0-26.5-21.5-48-48-48H352V32c0-17.7-14.3-32-32-32s-32 14.3-32 32V64H160V32c0-17.7-14.3-32-32-32S96 14.3 96 32zM448 192H0V464c0 26.5 21.5 48 48 48H400c26.5 0 48-21.5 48-48V192z"}))},Ut=function(e){function t(t){var r=e.call(this,t)||this;return r.portalRoot=null,r.el=document.createElement("div"),r}return ve(t,e),t.prototype.componentDidMount=function(){this.portalRoot=(this.props.portalHost||document).getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement("div"),this.portalRoot.setAttribute("id",this.props.portalId),(this.props.portalHost||document.body).appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)},t.prototype.componentWillUnmount=function(){this.portalRoot&&this.portalRoot.removeChild(this.el)},t.prototype.render=function(){return he.default.createPortal(this.props.children,this.el)},t}(r.Component),$t=function(e){return(e instanceof HTMLAnchorElement||!e.disabled)&&-1!==e.tabIndex},zt=function(e){function t(t){var n=e.call(this,t)||this;return n.getTabChildren=function(){var e;return Array.prototype.slice.call(null===(e=n.tabLoopRef.current)||void 0===e?void 0:e.querySelectorAll("[tabindex], a, button, input, select, textarea"),1,-1).filter($t)},n.handleFocusStart=function(){var e=n.getTabChildren();e&&e.length>1&&e[e.length-1].focus()},n.handleFocusEnd=function(){var e=n.getTabChildren();e&&e.length>1&&e[0].focus()},n.tabLoopRef=r.createRef(),n}return ve(t,e),t.prototype.render=function(){var e;return(null!==(e=this.props.enableTabLoop)&&void 0!==e?e:t.defaultProps.enableTabLoop)?ue.default.createElement("div",{className:"react-datepicker__tab-loop",ref:this.tabLoopRef},ue.default.createElement("div",{className:"react-datepicker__tab-loop__start",tabIndex:0,onFocus:this.handleFocusStart}),this.props.children,ue.default.createElement("div",{className:"react-datepicker__tab-loop__end",tabIndex:0,onFocus:this.handleFocusEnd})):this.props.children},t.defaultProps={enableTabLoop:!0},t}(r.Component);var Xt,Gt=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return ve(n,e),Object.defineProperty(n,"defaultProps",{get:function(){return{hidePopper:!0}},enumerable:!1,configurable:!0}),n.prototype.render=function(){var e=this.props,a=e.className,o=e.wrapperClassName,s=e.hidePopper,i=void 0===s?n.defaultProps.hidePopper:s,l=e.popperComponent,c=e.targetComponent,p=e.enableTabLoop,d=e.popperOnKeyDown,u=e.portalId,f=e.portalHost,h=e.popperProps,m=e.showArrow,v=void 0;if(!i){var g=t.clsx("react-datepicker-popper",a);v=ue.default.createElement(zt,{enableTabLoop:p},ue.default.createElement("div",{ref:h.refs.setFloating,style:h.floatingStyles,className:g,"data-placement":h.placement,onKeyDown:d},l,m&&ue.default.createElement(ce.FloatingArrow,{ref:h.arrowRef,context:h.context,fill:"currentColor",strokeWidth:1,height:8,width:16,style:{transform:"translateY(-1px)"},className:"react-datepicker__triangle"})))}this.props.popperContainer&&(v=r.createElement(this.props.popperContainer,{},v)),u&&!i&&(v=ue.default.createElement(Ut,{portalId:u,portalHost:f},v));var y=t.clsx("react-datepicker-wrapper",o);return ue.default.createElement(ue.default.Fragment,null,ue.default.createElement("div",{ref:h.refs.setReference,className:y},c),v)},n}(r.Component),Jt=(Xt=Gt,function(e){var t,n="boolean"!=typeof e.hidePopper||e.hidePopper,a=r.useRef(null),o=ce.useFloating(ge({open:!n,whileElementsMounted:ce.autoUpdate,placement:e.popperPlacement,middleware:ye([ce.flip({padding:15}),ce.offset(10),ce.arrow({element:a})],null!==(t=e.popperModifiers)&&void 0!==t?t:[],!0)},e.popperProps)),s=ge(ge({},e),{hidePopper:n,popperProps:ge(ge({},o),{arrowRef:a})});return ue.default.createElement(Xt,ge({},s))}),Zt="react-datepicker-ignore-onclickoutside",er=fe.default(Vt);var tr="Date input not valid.",rr=function(e){function n(o){var s=e.call(this,o)||this;return s.calendar=null,s.input=null,s.getPreSelection=function(){return s.props.openToDate?s.props.openToDate:s.props.selectsEnd&&s.props.startDate?s.props.startDate:s.props.selectsStart&&s.props.endDate?s.props.endDate:Me()},s.modifyHolidays=function(){var e;return null===(e=s.props.holidays)||void 0===e?void 0:e.reduce((function(e,t){var r=new Date(t.date);return _e(r)?ye(ye([],e,!0),[ge(ge({},t),{date:r})],!1):e}),[])},s.calcInitialState=function(){var e,t=s.getPreSelection(),r=ct(s.props),n=pt(s.props),a=r&&O.isBefore(t,Pe(r))?r:n&&N.isAfter(t,Re(n))?n:t;return{open:s.props.startOpen||!1,preventFocus:!1,inputValue:null,preSelection:null!==(e=s.props.selectsRange?s.props.startDate:s.props.selected)&&void 0!==e?e:a,highlightDates:dt(s.props.highlightDates),focused:!1,shouldFocusDayInline:!1,isRenderAriaLiveMessage:!1,wasHidden:!1}},s.resetHiddenStatus=function(){s.setState(ge(ge({},s.state),{wasHidden:!1}))},s.setHiddenStatus=function(){s.setState(ge(ge({},s.state),{wasHidden:!0}))},s.setHiddenStateOnVisibilityHidden=function(){"hidden"===document.visibilityState&&s.setHiddenStatus()},s.clearPreventFocusTimeout=function(){s.preventFocusTimeout&&clearTimeout(s.preventFocusTimeout)},s.setFocus=function(){s.input&&s.input.focus&&s.input.focus({preventScroll:!0})},s.setBlur=function(){s.input&&s.input.blur&&s.input.blur(),s.cancelFocusInput()},s.setOpen=function(e,t){void 0===t&&(t=!1),s.setState({open:e,preSelection:e&&s.state.open?s.state.preSelection:s.calcInitialState().preSelection,lastPreSelectChange:ar},(function(){e||s.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&s.setBlur(),s.setState({inputValue:null})}))}))},s.inputOk=function(){return I.isDate(s.state.preSelection)},s.isCalendarOpen=function(){return void 0===s.props.open?s.state.open&&!s.props.disabled&&!s.props.readOnly:s.props.open},s.handleFocus=function(e){var t,r,n=s.state.wasHidden,a=!n||s.state.open;n&&s.resetHiddenStatus(),!s.state.preventFocus&&a&&(null===(r=(t=s.props).onFocus)||void 0===r||r.call(t,e),s.props.preventOpenOnFocus||s.props.readOnly||s.setOpen(!0)),s.setState({focused:!0})},s.sendFocusBackToInput=function(){s.preventFocusTimeout&&s.clearPreventFocusTimeout(),s.setState({preventFocus:!0},(function(){s.preventFocusTimeout=setTimeout((function(){s.setFocus(),s.setState({preventFocus:!1})}))}))},s.cancelFocusInput=function(){clearTimeout(s.inputFocusTimeout),s.inputFocusTimeout=void 0},s.deferFocusInput=function(){s.cancelFocusInput(),s.inputFocusTimeout=setTimeout((function(){return s.setFocus()}),1)},s.handleDropdownFocus=function(){s.cancelFocusInput()},s.handleBlur=function(e){var t,r;(!s.state.open||s.props.withPortal||s.props.showTimeInput)&&(null===(r=(t=s.props).onBlur)||void 0===r||r.call(t,e)),s.setState({focused:!1})},s.handleCalendarClickOutside=function(e){var t,r;s.props.inline||s.setOpen(!1),null===(r=(t=s.props).onClickOutside)||void 0===r||r.call(t,e),s.props.withPortal&&e.preventDefault()},s.handleChange=function(){for(var e=[],t=0;t=r||la)}function Xe(e,t){var r=void 0===t?{}:t,n=r.minDate,a=r.maxDate,o=r.excludeDates,s=r.includeDates;return tt(e,{minDate:n,maxDate:a})||o&&o.some((function(t){return Ae(t instanceof Date?t:t.date,e)}))||s&&!s.some((function(t){return Ae(t,e)}))||!1}function Ge(e,t){var r=void 0===t?{}:t,n=r.minDate,a=r.maxDate,o=r.excludeDates,s=r.includeDates,i=r.filterDate;return tt(e,{minDate:n,maxDate:a})||(null==o?void 0:o.some((function(t){return Fe(e,t instanceof Date?t:t.date)})))||s&&!s.some((function(t){return Fe(e,t)}))||i&&!i(Me(e))||!1}function Je(e,t,r){if(!t||!r)return!1;if(!H.isValid(t)||!H.isValid(r))return!1;var n=x.getYear(t),a=x.getYear(r);return n<=e&&a>=e}function Ze(e,t){var r=void 0===t?{}:t,n=r.minDate,a=r.maxDate,o=r.excludeDates,s=r.includeDates,i=r.filterDate,l=new Date(e,0,1);return tt(l,{minDate:n?re.startOfYear(n):void 0,maxDate:a?y.endOfYear(a):void 0})||(null==o?void 0:o.some((function(e){return Le(l,e instanceof Date?e:e.date)})))||s&&!s.some((function(e){return Le(l,e)}))||i&&!i(Me(l))||!1}function et(e,t,r,n){var a=x.getYear(e),o=E.getQuarter(e),s=x.getYear(t),i=E.getQuarter(t),l=x.getYear(n);return a===s&&a===l?o<=r&&r<=i:a=r||la)}function tt(e,t){var r,n=void 0===t?{}:t,a=n.minDate,o=n.maxDate;return null!==(r=a&&u.differenceInCalendarDays(e,a)<0||o&&u.differenceInCalendarDays(e,o)>0)&&void 0!==r&&r}function rt(e,t){return t.some((function(t){return b.getHours(t)===b.getHours(e)&&C.getMinutes(t)===C.getMinutes(e)&&P.getSeconds(t)===P.getSeconds(e)}))}function nt(e,t){var r=void 0===t?{}:t,n=r.excludeTimes,a=r.includeTimes,o=r.filterTime;return n&&rt(e,n)||a&&!rt(e,a)||o&&!o(e)||!1}function at(e,t){var r=t.minTime,n=t.maxTime;if(!r||!n)throw new Error("Both minTime and maxTime props required");var a=Me();a=j.setHours(a,b.getHours(e)),a=U.setMinutes(a,C.getMinutes(e)),a=X.setSeconds(a,P.getSeconds(e));var o=Me();o=j.setHours(o,b.getHours(r)),o=U.setMinutes(o,C.getMinutes(r)),o=X.setSeconds(o,P.getSeconds(r));var s,i=Me();i=j.setHours(i,b.getHours(n)),i=U.setMinutes(i,C.getMinutes(n)),i=X.setSeconds(i,P.getSeconds(n));try{s=!W.isWithinInterval(a,{start:o,end:i})}catch(e){s=!1}return s}function ot(e,t){var r=void 0===t?{}:t,n=r.minDate,a=r.includeDates,o=ae.subMonths(e,1);return n&&f.differenceInCalendarMonths(n,o)>0||a&&a.every((function(e){return f.differenceInCalendarMonths(e,o)>0}))||!1}function st(e,t){var r=void 0===t?{}:t,n=r.maxDate,a=r.includeDates,o=i.addMonths(e,1);return n&&f.differenceInCalendarMonths(o,n)>0||a&&a.every((function(e){return f.differenceInCalendarMonths(o,e)>0}))||!1}function it(e,t){var r=void 0===t?{}:t,n=r.minDate,a=r.includeDates,o=ie.subYears(e,1);return n&&m.differenceInCalendarYears(n,o)>0||a&&a.every((function(e){return m.differenceInCalendarYears(e,o)>0}))||!1}function lt(e,t){var r=void 0===t?{}:t,n=r.maxDate,a=r.includeDates,o=d.addYears(e,1);return n&&m.differenceInCalendarYears(o,n)>0||a&&a.every((function(e){return m.differenceInCalendarYears(o,e)>0}))||!1}function ct(e){var t=e.minDate,r=e.includeDates;if(r&&t){var n=r.filter((function(e){return u.differenceInCalendarDays(e,t)>=0}));return q.min(n)}return r?q.min(r):t}function pt(e){var t=e.maxDate,r=e.includeDates;if(r&&t){var n=r.filter((function(e){return u.differenceInCalendarDays(e,t)<=0}));return Q.max(n)}return r?Q.max(r):t}function dt(e,t){var r;void 0===e&&(e=[]),void 0===t&&(t="react-datepicker__day--highlighted");for(var n=new Map,a=0,o=e.length;a0||a&&a.every((function(e){return h.differenceInCalendarQuarters(s,e)>0}))||!1}(s.state.date,s.props);break;default:t=st(s.state.date,s.props)}if(((null!==(e=s.props.forceShowMonthNavigation)&&void 0!==e?e:n.defaultProps.forceShowMonthNavigation)||s.props.showDisabledMonthNavigation||!t)&&!s.props.showTimeSelectOnly){var r=["react-datepicker__navigation","react-datepicker__navigation--next"];s.props.showTimeSelect&&r.push("react-datepicker__navigation--next--with-time"),s.props.todayButton&&r.push("react-datepicker__navigation--next--with-today-button");var a=s.increaseMonth;(s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker)&&(a=s.increaseYear),t&&s.props.showDisabledMonthNavigation&&(r.push("react-datepicker__navigation--next--disabled"),a=void 0);var o=s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker,i=s.props,c=i.nextMonthButtonLabel,p=void 0===c?n.defaultProps.nextMonthButtonLabel:c,u=i.nextYearButtonLabel,f=void 0===u?n.defaultProps.nextYearButtonLabel:u,m=s.props,v=m.nextMonthAriaLabel,g=void 0===v?"string"==typeof p?p:"Next Month":v,D=m.nextYearAriaLabel,k=void 0===D?"string"==typeof f?f:"Next Year":D;return ue.default.createElement("button",{type:"button",className:r.join(" "),onClick:a,onKeyDown:s.props.handleOnKeyDown,"aria-label":o?k:g},ue.default.createElement("span",{className:["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"].join(" ")},o?f:p))}}},s.renderCurrentMonth=function(e){void 0===e&&(e=s.state.date);var t=["react-datepicker__current-month"];return s.props.showYearDropdown&&t.push("react-datepicker__current-month--hasYearDropdown"),s.props.showMonthDropdown&&t.push("react-datepicker__current-month--hasMonthDropdown"),s.props.showMonthYearDropdown&&t.push("react-datepicker__current-month--hasMonthYearDropdown"),ue.default.createElement("h2",{className:t.join(" ")},_e(e,s.props.dateFormat,s.props.locale))},s.renderYearDropdown=function(e){if(void 0===e&&(e=!1),s.props.showYearDropdown&&!e)return ue.default.createElement(Kt,ge({},n.defaultProps,s.props,{date:s.state.date,onChange:s.changeYear,year:x.getYear(s.state.date)}))},s.renderMonthDropdown=function(e){if(void 0===e&&(e=!1),s.props.showMonthDropdown&&!e)return ue.default.createElement(It,ge({},n.defaultProps,s.props,{month:_.getMonth(s.state.date),onChange:s.changeMonth}))},s.renderMonthYearDropdown=function(e){if(void 0===e&&(e=!1),s.props.showMonthYearDropdown&&!e)return ue.default.createElement(At,ge({},n.defaultProps,s.props,{date:s.state.date,onChange:s.changeMonthYear}))},s.handleTodayButtonClick=function(e){s.props.onSelect(Te(),e),s.props.setPreSelection&&s.props.setPreSelection(Te())},s.renderTodayButton=function(){if(s.props.todayButton&&!s.props.showTimeSelectOnly)return ue.default.createElement("div",{className:"react-datepicker__today-button",onClick:s.handleTodayButtonClick},s.props.todayButton)},s.renderDefaultHeader=function(e){var t=e.monthDate,r=e.i;return ue.default.createElement("div",{className:"react-datepicker__header ".concat(s.props.showTimeSelect?"react-datepicker__header--has-time-select":"")},s.renderCurrentMonth(t),ue.default.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(s.props.dropdownMode),onFocus:s.handleDropdownFocus},s.renderMonthDropdown(0!==r),s.renderMonthYearDropdown(0!==r),s.renderYearDropdown(0!==r)),ue.default.createElement("div",{className:"react-datepicker__day-names"},s.header(t)))},s.renderCustomHeader=function(e){var t,r,n=e.monthDate,a=e.i;if(s.props.showTimeSelect&&!s.state.monthContainer||s.props.showTimeSelectOnly)return null;var o=ot(s.state.date,s.props),i=st(s.state.date,s.props),l=it(s.state.date,s.props),c=lt(s.state.date,s.props),p=!s.props.showMonthYearPicker&&!s.props.showQuarterYearPicker&&!s.props.showYearPicker;return ue.default.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:s.props.onDropdownFocus},null===(r=(t=s.props).renderCustomHeader)||void 0===r?void 0:r.call(t,ge(ge({},s.state),{customHeaderCount:a,monthDate:n,changeMonth:s.changeMonth,changeYear:s.changeYear,decreaseMonth:s.decreaseMonth,increaseMonth:s.increaseMonth,decreaseYear:s.decreaseYear,increaseYear:s.increaseYear,prevMonthButtonDisabled:o,nextMonthButtonDisabled:i,prevYearButtonDisabled:l,nextYearButtonDisabled:c})),p&&ue.default.createElement("div",{className:"react-datepicker__day-names"},s.header(n)))},s.renderYearHeader=function(e){var t=e.monthDate,r=s.props,a=r.showYearPicker,o=r.yearItemNumber,i=mt(t,void 0===o?n.defaultProps.yearItemNumber:o),l=i.startPeriod,c=i.endPeriod;return ue.default.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},a?"".concat(l," - ").concat(c):x.getYear(t))},s.renderHeader=function(e){var t=e.monthDate,r=e.i,n={monthDate:t,i:void 0===r?0:r};switch(!0){case void 0!==s.props.renderCustomHeader:return s.renderCustomHeader(n);case s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker:return s.renderYearHeader(n);default:return s.renderDefaultHeader(n)}},s.renderMonths=function(){var e,t;if(!s.props.showTimeSelectOnly&&!s.props.showYearPicker){for(var r=[],a=null!==(e=s.props.monthsShown)&&void 0!==e?e:n.defaultProps.monthsShown,o=s.props.showPreviousMonths?a-1:0,l=s.props.showMonthYearPicker||s.props.showQuarterYearPicker?d.addYears(s.state.date,o):ae.subMonths(s.state.date,o),c=null!==(t=s.props.monthSelectedIn)&&void 0!==t?t:o,p=0;p0;r.push(ue.default.createElement("div",{key:h,ref:function(e){s.monthContainer=null!=e?e:void 0},className:"react-datepicker__month-container"},s.renderHeader({monthDate:f,i:p}),ue.default.createElement(xt,ge({},n.defaultProps,s.props,{ariaLabelPrefix:s.props.monthAriaLabelPrefix,day:f,onDayClick:s.handleDayClick,handleOnKeyDown:s.props.handleOnDayKeyDown,handleOnMonthKeyDown:s.props.handleOnKeyDown,onDayMouseEnter:s.handleDayMouseEnter,onMouseLeave:s.handleMonthMouseLeave,orderInDisplay:p,selectingDate:s.state.selectingDate,monthShowsDuplicateDaysEnd:m,monthShowsDuplicateDaysStart:v}))))}return r}},s.renderYears=function(){if(!s.props.showTimeSelectOnly)return s.props.showYearPicker?ue.default.createElement("div",{className:"react-datepicker__year--container"},s.renderHeader({monthDate:s.state.date}),ue.default.createElement(Ht,ge({},n.defaultProps,s.props,{selectingDate:s.state.selectingDate,date:s.state.date,onDayClick:s.handleDayClick,clearSelectingDate:s.clearSelectingDate,onYearMouseEnter:s.handleYearMouseEnter,onYearMouseLeave:s.handleYearMouseLeave}))):void 0},s.renderTimeSection=function(){if(s.props.showTimeSelect&&(s.state.monthContainer||s.props.showTimeSelectOnly))return ue.default.createElement(Ft,ge({},n.defaultProps,s.props,{onChange:s.props.onTimeChange,format:s.props.timeFormat,intervals:s.props.timeIntervals,monthRef:s.state.monthContainer}))},s.renderInputTimeSection=function(){var e=s.props.selected?new Date(s.props.selected):void 0,t=e&&Ce(e)&&Boolean(s.props.selected)?"".concat(ht(e.getHours()),":").concat(ht(e.getMinutes())):"";if(s.props.showTimeInput)return ue.default.createElement(wt,ge({},n.defaultProps,s.props,{date:e,timeString:t,onChange:s.props.onTimeChange}))},s.renderAriaLiveRegion=function(){var e,t,r=mt(s.state.date,null!==(e=s.props.yearItemNumber)&&void 0!==e?e:n.defaultProps.yearItemNumber),a=r.startPeriod,o=r.endPeriod;return t=s.props.showYearPicker?"".concat(a," - ").concat(o):s.props.showMonthYearPicker||s.props.showQuarterYearPicker?x.getYear(s.state.date):"".concat(Be(_.getMonth(s.state.date),s.props.locale)," ").concat(x.getYear(s.state.date)),ue.default.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"},s.state.isRenderAriaLiveMessage&&t)},s.renderChildren=function(){if(s.props.children)return ue.default.createElement("div",{className:"react-datepicker__children-container"},s.props.children)},s.containerRef=r.createRef(),s.state={date:s.getDateInView(),selectingDate:void 0,monthContainer:void 0,isRenderAriaLiveMessage:!1},s}return ve(n,e),Object.defineProperty(n,"defaultProps",{get:function(){return{monthsShown:1,forceShowMonthNavigation:!1,timeCaption:"Time",previousYearButtonLabel:"Previous Year",nextYearButtonLabel:"Next Year",previousMonthButtonLabel:"Previous Month",nextMonthButtonLabel:"Next Month",yearItemNumber:Se}},enumerable:!1,configurable:!0}),n.prototype.componentDidMount=function(){var e=this;this.props.showTimeSelect&&(this.assignMonthContainer=void e.setState({monthContainer:e.monthContainer}))},n.prototype.componentDidUpdate=function(e){var t=this;if(!this.props.preSelection||He(this.props.preSelection,e.preSelection)&&this.props.monthSelectedIn===e.monthSelectedIn)this.props.openToDate&&!He(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate});else{var r=!Ae(this.state.date,this.props.preSelection);this.setState({date:this.props.preSelection},(function(){return r&&t.handleCustomMonthChange(t.state.date)}))}},n.prototype.render=function(){var e=this.props.container||ke;return ue.default.createElement("div",{style:{display:"contents"},ref:this.containerRef},ue.default.createElement(e,{className:t.clsx("react-datepicker",this.props.className,{"react-datepicker--time-only":this.props.showTimeSelectOnly}),showTime:this.props.showTimeSelect||this.props.showTimeInput,showTimeSelectOnly:this.props.showTimeSelectOnly},this.renderAriaLiveRegion(),this.renderPreviousButton(),this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.renderChildren()))},n}(r.Component),jt=function(e){var t=e.icon,r=e.className,n=void 0===r?"":r,a=e.onClick,o="react-datepicker__calendar-icon";return"string"==typeof t?ue.default.createElement("i",{className:"".concat(o," ").concat(t," ").concat(n),"aria-hidden":"true",onClick:a}):ue.default.isValidElement(t)?ue.default.cloneElement(t,{className:"".concat(t.props.className||""," ").concat(o," ").concat(n),onClick:function(e){"function"==typeof t.props.onClick&&t.props.onClick(e),"function"==typeof a&&a(e)}}):ue.default.createElement("svg",{className:"".concat(o," ").concat(n),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",onClick:a},ue.default.createElement("path",{d:"M96 32V64H48C21.5 64 0 85.5 0 112v48H448V112c0-26.5-21.5-48-48-48H352V32c0-17.7-14.3-32-32-32s-32 14.3-32 32V64H160V32c0-17.7-14.3-32-32-32S96 14.3 96 32zM448 192H0V464c0 26.5 21.5 48 48 48H400c26.5 0 48-21.5 48-48V192z"}))},Ut=function(e){function t(t){var r=e.call(this,t)||this;return r.portalRoot=null,r.el=document.createElement("div"),r}return ve(t,e),t.prototype.componentDidMount=function(){this.portalRoot=(this.props.portalHost||document).getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement("div"),this.portalRoot.setAttribute("id",this.props.portalId),(this.props.portalHost||document.body).appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)},t.prototype.componentWillUnmount=function(){this.portalRoot&&this.portalRoot.removeChild(this.el)},t.prototype.render=function(){return he.default.createPortal(this.props.children,this.el)},t}(r.Component),$t=function(e){return(e instanceof HTMLAnchorElement||!e.disabled)&&-1!==e.tabIndex},zt=function(e){function t(t){var n=e.call(this,t)||this;return n.getTabChildren=function(){var e;return Array.prototype.slice.call(null===(e=n.tabLoopRef.current)||void 0===e?void 0:e.querySelectorAll("[tabindex], a, button, input, select, textarea"),1,-1).filter($t)},n.handleFocusStart=function(){var e=n.getTabChildren();e&&e.length>1&&e[e.length-1].focus()},n.handleFocusEnd=function(){var e=n.getTabChildren();e&&e.length>1&&e[0].focus()},n.tabLoopRef=r.createRef(),n}return ve(t,e),t.prototype.render=function(){var e;return(null!==(e=this.props.enableTabLoop)&&void 0!==e?e:t.defaultProps.enableTabLoop)?ue.default.createElement("div",{className:"react-datepicker__tab-loop",ref:this.tabLoopRef},ue.default.createElement("div",{className:"react-datepicker__tab-loop__start",tabIndex:0,onFocus:this.handleFocusStart}),this.props.children,ue.default.createElement("div",{className:"react-datepicker__tab-loop__end",tabIndex:0,onFocus:this.handleFocusEnd})):this.props.children},t.defaultProps={enableTabLoop:!0},t}(r.Component);var Xt,Gt=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return ve(n,e),Object.defineProperty(n,"defaultProps",{get:function(){return{hidePopper:!0}},enumerable:!1,configurable:!0}),n.prototype.render=function(){var e=this.props,a=e.className,o=e.wrapperClassName,s=e.hidePopper,i=void 0===s?n.defaultProps.hidePopper:s,l=e.popperComponent,c=e.targetComponent,p=e.enableTabLoop,d=e.popperOnKeyDown,u=e.portalId,f=e.portalHost,h=e.popperProps,m=e.showArrow,v=void 0;if(!i){var g=t.clsx("react-datepicker-popper",a);v=ue.default.createElement(zt,{enableTabLoop:p},ue.default.createElement("div",{ref:h.refs.setFloating,style:h.floatingStyles,className:g,"data-placement":h.placement,onKeyDown:d},l,m&&ue.default.createElement(ce.FloatingArrow,{ref:h.arrowRef,context:h.context,fill:"currentColor",strokeWidth:1,height:8,width:16,style:{transform:"translateY(-1px)"},className:"react-datepicker__triangle"})))}this.props.popperContainer&&(v=r.createElement(this.props.popperContainer,{},v)),u&&!i&&(v=ue.default.createElement(Ut,{portalId:u,portalHost:f},v));var D=t.clsx("react-datepicker-wrapper",o);return ue.default.createElement(ue.default.Fragment,null,ue.default.createElement("div",{ref:h.refs.setReference,className:D},c),v)},n}(r.Component),Jt=(Xt=Gt,function(e){var t,n="boolean"!=typeof e.hidePopper||e.hidePopper,a=r.useRef(null),o=ce.useFloating(ge({open:!n,whileElementsMounted:ce.autoUpdate,placement:e.popperPlacement,middleware:De([ce.flip({padding:15}),ce.offset(10),ce.arrow({element:a})],null!==(t=e.popperModifiers)&&void 0!==t?t:[],!0)},e.popperProps)),s=ge(ge({},e),{hidePopper:n,popperProps:ge(ge({},o),{arrowRef:a})});return ue.default.createElement(Xt,ge({},s))}),Zt="react-datepicker-ignore-onclickoutside",er=fe.default(Vt);var tr="Date input not valid.",rr=function(e){function n(o){var s=e.call(this,o)||this;return s.calendar=null,s.input=null,s.getPreSelection=function(){return s.props.openToDate?s.props.openToDate:s.props.selectsEnd&&s.props.startDate?s.props.startDate:s.props.selectsStart&&s.props.endDate?s.props.endDate:Me()},s.modifyHolidays=function(){var e;return null===(e=s.props.holidays)||void 0===e?void 0:e.reduce((function(e,t){var r=new Date(t.date);return Ce(r)?De(De([],e,!0),[ge(ge({},t),{date:r})],!1):e}),[])},s.calcInitialState=function(){var e,t=s.getPreSelection(),r=ct(s.props),n=pt(s.props),a=r&&O.isBefore(t,Ye(r))?r:n&&N.isAfter(t,Re(n))?n:t;return{open:s.props.startOpen||!1,preventFocus:!1,inputValue:null,preSelection:null!==(e=s.props.selectsRange?s.props.startDate:s.props.selected)&&void 0!==e?e:a,highlightDates:dt(s.props.highlightDates),focused:!1,shouldFocusDayInline:!1,isRenderAriaLiveMessage:!1,wasHidden:!1}},s.resetHiddenStatus=function(){s.setState(ge(ge({},s.state),{wasHidden:!1}))},s.setHiddenStatus=function(){s.setState(ge(ge({},s.state),{wasHidden:!0}))},s.setHiddenStateOnVisibilityHidden=function(){"hidden"===document.visibilityState&&s.setHiddenStatus()},s.clearPreventFocusTimeout=function(){s.preventFocusTimeout&&clearTimeout(s.preventFocusTimeout)},s.setFocus=function(){s.input&&s.input.focus&&s.input.focus({preventScroll:!0})},s.setBlur=function(){s.input&&s.input.blur&&s.input.blur(),s.cancelFocusInput()},s.setOpen=function(e,t){void 0===t&&(t=!1),s.setState({open:e,preSelection:e&&s.state.open?s.state.preSelection:s.calcInitialState().preSelection,lastPreSelectChange:ar},(function(){e||s.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&s.setBlur(),s.setState({inputValue:null})}))}))},s.inputOk=function(){return I.isDate(s.state.preSelection)},s.isCalendarOpen=function(){return void 0===s.props.open?s.state.open&&!s.props.disabled&&!s.props.readOnly:s.props.open},s.handleFocus=function(e){var t,r,n=s.state.wasHidden,a=!n||s.state.open;n&&s.resetHiddenStatus(),!s.state.preventFocus&&a&&(null===(r=(t=s.props).onFocus)||void 0===r||r.call(t,e),s.props.preventOpenOnFocus||s.props.readOnly||s.setOpen(!0)),s.setState({focused:!0})},s.sendFocusBackToInput=function(){s.preventFocusTimeout&&s.clearPreventFocusTimeout(),s.setState({preventFocus:!0},(function(){s.preventFocusTimeout=setTimeout((function(){s.setFocus(),s.setState({preventFocus:!1})}))}))},s.cancelFocusInput=function(){clearTimeout(s.inputFocusTimeout),s.inputFocusTimeout=void 0},s.deferFocusInput=function(){s.cancelFocusInput(),s.inputFocusTimeout=setTimeout((function(){return s.setFocus()}),1)},s.handleDropdownFocus=function(){s.cancelFocusInput()},s.handleBlur=function(e){var t,r;(!s.state.open||s.props.withPortal||s.props.showTimeInput)&&(null===(r=(t=s.props).onBlur)||void 0===r||r.call(t,e)),s.setState({focused:!1})},s.handleCalendarClickOutside=function(e){var t,r;s.props.inline||s.setOpen(!1),null===(r=(t=s.props).onClickOutside)||void 0===r||r.call(t,e),s.props.withPortal&&e.preventDefault()},s.handleChange=function(){for(var e=[],t=0;t