my-awesome-react-digital-clock
Version:
A digital clock for React apps
1,257 lines (1,254 loc) • 45.1 kB
JavaScript
import nr, { useState as or, useRef as ar, useMemo as ir, useEffect as sr } from "react";
function ur(r) {
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
}
var xe = { exports: {} }, Ee = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Ie;
function cr() {
if (Ie) return Ee;
Ie = 1;
var r = Symbol.for("react.transitional.element"), y = Symbol.for("react.fragment");
function v(c, l, u) {
var p = null;
if (u !== void 0 && (p = "" + u), l.key !== void 0 && (p = "" + l.key), "key" in l) {
u = {};
for (var d in l)
d !== "key" && (u[d] = l[d]);
} else u = l;
return l = u.ref, {
$$typeof: r,
type: c,
key: p,
ref: l !== void 0 ? l : null,
props: u
};
}
return Ee.Fragment = y, Ee.jsx = v, Ee.jsxs = v, Ee;
}
var ge = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Ye;
function fr() {
return Ye || (Ye = 1, process.env.NODE_ENV !== "production" && function() {
function r(e) {
if (e == null) return null;
if (typeof e == "function")
return e.$$typeof === pe ? null : e.displayName || e.name || null;
if (typeof e == "string") return e;
switch (e) {
case J:
return "Fragment";
case a:
return "Portal";
case le:
return "Profiler";
case fe:
return "StrictMode";
case oe:
return "Suspense";
case ae:
return "SuspenseList";
}
if (typeof e == "object")
switch (typeof e.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), e.$$typeof) {
case ve:
return (e.displayName || "Context") + ".Provider";
case de:
return (e._context.displayName || "Context") + ".Consumer";
case ee:
var i = e.render;
return e = e.displayName, e || (e = i.displayName || i.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
case X:
return i = e.displayName || null, i !== null ? i : r(e.type) || "Memo";
case ie:
i = e._payload, e = e._init;
try {
return r(e(i));
} catch {
}
}
return null;
}
function y(e) {
return "" + e;
}
function v(e) {
try {
y(e);
var i = !1;
} catch {
i = !0;
}
if (i) {
i = console;
var s = i.error, w = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
return s.call(
i,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
w
), y(e);
}
}
function c() {
}
function l() {
if (f === 0) {
T = console.log, b = console.info, g = console.warn, x = console.error, O = console.group, S = console.groupCollapsed, D = console.groupEnd;
var e = {
configurable: !0,
enumerable: !0,
value: c,
writable: !0
};
Object.defineProperties(console, {
info: e,
log: e,
warn: e,
error: e,
group: e,
groupCollapsed: e,
groupEnd: e
});
}
f++;
}
function u() {
if (f--, f === 0) {
var e = { configurable: !0, enumerable: !0, writable: !0 };
Object.defineProperties(console, {
log: o({}, e, { value: T }),
info: o({}, e, { value: b }),
warn: o({}, e, { value: g }),
error: o({}, e, { value: x }),
group: o({}, e, { value: O }),
groupCollapsed: o({}, e, { value: S }),
groupEnd: o({}, e, { value: D })
});
}
0 > f && console.error(
"disabledDepth fell below zero. This is a bug in React. Please file an issue."
);
}
function p(e) {
if (n === void 0)
try {
throw Error();
} catch (s) {
var i = s.stack.trim().match(/\n( *(at )?)/);
n = i && i[1] || "", B = -1 < s.stack.indexOf(`
at`) ? " (<anonymous>)" : -1 < s.stack.indexOf("@") ? "@unknown:0:0" : "";
}
return `
` + n + e + B;
}
function d(e, i) {
if (!e || re) return "";
var s = ye.get(e);
if (s !== void 0) return s;
re = !0, s = Error.prepareStackTrace, Error.prepareStackTrace = void 0;
var w = null;
w = G.H, G.H = null, l();
try {
var z = {
DetermineComponentFrameRoot: function() {
try {
if (i) {
var te = function() {
throw Error();
};
if (Object.defineProperty(te.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(te, []);
} catch (Z) {
var Te = Z;
}
Reflect.construct(e, [], te);
} else {
try {
te.call();
} catch (Z) {
Te = Z;
}
e.call(te.prototype);
}
} else {
try {
throw Error();
} catch (Z) {
Te = Z;
}
(te = e()) && typeof te.catch == "function" && te.catch(function() {
});
}
} catch (Z) {
if (Z && Te && typeof Z.stack == "string")
return [Z.stack, Te.stack];
}
return [null, null];
}
};
z.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
var N = Object.getOwnPropertyDescriptor(
z.DetermineComponentFrameRoot,
"name"
);
N && N.configurable && Object.defineProperty(
z.DetermineComponentFrameRoot,
"name",
{ value: "DetermineComponentFrameRoot" }
);
var E = z.DetermineComponentFrameRoot(), Q = E[0], me = E[1];
if (Q && me) {
var L = Q.split(`
`), se = me.split(`
`);
for (E = N = 0; N < L.length && !L[N].includes(
"DetermineComponentFrameRoot"
); )
N++;
for (; E < se.length && !se[E].includes(
"DetermineComponentFrameRoot"
); )
E++;
if (N === L.length || E === se.length)
for (N = L.length - 1, E = se.length - 1; 1 <= N && 0 <= E && L[N] !== se[E]; )
E--;
for (; 1 <= N && 0 <= E; N--, E--)
if (L[N] !== se[E]) {
if (N !== 1 || E !== 1)
do
if (N--, E--, 0 > E || L[N] !== se[E]) {
var be = `
` + L[N].replace(
" at new ",
" at "
);
return e.displayName && be.includes("<anonymous>") && (be = be.replace("<anonymous>", e.displayName)), typeof e == "function" && ye.set(e, be), be;
}
while (1 <= N && 0 <= E);
break;
}
}
} finally {
re = !1, G.H = w, u(), Error.prepareStackTrace = s;
}
return L = (L = e ? e.displayName || e.name : "") ? p(L) : "", typeof e == "function" && ye.set(e, L), L;
}
function k(e) {
if (e == null) return "";
if (typeof e == "function") {
var i = e.prototype;
return d(
e,
!(!i || !i.isReactComponent)
);
}
if (typeof e == "string") return p(e);
switch (e) {
case oe:
return p("Suspense");
case ae:
return p("SuspenseList");
}
if (typeof e == "object")
switch (e.$$typeof) {
case ee:
return e = d(e.render, !1), e;
case X:
return k(e.type);
case ie:
i = e._payload, e = e._init;
try {
return k(e(i));
} catch {
}
}
return "";
}
function R() {
var e = G.A;
return e === null ? null : e.getOwner();
}
function _(e) {
if (t.call(e, "key")) {
var i = Object.getOwnPropertyDescriptor(e, "key").get;
if (i && i.isReactWarning) return !1;
}
return e.key !== void 0;
}
function P(e, i) {
function s() {
ke || (ke = !0, console.error(
"%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://react.dev/link/special-props)",
i
));
}
s.isReactWarning = !0, Object.defineProperty(e, "key", {
get: s,
configurable: !0
});
}
function M() {
var e = r(this.type);
return $e[e] || ($e[e] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), e = this.props.ref, e !== void 0 ? e : null;
}
function Y(e, i, s, w, z, N) {
return s = N.ref, e = {
$$typeof: I,
type: e,
key: i,
props: N,
_owner: z
}, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
enumerable: !1,
get: M
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(e, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
}
function U(e, i, s, w, z, N) {
if (typeof e == "string" || typeof e == "function" || e === J || e === le || e === fe || e === oe || e === ae || e === H || typeof e == "object" && e !== null && (e.$$typeof === ie || e.$$typeof === X || e.$$typeof === ve || e.$$typeof === de || e.$$typeof === ee || e.$$typeof === h || e.getModuleId !== void 0)) {
var E = i.children;
if (E !== void 0)
if (w)
if (m(E)) {
for (w = 0; w < E.length; w++)
$(E[w], e);
Object.freeze && Object.freeze(E);
} else
console.error(
"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 $(E, e);
} else
E = "", (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), e === null ? w = "null" : m(e) ? w = "array" : e !== void 0 && e.$$typeof === I ? (w = "<" + (r(e.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : w = typeof e, console.error(
"React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
w,
E
);
if (t.call(i, "key")) {
E = r(e);
var Q = Object.keys(i).filter(function(L) {
return L !== "key";
});
w = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", Me[E + w] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
`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} />`,
w,
E,
Q,
E
), Me[E + w] = !0);
}
if (E = null, s !== void 0 && (v(s), E = "" + s), _(i) && (v(i.key), E = "" + i.key), "key" in i) {
s = {};
for (var me in i)
me !== "key" && (s[me] = i[me]);
} else s = i;
return E && P(
s,
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
), Y(e, E, N, z, R(), s);
}
function $(e, i) {
if (typeof e == "object" && e && e.$$typeof !== tr) {
if (m(e))
for (var s = 0; s < e.length; s++) {
var w = e[s];
q(w) && F(w, i);
}
else if (q(e))
e._store && (e._store.validated = 1);
else if (e === null || typeof e != "object" ? s = null : (s = K && e[K] || e["@@iterator"], s = typeof s == "function" ? s : null), typeof s == "function" && s !== e.entries && (s = s.call(e), s !== e))
for (; !(e = s.next()).done; )
q(e.value) && F(e.value, i);
}
}
function q(e) {
return typeof e == "object" && e !== null && e.$$typeof === I;
}
function F(e, i) {
if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, i = ne(i), !Ne[i])) {
Ne[i] = !0;
var s = "";
e && e._owner != null && e._owner !== R() && (s = null, typeof e._owner.tag == "number" ? s = r(e._owner.type) : typeof e._owner.name == "string" && (s = e._owner.name), s = " It was passed a child from " + s + ".");
var w = G.getCurrentStack;
G.getCurrentStack = function() {
var z = k(e.type);
return w && (z += w() || ""), z;
}, console.error(
'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
i,
s
), G.getCurrentStack = w;
}
}
function ne(e) {
var i = "", s = R();
return s && (s = r(s.type)) && (i = `
Check the render method of \`` + s + "`."), i || (e = r(e)) && (i = `
Check the top-level render call using <` + e + ">."), i;
}
var W = nr, I = Symbol.for("react.transitional.element"), a = Symbol.for("react.portal"), J = Symbol.for("react.fragment"), fe = Symbol.for("react.strict_mode"), le = Symbol.for("react.profiler"), de = Symbol.for("react.consumer"), ve = Symbol.for("react.context"), ee = Symbol.for("react.forward_ref"), oe = Symbol.for("react.suspense"), ae = Symbol.for("react.suspense_list"), X = Symbol.for("react.memo"), ie = Symbol.for("react.lazy"), H = Symbol.for("react.offscreen"), K = Symbol.iterator, pe = Symbol.for("react.client.reference"), G = W.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, t = Object.prototype.hasOwnProperty, o = Object.assign, h = Symbol.for("react.client.reference"), m = Array.isArray, f = 0, T, b, g, x, O, S, D;
c.__reactDisabledLog = !0;
var n, B, re = !1, ye = new (typeof WeakMap == "function" ? WeakMap : Map)(), tr = Symbol.for("react.client.reference"), ke, $e = {}, Me = {}, Ne = {};
ge.Fragment = J, ge.jsx = function(e, i, s, w, z) {
return U(e, i, s, !1, w, z);
}, ge.jsxs = function(e, i, s, w, z) {
return U(e, i, s, !0, w, z);
};
}()), ge;
}
var qe;
function lr() {
return qe || (qe = 1, process.env.NODE_ENV === "production" ? xe.exports = cr() : xe.exports = fr()), xe.exports;
}
var A = lr(), Se = { exports: {} }, _e = { exports: {} }, C = {};
/** @license React v16.13.1
* react-is.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 We;
function dr() {
if (We) return C;
We = 1;
var r = typeof Symbol == "function" && Symbol.for, y = r ? Symbol.for("react.element") : 60103, v = r ? Symbol.for("react.portal") : 60106, c = r ? Symbol.for("react.fragment") : 60107, l = r ? Symbol.for("react.strict_mode") : 60108, u = r ? Symbol.for("react.profiler") : 60114, p = r ? Symbol.for("react.provider") : 60109, d = r ? Symbol.for("react.context") : 60110, k = r ? Symbol.for("react.async_mode") : 60111, R = r ? Symbol.for("react.concurrent_mode") : 60111, _ = r ? Symbol.for("react.forward_ref") : 60112, P = r ? Symbol.for("react.suspense") : 60113, M = r ? Symbol.for("react.suspense_list") : 60120, Y = r ? Symbol.for("react.memo") : 60115, U = r ? Symbol.for("react.lazy") : 60116, $ = r ? Symbol.for("react.block") : 60121, q = r ? Symbol.for("react.fundamental") : 60117, F = r ? Symbol.for("react.responder") : 60118, ne = r ? Symbol.for("react.scope") : 60119;
function W(a) {
if (typeof a == "object" && a !== null) {
var J = a.$$typeof;
switch (J) {
case y:
switch (a = a.type, a) {
case k:
case R:
case c:
case u:
case l:
case P:
return a;
default:
switch (a = a && a.$$typeof, a) {
case d:
case _:
case U:
case Y:
case p:
return a;
default:
return J;
}
}
case v:
return J;
}
}
}
function I(a) {
return W(a) === R;
}
return C.AsyncMode = k, C.ConcurrentMode = R, C.ContextConsumer = d, C.ContextProvider = p, C.Element = y, C.ForwardRef = _, C.Fragment = c, C.Lazy = U, C.Memo = Y, C.Portal = v, C.Profiler = u, C.StrictMode = l, C.Suspense = P, C.isAsyncMode = function(a) {
return I(a) || W(a) === k;
}, C.isConcurrentMode = I, C.isContextConsumer = function(a) {
return W(a) === d;
}, C.isContextProvider = function(a) {
return W(a) === p;
}, C.isElement = function(a) {
return typeof a == "object" && a !== null && a.$$typeof === y;
}, C.isForwardRef = function(a) {
return W(a) === _;
}, C.isFragment = function(a) {
return W(a) === c;
}, C.isLazy = function(a) {
return W(a) === U;
}, C.isMemo = function(a) {
return W(a) === Y;
}, C.isPortal = function(a) {
return W(a) === v;
}, C.isProfiler = function(a) {
return W(a) === u;
}, C.isStrictMode = function(a) {
return W(a) === l;
}, C.isSuspense = function(a) {
return W(a) === P;
}, C.isValidElementType = function(a) {
return typeof a == "string" || typeof a == "function" || a === c || a === R || a === u || a === l || a === P || a === M || typeof a == "object" && a !== null && (a.$$typeof === U || a.$$typeof === Y || a.$$typeof === p || a.$$typeof === d || a.$$typeof === _ || a.$$typeof === q || a.$$typeof === F || a.$$typeof === ne || a.$$typeof === $);
}, C.typeOf = W, C;
}
var j = {};
/** @license React v16.13.1
* react-is.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 De;
function vr() {
return De || (De = 1, process.env.NODE_ENV !== "production" && function() {
var r = typeof Symbol == "function" && Symbol.for, y = r ? Symbol.for("react.element") : 60103, v = r ? Symbol.for("react.portal") : 60106, c = r ? Symbol.for("react.fragment") : 60107, l = r ? Symbol.for("react.strict_mode") : 60108, u = r ? Symbol.for("react.profiler") : 60114, p = r ? Symbol.for("react.provider") : 60109, d = r ? Symbol.for("react.context") : 60110, k = r ? Symbol.for("react.async_mode") : 60111, R = r ? Symbol.for("react.concurrent_mode") : 60111, _ = r ? Symbol.for("react.forward_ref") : 60112, P = r ? Symbol.for("react.suspense") : 60113, M = r ? Symbol.for("react.suspense_list") : 60120, Y = r ? Symbol.for("react.memo") : 60115, U = r ? Symbol.for("react.lazy") : 60116, $ = r ? Symbol.for("react.block") : 60121, q = r ? Symbol.for("react.fundamental") : 60117, F = r ? Symbol.for("react.responder") : 60118, ne = r ? Symbol.for("react.scope") : 60119;
function W(n) {
return typeof n == "string" || typeof n == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
n === c || n === R || n === u || n === l || n === P || n === M || typeof n == "object" && n !== null && (n.$$typeof === U || n.$$typeof === Y || n.$$typeof === p || n.$$typeof === d || n.$$typeof === _ || n.$$typeof === q || n.$$typeof === F || n.$$typeof === ne || n.$$typeof === $);
}
function I(n) {
if (typeof n == "object" && n !== null) {
var B = n.$$typeof;
switch (B) {
case y:
var re = n.type;
switch (re) {
case k:
case R:
case c:
case u:
case l:
case P:
return re;
default:
var ye = re && re.$$typeof;
switch (ye) {
case d:
case _:
case U:
case Y:
case p:
return ye;
default:
return B;
}
}
case v:
return B;
}
}
}
var a = k, J = R, fe = d, le = p, de = y, ve = _, ee = c, oe = U, ae = Y, X = v, ie = u, H = l, K = P, pe = !1;
function G(n) {
return pe || (pe = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), t(n) || I(n) === k;
}
function t(n) {
return I(n) === R;
}
function o(n) {
return I(n) === d;
}
function h(n) {
return I(n) === p;
}
function m(n) {
return typeof n == "object" && n !== null && n.$$typeof === y;
}
function f(n) {
return I(n) === _;
}
function T(n) {
return I(n) === c;
}
function b(n) {
return I(n) === U;
}
function g(n) {
return I(n) === Y;
}
function x(n) {
return I(n) === v;
}
function O(n) {
return I(n) === u;
}
function S(n) {
return I(n) === l;
}
function D(n) {
return I(n) === P;
}
j.AsyncMode = a, j.ConcurrentMode = J, j.ContextConsumer = fe, j.ContextProvider = le, j.Element = de, j.ForwardRef = ve, j.Fragment = ee, j.Lazy = oe, j.Memo = ae, j.Portal = X, j.Profiler = ie, j.StrictMode = H, j.Suspense = K, j.isAsyncMode = G, j.isConcurrentMode = t, j.isContextConsumer = o, j.isContextProvider = h, j.isElement = m, j.isForwardRef = f, j.isFragment = T, j.isLazy = b, j.isMemo = g, j.isPortal = x, j.isProfiler = O, j.isStrictMode = S, j.isSuspense = D, j.isValidElementType = W, j.typeOf = I;
}()), j;
}
var Ue;
function Ke() {
return Ue || (Ue = 1, process.env.NODE_ENV === "production" ? _e.exports = dr() : _e.exports = vr()), _e.exports;
}
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
var Re, ze;
function pr() {
if (ze) return Re;
ze = 1;
var r = Object.getOwnPropertySymbols, y = Object.prototype.hasOwnProperty, v = Object.prototype.propertyIsEnumerable;
function c(u) {
if (u == null)
throw new TypeError("Object.assign cannot be called with null or undefined");
return Object(u);
}
function l() {
try {
if (!Object.assign)
return !1;
var u = new String("abc");
if (u[5] = "de", Object.getOwnPropertyNames(u)[0] === "5")
return !1;
for (var p = {}, d = 0; d < 10; d++)
p["_" + String.fromCharCode(d)] = d;
var k = Object.getOwnPropertyNames(p).map(function(_) {
return p[_];
});
if (k.join("") !== "0123456789")
return !1;
var R = {};
return "abcdefghijklmnopqrst".split("").forEach(function(_) {
R[_] = _;
}), Object.keys(Object.assign({}, R)).join("") === "abcdefghijklmnopqrst";
} catch {
return !1;
}
}
return Re = l() ? Object.assign : function(u, p) {
for (var d, k = c(u), R, _ = 1; _ < arguments.length; _++) {
d = Object(arguments[_]);
for (var P in d)
y.call(d, P) && (k[P] = d[P]);
if (r) {
R = r(d);
for (var M = 0; M < R.length; M++)
v.call(d, R[M]) && (k[R[M]] = d[R[M]]);
}
}
return k;
}, Re;
}
var Oe, Fe;
function Ae() {
if (Fe) return Oe;
Fe = 1;
var r = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
return Oe = r, Oe;
}
var Pe, Le;
function Qe() {
return Le || (Le = 1, Pe = Function.call.bind(Object.prototype.hasOwnProperty)), Pe;
}
var we, Ve;
function yr() {
if (Ve) return we;
Ve = 1;
var r = function() {
};
if (process.env.NODE_ENV !== "production") {
var y = /* @__PURE__ */ Ae(), v = {}, c = /* @__PURE__ */ Qe();
r = function(u) {
var p = "Warning: " + u;
typeof console < "u" && console.error(p);
try {
throw new Error(p);
} catch {
}
};
}
function l(u, p, d, k, R) {
if (process.env.NODE_ENV !== "production") {
for (var _ in u)
if (c(u, _)) {
var P;
try {
if (typeof u[_] != "function") {
var M = Error(
(k || "React class") + ": " + d + " type `" + _ + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof u[_] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
);
throw M.name = "Invariant Violation", M;
}
P = u[_](p, _, k, d, null, y);
} catch (U) {
P = U;
}
if (P && !(P instanceof Error) && r(
(k || "React class") + ": type specification of " + d + " `" + _ + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof P + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
), P instanceof Error && !(P.message in v)) {
v[P.message] = !0;
var Y = R ? R() : "";
r(
"Failed " + d + " type: " + P.message + (Y ?? "")
);
}
}
}
}
return l.resetWarningCache = function() {
process.env.NODE_ENV !== "production" && (v = {});
}, we = l, we;
}
var Ce, Be;
function mr() {
if (Be) return Ce;
Be = 1;
var r = Ke(), y = pr(), v = /* @__PURE__ */ Ae(), c = /* @__PURE__ */ Qe(), l = /* @__PURE__ */ yr(), u = function() {
};
process.env.NODE_ENV !== "production" && (u = function(d) {
var k = "Warning: " + d;
typeof console < "u" && console.error(k);
try {
throw new Error(k);
} catch {
}
});
function p() {
return null;
}
return Ce = function(d, k) {
var R = typeof Symbol == "function" && Symbol.iterator, _ = "@@iterator";
function P(t) {
var o = t && (R && t[R] || t[_]);
if (typeof o == "function")
return o;
}
var M = "<<anonymous>>", Y = {
array: F("array"),
bigint: F("bigint"),
bool: F("boolean"),
func: F("function"),
number: F("number"),
object: F("object"),
string: F("string"),
symbol: F("symbol"),
any: ne(),
arrayOf: W,
element: I(),
elementType: a(),
instanceOf: J,
node: ve(),
objectOf: le,
oneOf: fe,
oneOfType: de,
shape: oe,
exact: ae
};
function U(t, o) {
return t === o ? t !== 0 || 1 / t === 1 / o : t !== t && o !== o;
}
function $(t, o) {
this.message = t, this.data = o && typeof o == "object" ? o : {}, this.stack = "";
}
$.prototype = Error.prototype;
function q(t) {
if (process.env.NODE_ENV !== "production")
var o = {}, h = 0;
function m(T, b, g, x, O, S, D) {
if (x = x || M, S = S || g, D !== v) {
if (k) {
var n = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
);
throw n.name = "Invariant Violation", n;
} else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
var B = x + ":" + g;
!o[B] && // Avoid spamming the console because they are often not actionable except for lib authors
h < 3 && (u(
"You are manually calling a React.PropTypes validation function for the `" + S + "` prop on `" + x + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
), o[B] = !0, h++);
}
}
return b[g] == null ? T ? b[g] === null ? new $("The " + O + " `" + S + "` is marked as required " + ("in `" + x + "`, but its value is `null`.")) : new $("The " + O + " `" + S + "` is marked as required in " + ("`" + x + "`, but its value is `undefined`.")) : null : t(b, g, x, O, S);
}
var f = m.bind(null, !1);
return f.isRequired = m.bind(null, !0), f;
}
function F(t) {
function o(h, m, f, T, b, g) {
var x = h[m], O = H(x);
if (O !== t) {
var S = K(x);
return new $(
"Invalid " + T + " `" + b + "` of type " + ("`" + S + "` supplied to `" + f + "`, expected ") + ("`" + t + "`."),
{ expectedType: t }
);
}
return null;
}
return q(o);
}
function ne() {
return q(p);
}
function W(t) {
function o(h, m, f, T, b) {
if (typeof t != "function")
return new $("Property `" + b + "` of component `" + f + "` has invalid PropType notation inside arrayOf.");
var g = h[m];
if (!Array.isArray(g)) {
var x = H(g);
return new $("Invalid " + T + " `" + b + "` of type " + ("`" + x + "` supplied to `" + f + "`, expected an array."));
}
for (var O = 0; O < g.length; O++) {
var S = t(g, O, f, T, b + "[" + O + "]", v);
if (S instanceof Error)
return S;
}
return null;
}
return q(o);
}
function I() {
function t(o, h, m, f, T) {
var b = o[h];
if (!d(b)) {
var g = H(b);
return new $("Invalid " + f + " `" + T + "` of type " + ("`" + g + "` supplied to `" + m + "`, expected a single ReactElement."));
}
return null;
}
return q(t);
}
function a() {
function t(o, h, m, f, T) {
var b = o[h];
if (!r.isValidElementType(b)) {
var g = H(b);
return new $("Invalid " + f + " `" + T + "` of type " + ("`" + g + "` supplied to `" + m + "`, expected a single ReactElement type."));
}
return null;
}
return q(t);
}
function J(t) {
function o(h, m, f, T, b) {
if (!(h[m] instanceof t)) {
var g = t.name || M, x = G(h[m]);
return new $("Invalid " + T + " `" + b + "` of type " + ("`" + x + "` supplied to `" + f + "`, expected ") + ("instance of `" + g + "`."));
}
return null;
}
return q(o);
}
function fe(t) {
if (!Array.isArray(t))
return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? u(
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
) : u("Invalid argument supplied to oneOf, expected an array.")), p;
function o(h, m, f, T, b) {
for (var g = h[m], x = 0; x < t.length; x++)
if (U(g, t[x]))
return null;
var O = JSON.stringify(t, function(D, n) {
var B = K(n);
return B === "symbol" ? String(n) : n;
});
return new $("Invalid " + T + " `" + b + "` of value `" + String(g) + "` " + ("supplied to `" + f + "`, expected one of " + O + "."));
}
return q(o);
}
function le(t) {
function o(h, m, f, T, b) {
if (typeof t != "function")
return new $("Property `" + b + "` of component `" + f + "` has invalid PropType notation inside objectOf.");
var g = h[m], x = H(g);
if (x !== "object")
return new $("Invalid " + T + " `" + b + "` of type " + ("`" + x + "` supplied to `" + f + "`, expected an object."));
for (var O in g)
if (c(g, O)) {
var S = t(g, O, f, T, b + "." + O, v);
if (S instanceof Error)
return S;
}
return null;
}
return q(o);
}
function de(t) {
if (!Array.isArray(t))
return process.env.NODE_ENV !== "production" && u("Invalid argument supplied to oneOfType, expected an instance of array."), p;
for (var o = 0; o < t.length; o++) {
var h = t[o];
if (typeof h != "function")
return u(
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + pe(h) + " at index " + o + "."
), p;
}
function m(f, T, b, g, x) {
for (var O = [], S = 0; S < t.length; S++) {
var D = t[S], n = D(f, T, b, g, x, v);
if (n == null)
return null;
n.data && c(n.data, "expectedType") && O.push(n.data.expectedType);
}
var B = O.length > 0 ? ", expected one of type [" + O.join(", ") + "]" : "";
return new $("Invalid " + g + " `" + x + "` supplied to " + ("`" + b + "`" + B + "."));
}
return q(m);
}
function ve() {
function t(o, h, m, f, T) {
return X(o[h]) ? null : new $("Invalid " + f + " `" + T + "` supplied to " + ("`" + m + "`, expected a ReactNode."));
}
return q(t);
}
function ee(t, o, h, m, f) {
return new $(
(t || "React class") + ": " + o + " type `" + h + "." + m + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + f + "`."
);
}
function oe(t) {
function o(h, m, f, T, b) {
var g = h[m], x = H(g);
if (x !== "object")
return new $("Invalid " + T + " `" + b + "` of type `" + x + "` " + ("supplied to `" + f + "`, expected `object`."));
for (var O in t) {
var S = t[O];
if (typeof S != "function")
return ee(f, T, b, O, K(S));
var D = S(g, O, f, T, b + "." + O, v);
if (D)
return D;
}
return null;
}
return q(o);
}
function ae(t) {
function o(h, m, f, T, b) {
var g = h[m], x = H(g);
if (x !== "object")
return new $("Invalid " + T + " `" + b + "` of type `" + x + "` " + ("supplied to `" + f + "`, expected `object`."));
var O = y({}, h[m], t);
for (var S in O) {
var D = t[S];
if (c(t, S) && typeof D != "function")
return ee(f, T, b, S, K(D));
if (!D)
return new $(
"Invalid " + T + " `" + b + "` key `" + S + "` supplied to `" + f + "`.\nBad object: " + JSON.stringify(h[m], null, " ") + `
Valid keys: ` + JSON.stringify(Object.keys(t), null, " ")
);
var n = D(g, S, f, T, b + "." + S, v);
if (n)
return n;
}
return null;
}
return q(o);
}
function X(t) {
switch (typeof t) {
case "number":
case "string":
case "undefined":
return !0;
case "boolean":
return !t;
case "object":
if (Array.isArray(t))
return t.every(X);
if (t === null || d(t))
return !0;
var o = P(t);
if (o) {
var h = o.call(t), m;
if (o !== t.entries) {
for (; !(m = h.next()).done; )
if (!X(m.value))
return !1;
} else
for (; !(m = h.next()).done; ) {
var f = m.value;
if (f && !X(f[1]))
return !1;
}
} else
return !1;
return !0;
default:
return !1;
}
}
function ie(t, o) {
return t === "symbol" ? !0 : o ? o["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && o instanceof Symbol : !1;
}
function H(t) {
var o = typeof t;
return Array.isArray(t) ? "array" : t instanceof RegExp ? "object" : ie(o, t) ? "symbol" : o;
}
function K(t) {
if (typeof t > "u" || t === null)
return "" + t;
var o = H(t);
if (o === "object") {
if (t instanceof Date)
return "date";
if (t instanceof RegExp)
return "regexp";
}
return o;
}
function pe(t) {
var o = K(t);
switch (o) {
case "array":
case "object":
return "an " + o;
case "boolean":
case "date":
case "regexp":
return "a " + o;
default:
return o;
}
}
function G(t) {
return !t.constructor || !t.constructor.name ? M : t.constructor.name;
}
return Y.checkPropTypes = l, Y.resetWarningCache = l.resetWarningCache, Y.PropTypes = Y, Y;
}, Ce;
}
var je, He;
function br() {
if (He) return je;
He = 1;
var r = /* @__PURE__ */ Ae();
function y() {
}
function v() {
}
return v.resetWarningCache = y, je = function() {
function c(p, d, k, R, _, P) {
if (P !== r) {
var M = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
);
throw M.name = "Invariant Violation", M;
}
}
c.isRequired = c;
function l() {
return c;
}
var u = {
array: c,
bigint: c,
bool: c,
func: c,
number: c,
object: c,
string: c,
symbol: c,
any: c,
arrayOf: l,
element: c,
elementType: c,
instanceOf: l,
node: c,
objectOf: l,
oneOf: l,
oneOfType: l,
shape: l,
exact: l,
checkPropTypes: v,
resetWarningCache: y
};
return u.PropTypes = u, u;
}, je;
}
var Je;
function Er() {
if (Je) return Se.exports;
if (Je = 1, process.env.NODE_ENV !== "production") {
var r = Ke(), y = !0;
Se.exports = /* @__PURE__ */ mr()(r.isElement, y);
} else
Se.exports = /* @__PURE__ */ br()();
return Se.exports;
}
var gr = /* @__PURE__ */ Er();
const V = /* @__PURE__ */ ur(gr), ue = {
// top, tl, tr, br, bl, bottom, mid
0: [!0, !0, !0, !0, !0, !0, !1],
1: [!1, !1, !0, !0, !1, !1, !1],
2: [!0, !1, !0, !1, !0, !0, !0],
3: [!0, !1, !0, !0, !1, !0, !0],
4: [!1, !0, !0, !0, !1, !1, !0],
5: [!0, !0, !1, !0, !1, !0, !0],
6: [!0, !0, !1, !0, !0, !0, !0],
7: [!0, !1, !0, !0, !1, !1, !1],
8: [!0, !0, !0, !0, !0, !0, !0],
9: [!0, !0, !0, !0, !1, !0, !0]
}, ce = ({ number: r = 0 }) => /* @__PURE__ */ A.jsxs("div", { className: "digital-number", children: [
/* @__PURE__ */ A.jsx("span", { className: `top horizontal ${ue[r][0] ? "on" : "off"}` }),
/* @__PURE__ */ A.jsx("span", { className: `top left vertical ${ue[r][1] ? "on" : "off"}` }),
/* @__PURE__ */ A.jsx("span", { className: `top right vertical ${ue[r][2] ? "on" : "off"}` }),
/* @__PURE__ */ A.jsx("span", { className: `bottom right vertical ${ue[r][3] ? "on" : "off"}` }),
/* @__PURE__ */ A.jsx("span", { className: `bottom left vertical ${ue[r][4] ? "on" : "off"}` }),
/* @__PURE__ */ A.jsx("span", { className: `bottom horizontal ${ue[r][5] ? "on" : "off"}` }),
/* @__PURE__ */ A.jsx("span", { className: `mid horizontal ${ue[r][6] ? "on" : "off"}` })
] });
ce.propTypes = {
number: V.number
};
const hr = {
visible: "1.0",
hidden: "0",
partially: "0.2"
};
function he({ text: r = "", visibility: y = "visible" }) {
return /* @__PURE__ */ A.jsx("span", { style: { opacity: hr[y] }, children: r });
}
he.PropTypes = {
text: V.string,
visibility: V.oneOf(["hidden", "partially", "visible"])
};
const Ze = ({ hours: r, minutes: y, seconds: v }) => /* @__PURE__ */ A.jsxs("div", { className: "digital-time", children: [
/* @__PURE__ */ A.jsx(ce, { number: +r[0] }),
/* @__PURE__ */ A.jsx(ce, { number: +r[1] }),
/* @__PURE__ */ A.jsx("span", { className: "colon", children: ":" }),
/* @__PURE__ */ A.jsx(ce, { number: +y[0] }),
/* @__PURE__ */ A.jsx(ce, { number: +y[1] }),
/* @__PURE__ */ A.jsx("span", { className: "colon", children: ":" }),
/* @__PURE__ */ A.jsx(ce, { number: +v[0] }),
/* @__PURE__ */ A.jsx(ce, { number: +v[1] })
] });
Ze.propTypes = {
hours: V.string,
minutes: V.string,
seconds: V.string
};
const Tr = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"], er = ({ today: r }) => /* @__PURE__ */ A.jsx("div", { className: "weekdays", children: Tr.map((y, v) => /* @__PURE__ */ A.jsx(
he,
{
text: y,
visibility: v === r ? "visible" : "partially"
},
y
)) });
er.propTypes = {
day: V.number
};
const rr = ({ amPm: r }) => {
const y = r === "AM";
return /* @__PURE__ */ A.jsxs("div", { className: "ampm", children: [
/* @__PURE__ */ A.jsx(he, { text: "AM", visibility: y ? "visible" : "hidden" }),
/* @__PURE__ */ A.jsx(he, { text: "PM", visibility: y ? "hidden" : "visible" })
] });
};
rr.propTypes = {
amPm: V.string
};
function Ge(r = Intl.DateTimeFormat().resolvedOptions().timeZone) {
const [y, v] = or(() => Xe(/* @__PURE__ */ new Date(), r)), c = ar(null), l = ir(() => {
try {
return Intl.DateTimeFormat(void 0, { timeZone: r }).format(), r.replace("/", " - ").replace("_", " ");
} catch {
return;
}
}, [r]);
return sr(() => (c.current = setInterval(() => {
v(Xe(/* @__PURE__ */ new Date(), r));
}, 1e3), () => clearInterval(c.current)), [r]), { time: y, title: l };
}
function Xe(r, y) {
try {
const v = new Intl.DateTimeFormat("en-GB", {
timeZone: y,
hour12: !1,
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
}).formatToParts(r), c = {};
for (const { type: l, value: u } of v)
l !== "literal" && (c[l] = u);
return /* @__PURE__ */ new Date(
`${c.year}-${c.month}-${c.day}T${c.hour}:${c.minute}:${c.second}`
);
} catch {
return /* @__PURE__ */ new Date();
}
}
const xr = ({
size: r = 250,
bgColor: y = "#d3d3d3",
fgColor: v = "#232323",
hoverColor: c = "rgba(197,197,197,0.44)",
format: l = "24h",
timezone: u
}) => {
const { time: p, title: d } = u ? Ge(u) : Ge(), k = l === "24h" ? p.getHours().toString().padStart(2, "0") : (p.getHours() % 12).toString().padStart(2, "0"), R = p.getMinutes().toString().padStart(2, "0"), _ = p.getSeconds().toString().padStart(2, "0"), P = p.getDay(), M = p.getHours() >= 12 ? "PM" : "AM";
return /* @__PURE__ */ A.jsxs(
"div",
{
className: "digital-clock",
style: {
"--clock-size": `${r}px`,
"--clock-bg": y,
"--clock-fg": v,
"--clock-hover": c,
// only add height if timezone is set:
...u && d ? { height: "calc(var(--clock-size) * 0.4)" } : {}
},
children: [
/* @__PURE__ */ A.jsxs("div", { className: "top", children: [
u && d ? /* @__PURE__ */ A.jsx(he, { text: d, visibility: "visible" }) : "",
/* @__PURE__ */ A.jsx(er, { today: P })
] }),
/* @__PURE__ */ A.jsxs("div", { className: "bottom", children: [
/* @__PURE__ */ A.jsx(Ze, { hours: k, minutes: R, seconds: _ }),
l === "12h" ? /* @__PURE__ */ A.jsx(rr, { amPm: M }) : ""
] })
]
}
);
};
xr.propTypes = {
size: V.number,
bgColor: V.string,
fgColor: V.string,
hoverColor: V.string,
format: V.oneOf(["24h", "12h"]),
timezone: V.string
};
export {
xr as DigitalClock
};