bme-calendar
Version:
Developed for [Book My Event](https://evently-book.vercel.app/).
1,268 lines (1,265 loc) • 42 kB
JavaScript
import Ge, { useState as $e, useEffect as Be } from "react";
var Je = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function ze(p) {
return p && p.__esModule && Object.prototype.hasOwnProperty.call(p, "default") ? p.default : p;
}
var Re = { exports: {} }, ve = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Ue;
function $t() {
if (Ue) return ve;
Ue = 1;
var p = Ge, k = Symbol.for("react.element"), x = Symbol.for("react.fragment"), j = Object.prototype.hasOwnProperty, w = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, h = { key: !0, ref: !0, __self: !0, __source: !0 };
function $(u, c, b) {
var g, m = {}, N = null, P = null;
b !== void 0 && (N = "" + b), c.key !== void 0 && (N = "" + c.key), c.ref !== void 0 && (P = c.ref);
for (g in c) j.call(c, g) && !h.hasOwnProperty(g) && (m[g] = c[g]);
if (u && u.defaultProps) for (g in c = u.defaultProps, c) m[g] === void 0 && (m[g] = c[g]);
return { $$typeof: k, type: u, key: N, ref: P, props: m, _owner: w.current };
}
return ve.Fragment = x, ve.jsx = $, ve.jsxs = $, ve;
}
var ye = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Ve;
function Dt() {
return Ve || (Ve = 1, process.env.NODE_ENV !== "production" && function() {
var p = Ge, k = Symbol.for("react.element"), x = Symbol.for("react.portal"), j = Symbol.for("react.fragment"), w = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), $ = Symbol.for("react.provider"), u = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), P = Symbol.for("react.offscreen"), M = Symbol.iterator, v = "@@iterator";
function U(e) {
if (e === null || typeof e != "object")
return null;
var t = M && e[M] || e[v];
return typeof t == "function" ? t : null;
}
var J = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function T(e) {
{
for (var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), l = 1; l < t; l++)
i[l - 1] = arguments[l];
Z("error", e, i);
}
}
function Z(e, t, i) {
{
var l = J.ReactDebugCurrentFrame, E = l.getStackAddendum();
E !== "" && (t += "%s", i = i.concat([E]));
var O = i.map(function(_) {
return String(_);
});
O.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, O);
}
}
var D = !1, q = !1, z = !1, oe = !1, ie = !1, ue;
ue = Symbol.for("react.module.reference");
function I(e) {
return !!(typeof e == "string" || typeof e == "function" || e === j || e === h || ie || e === w || e === b || e === g || oe || e === P || D || q || z || typeof e == "object" && e !== null && (e.$$typeof === N || e.$$typeof === m || e.$$typeof === $ || e.$$typeof === u || e.$$typeof === c || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
e.$$typeof === ue || e.getModuleId !== void 0));
}
function S(e, t, i) {
var l = e.displayName;
if (l)
return l;
var E = t.displayName || t.name || "";
return E !== "" ? i + "(" + E + ")" : i;
}
function ce(e) {
return e.displayName || "Context";
}
function X(e) {
if (e == null)
return null;
if (typeof e.tag == "number" && T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
return e.displayName || e.name || null;
if (typeof e == "string")
return e;
switch (e) {
case j:
return "Fragment";
case x:
return "Portal";
case h:
return "Profiler";
case w:
return "StrictMode";
case b:
return "Suspense";
case g:
return "SuspenseList";
}
if (typeof e == "object")
switch (e.$$typeof) {
case u:
var t = e;
return ce(t) + ".Consumer";
case $:
var i = e;
return ce(i._context) + ".Provider";
case c:
return S(e, e.render, "ForwardRef");
case m:
var l = e.displayName || null;
return l !== null ? l : X(e.type) || "Memo";
case N: {
var E = e, O = E._payload, _ = E._init;
try {
return X(_(O));
} catch {
return null;
}
}
}
return null;
}
var o = Object.assign, n = 0, r, s, a, f, d, R, C;
function A() {
}
A.__reactDisabledLog = !0;
function V() {
{
if (n === 0) {
r = console.log, s = console.info, a = console.warn, f = console.error, d = console.group, R = console.groupCollapsed, C = console.groupEnd;
var e = {
configurable: !0,
enumerable: !0,
value: A,
writable: !0
};
Object.defineProperties(console, {
info: e,
log: e,
warn: e,
error: e,
group: e,
groupCollapsed: e,
groupEnd: e
});
}
n++;
}
}
function G() {
{
if (n--, n === 0) {
var e = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: o({}, e, {
value: r
}),
info: o({}, e, {
value: s
}),
warn: o({}, e, {
value: a
}),
error: o({}, e, {
value: f
}),
group: o({}, e, {
value: d
}),
groupCollapsed: o({}, e, {
value: R
}),
groupEnd: o({}, e, {
value: C
})
});
}
n < 0 && T("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var te = J.ReactCurrentDispatcher, Q;
function re(e, t, i) {
{
if (Q === void 0)
try {
throw Error();
} catch (E) {
var l = E.stack.trim().match(/\n( *(at )?)/);
Q = l && l[1] || "";
}
return `
` + Q + e;
}
}
var ee = !1, L;
{
var ne = typeof WeakMap == "function" ? WeakMap : Map;
L = new ne();
}
function se(e, t) {
if (!e || ee)
return "";
{
var i = L.get(e);
if (i !== void 0)
return i;
}
var l;
ee = !0;
var E = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var O;
O = te.current, te.current = null, V();
try {
if (t) {
var _ = function() {
throw Error();
};
if (Object.defineProperty(_.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(_, []);
} catch (B) {
l = B;
}
Reflect.construct(e, [], _);
} else {
try {
_.call();
} catch (B) {
l = B;
}
e.call(_.prototype);
}
} else {
try {
throw Error();
} catch (B) {
l = B;
}
e();
}
} catch (B) {
if (B && l && typeof B.stack == "string") {
for (var y = B.stack.split(`
`), H = l.stack.split(`
`), W = y.length - 1, Y = H.length - 1; W >= 1 && Y >= 0 && y[W] !== H[Y]; )
Y--;
for (; W >= 1 && Y >= 0; W--, Y--)
if (y[W] !== H[Y]) {
if (W !== 1 || Y !== 1)
do
if (W--, Y--, Y < 0 || y[W] !== H[Y]) {
var K = `
` + y[W].replace(" at new ", " at ");
return e.displayName && K.includes("<anonymous>") && (K = K.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, K), K;
}
while (W >= 1 && Y >= 0);
break;
}
}
} finally {
ee = !1, te.current = O, G(), Error.prepareStackTrace = E;
}
var he = e ? e.displayName || e.name : "", le = he ? re(he) : "";
return typeof e == "function" && L.set(e, le), le;
}
function fe(e, t, i) {
return se(e, !1);
}
function Xe(e) {
var t = e.prototype;
return !!(t && t.isReactComponent);
}
function me(e, t, i) {
if (e == null)
return "";
if (typeof e == "function")
return se(e, Xe(e));
if (typeof e == "string")
return re(e);
switch (e) {
case b:
return re("Suspense");
case g:
return re("SuspenseList");
}
if (typeof e == "object")
switch (e.$$typeof) {
case c:
return fe(e.render);
case m:
return me(e.type, t, i);
case N: {
var l = e, E = l._payload, O = l._init;
try {
return me(O(E), t, i);
} catch {
}
}
}
return "";
}
var pe = Object.prototype.hasOwnProperty, Me = {}, Oe = J.ReactDebugCurrentFrame;
function _e(e) {
if (e) {
var t = e._owner, i = me(e.type, e._source, t ? t.type : null);
Oe.setExtraStackFrame(i);
} else
Oe.setExtraStackFrame(null);
}
function Qe(e, t, i, l, E) {
{
var O = Function.call.bind(pe);
for (var _ in e)
if (O(e, _)) {
var y = void 0;
try {
if (typeof e[_] != "function") {
var H = Error((l || "React class") + ": " + i + " type `" + _ + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[_] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw H.name = "Invariant Violation", H;
}
y = e[_](t, _, l, i, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (W) {
y = W;
}
y && !(y instanceof Error) && (_e(E), T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", l || "React class", i, _, typeof y), _e(null)), y instanceof Error && !(y.message in Me) && (Me[y.message] = !0, _e(E), T("Failed %s type: %s", i, y.message), _e(null));
}
}
}
var et = Array.isArray;
function De(e) {
return et(e);
}
function tt(e) {
{
var t = typeof Symbol == "function" && Symbol.toStringTag, i = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
return i;
}
}
function rt(e) {
try {
return je(e), !1;
} catch {
return !0;
}
}
function je(e) {
return "" + e;
}
function Te(e) {
if (rt(e))
return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", tt(e)), je(e);
}
var Ce = J.ReactCurrentOwner, nt = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, ke, Pe;
function at(e) {
if (pe.call(e, "ref")) {
var t = Object.getOwnPropertyDescriptor(e, "ref").get;
if (t && t.isReactWarning)
return !1;
}
return e.ref !== void 0;
}
function it(e) {
if (pe.call(e, "key")) {
var t = Object.getOwnPropertyDescriptor(e, "key").get;
if (t && t.isReactWarning)
return !1;
}
return e.key !== void 0;
}
function st(e, t) {
typeof e.ref == "string" && Ce.current;
}
function ot(e, t) {
{
var i = function() {
ke || (ke = !0, T("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
};
i.isReactWarning = !0, Object.defineProperty(e, "key", {
get: i,
configurable: !0
});
}
}
function ut(e, t) {
{
var i = function() {
Pe || (Pe = !0, T("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
};
i.isReactWarning = !0, Object.defineProperty(e, "ref", {
get: i,
configurable: !0
});
}
}
var ct = function(e, t, i, l, E, O, _) {
var y = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: k,
// Built-in properties that belong on the element
type: e,
key: t,
ref: i,
props: _,
// Record the component responsible for creating this element.
_owner: O
};
return y._store = {}, Object.defineProperty(y._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(y, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: l
}), Object.defineProperty(y, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: E
}), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
};
function lt(e, t, i, l, E) {
{
var O, _ = {}, y = null, H = null;
i !== void 0 && (Te(i), y = "" + i), it(t) && (Te(t.key), y = "" + t.key), at(t) && (H = t.ref, st(t, E));
for (O in t)
pe.call(t, O) && !nt.hasOwnProperty(O) && (_[O] = t[O]);
if (e && e.defaultProps) {
var W = e.defaultProps;
for (O in W)
_[O] === void 0 && (_[O] = W[O]);
}
if (y || H) {
var Y = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
y && ot(_, Y), H && ut(_, Y);
}
return ct(e, y, H, E, l, Ce.current, _);
}
}
var we = J.ReactCurrentOwner, Ae = J.ReactDebugCurrentFrame;
function de(e) {
if (e) {
var t = e._owner, i = me(e.type, e._source, t ? t.type : null);
Ae.setExtraStackFrame(i);
} else
Ae.setExtraStackFrame(null);
}
var Se;
Se = !1;
function Ee(e) {
return typeof e == "object" && e !== null && e.$$typeof === k;
}
function We() {
{
if (we.current) {
var e = X(we.current.type);
if (e)
return `
Check the render method of \`` + e + "`.";
}
return "";
}
}
function ft(e) {
return "";
}
var Fe = {};
function dt(e) {
{
var t = We();
if (!t) {
var i = typeof e == "string" ? e : e.displayName || e.name;
i && (t = `
Check the top-level render call using <` + i + ">.");
}
return t;
}
}
function Ie(e, t) {
{
if (!e._store || e._store.validated || e.key != null)
return;
e._store.validated = !0;
var i = dt(t);
if (Fe[i])
return;
Fe[i] = !0;
var l = "";
e && e._owner && e._owner !== we.current && (l = " It was passed a child from " + X(e._owner.type) + "."), de(e), T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', i, l), de(null);
}
}
function Ye(e, t) {
{
if (typeof e != "object")
return;
if (De(e))
for (var i = 0; i < e.length; i++) {
var l = e[i];
Ee(l) && Ie(l, t);
}
else if (Ee(e))
e._store && (e._store.validated = !0);
else if (e) {
var E = U(e);
if (typeof E == "function" && E !== e.entries)
for (var O = E.call(e), _; !(_ = O.next()).done; )
Ee(_.value) && Ie(_.value, t);
}
}
}
function ht(e) {
{
var t = e.type;
if (t == null || typeof t == "string")
return;
var i;
if (typeof t == "function")
i = t.propTypes;
else if (typeof t == "object" && (t.$$typeof === c || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
t.$$typeof === m))
i = t.propTypes;
else
return;
if (i) {
var l = X(t);
Qe(i, e.props, "prop", l, e);
} else if (t.PropTypes !== void 0 && !Se) {
Se = !0;
var E = X(t);
T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", E || "Unknown");
}
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function pt(e) {
{
for (var t = Object.keys(e.props), i = 0; i < t.length; i++) {
var l = t[i];
if (l !== "children" && l !== "key") {
de(e), T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", l), de(null);
break;
}
}
e.ref !== null && (de(e), T("Invalid attribute `ref` supplied to `React.Fragment`."), de(null));
}
}
var Ne = {};
function Le(e, t, i, l, E, O) {
{
var _ = I(e);
if (!_) {
var y = "";
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (y += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var H = ft();
H ? y += H : y += We();
var W;
e === null ? W = "null" : De(e) ? W = "array" : e !== void 0 && e.$$typeof === k ? (W = "<" + (X(e.type) || "Unknown") + " />", y = " Did you accidentally export a JSX literal instead of a component?") : W = typeof e, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", W, y);
}
var Y = lt(e, t, i, E, O);
if (Y == null)
return Y;
if (_) {
var K = t.children;
if (K !== void 0)
if (l)
if (De(K)) {
for (var he = 0; he < K.length; he++)
Ye(K[he], e);
Object.freeze && Object.freeze(K);
} else
T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
else
Ye(K, e);
}
if (pe.call(t, "key")) {
var le = X(e), B = Object.keys(t).filter(function(bt) {
return bt !== "key";
}), xe = B.length > 0 ? "{key: someKey, " + B.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!Ne[le + xe]) {
var _t = B.length > 0 ? "{" + B.join(": ..., ") + ": ...}" : "{}";
T(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`, xe, le, _t, le), Ne[le + xe] = !0;
}
}
return e === j ? pt(Y) : ht(Y), Y;
}
}
function vt(e, t, i) {
return Le(e, t, i, !0);
}
function yt(e, t, i) {
return Le(e, t, i, !1);
}
var gt = yt, mt = vt;
ye.Fragment = j, ye.jsx = gt, ye.jsxs = mt;
}()), ye;
}
process.env.NODE_ENV === "production" ? Re.exports = $t() : Re.exports = Dt();
var F = Re.exports;
const wt = "_calendar_1274d_1", St = {
calendar: wt
};
function Et() {
const [p, k] = $e(), [x, j] = $e(/* @__PURE__ */ new Date()), w = x.getFullYear(), h = (x.getMonth() + 1).toString().padStart(2, "0"), $ = new Intl.DateTimeFormat("uk-UK", {
month: "long"
}).format(x), u = new Date(
w,
+h,
0
).getDate(), c = (/* @__PURE__ */ new Date(
`${w}-${h}-01`
)).getDay(), g = (new Date(w, Number(h) - 2).getMonth() + 1).toString().padStart(2, "0"), m = new Date(w, +g, 0).getDate(), N = (x.getMonth() + 2).toString().padStart(2, "0"), P = () => {
const v = /* @__PURE__ */ new Date(`${w}-${h}-01`), U = new Date(
v.setDate(v.getDate() + u)
);
j(U);
}, M = () => {
const v = /* @__PURE__ */ new Date(`${w}-${h}-01`), U = new Date(
v.setDate(v.getDate() - m)
);
j(U);
};
return Be(() => {
const v = [];
if (c !== 0)
for (let D = m; D > m - c + 1; D--)
v.push({
id: `${w}-${g}-${D.toString().padStart(2, "0")}`,
day: D,
type: "prev"
});
else
for (let D = m; D > m - 6; D--)
v.push({
id: `${w}-${g}-${D.toString().padStart(2, "0")}`,
day: D,
type: "prev"
});
const U = [];
for (let D = 1; D <= u; D++)
U.push({
id: `${w}-${h}-${D.toString().padStart(2, "0")}`,
day: D,
type: "current"
});
const J = [
...v.reverse(),
...U
], T = [];
for (let D = 0; D <= J.length; D += 7)
T.push(J.slice(D, D + 7));
const Z = T.length * 7 - T.flat().length;
if (Z !== 7)
for (let D = 1; D <= Z; D++)
T[T.length - 1].push({
id: `${w}-${N}-${D.toString().padStart(2, "0")}`,
day: D,
type: "next"
});
k(T);
}, [
u,
c,
h,
N,
m,
g,
w
]), {
finalDaysArray: p,
currentMonthName: $,
incrementMonth: P,
decrementMonth: M
};
}
const xt = "_navigation_1spdz_1", Rt = "_button_1spdz_13", Mt = "_month_1spdz_37", be = {
navigation: xt,
button: Rt,
month: Mt
};
function qe({ rotated: p = !1 }) {
return /* @__PURE__ */ F.jsx(
"svg",
{
width: "32",
height: "32",
viewBox: "0 0 32 32",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
style: {
transform: p ? "rotate(180deg)" : ""
},
children: /* @__PURE__ */ F.jsx(
"path",
{
d: "M12.3906 10.276L18.1146 16L12.3906 21.724L14.276 23.6094L21.8853 16L14.276 8.39071L12.3906 10.276Z",
fill: "#062341"
}
)
}
);
}
function Ot({
currentMonthName: p,
incrementMonth: k,
decrementMonth: x
}) {
return /* @__PURE__ */ F.jsxs("div", { className: be.navigation, children: [
/* @__PURE__ */ F.jsx(
"button",
{
type: "button",
className: be.button,
onClick: x,
"aria-label": "previous month",
children: /* @__PURE__ */ F.jsx(qe, { rotated: !0 })
}
),
/* @__PURE__ */ F.jsx("p", { className: be.month, children: p }),
/* @__PURE__ */ F.jsx(
"button",
{
type: "button",
className: be.button,
onClick: k,
"aria-label": "next month",
children: /* @__PURE__ */ F.jsx(qe, {})
}
)
] });
}
const jt = "_headWrapper_2fn57_1", Tt = "_text_2fn57_11", He = {
headWrapper: jt,
text: Tt
}, Ct = ["пн", "вт", "ср", "чт", "пт", "сб", "нд"];
function kt({ daySizes: p }) {
return /* @__PURE__ */ F.jsx("div", { className: He.headWrapper, style: { height: p.height }, children: Ct.map((k, x) => /* @__PURE__ */ F.jsx("p", { className: He.text, style: { width: p.width }, children: k }, x)) });
}
const Pt = "_monthWrapper_1u62r_1", At = {
monthWrapper: Pt
}, Wt = "_weekWrapper_i076z_1", Ft = {
weekWrapper: Wt
}, It = "_wrapper_kseqj_1", Yt = "_isGapWrapper_kseqj_9", Nt = "_wrapperIsInRange_kseqj_17", Lt = "_firstDay_kseqj_25", Ut = "_lastDay_kseqj_35", Vt = "_container_kseqj_45", qt = "_dayToday_kseqj_77", Ht = "_selectedDay_kseqj_85", Gt = "_notInCurrentMonth_kseqj_97", ae = {
wrapper: It,
isGapWrapper: Yt,
wrapperIsInRange: Nt,
firstDay: Lt,
lastDay: Ut,
container: Vt,
dayToday: qt,
selectedDay: Ht,
notInCurrentMonth: Gt
};
function Bt({
dayItem: p,
setUpSelectedDay: k,
selectedDay: x,
secondDay: j,
slicedArray: w,
range: h,
daySizes: $,
formattedDateToday: u
}) {
const { id: c, type: b } = p, g = p.type === "gap", m = () => {
g || k(p);
}, N = w.some((v) => v.id === c), P = h == null ? void 0 : h.some((v, U) => v === c && U === 0), M = h == null ? void 0 : h.some(
(v, U) => v === c && U === h.length - 1
);
return /* @__PURE__ */ F.jsx(
"div",
{
className: `${ae.wrapper}
${N ? ae.wrapperIsInRange : ""}
${g ? ae.isGapWrapper : ""}
${P ? ae.firstDay : ""}
${M ? ae.lastDay : ""}
`,
children: !g && /* @__PURE__ */ F.jsx(
"button",
{
type: "button",
"aria-label": "calendar day",
style: {
width: $.width,
height: $.height
},
onClick: m,
className: `${ae.container}
${u === c ? ae.dayToday : ""}
${x === c || j === c ? ae.selectedDay : ""}`,
children: /* @__PURE__ */ F.jsx("p", { className: b !== "current" ? ae.notInCurrentMonth : "", children: p.day })
}
)
}
);
}
function Jt({
week: p,
index: k,
setUpSelectedDay: x,
selectedDay: j,
secondDay: w,
range: h,
daySizes: $,
formattedDateToday: u
}) {
const c = [
{ id: "1", type: "gap" },
{ id: "3", type: "gap" },
{ id: "5", type: "gap" },
{ id: "7", type: "gap" },
{ id: "9", type: "gap" },
{ id: "11", type: "gap" }
], b = p.flatMap(
(M, v) => v < c.length ? [M, c[v]] : [M]
), g = b.filter(
(M) => h == null ? void 0 : h.some((v) => v === M.id)
), m = b.findIndex(
(M) => {
var v;
return M.id === ((v = g[0]) == null ? void 0 : v.id);
}
), N = b.findIndex(
(M) => {
var v;
return M.id === ((v = g[g.length - 1]) == null ? void 0 : v.id);
}
), P = b.slice(m, N + 1);
return /* @__PURE__ */ F.jsx("div", { className: Ft.weekWrapper, children: b.map((M, v) => /* @__PURE__ */ F.jsx(
Bt,
{
dayItem: M,
setUpSelectedDay: x,
selectedDay: j,
secondDay: w,
slicedArray: P,
range: h,
daySizes: $,
formattedDateToday: u
},
v
)) }, k);
}
function zt({
finalDaysArray: p,
selectedDay: k,
secondDay: x,
setUpSelectedDay: j,
range: w,
daySizes: h
}) {
const $ = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
return /* @__PURE__ */ F.jsx("div", { className: At.monthWrapper, children: p && p.map((u, c) => /* @__PURE__ */ F.jsx(
Jt,
{
week: u,
index: c,
setUpSelectedDay: j,
selectedDay: k,
secondDay: x,
range: w,
daySizes: h,
formattedDateToday: $
},
c
)) });
}
function Kt(p) {
return p === "mobile" ? {
width: 40,
height: 32
} : {
width: 24,
height: 24
};
}
var Ke = { exports: {} };
(function(p, k) {
(function(x, j) {
p.exports = j();
})(Je, function() {
var x = 1e3, j = 6e4, w = 36e5, h = "millisecond", $ = "second", u = "minute", c = "hour", b = "day", g = "week", m = "month", N = "quarter", P = "year", M = "date", v = "Invalid Date", U = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, J = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, T = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(o) {
var n = ["th", "st", "nd", "rd"], r = o % 100;
return "[" + o + (n[(r - 20) % 10] || n[r] || n[0]) + "]";
} }, Z = function(o, n, r) {
var s = String(o);
return !s || s.length >= n ? o : "" + Array(n + 1 - s.length).join(r) + o;
}, D = { s: Z, z: function(o) {
var n = -o.utcOffset(), r = Math.abs(n), s = Math.floor(r / 60), a = r % 60;
return (n <= 0 ? "+" : "-") + Z(s, 2, "0") + ":" + Z(a, 2, "0");
}, m: function o(n, r) {
if (n.date() < r.date()) return -o(r, n);
var s = 12 * (r.year() - n.year()) + (r.month() - n.month()), a = n.clone().add(s, m), f = r - a < 0, d = n.clone().add(s + (f ? -1 : 1), m);
return +(-(s + (r - a) / (f ? a - d : d - a)) || 0);
}, a: function(o) {
return o < 0 ? Math.ceil(o) || 0 : Math.floor(o);
}, p: function(o) {
return { M: m, y: P, w: g, d: b, D: M, h: c, m: u, s: $, ms: h, Q: N }[o] || String(o || "").toLowerCase().replace(/s$/, "");
}, u: function(o) {
return o === void 0;
} }, q = "en", z = {};
z[q] = T;
var oe = "$isDayjsObject", ie = function(o) {
return o instanceof ce || !(!o || !o[oe]);
}, ue = function o(n, r, s) {
var a;
if (!n) return q;
if (typeof n == "string") {
var f = n.toLowerCase();
z[f] && (a = f), r && (z[f] = r, a = f);
var d = n.split("-");
if (!a && d.length > 1) return o(d[0]);
} else {
var R = n.name;
z[R] = n, a = R;
}
return !s && a && (q = a), a || !s && q;
}, I = function(o, n) {
if (ie(o)) return o.clone();
var r = typeof n == "object" ? n : {};
return r.date = o, r.args = arguments, new ce(r);
}, S = D;
S.l = ue, S.i = ie, S.w = function(o, n) {
return I(o, { locale: n.$L, utc: n.$u, x: n.$x, $offset: n.$offset });
};
var ce = function() {
function o(r) {
this.$L = ue(r.locale, null, !0), this.parse(r), this.$x = this.$x || r.x || {}, this[oe] = !0;
}
var n = o.prototype;
return n.parse = function(r) {
this.$d = function(s) {
var a = s.date, f = s.utc;
if (a === null) return /* @__PURE__ */ new Date(NaN);
if (S.u(a)) return /* @__PURE__ */ new Date();
if (a instanceof Date) return new Date(a);
if (typeof a == "string" && !/Z$/i.test(a)) {
var d = a.match(U);
if (d) {
var R = d[2] - 1 || 0, C = (d[7] || "0").substring(0, 3);
return f ? new Date(Date.UTC(d[1], R, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, C)) : new Date(d[1], R, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, C);
}
}
return new Date(a);
}(r), this.init();
}, n.init = function() {
var r = this.$d;
this.$y = r.getFullYear(), this.$M = r.getMonth(), this.$D = r.getDate(), this.$W = r.getDay(), this.$H = r.getHours(), this.$m = r.getMinutes(), this.$s = r.getSeconds(), this.$ms = r.getMilliseconds();
}, n.$utils = function() {
return S;
}, n.isValid = function() {
return this.$d.toString() !== v;
}, n.isSame = function(r, s) {
var a = I(r);
return this.startOf(s) <= a && a <= this.endOf(s);
}, n.isAfter = function(r, s) {
return I(r) < this.startOf(s);
}, n.isBefore = function(r, s) {
return this.endOf(s) < I(r);
}, n.$g = function(r, s, a) {
return S.u(r) ? this[s] : this.set(a, r);
}, n.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, n.valueOf = function() {
return this.$d.getTime();
}, n.startOf = function(r, s) {
var a = this, f = !!S.u(s) || s, d = S.p(r), R = function(ee, L) {
var ne = S.w(a.$u ? Date.UTC(a.$y, L, ee) : new Date(a.$y, L, ee), a);
return f ? ne : ne.endOf(b);
}, C = function(ee, L) {
return S.w(a.toDate()[ee].apply(a.toDate("s"), (f ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(L)), a);
}, A = this.$W, V = this.$M, G = this.$D, te = "set" + (this.$u ? "UTC" : "");
switch (d) {
case P:
return f ? R(1, 0) : R(31, 11);
case m:
return f ? R(1, V) : R(0, V + 1);
case g:
var Q = this.$locale().weekStart || 0, re = (A < Q ? A + 7 : A) - Q;
return R(f ? G - re : G + (6 - re), V);
case b:
case M:
return C(te + "Hours", 0);
case c:
return C(te + "Minutes", 1);
case u:
return C(te + "Seconds", 2);
case $:
return C(te + "Milliseconds", 3);
default:
return this.clone();
}
}, n.endOf = function(r) {
return this.startOf(r, !1);
}, n.$set = function(r, s) {
var a, f = S.p(r), d = "set" + (this.$u ? "UTC" : ""), R = (a = {}, a[b] = d + "Date", a[M] = d + "Date", a[m] = d + "Month", a[P] = d + "FullYear", a[c] = d + "Hours", a[u] = d + "Minutes", a[$] = d + "Seconds", a[h] = d + "Milliseconds", a)[f], C = f === b ? this.$D + (s - this.$W) : s;
if (f === m || f === P) {
var A = this.clone().set(M, 1);
A.$d[R](C), A.init(), this.$d = A.set(M, Math.min(this.$D, A.daysInMonth())).$d;
} else R && this.$d[R](C);
return this.init(), this;
}, n.set = function(r, s) {
return this.clone().$set(r, s);
}, n.get = function(r) {
return this[S.p(r)]();
}, n.add = function(r, s) {
var a, f = this;
r = Number(r);
var d = S.p(s), R = function(V) {
var G = I(f);
return S.w(G.date(G.date() + Math.round(V * r)), f);
};
if (d === m) return this.set(m, this.$M + r);
if (d === P) return this.set(P, this.$y + r);
if (d === b) return R(1);
if (d === g) return R(7);
var C = (a = {}, a[u] = j, a[c] = w, a[$] = x, a)[d] || 1, A = this.$d.getTime() + r * C;
return S.w(A, this);
}, n.subtract = function(r, s) {
return this.add(-1 * r, s);
}, n.format = function(r) {
var s = this, a = this.$locale();
if (!this.isValid()) return a.invalidDate || v;
var f = r || "YYYY-MM-DDTHH:mm:ssZ", d = S.z(this), R = this.$H, C = this.$m, A = this.$M, V = a.weekdays, G = a.months, te = a.meridiem, Q = function(L, ne, se, fe) {
return L && (L[ne] || L(s, f)) || se[ne].slice(0, fe);
}, re = function(L) {
return S.s(R % 12 || 12, L, "0");
}, ee = te || function(L, ne, se) {
var fe = L < 12 ? "AM" : "PM";
return se ? fe.toLowerCase() : fe;
};
return f.replace(J, function(L, ne) {
return ne || function(se) {
switch (se) {
case "YY":
return String(s.$y).slice(-2);
case "YYYY":
return S.s(s.$y, 4, "0");
case "M":
return A + 1;
case "MM":
return S.s(A + 1, 2, "0");
case "MMM":
return Q(a.monthsShort, A, G, 3);
case "MMMM":
return Q(G, A);
case "D":
return s.$D;
case "DD":
return S.s(s.$D, 2, "0");
case "d":
return String(s.$W);
case "dd":
return Q(a.weekdaysMin, s.$W, V, 2);
case "ddd":
return Q(a.weekdaysShort, s.$W, V, 3);
case "dddd":
return V[s.$W];
case "H":
return String(R);
case "HH":
return S.s(R, 2, "0");
case "h":
return re(1);
case "hh":
return re(2);
case "a":
return ee(R, C, !0);
case "A":
return ee(R, C, !1);
case "m":
return String(C);
case "mm":
return S.s(C, 2, "0");
case "s":
return String(s.$s);
case "ss":
return S.s(s.$s, 2, "0");
case "SSS":
return S.s(s.$ms, 3, "0");
case "Z":
return d;
}
return null;
}(L) || d.replace(":", "");
});
}, n.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, n.diff = function(r, s, a) {
var f, d = this, R = S.p(s), C = I(r), A = (C.utcOffset() - this.utcOffset()) * j, V = this - C, G = function() {
return S.m(d, C);
};
switch (R) {
case P:
f = G() / 12;
break;
case m:
f = G();
break;
case N:
f = G() / 3;
break;
case g:
f = (V - A) / 6048e5;
break;
case b:
f = (V - A) / 864e5;
break;
case c:
f = V / w;
break;
case u:
f = V / j;
break;
case $:
f = V / x;
break;
default:
f = V;
}
return a ? f : S.a(f);
}, n.daysInMonth = function() {
return this.endOf(m).$D;
}, n.$locale = function() {
return z[this.$L];
}, n.locale = function(r, s) {
if (!r) return this.$L;
var a = this.clone(), f = ue(r, s, !0);
return f && (a.$L = f), a;
}, n.clone = function() {
return S.w(this.$d, this);
}, n.toDate = function() {
return new Date(this.valueOf());
}, n.toJSON = function() {
return this.isValid() ? this.toISOString() : null;
}, n.toISOString = function() {
return this.$d.toISOString();
}, n.toString = function() {
return this.$d.toUTCString();
}, o;
}(), X = ce.prototype;
return I.prototype = X, [["$ms", h], ["$s", $], ["$m", u], ["$H", c], ["$W", b], ["$M", m], ["$y", P], ["$D", M]].forEach(function(o) {
X[o[1]] = function(n) {
return this.$g(n, o[0], o[1]);
};
}), I.extend = function(o, n) {
return o.$i || (o(n, ce, I), o.$i = !0), I;
}, I.locale = ue, I.isDayjs = ie, I.unix = function(o) {
return I(1e3 * o);
}, I.en = z[q], I.Ls = z, I.p = {}, I;
});
})(Ke);
var Zt = Ke.exports;
const ge = /* @__PURE__ */ ze(Zt);
var Ze = { exports: {} };
(function(p, k) {
(function(x, j) {
p.exports = j();
})(Je, function() {
return function(x, j, w) {
var h = function($, u) {
if (!u || !u.length || u.length === 1 && !u[0] || u.length === 1 && Array.isArray(u[0]) && !u[0].length) return null;
var c;
u.length === 1 && u[0].length > 0 && (u = u[0]), c = (u = u.filter(function(g) {
return g;
}))[0];
for (var b = 1; b < u.length; b += 1) u[b].isValid() && !u[b][$](c) || (c = u[b]);
return c;
};
w.max = function() {
var $ = [].slice.call(arguments, 0);
return h("isAfter", $);
}, w.min = function() {
var $ = [].slice.call(arguments, 0);
return h("isBefore", $);
};
};
});
})(Ze);
var Xt = Ze.exports;
const Qt = /* @__PURE__ */ ze(Xt);
ge.extend(Qt);
function tr({
type: p = "calendar",
setDay: k,
setRange: x,
range: j,
daySize: w = "desktop"
}) {
const [h, $] = $e(), [u, c] = $e(), { finalDaysArray: b, currentMonthName: g, incrementMonth: m, decrementMonth: N } = Et(), P = (q) => {
if (p === "calendar" && k) {
$(q.id), k(q.id);
return;
}
p === "range" && (h || $(q.id), h && c(q.id), h && u && ($(q.id), c(void 0)));
}, M = ge(h), v = ge(u), U = ge.min(M, v), J = ge.max(M, v), T = U.format("YYYY-MM-DD"), Z = J.diff(U, "day"), D = Kt(w);
return Be(() => {
if (p === "range" && x) {
if (h && u) {
let q = U;
const z = [T];
for (let oe = 0; oe < Z; oe++) {
const ie = q.add(1, "day");
z.push(ie.format("YYYY-MM-DD")), q = ie;
}
x(z);
}
u || x(void 0);
}
}, [u, h, x, p, Z]), /* @__PURE__ */ F.jsxs("div", { className: St.calendar, children: [
/* @__PURE__ */ F.jsx(
Ot,
{
currentMonthName: g,
incrementMonth: m,
decrementMonth: N
}
),
/* @__PURE__ */ F.jsx(kt, { daySizes: D }),
/* @__PURE__ */ F.jsx(
zt,
{
finalDaysArray: b,
selectedDay: h,
secondDay: u,
setUpSelectedDay: P,
range: j,
daySizes: D
}
)
] });
}
export {
tr as Calendar
};